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