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

432 lines
21 KiB
JavaScript

/* Metro module 852; source: unknown; dependencies: [77, 65, 6, 7, 838, 840, 853, 854, 836, 847, 841, 855, 839, 832, 833] */
import * as ClassCallCheckModule from './module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
import * as CreateClassModule from './module-00007-CreateClass.js'; /* Metro dependency 7 */
import * as Module00065Module from './module-00065.js'; /* Metro dependency 65 */
import * as Module00077Module from './module-00077.js'; /* Metro dependency 77 */
import * as Module00853Module from './module-00853.js'; /* Metro dependency 853 */
function _fun9196(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#9196, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:979:6, offset: 0x00d5f9f7, size: 145 bytes, params: 8, frame: 18
const env0_0 = require;
const Object = global.Object;
const defineProperty = Object.defineProperty;
const Symbol = global.Symbol;
Reflect.apply(defineProperty, Object, [exports, Symbol.toStringTag, {value: 'Module'}]);
exports.Scope = _fun9197();
function _fun9197() { // fn#9197, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:979:141, offset: 0x00d5fa88, size: 895 bytes, params: 1, frame: 15
return CreateClassModule(Scope, [{key: 'clone', value: value_9199}, {key: 'setClient', value: function(a0) {
this._client = a0;
}}, {key: 'setLastEventId', value: function(a0) {
this._lastEventId = a0;
}}, {key: 'getClient', value: function() {
return this._client;
}}, {key: 'lastEventId', value: function() {
return this._lastEventId;
}}, {key: 'addScopeListener', value: function(a0) {
this._scopeListeners.push(a0);
}}, {key: 'addEventProcessor', value: function(a0) {
this._eventProcessors.push(a0);
return this;
}}, {key: 'setUser', value: value_9206}, {key: 'getUser', value: function() {
return this._user;
}}, {key: 'setTags', value: function(a0) {
var Object = global.Object;
this._tags = Object.assign({}, this._tags, a0);
this._notifyScopeListeners();
return this;
}}, {key: 'setTag', value: value_9209}, {key: 'setAttributes', value: function(a0) {
var Object = global.Object;
this._attributes = Object.assign({}, this._attributes, a0);
this._notifyScopeListeners();
return this;
}}, {key: 'setAttribute', value: value_9211}, {key: 'removeAttribute', value: function(a0) {
if (a0 in this._attributes) {
delete this._attributes[a0];
this._notifyScopeListeners();
}
return this;
}}, {key: 'setExtras', value: function(a0) {
var Object = global.Object;
this._extra = Object.assign({}, this._extra, a0);
this._notifyScopeListeners();
return this;
}}, {key: 'setExtra', value: value_9214}, {key: 'setFingerprint', value: function(a0) {
this._fingerprint = a0;
this._notifyScopeListeners();
return this;
}}, {key: 'setLevel', value: function(a0) {
this._level = a0;
this._notifyScopeListeners();
return this;
}}, {key: 'setTransactionName', value: function(a0) {
this._transactionName = a0;
this._notifyScopeListeners();
return this;
}}, {key: 'setContext', value: function(a0, a1) {
if (a1 === null) {
delete this._contexts[a0];
} else {
this._contexts[a0] = a1;
}
this._notifyScopeListeners();
return this;
}}, {key: 'setSession', value: function(a0) {
if (a0) {
this._session = a0;
} else {
delete this._session;
}
this._notifyScopeListeners();
return this;
}}, {key: 'getSession', value: function() {
return this._session;
}}, {key: 'update', value: value_9221}, {key: 'clear', value: value_9222}, {key: 'addBreadcrumb',
value: value_9223}, {key: 'getLastBreadcrumb', value: function() {
return this._breadcrumbs[this._breadcrumbs.length - 1];
}}, {key: 'clearBreadcrumbs', value: function() {
this._breadcrumbs = [];
this._notifyScopeListeners();
return this;
}}, {key: 'addAttachment', value: function(a0) {
this._attachments.push(a0);
return this;
}}, {key: 'clearAttachments', value: function() {
this._attachments = [];
return this;
}}, {key: 'getScopeData', value: value_9228}, {key: 'setSDKProcessingMetadata', value: value_9229},
{key: 'setPropagationContext', value: function(a0) {
this._propagationContext = a0;
return this;
}}, {key: 'getPropagationContext', value: function() {
return this._propagationContext;
}}, {key: 'captureException', value: value_9232}, {key: 'captureMessage', value: value_9233}, {key: 'captureEvent',
value: value_9234}, {key: '_notifyScopeListeners', value: function() {
var env0_0 = this;
if (!this._notifyingListeners) {
this._notifyingListeners = true;
this._scopeListeners.forEach(_fun9236);
this._notifyingListeners = false;
}
}}]);
function Scope() { // fn#9198, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:979:165, offset: 0x00d5fe07, size: 193 bytes, params: 1, frame: 16
const value = environment.__proto__;
env1_4(this, Scope);
this._notifyingListeners = false;
this._scopeListeners = [];
this._eventProcessors = [];
this._breadcrumbs = [];
this._attachments = [];
this._user = {};
this._tags = {};
this._attributes = {};
this._extra = {};
this._contexts = {};
this._sdkProcessingMetadata = {};
const object = {};
object.traceId = (require(838) /* metro dependency 838 */).generateTraceId();
object.sampleRand = (require(840) /* metro dependency 840 */).safeMathRandom();
this._propagationContext = object;
}
function value_9199() { // fn#9199, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:979:559, offset: 0x00d5fec8, size: 477 bytes, params: 1, frame: 18
var object;
const scope = new Scope();
let binding = env1_3;
scope._breadcrumbs = binding(this._breadcrumbs);
let Object = global.Object;
let assign = Object.assign;
scope._tags = Reflect.apply(assign, Object, [{}, this._tags]);
Object = global.Object;
scope._attributes = Object.assign({}, this._attributes);
Object = global.Object;
scope._extra = Object.assign({}, this._extra);
Object = global.Object;
assign = Object.assign;
let _contexts = this._contexts;
scope._contexts = Reflect.apply(assign, Object, [{}, _contexts]);
if (this._contexts.flags) {
_contexts = scope._contexts;
object = {};
object.values = env1_3(this._contexts.flags.values);
_contexts.flags = object;
}
scope._user = this._user;
scope._level = this._level;
scope._session = this._session;
scope._transactionName = this._transactionName;
scope._fingerprint = this._fingerprint;
binding = env1_3;
scope._eventProcessors = binding(this._eventProcessors);
scope._attachments = binding(this._attachments);
Object = global.Object;
scope._sdkProcessingMetadata = Object.assign({}, this._sdkProcessingMetadata);
Object = global.Object;
scope._propagationContext = Object.assign({}, this._propagationContext);
scope._client = this._client;
scope._lastEventId = this._lastEventId;
const _setSpanForScope = Module00853Module._setSpanForScope;
Reflect.apply(_setSpanForScope, Module00853Module, [scope, Module00853Module._getSpanForScope(this)]);
return scope;
}
function value_9206(a0) { // fn#9206, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:979:1857, offset: 0x00d60102, size: 114 bytes, params: 2, frame: 15
var value2;
var moduleValue;
const value = a0;
this._user = value || ({email: undefined, id: undefined, ip_address: undefined, username: undefined});
if (this._session) {
value2 = environment.__proto__;
moduleValue = require(854) /* metro dependency 854 */;
moduleValue.updateSession(this._session, {user: value});
}
this._notifyScopeListeners();
return this;
}
function value_9209(a0, a1) { // fn#9209, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:979:2260, offset: 0x00d601b3, size: 40 bytes, params: 3, frame: 17
return this.setTags(env1_2({}, a0, a1));
}
function value_9211(a0, a1) { // fn#9211, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:979:2490, offset: 0x00d6020f, size: 40 bytes, params: 3, frame: 17
return this.setAttributes(env1_2({}, a0, a1));
}
function value_9214(a0, a1) { // fn#9214, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:979:2862, offset: 0x00d60294, size: 73 bytes, params: 3, frame: 19
const Object = global.Object;
const assign = Object.assign;
const _extra = this._extra;
const value = environment.__proto__;
this._extra = Reflect.apply(assign, Object, [{}, _extra, env1_2({}, a0, a1)]);
this._notifyScopeListeners();
return this;
}
function value_9221(a0) { // fn#9221, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:979:3692, offset: 0x00d60383, size: 362 bytes, params: 2, frame: 24
var r3;
var r1;
var r2;
var value4;
var value5;
var moduleValue;
var tags;
var attributes;
var extra;
var user;
var contexts;
var level;
var fingerprint;
var propagationContext;
var Object;
var assign;
const value = a0;
if (value) {
r3 = typeof value !== 'function' ? value : value(this);
if (r3 instanceof Scope) {
r1 = r3.getScopeData();
} else {
value4 = environment.__proto__;
value5 = undefined;
moduleValue = require(836) /* metro dependency 836 */;
r1 = moduleValue.isPlainObject(r3) ? value : value5;
}
r1 = !r1 ? {} : r1;
tags = r1.tags;
attributes = r1.attributes;
extra = r1.extra;
user = r1.user;
contexts = r1.contexts;
level = r1.level;
fingerprint = r1.fingerprint;
r2 = fingerprint !== undefined ? fingerprint : [];
propagationContext = r1.propagationContext;
Object = global.Object;
assign = Object.assign;
this._tags = Reflect.apply(assign, Object, [{}, this._tags, tags]);
Object = global.Object;
assign = Object.assign;
this._attributes = Reflect.apply(assign, Object, [{}, this._attributes, attributes]);
Object = global.Object;
assign = Object.assign;
this._extra = Reflect.apply(assign, Object, [{}, this._extra, extra]);
Object = global.Object;
assign = Object.assign;
this._contexts = Reflect.apply(assign, Object, [{}, this._contexts, contexts]);
if (user && global.Object.keys(user).length) {
this._user = user;
}
if (level) {
this._level = level;
}
if (r2.length) {
this._fingerprint = r2;
}
if (propagationContext) {
this._propagationContext = propagationContext;
}
}
return this;
}
function value_9222() { // fn#9222, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:979:4314, offset: 0x00d604ed, size: 203 bytes, params: 1, frame: 17
this._breadcrumbs = [];
this._tags = {};
this._attributes = {};
this._extra = {};
this._user = {};
this._contexts = {};
this._level = undefined;
this._transactionName = undefined;
this._fingerprint = undefined;
this._session = undefined;
const value = environment.__proto__;
(Module00853Module)._setSpanForScope(this, undefined);
this._attachments = [];
const setPropagationContext = this.setPropagationContext;
const object = {};
object.traceId = (require(838) /* metro dependency 838 */).generateTraceId();
object.sampleRand = (require(840) /* metro dependency 840 */).safeMathRandom();
Reflect.apply(setPropagationContext, this, [object]);
this._notifyScopeListeners();
return this;
}
function value_9223(a0, a1) { // fn#9223, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:979:4756, offset: 0x00d605b8, size: 267 bytes, params: 3, frame: 22
var r7;
var _client;
let value = a1;
const r1 = typeof value !== 'number' ? 100 : value;
if (!(r1 <= 0)) {
var Object = global.Object;
var assign = Object.assign;
var object = {};
value = environment.__proto__;
object.timestamp = (require(847) /* metro dependency 847 */).dateTimestampInSeconds();
if (a0.message) {
value = require(841) /* metro dependency 841 */;
value = value.truncate(a0.message, 2048);
r7 = value;
} else {
r7 = a0.message;
}
value = Reflect.apply(assign, Object, [object, a0, {message: r7}]);
var _breadcrumbs = this._breadcrumbs;
_breadcrumbs.push(value);
_breadcrumbs = this._breadcrumbs;
if (_breadcrumbs.length > r1) {
_breadcrumbs = this._breadcrumbs;
this._breadcrumbs = _breadcrumbs.slice(-r1);
_client = this._client;
if (_client != null) {
_client.recordDroppedEvent('buffer_overflow', 'log_item');
}
}
this._notifyScopeListeners();
}
return this;
}
function value_9228() { // fn#9228, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:979:5640, offset: 0x00d60724, size: 197 bytes, params: 1, frame: 13
const object = {};
object.breadcrumbs = this._breadcrumbs;
object.attachments = this._attachments;
object.contexts = this._contexts;
object.tags = this._tags;
object.attributes = this._attributes;
object.extra = this._extra;
object.user = this._user;
object.level = this._level;
object.fingerprint = this._fingerprint || [];
object.eventProcessors = this._eventProcessors;
object.propagationContext = this._propagationContext;
object.sdkProcessingMetadata = this._sdkProcessingMetadata;
object.transactionName = this._transactionName;
const value = environment.__proto__;
object.span = (require(853) /* metro dependency 853 */)._getSpanForScope(this);
return object;
}
function value_9229(a0) { // fn#9229, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:979:6132, offset: 0x00d607e9, size: 61 bytes, params: 2, frame: 16
let value = environment.__proto__;
value = require(855) /* metro dependency 855 */;
this._sdkProcessingMetadata = value.merge(this._sdkProcessingMetadata, a0, 2);
return this;
}
function value_9232(a0, a1) { // fn#9232, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:979:6501, offset: 0x00d6083f, size: 241 bytes, params: 3, frame: 21
var error;
var captureException;
var Object;
const r0 = a1?.event_id || (require(839) /* metro dependency 839 */).uuid4();
let _client = this._client;
if (_client) {
error = new global.Error('Sentry syntheticException');
_client = this._client;
captureException = _client.captureException;
Object = global.Object;
Reflect.apply(captureException, _client, [a0, Object.assign({originalException: a0, syntheticException: error},
a1,
{event_id: r0}), this]);
} else if ((require(832) /* metro dependency 832 */).DEBUG_BUILD) {
(require(833) /* metro dependency 833 */).debug.warn('No client configured on scope - will not capture exception!');
}
return r0;
}
function value_9233(a0, a1, a2) { // fn#9233, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:979:6910, offset: 0x00d60930, size: 268 bytes, params: 4, frame: 22
var r1;
var captureMessage;
var Object;
let value = undefined;
const r0 = (a2 == null ? value : a2.event_id) || (require(839) /* metro dependency 839 */).uuid4();
let _client = this._client;
if (_client) {
r1 = (a2 == null ? value : a2.syntheticException) ?? new global.Error(a0);
_client = this._client;
captureMessage = _client.captureMessage;
Object = global.Object;
value = Object.assign({originalException: a0, syntheticException: r1}, a2, {event_id: r0});
Reflect.apply(captureMessage, _client, [a0, a1, value, this]);
} else if ((require(832) /* metro dependency 832 */).DEBUG_BUILD) {
(require(833) /* metro dependency 833 */).debug.warn('No client configured on scope - will not capture message!');
}
return r0;
}
function value_9234(a0, a1) { // fn#9234, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:979:7339, offset: 0x00d60a3c, size: 199 bytes, params: 3, frame: 19
var value4;
var captureEvent;
var Object;
const r0 = a1?.event_id || (require(839) /* metro dependency 839 */).uuid4();
let _client = this._client;
if (_client) {
_client = this._client;
captureEvent = _client.captureEvent;
Object = global.Object;
Reflect.apply(captureEvent, _client, [a0, Object.assign({}, a1, {event_id: r0}), this]);
} else {
value4 = environment.__proto__;
if ((require(832) /* metro dependency 832 */).DEBUG_BUILD) {
(require(833) /* metro dependency 833 */).debug.warn('No client configured on scope - will not capture event!');
}
}
return r0;
}
function value_9235() { // fn#9235, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:979:7651, offset: 0x00d60b03, size: 59 bytes, params: 1, frame: 12
if (!this._notifyingListeners) {
this._notifyingListeners = true;
this._scopeListeners.forEach(_fun9236);
this._notifyingListeners = false;
}
function _fun9236(a0) { // fn#9236, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:979:7780, offset: 0x00cd9b0e, size: 19 bytes, params: 2, frame: 11
a0(env0_0);
}
}
}
}
global.__d(_fun9196, 852, [77, 65, 6, 7, 838, 840, 853, 854, 836, 847, 841, 855, 839, 832,
833]) /* metro module 852, dependencies: [77, 65, 6, 7, 838, 840, 853, 854, 836, 847, 841, 855, 839, 832, 833] */;