@kitbag/router 0.7.1 → 0.8.0

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