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

550 lines
31 KiB
JavaScript

/* Metro module 945; source: unknown; dependencies: [5, 77, 831, 944, 946, 947, 857, 949, 874, 948, 953, 955] */
import * as Module00005Module from './module-00005.js'; /* Metro dependency 5 */
import * as Module00077Module from './module-00077.js'; /* Metro dependency 77 */
import * as Module00874Module from './module-00874.js'; /* Metro dependency 874 */
import * as Module00947Module from './module-00947.js'; /* Metro dependency 947 */
import * as Module00949Module from './module-00949.js'; /* Metro dependency 949 */
import * as Module00953Module from './module-00953.js'; /* Metro dependency 953 */
function _fun10038(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#10038, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1072:6, offset: 0x00d7a40c, size: 142 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.wrapTransportError = wrapTransportError;
exports.wrapTransportOnClose = wrapTransportOnClose;
exports.wrapTransportOnMessage = wrapTransportOnMessage;
exports.wrapTransportSend = wrapTransportSend;
function wrapTransportError(a0) { // fn#10039, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1072:136, offset: 0x00d7a49a, size: 65 bytes, params: 2, frame: 15
if (a0.onerror) {
(require(831) /* metro dependency 831 */).fill(a0, 'onerror', function(a0) {
var env0_0 = a0;
return _fun10041;
});
}
function _fun10040(a0) { // fn#10040, offset: 0x00d7a4db, size: 16 bytes, params: 2, frame: 2
const env0_0 = a0;
return _fun10041;
function _fun10041(a0) { // fn#10041, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1072:223, offset: 0x00d7a4eb, size: 76 bytes, params: 2, frame: 14
var value;
var property;
var error;
try {
value = environment.__proto__.__proto__;
property = dependencyMap[11];
value = require(property);
value.captureError(a0, 'transport');
} catch (error) {
}
return env0_0.call(this, a0);
}
}
}
function wrapTransportOnClose(a0) { // fn#10042, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1072:375, offset: 0x00d7a537, size: 65 bytes, params: 2, frame: 15
if (a0.onclose) {
(require(831) /* metro dependency 831 */).fill(a0, 'onclose', function(a0) {
var env0_0 = a0;
return _fun10044;
});
}
function _fun10043(a0) { // fn#10043, offset: 0x00d7a578, size: 16 bytes, params: 2, frame: 2
const env0_0 = a0;
return _fun10044;
function _fun10044() { // fn#10044, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1072:464, offset: 0x00d7a588, size: 164 bytes, params: 1, frame: 16
var r1;
var value5;
let value = environment.__proto__.__proto__;
(Module00953Module).cleanupPendingSpansForTransport(this);
(Module00947Module).cleanupSessionDataForTransport(this);
value = arguments.length;
const Array = global.Array;
const array = new Array(value);
const value4 = 0;
if (value4 < value) {
for (r1 = value4; true; r1 = value5) {
array[r1] = arguments[r1];
value5 = typeof r1 === 'bigint' ? r1 + 1n : +r1 + 1;
if (!(value5 < value)) {
break;
}
}
}
const binding = env0_0;
const call = binding.call;
const items2 = [this];
return call.apply(binding, items2.concat(array));
}
}
}
function wrapTransportOnMessage(a0, a1) { // fn#10045, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1072:709, offset: 0x00d7a62c, size: 72 bytes, params: 3, frame: 15
let env0_0 = a1;
if (a0.onmessage) {
(require(831) /* metro dependency 831 */).fill(a0, 'onmessage', function(a0) {
var env0_0 = a0;
return _fun10047;
});
}
function _fun10046(a0) { // fn#10046, offset: 0x00d7a674, size: 16 bytes, params: 2, frame: 2
const env0_0 = a0;
return _fun10047;
function _fun10047(a0, a1) { // fn#10047, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1072:806, offset: 0x00d7a684, size: 333 bytes, params: 3, frame: 24
var environment;
var r3;
var createMcpNotificationSpan;
var value2;
var property;
var moduleValue3;
var value4;
var moduleValue4;
var error;
const env0_0 = a0;
const env0_1 = a1;
let value = environment.__proto__.__proto__;
const moduleValue = require(dependencyMap[3]);
if (moduleValue.isJsonRpcRequest(a0)) {
if (a0.method === 'initialize') {
try {
property = dependencyMap[4];
moduleValue3 = require(property);
value4 = moduleValue3.extractSessionDataFromInitializeRequest(a0);
var env0_3 = value4;
property = dependencyMap[5];
moduleValue4 = require(property);
moduleValue4.storeSessionDataForTransport(this, value4);
} catch (error) {
}
}
value = require(dependencyMap[6]);
value = value.getIsolationScope();
value = value.clone();
return require(dependencyMap[6]).withIsolationScope(value, _fun10048);
}
const moduleValue2 = require(dependencyMap[3]);
if (moduleValue2.isJsonRpcNotification(a0)) {
value = require(dependencyMap[7]);
createMcpNotificationSpan = value.createMcpNotificationSpan;
value2 = environment.__proto__;
value = Reflect.apply(createMcpNotificationSpan, value, [a0, this, a1, require, _fun10050]);
r3 = value;
} else {
r3 = env0_0.call(this, a0, a1);
}
return r3;
function _fun10048() { // fn#10048, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1072:1091, offset: 0x00d7a7d1, size: 321 bytes, params: 1, frame: 25
var environment;
var setAttributes;
var Object;
var assign;
var moduleValue3;
let value = environment.__proto__.__proto__.__proto__;
const buildMcpServerSpanConfig = Module00949Module.buildMcpServerSpanConfig;
let binding = env0_0;
const value4 = (Module00874Module).startInactiveSpan(Reflect.apply(buildMcpServerSpanConfig,
Module00949Module, [binding, Module00005Module, require, require]));
if (result && env0_3) {
setAttributes = value4.setAttributes;
Object = global.Object;
assign = Object.assign;
moduleValue3 = require(946) /* metro dependency 946 */;
Reflect.apply(setAttributes, value4, [Reflect.apply(assign, Object, [{},
moduleValue3.buildClientAttributesFromInfo(env0_3.clientInfo), env0_3.protocolVersion && env3_3({},
(require(948) /* metro dependency 948 */).MCP_PROTOCOL_VERSION_ATTRIBUTE, env0_3.protocolVersion)])]);
}
value = require(953) /* metro dependency 953 */;
const storeSpanForRequest = value.storeSpanForRequest;
binding = Module00005Module;
const binding3 = env0_0;
Reflect.apply(storeSpanForRequest, value, [binding, binding3.id, value4, binding3.method]);
return (Module00874Module).withActiveSpan(value4, _fun10049);
function _fun10049() { // fn#10049, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1072:1437, offset: 0x00d7a912, size: 36 bytes, params: 1, frame: 15
const binding = env2_0;
return binding.call(env1_2, env1_0, require);
}
}
function _fun10050() { // fn#10050, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1072:1561, offset: 0x00d7a936, size: 36 bytes, params: 1, frame: 15
const binding = env1_0;
return binding.call(Module00005Module, env0_0, require);
}
}
}
}
function wrapTransportSend(a0, a1) { // fn#10051, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1072:1638, offset: 0x00d7a95a, size: 72 bytes, params: 3, frame: 15
const env0_0 = a1;
if (a0.send) {
(require(831) /* metro dependency 831 */).fill(a0, 'send', _fun10052);
}
function _fun10052(a0) { // fn#10052, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1072:1701, offset: 0x00d7a9a2, size: 30 bytes, params: 2, frame: 11
const env0_0 = a0;
return env1_2(_fun10054);
function* _fun10054() { // fn#10054, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1072:1723, offset: 0x00d7a9c9, size: 747 bytes, params: 1, frame: 26
var environment;
var r4;
var value6;
var id;
var error;
var value9;
var value10;
var value11;
var code;
var value12;
var value13;
var value14;
var Error;
var message;
var error2;
var value16;
var HermesInternal;
var concat;
var value17;
var binding3;
var property2;
var value18;
var captureError;
var value19;
var isValidContentItem;
var result;
var protocolVersion;
var serverInfo;
var binding4;
var property3;
var value20;
var extractSessionDataFromInitializeResponse;
var value21;
var property4;
var value22;
var updateSessionDataForTransport;
var completeSpanWithResults;
var value23;
var createMcpOutgoingNotificationSpan;
var value24;
if (false) {
return undefined;
}
value = arguments.length;
const Array = global.Array;
let prototype = Array.prototype;
const value3 = Object.create(prototype, {constructor: {value: Array}});
const array = new Array(value);
const value4 = array instanceof Object ? array : value3;
const value5 = 0;
if (value5 < value) {
r4 = value5;
reducibleLoop2: while (true) {
value4[r4] = arguments[r4];
value6 = typeof r4 === 'bigint' ? r4 + 1n : +r4 + 1;
if (value6 < value) {
r4 = value6;
continue reducibleLoop2;
}
break reducibleLoop2;
}
}
const property = value4[value5];
value = environment.__proto__.__proto__.__proto__;
let binding = env3_0;
const isJsonRpcNotification2 = binding(env3_1[3]).isJsonRpcNotification(property);
binding = env3_0;
const binding2 = env3_1;
if (isJsonRpcNotification2) {
value = binding(binding2[7]);
createMcpOutgoingNotificationSpan = value.createMcpOutgoingNotificationSpan;
value24 = environment.__proto__.__proto__;
return Reflect.apply(createMcpOutgoingNotificationSpan, value, [property, this, require, _fun10055]);
}
const value8 = binding(binding2[3]);
reducibleJoin71: while (true) {
if (value8.isJsonRpcResponse(property)) {
id = property.id;
if (id === null) {
break reducibleJoin71;
}
id = property.id;
if (id === undefined) {
break reducibleJoin71;
}
reduciblePort70: while (true) {
exceptionLanding69: while (true) {
reducibleJoin53: while (true) {
reduciblePort52: while (true) {
exceptionLanding51: while (true) {
error = property.error;
if (error) {
error = property.error;
if (error) {
try {
value9 = typeof error !== 'object';
} catch (error) {
break exceptionLanding51;
}
if (value9) {
break reduciblePort52;
}
try {
value10 = 'code' in error;
} catch (error) {
break exceptionLanding51;
}
if (value10) {
try {
value11 = 'message' in error;
} catch (error) {
break exceptionLanding51;
}
if (value11) {
try {
code = error.code;
} catch (error) {
break exceptionLanding51;
}
try {
value12 = code === -32603;
} catch (error) {
break exceptionLanding51;
}
if (!value12) {
try {
code = error.code;
} catch (error) {
break exceptionLanding51;
}
try {
value13 = code >= -32099;
} catch (error) {
break exceptionLanding51;
}
if (!value13) {
break reduciblePort52;
}
try {
code = error.code;
} catch (error) {
break exceptionLanding51;
}
try {
value14 = code <= -32000;
} catch (error) {
break exceptionLanding51;
}
if (!value14) {
break reduciblePort52;
}
}
try {
Error = global.Error;
} catch (error) {
break exceptionLanding51;
}
try {
message = error.message;
} catch (error) {
break exceptionLanding51;
}
try {
prototype = Error.prototype;
} catch (error) {
break exceptionLanding51;
}
try {
} catch (error) {
break exceptionLanding51;
}
try {
error2 = new Error();
} catch (error) {
break exceptionLanding51;
}
try {
value16 = error2 instanceof Object ? error2 : undefined;
} catch (error) {
break exceptionLanding51;
}
try {
code = error.code;
} catch (error) {
break exceptionLanding51;
}
try {
HermesInternal = global.HermesInternal;
} catch (error) {
break exceptionLanding51;
}
try {
concat = HermesInternal.concat;
} catch (error) {
break exceptionLanding51;
}
try {
value17 = 'JsonRpcError_' + code;
} catch (error) {
break exceptionLanding51;
}
try {
value16.name = value17;
} catch (error) {
break exceptionLanding51;
}
try {
binding = env3_0;
} catch (error) {
break exceptionLanding51;
}
try {
binding3 = env3_1;
} catch (error) {
break exceptionLanding51;
}
try {
property2 = binding3[11];
} catch (error) {
break exceptionLanding51;
}
try {
value18 = binding(property2);
} catch (error) {
break exceptionLanding51;
}
try {
captureError = value18.captureError;
} catch (error) {
break exceptionLanding51;
}
try {
Reflect.apply(captureError, value18, [value16, 'protocol']);
} catch (error) {
break exceptionLanding51;
}
break reduciblePort52;
}
break reduciblePort52;
}
break reduciblePort52;
}
break reduciblePort52;
}
break reduciblePort52;
}
break reduciblePort52;
}
binding = env3_0;
value19 = binding(env3_1[3]);
isValidContentItem = value19.isValidContentItem;
result = property.result;
if (Reflect.apply(isValidContentItem, value19, [result])) {
break reducibleJoin53;
}
break reduciblePort70;
}
result = property.result;
protocolVersion = result.protocolVersion;
if (!protocolVersion) {
result = property.result;
serverInfo = result.serverInfo;
if (!serverInfo) {
break reduciblePort70;
}
}
try {
binding = env3_0;
} catch (error) {
break exceptionLanding69;
}
try {
binding4 = env3_1;
} catch (error) {
break exceptionLanding69;
}
try {
property3 = binding4[4];
} catch (error) {
break exceptionLanding69;
}
try {
value20 = binding(property3);
} catch (error) {
break exceptionLanding69;
}
try {
extractSessionDataFromInitializeResponse = value20.extractSessionDataFromInitializeResponse;
} catch (error) {
break exceptionLanding69;
}
try {
result = property.result;
} catch (error) {
break exceptionLanding69;
}
try {
value21 = Reflect.apply(extractSessionDataFromInitializeResponse, value20, [result]);
} catch (error) {
break exceptionLanding69;
}
try {
property4 = binding4[5];
} catch (error) {
break exceptionLanding69;
}
try {
value22 = binding(property4);
} catch (error) {
break exceptionLanding69;
}
try {
updateSessionDataForTransport = value22.updateSessionDataForTransport;
} catch (error) {
break exceptionLanding69;
}
try {
Reflect.apply(updateSessionDataForTransport, value22, [this, value21]);
} catch (error) {
break exceptionLanding69;
}
break reduciblePort70;
}
break reduciblePort70;
}
binding = env3_0;
value = binding(env3_1[10]);
completeSpanWithResults = value.completeSpanWithResults;
id = property.id;
result = property.result;
value23 = environment.__proto__.__proto__;
Reflect.apply(completeSpanWithResults, value, [this, id, result, require]);
break reducibleJoin71;
}
break reducibleJoin71;
}
value = environment.__proto__;
const call = require.call;
const items2 = [this];
return call.apply(require, items2.concat(value4));
function _fun10055() { // fn#10055, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1072:1920, offset: 0x00d7acb4, size: 54 bytes, params: 1, frame: 15
const call = require.call;
const apply = call.apply;
const items2 = [env0_0];
return Reflect.apply(apply, call, [require, items2.concat(env0_1)]);
}
}
}
}
}
global.__d(_fun10038, 945, [5, 77, 831, 944, 946, 947, 857, 949, 874, 948, 953,
955]) /* metro module 945, dependencies: [5, 77, 831, 944, 946, 947, 857, 949, 874, 948, 953, 955] */;