likec4 1.20.1 → 1.20.3
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/__app__/src/chunks/{-index-overview-B8Ngh4J7.js → -index-overview-TebwYeV7.js} +4 -4
- package/__app__/src/chunks/{index-KI-kE60c.js → index-DrdkNxpF.js} +14 -14
- package/__app__/src/chunks/likec4-D8rQPdul.js +6104 -0
- package/__app__/src/chunks/{main-DwHOiMDD.js → main-DSlxn73B.js} +10801 -10507
- package/__app__/src/chunks/{mantine-B9NZkjVg.js → mantine-D3AsIG-5.js} +740 -740
- package/__app__/src/chunks/tanstack-router-BE0xJAYp.js +3032 -0
- package/__app__/src/main.js +1 -1
- package/__app__/src/style.css +1 -1
- package/__app__/webcomponent/webcomponent.js +5638 -5261
- package/dist/chunks/prompt.cjs +40 -40
- package/dist/chunks/prompt.mjs +42 -42
- package/dist/cli/index.cjs +70 -68
- package/dist/cli/index.mjs +109 -107
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +56 -645
- package/dist/index.d.mts +56 -645
- package/dist/index.d.ts +56 -645
- package/dist/index.mjs +1 -1
- package/dist/shared/likec4.32ndthTo.cjs +1855 -0
- package/dist/shared/likec4.BgEQuI_b.mjs +1855 -0
- package/package.json +25 -22
- package/react/index.d.ts +47 -5
- package/react/index.js +5404 -5019
- package/react/style.css +1 -1
- package/__app__/src/chunks/likec4-CK8zVxjc.js +0 -6069
- package/__app__/src/chunks/tanstack-router-B9I-d36d.js +0 -3032
- package/dist/shared/likec4.Buej2FfJ.mjs +0 -1857
- package/dist/shared/likec4.pZxbrzrY.cjs +0 -1857
|
@@ -0,0 +1,3032 @@
|
|
|
1
|
+
import { jsxs as et, jsx as C, Fragment as Ft } from "react/jsx-runtime";
|
|
2
|
+
import * as b from "react";
|
|
3
|
+
import vt, { useRef as Tt } from "react";
|
|
4
|
+
import { flushSync as Bt } from "react-dom";
|
|
5
|
+
const de = "__TSR_index", dt = "popstate", ht = "beforeunload";
|
|
6
|
+
function St(t) {
|
|
7
|
+
let n = t.getLocation();
|
|
8
|
+
const e = /* @__PURE__ */ new Set(), r = (i) => {
|
|
9
|
+
n = t.getLocation(), e.forEach((a) => a({ location: n, action: i }));
|
|
10
|
+
}, o = (i) => {
|
|
11
|
+
t.notifyOnIndexChange ?? !0 ? r(i) : n = t.getLocation();
|
|
12
|
+
}, s = async ({
|
|
13
|
+
task: i,
|
|
14
|
+
navigateOpts: a,
|
|
15
|
+
...l
|
|
16
|
+
}) => {
|
|
17
|
+
var c, d;
|
|
18
|
+
if (a?.ignoreBlocker ?? !1) {
|
|
19
|
+
i();
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const h = ((c = t.getBlockers) == null ? void 0 : c.call(t)) ?? [], f = l.type === "PUSH" || l.type === "REPLACE";
|
|
23
|
+
if (typeof document < "u" && h.length && f)
|
|
24
|
+
for (const p of h) {
|
|
25
|
+
const S = ve(l.path, l.state);
|
|
26
|
+
if (await p.blockerFn({
|
|
27
|
+
currentLocation: n,
|
|
28
|
+
nextLocation: S,
|
|
29
|
+
action: l.type
|
|
30
|
+
})) {
|
|
31
|
+
(d = t.onBlocked) == null || d.call(t);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
i();
|
|
36
|
+
};
|
|
37
|
+
return {
|
|
38
|
+
get location() {
|
|
39
|
+
return n;
|
|
40
|
+
},
|
|
41
|
+
get length() {
|
|
42
|
+
return t.getLength();
|
|
43
|
+
},
|
|
44
|
+
subscribers: e,
|
|
45
|
+
subscribe: (i) => (e.add(i), () => {
|
|
46
|
+
e.delete(i);
|
|
47
|
+
}),
|
|
48
|
+
push: (i, a, l) => {
|
|
49
|
+
const c = n.state[de];
|
|
50
|
+
a = tt(c + 1, a), s({
|
|
51
|
+
task: () => {
|
|
52
|
+
t.pushState(i, a), r({ type: "PUSH" });
|
|
53
|
+
},
|
|
54
|
+
navigateOpts: l,
|
|
55
|
+
type: "PUSH",
|
|
56
|
+
path: i,
|
|
57
|
+
state: a
|
|
58
|
+
});
|
|
59
|
+
},
|
|
60
|
+
replace: (i, a, l) => {
|
|
61
|
+
const c = n.state[de];
|
|
62
|
+
a = tt(c, a), s({
|
|
63
|
+
task: () => {
|
|
64
|
+
t.replaceState(i, a), r({ type: "REPLACE" });
|
|
65
|
+
},
|
|
66
|
+
navigateOpts: l,
|
|
67
|
+
type: "REPLACE",
|
|
68
|
+
path: i,
|
|
69
|
+
state: a
|
|
70
|
+
});
|
|
71
|
+
},
|
|
72
|
+
go: (i, a) => {
|
|
73
|
+
s({
|
|
74
|
+
task: () => {
|
|
75
|
+
t.go(i), o({ type: "GO", index: i });
|
|
76
|
+
},
|
|
77
|
+
navigateOpts: a,
|
|
78
|
+
type: "GO"
|
|
79
|
+
});
|
|
80
|
+
},
|
|
81
|
+
back: (i) => {
|
|
82
|
+
s({
|
|
83
|
+
task: () => {
|
|
84
|
+
t.back(i?.ignoreBlocker ?? !1), o({ type: "BACK" });
|
|
85
|
+
},
|
|
86
|
+
navigateOpts: i,
|
|
87
|
+
type: "BACK"
|
|
88
|
+
});
|
|
89
|
+
},
|
|
90
|
+
forward: (i) => {
|
|
91
|
+
s({
|
|
92
|
+
task: () => {
|
|
93
|
+
t.forward(i?.ignoreBlocker ?? !1), o({ type: "FORWARD" });
|
|
94
|
+
},
|
|
95
|
+
navigateOpts: i,
|
|
96
|
+
type: "FORWARD"
|
|
97
|
+
});
|
|
98
|
+
},
|
|
99
|
+
canGoBack: () => n.state[de] !== 0,
|
|
100
|
+
createHref: (i) => t.createHref(i),
|
|
101
|
+
block: (i) => {
|
|
102
|
+
var a;
|
|
103
|
+
if (!t.setBlockers) return () => {
|
|
104
|
+
};
|
|
105
|
+
const l = ((a = t.getBlockers) == null ? void 0 : a.call(t)) ?? [];
|
|
106
|
+
return t.setBlockers([...l, i]), () => {
|
|
107
|
+
var c, d;
|
|
108
|
+
const u = ((c = t.getBlockers) == null ? void 0 : c.call(t)) ?? [];
|
|
109
|
+
(d = t.setBlockers) == null || d.call(t, u.filter((h) => h !== i));
|
|
110
|
+
};
|
|
111
|
+
},
|
|
112
|
+
flush: () => {
|
|
113
|
+
var i;
|
|
114
|
+
return (i = t.flush) == null ? void 0 : i.call(t);
|
|
115
|
+
},
|
|
116
|
+
destroy: () => {
|
|
117
|
+
var i;
|
|
118
|
+
return (i = t.destroy) == null ? void 0 : i.call(t);
|
|
119
|
+
},
|
|
120
|
+
notify: r
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function tt(t, n) {
|
|
124
|
+
return n || (n = {}), {
|
|
125
|
+
...n,
|
|
126
|
+
key: Ot(),
|
|
127
|
+
[de]: t
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function _t(t) {
|
|
131
|
+
const n = t?.window ?? (typeof document < "u" ? window : void 0), e = n.history.pushState, r = n.history.replaceState;
|
|
132
|
+
let o = [];
|
|
133
|
+
const s = () => o, i = (v) => o = v, a = t?.createHref ?? ((v) => v), l = t?.parseLocation ?? (() => ve(
|
|
134
|
+
`${n.location.pathname}${n.location.search}${n.location.hash}`,
|
|
135
|
+
n.history.state
|
|
136
|
+
));
|
|
137
|
+
let c = l(), d, u = !1, h = !1, f = !1, p = !1;
|
|
138
|
+
const S = () => c;
|
|
139
|
+
let y, M;
|
|
140
|
+
const R = () => {
|
|
141
|
+
y && (F._ignoreSubscribers = !0, (y.isPush ? n.history.pushState : n.history.replaceState)(
|
|
142
|
+
y.state,
|
|
143
|
+
"",
|
|
144
|
+
y.href
|
|
145
|
+
), F._ignoreSubscribers = !1, y = void 0, M = void 0, d = void 0);
|
|
146
|
+
}, L = (v, _, E) => {
|
|
147
|
+
const m = a(_);
|
|
148
|
+
M || (d = c), c = ve(_, E), y = {
|
|
149
|
+
href: m,
|
|
150
|
+
state: E,
|
|
151
|
+
isPush: y?.isPush || v === "push"
|
|
152
|
+
}, M || (M = Promise.resolve().then(() => R()));
|
|
153
|
+
}, P = (v) => {
|
|
154
|
+
c = l(), F.notify({ type: v });
|
|
155
|
+
}, g = async () => {
|
|
156
|
+
if (h) {
|
|
157
|
+
h = !1;
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
const v = l(), _ = v.state[de] - c.state[de], E = _ === 1, m = _ === -1, w = !E && !m || u;
|
|
161
|
+
u = !1;
|
|
162
|
+
const k = w ? "GO" : m ? "BACK" : "FORWARD", T = w ? {
|
|
163
|
+
type: "GO",
|
|
164
|
+
index: _
|
|
165
|
+
} : {
|
|
166
|
+
type: m ? "BACK" : "FORWARD"
|
|
167
|
+
};
|
|
168
|
+
if (f)
|
|
169
|
+
f = !1;
|
|
170
|
+
else {
|
|
171
|
+
const I = s();
|
|
172
|
+
if (typeof document < "u" && I.length) {
|
|
173
|
+
for (const D of I)
|
|
174
|
+
if (await D.blockerFn({
|
|
175
|
+
currentLocation: c,
|
|
176
|
+
nextLocation: v,
|
|
177
|
+
action: k
|
|
178
|
+
})) {
|
|
179
|
+
h = !0, n.history.go(1), F.notify(T);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
c = l(), F.notify(T);
|
|
185
|
+
}, x = (v) => {
|
|
186
|
+
if (p) {
|
|
187
|
+
p = !1;
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
let _ = !1;
|
|
191
|
+
const E = s();
|
|
192
|
+
if (typeof document < "u" && E.length)
|
|
193
|
+
for (const m of E) {
|
|
194
|
+
const w = m.enableBeforeUnload ?? !0;
|
|
195
|
+
if (w === !0) {
|
|
196
|
+
_ = !0;
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
if (typeof w == "function" && w() === !0) {
|
|
200
|
+
_ = !0;
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
if (_)
|
|
205
|
+
return v.preventDefault(), v.returnValue = "";
|
|
206
|
+
}, F = St({
|
|
207
|
+
getLocation: S,
|
|
208
|
+
getLength: () => n.history.length,
|
|
209
|
+
pushState: (v, _) => L("push", v, _),
|
|
210
|
+
replaceState: (v, _) => L("replace", v, _),
|
|
211
|
+
back: (v) => (v && (f = !0), p = !0, n.history.back()),
|
|
212
|
+
forward: (v) => {
|
|
213
|
+
v && (f = !0), p = !0, n.history.forward();
|
|
214
|
+
},
|
|
215
|
+
go: (v) => {
|
|
216
|
+
u = !0, n.history.go(v);
|
|
217
|
+
},
|
|
218
|
+
createHref: (v) => a(v),
|
|
219
|
+
flush: R,
|
|
220
|
+
destroy: () => {
|
|
221
|
+
n.history.pushState = e, n.history.replaceState = r, n.removeEventListener(ht, x, {
|
|
222
|
+
capture: !0
|
|
223
|
+
}), n.removeEventListener(dt, g);
|
|
224
|
+
},
|
|
225
|
+
onBlocked: () => {
|
|
226
|
+
d && c !== d && (c = d);
|
|
227
|
+
},
|
|
228
|
+
getBlockers: s,
|
|
229
|
+
setBlockers: i,
|
|
230
|
+
notifyOnIndexChange: !1
|
|
231
|
+
});
|
|
232
|
+
return n.addEventListener(ht, x, { capture: !0 }), n.addEventListener(dt, g), n.history.pushState = function(...v) {
|
|
233
|
+
const _ = e.apply(n.history, v);
|
|
234
|
+
return F._ignoreSubscribers || P("PUSH"), _;
|
|
235
|
+
}, n.history.replaceState = function(...v) {
|
|
236
|
+
const _ = r.apply(n.history, v);
|
|
237
|
+
return F._ignoreSubscribers || P("REPLACE"), _;
|
|
238
|
+
}, F;
|
|
239
|
+
}
|
|
240
|
+
function rr(t) {
|
|
241
|
+
const n = typeof document < "u" ? window : void 0;
|
|
242
|
+
return _t({
|
|
243
|
+
window: n,
|
|
244
|
+
parseLocation: () => {
|
|
245
|
+
const e = n.location.hash.split("#").slice(1).join("#") ?? "/";
|
|
246
|
+
return ve(e, n.history.state);
|
|
247
|
+
},
|
|
248
|
+
createHref: (e) => `${n.location.pathname}${n.location.search}#${e}`
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
function Dt(t = {
|
|
252
|
+
initialEntries: ["/"]
|
|
253
|
+
}) {
|
|
254
|
+
const n = t.initialEntries;
|
|
255
|
+
let e = t.initialIndex ? Math.min(Math.max(t.initialIndex, 0), n.length - 1) : n.length - 1;
|
|
256
|
+
const r = n.map(
|
|
257
|
+
(s, i) => tt(i, void 0)
|
|
258
|
+
);
|
|
259
|
+
return St({
|
|
260
|
+
getLocation: () => ve(n[e], r[e]),
|
|
261
|
+
getLength: () => n.length,
|
|
262
|
+
pushState: (s, i) => {
|
|
263
|
+
e < n.length - 1 && (n.splice(e + 1), r.splice(e + 1)), r.push(i), n.push(s), e = Math.max(n.length - 1, 0);
|
|
264
|
+
},
|
|
265
|
+
replaceState: (s, i) => {
|
|
266
|
+
r[e] = i, n[e] = s;
|
|
267
|
+
},
|
|
268
|
+
back: () => {
|
|
269
|
+
e = Math.max(e - 1, 0);
|
|
270
|
+
},
|
|
271
|
+
forward: () => {
|
|
272
|
+
e = Math.min(e + 1, n.length - 1);
|
|
273
|
+
},
|
|
274
|
+
go: (s) => {
|
|
275
|
+
e = Math.min(Math.max(e + s, 0), n.length - 1);
|
|
276
|
+
},
|
|
277
|
+
createHref: (s) => s
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
function ve(t, n) {
|
|
281
|
+
const e = t.indexOf("#"), r = t.indexOf("?");
|
|
282
|
+
return {
|
|
283
|
+
href: t,
|
|
284
|
+
pathname: t.substring(
|
|
285
|
+
0,
|
|
286
|
+
e > 0 ? r > 0 ? Math.min(e, r) : e : r > 0 ? r : t.length
|
|
287
|
+
),
|
|
288
|
+
hash: e > -1 ? t.substring(e) : "",
|
|
289
|
+
search: r > -1 ? t.slice(r, e === -1 ? void 0 : e) : "",
|
|
290
|
+
state: n || { [de]: 0 }
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
function Ot() {
|
|
294
|
+
return (Math.random() + 1).toString(36).substring(7);
|
|
295
|
+
}
|
|
296
|
+
var Vt = !0, We = "Invariant failed";
|
|
297
|
+
function te(t, n) {
|
|
298
|
+
if (!t) {
|
|
299
|
+
if (Vt)
|
|
300
|
+
throw new Error(We);
|
|
301
|
+
var e = typeof n == "function" ? n() : n, r = e ? "".concat(We, ": ").concat(e) : We;
|
|
302
|
+
throw new Error(r);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
var At = !0;
|
|
306
|
+
function Me(t, n) {
|
|
307
|
+
if (!At) {
|
|
308
|
+
if (t)
|
|
309
|
+
return;
|
|
310
|
+
var e = "Warning: " + n;
|
|
311
|
+
typeof console < "u" && console.warn(e);
|
|
312
|
+
try {
|
|
313
|
+
throw Error(e);
|
|
314
|
+
} catch {
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
var st = { exports: {} }, wt = {}, it = { exports: {} }, Pt = {};
|
|
319
|
+
/**
|
|
320
|
+
* @license React
|
|
321
|
+
* use-sync-external-store-shim.production.js
|
|
322
|
+
*
|
|
323
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
324
|
+
*
|
|
325
|
+
* This source code is licensed under the MIT license found in the
|
|
326
|
+
* LICENSE file in the root directory of this source tree.
|
|
327
|
+
*/
|
|
328
|
+
var Se = vt;
|
|
329
|
+
function Nt(t, n) {
|
|
330
|
+
return t === n && (t !== 0 || 1 / t === 1 / n) || t !== t && n !== n;
|
|
331
|
+
}
|
|
332
|
+
var $t = typeof Object.is == "function" ? Object.is : Nt, Kt = Se.useState, Ut = Se.useEffect, zt = Se.useLayoutEffect, Wt = Se.useDebugValue;
|
|
333
|
+
function Ht(t, n) {
|
|
334
|
+
var e = n(), r = Kt({ inst: { value: e, getSnapshot: n } }), o = r[0].inst, s = r[1];
|
|
335
|
+
return zt(
|
|
336
|
+
function() {
|
|
337
|
+
o.value = e, o.getSnapshot = n, He(o) && s({ inst: o });
|
|
338
|
+
},
|
|
339
|
+
[t, e, n]
|
|
340
|
+
), Ut(
|
|
341
|
+
function() {
|
|
342
|
+
return He(o) && s({ inst: o }), t(function() {
|
|
343
|
+
He(o) && s({ inst: o });
|
|
344
|
+
});
|
|
345
|
+
},
|
|
346
|
+
[t]
|
|
347
|
+
), Wt(e), e;
|
|
348
|
+
}
|
|
349
|
+
function He(t) {
|
|
350
|
+
var n = t.getSnapshot;
|
|
351
|
+
t = t.value;
|
|
352
|
+
try {
|
|
353
|
+
var e = n();
|
|
354
|
+
return !$t(t, e);
|
|
355
|
+
} catch {
|
|
356
|
+
return !0;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
function jt(t, n) {
|
|
360
|
+
return n();
|
|
361
|
+
}
|
|
362
|
+
var Gt = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? jt : Ht;
|
|
363
|
+
Pt.useSyncExternalStore = Se.useSyncExternalStore !== void 0 ? Se.useSyncExternalStore : Gt;
|
|
364
|
+
it.exports;
|
|
365
|
+
it.exports = Pt;
|
|
366
|
+
var Xt = it.exports;
|
|
367
|
+
/**
|
|
368
|
+
* @license React
|
|
369
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
370
|
+
*
|
|
371
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
372
|
+
*
|
|
373
|
+
* This source code is licensed under the MIT license found in the
|
|
374
|
+
* LICENSE file in the root directory of this source tree.
|
|
375
|
+
*/
|
|
376
|
+
var Ne = vt, qt = Xt;
|
|
377
|
+
function Jt(t, n) {
|
|
378
|
+
return t === n && (t !== 0 || 1 / t === 1 / n) || t !== t && n !== n;
|
|
379
|
+
}
|
|
380
|
+
var Yt = typeof Object.is == "function" ? Object.is : Jt, Qt = qt.useSyncExternalStore, Zt = Ne.useRef, en = Ne.useEffect, tn = Ne.useMemo, nn = Ne.useDebugValue;
|
|
381
|
+
wt.useSyncExternalStoreWithSelector = function(t, n, e, r, o) {
|
|
382
|
+
var s = Zt(null);
|
|
383
|
+
if (s.current === null) {
|
|
384
|
+
var i = { hasValue: !1, value: null };
|
|
385
|
+
s.current = i;
|
|
386
|
+
} else i = s.current;
|
|
387
|
+
s = tn(
|
|
388
|
+
function() {
|
|
389
|
+
function l(f) {
|
|
390
|
+
if (!c) {
|
|
391
|
+
if (c = !0, d = f, f = r(f), o !== void 0 && i.hasValue) {
|
|
392
|
+
var p = i.value;
|
|
393
|
+
if (o(p, f))
|
|
394
|
+
return u = p;
|
|
395
|
+
}
|
|
396
|
+
return u = f;
|
|
397
|
+
}
|
|
398
|
+
if (p = u, Yt(d, f)) return p;
|
|
399
|
+
var S = r(f);
|
|
400
|
+
return o !== void 0 && o(p, S) ? (d = f, p) : (d = f, u = S);
|
|
401
|
+
}
|
|
402
|
+
var c = !1, d, u, h = e === void 0 ? null : e;
|
|
403
|
+
return [
|
|
404
|
+
function() {
|
|
405
|
+
return l(n());
|
|
406
|
+
},
|
|
407
|
+
h === null ? void 0 : function() {
|
|
408
|
+
return l(h());
|
|
409
|
+
}
|
|
410
|
+
];
|
|
411
|
+
},
|
|
412
|
+
[n, e, r, o]
|
|
413
|
+
);
|
|
414
|
+
var a = Qt(t, s[0], s[1]);
|
|
415
|
+
return en(
|
|
416
|
+
function() {
|
|
417
|
+
i.hasValue = !0, i.value = a;
|
|
418
|
+
},
|
|
419
|
+
[a]
|
|
420
|
+
), nn(a), a;
|
|
421
|
+
};
|
|
422
|
+
st.exports;
|
|
423
|
+
st.exports = wt;
|
|
424
|
+
var rn = st.exports;
|
|
425
|
+
const me = /* @__PURE__ */ new WeakMap(), Te = /* @__PURE__ */ new WeakMap(), De = {
|
|
426
|
+
current: []
|
|
427
|
+
};
|
|
428
|
+
let je = !1, Ce = 0;
|
|
429
|
+
const be = /* @__PURE__ */ new Set(), Ie = /* @__PURE__ */ new Map();
|
|
430
|
+
function bt(t) {
|
|
431
|
+
const n = Array.from(t).sort((e, r) => e instanceof ge && e.options.deps.includes(r) ? 1 : r instanceof ge && r.options.deps.includes(e) ? -1 : 0);
|
|
432
|
+
for (const e of n) {
|
|
433
|
+
if (De.current.includes(e))
|
|
434
|
+
continue;
|
|
435
|
+
De.current.push(e), e.recompute();
|
|
436
|
+
const r = Te.get(e);
|
|
437
|
+
if (r)
|
|
438
|
+
for (const o of r) {
|
|
439
|
+
const s = me.get(o);
|
|
440
|
+
s && bt(s);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
function on(t) {
|
|
445
|
+
t.listeners.forEach(
|
|
446
|
+
(n) => n({
|
|
447
|
+
prevVal: t.prevState,
|
|
448
|
+
currentVal: t.state
|
|
449
|
+
})
|
|
450
|
+
);
|
|
451
|
+
}
|
|
452
|
+
function sn(t) {
|
|
453
|
+
t.listeners.forEach(
|
|
454
|
+
(n) => n({
|
|
455
|
+
prevVal: t.prevState,
|
|
456
|
+
currentVal: t.state
|
|
457
|
+
})
|
|
458
|
+
);
|
|
459
|
+
}
|
|
460
|
+
function Rt(t) {
|
|
461
|
+
if (Ce > 0 && !Ie.has(t) && Ie.set(t, t.prevState), be.add(t), !(Ce > 0) && !je)
|
|
462
|
+
try {
|
|
463
|
+
for (je = !0; be.size > 0; ) {
|
|
464
|
+
const n = Array.from(be);
|
|
465
|
+
be.clear();
|
|
466
|
+
for (const e of n) {
|
|
467
|
+
const r = Ie.get(e) ?? e.prevState;
|
|
468
|
+
e.prevState = r, on(e);
|
|
469
|
+
}
|
|
470
|
+
for (const e of n) {
|
|
471
|
+
const r = me.get(e);
|
|
472
|
+
r && (De.current.push(e), bt(r));
|
|
473
|
+
}
|
|
474
|
+
for (const e of n) {
|
|
475
|
+
const r = me.get(e);
|
|
476
|
+
if (r)
|
|
477
|
+
for (const o of r)
|
|
478
|
+
sn(o);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
} finally {
|
|
482
|
+
je = !1, De.current = [], Ie.clear();
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
function Ge(t) {
|
|
486
|
+
Ce++;
|
|
487
|
+
try {
|
|
488
|
+
t();
|
|
489
|
+
} finally {
|
|
490
|
+
if (Ce--, Ce === 0) {
|
|
491
|
+
const n = Array.from(be)[0];
|
|
492
|
+
n && Rt(n);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
class nt {
|
|
497
|
+
constructor(n, e) {
|
|
498
|
+
this.listeners = /* @__PURE__ */ new Set(), this.subscribe = (r) => {
|
|
499
|
+
var o, s;
|
|
500
|
+
this.listeners.add(r);
|
|
501
|
+
const i = (s = (o = this.options) == null ? void 0 : o.onSubscribe) == null ? void 0 : s.call(o, r, this);
|
|
502
|
+
return () => {
|
|
503
|
+
this.listeners.delete(r), i?.();
|
|
504
|
+
};
|
|
505
|
+
}, this.setState = (r) => {
|
|
506
|
+
var o, s, i;
|
|
507
|
+
this.prevState = this.state, this.state = (o = this.options) != null && o.updateFn ? this.options.updateFn(this.prevState)(r) : r(this.prevState), (i = (s = this.options) == null ? void 0 : s.onUpdate) == null || i.call(s), Rt(this);
|
|
508
|
+
}, this.prevState = n, this.state = n, this.options = e;
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
class ge {
|
|
512
|
+
constructor(n) {
|
|
513
|
+
this.listeners = /* @__PURE__ */ new Set(), this._subscriptions = [], this.lastSeenDepValues = [], this.getDepVals = () => {
|
|
514
|
+
const e = [], r = [];
|
|
515
|
+
for (const o of this.options.deps)
|
|
516
|
+
e.push(o.prevState), r.push(o.state);
|
|
517
|
+
return this.lastSeenDepValues = r, {
|
|
518
|
+
prevDepVals: e,
|
|
519
|
+
currDepVals: r,
|
|
520
|
+
prevVal: this.prevState ?? void 0
|
|
521
|
+
};
|
|
522
|
+
}, this.recompute = () => {
|
|
523
|
+
var e, r;
|
|
524
|
+
this.prevState = this.state;
|
|
525
|
+
const { prevDepVals: o, currDepVals: s, prevVal: i } = this.getDepVals();
|
|
526
|
+
this.state = this.options.fn({
|
|
527
|
+
prevDepVals: o,
|
|
528
|
+
currDepVals: s,
|
|
529
|
+
prevVal: i
|
|
530
|
+
}), (r = (e = this.options).onUpdate) == null || r.call(e);
|
|
531
|
+
}, this.checkIfRecalculationNeededDeeply = () => {
|
|
532
|
+
for (const s of this.options.deps)
|
|
533
|
+
s instanceof ge && s.checkIfRecalculationNeededDeeply();
|
|
534
|
+
let e = !1;
|
|
535
|
+
const r = this.lastSeenDepValues, { currDepVals: o } = this.getDepVals();
|
|
536
|
+
for (let s = 0; s < o.length; s++)
|
|
537
|
+
if (o[s] !== r[s]) {
|
|
538
|
+
e = !0;
|
|
539
|
+
break;
|
|
540
|
+
}
|
|
541
|
+
e && this.recompute();
|
|
542
|
+
}, this.mount = () => (this.registerOnGraph(), this.checkIfRecalculationNeededDeeply(), () => {
|
|
543
|
+
this.unregisterFromGraph();
|
|
544
|
+
for (const e of this._subscriptions)
|
|
545
|
+
e();
|
|
546
|
+
}), this.subscribe = (e) => {
|
|
547
|
+
var r, o;
|
|
548
|
+
this.listeners.add(e);
|
|
549
|
+
const s = (o = (r = this.options).onSubscribe) == null ? void 0 : o.call(r, e, this);
|
|
550
|
+
return () => {
|
|
551
|
+
this.listeners.delete(e), s?.();
|
|
552
|
+
};
|
|
553
|
+
}, this.options = n, this.state = n.fn({
|
|
554
|
+
prevDepVals: void 0,
|
|
555
|
+
prevVal: void 0,
|
|
556
|
+
currDepVals: this.getDepVals().currDepVals
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
registerOnGraph(n = this.options.deps) {
|
|
560
|
+
for (const e of n)
|
|
561
|
+
if (e instanceof ge)
|
|
562
|
+
e.registerOnGraph(), this.registerOnGraph(e.options.deps);
|
|
563
|
+
else if (e instanceof nt) {
|
|
564
|
+
let r = me.get(e);
|
|
565
|
+
r || (r = /* @__PURE__ */ new Set(), me.set(e, r)), r.add(this);
|
|
566
|
+
let o = Te.get(this);
|
|
567
|
+
o || (o = /* @__PURE__ */ new Set(), Te.set(this, o)), o.add(e);
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
unregisterFromGraph(n = this.options.deps) {
|
|
571
|
+
for (const e of n)
|
|
572
|
+
if (e instanceof ge)
|
|
573
|
+
this.unregisterFromGraph(e.options.deps);
|
|
574
|
+
else if (e instanceof nt) {
|
|
575
|
+
const r = me.get(e);
|
|
576
|
+
r && r.delete(this);
|
|
577
|
+
const o = Te.get(this);
|
|
578
|
+
o && o.delete(e);
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
function an(t, n = (e) => e) {
|
|
583
|
+
return rn.useSyncExternalStoreWithSelector(
|
|
584
|
+
t.subscribe,
|
|
585
|
+
() => t.state,
|
|
586
|
+
() => t.state,
|
|
587
|
+
n,
|
|
588
|
+
cn
|
|
589
|
+
);
|
|
590
|
+
}
|
|
591
|
+
function cn(t, n) {
|
|
592
|
+
if (Object.is(t, n))
|
|
593
|
+
return !0;
|
|
594
|
+
if (typeof t != "object" || t === null || typeof n != "object" || n === null)
|
|
595
|
+
return !1;
|
|
596
|
+
if (t instanceof Map && n instanceof Map) {
|
|
597
|
+
if (t.size !== n.size) return !1;
|
|
598
|
+
for (const [r, o] of t)
|
|
599
|
+
if (!n.has(r) || !Object.is(o, n.get(r))) return !1;
|
|
600
|
+
return !0;
|
|
601
|
+
}
|
|
602
|
+
if (t instanceof Set && n instanceof Set) {
|
|
603
|
+
if (t.size !== n.size) return !1;
|
|
604
|
+
for (const r of t)
|
|
605
|
+
if (!n.has(r)) return !1;
|
|
606
|
+
return !0;
|
|
607
|
+
}
|
|
608
|
+
const e = Object.keys(t);
|
|
609
|
+
if (e.length !== Object.keys(n).length)
|
|
610
|
+
return !1;
|
|
611
|
+
for (let r = 0; r < e.length; r++)
|
|
612
|
+
if (!Object.prototype.hasOwnProperty.call(n, e[r]) || !Object.is(t[e[r]], n[e[r]]))
|
|
613
|
+
return !1;
|
|
614
|
+
return !0;
|
|
615
|
+
}
|
|
616
|
+
const H = "__root__";
|
|
617
|
+
function un(t, n) {
|
|
618
|
+
let e, r, o, s = "";
|
|
619
|
+
for (e in t)
|
|
620
|
+
if ((o = t[e]) !== void 0)
|
|
621
|
+
if (Array.isArray(o))
|
|
622
|
+
for (r = 0; r < o.length; r++)
|
|
623
|
+
s && (s += "&"), s += encodeURIComponent(e) + "=" + encodeURIComponent(o[r]);
|
|
624
|
+
else
|
|
625
|
+
s && (s += "&"), s += encodeURIComponent(e) + "=" + encodeURIComponent(o);
|
|
626
|
+
return "" + s;
|
|
627
|
+
}
|
|
628
|
+
function ft(t) {
|
|
629
|
+
if (!t) return "";
|
|
630
|
+
const n = decodeURIComponent(t);
|
|
631
|
+
return n === "false" ? !1 : n === "true" ? !0 : +n * 0 === 0 && +n + "" === n ? +n : n;
|
|
632
|
+
}
|
|
633
|
+
function ln(t, n) {
|
|
634
|
+
let e, r;
|
|
635
|
+
const o = {}, s = t.split("&");
|
|
636
|
+
for (; e = s.shift(); ) {
|
|
637
|
+
const i = e.indexOf("=");
|
|
638
|
+
if (i !== -1) {
|
|
639
|
+
r = e.slice(0, i), r = decodeURIComponent(r);
|
|
640
|
+
const a = e.slice(i + 1);
|
|
641
|
+
o[r] !== void 0 ? o[r] = [].concat(o[r], ft(a)) : o[r] = ft(a);
|
|
642
|
+
} else
|
|
643
|
+
r = e, r = decodeURIComponent(r), o[r] = "";
|
|
644
|
+
}
|
|
645
|
+
return o;
|
|
646
|
+
}
|
|
647
|
+
const dn = fn(JSON.parse), hn = pn(
|
|
648
|
+
JSON.stringify,
|
|
649
|
+
JSON.parse
|
|
650
|
+
);
|
|
651
|
+
function fn(t) {
|
|
652
|
+
return (n) => {
|
|
653
|
+
n.substring(0, 1) === "?" && (n = n.substring(1));
|
|
654
|
+
const e = ln(n);
|
|
655
|
+
for (const r in e) {
|
|
656
|
+
const o = e[r];
|
|
657
|
+
if (typeof o == "string")
|
|
658
|
+
try {
|
|
659
|
+
e[r] = t(o);
|
|
660
|
+
} catch {
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
return e;
|
|
664
|
+
};
|
|
665
|
+
}
|
|
666
|
+
function pn(t, n) {
|
|
667
|
+
function e(r) {
|
|
668
|
+
if (typeof r == "object" && r !== null)
|
|
669
|
+
try {
|
|
670
|
+
return t(r);
|
|
671
|
+
} catch {
|
|
672
|
+
}
|
|
673
|
+
else if (typeof r == "string" && typeof n == "function")
|
|
674
|
+
try {
|
|
675
|
+
return n(r), t(r);
|
|
676
|
+
} catch {
|
|
677
|
+
}
|
|
678
|
+
return r;
|
|
679
|
+
}
|
|
680
|
+
return (r) => {
|
|
681
|
+
r = { ...r }, Object.keys(r).forEach((s) => {
|
|
682
|
+
const i = r[s];
|
|
683
|
+
typeof i > "u" || i === void 0 ? delete r[s] : r[s] = e(i);
|
|
684
|
+
});
|
|
685
|
+
const o = un(r).toString();
|
|
686
|
+
return o ? `?${o}` : "";
|
|
687
|
+
};
|
|
688
|
+
}
|
|
689
|
+
function Le(t) {
|
|
690
|
+
return t[t.length - 1];
|
|
691
|
+
}
|
|
692
|
+
function mn(t) {
|
|
693
|
+
return typeof t == "function";
|
|
694
|
+
}
|
|
695
|
+
function ue(t, n) {
|
|
696
|
+
return mn(t) ? t(n) : t;
|
|
697
|
+
}
|
|
698
|
+
function rt(t, n) {
|
|
699
|
+
return n.reduce((e, r) => (e[r] = t[r], e), {});
|
|
700
|
+
}
|
|
701
|
+
function X(t, n) {
|
|
702
|
+
if (t === n)
|
|
703
|
+
return t;
|
|
704
|
+
const e = n, r = mt(t) && mt(e);
|
|
705
|
+
if (r || Oe(t) && Oe(e)) {
|
|
706
|
+
const o = r ? t : Object.keys(t), s = o.length, i = r ? e : Object.keys(e), a = i.length, l = r ? [] : {};
|
|
707
|
+
let c = 0;
|
|
708
|
+
for (let d = 0; d < a; d++) {
|
|
709
|
+
const u = r ? d : i[d];
|
|
710
|
+
(!r && o.includes(u) || r) && t[u] === void 0 && e[u] === void 0 ? (l[u] = void 0, c++) : (l[u] = X(t[u], e[u]), l[u] === t[u] && t[u] !== void 0 && c++);
|
|
711
|
+
}
|
|
712
|
+
return s === a && c === s ? t : l;
|
|
713
|
+
}
|
|
714
|
+
return e;
|
|
715
|
+
}
|
|
716
|
+
function Oe(t) {
|
|
717
|
+
if (!pt(t))
|
|
718
|
+
return !1;
|
|
719
|
+
const n = t.constructor;
|
|
720
|
+
if (typeof n > "u")
|
|
721
|
+
return !0;
|
|
722
|
+
const e = n.prototype;
|
|
723
|
+
return !(!pt(e) || !e.hasOwnProperty("isPrototypeOf"));
|
|
724
|
+
}
|
|
725
|
+
function pt(t) {
|
|
726
|
+
return Object.prototype.toString.call(t) === "[object Object]";
|
|
727
|
+
}
|
|
728
|
+
function mt(t) {
|
|
729
|
+
return Array.isArray(t) && t.length === Object.keys(t).length;
|
|
730
|
+
}
|
|
731
|
+
function gt(t, n) {
|
|
732
|
+
let e = Object.keys(t);
|
|
733
|
+
return n && (e = e.filter((r) => t[r] !== void 0)), e;
|
|
734
|
+
}
|
|
735
|
+
function ye(t, n, e) {
|
|
736
|
+
if (t === n)
|
|
737
|
+
return !0;
|
|
738
|
+
if (typeof t != typeof n)
|
|
739
|
+
return !1;
|
|
740
|
+
if (Oe(t) && Oe(n)) {
|
|
741
|
+
const r = e?.ignoreUndefined ?? !0, o = gt(t, r), s = gt(n, r);
|
|
742
|
+
return !e?.partial && o.length !== s.length ? !1 : s.every((i) => ye(t[i], n[i], e));
|
|
743
|
+
}
|
|
744
|
+
return Array.isArray(t) && Array.isArray(n) ? t.length !== n.length ? !1 : !t.some((r, o) => !ye(r, n[o], e)) : !1;
|
|
745
|
+
}
|
|
746
|
+
const Re = typeof window < "u" ? b.useLayoutEffect : b.useEffect;
|
|
747
|
+
function pe(t) {
|
|
748
|
+
let n, e;
|
|
749
|
+
const r = new Promise((o, s) => {
|
|
750
|
+
n = o, e = s;
|
|
751
|
+
});
|
|
752
|
+
return r.status = "pending", r.resolve = (o) => {
|
|
753
|
+
r.status = "resolved", r.value = o, n(o), t?.(o);
|
|
754
|
+
}, r.reject = (o) => {
|
|
755
|
+
r.status = "rejected", e(o);
|
|
756
|
+
}, r;
|
|
757
|
+
}
|
|
758
|
+
function Xe(t) {
|
|
759
|
+
const n = b.useRef({
|
|
760
|
+
value: t,
|
|
761
|
+
prev: null
|
|
762
|
+
}), e = n.current.value;
|
|
763
|
+
return t !== e && (n.current = {
|
|
764
|
+
value: t,
|
|
765
|
+
prev: e
|
|
766
|
+
}), n.current.prev;
|
|
767
|
+
}
|
|
768
|
+
function gn(t, n, e = {}, r = {}) {
|
|
769
|
+
const o = b.useRef(
|
|
770
|
+
typeof IntersectionObserver == "function"
|
|
771
|
+
), s = b.useRef(null);
|
|
772
|
+
return b.useEffect(() => {
|
|
773
|
+
if (!(!t.current || !o.current || r.disabled))
|
|
774
|
+
return s.current = new IntersectionObserver(([i]) => {
|
|
775
|
+
n(i);
|
|
776
|
+
}, e), s.current.observe(t.current), () => {
|
|
777
|
+
var i;
|
|
778
|
+
(i = s.current) == null || i.disconnect();
|
|
779
|
+
};
|
|
780
|
+
}, [n, e, r.disabled, t]), s.current;
|
|
781
|
+
}
|
|
782
|
+
function yn(t) {
|
|
783
|
+
const n = b.useRef(null);
|
|
784
|
+
return b.useEffect(() => {
|
|
785
|
+
t && (typeof t == "function" ? t(n.current) : t.current = n.current);
|
|
786
|
+
}), n;
|
|
787
|
+
}
|
|
788
|
+
function re(t) {
|
|
789
|
+
return $e(
|
|
790
|
+
t.filter((n) => n !== void 0).join("/")
|
|
791
|
+
);
|
|
792
|
+
}
|
|
793
|
+
function $e(t) {
|
|
794
|
+
return t.replace(/\/{2,}/g, "/");
|
|
795
|
+
}
|
|
796
|
+
function at(t) {
|
|
797
|
+
return t === "/" ? t : t.replace(/^\/{1,}/, "");
|
|
798
|
+
}
|
|
799
|
+
function le(t) {
|
|
800
|
+
return t === "/" ? t : t.replace(/\/{1,}$/, "");
|
|
801
|
+
}
|
|
802
|
+
function vn(t) {
|
|
803
|
+
return le(at(t));
|
|
804
|
+
}
|
|
805
|
+
function Ve(t, n) {
|
|
806
|
+
return t.endsWith("/") && t !== "/" && t !== `${n}/` ? t.slice(0, -1) : t;
|
|
807
|
+
}
|
|
808
|
+
function Sn(t, n, e) {
|
|
809
|
+
return Ve(t, e) === Ve(n, e);
|
|
810
|
+
}
|
|
811
|
+
function _n({
|
|
812
|
+
basepath: t,
|
|
813
|
+
base: n,
|
|
814
|
+
to: e,
|
|
815
|
+
trailingSlash: r = "never",
|
|
816
|
+
caseSensitive: o
|
|
817
|
+
}) {
|
|
818
|
+
var s, i;
|
|
819
|
+
n = Ae(t, n, o), e = Ae(t, e, o);
|
|
820
|
+
let a = _e(n);
|
|
821
|
+
const l = _e(e);
|
|
822
|
+
a.length > 1 && ((s = Le(a)) == null ? void 0 : s.value) === "/" && a.pop(), l.forEach((d, u) => {
|
|
823
|
+
d.value === "/" ? u ? u === l.length - 1 && a.push(d) : a = [d] : d.value === ".." ? a.pop() : d.value === "." || a.push(d);
|
|
824
|
+
}), a.length > 1 && (((i = Le(a)) == null ? void 0 : i.value) === "/" ? r === "never" && a.pop() : r === "always" && a.push({ type: "pathname", value: "/" }));
|
|
825
|
+
const c = re([t, ...a.map((d) => d.value)]);
|
|
826
|
+
return $e(c);
|
|
827
|
+
}
|
|
828
|
+
function _e(t) {
|
|
829
|
+
if (!t)
|
|
830
|
+
return [];
|
|
831
|
+
t = $e(t);
|
|
832
|
+
const n = [];
|
|
833
|
+
if (t.slice(0, 1) === "/" && (t = t.substring(1), n.push({
|
|
834
|
+
type: "pathname",
|
|
835
|
+
value: "/"
|
|
836
|
+
})), !t)
|
|
837
|
+
return n;
|
|
838
|
+
const e = t.split("/").filter(Boolean);
|
|
839
|
+
return n.push(
|
|
840
|
+
...e.map((r) => r === "$" || r === "*" ? {
|
|
841
|
+
type: "wildcard",
|
|
842
|
+
value: r
|
|
843
|
+
} : r.charAt(0) === "$" ? {
|
|
844
|
+
type: "param",
|
|
845
|
+
value: r
|
|
846
|
+
} : {
|
|
847
|
+
type: "pathname",
|
|
848
|
+
value: decodeURI(r)
|
|
849
|
+
})
|
|
850
|
+
), t.slice(-1) === "/" && (t = t.substring(1), n.push({
|
|
851
|
+
type: "pathname",
|
|
852
|
+
value: "/"
|
|
853
|
+
})), n;
|
|
854
|
+
}
|
|
855
|
+
function ke({
|
|
856
|
+
path: t,
|
|
857
|
+
params: n,
|
|
858
|
+
leaveWildcards: e,
|
|
859
|
+
leaveParams: r,
|
|
860
|
+
decodeCharMap: o
|
|
861
|
+
}) {
|
|
862
|
+
const s = _e(t), i = {};
|
|
863
|
+
for (const [a, l] of Object.entries(n)) {
|
|
864
|
+
const c = typeof l == "string";
|
|
865
|
+
["*", "_splat"].includes(a) ? i[a] = c ? encodeURI(l) : l : i[a] = c ? wn(l, o) : l;
|
|
866
|
+
}
|
|
867
|
+
return re(
|
|
868
|
+
s.map((a) => {
|
|
869
|
+
if (a.type === "wildcard") {
|
|
870
|
+
const l = i._splat;
|
|
871
|
+
return e ? `${a.value}${l ?? ""}` : l;
|
|
872
|
+
}
|
|
873
|
+
if (a.type === "param") {
|
|
874
|
+
if (r) {
|
|
875
|
+
const l = i[a.value];
|
|
876
|
+
return `${a.value}${l ?? ""}`;
|
|
877
|
+
}
|
|
878
|
+
return i[a.value.substring(1)] ?? "undefined";
|
|
879
|
+
}
|
|
880
|
+
return a.value;
|
|
881
|
+
})
|
|
882
|
+
);
|
|
883
|
+
}
|
|
884
|
+
function wn(t, n) {
|
|
885
|
+
let e = encodeURIComponent(t);
|
|
886
|
+
if (n)
|
|
887
|
+
for (const [r, o] of n)
|
|
888
|
+
e = e.replaceAll(r, o);
|
|
889
|
+
return e;
|
|
890
|
+
}
|
|
891
|
+
function Fe(t, n, e) {
|
|
892
|
+
const r = Pn(t, n, e);
|
|
893
|
+
if (!(e.to && !r))
|
|
894
|
+
return r ?? {};
|
|
895
|
+
}
|
|
896
|
+
function Ae(t, n, e = !1) {
|
|
897
|
+
const r = e ? t : t.toLowerCase(), o = e ? n : n.toLowerCase();
|
|
898
|
+
switch (!0) {
|
|
899
|
+
case r === "/":
|
|
900
|
+
return n;
|
|
901
|
+
case o === r:
|
|
902
|
+
return "";
|
|
903
|
+
case n.length < t.length:
|
|
904
|
+
return n;
|
|
905
|
+
case o[r.length] !== "/":
|
|
906
|
+
return n;
|
|
907
|
+
case o.startsWith(r):
|
|
908
|
+
return n.slice(t.length);
|
|
909
|
+
default:
|
|
910
|
+
return n;
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
function Pn(t, n, e) {
|
|
914
|
+
if (t !== "/" && !n.startsWith(t))
|
|
915
|
+
return;
|
|
916
|
+
n = Ae(t, n, e.caseSensitive);
|
|
917
|
+
const r = Ae(
|
|
918
|
+
t,
|
|
919
|
+
`${e.to ?? "$"}`,
|
|
920
|
+
e.caseSensitive
|
|
921
|
+
), o = _e(n), s = _e(r);
|
|
922
|
+
n.startsWith("/") || o.unshift({
|
|
923
|
+
type: "pathname",
|
|
924
|
+
value: "/"
|
|
925
|
+
}), r.startsWith("/") || s.unshift({
|
|
926
|
+
type: "pathname",
|
|
927
|
+
value: "/"
|
|
928
|
+
});
|
|
929
|
+
const i = {};
|
|
930
|
+
return (() => {
|
|
931
|
+
for (let l = 0; l < Math.max(o.length, s.length); l++) {
|
|
932
|
+
const c = o[l], d = s[l], u = l >= o.length - 1, h = l >= s.length - 1;
|
|
933
|
+
if (d) {
|
|
934
|
+
if (d.type === "wildcard") {
|
|
935
|
+
const f = decodeURI(
|
|
936
|
+
re(o.slice(l).map((p) => p.value))
|
|
937
|
+
);
|
|
938
|
+
return i["*"] = f, i._splat = f, !0;
|
|
939
|
+
}
|
|
940
|
+
if (d.type === "pathname") {
|
|
941
|
+
if (d.value === "/" && !c?.value)
|
|
942
|
+
return !0;
|
|
943
|
+
if (c) {
|
|
944
|
+
if (e.caseSensitive) {
|
|
945
|
+
if (d.value !== c.value)
|
|
946
|
+
return !1;
|
|
947
|
+
} else if (d.value.toLowerCase() !== c.value.toLowerCase())
|
|
948
|
+
return !1;
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
if (!c)
|
|
952
|
+
return !1;
|
|
953
|
+
if (d.type === "param") {
|
|
954
|
+
if (c.value === "/")
|
|
955
|
+
return !1;
|
|
956
|
+
c.value.charAt(0) !== "$" && (i[d.value.substring(1)] = decodeURIComponent(
|
|
957
|
+
c.value
|
|
958
|
+
));
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
if (!u && h)
|
|
962
|
+
return i["**"] = re(o.slice(l + 1).map((f) => f.value)), !!e.fuzzy && d?.value !== "/";
|
|
963
|
+
}
|
|
964
|
+
return !0;
|
|
965
|
+
})() ? i : void 0;
|
|
966
|
+
}
|
|
967
|
+
function ce(t) {
|
|
968
|
+
return !!t?.isRedirect;
|
|
969
|
+
}
|
|
970
|
+
function qe(t) {
|
|
971
|
+
return !!t?.isRedirect && t.href;
|
|
972
|
+
}
|
|
973
|
+
function ct(t) {
|
|
974
|
+
const n = t.errorComponent ?? Ke;
|
|
975
|
+
return /* @__PURE__ */ C(
|
|
976
|
+
bn,
|
|
977
|
+
{
|
|
978
|
+
getResetKey: t.getResetKey,
|
|
979
|
+
onCatch: t.onCatch,
|
|
980
|
+
children: ({ error: e, reset: r }) => e ? b.createElement(n, {
|
|
981
|
+
error: e,
|
|
982
|
+
reset: r
|
|
983
|
+
}) : t.children
|
|
984
|
+
}
|
|
985
|
+
);
|
|
986
|
+
}
|
|
987
|
+
class bn extends b.Component {
|
|
988
|
+
constructor() {
|
|
989
|
+
super(...arguments), this.state = { error: null };
|
|
990
|
+
}
|
|
991
|
+
static getDerivedStateFromProps(n) {
|
|
992
|
+
return { resetKey: n.getResetKey() };
|
|
993
|
+
}
|
|
994
|
+
static getDerivedStateFromError(n) {
|
|
995
|
+
return { error: n };
|
|
996
|
+
}
|
|
997
|
+
reset() {
|
|
998
|
+
this.setState({ error: null });
|
|
999
|
+
}
|
|
1000
|
+
componentDidUpdate(n, e) {
|
|
1001
|
+
e.error && e.resetKey !== this.state.resetKey && this.reset();
|
|
1002
|
+
}
|
|
1003
|
+
componentDidCatch(n, e) {
|
|
1004
|
+
this.props.onCatch && this.props.onCatch(n, e);
|
|
1005
|
+
}
|
|
1006
|
+
render() {
|
|
1007
|
+
return this.props.children({
|
|
1008
|
+
error: this.state.resetKey !== this.props.getResetKey() ? null : this.state.error,
|
|
1009
|
+
reset: () => {
|
|
1010
|
+
this.reset();
|
|
1011
|
+
}
|
|
1012
|
+
});
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
function Ke({ error: t }) {
|
|
1016
|
+
const [n, e] = b.useState(!1);
|
|
1017
|
+
return /* @__PURE__ */ et("div", { style: { padding: ".5rem", maxWidth: "100%" }, children: [
|
|
1018
|
+
/* @__PURE__ */ et("div", { style: { display: "flex", alignItems: "center", gap: ".5rem" }, children: [
|
|
1019
|
+
/* @__PURE__ */ C("strong", { style: { fontSize: "1rem" }, children: "Something went wrong!" }),
|
|
1020
|
+
/* @__PURE__ */ C(
|
|
1021
|
+
"button",
|
|
1022
|
+
{
|
|
1023
|
+
style: {
|
|
1024
|
+
appearance: "none",
|
|
1025
|
+
fontSize: ".6em",
|
|
1026
|
+
border: "1px solid currentColor",
|
|
1027
|
+
padding: ".1rem .2rem",
|
|
1028
|
+
fontWeight: "bold",
|
|
1029
|
+
borderRadius: ".25rem"
|
|
1030
|
+
},
|
|
1031
|
+
onClick: () => e((r) => !r),
|
|
1032
|
+
children: n ? "Hide Error" : "Show Error"
|
|
1033
|
+
}
|
|
1034
|
+
)
|
|
1035
|
+
] }),
|
|
1036
|
+
/* @__PURE__ */ C("div", { style: { height: ".25rem" } }),
|
|
1037
|
+
n ? /* @__PURE__ */ C("div", { children: /* @__PURE__ */ C(
|
|
1038
|
+
"pre",
|
|
1039
|
+
{
|
|
1040
|
+
style: {
|
|
1041
|
+
fontSize: ".7em",
|
|
1042
|
+
border: "1px solid red",
|
|
1043
|
+
borderRadius: ".25rem",
|
|
1044
|
+
padding: ".3rem",
|
|
1045
|
+
color: "red",
|
|
1046
|
+
overflow: "auto"
|
|
1047
|
+
},
|
|
1048
|
+
children: t.message ? /* @__PURE__ */ C("code", { children: t.message }) : null
|
|
1049
|
+
}
|
|
1050
|
+
) }) : null
|
|
1051
|
+
] });
|
|
1052
|
+
}
|
|
1053
|
+
const Je = b.createContext(null);
|
|
1054
|
+
function Ct() {
|
|
1055
|
+
return typeof document > "u" ? Je : window.__TSR_ROUTER_CONTEXT__ ? window.__TSR_ROUTER_CONTEXT__ : (window.__TSR_ROUTER_CONTEXT__ = Je, Je);
|
|
1056
|
+
}
|
|
1057
|
+
function oe(t) {
|
|
1058
|
+
const n = b.useContext(Ct());
|
|
1059
|
+
return Me(
|
|
1060
|
+
!((t?.warn ?? !0) && !n),
|
|
1061
|
+
"useRouter must be used inside a <RouterProvider> component!"
|
|
1062
|
+
), n;
|
|
1063
|
+
}
|
|
1064
|
+
function z(t) {
|
|
1065
|
+
const n = oe({
|
|
1066
|
+
warn: t?.router === void 0
|
|
1067
|
+
}), e = t?.router || n, r = Tt(void 0);
|
|
1068
|
+
return an(e.__store, (o) => {
|
|
1069
|
+
if (t?.select) {
|
|
1070
|
+
if (t.structuralSharing ?? e.options.defaultStructuralSharing) {
|
|
1071
|
+
const s = X(
|
|
1072
|
+
r.current,
|
|
1073
|
+
t.select(o)
|
|
1074
|
+
);
|
|
1075
|
+
return r.current = s, s;
|
|
1076
|
+
}
|
|
1077
|
+
return t.select(o);
|
|
1078
|
+
}
|
|
1079
|
+
return o;
|
|
1080
|
+
});
|
|
1081
|
+
}
|
|
1082
|
+
function or(t = {}) {
|
|
1083
|
+
if (t.isNotFound = !0, t.throw) throw t;
|
|
1084
|
+
return t;
|
|
1085
|
+
}
|
|
1086
|
+
function ee(t) {
|
|
1087
|
+
return !!t?.isNotFound;
|
|
1088
|
+
}
|
|
1089
|
+
function Rn(t) {
|
|
1090
|
+
const n = z({
|
|
1091
|
+
select: (e) => `not-found-${e.location.pathname}-${e.status}`
|
|
1092
|
+
});
|
|
1093
|
+
return /* @__PURE__ */ C(
|
|
1094
|
+
ct,
|
|
1095
|
+
{
|
|
1096
|
+
getResetKey: () => n,
|
|
1097
|
+
onCatch: (e, r) => {
|
|
1098
|
+
var o;
|
|
1099
|
+
if (ee(e))
|
|
1100
|
+
(o = t.onCatch) == null || o.call(t, e, r);
|
|
1101
|
+
else
|
|
1102
|
+
throw e;
|
|
1103
|
+
},
|
|
1104
|
+
errorComponent: ({ error: e }) => {
|
|
1105
|
+
var r;
|
|
1106
|
+
if (ee(e))
|
|
1107
|
+
return (r = t.fallback) == null ? void 0 : r.call(t, e);
|
|
1108
|
+
throw e;
|
|
1109
|
+
},
|
|
1110
|
+
children: t.children
|
|
1111
|
+
}
|
|
1112
|
+
);
|
|
1113
|
+
}
|
|
1114
|
+
function Cn() {
|
|
1115
|
+
return /* @__PURE__ */ C("p", { children: "Not Found" });
|
|
1116
|
+
}
|
|
1117
|
+
const Lt = [
|
|
1118
|
+
"component",
|
|
1119
|
+
"errorComponent",
|
|
1120
|
+
"pendingComponent",
|
|
1121
|
+
"notFoundComponent"
|
|
1122
|
+
];
|
|
1123
|
+
function Ln(t) {
|
|
1124
|
+
var n;
|
|
1125
|
+
for (const e of Lt)
|
|
1126
|
+
if ((n = t.options[e]) != null && n.preload)
|
|
1127
|
+
return !0;
|
|
1128
|
+
return !1;
|
|
1129
|
+
}
|
|
1130
|
+
function Ye(t, n) {
|
|
1131
|
+
if (t == null) return {};
|
|
1132
|
+
if ("~standard" in t) {
|
|
1133
|
+
const e = t["~standard"].validate(n);
|
|
1134
|
+
if (e instanceof Promise)
|
|
1135
|
+
throw new ot("Async validation not supported");
|
|
1136
|
+
if (e.issues)
|
|
1137
|
+
throw new ot(JSON.stringify(e.issues, void 0, 2));
|
|
1138
|
+
return e.value;
|
|
1139
|
+
}
|
|
1140
|
+
return "parse" in t ? t.parse(n) : typeof t == "function" ? t(n) : {};
|
|
1141
|
+
}
|
|
1142
|
+
function sr(t) {
|
|
1143
|
+
return new Mn(t);
|
|
1144
|
+
}
|
|
1145
|
+
class Mn {
|
|
1146
|
+
/**
|
|
1147
|
+
* @deprecated Use the `createRouter` function instead
|
|
1148
|
+
*/
|
|
1149
|
+
constructor(n) {
|
|
1150
|
+
this.tempLocationKey = `${Math.round(
|
|
1151
|
+
Math.random() * 1e7
|
|
1152
|
+
)}`, this.resetNextScroll = !0, this.shouldViewTransition = void 0, this.isViewTransitionTypesSupported = void 0, this.subscribers = /* @__PURE__ */ new Set(), this.startReactTransition = (e) => e(), this.update = (e) => {
|
|
1153
|
+
var r;
|
|
1154
|
+
e.notFoundRoute && console.warn(
|
|
1155
|
+
"The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/guide/not-found-errors#migrating-from-notfoundroute for more info."
|
|
1156
|
+
);
|
|
1157
|
+
const o = this.options;
|
|
1158
|
+
this.options = {
|
|
1159
|
+
...this.options,
|
|
1160
|
+
...e
|
|
1161
|
+
}, this.isServer = this.options.isServer ?? typeof document > "u", this.pathParamsDecodeCharMap = this.options.pathParamsAllowedCharacters ? new Map(
|
|
1162
|
+
this.options.pathParamsAllowedCharacters.map((s) => [
|
|
1163
|
+
encodeURIComponent(s),
|
|
1164
|
+
s
|
|
1165
|
+
])
|
|
1166
|
+
) : void 0, (!this.basepath || e.basepath && e.basepath !== o.basepath) && (e.basepath === void 0 || e.basepath === "" || e.basepath === "/" ? this.basepath = "/" : this.basepath = `/${vn(e.basepath)}`), // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
1167
|
+
(!this.history || this.options.history && this.options.history !== this.history) && (this.history = this.options.history ?? (this.isServer ? Dt({
|
|
1168
|
+
initialEntries: [this.basepath || "/"]
|
|
1169
|
+
}) : _t()), this.latestLocation = this.parseLocation()), this.options.routeTree !== this.routeTree && (this.routeTree = this.options.routeTree, this.buildRouteTree()), this.__store || (this.__store = new nt(En(this.latestLocation), {
|
|
1170
|
+
onUpdate: () => {
|
|
1171
|
+
this.__store.state = {
|
|
1172
|
+
...this.state,
|
|
1173
|
+
cachedMatches: this.state.cachedMatches.filter(
|
|
1174
|
+
(s) => !["redirected"].includes(s.status)
|
|
1175
|
+
)
|
|
1176
|
+
};
|
|
1177
|
+
}
|
|
1178
|
+
})), typeof window < "u" && "CSS" in window && // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
1179
|
+
typeof ((r = window.CSS) == null ? void 0 : r.supports) == "function" && (this.isViewTransitionTypesSupported = window.CSS.supports(
|
|
1180
|
+
"selector(:active-view-transition-type(a)"
|
|
1181
|
+
));
|
|
1182
|
+
}, this.buildRouteTree = () => {
|
|
1183
|
+
this.routesById = {}, this.routesByPath = {};
|
|
1184
|
+
const e = this.options.notFoundRoute;
|
|
1185
|
+
e && (e.init({
|
|
1186
|
+
originalIndex: 99999999999,
|
|
1187
|
+
defaultSsr: this.options.defaultSsr
|
|
1188
|
+
}), this.routesById[e.id] = e);
|
|
1189
|
+
const r = (i) => {
|
|
1190
|
+
i.forEach((a, l) => {
|
|
1191
|
+
a.init({
|
|
1192
|
+
originalIndex: l,
|
|
1193
|
+
defaultSsr: this.options.defaultSsr
|
|
1194
|
+
});
|
|
1195
|
+
const c = this.routesById[a.id];
|
|
1196
|
+
if (te(
|
|
1197
|
+
!c,
|
|
1198
|
+
`Duplicate routes found with id: ${String(a.id)}`
|
|
1199
|
+
), this.routesById[a.id] = a, !a.isRoot && a.path) {
|
|
1200
|
+
const u = le(a.fullPath);
|
|
1201
|
+
(!this.routesByPath[u] || a.fullPath.endsWith("/")) && (this.routesByPath[u] = a);
|
|
1202
|
+
}
|
|
1203
|
+
const d = a.children;
|
|
1204
|
+
d?.length && r(d);
|
|
1205
|
+
});
|
|
1206
|
+
};
|
|
1207
|
+
r([this.routeTree]);
|
|
1208
|
+
const o = [];
|
|
1209
|
+
Object.values(this.routesById).forEach((i, a) => {
|
|
1210
|
+
var l;
|
|
1211
|
+
if (i.isRoot || !i.path)
|
|
1212
|
+
return;
|
|
1213
|
+
const c = at(i.fullPath), d = _e(c);
|
|
1214
|
+
for (; d.length > 1 && ((l = d[0]) == null ? void 0 : l.value) === "/"; )
|
|
1215
|
+
d.shift();
|
|
1216
|
+
const u = d.map((h) => h.value === "/" ? 0.75 : h.type === "param" ? 0.5 : h.type === "wildcard" ? 0.25 : 1);
|
|
1217
|
+
o.push({ child: i, trimmed: c, parsed: d, index: a, scores: u });
|
|
1218
|
+
}), this.flatRoutes = o.sort((i, a) => {
|
|
1219
|
+
const l = Math.min(i.scores.length, a.scores.length);
|
|
1220
|
+
for (let c = 0; c < l; c++)
|
|
1221
|
+
if (i.scores[c] !== a.scores[c])
|
|
1222
|
+
return a.scores[c] - i.scores[c];
|
|
1223
|
+
if (i.scores.length !== a.scores.length)
|
|
1224
|
+
return a.scores.length - i.scores.length;
|
|
1225
|
+
for (let c = 0; c < l; c++)
|
|
1226
|
+
if (i.parsed[c].value !== a.parsed[c].value)
|
|
1227
|
+
return i.parsed[c].value > a.parsed[c].value ? 1 : -1;
|
|
1228
|
+
return i.index - a.index;
|
|
1229
|
+
}).map((i, a) => (i.child.rank = a, i.child));
|
|
1230
|
+
}, this.subscribe = (e, r) => {
|
|
1231
|
+
const o = {
|
|
1232
|
+
eventType: e,
|
|
1233
|
+
fn: r
|
|
1234
|
+
};
|
|
1235
|
+
return this.subscribers.add(o), () => {
|
|
1236
|
+
this.subscribers.delete(o);
|
|
1237
|
+
};
|
|
1238
|
+
}, this.emit = (e) => {
|
|
1239
|
+
this.subscribers.forEach((r) => {
|
|
1240
|
+
r.eventType === e.type && r.fn(e);
|
|
1241
|
+
});
|
|
1242
|
+
}, this.parseLocation = (e, r) => {
|
|
1243
|
+
const o = ({
|
|
1244
|
+
pathname: l,
|
|
1245
|
+
search: c,
|
|
1246
|
+
hash: d,
|
|
1247
|
+
state: u
|
|
1248
|
+
}) => {
|
|
1249
|
+
const h = this.options.parseSearch(c), f = this.options.stringifySearch(h);
|
|
1250
|
+
return {
|
|
1251
|
+
pathname: l,
|
|
1252
|
+
searchStr: f,
|
|
1253
|
+
search: X(e?.search, h),
|
|
1254
|
+
hash: d.split("#").reverse()[0] ?? "",
|
|
1255
|
+
href: `${l}${f}${d}`,
|
|
1256
|
+
state: X(e?.state, u)
|
|
1257
|
+
};
|
|
1258
|
+
}, s = o(r ?? this.history.location), { __tempLocation: i, __tempKey: a } = s.state;
|
|
1259
|
+
if (i && (!a || a === this.tempLocationKey)) {
|
|
1260
|
+
const l = o(i);
|
|
1261
|
+
return l.state.key = s.state.key, delete l.state.__tempLocation, {
|
|
1262
|
+
...l,
|
|
1263
|
+
maskedLocation: s
|
|
1264
|
+
};
|
|
1265
|
+
}
|
|
1266
|
+
return s;
|
|
1267
|
+
}, this.resolvePathWithBase = (e, r) => _n({
|
|
1268
|
+
basepath: this.basepath,
|
|
1269
|
+
base: e,
|
|
1270
|
+
to: $e(r),
|
|
1271
|
+
trailingSlash: this.options.trailingSlash,
|
|
1272
|
+
caseSensitive: this.options.caseSensitive
|
|
1273
|
+
}), this.getMatchedRoutes = (e, r) => {
|
|
1274
|
+
let o = {};
|
|
1275
|
+
const s = le(e.pathname), i = (d) => Fe(this.basepath, s, {
|
|
1276
|
+
to: d.fullPath,
|
|
1277
|
+
caseSensitive: d.options.caseSensitive ?? this.options.caseSensitive,
|
|
1278
|
+
fuzzy: !0
|
|
1279
|
+
});
|
|
1280
|
+
let a = r?.to !== void 0 ? this.routesByPath[r.to] : void 0;
|
|
1281
|
+
a ? o = i(a) : a = this.flatRoutes.find((d) => {
|
|
1282
|
+
const u = i(d);
|
|
1283
|
+
return u ? (o = u, !0) : !1;
|
|
1284
|
+
});
|
|
1285
|
+
let l = a || this.routesById[H];
|
|
1286
|
+
const c = [l];
|
|
1287
|
+
for (; l.parentRoute; )
|
|
1288
|
+
l = l.parentRoute, c.unshift(l);
|
|
1289
|
+
return { matchedRoutes: c, routeParams: o, foundRoute: a };
|
|
1290
|
+
}, this.cancelMatch = (e) => {
|
|
1291
|
+
const r = this.getMatch(e);
|
|
1292
|
+
r && (r.abortController.abort(), clearTimeout(r.pendingTimeout));
|
|
1293
|
+
}, this.cancelMatches = () => {
|
|
1294
|
+
var e;
|
|
1295
|
+
(e = this.state.pendingMatches) == null || e.forEach((r) => {
|
|
1296
|
+
this.cancelMatch(r.id);
|
|
1297
|
+
});
|
|
1298
|
+
}, this.buildLocation = (e) => {
|
|
1299
|
+
const r = (s = {}, i) => {
|
|
1300
|
+
var a, l, c, d, u, h;
|
|
1301
|
+
const f = s._fromLocation ? this.matchRoutes(s._fromLocation, { _buildLocation: !0 }) : this.state.matches, p = s.from != null ? f.find(
|
|
1302
|
+
(m) => Fe(this.basepath, le(m.pathname), {
|
|
1303
|
+
to: s.from,
|
|
1304
|
+
caseSensitive: !1,
|
|
1305
|
+
fuzzy: !1
|
|
1306
|
+
})
|
|
1307
|
+
) : void 0, S = p?.pathname || this.latestLocation.pathname;
|
|
1308
|
+
te(
|
|
1309
|
+
s.from == null || p != null,
|
|
1310
|
+
"Could not find match for from: " + s.from
|
|
1311
|
+
);
|
|
1312
|
+
const y = (a = this.state.pendingMatches) != null && a.length ? (l = Le(this.state.pendingMatches)) == null ? void 0 : l.search : ((c = Le(f)) == null ? void 0 : c.search) || this.latestLocation.search, M = i?.matchedRoutes.filter(
|
|
1313
|
+
(m) => f.find((w) => w.routeId === m.id)
|
|
1314
|
+
);
|
|
1315
|
+
let R;
|
|
1316
|
+
if (s.to)
|
|
1317
|
+
R = this.resolvePathWithBase(S, `${s.to}`);
|
|
1318
|
+
else {
|
|
1319
|
+
const m = this.routesById[(d = M?.find((w) => {
|
|
1320
|
+
const k = ke({
|
|
1321
|
+
path: w.fullPath,
|
|
1322
|
+
params: i?.routeParams ?? {},
|
|
1323
|
+
decodeCharMap: this.pathParamsDecodeCharMap
|
|
1324
|
+
});
|
|
1325
|
+
return re([this.basepath, k]) === S;
|
|
1326
|
+
})) == null ? void 0 : d.id];
|
|
1327
|
+
R = this.resolvePathWithBase(
|
|
1328
|
+
S,
|
|
1329
|
+
m?.to ?? S
|
|
1330
|
+
);
|
|
1331
|
+
}
|
|
1332
|
+
const L = { ...(u = Le(f)) == null ? void 0 : u.params };
|
|
1333
|
+
let P = (s.params ?? !0) === !0 ? L : {
|
|
1334
|
+
...L,
|
|
1335
|
+
...ue(s.params, L)
|
|
1336
|
+
};
|
|
1337
|
+
Object.keys(P).length > 0 && i?.matchedRoutes.map((m) => {
|
|
1338
|
+
var w;
|
|
1339
|
+
return ((w = m.options.params) == null ? void 0 : w.stringify) ?? m.options.stringifyParams;
|
|
1340
|
+
}).filter(Boolean).forEach((m) => {
|
|
1341
|
+
P = { ...P, ...m(P) };
|
|
1342
|
+
}), R = ke({
|
|
1343
|
+
path: R,
|
|
1344
|
+
params: P ?? {},
|
|
1345
|
+
leaveWildcards: !1,
|
|
1346
|
+
leaveParams: e.leaveParams,
|
|
1347
|
+
decodeCharMap: this.pathParamsDecodeCharMap
|
|
1348
|
+
});
|
|
1349
|
+
let g = y;
|
|
1350
|
+
if (e._includeValidateSearch && ((h = this.options.search) != null && h.strict)) {
|
|
1351
|
+
let m = {};
|
|
1352
|
+
i?.matchedRoutes.forEach((w) => {
|
|
1353
|
+
try {
|
|
1354
|
+
w.options.validateSearch && (m = {
|
|
1355
|
+
...m,
|
|
1356
|
+
...Ye(w.options.validateSearch, {
|
|
1357
|
+
...m,
|
|
1358
|
+
...g
|
|
1359
|
+
}) ?? {}
|
|
1360
|
+
});
|
|
1361
|
+
} catch {
|
|
1362
|
+
}
|
|
1363
|
+
}), g = m;
|
|
1364
|
+
}
|
|
1365
|
+
g = ((m) => {
|
|
1366
|
+
const w = i?.matchedRoutes.reduce(
|
|
1367
|
+
(I, D) => {
|
|
1368
|
+
var W;
|
|
1369
|
+
const q = [];
|
|
1370
|
+
if ("search" in D.options)
|
|
1371
|
+
(W = D.options.search) != null && W.middlewares && q.push(...D.options.search.middlewares);
|
|
1372
|
+
else if (D.options.preSearchFilters || D.options.postSearchFilters) {
|
|
1373
|
+
const J = ({
|
|
1374
|
+
search: j,
|
|
1375
|
+
next: ne
|
|
1376
|
+
}) => {
|
|
1377
|
+
let O = j;
|
|
1378
|
+
"preSearchFilters" in D.options && D.options.preSearchFilters && (O = D.options.preSearchFilters.reduce(
|
|
1379
|
+
(V, A) => A(V),
|
|
1380
|
+
j
|
|
1381
|
+
));
|
|
1382
|
+
const K = ne(O);
|
|
1383
|
+
return "postSearchFilters" in D.options && D.options.postSearchFilters ? D.options.postSearchFilters.reduce(
|
|
1384
|
+
(V, A) => A(V),
|
|
1385
|
+
K
|
|
1386
|
+
) : K;
|
|
1387
|
+
};
|
|
1388
|
+
q.push(J);
|
|
1389
|
+
}
|
|
1390
|
+
if (e._includeValidateSearch && D.options.validateSearch) {
|
|
1391
|
+
const J = ({ search: j, next: ne }) => {
|
|
1392
|
+
try {
|
|
1393
|
+
const O = ne(j);
|
|
1394
|
+
return {
|
|
1395
|
+
...O,
|
|
1396
|
+
...Ye(
|
|
1397
|
+
D.options.validateSearch,
|
|
1398
|
+
O
|
|
1399
|
+
) ?? {}
|
|
1400
|
+
};
|
|
1401
|
+
} catch {
|
|
1402
|
+
}
|
|
1403
|
+
};
|
|
1404
|
+
q.push(J);
|
|
1405
|
+
}
|
|
1406
|
+
return I.concat(q);
|
|
1407
|
+
},
|
|
1408
|
+
[]
|
|
1409
|
+
) ?? [], k = ({ search: I }) => s.search ? s.search === !0 ? I : ue(s.search, I) : {};
|
|
1410
|
+
w.push(k);
|
|
1411
|
+
const T = (I, D) => {
|
|
1412
|
+
if (I >= w.length)
|
|
1413
|
+
return D;
|
|
1414
|
+
const W = w[I];
|
|
1415
|
+
return W({ search: D, next: (J) => T(I + 1, J) });
|
|
1416
|
+
};
|
|
1417
|
+
return T(0, m);
|
|
1418
|
+
})(g), g = X(y, g);
|
|
1419
|
+
const F = this.options.stringifySearch(g), v = s.hash === !0 ? this.latestLocation.hash : s.hash ? ue(s.hash, this.latestLocation.hash) : void 0, _ = v ? `#${v}` : "";
|
|
1420
|
+
let E = s.state === !0 ? this.latestLocation.state : s.state ? ue(s.state, this.latestLocation.state) : {};
|
|
1421
|
+
return E = X(this.latestLocation.state, E), {
|
|
1422
|
+
pathname: R,
|
|
1423
|
+
search: g,
|
|
1424
|
+
searchStr: F,
|
|
1425
|
+
state: E,
|
|
1426
|
+
hash: v ?? "",
|
|
1427
|
+
href: `${R}${F}${_}`,
|
|
1428
|
+
unmaskOnReload: s.unmaskOnReload
|
|
1429
|
+
};
|
|
1430
|
+
}, o = (s = {}, i) => {
|
|
1431
|
+
var a;
|
|
1432
|
+
const l = r(s);
|
|
1433
|
+
let c = i ? r(i) : void 0;
|
|
1434
|
+
if (!c) {
|
|
1435
|
+
let h = {};
|
|
1436
|
+
const f = (a = this.options.routeMasks) == null ? void 0 : a.find((p) => {
|
|
1437
|
+
const S = Fe(this.basepath, l.pathname, {
|
|
1438
|
+
to: p.from,
|
|
1439
|
+
caseSensitive: !1,
|
|
1440
|
+
fuzzy: !1
|
|
1441
|
+
});
|
|
1442
|
+
return S ? (h = S, !0) : !1;
|
|
1443
|
+
});
|
|
1444
|
+
if (f) {
|
|
1445
|
+
const { from: p, ...S } = f;
|
|
1446
|
+
i = {
|
|
1447
|
+
...rt(e, ["from"]),
|
|
1448
|
+
...S,
|
|
1449
|
+
params: h
|
|
1450
|
+
}, c = r(i);
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
const d = this.getMatchedRoutes(l, s), u = r(s, d);
|
|
1454
|
+
if (c) {
|
|
1455
|
+
const h = this.getMatchedRoutes(c, i), f = r(i, h);
|
|
1456
|
+
u.maskedLocation = f;
|
|
1457
|
+
}
|
|
1458
|
+
return u;
|
|
1459
|
+
};
|
|
1460
|
+
return e.mask ? o(e, {
|
|
1461
|
+
...rt(e, ["from"]),
|
|
1462
|
+
...e.mask
|
|
1463
|
+
}) : o(e);
|
|
1464
|
+
}, this.commitLocation = ({
|
|
1465
|
+
viewTransition: e,
|
|
1466
|
+
ignoreBlocker: r,
|
|
1467
|
+
...o
|
|
1468
|
+
}) => {
|
|
1469
|
+
const s = () => {
|
|
1470
|
+
o.state.key = this.latestLocation.state.key;
|
|
1471
|
+
const l = ye(o.state, this.latestLocation.state);
|
|
1472
|
+
return delete o.state.key, l;
|
|
1473
|
+
}, i = this.latestLocation.href === o.href, a = this.commitLocationPromise;
|
|
1474
|
+
if (this.commitLocationPromise = pe(() => {
|
|
1475
|
+
a?.resolve();
|
|
1476
|
+
}), i && s())
|
|
1477
|
+
this.load();
|
|
1478
|
+
else {
|
|
1479
|
+
let { maskedLocation: l, hashScrollIntoView: c, ...d } = o;
|
|
1480
|
+
l && (d = {
|
|
1481
|
+
...l,
|
|
1482
|
+
state: {
|
|
1483
|
+
...l.state,
|
|
1484
|
+
__tempKey: void 0,
|
|
1485
|
+
__tempLocation: {
|
|
1486
|
+
...d,
|
|
1487
|
+
search: d.searchStr,
|
|
1488
|
+
state: {
|
|
1489
|
+
...d.state,
|
|
1490
|
+
__tempKey: void 0,
|
|
1491
|
+
__tempLocation: void 0,
|
|
1492
|
+
key: void 0
|
|
1493
|
+
}
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
}, (d.unmaskOnReload ?? this.options.unmaskOnReload ?? !1) && (d.state.__tempKey = this.tempLocationKey)), d.state.__hashScrollIntoViewOptions = c ?? this.options.defaultHashScrollIntoView ?? !0, this.shouldViewTransition = e, this.history[o.replace ? "replace" : "push"](
|
|
1497
|
+
d.href,
|
|
1498
|
+
d.state,
|
|
1499
|
+
{ ignoreBlocker: r }
|
|
1500
|
+
);
|
|
1501
|
+
}
|
|
1502
|
+
return this.resetNextScroll = o.resetScroll ?? !0, this.history.subscribers.size || this.load(), this.commitLocationPromise;
|
|
1503
|
+
}, this.buildAndCommitLocation = ({
|
|
1504
|
+
replace: e,
|
|
1505
|
+
resetScroll: r,
|
|
1506
|
+
hashScrollIntoView: o,
|
|
1507
|
+
viewTransition: s,
|
|
1508
|
+
ignoreBlocker: i,
|
|
1509
|
+
href: a,
|
|
1510
|
+
...l
|
|
1511
|
+
} = {}) => {
|
|
1512
|
+
if (a) {
|
|
1513
|
+
const d = this.history.location.state.__TSR_index, u = ve(a, {
|
|
1514
|
+
__TSR_index: e ? d : d + 1
|
|
1515
|
+
});
|
|
1516
|
+
l.to = u.pathname, l.search = this.options.parseSearch(u.search), l.hash = u.hash.slice(1);
|
|
1517
|
+
}
|
|
1518
|
+
const c = this.buildLocation({
|
|
1519
|
+
...l,
|
|
1520
|
+
_includeValidateSearch: !0
|
|
1521
|
+
});
|
|
1522
|
+
return this.commitLocation({
|
|
1523
|
+
...c,
|
|
1524
|
+
viewTransition: s,
|
|
1525
|
+
replace: e,
|
|
1526
|
+
resetScroll: r,
|
|
1527
|
+
hashScrollIntoView: o,
|
|
1528
|
+
ignoreBlocker: i
|
|
1529
|
+
});
|
|
1530
|
+
}, this.navigate = ({ to: e, reloadDocument: r, href: o, ...s }) => {
|
|
1531
|
+
if (r) {
|
|
1532
|
+
o || (o = this.buildLocation({ to: e, ...s }).href), s.replace ? window.location.replace(o) : window.location.href = o;
|
|
1533
|
+
return;
|
|
1534
|
+
}
|
|
1535
|
+
return this.buildAndCommitLocation({
|
|
1536
|
+
...s,
|
|
1537
|
+
href: o,
|
|
1538
|
+
to: e
|
|
1539
|
+
});
|
|
1540
|
+
}, this.load = async (e) => {
|
|
1541
|
+
this.latestLocation = this.parseLocation(this.latestLocation);
|
|
1542
|
+
let r, o, s;
|
|
1543
|
+
for (s = new Promise((i) => {
|
|
1544
|
+
this.startReactTransition(async () => {
|
|
1545
|
+
var a;
|
|
1546
|
+
try {
|
|
1547
|
+
const l = this.latestLocation, c = this.state.resolvedLocation, d = c.href !== l.href, u = c.pathname !== l.pathname;
|
|
1548
|
+
this.cancelMatches();
|
|
1549
|
+
let h;
|
|
1550
|
+
Ge(() => {
|
|
1551
|
+
h = this.matchRoutes(l), this.__store.setState((f) => ({
|
|
1552
|
+
...f,
|
|
1553
|
+
status: "pending",
|
|
1554
|
+
isLoading: !0,
|
|
1555
|
+
location: l,
|
|
1556
|
+
pendingMatches: h,
|
|
1557
|
+
// If a cached moved to pendingMatches, remove it from cachedMatches
|
|
1558
|
+
cachedMatches: f.cachedMatches.filter((p) => !h.find((S) => S.id === p.id))
|
|
1559
|
+
}));
|
|
1560
|
+
}), this.state.redirect || this.emit({
|
|
1561
|
+
type: "onBeforeNavigate",
|
|
1562
|
+
fromLocation: c,
|
|
1563
|
+
toLocation: l,
|
|
1564
|
+
pathChanged: u,
|
|
1565
|
+
hrefChanged: d
|
|
1566
|
+
}), this.emit({
|
|
1567
|
+
type: "onBeforeLoad",
|
|
1568
|
+
fromLocation: c,
|
|
1569
|
+
toLocation: l,
|
|
1570
|
+
pathChanged: u,
|
|
1571
|
+
hrefChanged: d
|
|
1572
|
+
}), await this.loadMatches({
|
|
1573
|
+
sync: e?.sync,
|
|
1574
|
+
matches: h,
|
|
1575
|
+
location: l,
|
|
1576
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
1577
|
+
onReady: async () => {
|
|
1578
|
+
this.startViewTransition(async () => {
|
|
1579
|
+
let f, p, S;
|
|
1580
|
+
Ge(() => {
|
|
1581
|
+
this.__store.setState((y) => {
|
|
1582
|
+
const M = y.matches, R = y.pendingMatches || y.matches;
|
|
1583
|
+
return f = M.filter(
|
|
1584
|
+
(L) => !R.find((P) => P.id === L.id)
|
|
1585
|
+
), p = R.filter(
|
|
1586
|
+
(L) => !M.find((P) => P.id === L.id)
|
|
1587
|
+
), S = M.filter(
|
|
1588
|
+
(L) => R.find((P) => P.id === L.id)
|
|
1589
|
+
), {
|
|
1590
|
+
...y,
|
|
1591
|
+
isLoading: !1,
|
|
1592
|
+
loadedAt: Date.now(),
|
|
1593
|
+
matches: R,
|
|
1594
|
+
pendingMatches: void 0,
|
|
1595
|
+
cachedMatches: [
|
|
1596
|
+
...y.cachedMatches,
|
|
1597
|
+
...f.filter((L) => L.status !== "error")
|
|
1598
|
+
]
|
|
1599
|
+
};
|
|
1600
|
+
}), this.clearExpiredCache();
|
|
1601
|
+
}), [
|
|
1602
|
+
[f, "onLeave"],
|
|
1603
|
+
[p, "onEnter"],
|
|
1604
|
+
[S, "onStay"]
|
|
1605
|
+
].forEach(([y, M]) => {
|
|
1606
|
+
y.forEach((R) => {
|
|
1607
|
+
var L, P;
|
|
1608
|
+
(P = (L = this.looseRoutesById[R.routeId].options)[M]) == null || P.call(L, R);
|
|
1609
|
+
});
|
|
1610
|
+
});
|
|
1611
|
+
});
|
|
1612
|
+
}
|
|
1613
|
+
});
|
|
1614
|
+
} catch (l) {
|
|
1615
|
+
qe(l) ? (r = l, this.isServer || this.navigate({
|
|
1616
|
+
...r,
|
|
1617
|
+
replace: !0,
|
|
1618
|
+
ignoreBlocker: !0
|
|
1619
|
+
})) : ee(l) && (o = l), this.__store.setState((c) => ({
|
|
1620
|
+
...c,
|
|
1621
|
+
statusCode: r ? r.statusCode : o ? 404 : c.matches.some((d) => d.status === "error") ? 500 : 200,
|
|
1622
|
+
redirect: r
|
|
1623
|
+
}));
|
|
1624
|
+
}
|
|
1625
|
+
this.latestLoadPromise === s && ((a = this.commitLocationPromise) == null || a.resolve(), this.latestLoadPromise = void 0, this.commitLocationPromise = void 0), i();
|
|
1626
|
+
});
|
|
1627
|
+
}), this.latestLoadPromise = s, await s; this.latestLoadPromise && s !== this.latestLoadPromise; )
|
|
1628
|
+
await this.latestLoadPromise;
|
|
1629
|
+
}, this.startViewTransition = (e) => {
|
|
1630
|
+
const r = this.shouldViewTransition ?? this.options.defaultViewTransition;
|
|
1631
|
+
if (delete this.shouldViewTransition, r && typeof document < "u" && "startViewTransition" in document && typeof document.startViewTransition == "function") {
|
|
1632
|
+
let o;
|
|
1633
|
+
typeof r == "object" && this.isViewTransitionTypesSupported ? o = {
|
|
1634
|
+
update: e,
|
|
1635
|
+
types: r.types
|
|
1636
|
+
} : o = e, document.startViewTransition(o);
|
|
1637
|
+
} else
|
|
1638
|
+
e();
|
|
1639
|
+
}, this.updateMatch = (e, r) => {
|
|
1640
|
+
var o;
|
|
1641
|
+
let s;
|
|
1642
|
+
const i = (o = this.state.pendingMatches) == null ? void 0 : o.find((d) => d.id === e), a = this.state.matches.find((d) => d.id === e), l = this.state.cachedMatches.find((d) => d.id === e), c = i ? "pendingMatches" : a ? "matches" : l ? "cachedMatches" : "";
|
|
1643
|
+
return c && this.__store.setState((d) => {
|
|
1644
|
+
var u;
|
|
1645
|
+
return {
|
|
1646
|
+
...d,
|
|
1647
|
+
[c]: (u = d[c]) == null ? void 0 : u.map(
|
|
1648
|
+
(h) => h.id === e ? s = r(h) : h
|
|
1649
|
+
)
|
|
1650
|
+
};
|
|
1651
|
+
}), s;
|
|
1652
|
+
}, this.getMatch = (e) => [
|
|
1653
|
+
...this.state.cachedMatches,
|
|
1654
|
+
...this.state.pendingMatches ?? [],
|
|
1655
|
+
...this.state.matches
|
|
1656
|
+
].find((r) => r.id === e), this.loadMatches = async ({
|
|
1657
|
+
location: e,
|
|
1658
|
+
matches: r,
|
|
1659
|
+
preload: o,
|
|
1660
|
+
onReady: s,
|
|
1661
|
+
updateMatch: i = this.updateMatch,
|
|
1662
|
+
sync: a
|
|
1663
|
+
}) => {
|
|
1664
|
+
let l, c = !1;
|
|
1665
|
+
const d = async () => {
|
|
1666
|
+
c || (c = !0, await s?.());
|
|
1667
|
+
}, u = (f) => !!(o && !this.state.matches.find((p) => p.id === f));
|
|
1668
|
+
!this.isServer && !this.state.matches.length && d();
|
|
1669
|
+
const h = (f, p) => {
|
|
1670
|
+
var S, y, M;
|
|
1671
|
+
if (qe(p) && !p.reloadDocument)
|
|
1672
|
+
throw p;
|
|
1673
|
+
if (ce(p) || ee(p)) {
|
|
1674
|
+
if (i(f.id, (R) => ({
|
|
1675
|
+
...R,
|
|
1676
|
+
status: ce(p) ? "redirected" : ee(p) ? "notFound" : "error",
|
|
1677
|
+
isFetching: !1,
|
|
1678
|
+
error: p,
|
|
1679
|
+
beforeLoadPromise: void 0,
|
|
1680
|
+
loaderPromise: void 0
|
|
1681
|
+
})), p.routeId || (p.routeId = f.routeId), (S = f.beforeLoadPromise) == null || S.resolve(), (y = f.loaderPromise) == null || y.resolve(), (M = f.loadPromise) == null || M.resolve(), ce(p))
|
|
1682
|
+
throw c = !0, p = this.resolveRedirect({ ...p, _fromLocation: e }), p;
|
|
1683
|
+
if (ee(p))
|
|
1684
|
+
throw this._handleNotFound(r, p, {
|
|
1685
|
+
updateMatch: i
|
|
1686
|
+
}), p;
|
|
1687
|
+
}
|
|
1688
|
+
};
|
|
1689
|
+
try {
|
|
1690
|
+
await new Promise((f, p) => {
|
|
1691
|
+
(async () => {
|
|
1692
|
+
var S, y, M;
|
|
1693
|
+
try {
|
|
1694
|
+
const R = (g, x, F) => {
|
|
1695
|
+
var v, _;
|
|
1696
|
+
const { id: E, routeId: m } = r[g], w = this.looseRoutesById[m];
|
|
1697
|
+
if (x instanceof Promise)
|
|
1698
|
+
throw x;
|
|
1699
|
+
x.routerCode = F, l = l ?? g, h(this.getMatch(E), x);
|
|
1700
|
+
try {
|
|
1701
|
+
(_ = (v = w.options).onError) == null || _.call(v, x);
|
|
1702
|
+
} catch (k) {
|
|
1703
|
+
x = k, h(this.getMatch(E), x);
|
|
1704
|
+
}
|
|
1705
|
+
i(E, (k) => {
|
|
1706
|
+
var T, I;
|
|
1707
|
+
return (T = k.beforeLoadPromise) == null || T.resolve(), (I = k.loadPromise) == null || I.resolve(), {
|
|
1708
|
+
...k,
|
|
1709
|
+
error: x,
|
|
1710
|
+
status: "error",
|
|
1711
|
+
isFetching: !1,
|
|
1712
|
+
updatedAt: Date.now(),
|
|
1713
|
+
abortController: new AbortController(),
|
|
1714
|
+
beforeLoadPromise: void 0
|
|
1715
|
+
};
|
|
1716
|
+
});
|
|
1717
|
+
};
|
|
1718
|
+
for (const [g, { id: x, routeId: F }] of r.entries()) {
|
|
1719
|
+
const v = this.getMatch(x), _ = (S = r[g - 1]) == null ? void 0 : S.id, E = this.looseRoutesById[F], m = E.options.pendingMs ?? this.options.defaultPendingMs, w = !!(s && !this.isServer && !u(x) && (E.options.loader || E.options.beforeLoad) && typeof m == "number" && m !== 1 / 0 && (E.options.pendingComponent ?? this.options.defaultPendingComponent));
|
|
1720
|
+
let k = !0;
|
|
1721
|
+
if (
|
|
1722
|
+
// If we are in the middle of a load, either of these will be present
|
|
1723
|
+
// (not to be confused with `loadPromise`, which is always defined)
|
|
1724
|
+
(v.beforeLoadPromise || v.loaderPromise) && (w && setTimeout(() => {
|
|
1725
|
+
try {
|
|
1726
|
+
d();
|
|
1727
|
+
} catch {
|
|
1728
|
+
}
|
|
1729
|
+
}, m), await v.beforeLoadPromise, k = this.getMatch(x).status !== "success"), k
|
|
1730
|
+
) {
|
|
1731
|
+
try {
|
|
1732
|
+
i(x, (N) => ({
|
|
1733
|
+
...N,
|
|
1734
|
+
loadPromise: pe(() => {
|
|
1735
|
+
var G;
|
|
1736
|
+
(G = N.loadPromise) == null || G.resolve();
|
|
1737
|
+
}),
|
|
1738
|
+
beforeLoadPromise: pe()
|
|
1739
|
+
}));
|
|
1740
|
+
const T = new AbortController();
|
|
1741
|
+
let I;
|
|
1742
|
+
w && (I = setTimeout(() => {
|
|
1743
|
+
try {
|
|
1744
|
+
d();
|
|
1745
|
+
} catch {
|
|
1746
|
+
}
|
|
1747
|
+
}, m));
|
|
1748
|
+
const { paramsError: D, searchError: W } = this.getMatch(x);
|
|
1749
|
+
D && R(g, D, "PARSE_PARAMS"), W && R(g, W, "VALIDATE_SEARCH");
|
|
1750
|
+
const q = () => _ ? this.getMatch(_).context : this.options.context ?? {};
|
|
1751
|
+
i(x, (N) => ({
|
|
1752
|
+
...N,
|
|
1753
|
+
isFetching: "beforeLoad",
|
|
1754
|
+
fetchCount: N.fetchCount + 1,
|
|
1755
|
+
abortController: T,
|
|
1756
|
+
pendingTimeout: I,
|
|
1757
|
+
context: {
|
|
1758
|
+
...q(),
|
|
1759
|
+
...N.__routeContext
|
|
1760
|
+
}
|
|
1761
|
+
}));
|
|
1762
|
+
const { search: J, params: j, context: ne, cause: O } = this.getMatch(x), K = u(x), V = {
|
|
1763
|
+
search: J,
|
|
1764
|
+
abortController: T,
|
|
1765
|
+
params: j,
|
|
1766
|
+
preload: K,
|
|
1767
|
+
context: ne,
|
|
1768
|
+
location: e,
|
|
1769
|
+
navigate: (N) => this.navigate({ ...N, _fromLocation: e }),
|
|
1770
|
+
buildLocation: this.buildLocation,
|
|
1771
|
+
cause: K ? "preload" : O,
|
|
1772
|
+
matches: r
|
|
1773
|
+
}, A = await ((M = (y = E.options).beforeLoad) == null ? void 0 : M.call(y, V)) ?? {};
|
|
1774
|
+
(ce(A) || ee(A)) && R(g, A, "BEFORE_LOAD"), i(x, (N) => ({
|
|
1775
|
+
...N,
|
|
1776
|
+
__beforeLoadContext: A,
|
|
1777
|
+
context: {
|
|
1778
|
+
...q(),
|
|
1779
|
+
...N.__routeContext,
|
|
1780
|
+
...A
|
|
1781
|
+
},
|
|
1782
|
+
abortController: T
|
|
1783
|
+
}));
|
|
1784
|
+
} catch (T) {
|
|
1785
|
+
R(g, T, "BEFORE_LOAD");
|
|
1786
|
+
}
|
|
1787
|
+
i(x, (T) => {
|
|
1788
|
+
var I;
|
|
1789
|
+
return (I = T.beforeLoadPromise) == null || I.resolve(), {
|
|
1790
|
+
...T,
|
|
1791
|
+
beforeLoadPromise: void 0,
|
|
1792
|
+
isFetching: !1
|
|
1793
|
+
};
|
|
1794
|
+
});
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
const L = r.slice(0, l), P = [];
|
|
1798
|
+
L.forEach(({ id: g, routeId: x }, F) => {
|
|
1799
|
+
P.push(
|
|
1800
|
+
(async () => {
|
|
1801
|
+
const { loaderPromise: v } = this.getMatch(g);
|
|
1802
|
+
let _ = !1, E = !1;
|
|
1803
|
+
if (v) {
|
|
1804
|
+
await v;
|
|
1805
|
+
const m = this.getMatch(g);
|
|
1806
|
+
m.error && h(m, m.error);
|
|
1807
|
+
} else {
|
|
1808
|
+
const m = P[F - 1], w = this.looseRoutesById[x], k = () => {
|
|
1809
|
+
const {
|
|
1810
|
+
params: O,
|
|
1811
|
+
loaderDeps: K,
|
|
1812
|
+
abortController: V,
|
|
1813
|
+
context: A,
|
|
1814
|
+
cause: N
|
|
1815
|
+
} = this.getMatch(g), G = u(g);
|
|
1816
|
+
return {
|
|
1817
|
+
params: O,
|
|
1818
|
+
deps: K,
|
|
1819
|
+
preload: !!G,
|
|
1820
|
+
parentMatchPromise: m,
|
|
1821
|
+
abortController: V,
|
|
1822
|
+
context: A,
|
|
1823
|
+
location: e,
|
|
1824
|
+
navigate: (Y) => this.navigate({ ...Y, _fromLocation: e }),
|
|
1825
|
+
cause: G ? "preload" : N,
|
|
1826
|
+
route: w
|
|
1827
|
+
};
|
|
1828
|
+
}, T = Date.now() - this.getMatch(g).updatedAt, I = u(g), D = I ? w.options.preloadStaleTime ?? this.options.defaultPreloadStaleTime ?? 3e4 : w.options.staleTime ?? this.options.defaultStaleTime ?? 0, W = w.options.shouldReload, q = typeof W == "function" ? W(k()) : W;
|
|
1829
|
+
i(g, (O) => ({
|
|
1830
|
+
...O,
|
|
1831
|
+
loaderPromise: pe(),
|
|
1832
|
+
preload: !!I && !this.state.matches.find((K) => K.id === g)
|
|
1833
|
+
}));
|
|
1834
|
+
const J = async () => {
|
|
1835
|
+
var O, K, V, A, N, G, Y, xe, Ee;
|
|
1836
|
+
try {
|
|
1837
|
+
const ie = async () => {
|
|
1838
|
+
const U = this.getMatch(g);
|
|
1839
|
+
U.minPendingPromise && await U.minPendingPromise;
|
|
1840
|
+
};
|
|
1841
|
+
try {
|
|
1842
|
+
this.loadRouteChunk(w), i(g, (fe) => ({
|
|
1843
|
+
...fe,
|
|
1844
|
+
isFetching: "loader"
|
|
1845
|
+
}));
|
|
1846
|
+
const U = await ((K = (O = w.options).loader) == null ? void 0 : K.call(O, k()));
|
|
1847
|
+
h(
|
|
1848
|
+
this.getMatch(g),
|
|
1849
|
+
U
|
|
1850
|
+
), await w._lazyPromise, await ie();
|
|
1851
|
+
const Q = (A = (V = w.options).head) == null ? void 0 : A.call(V, {
|
|
1852
|
+
matches: r,
|
|
1853
|
+
match: this.getMatch(g),
|
|
1854
|
+
params: this.getMatch(g).params,
|
|
1855
|
+
loaderData: U
|
|
1856
|
+
}), se = Q?.meta, ae = Q?.links, we = Q?.scripts, Pe = (G = (N = w.options).headers) == null ? void 0 : G.call(N, {
|
|
1857
|
+
loaderData: U
|
|
1858
|
+
});
|
|
1859
|
+
i(g, (fe) => ({
|
|
1860
|
+
...fe,
|
|
1861
|
+
error: void 0,
|
|
1862
|
+
status: "success",
|
|
1863
|
+
isFetching: !1,
|
|
1864
|
+
updatedAt: Date.now(),
|
|
1865
|
+
loaderData: U,
|
|
1866
|
+
meta: se,
|
|
1867
|
+
links: ae,
|
|
1868
|
+
scripts: we,
|
|
1869
|
+
headers: Pe
|
|
1870
|
+
}));
|
|
1871
|
+
} catch (U) {
|
|
1872
|
+
let Q = U;
|
|
1873
|
+
await ie(), h(this.getMatch(g), U);
|
|
1874
|
+
try {
|
|
1875
|
+
(xe = (Y = w.options).onError) == null || xe.call(Y, U);
|
|
1876
|
+
} catch (se) {
|
|
1877
|
+
Q = se, h(
|
|
1878
|
+
this.getMatch(g),
|
|
1879
|
+
se
|
|
1880
|
+
);
|
|
1881
|
+
}
|
|
1882
|
+
i(g, (se) => ({
|
|
1883
|
+
...se,
|
|
1884
|
+
error: Q,
|
|
1885
|
+
status: "error",
|
|
1886
|
+
isFetching: !1
|
|
1887
|
+
}));
|
|
1888
|
+
}
|
|
1889
|
+
(Ee = this.serverSsr) == null || Ee.onMatchSettled({
|
|
1890
|
+
router: this,
|
|
1891
|
+
match: this.getMatch(g)
|
|
1892
|
+
}), await w._componentsPromise;
|
|
1893
|
+
} catch (ie) {
|
|
1894
|
+
i(g, (U) => ({
|
|
1895
|
+
...U,
|
|
1896
|
+
loaderPromise: void 0
|
|
1897
|
+
})), h(this.getMatch(g), ie);
|
|
1898
|
+
}
|
|
1899
|
+
}, { status: j, invalid: ne } = this.getMatch(g);
|
|
1900
|
+
_ = j === "success" && (ne || (q ?? T > D)), I && w.options.preload === !1 || (_ && !a ? (E = !0, (async () => {
|
|
1901
|
+
try {
|
|
1902
|
+
await J();
|
|
1903
|
+
const { loaderPromise: O, loadPromise: K } = this.getMatch(g);
|
|
1904
|
+
O?.resolve(), K?.resolve(), i(g, (V) => ({
|
|
1905
|
+
...V,
|
|
1906
|
+
loaderPromise: void 0
|
|
1907
|
+
}));
|
|
1908
|
+
} catch (O) {
|
|
1909
|
+
qe(O) && await this.navigate(O);
|
|
1910
|
+
}
|
|
1911
|
+
})()) : (j !== "success" || _ && a) && await J());
|
|
1912
|
+
}
|
|
1913
|
+
if (!E) {
|
|
1914
|
+
const { loaderPromise: m, loadPromise: w } = this.getMatch(g);
|
|
1915
|
+
m?.resolve(), w?.resolve();
|
|
1916
|
+
}
|
|
1917
|
+
return i(g, (m) => ({
|
|
1918
|
+
...m,
|
|
1919
|
+
isFetching: E ? m.isFetching : !1,
|
|
1920
|
+
loaderPromise: E ? m.loaderPromise : void 0,
|
|
1921
|
+
invalid: !1
|
|
1922
|
+
})), this.getMatch(g);
|
|
1923
|
+
})()
|
|
1924
|
+
);
|
|
1925
|
+
}), await Promise.all(P), f();
|
|
1926
|
+
} catch (R) {
|
|
1927
|
+
p(R);
|
|
1928
|
+
}
|
|
1929
|
+
})();
|
|
1930
|
+
}), await d();
|
|
1931
|
+
} catch (f) {
|
|
1932
|
+
if (ce(f) || ee(f))
|
|
1933
|
+
throw ee(f) && !o && await d(), f;
|
|
1934
|
+
}
|
|
1935
|
+
return r;
|
|
1936
|
+
}, this.invalidate = (e) => {
|
|
1937
|
+
const r = (o) => {
|
|
1938
|
+
var s;
|
|
1939
|
+
return ((s = e?.filter) == null ? void 0 : s.call(e, o)) ?? !0 ? {
|
|
1940
|
+
...o,
|
|
1941
|
+
invalid: !0,
|
|
1942
|
+
...o.status === "error" ? { status: "pending", error: void 0 } : {}
|
|
1943
|
+
} : o;
|
|
1944
|
+
};
|
|
1945
|
+
return this.__store.setState((o) => {
|
|
1946
|
+
var s;
|
|
1947
|
+
return {
|
|
1948
|
+
...o,
|
|
1949
|
+
matches: o.matches.map(r),
|
|
1950
|
+
cachedMatches: o.cachedMatches.map(r),
|
|
1951
|
+
pendingMatches: (s = o.pendingMatches) == null ? void 0 : s.map(r)
|
|
1952
|
+
};
|
|
1953
|
+
}), this.load({ sync: e?.sync });
|
|
1954
|
+
}, this.resolveRedirect = (e) => {
|
|
1955
|
+
const r = e;
|
|
1956
|
+
return r.href || (r.href = this.buildLocation(r).href), r;
|
|
1957
|
+
}, this.clearCache = (e) => {
|
|
1958
|
+
const r = e?.filter;
|
|
1959
|
+
r !== void 0 ? this.__store.setState((o) => ({
|
|
1960
|
+
...o,
|
|
1961
|
+
cachedMatches: o.cachedMatches.filter(
|
|
1962
|
+
(s) => !r(s)
|
|
1963
|
+
)
|
|
1964
|
+
})) : this.__store.setState((o) => ({
|
|
1965
|
+
...o,
|
|
1966
|
+
cachedMatches: []
|
|
1967
|
+
}));
|
|
1968
|
+
}, this.clearExpiredCache = () => {
|
|
1969
|
+
const e = (r) => {
|
|
1970
|
+
const o = this.looseRoutesById[r.routeId];
|
|
1971
|
+
if (!o.options.loader)
|
|
1972
|
+
return !0;
|
|
1973
|
+
const s = (r.preload ? o.options.preloadGcTime ?? this.options.defaultPreloadGcTime : o.options.gcTime ?? this.options.defaultGcTime) ?? 5 * 60 * 1e3;
|
|
1974
|
+
return !(r.status !== "error" && Date.now() - r.updatedAt < s);
|
|
1975
|
+
};
|
|
1976
|
+
this.clearCache({ filter: e });
|
|
1977
|
+
}, this.loadRouteChunk = (e) => (e._lazyPromise === void 0 && (e.lazyFn ? e._lazyPromise = e.lazyFn().then((r) => {
|
|
1978
|
+
const { id: o, ...s } = r.options;
|
|
1979
|
+
Object.assign(e.options, s);
|
|
1980
|
+
}) : e._lazyPromise = Promise.resolve()), e._componentsPromise === void 0 && (e._componentsPromise = e._lazyPromise.then(
|
|
1981
|
+
() => Promise.all(
|
|
1982
|
+
Lt.map(async (r) => {
|
|
1983
|
+
const o = e.options[r];
|
|
1984
|
+
o?.preload && await o.preload();
|
|
1985
|
+
})
|
|
1986
|
+
)
|
|
1987
|
+
)), e._componentsPromise), this.preloadRoute = async (e) => {
|
|
1988
|
+
const r = this.buildLocation(e);
|
|
1989
|
+
let o = this.matchRoutes(r, {
|
|
1990
|
+
throwOnError: !0,
|
|
1991
|
+
preload: !0,
|
|
1992
|
+
dest: e
|
|
1993
|
+
});
|
|
1994
|
+
const s = new Set(
|
|
1995
|
+
[...this.state.matches, ...this.state.pendingMatches ?? []].map(
|
|
1996
|
+
(a) => a.id
|
|
1997
|
+
)
|
|
1998
|
+
), i = /* @__PURE__ */ new Set([
|
|
1999
|
+
...s,
|
|
2000
|
+
...this.state.cachedMatches.map((a) => a.id)
|
|
2001
|
+
]);
|
|
2002
|
+
Ge(() => {
|
|
2003
|
+
o.forEach((a) => {
|
|
2004
|
+
i.has(a.id) || this.__store.setState((l) => ({
|
|
2005
|
+
...l,
|
|
2006
|
+
cachedMatches: [...l.cachedMatches, a]
|
|
2007
|
+
}));
|
|
2008
|
+
});
|
|
2009
|
+
});
|
|
2010
|
+
try {
|
|
2011
|
+
return o = await this.loadMatches({
|
|
2012
|
+
matches: o,
|
|
2013
|
+
location: r,
|
|
2014
|
+
preload: !0,
|
|
2015
|
+
updateMatch: (a, l) => {
|
|
2016
|
+
s.has(a) ? o = o.map((c) => c.id === a ? l(c) : c) : this.updateMatch(a, l);
|
|
2017
|
+
}
|
|
2018
|
+
}), o;
|
|
2019
|
+
} catch (a) {
|
|
2020
|
+
if (ce(a))
|
|
2021
|
+
return a.reloadDocument ? void 0 : await this.preloadRoute({
|
|
2022
|
+
...a,
|
|
2023
|
+
_fromLocation: r
|
|
2024
|
+
});
|
|
2025
|
+
console.error(a);
|
|
2026
|
+
return;
|
|
2027
|
+
}
|
|
2028
|
+
}, this.matchRoute = (e, r) => {
|
|
2029
|
+
const o = {
|
|
2030
|
+
...e,
|
|
2031
|
+
to: e.to ? this.resolvePathWithBase(
|
|
2032
|
+
e.from || "",
|
|
2033
|
+
e.to
|
|
2034
|
+
) : void 0,
|
|
2035
|
+
params: e.params || {},
|
|
2036
|
+
leaveParams: !0
|
|
2037
|
+
}, s = this.buildLocation(o);
|
|
2038
|
+
if (r?.pending && this.state.status !== "pending")
|
|
2039
|
+
return !1;
|
|
2040
|
+
const a = (r?.pending === void 0 ? !this.state.isLoading : r.pending) ? this.latestLocation : this.state.resolvedLocation, l = Fe(this.basepath, a.pathname, {
|
|
2041
|
+
...r,
|
|
2042
|
+
to: s.pathname
|
|
2043
|
+
});
|
|
2044
|
+
return !l || e.params && !ye(l, e.params, { partial: !0 }) ? !1 : l && (r?.includeSearch ?? !0) ? ye(a.search, s.search, { partial: !0 }) ? l : !1 : l;
|
|
2045
|
+
}, this._handleNotFound = (e, r, {
|
|
2046
|
+
updateMatch: o = this.updateMatch
|
|
2047
|
+
} = {}) => {
|
|
2048
|
+
const s = Object.fromEntries(
|
|
2049
|
+
e.map((l) => [l.routeId, l])
|
|
2050
|
+
);
|
|
2051
|
+
let i = (r.global ? this.looseRoutesById[H] : this.looseRoutesById[r.routeId]) || this.looseRoutesById[H];
|
|
2052
|
+
for (; !i.options.notFoundComponent && !this.options.defaultNotFoundComponent && i.id !== H; )
|
|
2053
|
+
i = i.parentRoute, te(
|
|
2054
|
+
i,
|
|
2055
|
+
"Found invalid route tree while trying to find not-found handler."
|
|
2056
|
+
);
|
|
2057
|
+
const a = s[i.id];
|
|
2058
|
+
te(a, "Could not find match for route: " + i.id), o(a.id, (l) => ({
|
|
2059
|
+
...l,
|
|
2060
|
+
status: "notFound",
|
|
2061
|
+
error: r,
|
|
2062
|
+
isFetching: !1
|
|
2063
|
+
})), r.routerCode === "BEFORE_LOAD" && i.parentRoute && (r.routeId = i.parentRoute.id, this._handleNotFound(e, r, {
|
|
2064
|
+
updateMatch: o
|
|
2065
|
+
}));
|
|
2066
|
+
}, this.hasNotFoundMatch = () => this.__store.state.matches.some(
|
|
2067
|
+
(e) => e.status === "notFound" || e.globalNotFound
|
|
2068
|
+
), this.update({
|
|
2069
|
+
defaultPreloadDelay: 50,
|
|
2070
|
+
defaultPendingMs: 1e3,
|
|
2071
|
+
defaultPendingMinMs: 500,
|
|
2072
|
+
context: void 0,
|
|
2073
|
+
...n,
|
|
2074
|
+
caseSensitive: n.caseSensitive ?? !1,
|
|
2075
|
+
notFoundMode: n.notFoundMode ?? "fuzzy",
|
|
2076
|
+
stringifySearch: n.stringifySearch ?? hn,
|
|
2077
|
+
parseSearch: n.parseSearch ?? dn
|
|
2078
|
+
}), typeof document < "u" && (window.__TSR_ROUTER__ = this);
|
|
2079
|
+
}
|
|
2080
|
+
get state() {
|
|
2081
|
+
return this.__store.state;
|
|
2082
|
+
}
|
|
2083
|
+
get looseRoutesById() {
|
|
2084
|
+
return this.routesById;
|
|
2085
|
+
}
|
|
2086
|
+
matchRoutes(n, e, r) {
|
|
2087
|
+
return typeof n == "string" ? this.matchRoutesInternal(
|
|
2088
|
+
{
|
|
2089
|
+
pathname: n,
|
|
2090
|
+
search: e
|
|
2091
|
+
},
|
|
2092
|
+
r
|
|
2093
|
+
) : this.matchRoutesInternal(n, e);
|
|
2094
|
+
}
|
|
2095
|
+
matchRoutesInternal(n, e) {
|
|
2096
|
+
const { foundRoute: r, matchedRoutes: o, routeParams: s } = this.getMatchedRoutes(
|
|
2097
|
+
n,
|
|
2098
|
+
e?.dest
|
|
2099
|
+
);
|
|
2100
|
+
let i = !1;
|
|
2101
|
+
// If we found a route, and it's not an index route and we have left over path
|
|
2102
|
+
(r ? r.path !== "/" && s["**"] : (
|
|
2103
|
+
// Or if we didn't find a route and we have left over path
|
|
2104
|
+
le(n.pathname)
|
|
2105
|
+
)) && (this.options.notFoundRoute ? o.push(this.options.notFoundRoute) : i = !0);
|
|
2106
|
+
const a = (() => {
|
|
2107
|
+
if (i) {
|
|
2108
|
+
if (this.options.notFoundMode !== "root")
|
|
2109
|
+
for (let u = o.length - 1; u >= 0; u--) {
|
|
2110
|
+
const h = o[u];
|
|
2111
|
+
if (h.children)
|
|
2112
|
+
return h.id;
|
|
2113
|
+
}
|
|
2114
|
+
return H;
|
|
2115
|
+
}
|
|
2116
|
+
})(), l = o.map((u) => {
|
|
2117
|
+
var h;
|
|
2118
|
+
let f;
|
|
2119
|
+
const p = ((h = u.options.params) == null ? void 0 : h.parse) ?? u.options.parseParams;
|
|
2120
|
+
if (p)
|
|
2121
|
+
try {
|
|
2122
|
+
const S = p(s);
|
|
2123
|
+
Object.assign(s, S);
|
|
2124
|
+
} catch (S) {
|
|
2125
|
+
if (f = new xn(S.message, {
|
|
2126
|
+
cause: S
|
|
2127
|
+
}), e?.throwOnError)
|
|
2128
|
+
throw f;
|
|
2129
|
+
return f;
|
|
2130
|
+
}
|
|
2131
|
+
}), c = [], d = (u) => u?.id ? u.context ?? this.options.context ?? {} : this.options.context ?? {};
|
|
2132
|
+
return o.forEach((u, h) => {
|
|
2133
|
+
var f, p, S, y;
|
|
2134
|
+
const M = c[h - 1], [R, L] = (() => {
|
|
2135
|
+
const k = M?.search ?? n.search;
|
|
2136
|
+
try {
|
|
2137
|
+
const T = Ye(u.options.validateSearch, k) ?? {};
|
|
2138
|
+
return [
|
|
2139
|
+
{
|
|
2140
|
+
...k,
|
|
2141
|
+
...T
|
|
2142
|
+
},
|
|
2143
|
+
void 0
|
|
2144
|
+
];
|
|
2145
|
+
} catch (T) {
|
|
2146
|
+
const I = new ot(T.message, {
|
|
2147
|
+
cause: T
|
|
2148
|
+
});
|
|
2149
|
+
if (e?.throwOnError)
|
|
2150
|
+
throw I;
|
|
2151
|
+
return [k, I];
|
|
2152
|
+
}
|
|
2153
|
+
})(), P = ((p = (f = u.options).loaderDeps) == null ? void 0 : p.call(f, {
|
|
2154
|
+
search: R
|
|
2155
|
+
})) ?? "", g = P ? JSON.stringify(P) : "", x = ke({
|
|
2156
|
+
path: u.fullPath,
|
|
2157
|
+
params: s,
|
|
2158
|
+
decodeCharMap: this.pathParamsDecodeCharMap
|
|
2159
|
+
}), F = ke({
|
|
2160
|
+
path: u.id,
|
|
2161
|
+
params: s,
|
|
2162
|
+
leaveWildcards: !0,
|
|
2163
|
+
decodeCharMap: this.pathParamsDecodeCharMap
|
|
2164
|
+
}) + g, v = this.getMatch(F), _ = this.state.matches.find(
|
|
2165
|
+
(k) => k.routeId === u.id
|
|
2166
|
+
), E = _ ? "stay" : "enter";
|
|
2167
|
+
let m;
|
|
2168
|
+
if (v)
|
|
2169
|
+
m = {
|
|
2170
|
+
...v,
|
|
2171
|
+
cause: E,
|
|
2172
|
+
params: _ ? X(_.params, s) : s,
|
|
2173
|
+
search: X(_ ? _.search : v.search, R)
|
|
2174
|
+
};
|
|
2175
|
+
else {
|
|
2176
|
+
const k = u.options.loader || u.options.beforeLoad || u.lazyFn || Ln(u) ? "pending" : "success";
|
|
2177
|
+
m = {
|
|
2178
|
+
id: F,
|
|
2179
|
+
index: h,
|
|
2180
|
+
routeId: u.id,
|
|
2181
|
+
params: _ ? X(_.params, s) : s,
|
|
2182
|
+
pathname: re([this.basepath, x]),
|
|
2183
|
+
updatedAt: Date.now(),
|
|
2184
|
+
search: _ ? X(_.search, R) : R,
|
|
2185
|
+
searchError: void 0,
|
|
2186
|
+
status: k,
|
|
2187
|
+
isFetching: !1,
|
|
2188
|
+
error: void 0,
|
|
2189
|
+
paramsError: l[h],
|
|
2190
|
+
__routeContext: {},
|
|
2191
|
+
__beforeLoadContext: {},
|
|
2192
|
+
context: {},
|
|
2193
|
+
abortController: new AbortController(),
|
|
2194
|
+
fetchCount: 0,
|
|
2195
|
+
cause: E,
|
|
2196
|
+
loaderDeps: _ ? X(_.loaderDeps, P) : P,
|
|
2197
|
+
invalid: !1,
|
|
2198
|
+
preload: !1,
|
|
2199
|
+
links: void 0,
|
|
2200
|
+
scripts: void 0,
|
|
2201
|
+
meta: void 0,
|
|
2202
|
+
staticData: u.options.staticData || {},
|
|
2203
|
+
loadPromise: pe(),
|
|
2204
|
+
fullPath: u.fullPath
|
|
2205
|
+
};
|
|
2206
|
+
}
|
|
2207
|
+
m.status === "success" && (m.headers = (y = (S = u.options).headers) == null ? void 0 : y.call(S, {
|
|
2208
|
+
loaderData: m.loaderData
|
|
2209
|
+
})), e?.preload || (m.globalNotFound = a === u.id), m.searchError = L;
|
|
2210
|
+
const w = d(M);
|
|
2211
|
+
m.context = {
|
|
2212
|
+
...w,
|
|
2213
|
+
...m.__routeContext,
|
|
2214
|
+
...m.__beforeLoadContext
|
|
2215
|
+
}, c.push(m);
|
|
2216
|
+
}), c.forEach((u, h) => {
|
|
2217
|
+
var f, p, S, y;
|
|
2218
|
+
const M = this.looseRoutesById[u.routeId];
|
|
2219
|
+
if (!this.getMatch(u.id) && e?._buildLocation !== !0) {
|
|
2220
|
+
const P = c[h - 1], g = d(P), x = {
|
|
2221
|
+
deps: u.loaderDeps,
|
|
2222
|
+
params: u.params,
|
|
2223
|
+
context: g,
|
|
2224
|
+
location: n,
|
|
2225
|
+
navigate: (F) => this.navigate({ ...F, _fromLocation: n }),
|
|
2226
|
+
buildLocation: this.buildLocation,
|
|
2227
|
+
cause: u.cause,
|
|
2228
|
+
abortController: u.abortController,
|
|
2229
|
+
preload: !!u.preload,
|
|
2230
|
+
matches: c
|
|
2231
|
+
};
|
|
2232
|
+
u.__routeContext = ((p = (f = M.options).context) == null ? void 0 : p.call(f, x)) ?? {}, u.context = {
|
|
2233
|
+
...g,
|
|
2234
|
+
...u.__routeContext,
|
|
2235
|
+
...u.__beforeLoadContext
|
|
2236
|
+
};
|
|
2237
|
+
}
|
|
2238
|
+
const L = (y = (S = M.options).head) == null ? void 0 : y.call(S, {
|
|
2239
|
+
matches: c,
|
|
2240
|
+
match: u,
|
|
2241
|
+
params: u.params,
|
|
2242
|
+
loaderData: u.loaderData ?? void 0
|
|
2243
|
+
});
|
|
2244
|
+
u.links = L?.links, u.scripts = L?.scripts, u.meta = L?.meta;
|
|
2245
|
+
}), c;
|
|
2246
|
+
}
|
|
2247
|
+
}
|
|
2248
|
+
class ot extends Error {
|
|
2249
|
+
}
|
|
2250
|
+
class xn extends Error {
|
|
2251
|
+
}
|
|
2252
|
+
function En(t) {
|
|
2253
|
+
return {
|
|
2254
|
+
loadedAt: 0,
|
|
2255
|
+
isLoading: !1,
|
|
2256
|
+
isTransitioning: !1,
|
|
2257
|
+
status: "idle",
|
|
2258
|
+
resolvedLocation: { ...t },
|
|
2259
|
+
location: t,
|
|
2260
|
+
matches: [],
|
|
2261
|
+
pendingMatches: [],
|
|
2262
|
+
cachedMatches: [],
|
|
2263
|
+
statusCode: 200
|
|
2264
|
+
};
|
|
2265
|
+
}
|
|
2266
|
+
const Ue = b.createContext(void 0), In = b.createContext(
|
|
2267
|
+
void 0
|
|
2268
|
+
);
|
|
2269
|
+
function he(t) {
|
|
2270
|
+
const n = b.useContext(
|
|
2271
|
+
t.from ? In : Ue
|
|
2272
|
+
);
|
|
2273
|
+
return z({
|
|
2274
|
+
select: (r) => {
|
|
2275
|
+
const o = r.matches.find(
|
|
2276
|
+
(s) => t.from ? t.from === s.routeId : s.id === n
|
|
2277
|
+
);
|
|
2278
|
+
if (te(
|
|
2279
|
+
!((t.shouldThrow ?? !0) && !o),
|
|
2280
|
+
`Could not find ${t.from ? `an active match from "${t.from}"` : "a nearest match!"}`
|
|
2281
|
+
), o !== void 0)
|
|
2282
|
+
return t.select ? t.select(o) : o;
|
|
2283
|
+
},
|
|
2284
|
+
structuralSharing: t.structuralSharing
|
|
2285
|
+
});
|
|
2286
|
+
}
|
|
2287
|
+
function kn(t) {
|
|
2288
|
+
return he({
|
|
2289
|
+
from: t.from,
|
|
2290
|
+
strict: t.strict,
|
|
2291
|
+
structuralSharing: t.structuralSharing,
|
|
2292
|
+
select: (n) => t.select ? t.select(n.loaderData) : n.loaderData
|
|
2293
|
+
});
|
|
2294
|
+
}
|
|
2295
|
+
function Fn(t) {
|
|
2296
|
+
const { select: n, ...e } = t;
|
|
2297
|
+
return he({
|
|
2298
|
+
...e,
|
|
2299
|
+
select: (r) => n ? n(r.loaderDeps) : r.loaderDeps
|
|
2300
|
+
});
|
|
2301
|
+
}
|
|
2302
|
+
function Tn(t) {
|
|
2303
|
+
return he({
|
|
2304
|
+
from: t.from,
|
|
2305
|
+
strict: t.strict,
|
|
2306
|
+
structuralSharing: t.structuralSharing,
|
|
2307
|
+
select: (n) => t.select ? t.select(n.params) : n.params
|
|
2308
|
+
});
|
|
2309
|
+
}
|
|
2310
|
+
function Bn(t) {
|
|
2311
|
+
return he({
|
|
2312
|
+
from: t.from,
|
|
2313
|
+
strict: t.strict,
|
|
2314
|
+
structuralSharing: t.structuralSharing,
|
|
2315
|
+
select: (n) => t.select ? t.select(n.search) : n.search
|
|
2316
|
+
});
|
|
2317
|
+
}
|
|
2318
|
+
function Dn(t) {
|
|
2319
|
+
const { navigate: n } = oe();
|
|
2320
|
+
return b.useCallback(
|
|
2321
|
+
(e) => n({
|
|
2322
|
+
...e
|
|
2323
|
+
}),
|
|
2324
|
+
[n]
|
|
2325
|
+
);
|
|
2326
|
+
}
|
|
2327
|
+
class Mt {
|
|
2328
|
+
/**
|
|
2329
|
+
* @deprecated Use the `createRoute` function instead.
|
|
2330
|
+
*/
|
|
2331
|
+
constructor(n) {
|
|
2332
|
+
this.init = (e) => {
|
|
2333
|
+
var r, o;
|
|
2334
|
+
this.originalIndex = e.originalIndex;
|
|
2335
|
+
const s = this.options, i = !s?.path && !s?.id;
|
|
2336
|
+
this.parentRoute = (o = (r = this.options).getParentRoute) == null ? void 0 : o.call(r), i ? this._path = H : te(
|
|
2337
|
+
this.parentRoute,
|
|
2338
|
+
"Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a Route instance."
|
|
2339
|
+
);
|
|
2340
|
+
let a = i ? H : s.path;
|
|
2341
|
+
a && a !== "/" && (a = at(a));
|
|
2342
|
+
const l = s?.id || a;
|
|
2343
|
+
let c = i ? H : re([
|
|
2344
|
+
this.parentRoute.id === H ? "" : this.parentRoute.id,
|
|
2345
|
+
l
|
|
2346
|
+
]);
|
|
2347
|
+
a === H && (a = "/"), c !== H && (c = re(["/", c]));
|
|
2348
|
+
const d = c === H ? "/" : re([this.parentRoute.fullPath, a]);
|
|
2349
|
+
this._path = a, this._id = c, this._fullPath = d, this._to = d, this._ssr = s?.ssr ?? e.defaultSsr ?? !0;
|
|
2350
|
+
}, this.updateLoader = (e) => (Object.assign(this.options, e), this), this.update = (e) => (Object.assign(this.options, e), this), this.lazy = (e) => (this.lazyFn = e, this), this.useMatch = (e) => he({
|
|
2351
|
+
select: e?.select,
|
|
2352
|
+
from: this.id,
|
|
2353
|
+
structuralSharing: e?.structuralSharing
|
|
2354
|
+
}), this.useRouteContext = (e) => he({
|
|
2355
|
+
...e,
|
|
2356
|
+
from: this.id,
|
|
2357
|
+
select: (r) => e?.select ? e.select(r.context) : r.context
|
|
2358
|
+
}), this.useSearch = (e) => Bn({
|
|
2359
|
+
select: e?.select,
|
|
2360
|
+
structuralSharing: e?.structuralSharing,
|
|
2361
|
+
from: this.id
|
|
2362
|
+
}), this.useParams = (e) => Tn({
|
|
2363
|
+
select: e?.select,
|
|
2364
|
+
structuralSharing: e?.structuralSharing,
|
|
2365
|
+
from: this.id
|
|
2366
|
+
}), this.useLoaderDeps = (e) => Fn({ ...e, from: this.id }), this.useLoaderData = (e) => kn({ ...e, from: this.id }), this.useNavigate = () => Dn({ from: this.id }), this.options = n || {}, this.isRoot = !n?.getParentRoute, te(
|
|
2367
|
+
!(n?.id && n?.path),
|
|
2368
|
+
"Route cannot have both an 'id' and a 'path' option."
|
|
2369
|
+
), this.$$typeof = Symbol.for("react.memo");
|
|
2370
|
+
}
|
|
2371
|
+
get to() {
|
|
2372
|
+
return this._to;
|
|
2373
|
+
}
|
|
2374
|
+
get id() {
|
|
2375
|
+
return this._id;
|
|
2376
|
+
}
|
|
2377
|
+
get path() {
|
|
2378
|
+
return this._path;
|
|
2379
|
+
}
|
|
2380
|
+
get fullPath() {
|
|
2381
|
+
return this._fullPath;
|
|
2382
|
+
}
|
|
2383
|
+
get ssr() {
|
|
2384
|
+
return this._ssr;
|
|
2385
|
+
}
|
|
2386
|
+
addChildren(n) {
|
|
2387
|
+
return this._addFileChildren(n);
|
|
2388
|
+
}
|
|
2389
|
+
_addFileChildren(n) {
|
|
2390
|
+
return Array.isArray(n) && (this.children = n), typeof n == "object" && n !== null && (this.children = Object.values(n)), this;
|
|
2391
|
+
}
|
|
2392
|
+
}
|
|
2393
|
+
function On(t) {
|
|
2394
|
+
return new Mt(t);
|
|
2395
|
+
}
|
|
2396
|
+
function ir() {
|
|
2397
|
+
return (t) => An(t);
|
|
2398
|
+
}
|
|
2399
|
+
class Vn extends Mt {
|
|
2400
|
+
/**
|
|
2401
|
+
* @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.
|
|
2402
|
+
*/
|
|
2403
|
+
constructor(n) {
|
|
2404
|
+
super(n);
|
|
2405
|
+
}
|
|
2406
|
+
addChildren(n) {
|
|
2407
|
+
return super.addChildren(n), this;
|
|
2408
|
+
}
|
|
2409
|
+
_addFileChildren(n) {
|
|
2410
|
+
return super._addFileChildren(n), this;
|
|
2411
|
+
}
|
|
2412
|
+
_addFileTypes() {
|
|
2413
|
+
return this;
|
|
2414
|
+
}
|
|
2415
|
+
}
|
|
2416
|
+
function An(t) {
|
|
2417
|
+
return new Vn(t);
|
|
2418
|
+
}
|
|
2419
|
+
function ar(t) {
|
|
2420
|
+
return new Nn(t, {
|
|
2421
|
+
silent: !0
|
|
2422
|
+
}).createRoute;
|
|
2423
|
+
}
|
|
2424
|
+
class Nn {
|
|
2425
|
+
constructor(n, e) {
|
|
2426
|
+
this.path = n, this.createRoute = (r) => {
|
|
2427
|
+
Me(
|
|
2428
|
+
this.silent,
|
|
2429
|
+
"FileRoute is deprecated and will be removed in the next major version. Use the createFileRoute(path)(options) function instead."
|
|
2430
|
+
);
|
|
2431
|
+
const o = On(r);
|
|
2432
|
+
return o.isRoot = !1, o;
|
|
2433
|
+
}, this.silent = e?.silent;
|
|
2434
|
+
}
|
|
2435
|
+
}
|
|
2436
|
+
function Be(t) {
|
|
2437
|
+
return /* @__PURE__ */ C(Ft, { children: t.children });
|
|
2438
|
+
}
|
|
2439
|
+
function xt(t, n, e) {
|
|
2440
|
+
return n.options.notFoundComponent ? /* @__PURE__ */ C(n.options.notFoundComponent, { data: e }) : t.options.defaultNotFoundComponent ? /* @__PURE__ */ C(t.options.defaultNotFoundComponent, { data: e }) : /* @__PURE__ */ C(Cn, {});
|
|
2441
|
+
}
|
|
2442
|
+
const Et = b.memo(function({
|
|
2443
|
+
matchId: n
|
|
2444
|
+
}) {
|
|
2445
|
+
var e, r;
|
|
2446
|
+
const o = oe(), s = z({
|
|
2447
|
+
select: (y) => {
|
|
2448
|
+
var M;
|
|
2449
|
+
return (M = y.matches.find((R) => R.id === n)) == null ? void 0 : M.routeId;
|
|
2450
|
+
}
|
|
2451
|
+
});
|
|
2452
|
+
te(
|
|
2453
|
+
s,
|
|
2454
|
+
`Could not find routeId for matchId "${n}". Please file an issue!`
|
|
2455
|
+
);
|
|
2456
|
+
const i = o.routesById[s], a = i.options.pendingComponent ?? o.options.defaultPendingComponent, l = a ? /* @__PURE__ */ C(a, {}) : null, c = i.options.errorComponent ?? o.options.defaultErrorComponent, d = i.options.onCatch ?? o.options.defaultOnCatch, u = i.isRoot ? (
|
|
2457
|
+
// If it's the root route, use the globalNotFound option, with fallback to the notFoundRoute's component
|
|
2458
|
+
i.options.notFoundComponent ?? ((e = o.options.notFoundRoute) == null ? void 0 : e.options.component)
|
|
2459
|
+
) : i.options.notFoundComponent, h = (
|
|
2460
|
+
// If we're on the root route, allow forcefully wrapping in suspense
|
|
2461
|
+
(!i.isRoot || i.options.wrapInSuspense) && (i.options.wrapInSuspense ?? a ?? ((r = i.options.errorComponent) == null ? void 0 : r.preload)) ? b.Suspense : Be
|
|
2462
|
+
), f = c ? ct : Be, p = u ? Rn : Be, S = z({
|
|
2463
|
+
select: (y) => y.loadedAt
|
|
2464
|
+
});
|
|
2465
|
+
return /* @__PURE__ */ C(Ue.Provider, { value: n, children: /* @__PURE__ */ C(h, { fallback: l, children: /* @__PURE__ */ C(
|
|
2466
|
+
f,
|
|
2467
|
+
{
|
|
2468
|
+
getResetKey: () => S,
|
|
2469
|
+
errorComponent: c || Ke,
|
|
2470
|
+
onCatch: (y, M) => {
|
|
2471
|
+
if (ee(y)) throw y;
|
|
2472
|
+
Me(!1, `Error in route match: ${n}`), d?.(y, M);
|
|
2473
|
+
},
|
|
2474
|
+
children: /* @__PURE__ */ C(
|
|
2475
|
+
p,
|
|
2476
|
+
{
|
|
2477
|
+
fallback: (y) => {
|
|
2478
|
+
if (!u || y.routeId && y.routeId !== s || !y.routeId && !i.isRoot)
|
|
2479
|
+
throw y;
|
|
2480
|
+
return b.createElement(u, y);
|
|
2481
|
+
},
|
|
2482
|
+
children: /* @__PURE__ */ C($n, { matchId: n })
|
|
2483
|
+
}
|
|
2484
|
+
)
|
|
2485
|
+
}
|
|
2486
|
+
) }) });
|
|
2487
|
+
}), $n = b.memo(function({
|
|
2488
|
+
matchId: n
|
|
2489
|
+
}) {
|
|
2490
|
+
var e, r, o;
|
|
2491
|
+
const s = oe(), { match: i, matchIndex: a, routeId: l } = z({
|
|
2492
|
+
select: (h) => {
|
|
2493
|
+
const f = h.matches.findIndex((y) => y.id === n), p = h.matches[f];
|
|
2494
|
+
return {
|
|
2495
|
+
routeId: p.routeId,
|
|
2496
|
+
matchIndex: f,
|
|
2497
|
+
match: rt(p, ["id", "status", "error"])
|
|
2498
|
+
};
|
|
2499
|
+
},
|
|
2500
|
+
structuralSharing: !0
|
|
2501
|
+
}), c = s.routesById[l], d = b.useMemo(() => {
|
|
2502
|
+
const h = c.options.component ?? s.options.defaultComponent;
|
|
2503
|
+
return h ? /* @__PURE__ */ C(h, {}) : /* @__PURE__ */ C(Kn, {});
|
|
2504
|
+
}, [c.options.component, s.options.defaultComponent]), u = (c.options.errorComponent ?? s.options.defaultErrorComponent) || Ke;
|
|
2505
|
+
if (i.status === "notFound")
|
|
2506
|
+
return te(ee(i.error), "Expected a notFound error"), xt(s, c, i.error);
|
|
2507
|
+
if (i.status === "redirected")
|
|
2508
|
+
throw te(ce(i.error), "Expected a redirect error"), (e = s.getMatch(i.id)) == null ? void 0 : e.loadPromise;
|
|
2509
|
+
if (i.status === "error") {
|
|
2510
|
+
if (s.isServer)
|
|
2511
|
+
return /* @__PURE__ */ C(
|
|
2512
|
+
u,
|
|
2513
|
+
{
|
|
2514
|
+
error: i.error,
|
|
2515
|
+
info: {
|
|
2516
|
+
componentStack: ""
|
|
2517
|
+
}
|
|
2518
|
+
}
|
|
2519
|
+
);
|
|
2520
|
+
throw i.error;
|
|
2521
|
+
}
|
|
2522
|
+
if (i.status === "pending") {
|
|
2523
|
+
const h = c.options.pendingMinMs ?? s.options.defaultPendingMinMs;
|
|
2524
|
+
if (h && !((r = s.getMatch(i.id)) != null && r.minPendingPromise) && !s.isServer) {
|
|
2525
|
+
const f = pe();
|
|
2526
|
+
Promise.resolve().then(() => {
|
|
2527
|
+
s.updateMatch(i.id, (p) => ({
|
|
2528
|
+
...p,
|
|
2529
|
+
minPendingPromise: f
|
|
2530
|
+
}));
|
|
2531
|
+
}), setTimeout(() => {
|
|
2532
|
+
f.resolve(), s.updateMatch(i.id, (p) => ({
|
|
2533
|
+
...p,
|
|
2534
|
+
minPendingPromise: void 0
|
|
2535
|
+
}));
|
|
2536
|
+
}, h);
|
|
2537
|
+
}
|
|
2538
|
+
throw (o = s.getMatch(i.id)) == null ? void 0 : o.loadPromise;
|
|
2539
|
+
}
|
|
2540
|
+
return d;
|
|
2541
|
+
}), Kn = b.memo(function() {
|
|
2542
|
+
const n = oe(), e = b.useContext(Ue), r = z({
|
|
2543
|
+
select: (c) => {
|
|
2544
|
+
var d;
|
|
2545
|
+
return (d = c.matches.find((u) => u.id === e)) == null ? void 0 : d.routeId;
|
|
2546
|
+
}
|
|
2547
|
+
}), o = n.routesById[r], s = z({
|
|
2548
|
+
select: (c) => {
|
|
2549
|
+
const u = c.matches.find((h) => h.id === e);
|
|
2550
|
+
return te(
|
|
2551
|
+
u,
|
|
2552
|
+
`Could not find parent match for matchId "${e}"`
|
|
2553
|
+
), u.globalNotFound;
|
|
2554
|
+
}
|
|
2555
|
+
}), i = z({
|
|
2556
|
+
select: (c) => {
|
|
2557
|
+
var d;
|
|
2558
|
+
const u = c.matches, h = u.findIndex((f) => f.id === e);
|
|
2559
|
+
return (d = u[h + 1]) == null ? void 0 : d.id;
|
|
2560
|
+
}
|
|
2561
|
+
});
|
|
2562
|
+
if (s)
|
|
2563
|
+
return xt(n, o, void 0);
|
|
2564
|
+
if (!i)
|
|
2565
|
+
return null;
|
|
2566
|
+
const a = /* @__PURE__ */ C(Et, { matchId: i }), l = n.options.defaultPendingComponent ? /* @__PURE__ */ C(n.options.defaultPendingComponent, {}) : null;
|
|
2567
|
+
return e === H ? /* @__PURE__ */ C(b.Suspense, { fallback: l, children: a }) : a;
|
|
2568
|
+
}), Un = "Error preloading route! ☝️";
|
|
2569
|
+
function zn(t, n) {
|
|
2570
|
+
const e = oe(), [r, o] = b.useState(!1), s = b.useRef(!1), i = yn(n), {
|
|
2571
|
+
// custom props
|
|
2572
|
+
activeProps: a = () => ({ className: "active" }),
|
|
2573
|
+
inactiveProps: l = () => ({}),
|
|
2574
|
+
activeOptions: c,
|
|
2575
|
+
to: d,
|
|
2576
|
+
preload: u,
|
|
2577
|
+
preloadDelay: h,
|
|
2578
|
+
hashScrollIntoView: f,
|
|
2579
|
+
replace: p,
|
|
2580
|
+
startTransition: S,
|
|
2581
|
+
resetScroll: y,
|
|
2582
|
+
viewTransition: M,
|
|
2583
|
+
// element props
|
|
2584
|
+
children: R,
|
|
2585
|
+
target: L,
|
|
2586
|
+
disabled: P,
|
|
2587
|
+
style: g,
|
|
2588
|
+
className: x,
|
|
2589
|
+
onClick: F,
|
|
2590
|
+
onFocus: v,
|
|
2591
|
+
onMouseEnter: _,
|
|
2592
|
+
onMouseLeave: E,
|
|
2593
|
+
onTouchStart: m,
|
|
2594
|
+
ignoreBlocker: w,
|
|
2595
|
+
...k
|
|
2596
|
+
} = t, {
|
|
2597
|
+
// prevent these from being returned
|
|
2598
|
+
params: T,
|
|
2599
|
+
search: I,
|
|
2600
|
+
hash: D,
|
|
2601
|
+
state: W,
|
|
2602
|
+
mask: q,
|
|
2603
|
+
reloadDocument: J,
|
|
2604
|
+
...j
|
|
2605
|
+
} = k, ne = b.useMemo(() => {
|
|
2606
|
+
try {
|
|
2607
|
+
return new URL(`${d}`), "external";
|
|
2608
|
+
} catch {
|
|
2609
|
+
}
|
|
2610
|
+
return "internal";
|
|
2611
|
+
}, [d]), O = z({
|
|
2612
|
+
select: (B) => B.location.search,
|
|
2613
|
+
structuralSharing: !0
|
|
2614
|
+
});
|
|
2615
|
+
t = {
|
|
2616
|
+
from: he({ strict: !1, select: (B) => B.pathname }),
|
|
2617
|
+
...t
|
|
2618
|
+
};
|
|
2619
|
+
const V = b.useMemo(
|
|
2620
|
+
() => e.buildLocation(t),
|
|
2621
|
+
[e, t, O]
|
|
2622
|
+
), A = b.useMemo(() => t.reloadDocument ? !1 : u ?? e.options.defaultPreload, [e.options.defaultPreload, u, t.reloadDocument]), N = h ?? e.options.defaultPreloadDelay ?? 0, G = z({
|
|
2623
|
+
select: (B) => {
|
|
2624
|
+
if (c?.exact) {
|
|
2625
|
+
if (!Sn(
|
|
2626
|
+
B.location.pathname,
|
|
2627
|
+
V.pathname,
|
|
2628
|
+
e.basepath
|
|
2629
|
+
))
|
|
2630
|
+
return !1;
|
|
2631
|
+
} else {
|
|
2632
|
+
const $ = Ve(
|
|
2633
|
+
B.location.pathname,
|
|
2634
|
+
e.basepath
|
|
2635
|
+
).split("/");
|
|
2636
|
+
if (!Ve(
|
|
2637
|
+
V.pathname,
|
|
2638
|
+
e.basepath
|
|
2639
|
+
).split("/").every(
|
|
2640
|
+
(It, kt) => It === $[kt]
|
|
2641
|
+
))
|
|
2642
|
+
return !1;
|
|
2643
|
+
}
|
|
2644
|
+
return (c?.includeSearch ?? !0) && !ye(B.location.search, V.search, {
|
|
2645
|
+
partial: !c?.exact,
|
|
2646
|
+
ignoreUndefined: !c?.explicitUndefined
|
|
2647
|
+
}) ? !1 : c?.includeHash ? B.location.hash === V.hash : !0;
|
|
2648
|
+
}
|
|
2649
|
+
}), Y = b.useCallback(() => {
|
|
2650
|
+
e.preloadRoute(t).catch((B) => {
|
|
2651
|
+
console.warn(B), console.warn(Un);
|
|
2652
|
+
});
|
|
2653
|
+
}, [t, e]), xe = b.useCallback(
|
|
2654
|
+
(B) => {
|
|
2655
|
+
B?.isIntersecting && Y();
|
|
2656
|
+
},
|
|
2657
|
+
[Y]
|
|
2658
|
+
);
|
|
2659
|
+
if (gn(
|
|
2660
|
+
i,
|
|
2661
|
+
xe,
|
|
2662
|
+
{ rootMargin: "100px" },
|
|
2663
|
+
{ disabled: !!P || A !== "viewport" }
|
|
2664
|
+
), Re(() => {
|
|
2665
|
+
s.current || !P && A === "render" && (Y(), s.current = !0);
|
|
2666
|
+
}, [P, Y, A]), ne === "external")
|
|
2667
|
+
return {
|
|
2668
|
+
...j,
|
|
2669
|
+
ref: i,
|
|
2670
|
+
type: ne,
|
|
2671
|
+
href: d,
|
|
2672
|
+
...R && { children: R },
|
|
2673
|
+
...L && { target: L },
|
|
2674
|
+
...P && { disabled: P },
|
|
2675
|
+
...g && { style: g },
|
|
2676
|
+
...x && { className: x },
|
|
2677
|
+
...F && { onClick: F },
|
|
2678
|
+
...v && { onFocus: v },
|
|
2679
|
+
..._ && { onMouseEnter: _ },
|
|
2680
|
+
...E && { onMouseLeave: E },
|
|
2681
|
+
...m && { onTouchStart: m }
|
|
2682
|
+
};
|
|
2683
|
+
const Ee = (B) => {
|
|
2684
|
+
if (!P && !Wn(B) && !B.defaultPrevented && (!L || L === "_self") && B.button === 0) {
|
|
2685
|
+
B.preventDefault(), Bt(() => {
|
|
2686
|
+
o(!0);
|
|
2687
|
+
});
|
|
2688
|
+
const $ = e.subscribe("onResolved", () => {
|
|
2689
|
+
$(), o(!1);
|
|
2690
|
+
});
|
|
2691
|
+
return e.navigate({
|
|
2692
|
+
...t,
|
|
2693
|
+
replace: p,
|
|
2694
|
+
resetScroll: y,
|
|
2695
|
+
hashScrollIntoView: f,
|
|
2696
|
+
startTransition: S,
|
|
2697
|
+
viewTransition: M,
|
|
2698
|
+
ignoreBlocker: w
|
|
2699
|
+
});
|
|
2700
|
+
}
|
|
2701
|
+
}, ie = (B) => {
|
|
2702
|
+
P || A && Y();
|
|
2703
|
+
}, U = ie, Q = (B) => {
|
|
2704
|
+
if (P) return;
|
|
2705
|
+
const $ = B.target || {};
|
|
2706
|
+
if (A) {
|
|
2707
|
+
if ($.preloadTimeout)
|
|
2708
|
+
return;
|
|
2709
|
+
$.preloadTimeout = setTimeout(() => {
|
|
2710
|
+
$.preloadTimeout = null, Y();
|
|
2711
|
+
}, N);
|
|
2712
|
+
}
|
|
2713
|
+
}, se = (B) => {
|
|
2714
|
+
if (P) return;
|
|
2715
|
+
const $ = B.target || {};
|
|
2716
|
+
$.preloadTimeout && (clearTimeout($.preloadTimeout), $.preloadTimeout = null);
|
|
2717
|
+
}, ae = (B) => ($) => {
|
|
2718
|
+
var ze;
|
|
2719
|
+
(ze = $.persist) == null || ze.call($), B.filter(Boolean).forEach((lt) => {
|
|
2720
|
+
$.defaultPrevented || lt($);
|
|
2721
|
+
});
|
|
2722
|
+
}, we = G ? ue(a, {}) ?? {} : {}, Pe = G ? {} : ue(l, {}), fe = [
|
|
2723
|
+
x,
|
|
2724
|
+
we.className,
|
|
2725
|
+
Pe.className
|
|
2726
|
+
].filter(Boolean).join(" "), ut = {
|
|
2727
|
+
...g,
|
|
2728
|
+
...we.style,
|
|
2729
|
+
...Pe.style
|
|
2730
|
+
};
|
|
2731
|
+
return {
|
|
2732
|
+
...j,
|
|
2733
|
+
...we,
|
|
2734
|
+
...Pe,
|
|
2735
|
+
href: P ? void 0 : V.maskedLocation ? e.history.createHref(V.maskedLocation.href) : e.history.createHref(V.href),
|
|
2736
|
+
ref: i,
|
|
2737
|
+
onClick: ae([F, Ee]),
|
|
2738
|
+
onFocus: ae([v, ie]),
|
|
2739
|
+
onMouseEnter: ae([_, Q]),
|
|
2740
|
+
onMouseLeave: ae([E, se]),
|
|
2741
|
+
onTouchStart: ae([m, U]),
|
|
2742
|
+
disabled: !!P,
|
|
2743
|
+
target: L,
|
|
2744
|
+
...Object.keys(ut).length && { style: ut },
|
|
2745
|
+
...fe && { className: fe },
|
|
2746
|
+
...P && {
|
|
2747
|
+
role: "link",
|
|
2748
|
+
"aria-disabled": !0
|
|
2749
|
+
},
|
|
2750
|
+
...G && { "data-status": "active", "aria-current": "page" },
|
|
2751
|
+
...r && { "data-transitioning": "transitioning" }
|
|
2752
|
+
};
|
|
2753
|
+
}
|
|
2754
|
+
const cr = b.forwardRef(
|
|
2755
|
+
(t, n) => {
|
|
2756
|
+
const { _asChild: e, ...r } = t, {
|
|
2757
|
+
type: o,
|
|
2758
|
+
ref: s,
|
|
2759
|
+
...i
|
|
2760
|
+
} = zn(r, n), a = typeof r.children == "function" ? r.children({
|
|
2761
|
+
isActive: i["data-status"] === "active"
|
|
2762
|
+
}) : r.children;
|
|
2763
|
+
return typeof e > "u" && delete i.disabled, b.createElement(
|
|
2764
|
+
e || "a",
|
|
2765
|
+
{
|
|
2766
|
+
...i,
|
|
2767
|
+
ref: s
|
|
2768
|
+
},
|
|
2769
|
+
a
|
|
2770
|
+
);
|
|
2771
|
+
}
|
|
2772
|
+
);
|
|
2773
|
+
function Wn(t) {
|
|
2774
|
+
return !!(t.metaKey || t.altKey || t.ctrlKey || t.shiftKey);
|
|
2775
|
+
}
|
|
2776
|
+
function Hn() {
|
|
2777
|
+
const t = oe(), n = b.useRef({ router: t, mounted: !1 }), e = z({
|
|
2778
|
+
select: ({ isLoading: u }) => u
|
|
2779
|
+
}), [r, o] = b.useState(!1), s = z({
|
|
2780
|
+
select: (u) => u.matches.some((h) => h.status === "pending"),
|
|
2781
|
+
structuralSharing: !0
|
|
2782
|
+
}), i = Xe(e), a = e || r || s, l = Xe(a), c = e || s, d = Xe(c);
|
|
2783
|
+
return t.isServer || (t.startReactTransition = (u) => {
|
|
2784
|
+
o(!0), b.startTransition(() => {
|
|
2785
|
+
u(), o(!1);
|
|
2786
|
+
});
|
|
2787
|
+
}), b.useEffect(() => {
|
|
2788
|
+
const u = t.history.subscribe(t.load), h = t.buildLocation({
|
|
2789
|
+
to: t.latestLocation.pathname,
|
|
2790
|
+
search: !0,
|
|
2791
|
+
params: !0,
|
|
2792
|
+
hash: !0,
|
|
2793
|
+
state: !0,
|
|
2794
|
+
_includeValidateSearch: !0
|
|
2795
|
+
});
|
|
2796
|
+
return le(t.latestLocation.href) !== le(h.href) && t.commitLocation({ ...h, replace: !0 }), () => {
|
|
2797
|
+
u();
|
|
2798
|
+
};
|
|
2799
|
+
}, [t, t.history]), Re(() => {
|
|
2800
|
+
if (typeof window < "u" && t.clientSsr || n.current.router === t && n.current.mounted)
|
|
2801
|
+
return;
|
|
2802
|
+
n.current = { router: t, mounted: !0 }, (async () => {
|
|
2803
|
+
try {
|
|
2804
|
+
await t.load();
|
|
2805
|
+
} catch (h) {
|
|
2806
|
+
console.error(h);
|
|
2807
|
+
}
|
|
2808
|
+
})();
|
|
2809
|
+
}, [t]), Re(() => {
|
|
2810
|
+
if (i && !e) {
|
|
2811
|
+
const u = t.state.location, h = t.state.resolvedLocation, f = h.pathname !== u.pathname, p = h.href !== u.href;
|
|
2812
|
+
t.emit({
|
|
2813
|
+
type: "onLoad",
|
|
2814
|
+
// When the new URL has committed, when the new matches have been loaded into state.matches
|
|
2815
|
+
fromLocation: h,
|
|
2816
|
+
toLocation: u,
|
|
2817
|
+
pathChanged: f,
|
|
2818
|
+
hrefChanged: p
|
|
2819
|
+
});
|
|
2820
|
+
}
|
|
2821
|
+
}, [i, t, e]), Re(() => {
|
|
2822
|
+
if (d && !c) {
|
|
2823
|
+
const u = t.state.location, h = t.state.resolvedLocation, f = h.pathname !== u.pathname, p = h.href !== u.href;
|
|
2824
|
+
t.emit({
|
|
2825
|
+
type: "onBeforeRouteMount",
|
|
2826
|
+
fromLocation: h,
|
|
2827
|
+
toLocation: u,
|
|
2828
|
+
pathChanged: f,
|
|
2829
|
+
hrefChanged: p
|
|
2830
|
+
});
|
|
2831
|
+
}
|
|
2832
|
+
}, [c, d, t]), Re(() => {
|
|
2833
|
+
if (l && !a) {
|
|
2834
|
+
const u = t.state.location, h = t.state.resolvedLocation, f = h.pathname !== u.pathname, p = h.href !== u.href;
|
|
2835
|
+
if (t.emit({
|
|
2836
|
+
type: "onResolved",
|
|
2837
|
+
fromLocation: h,
|
|
2838
|
+
toLocation: u,
|
|
2839
|
+
pathChanged: f,
|
|
2840
|
+
hrefChanged: p
|
|
2841
|
+
}), t.__store.setState((S) => ({
|
|
2842
|
+
...S,
|
|
2843
|
+
status: "idle",
|
|
2844
|
+
resolvedLocation: S.location
|
|
2845
|
+
})), typeof document < "u" && document.querySelector) {
|
|
2846
|
+
const S = t.state.location.state.__hashScrollIntoViewOptions ?? !0;
|
|
2847
|
+
if (S && t.state.location.hash !== "") {
|
|
2848
|
+
const y = document.getElementById(t.state.location.hash);
|
|
2849
|
+
y && y.scrollIntoView(S);
|
|
2850
|
+
}
|
|
2851
|
+
}
|
|
2852
|
+
}
|
|
2853
|
+
}, [a, l, t]), null;
|
|
2854
|
+
}
|
|
2855
|
+
function jn() {
|
|
2856
|
+
const t = oe(), n = t.options.defaultPendingComponent ? /* @__PURE__ */ C(t.options.defaultPendingComponent, {}) : null, e = t.isServer || typeof document < "u" && t.clientSsr ? Be : b.Suspense, r = /* @__PURE__ */ et(e, { fallback: n, children: [
|
|
2857
|
+
/* @__PURE__ */ C(Hn, {}),
|
|
2858
|
+
/* @__PURE__ */ C(Gn, {})
|
|
2859
|
+
] });
|
|
2860
|
+
return t.options.InnerWrap ? /* @__PURE__ */ C(t.options.InnerWrap, { children: r }) : r;
|
|
2861
|
+
}
|
|
2862
|
+
function Gn() {
|
|
2863
|
+
const t = z({
|
|
2864
|
+
select: (e) => {
|
|
2865
|
+
var r;
|
|
2866
|
+
return (r = e.matches[0]) == null ? void 0 : r.id;
|
|
2867
|
+
}
|
|
2868
|
+
}), n = z({
|
|
2869
|
+
select: (e) => e.loadedAt
|
|
2870
|
+
});
|
|
2871
|
+
return /* @__PURE__ */ C(Ue.Provider, { value: t, children: /* @__PURE__ */ C(
|
|
2872
|
+
ct,
|
|
2873
|
+
{
|
|
2874
|
+
getResetKey: () => n,
|
|
2875
|
+
errorComponent: Ke,
|
|
2876
|
+
onCatch: (e) => {
|
|
2877
|
+
Me(
|
|
2878
|
+
!1,
|
|
2879
|
+
"The following error wasn't caught by any route! At the very least, consider setting an 'errorComponent' in your RootRoute!"
|
|
2880
|
+
), Me(!1, e.message || e.toString());
|
|
2881
|
+
},
|
|
2882
|
+
children: t ? /* @__PURE__ */ C(Et, { matchId: t }) : null
|
|
2883
|
+
}
|
|
2884
|
+
) });
|
|
2885
|
+
}
|
|
2886
|
+
function Xn({
|
|
2887
|
+
router: t,
|
|
2888
|
+
children: n,
|
|
2889
|
+
...e
|
|
2890
|
+
}) {
|
|
2891
|
+
t.update({
|
|
2892
|
+
...t.options,
|
|
2893
|
+
...e,
|
|
2894
|
+
context: {
|
|
2895
|
+
...t.options.context,
|
|
2896
|
+
...e.context
|
|
2897
|
+
}
|
|
2898
|
+
});
|
|
2899
|
+
const r = Ct(), o = /* @__PURE__ */ C(r.Provider, { value: t, children: n });
|
|
2900
|
+
return t.options.Wrap ? /* @__PURE__ */ C(t.options.Wrap, { children: o }) : o;
|
|
2901
|
+
}
|
|
2902
|
+
function ur({ router: t, ...n }) {
|
|
2903
|
+
return /* @__PURE__ */ C(Xn, { router: t, ...n, children: /* @__PURE__ */ C(jn, {}) });
|
|
2904
|
+
}
|
|
2905
|
+
const qn = typeof window < "u" ? b.useLayoutEffect : b.useEffect, Qe = "window", yt = "___";
|
|
2906
|
+
let Ze = /* @__PURE__ */ new WeakSet();
|
|
2907
|
+
const Jn = typeof window < "u" && window.sessionStorage, Z = Jn ? (() => {
|
|
2908
|
+
const t = "tsr-scroll-restoration-v2";
|
|
2909
|
+
return {
|
|
2910
|
+
state: JSON.parse(
|
|
2911
|
+
window.sessionStorage.getItem(t) || "null"
|
|
2912
|
+
) || { cached: {}, next: {} },
|
|
2913
|
+
set: (e) => {
|
|
2914
|
+
Z.state = ue(e, Z.state), window.sessionStorage.setItem(t, JSON.stringify(Z.state));
|
|
2915
|
+
}
|
|
2916
|
+
};
|
|
2917
|
+
})() : void 0, Yn = (t) => t.state.key || t.href;
|
|
2918
|
+
function Qn(t) {
|
|
2919
|
+
const n = oe();
|
|
2920
|
+
qn(() => {
|
|
2921
|
+
const e = t?.getKey || Yn, { history: r } = window;
|
|
2922
|
+
r.scrollRestoration = "manual";
|
|
2923
|
+
const o = (a) => {
|
|
2924
|
+
if (Ze.has(a.target)) return;
|
|
2925
|
+
Ze.add(a.target);
|
|
2926
|
+
let l = "";
|
|
2927
|
+
if (a.target === document || a.target === window)
|
|
2928
|
+
l = Qe;
|
|
2929
|
+
else {
|
|
2930
|
+
const c = a.target.getAttribute(
|
|
2931
|
+
"data-scroll-restoration-id"
|
|
2932
|
+
);
|
|
2933
|
+
c ? l = `[data-scroll-restoration-id="${c}"]` : l = Zn(a.target);
|
|
2934
|
+
}
|
|
2935
|
+
Z.state.next[l] || Z.set((c) => ({
|
|
2936
|
+
...c,
|
|
2937
|
+
next: {
|
|
2938
|
+
...c.next,
|
|
2939
|
+
[l]: {
|
|
2940
|
+
scrollX: NaN,
|
|
2941
|
+
scrollY: NaN
|
|
2942
|
+
}
|
|
2943
|
+
}
|
|
2944
|
+
}));
|
|
2945
|
+
};
|
|
2946
|
+
typeof document < "u" && document.addEventListener("scroll", o, !0);
|
|
2947
|
+
const s = n.subscribe("onBeforeLoad", (a) => {
|
|
2948
|
+
if (a.hrefChanged) {
|
|
2949
|
+
const l = e(a.fromLocation);
|
|
2950
|
+
for (const c in Z.state.next) {
|
|
2951
|
+
const d = Z.state.next[c];
|
|
2952
|
+
if (c === Qe)
|
|
2953
|
+
d.scrollX = window.scrollX || 0, d.scrollY = window.scrollY || 0;
|
|
2954
|
+
else if (c) {
|
|
2955
|
+
const u = document.querySelector(c);
|
|
2956
|
+
d.scrollX = u?.scrollLeft || 0, d.scrollY = u?.scrollTop || 0;
|
|
2957
|
+
}
|
|
2958
|
+
Z.set((u) => {
|
|
2959
|
+
const h = { ...u.next };
|
|
2960
|
+
return delete h[c], {
|
|
2961
|
+
...u,
|
|
2962
|
+
next: h,
|
|
2963
|
+
cached: {
|
|
2964
|
+
...u.cached,
|
|
2965
|
+
[[l, c].join(yt)]: d
|
|
2966
|
+
}
|
|
2967
|
+
};
|
|
2968
|
+
});
|
|
2969
|
+
}
|
|
2970
|
+
}
|
|
2971
|
+
}), i = n.subscribe(
|
|
2972
|
+
"onBeforeRouteMount",
|
|
2973
|
+
(a) => {
|
|
2974
|
+
if (a.hrefChanged) {
|
|
2975
|
+
if (!n.resetNextScroll)
|
|
2976
|
+
return;
|
|
2977
|
+
n.resetNextScroll = !0;
|
|
2978
|
+
const l = e(a.toLocation);
|
|
2979
|
+
let c = !1;
|
|
2980
|
+
for (const d in Z.state.cached) {
|
|
2981
|
+
const u = Z.state.cached[d], [h, f] = d.split(yt);
|
|
2982
|
+
if (h === l) {
|
|
2983
|
+
if (f === Qe)
|
|
2984
|
+
c = !0, window.scrollTo({
|
|
2985
|
+
top: u.scrollY,
|
|
2986
|
+
left: u.scrollX,
|
|
2987
|
+
behavior: t?.scrollBehavior
|
|
2988
|
+
});
|
|
2989
|
+
else if (f) {
|
|
2990
|
+
const p = document.querySelector(f);
|
|
2991
|
+
p && (p.scrollLeft = u.scrollX, p.scrollTop = u.scrollY);
|
|
2992
|
+
}
|
|
2993
|
+
}
|
|
2994
|
+
}
|
|
2995
|
+
c || window.scrollTo(0, 0), Z.set((d) => ({ ...d, next: {} })), Ze = /* @__PURE__ */ new WeakSet();
|
|
2996
|
+
}
|
|
2997
|
+
}
|
|
2998
|
+
);
|
|
2999
|
+
return () => {
|
|
3000
|
+
document.removeEventListener("scroll", o), s(), i();
|
|
3001
|
+
};
|
|
3002
|
+
}, [t?.getKey, n]);
|
|
3003
|
+
}
|
|
3004
|
+
function lr(t) {
|
|
3005
|
+
return Qn(t), null;
|
|
3006
|
+
}
|
|
3007
|
+
function Zn(t) {
|
|
3008
|
+
const n = [];
|
|
3009
|
+
let e;
|
|
3010
|
+
for (; e = t.parentNode; )
|
|
3011
|
+
n.unshift(
|
|
3012
|
+
`${t.tagName}:nth-child(${[].indexOf.call(e.children, t) + 1})`
|
|
3013
|
+
), t = e;
|
|
3014
|
+
return `${n.join(" > ")}`.toLowerCase();
|
|
3015
|
+
}
|
|
3016
|
+
export {
|
|
3017
|
+
cr as L,
|
|
3018
|
+
Kn as O,
|
|
3019
|
+
ur as R,
|
|
3020
|
+
lr as S,
|
|
3021
|
+
ar as a,
|
|
3022
|
+
Tn as b,
|
|
3023
|
+
ir as c,
|
|
3024
|
+
z as d,
|
|
3025
|
+
sr as e,
|
|
3026
|
+
rr as f,
|
|
3027
|
+
_t as g,
|
|
3028
|
+
ee as i,
|
|
3029
|
+
or as n,
|
|
3030
|
+
oe as u,
|
|
3031
|
+
rn as w
|
|
3032
|
+
};
|