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

344 lines
20 KiB
JavaScript

/* Metro module 1184; source: unknown; dependencies: [6, 7, 15, 17, 102, 18, 27, 1185, 1005, 1120, 826, 1032, 1009, 1186, 1187, 1136, 823, 1137] */
import ClassCallCheck from './module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
import CreateClass from './module-00007-CreateClass.js'; /* Metro dependency 7 */
import PossibleConstructorReturn from './module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
import Module00017 from './module-00017.js'; /* Metro dependency 17 */
import Inherits from './module-00018-Inherits.js'; /* Metro dependency 18 */
import Module00102 from './module-00102.js'; /* Metro dependency 102 */
import * as ReactNativeModule from './module-00027-ReactNative.js'; /* Metro dependency 27 */
import * as Module00823Module from './module-00823.js'; /* Metro dependency 823 */
import * as Module00826Module from './module-00826.js'; /* Metro dependency 826 */
import * as ReactNativeLibrariesModule from './module-01005-ReactNativeLibraries.js'; /* Metro dependency 1005 */
import * as Module01009Module from './module-01009.js'; /* Metro dependency 1009 */
import * as Module01137Module from './module-01137.js'; /* Metro dependency 1137 */
import * as IgnoreRequireCycleLogsModule from './module-01185-ignoreRequireCycleLogs.js'; /* Metro dependency 1185 */
import * as Module01186Module from './module-01186.js'; /* Metro dependency 1186 */
import * as MergeOutcomesModule from './module-01187-mergeOutcomes.js'; /* Metro dependency 1187 */
function _fun13139(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#13139, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1311:6, offset: 0x00de22ab, size: 223 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
(ReactNativeModule).Alert;
const Client = (Module00826Module).Client;
exports.ReactNativeClient = _fun13145(Client);
function _isNativeReflectConstruct_13140() { // fn#13140, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1311:174, offset: 0x00de238a, size: 94 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_13140_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _superPropGet_13143(a0, a1, a2, a3) { // fn#13143, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1311:393, offset: 0x00de23e8, size: 99 bytes, params: 5, frame: 18
let value = a0;
const env0_0 = a2;
value = Module00017(1 & 3 ? value.prototype : value);
value = Module00102(value, a1, a2);
return 2 & 3 ? typeof value !== 'function' ? value : _fun13144 : value;
function _fun13144(a0) { // fn#13144, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1311:492, offset: 0x00c62408, size: 27 bytes, params: 2, frame: 13
return env0_1.apply(importDefault, a0);
}
}
function _fun13145(a0) { // fn#13145, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1311:533, offset: 0x00de244b, size: 329 bytes, params: 2, frame: 16
const ReactNativeClient2 = ReactNativeClient;
Inherits(ReactNativeClient2, a0);
return CreateClass(ReactNativeClient2, [{key: 'eventFromException', value: value_13150}, {key: 'eventFromMessage',
value: value_13151}, {key: 'nativeCrash', value: function() {
var NATIVE = require(dependencyMap[12]).NATIVE;
NATIVE.nativeCrash();
}}, {key: 'close', value: value_13153}, {key: 'captureUserFeedback', value: value_13156}, {key: 'sendEnvelope',
value: value_13157}, {key: 'init', value: value_13159}, {key: 'on', value: value_13160}, {key: 'emit',
value: value_13161}, {key: '_initNativeSdk', value: value_13162}, {key: '_showCannotConnectDialog',
value: function() {
}}, {key: '_attachClientReportTo', value: value_13168}]);
function ReactNativeClient(a0) { // fn#13146, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1311:545, offset: 0x00de2594, size: 669 bytes, params: 2, frame: 32
const binding = env1_2;
const value3 = undefined;
binding(this, ReactNativeClient);
const ignoreRequireCycleLogs = IgnoreRequireCycleLogsModule.ignoreRequireCycleLogs;
const ReactNativeLibraries = (ReactNativeLibrariesModule).ReactNativeLibraries;
const ReactNativeVersion = ReactNativeLibraries.ReactNativeVersion;
Reflect.apply(ignoreRequireCycleLogs, IgnoreRequireCycleLogsModule,
[ReactNativeVersion === null || value3 === ReactNativeVersion ? value3 : ReactNativeVersion.version]);
const Object = global.Object;
const assign = Object.assign;
const Object2 = global.Object;
const assign2 = Object2.assign;
let _metadata = a0._metadata;
const value4 = Reflect.apply(assign2, Object2, [{}, _metadata]);
const Object3 = global.Object;
const assign3 = Object3.assign;
const Object4 = global.Object;
const assign4 = Object4.assign;
_metadata = a0._metadata;
let sdk = _metadata === null || value3 === _metadata ? value3 : _metadata.sdk;
const value5 = Reflect.apply(assign4, Object4, [{},
sdk || (require(1120) /* metro dependency 1120 */).defaultSdkInfo]);
const Object5 = global.Object;
const assign5 = Object5.assign;
_metadata = a0._metadata;
sdk = _metadata === null || value3 === _metadata ? value3 : _metadata.sdk;
a0._metadata = Reflect.apply(assign, Object, [value4, {sdk: Reflect.apply(assign3, Object3, [value5,
{settings: Reflect.apply(assign5, Object5, [{infer_ip: a0.sendDefaultPii ? 'auto' : 'never'},
sdk === null || value3 === sdk ? value3 : sdk.settings])}])}]);
a0.parentSpanIsAlwaysRootSpan = value3 === a0.parentSpanIsAlwaysRootSpan || a0.parentSpanIsAlwaysRootSpan;
const enableLogs = a0.enableLogs;
if (a0.enableLogs && a0.logsOrigin === 'native') {
(require(826) /* metro dependency 826 */).debug.log('disabling Sentry logs on JavaScript due to rule set by logsOrigin');
a0.enableLogs = false;
}
items2 = [a0];
const value10 = env1_5(ReactNativeClient);
const value13 = env1_4(this, _isNativeReflectConstruct_13140() ? global.Reflect.construct(value10, items2,
env1_5(this).constructor) : value10.apply(this, items2));
value13._outcomesBuffer = [];
if (a0.sendDefaultPii === true) {
value13.on('beforeSendSession', (require(826) /* metro dependency 826 */).addAutoIpAddressToSession);
}
if (a0.enableLogs) {
value13.on('flush', _fun13147);
value13.on('afterCaptureLog', _fun13148);
}
a0.enableLogs = enableLogs;
return value13;
function _fun13147() { // fn#13147, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1311:1632, offset: 0x00de2831, size: 45 bytes, params: 1, frame: 12
const value = environment.__proto__.__proto__;
(Module00826Module)._INTERNAL_flushLogsBuffer(env0_0);
}
function _fun13148() { // fn#13148, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1311:1709, offset: 0x00de285e, size: 82 bytes, params: 1, frame: 14
if (env0_0._logFlushIdleTimeout) {
global.clearTimeout(env0_0._logFlushIdleTimeout);
}
env0_0._logFlushIdleTimeout = global.setTimeout(_fun13149, 5000);
function _fun13149() { // fn#13149, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1311:1816, offset: 0x00de28b0, size: 45 bytes, params: 1, frame: 12
const value = environment.__proto__.__proto__.__proto__;
(Module00826Module)._INTERNAL_flushLogsBuffer(env1_0);
}
}
}
function value_13150(a0) { // fn#13150, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1311:1977, offset: 0x00de28dd, size: 101 bytes, params: 2, frame: 17
const r5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
let value = environment.__proto__;
value = require(1032) /* metro dependency 1032 */;
return value.eventFromException(this._options.stackParser, a0, r5, this._options.attachStacktrace);
}
function value_13151(a0, a1, a2) { // fn#13151, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1311:2202, offset: 0x00de2942, size: 76 bytes, params: 4, frame: 19
let value = environment.__proto__;
value = require(1032) /* metro dependency 1032 */;
return value.eventFromMessage(this._options.stackParser, a0, a1, a2, this._options.attachStacktrace);
}
function value_13153() { // fn#13153, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1311:2435, offset: 0x00de29b9, size: 60 bytes, params: 1, frame: 17
var environment;
let value = environment.__proto__;
value = _superPropGet_13143(ReactNativeClient, 'close', this, 3);
value = value([]);
return value.then(_fun13154);
function _fun13154(a0) { // fn#13154, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1311:2517, offset: 0x00de29f5, size: 67 bytes, params: 2, frame: 12
var environment;
const env0_0 = a0;
const value = environment.__proto__.__proto__;
const NATIVE = (Module01009Module).NATIVE;
return NATIVE.closeNativeSdk().then(_fun13155);
function _fun13155() { // fn#13155, offset: 0x00c36f09, size: 9 bytes, params: 1, frame: 1
return env0_0;
}
}
}
function value_13156(a0) { // fn#13156, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1311:2637, offset: 0x00de2a38, size: 95 bytes, params: 2, frame: 15
let value = environment.__proto__;
const createUserFeedbackEnvelope = (Module01186Module).createUserFeedbackEnvelope;
const object = {};
object.metadata = this._options._metadata;
object.dsn = this.getDsn();
object.tunnel = undefined;
value = Reflect.apply(createUserFeedbackEnvelope, value, [a0, object]);
this.sendEnvelope(value);
}
function value_13157(a0) { // fn#13157, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1311:2831, offset: 0x00de2a97, size: 275 bytes, params: 2, frame: 18
const debug = (Module00826Module).debug;
const value = this._clearOutcomes();
this._outcomesBuffer = MergeOutcomesModule.mergeOutcomes(this._outcomesBuffer, value);
if (this._options.sendClientReports) {
this._attachClientReportTo(this._outcomesBuffer, a0);
}
const env0_0 = true;
if (this._isEnabled()) {
if (this._transport) {
if (this._dsn) {
this.emit('beforeEnvelope', a0);
this._transport.send(a0).then(null, _fun13158);
} else {
debug.error('Transport disabled');
}
} else {
debug.error('Transport disabled');
}
} else {
debug.error('Transport disabled');
}
if (env0_0) {
this._outcomesBuffer = [];
}
const Promise = global.Promise;
return Promise.resolve({});
function _fun13158(a0) { // fn#13158, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1311:3165, offset: 0x00de2baa, size: 134 bytes, params: 2, frame: 16
const debug = (Module00826Module).debug;
const SentryError = (Module00826Module).SentryError;
if (a0 instanceof SentryError) {
debug.error('SentryError while sending event, keeping outcomes buffer:', a0);
} else {
debug.error('Error while sending event:', a0);
}
}
}
function value_13159() { // fn#13159, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1311:3475, offset: 0x00de2c30, size: 58 bytes, params: 1, frame: 17
const value = environment.__proto__;
_superPropGet_13143(ReactNativeClient, 'init', this, 3)([]);
this._initNativeSdk();
}
function value_13160(a0, a1) { // fn#13160, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1311:3582, offset: 0x00de2c6a, size: 57 bytes, params: 3, frame: 17
const value = environment.__proto__;
return _superPropGet_13143(ReactNativeClient, 'on', this, 3)([a0, a1]);
}
function value_13161(a0) { // fn#13161, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1311:3678, offset: 0x00de2ca3, size: 141 bytes, params: 2, frame: 19
var r1;
var value4;
var value7;
var value8;
let value = arguments.length;
const Array = global.Array;
const value2 = 1;
reducibleJoin2: while (true) {
if (value > value2) {
value4 = value - value2;
r1 = value4;
break reducibleJoin2;
}
r1 = 0;
break reducibleJoin2;
}
const array = new Array();
if (value2 < value) {
r1 = value2;
reducibleLoop3: while (true) {
value7 = r1 - value2;
array[value7] = arguments[r1];
value8 = typeof r1 === 'bigint' ? r1 + 1n : +r1 + 1;
if (value8 < value) {
r1 = value8;
continue reducibleLoop3;
}
break reducibleLoop3;
}
}
value = environment.__proto__;
value = _superPropGet_13143(ReactNativeClient, 'emit', this, 3);
const items2 = [a0];
value(items2.concat(array));
}
function value_13162() { // fn#13162, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1311:3869, offset: 0x00de2d30, size: 402 bytes, params: 1, frame: 25
var environment;
let value = environment.__proto__;
const value2 = undefined;
const NATIVE = (Module01009Module).NATIVE;
const initNativeSdk = NATIVE.initNativeSdk;
const Object = global.Object;
const assign = Object.assign;
const Object2 = global.Object;
const value3 = Object2.assign({}, this._options);
const object = {};
object.defaultSidecarUrl = (require(1136) /* metro dependency 1136 */).getDefaultSidecarUrl();
const devServer = (Module00823Module).getDevServer();
let url = devServer === null || value2 === devServer ? value2 : devServer.url;
url = !url ? '' : url;
object.devServerUrl = url;
const _integrations = this._integrations;
const MOBILE_REPLAY_INTEGRATION_NAME = (Module01137Module).MOBILE_REPLAY_INTEGRATION_NAME;
object.mobileReplayOptions = _integrations[MOBILE_REPLAY_INTEGRATION_NAME] && 'options' in this._integrations[MOBILE_REPLAY_INTEGRATION_NAME] ? this._integrations[MOBILE_REPLAY_INTEGRATION_NAME].options : value2;
const _experiments = this._options._experiments;
object.androidProfilingOptions = _experiments === null || value2 === _experiments ? value2 : _experiments.androidProfilingOptions;
value = Reflect.apply(initNativeSdk, NATIVE, [Reflect.apply(assign, Object, [value3, object])]);
value = value.then(function(a0) {
return a0;
}, _fun13164);
value = value.then(_fun13165);
value.then(value2, function(a0) {
require(dependencyMap[10]).debug.error('The OnReady callback threw an error: ', a0);
});
return value2;
function _fun13164() { // fn#13164, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1311:4490, offset: 0x00de2ec2, size: 23 bytes, params: 1, frame: 9
env0_0._showCannotConnectDialog();
return false;
}
function _fun13165(a0) { // fn#13165, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1311:4549, offset: 0x00de2ed9, size: 85 bytes, params: 2, frame: 15
const _options = env0_0._options;
const onReady = _options.onReady;
if (!(onReady === null || onReady === undefined)) {
onReady.call(_options, {didCallNativeInit: a0});
}
env0_0.emit('afterInit');
}
}
function value_13168(a0, a1) { // fn#13168, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1311:4878, offset: 0x00de2f63, size: 122 bytes, params: 3, frame: 16
var object;
var value;
if (a0.length > 0) {
object = {};
value = environment.__proto__;
value = require(826) /* metro dependency 826 */;
object.timestamp = value.dateTimestampInSeconds();
object.discarded_events = a0;
a1[(require(1186) /* metro dependency 1186 */).items].push([{type: 'client_report'}, object]);
}
}
}
}
global.__d(_fun13139, 1184, [6, 7, 15, 17, 102, 18, 27, 1185, 1005, 1120, 826, 1032, 1009, 1186, 1187, 1136, 823,
1137]) /* metro module 1184, dependencies: [6, 7, 15, 17, 102, 18, 27, 1185, 1005, 1120, 826, 1032, 1009, 1186, 1187, 1136, 823, 1137] */;