@kitbag/router 0.11.4 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/kitbag-router.d.ts +131 -146
- package/dist/kitbag-router.js +1068 -953
- package/dist/kitbag-router.umd.cjs +1 -1
- package/package.json +17 -17
package/dist/kitbag-router.js
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { defineComponent as
|
|
5
|
-
class
|
|
1
|
+
var sn = Object.defineProperty;
|
|
2
|
+
var cn = (e, t, n) => t in e ? sn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var _ = (e, t, n) => cn(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { defineComponent as le, h as ve, ref as qe, inject as re, toRefs as un, computed as N, reactive as Ue, markRaw as ye, defineAsyncComponent as fn, onMounted as ln, onBeforeUnmount as hn, watch as je, toValue as se, toRef as pn, onUnmounted as gt, openBlock as vt, createElementBlock as dn, normalizeClass as mn, renderSlot as yt, normalizeProps as Rt, guardReactiveProps as gn, unref as ce, resolveComponent as vn, provide as yn, mergeProps as Rn, createBlock as wn, resolveDynamicComponent as Pn, createCommentVNode as En } from "vue";
|
|
5
|
+
class he extends Error {
|
|
6
6
|
constructor() {
|
|
7
7
|
super("Router not installed");
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function pe(e) {
|
|
11
11
|
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function bn(e) {
|
|
14
14
|
return e.every((t) => Array.isArray(t));
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function de(e) {
|
|
17
17
|
return typeof e == "string" && e.length > 0;
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function Re(e) {
|
|
20
20
|
return {
|
|
21
|
-
value:
|
|
21
|
+
value: de(e) ? e.replace(/^#*/, "") : void 0
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
return
|
|
24
|
+
function Sn(e, t) {
|
|
25
|
+
return Re(`${e.value ?? ""}${t.value ?? ""}`);
|
|
26
26
|
}
|
|
27
|
-
class
|
|
27
|
+
class kn extends Error {
|
|
28
28
|
constructor(t) {
|
|
29
29
|
super(`Child property on meta for ${t} conflicts with the parent meta.`);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
return
|
|
32
|
+
function An(e, t) {
|
|
33
|
+
return xn(e, t), { ...e, ...t };
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function xn(e, t) {
|
|
36
36
|
const n = Object.keys(e).find((r) => r in t && typeof t[r] != typeof e[r]);
|
|
37
37
|
if (n)
|
|
38
|
-
throw new
|
|
38
|
+
throw new kn(n);
|
|
39
39
|
}
|
|
40
|
-
class
|
|
40
|
+
class Un extends Error {
|
|
41
41
|
/**
|
|
42
42
|
* Constructs a new DuplicateParamsError instance with a message indicating the problematic parameter.
|
|
43
43
|
* @param paramName - The name of the parameter that was duplicated.
|
|
@@ -46,120 +46,123 @@ class yn extends Error {
|
|
|
46
46
|
super(`Invalid Param "${t}": Router does not support multiple params by the same name. All param names must be unique.`);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function Y(e) {
|
|
50
50
|
return Array.isArray(e) ? e : [e];
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function wt(e, t) {
|
|
53
53
|
return e.filter((n) => t === n).length;
|
|
54
54
|
}
|
|
55
|
-
function
|
|
56
|
-
const t = e.flatMap((n) => Array.isArray(n) ? n : Object.keys(n).map(
|
|
55
|
+
function oe(...e) {
|
|
56
|
+
const t = e.flatMap((n) => Array.isArray(n) ? n : Object.keys(n).map(Bn));
|
|
57
57
|
for (const n of t)
|
|
58
|
-
if (
|
|
59
|
-
throw new
|
|
58
|
+
if (wt(t, n) > 1)
|
|
59
|
+
throw new Un(n);
|
|
60
60
|
}
|
|
61
|
-
function
|
|
61
|
+
function Bn(e) {
|
|
62
62
|
return e.startsWith("?") ? e.slice(1) : e;
|
|
63
63
|
}
|
|
64
|
-
function
|
|
65
|
-
return
|
|
64
|
+
function Ln(e, t) {
|
|
65
|
+
return oe(e.params, t.params), {
|
|
66
66
|
value: `${e.value}${t.value}`,
|
|
67
67
|
params: { ...e.params, ...t.params }
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
-
function
|
|
71
|
-
return
|
|
72
|
-
value: [e.value, t.value].filter(
|
|
70
|
+
function Cn(e, t) {
|
|
71
|
+
return oe(e.params, t.params), {
|
|
72
|
+
value: [e.value, t.value].filter(de).join("&"),
|
|
73
73
|
params: { ...e.params, ...t.params }
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
|
-
function
|
|
77
|
-
return
|
|
76
|
+
function Nn(e, t) {
|
|
77
|
+
return oe(e, t), { ...e, ...t };
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function Hn(e) {
|
|
80
80
|
return "host" in e && !!e.host;
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function Pt(e) {
|
|
83
83
|
return "parent" in e && !!e.parent;
|
|
84
84
|
}
|
|
85
|
-
function
|
|
85
|
+
function _e(e) {
|
|
86
86
|
return "component" in e && !!e.component;
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function Me(e) {
|
|
89
89
|
return "components" in e && !!e.components;
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function jn(e) {
|
|
92
92
|
return "state" in e && !!e.state;
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function Et(e, t) {
|
|
95
95
|
return {
|
|
96
96
|
...t,
|
|
97
|
-
path:
|
|
98
|
-
query:
|
|
99
|
-
meta:
|
|
100
|
-
state:
|
|
101
|
-
hash:
|
|
97
|
+
path: Ln(e.path, t.path),
|
|
98
|
+
query: Cn(e.query, t.query),
|
|
99
|
+
meta: An(e.meta, t.meta),
|
|
100
|
+
state: Nn(e.state, t.state),
|
|
101
|
+
hash: Sn(e.hash, t.hash),
|
|
102
102
|
matches: [...e.matches, t.matched],
|
|
103
103
|
host: e.host,
|
|
104
104
|
depth: e.depth + 1
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function Te() {
|
|
108
108
|
return typeof window < "u" && typeof window.document < "u";
|
|
109
109
|
}
|
|
110
|
-
function
|
|
111
|
-
return
|
|
110
|
+
function bt(e) {
|
|
111
|
+
return typeof e == "object" && e !== null && "then" in e;
|
|
112
|
+
}
|
|
113
|
+
function Vn(e, t) {
|
|
114
|
+
return le({
|
|
112
115
|
name: "PropsWrapper",
|
|
113
116
|
expose: [],
|
|
114
117
|
setup() {
|
|
115
118
|
const n = t();
|
|
116
|
-
return
|
|
119
|
+
return () => n instanceof Error ? "" : bt(n) ? ve($n(e, n)) : ve(e, n);
|
|
117
120
|
}
|
|
118
121
|
});
|
|
119
122
|
}
|
|
120
|
-
function
|
|
121
|
-
return
|
|
123
|
+
function $n(e, t) {
|
|
124
|
+
return le({
|
|
122
125
|
name: "AsyncPropsWrapper",
|
|
123
126
|
expose: [],
|
|
124
127
|
setup() {
|
|
125
|
-
const n =
|
|
126
|
-
return (async () => n.value = await t)(), () => n.value ?
|
|
128
|
+
const n = qe();
|
|
129
|
+
return (async () => n.value = await t)(), () => n.value instanceof Error ? "" : n.value ? ve(e, n.value) : "";
|
|
127
130
|
}
|
|
128
131
|
});
|
|
129
132
|
}
|
|
130
|
-
class
|
|
133
|
+
class Z extends Error {
|
|
131
134
|
}
|
|
132
|
-
const
|
|
133
|
-
function
|
|
135
|
+
const W = "[", G = "]";
|
|
136
|
+
function On(e) {
|
|
134
137
|
return e !== String && e !== Boolean && e !== Number && e !== Date;
|
|
135
138
|
}
|
|
136
|
-
function
|
|
137
|
-
return typeof e == "function" &&
|
|
139
|
+
function qn(e) {
|
|
140
|
+
return typeof e == "function" && On(e);
|
|
138
141
|
}
|
|
139
|
-
function
|
|
142
|
+
function Be(e) {
|
|
140
143
|
return typeof e == "object" && "get" in e && typeof e.get == "function" && "set" in e && typeof e.set == "function";
|
|
141
144
|
}
|
|
142
|
-
function
|
|
143
|
-
return
|
|
145
|
+
function _n(e) {
|
|
146
|
+
return Be(e) && e.defaultValue !== void 0;
|
|
144
147
|
}
|
|
145
|
-
function
|
|
146
|
-
return
|
|
148
|
+
function uo(e, t) {
|
|
149
|
+
return Dn(e, t);
|
|
147
150
|
}
|
|
148
|
-
function
|
|
151
|
+
function Mn(e, t) {
|
|
149
152
|
return e[t] ?? String;
|
|
150
153
|
}
|
|
151
|
-
const
|
|
154
|
+
const O = {
|
|
152
155
|
invalid: (e) => {
|
|
153
|
-
throw new
|
|
156
|
+
throw new Z(e);
|
|
154
157
|
}
|
|
155
|
-
},
|
|
158
|
+
}, Tn = {
|
|
156
159
|
get: (e) => e,
|
|
157
160
|
set: (e, { invalid: t }) => {
|
|
158
161
|
if (typeof e != "string")
|
|
159
162
|
throw t();
|
|
160
163
|
return e;
|
|
161
164
|
}
|
|
162
|
-
},
|
|
165
|
+
}, St = {
|
|
163
166
|
get: (e, { invalid: t }) => {
|
|
164
167
|
if (e === "true")
|
|
165
168
|
return !0;
|
|
@@ -172,7 +175,7 @@ const j = {
|
|
|
172
175
|
throw t();
|
|
173
176
|
return e.toString();
|
|
174
177
|
}
|
|
175
|
-
},
|
|
178
|
+
}, kt = {
|
|
176
179
|
get: (e, { invalid: t }) => {
|
|
177
180
|
const n = Number(e);
|
|
178
181
|
if (isNaN(n))
|
|
@@ -184,7 +187,7 @@ const j = {
|
|
|
184
187
|
throw t();
|
|
185
188
|
return e.toString();
|
|
186
189
|
}
|
|
187
|
-
},
|
|
190
|
+
}, At = {
|
|
188
191
|
get: (e, { invalid: t }) => {
|
|
189
192
|
const n = new Date(e);
|
|
190
193
|
if (isNaN(n.getTime()))
|
|
@@ -196,7 +199,7 @@ const j = {
|
|
|
196
199
|
throw t();
|
|
197
200
|
return e.toISOString();
|
|
198
201
|
}
|
|
199
|
-
},
|
|
202
|
+
}, xt = {
|
|
200
203
|
get: (e, { invalid: t }) => {
|
|
201
204
|
try {
|
|
202
205
|
return JSON.parse(e);
|
|
@@ -212,84 +215,84 @@ const j = {
|
|
|
212
215
|
}
|
|
213
216
|
}
|
|
214
217
|
};
|
|
215
|
-
function
|
|
216
|
-
if (e === void 0 || !
|
|
217
|
-
if (
|
|
218
|
+
function ue(e, t, n = !1) {
|
|
219
|
+
if (e === void 0 || !de(e)) {
|
|
220
|
+
if (_n(t))
|
|
218
221
|
return t.defaultValue;
|
|
219
222
|
if (n)
|
|
220
223
|
return;
|
|
221
|
-
throw new
|
|
224
|
+
throw new Z();
|
|
222
225
|
}
|
|
223
226
|
if (t === String)
|
|
224
|
-
return
|
|
227
|
+
return Tn.get(e, O);
|
|
225
228
|
if (t === Boolean)
|
|
226
|
-
return
|
|
229
|
+
return St.get(e, O);
|
|
227
230
|
if (t === Number)
|
|
228
|
-
return
|
|
231
|
+
return kt.get(e, O);
|
|
229
232
|
if (t === Date)
|
|
230
|
-
return
|
|
233
|
+
return At.get(e, O);
|
|
231
234
|
if (t === JSON)
|
|
232
|
-
return
|
|
233
|
-
if (
|
|
234
|
-
return t(e,
|
|
235
|
-
if (
|
|
236
|
-
return t.get(e,
|
|
235
|
+
return xt.get(e, O);
|
|
236
|
+
if (qn(t))
|
|
237
|
+
return t(e, O);
|
|
238
|
+
if (Be(t))
|
|
239
|
+
return t.get(e, O);
|
|
237
240
|
if (t instanceof RegExp) {
|
|
238
241
|
if (t.test(e))
|
|
239
242
|
return e;
|
|
240
|
-
throw new
|
|
243
|
+
throw new Z();
|
|
241
244
|
}
|
|
242
245
|
return e;
|
|
243
246
|
}
|
|
244
|
-
function
|
|
247
|
+
function ie(e, t, n = !1) {
|
|
245
248
|
if (e === void 0) {
|
|
246
249
|
if (n)
|
|
247
250
|
return "";
|
|
248
|
-
throw new
|
|
251
|
+
throw new Z();
|
|
249
252
|
}
|
|
250
253
|
if (t === Boolean)
|
|
251
|
-
return
|
|
254
|
+
return St.set(e, O);
|
|
252
255
|
if (t === Number)
|
|
253
|
-
return
|
|
256
|
+
return kt.set(e, O);
|
|
254
257
|
if (t === Date)
|
|
255
|
-
return
|
|
258
|
+
return At.set(e, O);
|
|
256
259
|
if (t === JSON)
|
|
257
|
-
return
|
|
258
|
-
if (
|
|
259
|
-
return t.set(e,
|
|
260
|
+
return xt.set(e, O);
|
|
261
|
+
if (Be(t))
|
|
262
|
+
return t.set(e, O);
|
|
260
263
|
try {
|
|
261
264
|
return e.toString();
|
|
262
265
|
} catch {
|
|
263
|
-
throw new
|
|
266
|
+
throw new Z();
|
|
264
267
|
}
|
|
265
268
|
}
|
|
266
|
-
function
|
|
267
|
-
return
|
|
268
|
-
get: (n) =>
|
|
269
|
-
set: (n) =>
|
|
269
|
+
function Dn(e, t) {
|
|
270
|
+
return Be(e) ? { ...e, defaultValue: t ?? e.defaultValue } : {
|
|
271
|
+
get: (n) => ue(n, e),
|
|
272
|
+
set: (n) => ie(n, e),
|
|
270
273
|
defaultValue: t
|
|
271
274
|
};
|
|
272
275
|
}
|
|
273
|
-
function
|
|
274
|
-
return
|
|
276
|
+
function Q() {
|
|
277
|
+
return Q = Object.assign ? Object.assign.bind() : function(e) {
|
|
275
278
|
for (var t = 1; t < arguments.length; t++) {
|
|
276
279
|
var n = arguments[t];
|
|
277
280
|
for (var r in n)
|
|
278
281
|
Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]);
|
|
279
282
|
}
|
|
280
283
|
return e;
|
|
281
|
-
},
|
|
284
|
+
}, Q.apply(this, arguments);
|
|
282
285
|
}
|
|
283
|
-
var
|
|
286
|
+
var H;
|
|
284
287
|
(function(e) {
|
|
285
288
|
e.Pop = "POP", e.Push = "PUSH", e.Replace = "REPLACE";
|
|
286
|
-
})(
|
|
287
|
-
var
|
|
289
|
+
})(H || (H = {}));
|
|
290
|
+
var ee = process.env.NODE_ENV !== "production" ? function(e) {
|
|
288
291
|
return Object.freeze(e);
|
|
289
292
|
} : function(e) {
|
|
290
293
|
return e;
|
|
291
294
|
};
|
|
292
|
-
function
|
|
295
|
+
function K(e, t) {
|
|
293
296
|
if (!e) {
|
|
294
297
|
typeof console < "u" && console.warn(t);
|
|
295
298
|
try {
|
|
@@ -298,38 +301,38 @@ function Q(e, t) {
|
|
|
298
301
|
}
|
|
299
302
|
}
|
|
300
303
|
}
|
|
301
|
-
var
|
|
302
|
-
function
|
|
304
|
+
var we = "beforeunload", Wn = "hashchange", Ut = "popstate";
|
|
305
|
+
function at(e) {
|
|
303
306
|
e === void 0 && (e = {});
|
|
304
307
|
var t = e, n = t.window, r = n === void 0 ? document.defaultView : n, o = r.history;
|
|
305
308
|
function a() {
|
|
306
|
-
var
|
|
307
|
-
return [
|
|
309
|
+
var m = r.location, l = m.pathname, d = m.search, E = m.hash, b = o.state || {};
|
|
310
|
+
return [b.idx, ee({
|
|
308
311
|
pathname: l,
|
|
309
|
-
search:
|
|
312
|
+
search: d,
|
|
310
313
|
hash: E,
|
|
311
|
-
state:
|
|
312
|
-
key:
|
|
314
|
+
state: b.usr || null,
|
|
315
|
+
key: b.key || "default"
|
|
313
316
|
})];
|
|
314
317
|
}
|
|
315
318
|
var s = null;
|
|
316
|
-
function
|
|
319
|
+
function c() {
|
|
317
320
|
if (s)
|
|
318
321
|
p.call(s), s = null;
|
|
319
322
|
else {
|
|
320
|
-
var
|
|
323
|
+
var m = H.Pop, l = a(), d = l[0], E = l[1];
|
|
321
324
|
if (p.length)
|
|
322
|
-
if (
|
|
323
|
-
var
|
|
324
|
-
|
|
325
|
-
action:
|
|
325
|
+
if (d != null) {
|
|
326
|
+
var b = f - d;
|
|
327
|
+
b && (s = {
|
|
328
|
+
action: m,
|
|
326
329
|
location: E,
|
|
327
330
|
retry: function() {
|
|
328
|
-
b
|
|
331
|
+
A(b * -1);
|
|
329
332
|
}
|
|
330
|
-
}, b
|
|
333
|
+
}, A(b));
|
|
331
334
|
} else
|
|
332
|
-
process.env.NODE_ENV !== "production" &&
|
|
335
|
+
process.env.NODE_ENV !== "production" && K(
|
|
333
336
|
!1,
|
|
334
337
|
// TODO: Write up a doc that explains our blocking strategy in
|
|
335
338
|
// detail and link to it here so people can understand better what
|
|
@@ -337,137 +340,137 @@ function Ze(e) {
|
|
|
337
340
|
"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation."
|
|
338
341
|
);
|
|
339
342
|
else
|
|
340
|
-
B(
|
|
343
|
+
B(m);
|
|
341
344
|
}
|
|
342
345
|
}
|
|
343
|
-
r.addEventListener(
|
|
344
|
-
var
|
|
345
|
-
|
|
346
|
-
idx:
|
|
346
|
+
r.addEventListener(Ut, c);
|
|
347
|
+
var i = H.Pop, u = a(), f = u[0], h = u[1], v = te(), p = te();
|
|
348
|
+
f == null && (f = 0, o.replaceState(Q({}, o.state, {
|
|
349
|
+
idx: f
|
|
347
350
|
}), ""));
|
|
348
|
-
function
|
|
349
|
-
return typeof
|
|
351
|
+
function k(m) {
|
|
352
|
+
return typeof m == "string" ? m : z(m);
|
|
350
353
|
}
|
|
351
|
-
function
|
|
352
|
-
return l === void 0 && (l = null),
|
|
354
|
+
function R(m, l) {
|
|
355
|
+
return l === void 0 && (l = null), ee(Q({
|
|
353
356
|
pathname: h.pathname,
|
|
354
357
|
hash: "",
|
|
355
358
|
search: ""
|
|
356
|
-
}, typeof
|
|
359
|
+
}, typeof m == "string" ? fe(m) : m, {
|
|
357
360
|
state: l,
|
|
358
|
-
key:
|
|
361
|
+
key: Ee()
|
|
359
362
|
}));
|
|
360
363
|
}
|
|
361
|
-
function
|
|
364
|
+
function y(m, l) {
|
|
362
365
|
return [{
|
|
363
|
-
usr:
|
|
364
|
-
key:
|
|
366
|
+
usr: m.state,
|
|
367
|
+
key: m.key,
|
|
365
368
|
idx: l
|
|
366
|
-
},
|
|
369
|
+
}, k(m)];
|
|
367
370
|
}
|
|
368
|
-
function
|
|
371
|
+
function S(m, l, d) {
|
|
369
372
|
return !p.length || (p.call({
|
|
370
|
-
action:
|
|
373
|
+
action: m,
|
|
371
374
|
location: l,
|
|
372
|
-
retry:
|
|
375
|
+
retry: d
|
|
373
376
|
}), !1);
|
|
374
377
|
}
|
|
375
|
-
function B(
|
|
376
|
-
|
|
378
|
+
function B(m) {
|
|
379
|
+
i = m;
|
|
377
380
|
var l = a();
|
|
378
|
-
|
|
379
|
-
action:
|
|
381
|
+
f = l[0], h = l[1], v.call({
|
|
382
|
+
action: i,
|
|
380
383
|
location: h
|
|
381
384
|
});
|
|
382
385
|
}
|
|
383
|
-
function
|
|
384
|
-
var
|
|
385
|
-
function
|
|
386
|
-
|
|
386
|
+
function g(m, l) {
|
|
387
|
+
var d = H.Push, E = R(m, l);
|
|
388
|
+
function b() {
|
|
389
|
+
g(m, l);
|
|
387
390
|
}
|
|
388
|
-
if (
|
|
389
|
-
var
|
|
391
|
+
if (S(d, E, b)) {
|
|
392
|
+
var U = y(E, f + 1), C = U[0], j = U[1];
|
|
390
393
|
try {
|
|
391
|
-
o.pushState(
|
|
394
|
+
o.pushState(C, "", j);
|
|
392
395
|
} catch {
|
|
393
|
-
r.location.assign(
|
|
396
|
+
r.location.assign(j);
|
|
394
397
|
}
|
|
395
|
-
B(
|
|
398
|
+
B(d);
|
|
396
399
|
}
|
|
397
400
|
}
|
|
398
|
-
function
|
|
399
|
-
var
|
|
400
|
-
function
|
|
401
|
-
|
|
401
|
+
function P(m, l) {
|
|
402
|
+
var d = H.Replace, E = R(m, l);
|
|
403
|
+
function b() {
|
|
404
|
+
P(m, l);
|
|
402
405
|
}
|
|
403
|
-
if (
|
|
404
|
-
var
|
|
405
|
-
o.replaceState(
|
|
406
|
+
if (S(d, E, b)) {
|
|
407
|
+
var U = y(E, f), C = U[0], j = U[1];
|
|
408
|
+
o.replaceState(C, "", j), B(d);
|
|
406
409
|
}
|
|
407
410
|
}
|
|
408
|
-
function
|
|
409
|
-
o.go(
|
|
411
|
+
function A(m) {
|
|
412
|
+
o.go(m);
|
|
410
413
|
}
|
|
411
|
-
var
|
|
414
|
+
var x = {
|
|
412
415
|
get action() {
|
|
413
|
-
return
|
|
416
|
+
return i;
|
|
414
417
|
},
|
|
415
418
|
get location() {
|
|
416
419
|
return h;
|
|
417
420
|
},
|
|
418
|
-
createHref:
|
|
419
|
-
push:
|
|
420
|
-
replace:
|
|
421
|
-
go:
|
|
421
|
+
createHref: k,
|
|
422
|
+
push: g,
|
|
423
|
+
replace: P,
|
|
424
|
+
go: A,
|
|
422
425
|
back: function() {
|
|
423
|
-
|
|
426
|
+
A(-1);
|
|
424
427
|
},
|
|
425
428
|
forward: function() {
|
|
426
|
-
|
|
429
|
+
A(1);
|
|
427
430
|
},
|
|
428
431
|
listen: function(l) {
|
|
429
|
-
return
|
|
432
|
+
return v.push(l);
|
|
430
433
|
},
|
|
431
434
|
block: function(l) {
|
|
432
|
-
var
|
|
433
|
-
return p.length === 1 && r.addEventListener(
|
|
434
|
-
|
|
435
|
+
var d = p.push(l);
|
|
436
|
+
return p.length === 1 && r.addEventListener(we, Pe), function() {
|
|
437
|
+
d(), p.length || r.removeEventListener(we, Pe);
|
|
435
438
|
};
|
|
436
439
|
}
|
|
437
440
|
};
|
|
438
|
-
return
|
|
441
|
+
return x;
|
|
439
442
|
}
|
|
440
|
-
function
|
|
443
|
+
function In(e) {
|
|
441
444
|
e === void 0 && (e = {});
|
|
442
445
|
var t = e, n = t.window, r = n === void 0 ? document.defaultView : n, o = r.history;
|
|
443
446
|
function a() {
|
|
444
|
-
var l =
|
|
445
|
-
return [
|
|
447
|
+
var l = fe(r.location.hash.substr(1)), d = l.pathname, E = d === void 0 ? "/" : d, b = l.search, U = b === void 0 ? "" : b, C = l.hash, j = C === void 0 ? "" : C, q = o.state || {};
|
|
448
|
+
return [q.idx, ee({
|
|
446
449
|
pathname: E,
|
|
447
|
-
search:
|
|
448
|
-
hash:
|
|
449
|
-
state:
|
|
450
|
-
key:
|
|
450
|
+
search: U,
|
|
451
|
+
hash: j,
|
|
452
|
+
state: q.usr || null,
|
|
453
|
+
key: q.key || "default"
|
|
451
454
|
})];
|
|
452
455
|
}
|
|
453
456
|
var s = null;
|
|
454
|
-
function
|
|
457
|
+
function c() {
|
|
455
458
|
if (s)
|
|
456
459
|
p.call(s), s = null;
|
|
457
460
|
else {
|
|
458
|
-
var l =
|
|
461
|
+
var l = H.Pop, d = a(), E = d[0], b = d[1];
|
|
459
462
|
if (p.length)
|
|
460
463
|
if (E != null) {
|
|
461
|
-
var
|
|
462
|
-
|
|
464
|
+
var U = f - E;
|
|
465
|
+
U && (s = {
|
|
463
466
|
action: l,
|
|
464
|
-
location:
|
|
467
|
+
location: b,
|
|
465
468
|
retry: function() {
|
|
466
|
-
|
|
469
|
+
x(U * -1);
|
|
467
470
|
}
|
|
468
|
-
},
|
|
471
|
+
}, x(U));
|
|
469
472
|
} else
|
|
470
|
-
process.env.NODE_ENV !== "production" &&
|
|
473
|
+
process.env.NODE_ENV !== "production" && K(
|
|
471
474
|
!1,
|
|
472
475
|
// TODO: Write up a doc that explains our blocking strategy in
|
|
473
476
|
// detail and link to it here so people can understand better
|
|
@@ -475,212 +478,212 @@ function $n(e) {
|
|
|
475
478
|
"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation."
|
|
476
479
|
);
|
|
477
480
|
else
|
|
478
|
-
|
|
481
|
+
g(l);
|
|
479
482
|
}
|
|
480
483
|
}
|
|
481
|
-
r.addEventListener(
|
|
482
|
-
var l = a(),
|
|
483
|
-
|
|
484
|
+
r.addEventListener(Ut, c), r.addEventListener(Wn, function() {
|
|
485
|
+
var l = a(), d = l[1];
|
|
486
|
+
z(d) !== z(h) && c();
|
|
484
487
|
});
|
|
485
|
-
var
|
|
486
|
-
|
|
487
|
-
idx:
|
|
488
|
+
var i = H.Pop, u = a(), f = u[0], h = u[1], v = te(), p = te();
|
|
489
|
+
f == null && (f = 0, o.replaceState(Q({}, o.state, {
|
|
490
|
+
idx: f
|
|
488
491
|
}), ""));
|
|
489
|
-
function
|
|
490
|
-
var l = document.querySelector("base"),
|
|
492
|
+
function k() {
|
|
493
|
+
var l = document.querySelector("base"), d = "";
|
|
491
494
|
if (l && l.getAttribute("href")) {
|
|
492
|
-
var E = r.location.href,
|
|
493
|
-
|
|
495
|
+
var E = r.location.href, b = E.indexOf("#");
|
|
496
|
+
d = b === -1 ? E : E.slice(0, b);
|
|
494
497
|
}
|
|
495
|
-
return
|
|
498
|
+
return d;
|
|
496
499
|
}
|
|
497
|
-
function
|
|
498
|
-
return
|
|
500
|
+
function R(l) {
|
|
501
|
+
return k() + "#" + (typeof l == "string" ? l : z(l));
|
|
499
502
|
}
|
|
500
|
-
function
|
|
501
|
-
return
|
|
503
|
+
function y(l, d) {
|
|
504
|
+
return d === void 0 && (d = null), ee(Q({
|
|
502
505
|
pathname: h.pathname,
|
|
503
506
|
hash: "",
|
|
504
507
|
search: ""
|
|
505
|
-
}, typeof l == "string" ?
|
|
506
|
-
state:
|
|
507
|
-
key:
|
|
508
|
+
}, typeof l == "string" ? fe(l) : l, {
|
|
509
|
+
state: d,
|
|
510
|
+
key: Ee()
|
|
508
511
|
}));
|
|
509
512
|
}
|
|
510
|
-
function
|
|
513
|
+
function S(l, d) {
|
|
511
514
|
return [{
|
|
512
515
|
usr: l.state,
|
|
513
516
|
key: l.key,
|
|
514
|
-
idx:
|
|
515
|
-
},
|
|
517
|
+
idx: d
|
|
518
|
+
}, R(l)];
|
|
516
519
|
}
|
|
517
|
-
function B(l,
|
|
520
|
+
function B(l, d, E) {
|
|
518
521
|
return !p.length || (p.call({
|
|
519
522
|
action: l,
|
|
520
|
-
location:
|
|
523
|
+
location: d,
|
|
521
524
|
retry: E
|
|
522
525
|
}), !1);
|
|
523
526
|
}
|
|
524
|
-
function
|
|
525
|
-
|
|
526
|
-
var
|
|
527
|
-
|
|
528
|
-
action:
|
|
527
|
+
function g(l) {
|
|
528
|
+
i = l;
|
|
529
|
+
var d = a();
|
|
530
|
+
f = d[0], h = d[1], v.call({
|
|
531
|
+
action: i,
|
|
529
532
|
location: h
|
|
530
533
|
});
|
|
531
534
|
}
|
|
532
|
-
function
|
|
533
|
-
var E =
|
|
534
|
-
function
|
|
535
|
-
|
|
535
|
+
function P(l, d) {
|
|
536
|
+
var E = H.Push, b = y(l, d);
|
|
537
|
+
function U() {
|
|
538
|
+
P(l, d);
|
|
536
539
|
}
|
|
537
|
-
if (process.env.NODE_ENV !== "production" &&
|
|
538
|
-
var
|
|
540
|
+
if (process.env.NODE_ENV !== "production" && K(b.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.push(" + JSON.stringify(l) + ")"), B(E, b, U)) {
|
|
541
|
+
var C = S(b, f + 1), j = C[0], q = C[1];
|
|
539
542
|
try {
|
|
540
|
-
o.pushState(
|
|
543
|
+
o.pushState(j, "", q);
|
|
541
544
|
} catch {
|
|
542
|
-
r.location.assign(
|
|
545
|
+
r.location.assign(q);
|
|
543
546
|
}
|
|
544
|
-
|
|
547
|
+
g(E);
|
|
545
548
|
}
|
|
546
549
|
}
|
|
547
|
-
function
|
|
548
|
-
var E =
|
|
549
|
-
function
|
|
550
|
-
|
|
550
|
+
function A(l, d) {
|
|
551
|
+
var E = H.Replace, b = y(l, d);
|
|
552
|
+
function U() {
|
|
553
|
+
A(l, d);
|
|
551
554
|
}
|
|
552
|
-
if (process.env.NODE_ENV !== "production" &&
|
|
553
|
-
var
|
|
554
|
-
o.replaceState(
|
|
555
|
+
if (process.env.NODE_ENV !== "production" && K(b.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.replace(" + JSON.stringify(l) + ")"), B(E, b, U)) {
|
|
556
|
+
var C = S(b, f), j = C[0], q = C[1];
|
|
557
|
+
o.replaceState(j, "", q), g(E);
|
|
555
558
|
}
|
|
556
559
|
}
|
|
557
|
-
function
|
|
560
|
+
function x(l) {
|
|
558
561
|
o.go(l);
|
|
559
562
|
}
|
|
560
|
-
var
|
|
563
|
+
var m = {
|
|
561
564
|
get action() {
|
|
562
|
-
return
|
|
565
|
+
return i;
|
|
563
566
|
},
|
|
564
567
|
get location() {
|
|
565
568
|
return h;
|
|
566
569
|
},
|
|
567
|
-
createHref:
|
|
568
|
-
push:
|
|
569
|
-
replace:
|
|
570
|
-
go:
|
|
570
|
+
createHref: R,
|
|
571
|
+
push: P,
|
|
572
|
+
replace: A,
|
|
573
|
+
go: x,
|
|
571
574
|
back: function() {
|
|
572
|
-
|
|
575
|
+
x(-1);
|
|
573
576
|
},
|
|
574
577
|
forward: function() {
|
|
575
|
-
|
|
578
|
+
x(1);
|
|
576
579
|
},
|
|
577
|
-
listen: function(
|
|
578
|
-
return
|
|
580
|
+
listen: function(d) {
|
|
581
|
+
return v.push(d);
|
|
579
582
|
},
|
|
580
|
-
block: function(
|
|
581
|
-
var E = p.push(
|
|
582
|
-
return p.length === 1 && r.addEventListener(
|
|
583
|
-
E(), p.length || r.removeEventListener(
|
|
583
|
+
block: function(d) {
|
|
584
|
+
var E = p.push(d);
|
|
585
|
+
return p.length === 1 && r.addEventListener(we, Pe), function() {
|
|
586
|
+
E(), p.length || r.removeEventListener(we, Pe);
|
|
584
587
|
};
|
|
585
588
|
}
|
|
586
589
|
};
|
|
587
|
-
return
|
|
590
|
+
return m;
|
|
588
591
|
}
|
|
589
|
-
function
|
|
592
|
+
function st(e) {
|
|
590
593
|
e === void 0 && (e = {});
|
|
591
|
-
var t = e, n = t.initialEntries, r = n === void 0 ? ["/"] : n, o = t.initialIndex, a = r.map(function(
|
|
592
|
-
var
|
|
594
|
+
var t = e, n = t.initialEntries, r = n === void 0 ? ["/"] : n, o = t.initialIndex, a = r.map(function(g) {
|
|
595
|
+
var P = ee(Q({
|
|
593
596
|
pathname: "/",
|
|
594
597
|
search: "",
|
|
595
598
|
hash: "",
|
|
596
599
|
state: null,
|
|
597
|
-
key:
|
|
598
|
-
}, typeof
|
|
599
|
-
return process.env.NODE_ENV !== "production" &&
|
|
600
|
-
}), s =
|
|
601
|
-
function h(
|
|
602
|
-
return typeof
|
|
603
|
-
}
|
|
604
|
-
function
|
|
605
|
-
return
|
|
606
|
-
pathname:
|
|
600
|
+
key: Ee()
|
|
601
|
+
}, typeof g == "string" ? fe(g) : g));
|
|
602
|
+
return process.env.NODE_ENV !== "production" && K(P.pathname.charAt(0) === "/", "Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: " + JSON.stringify(g) + ")"), P;
|
|
603
|
+
}), s = ct(o ?? a.length - 1, 0, a.length - 1), c = H.Pop, i = a[s], u = te(), f = te();
|
|
604
|
+
function h(g) {
|
|
605
|
+
return typeof g == "string" ? g : z(g);
|
|
606
|
+
}
|
|
607
|
+
function v(g, P) {
|
|
608
|
+
return P === void 0 && (P = null), ee(Q({
|
|
609
|
+
pathname: i.pathname,
|
|
607
610
|
search: "",
|
|
608
611
|
hash: ""
|
|
609
|
-
}, typeof
|
|
610
|
-
state:
|
|
611
|
-
key:
|
|
612
|
+
}, typeof g == "string" ? fe(g) : g, {
|
|
613
|
+
state: P,
|
|
614
|
+
key: Ee()
|
|
612
615
|
}));
|
|
613
616
|
}
|
|
614
|
-
function p(
|
|
615
|
-
return !
|
|
616
|
-
action:
|
|
617
|
-
location:
|
|
618
|
-
retry:
|
|
617
|
+
function p(g, P, A) {
|
|
618
|
+
return !f.length || (f.call({
|
|
619
|
+
action: g,
|
|
620
|
+
location: P,
|
|
621
|
+
retry: A
|
|
619
622
|
}), !1);
|
|
620
623
|
}
|
|
621
|
-
function
|
|
622
|
-
|
|
623
|
-
action:
|
|
624
|
-
location:
|
|
624
|
+
function k(g, P) {
|
|
625
|
+
c = g, i = P, u.call({
|
|
626
|
+
action: c,
|
|
627
|
+
location: i
|
|
625
628
|
});
|
|
626
629
|
}
|
|
627
|
-
function
|
|
628
|
-
var
|
|
629
|
-
function
|
|
630
|
-
|
|
630
|
+
function R(g, P) {
|
|
631
|
+
var A = H.Push, x = v(g, P);
|
|
632
|
+
function m() {
|
|
633
|
+
R(g, P);
|
|
631
634
|
}
|
|
632
|
-
process.env.NODE_ENV !== "production" &&
|
|
635
|
+
process.env.NODE_ENV !== "production" && K(i.pathname.charAt(0) === "/", "Relative pathnames are not supported in memory history.push(" + JSON.stringify(g) + ")"), p(A, x, m) && (s += 1, a.splice(s, a.length, x), k(A, x));
|
|
633
636
|
}
|
|
634
|
-
function
|
|
635
|
-
var
|
|
636
|
-
function
|
|
637
|
-
|
|
637
|
+
function y(g, P) {
|
|
638
|
+
var A = H.Replace, x = v(g, P);
|
|
639
|
+
function m() {
|
|
640
|
+
y(g, P);
|
|
638
641
|
}
|
|
639
|
-
process.env.NODE_ENV !== "production" &&
|
|
642
|
+
process.env.NODE_ENV !== "production" && K(i.pathname.charAt(0) === "/", "Relative pathnames are not supported in memory history.replace(" + JSON.stringify(g) + ")"), p(A, x, m) && (a[s] = x, k(A, x));
|
|
640
643
|
}
|
|
641
|
-
function
|
|
642
|
-
var
|
|
643
|
-
function
|
|
644
|
-
|
|
644
|
+
function S(g) {
|
|
645
|
+
var P = ct(s + g, 0, a.length - 1), A = H.Pop, x = a[P];
|
|
646
|
+
function m() {
|
|
647
|
+
S(g);
|
|
645
648
|
}
|
|
646
|
-
p(
|
|
649
|
+
p(A, x, m) && (s = P, k(A, x));
|
|
647
650
|
}
|
|
648
651
|
var B = {
|
|
649
652
|
get index() {
|
|
650
653
|
return s;
|
|
651
654
|
},
|
|
652
655
|
get action() {
|
|
653
|
-
return
|
|
656
|
+
return c;
|
|
654
657
|
},
|
|
655
658
|
get location() {
|
|
656
|
-
return
|
|
659
|
+
return i;
|
|
657
660
|
},
|
|
658
661
|
createHref: h,
|
|
659
|
-
push:
|
|
660
|
-
replace:
|
|
661
|
-
go:
|
|
662
|
+
push: R,
|
|
663
|
+
replace: y,
|
|
664
|
+
go: S,
|
|
662
665
|
back: function() {
|
|
663
|
-
|
|
666
|
+
S(-1);
|
|
664
667
|
},
|
|
665
668
|
forward: function() {
|
|
666
|
-
|
|
669
|
+
S(1);
|
|
667
670
|
},
|
|
668
|
-
listen: function(
|
|
669
|
-
return
|
|
671
|
+
listen: function(P) {
|
|
672
|
+
return u.push(P);
|
|
670
673
|
},
|
|
671
|
-
block: function(
|
|
672
|
-
return
|
|
674
|
+
block: function(P) {
|
|
675
|
+
return f.push(P);
|
|
673
676
|
}
|
|
674
677
|
};
|
|
675
678
|
return B;
|
|
676
679
|
}
|
|
677
|
-
function
|
|
680
|
+
function ct(e, t, n) {
|
|
678
681
|
return Math.min(Math.max(e, t), n);
|
|
679
682
|
}
|
|
680
|
-
function
|
|
683
|
+
function Pe(e) {
|
|
681
684
|
e.preventDefault(), e.returnValue = "";
|
|
682
685
|
}
|
|
683
|
-
function
|
|
686
|
+
function te() {
|
|
684
687
|
var e = [];
|
|
685
688
|
return {
|
|
686
689
|
get length() {
|
|
@@ -700,14 +703,14 @@ function Z() {
|
|
|
700
703
|
}
|
|
701
704
|
};
|
|
702
705
|
}
|
|
703
|
-
function
|
|
706
|
+
function Ee() {
|
|
704
707
|
return Math.random().toString(36).substr(2, 8);
|
|
705
708
|
}
|
|
706
|
-
function
|
|
709
|
+
function z(e) {
|
|
707
710
|
var t = e.pathname, n = t === void 0 ? "/" : t, r = e.search, o = r === void 0 ? "" : r, a = e.hash, s = a === void 0 ? "" : a;
|
|
708
711
|
return o && o !== "?" && (n += o.charAt(0) === "?" ? o : "?" + o), s && s !== "#" && (n += s.charAt(0) === "#" ? s : "#" + s), n;
|
|
709
712
|
}
|
|
710
|
-
function
|
|
713
|
+
function fe(e) {
|
|
711
714
|
var t = {};
|
|
712
715
|
if (e) {
|
|
713
716
|
var n = e.indexOf("#");
|
|
@@ -717,7 +720,7 @@ function ce(e) {
|
|
|
717
720
|
}
|
|
718
721
|
return t;
|
|
719
722
|
}
|
|
720
|
-
class
|
|
723
|
+
class Fn extends Error {
|
|
721
724
|
/**
|
|
722
725
|
* Constructs a new UseRouteInvalidError instance with a message that specifies both the given and expected route names.
|
|
723
726
|
* This detailed error message aids in quickly identifying and resolving mismatches in route usage.
|
|
@@ -728,106 +731,122 @@ class jn extends Error {
|
|
|
728
731
|
super(`useRoute called with incorrect route. Given ${t}, expected ${n}`);
|
|
729
732
|
}
|
|
730
733
|
}
|
|
731
|
-
const
|
|
732
|
-
function
|
|
733
|
-
const e =
|
|
734
|
+
const Bt = Symbol();
|
|
735
|
+
function Jn() {
|
|
736
|
+
const e = re(Bt);
|
|
734
737
|
if (!e)
|
|
735
|
-
throw new
|
|
738
|
+
throw new he();
|
|
736
739
|
return e;
|
|
737
740
|
}
|
|
738
|
-
const
|
|
739
|
-
function
|
|
740
|
-
const e =
|
|
741
|
+
const Lt = Symbol();
|
|
742
|
+
function De() {
|
|
743
|
+
const e = re(Lt);
|
|
741
744
|
if (!e)
|
|
742
|
-
throw new
|
|
745
|
+
throw new he();
|
|
743
746
|
return e;
|
|
744
747
|
}
|
|
745
|
-
const
|
|
746
|
-
function
|
|
747
|
-
return typeof e == "object" && e !== null &&
|
|
748
|
+
const Ct = Symbol("isRouterRouteSymbol");
|
|
749
|
+
function Qn(e) {
|
|
750
|
+
return typeof e == "object" && e !== null && Ct in e;
|
|
748
751
|
}
|
|
749
|
-
function
|
|
750
|
-
function n(
|
|
751
|
-
if (typeof
|
|
752
|
-
const
|
|
752
|
+
function Gn(e, t) {
|
|
753
|
+
function n(R, y, S) {
|
|
754
|
+
if (typeof R == "object") {
|
|
755
|
+
const g = {
|
|
753
756
|
...e.params,
|
|
754
|
-
...
|
|
757
|
+
...R
|
|
755
758
|
};
|
|
756
|
-
return t(e.name,
|
|
759
|
+
return t(e.name, g, y);
|
|
757
760
|
}
|
|
758
761
|
const B = {
|
|
759
762
|
...e.params,
|
|
760
|
-
[
|
|
763
|
+
[R]: y
|
|
761
764
|
};
|
|
762
|
-
return t(e.name, B,
|
|
763
|
-
}
|
|
764
|
-
const r = (...
|
|
765
|
-
const
|
|
766
|
-
|
|
767
|
-
}, o = (...
|
|
768
|
-
const
|
|
769
|
-
|
|
770
|
-
}, a = (...
|
|
771
|
-
const
|
|
772
|
-
|
|
773
|
-
}, { id: s, matched:
|
|
765
|
+
return t(e.name, B, S);
|
|
766
|
+
}
|
|
767
|
+
const r = (...R) => {
|
|
768
|
+
const y = new URLSearchParams(e.query.toString());
|
|
769
|
+
y.set(...R), n({}, { query: y });
|
|
770
|
+
}, o = (...R) => {
|
|
771
|
+
const y = new URLSearchParams(e.query.toString());
|
|
772
|
+
y.append(...R), n({}, { query: y });
|
|
773
|
+
}, a = (...R) => {
|
|
774
|
+
const y = new URLSearchParams(e.query.toString());
|
|
775
|
+
y.delete(...R), n({}, { query: y });
|
|
776
|
+
}, { id: s, matched: c, matches: i, name: u, hash: f } = un(e), h = N({
|
|
777
|
+
get() {
|
|
778
|
+
return new Proxy(e.params, {
|
|
779
|
+
set(R, y, S) {
|
|
780
|
+
return n(y, S), !0;
|
|
781
|
+
}
|
|
782
|
+
});
|
|
783
|
+
},
|
|
784
|
+
set(R) {
|
|
785
|
+
n(R);
|
|
786
|
+
}
|
|
787
|
+
}), v = N({
|
|
788
|
+
get() {
|
|
789
|
+
return new Proxy(e.query, {
|
|
790
|
+
get(R, y, S) {
|
|
791
|
+
switch (y) {
|
|
792
|
+
case "append":
|
|
793
|
+
return o;
|
|
794
|
+
case "set":
|
|
795
|
+
return r;
|
|
796
|
+
case "delete":
|
|
797
|
+
return a;
|
|
798
|
+
default:
|
|
799
|
+
return Reflect.get(R, y, S);
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
});
|
|
803
|
+
},
|
|
804
|
+
set(R) {
|
|
805
|
+
n({}, { query: R });
|
|
806
|
+
}
|
|
807
|
+
}), p = N({
|
|
808
|
+
get() {
|
|
809
|
+
return new Proxy(e.state, {
|
|
810
|
+
set(R, y, S) {
|
|
811
|
+
return n({}, { state: { ...e.state, [y]: S } }), !0;
|
|
812
|
+
}
|
|
813
|
+
});
|
|
814
|
+
},
|
|
815
|
+
set(R) {
|
|
816
|
+
n({}, { state: R });
|
|
817
|
+
}
|
|
818
|
+
});
|
|
819
|
+
return Ue({
|
|
774
820
|
id: s,
|
|
775
|
-
matched:
|
|
776
|
-
matches:
|
|
777
|
-
state:
|
|
778
|
-
query:
|
|
779
|
-
hash:
|
|
821
|
+
matched: c,
|
|
822
|
+
matches: i,
|
|
823
|
+
state: p,
|
|
824
|
+
query: v,
|
|
825
|
+
hash: f,
|
|
780
826
|
params: h,
|
|
781
|
-
name:
|
|
827
|
+
name: u,
|
|
782
828
|
update: n,
|
|
783
|
-
[
|
|
784
|
-
});
|
|
785
|
-
return new Proxy(A, {
|
|
786
|
-
get: (v, R, x) => R === "params" ? new Proxy(e.params, {
|
|
787
|
-
set(B, d, y) {
|
|
788
|
-
return n(d, y), !0;
|
|
789
|
-
}
|
|
790
|
-
}) : R === "state" ? new Proxy(e.state, {
|
|
791
|
-
set(B, d, y) {
|
|
792
|
-
return n({}, { state: { ...e.state, [d]: y } }), !0;
|
|
793
|
-
}
|
|
794
|
-
}) : R === "query" ? new Proxy(e.query, {
|
|
795
|
-
get(B, d, y) {
|
|
796
|
-
switch (d) {
|
|
797
|
-
case "append":
|
|
798
|
-
return o;
|
|
799
|
-
case "set":
|
|
800
|
-
return r;
|
|
801
|
-
case "delete":
|
|
802
|
-
return a;
|
|
803
|
-
default:
|
|
804
|
-
return Reflect.get(B, d, y);
|
|
805
|
-
}
|
|
806
|
-
}
|
|
807
|
-
}) : Reflect.get(v, R, x),
|
|
808
|
-
set(v, R, x, B) {
|
|
809
|
-
return R === "query" ? (n({}, { query: x }), !0) : Reflect.set(v, R, x, B);
|
|
810
|
-
}
|
|
829
|
+
[Ct]: !0
|
|
811
830
|
});
|
|
812
831
|
}
|
|
813
|
-
const
|
|
814
|
-
function
|
|
815
|
-
const n =
|
|
832
|
+
const Nt = Symbol();
|
|
833
|
+
function Kn(e, t) {
|
|
834
|
+
const n = Ue({ ...e }), r = (s) => {
|
|
816
835
|
Object.assign(n, {
|
|
817
|
-
[
|
|
836
|
+
[Nt]: !1,
|
|
818
837
|
...s
|
|
819
838
|
});
|
|
820
|
-
}, o = n, a =
|
|
839
|
+
}, o = n, a = Gn(o, t);
|
|
821
840
|
return {
|
|
822
841
|
currentRoute: o,
|
|
823
842
|
routerRoute: a,
|
|
824
843
|
updateRoute: r
|
|
825
844
|
};
|
|
826
845
|
}
|
|
827
|
-
function
|
|
828
|
-
return !e.startsWith("http") ?
|
|
846
|
+
function T(e) {
|
|
847
|
+
return !e.startsWith("http") ? Yn(e) : zn(e);
|
|
829
848
|
}
|
|
830
|
-
function
|
|
849
|
+
function zn(e) {
|
|
831
850
|
const { protocol: t, host: n, pathname: r, search: o, searchParams: a, hash: s } = new URL(e, e);
|
|
832
851
|
return {
|
|
833
852
|
protocol: t,
|
|
@@ -838,7 +857,7 @@ function Dn(e) {
|
|
|
838
857
|
hash: s
|
|
839
858
|
};
|
|
840
859
|
}
|
|
841
|
-
function
|
|
860
|
+
function Yn(e) {
|
|
842
861
|
const { pathname: t, search: n, searchParams: r, hash: o } = new URL(e, "https://localhost");
|
|
843
862
|
return {
|
|
844
863
|
pathname: t,
|
|
@@ -847,22 +866,22 @@ function Wn(e) {
|
|
|
847
866
|
hash: o
|
|
848
867
|
};
|
|
849
868
|
}
|
|
850
|
-
function
|
|
869
|
+
function Xn(e) {
|
|
851
870
|
return (t) => {
|
|
852
|
-
const { host: n } =
|
|
871
|
+
const { host: n } = T(t);
|
|
853
872
|
return !(n === void 0 || n === e);
|
|
854
873
|
};
|
|
855
874
|
}
|
|
856
|
-
function
|
|
857
|
-
const n =
|
|
858
|
-
if (
|
|
859
|
-
n.replace(
|
|
875
|
+
function Zn({ mode: e, listener: t }) {
|
|
876
|
+
const n = er(e), r = (i, u) => {
|
|
877
|
+
if (u != null && u.replace) {
|
|
878
|
+
n.replace(i, u.state);
|
|
860
879
|
return;
|
|
861
880
|
}
|
|
862
|
-
n.push(
|
|
881
|
+
n.push(i, u == null ? void 0 : u.state);
|
|
863
882
|
}, o = () => {
|
|
864
|
-
const
|
|
865
|
-
n.replace(
|
|
883
|
+
const i = z(n.location);
|
|
884
|
+
n.replace(i);
|
|
866
885
|
};
|
|
867
886
|
let a;
|
|
868
887
|
return {
|
|
@@ -877,98 +896,106 @@ function Tn({ mode: e, listener: t }) {
|
|
|
877
896
|
}
|
|
878
897
|
};
|
|
879
898
|
}
|
|
880
|
-
function
|
|
899
|
+
function er(e = "auto") {
|
|
881
900
|
switch (e) {
|
|
882
901
|
case "auto":
|
|
883
|
-
return
|
|
902
|
+
return Te() ? at() : st();
|
|
884
903
|
case "browser":
|
|
885
|
-
return
|
|
904
|
+
return at();
|
|
886
905
|
case "memory":
|
|
887
|
-
return
|
|
906
|
+
return st();
|
|
888
907
|
case "hash":
|
|
889
|
-
return
|
|
908
|
+
return In();
|
|
890
909
|
default:
|
|
891
910
|
const t = e;
|
|
892
911
|
throw new Error(`Switch is not exhaustive for mode: ${t}`);
|
|
893
912
|
}
|
|
894
913
|
}
|
|
895
|
-
class
|
|
914
|
+
class be {
|
|
896
915
|
constructor() {
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
916
|
+
_(this, "onBeforeRouteEnter", /* @__PURE__ */ new Set());
|
|
917
|
+
_(this, "onBeforeRouteUpdate", /* @__PURE__ */ new Set());
|
|
918
|
+
_(this, "onBeforeRouteLeave", /* @__PURE__ */ new Set());
|
|
919
|
+
_(this, "onAfterRouteEnter", /* @__PURE__ */ new Set());
|
|
920
|
+
_(this, "onAfterRouteUpdate", /* @__PURE__ */ new Set());
|
|
921
|
+
_(this, "onAfterRouteLeave", /* @__PURE__ */ new Set());
|
|
903
922
|
}
|
|
904
923
|
}
|
|
905
|
-
class
|
|
924
|
+
class Ht extends Error {
|
|
925
|
+
constructor() {
|
|
926
|
+
super("Uncaught CallbackContextAbortError");
|
|
927
|
+
_(this, "response");
|
|
928
|
+
this.response = { status: "ABORT" };
|
|
929
|
+
}
|
|
906
930
|
}
|
|
907
|
-
class
|
|
931
|
+
class X extends Error {
|
|
908
932
|
constructor(n) {
|
|
909
|
-
super("
|
|
910
|
-
|
|
911
|
-
this.
|
|
933
|
+
super("Uncaught CallbackContextPushError");
|
|
934
|
+
_(this, "response");
|
|
935
|
+
this.response = { status: "PUSH", to: n };
|
|
912
936
|
}
|
|
913
937
|
}
|
|
914
|
-
class
|
|
938
|
+
class Se extends Error {
|
|
915
939
|
constructor(n) {
|
|
916
|
-
super(
|
|
917
|
-
|
|
918
|
-
this.
|
|
940
|
+
super("Uncaught CallbackContextRejectionError");
|
|
941
|
+
_(this, "response");
|
|
942
|
+
this.response = { status: "REJECT", type: n };
|
|
919
943
|
}
|
|
920
944
|
}
|
|
921
|
-
function
|
|
922
|
-
const n = new
|
|
945
|
+
function tr(e, t) {
|
|
946
|
+
const n = new be();
|
|
923
947
|
return e.matches.forEach((r, o) => {
|
|
924
|
-
r.onBeforeRouteEnter &&
|
|
948
|
+
r.onBeforeRouteEnter && We(e, t, o) && Y(r.onBeforeRouteEnter).forEach((a) => n.onBeforeRouteEnter.add(a)), r.onBeforeRouteUpdate && Fe(e, t, o) && Y(r.onBeforeRouteUpdate).forEach((a) => n.onBeforeRouteUpdate.add(a));
|
|
925
949
|
}), t.matches.forEach((r, o) => {
|
|
926
|
-
r.onBeforeRouteLeave &&
|
|
950
|
+
r.onBeforeRouteLeave && Ie(e, t, o) && Y(r.onBeforeRouteLeave).forEach((a) => n.onBeforeRouteLeave.add(a));
|
|
927
951
|
}), n;
|
|
928
952
|
}
|
|
929
|
-
function
|
|
930
|
-
const n = new
|
|
953
|
+
function nr(e, t) {
|
|
954
|
+
const n = new be();
|
|
931
955
|
return e.matches.forEach((r, o) => {
|
|
932
|
-
r.onAfterRouteEnter &&
|
|
956
|
+
r.onAfterRouteEnter && We(e, t, o) && Y(r.onAfterRouteEnter).forEach((a) => n.onAfterRouteEnter.add(a)), r.onAfterRouteUpdate && Fe(e, t, o) && Y(r.onAfterRouteUpdate).forEach((a) => n.onAfterRouteUpdate.add(a));
|
|
933
957
|
}), t.matches.forEach((r, o) => {
|
|
934
|
-
r.onAfterRouteLeave &&
|
|
958
|
+
r.onAfterRouteLeave && Ie(e, t, o) && Y(r.onAfterRouteLeave).forEach((a) => n.onAfterRouteLeave.add(a));
|
|
935
959
|
}), n;
|
|
936
960
|
}
|
|
937
|
-
function
|
|
961
|
+
function M(e) {
|
|
938
962
|
return typeof e != "string" ? !1 : /^(https?:\/\/|\/).*/g.test(e);
|
|
939
963
|
}
|
|
940
|
-
function
|
|
941
|
-
return
|
|
942
|
-
}
|
|
943
|
-
function
|
|
944
|
-
|
|
945
|
-
throw new
|
|
946
|
-
},
|
|
947
|
-
throw new
|
|
948
|
-
},
|
|
949
|
-
if (
|
|
950
|
-
const
|
|
951
|
-
throw new
|
|
964
|
+
function rr(e) {
|
|
965
|
+
return M(e) ? e : `/${e}`;
|
|
966
|
+
}
|
|
967
|
+
function jt() {
|
|
968
|
+
return { reject: (o) => {
|
|
969
|
+
throw new Se(o);
|
|
970
|
+
}, push: (...o) => {
|
|
971
|
+
throw new X(o);
|
|
972
|
+
}, replace: (o, a, s) => {
|
|
973
|
+
if (M(o)) {
|
|
974
|
+
const u = a ?? {};
|
|
975
|
+
throw new X([o, { ...u, replace: !0 }]);
|
|
952
976
|
}
|
|
953
|
-
const
|
|
954
|
-
throw new
|
|
955
|
-
},
|
|
956
|
-
throw new
|
|
957
|
-
};
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
977
|
+
const c = a, i = s ?? {};
|
|
978
|
+
throw new X([o, c, { ...i, replace: !0 }]);
|
|
979
|
+
}, abort: () => {
|
|
980
|
+
throw new Ht();
|
|
981
|
+
} };
|
|
982
|
+
}
|
|
983
|
+
function or() {
|
|
984
|
+
const { reject: e, push: t, replace: n, abort: r } = jt();
|
|
985
|
+
async function o({ to: s, from: c, hooks: i }) {
|
|
986
|
+
const { global: u, component: f } = i, h = tr(s, c), v = [
|
|
987
|
+
...u.onBeforeRouteEnter,
|
|
961
988
|
...h.onBeforeRouteEnter,
|
|
962
|
-
...f.onBeforeRouteUpdate,
|
|
963
|
-
...h.onBeforeRouteUpdate,
|
|
964
989
|
...u.onBeforeRouteUpdate,
|
|
965
|
-
...
|
|
990
|
+
...h.onBeforeRouteUpdate,
|
|
991
|
+
...f.onBeforeRouteUpdate,
|
|
992
|
+
...u.onBeforeRouteLeave,
|
|
966
993
|
...h.onBeforeRouteLeave,
|
|
967
|
-
...
|
|
994
|
+
...f.onBeforeRouteLeave
|
|
968
995
|
];
|
|
969
996
|
try {
|
|
970
|
-
const p =
|
|
971
|
-
from:
|
|
997
|
+
const p = v.map((k) => k(s, {
|
|
998
|
+
from: c,
|
|
972
999
|
reject: e,
|
|
973
1000
|
push: t,
|
|
974
1001
|
replace: n,
|
|
@@ -976,57 +1003,37 @@ function Gn() {
|
|
|
976
1003
|
}));
|
|
977
1004
|
await Promise.all(p);
|
|
978
1005
|
} catch (p) {
|
|
979
|
-
if (p instanceof
|
|
980
|
-
return
|
|
981
|
-
status: "PUSH",
|
|
982
|
-
to: p.to
|
|
983
|
-
};
|
|
984
|
-
if (p instanceof Be)
|
|
985
|
-
return {
|
|
986
|
-
status: "REJECT",
|
|
987
|
-
type: p.type
|
|
988
|
-
};
|
|
989
|
-
if (p instanceof nt)
|
|
990
|
-
return {
|
|
991
|
-
status: "ABORT"
|
|
992
|
-
};
|
|
1006
|
+
if (p instanceof X || p instanceof Se || p instanceof Ht)
|
|
1007
|
+
return p.response;
|
|
993
1008
|
throw p;
|
|
994
1009
|
}
|
|
995
1010
|
return {
|
|
996
1011
|
status: "SUCCESS"
|
|
997
1012
|
};
|
|
998
1013
|
}
|
|
999
|
-
async function a({ to: s, from:
|
|
1000
|
-
const { global:
|
|
1001
|
-
...u.onAfterRouteLeave,
|
|
1002
|
-
...h.onAfterRouteLeave,
|
|
1014
|
+
async function a({ to: s, from: c, hooks: i }) {
|
|
1015
|
+
const { global: u, component: f } = i, h = nr(s, c), v = [
|
|
1003
1016
|
...f.onAfterRouteLeave,
|
|
1004
|
-
...
|
|
1005
|
-
...
|
|
1017
|
+
...h.onAfterRouteLeave,
|
|
1018
|
+
...u.onAfterRouteLeave,
|
|
1006
1019
|
...f.onAfterRouteUpdate,
|
|
1007
|
-
...
|
|
1020
|
+
...h.onAfterRouteUpdate,
|
|
1021
|
+
...u.onAfterRouteUpdate,
|
|
1022
|
+
...f.onAfterRouteEnter,
|
|
1008
1023
|
...h.onAfterRouteEnter,
|
|
1009
|
-
...
|
|
1024
|
+
...u.onAfterRouteEnter
|
|
1010
1025
|
];
|
|
1011
1026
|
try {
|
|
1012
|
-
const p =
|
|
1013
|
-
from:
|
|
1027
|
+
const p = v.map((k) => k(s, {
|
|
1028
|
+
from: c,
|
|
1014
1029
|
reject: e,
|
|
1015
1030
|
push: t,
|
|
1016
1031
|
replace: n
|
|
1017
1032
|
}));
|
|
1018
1033
|
await Promise.all(p);
|
|
1019
1034
|
} catch (p) {
|
|
1020
|
-
if (p instanceof
|
|
1021
|
-
return
|
|
1022
|
-
status: "PUSH",
|
|
1023
|
-
to: p.to
|
|
1024
|
-
};
|
|
1025
|
-
if (p instanceof Be)
|
|
1026
|
-
return {
|
|
1027
|
-
status: "REJECT",
|
|
1028
|
-
type: p.type
|
|
1029
|
-
};
|
|
1035
|
+
if (p instanceof X || p instanceof Se)
|
|
1036
|
+
return p.response;
|
|
1030
1037
|
throw p;
|
|
1031
1038
|
}
|
|
1032
1039
|
return {
|
|
@@ -1038,69 +1045,74 @@ function Gn() {
|
|
|
1038
1045
|
runAfterRouteHooks: a
|
|
1039
1046
|
};
|
|
1040
1047
|
}
|
|
1041
|
-
const
|
|
1048
|
+
const We = (e, t, n) => {
|
|
1049
|
+
var a;
|
|
1042
1050
|
const r = e.matches, o = (t == null ? void 0 : t.matches) ?? [];
|
|
1043
|
-
return r.length < n || r[n] !== o[n];
|
|
1044
|
-
},
|
|
1051
|
+
return r.length < n || r[n].id !== ((a = o[n]) == null ? void 0 : a.id);
|
|
1052
|
+
}, Ie = (e, t, n) => {
|
|
1053
|
+
var a;
|
|
1045
1054
|
const r = e.matches, o = (t == null ? void 0 : t.matches) ?? [];
|
|
1046
|
-
return r.length < n || r[n] !== o[n];
|
|
1047
|
-
},
|
|
1048
|
-
|
|
1055
|
+
return r.length < n || r[n].id !== ((a = o[n]) == null ? void 0 : a.id);
|
|
1056
|
+
}, Fe = (e, t, n) => {
|
|
1057
|
+
var r;
|
|
1058
|
+
return e.matches[n].id === ((r = t == null ? void 0 : t.matches[n]) == null ? void 0 : r.id);
|
|
1059
|
+
};
|
|
1060
|
+
function ut(e) {
|
|
1049
1061
|
switch (e) {
|
|
1050
1062
|
case "onBeforeRouteEnter":
|
|
1051
1063
|
case "onAfterRouteEnter":
|
|
1052
|
-
return
|
|
1064
|
+
return We;
|
|
1053
1065
|
case "onBeforeRouteUpdate":
|
|
1054
1066
|
case "onAfterRouteUpdate":
|
|
1055
|
-
return
|
|
1067
|
+
return Fe;
|
|
1056
1068
|
case "onBeforeRouteLeave":
|
|
1057
1069
|
case "onAfterRouteLeave":
|
|
1058
|
-
return
|
|
1070
|
+
return Ie;
|
|
1059
1071
|
default:
|
|
1060
1072
|
throw new Error(`Switch is not exhaustive for lifecycle: ${e}`);
|
|
1061
1073
|
}
|
|
1062
1074
|
}
|
|
1063
|
-
function
|
|
1075
|
+
function ar() {
|
|
1064
1076
|
const e = {
|
|
1065
|
-
global: new
|
|
1066
|
-
component: new
|
|
1077
|
+
global: new be(),
|
|
1078
|
+
component: new be()
|
|
1067
1079
|
};
|
|
1068
1080
|
function t({ lifecycle: r, timing: o, depth: a, hook: s }) {
|
|
1069
|
-
const
|
|
1070
|
-
if (
|
|
1071
|
-
return s(
|
|
1081
|
+
const c = ut(r), i = e[o][r], u = (f, h) => {
|
|
1082
|
+
if (c(f, h.from, a))
|
|
1083
|
+
return s(f, h);
|
|
1072
1084
|
};
|
|
1073
|
-
return
|
|
1085
|
+
return i.add(u), () => i.delete(u);
|
|
1074
1086
|
}
|
|
1075
1087
|
function n({ lifecycle: r, timing: o, depth: a, hook: s }) {
|
|
1076
|
-
const
|
|
1077
|
-
if (
|
|
1078
|
-
return s(
|
|
1088
|
+
const c = ut(r), i = e[o][r], u = (f, h) => {
|
|
1089
|
+
if (c(f, h.from, a))
|
|
1090
|
+
return s(f, h);
|
|
1079
1091
|
};
|
|
1080
|
-
return
|
|
1092
|
+
return i.add(u), () => i.delete(u);
|
|
1081
1093
|
}
|
|
1082
1094
|
return { ...e, addBeforeRouteHook: t, addAfterRouteHook: n };
|
|
1083
1095
|
}
|
|
1084
|
-
const
|
|
1085
|
-
function
|
|
1086
|
-
const e =
|
|
1096
|
+
const Vt = Symbol();
|
|
1097
|
+
function sr() {
|
|
1098
|
+
const e = ar();
|
|
1087
1099
|
return {
|
|
1088
|
-
onBeforeRouteEnter: (
|
|
1089
|
-
onBeforeRouteUpdate: (
|
|
1090
|
-
onBeforeRouteLeave: (
|
|
1091
|
-
onAfterRouteEnter: (
|
|
1092
|
-
onAfterRouteUpdate: (
|
|
1093
|
-
onAfterRouteLeave: (
|
|
1100
|
+
onBeforeRouteEnter: (c) => e.addBeforeRouteHook({ lifecycle: "onBeforeRouteEnter", hook: c, timing: "global", depth: 0 }),
|
|
1101
|
+
onBeforeRouteUpdate: (c) => e.addBeforeRouteHook({ lifecycle: "onBeforeRouteUpdate", hook: c, timing: "global", depth: 0 }),
|
|
1102
|
+
onBeforeRouteLeave: (c) => e.addBeforeRouteHook({ lifecycle: "onBeforeRouteLeave", hook: c, timing: "global", depth: 0 }),
|
|
1103
|
+
onAfterRouteEnter: (c) => e.addAfterRouteHook({ lifecycle: "onAfterRouteEnter", hook: c, timing: "global", depth: 0 }),
|
|
1104
|
+
onAfterRouteUpdate: (c) => e.addAfterRouteHook({ lifecycle: "onAfterRouteUpdate", hook: c, timing: "global", depth: 0 }),
|
|
1105
|
+
onAfterRouteLeave: (c) => e.addAfterRouteHook({ lifecycle: "onAfterRouteLeave", hook: c, timing: "global", depth: 0 }),
|
|
1094
1106
|
hooks: e
|
|
1095
1107
|
};
|
|
1096
1108
|
}
|
|
1097
|
-
function
|
|
1098
|
-
return
|
|
1109
|
+
function cr(e) {
|
|
1110
|
+
return le(() => () => ve("h1", e), {
|
|
1099
1111
|
name: e,
|
|
1100
1112
|
props: []
|
|
1101
1113
|
});
|
|
1102
1114
|
}
|
|
1103
|
-
function
|
|
1115
|
+
function $t(e) {
|
|
1104
1116
|
const t = new URLSearchParams(e);
|
|
1105
1117
|
return {
|
|
1106
1118
|
get: (...n) => t.get(...n),
|
|
@@ -1124,35 +1136,35 @@ function Ut(e) {
|
|
|
1124
1136
|
has: (...n) => t.has(...n)
|
|
1125
1137
|
};
|
|
1126
1138
|
}
|
|
1127
|
-
function
|
|
1139
|
+
function Ot() {
|
|
1128
1140
|
let e = 0;
|
|
1129
1141
|
return () => (++e).toString();
|
|
1130
1142
|
}
|
|
1131
|
-
const
|
|
1132
|
-
function
|
|
1143
|
+
const Je = Ot();
|
|
1144
|
+
function ur({
|
|
1133
1145
|
rejections: e
|
|
1134
1146
|
}) {
|
|
1135
1147
|
const t = (a) => {
|
|
1136
1148
|
const s = {
|
|
1137
1149
|
...e
|
|
1138
1150
|
};
|
|
1139
|
-
return
|
|
1151
|
+
return ye(s[a] ?? cr(a));
|
|
1140
1152
|
}, n = (a) => {
|
|
1141
|
-
const s =
|
|
1142
|
-
id:
|
|
1153
|
+
const s = ye(t(a)), c = {
|
|
1154
|
+
id: Je(),
|
|
1143
1155
|
component: s,
|
|
1144
1156
|
meta: {},
|
|
1145
1157
|
state: {}
|
|
1146
1158
|
};
|
|
1147
1159
|
return {
|
|
1148
|
-
id:
|
|
1149
|
-
matched:
|
|
1150
|
-
matches: [
|
|
1160
|
+
id: c.id,
|
|
1161
|
+
matched: c,
|
|
1162
|
+
matches: [c],
|
|
1151
1163
|
name: a,
|
|
1152
|
-
query:
|
|
1164
|
+
query: $t(""),
|
|
1153
1165
|
params: {},
|
|
1154
1166
|
state: {},
|
|
1155
|
-
[
|
|
1167
|
+
[Nt]: !0
|
|
1156
1168
|
};
|
|
1157
1169
|
}, r = (a) => {
|
|
1158
1170
|
if (!a) {
|
|
@@ -1161,311 +1173,311 @@ function Zn({
|
|
|
1161
1173
|
}
|
|
1162
1174
|
const s = t(a);
|
|
1163
1175
|
o.value = { type: a, component: s };
|
|
1164
|
-
}, o =
|
|
1176
|
+
}, o = qe(null);
|
|
1165
1177
|
return {
|
|
1166
1178
|
setRejection: r,
|
|
1167
1179
|
rejection: o,
|
|
1168
1180
|
getRejectionRoute: n
|
|
1169
1181
|
};
|
|
1170
1182
|
}
|
|
1171
|
-
class
|
|
1183
|
+
class ir extends Error {
|
|
1172
1184
|
constructor(t) {
|
|
1173
1185
|
super(`Route not found: "${t}"`);
|
|
1174
1186
|
}
|
|
1175
1187
|
}
|
|
1176
|
-
function
|
|
1188
|
+
function Qe(e) {
|
|
1177
1189
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1178
1190
|
}
|
|
1179
|
-
function
|
|
1191
|
+
function fr(e, t) {
|
|
1180
1192
|
const n = Array.from(e.matchAll(t));
|
|
1181
1193
|
if (n.length === 0)
|
|
1182
1194
|
return [e];
|
|
1183
1195
|
let r = 0;
|
|
1184
|
-
const o = n.reduce((s,
|
|
1185
|
-
const
|
|
1186
|
-
|
|
1187
|
-
const [
|
|
1188
|
-
return s.push(
|
|
1196
|
+
const o = n.reduce((s, c) => {
|
|
1197
|
+
const i = Qe(e.slice(r, c.index));
|
|
1198
|
+
i.length && s.push(i);
|
|
1199
|
+
const [u] = c;
|
|
1200
|
+
return s.push(u), r = c.index + u.length, s;
|
|
1189
1201
|
}, []), a = e.slice(r);
|
|
1190
1202
|
return a && o.push(a), o;
|
|
1191
1203
|
}
|
|
1192
|
-
function
|
|
1193
|
-
const t =
|
|
1204
|
+
function lr(e) {
|
|
1205
|
+
const t = qt(e.path.value);
|
|
1194
1206
|
return new RegExp(`^${t}$`, "i");
|
|
1195
1207
|
}
|
|
1196
|
-
function
|
|
1208
|
+
function hr(e) {
|
|
1197
1209
|
const t = new URLSearchParams(e.query.value);
|
|
1198
|
-
return Array.from(t.entries()).filter(([, n]) => !
|
|
1199
|
-
const o =
|
|
1200
|
-
return new RegExp(`${
|
|
1210
|
+
return Array.from(t.entries()).filter(([, n]) => !Ve(n)).map(([n, r]) => {
|
|
1211
|
+
const o = qt(r);
|
|
1212
|
+
return new RegExp(`${Qe(n)}=${o}(&|$)`, "i");
|
|
1201
1213
|
});
|
|
1202
1214
|
}
|
|
1203
|
-
function
|
|
1204
|
-
return
|
|
1215
|
+
function qt(e) {
|
|
1216
|
+
return fr(e, new RegExp(pr, "g")).map((t) => t.startsWith(W) ? _t(t) : Qe(t)).join("");
|
|
1205
1217
|
}
|
|
1206
|
-
function
|
|
1218
|
+
function _t(e) {
|
|
1207
1219
|
return [
|
|
1208
|
-
|
|
1209
|
-
|
|
1220
|
+
dr,
|
|
1221
|
+
mr
|
|
1210
1222
|
].reduce((t, n) => n(t), e);
|
|
1211
1223
|
}
|
|
1212
|
-
const
|
|
1213
|
-
function
|
|
1214
|
-
return e.replace(new RegExp(
|
|
1224
|
+
const pr = `\\${W}\\??([\\w-_]+)\\${G}`, Ge = `\\${W}\\?([\\w-_]+)\\${G}`, Mt = `\\${W}([\\w-_]+)\\${G}`;
|
|
1225
|
+
function dr(e) {
|
|
1226
|
+
return e.replace(new RegExp(Ge, "g"), ".*");
|
|
1215
1227
|
}
|
|
1216
|
-
function
|
|
1217
|
-
return new RegExp(
|
|
1228
|
+
function Ve(e) {
|
|
1229
|
+
return new RegExp(Ge, "g").test(e);
|
|
1218
1230
|
}
|
|
1219
|
-
function
|
|
1220
|
-
return e.replace(new RegExp(
|
|
1231
|
+
function mr(e) {
|
|
1232
|
+
return e.replace(new RegExp(Mt, "g"), ".+");
|
|
1221
1233
|
}
|
|
1222
|
-
function
|
|
1223
|
-
const [t] =
|
|
1234
|
+
function Le(e) {
|
|
1235
|
+
const [t] = ke(e, new RegExp(Ge, "g")), [n] = ke(e, new RegExp(Mt, "g"));
|
|
1224
1236
|
return t ?? n;
|
|
1225
1237
|
}
|
|
1226
|
-
function
|
|
1227
|
-
return Array.from(e.matchAll(t)).flatMap(([, ...r]) => r.map((o) =>
|
|
1238
|
+
function ke(e, t) {
|
|
1239
|
+
return Array.from(e.matchAll(t)).flatMap(([, ...r]) => r.map((o) => de(o) ? o : ""));
|
|
1228
1240
|
}
|
|
1229
|
-
function
|
|
1230
|
-
const r =
|
|
1241
|
+
function Tt(e, t, n) {
|
|
1242
|
+
const r = Wt(t, n), [o] = ke(e, r);
|
|
1231
1243
|
return o;
|
|
1232
1244
|
}
|
|
1233
|
-
function
|
|
1245
|
+
function Dt(e, t) {
|
|
1234
1246
|
if (!t)
|
|
1235
1247
|
return e;
|
|
1236
|
-
const { name: n, param: r, value: o } = t, a =
|
|
1237
|
-
return
|
|
1248
|
+
const { name: n, param: r, value: o } = t, a = Wt(e, n);
|
|
1249
|
+
return ke(e, a).reduce((c, i) => i === void 0 ? c : c.replace(i, () => ie(o, r, n.startsWith("?"))), e);
|
|
1238
1250
|
}
|
|
1239
|
-
function
|
|
1251
|
+
function Wt(e, t) {
|
|
1240
1252
|
const n = [
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1253
|
+
gr,
|
|
1254
|
+
vr,
|
|
1255
|
+
_t
|
|
1244
1256
|
].reduce((r, o) => o(r, t), e);
|
|
1245
1257
|
return new RegExp(n, "g");
|
|
1246
1258
|
}
|
|
1247
|
-
function
|
|
1259
|
+
function gr(e, t) {
|
|
1248
1260
|
if (!t.startsWith("?"))
|
|
1249
1261
|
return e;
|
|
1250
|
-
const n = new RegExp(`\\${
|
|
1262
|
+
const n = new RegExp(`\\${W}\\${t}\\${G}`, "g");
|
|
1251
1263
|
return e.replace(n, "(.*)");
|
|
1252
1264
|
}
|
|
1253
|
-
function
|
|
1265
|
+
function vr(e, t) {
|
|
1254
1266
|
if (t.startsWith("?"))
|
|
1255
1267
|
return e;
|
|
1256
|
-
const n = new RegExp(`\\${
|
|
1268
|
+
const n = new RegExp(`\\${W}${t}\\${G}`, "g");
|
|
1257
1269
|
return e.replace(n, "(.+)");
|
|
1258
1270
|
}
|
|
1259
|
-
function
|
|
1271
|
+
function It({ protocol: e, host: t, pathname: n, search: r, searchParams: o, hash: a }) {
|
|
1260
1272
|
const s = new URL("https://localhost");
|
|
1261
1273
|
e && (s.protocol = e), t && (s.host = t), n && (s.pathname = n), o ? s.search = o.toString() : r && (s.search = r), a && (s.hash = a);
|
|
1262
|
-
const
|
|
1263
|
-
return
|
|
1274
|
+
const c = s.toString().replace(/^https:\/\/localhost\/*/, "/");
|
|
1275
|
+
return rr(c);
|
|
1264
1276
|
}
|
|
1265
|
-
function
|
|
1277
|
+
function yr(e, t) {
|
|
1266
1278
|
const n = new URLSearchParams(e), r = new URLSearchParams(t);
|
|
1267
1279
|
for (const [o, a] of r.entries())
|
|
1268
1280
|
n.append(o, a);
|
|
1269
1281
|
return n;
|
|
1270
1282
|
}
|
|
1271
|
-
function
|
|
1272
|
-
const { params: n = {}, query: r } = t, o =
|
|
1273
|
-
return
|
|
1283
|
+
function Rr(e, t = {}) {
|
|
1284
|
+
const { params: n = {}, query: r } = t, o = Er(e.query, n), a = yr(o, r), s = Pr(e.path, n), c = Re(e.hash.value ?? t.hash).value, i = wr(e.host, n), { protocol: u, host: f } = T(i);
|
|
1285
|
+
return It({ protocol: u, host: f, pathname: s, searchParams: a, hash: c });
|
|
1274
1286
|
}
|
|
1275
|
-
function
|
|
1287
|
+
function wr(e, t) {
|
|
1276
1288
|
const n = e.value && !e.value.startsWith("http") ? `https://${e.value}` : e.value;
|
|
1277
1289
|
return Object.entries(e.params).reduce((r, [o, a]) => {
|
|
1278
|
-
const s =
|
|
1279
|
-
return s ?
|
|
1290
|
+
const s = Le(`${W}${o}${G}`);
|
|
1291
|
+
return s ? Dt(r, { name: o, param: a, value: t[s] }) : r;
|
|
1280
1292
|
}, n);
|
|
1281
1293
|
}
|
|
1282
|
-
function
|
|
1294
|
+
function Pr(e, t) {
|
|
1283
1295
|
return Object.entries(e.params).reduce((n, [r, o]) => {
|
|
1284
|
-
const a =
|
|
1285
|
-
return a ?
|
|
1296
|
+
const a = Le(`${W}${r}${G}`);
|
|
1297
|
+
return a ? Dt(n, { name: r, param: o, value: t[a] }) : n;
|
|
1286
1298
|
}, e.value);
|
|
1287
1299
|
}
|
|
1288
|
-
function
|
|
1300
|
+
function Er(e, t) {
|
|
1289
1301
|
const n = new URLSearchParams(e.value);
|
|
1290
1302
|
if (!e.value)
|
|
1291
1303
|
return n;
|
|
1292
1304
|
for (const [r, o] of n.entries()) {
|
|
1293
|
-
const a =
|
|
1305
|
+
const a = Le(o);
|
|
1294
1306
|
if (!a)
|
|
1295
1307
|
continue;
|
|
1296
|
-
const
|
|
1297
|
-
|
|
1308
|
+
const c = ie(t[a], e.params[a], Ve(o)), i = t[a] === void 0 && c === "";
|
|
1309
|
+
Ve(o) && i ? n.delete(r, o) : n.set(r, c);
|
|
1298
1310
|
}
|
|
1299
1311
|
return n;
|
|
1300
1312
|
}
|
|
1301
|
-
function
|
|
1313
|
+
function br(e) {
|
|
1302
1314
|
return (t, n, r) => {
|
|
1303
|
-
if (
|
|
1304
|
-
const
|
|
1305
|
-
return Object.entries(
|
|
1306
|
-
|
|
1307
|
-
}),
|
|
1315
|
+
if (M(t)) {
|
|
1316
|
+
const i = n ?? {}, { searchParams: u, ...f } = T(t);
|
|
1317
|
+
return Object.entries(i.query ?? {}).forEach(([h, v]) => {
|
|
1318
|
+
u.append(h, v);
|
|
1319
|
+
}), It({ ...f, searchParams: u });
|
|
1308
1320
|
}
|
|
1309
|
-
const o = n ?? {}, a = r ?? {}, s = e.find((
|
|
1321
|
+
const o = n ?? {}, a = r ?? {}, s = e.find((i) => i.name === t);
|
|
1310
1322
|
if (!s)
|
|
1311
|
-
throw new
|
|
1312
|
-
return
|
|
1323
|
+
throw new ir(String(t));
|
|
1324
|
+
return Rr(s, {
|
|
1313
1325
|
params: o,
|
|
1314
1326
|
query: a.query,
|
|
1315
1327
|
hash: a.hash
|
|
1316
1328
|
});
|
|
1317
1329
|
};
|
|
1318
1330
|
}
|
|
1319
|
-
class
|
|
1331
|
+
class Sr extends Error {
|
|
1320
1332
|
constructor() {
|
|
1321
1333
|
super("initialUrl must be set if window.location is unavailable");
|
|
1322
1334
|
}
|
|
1323
1335
|
}
|
|
1324
|
-
function
|
|
1336
|
+
function kr(e) {
|
|
1325
1337
|
if (e)
|
|
1326
1338
|
return e;
|
|
1327
|
-
if (
|
|
1339
|
+
if (Te())
|
|
1328
1340
|
return window.location.toString();
|
|
1329
|
-
throw new
|
|
1341
|
+
throw new Sr();
|
|
1330
1342
|
}
|
|
1331
|
-
const
|
|
1343
|
+
const Ar = (e, t) => {
|
|
1332
1344
|
try {
|
|
1333
|
-
|
|
1345
|
+
Ft(e, t);
|
|
1334
1346
|
} catch {
|
|
1335
1347
|
return !1;
|
|
1336
1348
|
}
|
|
1337
1349
|
return !0;
|
|
1338
|
-
},
|
|
1339
|
-
const { pathname: n, search: r } =
|
|
1350
|
+
}, Ft = (e, t) => {
|
|
1351
|
+
const { pathname: n, search: r } = T(t);
|
|
1340
1352
|
return {
|
|
1341
|
-
...
|
|
1342
|
-
...
|
|
1353
|
+
...xr(e.path, n),
|
|
1354
|
+
...Ur(e.query, r)
|
|
1343
1355
|
};
|
|
1344
1356
|
};
|
|
1345
|
-
function
|
|
1357
|
+
function xr(e, t) {
|
|
1346
1358
|
const n = {}, r = decodeURIComponent(t);
|
|
1347
1359
|
for (const [o, a] of Object.entries(e.params)) {
|
|
1348
|
-
const s = o.startsWith("?"),
|
|
1349
|
-
n[
|
|
1360
|
+
const s = o.startsWith("?"), c = s ? o.slice(1) : o, i = Tt(r, e.value, o), u = ue(i, a, s);
|
|
1361
|
+
n[c] = u;
|
|
1350
1362
|
}
|
|
1351
1363
|
return n;
|
|
1352
1364
|
}
|
|
1353
|
-
function
|
|
1365
|
+
function Ur(e, t) {
|
|
1354
1366
|
const n = {}, r = new URLSearchParams(t);
|
|
1355
1367
|
for (const [o, a] of Object.entries(e.params)) {
|
|
1356
|
-
const s = o.startsWith("?"),
|
|
1357
|
-
n[
|
|
1368
|
+
const s = o.startsWith("?"), c = s ? o.slice(1) : o, i = r.get(c) ?? void 0, u = ue(i, a, s);
|
|
1369
|
+
n[c] = u;
|
|
1358
1370
|
}
|
|
1359
1371
|
return n;
|
|
1360
1372
|
}
|
|
1361
|
-
const
|
|
1362
|
-
const { pathname: n } =
|
|
1363
|
-
return
|
|
1364
|
-
},
|
|
1365
|
-
const { search: n } =
|
|
1366
|
-
return
|
|
1367
|
-
},
|
|
1368
|
-
const { hash: n } =
|
|
1373
|
+
const Br = (e) => "name" in e.matched && !!e.matched.name, Lr = (e, t) => {
|
|
1374
|
+
const { pathname: n } = T(t);
|
|
1375
|
+
return lr(e).test(n);
|
|
1376
|
+
}, Cr = (e, t) => {
|
|
1377
|
+
const { search: n } = T(t);
|
|
1378
|
+
return hr(e).every((o) => o.test(n));
|
|
1379
|
+
}, $e = (e, t) => {
|
|
1380
|
+
const { hash: n } = T(t), { value: r } = e.hash;
|
|
1369
1381
|
return r === void 0 || `#${r.toLowerCase()}` === n.toLowerCase();
|
|
1370
1382
|
};
|
|
1371
|
-
function
|
|
1372
|
-
const { searchParams: t, pathname: n } =
|
|
1383
|
+
function Nr(e) {
|
|
1384
|
+
const { searchParams: t, pathname: n } = T(e), r = -1, o = 1;
|
|
1373
1385
|
return (a, s) => {
|
|
1374
|
-
const
|
|
1375
|
-
return a.depth > s.depth ? r : a.depth < s.depth ? o :
|
|
1386
|
+
const c = ft(a, t), i = it(a, n), u = ft(s, t), f = it(s, n);
|
|
1387
|
+
return a.depth > s.depth ? r : a.depth < s.depth ? o : c + i > u + f ? r : c + i < u + f ? o : $e(a, e) ? r : $e(s, e) ? o : 0;
|
|
1376
1388
|
};
|
|
1377
1389
|
}
|
|
1378
|
-
function
|
|
1379
|
-
const n = Object.keys(e.path.params).filter((o) => o.startsWith("?")).map((o) => o), r = n.filter((o) =>
|
|
1390
|
+
function it(e, t) {
|
|
1391
|
+
const n = Object.keys(e.path.params).filter((o) => o.startsWith("?")).map((o) => o), r = n.filter((o) => Tt(t, e.path.value, o) === void 0);
|
|
1380
1392
|
return n.length - r.length;
|
|
1381
1393
|
}
|
|
1382
|
-
function
|
|
1394
|
+
function ft(e, t) {
|
|
1383
1395
|
const n = new URLSearchParams(e.query.value), r = Array.from(n.keys()), o = r.filter((a) => !t.has(a));
|
|
1384
1396
|
return r.length - o.length;
|
|
1385
1397
|
}
|
|
1386
|
-
function
|
|
1398
|
+
function Jt(e) {
|
|
1387
1399
|
return !!e && typeof e == "object";
|
|
1388
1400
|
}
|
|
1389
|
-
const
|
|
1390
|
-
function
|
|
1391
|
-
if (
|
|
1401
|
+
const Ae = !0;
|
|
1402
|
+
function Hr(e, t, n) {
|
|
1403
|
+
if (Jt(e) && t in e) {
|
|
1392
1404
|
const r = e[t];
|
|
1393
1405
|
if (typeof r == "string")
|
|
1394
|
-
return
|
|
1406
|
+
return ue(r, n, Ae);
|
|
1395
1407
|
}
|
|
1396
|
-
return
|
|
1408
|
+
return ue(void 0, n, Ae);
|
|
1397
1409
|
}
|
|
1398
|
-
function
|
|
1410
|
+
function jr(e, t) {
|
|
1399
1411
|
const n = {};
|
|
1400
1412
|
for (const [r, o] of Object.entries(e)) {
|
|
1401
|
-
const a =
|
|
1413
|
+
const a = Hr(t, r, o);
|
|
1402
1414
|
n[r] = a;
|
|
1403
1415
|
}
|
|
1404
1416
|
return n;
|
|
1405
1417
|
}
|
|
1406
|
-
function
|
|
1407
|
-
if (
|
|
1418
|
+
function Vr(e, t, n) {
|
|
1419
|
+
if (Jt(e) && t in e) {
|
|
1408
1420
|
const r = e[t];
|
|
1409
|
-
return
|
|
1421
|
+
return ie(r, n, Ae);
|
|
1410
1422
|
}
|
|
1411
|
-
return
|
|
1423
|
+
return ie(void 0, n, Ae);
|
|
1412
1424
|
}
|
|
1413
|
-
const
|
|
1425
|
+
const lt = (e, t) => {
|
|
1414
1426
|
const n = {};
|
|
1415
1427
|
for (const [r, o] of Object.entries(e)) {
|
|
1416
|
-
const a =
|
|
1428
|
+
const a = Vr(t, r, o);
|
|
1417
1429
|
n[r] = a;
|
|
1418
1430
|
}
|
|
1419
1431
|
return n;
|
|
1420
|
-
},
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1432
|
+
}, $r = [
|
|
1433
|
+
Br,
|
|
1434
|
+
Lr,
|
|
1435
|
+
Cr,
|
|
1436
|
+
$e,
|
|
1437
|
+
Ar
|
|
1426
1438
|
];
|
|
1427
|
-
function
|
|
1428
|
-
const r =
|
|
1439
|
+
function Ne(e, t, n) {
|
|
1440
|
+
const r = Nr(t), o = e.filter((i) => $r.every((u) => u(i, t))).sort(r);
|
|
1429
1441
|
if (o.length === 0)
|
|
1430
1442
|
return;
|
|
1431
|
-
const [a] = o, { search: s, hash:
|
|
1443
|
+
const [a] = o, { search: s, hash: c } = T(t);
|
|
1432
1444
|
return {
|
|
1433
1445
|
id: a.id,
|
|
1434
1446
|
matched: a.matched,
|
|
1435
1447
|
matches: a.matches,
|
|
1436
1448
|
name: a.name,
|
|
1437
|
-
query:
|
|
1438
|
-
params:
|
|
1439
|
-
state:
|
|
1440
|
-
hash:
|
|
1449
|
+
query: $t(s),
|
|
1450
|
+
params: Ft(a, t),
|
|
1451
|
+
state: jr(a.state, n),
|
|
1452
|
+
hash: c
|
|
1441
1453
|
};
|
|
1442
1454
|
}
|
|
1443
|
-
function
|
|
1444
|
-
const n = new RegExp(`\\${
|
|
1455
|
+
function Ke(e, t) {
|
|
1456
|
+
const n = new RegExp(`\\${W}(\\??[\\w-_]+)\\${G}`, "g");
|
|
1445
1457
|
return Array.from(e.matchAll(n)).reduce((o, [a, s]) => {
|
|
1446
|
-
const
|
|
1447
|
-
if (!
|
|
1458
|
+
const c = Le(a);
|
|
1459
|
+
if (!c)
|
|
1448
1460
|
return o;
|
|
1449
|
-
const
|
|
1450
|
-
return
|
|
1461
|
+
const i = Mn(t, c);
|
|
1462
|
+
return oe([c], o), o[s] = i, o;
|
|
1451
1463
|
}, {});
|
|
1452
1464
|
}
|
|
1453
|
-
function
|
|
1465
|
+
function Oe(e, t) {
|
|
1454
1466
|
return {
|
|
1455
1467
|
value: e,
|
|
1456
|
-
params:
|
|
1468
|
+
params: Ke(e, t)
|
|
1457
1469
|
};
|
|
1458
1470
|
}
|
|
1459
|
-
function
|
|
1460
|
-
return
|
|
1471
|
+
function Or(e, t) {
|
|
1472
|
+
return de(t) ? e.map((n) => {
|
|
1461
1473
|
const r = `${t}${n.path.value}`;
|
|
1462
1474
|
return {
|
|
1463
1475
|
...n,
|
|
1464
|
-
path:
|
|
1476
|
+
path: Oe(r, n.path.params)
|
|
1465
1477
|
};
|
|
1466
1478
|
}) : e;
|
|
1467
1479
|
}
|
|
1468
|
-
class
|
|
1480
|
+
class qr extends Error {
|
|
1469
1481
|
/**
|
|
1470
1482
|
* Constructs a new DuplicateNamesError instance with a message indicating the problematic name.
|
|
1471
1483
|
* @param name - The name of the name that was duplicated.
|
|
@@ -1474,468 +1486,571 @@ class Br extends Error {
|
|
|
1474
1486
|
super(`Invalid Name "${t}": Router does not support multiple routes with the same name. All name names must be unique.`);
|
|
1475
1487
|
}
|
|
1476
1488
|
}
|
|
1477
|
-
function
|
|
1489
|
+
function _r(e) {
|
|
1478
1490
|
const t = e.map(({ name: n }) => n);
|
|
1479
1491
|
for (const n of t)
|
|
1480
|
-
if (
|
|
1481
|
-
throw new
|
|
1492
|
+
if (wt(t, n) > 1)
|
|
1493
|
+
throw new qr(n);
|
|
1482
1494
|
}
|
|
1483
|
-
function
|
|
1484
|
-
const
|
|
1485
|
-
|
|
1486
|
-
|
|
1495
|
+
function Mr() {
|
|
1496
|
+
const e = Ue(/* @__PURE__ */ new Map()), t = Te() ? s() : null, n = (c) => {
|
|
1497
|
+
e.set(c, !1), t == null || t.observe(c);
|
|
1498
|
+
}, r = (c) => {
|
|
1499
|
+
e.delete(c), t == null || t.unobserve(c);
|
|
1500
|
+
}, o = () => {
|
|
1501
|
+
t == null || t.disconnect();
|
|
1502
|
+
}, a = (c) => e.get(c) ?? !1;
|
|
1503
|
+
function s() {
|
|
1504
|
+
return new IntersectionObserver((c) => {
|
|
1505
|
+
c.forEach((i) => {
|
|
1506
|
+
e.set(i.target, i.isIntersecting);
|
|
1507
|
+
});
|
|
1508
|
+
});
|
|
1509
|
+
}
|
|
1510
|
+
return {
|
|
1511
|
+
observe: n,
|
|
1512
|
+
unobserve: r,
|
|
1513
|
+
disconnect: o,
|
|
1514
|
+
isElementVisible: a
|
|
1515
|
+
};
|
|
1516
|
+
}
|
|
1517
|
+
const Qt = Symbol("visibilityObserver");
|
|
1518
|
+
function Tr() {
|
|
1519
|
+
const e = re(Qt);
|
|
1520
|
+
if (!e)
|
|
1521
|
+
throw new he();
|
|
1522
|
+
return e;
|
|
1523
|
+
}
|
|
1524
|
+
function io(e, t) {
|
|
1525
|
+
const n = bn(e) ? e.flat() : e, r = Or(n, t == null ? void 0 : t.base);
|
|
1526
|
+
_r(r);
|
|
1527
|
+
const o = Ot(), a = Kr(), s = Mr(), c = br(r), i = Zn({
|
|
1487
1528
|
mode: t == null ? void 0 : t.historyMode,
|
|
1488
1529
|
listener: ({ location: w }) => {
|
|
1489
|
-
const
|
|
1490
|
-
|
|
1530
|
+
const L = z(w);
|
|
1531
|
+
B(L, { state: w.state });
|
|
1491
1532
|
}
|
|
1492
|
-
}), { runBeforeRouteHooks:
|
|
1493
|
-
hooks:
|
|
1494
|
-
onBeforeRouteEnter:
|
|
1495
|
-
onAfterRouteUpdate:
|
|
1496
|
-
onBeforeRouteLeave:
|
|
1497
|
-
onAfterRouteEnter:
|
|
1498
|
-
onBeforeRouteUpdate:
|
|
1499
|
-
onAfterRouteLeave:
|
|
1500
|
-
} =
|
|
1501
|
-
async function
|
|
1502
|
-
|
|
1503
|
-
|
|
1533
|
+
}), { runBeforeRouteHooks: u, runAfterRouteHooks: f } = or(), {
|
|
1534
|
+
hooks: h,
|
|
1535
|
+
onBeforeRouteEnter: v,
|
|
1536
|
+
onAfterRouteUpdate: p,
|
|
1537
|
+
onBeforeRouteLeave: k,
|
|
1538
|
+
onAfterRouteEnter: R,
|
|
1539
|
+
onBeforeRouteUpdate: y,
|
|
1540
|
+
onAfterRouteLeave: S
|
|
1541
|
+
} = sr();
|
|
1542
|
+
async function B(w, L = {}) {
|
|
1543
|
+
const I = o();
|
|
1544
|
+
if (i.stopListening(), Ce(w)) {
|
|
1545
|
+
i.update(w, L);
|
|
1504
1546
|
return;
|
|
1505
1547
|
}
|
|
1506
|
-
const
|
|
1507
|
-
switch (
|
|
1548
|
+
const V = Ne(r, w, L.state) ?? d("NotFound"), me = { ...b }, F = await u({ to: V, from: me, hooks: h });
|
|
1549
|
+
switch (F.status) {
|
|
1550
|
+
// On abort do nothing
|
|
1508
1551
|
case "ABORT":
|
|
1509
1552
|
return;
|
|
1553
|
+
// On push update the history, and push new route, and return
|
|
1510
1554
|
case "PUSH":
|
|
1511
|
-
|
|
1555
|
+
i.update(w, L), await g(...F.to);
|
|
1512
1556
|
return;
|
|
1557
|
+
// On reject update the history, the route, and set the rejection type
|
|
1513
1558
|
case "REJECT":
|
|
1514
|
-
|
|
1559
|
+
i.update(w, L), m(F.type);
|
|
1515
1560
|
break;
|
|
1561
|
+
// On success update history, set the route, and clear the rejection
|
|
1516
1562
|
case "SUCCESS":
|
|
1517
|
-
|
|
1563
|
+
i.update(w, L), m(null);
|
|
1518
1564
|
break;
|
|
1519
1565
|
default:
|
|
1520
|
-
throw new Error(`Switch is not exhaustive for before hook response status: ${JSON.stringify(
|
|
1566
|
+
throw new Error(`Switch is not exhaustive for before hook response status: ${JSON.stringify(F)}`);
|
|
1521
1567
|
}
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1568
|
+
const D = I;
|
|
1569
|
+
a.setProps(V).then(($) => {
|
|
1570
|
+
if (D === I)
|
|
1571
|
+
switch ($.status) {
|
|
1572
|
+
case "SUCCESS":
|
|
1573
|
+
break;
|
|
1574
|
+
case "PUSH":
|
|
1575
|
+
g(...$.to);
|
|
1576
|
+
break;
|
|
1577
|
+
case "REJECT":
|
|
1578
|
+
m($.type);
|
|
1579
|
+
break;
|
|
1580
|
+
default:
|
|
1581
|
+
const ae = $;
|
|
1582
|
+
throw new Error(`Switch is not exhaustive for prop store response status: ${JSON.stringify(ae)}`);
|
|
1583
|
+
}
|
|
1584
|
+
}), C(V);
|
|
1585
|
+
const J = await f({ to: V, from: me, hooks: h });
|
|
1586
|
+
switch (J.status) {
|
|
1525
1587
|
case "PUSH":
|
|
1526
|
-
await
|
|
1588
|
+
await g(...J.to);
|
|
1527
1589
|
break;
|
|
1528
1590
|
case "REJECT":
|
|
1529
|
-
|
|
1591
|
+
m(J.type);
|
|
1530
1592
|
break;
|
|
1531
1593
|
case "SUCCESS":
|
|
1532
1594
|
break;
|
|
1533
1595
|
default:
|
|
1534
|
-
const
|
|
1535
|
-
throw new Error(`Switch is not exhaustive for after hook response status: ${JSON.stringify(
|
|
1596
|
+
const $ = J;
|
|
1597
|
+
throw new Error(`Switch is not exhaustive for after hook response status: ${JSON.stringify($)}`);
|
|
1536
1598
|
}
|
|
1537
|
-
|
|
1599
|
+
i.startListening();
|
|
1538
1600
|
}
|
|
1539
|
-
const
|
|
1540
|
-
if (
|
|
1541
|
-
const
|
|
1542
|
-
return
|
|
1601
|
+
const g = (w, L, I) => {
|
|
1602
|
+
if (M(w)) {
|
|
1603
|
+
const $ = { ...L }, ae = c(w, $);
|
|
1604
|
+
return B(ae, $);
|
|
1543
1605
|
}
|
|
1544
|
-
const
|
|
1545
|
-
return
|
|
1546
|
-
},
|
|
1547
|
-
if (
|
|
1548
|
-
const
|
|
1549
|
-
return
|
|
1606
|
+
const V = { ...I }, F = c(w, L ?? {}, V), D = rt(w), J = lt((D == null ? void 0 : D.state) ?? {}, V.state);
|
|
1607
|
+
return B(F, { ...V, state: J });
|
|
1608
|
+
}, P = (w, L, I) => {
|
|
1609
|
+
if (M(w)) {
|
|
1610
|
+
const $ = { ...L, replace: !0 }, ae = c(w, $);
|
|
1611
|
+
return B(ae, $);
|
|
1550
1612
|
}
|
|
1551
|
-
const
|
|
1552
|
-
return
|
|
1553
|
-
},
|
|
1554
|
-
|
|
1555
|
-
},
|
|
1556
|
-
if (!
|
|
1557
|
-
const
|
|
1558
|
-
return
|
|
1613
|
+
const V = { ...I, replace: !0 }, F = c(w, L ?? {}, V), D = rt(w), J = lt((D == null ? void 0 : D.state) ?? {}, V.state);
|
|
1614
|
+
return B(F, { ...V, state: J });
|
|
1615
|
+
}, A = (w) => {
|
|
1616
|
+
m(w);
|
|
1617
|
+
}, x = (w, L = {}) => {
|
|
1618
|
+
if (!M(w)) {
|
|
1619
|
+
const I = c(w, L);
|
|
1620
|
+
return Ne(r, I);
|
|
1559
1621
|
}
|
|
1560
|
-
if (!
|
|
1561
|
-
return
|
|
1562
|
-
}, { setRejection:
|
|
1563
|
-
|
|
1564
|
-
const
|
|
1565
|
-
let
|
|
1566
|
-
async function
|
|
1567
|
-
|
|
1568
|
-
}
|
|
1569
|
-
function
|
|
1570
|
-
return r.find((
|
|
1571
|
-
}
|
|
1572
|
-
function
|
|
1573
|
-
w.component("RouterView",
|
|
1574
|
-
}
|
|
1575
|
-
const
|
|
1576
|
-
route:
|
|
1577
|
-
resolve:
|
|
1578
|
-
push:
|
|
1579
|
-
replace:
|
|
1580
|
-
reject:
|
|
1581
|
-
find:
|
|
1582
|
-
refresh:
|
|
1583
|
-
forward:
|
|
1584
|
-
back:
|
|
1585
|
-
go:
|
|
1586
|
-
install:
|
|
1587
|
-
isExternal:
|
|
1588
|
-
onBeforeRouteEnter:
|
|
1589
|
-
onAfterRouteUpdate:
|
|
1590
|
-
onBeforeRouteLeave:
|
|
1591
|
-
onAfterRouteEnter:
|
|
1592
|
-
onBeforeRouteUpdate:
|
|
1593
|
-
onAfterRouteLeave:
|
|
1622
|
+
if (!Ce(w))
|
|
1623
|
+
return Ne(r, w);
|
|
1624
|
+
}, { setRejection: m, rejection: l, getRejectionRoute: d } = ur(t ?? {}), E = d("NotFound"), { currentRoute: b, routerRoute: U, updateRoute: C } = Kn(E, g);
|
|
1625
|
+
i.startListening();
|
|
1626
|
+
const j = kr(t == null ? void 0 : t.initialUrl), q = i.location.state, { host: et } = T(j), Ce = Xn(et);
|
|
1627
|
+
let tt = !1;
|
|
1628
|
+
async function nt() {
|
|
1629
|
+
tt || (await B(j, { replace: !0, state: q }), tt = !0);
|
|
1630
|
+
}
|
|
1631
|
+
function rt(w) {
|
|
1632
|
+
return r.find((L) => L.name === w);
|
|
1633
|
+
}
|
|
1634
|
+
function an(w) {
|
|
1635
|
+
w.component("RouterView", oo), w.component("RouterLink", ro), w.provide(Bt, l), w.provide(Vt, h), w.provide(en, a), w.provide(Qt, s), w.provide(Lt, ot), nt();
|
|
1636
|
+
}
|
|
1637
|
+
const ot = {
|
|
1638
|
+
route: U,
|
|
1639
|
+
resolve: c,
|
|
1640
|
+
push: g,
|
|
1641
|
+
replace: P,
|
|
1642
|
+
reject: A,
|
|
1643
|
+
find: x,
|
|
1644
|
+
refresh: i.refresh,
|
|
1645
|
+
forward: i.forward,
|
|
1646
|
+
back: i.back,
|
|
1647
|
+
go: i.go,
|
|
1648
|
+
install: an,
|
|
1649
|
+
isExternal: Ce,
|
|
1650
|
+
onBeforeRouteEnter: v,
|
|
1651
|
+
onAfterRouteUpdate: p,
|
|
1652
|
+
onBeforeRouteLeave: k,
|
|
1653
|
+
onAfterRouteEnter: R,
|
|
1654
|
+
onBeforeRouteUpdate: y,
|
|
1655
|
+
onAfterRouteLeave: S,
|
|
1594
1656
|
prefetch: t == null ? void 0 : t.prefetch,
|
|
1595
|
-
start:
|
|
1657
|
+
start: nt
|
|
1596
1658
|
};
|
|
1597
|
-
return
|
|
1659
|
+
return ot;
|
|
1598
1660
|
}
|
|
1599
|
-
function
|
|
1661
|
+
function ht(e, t) {
|
|
1600
1662
|
return {
|
|
1601
1663
|
value: e,
|
|
1602
|
-
params:
|
|
1664
|
+
params: Ke(e, t)
|
|
1603
1665
|
};
|
|
1604
1666
|
}
|
|
1605
|
-
function
|
|
1667
|
+
function Gt(e, t) {
|
|
1606
1668
|
return {
|
|
1607
1669
|
value: e,
|
|
1608
|
-
params:
|
|
1670
|
+
params: Ke(e, t)
|
|
1609
1671
|
};
|
|
1610
1672
|
}
|
|
1611
|
-
function
|
|
1612
|
-
return
|
|
1673
|
+
function Dr(e) {
|
|
1674
|
+
return pe(e) && typeof e.hash == "string";
|
|
1613
1675
|
}
|
|
1614
|
-
function
|
|
1615
|
-
return e === void 0 ?
|
|
1676
|
+
function Kt(e) {
|
|
1677
|
+
return e === void 0 ? Re() : Dr(e) ? e : Re(e);
|
|
1616
1678
|
}
|
|
1617
|
-
function
|
|
1679
|
+
function ze(e) {
|
|
1618
1680
|
return e === void 0 ? "" : e;
|
|
1619
1681
|
}
|
|
1620
|
-
function
|
|
1621
|
-
return
|
|
1682
|
+
function Wr(e) {
|
|
1683
|
+
return pe(e) && typeof e.value == "string";
|
|
1622
1684
|
}
|
|
1623
|
-
function
|
|
1624
|
-
return e === void 0 ?
|
|
1685
|
+
function zt(e) {
|
|
1686
|
+
return e === void 0 ? Oe("", {}) : Wr(e) ? e : Oe(e, {});
|
|
1625
1687
|
}
|
|
1626
|
-
function
|
|
1627
|
-
return
|
|
1688
|
+
function Ir(e) {
|
|
1689
|
+
return pe(e) && typeof e.value == "string";
|
|
1628
1690
|
}
|
|
1629
|
-
function
|
|
1630
|
-
return e === void 0 ?
|
|
1691
|
+
function Yt(e) {
|
|
1692
|
+
return e === void 0 ? ht("", {}) : Ir(e) ? e : ht(e, {});
|
|
1631
1693
|
}
|
|
1632
|
-
function
|
|
1633
|
-
const t =
|
|
1694
|
+
function ne(e) {
|
|
1695
|
+
const t = Je(), n = ze(e.name), r = zt(e.path), o = Yt(e.query), a = Kt(e.hash), s = e.meta ?? {}, c = jn(e) ? e.state : {}, i = ye({ id: t, meta: {}, state: {}, ...e }), u = {
|
|
1634
1696
|
id: t,
|
|
1635
|
-
matched:
|
|
1636
|
-
matches: [
|
|
1697
|
+
matched: i,
|
|
1698
|
+
matches: [i],
|
|
1637
1699
|
name: n,
|
|
1638
1700
|
path: r,
|
|
1639
1701
|
query: o,
|
|
1640
1702
|
hash: a,
|
|
1641
1703
|
meta: s,
|
|
1642
|
-
state:
|
|
1704
|
+
state: c,
|
|
1643
1705
|
depth: 1,
|
|
1644
|
-
host:
|
|
1706
|
+
host: Gt("", {}),
|
|
1645
1707
|
prefetch: e.prefetch
|
|
1646
|
-
},
|
|
1647
|
-
return
|
|
1708
|
+
}, f = Pt(e) ? Et(e.parent, u) : u;
|
|
1709
|
+
return oe(f.path.params, f.query.params), f;
|
|
1648
1710
|
}
|
|
1649
|
-
const
|
|
1711
|
+
const xe = { template: "<div>This is component</div>" }, Ye = ne({
|
|
1650
1712
|
name: "parentA",
|
|
1651
1713
|
path: "/parentA/[paramA]"
|
|
1652
|
-
}),
|
|
1653
|
-
parent:
|
|
1714
|
+
}), Xt = ne({
|
|
1715
|
+
parent: Ye,
|
|
1654
1716
|
name: "parentA.childA",
|
|
1655
1717
|
path: "/[?paramB]"
|
|
1656
|
-
}),
|
|
1657
|
-
parent:
|
|
1718
|
+
}), Fr = ne({
|
|
1719
|
+
parent: Ye,
|
|
1658
1720
|
name: "parentA.childB",
|
|
1659
1721
|
path: "/[paramD]",
|
|
1660
|
-
component:
|
|
1661
|
-
}),
|
|
1662
|
-
parent:
|
|
1722
|
+
component: xe
|
|
1723
|
+
}), Jr = ne({
|
|
1724
|
+
parent: Xt,
|
|
1663
1725
|
name: "parentA.childA.grandChildA",
|
|
1664
1726
|
path: "/[paramC]",
|
|
1665
|
-
component:
|
|
1727
|
+
component: xe
|
|
1666
1728
|
});
|
|
1667
|
-
|
|
1729
|
+
ne({
|
|
1668
1730
|
name: "parentB",
|
|
1669
1731
|
path: "/parentB",
|
|
1670
|
-
component:
|
|
1671
|
-
}),
|
|
1732
|
+
component: xe
|
|
1733
|
+
}), ne({
|
|
1672
1734
|
name: "parentC",
|
|
1673
1735
|
path: "/",
|
|
1674
|
-
component:
|
|
1736
|
+
component: xe
|
|
1675
1737
|
});
|
|
1676
|
-
const
|
|
1738
|
+
const Qr = "eager", Gr = {
|
|
1677
1739
|
components: !0,
|
|
1678
1740
|
props: !1
|
|
1679
1741
|
};
|
|
1680
|
-
function
|
|
1681
|
-
return
|
|
1682
|
-
}
|
|
1683
|
-
function
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1742
|
+
function ge(e) {
|
|
1743
|
+
return ["eager", "lazy"].includes(e);
|
|
1744
|
+
}
|
|
1745
|
+
function Zt({ routerPrefetch: e, routePrefetch: t, linkPrefetch: n }, r) {
|
|
1746
|
+
const o = He(n, r), a = He(t, r), s = He(e, r), c = [
|
|
1747
|
+
o,
|
|
1748
|
+
a,
|
|
1749
|
+
s,
|
|
1750
|
+
Gr[r],
|
|
1751
|
+
Qr
|
|
1752
|
+
].reduce((i, u) => ge(i) ? i : i === !0 && ge(u) ? u : i === !0 && !ge(u) ? i : i === void 0 ? u : i, void 0);
|
|
1753
|
+
return ge(c) ? c : !1;
|
|
1754
|
+
}
|
|
1755
|
+
function He(e, t) {
|
|
1756
|
+
return pe(e) ? e[t] : e;
|
|
1757
|
+
}
|
|
1758
|
+
function pt(e) {
|
|
1759
|
+
try {
|
|
1760
|
+
const t = e();
|
|
1761
|
+
return bt(t) ? t.catch((n) => n) : t;
|
|
1762
|
+
} catch (t) {
|
|
1763
|
+
return t;
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
const en = Symbol();
|
|
1767
|
+
function Kr() {
|
|
1768
|
+
const e = Ue(/* @__PURE__ */ new Map()), t = jt(), n = (u, f, h) => f.matches.filter((v) => Zt({ ...h, routePrefetch: v.prefetch }, "props") === u).flatMap((v) => c(v)).reduce((v, { id: p, name: k, props: R }) => {
|
|
1769
|
+
if (!R)
|
|
1770
|
+
return v;
|
|
1771
|
+
const y = s(p, k, f), S = pt(() => R(f, t));
|
|
1772
|
+
return v[y] = S, v;
|
|
1773
|
+
}, {}), r = (u) => {
|
|
1774
|
+
Object.entries(u).forEach(([f, h]) => {
|
|
1775
|
+
e.set(f, h);
|
|
1694
1776
|
});
|
|
1695
|
-
},
|
|
1696
|
-
const
|
|
1697
|
-
|
|
1698
|
-
if (!
|
|
1699
|
-
|
|
1700
|
-
const
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1777
|
+
}, o = async (u) => {
|
|
1778
|
+
const f = u.matches.flatMap(c), h = [], v = [];
|
|
1779
|
+
for (const { id: p, name: k, props: R } of f) {
|
|
1780
|
+
if (!R)
|
|
1781
|
+
continue;
|
|
1782
|
+
const y = s(p, k, u);
|
|
1783
|
+
if (h.push(y), !e.has(y)) {
|
|
1784
|
+
const S = pt(() => R(u, t));
|
|
1785
|
+
e.set(y, S);
|
|
1786
|
+
}
|
|
1787
|
+
v.push((async () => {
|
|
1788
|
+
const S = await e.get(y);
|
|
1789
|
+
if (S instanceof Error)
|
|
1790
|
+
throw S;
|
|
1791
|
+
})());
|
|
1792
|
+
}
|
|
1793
|
+
i(h);
|
|
1794
|
+
try {
|
|
1795
|
+
return await Promise.all(v), { status: "SUCCESS" };
|
|
1796
|
+
} catch (p) {
|
|
1797
|
+
if (p instanceof X || p instanceof Se)
|
|
1798
|
+
return p.response;
|
|
1799
|
+
throw p;
|
|
1800
|
+
}
|
|
1801
|
+
}, a = (u, f, h) => {
|
|
1802
|
+
const v = s(u, f, h);
|
|
1803
|
+
return e.get(v);
|
|
1707
1804
|
};
|
|
1708
|
-
function
|
|
1709
|
-
return [
|
|
1805
|
+
function s(u, f, h) {
|
|
1806
|
+
return [u, f, h.id, JSON.stringify(h.params)].join("-");
|
|
1710
1807
|
}
|
|
1711
|
-
function
|
|
1712
|
-
return
|
|
1808
|
+
function c(u) {
|
|
1809
|
+
return Me(u) ? Object.entries(u.props ?? {}).map(([f, h]) => ({ id: u.id, name: f, props: h })) : _e(u) ? [
|
|
1713
1810
|
{
|
|
1714
|
-
id:
|
|
1811
|
+
id: u.id,
|
|
1715
1812
|
name: "default",
|
|
1716
|
-
props:
|
|
1813
|
+
props: u.props
|
|
1717
1814
|
}
|
|
1718
1815
|
] : [];
|
|
1719
1816
|
}
|
|
1720
|
-
function i(
|
|
1817
|
+
function i(u) {
|
|
1721
1818
|
for (const f in e.keys())
|
|
1722
|
-
|
|
1819
|
+
u.includes(f) || e.delete(f);
|
|
1723
1820
|
}
|
|
1724
1821
|
return {
|
|
1725
|
-
getPrefetchProps:
|
|
1726
|
-
setPrefetchProps:
|
|
1727
|
-
getProps:
|
|
1728
|
-
setProps:
|
|
1822
|
+
getPrefetchProps: n,
|
|
1823
|
+
setPrefetchProps: r,
|
|
1824
|
+
getProps: a,
|
|
1825
|
+
setProps: o
|
|
1729
1826
|
};
|
|
1730
1827
|
}
|
|
1731
|
-
function
|
|
1732
|
-
const e =
|
|
1828
|
+
function tn() {
|
|
1829
|
+
const e = re(en);
|
|
1733
1830
|
if (!e)
|
|
1734
|
-
throw new
|
|
1831
|
+
throw new he();
|
|
1735
1832
|
return e;
|
|
1736
1833
|
}
|
|
1737
|
-
const
|
|
1834
|
+
const zr = fn(() => new Promise((e) => {
|
|
1738
1835
|
e({ default: { template: "foo" } });
|
|
1739
1836
|
}));
|
|
1740
|
-
function
|
|
1741
|
-
return e.name ===
|
|
1837
|
+
function dt(e) {
|
|
1838
|
+
return e.name === zr.name && "setup" in e;
|
|
1742
1839
|
}
|
|
1743
|
-
function
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1840
|
+
function Yr(e) {
|
|
1841
|
+
const t = /* @__PURE__ */ new Map(), n = qe(), { getPrefetchProps: r, setPrefetchProps: o } = tn(), { observe: a, unobserve: s, isElementVisible: c } = Tr(), i = () => {
|
|
1842
|
+
const f = Array.from(t.values()).reduce((h, v) => (Object.assign(h, v), h), {});
|
|
1843
|
+
o(f);
|
|
1844
|
+
};
|
|
1845
|
+
ln(() => {
|
|
1846
|
+
if (!n.value) {
|
|
1847
|
+
console.warn("The usePrefetching composition will not work correctly if the element ref is not bound.");
|
|
1848
|
+
return;
|
|
1751
1849
|
}
|
|
1850
|
+
a(n.value);
|
|
1851
|
+
}), hn(() => {
|
|
1852
|
+
n.value && s(n.value);
|
|
1853
|
+
}), je(() => se(e), ({ route: f, ...h }) => {
|
|
1854
|
+
t.clear(), f && u("eager", f, h);
|
|
1855
|
+
}, { immediate: !0 }), je(() => !!(n.value && c(n.value)), (f) => {
|
|
1856
|
+
const { route: h, ...v } = se(e);
|
|
1857
|
+
!h || !f || u("lazy", h, v);
|
|
1858
|
+
}, { immediate: !0 });
|
|
1859
|
+
function u(f, h, v) {
|
|
1860
|
+
Xr(f, h, v), t.has(f) || t.set(f, r(f, h, v));
|
|
1861
|
+
}
|
|
1862
|
+
return {
|
|
1863
|
+
element: n,
|
|
1864
|
+
commit: i
|
|
1752
1865
|
};
|
|
1753
1866
|
}
|
|
1754
|
-
function
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
ut(a) && a.setup();
|
|
1867
|
+
function Xr(e, t, n) {
|
|
1868
|
+
t.matches.forEach((r) => {
|
|
1869
|
+
Zt({
|
|
1870
|
+
...n,
|
|
1871
|
+
routePrefetch: r.prefetch
|
|
1872
|
+
}, "components") === e && (_e(r) && dt(r.component) && r.component.setup(), Me(r) && Object.values(r.components).forEach((a) => {
|
|
1873
|
+
dt(a) && a.setup();
|
|
1762
1874
|
}));
|
|
1763
1875
|
});
|
|
1764
1876
|
}
|
|
1765
|
-
function
|
|
1766
|
-
const r =
|
|
1767
|
-
if (
|
|
1877
|
+
function Zr(e, t = {}, n = {}) {
|
|
1878
|
+
const r = De(), o = pn(e), a = N(() => M(o.value) ? {} : se(t)), s = N(() => M(o.value) ? se(t) : se(n)), c = N(() => {
|
|
1879
|
+
if (M(o.value))
|
|
1768
1880
|
return o.value;
|
|
1769
1881
|
try {
|
|
1770
1882
|
return r.resolve(o.value, a.value, s.value);
|
|
1771
|
-
} catch (
|
|
1772
|
-
throw
|
|
1883
|
+
} catch (y) {
|
|
1884
|
+
throw y instanceof Z && console.error(`Failed to resolve route "${o.value.toString()}" in RouterLink.`, y), y;
|
|
1773
1885
|
}
|
|
1774
|
-
}),
|
|
1775
|
-
route:
|
|
1886
|
+
}), i = N(() => r.find(c.value, s.value)), u = N(() => !!i.value && r.route.matches.includes(i.value.matched)), f = N(() => !!i.value && r.route.matched === i.value.matched), h = N(() => r.isExternal(c.value)), { element: v, commit: p } = Yr(() => ({
|
|
1887
|
+
route: i.value,
|
|
1776
1888
|
routerPrefetch: r.prefetch,
|
|
1777
1889
|
linkPrefetch: s.value.prefetch
|
|
1778
|
-
})),
|
|
1890
|
+
})), k = (y) => (p(), r.push(c.value, { ...s.value, ...y }));
|
|
1779
1891
|
return {
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1892
|
+
element: v,
|
|
1893
|
+
route: i,
|
|
1894
|
+
href: c,
|
|
1895
|
+
isMatch: u,
|
|
1896
|
+
isExactMatch: f,
|
|
1784
1897
|
isExternal: h,
|
|
1785
|
-
push:
|
|
1786
|
-
replace: (
|
|
1898
|
+
push: k,
|
|
1899
|
+
replace: (y) => k(y)
|
|
1787
1900
|
};
|
|
1788
1901
|
}
|
|
1789
|
-
function
|
|
1790
|
-
if (!
|
|
1902
|
+
function eo(e, t, { exact: n } = {}) {
|
|
1903
|
+
if (!Qn(e))
|
|
1791
1904
|
return !1;
|
|
1792
1905
|
if (t === void 0)
|
|
1793
1906
|
return !0;
|
|
1794
|
-
const r = e.matches.map((o) =>
|
|
1907
|
+
const r = e.matches.map((o) => ze(o.name));
|
|
1795
1908
|
if (n) {
|
|
1796
1909
|
const o = r.at(-1);
|
|
1797
1910
|
return t === o;
|
|
1798
1911
|
}
|
|
1799
1912
|
return r.includes(t);
|
|
1800
1913
|
}
|
|
1801
|
-
function
|
|
1802
|
-
const n =
|
|
1914
|
+
function to(e, t) {
|
|
1915
|
+
const n = De();
|
|
1803
1916
|
function r() {
|
|
1804
1917
|
if (!e)
|
|
1805
1918
|
return;
|
|
1806
|
-
if (!
|
|
1807
|
-
throw new
|
|
1919
|
+
if (!eo(n.route, e, t))
|
|
1920
|
+
throw new Fn(e, n.route.name);
|
|
1808
1921
|
}
|
|
1809
|
-
return
|
|
1922
|
+
return je(n.route, r, { immediate: !0, deep: !0 }), n.route;
|
|
1810
1923
|
}
|
|
1811
|
-
const
|
|
1812
|
-
function
|
|
1813
|
-
return
|
|
1924
|
+
const nn = Symbol();
|
|
1925
|
+
function Xe() {
|
|
1926
|
+
return re(nn, 0);
|
|
1814
1927
|
}
|
|
1815
|
-
function
|
|
1816
|
-
const e =
|
|
1928
|
+
function rn() {
|
|
1929
|
+
const e = re(Vt);
|
|
1817
1930
|
if (!e)
|
|
1818
|
-
throw new
|
|
1931
|
+
throw new he();
|
|
1819
1932
|
return e;
|
|
1820
1933
|
}
|
|
1821
|
-
function
|
|
1934
|
+
function on(e) {
|
|
1822
1935
|
return (t) => {
|
|
1823
|
-
const n =
|
|
1824
|
-
return
|
|
1936
|
+
const n = Xe(), o = rn().addBeforeRouteHook({ lifecycle: e, hook: t, depth: n, timing: "component" });
|
|
1937
|
+
return gt(o), o;
|
|
1825
1938
|
};
|
|
1826
1939
|
}
|
|
1827
|
-
function
|
|
1940
|
+
function Ze(e) {
|
|
1828
1941
|
return (t) => {
|
|
1829
|
-
const n =
|
|
1830
|
-
return
|
|
1942
|
+
const n = Xe(), o = rn().addAfterRouteHook({ lifecycle: e, hook: t, depth: n, timing: "component" });
|
|
1943
|
+
return gt(o), o;
|
|
1831
1944
|
};
|
|
1832
1945
|
}
|
|
1833
|
-
const
|
|
1946
|
+
const fo = on("onBeforeRouteUpdate"), lo = on("onBeforeRouteLeave"), ho = Ze("onAfterRouteEnter"), po = Ze("onAfterRouteUpdate"), mo = Ze("onAfterRouteLeave"), no = ["href"], ro = /* @__PURE__ */ le({
|
|
1834
1947
|
__name: "routerLink",
|
|
1835
1948
|
props: {
|
|
1836
1949
|
to: {},
|
|
1837
|
-
prefetch: { type: [Boolean, Object], default: void 0 },
|
|
1950
|
+
prefetch: { type: [Boolean, String, Object], default: void 0 },
|
|
1838
1951
|
query: {},
|
|
1839
1952
|
hash: {},
|
|
1840
1953
|
replace: { type: Boolean },
|
|
1841
1954
|
state: {}
|
|
1842
1955
|
},
|
|
1843
1956
|
setup(e) {
|
|
1844
|
-
const t = e, n =
|
|
1845
|
-
const { to:
|
|
1846
|
-
return
|
|
1847
|
-
}), {
|
|
1848
|
-
"router-link--match":
|
|
1849
|
-
"router-link--exact-match":
|
|
1957
|
+
const t = e, n = De(), r = N(() => M(t.to) ? t.to : t.to(n.resolve)), o = N(() => {
|
|
1958
|
+
const { to: v, ...p } = t;
|
|
1959
|
+
return p;
|
|
1960
|
+
}), { element: a, isMatch: s, isExactMatch: c, isExternal: i, push: u } = Zr(r, o), f = N(() => ({
|
|
1961
|
+
"router-link--match": s.value,
|
|
1962
|
+
"router-link--exact-match": c.value
|
|
1850
1963
|
}));
|
|
1851
|
-
function
|
|
1852
|
-
|
|
1964
|
+
function h(v) {
|
|
1965
|
+
v.preventDefault(), u();
|
|
1853
1966
|
}
|
|
1854
|
-
return (
|
|
1967
|
+
return (v, p) => (vt(), dn("a", {
|
|
1968
|
+
ref_key: "element",
|
|
1969
|
+
ref: a,
|
|
1855
1970
|
href: r.value,
|
|
1856
|
-
class:
|
|
1857
|
-
onClick:
|
|
1971
|
+
class: mn(["router-link", f.value]),
|
|
1972
|
+
onClick: h
|
|
1858
1973
|
}, [
|
|
1859
|
-
|
|
1860
|
-
], 10,
|
|
1974
|
+
yt(v.$slots, "default", Rt(gn({ resolved: r.value, isMatch: ce(s), isExactMatch: ce(c), isExternal: ce(i) })))
|
|
1975
|
+
], 10, no));
|
|
1861
1976
|
}
|
|
1862
|
-
}),
|
|
1977
|
+
}), oo = /* @__PURE__ */ le({
|
|
1863
1978
|
__name: "routerView",
|
|
1864
1979
|
props: {
|
|
1865
|
-
name: {}
|
|
1980
|
+
name: { default: "default" }
|
|
1866
1981
|
},
|
|
1867
1982
|
setup(e) {
|
|
1868
|
-
const
|
|
1869
|
-
|
|
1870
|
-
const
|
|
1871
|
-
if (
|
|
1872
|
-
return
|
|
1873
|
-
const u =
|
|
1983
|
+
const t = to(), n = Jn(), r = Xe(), { getProps: o } = tn(), a = vn("RouterView", !0);
|
|
1984
|
+
yn(nn, r + 1);
|
|
1985
|
+
const s = N(() => {
|
|
1986
|
+
if (n.value)
|
|
1987
|
+
return n.value.component;
|
|
1988
|
+
const u = t.matches.at(r);
|
|
1874
1989
|
if (!u)
|
|
1875
1990
|
return null;
|
|
1876
|
-
const
|
|
1877
|
-
return
|
|
1991
|
+
const f = c(u), h = o(u.id, e.name, t);
|
|
1992
|
+
return f ? h ? Vn(f, () => h) : f : null;
|
|
1878
1993
|
});
|
|
1879
1994
|
function c(u) {
|
|
1880
|
-
return
|
|
1995
|
+
return i(u)[e.name];
|
|
1881
1996
|
}
|
|
1882
|
-
function
|
|
1883
|
-
return
|
|
1997
|
+
function i(u) {
|
|
1998
|
+
return Me(u) ? u.components : _e(u) ? { default: u.component } : typeof a == "string" ? {} : { default: a };
|
|
1884
1999
|
}
|
|
1885
|
-
return (u,
|
|
1886
|
-
(
|
|
1887
|
-
]) :
|
|
2000
|
+
return (u, f) => s.value ? yt(u.$slots, "default", Rt(Rn({ key: 0 }, { route: ce(t), component: s.value, rejection: ce(n) })), () => [
|
|
2001
|
+
(vt(), wn(Pn(s.value)))
|
|
2002
|
+
]) : En("", !0);
|
|
1888
2003
|
}
|
|
1889
2004
|
});
|
|
1890
|
-
function
|
|
1891
|
-
return
|
|
2005
|
+
function ao(e) {
|
|
2006
|
+
return pe(e) && typeof e.value == "string";
|
|
1892
2007
|
}
|
|
1893
|
-
function
|
|
1894
|
-
return
|
|
2008
|
+
function mt(e) {
|
|
2009
|
+
return ao(e) ? e : Gt(e, {});
|
|
1895
2010
|
}
|
|
1896
|
-
function
|
|
1897
|
-
const t =
|
|
2011
|
+
function go(e) {
|
|
2012
|
+
const t = Je(), n = ze(e.name), r = zt(e.path), o = Yt(e.query), a = Kt(e.hash), s = e.meta ?? {}, c = Hn(e) ? mt(e.host) : mt(""), i = ye({ id: t, meta: {}, state: {}, ...e }), u = {
|
|
1898
2013
|
id: t,
|
|
1899
|
-
matched:
|
|
1900
|
-
matches: [
|
|
2014
|
+
matched: i,
|
|
2015
|
+
matches: [i],
|
|
1901
2016
|
name: n,
|
|
1902
|
-
host:
|
|
2017
|
+
host: c,
|
|
1903
2018
|
path: r,
|
|
1904
2019
|
query: o,
|
|
1905
2020
|
hash: a,
|
|
1906
2021
|
meta: s,
|
|
1907
2022
|
depth: 1,
|
|
1908
2023
|
state: {}
|
|
1909
|
-
},
|
|
1910
|
-
return
|
|
2024
|
+
}, f = Pt(e) ? Et(e.parent, u) : u;
|
|
2025
|
+
return oe(f.path.params, f.query.params, f.host.params), f;
|
|
1911
2026
|
}
|
|
1912
2027
|
export {
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
2028
|
+
Un as DuplicateParamsError,
|
|
2029
|
+
ro as RouterLink,
|
|
2030
|
+
he as RouterNotInstalledError,
|
|
2031
|
+
oo as RouterView,
|
|
2032
|
+
Fn as UseRouteInvalidError,
|
|
2033
|
+
rr as asUrl,
|
|
2034
|
+
Vn as component,
|
|
2035
|
+
go as createExternalRoute,
|
|
2036
|
+
Dn as createParam,
|
|
2037
|
+
ne as createRoute,
|
|
2038
|
+
io as createRouter,
|
|
2039
|
+
_n as isParamWithDefault,
|
|
2040
|
+
eo as isRoute,
|
|
2041
|
+
M as isUrl,
|
|
2042
|
+
ho as onAfterRouteEnter,
|
|
2043
|
+
po as onAfterRouteLeave,
|
|
2044
|
+
mo as onAfterRouteUpdate,
|
|
2045
|
+
fo as onBeforeRouteLeave,
|
|
2046
|
+
lo as onBeforeRouteUpdate,
|
|
2047
|
+
Oe as path,
|
|
2048
|
+
ht as query,
|
|
2049
|
+
Lt as routerInjectionKey,
|
|
2050
|
+
Bt as routerRejectionKey,
|
|
2051
|
+
Zr as useLink,
|
|
2052
|
+
Jn as useRejection,
|
|
2053
|
+
to as useRoute,
|
|
2054
|
+
De as useRouter,
|
|
2055
|
+
uo as withDefault
|
|
1941
2056
|
};
|