@kitbag/router 0.11.3 → 0.11.4
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 +14 -69
- package/dist/kitbag-router.js +175 -172
- package/dist/kitbag-router.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/kitbag-router.d.ts
CHANGED
|
@@ -1060,17 +1060,18 @@ declare type RouterResolveOptions = {
|
|
|
1060
1060
|
hash?: string;
|
|
1061
1061
|
};
|
|
1062
1062
|
|
|
1063
|
-
declare type RouterRoute<TRoute extends ResolvedRoute = ResolvedRoute> =
|
|
1064
|
-
id: TRoute['id'];
|
|
1065
|
-
name: TRoute['name'];
|
|
1066
|
-
matched: TRoute['matched'];
|
|
1067
|
-
matches: TRoute['matches'];
|
|
1068
|
-
state: TRoute['state'];
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1063
|
+
declare type RouterRoute<TRoute extends ResolvedRoute = ResolvedRoute> = {
|
|
1064
|
+
readonly id: TRoute['id'];
|
|
1065
|
+
readonly name: TRoute['name'];
|
|
1066
|
+
readonly matched: TRoute['matched'];
|
|
1067
|
+
readonly matches: TRoute['matches'];
|
|
1068
|
+
readonly state: TRoute['state'];
|
|
1069
|
+
readonly hash: TRoute['hash'];
|
|
1070
|
+
readonly params: Writable<TRoute['params']>;
|
|
1071
|
+
readonly update: RouteUpdate<TRoute>;
|
|
1072
|
+
get query(): ResolvedRouteQuery;
|
|
1073
|
+
set query(value: QuerySource);
|
|
1074
|
+
};
|
|
1074
1075
|
|
|
1075
1076
|
/**
|
|
1076
1077
|
* This type is the same as `RouterRoute<ResolvedRoute<TRoutes[number]>>` while remaining distributive
|
|
@@ -1085,35 +1086,7 @@ name?: string | undefined;
|
|
|
1085
1086
|
name?: string | undefined;
|
|
1086
1087
|
}>>>, {}, {}>, Readonly<{
|
|
1087
1088
|
default?: ((props: {
|
|
1088
|
-
route:
|
|
1089
|
-
id: string;
|
|
1090
|
-
name: string;
|
|
1091
|
-
matched: CreateRouteOptions & WithHooks & (WithHost | WithoutHost) & (WithComponent | WithComponents | WithoutComponents) & (WithParent | WithoutParent) & (WithState | WithoutState) & {
|
|
1092
|
-
id: string;
|
|
1093
|
-
meta: Record<string, unknown>;
|
|
1094
|
-
};
|
|
1095
|
-
matches: (CreateRouteOptions & WithHooks & (WithHost | WithoutHost) & (WithComponent | WithComponents | WithoutComponents) & (WithParent | WithoutParent) & (WithState | WithoutState) & {
|
|
1096
|
-
id: string;
|
|
1097
|
-
meta: Record<string, unknown>;
|
|
1098
|
-
})[];
|
|
1099
|
-
state: {
|
|
1100
|
-
[x: string]: any;
|
|
1101
|
-
[x: number]: any;
|
|
1102
|
-
};
|
|
1103
|
-
query: ResolvedRouteQuery;
|
|
1104
|
-
hash: string | undefined;
|
|
1105
|
-
params: Writable< {
|
|
1106
|
-
[x: string]: any;
|
|
1107
|
-
[x: number]: any;
|
|
1108
|
-
}>;
|
|
1109
|
-
update: {
|
|
1110
|
-
(paramName: string, paramValue: unknown, options?: RouterPushOptions | undefined): Promise<void>;
|
|
1111
|
-
(params: Partial<{
|
|
1112
|
-
[x: string]: any;
|
|
1113
|
-
[x: number]: any;
|
|
1114
|
-
}>, options?: RouterPushOptions | undefined): Promise<void>;
|
|
1115
|
-
};
|
|
1116
|
-
}>;
|
|
1089
|
+
route: RouterRoute;
|
|
1117
1090
|
component: Component;
|
|
1118
1091
|
rejection: {
|
|
1119
1092
|
type: "NotFound";
|
|
@@ -1124,35 +1097,7 @@ name?: string | undefined;
|
|
|
1124
1097
|
}>) | undefined;
|
|
1125
1098
|
}> & {
|
|
1126
1099
|
default?: ((props: {
|
|
1127
|
-
route:
|
|
1128
|
-
id: string;
|
|
1129
|
-
name: string;
|
|
1130
|
-
matched: CreateRouteOptions & WithHooks & (WithHost | WithoutHost) & (WithComponent | WithComponents | WithoutComponents) & (WithParent | WithoutParent) & (WithState | WithoutState) & {
|
|
1131
|
-
id: string;
|
|
1132
|
-
meta: Record<string, unknown>;
|
|
1133
|
-
};
|
|
1134
|
-
matches: (CreateRouteOptions & WithHooks & (WithHost | WithoutHost) & (WithComponent | WithComponents | WithoutComponents) & (WithParent | WithoutParent) & (WithState | WithoutState) & {
|
|
1135
|
-
id: string;
|
|
1136
|
-
meta: Record<string, unknown>;
|
|
1137
|
-
})[];
|
|
1138
|
-
state: {
|
|
1139
|
-
[x: string]: any;
|
|
1140
|
-
[x: number]: any;
|
|
1141
|
-
};
|
|
1142
|
-
query: ResolvedRouteQuery;
|
|
1143
|
-
hash: string | undefined;
|
|
1144
|
-
params: Writable< {
|
|
1145
|
-
[x: string]: any;
|
|
1146
|
-
[x: number]: any;
|
|
1147
|
-
}>;
|
|
1148
|
-
update: {
|
|
1149
|
-
(paramName: string, paramValue: unknown, options?: RouterPushOptions | undefined): Promise<void>;
|
|
1150
|
-
(params: Partial<{
|
|
1151
|
-
[x: string]: any;
|
|
1152
|
-
[x: number]: any;
|
|
1153
|
-
}>, options?: RouterPushOptions | undefined): Promise<void>;
|
|
1154
|
-
};
|
|
1155
|
-
}>;
|
|
1100
|
+
route: RouterRoute;
|
|
1156
1101
|
component: Component;
|
|
1157
1102
|
rejection: {
|
|
1158
1103
|
type: "NotFound";
|
package/dist/kitbag-router.js
CHANGED
|
@@ -37,7 +37,7 @@ function Rn(e, t) {
|
|
|
37
37
|
if (n)
|
|
38
38
|
throw new mn(n);
|
|
39
39
|
}
|
|
40
|
-
class
|
|
40
|
+
class yn 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.
|
|
@@ -53,12 +53,12 @@ function gt(e, t) {
|
|
|
53
53
|
return e.filter((n) => t === n).length;
|
|
54
54
|
}
|
|
55
55
|
function te(...e) {
|
|
56
|
-
const t = e.flatMap((n) => Array.isArray(n) ? n : Object.keys(n).map(
|
|
56
|
+
const t = e.flatMap((n) => Array.isArray(n) ? n : Object.keys(n).map(vn));
|
|
57
57
|
for (const n of t)
|
|
58
58
|
if (gt(t, n) > 1)
|
|
59
|
-
throw new
|
|
59
|
+
throw new yn(n);
|
|
60
60
|
}
|
|
61
|
-
function
|
|
61
|
+
function vn(e) {
|
|
62
62
|
return e.startsWith("?") ? e.slice(1) : e;
|
|
63
63
|
}
|
|
64
64
|
function wn(e, t) {
|
|
@@ -91,7 +91,7 @@ function qe(e) {
|
|
|
91
91
|
function bn(e) {
|
|
92
92
|
return "state" in e && !!e.state;
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function yt(e, t) {
|
|
95
95
|
return {
|
|
96
96
|
...t,
|
|
97
97
|
path: wn(e.path, t.path),
|
|
@@ -104,7 +104,7 @@ function vt(e, t) {
|
|
|
104
104
|
depth: e.depth + 1
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function vt() {
|
|
108
108
|
return typeof window < "u" && typeof window.document < "u";
|
|
109
109
|
}
|
|
110
110
|
function An(e, t) {
|
|
@@ -337,7 +337,7 @@ function Ze(e) {
|
|
|
337
337
|
"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
338
|
);
|
|
339
339
|
else
|
|
340
|
-
|
|
340
|
+
B(g);
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
343
|
r.addEventListener(bt, i);
|
|
@@ -348,31 +348,31 @@ function Ze(e) {
|
|
|
348
348
|
function A(g) {
|
|
349
349
|
return typeof g == "string" ? g : G(g);
|
|
350
350
|
}
|
|
351
|
-
function
|
|
351
|
+
function v(g, l) {
|
|
352
352
|
return l === void 0 && (l = null), X(F({
|
|
353
353
|
pathname: h.pathname,
|
|
354
354
|
hash: "",
|
|
355
355
|
search: ""
|
|
356
356
|
}, typeof g == "string" ? ce(g) : g, {
|
|
357
357
|
state: l,
|
|
358
|
-
key:
|
|
358
|
+
key: ye()
|
|
359
359
|
}));
|
|
360
360
|
}
|
|
361
|
-
function
|
|
361
|
+
function R(g, l) {
|
|
362
362
|
return [{
|
|
363
363
|
usr: g.state,
|
|
364
364
|
key: g.key,
|
|
365
365
|
idx: l
|
|
366
366
|
}, A(g)];
|
|
367
367
|
}
|
|
368
|
-
function
|
|
368
|
+
function x(g, l, m) {
|
|
369
369
|
return !p.length || (p.call({
|
|
370
370
|
action: g,
|
|
371
371
|
location: l,
|
|
372
372
|
retry: m
|
|
373
373
|
}), !1);
|
|
374
374
|
}
|
|
375
|
-
function
|
|
375
|
+
function B(g) {
|
|
376
376
|
c = g;
|
|
377
377
|
var l = a();
|
|
378
378
|
u = l[0], h = l[1], P.call({
|
|
@@ -381,34 +381,34 @@ function Ze(e) {
|
|
|
381
381
|
});
|
|
382
382
|
}
|
|
383
383
|
function d(g, l) {
|
|
384
|
-
var m = C.Push, E =
|
|
384
|
+
var m = C.Push, E = v(g, l);
|
|
385
385
|
function S() {
|
|
386
386
|
d(g, l);
|
|
387
387
|
}
|
|
388
|
-
if (
|
|
389
|
-
var L =
|
|
388
|
+
if (x(m, E, S)) {
|
|
389
|
+
var L = R(E, u + 1), N = L[0], $ = L[1];
|
|
390
390
|
try {
|
|
391
391
|
o.pushState(N, "", $);
|
|
392
392
|
} catch {
|
|
393
393
|
r.location.assign($);
|
|
394
394
|
}
|
|
395
|
-
|
|
395
|
+
B(m);
|
|
396
396
|
}
|
|
397
397
|
}
|
|
398
|
-
function
|
|
399
|
-
var m = C.Replace, E =
|
|
398
|
+
function y(g, l) {
|
|
399
|
+
var m = C.Replace, E = v(g, l);
|
|
400
400
|
function S() {
|
|
401
|
-
|
|
401
|
+
y(g, l);
|
|
402
402
|
}
|
|
403
|
-
if (
|
|
404
|
-
var L =
|
|
405
|
-
o.replaceState(N, "", $),
|
|
403
|
+
if (x(m, E, S)) {
|
|
404
|
+
var L = R(E, u), N = L[0], $ = L[1];
|
|
405
|
+
o.replaceState(N, "", $), B(m);
|
|
406
406
|
}
|
|
407
407
|
}
|
|
408
408
|
function b(g) {
|
|
409
409
|
o.go(g);
|
|
410
410
|
}
|
|
411
|
-
var
|
|
411
|
+
var k = {
|
|
412
412
|
get action() {
|
|
413
413
|
return c;
|
|
414
414
|
},
|
|
@@ -417,7 +417,7 @@ function Ze(e) {
|
|
|
417
417
|
},
|
|
418
418
|
createHref: A,
|
|
419
419
|
push: d,
|
|
420
|
-
replace:
|
|
420
|
+
replace: y,
|
|
421
421
|
go: b,
|
|
422
422
|
back: function() {
|
|
423
423
|
b(-1);
|
|
@@ -435,7 +435,7 @@ function Ze(e) {
|
|
|
435
435
|
};
|
|
436
436
|
}
|
|
437
437
|
};
|
|
438
|
-
return
|
|
438
|
+
return k;
|
|
439
439
|
}
|
|
440
440
|
function $n(e) {
|
|
441
441
|
e === void 0 && (e = {});
|
|
@@ -463,9 +463,9 @@ function $n(e) {
|
|
|
463
463
|
action: l,
|
|
464
464
|
location: S,
|
|
465
465
|
retry: function() {
|
|
466
|
-
|
|
466
|
+
k(L * -1);
|
|
467
467
|
}
|
|
468
|
-
},
|
|
468
|
+
}, k(L));
|
|
469
469
|
} else
|
|
470
470
|
process.env.NODE_ENV !== "production" && Q(
|
|
471
471
|
!1,
|
|
@@ -494,27 +494,27 @@ function $n(e) {
|
|
|
494
494
|
}
|
|
495
495
|
return m;
|
|
496
496
|
}
|
|
497
|
-
function
|
|
497
|
+
function v(l) {
|
|
498
498
|
return A() + "#" + (typeof l == "string" ? l : G(l));
|
|
499
499
|
}
|
|
500
|
-
function
|
|
500
|
+
function R(l, m) {
|
|
501
501
|
return m === void 0 && (m = null), X(F({
|
|
502
502
|
pathname: h.pathname,
|
|
503
503
|
hash: "",
|
|
504
504
|
search: ""
|
|
505
505
|
}, typeof l == "string" ? ce(l) : l, {
|
|
506
506
|
state: m,
|
|
507
|
-
key:
|
|
507
|
+
key: ye()
|
|
508
508
|
}));
|
|
509
509
|
}
|
|
510
|
-
function
|
|
510
|
+
function x(l, m) {
|
|
511
511
|
return [{
|
|
512
512
|
usr: l.state,
|
|
513
513
|
key: l.key,
|
|
514
514
|
idx: m
|
|
515
|
-
},
|
|
515
|
+
}, v(l)];
|
|
516
516
|
}
|
|
517
|
-
function
|
|
517
|
+
function B(l, m, E) {
|
|
518
518
|
return !p.length || (p.call({
|
|
519
519
|
action: l,
|
|
520
520
|
location: m,
|
|
@@ -529,13 +529,13 @@ function $n(e) {
|
|
|
529
529
|
location: h
|
|
530
530
|
});
|
|
531
531
|
}
|
|
532
|
-
function
|
|
533
|
-
var E = C.Push, S =
|
|
532
|
+
function y(l, m) {
|
|
533
|
+
var E = C.Push, S = R(l, m);
|
|
534
534
|
function L() {
|
|
535
|
-
|
|
535
|
+
y(l, m);
|
|
536
536
|
}
|
|
537
|
-
if (process.env.NODE_ENV !== "production" && Q(S.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.push(" + JSON.stringify(l) + ")"),
|
|
538
|
-
var N =
|
|
537
|
+
if (process.env.NODE_ENV !== "production" && Q(S.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.push(" + JSON.stringify(l) + ")"), B(E, S, L)) {
|
|
538
|
+
var N = x(S, u + 1), $ = N[0], H = N[1];
|
|
539
539
|
try {
|
|
540
540
|
o.pushState($, "", H);
|
|
541
541
|
} catch {
|
|
@@ -545,16 +545,16 @@ function $n(e) {
|
|
|
545
545
|
}
|
|
546
546
|
}
|
|
547
547
|
function b(l, m) {
|
|
548
|
-
var E = C.Replace, S =
|
|
548
|
+
var E = C.Replace, S = R(l, m);
|
|
549
549
|
function L() {
|
|
550
550
|
b(l, m);
|
|
551
551
|
}
|
|
552
|
-
if (process.env.NODE_ENV !== "production" && Q(S.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.replace(" + JSON.stringify(l) + ")"),
|
|
553
|
-
var N =
|
|
552
|
+
if (process.env.NODE_ENV !== "production" && Q(S.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.replace(" + JSON.stringify(l) + ")"), B(E, S, L)) {
|
|
553
|
+
var N = x(S, u), $ = N[0], H = N[1];
|
|
554
554
|
o.replaceState($, "", H), d(E);
|
|
555
555
|
}
|
|
556
556
|
}
|
|
557
|
-
function
|
|
557
|
+
function k(l) {
|
|
558
558
|
o.go(l);
|
|
559
559
|
}
|
|
560
560
|
var g = {
|
|
@@ -564,15 +564,15 @@ function $n(e) {
|
|
|
564
564
|
get location() {
|
|
565
565
|
return h;
|
|
566
566
|
},
|
|
567
|
-
createHref:
|
|
568
|
-
push:
|
|
567
|
+
createHref: v,
|
|
568
|
+
push: y,
|
|
569
569
|
replace: b,
|
|
570
|
-
go:
|
|
570
|
+
go: k,
|
|
571
571
|
back: function() {
|
|
572
|
-
|
|
572
|
+
k(-1);
|
|
573
573
|
},
|
|
574
574
|
forward: function() {
|
|
575
|
-
|
|
575
|
+
k(1);
|
|
576
576
|
},
|
|
577
577
|
listen: function(m) {
|
|
578
578
|
return P.push(m);
|
|
@@ -589,63 +589,63 @@ function $n(e) {
|
|
|
589
589
|
function et(e) {
|
|
590
590
|
e === void 0 && (e = {});
|
|
591
591
|
var t = e, n = t.initialEntries, r = n === void 0 ? ["/"] : n, o = t.initialIndex, a = r.map(function(d) {
|
|
592
|
-
var
|
|
592
|
+
var y = X(F({
|
|
593
593
|
pathname: "/",
|
|
594
594
|
search: "",
|
|
595
595
|
hash: "",
|
|
596
596
|
state: null,
|
|
597
|
-
key:
|
|
597
|
+
key: ye()
|
|
598
598
|
}, typeof d == "string" ? ce(d) : d));
|
|
599
|
-
return process.env.NODE_ENV !== "production" && Q(
|
|
599
|
+
return process.env.NODE_ENV !== "production" && Q(y.pathname.charAt(0) === "/", "Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: " + JSON.stringify(d) + ")"), y;
|
|
600
600
|
}), s = tt(o ?? a.length - 1, 0, a.length - 1), i = C.Pop, c = a[s], f = Z(), u = Z();
|
|
601
601
|
function h(d) {
|
|
602
602
|
return typeof d == "string" ? d : G(d);
|
|
603
603
|
}
|
|
604
|
-
function P(d,
|
|
605
|
-
return
|
|
604
|
+
function P(d, y) {
|
|
605
|
+
return y === void 0 && (y = null), X(F({
|
|
606
606
|
pathname: c.pathname,
|
|
607
607
|
search: "",
|
|
608
608
|
hash: ""
|
|
609
609
|
}, typeof d == "string" ? ce(d) : d, {
|
|
610
|
-
state:
|
|
611
|
-
key:
|
|
610
|
+
state: y,
|
|
611
|
+
key: ye()
|
|
612
612
|
}));
|
|
613
613
|
}
|
|
614
|
-
function p(d,
|
|
614
|
+
function p(d, y, b) {
|
|
615
615
|
return !u.length || (u.call({
|
|
616
616
|
action: d,
|
|
617
|
-
location:
|
|
617
|
+
location: y,
|
|
618
618
|
retry: b
|
|
619
619
|
}), !1);
|
|
620
620
|
}
|
|
621
|
-
function A(d,
|
|
622
|
-
i = d, c =
|
|
621
|
+
function A(d, y) {
|
|
622
|
+
i = d, c = y, f.call({
|
|
623
623
|
action: i,
|
|
624
624
|
location: c
|
|
625
625
|
});
|
|
626
626
|
}
|
|
627
|
-
function
|
|
628
|
-
var b = C.Push,
|
|
627
|
+
function v(d, y) {
|
|
628
|
+
var b = C.Push, k = P(d, y);
|
|
629
629
|
function g() {
|
|
630
|
-
|
|
630
|
+
v(d, y);
|
|
631
631
|
}
|
|
632
|
-
process.env.NODE_ENV !== "production" && Q(c.pathname.charAt(0) === "/", "Relative pathnames are not supported in memory history.push(" + JSON.stringify(d) + ")"), p(b,
|
|
632
|
+
process.env.NODE_ENV !== "production" && Q(c.pathname.charAt(0) === "/", "Relative pathnames are not supported in memory history.push(" + JSON.stringify(d) + ")"), p(b, k, g) && (s += 1, a.splice(s, a.length, k), A(b, k));
|
|
633
633
|
}
|
|
634
|
-
function
|
|
635
|
-
var b = C.Replace,
|
|
634
|
+
function R(d, y) {
|
|
635
|
+
var b = C.Replace, k = P(d, y);
|
|
636
636
|
function g() {
|
|
637
|
-
|
|
637
|
+
R(d, y);
|
|
638
638
|
}
|
|
639
|
-
process.env.NODE_ENV !== "production" && Q(c.pathname.charAt(0) === "/", "Relative pathnames are not supported in memory history.replace(" + JSON.stringify(d) + ")"), p(b,
|
|
639
|
+
process.env.NODE_ENV !== "production" && Q(c.pathname.charAt(0) === "/", "Relative pathnames are not supported in memory history.replace(" + JSON.stringify(d) + ")"), p(b, k, g) && (a[s] = k, A(b, k));
|
|
640
640
|
}
|
|
641
|
-
function
|
|
642
|
-
var
|
|
641
|
+
function x(d) {
|
|
642
|
+
var y = tt(s + d, 0, a.length - 1), b = C.Pop, k = a[y];
|
|
643
643
|
function g() {
|
|
644
|
-
|
|
644
|
+
x(d);
|
|
645
645
|
}
|
|
646
|
-
p(b,
|
|
646
|
+
p(b, k, g) && (s = y, A(b, k));
|
|
647
647
|
}
|
|
648
|
-
var
|
|
648
|
+
var B = {
|
|
649
649
|
get index() {
|
|
650
650
|
return s;
|
|
651
651
|
},
|
|
@@ -656,23 +656,23 @@ function et(e) {
|
|
|
656
656
|
return c;
|
|
657
657
|
},
|
|
658
658
|
createHref: h,
|
|
659
|
-
push:
|
|
660
|
-
replace:
|
|
661
|
-
go:
|
|
659
|
+
push: v,
|
|
660
|
+
replace: R,
|
|
661
|
+
go: x,
|
|
662
662
|
back: function() {
|
|
663
|
-
|
|
663
|
+
x(-1);
|
|
664
664
|
},
|
|
665
665
|
forward: function() {
|
|
666
|
-
|
|
666
|
+
x(1);
|
|
667
667
|
},
|
|
668
|
-
listen: function(
|
|
669
|
-
return f.push(
|
|
668
|
+
listen: function(y) {
|
|
669
|
+
return f.push(y);
|
|
670
670
|
},
|
|
671
|
-
block: function(
|
|
672
|
-
return u.push(
|
|
671
|
+
block: function(y) {
|
|
672
|
+
return u.push(y);
|
|
673
673
|
}
|
|
674
674
|
};
|
|
675
|
-
return
|
|
675
|
+
return B;
|
|
676
676
|
}
|
|
677
677
|
function tt(e, t, n) {
|
|
678
678
|
return Math.min(Math.max(e, t), n);
|
|
@@ -700,7 +700,7 @@ function Z() {
|
|
|
700
700
|
}
|
|
701
701
|
};
|
|
702
702
|
}
|
|
703
|
-
function
|
|
703
|
+
function ye() {
|
|
704
704
|
return Math.random().toString(36).substr(2, 8);
|
|
705
705
|
}
|
|
706
706
|
function G(e) {
|
|
@@ -747,29 +747,29 @@ function qn(e) {
|
|
|
747
747
|
return typeof e == "object" && e !== null && kt in e;
|
|
748
748
|
}
|
|
749
749
|
function On(e, t) {
|
|
750
|
-
function n(
|
|
751
|
-
if (typeof
|
|
750
|
+
function n(v, R, x) {
|
|
751
|
+
if (typeof v == "object") {
|
|
752
752
|
const d = {
|
|
753
753
|
...e.params,
|
|
754
|
-
...
|
|
754
|
+
...v
|
|
755
755
|
};
|
|
756
|
-
return t(e.name, d,
|
|
756
|
+
return t(e.name, d, R);
|
|
757
757
|
}
|
|
758
|
-
const
|
|
758
|
+
const B = {
|
|
759
759
|
...e.params,
|
|
760
|
-
[
|
|
760
|
+
[v]: R
|
|
761
761
|
};
|
|
762
|
-
return t(e.name,
|
|
763
|
-
}
|
|
764
|
-
const r = (...
|
|
765
|
-
const
|
|
766
|
-
|
|
767
|
-
}, o = (...
|
|
768
|
-
const
|
|
769
|
-
|
|
770
|
-
}, a = (...
|
|
771
|
-
const
|
|
772
|
-
|
|
762
|
+
return t(e.name, B, x);
|
|
763
|
+
}
|
|
764
|
+
const r = (...v) => {
|
|
765
|
+
const R = new URLSearchParams(e.query.toString());
|
|
766
|
+
R.set(...v), n({}, { query: R });
|
|
767
|
+
}, o = (...v) => {
|
|
768
|
+
const R = new URLSearchParams(e.query.toString());
|
|
769
|
+
R.append(...v), n({}, { query: R });
|
|
770
|
+
}, a = (...v) => {
|
|
771
|
+
const R = new URLSearchParams(e.query.toString());
|
|
772
|
+
R.delete(...v), n({}, { query: R });
|
|
773
773
|
}, { id: s, matched: i, matches: c, name: f, query: u, params: h, state: P, hash: p } = en(e), A = je({
|
|
774
774
|
id: s,
|
|
775
775
|
matched: i,
|
|
@@ -783,16 +783,16 @@ function On(e, t) {
|
|
|
783
783
|
[kt]: !0
|
|
784
784
|
});
|
|
785
785
|
return new Proxy(A, {
|
|
786
|
-
get: (
|
|
787
|
-
set(
|
|
788
|
-
return n(d,
|
|
786
|
+
get: (v, R, x) => R === "params" ? new Proxy(e.params, {
|
|
787
|
+
set(B, d, y) {
|
|
788
|
+
return n(d, y), !0;
|
|
789
789
|
}
|
|
790
|
-
}) :
|
|
791
|
-
set(
|
|
792
|
-
return n({}, { state: { ...e.state, [d]:
|
|
790
|
+
}) : R === "state" ? new Proxy(e.state, {
|
|
791
|
+
set(B, d, y) {
|
|
792
|
+
return n({}, { state: { ...e.state, [d]: y } }), !0;
|
|
793
793
|
}
|
|
794
|
-
}) :
|
|
795
|
-
get(
|
|
794
|
+
}) : R === "query" ? new Proxy(e.query, {
|
|
795
|
+
get(B, d, y) {
|
|
796
796
|
switch (d) {
|
|
797
797
|
case "append":
|
|
798
798
|
return o;
|
|
@@ -801,10 +801,13 @@ function On(e, t) {
|
|
|
801
801
|
case "delete":
|
|
802
802
|
return a;
|
|
803
803
|
default:
|
|
804
|
-
return Reflect.get(
|
|
804
|
+
return Reflect.get(B, d, y);
|
|
805
805
|
}
|
|
806
806
|
}
|
|
807
|
-
}) : Reflect.get(
|
|
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
|
+
}
|
|
808
811
|
});
|
|
809
812
|
}
|
|
810
813
|
const Lt = Symbol();
|
|
@@ -877,7 +880,7 @@ function Tn({ mode: e, listener: t }) {
|
|
|
877
880
|
function In(e = "auto") {
|
|
878
881
|
switch (e) {
|
|
879
882
|
case "auto":
|
|
880
|
-
return
|
|
883
|
+
return vt() ? Ze() : et();
|
|
881
884
|
case "browser":
|
|
882
885
|
return Ze();
|
|
883
886
|
case "memory":
|
|
@@ -889,7 +892,7 @@ function In(e = "auto") {
|
|
|
889
892
|
throw new Error(`Switch is not exhaustive for mode: ${t}`);
|
|
890
893
|
}
|
|
891
894
|
}
|
|
892
|
-
class
|
|
895
|
+
class ve {
|
|
893
896
|
constructor() {
|
|
894
897
|
M(this, "onBeforeRouteEnter", /* @__PURE__ */ new Set());
|
|
895
898
|
M(this, "onBeforeRouteUpdate", /* @__PURE__ */ new Set());
|
|
@@ -916,7 +919,7 @@ class Be extends Error {
|
|
|
916
919
|
}
|
|
917
920
|
}
|
|
918
921
|
function Fn(e, t) {
|
|
919
|
-
const n = new
|
|
922
|
+
const n = new ve();
|
|
920
923
|
return e.matches.forEach((r, o) => {
|
|
921
924
|
r.onBeforeRouteEnter && _e(e, t, o) && z(r.onBeforeRouteEnter).forEach((a) => n.onBeforeRouteEnter.add(a)), r.onBeforeRouteUpdate && We(e, t, o) && z(r.onBeforeRouteUpdate).forEach((a) => n.onBeforeRouteUpdate.add(a));
|
|
922
925
|
}), t.matches.forEach((r, o) => {
|
|
@@ -924,7 +927,7 @@ function Fn(e, t) {
|
|
|
924
927
|
}), n;
|
|
925
928
|
}
|
|
926
929
|
function Jn(e, t) {
|
|
927
|
-
const n = new
|
|
930
|
+
const n = new ve();
|
|
928
931
|
return e.matches.forEach((r, o) => {
|
|
929
932
|
r.onAfterRouteEnter && _e(e, t, o) && z(r.onAfterRouteEnter).forEach((a) => n.onAfterRouteEnter.add(a)), r.onAfterRouteUpdate && We(e, t, o) && z(r.onAfterRouteUpdate).forEach((a) => n.onAfterRouteUpdate.add(a));
|
|
930
933
|
}), t.matches.forEach((r, o) => {
|
|
@@ -1059,8 +1062,8 @@ function rt(e) {
|
|
|
1059
1062
|
}
|
|
1060
1063
|
function Kn() {
|
|
1061
1064
|
const e = {
|
|
1062
|
-
global: new
|
|
1063
|
-
component: new
|
|
1065
|
+
global: new ve(),
|
|
1066
|
+
component: new ve()
|
|
1064
1067
|
};
|
|
1065
1068
|
function t({ lifecycle: r, timing: o, depth: a, hook: s }) {
|
|
1066
1069
|
const i = rt(r), c = e[o][r], f = (u, h) => {
|
|
@@ -1321,7 +1324,7 @@ class mr extends Error {
|
|
|
1321
1324
|
function gr(e) {
|
|
1322
1325
|
if (e)
|
|
1323
1326
|
return e;
|
|
1324
|
-
if (
|
|
1327
|
+
if (vt())
|
|
1325
1328
|
return window.location.toString();
|
|
1326
1329
|
throw new mr();
|
|
1327
1330
|
}
|
|
@@ -1335,11 +1338,11 @@ const Rr = (e, t) => {
|
|
|
1335
1338
|
}, Ot = (e, t) => {
|
|
1336
1339
|
const { pathname: n, search: r } = D(t);
|
|
1337
1340
|
return {
|
|
1338
|
-
...
|
|
1339
|
-
...
|
|
1341
|
+
...yr(e.path, n),
|
|
1342
|
+
...vr(e.query, r)
|
|
1340
1343
|
};
|
|
1341
1344
|
};
|
|
1342
|
-
function
|
|
1345
|
+
function yr(e, t) {
|
|
1343
1346
|
const n = {}, r = decodeURIComponent(t);
|
|
1344
1347
|
for (const [o, a] of Object.entries(e.params)) {
|
|
1345
1348
|
const s = o.startsWith("?"), i = s ? o.slice(1) : o, c = $t(r, e.value, o), f = ae(c, a, s);
|
|
@@ -1347,7 +1350,7 @@ function vr(e, t) {
|
|
|
1347
1350
|
}
|
|
1348
1351
|
return n;
|
|
1349
1352
|
}
|
|
1350
|
-
function
|
|
1353
|
+
function vr(e, t) {
|
|
1351
1354
|
const n = {}, r = new URLSearchParams(t);
|
|
1352
1355
|
for (const [o, a] of Object.entries(e.params)) {
|
|
1353
1356
|
const s = o.startsWith("?"), i = s ? o.slice(1) : o, c = r.get(i) ?? void 0, f = ae(c, a, s);
|
|
@@ -1482,9 +1485,9 @@ function Yr(e, t) {
|
|
|
1482
1485
|
Ur(r);
|
|
1483
1486
|
const o = qr(), a = dr(r), s = Tn({
|
|
1484
1487
|
mode: t == null ? void 0 : t.historyMode,
|
|
1485
|
-
listener: ({ location:
|
|
1486
|
-
const
|
|
1487
|
-
|
|
1488
|
+
listener: ({ location: w }) => {
|
|
1489
|
+
const U = G(w);
|
|
1490
|
+
R(U, { state: w.state });
|
|
1488
1491
|
}
|
|
1489
1492
|
}), { runBeforeRouteHooks: i, runAfterRouteHooks: c } = Gn(), {
|
|
1490
1493
|
hooks: f,
|
|
@@ -1493,25 +1496,25 @@ function Yr(e, t) {
|
|
|
1493
1496
|
onBeforeRouteLeave: P,
|
|
1494
1497
|
onAfterRouteEnter: p,
|
|
1495
1498
|
onBeforeRouteUpdate: A,
|
|
1496
|
-
onAfterRouteLeave:
|
|
1499
|
+
onAfterRouteLeave: v
|
|
1497
1500
|
} = zn();
|
|
1498
|
-
async function w
|
|
1499
|
-
if (s.stopListening(), H(
|
|
1500
|
-
s.update(
|
|
1501
|
+
async function R(w, U = {}) {
|
|
1502
|
+
if (s.stopListening(), H(w)) {
|
|
1503
|
+
s.update(w, U);
|
|
1501
1504
|
return;
|
|
1502
1505
|
}
|
|
1503
|
-
const q = Ue(r,
|
|
1506
|
+
const q = Ue(r, w, U.state) ?? g("NotFound"), O = { ...m }, K = await i({ to: q, from: O, hooks: f });
|
|
1504
1507
|
switch (K.status) {
|
|
1505
1508
|
case "ABORT":
|
|
1506
1509
|
return;
|
|
1507
1510
|
case "PUSH":
|
|
1508
|
-
s.update(
|
|
1511
|
+
s.update(w, U), await x(...K.to);
|
|
1509
1512
|
return;
|
|
1510
1513
|
case "REJECT":
|
|
1511
|
-
s.update(
|
|
1514
|
+
s.update(w, U), b(K.type);
|
|
1512
1515
|
break;
|
|
1513
1516
|
case "SUCCESS":
|
|
1514
|
-
s.update(
|
|
1517
|
+
s.update(w, U), b(null);
|
|
1515
1518
|
break;
|
|
1516
1519
|
default:
|
|
1517
1520
|
throw new Error(`Switch is not exhaustive for before hook response status: ${JSON.stringify(K)}`);
|
|
@@ -1520,7 +1523,7 @@ function Yr(e, t) {
|
|
|
1520
1523
|
const I = await c({ to: q, from: O, hooks: f });
|
|
1521
1524
|
switch (I.status) {
|
|
1522
1525
|
case "PUSH":
|
|
1523
|
-
await
|
|
1526
|
+
await x(...I.to);
|
|
1524
1527
|
break;
|
|
1525
1528
|
case "REJECT":
|
|
1526
1529
|
b(I.type);
|
|
@@ -1533,49 +1536,49 @@ function Yr(e, t) {
|
|
|
1533
1536
|
}
|
|
1534
1537
|
s.startListening();
|
|
1535
1538
|
}
|
|
1536
|
-
const
|
|
1537
|
-
if (_(
|
|
1538
|
-
const ne = { ...
|
|
1539
|
-
return
|
|
1539
|
+
const x = (w, U, q) => {
|
|
1540
|
+
if (_(w)) {
|
|
1541
|
+
const ne = { ...U }, Le = a(w, ne);
|
|
1542
|
+
return R(Le, ne);
|
|
1540
1543
|
}
|
|
1541
|
-
const O = { ...q }, I = a(
|
|
1542
|
-
return
|
|
1543
|
-
},
|
|
1544
|
-
if (_(
|
|
1545
|
-
const ne = { ...
|
|
1546
|
-
return
|
|
1544
|
+
const O = { ...q }, I = a(w, U ?? {}, O), W = Ye(w), ke = st((W == null ? void 0 : W.state) ?? {}, O.state);
|
|
1545
|
+
return R(I, { ...O, state: ke });
|
|
1546
|
+
}, B = (w, U, q) => {
|
|
1547
|
+
if (_(w)) {
|
|
1548
|
+
const ne = { ...U, replace: !0 }, Le = a(w, ne);
|
|
1549
|
+
return R(Le, ne);
|
|
1547
1550
|
}
|
|
1548
|
-
const O = { ...q, replace: !0 }, I = a(
|
|
1549
|
-
return
|
|
1550
|
-
}, d = (
|
|
1551
|
-
b(
|
|
1552
|
-
},
|
|
1553
|
-
if (!_(
|
|
1554
|
-
const q = a(
|
|
1551
|
+
const O = { ...q, replace: !0 }, I = a(w, U ?? {}, O), W = Ye(w), ke = st((W == null ? void 0 : W.state) ?? {}, O.state);
|
|
1552
|
+
return R(I, { ...O, state: ke });
|
|
1553
|
+
}, d = (w) => {
|
|
1554
|
+
b(w);
|
|
1555
|
+
}, y = (w, U = {}) => {
|
|
1556
|
+
if (!_(w)) {
|
|
1557
|
+
const q = a(w, U);
|
|
1555
1558
|
return Ue(r, q);
|
|
1556
1559
|
}
|
|
1557
|
-
if (!H(
|
|
1558
|
-
return Ue(r,
|
|
1559
|
-
}, { setRejection: b, rejection:
|
|
1560
|
+
if (!H(w))
|
|
1561
|
+
return Ue(r, w);
|
|
1562
|
+
}, { setRejection: b, rejection: k, getRejectionRoute: g } = Zn(t ?? {}), l = g("NotFound"), { currentRoute: m, routerRoute: E, updateRoute: S } = _n(l, x);
|
|
1560
1563
|
s.startListening();
|
|
1561
1564
|
const L = gr(t == null ? void 0 : t.initialUrl), N = s.location.state, { host: $ } = D(L), H = Mn($);
|
|
1562
1565
|
let xe = !1;
|
|
1563
1566
|
async function ze() {
|
|
1564
|
-
xe || (await
|
|
1567
|
+
xe || (await R(L, { replace: !0, state: N }), xe = !0);
|
|
1565
1568
|
}
|
|
1566
|
-
function Ye(
|
|
1567
|
-
return r.find((
|
|
1569
|
+
function Ye(w) {
|
|
1570
|
+
return r.find((U) => U.name === w);
|
|
1568
1571
|
}
|
|
1569
|
-
function Yt(
|
|
1570
|
-
|
|
1572
|
+
function Yt(w) {
|
|
1573
|
+
w.component("RouterView", Jr), w.component("RouterLink", Fr), w.provide(At, k), w.provide(Bt, f), w.provide(Jt, o), w.provide(xt, Xe), ze();
|
|
1571
1574
|
}
|
|
1572
1575
|
const Xe = {
|
|
1573
1576
|
route: E,
|
|
1574
1577
|
resolve: a,
|
|
1575
|
-
push:
|
|
1576
|
-
replace:
|
|
1578
|
+
push: x,
|
|
1579
|
+
replace: B,
|
|
1577
1580
|
reject: d,
|
|
1578
|
-
find:
|
|
1581
|
+
find: y,
|
|
1579
1582
|
refresh: s.refresh,
|
|
1580
1583
|
forward: s.forward,
|
|
1581
1584
|
back: s.back,
|
|
@@ -1587,7 +1590,7 @@ function Yr(e, t) {
|
|
|
1587
1590
|
onBeforeRouteLeave: P,
|
|
1588
1591
|
onAfterRouteEnter: p,
|
|
1589
1592
|
onBeforeRouteUpdate: A,
|
|
1590
|
-
onAfterRouteLeave:
|
|
1593
|
+
onAfterRouteLeave: v,
|
|
1591
1594
|
prefetch: t == null ? void 0 : t.prefetch,
|
|
1592
1595
|
start: ze
|
|
1593
1596
|
};
|
|
@@ -1640,7 +1643,7 @@ function ee(e) {
|
|
|
1640
1643
|
depth: 1,
|
|
1641
1644
|
host: Dt("", {}),
|
|
1642
1645
|
prefetch: e.prefetch
|
|
1643
|
-
}, u = Rt(e) ?
|
|
1646
|
+
}, u = Rt(e) ? yt(e.parent, f) : f;
|
|
1644
1647
|
return te(u.path.params, u.query.params), u;
|
|
1645
1648
|
}
|
|
1646
1649
|
const Ee = { template: "<div>This is component</div>" }, Qe = ee({
|
|
@@ -1691,11 +1694,11 @@ function qr() {
|
|
|
1691
1694
|
});
|
|
1692
1695
|
}, r = (c) => {
|
|
1693
1696
|
const u = c.matches.flatMap(s).reduce((h, { id: P, name: p, props: A }) => {
|
|
1694
|
-
const
|
|
1695
|
-
if (!A || e.has(
|
|
1697
|
+
const v = a(P, p, c);
|
|
1698
|
+
if (!A || e.has(v))
|
|
1696
1699
|
return h;
|
|
1697
|
-
const
|
|
1698
|
-
return e.set(
|
|
1700
|
+
const R = A(c.params);
|
|
1701
|
+
return e.set(v, R), h.push(v), h;
|
|
1699
1702
|
}, []);
|
|
1700
1703
|
i(u);
|
|
1701
1704
|
}, o = (c, f, u) => {
|
|
@@ -1765,14 +1768,14 @@ function Wr(e, t = {}, n = {}) {
|
|
|
1765
1768
|
return o.value;
|
|
1766
1769
|
try {
|
|
1767
1770
|
return r.resolve(o.value, a.value, s.value);
|
|
1768
|
-
} catch (
|
|
1769
|
-
throw
|
|
1771
|
+
} catch (v) {
|
|
1772
|
+
throw v instanceof Y && console.error(`Failed to resolve route "${o.value.toString()}" in RouterLink.`, v), v;
|
|
1770
1773
|
}
|
|
1771
1774
|
}), c = V(() => r.find(i.value, s.value)), f = V(() => !!c.value && r.route.matches.includes(c.value.matched)), u = V(() => !!c.value && r.route.matched === c.value.matched), h = V(() => r.isExternal(i.value)), { commit: P } = _r(() => ({
|
|
1772
1775
|
route: c.value,
|
|
1773
1776
|
routerPrefetch: r.prefetch,
|
|
1774
1777
|
linkPrefetch: s.value.prefetch
|
|
1775
|
-
})), p = (
|
|
1778
|
+
})), p = (v) => (P(), r.push(i.value, { ...s.value, ...v }));
|
|
1776
1779
|
return {
|
|
1777
1780
|
route: c,
|
|
1778
1781
|
href: i,
|
|
@@ -1780,7 +1783,7 @@ function Wr(e, t = {}, n = {}) {
|
|
|
1780
1783
|
isExactMatch: u,
|
|
1781
1784
|
isExternal: h,
|
|
1782
1785
|
push: p,
|
|
1783
|
-
replace: (
|
|
1786
|
+
replace: (v) => p(v)
|
|
1784
1787
|
};
|
|
1785
1788
|
}
|
|
1786
1789
|
function Mr(e, t, { exact: n } = {}) {
|
|
@@ -1903,11 +1906,11 @@ function ro(e) {
|
|
|
1903
1906
|
meta: s,
|
|
1904
1907
|
depth: 1,
|
|
1905
1908
|
state: {}
|
|
1906
|
-
}, u = Rt(e) ?
|
|
1909
|
+
}, u = Rt(e) ? yt(e.parent, f) : f;
|
|
1907
1910
|
return te(u.path.params, u.query.params, u.host.params), u;
|
|
1908
1911
|
}
|
|
1909
1912
|
export {
|
|
1910
|
-
|
|
1913
|
+
yn as DuplicateParamsError,
|
|
1911
1914
|
Fr as RouterLink,
|
|
1912
1915
|
Se as RouterNotInstalledError,
|
|
1913
1916
|
Jr as RouterView,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(y,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],l):(y=typeof globalThis<"u"?globalThis:y||self,l(y["@kitbag/router"]={},y.Vue))})(this,function(y,l){"use strict";var Ur=Object.defineProperty;var Nr=(y,l,_)=>l in y?Ur(y,l,{enumerable:!0,configurable:!0,writable:!0,value:_}):y[l]=_;var F=(y,l,_)=>Nr(y,typeof l!="symbol"?l+"":l,_);class _ extends Error{constructor(){super("Router not installed")}}function oe(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Yt(e){return e.every(t=>Array.isArray(t))}function ae(e){return typeof e=="string"&&e.length>0}function le(e){return{value:ae(e)?e.replace(/^#*/,""):void 0}}function Xt(e,t){return le(`${e.value??""}${t.value??""}`)}class Zt extends Error{constructor(t){super(`Child property on meta for ${t} conflicts with the parent meta.`)}}function en(e,t){return tn(e,t),{...e,...t}}function tn(e,t){const n=Object.keys(e).find(r=>r in t&&typeof t[r]!=typeof e[r]);if(n)throw new Zt(n)}class Qe extends Error{constructor(t){super(`Invalid Param "${t}": Router does not support multiple params by the same name. All param names must be unique.`)}}function X(e){return Array.isArray(e)?e:[e]}function Ke(e,t){return e.filter(n=>t===n).length}function Z(...e){const t=e.flatMap(n=>Array.isArray(n)?n:Object.keys(n).map(nn));for(const n of t)if(Ke(t,n)>1)throw new Qe(n)}function nn(e){return e.startsWith("?")?e.slice(1):e}function rn(e,t){return Z(e.params,t.params),{value:`${e.value}${t.value}`,params:{...e.params,...t.params}}}function on(e,t){return Z(e.params,t.params),{value:[e.value,t.value].filter(ae).join("&"),params:{...e.params,...t.params}}}function an(e,t){return Z(e,t),{...e,...t}}function sn(e){return"host"in e&&!!e.host}function Ge(e){return"parent"in e&&!!e.parent}function Se(e){return"component"in e&&!!e.component}function be(e){return"components"in e&&!!e.components}function cn(e){return"state"in e&&!!e.state}function ze(e,t){return{...t,path:rn(e.path,t.path),query:on(e.query,t.query),meta:en(e.meta,t.meta),state:an(e.state,t.state),hash:Xt(e.hash,t.hash),matches:[...e.matches,t.matched],host:e.host,depth:e.depth+1}}function Ye(){return typeof window<"u"&&typeof window.document<"u"}function Xe(e,t){return l.defineComponent({name:"PropsWrapper",expose:[],setup(){const n=t();return"then"in n?()=>l.h(un(e,n)):()=>l.h(e,n)}})}function un(e,t){return l.defineComponent({name:"AsyncPropsWrapper",expose:[],setup(){const n=l.ref();return(async()=>n.value=await t)(),()=>n.value?l.h(e,n.value):""}})}class ee extends Error{}const T="[",J="]";function fn(e){return e!==String&&e!==Boolean&&e!==Number&&e!==Date}function ln(e){return typeof e=="function"&&fn(e)}function he(e){return typeof e=="object"&&"get"in e&&typeof e.get=="function"&&"set"in e&&typeof e.set=="function"}function Ze(e){return he(e)&&e.defaultValue!==void 0}function hn(e,t){return ot(e,t)}function pn(e,t){return e[t]??String}const $={invalid:e=>{throw new ee(e)}},dn={get:e=>e,set:(e,{invalid:t})=>{if(typeof e!="string")throw t();return e}},et={get:(e,{invalid:t})=>{if(e==="true")return!0;if(e==="false")return!1;throw t()},set:(e,{invalid:t})=>{if(typeof e!="boolean")throw t();return e.toString()}},tt={get:(e,{invalid:t})=>{const n=Number(e);if(isNaN(n))throw t();return n},set:(e,{invalid:t})=>{if(typeof e!="number")throw t();return e.toString()}},nt={get:(e,{invalid:t})=>{const n=new Date(e);if(isNaN(n.getTime()))throw t();return n},set:(e,{invalid:t})=>{if(typeof e!="object"||!(e instanceof Date))throw t();return e.toISOString()}},rt={get:(e,{invalid:t})=>{try{return JSON.parse(e)}catch{throw t()}},set:(e,{invalid:t})=>{try{return JSON.stringify(e)}catch{throw t()}}};function se(e,t,n=!1){if(e===void 0||!ae(e)){if(Ze(t))return t.defaultValue;if(n)return;throw new ee}if(t===String)return dn.get(e,$);if(t===Boolean)return et.get(e,$);if(t===Number)return tt.get(e,$);if(t===Date)return nt.get(e,$);if(t===JSON)return rt.get(e,$);if(ln(t))return t(e,$);if(he(t))return t.get(e,$);if(t instanceof RegExp){if(t.test(e))return e;throw new ee}return e}function ce(e,t,n=!1){if(e===void 0){if(n)return"";throw new ee}if(t===Boolean)return et.set(e,$);if(t===Number)return tt.set(e,$);if(t===Date)return nt.set(e,$);if(t===JSON)return rt.set(e,$);if(he(t))return t.set(e,$);try{return e.toString()}catch{throw new ee}}function ot(e,t){return he(e)?{...e,defaultValue:t??e.defaultValue}:{get:n=>se(n,e),set:n=>ce(n,e),defaultValue:t}}function Q(){return Q=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Q.apply(this,arguments)}var H;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(H||(H={}));var te=process.env.NODE_ENV!=="production"?function(e){return Object.freeze(e)}:function(e){return e};function G(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}var pe="beforeunload",mn="hashchange",at="popstate";function st(e){e===void 0&&(e={});var t=e,n=t.window,r=n===void 0?document.defaultView:n,o=r.history;function a(){var g=r.location,h=g.pathname,R=g.search,b=g.hash,A=o.state||{};return[A.idx,te({pathname:h,search:R,hash:b,state:A.usr||null,key:A.key||"default"})]}var s=null;function i(){if(s)d.call(s),s=null;else{var g=H.Pop,h=a(),R=h[0],b=h[1];if(d.length)if(R!=null){var A=u-R;A&&(s={action:g,location:b,retry:function(){k(A*-1)}},k(A))}else process.env.NODE_ENV!=="production"&&G(!1,"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.");else C(g)}}r.addEventListener(at,i);var c=H.Pop,f=a(),u=f[0],p=f[1],S=ne(),d=ne();u==null&&(u=0,o.replaceState(Q({},o.state,{idx:u}),""));function x(g){return typeof g=="string"?g:z(g)}function P(g,h){return h===void 0&&(h=null),te(Q({pathname:p.pathname,hash:"",search:""},typeof g=="string"?ue(g):g,{state:h,key:me()}))}function E(g,h){return[{usr:g.state,key:g.key,idx:h},x(g)]}function B(g,h,R){return!d.length||(d.call({action:g,location:h,retry:R}),!1)}function C(g){c=g;var h=a();u=h[0],p=h[1],S.call({action:c,location:p})}function m(g,h){var R=H.Push,b=P(g,h);function A(){m(g,h)}if(B(R,b,A)){var U=E(b,u+1),j=U[0],q=U[1];try{o.pushState(j,"",q)}catch{r.location.assign(q)}C(R)}}function w(g,h){var R=H.Replace,b=P(g,h);function A(){w(g,h)}if(B(R,b,A)){var U=E(b,u),j=U[0],q=U[1];o.replaceState(j,"",q),C(R)}}function k(g){o.go(g)}var L={get action(){return c},get location(){return p},createHref:x,push:m,replace:w,go:k,back:function(){k(-1)},forward:function(){k(1)},listen:function(h){return S.push(h)},block:function(h){var R=d.push(h);return d.length===1&&r.addEventListener(pe,de),function(){R(),d.length||r.removeEventListener(pe,de)}}};return L}function Rn(e){e===void 0&&(e={});var t=e,n=t.window,r=n===void 0?document.defaultView:n,o=r.history;function a(){var h=ue(r.location.hash.substr(1)),R=h.pathname,b=R===void 0?"/":R,A=h.search,U=A===void 0?"":A,j=h.hash,q=j===void 0?"":j,V=o.state||{};return[V.idx,te({pathname:b,search:U,hash:q,state:V.usr||null,key:V.key||"default"})]}var s=null;function i(){if(s)d.call(s),s=null;else{var h=H.Pop,R=a(),b=R[0],A=R[1];if(d.length)if(b!=null){var U=u-b;U&&(s={action:h,location:A,retry:function(){L(U*-1)}},L(U))}else process.env.NODE_ENV!=="production"&&G(!1,"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.");else m(h)}}r.addEventListener(at,i),r.addEventListener(mn,function(){var h=a(),R=h[1];z(R)!==z(p)&&i()});var c=H.Pop,f=a(),u=f[0],p=f[1],S=ne(),d=ne();u==null&&(u=0,o.replaceState(Q({},o.state,{idx:u}),""));function x(){var h=document.querySelector("base"),R="";if(h&&h.getAttribute("href")){var b=r.location.href,A=b.indexOf("#");R=A===-1?b:b.slice(0,A)}return R}function P(h){return x()+"#"+(typeof h=="string"?h:z(h))}function E(h,R){return R===void 0&&(R=null),te(Q({pathname:p.pathname,hash:"",search:""},typeof h=="string"?ue(h):h,{state:R,key:me()}))}function B(h,R){return[{usr:h.state,key:h.key,idx:R},P(h)]}function C(h,R,b){return!d.length||(d.call({action:h,location:R,retry:b}),!1)}function m(h){c=h;var R=a();u=R[0],p=R[1],S.call({action:c,location:p})}function w(h,R){var b=H.Push,A=E(h,R);function U(){w(h,R)}if(process.env.NODE_ENV!=="production"&&G(A.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.push("+JSON.stringify(h)+")"),C(b,A,U)){var j=B(A,u+1),q=j[0],V=j[1];try{o.pushState(q,"",V)}catch{r.location.assign(V)}m(b)}}function k(h,R){var b=H.Replace,A=E(h,R);function U(){k(h,R)}if(process.env.NODE_ENV!=="production"&&G(A.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.replace("+JSON.stringify(h)+")"),C(b,A,U)){var j=B(A,u),q=j[0],V=j[1];o.replaceState(q,"",V),m(b)}}function L(h){o.go(h)}var g={get action(){return c},get location(){return p},createHref:P,push:w,replace:k,go:L,back:function(){L(-1)},forward:function(){L(1)},listen:function(R){return S.push(R)},block:function(R){var b=d.push(R);return d.length===1&&r.addEventListener(pe,de),function(){b(),d.length||r.removeEventListener(pe,de)}}};return g}function ct(e){e===void 0&&(e={});var t=e,n=t.initialEntries,r=n===void 0?["/"]:n,o=t.initialIndex,a=r.map(function(m){var w=te(Q({pathname:"/",search:"",hash:"",state:null,key:me()},typeof m=="string"?ue(m):m));return process.env.NODE_ENV!=="production"&&G(w.pathname.charAt(0)==="/","Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(m)+")"),w}),s=ut(o??a.length-1,0,a.length-1),i=H.Pop,c=a[s],f=ne(),u=ne();function p(m){return typeof m=="string"?m:z(m)}function S(m,w){return w===void 0&&(w=null),te(Q({pathname:c.pathname,search:"",hash:""},typeof m=="string"?ue(m):m,{state:w,key:me()}))}function d(m,w,k){return!u.length||(u.call({action:m,location:w,retry:k}),!1)}function x(m,w){i=m,c=w,f.call({action:i,location:c})}function P(m,w){var k=H.Push,L=S(m,w);function g(){P(m,w)}process.env.NODE_ENV!=="production"&&G(c.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.push("+JSON.stringify(m)+")"),d(k,L,g)&&(s+=1,a.splice(s,a.length,L),x(k,L))}function E(m,w){var k=H.Replace,L=S(m,w);function g(){E(m,w)}process.env.NODE_ENV!=="production"&&G(c.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.replace("+JSON.stringify(m)+")"),d(k,L,g)&&(a[s]=L,x(k,L))}function B(m){var w=ut(s+m,0,a.length-1),k=H.Pop,L=a[w];function g(){B(m)}d(k,L,g)&&(s=w,x(k,L))}var C={get index(){return s},get action(){return i},get location(){return c},createHref:p,push:P,replace:E,go:B,back:function(){B(-1)},forward:function(){B(1)},listen:function(w){return f.push(w)},block:function(w){return u.push(w)}};return C}function ut(e,t,n){return Math.min(Math.max(e,t),n)}function de(e){e.preventDefault(),e.returnValue=""}function ne(){var e=[];return{get length(){return e.length},push:function(n){return e.push(n),function(){e=e.filter(function(r){return r!==n})}},call:function(n){e.forEach(function(r){return r&&r(n)})}}}function me(){return Math.random().toString(36).substr(2,8)}function z(e){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;return o&&o!=="?"&&(n+=o.charAt(0)==="?"?o:"?"+o),s&&s!=="#"&&(n+=s.charAt(0)==="#"?s:"#"+s),n}function ue(e){var t={};if(e){var n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));var r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}class it extends Error{constructor(t,n){super(`useRoute called with incorrect route. Given ${t}, expected ${n}`)}}const Ae=Symbol();function ft(){const e=l.inject(Ae);if(!e)throw new _;return e}const ke=Symbol();function Re(){const e=l.inject(ke);if(!e)throw new _;return e}const lt=Symbol("isRouterRouteSymbol");function gn(e){return typeof e=="object"&&e!==null&< in e}function yn(e,t){function n(P,E,B){if(typeof P=="object"){const m={...e.params,...P};return t(e.name,m,E)}const C={...e.params,[P]:E};return t(e.name,C,B)}const r=(...P)=>{const E=new URLSearchParams(e.query.toString());E.set(...P),n({},{query:E})},o=(...P)=>{const E=new URLSearchParams(e.query.toString());E.append(...P),n({},{query:E})},a=(...P)=>{const E=new URLSearchParams(e.query.toString());E.delete(...P),n({},{query:E})},{id:s,matched:i,matches:c,name:f,query:u,params:p,state:S,hash:d}=l.toRefs(e),x=l.reactive({id:s,matched:i,matches:c,state:S,query:u,hash:d,params:p,name:f,update:n,[lt]:!0});return new Proxy(x,{get:(P,E,B)=>E==="params"?new Proxy(e.params,{set(C,m,w){return n(m,w),!0}}):E==="state"?new Proxy(e.state,{set(C,m,w){return n({},{state:{...e.state,[m]:w}}),!0}}):E==="query"?new Proxy(e.query,{get(C,m,w){switch(m){case"append":return o;case"set":return r;case"delete":return a;default:return Reflect.get(C,m,w)}}}):Reflect.get(P,E,B)})}const ht=Symbol();function wn(e,t){const n=l.reactive({...e}),r=s=>{Object.assign(n,{[ht]:!1,...s})},o=n,a=yn(o,t);return{currentRoute:o,routerRoute:a,updateRoute:r}}function D(e){return!e.startsWith("http")?Pn(e):vn(e)}function vn(e){const{protocol:t,host:n,pathname:r,search:o,searchParams:a,hash:s}=new URL(e,e);return{protocol:t,host:n,pathname:r,search:o,searchParams:a,hash:s}}function Pn(e){const{pathname:t,search:n,searchParams:r,hash:o}=new URL(e,"https://localhost");return{pathname:t,search:n,searchParams:r,hash:o}}function En(e){return t=>{const{host:n}=D(t);return!(n===void 0||n===e)}}function Sn({mode:e,listener:t}){const n=bn(e),r=(c,f)=>{if(f!=null&&f.replace){n.replace(c,f.state);return}n.push(c,f==null?void 0:f.state)},o=()=>{const c=z(n.location);n.replace(c)};let a;return{...n,update:r,refresh:o,startListening:()=>{a==null||a(),a=n.listen(t)},stopListening:()=>{a==null||a()}}}function bn(e="auto"){switch(e){case"auto":return Ye()?st():ct();case"browser":return st();case"memory":return ct();case"hash":return Rn();default:const t=e;throw new Error(`Switch is not exhaustive for mode: ${t}`)}}class ge{constructor(){F(this,"onBeforeRouteEnter",new Set);F(this,"onBeforeRouteUpdate",new Set);F(this,"onBeforeRouteLeave",new Set);F(this,"onAfterRouteEnter",new Set);F(this,"onAfterRouteUpdate",new Set);F(this,"onAfterRouteLeave",new Set)}}class pt extends Error{}class ie extends Error{constructor(n){super("Error occurred during a router push operation.");F(this,"to");this.to=n}}class xe extends Error{constructor(n){super(`Routing action rejected: ${n}`);F(this,"type");this.type=n}}function An(e,t){const n=new ge;return e.matches.forEach((r,o)=>{r.onBeforeRouteEnter&&Le(e,t,o)&&X(r.onBeforeRouteEnter).forEach(a=>n.onBeforeRouteEnter.add(a)),r.onBeforeRouteUpdate&&Ue(e,t,o)&&X(r.onBeforeRouteUpdate).forEach(a=>n.onBeforeRouteUpdate.add(a))}),t.matches.forEach((r,o)=>{r.onBeforeRouteLeave&&Be(e,t,o)&&X(r.onBeforeRouteLeave).forEach(a=>n.onBeforeRouteLeave.add(a))}),n}function kn(e,t){const n=new ge;return e.matches.forEach((r,o)=>{r.onAfterRouteEnter&&Le(e,t,o)&&X(r.onAfterRouteEnter).forEach(a=>n.onAfterRouteEnter.add(a)),r.onAfterRouteUpdate&&Ue(e,t,o)&&X(r.onAfterRouteUpdate).forEach(a=>n.onAfterRouteUpdate.add(a))}),t.matches.forEach((r,o)=>{r.onAfterRouteLeave&&Be(e,t,o)&&X(r.onAfterRouteLeave).forEach(a=>n.onAfterRouteLeave.add(a))}),n}function O(e){return typeof e!="string"?!1:/^(https?:\/\/|\/).*/g.test(e)}function dt(e){return O(e)?e:`/${e}`}function xn(){const e=s=>{throw new xe(s)},t=(...s)=>{throw new ie(s)},n=(s,i,c)=>{if(O(s)){const p=i??{};throw new ie([s,{...p,replace:!0}])}const f=i,u=c??{};throw new ie([s,f,{...u,replace:!0}])},r=()=>{throw new pt};async function o({to:s,from:i,hooks:c}){const{global:f,component:u}=c,p=An(s,i),S=[...f.onBeforeRouteEnter,...p.onBeforeRouteEnter,...f.onBeforeRouteUpdate,...p.onBeforeRouteUpdate,...u.onBeforeRouteUpdate,...f.onBeforeRouteLeave,...p.onBeforeRouteLeave,...u.onBeforeRouteLeave];try{const d=S.map(x=>x(s,{from:i,reject:e,push:t,replace:n,abort:r}));await Promise.all(d)}catch(d){if(d instanceof ie)return{status:"PUSH",to:d.to};if(d instanceof xe)return{status:"REJECT",type:d.type};if(d instanceof pt)return{status:"ABORT"};throw d}return{status:"SUCCESS"}}async function a({to:s,from:i,hooks:c}){const{global:f,component:u}=c,p=kn(s,i),S=[...u.onAfterRouteLeave,...p.onAfterRouteLeave,...f.onAfterRouteLeave,...u.onAfterRouteUpdate,...p.onAfterRouteUpdate,...f.onAfterRouteUpdate,...u.onAfterRouteEnter,...p.onAfterRouteEnter,...f.onAfterRouteEnter];try{const d=S.map(x=>x(s,{from:i,reject:e,push:t,replace:n}));await Promise.all(d)}catch(d){if(d instanceof ie)return{status:"PUSH",to:d.to};if(d instanceof xe)return{status:"REJECT",type:d.type};throw d}return{status:"SUCCESS"}}return{runBeforeRouteHooks:o,runAfterRouteHooks:a}}const Le=(e,t,n)=>{const r=e.matches,o=(t==null?void 0:t.matches)??[];return r.length<n||r[n]!==o[n]},Be=(e,t,n)=>{const r=e.matches,o=(t==null?void 0:t.matches)??[];return r.length<n||r[n]!==o[n]},Ue=(e,t,n)=>e.matches[n]===(t==null?void 0:t.matches[n]);function mt(e){switch(e){case"onBeforeRouteEnter":case"onAfterRouteEnter":return Le;case"onBeforeRouteUpdate":case"onAfterRouteUpdate":return Ue;case"onBeforeRouteLeave":case"onAfterRouteLeave":return Be;default:throw new Error(`Switch is not exhaustive for lifecycle: ${e}`)}}function Ln(){const e={global:new ge,component:new ge};function t({lifecycle:r,timing:o,depth:a,hook:s}){const i=mt(r),c=e[o][r],f=(u,p)=>{if(i(u,p.from,a))return s(u,p)};return c.add(f),()=>c.delete(f)}function n({lifecycle:r,timing:o,depth:a,hook:s}){const i=mt(r),c=e[o][r],f=(u,p)=>{if(i(u,p.from,a))return s(u,p)};return c.add(f),()=>c.delete(f)}return{...e,addBeforeRouteHook:t,addAfterRouteHook:n}}const Rt=Symbol();function Bn(){const e=Ln();return{onBeforeRouteEnter:i=>e.addBeforeRouteHook({lifecycle:"onBeforeRouteEnter",hook:i,timing:"global",depth:0}),onBeforeRouteUpdate:i=>e.addBeforeRouteHook({lifecycle:"onBeforeRouteUpdate",hook:i,timing:"global",depth:0}),onBeforeRouteLeave:i=>e.addBeforeRouteHook({lifecycle:"onBeforeRouteLeave",hook:i,timing:"global",depth:0}),onAfterRouteEnter:i=>e.addAfterRouteHook({lifecycle:"onAfterRouteEnter",hook:i,timing:"global",depth:0}),onAfterRouteUpdate:i=>e.addAfterRouteHook({lifecycle:"onAfterRouteUpdate",hook:i,timing:"global",depth:0}),onAfterRouteLeave:i=>e.addAfterRouteHook({lifecycle:"onAfterRouteLeave",hook:i,timing:"global",depth:0}),hooks:e}}function Un(e){return l.defineComponent(()=>()=>l.h("h1",e),{name:e,props:[]})}function gt(e){const t=new URLSearchParams(e);return{get:(...n)=>t.get(...n),getAll:(...n)=>t.getAll(...n),set:(...n)=>{t.set(...n)},append:(...n)=>{t.append(...n)},delete:(...n)=>{t.delete(...n)},toString:(...n)=>t.toString(...n),forEach:(...n)=>{t.forEach(...n)},entries:(...n)=>t.entries(...n),keys:(...n)=>t.keys(...n),values:(...n)=>t.values(...n),has:(...n)=>t.has(...n)}}function Nn(){let e=0;return()=>(++e).toString()}const Ne=Nn();function Cn({rejections:e}){const t=a=>{const s={...e};return l.markRaw(s[a]??Un(a))},n=a=>{const s=l.markRaw(t(a)),i={id:Ne(),component:s,meta:{},state:{}};return{id:i.id,matched:i,matches:[i],name:a,query:gt(""),params:{},state:{},[ht]:!0}},r=a=>{if(!a){o.value=null;return}const s=t(a);o.value={type:a,component:s}},o=l.ref(null);return{setRejection:r,rejection:o,getRejectionRoute:n}}class jn extends Error{constructor(t){super(`Route not found: "${t}"`)}}function Ce(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Hn(e,t){const n=Array.from(e.matchAll(t));if(n.length===0)return[e];let r=0;const o=n.reduce((s,i)=>{const c=Ce(e.slice(r,i.index));c.length&&s.push(c);const[f]=i;return s.push(f),r=i.index+f.length,s},[]),a=e.slice(r);return a&&o.push(a),o}function Vn(e){const t=yt(e.path.value);return new RegExp(`^${t}$`,"i")}function $n(e){const t=new URLSearchParams(e.query.value);return Array.from(t.entries()).filter(([,n])=>!He(n)).map(([n,r])=>{const o=yt(r);return new RegExp(`${Ce(n)}=${o}(&|$)`,"i")})}function yt(e){return Hn(e,new RegExp(qn,"g")).map(t=>t.startsWith(T)?wt(t):Ce(t)).join("")}function wt(e){return[On,_n].reduce((t,n)=>n(t),e)}const qn=`\\${T}\\??([\\w-_]+)\\${J}`,je=`\\${T}\\?([\\w-_]+)\\${J}`,vt=`\\${T}([\\w-_]+)\\${J}`;function On(e){return e.replace(new RegExp(je,"g"),".*")}function He(e){return new RegExp(je,"g").test(e)}function _n(e){return e.replace(new RegExp(vt,"g"),".+")}function ye(e){const[t]=we(e,new RegExp(je,"g")),[n]=we(e,new RegExp(vt,"g"));return t??n}function we(e,t){return Array.from(e.matchAll(t)).flatMap(([,...r])=>r.map(o=>ae(o)?o:""))}function Pt(e,t,n){const r=St(t,n),[o]=we(e,r);return o}function Et(e,t){if(!t)return e;const{name:n,param:r,value:o}=t,a=St(e,n);return we(e,a).reduce((i,c)=>c===void 0?i:i.replace(c,()=>ce(o,r,n.startsWith("?"))),e)}function St(e,t){const n=[Dn,Wn,wt].reduce((r,o)=>o(r,t),e);return new RegExp(n,"g")}function Dn(e,t){if(!t.startsWith("?"))return e;const n=new RegExp(`\\${T}\\${t}\\${J}`,"g");return e.replace(n,"(.*)")}function Wn(e,t){if(t.startsWith("?"))return e;const n=new RegExp(`\\${T}${t}\\${J}`,"g");return e.replace(n,"(.+)")}function bt({protocol:e,host:t,pathname:n,search:r,searchParams:o,hash:a}){const s=new URL("https://localhost");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);const i=s.toString().replace(/^https:\/\/localhost\/*/,"/");return dt(i)}function Mn(e,t){const n=new URLSearchParams(e),r=new URLSearchParams(t);for(const[o,a]of r.entries())n.append(o,a);return n}function Tn(e,t={}){const{params:n={},query:r}=t,o=Jn(e.query,n),a=Mn(o,r),s=Fn(e.path,n),i=le(e.hash.value??t.hash).value,c=In(e.host,n),{protocol:f,host:u}=D(c);return bt({protocol:f,host:u,pathname:s,searchParams:a,hash:i})}function In(e,t){const n=e.value&&!e.value.startsWith("http")?`https://${e.value}`:e.value;return Object.entries(e.params).reduce((r,[o,a])=>{const s=ye(`${T}${o}${J}`);return s?Et(r,{name:o,param:a,value:t[s]}):r},n)}function Fn(e,t){return Object.entries(e.params).reduce((n,[r,o])=>{const a=ye(`${T}${r}${J}`);return a?Et(n,{name:r,param:o,value:t[a]}):n},e.value)}function Jn(e,t){const n=new URLSearchParams(e.value);if(!e.value)return n;for(const[r,o]of n.entries()){const a=ye(o);if(!a)continue;const i=ce(t[a],e.params[a],He(o)),c=t[a]===void 0&&i==="";He(o)&&c?n.delete(r,o):n.set(r,i)}return n}function Qn(e){return(t,n,r)=>{if(O(t)){const c=n??{},{searchParams:f,...u}=D(t);return Object.entries(c.query??{}).forEach(([p,S])=>{f.append(p,S)}),bt({...u,searchParams:f})}const o=n??{},a=r??{},s=e.find(c=>c.name===t);if(!s)throw new jn(String(t));return Tn(s,{params:o,query:a.query,hash:a.hash})}}class Kn extends Error{constructor(){super("initialUrl must be set if window.location is unavailable")}}function Gn(e){if(e)return e;if(Ye())return window.location.toString();throw new Kn}const zn=(e,t)=>{try{At(e,t)}catch{return!1}return!0},At=(e,t)=>{const{pathname:n,search:r}=D(t);return{...Yn(e.path,n),...Xn(e.query,r)}};function Yn(e,t){const n={},r=decodeURIComponent(t);for(const[o,a]of Object.entries(e.params)){const s=o.startsWith("?"),i=s?o.slice(1):o,c=Pt(r,e.value,o),f=se(c,a,s);n[i]=f}return n}function Xn(e,t){const n={},r=new URLSearchParams(t);for(const[o,a]of Object.entries(e.params)){const s=o.startsWith("?"),i=s?o.slice(1):o,c=r.get(i)??void 0,f=se(c,a,s);n[i]=f}return n}const Zn=e=>"name"in e.matched&&!!e.matched.name,er=(e,t)=>{const{pathname:n}=D(t);return Vn(e).test(n)},tr=(e,t)=>{const{search:n}=D(t);return $n(e).every(o=>o.test(n))},Ve=(e,t)=>{const{hash:n}=D(t),{value:r}=e.hash;return r===void 0||`#${r.toLowerCase()}`===n.toLowerCase()};function nr(e){const{searchParams:t,pathname:n}=D(e),r=-1,o=1;return(a,s)=>{const i=xt(a,t),c=kt(a,n),f=xt(s,t),u=kt(s,n);return a.depth>s.depth?r:a.depth<s.depth?o:i+c>f+u?r:i+c<f+u?o:Ve(a,e)?r:Ve(s,e)?o:0}}function kt(e,t){const n=Object.keys(e.path.params).filter(o=>o.startsWith("?")).map(o=>o),r=n.filter(o=>Pt(t,e.path.value,o)===void 0);return n.length-r.length}function xt(e,t){const n=new URLSearchParams(e.query.value),r=Array.from(n.keys()),o=r.filter(a=>!t.has(a));return r.length-o.length}function Lt(e){return!!e&&typeof e=="object"}const ve=!0;function rr(e,t,n){if(Lt(e)&&t in e){const r=e[t];if(typeof r=="string")return se(r,n,ve)}return se(void 0,n,ve)}function or(e,t){const n={};for(const[r,o]of Object.entries(e)){const a=rr(t,r,o);n[r]=a}return n}function ar(e,t,n){if(Lt(e)&&t in e){const r=e[t];return ce(r,n,ve)}return ce(void 0,n,ve)}const Bt=(e,t)=>{const n={};for(const[r,o]of Object.entries(e)){const a=ar(t,r,o);n[r]=a}return n},sr=[Zn,er,tr,Ve,zn];function $e(e,t,n){const r=nr(t),o=e.filter(c=>sr.every(f=>f(c,t))).sort(r);if(o.length===0)return;const[a]=o,{search:s,hash:i}=D(t);return{id:a.id,matched:a.matched,matches:a.matches,name:a.name,query:gt(s),params:At(a,t),state:or(a.state,n),hash:i}}function qe(e,t){const n=new RegExp(`\\${T}(\\??[\\w-_]+)\\${J}`,"g");return Array.from(e.matchAll(n)).reduce((o,[a,s])=>{const i=ye(a);if(!i)return o;const c=pn(t,i);return Z([i],o),o[s]=c,o},{})}function Pe(e,t){return{value:e,params:qe(e,t)}}function cr(e,t){return ae(t)?e.map(n=>{const r=`${t}${n.path.value}`;return{...n,path:Pe(r,n.path.params)}}):e}class ur extends Error{constructor(t){super(`Invalid Name "${t}": Router does not support multiple routes with the same name. All name names must be unique.`)}}function ir(e){const t=e.map(({name:n})=>n);for(const n of t)if(Ke(t,n)>1)throw new ur(n)}function fr(e,t){const n=Yt(e)?e.flat():e,r=cr(n,t==null?void 0:t.base);ir(r);const o=gr(),a=Qn(r),s=Sn({mode:t==null?void 0:t.historyMode,listener:({location:v})=>{const N=z(v);E(N,{state:v.state})}}),{runBeforeRouteHooks:i,runAfterRouteHooks:c}=xn(),{hooks:f,onBeforeRouteEnter:u,onAfterRouteUpdate:p,onBeforeRouteLeave:S,onAfterRouteEnter:d,onBeforeRouteUpdate:x,onAfterRouteLeave:P}=Bn();async function E(v,N={}){if(s.stopListening(),V(v)){s.update(v,N);return}const W=$e(r,v,N.state)??g("NotFound"),M={...R},re=await i({to:W,from:M,hooks:f});switch(re.status){case"ABORT":return;case"PUSH":s.update(v,N),await B(...re.to);return;case"REJECT":s.update(v,N),k(re.type);break;case"SUCCESS":s.update(v,N),k(null);break;default:throw new Error(`Switch is not exhaustive for before hook response status: ${JSON.stringify(re)}`)}o.setProps(W),A(W);const K=await c({to:W,from:M,hooks:f});switch(K.status){case"PUSH":await B(...K.to);break;case"REJECT":k(K.type);break;case"SUCCESS":break;default:const I=K;throw new Error(`Switch is not exhaustive for after hook response status: ${JSON.stringify(I)}`)}s.startListening()}const B=(v,N,W)=>{if(O(v)){const fe={...N},Je=a(v,fe);return E(Je,fe)}const M={...W},K=a(v,N??{},M),I=Gt(v),Fe=Bt((I==null?void 0:I.state)??{},M.state);return E(K,{...M,state:Fe})},C=(v,N,W)=>{if(O(v)){const fe={...N,replace:!0},Je=a(v,fe);return E(Je,fe)}const M={...W,replace:!0},K=a(v,N??{},M),I=Gt(v),Fe=Bt((I==null?void 0:I.state)??{},M.state);return E(K,{...M,state:Fe})},m=v=>{k(v)},w=(v,N={})=>{if(!O(v)){const W=a(v,N);return $e(r,W)}if(!V(v))return $e(r,v)},{setRejection:k,rejection:L,getRejectionRoute:g}=Cn(t??{}),h=g("NotFound"),{currentRoute:R,routerRoute:b,updateRoute:A}=wn(h,B);s.startListening();const U=Gn(t==null?void 0:t.initialUrl),j=s.location.state,{host:q}=D(U),V=En(q);let Ie=!1;async function Kt(){Ie||(await E(U,{replace:!0,state:j}),Ie=!0)}function Gt(v){return r.find(N=>N.name===v)}function Br(v){v.component("RouterView",Jt),v.component("RouterLink",Ft),v.provide(Ae,L),v.provide(Rt,f),v.provide($t,o),v.provide(ke,zt),Kt()}const zt={route:b,resolve:a,push:B,replace:C,reject:m,find:w,refresh:s.refresh,forward:s.forward,back:s.back,go:s.go,install:Br,isExternal:V,onBeforeRouteEnter:u,onAfterRouteUpdate:p,onBeforeRouteLeave:S,onAfterRouteEnter:d,onBeforeRouteUpdate:x,onAfterRouteLeave:P,prefetch:t==null?void 0:t.prefetch,start:Kt};return zt}function Oe(e,t){return{value:e,params:qe(e,t)}}function Ut(e,t){return{value:e,params:qe(e,t)}}function lr(e){return oe(e)&&typeof e.hash=="string"}function Nt(e){return e===void 0?le():lr(e)?e:le(e)}function _e(e){return e===void 0?"":e}function hr(e){return oe(e)&&typeof e.value=="string"}function Ct(e){return e===void 0?Pe("",{}):hr(e)?e:Pe(e,{})}function pr(e){return oe(e)&&typeof e.value=="string"}function jt(e){return e===void 0?Oe("",{}):pr(e)?e:Oe(e,{})}function Y(e){const t=Ne(),n=_e(e.name),r=Ct(e.path),o=jt(e.query),a=Nt(e.hash),s=e.meta??{},i=cn(e)?e.state:{},c=l.markRaw({id:t,meta:{},state:{},...e}),f={id:t,matched:c,matches:[c],name:n,path:r,query:o,hash:a,meta:s,state:i,depth:1,host:Ut("",{}),prefetch:e.prefetch},u=Ge(e)?ze(e.parent,f):f;return Z(u.path.params,u.query.params),u}const Ee={template:"<div>This is component</div>"},De=Y({name:"parentA",path:"/parentA/[paramA]"}),Ht=Y({parent:De,name:"parentA.childA",path:"/[?paramB]"}),dr=Y({parent:De,name:"parentA.childB",path:"/[paramD]",component:Ee}),mr=Y({parent:Ht,name:"parentA.childA.grandChildA",path:"/[paramC]",component:Ee});Y({name:"parentB",path:"/parentB",component:Ee}),Y({name:"parentC",path:"/",component:Ee});const Rr={components:!0,props:!1};function Vt({routerPrefetch:e,routePrefetch:t,linkPrefetch:n},r){return We(n,r)??We(t,r)??We(e,r)??Rr[r]}function We(e,t){return oe(e)?e[t]:e}const $t=Symbol();function gr(){const e=l.reactive(new Map),t=(c,f)=>c.matches.filter(u=>Vt({...f,routePrefetch:u.prefetch},"props")).flatMap(u=>s(u)).reduce((u,{id:p,name:S,props:d})=>{const x=a(p,S,c);return u[x]=d==null?void 0:d(c.params),u},{}),n=c=>{Object.entries(c).forEach(([f,u])=>{e.set(f,u)})},r=c=>{const u=c.matches.flatMap(s).reduce((p,{id:S,name:d,props:x})=>{const P=a(S,d,c);if(!x||e.has(P))return p;const E=x(c.params);return e.set(P,E),p.push(P),p},[]);i(u)},o=(c,f,u)=>{const p=a(c,f,u);return e.get(p)};function a(c,f,u){return[c,f,u.id,JSON.stringify(u.params)].join("-")}function s(c){return be(c)?Object.entries(c.props??{}).map(([f,u])=>({id:c.id,name:f,props:u})):Se(c)?[{id:c.id,name:"default",props:c.props}]:[]}function i(c){for(const f in e.keys())c.includes(f)||e.delete(f)}return{getPrefetchProps:t,setPrefetchProps:n,getProps:o,setProps:r}}function qt(){const e=l.inject($t);if(!e)throw new _;return e}const yr=l.defineAsyncComponent(()=>new Promise(e=>{e({default:{template:"foo"}})}));function Ot(e){return e.name===yr.name&&"setup"in e}function wr(e){let t={};const{getPrefetchProps:n,setPrefetchProps:r}=qt();return l.watch(()=>l.toValue(e),({route:a,...s})=>{a&&(vr(a,s),t=n(a,s))},{immediate:!0}),{commit:()=>{r(t)}}}function vr(e,{routerPrefetch:t,linkPrefetch:n}){e.matches.forEach(r=>{Vt({routePrefetch:r.prefetch,routerPrefetch:t,linkPrefetch:n},"components")&&(Se(r)&&Ot(r.component)&&r.component.setup(),be(r)&&Object.values(r.components).forEach(a=>{Ot(a)&&a.setup()}))})}function _t(e,t={},n={}){const r=Re(),o=l.toRef(e),a=l.computed(()=>O(o.value)?{}:l.toValue(t)),s=l.computed(()=>O(o.value)?l.toValue(t):l.toValue(n)),i=l.computed(()=>{if(O(o.value))return o.value;try{return r.resolve(o.value,a.value,s.value)}catch(P){throw P instanceof ee&&console.error(`Failed to resolve route "${o.value.toString()}" in RouterLink.`,P),P}}),c=l.computed(()=>r.find(i.value,s.value)),f=l.computed(()=>!!c.value&&r.route.matches.includes(c.value.matched)),u=l.computed(()=>!!c.value&&r.route.matched===c.value.matched),p=l.computed(()=>r.isExternal(i.value)),{commit:S}=wr(()=>({route:c.value,routerPrefetch:r.prefetch,linkPrefetch:s.value.prefetch})),d=P=>(S(),r.push(i.value,{...s.value,...P}));return{route:c,href:i,isMatch:f,isExactMatch:u,isExternal:p,push:d,replace:P=>d(P)}}function Dt(e,t,{exact:n}={}){if(!gn(e))return!1;if(t===void 0)return!0;const r=e.matches.map(o=>_e(o.name));if(n){const o=r.at(-1);return t===o}return r.includes(t)}function Wt(e,t){const n=Re();function r(){if(!e)return;if(!Dt(n.route,e,t))throw new it(e,n.route.name)}return l.watch(n.route,r,{immediate:!0,deep:!0}),n.route}const Mt=Symbol();function Me(){return l.inject(Mt,0)}function Tt(){const e=l.inject(Rt);if(!e)throw new _;return e}function It(e){return t=>{const n=Me(),o=Tt().addBeforeRouteHook({lifecycle:e,hook:t,depth:n,timing:"component"});return l.onUnmounted(o),o}}function Te(e){return t=>{const n=Me(),o=Tt().addAfterRouteHook({lifecycle:e,hook:t,depth:n,timing:"component"});return l.onUnmounted(o),o}}const Pr=It("onBeforeRouteUpdate"),Er=It("onBeforeRouteLeave"),Sr=Te("onAfterRouteEnter"),br=Te("onAfterRouteUpdate"),Ar=Te("onAfterRouteLeave"),kr=["href"],Ft=l.defineComponent({__name:"routerLink",props:{to:{},prefetch:{type:[Boolean,Object],default:void 0},query:{},hash:{},replace:{type:Boolean},state:{}},setup(e){const t=e,n=Re(),r=l.computed(()=>O(t.to)?t.to:t.to(n.resolve)),o=l.computed(()=>{const{to:p,...S}=t;return S}),{isMatch:a,isExactMatch:s,isExternal:i,push:c}=_t(r,o),f=l.computed(()=>({"router-link--match":a.value,"router-link--exact-match":s.value}));function u(p){p.preventDefault(),c()}return(p,S)=>(l.openBlock(),l.createElementBlock("a",{href:r.value,class:l.normalizeClass(["router-link",f.value]),onClick:u},[l.renderSlot(p.$slots,"default",l.normalizeProps(l.guardReactiveProps({resolved:r.value,isMatch:l.unref(a),isExactMatch:l.unref(s),isExternal:l.unref(i)})))],10,kr))}}),Jt=l.defineComponent({__name:"routerView",props:{name:{}},setup(e){const{name:t="default"}=e,n=Wt(),r=ft(),o=Me(),{getProps:a}=qt(),s=l.resolveComponent("RouterView",!0);l.provide(Mt,o+1);const i=l.computed(()=>{if(r.value)return r.value.component;const u=n.matches.at(o);if(!u)return null;const p=c(u),S=a(u.id,t,n);return p?S?Xe(p,()=>S):p:null});function c(u){return f(u)[t]}function f(u){return be(u)?u.components:Se(u)?{default:u.component}:typeof s=="string"?{}:{default:s}}return(u,p)=>i.value?l.renderSlot(u.$slots,"default",l.normalizeProps(l.mergeProps({key:0},{route:l.unref(n),component:i.value,rejection:l.unref(r)})),()=>[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(i.value)))]):l.createCommentVNode("",!0)}});function xr(e){return oe(e)&&typeof e.value=="string"}function Qt(e){return xr(e)?e:Ut(e,{})}function Lr(e){const t=Ne(),n=_e(e.name),r=Ct(e.path),o=jt(e.query),a=Nt(e.hash),s=e.meta??{},i=sn(e)?Qt(e.host):Qt(""),c=l.markRaw({id:t,meta:{},state:{},...e}),f={id:t,matched:c,matches:[c],name:n,host:i,path:r,query:o,hash:a,meta:s,depth:1,state:{}},u=Ge(e)?ze(e.parent,f):f;return Z(u.path.params,u.query.params,u.host.params),u}y.DuplicateParamsError=Qe,y.RouterLink=Ft,y.RouterNotInstalledError=_,y.RouterView=Jt,y.UseRouteInvalidError=it,y.asUrl=dt,y.component=Xe,y.createExternalRoute=Lr,y.createParam=ot,y.createRoute=Y,y.createRouter=fr,y.isParamWithDefault=Ze,y.isRoute=Dt,y.isUrl=O,y.onAfterRouteEnter=Sr,y.onAfterRouteLeave=br,y.onAfterRouteUpdate=Ar,y.onBeforeRouteLeave=Pr,y.onBeforeRouteUpdate=Er,y.path=Pe,y.query=Oe,y.routerInjectionKey=ke,y.routerRejectionKey=Ae,y.useLink=_t,y.useRejection=ft,y.useRoute=Wt,y.useRouter=Re,y.withDefault=hn,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(y,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],l):(y=typeof globalThis<"u"?globalThis:y||self,l(y["@kitbag/router"]={},y.Vue))})(this,function(y,l){"use strict";var Ur=Object.defineProperty;var Nr=(y,l,_)=>l in y?Ur(y,l,{enumerable:!0,configurable:!0,writable:!0,value:_}):y[l]=_;var F=(y,l,_)=>Nr(y,typeof l!="symbol"?l+"":l,_);class _ extends Error{constructor(){super("Router not installed")}}function oe(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Yt(e){return e.every(t=>Array.isArray(t))}function ae(e){return typeof e=="string"&&e.length>0}function le(e){return{value:ae(e)?e.replace(/^#*/,""):void 0}}function Xt(e,t){return le(`${e.value??""}${t.value??""}`)}class Zt extends Error{constructor(t){super(`Child property on meta for ${t} conflicts with the parent meta.`)}}function en(e,t){return tn(e,t),{...e,...t}}function tn(e,t){const n=Object.keys(e).find(r=>r in t&&typeof t[r]!=typeof e[r]);if(n)throw new Zt(n)}class Qe extends Error{constructor(t){super(`Invalid Param "${t}": Router does not support multiple params by the same name. All param names must be unique.`)}}function X(e){return Array.isArray(e)?e:[e]}function Ke(e,t){return e.filter(n=>t===n).length}function Z(...e){const t=e.flatMap(n=>Array.isArray(n)?n:Object.keys(n).map(nn));for(const n of t)if(Ke(t,n)>1)throw new Qe(n)}function nn(e){return e.startsWith("?")?e.slice(1):e}function rn(e,t){return Z(e.params,t.params),{value:`${e.value}${t.value}`,params:{...e.params,...t.params}}}function on(e,t){return Z(e.params,t.params),{value:[e.value,t.value].filter(ae).join("&"),params:{...e.params,...t.params}}}function an(e,t){return Z(e,t),{...e,...t}}function sn(e){return"host"in e&&!!e.host}function Ge(e){return"parent"in e&&!!e.parent}function Se(e){return"component"in e&&!!e.component}function be(e){return"components"in e&&!!e.components}function cn(e){return"state"in e&&!!e.state}function ze(e,t){return{...t,path:rn(e.path,t.path),query:on(e.query,t.query),meta:en(e.meta,t.meta),state:an(e.state,t.state),hash:Xt(e.hash,t.hash),matches:[...e.matches,t.matched],host:e.host,depth:e.depth+1}}function Ye(){return typeof window<"u"&&typeof window.document<"u"}function Xe(e,t){return l.defineComponent({name:"PropsWrapper",expose:[],setup(){const n=t();return"then"in n?()=>l.h(un(e,n)):()=>l.h(e,n)}})}function un(e,t){return l.defineComponent({name:"AsyncPropsWrapper",expose:[],setup(){const n=l.ref();return(async()=>n.value=await t)(),()=>n.value?l.h(e,n.value):""}})}class ee extends Error{}const T="[",J="]";function fn(e){return e!==String&&e!==Boolean&&e!==Number&&e!==Date}function ln(e){return typeof e=="function"&&fn(e)}function he(e){return typeof e=="object"&&"get"in e&&typeof e.get=="function"&&"set"in e&&typeof e.set=="function"}function Ze(e){return he(e)&&e.defaultValue!==void 0}function hn(e,t){return ot(e,t)}function pn(e,t){return e[t]??String}const $={invalid:e=>{throw new ee(e)}},dn={get:e=>e,set:(e,{invalid:t})=>{if(typeof e!="string")throw t();return e}},et={get:(e,{invalid:t})=>{if(e==="true")return!0;if(e==="false")return!1;throw t()},set:(e,{invalid:t})=>{if(typeof e!="boolean")throw t();return e.toString()}},tt={get:(e,{invalid:t})=>{const n=Number(e);if(isNaN(n))throw t();return n},set:(e,{invalid:t})=>{if(typeof e!="number")throw t();return e.toString()}},nt={get:(e,{invalid:t})=>{const n=new Date(e);if(isNaN(n.getTime()))throw t();return n},set:(e,{invalid:t})=>{if(typeof e!="object"||!(e instanceof Date))throw t();return e.toISOString()}},rt={get:(e,{invalid:t})=>{try{return JSON.parse(e)}catch{throw t()}},set:(e,{invalid:t})=>{try{return JSON.stringify(e)}catch{throw t()}}};function se(e,t,n=!1){if(e===void 0||!ae(e)){if(Ze(t))return t.defaultValue;if(n)return;throw new ee}if(t===String)return dn.get(e,$);if(t===Boolean)return et.get(e,$);if(t===Number)return tt.get(e,$);if(t===Date)return nt.get(e,$);if(t===JSON)return rt.get(e,$);if(ln(t))return t(e,$);if(he(t))return t.get(e,$);if(t instanceof RegExp){if(t.test(e))return e;throw new ee}return e}function ce(e,t,n=!1){if(e===void 0){if(n)return"";throw new ee}if(t===Boolean)return et.set(e,$);if(t===Number)return tt.set(e,$);if(t===Date)return nt.set(e,$);if(t===JSON)return rt.set(e,$);if(he(t))return t.set(e,$);try{return e.toString()}catch{throw new ee}}function ot(e,t){return he(e)?{...e,defaultValue:t??e.defaultValue}:{get:n=>se(n,e),set:n=>ce(n,e),defaultValue:t}}function Q(){return Q=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Q.apply(this,arguments)}var H;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(H||(H={}));var te=process.env.NODE_ENV!=="production"?function(e){return Object.freeze(e)}:function(e){return e};function G(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}var pe="beforeunload",mn="hashchange",at="popstate";function st(e){e===void 0&&(e={});var t=e,n=t.window,r=n===void 0?document.defaultView:n,o=r.history;function a(){var g=r.location,h=g.pathname,R=g.search,b=g.hash,A=o.state||{};return[A.idx,te({pathname:h,search:R,hash:b,state:A.usr||null,key:A.key||"default"})]}var s=null;function i(){if(s)d.call(s),s=null;else{var g=H.Pop,h=a(),R=h[0],b=h[1];if(d.length)if(R!=null){var A=u-R;A&&(s={action:g,location:b,retry:function(){k(A*-1)}},k(A))}else process.env.NODE_ENV!=="production"&&G(!1,"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.");else N(g)}}r.addEventListener(at,i);var c=H.Pop,f=a(),u=f[0],p=f[1],S=ne(),d=ne();u==null&&(u=0,o.replaceState(Q({},o.state,{idx:u}),""));function x(g){return typeof g=="string"?g:z(g)}function P(g,h){return h===void 0&&(h=null),te(Q({pathname:p.pathname,hash:"",search:""},typeof g=="string"?ue(g):g,{state:h,key:me()}))}function w(g,h){return[{usr:g.state,key:g.key,idx:h},x(g)]}function L(g,h,R){return!d.length||(d.call({action:g,location:h,retry:R}),!1)}function N(g){c=g;var h=a();u=h[0],p=h[1],S.call({action:c,location:p})}function m(g,h){var R=H.Push,b=P(g,h);function A(){m(g,h)}if(L(R,b,A)){var U=w(b,u+1),j=U[0],q=U[1];try{o.pushState(j,"",q)}catch{r.location.assign(q)}N(R)}}function v(g,h){var R=H.Replace,b=P(g,h);function A(){v(g,h)}if(L(R,b,A)){var U=w(b,u),j=U[0],q=U[1];o.replaceState(j,"",q),N(R)}}function k(g){o.go(g)}var B={get action(){return c},get location(){return p},createHref:x,push:m,replace:v,go:k,back:function(){k(-1)},forward:function(){k(1)},listen:function(h){return S.push(h)},block:function(h){var R=d.push(h);return d.length===1&&r.addEventListener(pe,de),function(){R(),d.length||r.removeEventListener(pe,de)}}};return B}function Rn(e){e===void 0&&(e={});var t=e,n=t.window,r=n===void 0?document.defaultView:n,o=r.history;function a(){var h=ue(r.location.hash.substr(1)),R=h.pathname,b=R===void 0?"/":R,A=h.search,U=A===void 0?"":A,j=h.hash,q=j===void 0?"":j,V=o.state||{};return[V.idx,te({pathname:b,search:U,hash:q,state:V.usr||null,key:V.key||"default"})]}var s=null;function i(){if(s)d.call(s),s=null;else{var h=H.Pop,R=a(),b=R[0],A=R[1];if(d.length)if(b!=null){var U=u-b;U&&(s={action:h,location:A,retry:function(){B(U*-1)}},B(U))}else process.env.NODE_ENV!=="production"&&G(!1,"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.");else m(h)}}r.addEventListener(at,i),r.addEventListener(mn,function(){var h=a(),R=h[1];z(R)!==z(p)&&i()});var c=H.Pop,f=a(),u=f[0],p=f[1],S=ne(),d=ne();u==null&&(u=0,o.replaceState(Q({},o.state,{idx:u}),""));function x(){var h=document.querySelector("base"),R="";if(h&&h.getAttribute("href")){var b=r.location.href,A=b.indexOf("#");R=A===-1?b:b.slice(0,A)}return R}function P(h){return x()+"#"+(typeof h=="string"?h:z(h))}function w(h,R){return R===void 0&&(R=null),te(Q({pathname:p.pathname,hash:"",search:""},typeof h=="string"?ue(h):h,{state:R,key:me()}))}function L(h,R){return[{usr:h.state,key:h.key,idx:R},P(h)]}function N(h,R,b){return!d.length||(d.call({action:h,location:R,retry:b}),!1)}function m(h){c=h;var R=a();u=R[0],p=R[1],S.call({action:c,location:p})}function v(h,R){var b=H.Push,A=w(h,R);function U(){v(h,R)}if(process.env.NODE_ENV!=="production"&&G(A.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.push("+JSON.stringify(h)+")"),N(b,A,U)){var j=L(A,u+1),q=j[0],V=j[1];try{o.pushState(q,"",V)}catch{r.location.assign(V)}m(b)}}function k(h,R){var b=H.Replace,A=w(h,R);function U(){k(h,R)}if(process.env.NODE_ENV!=="production"&&G(A.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.replace("+JSON.stringify(h)+")"),N(b,A,U)){var j=L(A,u),q=j[0],V=j[1];o.replaceState(q,"",V),m(b)}}function B(h){o.go(h)}var g={get action(){return c},get location(){return p},createHref:P,push:v,replace:k,go:B,back:function(){B(-1)},forward:function(){B(1)},listen:function(R){return S.push(R)},block:function(R){var b=d.push(R);return d.length===1&&r.addEventListener(pe,de),function(){b(),d.length||r.removeEventListener(pe,de)}}};return g}function ct(e){e===void 0&&(e={});var t=e,n=t.initialEntries,r=n===void 0?["/"]:n,o=t.initialIndex,a=r.map(function(m){var v=te(Q({pathname:"/",search:"",hash:"",state:null,key:me()},typeof m=="string"?ue(m):m));return process.env.NODE_ENV!=="production"&&G(v.pathname.charAt(0)==="/","Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(m)+")"),v}),s=ut(o??a.length-1,0,a.length-1),i=H.Pop,c=a[s],f=ne(),u=ne();function p(m){return typeof m=="string"?m:z(m)}function S(m,v){return v===void 0&&(v=null),te(Q({pathname:c.pathname,search:"",hash:""},typeof m=="string"?ue(m):m,{state:v,key:me()}))}function d(m,v,k){return!u.length||(u.call({action:m,location:v,retry:k}),!1)}function x(m,v){i=m,c=v,f.call({action:i,location:c})}function P(m,v){var k=H.Push,B=S(m,v);function g(){P(m,v)}process.env.NODE_ENV!=="production"&&G(c.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.push("+JSON.stringify(m)+")"),d(k,B,g)&&(s+=1,a.splice(s,a.length,B),x(k,B))}function w(m,v){var k=H.Replace,B=S(m,v);function g(){w(m,v)}process.env.NODE_ENV!=="production"&&G(c.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.replace("+JSON.stringify(m)+")"),d(k,B,g)&&(a[s]=B,x(k,B))}function L(m){var v=ut(s+m,0,a.length-1),k=H.Pop,B=a[v];function g(){L(m)}d(k,B,g)&&(s=v,x(k,B))}var N={get index(){return s},get action(){return i},get location(){return c},createHref:p,push:P,replace:w,go:L,back:function(){L(-1)},forward:function(){L(1)},listen:function(v){return f.push(v)},block:function(v){return u.push(v)}};return N}function ut(e,t,n){return Math.min(Math.max(e,t),n)}function de(e){e.preventDefault(),e.returnValue=""}function ne(){var e=[];return{get length(){return e.length},push:function(n){return e.push(n),function(){e=e.filter(function(r){return r!==n})}},call:function(n){e.forEach(function(r){return r&&r(n)})}}}function me(){return Math.random().toString(36).substr(2,8)}function z(e){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;return o&&o!=="?"&&(n+=o.charAt(0)==="?"?o:"?"+o),s&&s!=="#"&&(n+=s.charAt(0)==="#"?s:"#"+s),n}function ue(e){var t={};if(e){var n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));var r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}class it extends Error{constructor(t,n){super(`useRoute called with incorrect route. Given ${t}, expected ${n}`)}}const Ae=Symbol();function ft(){const e=l.inject(Ae);if(!e)throw new _;return e}const ke=Symbol();function Re(){const e=l.inject(ke);if(!e)throw new _;return e}const lt=Symbol("isRouterRouteSymbol");function gn(e){return typeof e=="object"&&e!==null&< in e}function yn(e,t){function n(P,w,L){if(typeof P=="object"){const m={...e.params,...P};return t(e.name,m,w)}const N={...e.params,[P]:w};return t(e.name,N,L)}const r=(...P)=>{const w=new URLSearchParams(e.query.toString());w.set(...P),n({},{query:w})},o=(...P)=>{const w=new URLSearchParams(e.query.toString());w.append(...P),n({},{query:w})},a=(...P)=>{const w=new URLSearchParams(e.query.toString());w.delete(...P),n({},{query:w})},{id:s,matched:i,matches:c,name:f,query:u,params:p,state:S,hash:d}=l.toRefs(e),x=l.reactive({id:s,matched:i,matches:c,state:S,query:u,hash:d,params:p,name:f,update:n,[lt]:!0});return new Proxy(x,{get:(P,w,L)=>w==="params"?new Proxy(e.params,{set(N,m,v){return n(m,v),!0}}):w==="state"?new Proxy(e.state,{set(N,m,v){return n({},{state:{...e.state,[m]:v}}),!0}}):w==="query"?new Proxy(e.query,{get(N,m,v){switch(m){case"append":return o;case"set":return r;case"delete":return a;default:return Reflect.get(N,m,v)}}}):Reflect.get(P,w,L),set(P,w,L,N){return w==="query"?(n({},{query:L}),!0):Reflect.set(P,w,L,N)}})}const ht=Symbol();function wn(e,t){const n=l.reactive({...e}),r=s=>{Object.assign(n,{[ht]:!1,...s})},o=n,a=yn(o,t);return{currentRoute:o,routerRoute:a,updateRoute:r}}function D(e){return!e.startsWith("http")?Pn(e):vn(e)}function vn(e){const{protocol:t,host:n,pathname:r,search:o,searchParams:a,hash:s}=new URL(e,e);return{protocol:t,host:n,pathname:r,search:o,searchParams:a,hash:s}}function Pn(e){const{pathname:t,search:n,searchParams:r,hash:o}=new URL(e,"https://localhost");return{pathname:t,search:n,searchParams:r,hash:o}}function En(e){return t=>{const{host:n}=D(t);return!(n===void 0||n===e)}}function Sn({mode:e,listener:t}){const n=bn(e),r=(c,f)=>{if(f!=null&&f.replace){n.replace(c,f.state);return}n.push(c,f==null?void 0:f.state)},o=()=>{const c=z(n.location);n.replace(c)};let a;return{...n,update:r,refresh:o,startListening:()=>{a==null||a(),a=n.listen(t)},stopListening:()=>{a==null||a()}}}function bn(e="auto"){switch(e){case"auto":return Ye()?st():ct();case"browser":return st();case"memory":return ct();case"hash":return Rn();default:const t=e;throw new Error(`Switch is not exhaustive for mode: ${t}`)}}class ge{constructor(){F(this,"onBeforeRouteEnter",new Set);F(this,"onBeforeRouteUpdate",new Set);F(this,"onBeforeRouteLeave",new Set);F(this,"onAfterRouteEnter",new Set);F(this,"onAfterRouteUpdate",new Set);F(this,"onAfterRouteLeave",new Set)}}class pt extends Error{}class ie extends Error{constructor(n){super("Error occurred during a router push operation.");F(this,"to");this.to=n}}class xe extends Error{constructor(n){super(`Routing action rejected: ${n}`);F(this,"type");this.type=n}}function An(e,t){const n=new ge;return e.matches.forEach((r,o)=>{r.onBeforeRouteEnter&&Le(e,t,o)&&X(r.onBeforeRouteEnter).forEach(a=>n.onBeforeRouteEnter.add(a)),r.onBeforeRouteUpdate&&Ue(e,t,o)&&X(r.onBeforeRouteUpdate).forEach(a=>n.onBeforeRouteUpdate.add(a))}),t.matches.forEach((r,o)=>{r.onBeforeRouteLeave&&Be(e,t,o)&&X(r.onBeforeRouteLeave).forEach(a=>n.onBeforeRouteLeave.add(a))}),n}function kn(e,t){const n=new ge;return e.matches.forEach((r,o)=>{r.onAfterRouteEnter&&Le(e,t,o)&&X(r.onAfterRouteEnter).forEach(a=>n.onAfterRouteEnter.add(a)),r.onAfterRouteUpdate&&Ue(e,t,o)&&X(r.onAfterRouteUpdate).forEach(a=>n.onAfterRouteUpdate.add(a))}),t.matches.forEach((r,o)=>{r.onAfterRouteLeave&&Be(e,t,o)&&X(r.onAfterRouteLeave).forEach(a=>n.onAfterRouteLeave.add(a))}),n}function O(e){return typeof e!="string"?!1:/^(https?:\/\/|\/).*/g.test(e)}function dt(e){return O(e)?e:`/${e}`}function xn(){const e=s=>{throw new xe(s)},t=(...s)=>{throw new ie(s)},n=(s,i,c)=>{if(O(s)){const p=i??{};throw new ie([s,{...p,replace:!0}])}const f=i,u=c??{};throw new ie([s,f,{...u,replace:!0}])},r=()=>{throw new pt};async function o({to:s,from:i,hooks:c}){const{global:f,component:u}=c,p=An(s,i),S=[...f.onBeforeRouteEnter,...p.onBeforeRouteEnter,...f.onBeforeRouteUpdate,...p.onBeforeRouteUpdate,...u.onBeforeRouteUpdate,...f.onBeforeRouteLeave,...p.onBeforeRouteLeave,...u.onBeforeRouteLeave];try{const d=S.map(x=>x(s,{from:i,reject:e,push:t,replace:n,abort:r}));await Promise.all(d)}catch(d){if(d instanceof ie)return{status:"PUSH",to:d.to};if(d instanceof xe)return{status:"REJECT",type:d.type};if(d instanceof pt)return{status:"ABORT"};throw d}return{status:"SUCCESS"}}async function a({to:s,from:i,hooks:c}){const{global:f,component:u}=c,p=kn(s,i),S=[...u.onAfterRouteLeave,...p.onAfterRouteLeave,...f.onAfterRouteLeave,...u.onAfterRouteUpdate,...p.onAfterRouteUpdate,...f.onAfterRouteUpdate,...u.onAfterRouteEnter,...p.onAfterRouteEnter,...f.onAfterRouteEnter];try{const d=S.map(x=>x(s,{from:i,reject:e,push:t,replace:n}));await Promise.all(d)}catch(d){if(d instanceof ie)return{status:"PUSH",to:d.to};if(d instanceof xe)return{status:"REJECT",type:d.type};throw d}return{status:"SUCCESS"}}return{runBeforeRouteHooks:o,runAfterRouteHooks:a}}const Le=(e,t,n)=>{const r=e.matches,o=(t==null?void 0:t.matches)??[];return r.length<n||r[n]!==o[n]},Be=(e,t,n)=>{const r=e.matches,o=(t==null?void 0:t.matches)??[];return r.length<n||r[n]!==o[n]},Ue=(e,t,n)=>e.matches[n]===(t==null?void 0:t.matches[n]);function mt(e){switch(e){case"onBeforeRouteEnter":case"onAfterRouteEnter":return Le;case"onBeforeRouteUpdate":case"onAfterRouteUpdate":return Ue;case"onBeforeRouteLeave":case"onAfterRouteLeave":return Be;default:throw new Error(`Switch is not exhaustive for lifecycle: ${e}`)}}function Ln(){const e={global:new ge,component:new ge};function t({lifecycle:r,timing:o,depth:a,hook:s}){const i=mt(r),c=e[o][r],f=(u,p)=>{if(i(u,p.from,a))return s(u,p)};return c.add(f),()=>c.delete(f)}function n({lifecycle:r,timing:o,depth:a,hook:s}){const i=mt(r),c=e[o][r],f=(u,p)=>{if(i(u,p.from,a))return s(u,p)};return c.add(f),()=>c.delete(f)}return{...e,addBeforeRouteHook:t,addAfterRouteHook:n}}const Rt=Symbol();function Bn(){const e=Ln();return{onBeforeRouteEnter:i=>e.addBeforeRouteHook({lifecycle:"onBeforeRouteEnter",hook:i,timing:"global",depth:0}),onBeforeRouteUpdate:i=>e.addBeforeRouteHook({lifecycle:"onBeforeRouteUpdate",hook:i,timing:"global",depth:0}),onBeforeRouteLeave:i=>e.addBeforeRouteHook({lifecycle:"onBeforeRouteLeave",hook:i,timing:"global",depth:0}),onAfterRouteEnter:i=>e.addAfterRouteHook({lifecycle:"onAfterRouteEnter",hook:i,timing:"global",depth:0}),onAfterRouteUpdate:i=>e.addAfterRouteHook({lifecycle:"onAfterRouteUpdate",hook:i,timing:"global",depth:0}),onAfterRouteLeave:i=>e.addAfterRouteHook({lifecycle:"onAfterRouteLeave",hook:i,timing:"global",depth:0}),hooks:e}}function Un(e){return l.defineComponent(()=>()=>l.h("h1",e),{name:e,props:[]})}function gt(e){const t=new URLSearchParams(e);return{get:(...n)=>t.get(...n),getAll:(...n)=>t.getAll(...n),set:(...n)=>{t.set(...n)},append:(...n)=>{t.append(...n)},delete:(...n)=>{t.delete(...n)},toString:(...n)=>t.toString(...n),forEach:(...n)=>{t.forEach(...n)},entries:(...n)=>t.entries(...n),keys:(...n)=>t.keys(...n),values:(...n)=>t.values(...n),has:(...n)=>t.has(...n)}}function Nn(){let e=0;return()=>(++e).toString()}const Ne=Nn();function Cn({rejections:e}){const t=a=>{const s={...e};return l.markRaw(s[a]??Un(a))},n=a=>{const s=l.markRaw(t(a)),i={id:Ne(),component:s,meta:{},state:{}};return{id:i.id,matched:i,matches:[i],name:a,query:gt(""),params:{},state:{},[ht]:!0}},r=a=>{if(!a){o.value=null;return}const s=t(a);o.value={type:a,component:s}},o=l.ref(null);return{setRejection:r,rejection:o,getRejectionRoute:n}}class jn extends Error{constructor(t){super(`Route not found: "${t}"`)}}function Ce(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Hn(e,t){const n=Array.from(e.matchAll(t));if(n.length===0)return[e];let r=0;const o=n.reduce((s,i)=>{const c=Ce(e.slice(r,i.index));c.length&&s.push(c);const[f]=i;return s.push(f),r=i.index+f.length,s},[]),a=e.slice(r);return a&&o.push(a),o}function Vn(e){const t=yt(e.path.value);return new RegExp(`^${t}$`,"i")}function $n(e){const t=new URLSearchParams(e.query.value);return Array.from(t.entries()).filter(([,n])=>!He(n)).map(([n,r])=>{const o=yt(r);return new RegExp(`${Ce(n)}=${o}(&|$)`,"i")})}function yt(e){return Hn(e,new RegExp(qn,"g")).map(t=>t.startsWith(T)?wt(t):Ce(t)).join("")}function wt(e){return[On,_n].reduce((t,n)=>n(t),e)}const qn=`\\${T}\\??([\\w-_]+)\\${J}`,je=`\\${T}\\?([\\w-_]+)\\${J}`,vt=`\\${T}([\\w-_]+)\\${J}`;function On(e){return e.replace(new RegExp(je,"g"),".*")}function He(e){return new RegExp(je,"g").test(e)}function _n(e){return e.replace(new RegExp(vt,"g"),".+")}function ye(e){const[t]=we(e,new RegExp(je,"g")),[n]=we(e,new RegExp(vt,"g"));return t??n}function we(e,t){return Array.from(e.matchAll(t)).flatMap(([,...r])=>r.map(o=>ae(o)?o:""))}function Pt(e,t,n){const r=St(t,n),[o]=we(e,r);return o}function Et(e,t){if(!t)return e;const{name:n,param:r,value:o}=t,a=St(e,n);return we(e,a).reduce((i,c)=>c===void 0?i:i.replace(c,()=>ce(o,r,n.startsWith("?"))),e)}function St(e,t){const n=[Dn,Wn,wt].reduce((r,o)=>o(r,t),e);return new RegExp(n,"g")}function Dn(e,t){if(!t.startsWith("?"))return e;const n=new RegExp(`\\${T}\\${t}\\${J}`,"g");return e.replace(n,"(.*)")}function Wn(e,t){if(t.startsWith("?"))return e;const n=new RegExp(`\\${T}${t}\\${J}`,"g");return e.replace(n,"(.+)")}function bt({protocol:e,host:t,pathname:n,search:r,searchParams:o,hash:a}){const s=new URL("https://localhost");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);const i=s.toString().replace(/^https:\/\/localhost\/*/,"/");return dt(i)}function Mn(e,t){const n=new URLSearchParams(e),r=new URLSearchParams(t);for(const[o,a]of r.entries())n.append(o,a);return n}function Tn(e,t={}){const{params:n={},query:r}=t,o=Jn(e.query,n),a=Mn(o,r),s=Fn(e.path,n),i=le(e.hash.value??t.hash).value,c=In(e.host,n),{protocol:f,host:u}=D(c);return bt({protocol:f,host:u,pathname:s,searchParams:a,hash:i})}function In(e,t){const n=e.value&&!e.value.startsWith("http")?`https://${e.value}`:e.value;return Object.entries(e.params).reduce((r,[o,a])=>{const s=ye(`${T}${o}${J}`);return s?Et(r,{name:o,param:a,value:t[s]}):r},n)}function Fn(e,t){return Object.entries(e.params).reduce((n,[r,o])=>{const a=ye(`${T}${r}${J}`);return a?Et(n,{name:r,param:o,value:t[a]}):n},e.value)}function Jn(e,t){const n=new URLSearchParams(e.value);if(!e.value)return n;for(const[r,o]of n.entries()){const a=ye(o);if(!a)continue;const i=ce(t[a],e.params[a],He(o)),c=t[a]===void 0&&i==="";He(o)&&c?n.delete(r,o):n.set(r,i)}return n}function Qn(e){return(t,n,r)=>{if(O(t)){const c=n??{},{searchParams:f,...u}=D(t);return Object.entries(c.query??{}).forEach(([p,S])=>{f.append(p,S)}),bt({...u,searchParams:f})}const o=n??{},a=r??{},s=e.find(c=>c.name===t);if(!s)throw new jn(String(t));return Tn(s,{params:o,query:a.query,hash:a.hash})}}class Kn extends Error{constructor(){super("initialUrl must be set if window.location is unavailable")}}function Gn(e){if(e)return e;if(Ye())return window.location.toString();throw new Kn}const zn=(e,t)=>{try{At(e,t)}catch{return!1}return!0},At=(e,t)=>{const{pathname:n,search:r}=D(t);return{...Yn(e.path,n),...Xn(e.query,r)}};function Yn(e,t){const n={},r=decodeURIComponent(t);for(const[o,a]of Object.entries(e.params)){const s=o.startsWith("?"),i=s?o.slice(1):o,c=Pt(r,e.value,o),f=se(c,a,s);n[i]=f}return n}function Xn(e,t){const n={},r=new URLSearchParams(t);for(const[o,a]of Object.entries(e.params)){const s=o.startsWith("?"),i=s?o.slice(1):o,c=r.get(i)??void 0,f=se(c,a,s);n[i]=f}return n}const Zn=e=>"name"in e.matched&&!!e.matched.name,er=(e,t)=>{const{pathname:n}=D(t);return Vn(e).test(n)},tr=(e,t)=>{const{search:n}=D(t);return $n(e).every(o=>o.test(n))},Ve=(e,t)=>{const{hash:n}=D(t),{value:r}=e.hash;return r===void 0||`#${r.toLowerCase()}`===n.toLowerCase()};function nr(e){const{searchParams:t,pathname:n}=D(e),r=-1,o=1;return(a,s)=>{const i=xt(a,t),c=kt(a,n),f=xt(s,t),u=kt(s,n);return a.depth>s.depth?r:a.depth<s.depth?o:i+c>f+u?r:i+c<f+u?o:Ve(a,e)?r:Ve(s,e)?o:0}}function kt(e,t){const n=Object.keys(e.path.params).filter(o=>o.startsWith("?")).map(o=>o),r=n.filter(o=>Pt(t,e.path.value,o)===void 0);return n.length-r.length}function xt(e,t){const n=new URLSearchParams(e.query.value),r=Array.from(n.keys()),o=r.filter(a=>!t.has(a));return r.length-o.length}function Lt(e){return!!e&&typeof e=="object"}const ve=!0;function rr(e,t,n){if(Lt(e)&&t in e){const r=e[t];if(typeof r=="string")return se(r,n,ve)}return se(void 0,n,ve)}function or(e,t){const n={};for(const[r,o]of Object.entries(e)){const a=rr(t,r,o);n[r]=a}return n}function ar(e,t,n){if(Lt(e)&&t in e){const r=e[t];return ce(r,n,ve)}return ce(void 0,n,ve)}const Bt=(e,t)=>{const n={};for(const[r,o]of Object.entries(e)){const a=ar(t,r,o);n[r]=a}return n},sr=[Zn,er,tr,Ve,zn];function $e(e,t,n){const r=nr(t),o=e.filter(c=>sr.every(f=>f(c,t))).sort(r);if(o.length===0)return;const[a]=o,{search:s,hash:i}=D(t);return{id:a.id,matched:a.matched,matches:a.matches,name:a.name,query:gt(s),params:At(a,t),state:or(a.state,n),hash:i}}function qe(e,t){const n=new RegExp(`\\${T}(\\??[\\w-_]+)\\${J}`,"g");return Array.from(e.matchAll(n)).reduce((o,[a,s])=>{const i=ye(a);if(!i)return o;const c=pn(t,i);return Z([i],o),o[s]=c,o},{})}function Pe(e,t){return{value:e,params:qe(e,t)}}function cr(e,t){return ae(t)?e.map(n=>{const r=`${t}${n.path.value}`;return{...n,path:Pe(r,n.path.params)}}):e}class ur extends Error{constructor(t){super(`Invalid Name "${t}": Router does not support multiple routes with the same name. All name names must be unique.`)}}function ir(e){const t=e.map(({name:n})=>n);for(const n of t)if(Ke(t,n)>1)throw new ur(n)}function fr(e,t){const n=Yt(e)?e.flat():e,r=cr(n,t==null?void 0:t.base);ir(r);const o=gr(),a=Qn(r),s=Sn({mode:t==null?void 0:t.historyMode,listener:({location:E})=>{const C=z(E);w(C,{state:E.state})}}),{runBeforeRouteHooks:i,runAfterRouteHooks:c}=xn(),{hooks:f,onBeforeRouteEnter:u,onAfterRouteUpdate:p,onBeforeRouteLeave:S,onAfterRouteEnter:d,onBeforeRouteUpdate:x,onAfterRouteLeave:P}=Bn();async function w(E,C={}){if(s.stopListening(),V(E)){s.update(E,C);return}const W=$e(r,E,C.state)??g("NotFound"),M={...R},re=await i({to:W,from:M,hooks:f});switch(re.status){case"ABORT":return;case"PUSH":s.update(E,C),await L(...re.to);return;case"REJECT":s.update(E,C),k(re.type);break;case"SUCCESS":s.update(E,C),k(null);break;default:throw new Error(`Switch is not exhaustive for before hook response status: ${JSON.stringify(re)}`)}o.setProps(W),A(W);const K=await c({to:W,from:M,hooks:f});switch(K.status){case"PUSH":await L(...K.to);break;case"REJECT":k(K.type);break;case"SUCCESS":break;default:const I=K;throw new Error(`Switch is not exhaustive for after hook response status: ${JSON.stringify(I)}`)}s.startListening()}const L=(E,C,W)=>{if(O(E)){const fe={...C},Je=a(E,fe);return w(Je,fe)}const M={...W},K=a(E,C??{},M),I=Gt(E),Fe=Bt((I==null?void 0:I.state)??{},M.state);return w(K,{...M,state:Fe})},N=(E,C,W)=>{if(O(E)){const fe={...C,replace:!0},Je=a(E,fe);return w(Je,fe)}const M={...W,replace:!0},K=a(E,C??{},M),I=Gt(E),Fe=Bt((I==null?void 0:I.state)??{},M.state);return w(K,{...M,state:Fe})},m=E=>{k(E)},v=(E,C={})=>{if(!O(E)){const W=a(E,C);return $e(r,W)}if(!V(E))return $e(r,E)},{setRejection:k,rejection:B,getRejectionRoute:g}=Cn(t??{}),h=g("NotFound"),{currentRoute:R,routerRoute:b,updateRoute:A}=wn(h,L);s.startListening();const U=Gn(t==null?void 0:t.initialUrl),j=s.location.state,{host:q}=D(U),V=En(q);let Ie=!1;async function Kt(){Ie||(await w(U,{replace:!0,state:j}),Ie=!0)}function Gt(E){return r.find(C=>C.name===E)}function Br(E){E.component("RouterView",Jt),E.component("RouterLink",Ft),E.provide(Ae,B),E.provide(Rt,f),E.provide($t,o),E.provide(ke,zt),Kt()}const zt={route:b,resolve:a,push:L,replace:N,reject:m,find:v,refresh:s.refresh,forward:s.forward,back:s.back,go:s.go,install:Br,isExternal:V,onBeforeRouteEnter:u,onAfterRouteUpdate:p,onBeforeRouteLeave:S,onAfterRouteEnter:d,onBeforeRouteUpdate:x,onAfterRouteLeave:P,prefetch:t==null?void 0:t.prefetch,start:Kt};return zt}function Oe(e,t){return{value:e,params:qe(e,t)}}function Ut(e,t){return{value:e,params:qe(e,t)}}function lr(e){return oe(e)&&typeof e.hash=="string"}function Nt(e){return e===void 0?le():lr(e)?e:le(e)}function _e(e){return e===void 0?"":e}function hr(e){return oe(e)&&typeof e.value=="string"}function Ct(e){return e===void 0?Pe("",{}):hr(e)?e:Pe(e,{})}function pr(e){return oe(e)&&typeof e.value=="string"}function jt(e){return e===void 0?Oe("",{}):pr(e)?e:Oe(e,{})}function Y(e){const t=Ne(),n=_e(e.name),r=Ct(e.path),o=jt(e.query),a=Nt(e.hash),s=e.meta??{},i=cn(e)?e.state:{},c=l.markRaw({id:t,meta:{},state:{},...e}),f={id:t,matched:c,matches:[c],name:n,path:r,query:o,hash:a,meta:s,state:i,depth:1,host:Ut("",{}),prefetch:e.prefetch},u=Ge(e)?ze(e.parent,f):f;return Z(u.path.params,u.query.params),u}const Ee={template:"<div>This is component</div>"},De=Y({name:"parentA",path:"/parentA/[paramA]"}),Ht=Y({parent:De,name:"parentA.childA",path:"/[?paramB]"}),dr=Y({parent:De,name:"parentA.childB",path:"/[paramD]",component:Ee}),mr=Y({parent:Ht,name:"parentA.childA.grandChildA",path:"/[paramC]",component:Ee});Y({name:"parentB",path:"/parentB",component:Ee}),Y({name:"parentC",path:"/",component:Ee});const Rr={components:!0,props:!1};function Vt({routerPrefetch:e,routePrefetch:t,linkPrefetch:n},r){return We(n,r)??We(t,r)??We(e,r)??Rr[r]}function We(e,t){return oe(e)?e[t]:e}const $t=Symbol();function gr(){const e=l.reactive(new Map),t=(c,f)=>c.matches.filter(u=>Vt({...f,routePrefetch:u.prefetch},"props")).flatMap(u=>s(u)).reduce((u,{id:p,name:S,props:d})=>{const x=a(p,S,c);return u[x]=d==null?void 0:d(c.params),u},{}),n=c=>{Object.entries(c).forEach(([f,u])=>{e.set(f,u)})},r=c=>{const u=c.matches.flatMap(s).reduce((p,{id:S,name:d,props:x})=>{const P=a(S,d,c);if(!x||e.has(P))return p;const w=x(c.params);return e.set(P,w),p.push(P),p},[]);i(u)},o=(c,f,u)=>{const p=a(c,f,u);return e.get(p)};function a(c,f,u){return[c,f,u.id,JSON.stringify(u.params)].join("-")}function s(c){return be(c)?Object.entries(c.props??{}).map(([f,u])=>({id:c.id,name:f,props:u})):Se(c)?[{id:c.id,name:"default",props:c.props}]:[]}function i(c){for(const f in e.keys())c.includes(f)||e.delete(f)}return{getPrefetchProps:t,setPrefetchProps:n,getProps:o,setProps:r}}function qt(){const e=l.inject($t);if(!e)throw new _;return e}const yr=l.defineAsyncComponent(()=>new Promise(e=>{e({default:{template:"foo"}})}));function Ot(e){return e.name===yr.name&&"setup"in e}function wr(e){let t={};const{getPrefetchProps:n,setPrefetchProps:r}=qt();return l.watch(()=>l.toValue(e),({route:a,...s})=>{a&&(vr(a,s),t=n(a,s))},{immediate:!0}),{commit:()=>{r(t)}}}function vr(e,{routerPrefetch:t,linkPrefetch:n}){e.matches.forEach(r=>{Vt({routePrefetch:r.prefetch,routerPrefetch:t,linkPrefetch:n},"components")&&(Se(r)&&Ot(r.component)&&r.component.setup(),be(r)&&Object.values(r.components).forEach(a=>{Ot(a)&&a.setup()}))})}function _t(e,t={},n={}){const r=Re(),o=l.toRef(e),a=l.computed(()=>O(o.value)?{}:l.toValue(t)),s=l.computed(()=>O(o.value)?l.toValue(t):l.toValue(n)),i=l.computed(()=>{if(O(o.value))return o.value;try{return r.resolve(o.value,a.value,s.value)}catch(P){throw P instanceof ee&&console.error(`Failed to resolve route "${o.value.toString()}" in RouterLink.`,P),P}}),c=l.computed(()=>r.find(i.value,s.value)),f=l.computed(()=>!!c.value&&r.route.matches.includes(c.value.matched)),u=l.computed(()=>!!c.value&&r.route.matched===c.value.matched),p=l.computed(()=>r.isExternal(i.value)),{commit:S}=wr(()=>({route:c.value,routerPrefetch:r.prefetch,linkPrefetch:s.value.prefetch})),d=P=>(S(),r.push(i.value,{...s.value,...P}));return{route:c,href:i,isMatch:f,isExactMatch:u,isExternal:p,push:d,replace:P=>d(P)}}function Dt(e,t,{exact:n}={}){if(!gn(e))return!1;if(t===void 0)return!0;const r=e.matches.map(o=>_e(o.name));if(n){const o=r.at(-1);return t===o}return r.includes(t)}function Wt(e,t){const n=Re();function r(){if(!e)return;if(!Dt(n.route,e,t))throw new it(e,n.route.name)}return l.watch(n.route,r,{immediate:!0,deep:!0}),n.route}const Mt=Symbol();function Me(){return l.inject(Mt,0)}function Tt(){const e=l.inject(Rt);if(!e)throw new _;return e}function It(e){return t=>{const n=Me(),o=Tt().addBeforeRouteHook({lifecycle:e,hook:t,depth:n,timing:"component"});return l.onUnmounted(o),o}}function Te(e){return t=>{const n=Me(),o=Tt().addAfterRouteHook({lifecycle:e,hook:t,depth:n,timing:"component"});return l.onUnmounted(o),o}}const Pr=It("onBeforeRouteUpdate"),Er=It("onBeforeRouteLeave"),Sr=Te("onAfterRouteEnter"),br=Te("onAfterRouteUpdate"),Ar=Te("onAfterRouteLeave"),kr=["href"],Ft=l.defineComponent({__name:"routerLink",props:{to:{},prefetch:{type:[Boolean,Object],default:void 0},query:{},hash:{},replace:{type:Boolean},state:{}},setup(e){const t=e,n=Re(),r=l.computed(()=>O(t.to)?t.to:t.to(n.resolve)),o=l.computed(()=>{const{to:p,...S}=t;return S}),{isMatch:a,isExactMatch:s,isExternal:i,push:c}=_t(r,o),f=l.computed(()=>({"router-link--match":a.value,"router-link--exact-match":s.value}));function u(p){p.preventDefault(),c()}return(p,S)=>(l.openBlock(),l.createElementBlock("a",{href:r.value,class:l.normalizeClass(["router-link",f.value]),onClick:u},[l.renderSlot(p.$slots,"default",l.normalizeProps(l.guardReactiveProps({resolved:r.value,isMatch:l.unref(a),isExactMatch:l.unref(s),isExternal:l.unref(i)})))],10,kr))}}),Jt=l.defineComponent({__name:"routerView",props:{name:{}},setup(e){const{name:t="default"}=e,n=Wt(),r=ft(),o=Me(),{getProps:a}=qt(),s=l.resolveComponent("RouterView",!0);l.provide(Mt,o+1);const i=l.computed(()=>{if(r.value)return r.value.component;const u=n.matches.at(o);if(!u)return null;const p=c(u),S=a(u.id,t,n);return p?S?Xe(p,()=>S):p:null});function c(u){return f(u)[t]}function f(u){return be(u)?u.components:Se(u)?{default:u.component}:typeof s=="string"?{}:{default:s}}return(u,p)=>i.value?l.renderSlot(u.$slots,"default",l.normalizeProps(l.mergeProps({key:0},{route:l.unref(n),component:i.value,rejection:l.unref(r)})),()=>[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(i.value)))]):l.createCommentVNode("",!0)}});function xr(e){return oe(e)&&typeof e.value=="string"}function Qt(e){return xr(e)?e:Ut(e,{})}function Lr(e){const t=Ne(),n=_e(e.name),r=Ct(e.path),o=jt(e.query),a=Nt(e.hash),s=e.meta??{},i=sn(e)?Qt(e.host):Qt(""),c=l.markRaw({id:t,meta:{},state:{},...e}),f={id:t,matched:c,matches:[c],name:n,host:i,path:r,query:o,hash:a,meta:s,depth:1,state:{}},u=Ge(e)?ze(e.parent,f):f;return Z(u.path.params,u.query.params,u.host.params),u}y.DuplicateParamsError=Qe,y.RouterLink=Ft,y.RouterNotInstalledError=_,y.RouterView=Jt,y.UseRouteInvalidError=it,y.asUrl=dt,y.component=Xe,y.createExternalRoute=Lr,y.createParam=ot,y.createRoute=Y,y.createRouter=fr,y.isParamWithDefault=Ze,y.isRoute=Dt,y.isUrl=O,y.onAfterRouteEnter=Sr,y.onAfterRouteLeave=br,y.onAfterRouteUpdate=Ar,y.onBeforeRouteLeave=Pr,y.onBeforeRouteUpdate=Er,y.path=Pe,y.query=Oe,y.routerInjectionKey=ke,y.routerRejectionKey=Ae,y.useLink=_t,y.useRejection=ft,y.useRoute=Wt,y.useRouter=Re,y.withDefault=hn,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
|