994 lines
32 KiB
React
994 lines
32 KiB
React
// Metro module 1148 (f1149).
|
|
import { useRef } from "react";
|
|
import { WINDOW, startBrowserTracingNavigationSpan, browserTracingIntegration, startBrowserTracingPageLoadSpan } from "./Module1024";
|
|
import { transactionNameHasWildcard, getActiveRootSpan, resolveRouteNameAndSource, setNavigationContext, clearNavigationContext, initializeRouterUtils } from "./pickSplat";
|
|
import { checkRouteForAsyncHandler } from "./createAsyncHandlerProxy";
|
|
import { spanToJSON, debug, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, addNonEnumerableProperty, getClient, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, getCurrentScope } from "./Module817";
|
|
import { DEBUG_BUILD } from "./Module1142";
|
|
import { hoistNonReactStatics } from "./getStatics";
|
|
function $mk68213($env) {
|
|
return (c24241_0) => !$env[0].some((item) => item === c24241_0 || c24241_0.path && item.path === c24241_0.path || c24241_0.id && item.id === c24241_0.id);
|
|
}
|
|
function $mk68219($env) {
|
|
return (a0) => {
|
|
let env24244;
|
|
const r1 = env24244 = {
|
|
$parent: $env
|
|
};
|
|
const set = new Set();
|
|
env24244[0] = set;
|
|
if (!set.has(a0)) {
|
|
set.add(a0);
|
|
if (a0.children && !a0.index) {
|
|
a0.children.forEach($mk68220(r1));
|
|
}
|
|
}
|
|
set.forEach($mk101939($env));
|
|
};
|
|
}
|
|
function $mk68220($env) {
|
|
return (a0) => {
|
|
const r2 = $env;
|
|
let r4 = r2[0];
|
|
if (r4 === void 0) {
|
|
r4 = new Set();
|
|
}
|
|
let env24245;
|
|
const r14 = env24245 = {
|
|
$parent: $env.$parent
|
|
};
|
|
env24245[0] = r4;
|
|
if (!r4.has(a0)) {
|
|
r4.add(a0);
|
|
if (a0.children && !a0.index) {
|
|
a0.children.forEach($mk68220(r14));
|
|
}
|
|
}
|
|
r4.forEach($mk101940(r2));
|
|
};
|
|
}
|
|
function $mk68222($env) {
|
|
return function patchedEnd() {
|
|
let env24246;
|
|
L29: {
|
|
const r4 = $env;
|
|
env24246 = {
|
|
$parent: $env
|
|
};
|
|
const r6 = Array.prototype.slice.call(arguments, 0);
|
|
env24246[0] = void 0;
|
|
env24246[1] = void 0;
|
|
if (!r4[7]) {
|
|
r4[7] = true;
|
|
const r33 = r6.length > 0 ? r6[0] : Date.now() / 1000;
|
|
env24246[0] = r33;
|
|
const r34 = $env.$parent;
|
|
const r8 = r34[0];
|
|
const r35 = r34[1];
|
|
const r12 = r8(r35[6]);
|
|
const r36 = r4[0];
|
|
const r17 = r12.spanToJSON(r36);
|
|
const { description, data } = r17;
|
|
const r39 = data == null ? void 0 : data[r8(r35[6]).SEMANTIC_ATTRIBUTE_SENTRY_SOURCE];
|
|
L11: {
|
|
env24246[1] = $mk101941(r4);
|
|
const r46 = r34[15].get(r36);
|
|
if (r46 && r46.size > 0 && description) {
|
|
if (!r8(r35[4]).transactionNameHasWildcard(description) && r39 === "route") {
|
|
break L11;
|
|
}
|
|
if (r34[11] === 0) {
|
|
const r93 = r34[25];
|
|
const r94 = r4[1];
|
|
const r95 = r4[2];
|
|
const r96 = r4[3];
|
|
const r97 = r4[4];
|
|
r93(r36, r17, description, r94, r95, r96, r97, r4[5]);
|
|
const client2 = r8(r35[6]).getClient();
|
|
if (client2 && r97 === "navigation") {
|
|
const r110 = r34[13];
|
|
const r112 = r110.get(client2);
|
|
if (r112 && r112.span === r36) {
|
|
r110.delete(client2);
|
|
}
|
|
}
|
|
(0, r4[6])(r33);
|
|
return void 0;
|
|
}
|
|
const r18 = Promise.allSettled(r46).then(() => {});
|
|
(r34[11] !== Infinity ? Promise.race([r18, new Promise($mk101943(r34))]) : r18).then(() => {
|
|
const r4 = env24246.$parent.$parent;
|
|
const r6 = r4[0];
|
|
const r5 = r4[1];
|
|
const r9 = r6(r5[6]);
|
|
const r25 = env24246.$parent;
|
|
const r8 = r25[0];
|
|
const r15 = r9.spanToJSON(r8);
|
|
const r14 = r4[25];
|
|
const description = r15.description;
|
|
const r20 = r25[1];
|
|
const r19 = r25[2];
|
|
const r18 = r25[3];
|
|
const r26 = r25[4];
|
|
r14(r8, r15, description, r20, r19, r18, r26, r25[5]);
|
|
const client = r6(r5[6]).getClient();
|
|
if (client && r26 === "navigation") {
|
|
const r35 = r4[13];
|
|
const r37 = r35.get(client);
|
|
if (r37 && r37.span === r8) {
|
|
r35.delete(client);
|
|
}
|
|
}
|
|
(0, r25[6])(env24246[0]);
|
|
}).catch(() => {
|
|
const r10 = env24246.$parent.$parent;
|
|
const client = (0, r10[0])(r10[1][6]).getClient();
|
|
if (client) {
|
|
const r6 = env24246.$parent;
|
|
if (r6[4] === "navigation") {
|
|
const r16 = r10[13];
|
|
const r18 = r16.get(client);
|
|
if (r18 && r18.span === r6[0]) {
|
|
r16.delete(client);
|
|
}
|
|
}
|
|
}
|
|
(0, env24246.$parent[6])(env24246[0]);
|
|
});
|
|
break L29;
|
|
}
|
|
}
|
|
const r19 = r34[25];
|
|
const r24 = r4[1];
|
|
const r23 = r4[2];
|
|
const r22 = r4[3];
|
|
const r52 = r4[4];
|
|
r19(r36, r17, description, r24, r23, r22, r52, r4[5]);
|
|
const client = r8(r35[6]).getClient();
|
|
if (client && r52 === "navigation") {
|
|
const r60 = r34[13];
|
|
const r15 = r60.get(client);
|
|
if (r15 && r15.span === r36) {
|
|
r60.delete(client);
|
|
}
|
|
}
|
|
(0, r4[6])(r33);
|
|
}
|
|
}
|
|
};
|
|
}
|
|
function $mk101939($env) {
|
|
return (a0) => {
|
|
c955_14.add(a0);
|
|
};
|
|
}
|
|
function $mk101940($env) {
|
|
return (a0) => {
|
|
$env[0].add(a0);
|
|
};
|
|
}
|
|
function $mk101941($env) {
|
|
return () => {};
|
|
}
|
|
function $mk101943($env) {
|
|
return (a0) => setTimeout(a0, $env[11]);
|
|
}
|
|
let shouldSkipNavigation, processResolvedRoutes, updateNavigationSpan, setupRouterSubscription, wrapPatchRoutesOnNavigation, handleNavigation, addRoutesToAllRoutes, updatePageloadTransaction, tryUpdateSpanNameBeforeEnd, patchSpanEnd, c955_12, c955_13, c955_14, c955_15;
|
|
let env955 = {};
|
|
export function computeLocationKey(a0) {
|
|
return `${a0.pathname}${a0.search || ""}${a0.hash || ""}`;
|
|
}
|
|
shouldSkipNavigation = function shouldSkipNavigation(a0, a1, a2, a3) {
|
|
if (a0) {
|
|
L5: {
|
|
if (a0.locationKey === a1) {
|
|
if (!a0.isPlaceholder && a3) {
|
|
break L5;
|
|
}
|
|
let r19 = !!a0.routeName && transactionNameHasWildcard(a0.routeName);
|
|
const r30 = transactionNameHasWildcard(a2);
|
|
let r10 = !!a0.routeName;
|
|
if (r10) {
|
|
const routeName = a0.routeName;
|
|
r10 = routeName.includes(":") || routeName.includes("*");
|
|
}
|
|
const r39 = a2.includes(":") || a2.includes("*");
|
|
if (r19) {
|
|
r19 = !r30;
|
|
}
|
|
const r42 = r10 ? !r10 : r39;
|
|
const r1 = a2 !== a0.routeName && a2.length > (a0.routeName?.length || 0) && !r30;
|
|
const routeName2 = a0.routeName;
|
|
let r50 = !routeName2;
|
|
if (routeName2) {
|
|
if (!r19) {
|
|
r19 = r42;
|
|
}
|
|
if (!r19) {
|
|
r19 = r1;
|
|
}
|
|
r50 = !r19;
|
|
}
|
|
return {
|
|
skip: true,
|
|
shouldUpdate: !r50
|
|
};
|
|
}
|
|
}
|
|
return {
|
|
skip: false,
|
|
shouldUpdate: false
|
|
};
|
|
}
|
|
return {
|
|
skip: false,
|
|
shouldUpdate: false
|
|
};
|
|
};
|
|
processResolvedRoutes = function processResolvedRoutes(a0, a1, r11 = null) {
|
|
a0.forEach((item) => {
|
|
c955_14.add(item);
|
|
if (env955[10]) {
|
|
checkRouteForAsyncHandler(item, processResolvedRoutes);
|
|
}
|
|
});
|
|
if (a1) {
|
|
const r6 = a1.children || [];
|
|
let env12842;
|
|
const r20 = env12842 = {};
|
|
env12842[0] = r6;
|
|
const r23 = a0.filter($mk68213(r20));
|
|
if (r23.length > 0) {
|
|
a1.children = [...r6, ...r23];
|
|
}
|
|
}
|
|
const r30 = arguments[3];
|
|
let activeRootSpan2 = r30;
|
|
if (activeRootSpan2 == null) {
|
|
activeRootSpan2 = getActiveRootSpan();
|
|
}
|
|
if (activeRootSpan2) {
|
|
const r41 = spanToJSON(activeRootSpan2);
|
|
if (r41.timestamp) {
|
|
if (DEBUG_BUILD) {
|
|
debug.warn("[React Router] Lazy handler resolved after span ended - skipping update");
|
|
}
|
|
return void 0;
|
|
}
|
|
const op = r41.op;
|
|
let r44 = r11;
|
|
if (!r44) {
|
|
r44 = r11;
|
|
if (!r30) {
|
|
r44 = r11;
|
|
if (WINDOW !== void 0) {
|
|
const location3 = WINDOW.location;
|
|
r44 = location3?.pathname ? {
|
|
pathname: location3.pathname
|
|
} : r11;
|
|
}
|
|
}
|
|
}
|
|
if (r44) {
|
|
if (op === "pageload") {
|
|
const r71 = Array;
|
|
updatePageloadTransaction({
|
|
activeRootSpan: activeRootSpan2,
|
|
location: {
|
|
pathname: r44.pathname
|
|
},
|
|
routes: r71.from(c955_14),
|
|
allRoutes: Array.from(c955_14)
|
|
});
|
|
} else if (op === "navigation") {
|
|
updateNavigationSpan(activeRootSpan2, r44, Array.from(c955_14), false, env955[8]);
|
|
}
|
|
}
|
|
}
|
|
};
|
|
updateNavigationSpan = function updateNavigationSpan(a0, a1, a2, r10 = false) {
|
|
const r26 = spanToJSON(a0);
|
|
const description = r26.description;
|
|
const __sentry_navigation_name_set__ = a0?.__sentry_navigation_name_set__;
|
|
const r13 = description && transactionNameHasWildcard(description);
|
|
if (!(__sentry_navigation_name_set__ && (!r10 && !r13)) && !r26.timestamp) {
|
|
const [r38, r39] = resolveRouteNameAndSource(a1, a2, a2, (0, arguments[4])(a2, a1) || [], "");
|
|
const data = r26.data;
|
|
const r42 = data == null ? void 0 : data[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE];
|
|
if (r38 && ((description ? __sentry_navigation_name_set__ ? !__sentry_navigation_name_set__ : r42 !== "route" || r39 === "route" : !description) || r42 !== "route" && r39 === "route" || r42 === "route" && r39 === "route" && r13)) {
|
|
a0.updateName(r38);
|
|
a0.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, r39);
|
|
if (!(transactionNameHasWildcard(r38) || r39 !== "route")) {
|
|
addNonEnumerableProperty(a0, "__sentry_navigation_name_set__", true);
|
|
}
|
|
}
|
|
}
|
|
};
|
|
setupRouterSubscription = function setupRouterSubscription(a0, routes, version, basename, a4) {
|
|
let c12843_3 = false;
|
|
let c12843_4 = !!a4 && spanToJSON(a4).op === "pageload";
|
|
let c12843_5 = false;
|
|
let c12843_6 = null;
|
|
let c12843_7 = null;
|
|
a0.subscribe((a0) => {
|
|
let c24242_0, c24242_1;
|
|
L9: {
|
|
c24242_0 = a0;
|
|
if (!c12843_3) {
|
|
const activeRootSpan2 = getActiveRootSpan();
|
|
if (activeRootSpan2 && spanToJSON(activeRootSpan2).op === "pageload") {
|
|
c12843_4 = true;
|
|
break L9;
|
|
}
|
|
if (c12843_4) {
|
|
if (a0.historyAction === "POP" && !c12843_5) {
|
|
c12843_5 = true;
|
|
break L9;
|
|
}
|
|
c12843_3 = true;
|
|
}
|
|
}
|
|
}
|
|
L40: {
|
|
if (a0.historyAction !== "PUSH") {
|
|
if (a0.historyAction !== "POP") {
|
|
break L40;
|
|
}
|
|
if (!c12843_3) {
|
|
break L40;
|
|
}
|
|
}
|
|
const location3 = a0.location;
|
|
const r44 = `${location3.pathname}${location3.search || ""}${location3.hash || ""}`;
|
|
c24242_1 = r44;
|
|
if (a0.navigation.state !== "idle") {
|
|
if (c12843_7 !== r44) {
|
|
c12843_7 = null;
|
|
}
|
|
const r80 = c12843_6;
|
|
if (r80 !== null) {
|
|
if (WINDOW?.cancelAnimationFrame) {
|
|
WINDOW.cancelAnimationFrame(r80);
|
|
} else {
|
|
clearTimeout(r80);
|
|
}
|
|
}
|
|
const requestAnimationFrame2 = WINDOW?.requestAnimationFrame;
|
|
const navigationHandler = () => {
|
|
const r2 = c12843_7;
|
|
if (r2 !== c24242_1) {
|
|
c12843_7 = c24242_1;
|
|
c12843_6 = null;
|
|
handleNavigation({
|
|
location: c24242_0.location,
|
|
routes,
|
|
navigationType: c24242_0.historyAction,
|
|
version,
|
|
basename,
|
|
allRoutes: Array.from(c955_14)
|
|
});
|
|
}
|
|
};
|
|
c12843_6 = requestAnimationFrame2 ? WINDOW.requestAnimationFrame(navigationHandler) : setTimeout(navigationHandler, 0);
|
|
} else {
|
|
const r48 = c12843_6;
|
|
if (r48 !== null) {
|
|
if (WINDOW?.cancelAnimationFrame) {
|
|
WINDOW.cancelAnimationFrame(r48);
|
|
} else {
|
|
clearTimeout(r48);
|
|
}
|
|
c12843_6 = null;
|
|
}
|
|
if (c12843_7 !== r44) {
|
|
c12843_7 = r44;
|
|
c12843_6 = null;
|
|
handleNavigation({
|
|
location: a0.location,
|
|
routes,
|
|
navigationType: a0.historyAction,
|
|
version,
|
|
basename,
|
|
allRoutes: Array.from(c955_14)
|
|
});
|
|
}
|
|
}
|
|
}
|
|
});
|
|
};
|
|
wrapPatchRoutesOnNavigation = function wrapPatchRoutesOnNavigation(a0, r3 = false) {
|
|
let c12844_1, patchRoutesOnNavigation2;
|
|
let r2 = a0;
|
|
let c12844_0 = r3;
|
|
c12844_1 = void 0;
|
|
patchRoutesOnNavigation2 = void 0;
|
|
if (a0 && "patchRoutesOnNavigation" in a0 && typeof a0.patchRoutesOnNavigation === "function") {
|
|
patchRoutesOnNavigation2 = a0.patchRoutesOnNavigation;
|
|
c12844_1 = async (c24243_0) => {
|
|
let patch;
|
|
let c28835_0 = c24243_0;
|
|
const path = c24243_0?.path;
|
|
const activeRootSpan = getActiveRootSpan();
|
|
if (!c12844_0) {
|
|
patch = c24243_0?.patch;
|
|
if (patch) {
|
|
c24243_0.patch = (a0, a1) => {
|
|
a1.forEach($mk68219(env955));
|
|
const activeRootSpan2 = getActiveRootSpan();
|
|
if ((path ? activeRootSpan2 : path) && spanToJSON(activeRootSpan2).op === "navigation") {
|
|
updateNavigationSpan(activeRootSpan2, {
|
|
pathname: path,
|
|
search: "",
|
|
hash: "",
|
|
state: null,
|
|
key: "default"
|
|
}, Array.from(c955_14), true, env955[8]);
|
|
}
|
|
return patch(a0, a1);
|
|
};
|
|
}
|
|
}
|
|
const r31 = (async () => {
|
|
let r87;
|
|
let c31219_2;
|
|
let c31219_3 = 0;
|
|
let c31881_0, c31881_1, c31881_2, c31881_3;
|
|
try {
|
|
c31881_0 = void 0;
|
|
c31881_1 = void 0;
|
|
c31881_2 = void 0;
|
|
c31881_3 = void 0;
|
|
c31881_1 = setNavigationContext(path, activeRootSpan);
|
|
c31219_3 = 1;
|
|
c31881_0 = await patchRoutesOnNavigation2(c28835_0);
|
|
c31219_3 = 0;
|
|
clearNavigationContext(c31881_1);
|
|
c31881_2 = getActiveRootSpan();
|
|
if (c31881_2) {
|
|
if (spanToJSON(c31881_2).op === "navigation") {
|
|
c31881_3 = c12844_0 ? path : path ? path : WINDOW.location?.pathname;
|
|
if (c31881_3) {
|
|
const r117 = (void 0).$parent;
|
|
(0, updateNavigationSpan)(c31881_2, {
|
|
pathname: c31881_3,
|
|
search: "",
|
|
hash: "",
|
|
state: null,
|
|
key: "default"
|
|
}, Array.from(c955_14), false, r117[8]);
|
|
}
|
|
}
|
|
}
|
|
r87 = c31881_0;
|
|
} catch ($e) {
|
|
const r36 = $e;
|
|
let r7 = r36;
|
|
c31219_2 = r36;
|
|
if (c31219_3 !== 0) {
|
|
while (true) {
|
|
try {
|
|
const r131 = c31219_2;
|
|
c31219_3 = 0;
|
|
clearNavigationContext(c31881_1);
|
|
throw r131;
|
|
} catch (r127) {
|
|
r7 = r127;
|
|
c31219_2 = r127;
|
|
if (c31219_3 === 0) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw r7;
|
|
}
|
|
return r87;
|
|
})();
|
|
if (activeRootSpan) {
|
|
(function trackLazyRouteLoad(a0, a1) {
|
|
let r4 = c955_15.get(a0);
|
|
if (!r4) {
|
|
const set = new Set();
|
|
c955_15.set(a0, set);
|
|
r4 = set;
|
|
}
|
|
r4.add(a1);
|
|
a1.finally(() => {
|
|
const r6 = c955_15.get(a0);
|
|
if (r6) {
|
|
r6.delete(a1);
|
|
}
|
|
});
|
|
})(activeRootSpan, r31);
|
|
}
|
|
return r31;
|
|
};
|
|
return {
|
|
...a0,
|
|
patchRoutesOnNavigation: function patchRoutesOnNavigation(a0) {
|
|
return c12844_1.apply(this, arguments);
|
|
}
|
|
};
|
|
}
|
|
if (!a0) {
|
|
r2 = {};
|
|
}
|
|
return r2;
|
|
};
|
|
handleNavigation = function handleNavigation({ location: location3, routes: routes3, navigationType: navigationType3, version: version4, matches, basename: basename2, allRoutes }) {
|
|
let span;
|
|
const r10 = Array.isArray(matches) ? matches : env955[8](allRoutes ? allRoutes : routes3, location3, basename2);
|
|
L26: {
|
|
const client = getClient();
|
|
if (client && c955_12.has(client)) {
|
|
const activeRootSpan2 = getActiveRootSpan();
|
|
if (activeRootSpan2 && spanToJSON(activeRootSpan2).op === "pageload" && navigationType3 === "POP") {
|
|
break L26;
|
|
}
|
|
if (navigationType3 !== "PUSH" && navigationType3 !== "POP") {
|
|
break L26;
|
|
}
|
|
if (r10) {
|
|
const [routeName2, r67] = resolveRouteNameAndSource(location3, allRoutes ? allRoutes : routes3, allRoutes || routes3, r10, basename2);
|
|
const locationKey = computeLocationKey(location3);
|
|
const r71 = c955_13.get(client);
|
|
const r18 = r71 ? r71.isPlaceholder : !r71;
|
|
const r83 = shouldSkipNavigation(r71, locationKey, routeName2, r18 ? !r18 : !!spanToJSON(r71.span).timestamp);
|
|
const { skip, shouldUpdate } = r83;
|
|
if (skip) {
|
|
L37: {
|
|
if (shouldUpdate && r71) {
|
|
const routeName = r71.routeName;
|
|
if (r71.isPlaceholder) {
|
|
r71.routeName = routeName2;
|
|
if (!DEBUG_BUILD) {
|
|
break L37;
|
|
}
|
|
debug.log(`[Tracing] Updated placeholder navigation name from "${routeName}" to "${routeName2}" (will apply to real span)`);
|
|
break L37;
|
|
}
|
|
r71.span.updateName(routeName2);
|
|
r71.span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, r67);
|
|
addNonEnumerableProperty(r71.span, "__sentry_navigation_name_set__", true);
|
|
r71.routeName = routeName2;
|
|
if (!DEBUG_BUILD) {
|
|
break L37;
|
|
}
|
|
debug.log(`[Tracing] Updated navigation span name from "${routeName}" to "${routeName2}"`);
|
|
} else if (DEBUG_BUILD) {
|
|
debug.log(`[Tracing] Skipping duplicate navigation for location: ${locationKey}`);
|
|
}
|
|
}
|
|
return void 0;
|
|
}
|
|
const r88 = {
|
|
span: {
|
|
end: () => {}
|
|
},
|
|
routeName: routeName2,
|
|
pathname: location3.pathname,
|
|
locationKey,
|
|
isPlaceholder: true
|
|
};
|
|
c955_13.set(client, r88);
|
|
try {
|
|
const attributes = {};
|
|
attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] = r67;
|
|
attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] = "navigation";
|
|
attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = `auto.navigation.react.reactrouter_v${version4}`;
|
|
span = startBrowserTracingNavigationSpan(client, {
|
|
name: r88.routeName,
|
|
attributes
|
|
});
|
|
} catch (r124) {
|
|
c955_13.delete(client);
|
|
throw r124;
|
|
}
|
|
if (span) {
|
|
c955_13.set(client, {
|
|
span,
|
|
routeName: r88.routeName,
|
|
pathname: location3.pathname,
|
|
locationKey
|
|
});
|
|
patchSpanEnd(span, location3, routes3, basename2, allRoutes, "navigation");
|
|
} else {
|
|
c955_13.delete(client);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
addRoutesToAllRoutes = function addRoutesToAllRoutes(a0) {
|
|
a0.forEach.call(a0, $mk68219(env955));
|
|
};
|
|
updatePageloadTransaction = function updatePageloadTransaction({ activeRootSpan: activeRootSpan2, location: location3, routes: routes3, matches, basename: basename2, allRoutes }) {
|
|
const r16 = Array.isArray(matches) ? matches : env955[8](allRoutes ? allRoutes : routes3, location3, basename2);
|
|
if (r16) {
|
|
const [r36, r37] = resolveRouteNameAndSource(location3, allRoutes ? allRoutes : routes3, allRoutes || routes3, r16, basename2);
|
|
getCurrentScope().setTransactionName(r36 || "/");
|
|
if (activeRootSpan2) {
|
|
let env12845;
|
|
activeRootSpan2.updateName(r36);
|
|
activeRootSpan2.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, r37);
|
|
const r52 = env12845 = {
|
|
$parent: env955
|
|
};
|
|
env12845[0] = activeRootSpan2;
|
|
env12845[1] = location3;
|
|
env12845[2] = routes3;
|
|
env12845[3] = basename2;
|
|
env12845[4] = "pageload";
|
|
env12845[5] = void 0;
|
|
env12845[6] = void 0;
|
|
env12845[7] = void 0;
|
|
const r58 = `__sentry_pageload_end_patched__`;
|
|
if (!(activeRootSpan2 == null ? void 0 : activeRootSpan2[r58]) && activeRootSpan2.end) {
|
|
env12845[5] = allRoutes ? new Set(allRoutes) : c955_14;
|
|
env12845[6] = activeRootSpan2.end.bind(activeRootSpan2);
|
|
env12845[7] = false;
|
|
activeRootSpan2.end = $mk68222(r52);
|
|
addNonEnumerableProperty(activeRootSpan2, r58, true);
|
|
}
|
|
}
|
|
}
|
|
};
|
|
tryUpdateSpanNameBeforeEnd = function tryUpdateSpanNameBeforeEnd(a0, a1, a2, a3, a4, a5, a6, a7) {
|
|
L20: {
|
|
L10: {
|
|
L6: {
|
|
try {
|
|
const data = a1.data;
|
|
const r14 = data == null ? void 0 : data[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE];
|
|
if (r14 === "route" && a2 && !transactionNameHasWildcard(a2)) {
|
|
break L6;
|
|
}
|
|
let r40 = a4;
|
|
const r44 = Array.from(a7);
|
|
if (r44.length > 0) {
|
|
r40 = r44;
|
|
}
|
|
const r50 = r40;
|
|
const r52 = (0, env955[8])(r40, a3, a5);
|
|
if (r52) {
|
|
const [r66, r68] = resolveRouteNameAndSource(a3, r50, r50, r52, a5);
|
|
let r77 = (function shouldUpdateWildcardSpanName(a0, a1, a2, a3, r5 = false) {
|
|
let r11 = !!a2;
|
|
if (r11) {
|
|
const r4 = a0 ? a0 : !r5;
|
|
r11 = (r4 ? !((a0 ? !transactionNameHasWildcard(a0) : !a0) || a3 !== "route" || transactionNameHasWildcard(a2)) : !r4) || a1 !== "route" && a3 === "route";
|
|
}
|
|
return r11;
|
|
})(a2, r14, r66, r68, true);
|
|
const r81 = a6 === "pageload" || !a1.timestamp;
|
|
if (r77) {
|
|
r77 = r81;
|
|
}
|
|
if (!r77) {
|
|
break L20;
|
|
}
|
|
a0.updateName(r66);
|
|
a0.setAttribute(require(dependencyMap[6]).SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, r68);
|
|
break L20;
|
|
}
|
|
break L10;
|
|
} catch (r92) {
|
|
if (!DEBUG_BUILD) {
|
|
break L20;
|
|
}
|
|
require(dependencyMap[6]).debug.warn(`Error updating span details before ending: ${r92}`);
|
|
break L20;
|
|
}
|
|
}
|
|
return void 0;
|
|
}
|
|
return void 0;
|
|
}
|
|
};
|
|
patchSpanEnd = function patchSpanEnd(a0, a1, a2, a3, a4, a5) {
|
|
let env12846;
|
|
const r3 = env12846 = {
|
|
$parent: env955
|
|
};
|
|
env12846[0] = a0;
|
|
env12846[1] = a1;
|
|
env12846[2] = a2;
|
|
env12846[3] = a3;
|
|
env12846[4] = a5;
|
|
const r18 = `__sentry_${a5}_end_patched__`;
|
|
if (!(a0 == null ? void 0 : a0[r18]) && a0.end) {
|
|
env12846[5] = a4 ? new Set(a4) : c955_14;
|
|
env12846[6] = a0.end.bind(a0);
|
|
env12846[7] = false;
|
|
a0.end = $mk68222(r3);
|
|
addNonEnumerableProperty(a0, r18, true);
|
|
}
|
|
};
|
|
Object.defineProperty(exports, Symbol.toStringTag, {
|
|
value: "Module"
|
|
});
|
|
env955[10] = false;
|
|
env955[11] = 3000;
|
|
c955_12 = new WeakSet();
|
|
c955_13 = new WeakMap();
|
|
const set = new Set();
|
|
c955_14 = set;
|
|
c955_15 = new WeakMap();
|
|
export function addResolvedRoutesToParent(a0, a1) {
|
|
const r5 = a1.children || [];
|
|
let env12841;
|
|
const r2 = env12841 = {};
|
|
env12841[0] = r5;
|
|
const r11 = a0.filter($mk68213(r2));
|
|
if (r11.length > 0) {
|
|
a1.children = [...r5, ...r11];
|
|
}
|
|
}
|
|
export { addRoutesToAllRoutes };
|
|
export { set as allRoutes };
|
|
export function createReactRouterV6CompatibleTracingIntegration(a0, c12847_1) {
|
|
let c12847_0 = a0;
|
|
const r15 = browserTracingIntegration({
|
|
...a0,
|
|
instrumentPageLoad: false,
|
|
instrumentNavigation: false
|
|
});
|
|
let c12847_2 = r15;
|
|
const { useEffect, useLocation, useNavigationType, createRoutesFromChildren, matchRoutes, stripBasename, enableAsyncRouteHandlers = false, instrumentPageLoad = true, instrumentNavigation = true, lazyRouteTimeout } = a0;
|
|
return {
|
|
...r15,
|
|
setup: (a0) => {
|
|
c12847_2.setup(a0);
|
|
let finalTimeout = c12847_0.finalTimeout;
|
|
if (finalTimeout == null) {
|
|
finalTimeout = 30000;
|
|
}
|
|
let idleTimeout = c12847_0.idleTimeout;
|
|
if (idleTimeout == null) {
|
|
idleTimeout = 1000;
|
|
}
|
|
const r20 = 3 * idleTimeout;
|
|
let r11 = lazyRouteTimeout;
|
|
if (lazyRouteTimeout == null) {
|
|
r11 = r20;
|
|
}
|
|
if (r11 === Infinity) {
|
|
env955[11] = finalTimeout;
|
|
if (DEBUG_BUILD) {
|
|
debug.log("[React Router] lazyRouteTimeout set to Infinity, capping at finalTimeout:", finalTimeout, "ms to prevent indefinite hangs");
|
|
}
|
|
} else if (Number.isNaN(r11)) {
|
|
if (DEBUG_BUILD) {
|
|
debug.warn("[React Router] lazyRouteTimeout must be a number, falling back to default:", r20);
|
|
}
|
|
env955[11] = r20;
|
|
} else if (r11 < 0) {
|
|
if (DEBUG_BUILD) {
|
|
debug.warn("[React Router] lazyRouteTimeout must be non-negative or Infinity, got:", r11, "falling back to:", r20);
|
|
}
|
|
env955[11] = r20;
|
|
} else {
|
|
env955[11] = r11;
|
|
}
|
|
env955[4] = useEffect;
|
|
env955[5] = useLocation;
|
|
env955[6] = useNavigationType;
|
|
env955[8] = matchRoutes;
|
|
env955[7] = createRoutesFromChildren;
|
|
env955[10] = enableAsyncRouteHandlers;
|
|
let r83 = stripBasename;
|
|
if (!stripBasename) {
|
|
r83 = false;
|
|
}
|
|
initializeRouterUtils(matchRoutes, r83);
|
|
},
|
|
afterAllSetup: (a0) => {
|
|
c12847_2.afterAllSetup(a0);
|
|
const pathname = WINDOW.location?.pathname;
|
|
let r20 = instrumentPageLoad;
|
|
if (instrumentPageLoad) {
|
|
r20 = pathname;
|
|
}
|
|
if (r20) {
|
|
const attributes = {};
|
|
attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] = "url";
|
|
attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP] = "pageload";
|
|
attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = `auto.pageload.react.reactrouter_v${c12847_1}`;
|
|
startBrowserTracingPageLoadSpan(a0, {
|
|
name: pathname,
|
|
attributes
|
|
});
|
|
}
|
|
if (instrumentNavigation) {
|
|
c955_12.add(a0);
|
|
}
|
|
}
|
|
};
|
|
}
|
|
export function createV6CompatibleWithSentryReactRouterRouting(a0, version2) {
|
|
if (env955[4] && env955[5] && env955[6] && env955[7] && env955[8]) {
|
|
const SentryRoutes3 = (props) => {
|
|
let c24247_0 = props;
|
|
const ref = useRef(true);
|
|
const location2 = (0, env955[5])();
|
|
const navigationType = (0, env955[6])();
|
|
(0, env955[4])(() => {
|
|
const r5 = env955;
|
|
const routes3 = (0, env955[7])(c24247_0.children);
|
|
if (ref.current) {
|
|
routes3.forEach($mk68219(r5));
|
|
updatePageloadTransaction({
|
|
activeRootSpan: getActiveRootSpan(),
|
|
location: location2,
|
|
routes: routes3,
|
|
allRoutes: Array.from(c955_14)
|
|
});
|
|
ref.current = false;
|
|
} else {
|
|
handleNavigation({
|
|
location: location2,
|
|
routes: routes3,
|
|
navigationType,
|
|
version: version2,
|
|
allRoutes: Array.from(c955_14)
|
|
});
|
|
}
|
|
}, [location2, navigationType]);
|
|
return <a0 {...props} />;
|
|
};
|
|
hoistNonReactStatics(SentryRoutes3, a0);
|
|
return SentryRoutes3;
|
|
}
|
|
if (DEBUG_BUILD) {
|
|
debug.warn(`reactRouterV6Instrumentation was unable to wrap Routes because of one or more missing parameters.
|
|
useEffect: ${env955[4]}. useLocation: ${env955[5]}. useNavigationType: ${env955[6]}.
|
|
createRoutesFromChildren: ${env955[7]}. matchRoutes: ${env955[8]}.`);
|
|
}
|
|
return a0;
|
|
}
|
|
export function createV6CompatibleWrapCreateBrowserRouter(a0, a1) {
|
|
let r16;
|
|
let c12849_0 = a0;
|
|
let c12849_1 = a1;
|
|
if (env955[4] && (env955[5] && (env955[6] && env955[8]))) {
|
|
r16 = function(a0, a1) {
|
|
addRoutesToAllRoutes(a0);
|
|
if (env955[10]) {
|
|
for (const item of a0) {
|
|
checkRouteForAsyncHandler(item, processResolvedRoutes);
|
|
}
|
|
}
|
|
const r43 = c12849_0(a0, wrapPatchRoutesOnNavigation(a1));
|
|
const basename2 = a1?.basename;
|
|
const activeRootSpan2 = getActiveRootSpan();
|
|
if (r43.state.historyAction === "POP" && activeRootSpan2) {
|
|
updatePageloadTransaction({
|
|
activeRootSpan: activeRootSpan2,
|
|
location: r43.state.location,
|
|
routes: a0,
|
|
basename: basename2,
|
|
allRoutes: Array.from(c955_14)
|
|
});
|
|
}
|
|
setupRouterSubscription(r43, a0, c12849_1, basename2, activeRootSpan2);
|
|
return r43;
|
|
};
|
|
} else {
|
|
r16 = a0;
|
|
if (DEBUG_BUILD) {
|
|
debug.warn(`reactRouterV${a1}Instrumentation was unable to wrap the \`createRouter\` function because of one or more missing parameters.`);
|
|
r16 = a0;
|
|
}
|
|
}
|
|
return r16;
|
|
}
|
|
export function createV6CompatibleWrapCreateMemoryRouter(a0, a1) {
|
|
let r16;
|
|
let c12850_0 = a0;
|
|
let c12850_1 = a1;
|
|
if (env955[4] && (env955[5] && (env955[6] && env955[8]))) {
|
|
r16 = function(a0, a1) {
|
|
let location3;
|
|
addRoutesToAllRoutes(a0);
|
|
if (env955[10]) {
|
|
for (const item of a0) {
|
|
checkRouteForAsyncHandler(item, processResolvedRoutes);
|
|
}
|
|
}
|
|
const r44 = c12850_0(a0, wrapPatchRoutesOnNavigation(a1, true));
|
|
const basename2 = a1?.basename;
|
|
const initialEntries = a1?.initialEntries;
|
|
const initialIndex = a1?.initialIndex;
|
|
const r51 = initialEntries ? initialEntries.length === 1 : initialEntries;
|
|
const r53 = initialIndex !== void 0 && initialEntries && initialEntries[initialIndex];
|
|
const pathname = r51 ? initialEntries[0] : r53 ? initialEntries[initialIndex] : void 0;
|
|
if (pathname) {
|
|
let r57 = pathname;
|
|
if (typeof r57 === "string") {
|
|
r57 = {
|
|
pathname
|
|
};
|
|
}
|
|
location3 = r57;
|
|
} else {
|
|
location3 = r44.state.location;
|
|
}
|
|
const activeRootSpan2 = getActiveRootSpan();
|
|
if (r44.state.historyAction === "POP" && activeRootSpan2) {
|
|
updatePageloadTransaction({
|
|
activeRootSpan: activeRootSpan2,
|
|
location: location3,
|
|
routes: a0,
|
|
basename: basename2,
|
|
allRoutes: Array.from(c955_14)
|
|
});
|
|
}
|
|
setupRouterSubscription(r44, a0, c12850_1, basename2, activeRootSpan2);
|
|
return r44;
|
|
};
|
|
} else {
|
|
r16 = a0;
|
|
if (DEBUG_BUILD) {
|
|
debug.warn(`reactRouterV${a1}Instrumentation was unable to wrap the \`createMemoryRouter\` function because of one or more missing parameters.`);
|
|
r16 = a0;
|
|
}
|
|
}
|
|
return r16;
|
|
}
|
|
export function createV6CompatibleWrapUseRoutes(a0, version3) {
|
|
let SentryRoutes2;
|
|
let c12851_0 = a0;
|
|
if (env955[4] && env955[5] && env955[6] && env955[8]) {
|
|
SentryRoutes2 = (a0) => {
|
|
const ref2 = useRef(true);
|
|
const { routes: routes2, locationArg: locationArg2 } = a0;
|
|
const r15 = c12851_0(routes2, locationArg2);
|
|
let r17 = (0, env955[5])();
|
|
const navigationType2 = (0, env955[6])();
|
|
if (typeof locationArg2 !== "string") {
|
|
if (locationArg2?.pathname) {
|
|
r17 = locationArg2;
|
|
}
|
|
} else {
|
|
r17 = locationArg2;
|
|
}
|
|
const locationArg = r17;
|
|
(0, env955[4])(() => {
|
|
const location3 = typeof locationArg === "string" ? {
|
|
pathname: locationArg
|
|
} : locationArg;
|
|
const current = ref2.current;
|
|
const r4 = env955;
|
|
if (current) {
|
|
routes2.forEach($mk68219(r4));
|
|
updatePageloadTransaction({
|
|
activeRootSpan: getActiveRootSpan(),
|
|
location: location3,
|
|
routes: routes2,
|
|
allRoutes: Array.from(c955_14)
|
|
});
|
|
ref2.current = false;
|
|
} else {
|
|
handleNavigation({
|
|
location: location3,
|
|
routes: routes2,
|
|
navigationType: navigationType2,
|
|
version: version3,
|
|
allRoutes: Array.from(c955_14)
|
|
});
|
|
}
|
|
}, [navigationType2, locationArg]);
|
|
return r15;
|
|
};
|
|
return (a0, a1) => <SentryRoutes2 routes={a0} locationArg={a1} />;
|
|
}
|
|
if (DEBUG_BUILD) {
|
|
debug.warn("reactRouterV6Instrumentation was unable to wrap `useRoutes` because of one or more missing parameters.");
|
|
}
|
|
return a0;
|
|
}
|
|
export { handleNavigation };
|
|
export { processResolvedRoutes };
|
|
export { shouldSkipNavigation };
|
|
export { updateNavigationSpan };
|