Files
discord-decomp/sources/by-id/module-07400.js
T
2026-07-28 01:06:53 +03:00

347 lines
18 KiB
JavaScript

/* Metro module 7400; source: unknown; dependencies: [65, 862, 7396, 7401, 7402, 7374, 7383, 7391, 7384, 7369, 7386, 7397, 7403] */
import * as Module00065Module from './module-00065.js'; /* Metro dependency 65 */
import * as Module00862Module from './module-00862.js'; /* Metro dependency 862 */
import * as Module07369Module from './module-07369.js'; /* Metro dependency 7369 */
import * as SEMANTIC_ATTRIBUTE_Module from './module-07384-SEMANTIC_ATTRIBUTE_.js'; /* Metro dependency 7384 */
import * as Module07391Module from './module-07391.js'; /* Metro dependency 7391 */
import * as DEBUG_BUILDModule from './module-07397-DEBUG_BUILD.js'; /* Metro dependency 7397 */
import * as SentryNonRecordingSpanModule from './module-07402-SentryNonRecordingSpan.js'; /* Metro dependency 7402 */
function _fun59613(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#59613, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7578:6, offset: 0x016eda21, size: 121 bytes, params: 8, frame: 17
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
exports.TRACING_DEFAULTS = {'idleTimeout': 1000, 'finalTimeout': 30000, 'childSpanTimeout': 15000};
exports.startIdleSpan = startIdleSpan_59614;
function startIdleSpan_59614(a0) { // fn#59614, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7578:203, offset: 0x016eda9a, size: 721 bytes, params: 2, frame: 25
var moduleValue2;
const SentryNonRecordingSpan = (SentryNonRecordingSpanModule).SentryNonRecordingSpan;
var value3;
var moduleValue6;
var _setSpanForScope;
var moduleValue7;
var Proxy;
var end;
var object2;
var push;
var on;
const closure = function(a0) {
var env0_0 = a0;
startIdleSpan_59614_cancelIdleTimeout();
env0_0 = global.setTimeout(_fun59617, idleTimeout);
};
const startIdleSpan_59614_restartChildSpanTimeout = function(a0) {
var env0_0 = a0;
env0_0 = global.setTimeout(_fun59619, childSpanTimeout);
};
const r6 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
const Map = global.Map;
let map = new Map();
const result = !r6.disableAutoFinish;
const items2 = [];
let idleTimeout = r6.idleTimeout;
if (idleTimeout === undefined) {
idleTimeout = env0_4.idleTimeout;
}
let finalTimeout = r6.finalTimeout;
finalTimeout = finalTimeout === undefined ? env0_4.finalTimeout : finalTimeout;
let childSpanTimeout = r6.childSpanTimeout;
if (childSpanTimeout === undefined) {
childSpanTimeout = env0_4.childSpanTimeout;
}
const env0_9 = r6.beforeSpanEnd;
const client = (require(7396) /* metro dependency 7396 */).getClient();
if (client) {
moduleValue2 = require(7401) /* metro dependency 7401 */;
if (moduleValue2.hasTracingEnabled()) {
var env0_10 = (require(7396) /* metro dependency 7396 */).getCurrentScope();
var env0_11 = (require(7374) /* metro dependency 7374 */).getActiveSpan();
value3 = (require(7403) /* metro dependency 7403 */).startInactiveSpan(a0);
moduleValue6 = require(7391) /* metro dependency 7391 */;
_setSpanForScope = moduleValue6._setSpanForScope;
moduleValue7 = require(7396) /* metro dependency 7396 */;
Reflect.apply(_setSpanForScope, moduleValue6, [moduleValue7.getCurrentScope(), value3]);
if ((require(7397) /* metro dependency 7397 */).DEBUG_BUILD) {
(require(7369) /* metro dependency 7369 */).logger.log('[Tracing] Started span is an idle span');
}
Proxy = global.Proxy;
end = value3.end;
object2 = {apply: apply_59624};
value3.end = new Proxy();
push = items2.push;
on = client.on;
Reflect.apply(push, items2, [Reflect.apply(on, client, ['spanStart', _fun59628])]);
push = items2.push;
on = client.on;
Reflect.apply(push, items2, [Reflect.apply(on, client, ['spanEnd', _fun59629])]);
push = items2.push;
on = client.on;
Reflect.apply(push, items2, [Reflect.apply(on, client, ['idleSpanEnableAutoFinish', _fun59630])]);
if (!r6.disableAutoFinish) {
closure();
}
global.setTimeout(_fun59631, finalTimeout);
return value3;
}
}
map = Object.create(SentryNonRecordingSpan.prototype, {constructor: {value: SentryNonRecordingSpan}});
const sentryNonRecordingSpan = new SentryNonRecordingSpan();
return sentryNonRecordingSpan instanceof Object ? sentryNonRecordingSpan : map;
function startIdleSpan_59614_cancelIdleTimeout() { // fn#59615, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7578:896, owner: startIdleSpan_59614._cancelIdleTimeout, offset: 0x00d61f34, size: 37 bytes, params: 1, frame: 12
if (env0_0) {
global.clearTimeout(env0_0);
}
}
function startIdleSpan_59614_restartIdleTimeout(a0) { // fn#59616, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7578:956, owner: startIdleSpan_59614._restartIdleTimeout, offset: 0x016edd6b, size: 51 bytes, params: 2, frame: 14
let env0_0 = a0;
startIdleSpan_59614_cancelIdleTimeout();
env0_0 = global.setTimeout(_fun59617, idleTimeout);
function _fun59617() { // fn#59617, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7578:1023, offset: 0x016edd9e, size: 71 bytes, params: 1, frame: 12
if (!env1_2 && env1_1.size === 0 && result) {
env1_12.end(env0_0);
}
}
}
function startIdleSpan_59614_restartChildSpanTimeout(a0) { // fn#59618, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7578:1085, owner: startIdleSpan_59614._restartChildSpanTimeout, offset: 0x016edde5, size: 43 bytes, params: 2, frame: 14
let env0_0 = a0;
env0_0 = global.setTimeout(_fun59619, childSpanTimeout);
function _fun59619() { // fn#59619, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7578:1136, offset: 0x016ede10, size: 55 bytes, params: 1, frame: 11
if (!env1_2 && result) {
env1_12.end(env0_0);
}
}
}
function startIdleSpan_59614OnIdleSpanEnded(a0) { // fn#59620, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7578:1190, owner: startIdleSpan_59614.onIdleSpanEnded, offset: 0x016ede47, size: 390 bytes, params: 2, frame: 21
const SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON = (SEMANTIC_ATTRIBUTE_Module).SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON;
var logger;
var value5;
const env0_0 = a0;
env0_1.clear();
env0_5.forEach(function(a0) {
return a0();
});
Module07391Module._setSpanForScope(env0_10, env0_11);
const value3 = (require(7374) /* metro dependency 7374 */).spanToJSON(env0_12);
if (value3.start_timestamp) {
if (!(value3.data || ({}))[SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON]) {
env0_12.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON, Module00862Module);
}
logger = (require(7369) /* metro dependency 7369 */).logger;
logger.log('[Tracing] Idle span "' + value3.op + '" finished');
value5 = (require(7374) /* metro dependency 7374 */).getSpanDescendants(env0_12).filter(_fun59622);
var env0_1 = 0;
value5.forEach(_fun59623);
if (env0_1 > 0) {
env0_12.setAttribute('sentry.idle_span_discarded_spans', env0_1);
}
}
function _fun59622(a0) { // fn#59622, offset: 0x016edfcd, size: 16 bytes, params: 2, frame: 2
return a0 !== env1_12;
}
function _fun59623(a0) { // fn#59623, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7578:1647, offset: 0x016edfdd, size: 495 bytes, params: 2, frame: 22
var setStatus;
var object;
var value;
const DEBUG_BUILD = (DEBUG_BUILDModule).DEBUG_BUILD;
const logger = (Module07369Module).logger;
var value10;
var binding;
if (a0.isRecording()) {
setStatus = a0.setStatus;
object = {};
value = environment.__proto__.__proto__;
object.code = (require(7386) /* metro dependency 7386 */).SPAN_STATUS_ERROR;
object.message = 'cancelled';
Reflect.apply(setStatus, a0, [object]);
a0.end(env0_0);
if (DEBUG_BUILD) {
logger.log('[Tracing] Cancelling span since span ended early', global.JSON.stringify(a0, undefined, 2));
}
}
value = environment.__proto__.__proto__;
const value3 = (require(7374) /* metro dependency 7374 */).spanToJSON(a0);
const timestamp = value3.timestamp;
const value4 = 0;
const r1 = timestamp === undefined ? value4 : timestamp;
const start_timestamp = value3.start_timestamp;
const r4 = start_timestamp === undefined ? value4 : start_timestamp;
const value6 = r4 <= env0_0;
const value9 = r1 - r4 <= (finalTimeout + idleTimeout) / 1000;
if (DEBUG_BUILD) {
value10 = global.JSON.stringify(a0, undefined, 2);
if (value6) {
if (!value9) {
logger.log('[Tracing] Discarding span since it finished after idle span final timeout', value10);
}
} else {
logger.log('[Tracing] Discarding span since it happened after idle span was finished', value10);
}
}
if (!(value9 && value6)) {
(require(7374) /* metro dependency 7374 */).removeChildSpanFromSpan(env1_12, a0);
binding = env0_1;
env0_1 = typeof binding === 'bigint' ? binding + 1n : +binding + 1;
}
}
}
function startIdleSpan_59614Apply(a0, a1, a2) { // fn#59624, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7578:2399, owner: startIdleSpan_59614.apply, offset: 0x016ee1cc, size: 517 bytes, params: 4, frame: 29
var r15;
var r6;
var start_timestamp;
var Reflect;
var apply;
var items2;
var value11;
var Math;
var max;
var moduleValue4;
var min;
var value13;
var Math2;
var Math3;
var min2;
var value16;
if (beforeSpanEnd) {
beforeSpanEnd(env0_12);
}
const value3 = undefined;
const value4 = env1_3(a2);
const property = value4[0];
const value5 = value4.slice(1);
const value7 = (require(7374) /* metro dependency 7374 */).spanTimeInputToSeconds(property || (require(7383) /* metro dependency 7383 */).timestampInSeconds());
const value9 = (require(7374) /* metro dependency 7374 */).getSpanDescendants(env0_12).filter(_fun59625);
if (value9.length) {
value11 = value9.map(_fun59626).filter(function(a0) {
return !!a0;
});
if (value11.length) {
Math = global.Math;
max = Math.max;
apply = max.apply;
Math = global.Math;
r15 = Reflect.apply(apply, max, [Math, env1_2(value11)]);
} else {
r15 = value3;
}
moduleValue4 = require(7374) /* metro dependency 7374 */;
start_timestamp = moduleValue4.spanToJSON(env0_12).start_timestamp;
Math = global.Math;
min = Math.min;
value13 = Infinity;
r6 = start_timestamp ? start_timestamp + finalTimeout / 1000 : value13;
Math2 = global.Math;
max = Math2.max;
start_timestamp = !start_timestamp ? -Infinity : start_timestamp;
Math3 = global.Math;
min2 = Math3.min;
r15 = !r15 ? value13 : r15;
value16 = Reflect.apply(min, Math, [r6, Reflect.apply(max, Math2, [start_timestamp, Reflect.apply(min2, Math3,
[value7, r15])])]);
startIdleSpan_59614OnIdleSpanEnded(value16);
Reflect = global.Reflect;
apply = Reflect.apply;
items2 = [value16];
} else {
startIdleSpan_59614OnIdleSpanEnded(value7);
Reflect = global.Reflect;
apply = Reflect.apply;
items2 = [value7];
}
return Reflect.apply(apply, Reflect, [a0, a1, items2.concat(env1_2(value5))]);
function _fun59625(a0) { // fn#59625, offset: 0x016edfcd, size: 16 bytes, params: 2, frame: 2
return a0 !== env1_12;
}
function _fun59626(a0) { // fn#59626, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7578:2686, offset: 0x016ee3d1, size: 47 bytes, params: 2, frame: 11
let value = environment.__proto__.__proto__;
value = require(7374) /* metro dependency 7374 */;
return value.spanToJSON(a0).timestamp;
}
}
function _fun59628(a0) { // fn#59628, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7578:3010, offset: 0x016ee400, size: 227 bytes, params: 2, frame: 16
var value3;
var moduleValue;
var value4;
var spanDescendants;
var spanId;
let r1 = Module00065Module || a0 === env0_12;
if (!r1) {
value3 = environment.__proto__;
moduleValue = require(7374) /* metro dependency 7374 */;
r1 = moduleValue.spanToJSON(a0).timestamp;
}
if (!r1) {
value4 = environment.__proto__;
spanDescendants = (require(7374) /* metro dependency 7374 */).getSpanDescendants(env0_12);
if (spanDescendants.includes(a0)) {
spanId = a0.spanContext().spanId;
startIdleSpan_59614_cancelIdleTimeout();
env0_1.set(spanId, true);
startIdleSpan_59614_restartChildSpanTimeout((require(7383) /* metro dependency 7383 */).timestampInSeconds() + childSpanTimeout / 1000);
}
}
}
function _fun59629(a0) { // fn#59629, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7578:3280, offset: 0x016ee4e3, size: 144 bytes, params: 2, frame: 13
var spanId;
var binding;
var startIdleSpan_59614_restartIdleTimeoutBinding;
var value2;
if (!Module00065Module) {
spanId = a0.spanContext().spanId;
binding = env0_1;
if (binding.has(spanId)) {
env0_1.delete(spanId);
}
if (env0_1.size === 0) {
startIdleSpan_59614_restartIdleTimeoutBinding = startIdleSpan_59614_restartIdleTimeout;
value2 = environment.__proto__;
startIdleSpan_59614_restartIdleTimeoutBinding((require(7383) /* metro dependency 7383 */).timestampInSeconds() + idleTimeout / 1000);
}
}
}
function _fun59630(a0) { // fn#59630, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7578:3479, offset: 0x016ee573, size: 54 bytes, params: 2, frame: 10
if (a0 === env0_12) {
startIdleSpan_59614_restartIdleTimeout();
if (env0_1.size) {
startIdleSpan_59614_restartChildSpanTimeout();
}
}
}
function _fun59631() { // fn#59631, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7578:3621, offset: 0x016ee5a9, size: 97 bytes, params: 1, frame: 15
var binding;
var setStatus;
var object;
var value2;
if (!Module00065Module) {
binding = env0_12;
setStatus = binding.setStatus;
object = {};
value2 = environment.__proto__;
object.code = (require(7386) /* metro dependency 7386 */).SPAN_STATUS_ERROR;
object.message = 'deadline_exceeded';
Reflect.apply(setStatus, binding, [object]);
binding = env0_12;
binding.end();
}
}
}
}
global.__d(_fun59613, 7400, [65, 862, 7396, 7401, 7402, 7374, 7383, 7391, 7384, 7369, 7386, 7397,
7403]) /* metro module 7400, dependencies: [65, 862, 7396, 7401, 7402, 7374, 7383, 7391, 7384, 7369, 7386, 7397, 7403] */;