@coffre/ui 0.1.17 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -3
- package/dist/{server/_coffre/assets/affordances-CKANXDTG.js → chunks/affordances-DAvsVz7u.js} +12 -7
- package/dist/chunks/affordances-DAvsVz7u.js.map +1 -0
- package/dist/chunks/directory-CSjWWUQ1.js +370 -0
- package/dist/chunks/directory-CSjWWUQ1.js.map +1 -0
- package/dist/{server/_coffre/assets/grants-DdKT11Ny.js → chunks/grants-saMQagmG.js} +41 -39
- package/dist/chunks/grants-saMQagmG.js.map +1 -0
- package/dist/chunks/icons-D-PfAfnH.js +203 -0
- package/dist/chunks/icons-D-PfAfnH.js.map +1 -0
- package/dist/chunks/mounted-jJmqqV_n.js +17 -0
- package/dist/chunks/mounted-jJmqqV_n.js.map +1 -0
- package/dist/{server/_coffre/assets/offboarding-CRz-K82H.js → chunks/offboarding-C6l30DZR.js} +70 -69
- package/dist/chunks/offboarding-C6l30DZR.js.map +1 -0
- package/dist/chunks/page-C5HcNqf2.js +190 -0
- package/dist/chunks/page-C5HcNqf2.js.map +1 -0
- package/dist/chunks/page-route-Drfw7lmn.js +20 -0
- package/dist/chunks/page-route-Drfw7lmn.js.map +1 -0
- package/dist/{server/_coffre/assets/principal-page-C-EFwJQw.js → chunks/principal-page-D_91OA0l.js} +105 -103
- package/dist/chunks/principal-page-D_91OA0l.js.map +1 -0
- package/dist/{server/_coffre/assets → chunks}/project-environments-lEzFHUt4.js +2 -0
- package/dist/chunks/project-environments-lEzFHUt4.js.map +1 -0
- package/dist/chunks/queries-CQ81o4so.js +376 -0
- package/dist/chunks/queries-CQ81o4so.js.map +1 -0
- package/dist/{server/_coffre/assets/row-state-C2P57xT1.js → chunks/row-state-0PsrEzOL.js} +22 -21
- package/dist/chunks/row-state-0PsrEzOL.js.map +1 -0
- package/dist/{server/_coffre/assets → chunks}/signin-errors-BEFlVDbQ.js +2 -0
- package/dist/chunks/signin-errors-BEFlVDbQ.js.map +1 -0
- package/dist/chunks/theme-B2vQolVR.js +86 -0
- package/dist/chunks/theme-B2vQolVR.js.map +1 -0
- package/dist/chunks/ui-DixXLQvQ.js +405 -0
- package/dist/chunks/ui-DixXLQvQ.js.map +1 -0
- package/dist/{server/_coffre/assets/use-action-B-xpvVRO.js → chunks/use-action-CWsg_YWU.js} +8 -6
- package/dist/chunks/use-action-CWsg_YWU.js.map +1 -0
- package/dist/{server/_coffre/assets/use-change-C8BCf3oU.js → chunks/use-change-c6CeLRin.js} +10 -474
- package/dist/chunks/use-change-c6CeLRin.js.map +1 -0
- package/dist/chunks/use-shell-jxd7Tzd-.js +26 -0
- package/dist/chunks/use-shell-jxd7Tzd-.js.map +1 -0
- package/dist/{server/_coffre/assets → chunks}/validation-BQtqPe2V.js +2 -0
- package/dist/chunks/validation-BQtqPe2V.js.map +1 -0
- package/dist/index.d.ts +386 -18
- package/dist/index.js +1147 -0
- package/dist/index.js.map +1 -0
- package/dist/pages/account.d.ts +9 -0
- package/dist/pages/account.js +334 -0
- package/dist/pages/account.js.map +1 -0
- package/dist/pages/audit.d.ts +3 -0
- package/dist/{server/_coffre/assets/audit-qB9G2AQJ.js → pages/audit.js} +102 -100
- package/dist/pages/audit.js.map +1 -0
- package/dist/pages/device-login.d.ts +9 -0
- package/dist/pages/device-login.js +211 -0
- package/dist/pages/device-login.js.map +1 -0
- package/dist/pages/environment.d.ts +3 -0
- package/dist/{server/_coffre/assets/projects._project._environment-C6uybzeU.js → pages/environment.js} +323 -469
- package/dist/pages/environment.js.map +1 -0
- package/dist/pages/login.d.ts +10 -0
- package/dist/pages/login.js +104 -0
- package/dist/pages/login.js.map +1 -0
- package/dist/pages/project.d.ts +2 -0
- package/dist/{server/_coffre/assets/projects._project.index-3CXwkyTh.js → pages/project.js} +223 -225
- package/dist/pages/project.js.map +1 -0
- package/dist/pages/projects.d.ts +3 -0
- package/dist/{server/_coffre/assets/projects.index-iSoBpRFz.js → pages/projects.js} +83 -81
- package/dist/pages/projects.js.map +1 -0
- package/dist/pages/settings.d.ts +3 -0
- package/dist/{server/_coffre/assets/settings-BDQTF5XW.js → pages/settings.js} +20 -18
- package/dist/pages/settings.js.map +1 -0
- package/dist/pages/token.d.ts +3 -0
- package/dist/{server/_coffre/assets/tokens._token-CrBMpcbN.js → pages/token.js} +195 -265
- package/dist/pages/token.js.map +1 -0
- package/dist/pages/tokens.d.ts +3 -0
- package/dist/pages/tokens.js +39 -0
- package/dist/pages/tokens.js.map +1 -0
- package/dist/pages/unregistered.d.ts +8 -0
- package/dist/pages/unregistered.js +54 -0
- package/dist/pages/unregistered.js.map +1 -0
- package/dist/pages/user.d.ts +3 -0
- package/dist/pages/user.js +16 -0
- package/dist/pages/user.js.map +1 -0
- package/dist/pages/users.d.ts +3 -0
- package/dist/pages/users.js +39 -0
- package/dist/pages/users.js.map +1 -0
- package/dist/project-BqIy8gYR.d.ts +5 -0
- package/dist/vite.d.ts +16 -0
- package/dist/vite.js +52 -0
- package/package.json +36 -21
- package/src/assets/icon.svg +1 -0
- package/src/components/affordances.ts +10 -4
- package/src/components/command-palette.tsx +229 -203
- package/src/components/directory.tsx +34 -38
- package/src/components/principal.tsx +7 -3
- package/src/components/shell.tsx +89 -127
- package/src/components/theme.tsx +14 -81
- package/src/components/ui.tsx +97 -68
- package/src/index.ts +29 -0
- package/src/layout.tsx +113 -0
- package/src/lib/coffre.ts +8 -4
- package/src/lib/mounted.ts +13 -0
- package/src/lib/page-context.ts +31 -0
- package/src/lib/page-route.ts +22 -0
- package/src/lib/preferences.tsx +46 -0
- package/src/options.ts +240 -0
- package/src/{routes → pages}/account.tsx +7 -24
- package/src/{routes → pages}/audit.tsx +5 -16
- package/src/{routes/auth.device.tsx → pages/device-login.tsx} +8 -21
- package/src/{routes/projects.$project.$environment.tsx → pages/environment.tsx} +43 -52
- package/src/{routes → pages}/login.tsx +5 -16
- package/src/{routes/projects.$project.index.tsx → pages/project.tsx} +38 -50
- package/src/{routes/projects.index.tsx → pages/projects.tsx} +2 -7
- package/src/{routes → pages}/settings.tsx +3 -10
- package/src/{routes/tokens.$token.tsx → pages/token.tsx} +6 -7
- package/src/{routes/tokens.index.tsx → pages/tokens.tsx} +3 -8
- package/src/{routes → pages}/unregistered.tsx +1 -6
- package/src/pages/user.tsx +10 -0
- package/src/{routes/users.index.tsx → pages/users.tsx} +3 -8
- package/src/register.ts +55 -0
- package/src/router.tsx +31 -62
- package/src/styles/globals.css +104 -46
- package/src/vite.ts +78 -0
- package/dist/client/.assetsignore +0 -2
- package/dist/client/_coffre/assets/account-BoLGAxbD.js +0 -2
- package/dist/client/_coffre/assets/account-CnnuRTDB.js +0 -1
- package/dist/client/_coffre/assets/affordances-CEafRJcN.js +0 -1
- package/dist/client/_coffre/assets/audit-CHSvKLWX.js +0 -1
- package/dist/client/_coffre/assets/audit-Cn4hmS4u.js +0 -2
- package/dist/client/_coffre/assets/auth.device-Co5vrpaA.js +0 -2
- package/dist/client/_coffre/assets/auth.device-DAlqWacc.js +0 -1
- package/dist/client/_coffre/assets/directory-H8Eh3MnS.js +0 -1
- package/dist/client/_coffre/assets/dist-Braunv_x.js +0 -1
- package/dist/client/_coffre/assets/globals-CpMrgkV6.css +0 -1
- package/dist/client/_coffre/assets/grants-DPDxJXU1.js +0 -1
- package/dist/client/_coffre/assets/icons-Dc_-t0lp.js +0 -1
- package/dist/client/_coffre/assets/index-sUCIXRgJ.js +0 -12
- package/dist/client/_coffre/assets/inter-cyrillic-ext-opsz-normal-CfYZpDVp.woff2 +0 -0
- package/dist/client/_coffre/assets/inter-cyrillic-opsz-normal-BFQXbQ-f.woff2 +0 -0
- package/dist/client/_coffre/assets/inter-greek-ext-opsz-normal-BmPQvyvo.woff2 +0 -0
- package/dist/client/_coffre/assets/inter-greek-opsz-normal-BM0NlUE_.woff2 +0 -0
- package/dist/client/_coffre/assets/inter-latin-ext-opsz-normal-DpK-iCPk.woff2 +0 -0
- package/dist/client/_coffre/assets/inter-latin-opsz-normal-BwkfbSeq.woff2 +0 -0
- package/dist/client/_coffre/assets/inter-vietnamese-opsz-normal-Ci9T9ieq.woff2 +0 -0
- package/dist/client/_coffre/assets/jetbrains-mono-cyrillic-ext-wght-normal-EocZY2iu.woff2 +0 -0
- package/dist/client/_coffre/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/dist/client/_coffre/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/dist/client/_coffre/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/dist/client/_coffre/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/dist/client/_coffre/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/dist/client/_coffre/assets/link-DBINMwm6.js +0 -1
- package/dist/client/_coffre/assets/login-BZFYfL1Y.js +0 -1
- package/dist/client/_coffre/assets/login-CYCKWTOD.js +0 -2
- package/dist/client/_coffre/assets/offboarding-Bwpftp3g.js +0 -1
- package/dist/client/_coffre/assets/page-C_hnzdaR.js +0 -1
- package/dist/client/_coffre/assets/preload-helper-CLkO85Nq.js +0 -1
- package/dist/client/_coffre/assets/principal-page-DLho8TSJ.js +0 -1
- package/dist/client/_coffre/assets/project-environments-CfIH5kFM.js +0 -1
- package/dist/client/_coffre/assets/projects._project._environment-DHRRvQw0.js +0 -3
- package/dist/client/_coffre/assets/projects._project._environment-TLI-RjBZ.js +0 -2
- package/dist/client/_coffre/assets/projects._project.index-BO-8FZIY.js +0 -2
- package/dist/client/_coffre/assets/projects._project.index-DGl921dP.js +0 -1
- package/dist/client/_coffre/assets/projects.index-BDn7Bhoo.js +0 -1
- package/dist/client/_coffre/assets/row-state-DJ-KLamZ.js +0 -1
- package/dist/client/_coffre/assets/settings-q9G1QvR_.js +0 -1
- package/dist/client/_coffre/assets/signin-errors-CroZWZgm.js +0 -1
- package/dist/client/_coffre/assets/suspense-O8sP0mEC.js +0 -1
- package/dist/client/_coffre/assets/tokens._token-B_qczpT9.js +0 -2
- package/dist/client/_coffre/assets/tokens._token-T-sqwMbz.js +0 -2
- package/dist/client/_coffre/assets/tokens.index-CcXSZnAG.js +0 -1
- package/dist/client/_coffre/assets/ui-BXP2IqrW.js +0 -46
- package/dist/client/_coffre/assets/unregistered-D2JXJ90x.js +0 -1
- package/dist/client/_coffre/assets/use-action-BpzKWhgg.js +0 -1
- package/dist/client/_coffre/assets/use-change-CKj3Inq9.js +0 -1
- package/dist/client/_coffre/assets/use-shell-W0SusPkz.js +0 -1
- package/dist/client/_coffre/assets/useQuery-B-lxFSES.js +0 -1
- package/dist/client/_coffre/assets/useSuspenseQuery-BZ-nzHST.js +0 -1
- package/dist/client/_coffre/assets/users._user-Bb3BGYHl.js +0 -1
- package/dist/client/_coffre/assets/users._user-DXmvKrzE.js +0 -2
- package/dist/client/_coffre/assets/users.index-BvzP3qwW.js +0 -1
- package/dist/client/_coffre/assets/validation-9Cl_XS-l.js +0 -1
- package/dist/server/.vite/manifest.json +0 -668
- package/dist/server/_coffre/assets/_tanstack-start-manifest_v-GsKnGGRy.js +0 -162
- package/dist/server/_coffre/assets/account-CV-a2IU2.js +0 -329
- package/dist/server/_coffre/assets/account-hk6wcIXU.js +0 -162
- package/dist/server/_coffre/assets/async-local-storage-C10uQtMM.js +0 -3108
- package/dist/server/_coffre/assets/audit-C1_Ej6YB.js +0 -31
- package/dist/server/_coffre/assets/auth.device-6JRrWbSV.js +0 -210
- package/dist/server/_coffre/assets/auth.device-CLoAxC2T.js +0 -29
- package/dist/server/_coffre/assets/directory-B-_rqsPx.js +0 -371
- package/dist/server/_coffre/assets/dist-CnnV3t2g.js +0 -908
- package/dist/server/_coffre/assets/empty-plugin-adapters-Cq4--YW-.js +0 -5
- package/dist/server/_coffre/assets/globals-CpMrgkV6.css +0 -1
- package/dist/server/_coffre/assets/icons-DOFT-eWB.js +0 -1704
- package/dist/server/_coffre/assets/inter-cyrillic-ext-opsz-normal-CfYZpDVp.woff2 +0 -0
- package/dist/server/_coffre/assets/inter-cyrillic-opsz-normal-BFQXbQ-f.woff2 +0 -0
- package/dist/server/_coffre/assets/inter-greek-ext-opsz-normal-BmPQvyvo.woff2 +0 -0
- package/dist/server/_coffre/assets/inter-greek-opsz-normal-BM0NlUE_.woff2 +0 -0
- package/dist/server/_coffre/assets/inter-latin-ext-opsz-normal-DpK-iCPk.woff2 +0 -0
- package/dist/server/_coffre/assets/inter-latin-opsz-normal-BwkfbSeq.woff2 +0 -0
- package/dist/server/_coffre/assets/inter-vietnamese-opsz-normal-Ci9T9ieq.woff2 +0 -0
- package/dist/server/_coffre/assets/jetbrains-mono-cyrillic-ext-wght-normal-EocZY2iu.woff2 +0 -0
- package/dist/server/_coffre/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/dist/server/_coffre/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/dist/server/_coffre/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/dist/server/_coffre/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/dist/server/_coffre/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/dist/server/_coffre/assets/lazyRouteComponent-CqBNCGuZ.js +0 -480
- package/dist/server/_coffre/assets/link-42ZWdjzZ.js +0 -422
- package/dist/server/_coffre/assets/login-DRKUKkaW.js +0 -22
- package/dist/server/_coffre/assets/login-DnwxVl4Y.js +0 -102
- package/dist/server/_coffre/assets/matchContext-qLfYbC6_.js +0 -56
- package/dist/server/_coffre/assets/page-D6n45dcK.js +0 -3561
- package/dist/server/_coffre/assets/projects._project._environment-CS8DdSMY.js +0 -48
- package/dist/server/_coffre/assets/projects._project.index-BGfcNpj0.js +0 -23
- package/dist/server/_coffre/assets/react-dom-bBoJXlK2.js +0 -1718
- package/dist/server/_coffre/assets/router-9BTgJhWG.js +0 -2322
- package/dist/server/_coffre/assets/start-DR3rN0St.js +0 -4
- package/dist/server/_coffre/assets/suspense-C-2QfDd2.js +0 -602
- package/dist/server/_coffre/assets/tokens._token-rY86Cjgp.js +0 -10
- package/dist/server/_coffre/assets/tokens.index-Bq5qDW9q.js +0 -37
- package/dist/server/_coffre/assets/ui-Cc0CGMtr.js +0 -14881
- package/dist/server/_coffre/assets/unregistered-D9ZKLOPJ.js +0 -53
- package/dist/server/_coffre/assets/use-shell-DwOzEi87.js +0 -462
- package/dist/server/_coffre/assets/useQuery-CTe86qFq.js +0 -8
- package/dist/server/_coffre/assets/useRouter-CaUSUNsw.js +0 -473
- package/dist/server/_coffre/assets/useSuspenseQuery-CSoHzrMb.js +0 -117
- package/dist/server/_coffre/assets/users._user-BmLKYeo_.js +0 -10
- package/dist/server/_coffre/assets/users._user-BmiHwQx3.js +0 -14
- package/dist/server/_coffre/assets/users.index-BiEax90r.js +0 -37
- package/dist/server/index.js +0 -13911
- package/src/assets/favicon-32.png +0 -0
- package/src/components/agentation.tsx +0 -34
- package/src/entry.ts +0 -19
- package/src/routeTree.gen.ts +0 -367
- package/src/routes/__root.tsx +0 -169
- package/src/routes/access.tsx +0 -11
- package/src/routes/index.tsx +0 -15
- package/src/routes/users.$user.tsx +0 -13
- package/src/types.ts +0 -21
|
@@ -1,3108 +0,0 @@
|
|
|
1
|
-
import { i as require_react, r as require_jsx_runtime, s as __toESM, t as useRouter } from "./useRouter-CaUSUNsw.js";
|
|
2
|
-
import { A as functionalUpdate, C as DEFAULT_PROTOCOL_ALLOWLIST, D as deepEqual, E as decodePath, F as last, I as nullReplaceEqualDeep, L as replaceEqualDeep, M as isDangerousProtocol, O as encodePathLikeUrl, P as isPromise, S as invariant, T as createControlledPromise, _ as findRouteMatch, a as cleanPath, b as processRouteTree, c as interpolatePath, d as resolvePath, f as trimPath, g as findFlatMatch, h as buildRouteBranch, j as hasKeys, l as joinPaths, m as trimPathRight, n as useStore, o as compileDecodeCharMap, r as ClientOnly, v as findSingleMatch, w as arraysEqual, x as createLRUCache, y as processRouteMasks } from "./react-dom-bBoJXlK2.js";
|
|
3
|
-
import { a as redirect, n as matchContext, o as rootRouteId, r as isRedirect } from "./matchContext-qLfYbC6_.js";
|
|
4
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
5
|
-
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.15/node_modules/@tanstack/router-core/dist/esm/not-found.js
|
|
6
|
-
/** Determine if a value is a TanStack Router not-found error. */
|
|
7
|
-
function isNotFound(obj) {
|
|
8
|
-
return obj?.isNotFound === true;
|
|
9
|
-
}
|
|
10
|
-
//#endregion
|
|
11
|
-
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.15/node_modules/@tanstack/router-core/dist/esm/scroll-restoration.js
|
|
12
|
-
function getSafeSessionStorage() {
|
|
13
|
-
try {
|
|
14
|
-
return sessionStorage;
|
|
15
|
-
} catch {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
getSafeSessionStorage();
|
|
20
|
-
//#endregion
|
|
21
|
-
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.15/node_modules/@tanstack/router-core/dist/esm/qss.js
|
|
22
|
-
/**
|
|
23
|
-
* Program is a reimplementation of the `qss` package:
|
|
24
|
-
* Copyright (c) Luke Edwards luke.edwards05@gmail.com, MIT License
|
|
25
|
-
* https://github.com/lukeed/qss/blob/master/license.md
|
|
26
|
-
*
|
|
27
|
-
* This reimplementation uses modern browser APIs
|
|
28
|
-
* (namely URLSearchParams) and TypeScript while still
|
|
29
|
-
* maintaining the original functionality and interface.
|
|
30
|
-
*
|
|
31
|
-
* Update: this implementation has also been mangled to
|
|
32
|
-
* fit exactly our use-case (single value per key in encoding).
|
|
33
|
-
*/
|
|
34
|
-
/**
|
|
35
|
-
* Encodes an object into a query string.
|
|
36
|
-
* @param obj - The object to encode into a query string.
|
|
37
|
-
* @param stringify - An optional custom stringify function.
|
|
38
|
-
* @returns The encoded query string.
|
|
39
|
-
* @example
|
|
40
|
-
* ```
|
|
41
|
-
* // Example input: encode({ token: 'foo', key: 'value' })
|
|
42
|
-
* // Expected output: "token=foo&key=value"
|
|
43
|
-
* ```
|
|
44
|
-
*/
|
|
45
|
-
function encode(obj, stringify = String) {
|
|
46
|
-
const result = new URLSearchParams();
|
|
47
|
-
for (const key in obj) {
|
|
48
|
-
const val = obj[key];
|
|
49
|
-
if (val !== void 0) result.set(key, stringify(val));
|
|
50
|
-
}
|
|
51
|
-
return result.toString();
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Converts a string value to its appropriate type (string, number, boolean).
|
|
55
|
-
* @param mix - The string value to convert.
|
|
56
|
-
* @returns The converted value.
|
|
57
|
-
* @example
|
|
58
|
-
* // Example input: toValue("123")
|
|
59
|
-
* // Expected output: 123
|
|
60
|
-
*/
|
|
61
|
-
function toValue(str) {
|
|
62
|
-
if (!str) return "";
|
|
63
|
-
if (str === "false") return false;
|
|
64
|
-
if (str === "true") return true;
|
|
65
|
-
return +str * 0 === 0 && +str + "" === str ? +str : str;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Decodes a query string into an object.
|
|
69
|
-
* @param str - The query string to decode.
|
|
70
|
-
* @returns The decoded key-value pairs in an object format.
|
|
71
|
-
* @example
|
|
72
|
-
* // Example input: decode("token=foo&key=value")
|
|
73
|
-
* // Expected output: { "token": "foo", "key": "value" }
|
|
74
|
-
*/
|
|
75
|
-
function decode(str) {
|
|
76
|
-
const searchParams = new URLSearchParams(str);
|
|
77
|
-
const result = Object.create(null);
|
|
78
|
-
for (const [key, value] of searchParams.entries()) {
|
|
79
|
-
const previousValue = result[key];
|
|
80
|
-
if (previousValue == null) result[key] = toValue(value);
|
|
81
|
-
else if (Array.isArray(previousValue)) previousValue.push(toValue(value));
|
|
82
|
-
else result[key] = [previousValue, toValue(value)];
|
|
83
|
-
}
|
|
84
|
-
return result;
|
|
85
|
-
}
|
|
86
|
-
//#endregion
|
|
87
|
-
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.15/node_modules/@tanstack/router-core/dist/esm/searchParams.js
|
|
88
|
-
/** Default `parseSearch` that strips leading '?' and JSON-parses values. */
|
|
89
|
-
var defaultParseSearch = parseSearchWith(JSON.parse);
|
|
90
|
-
/** Default `stringifySearch` using JSON.stringify for complex values. */
|
|
91
|
-
var defaultStringifySearch = stringifySearchWith(JSON.stringify, JSON.parse);
|
|
92
|
-
/**
|
|
93
|
-
* Build a `parseSearch` function using a provided JSON-like parser.
|
|
94
|
-
*
|
|
95
|
-
* The returned function strips a leading `?`, decodes values, and attempts to
|
|
96
|
-
* JSON-parse string values using the given `parser`.
|
|
97
|
-
*
|
|
98
|
-
* @param parser Function to parse a string value (e.g. `JSON.parse`).
|
|
99
|
-
* @returns A `parseSearch` function compatible with `Router` options.
|
|
100
|
-
* @link https://tanstack.com/router/latest/docs/framework/react/guide/custom-search-param-serialization
|
|
101
|
-
*/
|
|
102
|
-
function parseSearchWith(parser) {
|
|
103
|
-
return (searchStr) => {
|
|
104
|
-
if (searchStr[0] === "?") searchStr = searchStr.substring(1);
|
|
105
|
-
const query = decode(searchStr);
|
|
106
|
-
for (const key in query) {
|
|
107
|
-
const value = query[key];
|
|
108
|
-
if (typeof value === "string") try {
|
|
109
|
-
query[key] = parser(value);
|
|
110
|
-
} catch (_err) {}
|
|
111
|
-
}
|
|
112
|
-
return query;
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Build a `stringifySearch` function using a provided serializer.
|
|
117
|
-
*
|
|
118
|
-
* Non-primitive values are serialized with `stringify`. If a `parser` is
|
|
119
|
-
* supplied, string values that are parseable are re-serialized to ensure
|
|
120
|
-
* symmetry with `parseSearch`.
|
|
121
|
-
*
|
|
122
|
-
* @param stringify Function to serialize a value (e.g. `JSON.stringify`).
|
|
123
|
-
* @param parser Optional parser to detect parseable strings.
|
|
124
|
-
* @returns A `stringifySearch` function compatible with `Router` options.
|
|
125
|
-
* @link https://tanstack.com/router/latest/docs/framework/react/guide/custom-search-param-serialization
|
|
126
|
-
*/
|
|
127
|
-
function stringifySearchWith(stringify, parser) {
|
|
128
|
-
const hasParser = typeof parser === "function";
|
|
129
|
-
function stringifyValue(val) {
|
|
130
|
-
if (typeof val === "object" && val !== null) try {
|
|
131
|
-
return stringify(val);
|
|
132
|
-
} catch (_err) {}
|
|
133
|
-
else if (hasParser && typeof val === "string") try {
|
|
134
|
-
parser(val);
|
|
135
|
-
return stringify(val);
|
|
136
|
-
} catch (_err) {}
|
|
137
|
-
return val;
|
|
138
|
-
}
|
|
139
|
-
return (search) => {
|
|
140
|
-
const searchStr = encode(search, stringifyValue);
|
|
141
|
-
return searchStr ? `?${searchStr}` : "";
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
//#endregion
|
|
145
|
-
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.15/node_modules/@tanstack/router-core/dist/esm/rewrite.js
|
|
146
|
-
/** Compose multiple rewrite pairs into a single in/out rewrite. */
|
|
147
|
-
function composeRewrites(rewrites) {
|
|
148
|
-
return {
|
|
149
|
-
input: ({ url }) => {
|
|
150
|
-
for (const rewrite of rewrites) url = executeRewriteInput(rewrite, url);
|
|
151
|
-
return url;
|
|
152
|
-
},
|
|
153
|
-
output: ({ url }) => {
|
|
154
|
-
for (let i = rewrites.length - 1; i >= 0; i--) url = executeRewriteOutput(rewrites[i], url);
|
|
155
|
-
return url;
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
/** Create a rewrite pair that strips/adds a basepath on input/output. */
|
|
160
|
-
function rewriteBasepath(opts) {
|
|
161
|
-
const trimmedBasepath = trimPath(opts.basepath);
|
|
162
|
-
const normalizedBasepath = `/${trimmedBasepath}`;
|
|
163
|
-
const checkBasepath = opts.caseSensitive ? normalizedBasepath : normalizedBasepath.toLowerCase();
|
|
164
|
-
const checkBasepathWithSlash = `${checkBasepath}/`;
|
|
165
|
-
return {
|
|
166
|
-
input: ({ url }) => {
|
|
167
|
-
const pathname = opts.caseSensitive ? url.pathname : url.pathname.toLowerCase();
|
|
168
|
-
if (pathname === checkBasepath) url.pathname = "/";
|
|
169
|
-
else if (pathname.startsWith(checkBasepathWithSlash)) url.pathname = url.pathname.slice(normalizedBasepath.length);
|
|
170
|
-
return url;
|
|
171
|
-
},
|
|
172
|
-
output: ({ url }) => {
|
|
173
|
-
url.pathname = joinPaths([
|
|
174
|
-
"/",
|
|
175
|
-
trimmedBasepath,
|
|
176
|
-
url.pathname
|
|
177
|
-
]);
|
|
178
|
-
return url;
|
|
179
|
-
}
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
/** Execute a location input rewrite if provided. */
|
|
183
|
-
function executeRewriteInput(rewrite, url) {
|
|
184
|
-
const res = rewrite?.input?.({ url });
|
|
185
|
-
if (res) {
|
|
186
|
-
if (typeof res === "string") return new URL(res);
|
|
187
|
-
else if (res instanceof URL) return res;
|
|
188
|
-
}
|
|
189
|
-
return url;
|
|
190
|
-
}
|
|
191
|
-
/** Execute a location output rewrite if provided. */
|
|
192
|
-
function executeRewriteOutput(rewrite, url) {
|
|
193
|
-
const res = rewrite?.output?.({ url });
|
|
194
|
-
if (res) {
|
|
195
|
-
if (typeof res === "string") return new URL(res);
|
|
196
|
-
else if (res instanceof URL) return res;
|
|
197
|
-
}
|
|
198
|
-
return url;
|
|
199
|
-
}
|
|
200
|
-
//#endregion
|
|
201
|
-
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.15/node_modules/@tanstack/router-core/dist/esm/stores.js
|
|
202
|
-
/** SSR non-reactive createMutableStore */
|
|
203
|
-
function createNonReactiveMutableStore(initialValue) {
|
|
204
|
-
let value = initialValue;
|
|
205
|
-
return {
|
|
206
|
-
get() {
|
|
207
|
-
return value;
|
|
208
|
-
},
|
|
209
|
-
set(nextOrUpdater) {
|
|
210
|
-
value = functionalUpdate(nextOrUpdater, value);
|
|
211
|
-
}
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
/** SSR non-reactive createReadonlyStore */
|
|
215
|
-
function createNonReactiveReadonlyStore(read) {
|
|
216
|
-
return { get() {
|
|
217
|
-
return read();
|
|
218
|
-
} };
|
|
219
|
-
}
|
|
220
|
-
function createRouterStores(initialState, config) {
|
|
221
|
-
const { createMutableStore, createReadonlyStore, batch, init } = config;
|
|
222
|
-
const matchStores = /* @__PURE__ */ new Map();
|
|
223
|
-
const pendingMatchStores = /* @__PURE__ */ new Map();
|
|
224
|
-
const cachedMatchStores = /* @__PURE__ */ new Map();
|
|
225
|
-
const status = createMutableStore(initialState.status);
|
|
226
|
-
const loadedAt = createMutableStore(initialState.loadedAt);
|
|
227
|
-
const isLoading = createMutableStore(initialState.isLoading);
|
|
228
|
-
const isTransitioning = createMutableStore(initialState.isTransitioning);
|
|
229
|
-
const location = createMutableStore(initialState.location);
|
|
230
|
-
const resolvedLocation = createMutableStore(initialState.resolvedLocation);
|
|
231
|
-
const statusCode = createMutableStore(initialState.statusCode);
|
|
232
|
-
const redirect = createMutableStore(initialState.redirect);
|
|
233
|
-
const matchesId = createMutableStore([]);
|
|
234
|
-
const pendingIds = createMutableStore([]);
|
|
235
|
-
const cachedIds = createMutableStore([]);
|
|
236
|
-
const matches = createReadonlyStore(() => readPoolMatches(matchStores, matchesId.get()));
|
|
237
|
-
const pendingMatches = createReadonlyStore(() => readPoolMatches(pendingMatchStores, pendingIds.get()));
|
|
238
|
-
const cachedMatches = createReadonlyStore(() => readPoolMatches(cachedMatchStores, cachedIds.get()));
|
|
239
|
-
const firstId = createReadonlyStore(() => matchesId.get()[0]);
|
|
240
|
-
const hasPending = createReadonlyStore(() => matchesId.get().some((matchId) => {
|
|
241
|
-
return matchStores.get(matchId)?.get().status === "pending";
|
|
242
|
-
}));
|
|
243
|
-
const matchRouteDeps = createReadonlyStore(() => ({
|
|
244
|
-
locationHref: location.get().href,
|
|
245
|
-
resolvedLocationHref: resolvedLocation.get()?.href,
|
|
246
|
-
status: status.get()
|
|
247
|
-
}));
|
|
248
|
-
const __store = createReadonlyStore(() => ({
|
|
249
|
-
status: status.get(),
|
|
250
|
-
loadedAt: loadedAt.get(),
|
|
251
|
-
isLoading: isLoading.get(),
|
|
252
|
-
isTransitioning: isTransitioning.get(),
|
|
253
|
-
matches: matches.get(),
|
|
254
|
-
location: location.get(),
|
|
255
|
-
resolvedLocation: resolvedLocation.get(),
|
|
256
|
-
statusCode: statusCode.get(),
|
|
257
|
-
redirect: redirect.get()
|
|
258
|
-
}));
|
|
259
|
-
const matchStoreByRouteIdCache = createLRUCache(64);
|
|
260
|
-
function getRouteMatchStore(routeId) {
|
|
261
|
-
let cached = matchStoreByRouteIdCache.get(routeId);
|
|
262
|
-
if (!cached) {
|
|
263
|
-
cached = createReadonlyStore(() => {
|
|
264
|
-
const ids = matchesId.get();
|
|
265
|
-
for (const id of ids) {
|
|
266
|
-
const matchStore = matchStores.get(id);
|
|
267
|
-
if (matchStore && matchStore.routeId === routeId) return matchStore.get();
|
|
268
|
-
}
|
|
269
|
-
});
|
|
270
|
-
matchStoreByRouteIdCache.set(routeId, cached);
|
|
271
|
-
}
|
|
272
|
-
return cached;
|
|
273
|
-
}
|
|
274
|
-
const store = {
|
|
275
|
-
status,
|
|
276
|
-
loadedAt,
|
|
277
|
-
isLoading,
|
|
278
|
-
isTransitioning,
|
|
279
|
-
location,
|
|
280
|
-
resolvedLocation,
|
|
281
|
-
statusCode,
|
|
282
|
-
redirect,
|
|
283
|
-
matchesId,
|
|
284
|
-
pendingIds,
|
|
285
|
-
cachedIds,
|
|
286
|
-
matches,
|
|
287
|
-
pendingMatches,
|
|
288
|
-
cachedMatches,
|
|
289
|
-
firstId,
|
|
290
|
-
hasPending,
|
|
291
|
-
matchRouteDeps,
|
|
292
|
-
matchStores,
|
|
293
|
-
pendingMatchStores,
|
|
294
|
-
cachedMatchStores,
|
|
295
|
-
__store,
|
|
296
|
-
getRouteMatchStore,
|
|
297
|
-
setMatches,
|
|
298
|
-
setPending,
|
|
299
|
-
setCached
|
|
300
|
-
};
|
|
301
|
-
setMatches(initialState.matches);
|
|
302
|
-
init?.(store);
|
|
303
|
-
function setMatches(nextMatches) {
|
|
304
|
-
reconcileMatchPool(nextMatches, matchStores, matchesId, createMutableStore, batch);
|
|
305
|
-
}
|
|
306
|
-
function setPending(nextMatches) {
|
|
307
|
-
reconcileMatchPool(nextMatches, pendingMatchStores, pendingIds, createMutableStore, batch);
|
|
308
|
-
}
|
|
309
|
-
function setCached(nextMatches) {
|
|
310
|
-
reconcileMatchPool(nextMatches, cachedMatchStores, cachedIds, createMutableStore, batch);
|
|
311
|
-
}
|
|
312
|
-
return store;
|
|
313
|
-
}
|
|
314
|
-
function readPoolMatches(pool, ids) {
|
|
315
|
-
const matches = [];
|
|
316
|
-
for (const id of ids) {
|
|
317
|
-
const matchStore = pool.get(id);
|
|
318
|
-
if (matchStore) matches.push(matchStore.get());
|
|
319
|
-
}
|
|
320
|
-
return matches;
|
|
321
|
-
}
|
|
322
|
-
function reconcileMatchPool(nextMatches, pool, idStore, createMutableStore, batch) {
|
|
323
|
-
const nextIds = nextMatches.map((d) => d.id);
|
|
324
|
-
const nextIdSet = new Set(nextIds);
|
|
325
|
-
batch(() => {
|
|
326
|
-
for (const id of pool.keys()) if (!nextIdSet.has(id)) pool.delete(id);
|
|
327
|
-
for (const nextMatch of nextMatches) {
|
|
328
|
-
const existing = pool.get(nextMatch.id);
|
|
329
|
-
if (!existing) {
|
|
330
|
-
const matchStore = createMutableStore(nextMatch);
|
|
331
|
-
matchStore.routeId = nextMatch.routeId;
|
|
332
|
-
pool.set(nextMatch.id, matchStore);
|
|
333
|
-
continue;
|
|
334
|
-
}
|
|
335
|
-
existing.routeId = nextMatch.routeId;
|
|
336
|
-
if (existing.get() !== nextMatch) existing.set(nextMatch);
|
|
337
|
-
}
|
|
338
|
-
if (!arraysEqual(idStore.get(), nextIds)) idStore.set(nextIds);
|
|
339
|
-
});
|
|
340
|
-
}
|
|
341
|
-
//#endregion
|
|
342
|
-
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.15/node_modules/@tanstack/router-core/dist/esm/load-matches.js
|
|
343
|
-
var triggerOnReady = (inner) => {
|
|
344
|
-
if (!inner.rendered) {
|
|
345
|
-
inner.rendered = true;
|
|
346
|
-
return inner.onReady?.();
|
|
347
|
-
}
|
|
348
|
-
};
|
|
349
|
-
var resolvePreload = (inner, matchId) => {
|
|
350
|
-
return !!(inner.preload && !inner.router.stores.matchStores.has(matchId));
|
|
351
|
-
};
|
|
352
|
-
/**
|
|
353
|
-
* Builds the accumulated context from router options and all matches up to (and optionally including) the given index.
|
|
354
|
-
* Merges __routeContext and __beforeLoadContext from each match.
|
|
355
|
-
*/
|
|
356
|
-
var buildMatchContext = (inner, index, includeCurrentMatch = true) => {
|
|
357
|
-
const context = { ...inner.router.options.context ?? {} };
|
|
358
|
-
const end = includeCurrentMatch ? index : index - 1;
|
|
359
|
-
for (let i = 0; i <= end; i++) {
|
|
360
|
-
const innerMatch = inner.matches[i];
|
|
361
|
-
if (!innerMatch) continue;
|
|
362
|
-
const m = inner.router.getMatch(innerMatch.id);
|
|
363
|
-
if (!m) continue;
|
|
364
|
-
Object.assign(context, m.__routeContext, m.__beforeLoadContext);
|
|
365
|
-
}
|
|
366
|
-
return context;
|
|
367
|
-
};
|
|
368
|
-
var getNotFoundBoundaryIndex = (inner, err) => {
|
|
369
|
-
if (!inner.matches.length) return;
|
|
370
|
-
const requestedRouteId = err.routeId;
|
|
371
|
-
const matchedRootIndex = inner.matches.findIndex((m) => m.routeId === inner.router.routeTree.id);
|
|
372
|
-
const rootIndex = matchedRootIndex >= 0 ? matchedRootIndex : 0;
|
|
373
|
-
let startIndex = requestedRouteId ? inner.matches.findIndex((match) => match.routeId === requestedRouteId) : inner.firstBadMatchIndex ?? inner.matches.length - 1;
|
|
374
|
-
if (startIndex < 0) startIndex = rootIndex;
|
|
375
|
-
for (let i = startIndex; i >= 0; i--) {
|
|
376
|
-
const match = inner.matches[i];
|
|
377
|
-
if (inner.router.looseRoutesById[match.routeId].options.notFoundComponent) return i;
|
|
378
|
-
}
|
|
379
|
-
return requestedRouteId ? startIndex : rootIndex;
|
|
380
|
-
};
|
|
381
|
-
var handleRedirectAndNotFound = (inner, match, err) => {
|
|
382
|
-
if (!isRedirect(err) && !isNotFound(err)) return;
|
|
383
|
-
if (isRedirect(err) && err.redirectHandled && !err.options.reloadDocument) throw err;
|
|
384
|
-
if (match) {
|
|
385
|
-
match._nonReactive.beforeLoadPromise?.resolve();
|
|
386
|
-
match._nonReactive.loaderPromise?.resolve();
|
|
387
|
-
match._nonReactive.beforeLoadPromise = void 0;
|
|
388
|
-
match._nonReactive.loaderPromise = void 0;
|
|
389
|
-
match._nonReactive.error = err;
|
|
390
|
-
inner.updateMatch(match.id, (prev) => ({
|
|
391
|
-
...prev,
|
|
392
|
-
status: isRedirect(err) ? "redirected" : isNotFound(err) ? "notFound" : prev.status === "pending" ? "success" : prev.status,
|
|
393
|
-
context: buildMatchContext(inner, match.index),
|
|
394
|
-
isFetching: false,
|
|
395
|
-
error: err
|
|
396
|
-
}));
|
|
397
|
-
if (isNotFound(err) && !err.routeId) err.routeId = match.routeId;
|
|
398
|
-
match._nonReactive.loadPromise?.resolve();
|
|
399
|
-
}
|
|
400
|
-
if (isRedirect(err)) {
|
|
401
|
-
inner.rendered = true;
|
|
402
|
-
err.options._fromLocation = inner.location;
|
|
403
|
-
err.redirectHandled = true;
|
|
404
|
-
err = inner.router.resolveRedirect(err);
|
|
405
|
-
}
|
|
406
|
-
throw err;
|
|
407
|
-
};
|
|
408
|
-
var shouldSkipLoader = (inner, matchId) => {
|
|
409
|
-
const match = inner.router.getMatch(matchId);
|
|
410
|
-
if (!match) return true;
|
|
411
|
-
if (match.ssr === false) return true;
|
|
412
|
-
return false;
|
|
413
|
-
};
|
|
414
|
-
var syncMatchContext = (inner, matchId, index) => {
|
|
415
|
-
const nextContext = buildMatchContext(inner, index);
|
|
416
|
-
inner.updateMatch(matchId, (prev) => {
|
|
417
|
-
return {
|
|
418
|
-
...prev,
|
|
419
|
-
context: nextContext
|
|
420
|
-
};
|
|
421
|
-
});
|
|
422
|
-
};
|
|
423
|
-
var handleSerialError = (inner, index, err) => {
|
|
424
|
-
const { id: matchId, routeId } = inner.matches[index];
|
|
425
|
-
const route = inner.router.looseRoutesById[routeId];
|
|
426
|
-
if (err instanceof Promise) throw err;
|
|
427
|
-
inner.firstBadMatchIndex ??= index;
|
|
428
|
-
handleRedirectAndNotFound(inner, inner.router.getMatch(matchId), err);
|
|
429
|
-
try {
|
|
430
|
-
route.options.onError?.(err);
|
|
431
|
-
} catch (errorHandlerErr) {
|
|
432
|
-
err = errorHandlerErr;
|
|
433
|
-
handleRedirectAndNotFound(inner, inner.router.getMatch(matchId), err);
|
|
434
|
-
}
|
|
435
|
-
inner.updateMatch(matchId, (prev) => {
|
|
436
|
-
prev._nonReactive.beforeLoadPromise?.resolve();
|
|
437
|
-
prev._nonReactive.beforeLoadPromise = void 0;
|
|
438
|
-
prev._nonReactive.loadPromise?.resolve();
|
|
439
|
-
return {
|
|
440
|
-
...prev,
|
|
441
|
-
error: err,
|
|
442
|
-
status: "error",
|
|
443
|
-
isFetching: false,
|
|
444
|
-
updatedAt: Date.now(),
|
|
445
|
-
abortController: new AbortController()
|
|
446
|
-
};
|
|
447
|
-
});
|
|
448
|
-
if (!inner.preload && !isRedirect(err) && !isNotFound(err)) inner.serialError ??= err;
|
|
449
|
-
};
|
|
450
|
-
var isBeforeLoadSsr = (inner, matchId, index, route) => {
|
|
451
|
-
const existingMatch = inner.router.getMatch(matchId);
|
|
452
|
-
const parentMatchId = inner.matches[index - 1]?.id;
|
|
453
|
-
const parentMatch = parentMatchId ? inner.router.getMatch(parentMatchId) : void 0;
|
|
454
|
-
if (inner.router.isShell()) {
|
|
455
|
-
existingMatch.ssr = route.id === rootRouteId;
|
|
456
|
-
return;
|
|
457
|
-
}
|
|
458
|
-
if (parentMatch?.ssr === false) {
|
|
459
|
-
existingMatch.ssr = false;
|
|
460
|
-
return;
|
|
461
|
-
}
|
|
462
|
-
const parentOverride = (tempSsr) => {
|
|
463
|
-
if (tempSsr === true && parentMatch?.ssr === "data-only") return "data-only";
|
|
464
|
-
return tempSsr;
|
|
465
|
-
};
|
|
466
|
-
const defaultSsr = inner.router.options.defaultSsr ?? true;
|
|
467
|
-
if (route.options.ssr === void 0) {
|
|
468
|
-
existingMatch.ssr = parentOverride(defaultSsr);
|
|
469
|
-
return;
|
|
470
|
-
}
|
|
471
|
-
if (typeof route.options.ssr !== "function") {
|
|
472
|
-
existingMatch.ssr = parentOverride(route.options.ssr);
|
|
473
|
-
return;
|
|
474
|
-
}
|
|
475
|
-
const { search, params } = existingMatch;
|
|
476
|
-
const ssrFnContext = {
|
|
477
|
-
search: makeMaybe(search, existingMatch.searchError),
|
|
478
|
-
params: makeMaybe(params, existingMatch.paramsError),
|
|
479
|
-
location: inner.location,
|
|
480
|
-
matches: inner.matches.map((match) => ({
|
|
481
|
-
index: match.index,
|
|
482
|
-
pathname: match.pathname,
|
|
483
|
-
fullPath: match.fullPath,
|
|
484
|
-
staticData: match.staticData,
|
|
485
|
-
id: match.id,
|
|
486
|
-
routeId: match.routeId,
|
|
487
|
-
search: makeMaybe(match.search, match.searchError),
|
|
488
|
-
params: makeMaybe(match.params, match.paramsError),
|
|
489
|
-
ssr: match.ssr
|
|
490
|
-
}))
|
|
491
|
-
};
|
|
492
|
-
const tempSsr = route.options.ssr(ssrFnContext);
|
|
493
|
-
if (isPromise(tempSsr)) return tempSsr.then((ssr) => {
|
|
494
|
-
existingMatch.ssr = parentOverride(ssr ?? defaultSsr);
|
|
495
|
-
});
|
|
496
|
-
existingMatch.ssr = parentOverride(tempSsr ?? defaultSsr);
|
|
497
|
-
};
|
|
498
|
-
var setupPendingTimeout = (inner, matchId, route, match) => {
|
|
499
|
-
if (match._nonReactive.pendingTimeout !== void 0) return;
|
|
500
|
-
route.options.pendingMs ?? inner.router.options.defaultPendingMs;
|
|
501
|
-
if (!!(inner.onReady && false));
|
|
502
|
-
};
|
|
503
|
-
var preBeforeLoadSetup = (inner, matchId, route) => {
|
|
504
|
-
const existingMatch = inner.router.getMatch(matchId);
|
|
505
|
-
if (!existingMatch._nonReactive.beforeLoadPromise && !existingMatch._nonReactive.loaderPromise) return;
|
|
506
|
-
setupPendingTimeout(inner, matchId, route, existingMatch);
|
|
507
|
-
const then = () => {
|
|
508
|
-
const match = inner.router.getMatch(matchId);
|
|
509
|
-
if (match.preload && (match.status === "redirected" || match.status === "notFound")) handleRedirectAndNotFound(inner, match, match.error);
|
|
510
|
-
};
|
|
511
|
-
return existingMatch._nonReactive.beforeLoadPromise ? existingMatch._nonReactive.beforeLoadPromise.then(then) : then();
|
|
512
|
-
};
|
|
513
|
-
var executeBeforeLoad = (inner, matchId, index, route) => {
|
|
514
|
-
const match = inner.router.getMatch(matchId);
|
|
515
|
-
let prevLoadPromise = match._nonReactive.loadPromise;
|
|
516
|
-
match._nonReactive.loadPromise = createControlledPromise(() => {
|
|
517
|
-
prevLoadPromise?.resolve();
|
|
518
|
-
prevLoadPromise = void 0;
|
|
519
|
-
});
|
|
520
|
-
const { paramsError, searchError } = match;
|
|
521
|
-
if (paramsError) handleSerialError(inner, index, paramsError);
|
|
522
|
-
if (searchError) handleSerialError(inner, index, searchError);
|
|
523
|
-
setupPendingTimeout(inner, matchId, route, match);
|
|
524
|
-
const abortController = new AbortController();
|
|
525
|
-
let isPending = false;
|
|
526
|
-
const pending = () => {
|
|
527
|
-
if (isPending) return;
|
|
528
|
-
isPending = true;
|
|
529
|
-
inner.updateMatch(matchId, (prev) => ({
|
|
530
|
-
...prev,
|
|
531
|
-
isFetching: "beforeLoad",
|
|
532
|
-
fetchCount: prev.fetchCount + 1,
|
|
533
|
-
abortController
|
|
534
|
-
}));
|
|
535
|
-
};
|
|
536
|
-
const resolve = () => {
|
|
537
|
-
match._nonReactive.beforeLoadPromise?.resolve();
|
|
538
|
-
match._nonReactive.beforeLoadPromise = void 0;
|
|
539
|
-
inner.updateMatch(matchId, (prev) => ({
|
|
540
|
-
...prev,
|
|
541
|
-
isFetching: false
|
|
542
|
-
}));
|
|
543
|
-
};
|
|
544
|
-
if (!route.options.beforeLoad) {
|
|
545
|
-
inner.router.batch(() => {
|
|
546
|
-
pending();
|
|
547
|
-
resolve();
|
|
548
|
-
});
|
|
549
|
-
return;
|
|
550
|
-
}
|
|
551
|
-
match._nonReactive.beforeLoadPromise = createControlledPromise();
|
|
552
|
-
const context = {
|
|
553
|
-
...buildMatchContext(inner, index, false),
|
|
554
|
-
...match.__routeContext
|
|
555
|
-
};
|
|
556
|
-
const { search, params, cause } = match;
|
|
557
|
-
const preload = resolvePreload(inner, matchId);
|
|
558
|
-
const beforeLoadFnContext = {
|
|
559
|
-
search,
|
|
560
|
-
abortController,
|
|
561
|
-
params,
|
|
562
|
-
preload,
|
|
563
|
-
context,
|
|
564
|
-
location: inner.location,
|
|
565
|
-
navigate: (opts) => inner.router.navigate({
|
|
566
|
-
...opts,
|
|
567
|
-
_fromLocation: inner.location
|
|
568
|
-
}),
|
|
569
|
-
buildLocation: inner.router.buildLocation,
|
|
570
|
-
cause: preload ? "preload" : cause,
|
|
571
|
-
matches: inner.matches,
|
|
572
|
-
routeId: route.id,
|
|
573
|
-
...inner.router.options.additionalContext
|
|
574
|
-
};
|
|
575
|
-
const updateContext = (beforeLoadContext) => {
|
|
576
|
-
if (beforeLoadContext === void 0) {
|
|
577
|
-
inner.router.batch(() => {
|
|
578
|
-
pending();
|
|
579
|
-
resolve();
|
|
580
|
-
});
|
|
581
|
-
return;
|
|
582
|
-
}
|
|
583
|
-
if (isRedirect(beforeLoadContext) || isNotFound(beforeLoadContext)) {
|
|
584
|
-
pending();
|
|
585
|
-
handleSerialError(inner, index, beforeLoadContext);
|
|
586
|
-
}
|
|
587
|
-
inner.router.batch(() => {
|
|
588
|
-
pending();
|
|
589
|
-
inner.updateMatch(matchId, (prev) => ({
|
|
590
|
-
...prev,
|
|
591
|
-
__beforeLoadContext: beforeLoadContext
|
|
592
|
-
}));
|
|
593
|
-
resolve();
|
|
594
|
-
});
|
|
595
|
-
};
|
|
596
|
-
let beforeLoadContext;
|
|
597
|
-
try {
|
|
598
|
-
beforeLoadContext = route.options.beforeLoad(beforeLoadFnContext);
|
|
599
|
-
if (isPromise(beforeLoadContext)) {
|
|
600
|
-
pending();
|
|
601
|
-
return beforeLoadContext.catch((err) => {
|
|
602
|
-
handleSerialError(inner, index, err);
|
|
603
|
-
}).then(updateContext);
|
|
604
|
-
}
|
|
605
|
-
} catch (err) {
|
|
606
|
-
pending();
|
|
607
|
-
handleSerialError(inner, index, err);
|
|
608
|
-
}
|
|
609
|
-
updateContext(beforeLoadContext);
|
|
610
|
-
};
|
|
611
|
-
var handleBeforeLoad = (inner, index) => {
|
|
612
|
-
const { id: matchId, routeId } = inner.matches[index];
|
|
613
|
-
const route = inner.router.looseRoutesById[routeId];
|
|
614
|
-
const serverSsr = () => {
|
|
615
|
-
{
|
|
616
|
-
const maybePromise = isBeforeLoadSsr(inner, matchId, index, route);
|
|
617
|
-
if (isPromise(maybePromise)) return maybePromise.then(queueExecution);
|
|
618
|
-
}
|
|
619
|
-
return queueExecution();
|
|
620
|
-
};
|
|
621
|
-
const execute = () => executeBeforeLoad(inner, matchId, index, route);
|
|
622
|
-
const queueExecution = () => {
|
|
623
|
-
if (shouldSkipLoader(inner, matchId)) return;
|
|
624
|
-
const result = preBeforeLoadSetup(inner, matchId, route);
|
|
625
|
-
return isPromise(result) ? result.then(execute) : execute();
|
|
626
|
-
};
|
|
627
|
-
return serverSsr();
|
|
628
|
-
};
|
|
629
|
-
var executeHead = (inner, matchId, route) => {
|
|
630
|
-
const match = inner.router.getMatch(matchId);
|
|
631
|
-
if (!match) return;
|
|
632
|
-
if (!route.options.head && !route.options.scripts && !route.options.headers) return;
|
|
633
|
-
const assetContext = {
|
|
634
|
-
ssr: inner.router.options.ssr,
|
|
635
|
-
matches: inner.matches,
|
|
636
|
-
match,
|
|
637
|
-
params: match.params,
|
|
638
|
-
loaderData: match.loaderData
|
|
639
|
-
};
|
|
640
|
-
return Promise.all([
|
|
641
|
-
route.options.head?.(assetContext),
|
|
642
|
-
route.options.scripts?.(assetContext),
|
|
643
|
-
route.options.headers?.(assetContext)
|
|
644
|
-
]).then(([headFnContent, scripts, headers]) => {
|
|
645
|
-
return {
|
|
646
|
-
meta: headFnContent?.meta,
|
|
647
|
-
links: headFnContent?.links,
|
|
648
|
-
headScripts: headFnContent?.scripts,
|
|
649
|
-
headers,
|
|
650
|
-
scripts,
|
|
651
|
-
styles: headFnContent?.styles
|
|
652
|
-
};
|
|
653
|
-
});
|
|
654
|
-
};
|
|
655
|
-
var getLoaderContext = (inner, matchPromises, matchId, index, route) => {
|
|
656
|
-
const parentMatchPromise = matchPromises[index - 1];
|
|
657
|
-
const { params, loaderDeps, abortController, cause } = inner.router.getMatch(matchId);
|
|
658
|
-
const context = buildMatchContext(inner, index);
|
|
659
|
-
const preload = resolvePreload(inner, matchId);
|
|
660
|
-
return {
|
|
661
|
-
params,
|
|
662
|
-
deps: loaderDeps,
|
|
663
|
-
preload: !!preload,
|
|
664
|
-
parentMatchPromise,
|
|
665
|
-
abortController,
|
|
666
|
-
context,
|
|
667
|
-
location: inner.location,
|
|
668
|
-
navigate: (opts) => inner.router.navigate({
|
|
669
|
-
...opts,
|
|
670
|
-
_fromLocation: inner.location
|
|
671
|
-
}),
|
|
672
|
-
cause: preload ? "preload" : cause,
|
|
673
|
-
route,
|
|
674
|
-
...inner.router.options.additionalContext
|
|
675
|
-
};
|
|
676
|
-
};
|
|
677
|
-
var runLoader = async (inner, matchPromises, matchId, index, route) => {
|
|
678
|
-
try {
|
|
679
|
-
const match = inner.router.getMatch(matchId);
|
|
680
|
-
try {
|
|
681
|
-
if (match.ssr === true) loadRouteChunk(route);
|
|
682
|
-
const routeLoader = route.options.loader;
|
|
683
|
-
const loader = typeof routeLoader === "function" ? routeLoader : routeLoader?.handler;
|
|
684
|
-
const loaderResult = loader?.(getLoaderContext(inner, matchPromises, matchId, index, route));
|
|
685
|
-
const loaderResultIsPromise = !!loader && isPromise(loaderResult);
|
|
686
|
-
if (!!(loaderResultIsPromise || route._lazyPromise || route._componentsPromise || route.options.head || route.options.scripts || route.options.headers || match._nonReactive.minPendingPromise)) inner.updateMatch(matchId, (prev) => ({
|
|
687
|
-
...prev,
|
|
688
|
-
isFetching: "loader"
|
|
689
|
-
}));
|
|
690
|
-
if (loader) {
|
|
691
|
-
const loaderData = loaderResultIsPromise ? await loaderResult : loaderResult;
|
|
692
|
-
handleRedirectAndNotFound(inner, inner.router.getMatch(matchId), loaderData);
|
|
693
|
-
if (loaderData !== void 0) inner.updateMatch(matchId, (prev) => ({
|
|
694
|
-
...prev,
|
|
695
|
-
loaderData
|
|
696
|
-
}));
|
|
697
|
-
}
|
|
698
|
-
if (route._lazyPromise) await route._lazyPromise;
|
|
699
|
-
const pendingPromise = match._nonReactive.minPendingPromise;
|
|
700
|
-
if (pendingPromise) await pendingPromise;
|
|
701
|
-
if (route._componentsPromise) await route._componentsPromise;
|
|
702
|
-
inner.updateMatch(matchId, (prev) => ({
|
|
703
|
-
...prev,
|
|
704
|
-
error: void 0,
|
|
705
|
-
context: buildMatchContext(inner, index),
|
|
706
|
-
status: "success",
|
|
707
|
-
isFetching: false,
|
|
708
|
-
updatedAt: Date.now()
|
|
709
|
-
}));
|
|
710
|
-
} catch (e) {
|
|
711
|
-
let error = e;
|
|
712
|
-
if (error?.name === "AbortError") {
|
|
713
|
-
if (match.abortController.signal.aborted) {
|
|
714
|
-
match._nonReactive.loaderPromise?.resolve();
|
|
715
|
-
match._nonReactive.loaderPromise = void 0;
|
|
716
|
-
return;
|
|
717
|
-
}
|
|
718
|
-
inner.updateMatch(matchId, (prev) => ({
|
|
719
|
-
...prev,
|
|
720
|
-
status: prev.status === "pending" ? "success" : prev.status,
|
|
721
|
-
isFetching: false,
|
|
722
|
-
context: buildMatchContext(inner, index)
|
|
723
|
-
}));
|
|
724
|
-
return;
|
|
725
|
-
}
|
|
726
|
-
const pendingPromise = match._nonReactive.minPendingPromise;
|
|
727
|
-
if (pendingPromise) await pendingPromise;
|
|
728
|
-
if (isNotFound(e)) await route.options.notFoundComponent?.preload?.();
|
|
729
|
-
handleRedirectAndNotFound(inner, inner.router.getMatch(matchId), e);
|
|
730
|
-
try {
|
|
731
|
-
route.options.onError?.(e);
|
|
732
|
-
} catch (onErrorError) {
|
|
733
|
-
error = onErrorError;
|
|
734
|
-
handleRedirectAndNotFound(inner, inner.router.getMatch(matchId), onErrorError);
|
|
735
|
-
}
|
|
736
|
-
if (!isRedirect(error) && !isNotFound(error)) await loadRouteChunk(route, ["errorComponent"]);
|
|
737
|
-
inner.updateMatch(matchId, (prev) => ({
|
|
738
|
-
...prev,
|
|
739
|
-
error,
|
|
740
|
-
context: buildMatchContext(inner, index),
|
|
741
|
-
status: "error",
|
|
742
|
-
isFetching: false
|
|
743
|
-
}));
|
|
744
|
-
}
|
|
745
|
-
} catch (err) {
|
|
746
|
-
const match = inner.router.getMatch(matchId);
|
|
747
|
-
if (match) match._nonReactive.loaderPromise = void 0;
|
|
748
|
-
handleRedirectAndNotFound(inner, match, err);
|
|
749
|
-
}
|
|
750
|
-
};
|
|
751
|
-
var loadRouteMatch = async (inner, matchPromises, index) => {
|
|
752
|
-
async function handleLoader(preload, prevMatch, previousRouteMatchId, match, route) {
|
|
753
|
-
const age = Date.now() - prevMatch.updatedAt;
|
|
754
|
-
const staleAge = preload ? route.options.preloadStaleTime ?? inner.router.options.defaultPreloadStaleTime ?? 3e4 : route.options.staleTime ?? inner.router.options.defaultStaleTime ?? 0;
|
|
755
|
-
const shouldReloadOption = route.options.shouldReload;
|
|
756
|
-
const shouldReload = typeof shouldReloadOption === "function" ? shouldReloadOption(getLoaderContext(inner, matchPromises, matchId, index, route)) : shouldReloadOption;
|
|
757
|
-
const { status, invalid } = match;
|
|
758
|
-
const staleMatchShouldReload = age >= staleAge && (!!inner.forceStaleReload || match.cause === "enter" || previousRouteMatchId !== void 0 && previousRouteMatchId !== match.id);
|
|
759
|
-
loaderShouldRunAsync = status === "success" && (invalid || (shouldReload ?? staleMatchShouldReload));
|
|
760
|
-
if (preload && route.options.preload === false) {} else if (loaderShouldRunAsync && !inner.sync && shouldReloadInBackground) {
|
|
761
|
-
loaderIsRunningAsync = true;
|
|
762
|
-
(async () => {
|
|
763
|
-
try {
|
|
764
|
-
await runLoader(inner, matchPromises, matchId, index, route);
|
|
765
|
-
const match = inner.router.getMatch(matchId);
|
|
766
|
-
match._nonReactive.loaderPromise?.resolve();
|
|
767
|
-
match._nonReactive.loadPromise?.resolve();
|
|
768
|
-
match._nonReactive.loaderPromise = void 0;
|
|
769
|
-
match._nonReactive.loadPromise = void 0;
|
|
770
|
-
} catch (err) {
|
|
771
|
-
if (isRedirect(err)) await inner.router.navigate(err.options);
|
|
772
|
-
}
|
|
773
|
-
})();
|
|
774
|
-
} else if (status !== "success" || loaderShouldRunAsync) await runLoader(inner, matchPromises, matchId, index, route);
|
|
775
|
-
else syncMatchContext(inner, matchId, index);
|
|
776
|
-
}
|
|
777
|
-
const { id: matchId, routeId } = inner.matches[index];
|
|
778
|
-
let loaderShouldRunAsync = false;
|
|
779
|
-
let loaderIsRunningAsync = false;
|
|
780
|
-
const route = inner.router.looseRoutesById[routeId];
|
|
781
|
-
const routeLoader = route.options.loader;
|
|
782
|
-
const shouldReloadInBackground = ((typeof routeLoader === "function" ? void 0 : routeLoader?.staleReloadMode) ?? inner.router.options.defaultStaleReloadMode) !== "blocking";
|
|
783
|
-
if (shouldSkipLoader(inner, matchId)) {
|
|
784
|
-
if (!inner.router.getMatch(matchId)) return inner.matches[index];
|
|
785
|
-
syncMatchContext(inner, matchId, index);
|
|
786
|
-
return inner.router.getMatch(matchId);
|
|
787
|
-
} else {
|
|
788
|
-
const prevMatch = inner.router.getMatch(matchId);
|
|
789
|
-
const activeIdAtIndex = inner.router.stores.matchesId.get()[index];
|
|
790
|
-
const previousRouteMatchId = (activeIdAtIndex && inner.router.stores.matchStores.get(activeIdAtIndex) || null)?.routeId === routeId ? activeIdAtIndex : inner.router.stores.matches.get().find((d) => d.routeId === routeId)?.id;
|
|
791
|
-
const preload = resolvePreload(inner, matchId);
|
|
792
|
-
if (prevMatch._nonReactive.loaderPromise) {
|
|
793
|
-
if (prevMatch.status === "success" && !inner.sync && !prevMatch.preload && shouldReloadInBackground) return prevMatch;
|
|
794
|
-
await prevMatch._nonReactive.loaderPromise;
|
|
795
|
-
const match = inner.router.getMatch(matchId);
|
|
796
|
-
const error = match._nonReactive.error || match.error;
|
|
797
|
-
if (error) handleRedirectAndNotFound(inner, match, error);
|
|
798
|
-
if (match.status === "pending") await handleLoader(preload, prevMatch, previousRouteMatchId, match, route);
|
|
799
|
-
} else {
|
|
800
|
-
const nextPreload = preload && !inner.router.stores.matchStores.has(matchId);
|
|
801
|
-
const match = inner.router.getMatch(matchId);
|
|
802
|
-
match._nonReactive.loaderPromise = createControlledPromise();
|
|
803
|
-
if (nextPreload !== match.preload) inner.updateMatch(matchId, (prev) => ({
|
|
804
|
-
...prev,
|
|
805
|
-
preload: nextPreload
|
|
806
|
-
}));
|
|
807
|
-
await handleLoader(preload, prevMatch, previousRouteMatchId, match, route);
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
const match = inner.router.getMatch(matchId);
|
|
811
|
-
if (!loaderIsRunningAsync) {
|
|
812
|
-
match._nonReactive.loaderPromise?.resolve();
|
|
813
|
-
match._nonReactive.loadPromise?.resolve();
|
|
814
|
-
match._nonReactive.loadPromise = void 0;
|
|
815
|
-
}
|
|
816
|
-
clearTimeout(match._nonReactive.pendingTimeout);
|
|
817
|
-
match._nonReactive.pendingTimeout = void 0;
|
|
818
|
-
if (!loaderIsRunningAsync) match._nonReactive.loaderPromise = void 0;
|
|
819
|
-
match._nonReactive.dehydrated = void 0;
|
|
820
|
-
const nextIsFetching = loaderIsRunningAsync ? match.isFetching : false;
|
|
821
|
-
if (nextIsFetching !== match.isFetching || match.invalid !== false) {
|
|
822
|
-
inner.updateMatch(matchId, (prev) => ({
|
|
823
|
-
...prev,
|
|
824
|
-
isFetching: nextIsFetching,
|
|
825
|
-
invalid: false
|
|
826
|
-
}));
|
|
827
|
-
return inner.router.getMatch(matchId);
|
|
828
|
-
} else return match;
|
|
829
|
-
};
|
|
830
|
-
async function loadMatches(arg) {
|
|
831
|
-
const inner = arg;
|
|
832
|
-
const matchPromises = [];
|
|
833
|
-
let beforeLoadNotFound;
|
|
834
|
-
for (let i = 0; i < inner.matches.length; i++) {
|
|
835
|
-
try {
|
|
836
|
-
const beforeLoad = handleBeforeLoad(inner, i);
|
|
837
|
-
if (isPromise(beforeLoad)) await beforeLoad;
|
|
838
|
-
} catch (err) {
|
|
839
|
-
if (isRedirect(err)) throw err;
|
|
840
|
-
if (isNotFound(err)) beforeLoadNotFound = err;
|
|
841
|
-
else if (!inner.preload) throw err;
|
|
842
|
-
break;
|
|
843
|
-
}
|
|
844
|
-
if (inner.serialError || inner.firstBadMatchIndex != null) break;
|
|
845
|
-
}
|
|
846
|
-
const baseMaxIndexExclusive = inner.firstBadMatchIndex ?? inner.matches.length;
|
|
847
|
-
const boundaryIndex = beforeLoadNotFound && !inner.preload ? getNotFoundBoundaryIndex(inner, beforeLoadNotFound) : void 0;
|
|
848
|
-
const maxIndexExclusive = beforeLoadNotFound && inner.preload ? 0 : boundaryIndex !== void 0 ? Math.min(boundaryIndex + 1, baseMaxIndexExclusive) : baseMaxIndexExclusive;
|
|
849
|
-
let firstNotFound;
|
|
850
|
-
let firstUnhandledRejection;
|
|
851
|
-
for (let i = 0; i < maxIndexExclusive; i++) matchPromises.push(loadRouteMatch(inner, matchPromises, i));
|
|
852
|
-
try {
|
|
853
|
-
await Promise.all(matchPromises);
|
|
854
|
-
} catch {
|
|
855
|
-
const settled = await Promise.allSettled(matchPromises);
|
|
856
|
-
for (const result of settled) {
|
|
857
|
-
if (result.status !== "rejected") continue;
|
|
858
|
-
const reason = result.reason;
|
|
859
|
-
if (isRedirect(reason)) throw reason;
|
|
860
|
-
if (isNotFound(reason)) firstNotFound ??= reason;
|
|
861
|
-
else firstUnhandledRejection ??= reason;
|
|
862
|
-
}
|
|
863
|
-
if (firstUnhandledRejection !== void 0) throw firstUnhandledRejection;
|
|
864
|
-
}
|
|
865
|
-
const notFoundToThrow = firstNotFound ?? (beforeLoadNotFound && !inner.preload ? beforeLoadNotFound : void 0);
|
|
866
|
-
let headMaxIndex = inner.firstBadMatchIndex !== void 0 ? inner.firstBadMatchIndex : inner.matches.length - 1;
|
|
867
|
-
if (!notFoundToThrow && beforeLoadNotFound && inner.preload) return inner.matches;
|
|
868
|
-
if (notFoundToThrow) {
|
|
869
|
-
const renderedBoundaryIndex = getNotFoundBoundaryIndex(inner, notFoundToThrow);
|
|
870
|
-
if (renderedBoundaryIndex === void 0) invariant();
|
|
871
|
-
const boundaryMatch = inner.matches[renderedBoundaryIndex];
|
|
872
|
-
const boundaryRoute = inner.router.looseRoutesById[boundaryMatch.routeId];
|
|
873
|
-
const defaultNotFoundComponent = inner.router.options?.defaultNotFoundComponent;
|
|
874
|
-
if (!boundaryRoute.options.notFoundComponent && defaultNotFoundComponent) boundaryRoute.options.notFoundComponent = defaultNotFoundComponent;
|
|
875
|
-
notFoundToThrow.routeId = boundaryMatch.routeId;
|
|
876
|
-
const boundaryIsRoot = boundaryMatch.routeId === inner.router.routeTree.id;
|
|
877
|
-
inner.updateMatch(boundaryMatch.id, (prev) => ({
|
|
878
|
-
...prev,
|
|
879
|
-
...boundaryIsRoot ? {
|
|
880
|
-
status: "success",
|
|
881
|
-
globalNotFound: true,
|
|
882
|
-
error: void 0
|
|
883
|
-
} : {
|
|
884
|
-
status: "notFound",
|
|
885
|
-
error: notFoundToThrow
|
|
886
|
-
},
|
|
887
|
-
isFetching: false
|
|
888
|
-
}));
|
|
889
|
-
headMaxIndex = renderedBoundaryIndex;
|
|
890
|
-
await loadRouteChunk(boundaryRoute, ["notFoundComponent"]);
|
|
891
|
-
} else if (!inner.preload) {
|
|
892
|
-
const rootMatch = inner.matches[0];
|
|
893
|
-
if (!rootMatch.globalNotFound) {
|
|
894
|
-
if (inner.router.getMatch(rootMatch.id)?.globalNotFound) inner.updateMatch(rootMatch.id, (prev) => ({
|
|
895
|
-
...prev,
|
|
896
|
-
globalNotFound: false,
|
|
897
|
-
error: void 0
|
|
898
|
-
}));
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
if (inner.serialError && inner.firstBadMatchIndex !== void 0) {
|
|
902
|
-
const errorRoute = inner.router.looseRoutesById[inner.matches[inner.firstBadMatchIndex].routeId];
|
|
903
|
-
await loadRouteChunk(errorRoute, ["errorComponent"]);
|
|
904
|
-
}
|
|
905
|
-
for (let i = 0; i <= headMaxIndex; i++) {
|
|
906
|
-
const { id: matchId, routeId } = inner.matches[i];
|
|
907
|
-
const route = inner.router.looseRoutesById[routeId];
|
|
908
|
-
try {
|
|
909
|
-
const headResult = executeHead(inner, matchId, route);
|
|
910
|
-
if (headResult) {
|
|
911
|
-
const head = await headResult;
|
|
912
|
-
inner.updateMatch(matchId, (prev) => ({
|
|
913
|
-
...prev,
|
|
914
|
-
...head
|
|
915
|
-
}));
|
|
916
|
-
}
|
|
917
|
-
} catch (err) {
|
|
918
|
-
console.error(`Error executing head for route ${routeId}:`, err);
|
|
919
|
-
}
|
|
920
|
-
}
|
|
921
|
-
const readyPromise = triggerOnReady(inner);
|
|
922
|
-
if (isPromise(readyPromise)) await readyPromise;
|
|
923
|
-
if (notFoundToThrow) throw notFoundToThrow;
|
|
924
|
-
if (inner.serialError && !inner.preload && !inner.onReady) throw inner.serialError;
|
|
925
|
-
return inner.matches;
|
|
926
|
-
}
|
|
927
|
-
function preloadRouteComponents(route, componentTypesToLoad) {
|
|
928
|
-
const preloads = componentTypesToLoad.map((type) => route.options[type]?.preload?.()).filter(Boolean);
|
|
929
|
-
if (preloads.length === 0) return void 0;
|
|
930
|
-
return Promise.all(preloads);
|
|
931
|
-
}
|
|
932
|
-
function loadRouteChunk(route, componentTypesToLoad = componentTypes) {
|
|
933
|
-
if (!route._lazyLoaded && route._lazyPromise === void 0) if (route.lazyFn) route._lazyPromise = route.lazyFn().then((lazyRoute) => {
|
|
934
|
-
const { id: _id, ...options } = lazyRoute.options;
|
|
935
|
-
Object.assign(route.options, options);
|
|
936
|
-
route._lazyLoaded = true;
|
|
937
|
-
route._lazyPromise = void 0;
|
|
938
|
-
});
|
|
939
|
-
else route._lazyLoaded = true;
|
|
940
|
-
const runAfterLazy = () => route._componentsLoaded ? void 0 : componentTypesToLoad === componentTypes ? (() => {
|
|
941
|
-
if (route._componentsPromise === void 0) {
|
|
942
|
-
const componentsPromise = preloadRouteComponents(route, componentTypes);
|
|
943
|
-
if (componentsPromise) route._componentsPromise = componentsPromise.then(() => {
|
|
944
|
-
route._componentsLoaded = true;
|
|
945
|
-
route._componentsPromise = void 0;
|
|
946
|
-
});
|
|
947
|
-
else route._componentsLoaded = true;
|
|
948
|
-
}
|
|
949
|
-
return route._componentsPromise;
|
|
950
|
-
})() : preloadRouteComponents(route, componentTypesToLoad);
|
|
951
|
-
return route._lazyPromise ? route._lazyPromise.then(runAfterLazy) : runAfterLazy();
|
|
952
|
-
}
|
|
953
|
-
function makeMaybe(value, error) {
|
|
954
|
-
if (error) return {
|
|
955
|
-
status: "error",
|
|
956
|
-
error
|
|
957
|
-
};
|
|
958
|
-
return {
|
|
959
|
-
status: "success",
|
|
960
|
-
value
|
|
961
|
-
};
|
|
962
|
-
}
|
|
963
|
-
function routeNeedsPreload(route) {
|
|
964
|
-
for (const componentType of componentTypes) if (route.options[componentType]?.preload) return true;
|
|
965
|
-
return false;
|
|
966
|
-
}
|
|
967
|
-
var componentTypes = [
|
|
968
|
-
"component",
|
|
969
|
-
"errorComponent",
|
|
970
|
-
"pendingComponent",
|
|
971
|
-
"notFoundComponent"
|
|
972
|
-
];
|
|
973
|
-
//#endregion
|
|
974
|
-
//#region ../../node_modules/.pnpm/@tanstack+history@1.162.0/node_modules/@tanstack/history/dist/esm/index.js
|
|
975
|
-
var stateIndexKey = "__TSR_index";
|
|
976
|
-
function createHistory(opts) {
|
|
977
|
-
let location = opts.getLocation();
|
|
978
|
-
const subscribers = /* @__PURE__ */ new Set();
|
|
979
|
-
const notify = (action) => {
|
|
980
|
-
location = opts.getLocation();
|
|
981
|
-
subscribers.forEach((subscriber) => subscriber({
|
|
982
|
-
location,
|
|
983
|
-
action
|
|
984
|
-
}));
|
|
985
|
-
};
|
|
986
|
-
const handleIndexChange = (action) => {
|
|
987
|
-
if (opts.notifyOnIndexChange ?? true) notify(action);
|
|
988
|
-
else location = opts.getLocation();
|
|
989
|
-
};
|
|
990
|
-
const tryNavigation = async ({ task, navigateOpts, ...actionInfo }) => {
|
|
991
|
-
if (navigateOpts?.ignoreBlocker ?? false) {
|
|
992
|
-
task();
|
|
993
|
-
return;
|
|
994
|
-
}
|
|
995
|
-
const blockers = opts.getBlockers?.() ?? [];
|
|
996
|
-
const isPushOrReplace = actionInfo.type === "PUSH" || actionInfo.type === "REPLACE";
|
|
997
|
-
if (typeof document !== "undefined" && blockers.length && isPushOrReplace) for (const blocker of blockers) {
|
|
998
|
-
const nextLocation = parseHref(actionInfo.path, actionInfo.state);
|
|
999
|
-
if (await blocker.blockerFn({
|
|
1000
|
-
currentLocation: location,
|
|
1001
|
-
nextLocation,
|
|
1002
|
-
action: actionInfo.type
|
|
1003
|
-
})) {
|
|
1004
|
-
opts.onBlocked?.();
|
|
1005
|
-
return;
|
|
1006
|
-
}
|
|
1007
|
-
}
|
|
1008
|
-
task();
|
|
1009
|
-
};
|
|
1010
|
-
return {
|
|
1011
|
-
get location() {
|
|
1012
|
-
return location;
|
|
1013
|
-
},
|
|
1014
|
-
get length() {
|
|
1015
|
-
return opts.getLength();
|
|
1016
|
-
},
|
|
1017
|
-
subscribers,
|
|
1018
|
-
subscribe: (cb) => {
|
|
1019
|
-
subscribers.add(cb);
|
|
1020
|
-
return () => {
|
|
1021
|
-
subscribers.delete(cb);
|
|
1022
|
-
};
|
|
1023
|
-
},
|
|
1024
|
-
push: (path, state, navigateOpts) => {
|
|
1025
|
-
const currentIndex = location.state[stateIndexKey];
|
|
1026
|
-
state = assignKeyAndIndex(currentIndex + 1, state);
|
|
1027
|
-
tryNavigation({
|
|
1028
|
-
task: () => {
|
|
1029
|
-
opts.pushState(path, state);
|
|
1030
|
-
notify({ type: "PUSH" });
|
|
1031
|
-
},
|
|
1032
|
-
navigateOpts,
|
|
1033
|
-
type: "PUSH",
|
|
1034
|
-
path,
|
|
1035
|
-
state
|
|
1036
|
-
});
|
|
1037
|
-
},
|
|
1038
|
-
replace: (path, state, navigateOpts) => {
|
|
1039
|
-
const currentIndex = location.state[stateIndexKey];
|
|
1040
|
-
state = assignKeyAndIndex(currentIndex, state);
|
|
1041
|
-
tryNavigation({
|
|
1042
|
-
task: () => {
|
|
1043
|
-
opts.replaceState(path, state);
|
|
1044
|
-
notify({ type: "REPLACE" });
|
|
1045
|
-
},
|
|
1046
|
-
navigateOpts,
|
|
1047
|
-
type: "REPLACE",
|
|
1048
|
-
path,
|
|
1049
|
-
state
|
|
1050
|
-
});
|
|
1051
|
-
},
|
|
1052
|
-
go: (index, navigateOpts) => {
|
|
1053
|
-
tryNavigation({
|
|
1054
|
-
task: () => {
|
|
1055
|
-
opts.go(index);
|
|
1056
|
-
handleIndexChange({
|
|
1057
|
-
type: "GO",
|
|
1058
|
-
index
|
|
1059
|
-
});
|
|
1060
|
-
},
|
|
1061
|
-
navigateOpts,
|
|
1062
|
-
type: "GO"
|
|
1063
|
-
});
|
|
1064
|
-
},
|
|
1065
|
-
back: (navigateOpts) => {
|
|
1066
|
-
tryNavigation({
|
|
1067
|
-
task: () => {
|
|
1068
|
-
opts.back(navigateOpts?.ignoreBlocker ?? false);
|
|
1069
|
-
handleIndexChange({ type: "BACK" });
|
|
1070
|
-
},
|
|
1071
|
-
navigateOpts,
|
|
1072
|
-
type: "BACK"
|
|
1073
|
-
});
|
|
1074
|
-
},
|
|
1075
|
-
forward: (navigateOpts) => {
|
|
1076
|
-
tryNavigation({
|
|
1077
|
-
task: () => {
|
|
1078
|
-
opts.forward(navigateOpts?.ignoreBlocker ?? false);
|
|
1079
|
-
handleIndexChange({ type: "FORWARD" });
|
|
1080
|
-
},
|
|
1081
|
-
navigateOpts,
|
|
1082
|
-
type: "FORWARD"
|
|
1083
|
-
});
|
|
1084
|
-
},
|
|
1085
|
-
canGoBack: () => location.state[stateIndexKey] !== 0,
|
|
1086
|
-
createHref: (str) => opts.createHref(str),
|
|
1087
|
-
block: (blocker) => {
|
|
1088
|
-
if (!opts.setBlockers) return () => {};
|
|
1089
|
-
const blockers = opts.getBlockers?.() ?? [];
|
|
1090
|
-
opts.setBlockers([...blockers, blocker]);
|
|
1091
|
-
return () => {
|
|
1092
|
-
const blockers = opts.getBlockers?.() ?? [];
|
|
1093
|
-
opts.setBlockers?.(blockers.filter((b) => b !== blocker));
|
|
1094
|
-
};
|
|
1095
|
-
},
|
|
1096
|
-
flush: () => opts.flush?.(),
|
|
1097
|
-
destroy: () => opts.destroy?.(),
|
|
1098
|
-
notify
|
|
1099
|
-
};
|
|
1100
|
-
}
|
|
1101
|
-
function assignKeyAndIndex(index, state) {
|
|
1102
|
-
if (!state) state = {};
|
|
1103
|
-
const key = createRandomKey();
|
|
1104
|
-
return {
|
|
1105
|
-
...state,
|
|
1106
|
-
key,
|
|
1107
|
-
__TSR_key: key,
|
|
1108
|
-
[stateIndexKey]: index
|
|
1109
|
-
};
|
|
1110
|
-
}
|
|
1111
|
-
/**
|
|
1112
|
-
* Create an in-memory history implementation.
|
|
1113
|
-
* Ideal for server rendering, tests, and non-DOM environments.
|
|
1114
|
-
* @link https://tanstack.com/router/latest/docs/framework/react/guide/history-types
|
|
1115
|
-
*/
|
|
1116
|
-
function createMemoryHistory(opts = { initialEntries: ["/"] }) {
|
|
1117
|
-
const entries = opts.initialEntries;
|
|
1118
|
-
let index = opts.initialIndex ? Math.min(Math.max(opts.initialIndex, 0), entries.length - 1) : entries.length - 1;
|
|
1119
|
-
const states = entries.map((_entry, index) => assignKeyAndIndex(index, void 0));
|
|
1120
|
-
const getLocation = () => parseHref(entries[index], states[index]);
|
|
1121
|
-
let blockers = [];
|
|
1122
|
-
const _getBlockers = () => blockers;
|
|
1123
|
-
const _setBlockers = (newBlockers) => blockers = newBlockers;
|
|
1124
|
-
return createHistory({
|
|
1125
|
-
getLocation,
|
|
1126
|
-
getLength: () => entries.length,
|
|
1127
|
-
pushState: (path, state) => {
|
|
1128
|
-
if (index < entries.length - 1) {
|
|
1129
|
-
entries.splice(index + 1);
|
|
1130
|
-
states.splice(index + 1);
|
|
1131
|
-
}
|
|
1132
|
-
states.push(state);
|
|
1133
|
-
entries.push(path);
|
|
1134
|
-
index = Math.max(entries.length - 1, 0);
|
|
1135
|
-
},
|
|
1136
|
-
replaceState: (path, state) => {
|
|
1137
|
-
states[index] = state;
|
|
1138
|
-
entries[index] = path;
|
|
1139
|
-
},
|
|
1140
|
-
back: () => {
|
|
1141
|
-
index = Math.max(index - 1, 0);
|
|
1142
|
-
},
|
|
1143
|
-
forward: () => {
|
|
1144
|
-
index = Math.min(index + 1, entries.length - 1);
|
|
1145
|
-
},
|
|
1146
|
-
go: (n) => {
|
|
1147
|
-
index = Math.min(Math.max(index + n, 0), entries.length - 1);
|
|
1148
|
-
},
|
|
1149
|
-
createHref: (path) => path,
|
|
1150
|
-
getBlockers: _getBlockers,
|
|
1151
|
-
setBlockers: _setBlockers
|
|
1152
|
-
});
|
|
1153
|
-
}
|
|
1154
|
-
/**
|
|
1155
|
-
* Sanitize a path to prevent open redirect vulnerabilities.
|
|
1156
|
-
* Removes control characters and collapses leading double slashes.
|
|
1157
|
-
*/
|
|
1158
|
-
function sanitizePath(path) {
|
|
1159
|
-
let sanitized = path.replace(/[\x00-\x1f\x7f]/g, "");
|
|
1160
|
-
if (sanitized.startsWith("//")) sanitized = "/" + sanitized.replace(/^\/+/, "");
|
|
1161
|
-
return sanitized;
|
|
1162
|
-
}
|
|
1163
|
-
function parseHref(href, state) {
|
|
1164
|
-
const sanitizedHref = sanitizePath(href);
|
|
1165
|
-
const hashIndex = sanitizedHref.indexOf("#");
|
|
1166
|
-
const searchIndex = sanitizedHref.indexOf("?");
|
|
1167
|
-
const addedKey = createRandomKey();
|
|
1168
|
-
return {
|
|
1169
|
-
href: sanitizedHref,
|
|
1170
|
-
pathname: sanitizedHref.substring(0, hashIndex > 0 ? searchIndex > 0 ? Math.min(hashIndex, searchIndex) : hashIndex : searchIndex > 0 ? searchIndex : sanitizedHref.length),
|
|
1171
|
-
hash: hashIndex > -1 ? sanitizedHref.substring(hashIndex) : "",
|
|
1172
|
-
search: searchIndex > -1 ? sanitizedHref.slice(searchIndex, hashIndex === -1 ? void 0 : hashIndex) : "",
|
|
1173
|
-
state: state || {
|
|
1174
|
-
[stateIndexKey]: 0,
|
|
1175
|
-
key: addedKey,
|
|
1176
|
-
__TSR_key: addedKey
|
|
1177
|
-
}
|
|
1178
|
-
};
|
|
1179
|
-
}
|
|
1180
|
-
function createRandomKey() {
|
|
1181
|
-
return (Math.random() + 1).toString(36).substring(7);
|
|
1182
|
-
}
|
|
1183
|
-
//#endregion
|
|
1184
|
-
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.15/node_modules/@tanstack/router-core/dist/esm/router.js
|
|
1185
|
-
/**
|
|
1186
|
-
* Compute whether path, href or hash changed between previous and current
|
|
1187
|
-
* resolved locations.
|
|
1188
|
-
*/
|
|
1189
|
-
function getLocationChangeInfo(location, resolvedLocation) {
|
|
1190
|
-
const fromLocation = resolvedLocation;
|
|
1191
|
-
const toLocation = location;
|
|
1192
|
-
return {
|
|
1193
|
-
fromLocation,
|
|
1194
|
-
toLocation,
|
|
1195
|
-
pathChanged: fromLocation?.pathname !== toLocation.pathname,
|
|
1196
|
-
hrefChanged: fromLocation?.href !== toLocation.href,
|
|
1197
|
-
hashChanged: fromLocation?.hash !== toLocation.hash
|
|
1198
|
-
};
|
|
1199
|
-
}
|
|
1200
|
-
/**
|
|
1201
|
-
* Core, framework-agnostic router engine that powers TanStack Router.
|
|
1202
|
-
*
|
|
1203
|
-
* Provides navigation, matching, loading, preloading, caching and event APIs
|
|
1204
|
-
* used by framework adapters (React/Solid). Prefer framework helpers like
|
|
1205
|
-
* `createRouter` in app code.
|
|
1206
|
-
*
|
|
1207
|
-
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/RouterType
|
|
1208
|
-
*/
|
|
1209
|
-
var RouterCore = class {
|
|
1210
|
-
/**
|
|
1211
|
-
* @deprecated Use the `createRouter` function instead
|
|
1212
|
-
*/
|
|
1213
|
-
constructor(options, getStoreConfig) {
|
|
1214
|
-
this.tempLocationKey = `${Math.round(Math.random() * 1e7)}`;
|
|
1215
|
-
this._scroll = { next: true };
|
|
1216
|
-
this.shouldViewTransition = void 0;
|
|
1217
|
-
this.isViewTransitionTypesSupported = void 0;
|
|
1218
|
-
this.subscribers = /* @__PURE__ */ new Set();
|
|
1219
|
-
this.routeBranchCache = /* @__PURE__ */ new WeakMap();
|
|
1220
|
-
this.lightweightCache = /* @__PURE__ */ new WeakMap();
|
|
1221
|
-
this.startTransition = (fn) => fn();
|
|
1222
|
-
this.update = (newOptions) => {
|
|
1223
|
-
const prevOptions = this.options;
|
|
1224
|
-
const prevBasepath = this.basepath ?? prevOptions?.basepath ?? "/";
|
|
1225
|
-
const basepathWasUnset = this.basepath === void 0;
|
|
1226
|
-
const prevRewriteOption = prevOptions?.rewrite;
|
|
1227
|
-
this.options = {
|
|
1228
|
-
...prevOptions,
|
|
1229
|
-
...newOptions
|
|
1230
|
-
};
|
|
1231
|
-
this.isServer = this.options.isServer ?? typeof document === "undefined";
|
|
1232
|
-
this.protocolAllowlist = new Set(this.options.protocolAllowlist);
|
|
1233
|
-
if (this.options.pathParamsAllowedCharacters) this.pathParamsDecoder = compileDecodeCharMap(this.options.pathParamsAllowedCharacters);
|
|
1234
|
-
if (!this.history || this.options.history && this.options.history !== this.history) if (!this.options.history) {} else this.history = this.options.history;
|
|
1235
|
-
this.origin = this.options.origin;
|
|
1236
|
-
if (!this.origin) this.origin = "http://localhost";
|
|
1237
|
-
if (this.history) this.updateLatestLocation();
|
|
1238
|
-
if (this.options.routeTree !== this.routeTree) {
|
|
1239
|
-
this.routeTree = this.options.routeTree;
|
|
1240
|
-
let processRouteTreeResult;
|
|
1241
|
-
if (globalThis.__TSR_CACHE__ && globalThis.__TSR_CACHE__.routeTree === this.routeTree) {
|
|
1242
|
-
const cached = globalThis.__TSR_CACHE__;
|
|
1243
|
-
this.resolvePathCache = cached.resolvePathCache;
|
|
1244
|
-
processRouteTreeResult = cached.processRouteTreeResult;
|
|
1245
|
-
} else {
|
|
1246
|
-
this.resolvePathCache = createLRUCache(1e3);
|
|
1247
|
-
processRouteTreeResult = this.buildRouteTree();
|
|
1248
|
-
if (globalThis.__TSR_CACHE__ === void 0) globalThis.__TSR_CACHE__ = {
|
|
1249
|
-
routeTree: this.routeTree,
|
|
1250
|
-
processRouteTreeResult,
|
|
1251
|
-
resolvePathCache: this.resolvePathCache
|
|
1252
|
-
};
|
|
1253
|
-
}
|
|
1254
|
-
this.setRoutes(processRouteTreeResult);
|
|
1255
|
-
}
|
|
1256
|
-
if (!this.stores && this.latestLocation) {
|
|
1257
|
-
const config = this.getStoreConfig(this);
|
|
1258
|
-
this.batch = config.batch;
|
|
1259
|
-
this.stores = createRouterStores(getInitialRouterState(this.latestLocation), config);
|
|
1260
|
-
}
|
|
1261
|
-
let needsLocationUpdate = false;
|
|
1262
|
-
const nextBasepath = this.options.basepath ?? "/";
|
|
1263
|
-
const nextRewriteOption = this.options.rewrite;
|
|
1264
|
-
if (basepathWasUnset || prevBasepath !== nextBasepath || prevRewriteOption !== nextRewriteOption) {
|
|
1265
|
-
this.basepath = nextBasepath;
|
|
1266
|
-
const rewrites = [];
|
|
1267
|
-
const trimmed = trimPath(nextBasepath);
|
|
1268
|
-
if (trimmed && trimmed !== "/") rewrites.push(rewriteBasepath({ basepath: nextBasepath }));
|
|
1269
|
-
if (nextRewriteOption) rewrites.push(nextRewriteOption);
|
|
1270
|
-
this.rewrite = rewrites.length === 0 ? void 0 : rewrites.length === 1 ? rewrites[0] : composeRewrites(rewrites);
|
|
1271
|
-
if (this.history) this.updateLatestLocation();
|
|
1272
|
-
needsLocationUpdate = true;
|
|
1273
|
-
}
|
|
1274
|
-
if (needsLocationUpdate && this.stores) this.stores.location.set(this.latestLocation);
|
|
1275
|
-
if (typeof window !== "undefined" && "CSS" in window && typeof window.CSS?.supports === "function") this.isViewTransitionTypesSupported = window.CSS.supports("selector(:active-view-transition-type(a))");
|
|
1276
|
-
};
|
|
1277
|
-
this.updateLatestLocation = () => {
|
|
1278
|
-
this.latestLocation = this.parseLocation(this.history.location, this.latestLocation);
|
|
1279
|
-
};
|
|
1280
|
-
this.buildRouteTree = () => {
|
|
1281
|
-
const result = processRouteTree(this.routeTree, this.options.caseSensitive, (route, i) => {
|
|
1282
|
-
route.init({ originalIndex: i });
|
|
1283
|
-
});
|
|
1284
|
-
if (this.options.routeMasks) processRouteMasks(this.options.routeMasks, result.processedTree);
|
|
1285
|
-
return result;
|
|
1286
|
-
};
|
|
1287
|
-
this.subscribe = (eventType, fn) => {
|
|
1288
|
-
const listener = {
|
|
1289
|
-
eventType,
|
|
1290
|
-
fn
|
|
1291
|
-
};
|
|
1292
|
-
this.subscribers.add(listener);
|
|
1293
|
-
return () => {
|
|
1294
|
-
this.subscribers.delete(listener);
|
|
1295
|
-
};
|
|
1296
|
-
};
|
|
1297
|
-
this.emit = (routerEvent) => {
|
|
1298
|
-
this.subscribers.forEach((listener) => {
|
|
1299
|
-
if (listener.eventType === routerEvent.type) listener.fn(routerEvent);
|
|
1300
|
-
});
|
|
1301
|
-
};
|
|
1302
|
-
this.parseLocation = (locationToParse, previousLocation) => {
|
|
1303
|
-
const parse = ({ pathname, search, hash, href, state }) => {
|
|
1304
|
-
if (!this.rewrite && !/[ \x00-\x1f\x7f\u0080-\uffff]/.test(pathname)) {
|
|
1305
|
-
const parsedSearch = this.options.parseSearch(search);
|
|
1306
|
-
const searchStr = this.options.stringifySearch(parsedSearch);
|
|
1307
|
-
return {
|
|
1308
|
-
href: pathname + searchStr + hash,
|
|
1309
|
-
publicHref: pathname + searchStr + hash,
|
|
1310
|
-
pathname: decodePath(pathname).path,
|
|
1311
|
-
external: false,
|
|
1312
|
-
searchStr,
|
|
1313
|
-
search: nullReplaceEqualDeep(previousLocation?.search, parsedSearch),
|
|
1314
|
-
hash: decodePath(hash.slice(1)).path,
|
|
1315
|
-
state: replaceEqualDeep(previousLocation?.state, state)
|
|
1316
|
-
};
|
|
1317
|
-
}
|
|
1318
|
-
const fullUrl = new URL(href, this.origin);
|
|
1319
|
-
const url = executeRewriteInput(this.rewrite, fullUrl);
|
|
1320
|
-
const parsedSearch = this.options.parseSearch(url.search);
|
|
1321
|
-
const searchStr = this.options.stringifySearch(parsedSearch);
|
|
1322
|
-
url.search = searchStr;
|
|
1323
|
-
return {
|
|
1324
|
-
href: url.href.replace(url.origin, ""),
|
|
1325
|
-
publicHref: href,
|
|
1326
|
-
pathname: decodePath(url.pathname).path,
|
|
1327
|
-
external: !!this.rewrite && url.origin !== this.origin,
|
|
1328
|
-
searchStr,
|
|
1329
|
-
search: nullReplaceEqualDeep(previousLocation?.search, parsedSearch),
|
|
1330
|
-
hash: decodePath(url.hash.slice(1)).path,
|
|
1331
|
-
state: replaceEqualDeep(previousLocation?.state, state)
|
|
1332
|
-
};
|
|
1333
|
-
};
|
|
1334
|
-
const location = parse(locationToParse);
|
|
1335
|
-
const { __tempLocation, __tempKey } = location.state;
|
|
1336
|
-
if (__tempLocation && (!__tempKey || __tempKey === this.tempLocationKey)) {
|
|
1337
|
-
const parsedTempLocation = parse(__tempLocation);
|
|
1338
|
-
parsedTempLocation.state.key = location.state.key;
|
|
1339
|
-
parsedTempLocation.state.__TSR_key = location.state.__TSR_key;
|
|
1340
|
-
delete parsedTempLocation.state.__tempLocation;
|
|
1341
|
-
return {
|
|
1342
|
-
...parsedTempLocation,
|
|
1343
|
-
maskedLocation: location
|
|
1344
|
-
};
|
|
1345
|
-
}
|
|
1346
|
-
return location;
|
|
1347
|
-
};
|
|
1348
|
-
this.resolvePathWithBase = (from, path) => {
|
|
1349
|
-
return resolvePath({
|
|
1350
|
-
base: from,
|
|
1351
|
-
to: path.includes("//") ? cleanPath(path) : path,
|
|
1352
|
-
trailingSlash: this.options.trailingSlash,
|
|
1353
|
-
cache: this.resolvePathCache
|
|
1354
|
-
});
|
|
1355
|
-
};
|
|
1356
|
-
this.matchRoutes = (pathnameOrNext, locationSearchOrOpts, opts) => {
|
|
1357
|
-
if (typeof pathnameOrNext === "string") return this.matchRoutesInternal({
|
|
1358
|
-
pathname: pathnameOrNext,
|
|
1359
|
-
search: locationSearchOrOpts
|
|
1360
|
-
}, opts);
|
|
1361
|
-
return this.matchRoutesInternal(pathnameOrNext, locationSearchOrOpts);
|
|
1362
|
-
};
|
|
1363
|
-
this.getMatchedRoutes = (pathname) => {
|
|
1364
|
-
return getMatchedRoutes({
|
|
1365
|
-
pathname,
|
|
1366
|
-
routesById: this.routesById,
|
|
1367
|
-
processedTree: this.processedTree
|
|
1368
|
-
});
|
|
1369
|
-
};
|
|
1370
|
-
this.cancelMatch = (id) => {
|
|
1371
|
-
const match = this.getMatch(id);
|
|
1372
|
-
if (!match) return;
|
|
1373
|
-
match.abortController.abort();
|
|
1374
|
-
clearTimeout(match._nonReactive.pendingTimeout);
|
|
1375
|
-
match._nonReactive.pendingTimeout = void 0;
|
|
1376
|
-
};
|
|
1377
|
-
this.cancelMatches = () => {
|
|
1378
|
-
this.stores.pendingIds.get().forEach((matchId) => {
|
|
1379
|
-
this.cancelMatch(matchId);
|
|
1380
|
-
});
|
|
1381
|
-
this.stores.matchesId.get().forEach((matchId) => {
|
|
1382
|
-
if (this.stores.pendingMatchStores.has(matchId)) return;
|
|
1383
|
-
const match = this.stores.matchStores.get(matchId)?.get();
|
|
1384
|
-
if (!match) return;
|
|
1385
|
-
if (match.status === "pending" || match.isFetching === "loader") this.cancelMatch(matchId);
|
|
1386
|
-
});
|
|
1387
|
-
};
|
|
1388
|
-
this.buildLocation = (opts) => {
|
|
1389
|
-
const build = (dest = {}) => {
|
|
1390
|
-
const currentLocation = dest._fromLocation || this.pendingBuiltLocation || this.latestLocation;
|
|
1391
|
-
const lightweightResult = this.matchRoutesLightweight(currentLocation);
|
|
1392
|
-
if (dest.from && false);
|
|
1393
|
-
const defaultedFromPath = dest.unsafeRelative === "path" ? currentLocation.pathname : dest.from ?? lightweightResult.fullPath;
|
|
1394
|
-
const destTo = dest.to ? `${dest.to}` : void 0;
|
|
1395
|
-
const fromSearch = lightweightResult.search;
|
|
1396
|
-
const fromParams = Object.assign(Object.create(null), lightweightResult.params);
|
|
1397
|
-
const sourcePath = destTo?.charCodeAt(0) === 47 ? "/" : this.resolvePathWithBase(defaultedFromPath, ".");
|
|
1398
|
-
const nextTo = destTo ? this.resolvePathWithBase(sourcePath, destTo) : sourcePath;
|
|
1399
|
-
const nextParams = dest.params === false || dest.params === null ? Object.create(null) : (dest.params ?? true) === true ? fromParams : Object.assign(fromParams, functionalUpdate(dest.params, fromParams));
|
|
1400
|
-
const destRoute = this.routesByPath[trimPathRight(nextTo)];
|
|
1401
|
-
let destRoutes;
|
|
1402
|
-
if (destRoute) destRoutes = this.getRouteBranch(destRoute);
|
|
1403
|
-
else if (nextTo.includes("$")) destRoutes = [];
|
|
1404
|
-
else {
|
|
1405
|
-
const destMatchResult = this.getMatchedRoutes(nextTo);
|
|
1406
|
-
destRoutes = destMatchResult.matchedRoutes;
|
|
1407
|
-
if (this.options.notFoundRoute && (!destMatchResult.foundRoute || destMatchResult.foundRoute.path !== "/" && destMatchResult.routeParams["**"])) destRoutes = [...destRoutes, this.options.notFoundRoute];
|
|
1408
|
-
}
|
|
1409
|
-
if (destRoutes.length && hasKeys(nextParams)) for (const route of destRoutes) {
|
|
1410
|
-
const fn = route.options.params?.stringify ?? route.options.stringifyParams;
|
|
1411
|
-
if (fn) try {
|
|
1412
|
-
Object.assign(nextParams, fn(nextParams));
|
|
1413
|
-
} catch {}
|
|
1414
|
-
}
|
|
1415
|
-
const nextPathname = opts.leaveParams ? nextTo : decodePath(interpolatePath({
|
|
1416
|
-
path: nextTo,
|
|
1417
|
-
params: nextParams,
|
|
1418
|
-
decoder: this.pathParamsDecoder,
|
|
1419
|
-
server: this.isServer
|
|
1420
|
-
}).interpolatedPath).path;
|
|
1421
|
-
let nextSearch = fromSearch;
|
|
1422
|
-
if (opts._includeValidateSearch && this.options.search?.strict) {
|
|
1423
|
-
const validatedSearch = {};
|
|
1424
|
-
destRoutes.forEach((route) => {
|
|
1425
|
-
if (route.options.validateSearch) try {
|
|
1426
|
-
Object.assign(validatedSearch, validateSearch(route.options.validateSearch, {
|
|
1427
|
-
...validatedSearch,
|
|
1428
|
-
...nextSearch
|
|
1429
|
-
}));
|
|
1430
|
-
} catch {}
|
|
1431
|
-
});
|
|
1432
|
-
nextSearch = validatedSearch;
|
|
1433
|
-
}
|
|
1434
|
-
nextSearch = applySearchMiddleware({
|
|
1435
|
-
search: nextSearch,
|
|
1436
|
-
dest,
|
|
1437
|
-
destRoutes,
|
|
1438
|
-
_includeValidateSearch: opts._includeValidateSearch
|
|
1439
|
-
});
|
|
1440
|
-
nextSearch = nullReplaceEqualDeep(fromSearch, nextSearch);
|
|
1441
|
-
const searchStr = this.options.stringifySearch(nextSearch);
|
|
1442
|
-
const hash = dest.hash === true ? currentLocation.hash : dest.hash ? functionalUpdate(dest.hash, currentLocation.hash) : void 0;
|
|
1443
|
-
const hashStr = hash ? `#${hash}` : "";
|
|
1444
|
-
let nextState = dest.state === true ? currentLocation.state : dest.state ? functionalUpdate(dest.state, currentLocation.state) : {};
|
|
1445
|
-
nextState = replaceEqualDeep(currentLocation.state, nextState);
|
|
1446
|
-
const fullPath = `${nextPathname}${searchStr}${hashStr}`;
|
|
1447
|
-
let href;
|
|
1448
|
-
let publicHref;
|
|
1449
|
-
let external = false;
|
|
1450
|
-
if (this.rewrite) {
|
|
1451
|
-
const url = new URL(fullPath, this.origin);
|
|
1452
|
-
const rewrittenUrl = executeRewriteOutput(this.rewrite, url);
|
|
1453
|
-
href = url.href.replace(url.origin, "");
|
|
1454
|
-
if (rewrittenUrl.origin !== this.origin) {
|
|
1455
|
-
publicHref = rewrittenUrl.href;
|
|
1456
|
-
external = true;
|
|
1457
|
-
} else publicHref = rewrittenUrl.pathname + rewrittenUrl.search + rewrittenUrl.hash;
|
|
1458
|
-
} else {
|
|
1459
|
-
href = encodePathLikeUrl(fullPath);
|
|
1460
|
-
publicHref = href;
|
|
1461
|
-
}
|
|
1462
|
-
return {
|
|
1463
|
-
publicHref,
|
|
1464
|
-
href,
|
|
1465
|
-
pathname: nextPathname,
|
|
1466
|
-
search: nextSearch,
|
|
1467
|
-
searchStr,
|
|
1468
|
-
state: nextState,
|
|
1469
|
-
hash: hash ?? "",
|
|
1470
|
-
external,
|
|
1471
|
-
unmaskOnReload: dest.unmaskOnReload
|
|
1472
|
-
};
|
|
1473
|
-
};
|
|
1474
|
-
const buildWithMatches = (dest = {}, maskedDest) => {
|
|
1475
|
-
const next = build(dest);
|
|
1476
|
-
let maskedNext = maskedDest ? build(maskedDest) : void 0;
|
|
1477
|
-
if (!maskedNext) {
|
|
1478
|
-
const params = Object.create(null);
|
|
1479
|
-
if (this.options.routeMasks) {
|
|
1480
|
-
const match = findFlatMatch(next.pathname, this.processedTree);
|
|
1481
|
-
if (match) {
|
|
1482
|
-
Object.assign(params, match.rawParams);
|
|
1483
|
-
const { from: _from, params: maskParams, ...maskProps } = match.route;
|
|
1484
|
-
const nextParams = maskParams === false || maskParams === null ? Object.create(null) : (maskParams ?? true) === true ? params : Object.assign(params, functionalUpdate(maskParams, params));
|
|
1485
|
-
maskedDest = {
|
|
1486
|
-
from: opts.from,
|
|
1487
|
-
...maskProps,
|
|
1488
|
-
params: nextParams
|
|
1489
|
-
};
|
|
1490
|
-
maskedNext = build(maskedDest);
|
|
1491
|
-
}
|
|
1492
|
-
}
|
|
1493
|
-
}
|
|
1494
|
-
if (maskedNext) next.maskedLocation = maskedNext;
|
|
1495
|
-
return next;
|
|
1496
|
-
};
|
|
1497
|
-
if (opts.mask) return buildWithMatches(opts, {
|
|
1498
|
-
from: opts.from,
|
|
1499
|
-
...opts.mask
|
|
1500
|
-
});
|
|
1501
|
-
return buildWithMatches(opts);
|
|
1502
|
-
};
|
|
1503
|
-
this.commitLocation = async ({ viewTransition, ignoreBlocker, ...next }) => {
|
|
1504
|
-
let historyAction;
|
|
1505
|
-
const isSameState = () => {
|
|
1506
|
-
const ignoredProps = [
|
|
1507
|
-
"key",
|
|
1508
|
-
"__TSR_key",
|
|
1509
|
-
"__TSR_index",
|
|
1510
|
-
"__hashScrollIntoViewOptions"
|
|
1511
|
-
];
|
|
1512
|
-
ignoredProps.forEach((prop) => {
|
|
1513
|
-
next.state[prop] = this.latestLocation.state[prop];
|
|
1514
|
-
});
|
|
1515
|
-
const isEqual = deepEqual(next.state, this.latestLocation.state);
|
|
1516
|
-
ignoredProps.forEach((prop) => {
|
|
1517
|
-
delete next.state[prop];
|
|
1518
|
-
});
|
|
1519
|
-
return isEqual;
|
|
1520
|
-
};
|
|
1521
|
-
const isSameUrl = trimPathRight(this.latestLocation.href) === trimPathRight(next.href);
|
|
1522
|
-
let previousCommitPromise = this.commitLocationPromise;
|
|
1523
|
-
this.commitLocationPromise = createControlledPromise(() => {
|
|
1524
|
-
previousCommitPromise?.resolve();
|
|
1525
|
-
previousCommitPromise = void 0;
|
|
1526
|
-
});
|
|
1527
|
-
if (isSameUrl && isSameState()) this.load();
|
|
1528
|
-
else {
|
|
1529
|
-
let { maskedLocation, hashScrollIntoView, ...nextHistory } = next;
|
|
1530
|
-
if (maskedLocation) {
|
|
1531
|
-
nextHistory = {
|
|
1532
|
-
...maskedLocation,
|
|
1533
|
-
state: {
|
|
1534
|
-
...maskedLocation.state,
|
|
1535
|
-
__tempKey: void 0,
|
|
1536
|
-
__tempLocation: {
|
|
1537
|
-
...nextHistory,
|
|
1538
|
-
search: nextHistory.searchStr,
|
|
1539
|
-
state: {
|
|
1540
|
-
...nextHistory.state,
|
|
1541
|
-
__tempKey: void 0,
|
|
1542
|
-
__tempLocation: void 0,
|
|
1543
|
-
__TSR_key: void 0,
|
|
1544
|
-
key: void 0
|
|
1545
|
-
}
|
|
1546
|
-
}
|
|
1547
|
-
}
|
|
1548
|
-
};
|
|
1549
|
-
if (nextHistory.unmaskOnReload ?? this.options.unmaskOnReload ?? false) nextHistory.state.__tempKey = this.tempLocationKey;
|
|
1550
|
-
}
|
|
1551
|
-
nextHistory.state.__hashScrollIntoViewOptions = hashScrollIntoView ?? this.options.defaultHashScrollIntoView ?? true;
|
|
1552
|
-
this.shouldViewTransition = viewTransition;
|
|
1553
|
-
historyAction = next.replace ? "REPLACE" : "PUSH";
|
|
1554
|
-
this.history[historyAction === "REPLACE" ? "replace" : "push"](nextHistory.publicHref, nextHistory.state, { ignoreBlocker });
|
|
1555
|
-
}
|
|
1556
|
-
this._scroll.next = next.resetScroll ?? true;
|
|
1557
|
-
if (!this.history.subscribers.size) this.load(historyAction ? { action: { type: historyAction } } : void 0);
|
|
1558
|
-
return this.commitLocationPromise;
|
|
1559
|
-
};
|
|
1560
|
-
this.buildAndCommitLocation = ({ replace, resetScroll, hashScrollIntoView, viewTransition, ignoreBlocker, href, ...rest } = {}) => {
|
|
1561
|
-
if (href) {
|
|
1562
|
-
const currentIndex = this.history.location.state.__TSR_index;
|
|
1563
|
-
const parsed = parseHref(href, { __TSR_index: replace ? currentIndex : currentIndex + 1 });
|
|
1564
|
-
const hrefUrl = new URL(parsed.pathname, this.origin);
|
|
1565
|
-
rest.to = executeRewriteInput(this.rewrite, hrefUrl).pathname;
|
|
1566
|
-
rest.search = this.options.parseSearch(parsed.search);
|
|
1567
|
-
rest.hash = parsed.hash.slice(1);
|
|
1568
|
-
}
|
|
1569
|
-
const location = this.buildLocation({
|
|
1570
|
-
...rest,
|
|
1571
|
-
_includeValidateSearch: true
|
|
1572
|
-
});
|
|
1573
|
-
this.pendingBuiltLocation = location;
|
|
1574
|
-
const commitPromise = this.commitLocation({
|
|
1575
|
-
...location,
|
|
1576
|
-
viewTransition,
|
|
1577
|
-
replace,
|
|
1578
|
-
resetScroll,
|
|
1579
|
-
hashScrollIntoView,
|
|
1580
|
-
ignoreBlocker
|
|
1581
|
-
});
|
|
1582
|
-
queueMicrotask(() => {
|
|
1583
|
-
if (this.pendingBuiltLocation === location) this.pendingBuiltLocation = void 0;
|
|
1584
|
-
});
|
|
1585
|
-
return commitPromise;
|
|
1586
|
-
};
|
|
1587
|
-
this.navigate = async ({ to, reloadDocument, href, publicHref, ...rest }) => {
|
|
1588
|
-
let hrefIsUrl = false;
|
|
1589
|
-
if (href) try {
|
|
1590
|
-
new URL(`${href}`);
|
|
1591
|
-
hrefIsUrl = true;
|
|
1592
|
-
} catch {}
|
|
1593
|
-
if (hrefIsUrl && !reloadDocument) reloadDocument = true;
|
|
1594
|
-
if (reloadDocument) {
|
|
1595
|
-
if (to !== void 0 || !href) {
|
|
1596
|
-
const location = this.buildLocation({
|
|
1597
|
-
to,
|
|
1598
|
-
...rest
|
|
1599
|
-
});
|
|
1600
|
-
href = href ?? location.publicHref;
|
|
1601
|
-
publicHref = publicHref ?? location.publicHref;
|
|
1602
|
-
}
|
|
1603
|
-
const reloadHref = !hrefIsUrl && publicHref ? publicHref : href;
|
|
1604
|
-
if (isDangerousProtocol(reloadHref, this.protocolAllowlist)) return;
|
|
1605
|
-
if (!rest.ignoreBlocker) {
|
|
1606
|
-
const blockers = this.history.getBlockers?.() ?? [];
|
|
1607
|
-
for (const blocker of blockers) if (blocker?.blockerFn) {
|
|
1608
|
-
if (await blocker.blockerFn({
|
|
1609
|
-
currentLocation: this.latestLocation,
|
|
1610
|
-
nextLocation: this.latestLocation,
|
|
1611
|
-
action: "PUSH"
|
|
1612
|
-
})) return;
|
|
1613
|
-
}
|
|
1614
|
-
}
|
|
1615
|
-
if (rest.replace) window.location.replace(reloadHref);
|
|
1616
|
-
else window.location.href = reloadHref;
|
|
1617
|
-
return;
|
|
1618
|
-
}
|
|
1619
|
-
return this.buildAndCommitLocation({
|
|
1620
|
-
...rest,
|
|
1621
|
-
href,
|
|
1622
|
-
to,
|
|
1623
|
-
_isNavigate: true
|
|
1624
|
-
});
|
|
1625
|
-
};
|
|
1626
|
-
this.beforeLoad = () => {
|
|
1627
|
-
this.cancelMatches();
|
|
1628
|
-
this.updateLatestLocation();
|
|
1629
|
-
{
|
|
1630
|
-
const nextLocation = this.buildLocation({
|
|
1631
|
-
to: this.latestLocation.pathname,
|
|
1632
|
-
search: true,
|
|
1633
|
-
params: true,
|
|
1634
|
-
hash: true,
|
|
1635
|
-
state: true,
|
|
1636
|
-
_includeValidateSearch: true
|
|
1637
|
-
});
|
|
1638
|
-
if (this.latestLocation.publicHref !== nextLocation.publicHref) {
|
|
1639
|
-
const href = this.getParsedLocationHref(nextLocation);
|
|
1640
|
-
if (nextLocation.external) throw redirect({ href });
|
|
1641
|
-
else throw redirect({
|
|
1642
|
-
href,
|
|
1643
|
-
_builtLocation: nextLocation
|
|
1644
|
-
});
|
|
1645
|
-
}
|
|
1646
|
-
}
|
|
1647
|
-
const pendingMatches = this.matchRoutes(this.latestLocation);
|
|
1648
|
-
const nextCachedMatches = this.stores.cachedMatches.get().filter((d) => !pendingMatches.some((e) => e.id === d.id));
|
|
1649
|
-
this.batch(() => {
|
|
1650
|
-
this.stores.status.set("pending");
|
|
1651
|
-
this.stores.statusCode.set(200);
|
|
1652
|
-
this.stores.isLoading.set(true);
|
|
1653
|
-
this.stores.location.set(this.latestLocation);
|
|
1654
|
-
this.stores.setPending(pendingMatches);
|
|
1655
|
-
this.stores.setCached(nextCachedMatches);
|
|
1656
|
-
});
|
|
1657
|
-
};
|
|
1658
|
-
this.load = async (opts) => {
|
|
1659
|
-
const historyAction = opts?.action?.type;
|
|
1660
|
-
let redirect;
|
|
1661
|
-
let notFound;
|
|
1662
|
-
let loadPromise;
|
|
1663
|
-
const previousLocation = this.stores.resolvedLocation.get() ?? this.stores.location.get();
|
|
1664
|
-
loadPromise = new Promise((resolve) => {
|
|
1665
|
-
this.startTransition(async () => {
|
|
1666
|
-
try {
|
|
1667
|
-
this.beforeLoad();
|
|
1668
|
-
if (historyAction) this._scroll.hash = historyAction === "PUSH" || historyAction === "REPLACE";
|
|
1669
|
-
const next = this.latestLocation;
|
|
1670
|
-
const locationChangeInfo = getLocationChangeInfo(next, this.stores.resolvedLocation.get());
|
|
1671
|
-
if (!this.stores.redirect.get()) this.emit({
|
|
1672
|
-
type: "onBeforeNavigate",
|
|
1673
|
-
...locationChangeInfo
|
|
1674
|
-
});
|
|
1675
|
-
this.emit({
|
|
1676
|
-
type: "onBeforeLoad",
|
|
1677
|
-
...locationChangeInfo
|
|
1678
|
-
});
|
|
1679
|
-
await loadMatches({
|
|
1680
|
-
router: this,
|
|
1681
|
-
sync: opts?.sync,
|
|
1682
|
-
forceStaleReload: previousLocation.href === next.href,
|
|
1683
|
-
matches: this.stores.pendingMatches.get(),
|
|
1684
|
-
location: next,
|
|
1685
|
-
updateMatch: this.updateMatch,
|
|
1686
|
-
onReady: async () => {
|
|
1687
|
-
this.startTransition(() => {
|
|
1688
|
-
this.startViewTransition(async () => {
|
|
1689
|
-
let exitingMatches = null;
|
|
1690
|
-
let hookExitingMatches = null;
|
|
1691
|
-
let hookEnteringMatches = null;
|
|
1692
|
-
let hookStayingMatches = null;
|
|
1693
|
-
this.batch(() => {
|
|
1694
|
-
const pendingMatches = this.stores.pendingMatches.get();
|
|
1695
|
-
const mountPending = pendingMatches.length;
|
|
1696
|
-
const currentMatches = this.stores.matches.get();
|
|
1697
|
-
exitingMatches = mountPending ? currentMatches.filter((match) => !this.stores.pendingMatchStores.has(match.id)) : null;
|
|
1698
|
-
const pendingRouteIds = /* @__PURE__ */ new Set();
|
|
1699
|
-
for (const s of this.stores.pendingMatchStores.values()) if (s.routeId) pendingRouteIds.add(s.routeId);
|
|
1700
|
-
const activeRouteIds = /* @__PURE__ */ new Set();
|
|
1701
|
-
for (const s of this.stores.matchStores.values()) if (s.routeId) activeRouteIds.add(s.routeId);
|
|
1702
|
-
hookExitingMatches = mountPending ? currentMatches.filter((match) => !pendingRouteIds.has(match.routeId)) : null;
|
|
1703
|
-
hookEnteringMatches = mountPending ? pendingMatches.filter((match) => !activeRouteIds.has(match.routeId)) : null;
|
|
1704
|
-
hookStayingMatches = mountPending ? pendingMatches.filter((match) => activeRouteIds.has(match.routeId)) : currentMatches;
|
|
1705
|
-
this.stores.isLoading.set(false);
|
|
1706
|
-
this.stores.loadedAt.set(Date.now());
|
|
1707
|
-
/**
|
|
1708
|
-
* When committing new matches, cache any exiting matches that are still usable.
|
|
1709
|
-
* Routes that resolved with `status: 'error'` or `status: 'notFound'` are
|
|
1710
|
-
* deliberately excluded from `cachedMatches` so that subsequent invalidations
|
|
1711
|
-
* or reloads re-run their loaders instead of reusing the failed/not-found data.
|
|
1712
|
-
*/
|
|
1713
|
-
if (mountPending) {
|
|
1714
|
-
this.stores.setMatches(pendingMatches);
|
|
1715
|
-
this.stores.setPending([]);
|
|
1716
|
-
this.stores.setCached([...this.stores.cachedMatches.get(), ...exitingMatches.filter((d) => d.status !== "error" && d.status !== "notFound" && d.status !== "redirected")]);
|
|
1717
|
-
this.clearExpiredCache();
|
|
1718
|
-
}
|
|
1719
|
-
});
|
|
1720
|
-
for (const [matches, hook] of [
|
|
1721
|
-
[hookExitingMatches, "onLeave"],
|
|
1722
|
-
[hookEnteringMatches, "onEnter"],
|
|
1723
|
-
[hookStayingMatches, "onStay"]
|
|
1724
|
-
]) {
|
|
1725
|
-
if (!matches) continue;
|
|
1726
|
-
for (const match of matches) this.looseRoutesById[match.routeId].options[hook]?.(match);
|
|
1727
|
-
}
|
|
1728
|
-
});
|
|
1729
|
-
});
|
|
1730
|
-
}
|
|
1731
|
-
});
|
|
1732
|
-
} catch (err) {
|
|
1733
|
-
if (isRedirect(err)) redirect = err;
|
|
1734
|
-
else if (isNotFound(err)) notFound = err;
|
|
1735
|
-
const nextStatusCode = redirect ? redirect.status : notFound ? 404 : this.stores.matches.get().some((d) => d.status === "error") ? 500 : 200;
|
|
1736
|
-
this.batch(() => {
|
|
1737
|
-
this.stores.statusCode.set(nextStatusCode);
|
|
1738
|
-
this.stores.redirect.set(redirect);
|
|
1739
|
-
});
|
|
1740
|
-
}
|
|
1741
|
-
if (this.latestLoadPromise === loadPromise) {
|
|
1742
|
-
this.commitLocationPromise?.resolve();
|
|
1743
|
-
this.latestLoadPromise = void 0;
|
|
1744
|
-
this.commitLocationPromise = void 0;
|
|
1745
|
-
}
|
|
1746
|
-
resolve();
|
|
1747
|
-
});
|
|
1748
|
-
});
|
|
1749
|
-
this.latestLoadPromise = loadPromise;
|
|
1750
|
-
await loadPromise;
|
|
1751
|
-
while (this.latestLoadPromise && loadPromise !== this.latestLoadPromise) await this.latestLoadPromise;
|
|
1752
|
-
let newStatusCode = void 0;
|
|
1753
|
-
if (this.hasNotFoundMatch()) newStatusCode = 404;
|
|
1754
|
-
else if (this.stores.matches.get().some((d) => d.status === "error")) newStatusCode = 500;
|
|
1755
|
-
if (newStatusCode !== void 0) this.stores.statusCode.set(newStatusCode);
|
|
1756
|
-
};
|
|
1757
|
-
this.startViewTransition = (fn) => {
|
|
1758
|
-
const shouldViewTransition = this.shouldViewTransition ?? this.options.defaultViewTransition;
|
|
1759
|
-
this.shouldViewTransition = void 0;
|
|
1760
|
-
if (shouldViewTransition && typeof document !== "undefined" && "startViewTransition" in document && typeof document.startViewTransition === "function") {
|
|
1761
|
-
let startViewTransitionParams;
|
|
1762
|
-
if (typeof shouldViewTransition === "object" && this.isViewTransitionTypesSupported) {
|
|
1763
|
-
const next = this.latestLocation;
|
|
1764
|
-
const prevLocation = this.stores.resolvedLocation.get();
|
|
1765
|
-
const resolvedViewTransitionTypes = typeof shouldViewTransition.types === "function" ? shouldViewTransition.types(getLocationChangeInfo(next, prevLocation)) : shouldViewTransition.types;
|
|
1766
|
-
if (resolvedViewTransitionTypes === false) {
|
|
1767
|
-
fn();
|
|
1768
|
-
return;
|
|
1769
|
-
}
|
|
1770
|
-
startViewTransitionParams = {
|
|
1771
|
-
update: fn,
|
|
1772
|
-
types: resolvedViewTransitionTypes
|
|
1773
|
-
};
|
|
1774
|
-
} else startViewTransitionParams = fn;
|
|
1775
|
-
document.startViewTransition(startViewTransitionParams);
|
|
1776
|
-
} else fn();
|
|
1777
|
-
};
|
|
1778
|
-
this.updateMatch = (id, updater) => {
|
|
1779
|
-
this.startTransition(() => {
|
|
1780
|
-
const pendingMatch = this.stores.pendingMatchStores.get(id);
|
|
1781
|
-
if (pendingMatch) {
|
|
1782
|
-
pendingMatch.set(updater);
|
|
1783
|
-
return;
|
|
1784
|
-
}
|
|
1785
|
-
const activeMatch = this.stores.matchStores.get(id);
|
|
1786
|
-
if (activeMatch) {
|
|
1787
|
-
activeMatch.set(updater);
|
|
1788
|
-
return;
|
|
1789
|
-
}
|
|
1790
|
-
const cachedMatch = this.stores.cachedMatchStores.get(id);
|
|
1791
|
-
if (cachedMatch) {
|
|
1792
|
-
const next = updater(cachedMatch.get());
|
|
1793
|
-
if (next.status === "redirected") {
|
|
1794
|
-
if (this.stores.cachedMatchStores.delete(id)) this.stores.cachedIds.set((prev) => prev.filter((matchId) => matchId !== id));
|
|
1795
|
-
} else cachedMatch.set(next);
|
|
1796
|
-
}
|
|
1797
|
-
});
|
|
1798
|
-
};
|
|
1799
|
-
this.getMatch = (matchId) => {
|
|
1800
|
-
return this.stores.cachedMatchStores.get(matchId)?.get() ?? this.stores.pendingMatchStores.get(matchId)?.get() ?? this.stores.matchStores.get(matchId)?.get();
|
|
1801
|
-
};
|
|
1802
|
-
this.invalidate = (opts) => {
|
|
1803
|
-
const invalidate = (d) => {
|
|
1804
|
-
if (opts?.filter?.(d) ?? true) return {
|
|
1805
|
-
...d,
|
|
1806
|
-
invalid: true,
|
|
1807
|
-
...opts?.forcePending || d.status === "error" || d.status === "notFound" ? {
|
|
1808
|
-
status: "pending",
|
|
1809
|
-
error: void 0
|
|
1810
|
-
} : void 0
|
|
1811
|
-
};
|
|
1812
|
-
return d;
|
|
1813
|
-
};
|
|
1814
|
-
this.batch(() => {
|
|
1815
|
-
this.stores.setMatches(this.stores.matches.get().map(invalidate));
|
|
1816
|
-
this.stores.setCached(this.stores.cachedMatches.get().map(invalidate));
|
|
1817
|
-
this.stores.setPending(this.stores.pendingMatches.get().map(invalidate));
|
|
1818
|
-
});
|
|
1819
|
-
this.shouldViewTransition = false;
|
|
1820
|
-
return this.load({ sync: opts?.sync });
|
|
1821
|
-
};
|
|
1822
|
-
this.getParsedLocationHref = (location) => {
|
|
1823
|
-
return location.publicHref || "/";
|
|
1824
|
-
};
|
|
1825
|
-
this.resolveRedirect = (redirect) => {
|
|
1826
|
-
const locationHeader = redirect.headers.get("Location");
|
|
1827
|
-
if (!redirect.options.href || redirect.options._builtLocation) {
|
|
1828
|
-
const location = redirect.options._builtLocation ?? this.buildLocation(redirect.options);
|
|
1829
|
-
const href = this.getParsedLocationHref(location);
|
|
1830
|
-
redirect.options.href = href;
|
|
1831
|
-
redirect.headers.set("Location", href);
|
|
1832
|
-
} else if (locationHeader) try {
|
|
1833
|
-
const url = new URL(locationHeader);
|
|
1834
|
-
if (this.origin && url.origin === this.origin) {
|
|
1835
|
-
const href = url.pathname + url.search + url.hash;
|
|
1836
|
-
redirect.options.href = href;
|
|
1837
|
-
redirect.headers.set("Location", href);
|
|
1838
|
-
}
|
|
1839
|
-
} catch {}
|
|
1840
|
-
if (redirect.options.href && !redirect.options._builtLocation && isDangerousProtocol(redirect.options.href, this.protocolAllowlist)) throw new Error("Redirect blocked: unsafe protocol");
|
|
1841
|
-
if (!redirect.headers.get("Location")) redirect.headers.set("Location", redirect.options.href);
|
|
1842
|
-
return redirect;
|
|
1843
|
-
};
|
|
1844
|
-
this.clearCache = (opts) => {
|
|
1845
|
-
const filter = opts?.filter;
|
|
1846
|
-
if (filter !== void 0) this.stores.setCached(this.stores.cachedMatches.get().filter((m) => !filter(m)));
|
|
1847
|
-
else this.stores.setCached([]);
|
|
1848
|
-
};
|
|
1849
|
-
this.clearExpiredCache = () => {
|
|
1850
|
-
const now = Date.now();
|
|
1851
|
-
const filter = (d) => {
|
|
1852
|
-
const route = this.looseRoutesById[d.routeId];
|
|
1853
|
-
if (!route.options.loader) return true;
|
|
1854
|
-
const gcTime = (d.preload ? route.options.preloadGcTime ?? this.options.defaultPreloadGcTime : route.options.gcTime ?? this.options.defaultGcTime) ?? 300 * 1e3;
|
|
1855
|
-
if (d.status === "error") return true;
|
|
1856
|
-
return now - d.updatedAt >= gcTime;
|
|
1857
|
-
};
|
|
1858
|
-
this.clearCache({ filter });
|
|
1859
|
-
};
|
|
1860
|
-
this.loadRouteChunk = loadRouteChunk;
|
|
1861
|
-
this.preloadRoute = async (opts) => {
|
|
1862
|
-
const next = opts._builtLocation ?? this.buildLocation(opts);
|
|
1863
|
-
let matches = this.matchRoutes(next, {
|
|
1864
|
-
throwOnError: true,
|
|
1865
|
-
preload: true,
|
|
1866
|
-
dest: opts
|
|
1867
|
-
});
|
|
1868
|
-
const activeMatchIds = /* @__PURE__ */ new Set([...this.stores.matchesId.get(), ...this.stores.pendingIds.get()]);
|
|
1869
|
-
const loadedMatchIds = /* @__PURE__ */ new Set([...activeMatchIds, ...this.stores.cachedIds.get()]);
|
|
1870
|
-
const matchesToCache = matches.filter((match) => !loadedMatchIds.has(match.id));
|
|
1871
|
-
if (matchesToCache.length) {
|
|
1872
|
-
const cachedMatches = this.stores.cachedMatches.get();
|
|
1873
|
-
this.stores.setCached([...cachedMatches, ...matchesToCache]);
|
|
1874
|
-
}
|
|
1875
|
-
try {
|
|
1876
|
-
matches = await loadMatches({
|
|
1877
|
-
router: this,
|
|
1878
|
-
matches,
|
|
1879
|
-
location: next,
|
|
1880
|
-
preload: true,
|
|
1881
|
-
updateMatch: (id, updater) => {
|
|
1882
|
-
if (activeMatchIds.has(id)) matches = matches.map((d) => d.id === id ? updater(d) : d);
|
|
1883
|
-
else this.updateMatch(id, updater);
|
|
1884
|
-
}
|
|
1885
|
-
});
|
|
1886
|
-
return matches;
|
|
1887
|
-
} catch (err) {
|
|
1888
|
-
if (isRedirect(err)) {
|
|
1889
|
-
if (err.options.reloadDocument) return;
|
|
1890
|
-
return await this.preloadRoute({
|
|
1891
|
-
...err.options,
|
|
1892
|
-
_fromLocation: next
|
|
1893
|
-
});
|
|
1894
|
-
}
|
|
1895
|
-
if (!isNotFound(err)) console.error(err);
|
|
1896
|
-
return;
|
|
1897
|
-
}
|
|
1898
|
-
};
|
|
1899
|
-
this.matchRoute = (location, opts) => {
|
|
1900
|
-
const matchLocation = {
|
|
1901
|
-
...location,
|
|
1902
|
-
to: location.to ? this.resolvePathWithBase(location.from || "", location.to) : void 0,
|
|
1903
|
-
params: location.params || {},
|
|
1904
|
-
leaveParams: true
|
|
1905
|
-
};
|
|
1906
|
-
const next = this.buildLocation(matchLocation);
|
|
1907
|
-
if (opts?.pending && this.stores.status.get() !== "pending") return false;
|
|
1908
|
-
const baseLocation = (opts?.pending === void 0 ? !this.stores.isLoading.get() : opts.pending) ? this.latestLocation : this.stores.resolvedLocation.get() || this.stores.location.get();
|
|
1909
|
-
const match = findSingleMatch(next.pathname, opts?.caseSensitive ?? false, opts?.fuzzy ?? false, baseLocation.pathname, this.processedTree);
|
|
1910
|
-
if (!match) return false;
|
|
1911
|
-
if (location.params) {
|
|
1912
|
-
if (!deepEqual(match.rawParams, location.params, { partial: true })) return false;
|
|
1913
|
-
}
|
|
1914
|
-
if (opts?.includeSearch ?? true) return deepEqual(baseLocation.search, next.search, { partial: true }) ? match.rawParams : false;
|
|
1915
|
-
return match.rawParams;
|
|
1916
|
-
};
|
|
1917
|
-
this.hasNotFoundMatch = () => {
|
|
1918
|
-
return this.stores.matches.get().some((d) => d.status === "notFound" || d.globalNotFound);
|
|
1919
|
-
};
|
|
1920
|
-
this.getStoreConfig = getStoreConfig;
|
|
1921
|
-
this.update({
|
|
1922
|
-
defaultPreloadDelay: 50,
|
|
1923
|
-
defaultPendingMs: 1e3,
|
|
1924
|
-
defaultPendingMinMs: 500,
|
|
1925
|
-
context: void 0,
|
|
1926
|
-
...options,
|
|
1927
|
-
caseSensitive: options.caseSensitive ?? false,
|
|
1928
|
-
notFoundMode: options.notFoundMode ?? "fuzzy",
|
|
1929
|
-
stringifySearch: options.stringifySearch ?? defaultStringifySearch,
|
|
1930
|
-
parseSearch: options.parseSearch ?? defaultParseSearch,
|
|
1931
|
-
protocolAllowlist: options.protocolAllowlist ?? DEFAULT_PROTOCOL_ALLOWLIST
|
|
1932
|
-
});
|
|
1933
|
-
if (typeof document !== "undefined") self.__TSR_ROUTER__ = this;
|
|
1934
|
-
}
|
|
1935
|
-
isShell() {
|
|
1936
|
-
return !!this.options.isShell;
|
|
1937
|
-
}
|
|
1938
|
-
isPrerendering() {
|
|
1939
|
-
return !!this.options.isPrerendering;
|
|
1940
|
-
}
|
|
1941
|
-
get state() {
|
|
1942
|
-
return this.stores.__store.get();
|
|
1943
|
-
}
|
|
1944
|
-
setRoutes({ routesById, routesByPath, processedTree }) {
|
|
1945
|
-
this.routesById = routesById;
|
|
1946
|
-
this.routesByPath = routesByPath;
|
|
1947
|
-
this.processedTree = processedTree;
|
|
1948
|
-
const notFoundRoute = this.options.notFoundRoute;
|
|
1949
|
-
if (notFoundRoute) {
|
|
1950
|
-
notFoundRoute.init({ originalIndex: 99999999999 });
|
|
1951
|
-
this.routesById[notFoundRoute.id] = notFoundRoute;
|
|
1952
|
-
}
|
|
1953
|
-
}
|
|
1954
|
-
getRouteBranch(route) {
|
|
1955
|
-
let branch = this.routeBranchCache.get(route);
|
|
1956
|
-
if (!branch) {
|
|
1957
|
-
branch = buildRouteBranch(route);
|
|
1958
|
-
this.routeBranchCache.set(route, branch);
|
|
1959
|
-
}
|
|
1960
|
-
return branch;
|
|
1961
|
-
}
|
|
1962
|
-
get looseRoutesById() {
|
|
1963
|
-
return this.routesById;
|
|
1964
|
-
}
|
|
1965
|
-
getParentContext(parentMatch) {
|
|
1966
|
-
return !parentMatch?.id ? this.options.context ?? void 0 : parentMatch.context ?? this.options.context ?? void 0;
|
|
1967
|
-
}
|
|
1968
|
-
matchRoutesInternal(next, opts) {
|
|
1969
|
-
const matchedRoutesResult = this.getMatchedRoutes(next.pathname);
|
|
1970
|
-
const { foundRoute, routeParams } = matchedRoutesResult;
|
|
1971
|
-
let { matchedRoutes } = matchedRoutesResult;
|
|
1972
|
-
let isGlobalNotFound = false;
|
|
1973
|
-
if (foundRoute ? foundRoute.path !== "/" && routeParams["**"] : trimPathRight(next.pathname)) if (this.options.notFoundRoute) matchedRoutes = [...matchedRoutes, this.options.notFoundRoute];
|
|
1974
|
-
else isGlobalNotFound = true;
|
|
1975
|
-
const globalNotFoundRouteId = isGlobalNotFound ? findGlobalNotFoundRouteId(this.options.notFoundMode, matchedRoutes) : void 0;
|
|
1976
|
-
const matches = new Array(matchedRoutes.length);
|
|
1977
|
-
const previousActiveMatchesByRouteId = /* @__PURE__ */ new Map();
|
|
1978
|
-
for (const store of this.stores.matchStores.values()) if (store.routeId) previousActiveMatchesByRouteId.set(store.routeId, store.get());
|
|
1979
|
-
for (let index = 0; index < matchedRoutes.length; index++) {
|
|
1980
|
-
const route = matchedRoutes[index];
|
|
1981
|
-
const parentMatch = matches[index - 1];
|
|
1982
|
-
let preMatchSearch;
|
|
1983
|
-
let strictMatchSearch;
|
|
1984
|
-
let searchError;
|
|
1985
|
-
{
|
|
1986
|
-
const parentSearch = parentMatch?.search ?? next.search;
|
|
1987
|
-
const parentStrictSearch = parentMatch?._strictSearch ?? void 0;
|
|
1988
|
-
try {
|
|
1989
|
-
const strictSearch = validateSearch(route.options.validateSearch, { ...parentSearch }) ?? void 0;
|
|
1990
|
-
preMatchSearch = {
|
|
1991
|
-
...parentSearch,
|
|
1992
|
-
...strictSearch
|
|
1993
|
-
};
|
|
1994
|
-
strictMatchSearch = {
|
|
1995
|
-
...parentStrictSearch,
|
|
1996
|
-
...strictSearch
|
|
1997
|
-
};
|
|
1998
|
-
searchError = void 0;
|
|
1999
|
-
} catch (err) {
|
|
2000
|
-
let searchParamError = err;
|
|
2001
|
-
if (!(err instanceof SearchParamError)) searchParamError = new SearchParamError(err.message, { cause: err });
|
|
2002
|
-
if (opts?.throwOnError) throw searchParamError;
|
|
2003
|
-
preMatchSearch = parentSearch;
|
|
2004
|
-
strictMatchSearch = {};
|
|
2005
|
-
searchError = searchParamError;
|
|
2006
|
-
}
|
|
2007
|
-
}
|
|
2008
|
-
const loaderDeps = route.options.loaderDeps?.({ search: preMatchSearch }) ?? "";
|
|
2009
|
-
const loaderDepsHash = loaderDeps ? JSON.stringify(loaderDeps) : "";
|
|
2010
|
-
const { interpolatedPath, usedParams } = interpolatePath({
|
|
2011
|
-
path: route.fullPath,
|
|
2012
|
-
params: routeParams,
|
|
2013
|
-
decoder: this.pathParamsDecoder,
|
|
2014
|
-
server: this.isServer
|
|
2015
|
-
});
|
|
2016
|
-
const matchId = route.id + interpolatedPath + loaderDepsHash;
|
|
2017
|
-
const existingMatch = this.getMatch(matchId);
|
|
2018
|
-
const previousMatch = previousActiveMatchesByRouteId.get(route.id);
|
|
2019
|
-
const strictParams = existingMatch?._strictParams ?? usedParams;
|
|
2020
|
-
let paramsError = void 0;
|
|
2021
|
-
if (!existingMatch) try {
|
|
2022
|
-
extractStrictParams(route, strictParams);
|
|
2023
|
-
} catch (err) {
|
|
2024
|
-
if (isNotFound(err) || isRedirect(err)) paramsError = err;
|
|
2025
|
-
else paramsError = new PathParamError(err.message, { cause: err });
|
|
2026
|
-
if (opts?.throwOnError) throw paramsError;
|
|
2027
|
-
}
|
|
2028
|
-
Object.assign(routeParams, strictParams);
|
|
2029
|
-
const cause = previousMatch ? "stay" : "enter";
|
|
2030
|
-
let match;
|
|
2031
|
-
if (existingMatch) match = {
|
|
2032
|
-
...existingMatch,
|
|
2033
|
-
cause,
|
|
2034
|
-
params: previousMatch?.params ?? routeParams,
|
|
2035
|
-
_strictParams: strictParams,
|
|
2036
|
-
search: previousMatch ? nullReplaceEqualDeep(previousMatch.search, preMatchSearch) : nullReplaceEqualDeep(existingMatch.search, preMatchSearch),
|
|
2037
|
-
_strictSearch: strictMatchSearch
|
|
2038
|
-
};
|
|
2039
|
-
else {
|
|
2040
|
-
const status = route.options.loader || route.options.beforeLoad || route.lazyFn || routeNeedsPreload(route) ? "pending" : "success";
|
|
2041
|
-
match = {
|
|
2042
|
-
id: matchId,
|
|
2043
|
-
ssr: void 0,
|
|
2044
|
-
index,
|
|
2045
|
-
routeId: route.id,
|
|
2046
|
-
params: previousMatch?.params ?? routeParams,
|
|
2047
|
-
_strictParams: strictParams,
|
|
2048
|
-
pathname: interpolatedPath,
|
|
2049
|
-
updatedAt: Date.now(),
|
|
2050
|
-
search: previousMatch ? nullReplaceEqualDeep(previousMatch.search, preMatchSearch) : preMatchSearch,
|
|
2051
|
-
_strictSearch: strictMatchSearch,
|
|
2052
|
-
searchError: void 0,
|
|
2053
|
-
status,
|
|
2054
|
-
isFetching: false,
|
|
2055
|
-
error: void 0,
|
|
2056
|
-
paramsError,
|
|
2057
|
-
__routeContext: void 0,
|
|
2058
|
-
_nonReactive: { loadPromise: createControlledPromise() },
|
|
2059
|
-
__beforeLoadContext: void 0,
|
|
2060
|
-
context: {},
|
|
2061
|
-
abortController: new AbortController(),
|
|
2062
|
-
fetchCount: 0,
|
|
2063
|
-
cause,
|
|
2064
|
-
loaderDeps: previousMatch ? replaceEqualDeep(previousMatch.loaderDeps, loaderDeps) : loaderDeps,
|
|
2065
|
-
invalid: false,
|
|
2066
|
-
preload: false,
|
|
2067
|
-
links: void 0,
|
|
2068
|
-
scripts: void 0,
|
|
2069
|
-
headScripts: void 0,
|
|
2070
|
-
meta: void 0,
|
|
2071
|
-
staticData: route.options.staticData || {},
|
|
2072
|
-
fullPath: route.fullPath
|
|
2073
|
-
};
|
|
2074
|
-
}
|
|
2075
|
-
if (!opts?.preload) match.globalNotFound = globalNotFoundRouteId === route.id;
|
|
2076
|
-
match.searchError = searchError;
|
|
2077
|
-
const parentContext = this.getParentContext(parentMatch);
|
|
2078
|
-
match.context = {
|
|
2079
|
-
...parentContext,
|
|
2080
|
-
...match.__routeContext,
|
|
2081
|
-
...match.__beforeLoadContext
|
|
2082
|
-
};
|
|
2083
|
-
matches[index] = match;
|
|
2084
|
-
}
|
|
2085
|
-
for (let index = 0; index < matches.length; index++) {
|
|
2086
|
-
const match = matches[index];
|
|
2087
|
-
const route = this.looseRoutesById[match.routeId];
|
|
2088
|
-
const existingMatch = this.getMatch(match.id);
|
|
2089
|
-
const previousMatch = previousActiveMatchesByRouteId.get(match.routeId);
|
|
2090
|
-
match.params = previousMatch ? nullReplaceEqualDeep(previousMatch.params, routeParams) : routeParams;
|
|
2091
|
-
if (!existingMatch) {
|
|
2092
|
-
const parentMatch = matches[index - 1];
|
|
2093
|
-
const parentContext = this.getParentContext(parentMatch);
|
|
2094
|
-
if (route.options.context) {
|
|
2095
|
-
const contextFnContext = {
|
|
2096
|
-
deps: match.loaderDeps,
|
|
2097
|
-
params: match.params,
|
|
2098
|
-
context: parentContext ?? {},
|
|
2099
|
-
location: next,
|
|
2100
|
-
navigate: (opts) => this.navigate({
|
|
2101
|
-
...opts,
|
|
2102
|
-
_fromLocation: next
|
|
2103
|
-
}),
|
|
2104
|
-
buildLocation: this.buildLocation,
|
|
2105
|
-
cause: match.cause,
|
|
2106
|
-
abortController: match.abortController,
|
|
2107
|
-
preload: !!match.preload,
|
|
2108
|
-
matches,
|
|
2109
|
-
routeId: route.id
|
|
2110
|
-
};
|
|
2111
|
-
match.__routeContext = route.options.context(contextFnContext) ?? void 0;
|
|
2112
|
-
}
|
|
2113
|
-
match.context = {
|
|
2114
|
-
...parentContext,
|
|
2115
|
-
...match.__routeContext,
|
|
2116
|
-
...match.__beforeLoadContext
|
|
2117
|
-
};
|
|
2118
|
-
}
|
|
2119
|
-
}
|
|
2120
|
-
return matches;
|
|
2121
|
-
}
|
|
2122
|
-
/**
|
|
2123
|
-
* Lightweight route matching for buildLocation.
|
|
2124
|
-
* Only computes fullPath, accumulated search, and params - skipping expensive
|
|
2125
|
-
* operations like AbortController, ControlledPromise, loaderDeps, and full match objects.
|
|
2126
|
-
*/
|
|
2127
|
-
matchRoutesLightweight(location) {
|
|
2128
|
-
const lastStateMatchId = last(this.stores.matchesId.get());
|
|
2129
|
-
const cached = this.lightweightCache.get(location);
|
|
2130
|
-
if (cached && cached[0] === lastStateMatchId) return cached[1];
|
|
2131
|
-
const { matchedRoutes, routeParams } = this.getMatchedRoutes(location.pathname);
|
|
2132
|
-
const lastRoute = last(matchedRoutes);
|
|
2133
|
-
const accumulatedSearch = { ...location.search };
|
|
2134
|
-
for (const route of matchedRoutes) try {
|
|
2135
|
-
Object.assign(accumulatedSearch, validateSearch(route.options.validateSearch, accumulatedSearch));
|
|
2136
|
-
} catch {}
|
|
2137
|
-
const lastStateMatch = lastStateMatchId && this.stores.matchStores.get(lastStateMatchId)?.get();
|
|
2138
|
-
const canReuseParams = lastStateMatch && lastStateMatch.routeId === lastRoute.id && lastStateMatch.pathname === location.pathname;
|
|
2139
|
-
let params;
|
|
2140
|
-
if (canReuseParams) params = lastStateMatch.params;
|
|
2141
|
-
else {
|
|
2142
|
-
const strictParams = Object.assign(Object.create(null), routeParams);
|
|
2143
|
-
for (const route of matchedRoutes) try {
|
|
2144
|
-
extractStrictParams(route, strictParams);
|
|
2145
|
-
} catch {}
|
|
2146
|
-
params = strictParams;
|
|
2147
|
-
}
|
|
2148
|
-
const result = {
|
|
2149
|
-
matchedRoutes,
|
|
2150
|
-
fullPath: lastRoute.fullPath,
|
|
2151
|
-
search: accumulatedSearch,
|
|
2152
|
-
params
|
|
2153
|
-
};
|
|
2154
|
-
this.lightweightCache.set(location, [lastStateMatchId, result]);
|
|
2155
|
-
return result;
|
|
2156
|
-
}
|
|
2157
|
-
};
|
|
2158
|
-
/** Error thrown when search parameter validation fails. */
|
|
2159
|
-
var SearchParamError = class extends Error {};
|
|
2160
|
-
/** Error thrown when path parameter parsing/validation fails. */
|
|
2161
|
-
var PathParamError = class extends Error {};
|
|
2162
|
-
/** Create an initial RouterState from a parsed location. */
|
|
2163
|
-
function getInitialRouterState(location) {
|
|
2164
|
-
return {
|
|
2165
|
-
loadedAt: 0,
|
|
2166
|
-
isLoading: false,
|
|
2167
|
-
isTransitioning: false,
|
|
2168
|
-
status: "idle",
|
|
2169
|
-
resolvedLocation: void 0,
|
|
2170
|
-
location,
|
|
2171
|
-
matches: [],
|
|
2172
|
-
statusCode: 200
|
|
2173
|
-
};
|
|
2174
|
-
}
|
|
2175
|
-
function validateSearch(validateSearch, input) {
|
|
2176
|
-
if (validateSearch == null) return {};
|
|
2177
|
-
if ("~standard" in validateSearch) {
|
|
2178
|
-
const result = validateSearch["~standard"].validate(input);
|
|
2179
|
-
if (result instanceof Promise) throw new SearchParamError("Async validation not supported");
|
|
2180
|
-
if (result.issues) throw new SearchParamError(JSON.stringify(result.issues, void 0, 2), { cause: result });
|
|
2181
|
-
return result.value;
|
|
2182
|
-
}
|
|
2183
|
-
if ("parse" in validateSearch) return validateSearch.parse(input);
|
|
2184
|
-
if (typeof validateSearch === "function") return validateSearch(input);
|
|
2185
|
-
return {};
|
|
2186
|
-
}
|
|
2187
|
-
/**
|
|
2188
|
-
* Build the matched route chain and extract params for a pathname.
|
|
2189
|
-
* Falls back to the root route if no specific route is found.
|
|
2190
|
-
*/
|
|
2191
|
-
function getMatchedRoutes({ pathname, routesById, processedTree }) {
|
|
2192
|
-
const routeParams = Object.create(null);
|
|
2193
|
-
const trimmedPath = trimPathRight(pathname);
|
|
2194
|
-
let foundRoute = void 0;
|
|
2195
|
-
const match = findRouteMatch(trimmedPath, processedTree, true);
|
|
2196
|
-
if (match) {
|
|
2197
|
-
foundRoute = match.route;
|
|
2198
|
-
Object.assign(routeParams, match.rawParams);
|
|
2199
|
-
}
|
|
2200
|
-
return {
|
|
2201
|
-
matchedRoutes: match?.branch || [routesById["__root__"]],
|
|
2202
|
-
routeParams,
|
|
2203
|
-
foundRoute
|
|
2204
|
-
};
|
|
2205
|
-
}
|
|
2206
|
-
/**
|
|
2207
|
-
* TODO: once caches are persisted across requests on the server,
|
|
2208
|
-
* we can cache the built middleware chain using `last(destRoutes)` as the key
|
|
2209
|
-
*/
|
|
2210
|
-
function applySearchMiddleware({ search, dest, destRoutes, _includeValidateSearch }) {
|
|
2211
|
-
return buildMiddlewareChain(destRoutes)(search, dest, _includeValidateSearch ?? false);
|
|
2212
|
-
}
|
|
2213
|
-
function buildMiddlewareChain(destRoutes) {
|
|
2214
|
-
let dest;
|
|
2215
|
-
let includeValidateSearch;
|
|
2216
|
-
const middlewares = [];
|
|
2217
|
-
for (const route of destRoutes) {
|
|
2218
|
-
const routeOptions = route.options;
|
|
2219
|
-
if ("search" in routeOptions) {
|
|
2220
|
-
if (routeOptions.search?.middlewares) middlewares.push(...routeOptions.search.middlewares);
|
|
2221
|
-
} else if (routeOptions.preSearchFilters || routeOptions.postSearchFilters) {
|
|
2222
|
-
const legacyMiddleware = ({ search, next }) => {
|
|
2223
|
-
const result = next(routeOptions.preSearchFilters ? routeOptions.preSearchFilters.reduce((prev, next) => next(prev), search) : search);
|
|
2224
|
-
return routeOptions.postSearchFilters ? routeOptions.postSearchFilters.reduce((prev, next) => next(prev), result) : result;
|
|
2225
|
-
};
|
|
2226
|
-
middlewares.push(legacyMiddleware);
|
|
2227
|
-
}
|
|
2228
|
-
const routeValidateSearch = routeOptions.validateSearch;
|
|
2229
|
-
if (routeValidateSearch) {
|
|
2230
|
-
const validate = ({ search, next, meta }) => {
|
|
2231
|
-
const result = next(search);
|
|
2232
|
-
if (includeValidateSearch) try {
|
|
2233
|
-
const validated = validateSearch(routeValidateSearch, result);
|
|
2234
|
-
if (meta && validated) {
|
|
2235
|
-
for (const key in validated) if (!(key in result)) (meta.defaulted ||= /* @__PURE__ */ new Map()).set(key, validated[key]);
|
|
2236
|
-
}
|
|
2237
|
-
return {
|
|
2238
|
-
...result,
|
|
2239
|
-
...validated
|
|
2240
|
-
};
|
|
2241
|
-
} catch {}
|
|
2242
|
-
return result;
|
|
2243
|
-
};
|
|
2244
|
-
middlewares.push(validate);
|
|
2245
|
-
}
|
|
2246
|
-
}
|
|
2247
|
-
const applyNext = (index, currentSearch, meta) => {
|
|
2248
|
-
if (index >= middlewares.length) {
|
|
2249
|
-
if (!dest.search) return {};
|
|
2250
|
-
if (dest.search === true) return currentSearch;
|
|
2251
|
-
const result = functionalUpdate(dest.search, currentSearch);
|
|
2252
|
-
if (meta) meta.explicit = result;
|
|
2253
|
-
return result;
|
|
2254
|
-
}
|
|
2255
|
-
const next = (newSearch, collectMeta) => {
|
|
2256
|
-
if (collectMeta) {
|
|
2257
|
-
const nextMeta = meta || {};
|
|
2258
|
-
return {
|
|
2259
|
-
search: applyNext(index + 1, newSearch, nextMeta),
|
|
2260
|
-
meta: nextMeta
|
|
2261
|
-
};
|
|
2262
|
-
}
|
|
2263
|
-
return applyNext(index + 1, newSearch, meta);
|
|
2264
|
-
};
|
|
2265
|
-
return middlewares[index]({
|
|
2266
|
-
search: currentSearch,
|
|
2267
|
-
next,
|
|
2268
|
-
meta
|
|
2269
|
-
});
|
|
2270
|
-
};
|
|
2271
|
-
return function middleware(search, nextDest, _includeValidateSearch) {
|
|
2272
|
-
dest = nextDest;
|
|
2273
|
-
includeValidateSearch = _includeValidateSearch;
|
|
2274
|
-
return applyNext(0, search);
|
|
2275
|
-
};
|
|
2276
|
-
}
|
|
2277
|
-
function findGlobalNotFoundRouteId(notFoundMode, routes) {
|
|
2278
|
-
if (notFoundMode !== "root") for (let i = routes.length - 1; i >= 0; i--) {
|
|
2279
|
-
const route = routes[i];
|
|
2280
|
-
if (route.children) return route.id;
|
|
2281
|
-
}
|
|
2282
|
-
return rootRouteId;
|
|
2283
|
-
}
|
|
2284
|
-
function extractStrictParams(route, accumulatedParams) {
|
|
2285
|
-
const parseParams = route.options.params?.parse ?? route.options.parseParams;
|
|
2286
|
-
if (parseParams) {
|
|
2287
|
-
const result = parseParams(accumulatedParams);
|
|
2288
|
-
if (result === false) throw new Error("Route params.parse returned false for a matched route");
|
|
2289
|
-
Object.assign(accumulatedParams, result);
|
|
2290
|
-
}
|
|
2291
|
-
}
|
|
2292
|
-
//#endregion
|
|
2293
|
-
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.15/node_modules/@tanstack/router-core/dist/esm/manifest.js
|
|
2294
|
-
function getAssetCrossOrigin(assetCrossOrigin, kind) {
|
|
2295
|
-
if (!assetCrossOrigin) return;
|
|
2296
|
-
if (typeof assetCrossOrigin === "string") return assetCrossOrigin;
|
|
2297
|
-
return assetCrossOrigin[kind];
|
|
2298
|
-
}
|
|
2299
|
-
function getManifestScriptFormat(manifest) {
|
|
2300
|
-
return manifest?.scriptFormat ?? "module";
|
|
2301
|
-
}
|
|
2302
|
-
function getScriptPreloadAttrs(manifest, link, assetCrossOrigin) {
|
|
2303
|
-
const preloadLink = resolveManifestAssetLink(link);
|
|
2304
|
-
const crossOrigin = getAssetCrossOrigin(assetCrossOrigin, "script") ?? preloadLink.crossOrigin;
|
|
2305
|
-
return {
|
|
2306
|
-
...getManifestScriptFormat(manifest) === "iife" ? {
|
|
2307
|
-
rel: "preload",
|
|
2308
|
-
as: "script"
|
|
2309
|
-
} : { rel: "modulepreload" },
|
|
2310
|
-
href: preloadLink.href,
|
|
2311
|
-
...crossOrigin ? { crossOrigin } : {}
|
|
2312
|
-
};
|
|
2313
|
-
}
|
|
2314
|
-
function resolveManifestAssetLink(link) {
|
|
2315
|
-
if (typeof link === "string") return {
|
|
2316
|
-
href: link,
|
|
2317
|
-
crossOrigin: void 0
|
|
2318
|
-
};
|
|
2319
|
-
return link;
|
|
2320
|
-
}
|
|
2321
|
-
function appendUniqueUserTags(target, tags) {
|
|
2322
|
-
if (tags.length === 0) return;
|
|
2323
|
-
if (tags.length === 1) {
|
|
2324
|
-
target.push(tags[0]);
|
|
2325
|
-
return;
|
|
2326
|
-
}
|
|
2327
|
-
const seen = /* @__PURE__ */ new Set();
|
|
2328
|
-
for (const tag of tags) {
|
|
2329
|
-
const key = JSON.stringify(tag);
|
|
2330
|
-
if (seen.has(key)) continue;
|
|
2331
|
-
seen.add(key);
|
|
2332
|
-
target.push(tag);
|
|
2333
|
-
}
|
|
2334
|
-
}
|
|
2335
|
-
function getStylesheetHref(asset) {
|
|
2336
|
-
return resolveManifestCssLink(asset).href;
|
|
2337
|
-
}
|
|
2338
|
-
function resolveManifestCssLink(link) {
|
|
2339
|
-
if (typeof link === "string") return {
|
|
2340
|
-
href: link,
|
|
2341
|
-
crossOrigin: void 0
|
|
2342
|
-
};
|
|
2343
|
-
return link;
|
|
2344
|
-
}
|
|
2345
|
-
function createInlineCssStyleAsset(css) {
|
|
2346
|
-
return {
|
|
2347
|
-
attrs: { suppressHydrationWarning: true },
|
|
2348
|
-
children: css
|
|
2349
|
-
};
|
|
2350
|
-
}
|
|
2351
|
-
function createInlineCssPlaceholderAsset() {
|
|
2352
|
-
return { attrs: { suppressHydrationWarning: true } };
|
|
2353
|
-
}
|
|
2354
|
-
//#endregion
|
|
2355
|
-
//#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.18_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@tanstack/react-router/dist/esm/CatchBoundary.js
|
|
2356
|
-
var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
|
|
2357
|
-
var import_jsx_runtime = require_jsx_runtime();
|
|
2358
|
-
function CatchBoundary(props) {
|
|
2359
|
-
const errorComponent = props.errorComponent ?? ErrorComponent;
|
|
2360
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CatchBoundaryImpl, {
|
|
2361
|
-
getResetKey: props.getResetKey,
|
|
2362
|
-
onCatch: props.onCatch,
|
|
2363
|
-
children: ({ error, reset }) => {
|
|
2364
|
-
if (error) return import_react.createElement(errorComponent, {
|
|
2365
|
-
error,
|
|
2366
|
-
reset
|
|
2367
|
-
});
|
|
2368
|
-
return props.children;
|
|
2369
|
-
}
|
|
2370
|
-
});
|
|
2371
|
-
}
|
|
2372
|
-
var CatchBoundaryImpl = class extends import_react.Component {
|
|
2373
|
-
constructor(..._args) {
|
|
2374
|
-
super(..._args);
|
|
2375
|
-
this.state = { error: null };
|
|
2376
|
-
}
|
|
2377
|
-
static getDerivedStateFromProps(props, state) {
|
|
2378
|
-
const resetKey = props.getResetKey();
|
|
2379
|
-
if (state.error && state.resetKey !== resetKey) return {
|
|
2380
|
-
resetKey,
|
|
2381
|
-
error: null
|
|
2382
|
-
};
|
|
2383
|
-
return { resetKey };
|
|
2384
|
-
}
|
|
2385
|
-
static getDerivedStateFromError(error) {
|
|
2386
|
-
return { error };
|
|
2387
|
-
}
|
|
2388
|
-
reset() {
|
|
2389
|
-
this.setState({ error: null });
|
|
2390
|
-
}
|
|
2391
|
-
componentDidCatch(error, errorInfo) {
|
|
2392
|
-
if (this.props.onCatch) this.props.onCatch(error, errorInfo);
|
|
2393
|
-
}
|
|
2394
|
-
render() {
|
|
2395
|
-
return this.props.children({
|
|
2396
|
-
error: this.state.error,
|
|
2397
|
-
reset: () => {
|
|
2398
|
-
this.reset();
|
|
2399
|
-
}
|
|
2400
|
-
});
|
|
2401
|
-
}
|
|
2402
|
-
};
|
|
2403
|
-
function ErrorComponent({ error }) {
|
|
2404
|
-
const [show, setShow] = import_react.useState(false);
|
|
2405
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
2406
|
-
style: {
|
|
2407
|
-
padding: ".5rem",
|
|
2408
|
-
maxWidth: "100%"
|
|
2409
|
-
},
|
|
2410
|
-
children: [
|
|
2411
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
2412
|
-
style: {
|
|
2413
|
-
display: "flex",
|
|
2414
|
-
alignItems: "center",
|
|
2415
|
-
gap: ".5rem"
|
|
2416
|
-
},
|
|
2417
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", {
|
|
2418
|
-
style: { fontSize: "1rem" },
|
|
2419
|
-
children: "Something went wrong!"
|
|
2420
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
2421
|
-
style: {
|
|
2422
|
-
appearance: "none",
|
|
2423
|
-
fontSize: ".6em",
|
|
2424
|
-
border: "1px solid currentColor",
|
|
2425
|
-
padding: ".1rem .2rem",
|
|
2426
|
-
fontWeight: "bold",
|
|
2427
|
-
borderRadius: ".25rem"
|
|
2428
|
-
},
|
|
2429
|
-
onClick: () => setShow((d) => !d),
|
|
2430
|
-
children: show ? "Hide Error" : "Show Error"
|
|
2431
|
-
})]
|
|
2432
|
-
}),
|
|
2433
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { height: ".25rem" } }),
|
|
2434
|
-
show ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", {
|
|
2435
|
-
style: {
|
|
2436
|
-
fontSize: ".7em",
|
|
2437
|
-
border: "1px solid red",
|
|
2438
|
-
borderRadius: ".25rem",
|
|
2439
|
-
padding: ".3rem",
|
|
2440
|
-
color: "red",
|
|
2441
|
-
overflow: "auto"
|
|
2442
|
-
},
|
|
2443
|
-
children: error.message ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { children: error.message }) : null
|
|
2444
|
-
}) }) : null
|
|
2445
|
-
]
|
|
2446
|
-
});
|
|
2447
|
-
}
|
|
2448
|
-
//#endregion
|
|
2449
|
-
//#region ../../node_modules/.pnpm/@tanstack+store@0.9.3/node_modules/@tanstack/store/dist/esm/alien.js
|
|
2450
|
-
var ReactiveFlags = /* @__PURE__ */ ((ReactiveFlags2) => {
|
|
2451
|
-
ReactiveFlags2[ReactiveFlags2["None"] = 0] = "None";
|
|
2452
|
-
ReactiveFlags2[ReactiveFlags2["Mutable"] = 1] = "Mutable";
|
|
2453
|
-
ReactiveFlags2[ReactiveFlags2["Watching"] = 2] = "Watching";
|
|
2454
|
-
ReactiveFlags2[ReactiveFlags2["RecursedCheck"] = 4] = "RecursedCheck";
|
|
2455
|
-
ReactiveFlags2[ReactiveFlags2["Recursed"] = 8] = "Recursed";
|
|
2456
|
-
ReactiveFlags2[ReactiveFlags2["Dirty"] = 16] = "Dirty";
|
|
2457
|
-
ReactiveFlags2[ReactiveFlags2["Pending"] = 32] = "Pending";
|
|
2458
|
-
return ReactiveFlags2;
|
|
2459
|
-
})(ReactiveFlags || {});
|
|
2460
|
-
// @__NO_SIDE_EFFECTS__
|
|
2461
|
-
function createReactiveSystem({ update, notify, unwatched }) {
|
|
2462
|
-
return {
|
|
2463
|
-
link,
|
|
2464
|
-
unlink,
|
|
2465
|
-
propagate,
|
|
2466
|
-
checkDirty,
|
|
2467
|
-
shallowPropagate
|
|
2468
|
-
};
|
|
2469
|
-
function link(dep, sub, version) {
|
|
2470
|
-
const prevDep = sub.depsTail;
|
|
2471
|
-
if (prevDep !== void 0 && prevDep.dep === dep) return;
|
|
2472
|
-
const nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;
|
|
2473
|
-
if (nextDep !== void 0 && nextDep.dep === dep) {
|
|
2474
|
-
nextDep.version = version;
|
|
2475
|
-
sub.depsTail = nextDep;
|
|
2476
|
-
return;
|
|
2477
|
-
}
|
|
2478
|
-
const prevSub = dep.subsTail;
|
|
2479
|
-
if (prevSub !== void 0 && prevSub.version === version && prevSub.sub === sub) return;
|
|
2480
|
-
const newLink = sub.depsTail = dep.subsTail = {
|
|
2481
|
-
version,
|
|
2482
|
-
dep,
|
|
2483
|
-
sub,
|
|
2484
|
-
prevDep,
|
|
2485
|
-
nextDep,
|
|
2486
|
-
prevSub,
|
|
2487
|
-
nextSub: void 0
|
|
2488
|
-
};
|
|
2489
|
-
if (nextDep !== void 0) nextDep.prevDep = newLink;
|
|
2490
|
-
if (prevDep !== void 0) prevDep.nextDep = newLink;
|
|
2491
|
-
else sub.deps = newLink;
|
|
2492
|
-
if (prevSub !== void 0) prevSub.nextSub = newLink;
|
|
2493
|
-
else dep.subs = newLink;
|
|
2494
|
-
}
|
|
2495
|
-
function unlink(link2, sub = link2.sub) {
|
|
2496
|
-
const dep = link2.dep;
|
|
2497
|
-
const prevDep = link2.prevDep;
|
|
2498
|
-
const nextDep = link2.nextDep;
|
|
2499
|
-
const nextSub = link2.nextSub;
|
|
2500
|
-
const prevSub = link2.prevSub;
|
|
2501
|
-
if (nextDep !== void 0) nextDep.prevDep = prevDep;
|
|
2502
|
-
else sub.depsTail = prevDep;
|
|
2503
|
-
if (prevDep !== void 0) prevDep.nextDep = nextDep;
|
|
2504
|
-
else sub.deps = nextDep;
|
|
2505
|
-
if (nextSub !== void 0) nextSub.prevSub = prevSub;
|
|
2506
|
-
else dep.subsTail = prevSub;
|
|
2507
|
-
if (prevSub !== void 0) prevSub.nextSub = nextSub;
|
|
2508
|
-
else if ((dep.subs = nextSub) === void 0) unwatched(dep);
|
|
2509
|
-
return nextDep;
|
|
2510
|
-
}
|
|
2511
|
-
function propagate(link2) {
|
|
2512
|
-
let next = link2.nextSub;
|
|
2513
|
-
let stack;
|
|
2514
|
-
top: do {
|
|
2515
|
-
const sub = link2.sub;
|
|
2516
|
-
let flags = sub.flags;
|
|
2517
|
-
if (!(flags & 60)) sub.flags = flags | 32;
|
|
2518
|
-
else if (!(flags & 12)) flags = 0;
|
|
2519
|
-
else if (!(flags & 4)) sub.flags = flags & -9 | 32;
|
|
2520
|
-
else if (!(flags & 48) && isValidLink(link2, sub)) {
|
|
2521
|
-
sub.flags = flags | 40;
|
|
2522
|
-
flags &= 1;
|
|
2523
|
-
} else flags = 0;
|
|
2524
|
-
if (flags & 2) notify(sub);
|
|
2525
|
-
if (flags & 1) {
|
|
2526
|
-
const subSubs = sub.subs;
|
|
2527
|
-
if (subSubs !== void 0) {
|
|
2528
|
-
const nextSub = (link2 = subSubs).nextSub;
|
|
2529
|
-
if (nextSub !== void 0) {
|
|
2530
|
-
stack = {
|
|
2531
|
-
value: next,
|
|
2532
|
-
prev: stack
|
|
2533
|
-
};
|
|
2534
|
-
next = nextSub;
|
|
2535
|
-
}
|
|
2536
|
-
continue;
|
|
2537
|
-
}
|
|
2538
|
-
}
|
|
2539
|
-
if ((link2 = next) !== void 0) {
|
|
2540
|
-
next = link2.nextSub;
|
|
2541
|
-
continue;
|
|
2542
|
-
}
|
|
2543
|
-
while (stack !== void 0) {
|
|
2544
|
-
link2 = stack.value;
|
|
2545
|
-
stack = stack.prev;
|
|
2546
|
-
if (link2 !== void 0) {
|
|
2547
|
-
next = link2.nextSub;
|
|
2548
|
-
continue top;
|
|
2549
|
-
}
|
|
2550
|
-
}
|
|
2551
|
-
break;
|
|
2552
|
-
} while (true);
|
|
2553
|
-
}
|
|
2554
|
-
function checkDirty(link2, sub) {
|
|
2555
|
-
let stack;
|
|
2556
|
-
let checkDepth = 0;
|
|
2557
|
-
let dirty = false;
|
|
2558
|
-
top: do {
|
|
2559
|
-
const dep = link2.dep;
|
|
2560
|
-
const flags = dep.flags;
|
|
2561
|
-
if (sub.flags & 16) dirty = true;
|
|
2562
|
-
else if ((flags & 17) === 17) {
|
|
2563
|
-
if (update(dep)) {
|
|
2564
|
-
const subs = dep.subs;
|
|
2565
|
-
if (subs.nextSub !== void 0) shallowPropagate(subs);
|
|
2566
|
-
dirty = true;
|
|
2567
|
-
}
|
|
2568
|
-
} else if ((flags & 33) === 33) {
|
|
2569
|
-
if (link2.nextSub !== void 0 || link2.prevSub !== void 0) stack = {
|
|
2570
|
-
value: link2,
|
|
2571
|
-
prev: stack
|
|
2572
|
-
};
|
|
2573
|
-
link2 = dep.deps;
|
|
2574
|
-
sub = dep;
|
|
2575
|
-
++checkDepth;
|
|
2576
|
-
continue;
|
|
2577
|
-
}
|
|
2578
|
-
if (!dirty) {
|
|
2579
|
-
const nextDep = link2.nextDep;
|
|
2580
|
-
if (nextDep !== void 0) {
|
|
2581
|
-
link2 = nextDep;
|
|
2582
|
-
continue;
|
|
2583
|
-
}
|
|
2584
|
-
}
|
|
2585
|
-
while (checkDepth--) {
|
|
2586
|
-
const firstSub = sub.subs;
|
|
2587
|
-
const hasMultipleSubs = firstSub.nextSub !== void 0;
|
|
2588
|
-
if (hasMultipleSubs) {
|
|
2589
|
-
link2 = stack.value;
|
|
2590
|
-
stack = stack.prev;
|
|
2591
|
-
} else link2 = firstSub;
|
|
2592
|
-
if (dirty) {
|
|
2593
|
-
if (update(sub)) {
|
|
2594
|
-
if (hasMultipleSubs) shallowPropagate(firstSub);
|
|
2595
|
-
sub = link2.sub;
|
|
2596
|
-
continue;
|
|
2597
|
-
}
|
|
2598
|
-
dirty = false;
|
|
2599
|
-
} else sub.flags &= -33;
|
|
2600
|
-
sub = link2.sub;
|
|
2601
|
-
const nextDep = link2.nextDep;
|
|
2602
|
-
if (nextDep !== void 0) {
|
|
2603
|
-
link2 = nextDep;
|
|
2604
|
-
continue top;
|
|
2605
|
-
}
|
|
2606
|
-
}
|
|
2607
|
-
return dirty;
|
|
2608
|
-
} while (true);
|
|
2609
|
-
}
|
|
2610
|
-
function shallowPropagate(link2) {
|
|
2611
|
-
do {
|
|
2612
|
-
const sub = link2.sub;
|
|
2613
|
-
const flags = sub.flags;
|
|
2614
|
-
if ((flags & 48) === 32) {
|
|
2615
|
-
sub.flags = flags | 16;
|
|
2616
|
-
if ((flags & 6) === 2) notify(sub);
|
|
2617
|
-
}
|
|
2618
|
-
} while ((link2 = link2.nextSub) !== void 0);
|
|
2619
|
-
}
|
|
2620
|
-
function isValidLink(checkLink, sub) {
|
|
2621
|
-
let link2 = sub.depsTail;
|
|
2622
|
-
while (link2 !== void 0) {
|
|
2623
|
-
if (link2 === checkLink) return true;
|
|
2624
|
-
link2 = link2.prevDep;
|
|
2625
|
-
}
|
|
2626
|
-
return false;
|
|
2627
|
-
}
|
|
2628
|
-
}
|
|
2629
|
-
//#endregion
|
|
2630
|
-
//#region ../../node_modules/.pnpm/@tanstack+store@0.9.3/node_modules/@tanstack/store/dist/esm/atom.js
|
|
2631
|
-
function toObserver(nextHandler, errorHandler, completionHandler) {
|
|
2632
|
-
const isObserver = typeof nextHandler === "object";
|
|
2633
|
-
const self = isObserver ? nextHandler : void 0;
|
|
2634
|
-
return {
|
|
2635
|
-
next: (isObserver ? nextHandler.next : nextHandler)?.bind(self),
|
|
2636
|
-
error: (isObserver ? nextHandler.error : errorHandler)?.bind(self),
|
|
2637
|
-
complete: (isObserver ? nextHandler.complete : completionHandler)?.bind(self)
|
|
2638
|
-
};
|
|
2639
|
-
}
|
|
2640
|
-
var queuedEffects = [];
|
|
2641
|
-
var cycle = 0;
|
|
2642
|
-
var { link, unlink, propagate, checkDirty, shallowPropagate } = /* @__PURE__ */ createReactiveSystem({
|
|
2643
|
-
update(atom) {
|
|
2644
|
-
return atom._update();
|
|
2645
|
-
},
|
|
2646
|
-
notify(effect2) {
|
|
2647
|
-
queuedEffects[queuedEffectsLength++] = effect2;
|
|
2648
|
-
effect2.flags &= ~ReactiveFlags.Watching;
|
|
2649
|
-
},
|
|
2650
|
-
unwatched(atom) {
|
|
2651
|
-
if (atom.depsTail !== void 0) {
|
|
2652
|
-
atom.depsTail = void 0;
|
|
2653
|
-
atom.flags = ReactiveFlags.Mutable | ReactiveFlags.Dirty;
|
|
2654
|
-
purgeDeps(atom);
|
|
2655
|
-
}
|
|
2656
|
-
}
|
|
2657
|
-
});
|
|
2658
|
-
var notifyIndex = 0;
|
|
2659
|
-
var queuedEffectsLength = 0;
|
|
2660
|
-
var activeSub;
|
|
2661
|
-
var batchDepth = 0;
|
|
2662
|
-
function batch(fn) {
|
|
2663
|
-
try {
|
|
2664
|
-
++batchDepth;
|
|
2665
|
-
fn();
|
|
2666
|
-
} finally {
|
|
2667
|
-
if (!--batchDepth) flush();
|
|
2668
|
-
}
|
|
2669
|
-
}
|
|
2670
|
-
function purgeDeps(sub) {
|
|
2671
|
-
const depsTail = sub.depsTail;
|
|
2672
|
-
let dep = depsTail !== void 0 ? depsTail.nextDep : sub.deps;
|
|
2673
|
-
while (dep !== void 0) dep = unlink(dep, sub);
|
|
2674
|
-
}
|
|
2675
|
-
function flush() {
|
|
2676
|
-
if (batchDepth > 0) return;
|
|
2677
|
-
while (notifyIndex < queuedEffectsLength) {
|
|
2678
|
-
const effect2 = queuedEffects[notifyIndex];
|
|
2679
|
-
queuedEffects[notifyIndex++] = void 0;
|
|
2680
|
-
effect2.notify();
|
|
2681
|
-
}
|
|
2682
|
-
notifyIndex = 0;
|
|
2683
|
-
queuedEffectsLength = 0;
|
|
2684
|
-
}
|
|
2685
|
-
function createAtom(valueOrFn, options) {
|
|
2686
|
-
const isComputed = typeof valueOrFn === "function";
|
|
2687
|
-
const getter = valueOrFn;
|
|
2688
|
-
const atom = {
|
|
2689
|
-
_snapshot: isComputed ? void 0 : valueOrFn,
|
|
2690
|
-
subs: void 0,
|
|
2691
|
-
subsTail: void 0,
|
|
2692
|
-
deps: void 0,
|
|
2693
|
-
depsTail: void 0,
|
|
2694
|
-
flags: isComputed ? ReactiveFlags.None : ReactiveFlags.Mutable,
|
|
2695
|
-
get() {
|
|
2696
|
-
if (activeSub !== void 0) link(atom, activeSub, cycle);
|
|
2697
|
-
return atom._snapshot;
|
|
2698
|
-
},
|
|
2699
|
-
subscribe(observerOrFn) {
|
|
2700
|
-
const obs = toObserver(observerOrFn);
|
|
2701
|
-
const observed = { current: false };
|
|
2702
|
-
const e = effect(() => {
|
|
2703
|
-
atom.get();
|
|
2704
|
-
if (!observed.current) observed.current = true;
|
|
2705
|
-
else obs.next?.(atom._snapshot);
|
|
2706
|
-
});
|
|
2707
|
-
return { unsubscribe: () => {
|
|
2708
|
-
e.stop();
|
|
2709
|
-
} };
|
|
2710
|
-
},
|
|
2711
|
-
_update(getValue) {
|
|
2712
|
-
const prevSub = activeSub;
|
|
2713
|
-
const compare = options?.compare ?? Object.is;
|
|
2714
|
-
if (isComputed) {
|
|
2715
|
-
activeSub = atom;
|
|
2716
|
-
++cycle;
|
|
2717
|
-
atom.depsTail = void 0;
|
|
2718
|
-
} else if (getValue === void 0) return false;
|
|
2719
|
-
if (isComputed) atom.flags = ReactiveFlags.Mutable | ReactiveFlags.RecursedCheck;
|
|
2720
|
-
try {
|
|
2721
|
-
const oldValue = atom._snapshot;
|
|
2722
|
-
const newValue = typeof getValue === "function" ? getValue(oldValue) : getValue === void 0 && isComputed ? getter(oldValue) : getValue;
|
|
2723
|
-
if (oldValue === void 0 || !compare(oldValue, newValue)) {
|
|
2724
|
-
atom._snapshot = newValue;
|
|
2725
|
-
return true;
|
|
2726
|
-
}
|
|
2727
|
-
return false;
|
|
2728
|
-
} finally {
|
|
2729
|
-
activeSub = prevSub;
|
|
2730
|
-
if (isComputed) atom.flags &= ~ReactiveFlags.RecursedCheck;
|
|
2731
|
-
purgeDeps(atom);
|
|
2732
|
-
}
|
|
2733
|
-
}
|
|
2734
|
-
};
|
|
2735
|
-
if (isComputed) {
|
|
2736
|
-
atom.flags = ReactiveFlags.Mutable | ReactiveFlags.Dirty;
|
|
2737
|
-
atom.get = function() {
|
|
2738
|
-
const flags = atom.flags;
|
|
2739
|
-
if (flags & ReactiveFlags.Dirty || flags & ReactiveFlags.Pending && checkDirty(atom.deps, atom)) {
|
|
2740
|
-
if (atom._update()) {
|
|
2741
|
-
const subs = atom.subs;
|
|
2742
|
-
if (subs !== void 0) shallowPropagate(subs);
|
|
2743
|
-
}
|
|
2744
|
-
} else if (flags & ReactiveFlags.Pending) atom.flags = flags & ~ReactiveFlags.Pending;
|
|
2745
|
-
if (activeSub !== void 0) link(atom, activeSub, cycle);
|
|
2746
|
-
return atom._snapshot;
|
|
2747
|
-
};
|
|
2748
|
-
} else atom.set = function(valueOrFn2) {
|
|
2749
|
-
if (atom._update(valueOrFn2)) {
|
|
2750
|
-
const subs = atom.subs;
|
|
2751
|
-
if (subs !== void 0) {
|
|
2752
|
-
propagate(subs);
|
|
2753
|
-
shallowPropagate(subs);
|
|
2754
|
-
flush();
|
|
2755
|
-
}
|
|
2756
|
-
}
|
|
2757
|
-
};
|
|
2758
|
-
return atom;
|
|
2759
|
-
}
|
|
2760
|
-
function effect(fn) {
|
|
2761
|
-
const run = () => {
|
|
2762
|
-
const prevSub = activeSub;
|
|
2763
|
-
activeSub = effectObj;
|
|
2764
|
-
++cycle;
|
|
2765
|
-
effectObj.depsTail = void 0;
|
|
2766
|
-
effectObj.flags = ReactiveFlags.Watching | ReactiveFlags.RecursedCheck;
|
|
2767
|
-
try {
|
|
2768
|
-
return fn();
|
|
2769
|
-
} finally {
|
|
2770
|
-
activeSub = prevSub;
|
|
2771
|
-
effectObj.flags &= ~ReactiveFlags.RecursedCheck;
|
|
2772
|
-
purgeDeps(effectObj);
|
|
2773
|
-
}
|
|
2774
|
-
};
|
|
2775
|
-
const effectObj = {
|
|
2776
|
-
deps: void 0,
|
|
2777
|
-
depsTail: void 0,
|
|
2778
|
-
subs: void 0,
|
|
2779
|
-
subsTail: void 0,
|
|
2780
|
-
flags: ReactiveFlags.Watching | ReactiveFlags.RecursedCheck,
|
|
2781
|
-
notify() {
|
|
2782
|
-
const flags = this.flags;
|
|
2783
|
-
if (flags & ReactiveFlags.Dirty || flags & ReactiveFlags.Pending && checkDirty(this.deps, this)) run();
|
|
2784
|
-
else this.flags = ReactiveFlags.Watching;
|
|
2785
|
-
},
|
|
2786
|
-
stop() {
|
|
2787
|
-
this.flags = ReactiveFlags.None;
|
|
2788
|
-
this.depsTail = void 0;
|
|
2789
|
-
purgeDeps(this);
|
|
2790
|
-
}
|
|
2791
|
-
};
|
|
2792
|
-
run();
|
|
2793
|
-
return effectObj;
|
|
2794
|
-
}
|
|
2795
|
-
//#endregion
|
|
2796
|
-
//#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.18_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@tanstack/react-router/dist/esm/not-found.js
|
|
2797
|
-
function CatchNotFound(props) {
|
|
2798
|
-
const router = useRouter();
|
|
2799
|
-
{
|
|
2800
|
-
const resetKey = `not-found-${router.stores.location.get().pathname}-${router.stores.status.get()}`;
|
|
2801
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CatchBoundary, {
|
|
2802
|
-
getResetKey: () => resetKey,
|
|
2803
|
-
onCatch: (error, errorInfo) => {
|
|
2804
|
-
if (isNotFound(error)) props.onCatch?.(error, errorInfo);
|
|
2805
|
-
else throw error;
|
|
2806
|
-
},
|
|
2807
|
-
errorComponent: ({ error }) => {
|
|
2808
|
-
if (isNotFound(error)) return props.fallback?.(error);
|
|
2809
|
-
else throw error;
|
|
2810
|
-
},
|
|
2811
|
-
children: props.children
|
|
2812
|
-
});
|
|
2813
|
-
}
|
|
2814
|
-
const resetKey = `not-found-${useStore(router.stores.location, (location) => location.pathname)}-${useStore(router.stores.status, (status) => status)}`;
|
|
2815
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CatchBoundary, {
|
|
2816
|
-
getResetKey: () => resetKey,
|
|
2817
|
-
onCatch: (error, errorInfo) => {
|
|
2818
|
-
if (isNotFound(error)) props.onCatch?.(error, errorInfo);
|
|
2819
|
-
else throw error;
|
|
2820
|
-
},
|
|
2821
|
-
errorComponent: ({ error }) => {
|
|
2822
|
-
if (isNotFound(error)) return props.fallback?.(error);
|
|
2823
|
-
else throw error;
|
|
2824
|
-
},
|
|
2825
|
-
children: props.children
|
|
2826
|
-
});
|
|
2827
|
-
}
|
|
2828
|
-
function DefaultGlobalNotFound() {
|
|
2829
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "Not Found" });
|
|
2830
|
-
}
|
|
2831
|
-
//#endregion
|
|
2832
|
-
//#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.18_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@tanstack/react-router/dist/esm/ScriptOnce.js
|
|
2833
|
-
/**
|
|
2834
|
-
* Server-only helper to emit a script tag exactly once during SSR.
|
|
2835
|
-
*/
|
|
2836
|
-
function ScriptOnce({ children }) {
|
|
2837
|
-
const router = useRouter();
|
|
2838
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("script", {
|
|
2839
|
-
nonce: router.options.ssr?.nonce,
|
|
2840
|
-
dangerouslySetInnerHTML: { __html: children + ";document.currentScript.remove()" }
|
|
2841
|
-
});
|
|
2842
|
-
}
|
|
2843
|
-
//#endregion
|
|
2844
|
-
//#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.18_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@tanstack/react-router/dist/esm/SafeFragment.js
|
|
2845
|
-
function SafeFragment(props) {
|
|
2846
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: props.children });
|
|
2847
|
-
}
|
|
2848
|
-
//#endregion
|
|
2849
|
-
//#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.18_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@tanstack/react-router/dist/esm/renderRouteNotFound.js
|
|
2850
|
-
/**
|
|
2851
|
-
* Renders a not found component for a route when no matching route is found.
|
|
2852
|
-
*
|
|
2853
|
-
* @param router - The router instance containing the route configuration
|
|
2854
|
-
* @param route - The route that triggered the not found state
|
|
2855
|
-
* @param data - Additional data to pass to the not found component
|
|
2856
|
-
* @returns The rendered not found component or a default fallback component
|
|
2857
|
-
*/
|
|
2858
|
-
function renderRouteNotFound(router, route, data) {
|
|
2859
|
-
if (!route.options.notFoundComponent) {
|
|
2860
|
-
if (router.options.defaultNotFoundComponent) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(router.options.defaultNotFoundComponent, { ...data });
|
|
2861
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultGlobalNotFound, {});
|
|
2862
|
-
}
|
|
2863
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(route.options.notFoundComponent, { ...data });
|
|
2864
|
-
}
|
|
2865
|
-
//#endregion
|
|
2866
|
-
//#region ../../node_modules/.pnpm/@tanstack+router-core@1.171.15/node_modules/@tanstack/router-core/dist/esm/scroll-restoration-script/client.js
|
|
2867
|
-
function getScrollRestorationScriptForRouter(_router) {
|
|
2868
|
-
return null;
|
|
2869
|
-
}
|
|
2870
|
-
//#endregion
|
|
2871
|
-
//#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.18_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@tanstack/react-router/dist/esm/scroll-restoration.js
|
|
2872
|
-
function ScrollRestoration() {
|
|
2873
|
-
const script = getScrollRestorationScriptForRouter(useRouter());
|
|
2874
|
-
if (!script) return null;
|
|
2875
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ScriptOnce, { children: script });
|
|
2876
|
-
}
|
|
2877
|
-
//#endregion
|
|
2878
|
-
//#region ../../node_modules/.pnpm/@tanstack+react-router@1.170.18_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@tanstack/react-router/dist/esm/Match.js
|
|
2879
|
-
var matchViewFieldsEqual = (a, b) => a.routeId === b.routeId && a._displayPending === b._displayPending;
|
|
2880
|
-
var Match = import_react.memo(function MatchImpl({ matchId }) {
|
|
2881
|
-
const router = useRouter();
|
|
2882
|
-
{
|
|
2883
|
-
const match = router.stores.matchStores.get(matchId)?.get();
|
|
2884
|
-
if (!match) invariant();
|
|
2885
|
-
const routeId = match.routeId;
|
|
2886
|
-
const parentRouteId = router.routesById[routeId].parentRoute?.id;
|
|
2887
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MatchView, {
|
|
2888
|
-
router,
|
|
2889
|
-
matchId,
|
|
2890
|
-
resetKey: router.stores.loadedAt.get(),
|
|
2891
|
-
matchState: {
|
|
2892
|
-
routeId,
|
|
2893
|
-
ssr: match.ssr,
|
|
2894
|
-
_displayPending: match._displayPending,
|
|
2895
|
-
parentRouteId
|
|
2896
|
-
}
|
|
2897
|
-
});
|
|
2898
|
-
}
|
|
2899
|
-
const matchStore = router.stores.matchStores.get(matchId);
|
|
2900
|
-
if (!matchStore) invariant();
|
|
2901
|
-
const resetKey = useStore(router.stores.loadedAt, (loadedAt) => loadedAt);
|
|
2902
|
-
const match = useStore(matchStore, (value) => value, matchViewFieldsEqual);
|
|
2903
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MatchView, {
|
|
2904
|
-
router,
|
|
2905
|
-
matchId,
|
|
2906
|
-
resetKey,
|
|
2907
|
-
matchState: import_react.useMemo(() => {
|
|
2908
|
-
const routeId = match.routeId;
|
|
2909
|
-
const parentRouteId = router.routesById[routeId].parentRoute?.id;
|
|
2910
|
-
return {
|
|
2911
|
-
routeId,
|
|
2912
|
-
ssr: match.ssr,
|
|
2913
|
-
_displayPending: match._displayPending,
|
|
2914
|
-
parentRouteId
|
|
2915
|
-
};
|
|
2916
|
-
}, [
|
|
2917
|
-
match._displayPending,
|
|
2918
|
-
match.routeId,
|
|
2919
|
-
match.ssr,
|
|
2920
|
-
router.routesById
|
|
2921
|
-
])
|
|
2922
|
-
});
|
|
2923
|
-
});
|
|
2924
|
-
function MatchView({ router, matchId, resetKey, matchState }) {
|
|
2925
|
-
const route = router.routesById[matchState.routeId];
|
|
2926
|
-
const PendingComponent = route.options.pendingComponent ?? router.options.defaultPendingComponent;
|
|
2927
|
-
const pendingElement = PendingComponent ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PendingComponent, {}) : null;
|
|
2928
|
-
const routeErrorComponent = route.options.errorComponent ?? router.options.defaultErrorComponent;
|
|
2929
|
-
const routeOnCatch = route.options.onCatch ?? router.options.defaultOnCatch;
|
|
2930
|
-
const routeNotFoundComponent = route.isRoot ? route.options.notFoundComponent ?? router.options.notFoundRoute?.options.component : route.options.notFoundComponent;
|
|
2931
|
-
const resolvedNoSsr = matchState.ssr === false || matchState.ssr === "data-only";
|
|
2932
|
-
const ResolvedSuspenseBoundary = (!route.isRoot || route.options.wrapInSuspense || resolvedNoSsr) && (route.options.wrapInSuspense ?? PendingComponent ?? (route.options.errorComponent?.preload || resolvedNoSsr)) ? import_react.Suspense : SafeFragment;
|
|
2933
|
-
const ResolvedCatchBoundary = routeErrorComponent ? CatchBoundary : SafeFragment;
|
|
2934
|
-
const ResolvedNotFoundBoundary = routeNotFoundComponent ? CatchNotFound : SafeFragment;
|
|
2935
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(route.isRoot ? route.options.shellComponent ?? SafeFragment : SafeFragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(matchContext.Provider, {
|
|
2936
|
-
value: matchId,
|
|
2937
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ResolvedSuspenseBoundary, {
|
|
2938
|
-
fallback: pendingElement,
|
|
2939
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ResolvedCatchBoundary, {
|
|
2940
|
-
getResetKey: () => resetKey,
|
|
2941
|
-
errorComponent: routeErrorComponent || ErrorComponent,
|
|
2942
|
-
onCatch: (error, errorInfo) => {
|
|
2943
|
-
if (isNotFound(error)) {
|
|
2944
|
-
error.routeId ??= matchState.routeId;
|
|
2945
|
-
throw error;
|
|
2946
|
-
}
|
|
2947
|
-
routeOnCatch?.(error, errorInfo);
|
|
2948
|
-
},
|
|
2949
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ResolvedNotFoundBoundary, {
|
|
2950
|
-
fallback: (error) => {
|
|
2951
|
-
error.routeId ??= matchState.routeId;
|
|
2952
|
-
if (!routeNotFoundComponent || error.routeId && error.routeId !== matchState.routeId || !error.routeId && !route.isRoot) throw error;
|
|
2953
|
-
return import_react.createElement(routeNotFoundComponent, error);
|
|
2954
|
-
},
|
|
2955
|
-
children: resolvedNoSsr || matchState._displayPending ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ClientOnly, {
|
|
2956
|
-
fallback: pendingElement,
|
|
2957
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MatchInner, { matchId })
|
|
2958
|
-
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MatchInner, { matchId })
|
|
2959
|
-
})
|
|
2960
|
-
})
|
|
2961
|
-
})
|
|
2962
|
-
}), matchState.parentRouteId === "__root__" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(OnRendered, {}), router.options.scrollRestoration && true ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ScrollRestoration, {}) : null] }) : null] });
|
|
2963
|
-
}
|
|
2964
|
-
function OnRendered() {
|
|
2965
|
-
useRouter();
|
|
2966
|
-
return null;
|
|
2967
|
-
}
|
|
2968
|
-
var MatchInner = import_react.memo(function MatchInnerImpl({ matchId }) {
|
|
2969
|
-
const router = useRouter();
|
|
2970
|
-
const getMatchPromise = (match, key) => {
|
|
2971
|
-
return router.getMatch(match.id)?._nonReactive[key] ?? match._nonReactive[key];
|
|
2972
|
-
};
|
|
2973
|
-
{
|
|
2974
|
-
const match = router.stores.matchStores.get(matchId)?.get();
|
|
2975
|
-
if (!match) invariant();
|
|
2976
|
-
const routeId = match.routeId;
|
|
2977
|
-
const route = router.routesById[routeId];
|
|
2978
|
-
const remountDeps = (router.routesById[routeId].options.remountDeps ?? router.options.defaultRemountDeps)?.({
|
|
2979
|
-
routeId,
|
|
2980
|
-
loaderDeps: match.loaderDeps,
|
|
2981
|
-
params: match._strictParams,
|
|
2982
|
-
search: match._strictSearch
|
|
2983
|
-
});
|
|
2984
|
-
const key = remountDeps ? JSON.stringify(remountDeps) : void 0;
|
|
2985
|
-
const Comp = route.options.component ?? router.options.defaultComponent;
|
|
2986
|
-
const out = Comp ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Comp, {}, key) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Outlet, {});
|
|
2987
|
-
if (match._displayPending) throw getMatchPromise(match, "displayPendingPromise");
|
|
2988
|
-
if (match._forcePending) throw getMatchPromise(match, "minPendingPromise");
|
|
2989
|
-
if (match.status === "pending") throw getMatchPromise(match, "loadPromise");
|
|
2990
|
-
if (match.status === "notFound") {
|
|
2991
|
-
if (!isNotFound(match.error)) invariant();
|
|
2992
|
-
return renderRouteNotFound(router, route, match.error);
|
|
2993
|
-
}
|
|
2994
|
-
if (match.status === "redirected") {
|
|
2995
|
-
if (!isRedirect(match.error)) invariant();
|
|
2996
|
-
throw getMatchPromise(match, "loadPromise");
|
|
2997
|
-
}
|
|
2998
|
-
if (match.status === "error") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)((route.options.errorComponent ?? router.options.defaultErrorComponent) || ErrorComponent, {
|
|
2999
|
-
error: match.error,
|
|
3000
|
-
reset: void 0,
|
|
3001
|
-
info: { componentStack: "" }
|
|
3002
|
-
});
|
|
3003
|
-
return out;
|
|
3004
|
-
}
|
|
3005
|
-
const matchStore = router.stores.matchStores.get(matchId);
|
|
3006
|
-
if (!matchStore) invariant();
|
|
3007
|
-
const match = useStore(matchStore, (value) => value);
|
|
3008
|
-
const routeId = match.routeId;
|
|
3009
|
-
const route = router.routesById[routeId];
|
|
3010
|
-
const key = import_react.useMemo(() => {
|
|
3011
|
-
const remountDeps = (router.routesById[routeId].options.remountDeps ?? router.options.defaultRemountDeps)?.({
|
|
3012
|
-
routeId,
|
|
3013
|
-
loaderDeps: match.loaderDeps,
|
|
3014
|
-
params: match._strictParams,
|
|
3015
|
-
search: match._strictSearch
|
|
3016
|
-
});
|
|
3017
|
-
return remountDeps ? JSON.stringify(remountDeps) : void 0;
|
|
3018
|
-
}, [
|
|
3019
|
-
routeId,
|
|
3020
|
-
match.loaderDeps,
|
|
3021
|
-
match._strictParams,
|
|
3022
|
-
match._strictSearch,
|
|
3023
|
-
router.options.defaultRemountDeps,
|
|
3024
|
-
router.routesById
|
|
3025
|
-
]);
|
|
3026
|
-
const out = import_react.useMemo(() => {
|
|
3027
|
-
const Comp = route.options.component ?? router.options.defaultComponent;
|
|
3028
|
-
if (Comp) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Comp, {}, key);
|
|
3029
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Outlet, {});
|
|
3030
|
-
}, [
|
|
3031
|
-
key,
|
|
3032
|
-
route.options.component,
|
|
3033
|
-
router.options.defaultComponent
|
|
3034
|
-
]);
|
|
3035
|
-
if (match._displayPending) throw getMatchPromise(match, "displayPendingPromise");
|
|
3036
|
-
if (match._forcePending) throw getMatchPromise(match, "minPendingPromise");
|
|
3037
|
-
if (match.status === "pending") {
|
|
3038
|
-
if (route.options.pendingMinMs ?? router.options.defaultPendingMinMs) {
|
|
3039
|
-
const routerMatch = router.getMatch(match.id);
|
|
3040
|
-
if (routerMatch && !routerMatch._nonReactive.minPendingPromise) {}
|
|
3041
|
-
}
|
|
3042
|
-
throw getMatchPromise(match, "loadPromise");
|
|
3043
|
-
}
|
|
3044
|
-
if (match.status === "notFound") {
|
|
3045
|
-
if (!isNotFound(match.error)) invariant();
|
|
3046
|
-
return renderRouteNotFound(router, route, match.error);
|
|
3047
|
-
}
|
|
3048
|
-
if (match.status === "redirected") {
|
|
3049
|
-
if (!isRedirect(match.error)) invariant();
|
|
3050
|
-
throw getMatchPromise(match, "loadPromise");
|
|
3051
|
-
}
|
|
3052
|
-
if (match.status === "error") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)((route.options.errorComponent ?? router.options.defaultErrorComponent) || ErrorComponent, {
|
|
3053
|
-
error: match.error,
|
|
3054
|
-
reset: void 0,
|
|
3055
|
-
info: { componentStack: "" }
|
|
3056
|
-
});
|
|
3057
|
-
return out;
|
|
3058
|
-
});
|
|
3059
|
-
/**
|
|
3060
|
-
* Render the next child match in the route tree. Typically used inside
|
|
3061
|
-
* a route component to render nested routes.
|
|
3062
|
-
*
|
|
3063
|
-
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/outletComponent
|
|
3064
|
-
*/
|
|
3065
|
-
var Outlet = import_react.memo(function OutletImpl() {
|
|
3066
|
-
const router = useRouter();
|
|
3067
|
-
const matchId = import_react.useContext(matchContext);
|
|
3068
|
-
let routeId;
|
|
3069
|
-
let parentGlobalNotFound = false;
|
|
3070
|
-
let childMatchId;
|
|
3071
|
-
{
|
|
3072
|
-
const matches = router.stores.matches.get();
|
|
3073
|
-
const parentIndex = matchId ? matches.findIndex((match) => match.id === matchId) : -1;
|
|
3074
|
-
const parentMatch = parentIndex >= 0 ? matches[parentIndex] : void 0;
|
|
3075
|
-
routeId = parentMatch?.routeId;
|
|
3076
|
-
parentGlobalNotFound = parentMatch?.globalNotFound ?? false;
|
|
3077
|
-
childMatchId = parentIndex >= 0 ? matches[parentIndex + 1]?.id : void 0;
|
|
3078
|
-
}
|
|
3079
|
-
const route = routeId ? router.routesById[routeId] : void 0;
|
|
3080
|
-
const pendingElement = router.options.defaultPendingComponent ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(router.options.defaultPendingComponent, {}) : null;
|
|
3081
|
-
if (parentGlobalNotFound) {
|
|
3082
|
-
if (!route) invariant();
|
|
3083
|
-
return renderRouteNotFound(router, route, void 0);
|
|
3084
|
-
}
|
|
3085
|
-
if (!childMatchId) return null;
|
|
3086
|
-
const nextMatch = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Match, { matchId: childMatchId });
|
|
3087
|
-
if (routeId === "__root__") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Suspense, {
|
|
3088
|
-
fallback: pendingElement,
|
|
3089
|
-
children: nextMatch
|
|
3090
|
-
});
|
|
3091
|
-
return nextMatch;
|
|
3092
|
-
});
|
|
3093
|
-
//#endregion
|
|
3094
|
-
//#region ../../node_modules/.pnpm/@tanstack+start-storage-context@1.167.17/node_modules/@tanstack/start-storage-context/dist/esm/async-local-storage.js
|
|
3095
|
-
var GLOBAL_STORAGE_KEY = Symbol.for("tanstack-start:start-storage-context");
|
|
3096
|
-
var globalObj = globalThis;
|
|
3097
|
-
if (!globalObj[GLOBAL_STORAGE_KEY]) globalObj[GLOBAL_STORAGE_KEY] = new AsyncLocalStorage();
|
|
3098
|
-
var startStorage = globalObj[GLOBAL_STORAGE_KEY];
|
|
3099
|
-
async function runWithStartContext(context, fn) {
|
|
3100
|
-
return startStorage.run(context, fn);
|
|
3101
|
-
}
|
|
3102
|
-
function getStartContext(opts) {
|
|
3103
|
-
const context = startStorage.getStore();
|
|
3104
|
-
if (!context && opts?.throwIfNotFound !== false) throw new Error(`No Start context found in AsyncLocalStorage. Make sure you are using the function within the server runtime.`);
|
|
3105
|
-
return context;
|
|
3106
|
-
}
|
|
3107
|
-
//#endregion
|
|
3108
|
-
export { createNonReactiveReadonlyStore as C, createNonReactiveMutableStore as S, isNotFound as T, resolveManifestAssetLink as _, SafeFragment as a, getLocationChangeInfo as b, createAtom as c, appendUniqueUserTags as d, createInlineCssPlaceholderAsset as f, getStylesheetHref as g, getScriptPreloadAttrs as h, Outlet as i, CatchBoundary as l, getAssetCrossOrigin as m, runWithStartContext as n, ScriptOnce as o, createInlineCssStyleAsset as p, Match as r, batch as s, getStartContext as t, ErrorComponent as u, resolveManifestCssLink as v, executeRewriteInput as w, createMemoryHistory as x, RouterCore as y };
|