Files
discord-decomp/sources/modules/libdiscore/LibdiscoreExperimentManager.tsx
2026-07-28 01:06:53 +03:00

313 lines
14 KiB
TypeScript

/* Metro module 16193; source: modules/libdiscore/LibdiscoreExperimentManager.tsx; dependencies: [6, 7, 15, 17, 18, 1220, 1873, 1870, 628, 1854, 4860, 2] */
import ClassCallCheck from '../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
import CreateClass from '../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */
import PossibleConstructorReturn from '../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
import Module00017 from '../../by-id/module-00017.js'; /* Metro dependency 17 */
import Inherits from '../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */
import ApexExperimentStore from '../experiments/apex/ApexExperimentStore.tsx'; /* Metro dependency 1220 */
import AutomaticLifecycleManager from '../../lib/AutomaticLifecycleManager.tsx'; /* Metro dependency 4860 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as LibdiscoreExperimentsModule from './libdiscoreExperiments.tsx'; /* Metro dependency 1870 */
import * as ShimNativeModule from '../../external/discord_common/js/packages/libdiscore/js_shim/js/shim.native.tsx'; /* Metro dependency 1873 */
function _fun125124(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#125124, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16401:6, offset: 0x025cec92, size: 296 bytes, params: 8, frame: 19
const env0_0 = require;
const _arrayLikeToArray_125130 = 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 initializeAllExperiments = function() {
var ALL_LIBDISCORE_EXPERIMENTS = require(dependencyMap[7]).ALL_LIBDISCORE_EXPERIMENTS;
ALL_LIBDISCORE_EXPERIMENTS.forEach(_fun125133);
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = AutomaticLifecycleManager;
value = _fun125136(value);
value = new value();
(FileImportTrackerModule).fileFinishedImporting('modules/libdiscore/LibdiscoreExperimentManager.tsx');
exports.default = value;
function _isNativeReflectConstruct_125125() { // fn#125125, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16401:160, offset: 0x025cedba, size: 98 bytes, params: 1, frame: 18
var Boolean;
var prototype;
var valueOf;
var call;
var Reflect;
var construct;
var closure;
var value;
var error;
try {
Boolean = global.Boolean;
prototype = Boolean.prototype;
valueOf = prototype.valueOf;
call = valueOf.call;
Reflect = global.Reflect;
construct = Reflect.construct;
Boolean = global.Boolean;
closure = function() {
};
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
value = Reflect.apply(call, valueOf, [value]);
var result = !value;
} catch (error) {
}
return (_isNativeReflectConstruct_125125_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _createForOfIteratorHelperLoose_125128(a0, a1) { // fn#125128, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16401:353, offset: 0x025cee1c, 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 _fun125129;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_125130(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_125130(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_125130(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun125129;
}
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 _fun125129() { // fn#125129, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16401:924, 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 experimentStoreUpdateHandler() { // fn#125131, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16401:1274, offset: 0x025cef90, size: 273 bytes, params: 1, frame: 18
var object3;
var r4;
var r3;
var moduleValue2;
var isExperimentSyncDisabled;
var object;
var _createForOfIteratorHelperLoose_125128Binding;
var ALL_LIBDISCORE_EXPERIMENTS;
var value2;
var value3;
var done;
var value4;
var id;
var getCurrentConfig;
var value5;
var value6;
var defaultImport;
var value7;
var moduleValue3;
var getExperimentCacher;
var value8;
var flushToCache;
var JSON;
var stringify;
reducibleJoin8: while (true) {
if (ShimNativeModule.isLibdiscoreInitialized()) {
moduleValue2 = require(1870) /* metro dependency 1870: libdiscoreExperiments */;
isExperimentSyncDisabled = moduleValue2.isExperimentSyncDisabled;
if (Reflect.apply(isExperimentSyncDisabled, moduleValue2, [])) {
break reducibleJoin8;
}
object = {};
_createForOfIteratorHelperLoose_125128Binding = _createForOfIteratorHelperLoose_125128;
ALL_LIBDISCORE_EXPERIMENTS = (require(1870) /* metro dependency 1870: libdiscoreExperiments */).ALL_LIBDISCORE_EXPERIMENTS;
value2 = _createForOfIteratorHelperLoose_125128Binding(ALL_LIBDISCORE_EXPERIMENTS);
value3 = value2();
done = value3.done;
if (!done) {
r4 = value3;
reducibleLoop3: while (true) {
value4 = r4.value;
id = value4.id;
getCurrentConfig = value4.getCurrentConfig;
object[id] = Reflect.apply(getCurrentConfig, value4, []);
value5 = value2();
done = value5.done;
if (done) {
break reducibleLoop3;
}
r4 = value5;
continue reducibleLoop3;
}
}
value6 = object3 != null;
reducibleJoin6: while (true) {
if (value6) {
defaultImport = importDefault(628) /* metro dependency 628: shallowEqual */;
value7 = defaultImport(object3, object);
r3 = value7;
break reducibleJoin6;
}
r3 = value6;
break reducibleJoin6;
}
if (r3) {
break reducibleJoin8;
}
moduleValue3 = ShimNativeModule;
getExperimentCacher = moduleValue3.getExperimentCacher;
value8 = Reflect.apply(getExperimentCacher, moduleValue3, []);
flushToCache = value8.flushToCache;
JSON = global.JSON;
stringify = JSON.stringify;
Reflect.apply(flushToCache, value8, [Reflect.apply(stringify, JSON, [object])]);
object3 = object;
break reducibleJoin8;
}
break reducibleJoin8;
}
}
function initializeAllExperiments() { // fn#125132, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16401:1629, offset: 0x025cf0a1, size: 52 bytes, params: 1, frame: 12
const ALL_LIBDISCORE_EXPERIMENTS = (LibdiscoreExperimentsModule).ALL_LIBDISCORE_EXPERIMENTS;
ALL_LIBDISCORE_EXPERIMENTS.forEach(function(a0) {
a0.setExperiment(_fun125134(a0));
});
function _fun125133(a0) { // fn#125133, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16401:1710, offset: 0x025cf0d5, size: 34 bytes, params: 2, frame: 12
a0.setExperiment(createApexExperimentWrapper(a0));
function createApexExperimentWrapper(a0) { // fn#125134, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16401:1730, offset: 0x025cf0f7, size: 133 bytes, params: 2, frame: 16
var environment;
let value = environment.__proto__.__proto__;
value = require(1854) /* metro dependency 1854: apex */;
const createApexExperiment = value.createApexExperiment;
const object = {kind: 'user'};
object.name = a0.id;
object.defaultConfig = {treatmentId: -1};
const Object = global.Object;
const fromEntries = Object.fromEntries;
const treatments = a0.getTreatments();
object.variations = Reflect.apply(fromEntries, Object, [treatments.map(function({treatmentId}) {
return [treatmentId, {treatmentId: treatmentId}];
})]);
return Reflect.apply(createApexExperiment, value, [object]);
}
}
}
function _fun125136(a0) { // fn#125136, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16401:1976, offset: 0x025cf19a, size: 97 bytes, params: 2, frame: 16
const LibdiscoreExperimentManager2 = LibdiscoreExperimentManager;
Inherits(LibdiscoreExperimentManager2, a0);
return CreateClass(LibdiscoreExperimentManager2, [{key: '_initialize', value: function() {
initializeAllExperiments();
}}, {key: '_terminate', value: function() {
}}]);
function LibdiscoreExperimentManager(a0) { // fn#125137, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16401:1988, offset: 0x025cf1fb, size: 187 bytes, params: 2, frame: 20
var r0;
var Reflect;
let value = copyRestArgs(0, undefined);
let binding = env1_3;
binding(this, LibdiscoreExperimentManager);
const items2 = [];
arraySpread(items2, value, 0, items2);
value = env1_6(LibdiscoreExperimentManager);
binding = env1_5;
if (_isNativeReflectConstruct_125125()) {
Reflect = global.Reflect;
value = Reflect.construct(value, items2, env1_6(this).constructor);
r0 = value;
} else {
value = value.apply(this, items2);
r0 = value;
}
value = binding(this, r0);
value.actions = {};
const Map = global.Map;
const map = new Map();
value.stores = map.set(ApexExperimentStore, experimentStoreUpdateHandler);
return value;
}
}
}
global.__d(_fun125124, 16193, [6, 7, 15, 17, 18, 1220, 1873, 1870, 628, 1854, 4860,
2]) /* metro module 16193, dependencies: [6, 7, 15, 17, 18, 1220, 1873, 1870, 628, 1854, 4860, 2] */;