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