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

568 lines
23 KiB
TypeScript

/* Metro module 16217; source: modules/sentry/SentryExperimentFeatureFlagManager.tsx; dependencies: [7, 6, 15, 17, 18, 4107, 1220, 3969, 1216, 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 SelectedGuildStore from '../../stores/SelectedGuildStore.tsx'; /* Metro dependency 3969 */
import ExperimentStore from '../experiments/ExperimentStore.tsx'; /* Metro dependency 4107 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
function _fun125348(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#125348, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16425:6, offset: 0x025d57b6, size: 359 bytes, params: 8, frame: 19
const _arrayLikeToArray_125354 = 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 isLikelyControl = function(a0, a1) {
var r0;
if (a0 == null) {
return true;
}
var property = a0.variations[a1];
var value = property == null;
if (value) {
r0 = value;
} else {
value = global.JSON.stringify(property);
property = global.JSON;
value = value === property.stringify(a0.defaultConfig);
r0 = value;
}
return r0;
};
const flushFlags = function(a0, a1) {
var r2;
var value4;
var defaultImport;
var value5;
a0.sort();
var value2 = _createForOfIteratorHelperLoose_125352(a0);
var value3 = value2();
if (!value3.done) {
r2 = value3;
while (true) {
value4 = r2.value;
defaultImport = importDefault(dependencyMap[8]);
defaultImport.addFeatureFlag(value4, true);
if (a1 != null) {
a1.add(value4);
}
value5 = value2();
if (value5.done) {
break;
}
r2 = value5;
continue;
}
}
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const Set = global.Set;
let set = new Set();
set = importDefault(4860) /* metro dependency 4860: AutomaticLifecycleManager */;
set = _fun125358(set);
set = new set();
(FileImportTrackerModule).fileFinishedImporting('modules/sentry/SentryExperimentFeatureFlagManager.tsx');
exports.default = set;
function _isNativeReflectConstruct_125349() { // fn#125349, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16425:180, offset: 0x025d591d, 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_125349_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _createForOfIteratorHelperLoose_125352(a0, a1) { // fn#125352, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16425:373, offset: 0x025d597f, 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 _fun125353;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_125354(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_125354(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_125354(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun125353;
}
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 _fun125353() { // fn#125353, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16425:944, 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 syncAllExperimentFlags() { // fn#125357, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16425:1596, offset: 0x025d5bb6, size: 1081 bytes, params: 1, frame: 64
var r3;
var r13;
var r17;
var r11;
var r25;
var r10;
var r41;
var r36;
var r30;
var r32;
var r50;
var r15;
var r12;
var value5;
var defaultImport;
var addFeatureFlag;
var value6;
var propertyName;
var propertyName2;
var property;
var value9;
var value10;
var includes;
var push;
var HermesInternal;
var concat;
var value11;
var startsWith;
var value12;
var split;
var property2;
var propertyName3;
var getHash;
var value17;
var properties6;
var properties7;
var propertyName4;
var assignments;
var properties8;
var properties9;
var properties10;
var propertyName5;
var variantId;
var value18;
var value19;
var guild;
var properties11;
var properties12;
var propertyName6;
var assignments2;
var value20;
const _createForOfIteratorHelperLoose_125352Binding = _createForOfIteratorHelperLoose_125352;
const value2 = undefined;
const value3 = _createForOfIteratorHelperLoose_125352Binding(env0_10);
const value4 = value3();
let done = value4.done;
if (!done) {
r3 = value4;
reducibleLoop1: while (true) {
value5 = r3.value;
defaultImport = importDefault(1216) /* metro dependency 1216: SentryUtilsNative */;
addFeatureFlag = defaultImport.addFeatureFlag;
Reflect.apply(addFeatureFlag, defaultImport, [value5, false]);
value6 = value3();
done = value6.done;
if (done) {
break reducibleLoop1;
}
r3 = value6;
continue reducibleLoop1;
}
}
env0_10.clear();
const items7 = [];
const items2 = [];
const items3 = [];
const items4 = [];
const items5 = [];
const items6 = [];
const guildId = SelectedGuildStore.getGuildId();
const allExperimentAssignments = ExperimentStore.getAllExperimentAssignments();
let properties = Object.keys(allExperimentAssignments);
const properties2 = 0;
const properties3 = properties.length;
if (properties !== value2) {
r13 = properties2;
reducibleLoop3: while (true) {
propertyName = properties[r13];
propertyName2 = r13 + 1;
if (propertyName === value2) {
break reducibleLoop3;
}
property = allExperimentAssignments[propertyName];
value9 = property == null;
reducibleJoin6: while (true) {
if (value9) {
r17 = value9;
break reducibleJoin6;
}
value10 = property <= 0;
r17 = value10;
break reducibleJoin6;
}
if (r17) {
r13 = propertyName2;
continue reducibleLoop3;
}
includes = propertyName.includes;
if (Reflect.apply(includes, propertyName, [':'])) {
value11 = guildId != null;
reducibleJoin11: while (true) {
if (value11) {
startsWith = propertyName.startsWith;
HermesInternal = global.HermesInternal;
concat = HermesInternal.concat;
value12 = Reflect.apply(startsWith, propertyName, ['' + guildId + ':']);
r17 = value12;
break reducibleJoin11;
}
r17 = value11;
break reducibleJoin11;
}
if (r17) {
push = items2.push;
split = propertyName.split;
property2 = Reflect.apply(split, propertyName, [':'])[1];
concat = global.HermesInternal.concat;
Reflect.apply(push, items2, ['' + property2 + ':' + property]);
r13 = propertyName2;
continue reducibleLoop3;
}
r13 = propertyName2;
continue reducibleLoop3;
}
push = items7.push;
HermesInternal = global.HermesInternal;
concat = HermesInternal.concat;
Reflect.apply(push, items7, ['' + propertyName + ':' + property]);
r13 = propertyName2;
continue reducibleLoop3;
}
}
const registeredExperiments = ApexExperimentStore.getRegisteredExperiments();
const registeredExperiments2 = ApexExperimentStore.getRegisteredExperiments();
const object = {};
properties = Object.keys(registeredExperiments2);
const properties4 = 0;
const properties5 = properties.length;
if (properties !== value2) {
r11 = properties4;
reducibleLoop14: while (true) {
propertyName = properties[r11];
propertyName3 = r11 + 1;
if (propertyName === value2) {
break reducibleLoop14;
}
apexExperimentStoreBinding = ApexExperimentStore;
getHash = apexExperimentStoreBinding.getHash;
object[Reflect.apply(getHash, apexExperimentStoreBinding, [propertyName])] = propertyName;
r11 = propertyName3;
continue reducibleLoop14;
}
}
apexExperimentStoreBinding = ApexExperimentStore;
const getState = apexExperimentStoreBinding.getState;
const evaluatedExperiments = Reflect.apply(getState, apexExperimentStoreBinding, []).evaluatedExperiments;
const value15 = _createForOfIteratorHelperLoose_125352(['user', 'installation']);
const value16 = value15();
done = value16.done;
if (!done) {
r25 = value16;
reducibleLoop17: while (true) {
value17 = r25.value;
reducibleJoin19: while (true) {
if (evaluatedExperiments == null) {
r10 = value2;
break reducibleJoin19;
}
property = evaluatedExperiments[value17];
r10 = property;
break reducibleJoin19;
}
properties = Object.keys(r10);
properties6 = 0;
properties7 = properties.length;
if (properties !== value2) {
r41 = properties6;
reducibleLoop20: while (true) {
propertyName = properties[r41];
propertyName4 = r41 + 1;
if (propertyName === value2) {
break reducibleLoop20;
}
property = evaluatedExperiments[value17];
reducibleJoin23: while (true) {
if (property == null) {
r36 = value2;
break reducibleJoin23;
}
property = property[propertyName];
r36 = property;
break reducibleJoin23;
}
reducibleJoin25: while (true) {
if (r36 != null) {
r30 = r36;
break reducibleJoin25;
}
r30 = {};
break reducibleJoin25;
}
assignments = r30.assignments;
properties8 = Object.keys(assignments);
properties9 = 0;
properties10 = properties8.length;
if (properties8 === value2) {
r41 = propertyName4;
continue reducibleLoop20;
}
r32 = properties9;
reducibleLoop26: while (true) {
propertyName = properties8[r32];
propertyName5 = r32 + 1;
if (propertyName === value2) {
r41 = propertyName4;
continue reducibleLoop20;
}
property = object[propertyName];
if (property == null) {
r32 = propertyName5;
continue reducibleLoop26;
}
variantId = assignments[propertyName].variantId;
if (variantId == null) {
r32 = propertyName5;
continue reducibleLoop26;
}
HermesInternal = global.HermesInternal;
concat = HermesInternal.concat;
value18 = '' + property + ':' + variantId;
r50 = isLikelyControl(registeredExperiments[property], variantId) ? items3 : items5;
push = r50.push;
Reflect.apply(push, r50, [value18]);
r32 = propertyName5;
continue reducibleLoop26;
}
continue reducibleLoop20;
}
}
value19 = value15();
done = value19.done;
if (done) {
break reducibleLoop17;
}
r25 = value19;
continue reducibleLoop17;
}
}
reducibleJoin43: while (true) {
if (guildId == null) {
break reducibleJoin43;
}
reducibleJoin36: while (true) {
if (evaluatedExperiments == null) {
r15 = value2;
break reducibleJoin36;
}
guild = evaluatedExperiments.guild;
if (guild == null) {
r15 = value2;
break reducibleJoin36;
}
property = guild[guildId];
r15 = property;
break reducibleJoin36;
}
if (r15 == null) {
break reducibleJoin43;
}
assignments = r15.assignments;
properties = Object.keys(assignments);
properties11 = 0;
properties12 = properties.length;
if (properties === value2) {
break reducibleJoin43;
}
r12 = properties11;
reducibleLoop38: while (true) {
propertyName = properties[r12];
propertyName6 = r12 + 1;
if (propertyName === value2) {
break reducibleJoin43;
}
property = object[propertyName];
if (property == null) {
r12 = propertyName6;
continue reducibleLoop38;
}
assignments2 = r15.assignments;
variantId = assignments2[propertyName].variantId;
if (variantId == null) {
r12 = propertyName6;
continue reducibleLoop38;
}
HermesInternal = global.HermesInternal;
concat = HermesInternal.concat;
value20 = '' + property + ':' + variantId;
r25 = isLikelyControl(registeredExperiments[property], variantId) ? items4 : items6;
push = r25.push;
Reflect.apply(push, r25, [value20]);
r12 = propertyName6;
continue reducibleLoop38;
}
}
const flushFlagsBinding = flushFlags;
flushFlagsBinding(items7);
flushFlagsBinding(items2, env0_10);
flushFlagsBinding(items3);
flushFlagsBinding(items4, env0_10);
flushFlagsBinding(items5);
flushFlagsBinding(items6, env0_10);
return value2;
}
function _fun125358(a0) { // fn#125358, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16425:2843, offset: 0x025d5fef, size: 42 bytes, params: 2, frame: 14
const SentryExperimentFeatureFlagManager2 = SentryExperimentFeatureFlagManager;
Inherits(SentryExperimentFeatureFlagManager2, a0);
return CreateClass(SentryExperimentFeatureFlagManager2);
function SentryExperimentFeatureFlagManager(a0) { // fn#125359, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16425:2855, offset: 0x025d6019, size: 209 bytes, params: 2, frame: 20
var r0;
var Reflect;
let value = copyRestArgs(0, undefined);
let binding = env1_3;
binding(this, SentryExperimentFeatureFlagManager);
const items2 = [];
arraySpread(items2, value, 0, items2);
value = env1_5(SentryExperimentFeatureFlagManager);
binding = env1_4;
if (_isNativeReflectConstruct_125349()) {
Reflect = global.Reflect;
value = Reflect.construct(value, items2, env1_5(this).constructor);
r0 = value;
} else {
value = value.apply(this, items2);
r0 = value;
}
value = binding(this, r0);
const Map = global.Map;
const map = new Map();
const set = map.set;
const experimentStoreBinding = ExperimentStore;
const syncAllExperimentFlagsBinding = syncAllExperimentFlags;
const value6 = Reflect.apply(set, map, [experimentStoreBinding, syncAllExperimentFlagsBinding]);
const value7 = value6.set(ApexExperimentStore, syncAllExperimentFlagsBinding);
value.stores = value7.set(SelectedGuildStore, syncAllExperimentFlagsBinding);
return value;
}
}
}
global.__d(_fun125348, 16217, [7, 6, 15, 17, 18, 4107, 1220, 3969, 1216, 4860,
2]) /* metro module 16217, dependencies: [7, 6, 15, 17, 18, 4107, 1220, 3969, 1216, 4860, 2] */;