@kitbag/router 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/dist/kitbag-router.d.ts +37 -28
- package/dist/kitbag-router.js +475 -450
- package/dist/kitbag-router.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/kitbag-router.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var ft = Object.defineProperty;
|
|
2
2
|
var lt = (e, t, n) => t in e ? ft(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var H = (e, t, n) => (lt(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
4
|
-
import { inject as
|
|
5
|
-
class
|
|
4
|
+
import { inject as re, watch as ht, onUnmounted as Ne, defineComponent as le, computed as C, readonly as oe, openBlock as ie, createElementBlock as pt, normalizeClass as dt, renderSlot as _e, normalizeProps as mt, guardReactiveProps as yt, provide as gt, defineAsyncComponent as Rt, unref as ce, createBlock as ke, resolveDynamicComponent as Se, reactive as vt, h as wt, ref as Et, markRaw as ue } from "vue";
|
|
5
|
+
class ae extends Error {
|
|
6
6
|
/**
|
|
7
7
|
* Constructs a new DuplicateParamsError instance with a message indicating the problematic parameter.
|
|
8
8
|
* @param paramName - The name of the parameter that was duplicated.
|
|
@@ -11,7 +11,7 @@ class re extends Error {
|
|
|
11
11
|
super(`Invalid Param "${t}": Router does not support multiple params by the same name. All param names must be unique.`);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
class
|
|
14
|
+
class he extends Error {
|
|
15
15
|
constructor() {
|
|
16
16
|
super("Router not installed");
|
|
17
17
|
}
|
|
@@ -27,29 +27,29 @@ class bt extends Error {
|
|
|
27
27
|
super(`useRoute called with incorrect route. Given ${t}, expected ${n}`);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
const
|
|
30
|
+
const Ve = Symbol();
|
|
31
31
|
function Pt() {
|
|
32
|
-
const e =
|
|
32
|
+
const e = re(Ve);
|
|
33
33
|
if (!e)
|
|
34
|
-
throw new
|
|
34
|
+
throw new he();
|
|
35
35
|
return e;
|
|
36
36
|
}
|
|
37
|
-
const
|
|
38
|
-
function
|
|
39
|
-
const e =
|
|
37
|
+
const Ce = Symbol();
|
|
38
|
+
function pe() {
|
|
39
|
+
const e = re(Ce);
|
|
40
40
|
if (!e)
|
|
41
|
-
throw new
|
|
41
|
+
throw new he();
|
|
42
42
|
return e;
|
|
43
43
|
}
|
|
44
44
|
function qe(e, t) {
|
|
45
45
|
return [e, t].filter((n) => !!n).join(".");
|
|
46
46
|
}
|
|
47
|
-
function
|
|
48
|
-
const t =
|
|
47
|
+
function Sn(e) {
|
|
48
|
+
const t = pe();
|
|
49
49
|
function n() {
|
|
50
50
|
if (!e)
|
|
51
51
|
return;
|
|
52
|
-
const r = t.route.matches.map((
|
|
52
|
+
const r = t.route.matches.map((c) => c.name);
|
|
53
53
|
if (!kt(r).includes(e))
|
|
54
54
|
throw new bt(e, t.route.key);
|
|
55
55
|
}
|
|
@@ -65,9 +65,9 @@ function kt(e) {
|
|
|
65
65
|
] : o;
|
|
66
66
|
}, []);
|
|
67
67
|
}
|
|
68
|
-
const
|
|
69
|
-
function
|
|
70
|
-
return
|
|
68
|
+
const Oe = Symbol();
|
|
69
|
+
function de() {
|
|
70
|
+
return re(Oe, 0);
|
|
71
71
|
}
|
|
72
72
|
class z {
|
|
73
73
|
constructor() {
|
|
@@ -79,7 +79,7 @@ class z {
|
|
|
79
79
|
H(this, "onAfterRouteLeave", /* @__PURE__ */ new Set());
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
class
|
|
82
|
+
class xe extends Error {
|
|
83
83
|
}
|
|
84
84
|
class F extends Error {
|
|
85
85
|
constructor(n) {
|
|
@@ -88,7 +88,7 @@ class F extends Error {
|
|
|
88
88
|
this.to = n;
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
class
|
|
91
|
+
class se extends Error {
|
|
92
92
|
constructor(n) {
|
|
93
93
|
super(`Routing action rejected: ${n}`);
|
|
94
94
|
H(this, "type");
|
|
@@ -101,51 +101,51 @@ function M(e) {
|
|
|
101
101
|
function St(e, t) {
|
|
102
102
|
const n = new z();
|
|
103
103
|
return e.matches.forEach((r, o) => {
|
|
104
|
-
r.onBeforeRouteEnter &&
|
|
104
|
+
r.onBeforeRouteEnter && me(e, t, o) && M(r.onBeforeRouteEnter).forEach((a) => n.onBeforeRouteEnter.add(a)), r.onBeforeRouteUpdate && ge(e, t, o) && M(r.onBeforeRouteUpdate).forEach((a) => n.onBeforeRouteUpdate.add(a));
|
|
105
105
|
}), t.matches.forEach((r, o) => {
|
|
106
|
-
r.onBeforeRouteLeave &&
|
|
106
|
+
r.onBeforeRouteLeave && ye(e, t, o) && M(r.onBeforeRouteLeave).forEach((a) => n.onBeforeRouteLeave.add(a));
|
|
107
107
|
}), n;
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function xt(e, t) {
|
|
110
110
|
const n = new z();
|
|
111
111
|
return e.matches.forEach((r, o) => {
|
|
112
|
-
r.onAfterRouteEnter &&
|
|
112
|
+
r.onAfterRouteEnter && me(e, t, o) && M(r.onAfterRouteEnter).forEach((a) => n.onAfterRouteEnter.add(a)), r.onAfterRouteUpdate && ge(e, t, o) && M(r.onAfterRouteUpdate).forEach((a) => n.onAfterRouteUpdate.add(a));
|
|
113
113
|
}), t.matches.forEach((r, o) => {
|
|
114
|
-
r.onAfterRouteLeave &&
|
|
114
|
+
r.onAfterRouteLeave && ye(e, t, o) && M(r.onAfterRouteLeave).forEach((a) => n.onAfterRouteLeave.add(a));
|
|
115
115
|
}), n;
|
|
116
116
|
}
|
|
117
117
|
function I(e) {
|
|
118
118
|
return typeof e != "string" ? !1 : /^(https?:\/\/|\/).*/g.test(e);
|
|
119
119
|
}
|
|
120
|
-
function
|
|
121
|
-
const e = (
|
|
122
|
-
throw new
|
|
123
|
-
}, t = (...
|
|
124
|
-
throw new F(
|
|
125
|
-
}, n = (
|
|
126
|
-
if (I(
|
|
127
|
-
const
|
|
128
|
-
throw new F([
|
|
120
|
+
function At() {
|
|
121
|
+
const e = (c) => {
|
|
122
|
+
throw new se(c);
|
|
123
|
+
}, t = (...c) => {
|
|
124
|
+
throw new F(c);
|
|
125
|
+
}, n = (c, s, u) => {
|
|
126
|
+
if (I(c)) {
|
|
127
|
+
const g = s ?? {};
|
|
128
|
+
throw new F([c, { ...g, replace: !0 }]);
|
|
129
129
|
}
|
|
130
|
-
const d =
|
|
131
|
-
throw new F([
|
|
130
|
+
const d = s, m = u ?? {};
|
|
131
|
+
throw new F([c, d, { ...m, replace: !0 }]);
|
|
132
132
|
}, r = () => {
|
|
133
|
-
throw new
|
|
133
|
+
throw new xe();
|
|
134
134
|
};
|
|
135
|
-
async function o({ to:
|
|
136
|
-
const { global: d, component: m } = u,
|
|
135
|
+
async function o({ to: c, from: s, hooks: u }) {
|
|
136
|
+
const { global: d, component: m } = u, g = St(c, s), A = [
|
|
137
137
|
...d.onBeforeRouteEnter,
|
|
138
|
-
...
|
|
138
|
+
...g.onBeforeRouteEnter,
|
|
139
139
|
...d.onBeforeRouteUpdate,
|
|
140
|
-
...
|
|
140
|
+
...g.onBeforeRouteUpdate,
|
|
141
141
|
...m.onBeforeRouteUpdate,
|
|
142
142
|
...d.onBeforeRouteLeave,
|
|
143
|
-
...
|
|
143
|
+
...g.onBeforeRouteLeave,
|
|
144
144
|
...m.onBeforeRouteLeave
|
|
145
145
|
];
|
|
146
146
|
try {
|
|
147
|
-
const h =
|
|
148
|
-
from:
|
|
147
|
+
const h = A.map((k) => k(c, {
|
|
148
|
+
from: s,
|
|
149
149
|
reject: e,
|
|
150
150
|
push: t,
|
|
151
151
|
replace: n,
|
|
@@ -158,12 +158,12 @@ function xt() {
|
|
|
158
158
|
status: "PUSH",
|
|
159
159
|
to: h.to
|
|
160
160
|
};
|
|
161
|
-
if (h instanceof
|
|
161
|
+
if (h instanceof se)
|
|
162
162
|
return {
|
|
163
163
|
status: "REJECT",
|
|
164
164
|
type: h.type
|
|
165
165
|
};
|
|
166
|
-
if (h instanceof
|
|
166
|
+
if (h instanceof xe)
|
|
167
167
|
return {
|
|
168
168
|
status: "ABORT"
|
|
169
169
|
};
|
|
@@ -173,21 +173,21 @@ function xt() {
|
|
|
173
173
|
status: "SUCCESS"
|
|
174
174
|
};
|
|
175
175
|
}
|
|
176
|
-
async function a({ to:
|
|
177
|
-
const { global: d, component: m } = u,
|
|
176
|
+
async function a({ to: c, from: s, hooks: u }) {
|
|
177
|
+
const { global: d, component: m } = u, g = xt(c, s), A = [
|
|
178
178
|
...m.onAfterRouteLeave,
|
|
179
|
-
...
|
|
179
|
+
...g.onAfterRouteLeave,
|
|
180
180
|
...d.onAfterRouteLeave,
|
|
181
181
|
...m.onAfterRouteUpdate,
|
|
182
|
-
...
|
|
182
|
+
...g.onAfterRouteUpdate,
|
|
183
183
|
...d.onAfterRouteUpdate,
|
|
184
184
|
...m.onAfterRouteEnter,
|
|
185
|
-
...
|
|
185
|
+
...g.onAfterRouteEnter,
|
|
186
186
|
...d.onAfterRouteEnter
|
|
187
187
|
];
|
|
188
188
|
try {
|
|
189
|
-
const h =
|
|
190
|
-
from:
|
|
189
|
+
const h = A.map((k) => k(c, {
|
|
190
|
+
from: s,
|
|
191
191
|
reject: e,
|
|
192
192
|
push: t,
|
|
193
193
|
replace: n
|
|
@@ -199,7 +199,7 @@ function xt() {
|
|
|
199
199
|
status: "PUSH",
|
|
200
200
|
to: h.to
|
|
201
201
|
};
|
|
202
|
-
if (h instanceof
|
|
202
|
+
if (h instanceof se)
|
|
203
203
|
return {
|
|
204
204
|
status: "REJECT",
|
|
205
205
|
type: h.type
|
|
@@ -215,80 +215,80 @@ function xt() {
|
|
|
215
215
|
runAfterRouteHooks: a
|
|
216
216
|
};
|
|
217
217
|
}
|
|
218
|
-
const
|
|
218
|
+
const me = (e, t, n) => {
|
|
219
219
|
const r = e.matches, o = (t == null ? void 0 : t.matches) ?? [];
|
|
220
220
|
return r.length < n || r[n] !== o[n];
|
|
221
|
-
},
|
|
221
|
+
}, ye = (e, t, n) => {
|
|
222
222
|
const r = e.matches, o = (t == null ? void 0 : t.matches) ?? [];
|
|
223
223
|
return r.length < n || r[n] !== o[n];
|
|
224
|
-
},
|
|
225
|
-
function
|
|
224
|
+
}, ge = (e, t, n) => e.matches[n] === (t == null ? void 0 : t.matches[n]);
|
|
225
|
+
function Ae(e) {
|
|
226
226
|
switch (e) {
|
|
227
227
|
case "onBeforeRouteEnter":
|
|
228
228
|
case "onAfterRouteEnter":
|
|
229
|
-
return
|
|
229
|
+
return me;
|
|
230
230
|
case "onBeforeRouteUpdate":
|
|
231
231
|
case "onAfterRouteUpdate":
|
|
232
|
-
return
|
|
232
|
+
return ge;
|
|
233
233
|
case "onBeforeRouteLeave":
|
|
234
234
|
case "onAfterRouteLeave":
|
|
235
|
-
return
|
|
235
|
+
return ye;
|
|
236
236
|
default:
|
|
237
237
|
throw new Error(`Switch is not exhaustive for lifecycle: ${e}`);
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
|
-
class
|
|
240
|
+
class Lt {
|
|
241
241
|
constructor() {
|
|
242
242
|
H(this, "global", new z());
|
|
243
243
|
H(this, "component", new z());
|
|
244
244
|
}
|
|
245
245
|
addBeforeRouteHook({ lifecycle: t, timing: n, depth: r, hook: o }) {
|
|
246
|
-
const a =
|
|
246
|
+
const a = Ae(t), c = this[n][t], s = (u, d) => {
|
|
247
247
|
if (a(u, d.from, r))
|
|
248
248
|
return o(u, d);
|
|
249
249
|
};
|
|
250
|
-
return
|
|
250
|
+
return c.add(s), () => c.delete(s);
|
|
251
251
|
}
|
|
252
252
|
addAfterRouteHook({ lifecycle: t, timing: n, depth: r, hook: o }) {
|
|
253
|
-
const a =
|
|
253
|
+
const a = Ae(t), c = this[n][t], s = (u, d) => {
|
|
254
254
|
if (a(u, d.from, r))
|
|
255
255
|
return o(u, d);
|
|
256
256
|
};
|
|
257
|
-
return
|
|
257
|
+
return c.add(s), () => c.delete(s);
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
|
-
const
|
|
261
|
-
function
|
|
262
|
-
const e = new
|
|
260
|
+
const De = Symbol();
|
|
261
|
+
function Bt() {
|
|
262
|
+
const e = new Lt();
|
|
263
263
|
return {
|
|
264
|
-
onBeforeRouteEnter: (
|
|
265
|
-
onBeforeRouteUpdate: (
|
|
266
|
-
onBeforeRouteLeave: (
|
|
267
|
-
onAfterRouteEnter: (
|
|
268
|
-
onAfterRouteUpdate: (
|
|
269
|
-
onAfterRouteLeave: (
|
|
264
|
+
onBeforeRouteEnter: (s) => e.addBeforeRouteHook({ lifecycle: "onBeforeRouteEnter", hook: s, timing: "global", depth: 0 }),
|
|
265
|
+
onBeforeRouteUpdate: (s) => e.addBeforeRouteHook({ lifecycle: "onBeforeRouteUpdate", hook: s, timing: "global", depth: 0 }),
|
|
266
|
+
onBeforeRouteLeave: (s) => e.addBeforeRouteHook({ lifecycle: "onBeforeRouteLeave", hook: s, timing: "global", depth: 0 }),
|
|
267
|
+
onAfterRouteEnter: (s) => e.addAfterRouteHook({ lifecycle: "onAfterRouteEnter", hook: s, timing: "global", depth: 0 }),
|
|
268
|
+
onAfterRouteUpdate: (s) => e.addAfterRouteHook({ lifecycle: "onAfterRouteUpdate", hook: s, timing: "global", depth: 0 }),
|
|
269
|
+
onAfterRouteLeave: (s) => e.addAfterRouteHook({ lifecycle: "onAfterRouteLeave", hook: s, timing: "global", depth: 0 }),
|
|
270
270
|
hooks: e
|
|
271
271
|
};
|
|
272
272
|
}
|
|
273
|
-
function
|
|
274
|
-
const e =
|
|
273
|
+
function Te() {
|
|
274
|
+
const e = re(De);
|
|
275
275
|
if (!e)
|
|
276
|
-
throw new
|
|
276
|
+
throw new he();
|
|
277
277
|
return e;
|
|
278
278
|
}
|
|
279
|
-
function
|
|
279
|
+
function Me(e) {
|
|
280
280
|
return (t) => {
|
|
281
|
-
const n =
|
|
282
|
-
return
|
|
281
|
+
const n = de(), o = Te().addBeforeRouteHook({ lifecycle: e, hook: t, depth: n, timing: "component" });
|
|
282
|
+
return Ne(o), o;
|
|
283
283
|
};
|
|
284
284
|
}
|
|
285
285
|
function Re(e) {
|
|
286
286
|
return (t) => {
|
|
287
|
-
const n =
|
|
288
|
-
return
|
|
287
|
+
const n = de(), o = Te().addAfterRouteHook({ lifecycle: e, hook: t, depth: n, timing: "component" });
|
|
288
|
+
return Ne(o), o;
|
|
289
289
|
};
|
|
290
290
|
}
|
|
291
|
-
const
|
|
291
|
+
const xn = Me("onBeforeRouteUpdate"), An = Me("onBeforeRouteLeave"), Ln = Re("onAfterRouteEnter"), Bn = Re("onAfterRouteUpdate"), Un = Re("onAfterRouteLeave"), Ut = ["href"], Ht = /* @__PURE__ */ le({
|
|
292
292
|
__name: "routerLink",
|
|
293
293
|
props: {
|
|
294
294
|
to: { type: [String, Function] },
|
|
@@ -296,63 +296,63 @@ const Pn = De("onBeforeRouteUpdate"), kn = De("onBeforeRouteLeave"), Sn = Re("on
|
|
|
296
296
|
replace: { type: Boolean }
|
|
297
297
|
},
|
|
298
298
|
setup(e) {
|
|
299
|
-
const t = e, n =
|
|
300
|
-
const { to:
|
|
301
|
-
return
|
|
299
|
+
const t = e, n = pe(), r = C(() => I(t.to) ? t.to : t.to(n.resolve)), o = C(() => {
|
|
300
|
+
const { to: g, ...A } = t;
|
|
301
|
+
return A;
|
|
302
302
|
}), a = C(() => {
|
|
303
|
-
var
|
|
304
|
-
return (
|
|
305
|
-
}),
|
|
306
|
-
"router-link--match":
|
|
307
|
-
"router-link--exact-match":
|
|
303
|
+
var g;
|
|
304
|
+
return (g = n.find(r.value, o.value)) == null ? void 0 : g.matched;
|
|
305
|
+
}), c = C(() => !!a.value && n.route.matches.includes(oe(a.value))), s = C(() => !!a.value && n.route.matched === a.value), u = C(() => ({
|
|
306
|
+
"router-link--match": c.value,
|
|
307
|
+
"router-link--exact-match": s.value
|
|
308
308
|
})), d = C(() => {
|
|
309
|
-
const { host:
|
|
310
|
-
return
|
|
309
|
+
const { host: g } = new URL(r.value, window.location.origin);
|
|
310
|
+
return g !== window.location.host;
|
|
311
311
|
});
|
|
312
|
-
function m(
|
|
313
|
-
|
|
312
|
+
function m(g) {
|
|
313
|
+
g.preventDefault(), n.push(r.value, o.value);
|
|
314
314
|
}
|
|
315
|
-
return (
|
|
315
|
+
return (g, A) => (ie(), pt("a", {
|
|
316
316
|
href: r.value,
|
|
317
317
|
class: dt(u.value),
|
|
318
318
|
onClick: m
|
|
319
319
|
}, [
|
|
320
|
-
|
|
320
|
+
_e(g.$slots, "default", mt(yt({ resolved: r.value, match: c.value, exactMatch: s.value, isExternal: d.value })))
|
|
321
321
|
], 10, Ut));
|
|
322
322
|
}
|
|
323
|
-
}),
|
|
323
|
+
}), Ke = /* @__PURE__ */ le({
|
|
324
324
|
__name: "routerView",
|
|
325
325
|
setup(e) {
|
|
326
|
-
const t =
|
|
327
|
-
|
|
326
|
+
const t = pe(), n = Pt(), r = de();
|
|
327
|
+
gt(Oe, r + 1);
|
|
328
328
|
const o = C(() => {
|
|
329
|
-
var
|
|
330
|
-
const a = (
|
|
331
|
-
return a ? typeof a == "function" ?
|
|
329
|
+
var c;
|
|
330
|
+
const a = (c = t.route.matches[r]) == null ? void 0 : c.component;
|
|
331
|
+
return a ? typeof a == "function" ? Rt(a) : a : null;
|
|
332
332
|
});
|
|
333
|
-
return (a,
|
|
333
|
+
return (a, c) => ce(n) ? (ie(), ke(Se(ce(n).component), { key: 0 })) : _e(a.$slots, "default", {
|
|
334
334
|
key: 1,
|
|
335
|
-
route:
|
|
335
|
+
route: ce(t).route,
|
|
336
336
|
component: o.value
|
|
337
337
|
}, () => [
|
|
338
|
-
(
|
|
338
|
+
(ie(), ke(Se(o.value)))
|
|
339
339
|
]);
|
|
340
340
|
}
|
|
341
341
|
});
|
|
342
|
-
function
|
|
343
|
-
return
|
|
342
|
+
function q() {
|
|
343
|
+
return q = Object.assign ? Object.assign.bind() : function(e) {
|
|
344
344
|
for (var t = 1; t < arguments.length; t++) {
|
|
345
345
|
var n = arguments[t];
|
|
346
346
|
for (var r in n)
|
|
347
347
|
Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]);
|
|
348
348
|
}
|
|
349
349
|
return e;
|
|
350
|
-
},
|
|
350
|
+
}, q.apply(this, arguments);
|
|
351
351
|
}
|
|
352
|
-
var
|
|
352
|
+
var L;
|
|
353
353
|
(function(e) {
|
|
354
354
|
e.Pop = "POP", e.Push = "PUSH", e.Replace = "REPLACE";
|
|
355
|
-
})(
|
|
355
|
+
})(L || (L = {}));
|
|
356
356
|
var K = process.env.NODE_ENV !== "production" ? function(e) {
|
|
357
357
|
return Object.freeze(e);
|
|
358
358
|
} : function(e) {
|
|
@@ -367,30 +367,30 @@ function D(e, t) {
|
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
|
-
var Y = "beforeunload", $t = "hashchange",
|
|
371
|
-
function
|
|
370
|
+
var Y = "beforeunload", $t = "hashchange", We = "popstate";
|
|
371
|
+
function Le(e) {
|
|
372
372
|
e === void 0 && (e = {});
|
|
373
373
|
var t = e, n = t.window, r = n === void 0 ? document.defaultView : n, o = r.history;
|
|
374
374
|
function a() {
|
|
375
|
-
var l = r.location,
|
|
375
|
+
var l = r.location, i = l.pathname, f = l.search, v = l.hash, w = o.state || {};
|
|
376
376
|
return [w.idx, K({
|
|
377
|
-
pathname:
|
|
377
|
+
pathname: i,
|
|
378
378
|
search: f,
|
|
379
379
|
hash: v,
|
|
380
380
|
state: w.usr || null,
|
|
381
381
|
key: w.key || "default"
|
|
382
382
|
})];
|
|
383
383
|
}
|
|
384
|
-
var
|
|
385
|
-
function
|
|
386
|
-
if (
|
|
387
|
-
h.call(
|
|
384
|
+
var c = null;
|
|
385
|
+
function s() {
|
|
386
|
+
if (c)
|
|
387
|
+
h.call(c), c = null;
|
|
388
388
|
else {
|
|
389
|
-
var l =
|
|
389
|
+
var l = L.Pop, i = a(), f = i[0], v = i[1];
|
|
390
390
|
if (h.length)
|
|
391
391
|
if (f != null) {
|
|
392
392
|
var w = m - f;
|
|
393
|
-
w && (
|
|
393
|
+
w && (c = {
|
|
394
394
|
action: l,
|
|
395
395
|
location: v,
|
|
396
396
|
retry: function() {
|
|
@@ -406,53 +406,53 @@ function ke(e) {
|
|
|
406
406
|
"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."
|
|
407
407
|
);
|
|
408
408
|
else
|
|
409
|
-
|
|
409
|
+
B(l);
|
|
410
410
|
}
|
|
411
411
|
}
|
|
412
|
-
r.addEventListener(
|
|
413
|
-
var u =
|
|
414
|
-
m == null && (m = 0, o.replaceState(
|
|
412
|
+
r.addEventListener(We, s);
|
|
413
|
+
var u = L.Pop, d = a(), m = d[0], g = d[1], A = W(), h = W();
|
|
414
|
+
m == null && (m = 0, o.replaceState(q({}, o.state, {
|
|
415
415
|
idx: m
|
|
416
416
|
}), ""));
|
|
417
417
|
function k(l) {
|
|
418
418
|
return typeof l == "string" ? l : T(l);
|
|
419
419
|
}
|
|
420
|
-
function $(l,
|
|
421
|
-
return
|
|
422
|
-
pathname:
|
|
420
|
+
function $(l, i) {
|
|
421
|
+
return i === void 0 && (i = null), K(q({
|
|
422
|
+
pathname: g.pathname,
|
|
423
423
|
hash: "",
|
|
424
424
|
search: ""
|
|
425
|
-
}, typeof l == "string" ?
|
|
426
|
-
state:
|
|
425
|
+
}, typeof l == "string" ? Q(l) : l, {
|
|
426
|
+
state: i,
|
|
427
427
|
key: Z()
|
|
428
428
|
}));
|
|
429
429
|
}
|
|
430
|
-
function j(l,
|
|
430
|
+
function j(l, i) {
|
|
431
431
|
return [{
|
|
432
432
|
usr: l.state,
|
|
433
433
|
key: l.key,
|
|
434
|
-
idx:
|
|
434
|
+
idx: i
|
|
435
435
|
}, k(l)];
|
|
436
436
|
}
|
|
437
|
-
function U(l,
|
|
437
|
+
function U(l, i, f) {
|
|
438
438
|
return !h.length || (h.call({
|
|
439
439
|
action: l,
|
|
440
|
-
location:
|
|
440
|
+
location: i,
|
|
441
441
|
retry: f
|
|
442
442
|
}), !1);
|
|
443
443
|
}
|
|
444
|
-
function
|
|
444
|
+
function B(l) {
|
|
445
445
|
u = l;
|
|
446
|
-
var
|
|
447
|
-
m =
|
|
446
|
+
var i = a();
|
|
447
|
+
m = i[0], g = i[1], A.call({
|
|
448
448
|
action: u,
|
|
449
|
-
location:
|
|
449
|
+
location: g
|
|
450
450
|
});
|
|
451
451
|
}
|
|
452
|
-
function p(l,
|
|
453
|
-
var f =
|
|
452
|
+
function p(l, i) {
|
|
453
|
+
var f = L.Push, v = $(l, i);
|
|
454
454
|
function w() {
|
|
455
|
-
p(l,
|
|
455
|
+
p(l, i);
|
|
456
456
|
}
|
|
457
457
|
if (U(f, v, w)) {
|
|
458
458
|
var S = j(v, m + 1), y = S[0], P = S[1];
|
|
@@ -461,17 +461,17 @@ function ke(e) {
|
|
|
461
461
|
} catch {
|
|
462
462
|
r.location.assign(P);
|
|
463
463
|
}
|
|
464
|
-
|
|
464
|
+
B(f);
|
|
465
465
|
}
|
|
466
466
|
}
|
|
467
|
-
function
|
|
468
|
-
var f =
|
|
467
|
+
function R(l, i) {
|
|
468
|
+
var f = L.Replace, v = $(l, i);
|
|
469
469
|
function w() {
|
|
470
|
-
|
|
470
|
+
R(l, i);
|
|
471
471
|
}
|
|
472
472
|
if (U(f, v, w)) {
|
|
473
473
|
var S = j(v, m), y = S[0], P = S[1];
|
|
474
|
-
o.replaceState(y, "", P),
|
|
474
|
+
o.replaceState(y, "", P), B(f);
|
|
475
475
|
}
|
|
476
476
|
}
|
|
477
477
|
function E(l) {
|
|
@@ -482,11 +482,11 @@ function ke(e) {
|
|
|
482
482
|
return u;
|
|
483
483
|
},
|
|
484
484
|
get location() {
|
|
485
|
-
return
|
|
485
|
+
return g;
|
|
486
486
|
},
|
|
487
487
|
createHref: k,
|
|
488
488
|
push: p,
|
|
489
|
-
replace:
|
|
489
|
+
replace: R,
|
|
490
490
|
go: E,
|
|
491
491
|
back: function() {
|
|
492
492
|
E(-1);
|
|
@@ -494,11 +494,11 @@ function ke(e) {
|
|
|
494
494
|
forward: function() {
|
|
495
495
|
E(1);
|
|
496
496
|
},
|
|
497
|
-
listen: function(
|
|
498
|
-
return
|
|
497
|
+
listen: function(i) {
|
|
498
|
+
return A.push(i);
|
|
499
499
|
},
|
|
500
|
-
block: function(
|
|
501
|
-
var f = h.push(
|
|
500
|
+
block: function(i) {
|
|
501
|
+
var f = h.push(i);
|
|
502
502
|
return h.length === 1 && r.addEventListener(Y, X), function() {
|
|
503
503
|
f(), h.length || r.removeEventListener(Y, X);
|
|
504
504
|
};
|
|
@@ -510,26 +510,26 @@ function jt(e) {
|
|
|
510
510
|
e === void 0 && (e = {});
|
|
511
511
|
var t = e, n = t.window, r = n === void 0 ? document.defaultView : n, o = r.history;
|
|
512
512
|
function a() {
|
|
513
|
-
var
|
|
514
|
-
return [
|
|
513
|
+
var i = Q(r.location.hash.substr(1)), f = i.pathname, v = f === void 0 ? "/" : f, w = i.search, S = w === void 0 ? "" : w, y = i.hash, P = y === void 0 ? "" : y, x = o.state || {};
|
|
514
|
+
return [x.idx, K({
|
|
515
515
|
pathname: v,
|
|
516
516
|
search: S,
|
|
517
517
|
hash: P,
|
|
518
|
-
state:
|
|
519
|
-
key:
|
|
518
|
+
state: x.usr || null,
|
|
519
|
+
key: x.key || "default"
|
|
520
520
|
})];
|
|
521
521
|
}
|
|
522
|
-
var
|
|
523
|
-
function
|
|
524
|
-
if (
|
|
525
|
-
h.call(
|
|
522
|
+
var c = null;
|
|
523
|
+
function s() {
|
|
524
|
+
if (c)
|
|
525
|
+
h.call(c), c = null;
|
|
526
526
|
else {
|
|
527
|
-
var
|
|
527
|
+
var i = L.Pop, f = a(), v = f[0], w = f[1];
|
|
528
528
|
if (h.length)
|
|
529
529
|
if (v != null) {
|
|
530
530
|
var S = m - v;
|
|
531
|
-
S && (
|
|
532
|
-
action:
|
|
531
|
+
S && (c = {
|
|
532
|
+
action: i,
|
|
533
533
|
location: w,
|
|
534
534
|
retry: function() {
|
|
535
535
|
b(S * -1);
|
|
@@ -544,97 +544,97 @@ function jt(e) {
|
|
|
544
544
|
"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."
|
|
545
545
|
);
|
|
546
546
|
else
|
|
547
|
-
p(
|
|
547
|
+
p(i);
|
|
548
548
|
}
|
|
549
549
|
}
|
|
550
|
-
r.addEventListener(
|
|
551
|
-
var
|
|
552
|
-
T(f) !== T(
|
|
550
|
+
r.addEventListener(We, s), r.addEventListener($t, function() {
|
|
551
|
+
var i = a(), f = i[1];
|
|
552
|
+
T(f) !== T(g) && s();
|
|
553
553
|
});
|
|
554
|
-
var u =
|
|
555
|
-
m == null && (m = 0, o.replaceState(
|
|
554
|
+
var u = L.Pop, d = a(), m = d[0], g = d[1], A = W(), h = W();
|
|
555
|
+
m == null && (m = 0, o.replaceState(q({}, o.state, {
|
|
556
556
|
idx: m
|
|
557
557
|
}), ""));
|
|
558
558
|
function k() {
|
|
559
|
-
var
|
|
560
|
-
if (
|
|
559
|
+
var i = document.querySelector("base"), f = "";
|
|
560
|
+
if (i && i.getAttribute("href")) {
|
|
561
561
|
var v = r.location.href, w = v.indexOf("#");
|
|
562
562
|
f = w === -1 ? v : v.slice(0, w);
|
|
563
563
|
}
|
|
564
564
|
return f;
|
|
565
565
|
}
|
|
566
|
-
function $(
|
|
567
|
-
return k() + "#" + (typeof
|
|
566
|
+
function $(i) {
|
|
567
|
+
return k() + "#" + (typeof i == "string" ? i : T(i));
|
|
568
568
|
}
|
|
569
|
-
function j(
|
|
570
|
-
return f === void 0 && (f = null), K(
|
|
571
|
-
pathname:
|
|
569
|
+
function j(i, f) {
|
|
570
|
+
return f === void 0 && (f = null), K(q({
|
|
571
|
+
pathname: g.pathname,
|
|
572
572
|
hash: "",
|
|
573
573
|
search: ""
|
|
574
|
-
}, typeof
|
|
574
|
+
}, typeof i == "string" ? Q(i) : i, {
|
|
575
575
|
state: f,
|
|
576
576
|
key: Z()
|
|
577
577
|
}));
|
|
578
578
|
}
|
|
579
|
-
function U(
|
|
579
|
+
function U(i, f) {
|
|
580
580
|
return [{
|
|
581
|
-
usr:
|
|
582
|
-
key:
|
|
581
|
+
usr: i.state,
|
|
582
|
+
key: i.key,
|
|
583
583
|
idx: f
|
|
584
|
-
}, $(
|
|
584
|
+
}, $(i)];
|
|
585
585
|
}
|
|
586
|
-
function
|
|
586
|
+
function B(i, f, v) {
|
|
587
587
|
return !h.length || (h.call({
|
|
588
|
-
action:
|
|
588
|
+
action: i,
|
|
589
589
|
location: f,
|
|
590
590
|
retry: v
|
|
591
591
|
}), !1);
|
|
592
592
|
}
|
|
593
|
-
function p(
|
|
594
|
-
u =
|
|
593
|
+
function p(i) {
|
|
594
|
+
u = i;
|
|
595
595
|
var f = a();
|
|
596
|
-
m = f[0],
|
|
596
|
+
m = f[0], g = f[1], A.call({
|
|
597
597
|
action: u,
|
|
598
|
-
location:
|
|
598
|
+
location: g
|
|
599
599
|
});
|
|
600
600
|
}
|
|
601
|
-
function
|
|
602
|
-
var v =
|
|
601
|
+
function R(i, f) {
|
|
602
|
+
var v = L.Push, w = j(i, f);
|
|
603
603
|
function S() {
|
|
604
|
-
|
|
604
|
+
R(i, f);
|
|
605
605
|
}
|
|
606
|
-
if (process.env.NODE_ENV !== "production" && D(w.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.push(" + JSON.stringify(
|
|
607
|
-
var y = U(w, m + 1), P = y[0],
|
|
606
|
+
if (process.env.NODE_ENV !== "production" && D(w.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.push(" + JSON.stringify(i) + ")"), B(v, w, S)) {
|
|
607
|
+
var y = U(w, m + 1), P = y[0], x = y[1];
|
|
608
608
|
try {
|
|
609
|
-
o.pushState(P, "",
|
|
609
|
+
o.pushState(P, "", x);
|
|
610
610
|
} catch {
|
|
611
|
-
r.location.assign(
|
|
611
|
+
r.location.assign(x);
|
|
612
612
|
}
|
|
613
613
|
p(v);
|
|
614
614
|
}
|
|
615
615
|
}
|
|
616
|
-
function E(
|
|
617
|
-
var v =
|
|
616
|
+
function E(i, f) {
|
|
617
|
+
var v = L.Replace, w = j(i, f);
|
|
618
618
|
function S() {
|
|
619
|
-
E(
|
|
619
|
+
E(i, f);
|
|
620
620
|
}
|
|
621
|
-
if (process.env.NODE_ENV !== "production" && D(w.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.replace(" + JSON.stringify(
|
|
622
|
-
var y = U(w, m), P = y[0],
|
|
623
|
-
o.replaceState(P, "",
|
|
621
|
+
if (process.env.NODE_ENV !== "production" && D(w.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.replace(" + JSON.stringify(i) + ")"), B(v, w, S)) {
|
|
622
|
+
var y = U(w, m), P = y[0], x = y[1];
|
|
623
|
+
o.replaceState(P, "", x), p(v);
|
|
624
624
|
}
|
|
625
625
|
}
|
|
626
|
-
function b(
|
|
627
|
-
o.go(
|
|
626
|
+
function b(i) {
|
|
627
|
+
o.go(i);
|
|
628
628
|
}
|
|
629
629
|
var l = {
|
|
630
630
|
get action() {
|
|
631
631
|
return u;
|
|
632
632
|
},
|
|
633
633
|
get location() {
|
|
634
|
-
return
|
|
634
|
+
return g;
|
|
635
635
|
},
|
|
636
636
|
createHref: $,
|
|
637
|
-
push:
|
|
637
|
+
push: R,
|
|
638
638
|
replace: E,
|
|
639
639
|
go: b,
|
|
640
640
|
back: function() {
|
|
@@ -644,7 +644,7 @@ function jt(e) {
|
|
|
644
644
|
b(1);
|
|
645
645
|
},
|
|
646
646
|
listen: function(f) {
|
|
647
|
-
return
|
|
647
|
+
return A.push(f);
|
|
648
648
|
},
|
|
649
649
|
block: function(f) {
|
|
650
650
|
var v = h.push(f);
|
|
@@ -655,76 +655,76 @@ function jt(e) {
|
|
|
655
655
|
};
|
|
656
656
|
return l;
|
|
657
657
|
}
|
|
658
|
-
function
|
|
658
|
+
function Be(e) {
|
|
659
659
|
e === void 0 && (e = {});
|
|
660
660
|
var t = e, n = t.initialEntries, r = n === void 0 ? ["/"] : n, o = t.initialIndex, a = r.map(function(p) {
|
|
661
|
-
var
|
|
661
|
+
var R = K(q({
|
|
662
662
|
pathname: "/",
|
|
663
663
|
search: "",
|
|
664
664
|
hash: "",
|
|
665
665
|
state: null,
|
|
666
666
|
key: Z()
|
|
667
|
-
}, typeof p == "string" ?
|
|
668
|
-
return process.env.NODE_ENV !== "production" && D(
|
|
669
|
-
}),
|
|
670
|
-
function
|
|
667
|
+
}, typeof p == "string" ? Q(p) : p));
|
|
668
|
+
return process.env.NODE_ENV !== "production" && D(R.pathname.charAt(0) === "/", "Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: " + JSON.stringify(p) + ")"), R;
|
|
669
|
+
}), c = Ue(o ?? a.length - 1, 0, a.length - 1), s = L.Pop, u = a[c], d = W(), m = W();
|
|
670
|
+
function g(p) {
|
|
671
671
|
return typeof p == "string" ? p : T(p);
|
|
672
672
|
}
|
|
673
|
-
function
|
|
674
|
-
return
|
|
673
|
+
function A(p, R) {
|
|
674
|
+
return R === void 0 && (R = null), K(q({
|
|
675
675
|
pathname: u.pathname,
|
|
676
676
|
search: "",
|
|
677
677
|
hash: ""
|
|
678
|
-
}, typeof p == "string" ?
|
|
679
|
-
state:
|
|
678
|
+
}, typeof p == "string" ? Q(p) : p, {
|
|
679
|
+
state: R,
|
|
680
680
|
key: Z()
|
|
681
681
|
}));
|
|
682
682
|
}
|
|
683
|
-
function h(p,
|
|
683
|
+
function h(p, R, E) {
|
|
684
684
|
return !m.length || (m.call({
|
|
685
685
|
action: p,
|
|
686
|
-
location:
|
|
686
|
+
location: R,
|
|
687
687
|
retry: E
|
|
688
688
|
}), !1);
|
|
689
689
|
}
|
|
690
|
-
function k(p,
|
|
691
|
-
|
|
692
|
-
action:
|
|
690
|
+
function k(p, R) {
|
|
691
|
+
s = p, u = R, d.call({
|
|
692
|
+
action: s,
|
|
693
693
|
location: u
|
|
694
694
|
});
|
|
695
695
|
}
|
|
696
|
-
function $(p,
|
|
697
|
-
var E =
|
|
696
|
+
function $(p, R) {
|
|
697
|
+
var E = L.Push, b = A(p, R);
|
|
698
698
|
function l() {
|
|
699
|
-
$(p,
|
|
699
|
+
$(p, R);
|
|
700
700
|
}
|
|
701
|
-
process.env.NODE_ENV !== "production" && D(u.pathname.charAt(0) === "/", "Relative pathnames are not supported in memory history.push(" + JSON.stringify(p) + ")"), h(E, b, l) && (
|
|
701
|
+
process.env.NODE_ENV !== "production" && D(u.pathname.charAt(0) === "/", "Relative pathnames are not supported in memory history.push(" + JSON.stringify(p) + ")"), h(E, b, l) && (c += 1, a.splice(c, a.length, b), k(E, b));
|
|
702
702
|
}
|
|
703
|
-
function j(p,
|
|
704
|
-
var E =
|
|
703
|
+
function j(p, R) {
|
|
704
|
+
var E = L.Replace, b = A(p, R);
|
|
705
705
|
function l() {
|
|
706
|
-
j(p,
|
|
706
|
+
j(p, R);
|
|
707
707
|
}
|
|
708
|
-
process.env.NODE_ENV !== "production" && D(u.pathname.charAt(0) === "/", "Relative pathnames are not supported in memory history.replace(" + JSON.stringify(p) + ")"), h(E, b, l) && (a[
|
|
708
|
+
process.env.NODE_ENV !== "production" && D(u.pathname.charAt(0) === "/", "Relative pathnames are not supported in memory history.replace(" + JSON.stringify(p) + ")"), h(E, b, l) && (a[c] = b, k(E, b));
|
|
709
709
|
}
|
|
710
710
|
function U(p) {
|
|
711
|
-
var
|
|
711
|
+
var R = Ue(c + p, 0, a.length - 1), E = L.Pop, b = a[R];
|
|
712
712
|
function l() {
|
|
713
713
|
U(p);
|
|
714
714
|
}
|
|
715
|
-
h(E, b, l) && (
|
|
715
|
+
h(E, b, l) && (c = R, k(E, b));
|
|
716
716
|
}
|
|
717
|
-
var
|
|
717
|
+
var B = {
|
|
718
718
|
get index() {
|
|
719
|
-
return
|
|
719
|
+
return c;
|
|
720
720
|
},
|
|
721
721
|
get action() {
|
|
722
|
-
return
|
|
722
|
+
return s;
|
|
723
723
|
},
|
|
724
724
|
get location() {
|
|
725
725
|
return u;
|
|
726
726
|
},
|
|
727
|
-
createHref:
|
|
727
|
+
createHref: g,
|
|
728
728
|
push: $,
|
|
729
729
|
replace: j,
|
|
730
730
|
go: U,
|
|
@@ -734,16 +734,16 @@ function Se(e) {
|
|
|
734
734
|
forward: function() {
|
|
735
735
|
U(1);
|
|
736
736
|
},
|
|
737
|
-
listen: function(
|
|
738
|
-
return d.push(
|
|
737
|
+
listen: function(R) {
|
|
738
|
+
return d.push(R);
|
|
739
739
|
},
|
|
740
|
-
block: function(
|
|
741
|
-
return m.push(
|
|
740
|
+
block: function(R) {
|
|
741
|
+
return m.push(R);
|
|
742
742
|
}
|
|
743
743
|
};
|
|
744
|
-
return
|
|
744
|
+
return B;
|
|
745
745
|
}
|
|
746
|
-
function
|
|
746
|
+
function Ue(e, t, n) {
|
|
747
747
|
return Math.min(Math.max(e, t), n);
|
|
748
748
|
}
|
|
749
749
|
function X(e) {
|
|
@@ -773,10 +773,10 @@ function Z() {
|
|
|
773
773
|
return Math.random().toString(36).substr(2, 8);
|
|
774
774
|
}
|
|
775
775
|
function T(e) {
|
|
776
|
-
var t = e.pathname, n = t === void 0 ? "/" : t, r = e.search, o = r === void 0 ? "" : r, a = e.hash,
|
|
777
|
-
return o && o !== "?" && (n += o.charAt(0) === "?" ? o : "?" + o),
|
|
776
|
+
var t = e.pathname, n = t === void 0 ? "/" : t, r = e.search, o = r === void 0 ? "" : r, a = e.hash, c = a === void 0 ? "" : a;
|
|
777
|
+
return o && o !== "?" && (n += o.charAt(0) === "?" ? o : "?" + o), c && c !== "#" && (n += c.charAt(0) === "#" ? c : "#" + c), n;
|
|
778
778
|
}
|
|
779
|
-
function
|
|
779
|
+
function Q(e) {
|
|
780
780
|
var t = {};
|
|
781
781
|
if (e) {
|
|
782
782
|
var n = e.indexOf("#");
|
|
@@ -789,30 +789,30 @@ function J(e) {
|
|
|
789
789
|
function Nt(e, t) {
|
|
790
790
|
function n(r, o, a) {
|
|
791
791
|
if (typeof r == "object") {
|
|
792
|
-
const
|
|
792
|
+
const s = {
|
|
793
793
|
...e.params,
|
|
794
794
|
...r
|
|
795
795
|
};
|
|
796
|
-
return t(e.key,
|
|
796
|
+
return t(e.key, s, o);
|
|
797
797
|
}
|
|
798
|
-
const
|
|
798
|
+
const c = {
|
|
799
799
|
...e.params,
|
|
800
800
|
[r]: o
|
|
801
801
|
};
|
|
802
|
-
return t(e.key,
|
|
802
|
+
return t(e.key, c, a);
|
|
803
803
|
}
|
|
804
804
|
return new Proxy(e, {
|
|
805
805
|
get: (r, o, a) => o === "update" ? n : o === "params" ? new Proxy(e.params, {
|
|
806
|
-
set(
|
|
807
|
-
return n(
|
|
806
|
+
set(c, s, u) {
|
|
807
|
+
return n(s, u), !0;
|
|
808
808
|
}
|
|
809
809
|
}) : Reflect.get(r, o, a)
|
|
810
810
|
});
|
|
811
811
|
}
|
|
812
812
|
function _t(e, t) {
|
|
813
|
-
const n = vt({ ...e }), r = (
|
|
814
|
-
Object.assign(n, { ...
|
|
815
|
-
}, o =
|
|
813
|
+
const n = vt({ ...e }), r = (c) => {
|
|
814
|
+
Object.assign(n, { ...c });
|
|
815
|
+
}, o = oe(n), a = Nt(o, t);
|
|
816
816
|
return {
|
|
817
817
|
currentRoute: o,
|
|
818
818
|
routerRoute: a,
|
|
@@ -821,33 +821,33 @@ function _t(e, t) {
|
|
|
821
821
|
}
|
|
822
822
|
class ee extends Error {
|
|
823
823
|
}
|
|
824
|
-
function
|
|
824
|
+
function Vt(e) {
|
|
825
825
|
return e !== String && e !== Boolean && e !== Number;
|
|
826
826
|
}
|
|
827
827
|
function Ct(e) {
|
|
828
|
-
return typeof e == "function" &&
|
|
828
|
+
return typeof e == "function" && Vt(e);
|
|
829
829
|
}
|
|
830
|
-
function
|
|
830
|
+
function Fe(e) {
|
|
831
831
|
return typeof e == "object" && "get" in e && typeof e.get == "function" && "set" in e && typeof e.set == "function";
|
|
832
832
|
}
|
|
833
|
-
function
|
|
833
|
+
function te(e) {
|
|
834
834
|
return typeof e == "string" && e.length > 0;
|
|
835
835
|
}
|
|
836
|
-
function
|
|
836
|
+
function qt(e, t) {
|
|
837
837
|
return e[t] ?? String;
|
|
838
838
|
}
|
|
839
|
-
const
|
|
840
|
-
function
|
|
841
|
-
return
|
|
839
|
+
const Ie = Symbol();
|
|
840
|
+
function Qe(e) {
|
|
841
|
+
return Ie in e;
|
|
842
842
|
}
|
|
843
843
|
function Ot(e) {
|
|
844
844
|
return {
|
|
845
|
-
[
|
|
845
|
+
[Ie]: !0,
|
|
846
846
|
get: (t) => {
|
|
847
|
-
if (
|
|
848
|
-
return
|
|
847
|
+
if (te(t))
|
|
848
|
+
return ve(t, e);
|
|
849
849
|
},
|
|
850
|
-
set: (t) =>
|
|
850
|
+
set: (t) => te(t) ? we(t, e) : ""
|
|
851
851
|
};
|
|
852
852
|
}
|
|
853
853
|
const N = {
|
|
@@ -861,7 +861,7 @@ const N = {
|
|
|
861
861
|
throw t();
|
|
862
862
|
return e;
|
|
863
863
|
}
|
|
864
|
-
},
|
|
864
|
+
}, Je = {
|
|
865
865
|
get: (e, { invalid: t }) => {
|
|
866
866
|
if (e === "true")
|
|
867
867
|
return !0;
|
|
@@ -874,7 +874,7 @@ const N = {
|
|
|
874
874
|
throw t();
|
|
875
875
|
return e.toString();
|
|
876
876
|
}
|
|
877
|
-
},
|
|
877
|
+
}, Ge = {
|
|
878
878
|
get: (e, { invalid: t }) => {
|
|
879
879
|
const n = Number(e);
|
|
880
880
|
if (isNaN(n))
|
|
@@ -887,21 +887,21 @@ const N = {
|
|
|
887
887
|
return e.toString();
|
|
888
888
|
}
|
|
889
889
|
};
|
|
890
|
-
function
|
|
890
|
+
function ve(e, t) {
|
|
891
891
|
if (e === void 0) {
|
|
892
|
-
if (
|
|
892
|
+
if (Qe(t))
|
|
893
893
|
return t.get(e, N);
|
|
894
894
|
throw new ee();
|
|
895
895
|
}
|
|
896
896
|
if (t === String)
|
|
897
897
|
return Dt.get(e, N);
|
|
898
898
|
if (t === Boolean)
|
|
899
|
-
return Ie.get(e, N);
|
|
900
|
-
if (t === Number)
|
|
901
899
|
return Je.get(e, N);
|
|
900
|
+
if (t === Number)
|
|
901
|
+
return Ge.get(e, N);
|
|
902
902
|
if (Ct(t))
|
|
903
903
|
return t(e, N);
|
|
904
|
-
if (
|
|
904
|
+
if (Fe(t))
|
|
905
905
|
return t.get(e, N);
|
|
906
906
|
if (t instanceof RegExp) {
|
|
907
907
|
if (t.test(e))
|
|
@@ -910,12 +910,12 @@ function Qe(e, t) {
|
|
|
910
910
|
}
|
|
911
911
|
return e;
|
|
912
912
|
}
|
|
913
|
-
function
|
|
913
|
+
function we(e, t) {
|
|
914
914
|
if (t === Boolean)
|
|
915
|
-
return Ie.set(e, N);
|
|
916
|
-
if (t === Number)
|
|
917
915
|
return Je.set(e, N);
|
|
918
|
-
if (
|
|
916
|
+
if (t === Number)
|
|
917
|
+
return Ge.set(e, N);
|
|
918
|
+
if (Fe(t))
|
|
919
919
|
return t.set(e, N);
|
|
920
920
|
try {
|
|
921
921
|
return e.toString();
|
|
@@ -924,44 +924,51 @@ function Ge(e, t) {
|
|
|
924
924
|
}
|
|
925
925
|
}
|
|
926
926
|
function Tt(e) {
|
|
927
|
-
const t =
|
|
927
|
+
const t = Ee(e.path.toString());
|
|
928
928
|
return new RegExp(`^${t}$`, "i");
|
|
929
929
|
}
|
|
930
930
|
function Mt(e) {
|
|
931
931
|
const t = new URLSearchParams(e.query.toString());
|
|
932
|
-
return Array.from(t.entries()).filter(([, n]) => !
|
|
932
|
+
return Array.from(t.entries()).filter(([, n]) => !Ye(n)).map(([n, r]) => new RegExp(`${n}=${Ee(r)}(&|$)`, "i"));
|
|
933
933
|
}
|
|
934
|
-
function
|
|
934
|
+
function Ee(e) {
|
|
935
935
|
return [
|
|
936
|
-
|
|
937
|
-
|
|
936
|
+
Kt,
|
|
937
|
+
Wt
|
|
938
938
|
].reduce((t, n) => n(t), e);
|
|
939
939
|
}
|
|
940
|
-
const
|
|
940
|
+
const be = ":\\?([\\w]+)(?=\\W|$)", ze = ":([\\w]+)(?=\\W|$)";
|
|
941
|
+
function Kt(e) {
|
|
942
|
+
return e.replace(new RegExp(be, "g"), "[^\\/]*");
|
|
943
|
+
}
|
|
944
|
+
function Ye(e) {
|
|
945
|
+
return new RegExp(be, "g").test(e);
|
|
946
|
+
}
|
|
941
947
|
function Wt(e) {
|
|
942
|
-
return e.replace(ze, "[^\\/]
|
|
948
|
+
return e.replace(new RegExp(ze, "g"), "[^\\/]+");
|
|
943
949
|
}
|
|
944
950
|
function Ft(e) {
|
|
945
|
-
|
|
951
|
+
const [t] = ne(e, new RegExp(be, "g")), [n] = ne(e, new RegExp(ze, "g"));
|
|
952
|
+
return t ?? n;
|
|
946
953
|
}
|
|
947
|
-
function
|
|
948
|
-
return e.
|
|
954
|
+
function ne(e, t) {
|
|
955
|
+
return Array.from(e.matchAll(t)).flatMap(([, ...r]) => r.map((o) => te(o) ? o : ""));
|
|
949
956
|
}
|
|
950
|
-
function
|
|
951
|
-
const r =
|
|
957
|
+
function Xe(e, t, n) {
|
|
958
|
+
const r = Ze(t, n), [o] = ne(e, r);
|
|
952
959
|
return o;
|
|
953
960
|
}
|
|
954
|
-
function
|
|
961
|
+
function It(e, t) {
|
|
955
962
|
if (!t)
|
|
956
963
|
return e;
|
|
957
|
-
const { name: n, param: r, value: o } = t, a =
|
|
958
|
-
return
|
|
964
|
+
const { name: n, param: r, value: o } = t, a = Ze(e, n);
|
|
965
|
+
return ne(e, a).reduce((s, u) => u === void 0 ? s : s.replace(u, () => we(o, r)), e);
|
|
959
966
|
}
|
|
960
|
-
function
|
|
967
|
+
function Ze(e, t) {
|
|
961
968
|
const n = [
|
|
962
969
|
Qt,
|
|
963
|
-
|
|
964
|
-
|
|
970
|
+
Jt,
|
|
971
|
+
Ee
|
|
965
972
|
].reduce((r, o) => o(r, t), e);
|
|
966
973
|
return new RegExp(n, "g");
|
|
967
974
|
}
|
|
@@ -969,13 +976,10 @@ function Qt(e, t) {
|
|
|
969
976
|
const n = new RegExp(`(:\\?${t})(?=\\W|$)`, "g");
|
|
970
977
|
return e.replace(n, "([^\\/]*)");
|
|
971
978
|
}
|
|
972
|
-
function
|
|
979
|
+
function Jt(e, t) {
|
|
973
980
|
const n = new RegExp(`(:${t})(?=\\W|$)`, "g");
|
|
974
981
|
return e.replace(n, "([^\\/]+)");
|
|
975
982
|
}
|
|
976
|
-
function Ze(e, t) {
|
|
977
|
-
return Array.from(e.matchAll(t)).flatMap(([, ...r]) => r.map((o) => ie(o) ? o : ""));
|
|
978
|
-
}
|
|
979
983
|
function et(e, ...t) {
|
|
980
984
|
return t.reduce((n, r) => {
|
|
981
985
|
if (!r)
|
|
@@ -984,43 +988,55 @@ function et(e, ...t) {
|
|
|
984
988
|
return Object.keys(o).length === 0 ? n : n.includes("?") ? `${n}&${o}` : `${n}?${o}`;
|
|
985
989
|
}, e);
|
|
986
990
|
}
|
|
987
|
-
function
|
|
988
|
-
const { params: n = {}, query: r } = t, o =
|
|
989
|
-
return et(
|
|
991
|
+
function Gt(e, t = {}) {
|
|
992
|
+
const { params: n = {}, query: r } = t, o = { ...e.path.params, ...e.query.params }, a = e.path.toString(), c = e.query.toString(), s = zt(a, o, n), u = Yt(c, o, n);
|
|
993
|
+
return et(s, u, r);
|
|
994
|
+
}
|
|
995
|
+
function zt(e, t, n) {
|
|
996
|
+
return e.length ? Object.entries(t).reduce((r, [o, a]) => It(r, { name: o, param: a, value: n[o] }), e) : e;
|
|
990
997
|
}
|
|
991
|
-
function
|
|
992
|
-
|
|
998
|
+
function Yt(e, t, n) {
|
|
999
|
+
if (!e.length)
|
|
1000
|
+
return {};
|
|
1001
|
+
const r = new URLSearchParams(e);
|
|
1002
|
+
return Array.from(r.entries()).reduce((o, [a, c]) => {
|
|
1003
|
+
const s = Ft(c);
|
|
1004
|
+
if (!s)
|
|
1005
|
+
return { ...o, [a]: c };
|
|
1006
|
+
const u = we(n[s], t[s]);
|
|
1007
|
+
return Ye(c) && n[s] === void 0 && u === "" ? o : { ...o, [a]: u };
|
|
1008
|
+
}, {});
|
|
993
1009
|
}
|
|
994
1010
|
function tt(e) {
|
|
995
1011
|
return (t, n, r) => {
|
|
996
1012
|
if (I(t))
|
|
997
1013
|
return et(t, (n ?? {}).query);
|
|
998
|
-
const o = n ?? {}, a = r ?? {},
|
|
999
|
-
if (!
|
|
1014
|
+
const o = n ?? {}, a = r ?? {}, c = e.find((u) => u.key === t);
|
|
1015
|
+
if (!c)
|
|
1000
1016
|
throw `Route not found: "${String(t)}"`;
|
|
1001
|
-
if (
|
|
1017
|
+
if (c.matched.disabled)
|
|
1002
1018
|
throw `Route disabled: "${String(t)}"`;
|
|
1003
|
-
return
|
|
1019
|
+
return Gt(c, {
|
|
1004
1020
|
params: o,
|
|
1005
1021
|
query: a.query
|
|
1006
1022
|
});
|
|
1007
1023
|
};
|
|
1008
1024
|
}
|
|
1009
|
-
function
|
|
1010
|
-
return !e.startsWith("http") ?
|
|
1025
|
+
function J(e) {
|
|
1026
|
+
return !e.startsWith("http") ? Zt(e) : Xt(e);
|
|
1011
1027
|
}
|
|
1012
|
-
function
|
|
1013
|
-
const { protocol: t, host: n, pathname: r, search: o, searchParams: a, hash:
|
|
1028
|
+
function Xt(e) {
|
|
1029
|
+
const { protocol: t, host: n, pathname: r, search: o, searchParams: a, hash: c } = new URL(e, e);
|
|
1014
1030
|
return {
|
|
1015
1031
|
protocol: t,
|
|
1016
1032
|
host: n,
|
|
1017
1033
|
pathname: r,
|
|
1018
1034
|
search: o,
|
|
1019
1035
|
searchParams: a,
|
|
1020
|
-
hash:
|
|
1036
|
+
hash: c
|
|
1021
1037
|
};
|
|
1022
1038
|
}
|
|
1023
|
-
function
|
|
1039
|
+
function Zt(e) {
|
|
1024
1040
|
const { pathname: t, search: n, searchParams: r, hash: o } = new URL(e, "https://localhost");
|
|
1025
1041
|
return {
|
|
1026
1042
|
pathname: t,
|
|
@@ -1036,7 +1052,7 @@ function nt(e) {
|
|
|
1036
1052
|
getAll: (n) => t.getAll(n)
|
|
1037
1053
|
};
|
|
1038
1054
|
}
|
|
1039
|
-
const
|
|
1055
|
+
const en = (e, t) => {
|
|
1040
1056
|
try {
|
|
1041
1057
|
rt(e, t);
|
|
1042
1058
|
} catch {
|
|
@@ -1044,55 +1060,65 @@ const Zt = (e, t) => {
|
|
|
1044
1060
|
}
|
|
1045
1061
|
return !0;
|
|
1046
1062
|
}, rt = (e, t) => {
|
|
1047
|
-
const { pathname: n, search: r } =
|
|
1063
|
+
const { pathname: n, search: r } = J(t);
|
|
1048
1064
|
return {
|
|
1049
|
-
...
|
|
1050
|
-
...
|
|
1065
|
+
...tn(e.path, n),
|
|
1066
|
+
...nn(e.query, r)
|
|
1051
1067
|
};
|
|
1052
|
-
}
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
r
|
|
1068
|
+
};
|
|
1069
|
+
function tn(e, t) {
|
|
1070
|
+
const n = {}, r = decodeURIComponent(t);
|
|
1071
|
+
for (const [o, a] of Object.entries(e.params)) {
|
|
1072
|
+
const c = Xe(r, e.toString(), o), s = ve(c, a);
|
|
1073
|
+
n[o] = s;
|
|
1057
1074
|
}
|
|
1058
|
-
return
|
|
1059
|
-
}
|
|
1060
|
-
|
|
1075
|
+
return n;
|
|
1076
|
+
}
|
|
1077
|
+
function nn(e, t) {
|
|
1078
|
+
const n = {}, r = new URLSearchParams(t);
|
|
1079
|
+
for (const [o, a] of Object.entries(e.params)) {
|
|
1080
|
+
const c = r.get(o) ?? void 0, s = ve(c, a);
|
|
1081
|
+
n[o] = s;
|
|
1082
|
+
}
|
|
1083
|
+
return n;
|
|
1084
|
+
}
|
|
1085
|
+
const rn = (e, t) => {
|
|
1086
|
+
const { pathname: n } = J(t);
|
|
1061
1087
|
return Tt(e).test(n);
|
|
1062
|
-
},
|
|
1063
|
-
const { search: n } =
|
|
1088
|
+
}, on = (e, t) => {
|
|
1089
|
+
const { search: n } = J(t);
|
|
1064
1090
|
return Mt(e).every((o) => o.test(n));
|
|
1065
1091
|
};
|
|
1066
|
-
function
|
|
1067
|
-
const { searchParams: t, pathname: n } =
|
|
1068
|
-
return (a,
|
|
1069
|
-
const
|
|
1070
|
-
return
|
|
1092
|
+
function an(e) {
|
|
1093
|
+
const { searchParams: t, pathname: n } = J(e), r = -1, o = 1;
|
|
1094
|
+
return (a, c) => {
|
|
1095
|
+
const s = $e(a, t), u = He(a, n), d = $e(c, t), m = He(c, n);
|
|
1096
|
+
return s + u > d + m ? r : s + u < d + m ? o : a.depth > c.depth ? r : a.depth < c.depth ? o : 0;
|
|
1071
1097
|
};
|
|
1072
1098
|
}
|
|
1073
|
-
function
|
|
1074
|
-
const n = Object.entries(e.
|
|
1099
|
+
function He(e, t) {
|
|
1100
|
+
const n = Object.entries(e.path.params).filter(([, o]) => Qe(o)).map(([o]) => o), r = n.filter((o) => Xe(t, e.path.toString(), o) === void 0);
|
|
1075
1101
|
return n.length - r.length;
|
|
1076
1102
|
}
|
|
1077
|
-
function
|
|
1103
|
+
function $e(e, t) {
|
|
1078
1104
|
const n = new URLSearchParams(e.query.toString()), r = Array.from(n.keys()), o = r.filter((a) => !t.has(a));
|
|
1079
1105
|
return r.length - o.length;
|
|
1080
1106
|
}
|
|
1081
1107
|
function ot(e, t) {
|
|
1082
|
-
const n = [
|
|
1108
|
+
const n = [cn, rn, on, en], r = an(t), o = e.filter((d) => n.every((m) => m(d, t))).sort(r);
|
|
1083
1109
|
if (o.length === 0)
|
|
1084
1110
|
return;
|
|
1085
|
-
const [a] = o, { search:
|
|
1086
|
-
return
|
|
1111
|
+
const [a] = o, { search: c } = J(t), s = nt(c), u = rt(a, t);
|
|
1112
|
+
return oe({
|
|
1087
1113
|
matched: a.matched,
|
|
1088
1114
|
matches: a.matches,
|
|
1089
1115
|
key: a.key,
|
|
1090
|
-
query:
|
|
1116
|
+
query: s,
|
|
1091
1117
|
params: u
|
|
1092
1118
|
});
|
|
1093
1119
|
}
|
|
1094
|
-
const
|
|
1095
|
-
function
|
|
1120
|
+
const cn = (e) => "name" in e.matched && !!e.matched.name;
|
|
1121
|
+
function sn(e) {
|
|
1096
1122
|
return (t, n = {}) => {
|
|
1097
1123
|
const o = tt(e)(t, n);
|
|
1098
1124
|
return ot(e, o);
|
|
@@ -1101,8 +1127,8 @@ function on(e) {
|
|
|
1101
1127
|
function at() {
|
|
1102
1128
|
return typeof window < "u" && typeof window.document < "u";
|
|
1103
1129
|
}
|
|
1104
|
-
function
|
|
1105
|
-
const n =
|
|
1130
|
+
function un({ mode: e, listener: t }) {
|
|
1131
|
+
const n = fn(e), r = (u, d) => {
|
|
1106
1132
|
if (d != null && d.replace)
|
|
1107
1133
|
return n.replace(u);
|
|
1108
1134
|
n.push(u);
|
|
@@ -1123,14 +1149,14 @@ function an({ mode: e, listener: t }) {
|
|
|
1123
1149
|
}
|
|
1124
1150
|
};
|
|
1125
1151
|
}
|
|
1126
|
-
function
|
|
1152
|
+
function fn(e = "auto") {
|
|
1127
1153
|
switch (e) {
|
|
1128
1154
|
case "auto":
|
|
1129
|
-
return at() ?
|
|
1155
|
+
return at() ? Le() : Be();
|
|
1130
1156
|
case "browser":
|
|
1131
|
-
return
|
|
1157
|
+
return Le();
|
|
1132
1158
|
case "memory":
|
|
1133
|
-
return
|
|
1159
|
+
return Be();
|
|
1134
1160
|
case "hash":
|
|
1135
1161
|
return jt();
|
|
1136
1162
|
default:
|
|
@@ -1138,43 +1164,43 @@ function sn(e = "auto") {
|
|
|
1138
1164
|
throw new Error(`Switch is not exhaustive for mode: ${t}`);
|
|
1139
1165
|
}
|
|
1140
1166
|
}
|
|
1141
|
-
function
|
|
1142
|
-
return
|
|
1167
|
+
function ln(e) {
|
|
1168
|
+
return le(() => () => wt("h1", e), {
|
|
1143
1169
|
name: e,
|
|
1144
1170
|
props: []
|
|
1145
1171
|
});
|
|
1146
1172
|
}
|
|
1147
|
-
const
|
|
1148
|
-
function
|
|
1173
|
+
const je = Symbol();
|
|
1174
|
+
function hn({
|
|
1149
1175
|
rejections: e
|
|
1150
1176
|
}) {
|
|
1151
|
-
const t = (
|
|
1152
|
-
const
|
|
1177
|
+
const t = (c) => {
|
|
1178
|
+
const s = {
|
|
1153
1179
|
...e
|
|
1154
1180
|
};
|
|
1155
|
-
return
|
|
1156
|
-
}, n = (
|
|
1157
|
-
const
|
|
1158
|
-
name:
|
|
1181
|
+
return ue(s[c] ?? ln(c));
|
|
1182
|
+
}, n = (c) => {
|
|
1183
|
+
const s = ue(t(c)), u = {
|
|
1184
|
+
name: c,
|
|
1159
1185
|
path: "",
|
|
1160
|
-
component:
|
|
1186
|
+
component: s,
|
|
1161
1187
|
meta: {}
|
|
1162
1188
|
};
|
|
1163
|
-
return
|
|
1189
|
+
return oe({
|
|
1164
1190
|
matched: u,
|
|
1165
1191
|
matches: [u],
|
|
1166
|
-
key:
|
|
1192
|
+
key: c,
|
|
1167
1193
|
query: nt(""),
|
|
1168
1194
|
params: {},
|
|
1169
|
-
[
|
|
1195
|
+
[je]: !0
|
|
1170
1196
|
});
|
|
1171
|
-
}, r = (
|
|
1172
|
-
if (!
|
|
1197
|
+
}, r = (c) => c[je] === !0, o = (c) => {
|
|
1198
|
+
if (!c) {
|
|
1173
1199
|
a.value = null;
|
|
1174
1200
|
return;
|
|
1175
1201
|
}
|
|
1176
|
-
const
|
|
1177
|
-
a.value = { type:
|
|
1202
|
+
const s = t(c);
|
|
1203
|
+
a.value = { type: c, component: s };
|
|
1178
1204
|
}, a = Et(null);
|
|
1179
1205
|
return {
|
|
1180
1206
|
setRejection: o,
|
|
@@ -1183,37 +1209,37 @@ function un({
|
|
|
1183
1209
|
isRejectionRoute: r
|
|
1184
1210
|
};
|
|
1185
1211
|
}
|
|
1186
|
-
class
|
|
1212
|
+
class pn extends Error {
|
|
1187
1213
|
constructor() {
|
|
1188
1214
|
super("initialUrl must be set if window.location is unavailable");
|
|
1189
1215
|
}
|
|
1190
1216
|
}
|
|
1191
|
-
function
|
|
1217
|
+
function dn(e) {
|
|
1192
1218
|
if (e)
|
|
1193
1219
|
return e;
|
|
1194
1220
|
if (at())
|
|
1195
1221
|
return window.location.toString();
|
|
1196
|
-
throw new
|
|
1222
|
+
throw new pn();
|
|
1197
1223
|
}
|
|
1198
|
-
function
|
|
1199
|
-
const n = tt(e), r =
|
|
1224
|
+
function Hn(e, t = {}) {
|
|
1225
|
+
const n = tt(e), r = un({
|
|
1200
1226
|
mode: t.historyMode,
|
|
1201
1227
|
listener: () => {
|
|
1202
1228
|
const y = T(location);
|
|
1203
1229
|
h(y);
|
|
1204
1230
|
}
|
|
1205
|
-
}), { runBeforeRouteHooks: o, runAfterRouteHooks: a } =
|
|
1206
|
-
hooks:
|
|
1207
|
-
onBeforeRouteEnter:
|
|
1231
|
+
}), { runBeforeRouteHooks: o, runAfterRouteHooks: a } = At(), {
|
|
1232
|
+
hooks: c,
|
|
1233
|
+
onBeforeRouteEnter: s,
|
|
1208
1234
|
onAfterRouteUpdate: u,
|
|
1209
1235
|
onBeforeRouteLeave: d,
|
|
1210
1236
|
onAfterRouteEnter: m,
|
|
1211
|
-
onBeforeRouteUpdate:
|
|
1212
|
-
onAfterRouteLeave:
|
|
1213
|
-
} =
|
|
1237
|
+
onBeforeRouteUpdate: g,
|
|
1238
|
+
onAfterRouteLeave: A
|
|
1239
|
+
} = Bt();
|
|
1214
1240
|
async function h(y, { replace: P } = {}) {
|
|
1215
1241
|
r.stopListening();
|
|
1216
|
-
const
|
|
1242
|
+
const x = ot(e, y) ?? R("NotFound"), _ = { ...b }, O = await o({ to: x, from: _, hooks: c });
|
|
1217
1243
|
switch (O.status) {
|
|
1218
1244
|
case "ABORT":
|
|
1219
1245
|
return;
|
|
@@ -1221,49 +1247,49 @@ function Bn(e, t = {}) {
|
|
|
1221
1247
|
r.update(y, { replace: P }), await k(...O.to);
|
|
1222
1248
|
return;
|
|
1223
1249
|
case "REJECT":
|
|
1224
|
-
r.update(y, { replace: P }),
|
|
1250
|
+
r.update(y, { replace: P }), B(O.type), i(x);
|
|
1225
1251
|
break;
|
|
1226
1252
|
case "SUCCESS":
|
|
1227
|
-
r.update(y, { replace: P }),
|
|
1253
|
+
r.update(y, { replace: P }), B(null), i(x);
|
|
1228
1254
|
break;
|
|
1229
1255
|
default:
|
|
1230
1256
|
throw new Error(`Switch is not exhaustive for before hook response status: ${JSON.stringify(O)}`);
|
|
1231
1257
|
}
|
|
1232
|
-
const
|
|
1233
|
-
switch (
|
|
1258
|
+
const V = await a({ to: x, from: _, hooks: c });
|
|
1259
|
+
switch (V.status) {
|
|
1234
1260
|
case "PUSH":
|
|
1235
|
-
await k(...
|
|
1261
|
+
await k(...V.to);
|
|
1236
1262
|
break;
|
|
1237
1263
|
case "REJECT":
|
|
1238
|
-
|
|
1264
|
+
B(V.type);
|
|
1239
1265
|
break;
|
|
1240
1266
|
case "SUCCESS":
|
|
1241
1267
|
break;
|
|
1242
1268
|
default:
|
|
1243
|
-
const G =
|
|
1269
|
+
const G = V;
|
|
1244
1270
|
throw new Error(`Switch is not exhaustive for after hook response status: ${JSON.stringify(G)}`);
|
|
1245
1271
|
}
|
|
1246
1272
|
r.startListening();
|
|
1247
1273
|
}
|
|
1248
|
-
const k = (y, P,
|
|
1274
|
+
const k = (y, P, x) => {
|
|
1249
1275
|
if (I(y)) {
|
|
1250
1276
|
const G = { ...P }, ut = n(y, G);
|
|
1251
1277
|
return h(ut, { replace: G.replace });
|
|
1252
1278
|
}
|
|
1253
|
-
const _ = { ...
|
|
1254
|
-
return h(
|
|
1255
|
-
}, $ = (y, P,
|
|
1279
|
+
const _ = { ...x }, V = n(y, P ?? {}, _);
|
|
1280
|
+
return h(V, { replace: _.replace });
|
|
1281
|
+
}, $ = (y, P, x) => {
|
|
1256
1282
|
if (I(y)) {
|
|
1257
|
-
const
|
|
1258
|
-
return k(y,
|
|
1283
|
+
const V = { ...P, replace: !0 };
|
|
1284
|
+
return k(y, V);
|
|
1259
1285
|
}
|
|
1260
|
-
const _ = P ?? {}, O = { ...
|
|
1286
|
+
const _ = P ?? {}, O = { ...x, replace: !0 };
|
|
1261
1287
|
return k(y, _, O);
|
|
1262
|
-
}, j = (y) =>
|
|
1288
|
+
}, j = (y) => B(y), U = sn(e), { setRejection: B, rejection: p, getRejectionRoute: R } = hn(t), E = R("NotFound"), { currentRoute: b, routerRoute: l, updateRoute: i } = _t(E, k);
|
|
1263
1289
|
r.startListening();
|
|
1264
|
-
const f =
|
|
1290
|
+
const f = dn(t.initialUrl), v = h(f, { replace: !0 });
|
|
1265
1291
|
function w(y) {
|
|
1266
|
-
y.component("RouterView",
|
|
1292
|
+
y.component("RouterView", Ke), y.component("RouterLink", Ht), y.provide(Ce, S), y.provide(Ve, p), y.provide(De, c);
|
|
1267
1293
|
}
|
|
1268
1294
|
const S = {
|
|
1269
1295
|
route: l,
|
|
@@ -1278,32 +1304,32 @@ function Bn(e, t = {}) {
|
|
|
1278
1304
|
go: r.go,
|
|
1279
1305
|
install: w,
|
|
1280
1306
|
initialized: v,
|
|
1281
|
-
onBeforeRouteEnter:
|
|
1307
|
+
onBeforeRouteEnter: s,
|
|
1282
1308
|
onAfterRouteUpdate: u,
|
|
1283
1309
|
onBeforeRouteLeave: d,
|
|
1284
1310
|
onAfterRouteEnter: m,
|
|
1285
|
-
onBeforeRouteUpdate:
|
|
1286
|
-
onAfterRouteLeave:
|
|
1311
|
+
onBeforeRouteUpdate: g,
|
|
1312
|
+
onAfterRouteLeave: A
|
|
1287
1313
|
};
|
|
1288
1314
|
return S;
|
|
1289
1315
|
}
|
|
1290
|
-
function
|
|
1316
|
+
function ct(e, t) {
|
|
1291
1317
|
const n = /:\??([\w]+)(?=\W|$)/g;
|
|
1292
|
-
return Array.from(e.matchAll(n)).reduce((o, [a,
|
|
1293
|
-
const
|
|
1294
|
-
if (
|
|
1295
|
-
throw new
|
|
1296
|
-
return o[
|
|
1318
|
+
return Array.from(e.matchAll(n)).reduce((o, [a, c]) => {
|
|
1319
|
+
const s = a.startsWith(":?"), u = qt(t, c);
|
|
1320
|
+
if (c in o)
|
|
1321
|
+
throw new ae(c);
|
|
1322
|
+
return o[c] = s ? Ot(u) : u, o;
|
|
1297
1323
|
}, {});
|
|
1298
1324
|
}
|
|
1299
|
-
function
|
|
1325
|
+
function st(e, t) {
|
|
1300
1326
|
return {
|
|
1301
1327
|
path: e,
|
|
1302
|
-
params:
|
|
1328
|
+
params: ct(e, t),
|
|
1303
1329
|
toString: () => e
|
|
1304
1330
|
};
|
|
1305
1331
|
}
|
|
1306
|
-
function
|
|
1332
|
+
function Pe(e, t) {
|
|
1307
1333
|
const n = Object.keys(e), r = Object.keys(t), o = n.find((a) => r.includes(a));
|
|
1308
1334
|
return o ? {
|
|
1309
1335
|
key: o,
|
|
@@ -1313,98 +1339,97 @@ function ve(e, t) {
|
|
|
1313
1339
|
hasDuplicates: !1
|
|
1314
1340
|
};
|
|
1315
1341
|
}
|
|
1316
|
-
function
|
|
1317
|
-
const { hasDuplicates: n, key: r } =
|
|
1342
|
+
function mn(e, t) {
|
|
1343
|
+
const { hasDuplicates: n, key: r } = Pe(e.params, t.params);
|
|
1318
1344
|
if (n)
|
|
1319
|
-
throw new
|
|
1320
|
-
return
|
|
1345
|
+
throw new ae(r);
|
|
1346
|
+
return st(`${e.path}${t.path}`, { ...e.params, ...t.params });
|
|
1321
1347
|
}
|
|
1322
|
-
function
|
|
1348
|
+
function fe(e, t) {
|
|
1323
1349
|
return {
|
|
1324
1350
|
query: e,
|
|
1325
|
-
params:
|
|
1351
|
+
params: ct(e, t),
|
|
1326
1352
|
toString: () => e
|
|
1327
1353
|
};
|
|
1328
1354
|
}
|
|
1329
|
-
function
|
|
1330
|
-
const { hasDuplicates: n, key: r } =
|
|
1355
|
+
function yn(e, t) {
|
|
1356
|
+
const { hasDuplicates: n, key: r } = Pe(e.params, t.params);
|
|
1331
1357
|
if (n)
|
|
1332
|
-
throw new
|
|
1333
|
-
|
|
1358
|
+
throw new ae(r);
|
|
1359
|
+
const o = [e.query, t.query].filter(te).join("&");
|
|
1360
|
+
return fe(o, { ...e.params, ...t.params });
|
|
1334
1361
|
}
|
|
1335
1362
|
function it(e) {
|
|
1336
1363
|
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
1337
1364
|
}
|
|
1338
|
-
function
|
|
1365
|
+
function gn(e) {
|
|
1339
1366
|
return it(e) && typeof e.path == "string";
|
|
1340
1367
|
}
|
|
1341
|
-
function
|
|
1342
|
-
return
|
|
1368
|
+
function Rn(e) {
|
|
1369
|
+
return gn(e) ? e : st(e, {});
|
|
1343
1370
|
}
|
|
1344
|
-
function
|
|
1371
|
+
function vn(e) {
|
|
1345
1372
|
return it(e) && typeof e.query == "string";
|
|
1346
1373
|
}
|
|
1347
|
-
function
|
|
1348
|
-
return e === void 0 ?
|
|
1374
|
+
function wn(e) {
|
|
1375
|
+
return e === void 0 ? fe("", {}) : vn(e) ? e : fe(e, {});
|
|
1349
1376
|
}
|
|
1350
|
-
function
|
|
1377
|
+
function En(e) {
|
|
1351
1378
|
return "children" in e;
|
|
1352
1379
|
}
|
|
1353
|
-
function
|
|
1380
|
+
function $n(e) {
|
|
1354
1381
|
const t = e.reduce((n, r) => {
|
|
1355
|
-
const o =
|
|
1382
|
+
const o = bn({
|
|
1356
1383
|
...r,
|
|
1357
|
-
component: r.component ??
|
|
1384
|
+
component: r.component ?? Ke
|
|
1358
1385
|
});
|
|
1359
|
-
return
|
|
1386
|
+
return En(r) && n.push(...r.children.map((a) => ({
|
|
1360
1387
|
...a,
|
|
1361
1388
|
key: qe(o.key, a.key),
|
|
1362
|
-
path:
|
|
1363
|
-
query:
|
|
1389
|
+
path: mn(o.path, a.path),
|
|
1390
|
+
query: yn(o.query, a.query),
|
|
1364
1391
|
matches: [o.matched, ...a.matches],
|
|
1365
1392
|
depth: a.depth + 1
|
|
1366
1393
|
}))), n.push(o), n;
|
|
1367
1394
|
}, []);
|
|
1368
1395
|
return t.forEach(({ path: n, query: r }) => {
|
|
1369
|
-
const { hasDuplicates: o, key: a } =
|
|
1396
|
+
const { hasDuplicates: o, key: a } = Pe(n.params, r.params);
|
|
1370
1397
|
if (o)
|
|
1371
|
-
throw new
|
|
1398
|
+
throw new ae(a);
|
|
1372
1399
|
}), t;
|
|
1373
1400
|
}
|
|
1374
|
-
function
|
|
1375
|
-
const t =
|
|
1401
|
+
function bn(e) {
|
|
1402
|
+
const t = Rn(e.path), n = wn(e.query), r = ue({ meta: {}, ...e });
|
|
1376
1403
|
return {
|
|
1377
1404
|
matched: r,
|
|
1378
1405
|
matches: [r],
|
|
1379
1406
|
key: e.name,
|
|
1380
1407
|
path: t,
|
|
1381
1408
|
query: n,
|
|
1382
|
-
pathParams: t.params,
|
|
1383
|
-
queryParams: n.params,
|
|
1384
1409
|
depth: 1,
|
|
1385
1410
|
disabled: e.disabled ?? !1
|
|
1386
1411
|
};
|
|
1387
1412
|
}
|
|
1388
1413
|
export {
|
|
1389
|
-
|
|
1414
|
+
ae as DuplicateParamsError,
|
|
1390
1415
|
Ht as RouterLink,
|
|
1391
|
-
|
|
1392
|
-
|
|
1416
|
+
he as RouterNotInstalledError,
|
|
1417
|
+
Ke as RouterView,
|
|
1393
1418
|
bt as UseRouteInvalidError,
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1419
|
+
Hn as createRouter,
|
|
1420
|
+
$n as createRoutes,
|
|
1421
|
+
Fe as isParamGetSet,
|
|
1397
1422
|
Ct as isParamGetter,
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1423
|
+
Ln as onAfterRouteEnter,
|
|
1424
|
+
Bn as onAfterRouteLeave,
|
|
1425
|
+
Un as onAfterRouteUpdate,
|
|
1426
|
+
xn as onBeforeRouteLeave,
|
|
1427
|
+
An as onBeforeRouteUpdate,
|
|
1428
|
+
st as path,
|
|
1429
|
+
fe as query,
|
|
1430
|
+
Ce as routerInjectionKey,
|
|
1431
|
+
Ve as routerRejectionKey,
|
|
1407
1432
|
Pt as useRejection,
|
|
1408
|
-
|
|
1409
|
-
|
|
1433
|
+
Sn as useRoute,
|
|
1434
|
+
pe as useRouter
|
|
1410
1435
|
};
|