Files
discord-decomp/sources/by-id/module-01109.jsx
T
2026-07-27 16:20:00 +03:00

1399 lines
54 KiB
React

/* Metro module 1109; source: unknown; dependencies: [77, 826, 1036, 1080] */
function _fun12422(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#12422, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1236:6, offset: 0x00dca5df, size: 750 bytes, params: 8, frame: 29
const env0_0 = require;
const closure = enrichWithThreadInformation;
const closure2 = createProfilePayload;
const closure3 = convertJSSelfProfileToSampledFormat;
const closure4 = applyDebugMetadata;
const closure5 = isValidSampleRate;
const value = undefined;
const env0_2 = require(77) /* metro dependency 77 */;
const Object = global.Object;
const defineProperty = Object.defineProperty;
const Symbol = global.Symbol;
Reflect.apply(defineProperty, Object, [exports, Symbol.toStringTag, {value: 'Module'}]);
const GLOBAL_OBJ = (require(826) /* metro dependency 826 */).GLOBAL_OBJ;
const r11 = 'window' in GLOBAL_OBJ && GLOBAL_OBJ.window === GLOBAL_OBJ && typeof global.importScripts === 'undefined';
const String = global.String;
const value5 = String(0);
const r8 = r11 ? 'main' : 'worker';
const WINDOW = (require(1036) /* metro dependency 1036 */).WINDOW;
const navigator = WINDOW.navigator;
const value8 = '';
const userAgent = navigator == null ? value : navigator.userAgent;
const r13 = userAgent || value8;
if ((navigator == null ? value : navigator.language) || (navigator == null || navigator.languages == null ? value : navigator.languages[0])) {
}
const userAgentData = navigator == null ? value : navigator.userAgentData;
if (typeof userAgentData === 'object' && userAgentData !== null && 'getHighEntropyValues' in userAgentData) {
userAgentData.getHighEntropyValues(['architecture', 'model', 'platform', 'platformVersion',
'fullVersionList']).then(_fun12429).catch(function(a0) {
});
}
const Map = global.Map;
const map = new Map();
exports.MAX_PROFILE_DURATION_MS = 30000;
exports.PROFILER_THREAD_ID_STRING = value5;
exports.PROFILER_THREAD_NAME = r8;
exports.addProfileToGlobalCache = addProfileToGlobalCache;
exports.addProfilesToEnvelope = function(a0, a1) {
var property;
var push;
var object;
var items;
var error;
if (a1.length) {
var iterator = a1[Symbol.iterator]();
var iterator2 = iterator.next;
var r2 = iterator;
var item2 = Reflect.apply(iterator2, r2, []);
var item = item2.value;
item2 = item2.done ? undefined : r2;
reducibleJoin4: while (true) {
if (item2 === undefined) {
return a0;
}
break reducibleJoin4;
}
reducibleLoop4: while (true) {
try {
property = a0[1];
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
push = property.push;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
object = {};
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
object.type = 'profile';
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
items = [];
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
items[0] = object;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
items[1] = item;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
Reflect.apply(push, property, [items]);
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
r2 = item2;
item2 = Reflect.apply(iterator2, r2, []);
item = item2.value;
item2 = item2.done ? undefined : r2;
if (item2 === undefined) {
break reducibleLoop4;
}
continue reducibleLoop4;
}
}
return a0;
};
exports.applyDebugMetadata = closure4;
exports.attachProfiledThreadToEvent = attachProfiledThreadToEvent;
exports.convertJSSelfProfileToSampledFormat = closure3;
exports.createProfileChunkPayload = createProfileChunkPayload;
exports.createProfilePayload = closure2;
exports.createProfilingEvent = createProfilingEvent;
exports.enrichWithThreadInformation = closure;
exports.findProfiledTransactionsFromEnvelope = findProfiledTransactionsFromEnvelope;
exports.getActiveProfilesCount = getActiveProfilesCount;
exports.hasLegacyProfiling = function(a0) {
return a0.profilesSampleRate !== undefined;
};
exports.isAutomatedPageLoadSpan = isAutomatedPageLoadSpan;
exports.isValidSampleRate = closure5;
exports.shouldProfileSession = shouldProfileSession;
exports.shouldProfileSpanLegacy = shouldProfileSpanLegacy;
exports.startJSSelfProfile = startJSSelfProfile;
exports.takeProfileFromGlobalCache = takeProfileFromGlobalCache;
exports.validateProfileChunk = validateProfileChunk;
return value;
}
function enrichWithThreadInformation(a0) { // fn#12423, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1236:467, offset: 0x00dca8cd, size: 33 bytes, params: 2, frame: 12
var r0;
let value = a0;
if ('thread_metadata' in value) {
r0 = value;
} else {
value = convertJSSelfProfileToSampledFormat(value);
r0 = value;
}
return r0;
}
function createProfilePayload(a0, a1, a2, a3) { // fn#12424, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1236:627, offset: 0x00dca8ee, size: 922 bytes, params: 5, frame: 24
var r0;
var r3;
var r1;
var r7;
let value = a1;
if (a3.type !== 'transaction') {
throw new global.TypeError('Profiling events may only be attached to transactions, this should never occur.');
}
if (a2 == null) {
throw new global.TypeError('Cannot construct profiling event envelope without a valid profile. Got ' + a2 + ' instead.');
}
const contexts = a3.contexts;
const trace_id = contexts == null || contexts.trace == null ? undefined : contexts.trace.trace_id;
const value3 = typeof trace_id;
if (value3 === 'string' && trace_id.length !== 32 && (require(1080) /* metro dependency 1080 */).DEBUG_BUILD) {
(require(826) /* metro dependency 826 */).debug.log('[Profiling] Invalid traceId: ' + trace_id + ' on profiled event');
}
const value8 = '';
const r6 = value3 !== 'string' ? value8 : trace_id;
const value10 = enrichWithThreadInformation(a2);
if (value) {
r3 = value;
} else {
if (typeof a3.start_timestamp === 'number') {
r0 = 1000 * a3.start_timestamp;
} else {
value = require(826) /* metro dependency 826 */;
value = value.timestampInSeconds();
value = 1000 * value;
r0 = value;
}
r3 = r0;
}
if (typeof a3.timestamp === 'number') {
r1 = 1000 * a3.timestamp;
} else {
value = require(826) /* metro dependency 826 */;
value = value.timestampInSeconds();
value = 1000 * value;
r1 = value;
}
const object2 = {event_id: a0};
const Date = global.Date;
let date = new Date();
object2.timestamp = date.toISOString();
object2.platform = 'javascript';
object2.version = '1';
object2.release = a3.release || value8;
object2.environment = a3.environment || (require(826) /* metro dependency 826 */).DEFAULT_ENVIRONMENT;
const WINDOW = (require(1036) /* metro dependency 1036 */).WINDOW;
const userAgent = WINDOW.navigator.userAgent;
object2.runtime = {name: 'javascript', version: userAgent};
object2.os = {name: env0_6, version: env0_7, build_number: env0_9};
object2.device = {locale: env0_11, model: env0_10, manufacturer: env0_9, architecture: env0_8, is_emulator: false};
const object3 = {};
object3.images = applyDebugMetadata(a2.resources);
object2.debug_meta = object3;
object2.profile = value10;
const object4 = {};
object4.name = a3.transaction || value8;
const event_id = a3.event_id;
if (event_id) {
r7 = event_id;
} else {
date = require(826) /* metro dependency 826 */;
date = date.uuid4();
r7 = date;
}
object4.id = r7;
object4.trace_id = r6;
object4.active_thread_id = env0_4;
object4.relative_start_ns = '0';
object4.relative_end_ns = (1000000 * (r1 - r3)).toFixed(0);
object2.transactions = [object4];
return object2;
}
function convertJSSelfProfileToSampledFormat(a0) { // fn#12425, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1236:1951, offset: 0x00dcac88, size: 224 bytes, params: 2, frame: 20
var r4;
var timestamp;
var value3;
const env0_0 = a0;
const value = 0;
const env0_2 = value;
const object2 = {samples: [], stacks: [], frames: []};
object2.thread_metadata = env0_2({}, env0_4, {name: env0_5});
const property = a0.samples[value];
if (property) {
timestamp = property.timestamp;
value3 = (require(826) /* metro dependency 826 */).browserPerformanceTimeOrigin();
r4 = typeof global.performance.timeOrigin === 'number' ? global.performance.timeOrigin : value3 || value;
var env0_5 = r4 - (value3 || r4);
a0.samples.forEach(_fun12426);
}
return object2;
}
function applyDebugMetadata(a0) { // fn#12427, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1236:2892, offset: 0x00dcaf6b, size: 114 bytes, params: 2, frame: 16
var value;
const value2 = undefined;
const client = (require(826) /* metro dependency 826 */).getClient();
let r0 = client == null ? value2 : client.getOptions();
const stackParser = r0 == null ? value2 : r0.stackParser;
if (stackParser) {
value = require(826) /* metro dependency 826 */;
value = value.getDebugImagesForResources(stackParser, a0);
r0 = value;
} else {
r0 = [];
}
return r0;
}
function isValidSampleRate(a0) { // fn#12428, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1236:3064, offset: 0x00dcafdd, size: 350 bytes, params: 2, frame: 21
var r0;
var r2;
var r1;
const DEBUG_BUILD = (require(1080) /* metro dependency 1080 */).DEBUG_BUILD;
var value2;
const debug = (require(826) /* metro dependency 826 */).debug;
var warn;
var value4;
var JSON;
var value5;
let value = typeof a0;
if (value === 'number') {
if (value !== 'number') {
value = a0 === true;
r0 = value || a0 === false;
if (!r0) {
value = a0 < 0;
r2 = value || a0 > 1;
value = !r2;
if (r2) {
value2 = false;
if (DEBUG_BUILD) {
debug.warn('[Profiling] Invalid sample rate. Sample rate must be between 0 and 1. Got ' + a0 + '.');
r1 = value2;
} else {
r1 = value2;
}
} else {
r1 = value;
}
r0 = r1;
}
} else if (global.isNaN(a0)) {
value4 = false;
if (DEBUG_BUILD) {
warn = debug.warn;
JSON = global.JSON;
value5 = JSON.stringify(a0);
JSON = global.JSON;
value = JSON.stringify(value);
Reflect.apply(warn, debug,
['[Profiling] Invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ' + value5 + ' of type ' + value + '.']);
r0 = value4;
} else {
r0 = value4;
}
} else {
value = a0 === true;
r0 = value || a0 === false;
if (!r0) {
value = a0 < 0;
r2 = value || a0 > 1;
value = !r2;
if (r2) {
value2 = false;
if (DEBUG_BUILD) {
debug.warn('[Profiling] Invalid sample rate. Sample rate must be between 0 and 1. Got ' + a0 + '.');
r1 = value2;
} else {
r1 = value2;
}
} else {
r1 = value;
}
r0 = r1;
}
}
} else if (value !== 'boolean') {
value4 = false;
if (DEBUG_BUILD) {
warn = debug.warn;
JSON = global.JSON;
value5 = JSON.stringify(a0);
JSON = global.JSON;
value = JSON.stringify(value);
Reflect.apply(warn, debug,
['[Profiling] Invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ' + value5 + ' of type ' + value + '.']);
r0 = value4;
} else {
r0 = value4;
}
} else if (value !== 'number') {
value = a0 === true;
r0 = value || a0 === false;
if (!r0) {
value = a0 < 0;
r2 = value || a0 > 1;
value = !r2;
if (r2) {
value2 = false;
if (DEBUG_BUILD) {
debug.warn('[Profiling] Invalid sample rate. Sample rate must be between 0 and 1. Got ' + a0 + '.');
r1 = value2;
} else {
r1 = value2;
}
} else {
r1 = value;
}
r0 = r1;
}
} else if (global.isNaN(a0)) {
value4 = false;
if (DEBUG_BUILD) {
warn = debug.warn;
JSON = global.JSON;
value5 = JSON.stringify(a0);
JSON = global.JSON;
value = JSON.stringify(value);
Reflect.apply(warn, debug,
['[Profiling] Invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ' + value5 + ' of type ' + value + '.']);
r0 = value4;
} else {
r0 = value4;
}
} else {
value = a0 === true;
r0 = value || a0 === false;
if (!r0) {
value = a0 < 0;
r2 = value || a0 > 1;
value = !r2;
if (r2) {
value2 = false;
if (DEBUG_BUILD) {
debug.warn('[Profiling] Invalid sample rate. Sample rate must be between 0 and 1. Got ' + a0 + '.');
r1 = value2;
} else {
r1 = value2;
}
} else {
r1 = value;
}
r0 = r1;
}
}
return r0;
}
function _fun12429(a0) { // fn#12429, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1236:3731, offset: 0x00dcb13b, size: 172 bytes, params: 2, frame: 16
var property;
if (a0.platform) {
}
if (a0.architecture) {
}
if (a0.model) {
}
if (a0.platformVersion) {
}
const fullVersionList = a0.fullVersionList;
if (fullVersionList != null) {
if (fullVersionList.length) {
property = a0.fullVersionList[a0.fullVersionList.length - 1];
env0_9 = '' + property.brand + ' ' + property.version;
}
}
}
function addProfileToGlobalCache(a0, a1) { // fn#12431, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1236:4112, offset: 0x00dcb1e7, size: 91 bytes, params: 3, frame: 14
var value2;
var value3;
env0_13.set(a0, a1);
if (env0_13.size > 30) {
value2 = env0_13.keys();
value3 = value2.next().value;
if (value3 !== undefined) {
env0_13.delete(value3);
}
}
}
function attachProfiledThreadToEvent(a0) { // fn#12433, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1236:4441, offset: 0x00dcb29d, size: 249 bytes, params: 2, frame: 26
var r5;
var r9;
var contexts;
var Object;
var assign;
var contexts2;
var value;
var Object2;
var assign2;
var contexts3;
var binding;
var spans;
if (a0 != null) {
contexts = a0.contexts;
if (contexts != null) {
if (contexts.profile) {
contexts = a0.contexts;
if (contexts) {
contexts = a0.contexts;
Object = global.Object;
assign = Object.assign;
contexts2 = a0.contexts;
value = undefined;
r5 = (contexts2 == null ? value : contexts2.trace) ?? ({});
Object2 = global.Object;
assign2 = Object2.assign;
contexts3 = a0.contexts;
r9 = (contexts3 == null || contexts3.trace == null ? value : contexts3.trace.data) ?? ({});
binding = env0_2;
value = binding(binding({}, 'thread.id', env0_4), 'thread.name', env0_5);
contexts.trace = Reflect.apply(assign, Object, [{}, r5, {data: Reflect.apply(assign2, Object2, [{},
r9,
value])}]);
spans = a0.spans;
if (spans != null) {
spans.forEach(_fun12434);
}
}
}
}
}
return a0;
}
function createProfileChunkPayload(a0, a1, a2) { // fn#12435, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1236:5007, offset: 0x00dcb3ec, size: 916 bytes, params: 4, frame: 32
var r1;
var r5;
var r10;
var r13;
var r14;
var r20;
var sdk;
var name;
var r7;
var property;
var resourceId;
var resources;
var property2;
var line;
var column;
var value4;
var items2;
var push;
var frameId;
var parentId;
var value5;
var timestamp;
var value9;
var stackId;
var value10;
var sdkMetadata;
let value = a2;
if (a0 == null) {
throw new global.TypeError('Cannot construct profiling event envelope without a valid profile. Got ' + a0 + ' instead.');
}
let object = [];
let frames = a0.frames;
let length = frames.length;
const value2 = 0;
const value3 = undefined;
if (value2 < length) {
r1 = value2;
while (true) {
frames = a0.frames;
property = frames[r1];
if (property) {
name = property.name;
resourceId = property.resourceId;
if (typeof resourceId !== 'number') {
r5 = value3;
continue;
}
resources = a0.resources;
resourceId = property.resourceId;
property2 = resources[resourceId];
r5 = property2;
line = property.line;
column = property.column;
object[r1] = {function: name, abs_path: r5, lineno: line, colno: column};
}
value4 = typeof r1 === 'bigint' ? r1 + 1n : +r1 + 1;
frames = a0.frames;
length = frames.length;
if (value4 < length) {
r1 = value4;
continue;
}
break;
}
}
const items4 = [];
let stacks = a0.stacks;
length = stacks.length;
if (value2 < length) {
r10 = value2;
while (true) {
stacks = a0.stacks;
property = stacks[r10];
if (property) {
items2 = [];
if (!property) {
continue;
}
r13 = property;
while (true) {
push = items2.push;
frameId = r13.frameId;
Reflect.apply(push, items2, [frameId]);
parentId = r13.parentId;
if (value3 === parentId) {
r14 = value3;
} else {
stacks = a0.stacks;
parentId = r13.parentId;
property = stacks[parentId];
r14 = property;
}
if (r14) {
r13 = r14;
continue;
}
break;
}
items4[r10] = items2;
}
value5 = typeof r10 === 'bigint' ? r10 + 1n : +r10 + 1;
stacks = a0.stacks;
length = stacks.length;
if (value5 < length) {
r10 = value5;
continue;
}
break;
}
}
const value7 = (require(826) /* metro dependency 826 */).browserPerformanceTimeOrigin();
const r16 = typeof global.performance.timeOrigin === 'number' ? global.performance.timeOrigin : value7 || value2;
const value8 = r16 - (value7 || r16);
const items3 = [];
let samples = a0.samples;
length = samples.length;
if (value2 < length) {
r13 = value2;
while (true) {
samples = a0.samples;
property = samples[r13];
if (property) {
timestamp = property.timestamp;
value9 = (r16 + (timestamp - value8)) / 1000;
stackId = property.stackId;
if (stackId != null) {
r20 = stackId;
continue;
}
r20 = value2;
continue;
items3[r13] = {stack_id: r20, thread_id: env0_4, timestamp: value9};
}
value10 = typeof r13 === 'bigint' ? r13 + 1n : +r13 + 1;
samples = a0.samples;
length = samples.length;
if (value10 < length) {
r13 = value10;
continue;
}
break;
}
}
const object2 = {frames: object, stacks: items4, samples: items3};
object2.thread_metadata = env0_2({}, env0_4, {name: env0_5});
const options = a1.getOptions();
const getSdkMetadata = a1.getSdkMetadata;
if (getSdkMetadata == null) {
sdk = value3;
} else {
sdkMetadata = a1.getSdkMetadata();
sdk = sdkMetadata == null ? value3 : sdkMetadata.sdk;
}
object = {};
object.chunk_id = (require(826) /* metro dependency 826 */).uuid4();
object.client_sdk = {name: (sdk == null ? value3 : sdk.name) ?? 'sentry.javascript.browser',
version: (sdk == null ? value3 : sdk.version) ?? '0.0.0'};
if (value) {
r7 = value;
} else {
value = require(826) /* metro dependency 826 */;
value = value.uuid4();
r7 = value;
}
object.profiler_id = r7;
object.platform = 'javascript';
object.version = '2';
object.release = options.release ?? '';
object.environment = options.environment ?? 'production';
const object3 = {};
object3.images = applyDebugMetadata(a0.resources);
object.debug_meta = object3;
object.profile = object2;
return object;
}
function createProfilingEvent(a0, a1, a2, a3) { // fn#12436, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1236:6464, offset: 0x00dcb780, size: 237 bytes, params: 5, frame: 18
var r1;
const DEBUG_BUILD = (require(1080) /* metro dependency 1080 */).DEBUG_BUILD;
var value2;
const debug = (require(826) /* metro dependency 826 */).debug;
var value3;
let length = a2.samples.length;
if (length < 2) {
value3 = false;
if (DEBUG_BUILD) {
debug.log('[Profiling] Discarding profile because it contains less than 2 samples');
r1 = value3;
} else {
r1 = value3;
}
} else {
length = a2.frames.length;
if (length) {
r1 = !!length;
} else {
value2 = false;
if (DEBUG_BUILD) {
debug.log('[Profiling] Discarding profile because it contains no frames');
r1 = value2;
} else {
r1 = value2;
}
}
}
return r1 ? createProfilePayload(a0, a1, a2, a3) : null;
}
function findProfiledTransactionsFromEnvelope(a0) { // fn#12437, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1236:6947, offset: 0x00dcb86d, size: 57 bytes, params: 2, frame: 14
(require(826) /* metro dependency 826 */).forEachEnvelopeItem(a0, _fun12438);
return [];
}
function getActiveProfilesCount() { // fn#12439, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1236:7231, offset: 0x00dcb926, size: 14 bytes, params: 1, frame: 1
return env0_13.size;
}
function isAutomatedPageLoadSpan(a0) { // fn#12441, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1236:7398, offset: 0x00dcb945, size: 56 bytes, params: 2, frame: 11
const value = require(826) /* metro dependency 826 */;
return value.spanToJSON(a0).op === 'pageload';
}
function shouldProfileSession(a0) { // fn#12442, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1236:7542, offset: 0x00dcb97d, size: 410 bytes, params: 2, frame: 17
var r2;
var r1;
const DEBUG_BUILD = (require(1080) /* metro dependency 1080 */).DEBUG_BUILD;
var value2;
const debug = (require(826) /* metro dependency 826 */).debug;
var value3;
var Math;
if (env0_12) {
if (DEBUG_BUILD) {
debug.log('[Profiling] Profiling has been disabled for the duration of the current user session as the JS Profiler could not be started.');
}
return false;
}
if (a0.profileLifecycle !== 'trace') {
if (a0.profileLifecycle !== 'manual') {
if (DEBUG_BUILD) {
debug.warn('[Profiling] Session not sampled. Invalid `profileLifecycle` option.');
}
return false;
}
}
const profileSessionSampleRate = a0.profileSessionSampleRate;
if (isValidSampleRate(profileSessionSampleRate)) {
if (profileSessionSampleRate) {
Math = global.Math;
r2 = Math.random() <= profileSessionSampleRate;
} else {
value3 = false;
if (DEBUG_BUILD) {
debug.log('[Profiling] Discarding profile because profileSessionSampleRate is not defined or set to 0');
r2 = value3;
} else {
r2 = value3;
}
}
r1 = r2;
} else {
value2 = false;
if (DEBUG_BUILD) {
debug.warn('[Profiling] Discarding profile because of invalid profileSessionSampleRate.');
r1 = value2;
} else {
r1 = value2;
}
}
return r1;
}
function shouldProfileSpanLegacy(a0) { // fn#12443, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1236:8312, offset: 0x00dcbb17, size: 645 bytes, params: 2, frame: 20
var r1;
var r4;
var r3;
var r2;
const DEBUG_BUILD = (require(1080) /* metro dependency 1080 */).DEBUG_BUILD;
const debug = (require(826) /* metro dependency 826 */).debug;
var value2;
var client;
var profilesSampleRate;
var value5;
var value6;
var value10;
if (env0_12) {
if (DEBUG_BUILD) {
debug.log('[Profiling] Profiling has been disabled for the duration of the current user session.');
}
} else {
if (a0.isRecording()) {
value2 = undefined;
client = (require(826) /* metro dependency 826 */).getClient();
r1 = client == null ? value2 : client.getOptions();
if (r1) {
profilesSampleRate = r1.profilesSampleRate;
if (isValidSampleRate(profilesSampleRate)) {
if (profilesSampleRate) {
r4 = profilesSampleRate === true || global.Math.random() < profilesSampleRate;
if (r4) {
r3 = !!r4;
} else {
value10 = false;
if (DEBUG_BUILD) {
debug.log("[Profiling] Discarding profile because it's not included in the random sample (sampling rate = " + global.Number(profilesSampleRate) + ')');
r3 = value10;
} else {
r3 = value10;
}
}
r2 = r3;
} else {
value6 = false;
if (DEBUG_BUILD) {
debug.log('[Profiling] Discarding profile because a negative sampling decision was inherited or profileSampleRate is set to 0');
r2 = value6;
} else {
r2 = value6;
}
}
r1 = r2;
} else {
value5 = false;
if (DEBUG_BUILD) {
debug.warn('[Profiling] Discarding profile because of invalid sample rate.');
r1 = value5;
} else {
r1 = value5;
}
}
return r1;
}
if (DEBUG_BUILD) {
debug.log('[Profiling] Profiling disabled, no options found.');
}
return false;
}
if (DEBUG_BUILD) {
debug.log('[Profiling] Discarding profile because root span was not sampled.');
}
}
return false;
}
function startJSSelfProfile() { // fn#12444, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1236:9333, offset: 0x00dcbd9c, size: 321 bytes, params: 1, frame: 16
const DEBUG_BUILD = (require(1080) /* metro dependency 1080 */).DEBUG_BUILD;
const debug = (require(826) /* metro dependency 826 */).debug;
var object;
var prototype;
var value3;
var profiler;
var value5;
var error;
const WINDOW = (require(1036) /* metro dependency 1036 */).WINDOW;
const Profiler = WINDOW.Profiler;
if (typeof Profiler === 'function') {
try {
object = {sampleInterval: 10, maxBufferSize: global.Math.floor(3000)};
prototype = Profiler.prototype;
value3 = Object.create(prototype, {constructor: {value: Profiler}});
profiler = new Profiler();
value5 = profiler instanceof Object ? profiler : value3;
} catch (error) {
if (DEBUG_BUILD) {
debug.log("[Profiling] Failed to initialize the Profiling constructor, this is likely due to a missing 'Document-Policy': 'js-profiling' header.");
debug.log('[Profiling] Disabling profiling for current user session.');
}
env0_12 = true;
return undefined;
}
return value5;
}
if (DEBUG_BUILD) {
debug.log('[Profiling] Profiling is not supported by this browser, Profiler interface missing on window object.');
}
}
function takeProfileFromGlobalCache(a0) { // fn#12445, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1236:9989, offset: 0x00dcbedd, size: 39 bytes, params: 2, frame: 12
const value2 = env0_13.get(a0);
if (value2) {
env0_13.delete(a0);
}
return value2;
}
function validateProfileChunk(a0) { // fn#12446, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1236:10092, offset: 0x00dcbf04, size: 424 bytes, params: 2, frame: 15
var r3;
var r2;
var r1;
var r0;
var value;
var closure;
var profiler_id;
var object2;
var chunk_id;
var client_sdk;
var profile;
var Array;
var isArray;
var frames;
var length;
var stacks;
var samples;
var error;
if (a0) {
try {
value = typeof a0 !== 'object';
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
if (value) {
try {
object2 = {};
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
try {
object2.reason = 'chunk is not an object';
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
return object2;
}
try {
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
try {
closure = function(a0) {
return typeof a0 === 'string' && RegExp('^[a-f0-9]{32}$', '').test(a0);
};
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
try {
profiler_id = a0.profiler_id;
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
try {
value = closure(profiler_id);
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
if (value) {
try {
chunk_id = a0.chunk_id;
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
try {
value = closure(chunk_id);
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
if (value) {
try {
client_sdk = a0.client_sdk;
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
if (client_sdk) {
try {
profile = a0.profile;
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
if (profile) {
try {
Array = global.Array;
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
try {
isArray = Array.isArray;
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
try {
frames = profile.frames;
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
try {
value = Reflect.apply(isArray, Array, [frames]);
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
if (value) {
try {
frames = profile.frames;
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
try {
length = frames.length;
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
if (length) {
try {
Array = global.Array;
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
try {
isArray = Array.isArray;
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
try {
stacks = profile.stacks;
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
try {
value = Reflect.apply(isArray, Array, [stacks]);
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
if (value) {
try {
stacks = profile.stacks;
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
try {
length = stacks.length;
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
if (length) {
try {
Array = global.Array;
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
try {
isArray = Array.isArray;
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
try {
samples = profile.samples;
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
try {
value = Reflect.apply(isArray, Array, [samples]);
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
if (value) {
try {
samples = profile.samples;
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
try {
length = samples.length;
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
if (length) {
try {
object2 = {};
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
try {
object2.valid = true;
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
r3 = object2;
} else {
try {
object2 = {};
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
try {
object2.reason = 'profile has no samples';
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
r3 = object2;
}
} else {
try {
object2 = {};
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
try {
object2.reason = 'profile has no samples';
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
r3 = object2;
}
r2 = r3;
} else {
try {
object2 = {};
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
try {
object2.reason = 'profile has no stacks';
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
r2 = object2;
}
} else {
try {
object2 = {};
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
try {
object2.reason = 'profile has no stacks';
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
r2 = object2;
}
r1 = r2;
} else {
try {
object2 = {};
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
try {
object2.reason = 'profile has no frames';
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
r1 = object2;
}
} else {
try {
object2 = {};
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
try {
object2.reason = 'profile has no frames';
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
r1 = object2;
}
r0 = r1;
} else {
try {
object2 = {};
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
try {
object2.reason = 'missing profile data';
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
r0 = object2;
}
return r0;
}
try {
object2 = {};
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
try {
object2.reason = 'missing client_sdk metadata';
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
return object2;
}
try {
object2 = {};
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
try {
object2.reason = 'missing or invalid chunk_id';
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
return object2;
}
try {
object2 = {};
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
try {
object2.reason = 'missing or invalid profiler_id';
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
} else {
try {
object2 = {};
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
try {
object2.reason = 'chunk is not an object';
} catch (error) {
return {reason: 'unknown validation error: ' + error};
}
}
return object2;
}
function _fun12426(a0, a1) { // fn#12426, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1236:2280, offset: 0x00dcad68, size: 515 bytes, params: 3, frame: 22
var r5;
var r6;
var r11;
var stacks;
var object;
var push;
var frameId;
var frames;
var value3;
var name;
var resourceId;
var resources;
var property2;
var line;
var column;
var parentId;
var binding;
var samples;
var value10;
var value11;
const stackId = a0.stackId;
const value = undefined;
if (value === stackId) {
if (value === env0_1) {
binding = env0_2;
env0_1 = binding;
env0_3.stacks[binding] = [];
binding = env0_2;
env0_2 = typeof binding === 'bigint' ? binding + 1n : +binding + 1;
}
samples = env0_3.samples;
object = {};
value10 = a0.timestamp + env0_5 - timestamp;
value11 = environment.__proto__;
object.elapsed_since_start_ns = (value10 * env1_3).toFixed(0);
object.stack_id = env0_1;
object.thread_id = env1_4;
samples[a1] = object;
} else {
var property = env0_0.stacks[a0.stackId];
object = [];
if (property) {
r5 = property;
while (true) {
push = object.push;
frameId = r5.frameId;
Reflect.apply(push, object, [frameId]);
frames = env0_0.frames;
frameId = r5.frameId;
property = frames[frameId];
if (property) {
value3 = value === env0_3.frames[r5.frameId];
r6 = value3;
} else {
r6 = property;
}
if (!r6) {
continue;
}
frames = env0_3.frames;
frameId = r5.frameId;
name = property.name;
resourceId = property.resourceId;
if (typeof resourceId !== 'number') {
r11 = value;
continue;
}
resources = env0_0.resources;
resourceId = property.resourceId;
property2 = resources[resourceId];
r11 = property2;
line = property.line;
column = property.column;
frames[frameId] = {function: name, abs_path: r11, lineno: line, colno: column};
parentId = r5.parentId;
if (value === parentId) {
r6 = value;
continue;
}
stacks = env0_0.stacks;
parentId = r5.parentId;
property = stacks[parentId];
r6 = property;
if (r6) {
r5 = r6;
continue;
}
break;
}
}
var object2 = {};
object2.elapsed_since_start_ns = ((a0.timestamp + env0_5 - timestamp) * env1_3).toFixed(0);
object2.stack_id = env0_2;
object2.thread_id = env1_4;
binding = env0_3;
binding.stacks[env0_2] = object;
binding.samples[a1] = object2;
binding = env0_2;
env0_2 = typeof binding === 'bigint' ? binding + 1n : +binding + 1;
}
return value;
}
function _fun12434(a0) { // fn#12434, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1236:4807, offset: 0x00dcb396, size: 86 bytes, params: 2, frame: 20
const Object = global.Object;
const assign = Object.assign;
const r4 = a0.data || ({});
const value = environment.__proto__;
const binding = env1_2;
a0.data = Reflect.apply(assign, Object, [{}, r4, binding(binding({}, 'thread.id', env1_4), 'thread.name', env1_5)]);
}
function _fun12438(a0, a1) { // fn#12438, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1236:7043, offset: 0x00dcb8a6, size: 128 bytes, params: 3, frame: 17
var r3;
var r4;
var r0;
var r6;
var length;
var value;
var property;
var contexts;
var profile;
var profile_id;
var binding;
if (a1 === 'transaction') {
length = a0.length;
value = 1;
if (value < length) {
r3 = undefined;
r4 = value;
while (true) {
property = a0[r4];
value = property != null;
if (value) {
contexts = property.contexts;
r0 = contexts != null;
r3 = contexts;
} else {
r0 = value;
}
if (!r0) {
r6 = r3;
continue;
}
profile = r3.profile;
r0 = profile != null;
r6 = profile;
if (!r0) {
continue;
}
profile_id = r6.profile_id;
r0 = profile_id;
if (!r0) {
continue;
}
binding = env0_0;
binding.push(a0[r4]);
value = typeof r4 === 'bigint' ? r4 + 1n : +r4 + 1;
length = a0.length;
if (value < length) {
r3 = r6;
r4 = value;
continue;
}
break;
}
}
}
}