/* Metro module 1168; source: unknown; dependencies: [27, 826, 1130, 1169, 1166] */ function _fun12953(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#12953, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1295:6, offset: 0x00ddbe5f, size: 264 bytes, params: 8, frame: 21 const env0_0 = require; const closure = getDefaultIdleNavigationSpanOptions; const closure2 = isSentryInteractionSpan; const closure3 = clearActiveSpanFromScope; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_2 = (require(27) /* metro dependency 27 */).AppState; const closure4 = startIdleSpan_12957; exports.DEFAULT_NAVIGATION_SPAN_NAME = 'Route Change'; exports.defaultIdleOptions = {'idleTimeout': 1000, 'finalTimeout': 600000}; exports.startIdleNavigationSpan = startIdleNavigationSpan; exports.startIdleSpan = closure4; exports.getDefaultIdleNavigationSpanOptions = closure; exports.isSentryInteractionSpan = closure2; exports.SCOPE_SPAN_FIELD = '_sentrySpan'; exports.clearActiveSpanFromScope = closure3; exports.addDefaultOpForSpanFrom = function(a0) { a0.on('spanStart', _fun12960); }; exports.SPAN_THREAD_NAME = 'thread.name'; exports.SPAN_THREAD_NAME_MAIN = 'main'; exports.SPAN_THREAD_NAME_JAVASCRIPT = 'javascript'; exports.addThreadInfoToSpan = function(a0) { a0.on('spanStart', _fun12962); }; exports.setMainThreadInfo = function(a0) { a0.data = a0.data || ({}); a0.data['thread.name'] = 'main'; return a0; }; } function getDefaultIdleNavigationSpanOptions() { // fn#12954, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1295:774, offset: 0x00ddbf67, size: 66 bytes, params: 1, frame: 12 const object2 = {'name': null, 'op': 'navigation', 'forceTransaction': true}; object2.name = env0_3; object2.scope = (require(826) /* metro dependency 826 */).getCurrentScope(); return object2; } function isSentryInteractionSpan(a0) { // fn#12955, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1295:904, offset: 0x00ddbfa9, size: 109 bytes, params: 2, frame: 14 const SPAN_ORIGIN_AUTO_INTERACTION = (require(1166) /* metro dependency 1166 */).SPAN_ORIGIN_AUTO_INTERACTION; const items2 = [SPAN_ORIGIN_AUTO_INTERACTION]; const SPAN_ORIGIN_MANUAL_INTERACTION = (require(1166) /* metro dependency 1166 */).SPAN_ORIGIN_MANUAL_INTERACTION; items2[1] = SPAN_ORIGIN_MANUAL_INTERACTION; const includes = items2.includes; const value = require(826) /* metro dependency 826 */; let origin = value.spanToJSON(a0).origin; origin = !origin ? '' : origin; return Reflect.apply(includes, items2, [origin]); } function clearActiveSpanFromScope(a0) { // fn#12956, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1295:1087, offset: 0x00ddc016, size: 18 bytes, params: 2, frame: 2 delete a0[env0_6]; } function startIdleSpan_12957(a0, {finalTimeout, idleTimeout}) { // fn#12957, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1295:171, offset: 0x00ddc028, size: 399 bytes, params: 3, frame: 23 const debug = (require(826) /* metro dependency 826 */).debug; const SentryNonRecordingSpan = (require(826) /* metro dependency 826 */).SentryNonRecordingSpan; var sentryNonRecordingSpan; var setPropagationContext; var object2; var value; const client = (require(826) /* metro dependency 826 */).getClient(); if (client) { if (AppState.currentState === 'background') { debug.log('[startIdleSpan] App is already in background, not starting span for ' + a0.name); value = Object.create(SentryNonRecordingSpan.prototype, {constructor: {value: SentryNonRecordingSpan}}); sentryNonRecordingSpan = new SentryNonRecordingSpan(); return sentryNonRecordingSpan instanceof Object ? sentryNonRecordingSpan : value; } value = require(826) /* metro dependency 826 */; value = value.getCurrentScope(); setPropagationContext = value.setPropagationContext; object2 = {}; object2.traceId = (require(826) /* metro dependency 826 */).generateTraceId(); object2.sampleRand = global.Math.random(); Reflect.apply(setPropagationContext, value, [object2]); value = require(826) /* metro dependency 826 */; value = value.startIdleSpan(a0, {finalTimeout: finalTimeout, idleTimeout: idleTimeout}); (require(1169) /* metro dependency 1169 */).cancelInBackground(client, value); return value; } debug.warn("[startIdleSpan] Can't create idle span, missing client."); value = Object.create(SentryNonRecordingSpan.prototype, {constructor: {value: SentryNonRecordingSpan}}); sentryNonRecordingSpan = new SentryNonRecordingSpan(); return sentryNonRecordingSpan instanceof Object ? sentryNonRecordingSpan : value; } function startIdleNavigationSpan(a0) { // fn#12958, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1295:1262, offset: 0x00ddc1b7, size: 747 bytes, params: 2, frame: 26 var op; const debug = (require(826) /* metro dependency 826 */).debug; var activeSpan; var clearActiveSpanFromScopeBinding; var moduleValue4; var log; var moduleValue5; const SPAN_STATUS_ERROR = (require(826) /* metro dependency 826 */).SPAN_STATUS_ERROR; var moduleValue6; var Object; var assign; var Object2; var value6; var value7; let r0 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; let finalTimeout = r0.finalTimeout; finalTimeout = finalTimeout === undefined ? env0_4.finalTimeout : finalTimeout; let idleTimeout = r0.idleTimeout; idleTimeout = idleTimeout === undefined ? env0_4.idleTimeout : idleTimeout; const isAppRestart = r0.isAppRestart; const r3 = isAppRestart !== undefined && isAppRestart; const client = (require(826) /* metro dependency 826 */).getClient(); const moduleValue2 = require(826) /* metro dependency 826 */; if (client) { activeSpan = moduleValue2.getActiveSpan(); r0 = activeSpan && (require(1130) /* metro dependency 1130 */).isRootSpan(activeSpan); r0 = r0 && isSentryInteractionSpan(activeSpan); clearActiveSpanFromScopeBinding = clearActiveSpanFromScope; moduleValue4 = moduleValue2; clearActiveSpanFromScopeBinding(moduleValue4.getCurrentScope()); if (r0) { if (r3) { log = debug.log; moduleValue6 = require(826) /* metro dependency 826 */; Reflect.apply(log, debug, ['[startIdleNavigationSpan] Not canceling ' + moduleValue6.spanToJSON(activeSpan).op + ' transaction because navigation is from app restart - preserving error context.']); } else if (r0) { log = debug.log; moduleValue5 = require(826) /* metro dependency 826 */; Reflect.apply(log, debug, ['[startIdleNavigationSpan] Canceling ' + moduleValue5.spanToJSON(activeSpan).op + ' transaction because of a new navigation root span.']); activeSpan.setStatus({code: SPAN_STATUS_ERROR, message: 'cancelled'}); activeSpan.end(); } } else if (r0) { log = debug.log; moduleValue5 = require(826) /* metro dependency 826 */; Reflect.apply(log, debug, ['[startIdleNavigationSpan] Canceling ' + moduleValue5.spanToJSON(activeSpan).op + ' transaction because of a new navigation root span.']); activeSpan.setStatus({code: SPAN_STATUS_ERROR, message: 'cancelled'}); activeSpan.end(); } Object = global.Object; assign = Object.assign; Object2 = global.Object; value6 = Reflect.apply(assign, Object, [Object2.assign({}, getDefaultIdleNavigationSpanOptions()), a0]); value7 = startIdleSpan_12957(value6, {finalTimeout: finalTimeout, idleTimeout: idleTimeout}); log = debug.log; op = value6.op; op = !op ? 'unknown op' : op; Reflect.apply(log, debug, ['[startIdleNavigationSpan] Starting ' + op + ' transaction "' + value6.name + '" on scope']); (require(1169) /* metro dependency 1169 */).adjustTransactionDuration(client, value7, finalTimeout); value7.setAttribute((require(826) /* metro dependency 826 */).SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, (require(1166) /* metro dependency 1166 */).SPAN_ORIGIN_AUTO_NAVIGATION_CUSTOM); return value7; } moduleValue2.debug.warn("[startIdleNavigationSpan] Can't create route change span, missing client."); } function addDefaultOpForSpanFrom(a0) { // fn#12959, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1295:2756, offset: 0x00ddc4a2, size: 32 bytes, params: 2, frame: 13 a0.on('spanStart', function(a0) { if (!require(dependencyMap[1]).spanToJSON(a0).op) { a0.setAttribute(require(dependencyMap[1]).SEMANTIC_ATTRIBUTE_SENTRY_OP, 'default'); } }); } function addThreadInfoToSpan(a0) { // fn#12961, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1295:3016, offset: 0x00ddc51a, size: 32 bytes, params: 2, frame: 13 a0.on('spanStart', _fun12962); } function _fun12962(a0) { // fn#12962, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1295:3066, offset: 0x00ddc53a, size: 89 bytes, params: 2, frame: 14 let value = environment.__proto__; value = undefined; const moduleValue = require(826) /* metro dependency 826 */; const data = moduleValue.spanToJSON(a0).data; if (!(data === null || value === data ? value : data['thread.name'])) { a0.setAttribute('thread.name', 'javascript'); } return value; }