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

95 lines
2.4 KiB
JavaScript

// Metro module 874 (f875).
import { GLOBAL_OBJ } from "./Module821";
import { normalizeStackTracePath } from "./createStackParser";
let c715_2, length, length2, c715_5;
const getFilenameToDebugIdMap = function getFilenameToDebugIdMap(c12536_0) {
const _sentryDebugIds = GLOBAL_OBJ._sentryDebugIds;
const _debugIds = GLOBAL_OBJ._debugIds;
if (!_sentryDebugIds && !_debugIds) {
return {};
}
const r18 = _sentryDebugIds ? Object.keys(_sentryDebugIds) : [];
const r21 = _debugIds ? Object.keys(_debugIds) : [];
if (c715_5 && r18.length === length && r21.length === length2) {
return c715_5;
}
length = r18.length;
length2 = r21.length;
c715_5 = {};
if (!c715_2) {
c715_2 = {};
}
const processDebugIds = (a0, a1) => {
loop1: for (const r33 of a0) {
const r34 = r33;
const r35 = a1[r33];
const r37 = c715_2 == null ? void 0 : c715_2[r34];
if (r37) {
if (c715_5 && r35) {
c715_5[r37[0]] = r35;
if (!c715_2) {
continue;
}
c715_2[r34] = [r37[0], r35];
continue;
}
}
if (r35) {
const r45 = c12536_0(r34);
const r48 = r45.length - 1;
let r49 = r48;
if (0 <= r48) {
while (true) {
const filename = r45[r49]?.filename;
if (filename) {
if (c715_5 && c715_2) {
c715_5[filename] = r35;
c715_2[r34] = [filename, r35];
continue loop1;
}
}
const r58 = r49 - 1;
r49 = r58;
if (!(0 <= r58)) {
continue loop1;
}
}
}
}
}
};
if (_sentryDebugIds) {
processDebugIds(r18, _sentryDebugIds);
}
if (_debugIds) {
processDebugIds(r21, _debugIds);
}
return c715_5;
};
Object.defineProperty(exports, Symbol.toStringTag, {
value: "Module"
});
export function getDebugImagesForResources(a0, a1) {
const filenameToDebugIdMap = getFilenameToDebugIdMap(a0);
const r22 = [];
if (!filenameToDebugIdMap) {
return r22;
}
for (const item of a1) {
let r32 = normalizeStackTracePath(item);
const r33 = r32;
if (r32) {
r32 = filenameToDebugIdMap[r33];
}
if (r32) {
r22.push({
type: "sourcemap",
code_file: item,
debug_id: filenameToDebugIdMap[r33]
});
}
}
return r22;
}
export { getFilenameToDebugIdMap };