clear-react-router 1.0.3 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -30
- package/dist/components/Link.d.ts +1 -1
- package/dist/components/Router.d.ts +1 -1
- package/dist/context/RouterContext.d.ts +5 -5
- package/dist/hooks/useBlocker.d.ts +1 -1
- package/dist/hooks/useHandleNavigation.d.ts +1 -1
- package/dist/hooks/useLatest.d.ts +1 -1
- package/dist/hooks/useLoader.d.ts +3 -3
- package/dist/hooks/useLocation.d.ts +1 -1
- package/dist/hooks/useNavigate.d.ts +1 -1
- package/dist/hooks/useServiceContext.d.ts +3 -3
- package/dist/index.d.ts +1 -2
- package/dist/index.js +437 -515
- package/dist/provider/RouterProvider.d.ts +2 -2
- package/dist/types/global.d.ts +1 -1
- package/dist/utils/createLazyComponent.d.ts +1 -1
- package/dist/utils/renderElement.d.ts +1 -1
- package/dist/utils/utils.d.ts +1 -1
- package/package.json +49 -50
- package/dist/vite.config.d.ts +0 -2
package/dist/index.js
CHANGED
|
@@ -1,517 +1,439 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
)
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
if (t != null && t.loader && !_(t)) {
|
|
394
|
-
m((i) => ({ ...i, [t.path]: !0 })), a(
|
|
395
|
-
(i) => Object.keys(i).filter((R) => R !== t.path).reduce((R, w) => ({ ...R, [w]: i[w] }), {})
|
|
396
|
-
);
|
|
397
|
-
try {
|
|
398
|
-
s(!1);
|
|
399
|
-
const i = await (t == null ? void 0 : t.loader());
|
|
400
|
-
o((R) => ({
|
|
401
|
-
...R,
|
|
402
|
-
[t.path]: Date.now()
|
|
403
|
-
})), b({ key: t.path, value: i });
|
|
404
|
-
} catch {
|
|
405
|
-
s(!0);
|
|
406
|
-
} finally {
|
|
407
|
-
m((i) => ({ ...i, [t.path]: !1 }));
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
},
|
|
411
|
-
[_, b]
|
|
412
|
-
), l = y(
|
|
413
|
-
async (t) => {
|
|
414
|
-
const i = r.find((R) => J(R, t));
|
|
415
|
-
i && await v(i);
|
|
416
|
-
},
|
|
417
|
-
[v, r]
|
|
418
|
-
);
|
|
419
|
-
return { loaderCache: n, loaderError: f, prefetchLoader: l, revalidateCache: v, isLoadingMap: E };
|
|
420
|
-
}, z = (r) => r ? typeof r == "function" ? /* @__PURE__ */ k.jsx(r, {}) : r : null, Le = "error 404. Page not found", $e = "*", ze = ({ routeList: r, context: n = {} }) => {
|
|
421
|
-
const [a, u] = T(U(window.location)), [o, f] = T(n), s = N(
|
|
422
|
-
() => r.find((x) => x.path === $e || J(x, a.pathname)),
|
|
423
|
-
[a.pathname, r]
|
|
424
|
-
), { loaderError: E, loaderCache: m, prefetchLoader: b, revalidateCache: _, isLoadingMap: v } = Ne(r), { blockerState: l, updateLocation: t, updateBlockedRoute: i } = Ce({
|
|
425
|
-
setLocation: u,
|
|
426
|
-
routeList: r,
|
|
427
|
-
context: o,
|
|
428
|
-
revalidateCache: _
|
|
429
|
-
}), R = N(() => s != null && s.params ? Ae(s.params) : {}, [s]), w = N(
|
|
430
|
-
() => ({
|
|
431
|
-
location: a,
|
|
432
|
-
updateLocation: t,
|
|
433
|
-
params: R,
|
|
434
|
-
loaderCache: m,
|
|
435
|
-
prefetchLoader: b,
|
|
436
|
-
updateBlockedRoute: i,
|
|
437
|
-
blockerState: l,
|
|
438
|
-
context: o,
|
|
439
|
-
setContext: f
|
|
440
|
-
}),
|
|
441
|
-
[l, m, a, R, b, o, i, t]
|
|
442
|
-
);
|
|
443
|
-
return s != null && s.loader && !E && v[a.pathname] ? /* @__PURE__ */ k.jsx(B, { ...w, children: z(s == null ? void 0 : s.loaderFallback) }) : E ? /* @__PURE__ */ k.jsx(B, { ...w, children: z(s == null ? void 0 : s.errorElement) }) : /* @__PURE__ */ k.jsx(B, { ...w, children: z(s == null ? void 0 : s.element) || Le });
|
|
444
|
-
}, V = () => {
|
|
445
|
-
const r = q(oe);
|
|
446
|
-
if (!Object.keys(r).length) throw new Error("useNavigationState must be used within Router component");
|
|
447
|
-
return r;
|
|
1
|
+
import { Suspense as e, createContext as t, lazy as n, useCallback as r, useContext as i, useEffect as a, useMemo as o, useRef as s, useState as c } from "react";
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
|
+
var l = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), u = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
|
|
4
|
+
if (typeof require < "u") return require.apply(this, arguments);
|
|
5
|
+
throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
6
|
+
}), d = t({}), f = t({}), p = t({}), m = /* @__PURE__ */ l(((e) => {
|
|
7
|
+
var t = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
|
|
8
|
+
function r(e, n, r) {
|
|
9
|
+
var i = null;
|
|
10
|
+
if (r !== void 0 && (i = "" + r), n.key !== void 0 && (i = "" + n.key), "key" in n) for (var a in r = {}, n) a !== "key" && (r[a] = n[a]);
|
|
11
|
+
else r = n;
|
|
12
|
+
return n = r.ref, {
|
|
13
|
+
$$typeof: t,
|
|
14
|
+
type: e,
|
|
15
|
+
key: i,
|
|
16
|
+
ref: n === void 0 ? null : n,
|
|
17
|
+
props: r
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
e.Fragment = n, e.jsx = r, e.jsxs = r;
|
|
21
|
+
})), h = /* @__PURE__ */ l(((e) => {
|
|
22
|
+
process.env.NODE_ENV !== "production" && (function() {
|
|
23
|
+
function t(e) {
|
|
24
|
+
if (e == null) return null;
|
|
25
|
+
if (typeof e == "function") return e.$$typeof === k ? null : e.displayName || e.name || null;
|
|
26
|
+
if (typeof e == "string") return e;
|
|
27
|
+
switch (e) {
|
|
28
|
+
case v: return "Fragment";
|
|
29
|
+
case b: return "Profiler";
|
|
30
|
+
case y: return "StrictMode";
|
|
31
|
+
case w: return "Suspense";
|
|
32
|
+
case T: return "SuspenseList";
|
|
33
|
+
case O: return "Activity";
|
|
34
|
+
}
|
|
35
|
+
if (typeof e == "object") switch (typeof e.tag == "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), e.$$typeof) {
|
|
36
|
+
case _: return "Portal";
|
|
37
|
+
case S: return e.displayName || "Context";
|
|
38
|
+
case x: return (e._context.displayName || "Context") + ".Consumer";
|
|
39
|
+
case C:
|
|
40
|
+
var n = e.render;
|
|
41
|
+
return e = e.displayName, e ||= (e = n.displayName || n.name || "", e === "" ? "ForwardRef" : "ForwardRef(" + e + ")"), e;
|
|
42
|
+
case E: return n = e.displayName || null, n === null ? t(e.type) || "Memo" : n;
|
|
43
|
+
case D:
|
|
44
|
+
n = e._payload, e = e._init;
|
|
45
|
+
try {
|
|
46
|
+
return t(e(n));
|
|
47
|
+
} catch {}
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
function n(e) {
|
|
52
|
+
return "" + e;
|
|
53
|
+
}
|
|
54
|
+
function r(e) {
|
|
55
|
+
try {
|
|
56
|
+
n(e);
|
|
57
|
+
var t = !1;
|
|
58
|
+
} catch {
|
|
59
|
+
t = !0;
|
|
60
|
+
}
|
|
61
|
+
if (t) {
|
|
62
|
+
t = console;
|
|
63
|
+
var r = t.error, i = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
64
|
+
return r.call(t, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", i), n(e);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function i(e) {
|
|
68
|
+
if (e === v) return "<>";
|
|
69
|
+
if (typeof e == "object" && e && e.$$typeof === D) return "<...>";
|
|
70
|
+
try {
|
|
71
|
+
var n = t(e);
|
|
72
|
+
return n ? "<" + n + ">" : "<...>";
|
|
73
|
+
} catch {
|
|
74
|
+
return "<...>";
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function a() {
|
|
78
|
+
var e = A.A;
|
|
79
|
+
return e === null ? null : e.getOwner();
|
|
80
|
+
}
|
|
81
|
+
function o() {
|
|
82
|
+
return Error("react-stack-top-frame");
|
|
83
|
+
}
|
|
84
|
+
function s(e) {
|
|
85
|
+
if (j.call(e, "key")) {
|
|
86
|
+
var t = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
87
|
+
if (t && t.isReactWarning) return !1;
|
|
88
|
+
}
|
|
89
|
+
return e.key !== void 0;
|
|
90
|
+
}
|
|
91
|
+
function c(e, t) {
|
|
92
|
+
function n() {
|
|
93
|
+
P || (P = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", t));
|
|
94
|
+
}
|
|
95
|
+
n.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
96
|
+
get: n,
|
|
97
|
+
configurable: !0
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
function l() {
|
|
101
|
+
var e = t(this.type);
|
|
102
|
+
return F[e] || (F[e] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")), e = this.props.ref, e === void 0 ? null : e;
|
|
103
|
+
}
|
|
104
|
+
function d(e, t, n, r, i, a) {
|
|
105
|
+
var o = n.ref;
|
|
106
|
+
return e = {
|
|
107
|
+
$$typeof: g,
|
|
108
|
+
type: e,
|
|
109
|
+
key: t,
|
|
110
|
+
props: n,
|
|
111
|
+
_owner: r
|
|
112
|
+
}, (o === void 0 ? null : o) === null ? Object.defineProperty(e, "ref", {
|
|
113
|
+
enumerable: !1,
|
|
114
|
+
value: null
|
|
115
|
+
}) : Object.defineProperty(e, "ref", {
|
|
116
|
+
enumerable: !1,
|
|
117
|
+
get: l
|
|
118
|
+
}), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
119
|
+
configurable: !1,
|
|
120
|
+
enumerable: !1,
|
|
121
|
+
writable: !0,
|
|
122
|
+
value: 0
|
|
123
|
+
}), Object.defineProperty(e, "_debugInfo", {
|
|
124
|
+
configurable: !1,
|
|
125
|
+
enumerable: !1,
|
|
126
|
+
writable: !0,
|
|
127
|
+
value: null
|
|
128
|
+
}), Object.defineProperty(e, "_debugStack", {
|
|
129
|
+
configurable: !1,
|
|
130
|
+
enumerable: !1,
|
|
131
|
+
writable: !0,
|
|
132
|
+
value: i
|
|
133
|
+
}), Object.defineProperty(e, "_debugTask", {
|
|
134
|
+
configurable: !1,
|
|
135
|
+
enumerable: !1,
|
|
136
|
+
writable: !0,
|
|
137
|
+
value: a
|
|
138
|
+
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
139
|
+
}
|
|
140
|
+
function f(e, n, i, o, l, u) {
|
|
141
|
+
var f = n.children;
|
|
142
|
+
if (f !== void 0) if (o) if (M(f)) {
|
|
143
|
+
for (o = 0; o < f.length; o++) p(f[o]);
|
|
144
|
+
Object.freeze && Object.freeze(f);
|
|
145
|
+
} else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
146
|
+
else p(f);
|
|
147
|
+
if (j.call(n, "key")) {
|
|
148
|
+
f = t(e);
|
|
149
|
+
var m = Object.keys(n).filter(function(e) {
|
|
150
|
+
return e !== "key";
|
|
151
|
+
});
|
|
152
|
+
o = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", R[f + o] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", o, f, m, f), R[f + o] = !0);
|
|
153
|
+
}
|
|
154
|
+
if (f = null, i !== void 0 && (r(i), f = "" + i), s(n) && (r(n.key), f = "" + n.key), "key" in n) for (var h in i = {}, n) h !== "key" && (i[h] = n[h]);
|
|
155
|
+
else i = n;
|
|
156
|
+
return f && c(i, typeof e == "function" ? e.displayName || e.name || "Unknown" : e), d(e, f, i, a(), l, u);
|
|
157
|
+
}
|
|
158
|
+
function p(e) {
|
|
159
|
+
m(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e && e.$$typeof === D && (e._payload.status === "fulfilled" ? m(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
160
|
+
}
|
|
161
|
+
function m(e) {
|
|
162
|
+
return typeof e == "object" && !!e && e.$$typeof === g;
|
|
163
|
+
}
|
|
164
|
+
var h = u("react"), g = Symbol.for("react.transitional.element"), _ = Symbol.for("react.portal"), v = Symbol.for("react.fragment"), y = Symbol.for("react.strict_mode"), b = Symbol.for("react.profiler"), x = Symbol.for("react.consumer"), S = Symbol.for("react.context"), C = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), T = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), D = Symbol.for("react.lazy"), O = Symbol.for("react.activity"), k = Symbol.for("react.client.reference"), A = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, j = Object.prototype.hasOwnProperty, M = Array.isArray, N = console.createTask ? console.createTask : function() {
|
|
165
|
+
return null;
|
|
166
|
+
};
|
|
167
|
+
h = { react_stack_bottom_frame: function(e) {
|
|
168
|
+
return e();
|
|
169
|
+
} };
|
|
170
|
+
var P, F = {}, I = h.react_stack_bottom_frame.bind(h, o)(), L = N(i(o)), R = {};
|
|
171
|
+
e.Fragment = v, e.jsx = function(e, t, n) {
|
|
172
|
+
var r = 1e4 > A.recentlyCreatedOwnerStacks++;
|
|
173
|
+
return f(e, t, n, !1, r ? Error("react-stack-top-frame") : I, r ? N(i(e)) : L);
|
|
174
|
+
}, e.jsxs = function(e, t, n) {
|
|
175
|
+
var r = 1e4 > A.recentlyCreatedOwnerStacks++;
|
|
176
|
+
return f(e, t, n, !0, r ? Error("react-stack-top-frame") : I, r ? N(i(e)) : L);
|
|
177
|
+
};
|
|
178
|
+
})();
|
|
179
|
+
})), g = (/* @__PURE__ */ l(((e, t) => {
|
|
180
|
+
process.env.NODE_ENV === "production" ? t.exports = m() : t.exports = h();
|
|
181
|
+
})))(), _ = ({ children: e, setContext: t, context: n, updateBlockedRoute: r, updateLocation: i, location: a, params: o, prefetchLoader: s, loaderCache: c, blockerState: l }) => /* @__PURE__ */ (0, g.jsx)(d.Provider, {
|
|
182
|
+
value: {
|
|
183
|
+
updateLocation: i,
|
|
184
|
+
updateBlockedRoute: r,
|
|
185
|
+
prefetchLoader: s,
|
|
186
|
+
setContext: t
|
|
187
|
+
},
|
|
188
|
+
children: /* @__PURE__ */ (0, g.jsx)(f.Provider, {
|
|
189
|
+
value: {
|
|
190
|
+
context: n,
|
|
191
|
+
loaderCache: c
|
|
192
|
+
},
|
|
193
|
+
children: /* @__PURE__ */ (0, g.jsx)(p.Provider, {
|
|
194
|
+
value: {
|
|
195
|
+
blockerState: l,
|
|
196
|
+
params: o,
|
|
197
|
+
location: a
|
|
198
|
+
},
|
|
199
|
+
children: e
|
|
200
|
+
})
|
|
201
|
+
})
|
|
202
|
+
}), v = (t, r) => {
|
|
203
|
+
let i = n(() => t().then((e) => ({ default: e.default || e })));
|
|
204
|
+
return () => /* @__PURE__ */ (0, g.jsx)(e, {
|
|
205
|
+
fallback: typeof r == "function" ? r() : r || null,
|
|
206
|
+
children: /* @__PURE__ */ (0, g.jsx)(i, {})
|
|
207
|
+
});
|
|
208
|
+
}, y = (e) => typeof e.element == "function" && e.element.toString().includes("import("), b = (e, t = [], n = "") => {
|
|
209
|
+
let r = e.path.match(/:[^/]+/g), i = e.path.replaceAll(/:[^/]+(\/|$)/g, "").split("/").filter(Boolean), a = e.path.split("/"), o = r ? [...t, ...r.map((e, t) => ({
|
|
210
|
+
key: i[t],
|
|
211
|
+
value: e.slice(1)
|
|
212
|
+
}))] : t, s = o.length ? `${n}${a.slice(0, a.length - 1).join("/")}` : e.path, c = y(e) ? v(e.element, e.fallback) : e.element;
|
|
213
|
+
return [{
|
|
214
|
+
...e,
|
|
215
|
+
path: s,
|
|
216
|
+
params: o,
|
|
217
|
+
element: c
|
|
218
|
+
}, ...e.children?.flatMap((e) => b(e, o, s)) || []];
|
|
219
|
+
}, x = (e) => e.flatMap((e) => b(e, [])), S = (e) => {
|
|
220
|
+
let { pathname: t } = window.location, n = t.split("/");
|
|
221
|
+
return (e || []).map((e) => ({
|
|
222
|
+
index: n.findIndex((t) => t === e.key),
|
|
223
|
+
value: e.value
|
|
224
|
+
})).reduce((e, t) => ({
|
|
225
|
+
...e,
|
|
226
|
+
[t.value]: n[t.index + 1]
|
|
227
|
+
}), {});
|
|
228
|
+
}, C = (e) => ({
|
|
229
|
+
pathname: e.pathname,
|
|
230
|
+
search: e.search
|
|
231
|
+
}), w = (e, t) => {
|
|
232
|
+
let n = e.path.split("/").filter(Boolean), r = e.params ? Object.keys(e.params).length : 0, i = t.split("/").filter(Boolean);
|
|
233
|
+
return n.every((e, t) => e === i[t + +!!t]) && i.length === n.length + r;
|
|
234
|
+
}, T = class {
|
|
235
|
+
url;
|
|
236
|
+
search;
|
|
237
|
+
cause;
|
|
238
|
+
constructor(e, t) {
|
|
239
|
+
this.url = e, this.search = t, this.cause = "redirect";
|
|
240
|
+
}
|
|
241
|
+
}, E = (e, t) => Promise.reject(new T(e, t)), D = (e) => {
|
|
242
|
+
let t = s(e);
|
|
243
|
+
return a(() => {
|
|
244
|
+
t.current = e;
|
|
245
|
+
}, [e]), t;
|
|
246
|
+
}, O = ({ setLocation: e, routeList: t, context: n, revalidateCache: i }) => {
|
|
247
|
+
let [l, u] = c({
|
|
248
|
+
from: "",
|
|
249
|
+
to: ""
|
|
250
|
+
}), d = s(""), f = D(r(async (r) => {
|
|
251
|
+
try {
|
|
252
|
+
let a = t.find((e) => w(e, r.pathname));
|
|
253
|
+
a?.beforeLoad && await a?.beforeLoad(n), e(r), r.pathname !== window.location.pathname && (history.pushState(null, "", r.pathname), d.current = r.pathname), await i(a), a?.afterLoad && await a?.afterLoad(n);
|
|
254
|
+
} catch (t) {
|
|
255
|
+
if (!(t instanceof T)) return t;
|
|
256
|
+
history.replaceState(null, "", `${t.url}${t.search || ""}`), e({
|
|
257
|
+
pathname: t.url,
|
|
258
|
+
search: t.search
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}, [
|
|
262
|
+
n,
|
|
263
|
+
i,
|
|
264
|
+
t,
|
|
265
|
+
e
|
|
266
|
+
])), p = r(({ type: e, payload: t = "" }) => u((n) => n.from === t && e === "charge" ? n : t && n.from !== t && e === "charge" ? {
|
|
267
|
+
...n,
|
|
268
|
+
from: t
|
|
269
|
+
} : e === "reset" ? {
|
|
270
|
+
...n,
|
|
271
|
+
to: ""
|
|
272
|
+
} : (e === "process" && f.current({ pathname: n.to }), !n.from && !n.to ? n : {
|
|
273
|
+
from: "",
|
|
274
|
+
to: ""
|
|
275
|
+
})), [f]), m = r(async (e) => {
|
|
276
|
+
l.from ? u((t) => ({
|
|
277
|
+
...t,
|
|
278
|
+
to: e.pathname
|
|
279
|
+
})) : await f.current(e);
|
|
280
|
+
}, [l.from, f]);
|
|
281
|
+
return a(() => {
|
|
282
|
+
let e = async (e) => {
|
|
283
|
+
let t = C(e.target.location);
|
|
284
|
+
d.current === l.from ? (u({
|
|
285
|
+
from: d.current,
|
|
286
|
+
to: t.pathname
|
|
287
|
+
}), history.replaceState(null, "", d.current)) : f.current(t);
|
|
288
|
+
};
|
|
289
|
+
return window.addEventListener("popstate", e), () => window.removeEventListener("popstate", e);
|
|
290
|
+
}, [l.from, f]), a(() => {
|
|
291
|
+
let e = C(window.location);
|
|
292
|
+
f.current(e), d.current = e.pathname;
|
|
293
|
+
}, [f]), {
|
|
294
|
+
blockerState: o(() => l.from && l.to ? "blocked" : l.from ? "charged" : "unblocked", [l]),
|
|
295
|
+
updateLocation: m,
|
|
296
|
+
updateBlockedRoute: p
|
|
297
|
+
};
|
|
298
|
+
}, k = (e) => {
|
|
299
|
+
let [t, n] = c({}), [i, a] = c(!1), [o, l] = c({}), u = s({}), d = r(({ key: e, value: t }) => n((n) => ({
|
|
300
|
+
...n,
|
|
301
|
+
[e]: t
|
|
302
|
+
})), []), f = r((e) => {
|
|
303
|
+
if (!e) return !0;
|
|
304
|
+
let t = u.current[e.path];
|
|
305
|
+
return !!(t && Date.now() - t < (e.staleTime || 0));
|
|
306
|
+
}, []), p = r(async (e) => {
|
|
307
|
+
if (e?.loader && !f(e)) {
|
|
308
|
+
l((t) => ({
|
|
309
|
+
...t,
|
|
310
|
+
[e.path]: !0
|
|
311
|
+
})), n((t) => Object.keys(t).filter((t) => t !== e.path).reduce((e, n) => ({
|
|
312
|
+
...e,
|
|
313
|
+
[n]: t[n]
|
|
314
|
+
}), {}));
|
|
315
|
+
try {
|
|
316
|
+
a(!1);
|
|
317
|
+
let t = await e?.loader();
|
|
318
|
+
u.current = {
|
|
319
|
+
...u.current,
|
|
320
|
+
[e.path]: Date.now()
|
|
321
|
+
}, d({
|
|
322
|
+
key: e.path,
|
|
323
|
+
value: t
|
|
324
|
+
});
|
|
325
|
+
} catch {
|
|
326
|
+
a(!0);
|
|
327
|
+
} finally {
|
|
328
|
+
l((t) => ({
|
|
329
|
+
...t,
|
|
330
|
+
[e.path]: !1
|
|
331
|
+
}));
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}, [f, d]), m = r(async (t) => {
|
|
335
|
+
let n = e.find((e) => w(e, t));
|
|
336
|
+
n && await p(n);
|
|
337
|
+
}, [p, e]);
|
|
338
|
+
return {
|
|
339
|
+
loaderCache: t[window.location.pathname],
|
|
340
|
+
loaderError: i,
|
|
341
|
+
prefetchLoader: m,
|
|
342
|
+
revalidateCache: p,
|
|
343
|
+
isLoading: o[window.location.pathname]
|
|
344
|
+
};
|
|
345
|
+
}, A = (e) => e ? typeof e == "function" ? /* @__PURE__ */ (0, g.jsx)(e, {}) : e : null, j = "error 404. Page not found", M = "*", N = ({ routeList: e, context: t = {} }) => {
|
|
346
|
+
let [n, r] = c(C(window.location)), [i, a] = c(t), s = o(() => e.find((e) => e.path === M || w(e, n.pathname)), [n.pathname, e]), { loaderError: l, loaderCache: u, prefetchLoader: d, revalidateCache: f, isLoading: p } = k(e), { blockerState: m, updateLocation: h, updateBlockedRoute: v } = O({
|
|
347
|
+
setLocation: r,
|
|
348
|
+
routeList: e,
|
|
349
|
+
context: i,
|
|
350
|
+
revalidateCache: f
|
|
351
|
+
}), y = o(() => s?.params ? S(s.params) : {}, [s]), b = o(() => ({
|
|
352
|
+
location: n,
|
|
353
|
+
updateLocation: h,
|
|
354
|
+
params: y,
|
|
355
|
+
loaderCache: u,
|
|
356
|
+
prefetchLoader: d,
|
|
357
|
+
updateBlockedRoute: v,
|
|
358
|
+
blockerState: m,
|
|
359
|
+
context: i,
|
|
360
|
+
setContext: a
|
|
361
|
+
}), [
|
|
362
|
+
m,
|
|
363
|
+
u,
|
|
364
|
+
n,
|
|
365
|
+
y,
|
|
366
|
+
d,
|
|
367
|
+
i,
|
|
368
|
+
v,
|
|
369
|
+
h
|
|
370
|
+
]);
|
|
371
|
+
return s?.loader && !l && p ? /* @__PURE__ */ (0, g.jsx)(_, {
|
|
372
|
+
...b,
|
|
373
|
+
children: A(s?.loaderFallback)
|
|
374
|
+
}) : l ? /* @__PURE__ */ (0, g.jsx)(_, {
|
|
375
|
+
...b,
|
|
376
|
+
children: A(s?.errorElement)
|
|
377
|
+
}) : /* @__PURE__ */ (0, g.jsx)(_, {
|
|
378
|
+
...b,
|
|
379
|
+
children: A(s?.element) || j
|
|
380
|
+
});
|
|
381
|
+
}, P = () => {
|
|
382
|
+
let e = i(p);
|
|
383
|
+
if (!Object.keys(e).length) throw Error("useNavigationState must be used within Router component");
|
|
384
|
+
return e;
|
|
385
|
+
}, F = () => {
|
|
386
|
+
let e = i(d);
|
|
387
|
+
if (!Object.keys(e).length) throw Error("useRouterActions must be used within Router component");
|
|
388
|
+
return e;
|
|
389
|
+
}, I = () => {
|
|
390
|
+
let e = i(f);
|
|
391
|
+
if (!Object.keys(e).length) throw Error("useRouterData must be used within Router component");
|
|
392
|
+
return e;
|
|
448
393
|
}, L = () => {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
},
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
},
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
},
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
}, Ge = (r) => {
|
|
493
|
-
j(() => {
|
|
494
|
-
const n = (a) => {
|
|
495
|
-
r && (a.preventDefault(), r());
|
|
496
|
-
};
|
|
497
|
-
return window.addEventListener("beforeunload", n), () => window.removeEventListener("beforeunload", n);
|
|
498
|
-
}, [r]);
|
|
499
|
-
}, Xe = () => {
|
|
500
|
-
const { context: r } = ie(), { setContext: n } = L();
|
|
501
|
-
return { context: r, setContext: n };
|
|
502
|
-
};
|
|
503
|
-
export {
|
|
504
|
-
Ue as Link,
|
|
505
|
-
ze as Router,
|
|
506
|
-
J as comparePaths,
|
|
507
|
-
Fe as createRouter,
|
|
508
|
-
U as parseWindowLocation,
|
|
509
|
-
Be as redirect,
|
|
510
|
-
Ge as useBeforeUnload,
|
|
511
|
-
Ve as useBlocker,
|
|
512
|
-
Je as useLoaderState,
|
|
513
|
-
qe as useLocation,
|
|
514
|
-
De as useNavigate,
|
|
515
|
-
We as useParams,
|
|
516
|
-
Xe as useRouterContext
|
|
394
|
+
let { updateLocation: e } = F();
|
|
395
|
+
return r(async (t) => t === -1 ? history.go(-1) : await e(t), [e]);
|
|
396
|
+
}, R = ({ children: e, to: t, prefetch: n = !0 }) => {
|
|
397
|
+
let { prefetchLoader: r } = F(), i = L();
|
|
398
|
+
return /* @__PURE__ */ (0, g.jsx)("a", {
|
|
399
|
+
style: { cursor: "pointer" },
|
|
400
|
+
onClick: () => i({ pathname: t }),
|
|
401
|
+
onMouseOver: () => n && r(t),
|
|
402
|
+
children: e
|
|
403
|
+
});
|
|
404
|
+
}, z = () => {
|
|
405
|
+
let { params: e } = P();
|
|
406
|
+
return e;
|
|
407
|
+
}, B = () => P().location, V = () => {
|
|
408
|
+
let { loaderCache: e } = I();
|
|
409
|
+
return e;
|
|
410
|
+
}, H = (e) => {
|
|
411
|
+
let { location: { pathname: t }, blockerState: n } = P(), { updateBlockedRoute: r } = F(), i = e();
|
|
412
|
+
return a(() => r(i ? {
|
|
413
|
+
type: "charge",
|
|
414
|
+
payload: t
|
|
415
|
+
} : { type: "unblock" }), [
|
|
416
|
+
i,
|
|
417
|
+
t,
|
|
418
|
+
r
|
|
419
|
+
]), {
|
|
420
|
+
state: n,
|
|
421
|
+
process: () => r({ type: "process" }),
|
|
422
|
+
reset: () => r({ type: "reset" })
|
|
423
|
+
};
|
|
424
|
+
}, U = (e) => {
|
|
425
|
+
a(() => {
|
|
426
|
+
let t = (t) => {
|
|
427
|
+
e && (t.preventDefault(), e());
|
|
428
|
+
};
|
|
429
|
+
return window.addEventListener("beforeunload", t), () => window.removeEventListener("beforeunload", t);
|
|
430
|
+
}, [e]);
|
|
431
|
+
}, W = () => {
|
|
432
|
+
let { context: e } = I(), { setContext: t } = F();
|
|
433
|
+
return {
|
|
434
|
+
context: e,
|
|
435
|
+
setContext: t
|
|
436
|
+
};
|
|
517
437
|
};
|
|
438
|
+
//#endregion
|
|
439
|
+
export { R as Link, N as Router, x as createRouter, E as redirect, U as useBeforeUnload, H as useBlocker, V as useLoaderState, B as useLocation, L as useNavigate, z as useParams, W as useRouterContext };
|