Files
discord-decomp/sources/modules/build_overrides/validateBuildOverride.tsx
T
2026-07-28 01:06:53 +03:00

356 lines
16 KiB
TypeScript

/* Metro module 10561; source: modules/build_overrides/validateBuildOverride.tsx; dependencies: [57, 1226, 4103, 661, 1244, 22, 2] */
import Module00057 from '../../by-id/module-00057.js'; /* Metro dependency 57 */
import AuthenticationStore from '../../stores/AuthenticationStore.tsx'; /* Metro dependency 1226 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
import * as IndexNativeModule from '../../intl/index.native.tsx'; /* Metro dependency 1244 */
import * as BuildOverrideConstantsModule from './BuildOverrideConstants.tsx'; /* Metro dependency 4103 */
function _fun81434(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#81434, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10747:6, offset: 0x01ecf390, size: 200 bytes, params: 8, frame: 19
const env0_0 = require;
const _arrayLikeToArray_81437 = function(a0, a1) {
var r0;
var r1;
var r2;
var value3;
var length;
var value5;
var value = undefined;
var value2 = value == null;
reducibleJoin2: while (true) {
if (value2) {
r0 = value2;
break reducibleJoin2;
}
value3 = value > a0.length;
r0 = value3;
break reducibleJoin2;
}
reducibleJoin4: while (true) {
if (r0) {
length = a0.length;
r1 = length;
break reducibleJoin4;
}
r1 = value;
break reducibleJoin4;
}
value = (0, global.Array)(r1);
var value4 = 0;
if (value4 < r1) {
r2 = value4;
reducibleLoop5: while (true) {
value[r2] = a0[r2];
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
if (value5 < r1) {
r2 = value5;
continue reducibleLoop5;
}
break reducibleLoop5;
}
}
return value;
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
(FileImportTrackerModule).fileFinishedImporting('modules/build_overrides/validateBuildOverride.tsx');
exports.default = validateBuildOverride;
function _createForOfIteratorHelperLoose_81435(a0, a1) { // fn#81435, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10747:192, offset: 0x01ecf458, size: 372 bytes, params: 3, frame: 20
var r6;
var r9;
var r5;
var value3;
var regexp;
const env0_0 = a0;
const Symbol = global.Symbol;
let value = typeof Symbol !== 'undefined';
let r1 = value && a0[global.Symbol.iterator];
r1 = !r1 ? a0['@@iterator'] : r1;
if (r1) {
value = r1.call(a0);
return value.next.bind(value);
}
const Array = global.Array;
if (Array.isArray(a0)) {
if (r1) {
}
return _fun81436;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_81437(a0, value);
r5 = value;
} else {
value3 = ({}).toString.call(a0).slice(8, -1);
r6 = value3 === 'Object' && a0.constructor;
r9 = r6 ? a0.constructor.name : value3;
if (r9 === 'Map') {
r6 = global.Array.from(a0);
} else if (r9 === 'Set') {
r6 = global.Array.from(a0);
} else if (r9 === 'Arguments') {
value = _arrayLikeToArray_81437(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_81437(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun81436;
}
const TypeError = global.TypeError;
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
function _fun81436() { // fn#81436, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10747:763, offset: 0x00c39d73, size: 69 bytes, params: 1, frame: 5
return env0_1 >= env0_0.length ? {done: true} : {done: false,
value: env0_0[typeof env0_1 === 'bigint' ? env0_1 : +env0_1]};
}
}
function validateBuildOverride(a0, a1, a2) { // fn#81438, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10747:1197, offset: 0x01ecf5cc, size: 1035 bytes, params: 4, frame: 31
var environment;
var r12;
var r6;
var object2;
var r8;
var releaseChannel;
var expiresAt;
var validForUserIds;
var allowedVersions;
var targetBuildOverride;
var Object;
var keys;
var value2;
var value3;
var defaultImport;
var intersection;
var length;
var window;
var GLOBAL_ENV;
var RELEASE_CHANNEL;
var value4;
var includes;
var value5;
var value6;
var split;
var value7;
var property;
var value8;
var value9;
var done;
var value10;
var value11;
var value12;
var property2;
var value13;
const intl = (IndexNativeModule).intl;
var formatToPlainString;
const t = (IndexNativeModule).t;
var Date;
var prototype;
var value14;
var date;
var value15;
var getTime;
var value16;
var now;
var authenticationStoreBinding;
var getId;
var string;
var qZgV0a;
var value17;
var concat;
var wySUzv;
let value = null;
if (value != a0) {
reducibleJoin30: while (true) {
if (value != a1) {
releaseChannel = a0.releaseChannel;
expiresAt = a0.expiresAt;
validForUserIds = a0.validForUserIds;
allowedVersions = a0.allowedVersions;
targetBuildOverride = a0.targetBuildOverride;
Object = global.Object;
keys = Object.keys;
value2 = Reflect.apply(keys, Object, [targetBuildOverride]);
value3 = environment;
defaultImport = importDefault(22) /* metro dependency 22 */;
intersection = defaultImport.intersection;
length = Reflect.apply(intersection, defaultImport, [value2, a1]).length;
if (length === 0) {
formatToPlainString = intl.formatToPlainString;
wySUzv = t.wySUzv;
value = value2.map(_fun81439);
return {valid: false, reason: Reflect.apply(formatToPlainString, intl, [wySUzv,
{requestedTargets: value.join(', ')}])};
}
if (value != releaseChannel) {
window = global.window;
GLOBAL_ENV = window.GLOBAL_ENV;
RELEASE_CHANNEL = GLOBAL_ENV.RELEASE_CHANNEL;
reducibleJoin5: while (true) {
if (releaseChannel !== RELEASE_CHANNEL) {
if (releaseChannel === PublicReleaseChannels.PTB) {
r8 = releaseChannel.toUpperCase();
} else {
value = releaseChannel.charAt(0);
value = value.toUpperCase();
value17 = releaseChannel.slice(1);
concat = global.HermesInternal.concat;
value = '' + value + value17;
r8 = value;
}
return {valid: false, reason: intl.formatToPlainString(t.GOEF0C, {releaseChannel: r8})};
}
break reducibleJoin5;
}
}
if (value != allowedVersions) {
value4 = false;
reducibleJoin12: while (true) {
if (value == a2) {
r6 = value4;
break reducibleJoin12;
}
includes = allowedVersions.includes;
value5 = Reflect.apply(includes, allowedVersions, [a2]);
value6 = true;
if (value5) {
r6 = value6;
break reducibleJoin12;
}
split = a2.split;
value7 = Reflect.apply(split, a2, ['.']);
property = Module00057(value7, 1)[0];
value8 = _createForOfIteratorHelperLoose_81435(allowedVersions);
value9 = value8();
done = value9.done;
if (done) {
r6 = value4;
break reducibleJoin12;
}
r12 = value9;
reducibleLoop9: while (true) {
value10 = r12.value;
split = value10.split;
value11 = Reflect.apply(split, value10, ['.']);
value12 = Module00057(value11, 2);
property2 = value12[0];
if (value12[1] === '*') {
reducibleJoin11: while (true) {
if (property === property2) {
r6 = value6;
break reducibleJoin12;
}
break reducibleJoin11;
}
}
value13 = value8();
done = value13.done;
if (done) {
r6 = value4;
break reducibleJoin12;
}
r12 = value13;
continue reducibleLoop9;
}
}
reducibleJoin14: while (true) {
if (!r6) {
return {valid: value4, reason: intl.formatToPlainString(t.GOEF0C,
{releaseChannel: allowedVersions.join(', ')})};
}
break reducibleJoin14;
}
}
reducibleJoin16: while (true) {
if (value != expiresAt) {
Date = global.Date;
prototype = Date.prototype;
value14 = Object.create(prototype, {constructor: {value: Date}});
date = new Date();
value15 = date instanceof Object ? date : value14;
getTime = value15.getTime;
value16 = Reflect.apply(getTime, value15, []);
r6 = value16;
break reducibleJoin16;
}
r6 = value;
break reducibleJoin16;
}
reducibleJoin24: while (true) {
reducibleJoin22: while (true) {
if (value == r6) {
if (validForUserIds.length > 0) {
includes = validForUserIds.includes;
authenticationStoreBinding = AuthenticationStore;
getId = authenticationStoreBinding.getId;
if (!Reflect.apply(includes, validForUserIds, [Reflect.apply(getId,
authenticationStoreBinding,
[])])) {
string = intl.string;
qZgV0a = t.qZgV0a;
object2 = {valid: false, reason: Reflect.apply(string, intl, [qZgV0a])};
break reducibleJoin22;
}
}
object2 = {valid: true};
break reducibleJoin22;
}
Date = global.Date;
now = Date.now;
if (r6 < Reflect.apply(now, Date, [])) {
string = intl.string;
object2 = {valid: false, reason: Reflect.apply(string, intl, [t['8eRE6S']])};
break reducibleJoin24;
}
length = validForUserIds.length;
if (length > 0) {
includes = validForUserIds.includes;
authenticationStoreBinding = AuthenticationStore;
getId = authenticationStoreBinding.getId;
if (!Reflect.apply(includes, validForUserIds, [Reflect.apply(getId,
authenticationStoreBinding,
[])])) {
string = intl.string;
qZgV0a = t.qZgV0a;
object2 = {valid: false, reason: Reflect.apply(string, intl, [qZgV0a])};
break reducibleJoin22;
}
}
object2 = {valid: true};
break reducibleJoin22;
}
break reducibleJoin24;
}
return object2;
}
break reducibleJoin30;
}
}
return {valid: false, reason: intl.string(t.d34xi4)};
function _fun81439(a0) { // fn#81439, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10747:1577, offset: 0x01ecf9d7, size: 32 bytes, params: 2, frame: 3
const value = environment.__proto__;
return BUILD_OVERRIDE_TARGET_NAMES[a0] ?? 'unknown';
}
}
}
global.__d(_fun81434, 10561, [57, 1226, 4103, 661, 1244, 22,
2]) /* metro module 10561, dependencies: [57, 1226, 4103, 661, 1244, 22, 2] */;