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

117 lines
3.6 KiB
JavaScript

// Metro module 1144 (f1145).
import { browserTracingIntegration, WINDOW, startBrowserTracingPageLoadSpan, startBrowserTracingNavigationSpan } from "./Module1024";
import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from "./Module817";
function $mk68203($env) {
return (a0, a1, a2) => {
let r40;
const r9 = $env;
if (!a0 && a2) {
const r11 = a2.routes || [];
const isArray = Array.isArray(r11);
let r21 = "";
if (isArray) {
const length = r11.length;
r21 = "";
if (length !== 0) {
const r25 = r11.filter((item) => !!item.path);
let r0 = r25.length - 1;
let r2 = -1;
while (0 <= r0) {
const path = r25[r0].path;
const r8 = path == null;
const r1 = r0;
const r29 = r8 ? void 0 : path.startsWith("/");
r2 = r1;
if (r29) {
break;
}
r0 = r1 - 1;
r2 = -1;
}
r21 = r25.slice(r2).reduce((acc, { path }) => `${acc}${acc !== "/" ? acc !== "" ? `/${path}` : path : path}`, "");
}
}
if (r21.length !== 0 && r21 !== "/*") {
const r37 = r9[0];
r9[1] = r21;
r40 = r37(r21, "route");
} else {
r40 = (0, r9[0])(r9[1]);
}
return r40;
}
return (0, r9[0])(r9[1]);
};
}
Object.defineProperty(exports, Symbol.toStringTag, {
value: "Module"
});
export function reactRouterV3BrowserTracingIntegration(a0) {
const r14 = browserTracingIntegration({
...a0,
instrumentPageLoad: false,
instrumentNavigation: false
});
let c12834_0 = r14;
const { history: history2, routes, match, instrumentPageLoad = true, instrumentNavigation = true } = a0;
return {
...r14,
afterAllSetup: (a0) => {
let c24236_0 = a0;
c12834_0.afterAllSetup(a0);
let r9 = instrumentPageLoad;
if (instrumentPageLoad) {
r9 = WINDOW.location;
}
if (r9) {
let env24237;
const location2 = WINDOW.location;
const r24 = env24237 = {};
env24237[0] = function(a0, r7 = "url") {
const attributes = {};
attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] = "pageload";
attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = "auto.pageload.react.reactrouter_v3";
attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] = r7;
startBrowserTracingPageLoadSpan(c24236_0, {
name: a0,
attributes
});
};
env24237[1] = void 0;
env24237[1] = location2.pathname;
match({
location: location2,
routes
}, $mk68203(r24));
}
let r30 = instrumentNavigation;
if (instrumentNavigation) {
r30 = history2.listen;
}
if (r30) {
history2.listen((a0) => {
if (!(a0.action !== "PUSH" && a0.action !== "POP")) {
let env28833;
const r11 = env28833 = {};
env28833[0] = function(a0, r7 = "url") {
const attributes = {};
attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] = "navigation";
attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = "auto.navigation.react.reactrouter_v3";
attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] = r7;
startBrowserTracingNavigationSpan(c24236_0, {
name: a0,
attributes
});
};
env28833[1] = a0.pathname;
match({
location: a0,
routes
}, $mk68203(r11));
}
});
}
}
};
}