Files
discord-decomp/_bundle/eventFromEnvelope_6435.js
T
2026-11-01 12:12:55 +02:00

128 lines
4.0 KiB
JavaScript

// Metro module 6435 (f6436).
import { forEachEnvelopeItem, createEnvelope } from "./forEachEnvelopeItem_6412";
import { dsnFromString } from "./dsnFromString_6415";
import { getEnvelopeEndpointWithUrlEncodedAuth } from "./Module6422";
import { HermesBuiltin } from "../_hermes/prelude";
function $mk78617($env) {
return (a0, a1) => {
const r1 = $env;
if (r1[0].includes(a1)) {
r1[1] = Array.isArray(a0) ? a0[1] : void 0;
}
return !!r1[1];
};
}
let env4136 = {};
export function eventFromEnvelope(a0, a1) {
let env15732;
const r1 = env15732 = {};
env15732[0] = a1;
forEachEnvelopeItem(a0, $mk78617(r1));
return env15732[1];
}
export function makeMultiplexedTransport(c15733_0, c15733_1) {
return (a0) => {
let c25881_1, c25881_2, _send2, _flush2;
let c25881_0 = a0;
const getTransport2 = function getTransport(a0, a1) {
let r34;
const r4 = a1 ? `${a0}:${a1}` : a0;
let r20 = c25881_2.get(r4);
if (!r20) {
const r8 = env4136;
const r24 = dsnFromString(a0);
if (!r24) {
return void 0;
}
const envelopeEndpointWithUrlEncodedAuth = getEnvelopeEndpointWithUrlEncodedAuth(r24, c25881_0.tunnel);
const r32 = {};
if (a1) {
let env29773 = {
$parent: r8
};
env29773[0] = a1;
HermesBuiltin.copyDataProperties(r32, c25881_0);
r32.url = envelopeEndpointWithUrlEncodedAuth;
const r40 = c15733_0(r32);
let c29774_1 = r40;
let c29774_0 = async (c32124_0) => {
const r19 = eventFromEnvelope(c32124_0, ["event", "transaction", "profile", "replay_event"]);
if (r19) {
r19.release = env29773[0];
}
return c29774_1.send(c32124_0);
};
r34 = {
...r40,
send: function send(a0) {
return c29774_0.apply(this, arguments);
}
};
} else {
HermesBuiltin.copyDataProperties(r32, c25881_0);
r32.url = envelopeEndpointWithUrlEncodedAuth;
r34 = c15733_0(r32);
}
c25881_2.set(r4, r34);
r20 = r34;
}
return [a0, r20];
};
_send2 = function _send() {
const r9 = async (envelope) => {
let c31963_0 = envelope;
const r32 = c15733_1({
envelope,
getEvent: function getEvent(a0) {
const r3 = a0 && a0.length ? a0 : ["event"];
let env32125;
const r7 = env32125 = {};
env32125[0] = r3;
forEachEnvelopeItem(c31963_0, $mk78617(r7));
return env32125[1];
}
}).map((item) => typeof item === "string" ? getTransport2(item, void 0) : getTransport2(item.dsn, item.release)).filter((item) => !!item);
return (await Promise.all((r32.length ? r32 : [["", c25881_1]]).map((item) => {
const [dsn, r27] = item;
const send2 = r27.send;
const r11 = c31963_0[0];
return send2.call(r27, createEnvelope(dsn ? {
...r11,
dsn
} : r11, c31963_0[1]));
})))[0];
};
_send2 = r9;
return r9.apply(this, arguments);
};
_flush2 = function _flush() {
const r9 = async (c31425_0) => {
let env31964;
const r8 = env31964 = {};
let c31425_2 = r8;
env31964[0] = c31425_0;
let c31425_1 = 0;
const r14 = c25881_2.values();
const r12 = [,];
const r26 = HermesBuiltin.arraySpread(r12, r14, c31425_1);
c31425_1 = r26;
r12[r26] = c25881_1;
c31425_1 = c31425_1 + 1;
return (await Promise.all(r12.map((item) => item.flush(env31964[0])))).every((item) => item);
};
_flush2 = r9;
return r9.apply(this, arguments);
};
c25881_1 = c15733_0(a0);
c25881_2 = new Map();
return {
send: function send(a0) {
return _send2.apply(this, arguments);
},
flush: function flush(a0) {
return _flush2.apply(this, arguments);
}
};
};
}