@kitbag/router 0.8.1 → 0.9.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.
@@ -666,6 +666,10 @@ declare type ResolvedRoute<TRoute extends Route = Route> = Readonly<{
666
666
  * Accessor for query string values from user in the current browser location.
667
667
  */
668
668
  query: ResolvedRouteQuery;
669
+ /**
670
+ * Hash value of the route.
671
+ */
672
+ hash?: string;
669
673
  /**
670
674
  * Key value pair for route params, values will be the user provided value from current browser location.
671
675
  */
@@ -978,6 +982,7 @@ declare type RouterPushArgs<TRoutes extends Routes, TSource extends RoutesName<T
978
982
 
979
983
  declare type RouterPushOptions<TState = unknown> = {
980
984
  query?: Record<string, string>;
985
+ hash?: string;
981
986
  replace?: boolean;
982
987
  state?: Partial<TState>;
983
988
  };
@@ -1000,6 +1005,7 @@ declare type RouterReplaceArgs<TRoutes extends Routes, TSource extends RoutesNam
1000
1005
 
1001
1006
  declare type RouterReplaceOptions<TState = unknown> = {
1002
1007
  query?: Record<string, string>;
1008
+ hash?: string;
1003
1009
  state?: Partial<TState>;
1004
1010
  };
1005
1011
 
@@ -1012,6 +1018,7 @@ declare type RouterResolveArgs<TRoutes extends Routes, TSource extends RoutesNam
1012
1018
 
1013
1019
  declare type RouterResolveOptions = {
1014
1020
  query?: Record<string, string>;
1021
+ hash?: string;
1015
1022
  };
1016
1023
 
1017
1024
  declare type RouterRoute<TRoute extends ResolvedRoute = ResolvedRoute> = Readonly<{
@@ -1020,6 +1027,7 @@ declare type RouterRoute<TRoute extends ResolvedRoute = ResolvedRoute> = Readonl
1020
1027
  matches: TRoute['matches'];
1021
1028
  state: TRoute['state'];
1022
1029
  query: ResolvedRouteQuery;
1030
+ hash: TRoute['hash'];
1023
1031
  params: Writable<TRoute['params']>;
1024
1032
  update: RouteUpdate<TRoute>;
1025
1033
  }>;
@@ -1050,6 +1058,7 @@ name?: string | undefined;
1050
1058
  [x: number]: any;
1051
1059
  };
1052
1060
  query: ResolvedRouteQuery;
1061
+ hash: string | undefined;
1053
1062
  params: Writable< {
1054
1063
  [x: string]: any;
1055
1064
  [x: number]: any;
@@ -1085,6 +1094,7 @@ name?: string | undefined;
1085
1094
  [x: number]: any;
1086
1095
  };
1087
1096
  query: ResolvedRouteQuery;
1097
+ hash: string | undefined;
1088
1098
  params: Writable< {
1089
1099
  [x: string]: any;
1090
1100
  [x: number]: any;
@@ -295,10 +295,10 @@ function F() {
295
295
  return t;
296
296
  }, F.apply(this, arguments);
297
297
  }
298
- var N;
298
+ var U;
299
299
  (function(t) {
300
300
  t.Pop = "POP", t.Push = "PUSH", t.Replace = "REPLACE";
301
- })(N || (N = {}));
301
+ })(U || (U = {}));
302
302
  var Z = process.env.NODE_ENV !== "production" ? function(t) {
303
303
  return Object.freeze(t);
304
304
  } : function(t) {
@@ -318,11 +318,11 @@ function Jt(t) {
318
318
  t === void 0 && (t = {});
319
319
  var e = t, n = e.window, r = n === void 0 ? document.defaultView : n, o = r.history;
320
320
  function a() {
321
- var d = r.location, i = d.pathname, h = d.search, v = d.hash, E = o.state || {};
321
+ var m = r.location, i = m.pathname, h = m.search, w = m.hash, E = o.state || {};
322
322
  return [E.idx, Z({
323
323
  pathname: i,
324
324
  search: h,
325
- hash: v,
325
+ hash: w,
326
326
  state: E.usr || null,
327
327
  key: E.key || "default"
328
328
  })];
@@ -330,19 +330,19 @@ function Jt(t) {
330
330
  var s = null;
331
331
  function c() {
332
332
  if (s)
333
- m.call(s), s = null;
333
+ p.call(s), s = null;
334
334
  else {
335
- var d = N.Pop, i = a(), h = i[0], v = i[1];
336
- if (m.length)
335
+ var m = U.Pop, i = a(), h = i[0], w = i[1];
336
+ if (p.length)
337
337
  if (h != null) {
338
- var E = p - h;
338
+ var E = d - h;
339
339
  E && (s = {
340
- action: d,
341
- location: v,
340
+ action: m,
341
+ location: w,
342
342
  retry: function() {
343
- P(E * -1);
343
+ b(E * -1);
344
344
  }
345
- }, P(E));
345
+ }, b(E));
346
346
  } else
347
347
  process.env.NODE_ENV !== "production" && Q(
348
348
  !1,
@@ -352,115 +352,115 @@ function Jt(t) {
352
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."
353
353
  );
354
354
  else
355
- O(d);
355
+ O(m);
356
356
  }
357
357
  }
358
358
  r.addEventListener(ve, 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, {
361
- idx: p
359
+ var u = U.Pop, l = a(), d = l[0], f = l[1], v = tt(), p = tt();
360
+ d == null && (d = 0, o.replaceState(F({}, o.state, {
361
+ idx: d
362
362
  }), ""));
363
- function S(d) {
364
- return typeof d == "string" ? d : G(d);
363
+ function A(m) {
364
+ return typeof m == "string" ? m : G(m);
365
365
  }
366
- function A(d, i) {
366
+ function P(m, i) {
367
367
  return i === void 0 && (i = null), Z(F({
368
368
  pathname: f.pathname,
369
369
  hash: "",
370
370
  search: ""
371
- }, typeof d == "string" ? st(d) : d, {
371
+ }, typeof m == "string" ? st(m) : m, {
372
372
  state: i,
373
373
  key: pt()
374
374
  }));
375
375
  }
376
- function U(d, i) {
376
+ function k(m, i) {
377
377
  return [{
378
- usr: d.state,
379
- key: d.key,
378
+ usr: m.state,
379
+ key: m.key,
380
380
  idx: i
381
- }, S(d)];
381
+ }, A(m)];
382
382
  }
383
- function $(d, i, h) {
384
- return !m.length || (m.call({
385
- action: d,
383
+ function $(m, i, h) {
384
+ return !p.length || (p.call({
385
+ action: m,
386
386
  location: i,
387
387
  retry: h
388
388
  }), !1);
389
389
  }
390
- function O(d) {
391
- u = d;
390
+ function O(m) {
391
+ u = m;
392
392
  var i = a();
393
- p = i[0], f = i[1], w.call({
393
+ d = i[0], f = i[1], v.call({
394
394
  action: u,
395
395
  location: f
396
396
  });
397
397
  }
398
- function g(d, i) {
399
- var h = N.Push, v = A(d, i);
398
+ function g(m, i) {
399
+ var h = U.Push, w = P(m, i);
400
400
  function E() {
401
- g(d, i);
401
+ g(m, i);
402
402
  }
403
- if ($(h, v, E)) {
404
- var x = U(v, p + 1), B = x[0], L = x[1];
403
+ if ($(h, w, E)) {
404
+ var x = k(w, d + 1), L = x[0], N = x[1];
405
405
  try {
406
- o.pushState(B, "", L);
406
+ o.pushState(L, "", N);
407
407
  } catch {
408
- r.location.assign(L);
408
+ r.location.assign(N);
409
409
  }
410
410
  O(h);
411
411
  }
412
412
  }
413
- function R(d, i) {
414
- var h = N.Replace, v = A(d, i);
413
+ function R(m, i) {
414
+ var h = U.Replace, w = P(m, i);
415
415
  function E() {
416
- R(d, i);
416
+ R(m, i);
417
417
  }
418
- if ($(h, v, E)) {
419
- var x = U(v, p), B = x[0], L = x[1];
420
- o.replaceState(B, "", L), O(h);
418
+ if ($(h, w, E)) {
419
+ var x = k(w, d), L = x[0], N = x[1];
420
+ o.replaceState(L, "", N), O(h);
421
421
  }
422
422
  }
423
- function P(d) {
424
- o.go(d);
423
+ function b(m) {
424
+ o.go(m);
425
425
  }
426
- var b = {
426
+ var S = {
427
427
  get action() {
428
428
  return u;
429
429
  },
430
430
  get location() {
431
431
  return f;
432
432
  },
433
- createHref: S,
433
+ createHref: A,
434
434
  push: g,
435
435
  replace: R,
436
- go: P,
436
+ go: b,
437
437
  back: function() {
438
- P(-1);
438
+ b(-1);
439
439
  },
440
440
  forward: function() {
441
- P(1);
441
+ b(1);
442
442
  },
443
443
  listen: function(i) {
444
- return w.push(i);
444
+ return v.push(i);
445
445
  },
446
446
  block: function(i) {
447
- var h = m.push(i);
448
- return m.length === 1 && r.addEventListener(lt, ht), function() {
449
- h(), m.length || r.removeEventListener(lt, ht);
447
+ var h = p.push(i);
448
+ return p.length === 1 && r.addEventListener(lt, ht), function() {
449
+ h(), p.length || r.removeEventListener(lt, ht);
450
450
  };
451
451
  }
452
452
  };
453
- return b;
453
+ return S;
454
454
  }
455
455
  function An(t) {
456
456
  t === void 0 && (t = {});
457
457
  var e = t, n = e.window, r = n === void 0 ? document.defaultView : n, o = r.history;
458
458
  function a() {
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 || {};
459
+ var i = st(r.location.hash.substr(1)), h = i.pathname, w = h === void 0 ? "/" : h, E = i.search, x = E === void 0 ? "" : E, L = i.hash, N = L === void 0 ? "" : L, H = o.state || {};
460
460
  return [H.idx, Z({
461
- pathname: v,
461
+ pathname: w,
462
462
  search: x,
463
- hash: L,
463
+ hash: N,
464
464
  state: H.usr || null,
465
465
  key: H.key || "default"
466
466
  })];
@@ -468,19 +468,19 @@ function An(t) {
468
468
  var s = null;
469
469
  function c() {
470
470
  if (s)
471
- m.call(s), s = null;
471
+ p.call(s), s = null;
472
472
  else {
473
- var i = N.Pop, h = a(), v = h[0], E = h[1];
474
- if (m.length)
475
- if (v != null) {
476
- var x = p - v;
473
+ var i = U.Pop, h = a(), w = h[0], E = h[1];
474
+ if (p.length)
475
+ if (w != null) {
476
+ var x = d - w;
477
477
  x && (s = {
478
478
  action: i,
479
479
  location: E,
480
480
  retry: function() {
481
- b(x * -1);
481
+ S(x * -1);
482
482
  }
483
- }, b(x));
483
+ }, S(x));
484
484
  } else
485
485
  process.env.NODE_ENV !== "production" && Q(
486
486
  !1,
@@ -497,22 +497,22 @@ function An(t) {
497
497
  var i = a(), h = i[1];
498
498
  G(h) !== G(f) && c();
499
499
  });
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, {
502
- idx: p
500
+ var u = U.Pop, l = a(), d = l[0], f = l[1], v = tt(), p = tt();
501
+ d == null && (d = 0, o.replaceState(F({}, o.state, {
502
+ idx: d
503
503
  }), ""));
504
- function S() {
504
+ function A() {
505
505
  var i = document.querySelector("base"), h = "";
506
506
  if (i && i.getAttribute("href")) {
507
- var v = r.location.href, E = v.indexOf("#");
508
- h = E === -1 ? v : v.slice(0, E);
507
+ var w = r.location.href, E = w.indexOf("#");
508
+ h = E === -1 ? w : w.slice(0, E);
509
509
  }
510
510
  return h;
511
511
  }
512
- function A(i) {
513
- return S() + "#" + (typeof i == "string" ? i : G(i));
512
+ function P(i) {
513
+ return A() + "#" + (typeof i == "string" ? i : G(i));
514
514
  }
515
- function U(i, h) {
515
+ function k(i, h) {
516
516
  return h === void 0 && (h = null), Z(F({
517
517
  pathname: f.pathname,
518
518
  hash: "",
@@ -527,79 +527,79 @@ function An(t) {
527
527
  usr: i.state,
528
528
  key: i.key,
529
529
  idx: h
530
- }, A(i)];
530
+ }, P(i)];
531
531
  }
532
- function O(i, h, v) {
533
- return !m.length || (m.call({
532
+ function O(i, h, w) {
533
+ return !p.length || (p.call({
534
534
  action: i,
535
535
  location: h,
536
- retry: v
536
+ retry: w
537
537
  }), !1);
538
538
  }
539
539
  function g(i) {
540
540
  u = i;
541
541
  var h = a();
542
- p = h[0], f = h[1], w.call({
542
+ d = h[0], f = h[1], v.call({
543
543
  action: u,
544
544
  location: f
545
545
  });
546
546
  }
547
547
  function R(i, h) {
548
- var v = N.Push, E = U(i, h);
548
+ var w = U.Push, E = k(i, h);
549
549
  function x() {
550
550
  R(i, h);
551
551
  }
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];
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(w, E, x)) {
553
+ var L = $(E, d + 1), N = L[0], H = L[1];
554
554
  try {
555
- o.pushState(L, "", H);
555
+ o.pushState(N, "", H);
556
556
  } catch {
557
557
  r.location.assign(H);
558
558
  }
559
- g(v);
559
+ g(w);
560
560
  }
561
561
  }
562
- function P(i, h) {
563
- var v = N.Replace, E = U(i, h);
562
+ function b(i, h) {
563
+ var w = U.Replace, E = k(i, h);
564
564
  function x() {
565
- P(i, h);
565
+ b(i, h);
566
566
  }
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);
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(w, E, x)) {
568
+ var L = $(E, d), N = L[0], H = L[1];
569
+ o.replaceState(N, "", H), g(w);
570
570
  }
571
571
  }
572
- function b(i) {
572
+ function S(i) {
573
573
  o.go(i);
574
574
  }
575
- var d = {
575
+ var m = {
576
576
  get action() {
577
577
  return u;
578
578
  },
579
579
  get location() {
580
580
  return f;
581
581
  },
582
- createHref: A,
582
+ createHref: P,
583
583
  push: R,
584
- replace: P,
585
- go: b,
584
+ replace: b,
585
+ go: S,
586
586
  back: function() {
587
- b(-1);
587
+ S(-1);
588
588
  },
589
589
  forward: function() {
590
- b(1);
590
+ S(1);
591
591
  },
592
592
  listen: function(h) {
593
- return w.push(h);
593
+ return v.push(h);
594
594
  },
595
595
  block: function(h) {
596
- var v = m.push(h);
597
- return m.length === 1 && r.addEventListener(lt, ht), function() {
598
- v(), m.length || r.removeEventListener(lt, ht);
596
+ var w = p.push(h);
597
+ return p.length === 1 && r.addEventListener(lt, ht), function() {
598
+ w(), p.length || r.removeEventListener(lt, ht);
599
599
  };
600
600
  }
601
601
  };
602
- return d;
602
+ return m;
603
603
  }
604
604
  function Qt(t) {
605
605
  t === void 0 && (t = {});
@@ -612,11 +612,11 @@ function Qt(t) {
612
612
  key: pt()
613
613
  }, typeof g == "string" ? st(g) : g));
614
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();
615
+ }), s = Gt(o ?? a.length - 1, 0, a.length - 1), c = U.Pop, u = a[s], l = tt(), d = tt();
616
616
  function f(g) {
617
617
  return typeof g == "string" ? g : G(g);
618
618
  }
619
- function w(g, R) {
619
+ function v(g, R) {
620
620
  return R === void 0 && (R = null), Z(F({
621
621
  pathname: u.pathname,
622
622
  search: "",
@@ -626,39 +626,39 @@ function Qt(t) {
626
626
  key: pt()
627
627
  }));
628
628
  }
629
- function m(g, R, P) {
630
- return !p.length || (p.call({
629
+ function p(g, R, b) {
630
+ return !d.length || (d.call({
631
631
  action: g,
632
632
  location: R,
633
- retry: P
633
+ retry: b
634
634
  }), !1);
635
635
  }
636
- function S(g, R) {
636
+ function A(g, R) {
637
637
  c = g, u = R, l.call({
638
638
  action: c,
639
639
  location: u
640
640
  });
641
641
  }
642
- function A(g, R) {
643
- var P = N.Push, b = w(g, R);
644
- function d() {
645
- A(g, R);
642
+ function P(g, R) {
643
+ var b = U.Push, S = v(g, R);
644
+ function m() {
645
+ P(g, R);
646
646
  }
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));
647
+ process.env.NODE_ENV !== "production" && Q(u.pathname.charAt(0) === "/", "Relative pathnames are not supported in memory history.push(" + JSON.stringify(g) + ")"), p(b, S, m) && (s += 1, a.splice(s, a.length, S), A(b, S));
648
648
  }
649
- function U(g, R) {
650
- var P = N.Replace, b = w(g, R);
651
- function d() {
652
- U(g, R);
649
+ function k(g, R) {
650
+ var b = U.Replace, S = v(g, R);
651
+ function m() {
652
+ k(g, R);
653
653
  }
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));
654
+ process.env.NODE_ENV !== "production" && Q(u.pathname.charAt(0) === "/", "Relative pathnames are not supported in memory history.replace(" + JSON.stringify(g) + ")"), p(b, S, m) && (a[s] = S, A(b, S));
655
655
  }
656
656
  function $(g) {
657
- var R = Gt(s + g, 0, a.length - 1), P = N.Pop, b = a[R];
658
- function d() {
657
+ var R = Gt(s + g, 0, a.length - 1), b = U.Pop, S = a[R];
658
+ function m() {
659
659
  $(g);
660
660
  }
661
- m(P, b, d) && (s = R, S(P, b));
661
+ p(b, S, m) && (s = R, A(b, S));
662
662
  }
663
663
  var O = {
664
664
  get index() {
@@ -671,8 +671,8 @@ function Qt(t) {
671
671
  return u;
672
672
  },
673
673
  createHref: f,
674
- push: A,
675
- replace: U,
674
+ push: P,
675
+ replace: k,
676
676
  go: $,
677
677
  back: function() {
678
678
  $(-1);
@@ -684,7 +684,7 @@ function Qt(t) {
684
684
  return l.push(R);
685
685
  },
686
686
  block: function(R) {
687
- return p.push(R);
687
+ return d.push(R);
688
688
  }
689
689
  };
690
690
  return O;
@@ -744,40 +744,41 @@ function kn(t) {
744
744
  return typeof t == "object" && t !== null && Ee in t;
745
745
  }
746
746
  function Bn(t, e) {
747
- function n(p, f, w) {
748
- if (typeof p == "object") {
749
- const S = {
747
+ function n(f, v, p) {
748
+ if (typeof f == "object") {
749
+ const P = {
750
750
  ...t.params,
751
- ...p
751
+ ...f
752
752
  };
753
- return e(t.name, S, f);
753
+ return e(t.name, P, v);
754
754
  }
755
- const m = {
755
+ const A = {
756
756
  ...t.params,
757
- [p]: f
757
+ [f]: v
758
758
  };
759
- return e(t.name, m, w);
759
+ return e(t.name, A, p);
760
760
  }
761
- const { matched: r, matches: o, name: a, query: s, params: c, state: u } = Fe(t), l = oe({
761
+ const { matched: r, matches: o, name: a, query: s, params: c, state: u, hash: l } = Fe(t), d = oe({
762
762
  matched: r,
763
763
  matches: o,
764
764
  state: u,
765
765
  query: s,
766
+ hash: l,
766
767
  params: c,
767
768
  name: a,
768
769
  update: n,
769
770
  [Ee]: !0
770
771
  });
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;
772
+ return new Proxy(d, {
773
+ get: (f, v, p) => v === "params" ? new Proxy(t.params, {
774
+ set(A, P, k) {
775
+ return n(P, k), !0;
775
776
  }
776
- }) : f === "state" ? new Proxy(t.state, {
777
- set(m, S, A) {
778
- return n({}, { state: { ...t.state, [S]: A } }), !0;
777
+ }) : v === "state" ? new Proxy(t.state, {
778
+ set(A, P, k) {
779
+ return n({}, { state: { ...t.state, [P]: k } }), !0;
779
780
  }
780
- }) : Reflect.get(p, f, w)
781
+ }) : Reflect.get(f, v, p)
781
782
  });
782
783
  }
783
784
  const Pe = Symbol();
@@ -915,84 +916,84 @@ function On() {
915
916
  const f = c ?? {};
916
917
  throw new rt([s, { ...f, replace: !0 }]);
917
918
  }
918
- const l = c, p = u ?? {};
919
- throw new rt([s, l, { ...p, replace: !0 }]);
919
+ const l = c, d = u ?? {};
920
+ throw new rt([s, l, { ...d, replace: !0 }]);
920
921
  }, r = () => {
921
922
  throw new Kt();
922
923
  };
923
924
  async function o({ to: s, from: c, hooks: u }) {
924
- const { global: l, component: p } = u, f = Vn(s, c), w = [
925
+ const { global: l, component: d } = u, f = Vn(s, c), v = [
925
926
  ...l.onBeforeRouteEnter,
926
927
  ...f.onBeforeRouteEnter,
927
928
  ...l.onBeforeRouteUpdate,
928
929
  ...f.onBeforeRouteUpdate,
929
- ...p.onBeforeRouteUpdate,
930
+ ...d.onBeforeRouteUpdate,
930
931
  ...l.onBeforeRouteLeave,
931
932
  ...f.onBeforeRouteLeave,
932
- ...p.onBeforeRouteLeave
933
+ ...d.onBeforeRouteLeave
933
934
  ];
934
935
  try {
935
- const m = w.map((S) => S(s, {
936
+ const p = v.map((A) => A(s, {
936
937
  from: c,
937
938
  reject: t,
938
939
  push: e,
939
940
  replace: n,
940
941
  abort: r
941
942
  }));
942
- await Promise.all(m);
943
- } catch (m) {
944
- if (m instanceof rt)
943
+ await Promise.all(p);
944
+ } catch (p) {
945
+ if (p instanceof rt)
945
946
  return {
946
947
  status: "PUSH",
947
- to: m.to
948
+ to: p.to
948
949
  };
949
- if (m instanceof kt)
950
+ if (p instanceof kt)
950
951
  return {
951
952
  status: "REJECT",
952
- type: m.type
953
+ type: p.type
953
954
  };
954
- if (m instanceof Kt)
955
+ if (p instanceof Kt)
955
956
  return {
956
957
  status: "ABORT"
957
958
  };
958
- throw m;
959
+ throw p;
959
960
  }
960
961
  return {
961
962
  status: "SUCCESS"
962
963
  };
963
964
  }
964
965
  async function a({ to: s, from: c, hooks: u }) {
965
- const { global: l, component: p } = u, f = jn(s, c), w = [
966
- ...p.onAfterRouteLeave,
966
+ const { global: l, component: d } = u, f = jn(s, c), v = [
967
+ ...d.onAfterRouteLeave,
967
968
  ...f.onAfterRouteLeave,
968
969
  ...l.onAfterRouteLeave,
969
- ...p.onAfterRouteUpdate,
970
+ ...d.onAfterRouteUpdate,
970
971
  ...f.onAfterRouteUpdate,
971
972
  ...l.onAfterRouteUpdate,
972
- ...p.onAfterRouteEnter,
973
+ ...d.onAfterRouteEnter,
973
974
  ...f.onAfterRouteEnter,
974
975
  ...l.onAfterRouteEnter
975
976
  ];
976
977
  try {
977
- const m = w.map((S) => S(s, {
978
+ const p = v.map((A) => A(s, {
978
979
  from: c,
979
980
  reject: t,
980
981
  push: e,
981
982
  replace: n
982
983
  }));
983
- await Promise.all(m);
984
- } catch (m) {
985
- if (m instanceof rt)
984
+ await Promise.all(p);
985
+ } catch (p) {
986
+ if (p instanceof rt)
986
987
  return {
987
988
  status: "PUSH",
988
- to: m.to
989
+ to: p.to
989
990
  };
990
- if (m instanceof kt)
991
+ if (p instanceof kt)
991
992
  return {
992
993
  status: "REJECT",
993
- type: m.type
994
+ type: p.type
994
995
  };
995
- throw m;
996
+ throw p;
996
997
  }
997
998
  return {
998
999
  status: "SUCCESS"
@@ -1206,8 +1207,8 @@ function Ue(t, ...e) {
1206
1207
  }, t);
1207
1208
  }
1208
1209
  function Yn(t, e = {}) {
1209
- const { params: n = {}, query: r } = e, o = Xn(t.host, n), a = Zn(t.path, n), s = tr(t.query, n);
1210
- return Ue(`${o}${a}`, s, r);
1210
+ const { params: n = {}, query: r } = e, o = Xn(t.host, n), a = Zn(t.path, n), s = tr(t.query, n), c = Ue(`${o}${a}`, s, r), u = e.hash ? `#${e.hash.replace(/^#/, "")}` : "";
1211
+ return `${c}${u}`;
1211
1212
  }
1212
1213
  function Xn(t, e) {
1213
1214
  const n = t.toString();
@@ -1232,8 +1233,8 @@ function tr(t, e) {
1232
1233
  const c = Pt(s);
1233
1234
  if (!c)
1234
1235
  return { ...o, [a]: s };
1235
- const l = at(e[c], t.params[c], $t(s)), p = e[c] === void 0 && l === "";
1236
- return $t(s) && p ? o : { ...o, [a]: l };
1236
+ const l = at(e[c], t.params[c], $t(s)), d = e[c] === void 0 && l === "";
1237
+ return $t(s) && d ? o : { ...o, [a]: l };
1237
1238
  }, {});
1238
1239
  }
1239
1240
  function er(t) {
@@ -1245,7 +1246,8 @@ function er(t) {
1245
1246
  throw new Mn(String(e));
1246
1247
  return Yn(s, {
1247
1248
  params: o,
1248
- query: a.query
1249
+ query: a.query,
1250
+ hash: a.hash
1249
1251
  });
1250
1252
  };
1251
1253
  }
@@ -1301,8 +1303,8 @@ const cr = (t) => "name" in t.matched && !!t.matched.name, ur = (t, e) => {
1301
1303
  function fr(t) {
1302
1304
  const { searchParams: e, pathname: n } = K(t), r = -1, o = 1;
1303
1305
  return (a, s) => {
1304
- const c = Xt(a, e), u = Yt(a, n), l = Xt(s, e), p = Yt(s, n);
1305
- return a.depth > s.depth ? r : a.depth < s.depth ? o : c + u > l + p ? r : c + u < l + p ? o : 0;
1306
+ const c = Xt(a, e), u = Yt(a, n), l = Xt(s, e), d = Yt(s, n);
1307
+ return a.depth > s.depth ? r : a.depth < s.depth ? o : c + u > l + d ? r : c + u < l + d ? o : 0;
1306
1308
  };
1307
1309
  }
1308
1310
  function Yt(t, e) {
@@ -1354,17 +1356,18 @@ const Zt = (t, e) => {
1354
1356
  or
1355
1357
  ];
1356
1358
  function Bt(t, e, n) {
1357
- const r = fr(e), o = t.filter((c) => mr.every((u) => u(c, e))).sort(r);
1359
+ const r = fr(e), o = t.filter((u) => mr.every((l) => l(u, e))).sort(r);
1358
1360
  if (o.length === 0)
1359
1361
  return;
1360
- const [a] = o, { search: s } = K(e);
1362
+ const [a] = o, { search: s, hash: c } = K(e);
1361
1363
  return {
1362
1364
  matched: a.matched,
1363
1365
  matches: a.matches,
1364
1366
  name: a.name,
1365
1367
  query: Se(s),
1366
1368
  params: $e(a, e),
1367
- state: hr(a.state, n)
1369
+ state: hr(a.state, n),
1370
+ hash: c
1368
1371
  };
1369
1372
  }
1370
1373
  function Wt(t, e) {
@@ -1458,33 +1461,33 @@ function jr(t, e) {
1458
1461
  const o = er(r), a = Cn({
1459
1462
  mode: e == null ? void 0 : e.historyMode,
1460
1463
  listener: ({ location: y }) => {
1461
- const k = G(y);
1462
- A(k, { state: y.state });
1464
+ const B = G(y);
1465
+ P(B, { state: y.state });
1463
1466
  }
1464
1467
  }), { runBeforeRouteHooks: s, runAfterRouteHooks: c } = On(), {
1465
1468
  hooks: u,
1466
1469
  onBeforeRouteEnter: l,
1467
- onAfterRouteUpdate: p,
1470
+ onAfterRouteUpdate: d,
1468
1471
  onBeforeRouteLeave: f,
1469
- onAfterRouteEnter: w,
1470
- onBeforeRouteUpdate: m,
1471
- onAfterRouteLeave: S
1472
+ onAfterRouteEnter: v,
1473
+ onBeforeRouteUpdate: p,
1474
+ onAfterRouteLeave: A
1472
1475
  } = qn();
1473
- async function A(y, k = {}) {
1474
- if (a.stopListening(), L(y))
1475
- return a.update(y, k);
1476
- const _ = Bt(r, y, k.state) ?? b("NotFound"), q = { ...i }, z = await s({ to: _, from: q, hooks: u });
1476
+ async function P(y, B = {}) {
1477
+ if (a.stopListening(), N(y))
1478
+ return a.update(y, B);
1479
+ const _ = Bt(r, y, B.state) ?? S("NotFound"), q = { ...i }, z = await s({ to: _, from: q, hooks: u });
1477
1480
  switch (z.status) {
1478
1481
  case "ABORT":
1479
1482
  return;
1480
1483
  case "PUSH":
1481
- a.update(y, k), await U(...z.to);
1484
+ a.update(y, B), await k(...z.to);
1482
1485
  return;
1483
1486
  case "REJECT":
1484
- a.update(y, k), R(z.type), v(_);
1487
+ a.update(y, B), R(z.type), w(_);
1485
1488
  break;
1486
1489
  case "SUCCESS":
1487
- a.update(y, k), R(null), v(_);
1490
+ a.update(y, B), R(null), w(_);
1488
1491
  break;
1489
1492
  default:
1490
1493
  throw new Error(`Switch is not exhaustive for before hook response status: ${JSON.stringify(z)}`);
@@ -1492,7 +1495,7 @@ function jr(t, e) {
1492
1495
  const T = await c({ to: _, from: q, hooks: u });
1493
1496
  switch (T.status) {
1494
1497
  case "PUSH":
1495
- await U(...T.to);
1498
+ await k(...T.to);
1496
1499
  break;
1497
1500
  case "REJECT":
1498
1501
  R(T.type);
@@ -1505,40 +1508,40 @@ function jr(t, e) {
1505
1508
  }
1506
1509
  a.startListening();
1507
1510
  }
1508
- const U = (y, k, _) => {
1511
+ const k = (y, B, _) => {
1509
1512
  if (D(y)) {
1510
- const nt = { ...k }, At = o(y, nt);
1511
- return A(At, nt);
1513
+ const nt = { ...B }, At = o(y, nt);
1514
+ return P(At, nt);
1512
1515
  }
1513
- const q = { ..._ }, T = o(y, k ?? {}, q), W = bt(y), St = Zt((W == null ? void 0 : W.state) ?? {}, q.state);
1514
- return A(T, { ...q, state: St });
1515
- }, $ = (y, k, _) => {
1516
+ const q = { ..._ }, T = o(y, B ?? {}, q), W = bt(y), St = Zt((W == null ? void 0 : W.state) ?? {}, q.state);
1517
+ return P(T, { ...q, state: St });
1518
+ }, $ = (y, B, _) => {
1516
1519
  if (D(y)) {
1517
- const nt = { ...k, replace: !0 }, At = o(y, nt);
1518
- return A(At, nt);
1520
+ const nt = { ...B, replace: !0 }, At = o(y, nt);
1521
+ return P(At, nt);
1519
1522
  }
1520
- const q = { ..._, replace: !0 }, T = o(y, k ?? {}, q), W = bt(y), St = Zt((W == null ? void 0 : W.state) ?? {}, q.state);
1521
- return A(T, { ...q, state: St });
1522
- }, O = (y) => R(y), g = (y, k = {}) => {
1523
+ const q = { ..._, replace: !0 }, T = o(y, B ?? {}, q), W = bt(y), St = Zt((W == null ? void 0 : W.state) ?? {}, q.state);
1524
+ return P(T, { ...q, state: St });
1525
+ }, O = (y) => R(y), g = (y, B = {}) => {
1523
1526
  if (!D(y)) {
1524
- const _ = o(y, k);
1527
+ const _ = o(y, B);
1525
1528
  return Bt(r, _);
1526
1529
  }
1527
- if (!L(y))
1530
+ if (!N(y))
1528
1531
  return Bt(r, y);
1529
- }, { setRejection: R, rejection: P, getRejectionRoute: b } = Dn(e ?? {}), d = b("NotFound"), { currentRoute: i, routerRoute: h, updateRoute: v } = Ln(d, U);
1532
+ }, { setRejection: R, rejection: b, getRejectionRoute: S } = Dn(e ?? {}), m = S("NotFound"), { currentRoute: i, routerRoute: h, updateRoute: w } = Ln(m, k);
1530
1533
  a.startListening();
1531
- const E = rr(e == null ? void 0 : e.initialUrl), x = a.location.state, { host: B } = K(E), L = $n(B), H = A(E, { replace: !0, state: x });
1534
+ const E = rr(e == null ? void 0 : e.initialUrl), x = a.location.state, { host: L } = K(E), N = $n(L), H = P(E, { replace: !0, state: x });
1532
1535
  function bt(y) {
1533
- return r.find((k) => k.name === y);
1536
+ return r.find((B) => B.name === y);
1534
1537
  }
1535
1538
  function De(y) {
1536
- y.component("RouterView", Ur), y.component("RouterLink", Nr), y.provide(we, P), y.provide(be, u), y.provide(fe, It);
1539
+ y.component("RouterView", Ur), y.component("RouterLink", Nr), y.provide(we, b), y.provide(be, u), y.provide(fe, It);
1537
1540
  }
1538
1541
  const It = {
1539
1542
  route: h,
1540
1543
  resolve: o,
1541
- push: U,
1544
+ push: k,
1542
1545
  replace: $,
1543
1546
  reject: O,
1544
1547
  find: g,
@@ -1548,13 +1551,13 @@ function jr(t, e) {
1548
1551
  go: a.go,
1549
1552
  install: De,
1550
1553
  initialized: H,
1551
- isExternal: L,
1554
+ isExternal: N,
1552
1555
  onBeforeRouteEnter: l,
1553
- onAfterRouteUpdate: p,
1556
+ onAfterRouteUpdate: d,
1554
1557
  onBeforeRouteLeave: f,
1555
- onAfterRouteEnter: w,
1556
- onBeforeRouteUpdate: m,
1557
- onAfterRouteLeave: S,
1558
+ onAfterRouteEnter: v,
1559
+ onBeforeRouteUpdate: p,
1560
+ onAfterRouteLeave: A,
1558
1561
  prefetch: e == null ? void 0 : e.prefetch
1559
1562
  };
1560
1563
  return It;
@@ -1610,20 +1613,20 @@ function Ar(t, e = {}, n = {}) {
1610
1613
  } catch (f) {
1611
1614
  throw f instanceof X && console.error(`Failed to resolve route "${o.value.toString()}" in RouterLink.`, f), f;
1612
1615
  }
1613
- }), 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);
1616
+ }), 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);
1614
1617
  return ae(u, (f) => {
1615
1618
  if (!f)
1616
1619
  return;
1617
- const { prefetch: w } = r, { prefetch: m } = s.value;
1620
+ const { prefetch: v } = r, { prefetch: p } = s.value;
1618
1621
  xr(f, {
1619
- routerPrefetch: w,
1620
- linkPrefetch: m
1622
+ routerPrefetch: v,
1623
+ linkPrefetch: p
1621
1624
  });
1622
1625
  }, { immediate: !0 }), {
1623
1626
  route: u,
1624
1627
  href: c,
1625
1628
  isMatch: l,
1626
- isExactMatch: p,
1629
+ isExactMatch: d,
1627
1630
  push: (f) => r.push(c.value, {}, { ...s.value, ...f }),
1628
1631
  replace: (f) => r.replace(c.value, {}, { ...s.value, ...f })
1629
1632
  };
@@ -1689,24 +1692,25 @@ const Or = We("onBeforeRouteUpdate"), _r = We("onBeforeRouteLeave"), qr = Ft("on
1689
1692
  to: {},
1690
1693
  prefetch: { type: [Boolean, Object], default: void 0 },
1691
1694
  query: {},
1695
+ hash: {},
1692
1696
  replace: { type: Boolean },
1693
1697
  state: {}
1694
1698
  },
1695
1699
  setup(t) {
1696
1700
  const e = t, n = Ht(), r = j(() => D(e.to) ? e.to : e.to(n.resolve)), o = j(() => {
1697
- const { to: f, ...w } = e;
1698
- return w;
1701
+ const { to: f, ...v } = e;
1702
+ return v;
1699
1703
  }), { href: a, isMatch: s, isExactMatch: c } = Ar(r, o), u = j(() => ({
1700
1704
  "router-link--match": s.value,
1701
1705
  "router-link--exact-match": c.value
1702
1706
  })), l = j(() => n.isExternal(r.value));
1703
- function p(f) {
1707
+ function d(f) {
1704
1708
  f.preventDefault(), n.push(a.value, o.value);
1705
1709
  }
1706
- return (f, w) => (ce(), Ge("a", {
1710
+ return (f, v) => (ce(), Ge("a", {
1707
1711
  href: r.value,
1708
1712
  class: Ke(["router-link", u.value]),
1709
- onClick: p
1713
+ onClick: d
1710
1714
  }, [
1711
1715
  ue(f.$slots, "default", ie(ze({ resolved: r.value, isMatch: ft(s), isExactMatch: ft(c), isExternal: l.value })))
1712
1716
  ], 10, Lr));
@@ -1725,8 +1729,8 @@ const Or = We("onBeforeRouteUpdate"), _r = We("onBeforeRouteLeave"), qr = Ft("on
1725
1729
  const f = n.matches.at(o);
1726
1730
  if (!f)
1727
1731
  return null;
1728
- const w = c(f), m = l(f);
1729
- return w ? m ? (n.params, gn(w, () => m(n.params))) : w : null;
1732
+ const v = c(f), p = l(f);
1733
+ return v ? p ? (n.params, gn(v, () => p(n.params))) : v : null;
1730
1734
  });
1731
1735
  function c(f) {
1732
1736
  return u(f)[e];
@@ -1735,12 +1739,12 @@ const Or = We("onBeforeRouteUpdate"), _r = We("onBeforeRouteLeave"), qr = Ft("on
1735
1739
  return Ut(f) ? f.components : Nt(f) ? { default: f.component } : typeof a == "string" ? {} : { default: a };
1736
1740
  }
1737
1741
  function l(f) {
1738
- return p(f)[e];
1742
+ return d(f)[e];
1739
1743
  }
1740
- function p(f) {
1744
+ function d(f) {
1741
1745
  return Ut(f) ? f.props ?? {} : Nt(f) ? { default: f.props } : {};
1742
1746
  }
1743
- return (f, w) => s.value ? ue(f.$slots, "default", ie(Ze({ key: 0 }, { route: ft(n), component: s.value, rejection: ft(r) })), () => [
1747
+ return (f, v) => s.value ? ue(f.$slots, "default", ie(Ze({ key: 0 }, { route: ft(n), component: s.value, rejection: ft(r) })), () => [
1744
1748
  (ce(), tn(en(s.value)))
1745
1749
  ]) : nn("", !0);
1746
1750
  }
@@ -1 +1 @@
1
- (function(y,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],i):(y=typeof globalThis<"u"?globalThis:y||self,i(y["@kitbag/router"]={},y.Vue))})(this,function(y,i){"use strict";var dr=Object.defineProperty;var Rr=(y,i,F)=>i in y?dr(y,i,{enumerable:!0,configurable:!0,writable:!0,value:F}):y[i]=F;var O=(y,i,F)=>(Rr(y,typeof i!="symbol"?i+"":i,F),F);class F extends Error{constructor(e){super(`Invalid Param "${e}": Router does not support multiple params by the same name. All param names must be unique.`)}}class it extends Error{constructor(){super("Router not installed")}}class Ft extends Error{constructor(e,n){super(`useRoute called with incorrect route. Given ${e}, expected ${n}`)}}const Pt=Symbol();function ft(){const t=i.inject(Pt);if(!t)throw new it;return t}class X extends Error{}class We extends Error{constructor(e){super(`Child property on meta for ${e} conflicts with the parent meta.`)}}function Te(t,e){return Me(t,e),{...t,...e}}function Me(t,e){const n=Object.keys(t).find(r=>r in e&&typeof e[r]!=typeof t[r]);if(n)throw new We(n)}function Z(t){return Array.isArray(t)?t:[t]}function Jt(t,e){return t.filter(n=>e===n).length}function tt(...t){const e=t.flatMap(n=>Array.isArray(n)?n:Object.keys(n).map(Ie));for(const n of e)if(Jt(e,n)>1)throw new F(n)}function Ie(t){return t.startsWith("?")?t.slice(1):t}function Fe(t,e){tt(t.params,e.params);const n=`${t.path}${e.path}`;return{path:n,params:{...t.params,...e.params},toString:()=>n}}function lt(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Je(t){return t.every(e=>Array.isArray(e))}function ht(t){return typeof t=="string"&&t.length>0}function Qe(t,e){tt(t.params,e.params);const n=[t.query,e.query].filter(ht).join("&");return{query:n,params:{...t.params,...e.params},toString:()=>n}}function Ge(t,e){return tt(t,e),{...t,...e}}function Ke(t){return"host"in t&&!!t.host}function Qt(t){return"parent"in t&&!!t.parent}function bt(t){return"component"in t&&!!t.component}function St(t){return"components"in t&&!!t.components}function ze(t){return"state"in t&&!!t.state}function Gt(t,e){return{...e,path:Fe(t.path,e.path),query:Qe(t.query,e.query),meta:Te(t.meta,e.meta),state:Ge(t.state,e.state),matches:[...t.matches,e.matched],host:t.host,depth:t.depth+1}}function Kt(){return typeof window<"u"&&typeof window.document<"u"}function zt(t,e){return i.defineComponent({name:"PropsWrapper",expose:[],setup(){const n=e();return"then"in n?()=>i.h(Ye(t,n)):()=>i.h(t,n)}})}function Ye(t,e){return i.defineComponent({name:"AsyncPropsWrapper",expose:[],async setup(){const n=await e;return()=>i.h(t,n)}})}const W="[",J="]";function Xe(t){return t!==String&&t!==Boolean&&t!==Number&&t!==Date}function Ze(t){return typeof t=="function"&&Xe(t)}function pt(t){return typeof t=="object"&&"get"in t&&typeof t.get=="function"&&"set"in t&&typeof t.set=="function"}function Yt(t){return pt(t)&&t.defaultValue!==void 0}function tn(t,e){return ne(t,e)}function en(t,e){return t[e]??String}const j={invalid:t=>{throw new X(t)}},nn={get:t=>t,set:(t,{invalid:e})=>{if(typeof t!="string")throw e();return t}},Xt={get:(t,{invalid:e})=>{if(t==="true")return!0;if(t==="false")return!1;throw e()},set:(t,{invalid:e})=>{if(typeof t!="boolean")throw e();return t.toString()}},Zt={get:(t,{invalid:e})=>{const n=Number(t);if(isNaN(n))throw e();return n},set:(t,{invalid:e})=>{if(typeof t!="number")throw e();return t.toString()}},te={get:(t,{invalid:e})=>{const n=new Date(t);if(isNaN(n.getTime()))throw e();return n},set:(t,{invalid:e})=>{if(typeof t!="object"||!(t instanceof Date))throw e();return t.toISOString()}},ee={get:(t,{invalid:e})=>{try{return JSON.parse(t)}catch{throw e()}},set:(t,{invalid:e})=>{try{return JSON.stringify(t)}catch{throw e()}}};function ot(t,e,n=!1){if(t===void 0||!ht(t)){if(Yt(e))return e.defaultValue;if(n)return;throw new X}if(e===String)return nn.get(t,j);if(e===Boolean)return Xt.get(t,j);if(e===Number)return Zt.get(t,j);if(e===Date)return te.get(t,j);if(e===JSON)return ee.get(t,j);if(Ze(e))return e(t,j);if(pt(e))return e.get(t,j);if(e instanceof RegExp){if(e.test(t))return t;throw new X}return t}function at(t,e,n=!1){if(t===void 0){if(n)return"";throw new X}if(e===Boolean)return Xt.set(t,j);if(e===Number)return Zt.set(t,j);if(e===Date)return te.set(t,j);if(e===JSON)return ee.set(t,j);if(pt(e))return e.set(t,j);try{return t.toString()}catch{throw new X}}function ne(t,e){return pt(t)?{...t,defaultValue:e??t.defaultValue}:{get:n=>ot(n,t),set:n=>at(n,t),defaultValue:e}}function Q(){return Q=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Q.apply(this,arguments)}var N;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(N||(N={}));var et=process.env.NODE_ENV!=="production"?function(t){return Object.freeze(t)}:function(t){return t};function K(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}var mt="beforeunload",rn="hashchange",re="popstate";function oe(t){t===void 0&&(t={});var e=t,n=e.window,r=n===void 0?document.defaultView:n,o=r.history;function a(){var R=r.location,f=R.pathname,p=R.search,E=R.hash,b=o.state||{};return[b.idx,et({pathname:f,search:p,hash:E,state:b.usr||null,key:b.key||"default"})]}var c=null;function s(){if(c)d.call(c),c=null;else{var R=N.Pop,f=a(),p=f[0],E=f[1];if(d.length)if(p!=null){var b=m-p;b&&(c={action:R,location:E,retry:function(){S(b*-1)}},S(b))}else process.env.NODE_ENV!=="production"&&K(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.");else _(R)}}r.addEventListener(re,s);var u=N.Pop,h=a(),m=h[0],l=h[1],P=nt(),d=nt();m==null&&(m=0,o.replaceState(Q({},o.state,{idx:m}),""));function k(R){return typeof R=="string"?R:z(R)}function x(R,f){return f===void 0&&(f=null),et(Q({pathname:l.pathname,hash:"",search:""},typeof R=="string"?ct(R):R,{state:f,key:Rt()}))}function $(R,f){return[{usr:R.state,key:R.key,idx:f},k(R)]}function H(R,f,p){return!d.length||(d.call({action:R,location:f,retry:p}),!1)}function _(R){u=R;var f=a();m=f[0],l=f[1],P.call({action:u,location:l})}function g(R,f){var p=N.Push,E=x(R,f);function b(){g(R,f)}if(H(p,E,b)){var B=$(E,m+1),U=B[0],C=B[1];try{o.pushState(U,"",C)}catch{r.location.assign(C)}_(p)}}function w(R,f){var p=N.Replace,E=x(R,f);function b(){w(R,f)}if(H(p,E,b)){var B=$(E,m),U=B[0],C=B[1];o.replaceState(U,"",C),_(p)}}function S(R){o.go(R)}var A={get action(){return u},get location(){return l},createHref:k,push:g,replace:w,go:S,back:function(){S(-1)},forward:function(){S(1)},listen:function(f){return P.push(f)},block:function(f){var p=d.push(f);return d.length===1&&r.addEventListener(mt,dt),function(){p(),d.length||r.removeEventListener(mt,dt)}}};return A}function on(t){t===void 0&&(t={});var e=t,n=e.window,r=n===void 0?document.defaultView:n,o=r.history;function a(){var f=ct(r.location.hash.substr(1)),p=f.pathname,E=p===void 0?"/":p,b=f.search,B=b===void 0?"":b,U=f.hash,C=U===void 0?"":U,V=o.state||{};return[V.idx,et({pathname:E,search:B,hash:C,state:V.usr||null,key:V.key||"default"})]}var c=null;function s(){if(c)d.call(c),c=null;else{var f=N.Pop,p=a(),E=p[0],b=p[1];if(d.length)if(E!=null){var B=m-E;B&&(c={action:f,location:b,retry:function(){A(B*-1)}},A(B))}else process.env.NODE_ENV!=="production"&&K(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.");else g(f)}}r.addEventListener(re,s),r.addEventListener(rn,function(){var f=a(),p=f[1];z(p)!==z(l)&&s()});var u=N.Pop,h=a(),m=h[0],l=h[1],P=nt(),d=nt();m==null&&(m=0,o.replaceState(Q({},o.state,{idx:m}),""));function k(){var f=document.querySelector("base"),p="";if(f&&f.getAttribute("href")){var E=r.location.href,b=E.indexOf("#");p=b===-1?E:E.slice(0,b)}return p}function x(f){return k()+"#"+(typeof f=="string"?f:z(f))}function $(f,p){return p===void 0&&(p=null),et(Q({pathname:l.pathname,hash:"",search:""},typeof f=="string"?ct(f):f,{state:p,key:Rt()}))}function H(f,p){return[{usr:f.state,key:f.key,idx:p},x(f)]}function _(f,p,E){return!d.length||(d.call({action:f,location:p,retry:E}),!1)}function g(f){u=f;var p=a();m=p[0],l=p[1],P.call({action:u,location:l})}function w(f,p){var E=N.Push,b=$(f,p);function B(){w(f,p)}if(process.env.NODE_ENV!=="production"&&K(b.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.push("+JSON.stringify(f)+")"),_(E,b,B)){var U=H(b,m+1),C=U[0],V=U[1];try{o.pushState(C,"",V)}catch{r.location.assign(V)}g(E)}}function S(f,p){var E=N.Replace,b=$(f,p);function B(){S(f,p)}if(process.env.NODE_ENV!=="production"&&K(b.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.replace("+JSON.stringify(f)+")"),_(E,b,B)){var U=H(b,m),C=U[0],V=U[1];o.replaceState(C,"",V),g(E)}}function A(f){o.go(f)}var R={get action(){return u},get location(){return l},createHref:x,push:w,replace:S,go:A,back:function(){A(-1)},forward:function(){A(1)},listen:function(p){return P.push(p)},block:function(p){var E=d.push(p);return d.length===1&&r.addEventListener(mt,dt),function(){E(),d.length||r.removeEventListener(mt,dt)}}};return R}function ae(t){t===void 0&&(t={});var e=t,n=e.initialEntries,r=n===void 0?["/"]:n,o=e.initialIndex,a=r.map(function(g){var w=et(Q({pathname:"/",search:"",hash:"",state:null,key:Rt()},typeof g=="string"?ct(g):g));return process.env.NODE_ENV!=="production"&&K(w.pathname.charAt(0)==="/","Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(g)+")"),w}),c=ce(o??a.length-1,0,a.length-1),s=N.Pop,u=a[c],h=nt(),m=nt();function l(g){return typeof g=="string"?g:z(g)}function P(g,w){return w===void 0&&(w=null),et(Q({pathname:u.pathname,search:"",hash:""},typeof g=="string"?ct(g):g,{state:w,key:Rt()}))}function d(g,w,S){return!m.length||(m.call({action:g,location:w,retry:S}),!1)}function k(g,w){s=g,u=w,h.call({action:s,location:u})}function x(g,w){var S=N.Push,A=P(g,w);function R(){x(g,w)}process.env.NODE_ENV!=="production"&&K(u.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.push("+JSON.stringify(g)+")"),d(S,A,R)&&(c+=1,a.splice(c,a.length,A),k(S,A))}function $(g,w){var S=N.Replace,A=P(g,w);function R(){$(g,w)}process.env.NODE_ENV!=="production"&&K(u.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.replace("+JSON.stringify(g)+")"),d(S,A,R)&&(a[c]=A,k(S,A))}function H(g){var w=ce(c+g,0,a.length-1),S=N.Pop,A=a[w];function R(){H(g)}d(S,A,R)&&(c=w,k(S,A))}var _={get index(){return c},get action(){return s},get location(){return u},createHref:l,push:x,replace:$,go:H,back:function(){H(-1)},forward:function(){H(1)},listen:function(w){return h.push(w)},block:function(w){return m.push(w)}};return _}function ce(t,e,n){return Math.min(Math.max(t,e),n)}function dt(t){t.preventDefault(),t.returnValue=""}function nt(){var t=[];return{get length(){return t.length},push:function(n){return t.push(n),function(){t=t.filter(function(r){return r!==n})}},call:function(n){t.forEach(function(r){return r&&r(n)})}}}function Rt(){return Math.random().toString(36).substr(2,8)}function z(t){var e=t.pathname,n=e===void 0?"/":e,r=t.search,o=r===void 0?"":r,a=t.hash,c=a===void 0?"":a;return o&&o!=="?"&&(n+=o.charAt(0)==="?"?o:"?"+o),c&&c!=="#"&&(n+=c.charAt(0)==="#"?c:"#"+c),n}function ct(t){var e={};if(t){var n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));var r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}const At=Symbol();function se(){const t=i.inject(At);if(!t)throw new it;return t}const ue=Symbol("isRouterRouteSymbol");function an(t){return typeof t=="object"&&t!==null&&ue in t}function cn(t,e){function n(m,l,P){if(typeof m=="object"){const k={...t.params,...m};return e(t.name,k,l)}const d={...t.params,[m]:l};return e(t.name,d,P)}const{matched:r,matches:o,name:a,query:c,params:s,state:u}=i.toRefs(t),h=i.reactive({matched:r,matches:o,state:u,query:c,params:s,name:a,update:n,[ue]:!0});return new Proxy(h,{get:(m,l,P)=>l==="params"?new Proxy(t.params,{set(d,k,x){return n(k,x),!0}}):l==="state"?new Proxy(t.state,{set(d,k,x){return n({},{state:{...t.state,[k]:x}}),!0}}):Reflect.get(m,l,P)})}const ie=Symbol();function sn(t,e){const n=i.reactive({...t}),r=c=>{Object.assign(n,{[ie]:!1,...c})},o=n,a=cn(o,e);return{currentRoute:o,routerRoute:a,updateRoute:r}}function Y(t){return!t.startsWith("http")?fn(t):un(t)}function un(t){const{protocol:e,host:n,pathname:r,search:o,searchParams:a,hash:c}=new URL(t,t);return{protocol:e,host:n,pathname:r,search:o,searchParams:a,hash:c}}function fn(t){const{pathname:e,search:n,searchParams:r,hash:o}=new URL(t,"https://localhost");return{pathname:e,search:n,searchParams:r,hash:o}}function ln(t){return e=>{const{host:n}=Y(e);return!(n===void 0||n===t)}}function hn({mode:t,listener:e}){const n=pn(t),r=(u,h)=>{if(h!=null&&h.replace)return n.replace(u,h.state);n.push(u,h==null?void 0:h.state)},o=()=>{const u=z(n.location);return n.replace(u)};let a;return{...n,update:r,refresh:o,startListening:()=>{a==null||a(),a=n.listen(e)},stopListening:()=>{a==null||a()}}}function pn(t="auto"){switch(t){case"auto":return Kt()?oe():ae();case"browser":return oe();case"memory":return ae();case"hash":return on();default:const e=t;throw new Error(`Switch is not exhaustive for mode: ${e}`)}}class gt{constructor(){O(this,"onBeforeRouteEnter",new Set);O(this,"onBeforeRouteUpdate",new Set);O(this,"onBeforeRouteLeave",new Set);O(this,"onAfterRouteEnter",new Set);O(this,"onAfterRouteUpdate",new Set);O(this,"onAfterRouteLeave",new Set)}}class fe extends Error{}class st extends Error{constructor(n){super("Error occurred during a router push operation.");O(this,"to");this.to=n}}class kt extends Error{constructor(n){super(`Routing action rejected: ${n}`);O(this,"type");this.type=n}}function mn(t,e){const n=new gt;return t.matches.forEach((r,o)=>{r.onBeforeRouteEnter&&xt(t,e,o)&&Z(r.onBeforeRouteEnter).forEach(a=>n.onBeforeRouteEnter.add(a)),r.onBeforeRouteUpdate&&Lt(t,e,o)&&Z(r.onBeforeRouteUpdate).forEach(a=>n.onBeforeRouteUpdate.add(a))}),e.matches.forEach((r,o)=>{r.onBeforeRouteLeave&&Bt(t,e,o)&&Z(r.onBeforeRouteLeave).forEach(a=>n.onBeforeRouteLeave.add(a))}),n}function dn(t,e){const n=new gt;return t.matches.forEach((r,o)=>{r.onAfterRouteEnter&&xt(t,e,o)&&Z(r.onAfterRouteEnter).forEach(a=>n.onAfterRouteEnter.add(a)),r.onAfterRouteUpdate&&Lt(t,e,o)&&Z(r.onAfterRouteUpdate).forEach(a=>n.onAfterRouteUpdate.add(a))}),e.matches.forEach((r,o)=>{r.onAfterRouteLeave&&Bt(t,e,o)&&Z(r.onAfterRouteLeave).forEach(a=>n.onAfterRouteLeave.add(a))}),n}function T(t){return typeof t!="string"?!1:/^(https?:\/\/|\/).*/g.test(t)}function Rn(){const t=c=>{throw new kt(c)},e=(...c)=>{throw new st(c)},n=(c,s,u)=>{if(T(c)){const l=s??{};throw new st([c,{...l,replace:!0}])}const h=s,m=u??{};throw new st([c,h,{...m,replace:!0}])},r=()=>{throw new fe};async function o({to:c,from:s,hooks:u}){const{global:h,component:m}=u,l=mn(c,s),P=[...h.onBeforeRouteEnter,...l.onBeforeRouteEnter,...h.onBeforeRouteUpdate,...l.onBeforeRouteUpdate,...m.onBeforeRouteUpdate,...h.onBeforeRouteLeave,...l.onBeforeRouteLeave,...m.onBeforeRouteLeave];try{const d=P.map(k=>k(c,{from:s,reject:t,push:e,replace:n,abort:r}));await Promise.all(d)}catch(d){if(d instanceof st)return{status:"PUSH",to:d.to};if(d instanceof kt)return{status:"REJECT",type:d.type};if(d instanceof fe)return{status:"ABORT"};throw d}return{status:"SUCCESS"}}async function a({to:c,from:s,hooks:u}){const{global:h,component:m}=u,l=dn(c,s),P=[...m.onAfterRouteLeave,...l.onAfterRouteLeave,...h.onAfterRouteLeave,...m.onAfterRouteUpdate,...l.onAfterRouteUpdate,...h.onAfterRouteUpdate,...m.onAfterRouteEnter,...l.onAfterRouteEnter,...h.onAfterRouteEnter];try{const d=P.map(k=>k(c,{from:s,reject:t,push:e,replace:n}));await Promise.all(d)}catch(d){if(d instanceof st)return{status:"PUSH",to:d.to};if(d instanceof kt)return{status:"REJECT",type:d.type};throw d}return{status:"SUCCESS"}}return{runBeforeRouteHooks:o,runAfterRouteHooks:a}}const xt=(t,e,n)=>{const r=t.matches,o=(e==null?void 0:e.matches)??[];return r.length<n||r[n]!==o[n]},Bt=(t,e,n)=>{const r=t.matches,o=(e==null?void 0:e.matches)??[];return r.length<n||r[n]!==o[n]},Lt=(t,e,n)=>t.matches[n]===(e==null?void 0:e.matches[n]);function le(t){switch(t){case"onBeforeRouteEnter":case"onAfterRouteEnter":return xt;case"onBeforeRouteUpdate":case"onAfterRouteUpdate":return Lt;case"onBeforeRouteLeave":case"onAfterRouteLeave":return Bt;default:throw new Error(`Switch is not exhaustive for lifecycle: ${t}`)}}class gn{constructor(){O(this,"global",new gt);O(this,"component",new gt)}addBeforeRouteHook({lifecycle:e,timing:n,depth:r,hook:o}){const a=le(e),c=this[n][e],s=(u,h)=>{if(a(u,h.from,r))return o(u,h)};return c.add(s),()=>c.delete(s)}addAfterRouteHook({lifecycle:e,timing:n,depth:r,hook:o}){const a=le(e),c=this[n][e],s=(u,h)=>{if(a(u,h.from,r))return o(u,h)};return c.add(s),()=>c.delete(s)}}const he=Symbol();function yn(){const t=new gn;return{onBeforeRouteEnter:s=>t.addBeforeRouteHook({lifecycle:"onBeforeRouteEnter",hook:s,timing:"global",depth:0}),onBeforeRouteUpdate:s=>t.addBeforeRouteHook({lifecycle:"onBeforeRouteUpdate",hook:s,timing:"global",depth:0}),onBeforeRouteLeave:s=>t.addBeforeRouteHook({lifecycle:"onBeforeRouteLeave",hook:s,timing:"global",depth:0}),onAfterRouteEnter:s=>t.addAfterRouteHook({lifecycle:"onAfterRouteEnter",hook:s,timing:"global",depth:0}),onAfterRouteUpdate:s=>t.addAfterRouteHook({lifecycle:"onAfterRouteUpdate",hook:s,timing:"global",depth:0}),onAfterRouteLeave:s=>t.addAfterRouteHook({lifecycle:"onAfterRouteLeave",hook:s,timing:"global",depth:0}),hooks:t}}function wn(t){return i.defineComponent(()=>()=>i.h("h1",t),{name:t,props:[]})}function pe(t){const e=new URLSearchParams(t);return{get:n=>e.get(n),getAll:n=>e.getAll(n)}}function vn({rejections:t}){const e=a=>{const c={...t};return i.markRaw(c[a]??wn(a))},n=a=>{const c=i.markRaw(e(a)),s={name:a,component:c,meta:{},state:{}};return{matched:s,matches:[s],name:a,query:pe(""),params:{},state:{},[ie]:!0}},r=a=>{if(!a){o.value=null;return}const c=e(a);o.value={type:a,component:c}},o=i.ref(null);return{setRejection:r,rejection:o,getRejectionRoute:n}}class En extends Error{constructor(e){super(`Route not found: "${e}"`)}}function Ut(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Pn(t,e){const n=Array.from(t.matchAll(e));if(n.length===0)return[t];let r=0;const o=n.reduce((c,s)=>{const u=Ut(t.slice(r,s.index));u.length&&c.push(u);const[h]=s;return c.push(h),r=s.index+h.length,c},[]),a=t.slice(r);return a&&o.push(a),o}function bn(t){const e=me(t.path.toString());return new RegExp(`^${e}$`,"i")}function Sn(t){const e=new URLSearchParams(t.query.toString());return Array.from(e.entries()).filter(([,n])=>!Ct(n)).map(([n,r])=>{const o=me(r);return new RegExp(`${Ut(n)}=${o}(&|$)`,"i")})}function me(t){return Pn(t,new RegExp(An,"g")).map(e=>e.startsWith(W)?de(e):Ut(e)).join("")}function de(t){return[kn,xn].reduce((e,n)=>n(e),t)}const An=`\\${W}\\??([\\w-_]+)\\${J}`,Nt=`\\${W}\\?([\\w-_]+)\\${J}`,Re=`\\${W}([\\w-_]+)\\${J}`;function kn(t){return t.replace(new RegExp(Nt,"g"),".*")}function Ct(t){return new RegExp(Nt,"g").test(t)}function xn(t){return t.replace(new RegExp(Re,"g"),".+")}function yt(t){const[e]=wt(t,new RegExp(Nt,"g")),[n]=wt(t,new RegExp(Re,"g"));return e??n}function wt(t,e){return Array.from(t.matchAll(e)).flatMap(([,...r])=>r.map(o=>ht(o)?o:""))}function ge(t,e,n){const r=we(e,n),[o]=wt(t,r);return o}function ye(t,e){if(!e)return t;const{name:n,param:r,value:o}=e,a=we(t,n);return wt(t,a).reduce((s,u)=>u===void 0?s:s.replace(u,()=>at(o,r,n.startsWith("?"))),t)}function we(t,e){const n=[Bn,Ln,de].reduce((r,o)=>o(r,e),t);return new RegExp(n,"g")}function Bn(t,e){if(!e.startsWith("?"))return t;const n=new RegExp(`\\${W}\\${e}\\${J}`,"g");return t.replace(n,"(.*)")}function Ln(t,e){if(e.startsWith("?"))return t;const n=new RegExp(`\\${W}${e}\\${J}`,"g");return t.replace(n,"(.+)")}function ve(t,...e){return e.reduce((n,r)=>{if(!r)return n;const o=new URLSearchParams(r).toString();return Object.keys(o).length===0?n:n.includes("?")?`${n}&${o}`:`${n}?${o}`},t)}function Un(t,e={}){const{params:n={},query:r}=e,o=Nn(t.host,n),a=Cn(t.path,n),c=$n(t.query,n);return ve(`${o}${a}`,c,r)}function Nn(t,e){const n=t.toString();return Object.entries(t.params).reduce((r,[o,a])=>{const c=yt(`${W}${o}${J}`);return c?ye(r,{name:o,param:a,value:e[c]}):r},n)}function Cn(t,e){const n=t.toString();return Object.entries(t.params).reduce((r,[o,a])=>{const c=yt(`${W}${o}${J}`);return c?ye(r,{name:o,param:a,value:e[c]}):r},n)}function $n(t,e){const n=t.toString();if(!n)return{};const r=new URLSearchParams(n);return Array.from(r.entries()).reduce((o,[a,c])=>{const s=yt(c);if(!s)return{...o,[a]:c};const h=at(e[s],t.params[s],Ct(c)),m=e[s]===void 0&&h==="";return Ct(c)&&m?o:{...o,[a]:h}},{})}function jn(t){return(e,n,r)=>{if(T(e))return ve(e,(n??{}).query);const o=n??{},a=r??{},c=t.find(u=>u.name===e);if(!c)throw new En(String(e));return Un(c,{params:o,query:a.query})}}class Hn extends Error{constructor(){super("initialUrl must be set if window.location is unavailable")}}function Vn(t){if(t)return t;if(Kt())return window.location.toString();throw new Hn}const On=(t,e)=>{try{Ee(t,e)}catch{return!1}return!0},Ee=(t,e)=>{const{pathname:n,search:r}=Y(e);return{..._n(t.path,n),...qn(t.query,r)}};function _n(t,e){const n={},r=decodeURIComponent(e);for(const[o,a]of Object.entries(t.params)){const c=o.startsWith("?"),s=c?o.slice(1):o,u=ge(r,t.toString(),o),h=ot(u,a,c);n[s]=h}return n}function qn(t,e){const n={},r=new URLSearchParams(e);for(const[o,a]of Object.entries(t.params)){const c=o.startsWith("?"),s=c?o.slice(1):o,u=r.get(s)??void 0,h=ot(u,a,c);n[s]=h}return n}const Dn=t=>"name"in t.matched&&!!t.matched.name,Wn=(t,e)=>{const{pathname:n}=Y(e);return bn(t).test(n)},Tn=(t,e)=>{const{search:n}=Y(e);return Sn(t).every(o=>o.test(n))};function Mn(t){const{searchParams:e,pathname:n}=Y(t),r=-1,o=1;return(a,c)=>{const s=be(a,e),u=Pe(a,n),h=be(c,e),m=Pe(c,n);return a.depth>c.depth?r:a.depth<c.depth?o:s+u>h+m?r:s+u<h+m?o:0}}function Pe(t,e){const n=Object.keys(t.path.params).filter(o=>o.startsWith("?")).map(o=>o),r=n.filter(o=>ge(e,t.path.toString(),o)===void 0);return n.length-r.length}function be(t,e){const n=new URLSearchParams(t.query.toString()),r=Array.from(n.keys()),o=r.filter(a=>!e.has(a));return r.length-o.length}function Se(t){return!!t&&typeof t=="object"}const vt=!0;function In(t,e,n){if(Se(t)&&e in t){const r=t[e];if(typeof r=="string")return ot(r,n,vt)}return ot(void 0,n,vt)}function Fn(t,e){const n={};for(const[r,o]of Object.entries(t)){const a=In(e,r,o);n[r]=a}return n}function Jn(t,e,n){if(Se(t)&&e in t){const r=t[e];return at(r,n,vt)}return at(void 0,n,vt)}const Ae=(t,e)=>{const n={};for(const[r,o]of Object.entries(t)){const a=Jn(e,r,o);n[r]=a}return n},Qn=[Dn,Wn,Tn,On];function $t(t,e,n){const r=Mn(e),o=t.filter(s=>Qn.every(u=>u(s,e))).sort(r);if(o.length===0)return;const[a]=o,{search:c}=Y(e);return{matched:a.matched,matches:a.matches,name:a.name,query:pe(c),params:Ee(a,e),state:Fn(a.state,n)}}function jt(t,e){const n=new RegExp(`\\${W}(\\??[\\w-_]+)\\${J}`,"g");return Array.from(t.matchAll(n)).reduce((o,[a,c])=>{const s=yt(a);if(!s)return o;const u=en(e,s);return tt([s],o),o[c]=u,o},{})}function ke(t,e){return{host:t,params:jt(t,e),toString:()=>t}}function Ht(t){return t===void 0?"":t}function Vt(t,e){return{path:t,params:jt(t,e),toString:()=>t}}function Gn(t){return lt(t)&&typeof t.path=="string"}function xe(t){return t===void 0?Vt("",{}):Gn(t)?t:Vt(t,{})}function Ot(t,e){return{query:t,params:jt(t,e),toString:()=>t}}function Kn(t){return lt(t)&&typeof t.query=="string"}function Be(t){return t===void 0?Ot("",{}):Kn(t)?t:Ot(t,{})}function M(t){const e=Ht(t.name),n=xe(t.path),r=Be(t.query),o=t.meta??{},a=ze(t)?t.state:{},c=i.markRaw({meta:{},state:{},...t}),s={matched:c,matches:[c],name:e,path:n,query:r,meta:o,state:a,depth:1,host:ke("",{}),prefetch:t.prefetch},u=Qt(t)?Gt(t.parent,s):s;return tt(u.path.params,u.query.params),u}function zn(t,e){if(!ht(e))return t;const n=M({path:e});return t.map(r=>M({parent:n,...r}))}class Yn extends Error{constructor(e){super(`Invalid Name "${e}": Router does not support multiple routes with the same name. All name names must be unique.`)}}function Xn(t){const e=t.map(({name:n})=>n);for(const n of e)if(Jt(e,n)>1)throw new Yn(n)}function Zn(t,e){const n=Je(t)?t.flat():t,r=zn(n,e==null?void 0:e.base);Xn(r);const o=jn(r),a=hn({mode:e==null?void 0:e.historyMode,listener:({location:v})=>{const L=z(v);x(L,{state:v.state})}}),{runBeforeRouteHooks:c,runAfterRouteHooks:s}=Rn(),{hooks:u,onBeforeRouteEnter:h,onAfterRouteUpdate:m,onBeforeRouteLeave:l,onAfterRouteEnter:P,onBeforeRouteUpdate:d,onAfterRouteLeave:k}=yn();async function x(v,L={}){if(a.stopListening(),C(v))return a.update(v,L);const q=$t(r,v,L.state)??A("NotFound"),D={...f},rt=await c({to:q,from:D,hooks:u});switch(rt.status){case"ABORT":return;case"PUSH":a.update(v,L),await $(...rt.to);return;case"REJECT":a.update(v,L),w(rt.type),E(q);break;case"SUCCESS":a.update(v,L),w(null),E(q);break;default:throw new Error(`Switch is not exhaustive for before hook response status: ${JSON.stringify(rt)}`)}const G=await s({to:q,from:D,hooks:u});switch(G.status){case"PUSH":await $(...G.to);break;case"REJECT":w(G.type);break;case"SUCCESS":break;default:const I=G;throw new Error(`Switch is not exhaustive for after hook response status: ${JSON.stringify(I)}`)}a.startListening()}const $=(v,L,q)=>{if(T(v)){const ut={...L},It=o(v,ut);return x(It,ut)}const D={...q},G=o(v,L??{},D),I=Tt(v),Mt=Ae((I==null?void 0:I.state)??{},D.state);return x(G,{...D,state:Mt})},H=(v,L,q)=>{if(T(v)){const ut={...L,replace:!0},It=o(v,ut);return x(It,ut)}const D={...q,replace:!0},G=o(v,L??{},D),I=Tt(v),Mt=Ae((I==null?void 0:I.state)??{},D.state);return x(G,{...D,state:Mt})},_=v=>w(v),g=(v,L={})=>{if(!T(v)){const q=o(v,L);return $t(r,q)}if(!C(v))return $t(r,v)},{setRejection:w,rejection:S,getRejectionRoute:A}=vn(e??{}),R=A("NotFound"),{currentRoute:f,routerRoute:p,updateRoute:E}=sn(R,$);a.startListening();const b=Vn(e==null?void 0:e.initialUrl),B=a.location.state,{host:U}=Y(b),C=ln(U),V=x(b,{replace:!0,state:B});function Tt(v){return r.find(L=>L.name===v)}function mr(v){v.component("RouterView",_e),v.component("RouterLink",Oe),v.provide(At,S),v.provide(he,u),v.provide(Pt,De)}const De={route:p,resolve:o,push:$,replace:H,reject:_,find:g,refresh:a.refresh,forward:a.forward,back:a.back,go:a.go,install:mr,initialized:V,isExternal:C,onBeforeRouteEnter:h,onAfterRouteUpdate:m,onBeforeRouteLeave:l,onAfterRouteEnter:P,onBeforeRouteUpdate:d,onAfterRouteLeave:k,prefetch:e==null?void 0:e.prefetch};return De}const Et={template:"<div>This is component</div>"},_t=M({name:"parentA",path:"/parentA/[paramA]"}),Le=M({parent:_t,name:"parentA.childA",path:"/[?paramB]"}),tr=M({parent:_t,name:"parentA.childB",path:"/[paramD]",component:Et}),er=M({parent:Le,name:"parentA.childA.grandChildA",path:"/[paramC]",component:Et});M({name:"parentB",path:"/parentB",component:Et}),M({name:"parentC",path:"/",component:Et});const nr={components:!0};function rr({routerPrefetch:t,routePrefetch:e,linkPrefetch:n},r){return qt(n,r)??qt(e,r)??qt(t,r)??nr[r]}function qt(t,e){return lt(t)?t[e]:t}const or=i.defineAsyncComponent(()=>new Promise(t=>{t({default:{template:""}})}));function Ue(t){return t.name===or.name&&"setup"in t}function Ne(t,e={},n={}){const r=ft(),o=i.toRef(t),a=i.computed(()=>T(o.value)?{}:i.toValue(e)),c=i.computed(()=>T(o.value)?i.toValue(e):i.toValue(n)),s=i.computed(()=>{if(T(o.value))return o.value;try{return r.resolve(o.value,a.value,c.value)}catch(l){throw l instanceof X&&console.error(`Failed to resolve route "${o.value.toString()}" in RouterLink.`,l),l}}),u=i.computed(()=>r.find(s.value,c.value)),h=i.computed(()=>!!u.value&&r.route.matches.includes(u.value.matched)),m=i.computed(()=>!!u.value&&r.route.matched===u.value.matched);return i.watch(u,l=>{if(!l)return;const{prefetch:P}=r,{prefetch:d}=c.value;ar(l,{routerPrefetch:P,linkPrefetch:d})},{immediate:!0}),{route:u,href:s,isMatch:h,isExactMatch:m,push:l=>r.push(s.value,{},{...c.value,...l}),replace:l=>r.replace(s.value,{},{...c.value,...l})}}function ar(t,{routerPrefetch:e,linkPrefetch:n}){t.matches.forEach(r=>{rr({routePrefetch:r.prefetch,routerPrefetch:e,linkPrefetch:n},"components")&&(bt(r)&&Ue(r.component)&&r.component.setup(),St(r)&&Object.values(r.components).forEach(a=>{Ue(a)&&a.setup()}))})}function Ce(t,e,{exact:n}={}){if(!an(t))return!1;if(e===void 0)return!0;const r=t.matches.map(o=>Ht(o.name));if(n){const o=r.at(-1);return e===o}return r.includes(e)}function $e(t,e){const n=ft();function r(){if(!t)return;if(!Ce(n.route,t,e))throw new Ft(t,n.route.name)}return i.watch(n.route,r,{immediate:!0,deep:!0}),n.route}const je=Symbol();function Dt(){return i.inject(je,0)}function He(){const t=i.inject(he);if(!t)throw new it;return t}function Ve(t){return e=>{const n=Dt(),o=He().addBeforeRouteHook({lifecycle:t,hook:e,depth:n,timing:"component"});return i.onUnmounted(o),o}}function Wt(t){return e=>{const n=Dt(),o=He().addAfterRouteHook({lifecycle:t,hook:e,depth:n,timing:"component"});return i.onUnmounted(o),o}}const cr=Ve("onBeforeRouteUpdate"),sr=Ve("onBeforeRouteLeave"),ur=Wt("onAfterRouteEnter"),ir=Wt("onAfterRouteUpdate"),fr=Wt("onAfterRouteLeave"),lr=["href"],Oe=i.defineComponent({__name:"routerLink",props:{to:{},prefetch:{type:[Boolean,Object],default:void 0},query:{},replace:{type:Boolean},state:{}},setup(t){const e=t,n=ft(),r=i.computed(()=>T(e.to)?e.to:e.to(n.resolve)),o=i.computed(()=>{const{to:l,...P}=e;return P}),{href:a,isMatch:c,isExactMatch:s}=Ne(r,o),u=i.computed(()=>({"router-link--match":c.value,"router-link--exact-match":s.value})),h=i.computed(()=>n.isExternal(r.value));function m(l){l.preventDefault(),n.push(a.value,o.value)}return(l,P)=>(i.openBlock(),i.createElementBlock("a",{href:r.value,class:i.normalizeClass(["router-link",u.value]),onClick:m},[i.renderSlot(l.$slots,"default",i.normalizeProps(i.guardReactiveProps({resolved:r.value,isMatch:i.unref(c),isExactMatch:i.unref(s),isExternal:h.value})))],10,lr))}}),_e=i.defineComponent({__name:"routerView",props:{name:{}},setup(t){const{name:e="default"}=t,n=$e(),r=se(),o=Dt(),a=i.resolveComponent("RouterView",!0);i.provide(je,o+1);const c=i.computed(()=>{if(r.value)return r.value.component;const l=n.matches.at(o);if(!l)return null;const P=s(l),d=h(l);return P?d?(n.params,zt(P,()=>d(n.params))):P:null});function s(l){return u(l)[e]}function u(l){return St(l)?l.components:bt(l)?{default:l.component}:typeof a=="string"?{}:{default:a}}function h(l){return m(l)[e]}function m(l){return St(l)?l.props??{}:bt(l)?{default:l.props}:{}}return(l,P)=>c.value?i.renderSlot(l.$slots,"default",i.normalizeProps(i.mergeProps({key:0},{route:i.unref(n),component:c.value,rejection:i.unref(r)})),()=>[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(c.value)))]):i.createCommentVNode("",!0)}});function hr(t){return lt(t)&&typeof t.host=="string"}function qe(t){return hr(t)?t:ke(t,{})}function pr(t){const e=Ht(t.name),n=xe(t.path),r=Be(t.query),o=t.meta??{},a=Ke(t)?qe(t.host):qe(""),c=i.markRaw({meta:{},state:{},...t}),s={matched:c,matches:[c],name:e,host:a,path:n,query:r,meta:o,depth:1,state:{}},u=Qt(t)?Gt(t.parent,s):s;return tt(u.path.params,u.query.params,u.host.params),u}y.DuplicateParamsError=F,y.RouterLink=Oe,y.RouterNotInstalledError=it,y.RouterView=_e,y.UseRouteInvalidError=Ft,y.component=zt,y.createExternalRoute=pr,y.createParam=ne,y.createRoute=M,y.createRouter=Zn,y.isParamWithDefault=Yt,y.isRoute=Ce,y.onAfterRouteEnter=ur,y.onAfterRouteLeave=ir,y.onAfterRouteUpdate=fr,y.onBeforeRouteLeave=cr,y.onBeforeRouteUpdate=sr,y.path=Vt,y.query=Ot,y.routerInjectionKey=Pt,y.routerRejectionKey=At,y.useLink=Ne,y.useRejection=se,y.useRoute=$e,y.useRouter=ft,y.withDefault=tn,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
1
+ (function(y,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],i):(y=typeof globalThis<"u"?globalThis:y||self,i(y["@kitbag/router"]={},y.Vue))})(this,function(y,i){"use strict";var dr=Object.defineProperty;var Rr=(y,i,F)=>i in y?dr(y,i,{enumerable:!0,configurable:!0,writable:!0,value:F}):y[i]=F;var O=(y,i,F)=>(Rr(y,typeof i!="symbol"?i+"":i,F),F);class F extends Error{constructor(e){super(`Invalid Param "${e}": Router does not support multiple params by the same name. All param names must be unique.`)}}class it extends Error{constructor(){super("Router not installed")}}class Ft extends Error{constructor(e,n){super(`useRoute called with incorrect route. Given ${e}, expected ${n}`)}}const Pt=Symbol();function ft(){const t=i.inject(Pt);if(!t)throw new it;return t}class X extends Error{}class We extends Error{constructor(e){super(`Child property on meta for ${e} conflicts with the parent meta.`)}}function Te(t,e){return Me(t,e),{...t,...e}}function Me(t,e){const n=Object.keys(t).find(r=>r in e&&typeof e[r]!=typeof t[r]);if(n)throw new We(n)}function Z(t){return Array.isArray(t)?t:[t]}function Jt(t,e){return t.filter(n=>e===n).length}function tt(...t){const e=t.flatMap(n=>Array.isArray(n)?n:Object.keys(n).map(Ie));for(const n of e)if(Jt(e,n)>1)throw new F(n)}function Ie(t){return t.startsWith("?")?t.slice(1):t}function Fe(t,e){tt(t.params,e.params);const n=`${t.path}${e.path}`;return{path:n,params:{...t.params,...e.params},toString:()=>n}}function lt(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Je(t){return t.every(e=>Array.isArray(e))}function ht(t){return typeof t=="string"&&t.length>0}function Qe(t,e){tt(t.params,e.params);const n=[t.query,e.query].filter(ht).join("&");return{query:n,params:{...t.params,...e.params},toString:()=>n}}function Ge(t,e){return tt(t,e),{...t,...e}}function Ke(t){return"host"in t&&!!t.host}function Qt(t){return"parent"in t&&!!t.parent}function bt(t){return"component"in t&&!!t.component}function St(t){return"components"in t&&!!t.components}function ze(t){return"state"in t&&!!t.state}function Gt(t,e){return{...e,path:Fe(t.path,e.path),query:Qe(t.query,e.query),meta:Te(t.meta,e.meta),state:Ge(t.state,e.state),matches:[...t.matches,e.matched],host:t.host,depth:t.depth+1}}function Kt(){return typeof window<"u"&&typeof window.document<"u"}function zt(t,e){return i.defineComponent({name:"PropsWrapper",expose:[],setup(){const n=e();return"then"in n?()=>i.h(Ye(t,n)):()=>i.h(t,n)}})}function Ye(t,e){return i.defineComponent({name:"AsyncPropsWrapper",expose:[],async setup(){const n=await e;return()=>i.h(t,n)}})}const W="[",J="]";function Xe(t){return t!==String&&t!==Boolean&&t!==Number&&t!==Date}function Ze(t){return typeof t=="function"&&Xe(t)}function pt(t){return typeof t=="object"&&"get"in t&&typeof t.get=="function"&&"set"in t&&typeof t.set=="function"}function Yt(t){return pt(t)&&t.defaultValue!==void 0}function tn(t,e){return ne(t,e)}function en(t,e){return t[e]??String}const j={invalid:t=>{throw new X(t)}},nn={get:t=>t,set:(t,{invalid:e})=>{if(typeof t!="string")throw e();return t}},Xt={get:(t,{invalid:e})=>{if(t==="true")return!0;if(t==="false")return!1;throw e()},set:(t,{invalid:e})=>{if(typeof t!="boolean")throw e();return t.toString()}},Zt={get:(t,{invalid:e})=>{const n=Number(t);if(isNaN(n))throw e();return n},set:(t,{invalid:e})=>{if(typeof t!="number")throw e();return t.toString()}},te={get:(t,{invalid:e})=>{const n=new Date(t);if(isNaN(n.getTime()))throw e();return n},set:(t,{invalid:e})=>{if(typeof t!="object"||!(t instanceof Date))throw e();return t.toISOString()}},ee={get:(t,{invalid:e})=>{try{return JSON.parse(t)}catch{throw e()}},set:(t,{invalid:e})=>{try{return JSON.stringify(t)}catch{throw e()}}};function ot(t,e,n=!1){if(t===void 0||!ht(t)){if(Yt(e))return e.defaultValue;if(n)return;throw new X}if(e===String)return nn.get(t,j);if(e===Boolean)return Xt.get(t,j);if(e===Number)return Zt.get(t,j);if(e===Date)return te.get(t,j);if(e===JSON)return ee.get(t,j);if(Ze(e))return e(t,j);if(pt(e))return e.get(t,j);if(e instanceof RegExp){if(e.test(t))return t;throw new X}return t}function at(t,e,n=!1){if(t===void 0){if(n)return"";throw new X}if(e===Boolean)return Xt.set(t,j);if(e===Number)return Zt.set(t,j);if(e===Date)return te.set(t,j);if(e===JSON)return ee.set(t,j);if(pt(e))return e.set(t,j);try{return t.toString()}catch{throw new X}}function ne(t,e){return pt(t)?{...t,defaultValue:e??t.defaultValue}:{get:n=>ot(n,t),set:n=>at(n,t),defaultValue:e}}function Q(){return Q=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Q.apply(this,arguments)}var $;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})($||($={}));var et=process.env.NODE_ENV!=="production"?function(t){return Object.freeze(t)}:function(t){return t};function K(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}var mt="beforeunload",rn="hashchange",re="popstate";function oe(t){t===void 0&&(t={});var e=t,n=e.window,r=n===void 0?document.defaultView:n,o=r.history;function a(){var d=r.location,f=d.pathname,p=d.search,P=d.hash,b=o.state||{};return[b.idx,et({pathname:f,search:p,hash:P,state:b.usr||null,key:b.key||"default"})]}var c=null;function s(){if(c)m.call(c),c=null;else{var d=$.Pop,f=a(),p=f[0],P=f[1];if(m.length)if(p!=null){var b=R-p;b&&(c={action:d,location:P,retry:function(){A(b*-1)}},A(b))}else process.env.NODE_ENV!=="production"&&K(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.");else _(d)}}r.addEventListener(re,s);var u=$.Pop,h=a(),R=h[0],l=h[1],E=nt(),m=nt();R==null&&(R=0,o.replaceState(Q({},o.state,{idx:R}),""));function x(d){return typeof d=="string"?d:z(d)}function S(d,f){return f===void 0&&(f=null),et(Q({pathname:l.pathname,hash:"",search:""},typeof d=="string"?ct(d):d,{state:f,key:Rt()}))}function L(d,f){return[{usr:d.state,key:d.key,idx:f},x(d)]}function H(d,f,p){return!m.length||(m.call({action:d,location:f,retry:p}),!1)}function _(d){u=d;var f=a();R=f[0],l=f[1],E.call({action:u,location:l})}function g(d,f){var p=$.Push,P=S(d,f);function b(){g(d,f)}if(H(p,P,b)){var B=L(P,R+1),N=B[0],C=B[1];try{o.pushState(N,"",C)}catch{r.location.assign(C)}_(p)}}function w(d,f){var p=$.Replace,P=S(d,f);function b(){w(d,f)}if(H(p,P,b)){var B=L(P,R),N=B[0],C=B[1];o.replaceState(N,"",C),_(p)}}function A(d){o.go(d)}var k={get action(){return u},get location(){return l},createHref:x,push:g,replace:w,go:A,back:function(){A(-1)},forward:function(){A(1)},listen:function(f){return E.push(f)},block:function(f){var p=m.push(f);return m.length===1&&r.addEventListener(mt,dt),function(){p(),m.length||r.removeEventListener(mt,dt)}}};return k}function on(t){t===void 0&&(t={});var e=t,n=e.window,r=n===void 0?document.defaultView:n,o=r.history;function a(){var f=ct(r.location.hash.substr(1)),p=f.pathname,P=p===void 0?"/":p,b=f.search,B=b===void 0?"":b,N=f.hash,C=N===void 0?"":N,V=o.state||{};return[V.idx,et({pathname:P,search:B,hash:C,state:V.usr||null,key:V.key||"default"})]}var c=null;function s(){if(c)m.call(c),c=null;else{var f=$.Pop,p=a(),P=p[0],b=p[1];if(m.length)if(P!=null){var B=R-P;B&&(c={action:f,location:b,retry:function(){k(B*-1)}},k(B))}else process.env.NODE_ENV!=="production"&&K(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.");else g(f)}}r.addEventListener(re,s),r.addEventListener(rn,function(){var f=a(),p=f[1];z(p)!==z(l)&&s()});var u=$.Pop,h=a(),R=h[0],l=h[1],E=nt(),m=nt();R==null&&(R=0,o.replaceState(Q({},o.state,{idx:R}),""));function x(){var f=document.querySelector("base"),p="";if(f&&f.getAttribute("href")){var P=r.location.href,b=P.indexOf("#");p=b===-1?P:P.slice(0,b)}return p}function S(f){return x()+"#"+(typeof f=="string"?f:z(f))}function L(f,p){return p===void 0&&(p=null),et(Q({pathname:l.pathname,hash:"",search:""},typeof f=="string"?ct(f):f,{state:p,key:Rt()}))}function H(f,p){return[{usr:f.state,key:f.key,idx:p},S(f)]}function _(f,p,P){return!m.length||(m.call({action:f,location:p,retry:P}),!1)}function g(f){u=f;var p=a();R=p[0],l=p[1],E.call({action:u,location:l})}function w(f,p){var P=$.Push,b=L(f,p);function B(){w(f,p)}if(process.env.NODE_ENV!=="production"&&K(b.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.push("+JSON.stringify(f)+")"),_(P,b,B)){var N=H(b,R+1),C=N[0],V=N[1];try{o.pushState(C,"",V)}catch{r.location.assign(V)}g(P)}}function A(f,p){var P=$.Replace,b=L(f,p);function B(){A(f,p)}if(process.env.NODE_ENV!=="production"&&K(b.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.replace("+JSON.stringify(f)+")"),_(P,b,B)){var N=H(b,R),C=N[0],V=N[1];o.replaceState(C,"",V),g(P)}}function k(f){o.go(f)}var d={get action(){return u},get location(){return l},createHref:S,push:w,replace:A,go:k,back:function(){k(-1)},forward:function(){k(1)},listen:function(p){return E.push(p)},block:function(p){var P=m.push(p);return m.length===1&&r.addEventListener(mt,dt),function(){P(),m.length||r.removeEventListener(mt,dt)}}};return d}function ae(t){t===void 0&&(t={});var e=t,n=e.initialEntries,r=n===void 0?["/"]:n,o=e.initialIndex,a=r.map(function(g){var w=et(Q({pathname:"/",search:"",hash:"",state:null,key:Rt()},typeof g=="string"?ct(g):g));return process.env.NODE_ENV!=="production"&&K(w.pathname.charAt(0)==="/","Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(g)+")"),w}),c=ce(o??a.length-1,0,a.length-1),s=$.Pop,u=a[c],h=nt(),R=nt();function l(g){return typeof g=="string"?g:z(g)}function E(g,w){return w===void 0&&(w=null),et(Q({pathname:u.pathname,search:"",hash:""},typeof g=="string"?ct(g):g,{state:w,key:Rt()}))}function m(g,w,A){return!R.length||(R.call({action:g,location:w,retry:A}),!1)}function x(g,w){s=g,u=w,h.call({action:s,location:u})}function S(g,w){var A=$.Push,k=E(g,w);function d(){S(g,w)}process.env.NODE_ENV!=="production"&&K(u.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.push("+JSON.stringify(g)+")"),m(A,k,d)&&(c+=1,a.splice(c,a.length,k),x(A,k))}function L(g,w){var A=$.Replace,k=E(g,w);function d(){L(g,w)}process.env.NODE_ENV!=="production"&&K(u.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.replace("+JSON.stringify(g)+")"),m(A,k,d)&&(a[c]=k,x(A,k))}function H(g){var w=ce(c+g,0,a.length-1),A=$.Pop,k=a[w];function d(){H(g)}m(A,k,d)&&(c=w,x(A,k))}var _={get index(){return c},get action(){return s},get location(){return u},createHref:l,push:S,replace:L,go:H,back:function(){H(-1)},forward:function(){H(1)},listen:function(w){return h.push(w)},block:function(w){return R.push(w)}};return _}function ce(t,e,n){return Math.min(Math.max(t,e),n)}function dt(t){t.preventDefault(),t.returnValue=""}function nt(){var t=[];return{get length(){return t.length},push:function(n){return t.push(n),function(){t=t.filter(function(r){return r!==n})}},call:function(n){t.forEach(function(r){return r&&r(n)})}}}function Rt(){return Math.random().toString(36).substr(2,8)}function z(t){var e=t.pathname,n=e===void 0?"/":e,r=t.search,o=r===void 0?"":r,a=t.hash,c=a===void 0?"":a;return o&&o!=="?"&&(n+=o.charAt(0)==="?"?o:"?"+o),c&&c!=="#"&&(n+=c.charAt(0)==="#"?c:"#"+c),n}function ct(t){var e={};if(t){var n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));var r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}const At=Symbol();function se(){const t=i.inject(At);if(!t)throw new it;return t}const ue=Symbol("isRouterRouteSymbol");function an(t){return typeof t=="object"&&t!==null&&ue in t}function cn(t,e){function n(l,E,m){if(typeof l=="object"){const S={...t.params,...l};return e(t.name,S,E)}const x={...t.params,[l]:E};return e(t.name,x,m)}const{matched:r,matches:o,name:a,query:c,params:s,state:u,hash:h}=i.toRefs(t),R=i.reactive({matched:r,matches:o,state:u,query:c,hash:h,params:s,name:a,update:n,[ue]:!0});return new Proxy(R,{get:(l,E,m)=>E==="params"?new Proxy(t.params,{set(x,S,L){return n(S,L),!0}}):E==="state"?new Proxy(t.state,{set(x,S,L){return n({},{state:{...t.state,[S]:L}}),!0}}):Reflect.get(l,E,m)})}const ie=Symbol();function sn(t,e){const n=i.reactive({...t}),r=c=>{Object.assign(n,{[ie]:!1,...c})},o=n,a=cn(o,e);return{currentRoute:o,routerRoute:a,updateRoute:r}}function Y(t){return!t.startsWith("http")?fn(t):un(t)}function un(t){const{protocol:e,host:n,pathname:r,search:o,searchParams:a,hash:c}=new URL(t,t);return{protocol:e,host:n,pathname:r,search:o,searchParams:a,hash:c}}function fn(t){const{pathname:e,search:n,searchParams:r,hash:o}=new URL(t,"https://localhost");return{pathname:e,search:n,searchParams:r,hash:o}}function ln(t){return e=>{const{host:n}=Y(e);return!(n===void 0||n===t)}}function hn({mode:t,listener:e}){const n=pn(t),r=(u,h)=>{if(h!=null&&h.replace)return n.replace(u,h.state);n.push(u,h==null?void 0:h.state)},o=()=>{const u=z(n.location);return n.replace(u)};let a;return{...n,update:r,refresh:o,startListening:()=>{a==null||a(),a=n.listen(e)},stopListening:()=>{a==null||a()}}}function pn(t="auto"){switch(t){case"auto":return Kt()?oe():ae();case"browser":return oe();case"memory":return ae();case"hash":return on();default:const e=t;throw new Error(`Switch is not exhaustive for mode: ${e}`)}}class gt{constructor(){O(this,"onBeforeRouteEnter",new Set);O(this,"onBeforeRouteUpdate",new Set);O(this,"onBeforeRouteLeave",new Set);O(this,"onAfterRouteEnter",new Set);O(this,"onAfterRouteUpdate",new Set);O(this,"onAfterRouteLeave",new Set)}}class fe extends Error{}class st extends Error{constructor(n){super("Error occurred during a router push operation.");O(this,"to");this.to=n}}class kt extends Error{constructor(n){super(`Routing action rejected: ${n}`);O(this,"type");this.type=n}}function mn(t,e){const n=new gt;return t.matches.forEach((r,o)=>{r.onBeforeRouteEnter&&xt(t,e,o)&&Z(r.onBeforeRouteEnter).forEach(a=>n.onBeforeRouteEnter.add(a)),r.onBeforeRouteUpdate&&Lt(t,e,o)&&Z(r.onBeforeRouteUpdate).forEach(a=>n.onBeforeRouteUpdate.add(a))}),e.matches.forEach((r,o)=>{r.onBeforeRouteLeave&&Bt(t,e,o)&&Z(r.onBeforeRouteLeave).forEach(a=>n.onBeforeRouteLeave.add(a))}),n}function dn(t,e){const n=new gt;return t.matches.forEach((r,o)=>{r.onAfterRouteEnter&&xt(t,e,o)&&Z(r.onAfterRouteEnter).forEach(a=>n.onAfterRouteEnter.add(a)),r.onAfterRouteUpdate&&Lt(t,e,o)&&Z(r.onAfterRouteUpdate).forEach(a=>n.onAfterRouteUpdate.add(a))}),e.matches.forEach((r,o)=>{r.onAfterRouteLeave&&Bt(t,e,o)&&Z(r.onAfterRouteLeave).forEach(a=>n.onAfterRouteLeave.add(a))}),n}function T(t){return typeof t!="string"?!1:/^(https?:\/\/|\/).*/g.test(t)}function Rn(){const t=c=>{throw new kt(c)},e=(...c)=>{throw new st(c)},n=(c,s,u)=>{if(T(c)){const l=s??{};throw new st([c,{...l,replace:!0}])}const h=s,R=u??{};throw new st([c,h,{...R,replace:!0}])},r=()=>{throw new fe};async function o({to:c,from:s,hooks:u}){const{global:h,component:R}=u,l=mn(c,s),E=[...h.onBeforeRouteEnter,...l.onBeforeRouteEnter,...h.onBeforeRouteUpdate,...l.onBeforeRouteUpdate,...R.onBeforeRouteUpdate,...h.onBeforeRouteLeave,...l.onBeforeRouteLeave,...R.onBeforeRouteLeave];try{const m=E.map(x=>x(c,{from:s,reject:t,push:e,replace:n,abort:r}));await Promise.all(m)}catch(m){if(m instanceof st)return{status:"PUSH",to:m.to};if(m instanceof kt)return{status:"REJECT",type:m.type};if(m instanceof fe)return{status:"ABORT"};throw m}return{status:"SUCCESS"}}async function a({to:c,from:s,hooks:u}){const{global:h,component:R}=u,l=dn(c,s),E=[...R.onAfterRouteLeave,...l.onAfterRouteLeave,...h.onAfterRouteLeave,...R.onAfterRouteUpdate,...l.onAfterRouteUpdate,...h.onAfterRouteUpdate,...R.onAfterRouteEnter,...l.onAfterRouteEnter,...h.onAfterRouteEnter];try{const m=E.map(x=>x(c,{from:s,reject:t,push:e,replace:n}));await Promise.all(m)}catch(m){if(m instanceof st)return{status:"PUSH",to:m.to};if(m instanceof kt)return{status:"REJECT",type:m.type};throw m}return{status:"SUCCESS"}}return{runBeforeRouteHooks:o,runAfterRouteHooks:a}}const xt=(t,e,n)=>{const r=t.matches,o=(e==null?void 0:e.matches)??[];return r.length<n||r[n]!==o[n]},Bt=(t,e,n)=>{const r=t.matches,o=(e==null?void 0:e.matches)??[];return r.length<n||r[n]!==o[n]},Lt=(t,e,n)=>t.matches[n]===(e==null?void 0:e.matches[n]);function le(t){switch(t){case"onBeforeRouteEnter":case"onAfterRouteEnter":return xt;case"onBeforeRouteUpdate":case"onAfterRouteUpdate":return Lt;case"onBeforeRouteLeave":case"onAfterRouteLeave":return Bt;default:throw new Error(`Switch is not exhaustive for lifecycle: ${t}`)}}class gn{constructor(){O(this,"global",new gt);O(this,"component",new gt)}addBeforeRouteHook({lifecycle:e,timing:n,depth:r,hook:o}){const a=le(e),c=this[n][e],s=(u,h)=>{if(a(u,h.from,r))return o(u,h)};return c.add(s),()=>c.delete(s)}addAfterRouteHook({lifecycle:e,timing:n,depth:r,hook:o}){const a=le(e),c=this[n][e],s=(u,h)=>{if(a(u,h.from,r))return o(u,h)};return c.add(s),()=>c.delete(s)}}const he=Symbol();function yn(){const t=new gn;return{onBeforeRouteEnter:s=>t.addBeforeRouteHook({lifecycle:"onBeforeRouteEnter",hook:s,timing:"global",depth:0}),onBeforeRouteUpdate:s=>t.addBeforeRouteHook({lifecycle:"onBeforeRouteUpdate",hook:s,timing:"global",depth:0}),onBeforeRouteLeave:s=>t.addBeforeRouteHook({lifecycle:"onBeforeRouteLeave",hook:s,timing:"global",depth:0}),onAfterRouteEnter:s=>t.addAfterRouteHook({lifecycle:"onAfterRouteEnter",hook:s,timing:"global",depth:0}),onAfterRouteUpdate:s=>t.addAfterRouteHook({lifecycle:"onAfterRouteUpdate",hook:s,timing:"global",depth:0}),onAfterRouteLeave:s=>t.addAfterRouteHook({lifecycle:"onAfterRouteLeave",hook:s,timing:"global",depth:0}),hooks:t}}function wn(t){return i.defineComponent(()=>()=>i.h("h1",t),{name:t,props:[]})}function pe(t){const e=new URLSearchParams(t);return{get:n=>e.get(n),getAll:n=>e.getAll(n)}}function vn({rejections:t}){const e=a=>{const c={...t};return i.markRaw(c[a]??wn(a))},n=a=>{const c=i.markRaw(e(a)),s={name:a,component:c,meta:{},state:{}};return{matched:s,matches:[s],name:a,query:pe(""),params:{},state:{},[ie]:!0}},r=a=>{if(!a){o.value=null;return}const c=e(a);o.value={type:a,component:c}},o=i.ref(null);return{setRejection:r,rejection:o,getRejectionRoute:n}}class En extends Error{constructor(e){super(`Route not found: "${e}"`)}}function Ut(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Pn(t,e){const n=Array.from(t.matchAll(e));if(n.length===0)return[t];let r=0;const o=n.reduce((c,s)=>{const u=Ut(t.slice(r,s.index));u.length&&c.push(u);const[h]=s;return c.push(h),r=s.index+h.length,c},[]),a=t.slice(r);return a&&o.push(a),o}function bn(t){const e=me(t.path.toString());return new RegExp(`^${e}$`,"i")}function Sn(t){const e=new URLSearchParams(t.query.toString());return Array.from(e.entries()).filter(([,n])=>!$t(n)).map(([n,r])=>{const o=me(r);return new RegExp(`${Ut(n)}=${o}(&|$)`,"i")})}function me(t){return Pn(t,new RegExp(An,"g")).map(e=>e.startsWith(W)?de(e):Ut(e)).join("")}function de(t){return[kn,xn].reduce((e,n)=>n(e),t)}const An=`\\${W}\\??([\\w-_]+)\\${J}`,Nt=`\\${W}\\?([\\w-_]+)\\${J}`,Re=`\\${W}([\\w-_]+)\\${J}`;function kn(t){return t.replace(new RegExp(Nt,"g"),".*")}function $t(t){return new RegExp(Nt,"g").test(t)}function xn(t){return t.replace(new RegExp(Re,"g"),".+")}function yt(t){const[e]=wt(t,new RegExp(Nt,"g")),[n]=wt(t,new RegExp(Re,"g"));return e??n}function wt(t,e){return Array.from(t.matchAll(e)).flatMap(([,...r])=>r.map(o=>ht(o)?o:""))}function ge(t,e,n){const r=we(e,n),[o]=wt(t,r);return o}function ye(t,e){if(!e)return t;const{name:n,param:r,value:o}=e,a=we(t,n);return wt(t,a).reduce((s,u)=>u===void 0?s:s.replace(u,()=>at(o,r,n.startsWith("?"))),t)}function we(t,e){const n=[Bn,Ln,de].reduce((r,o)=>o(r,e),t);return new RegExp(n,"g")}function Bn(t,e){if(!e.startsWith("?"))return t;const n=new RegExp(`\\${W}\\${e}\\${J}`,"g");return t.replace(n,"(.*)")}function Ln(t,e){if(e.startsWith("?"))return t;const n=new RegExp(`\\${W}${e}\\${J}`,"g");return t.replace(n,"(.+)")}function ve(t,...e){return e.reduce((n,r)=>{if(!r)return n;const o=new URLSearchParams(r).toString();return Object.keys(o).length===0?n:n.includes("?")?`${n}&${o}`:`${n}?${o}`},t)}function Un(t,e={}){const{params:n={},query:r}=e,o=Nn(t.host,n),a=$n(t.path,n),c=Cn(t.query,n),s=ve(`${o}${a}`,c,r),u=e.hash?`#${e.hash.replace(/^#/,"")}`:"";return`${s}${u}`}function Nn(t,e){const n=t.toString();return Object.entries(t.params).reduce((r,[o,a])=>{const c=yt(`${W}${o}${J}`);return c?ye(r,{name:o,param:a,value:e[c]}):r},n)}function $n(t,e){const n=t.toString();return Object.entries(t.params).reduce((r,[o,a])=>{const c=yt(`${W}${o}${J}`);return c?ye(r,{name:o,param:a,value:e[c]}):r},n)}function Cn(t,e){const n=t.toString();if(!n)return{};const r=new URLSearchParams(n);return Array.from(r.entries()).reduce((o,[a,c])=>{const s=yt(c);if(!s)return{...o,[a]:c};const h=at(e[s],t.params[s],$t(c)),R=e[s]===void 0&&h==="";return $t(c)&&R?o:{...o,[a]:h}},{})}function jn(t){return(e,n,r)=>{if(T(e))return ve(e,(n??{}).query);const o=n??{},a=r??{},c=t.find(u=>u.name===e);if(!c)throw new En(String(e));return Un(c,{params:o,query:a.query,hash:a.hash})}}class Hn extends Error{constructor(){super("initialUrl must be set if window.location is unavailable")}}function Vn(t){if(t)return t;if(Kt())return window.location.toString();throw new Hn}const On=(t,e)=>{try{Ee(t,e)}catch{return!1}return!0},Ee=(t,e)=>{const{pathname:n,search:r}=Y(e);return{..._n(t.path,n),...qn(t.query,r)}};function _n(t,e){const n={},r=decodeURIComponent(e);for(const[o,a]of Object.entries(t.params)){const c=o.startsWith("?"),s=c?o.slice(1):o,u=ge(r,t.toString(),o),h=ot(u,a,c);n[s]=h}return n}function qn(t,e){const n={},r=new URLSearchParams(e);for(const[o,a]of Object.entries(t.params)){const c=o.startsWith("?"),s=c?o.slice(1):o,u=r.get(s)??void 0,h=ot(u,a,c);n[s]=h}return n}const Dn=t=>"name"in t.matched&&!!t.matched.name,Wn=(t,e)=>{const{pathname:n}=Y(e);return bn(t).test(n)},Tn=(t,e)=>{const{search:n}=Y(e);return Sn(t).every(o=>o.test(n))};function Mn(t){const{searchParams:e,pathname:n}=Y(t),r=-1,o=1;return(a,c)=>{const s=be(a,e),u=Pe(a,n),h=be(c,e),R=Pe(c,n);return a.depth>c.depth?r:a.depth<c.depth?o:s+u>h+R?r:s+u<h+R?o:0}}function Pe(t,e){const n=Object.keys(t.path.params).filter(o=>o.startsWith("?")).map(o=>o),r=n.filter(o=>ge(e,t.path.toString(),o)===void 0);return n.length-r.length}function be(t,e){const n=new URLSearchParams(t.query.toString()),r=Array.from(n.keys()),o=r.filter(a=>!e.has(a));return r.length-o.length}function Se(t){return!!t&&typeof t=="object"}const vt=!0;function In(t,e,n){if(Se(t)&&e in t){const r=t[e];if(typeof r=="string")return ot(r,n,vt)}return ot(void 0,n,vt)}function Fn(t,e){const n={};for(const[r,o]of Object.entries(t)){const a=In(e,r,o);n[r]=a}return n}function Jn(t,e,n){if(Se(t)&&e in t){const r=t[e];return at(r,n,vt)}return at(void 0,n,vt)}const Ae=(t,e)=>{const n={};for(const[r,o]of Object.entries(t)){const a=Jn(e,r,o);n[r]=a}return n},Qn=[Dn,Wn,Tn,On];function Ct(t,e,n){const r=Mn(e),o=t.filter(u=>Qn.every(h=>h(u,e))).sort(r);if(o.length===0)return;const[a]=o,{search:c,hash:s}=Y(e);return{matched:a.matched,matches:a.matches,name:a.name,query:pe(c),params:Ee(a,e),state:Fn(a.state,n),hash:s}}function jt(t,e){const n=new RegExp(`\\${W}(\\??[\\w-_]+)\\${J}`,"g");return Array.from(t.matchAll(n)).reduce((o,[a,c])=>{const s=yt(a);if(!s)return o;const u=en(e,s);return tt([s],o),o[c]=u,o},{})}function ke(t,e){return{host:t,params:jt(t,e),toString:()=>t}}function Ht(t){return t===void 0?"":t}function Vt(t,e){return{path:t,params:jt(t,e),toString:()=>t}}function Gn(t){return lt(t)&&typeof t.path=="string"}function xe(t){return t===void 0?Vt("",{}):Gn(t)?t:Vt(t,{})}function Ot(t,e){return{query:t,params:jt(t,e),toString:()=>t}}function Kn(t){return lt(t)&&typeof t.query=="string"}function Be(t){return t===void 0?Ot("",{}):Kn(t)?t:Ot(t,{})}function M(t){const e=Ht(t.name),n=xe(t.path),r=Be(t.query),o=t.meta??{},a=ze(t)?t.state:{},c=i.markRaw({meta:{},state:{},...t}),s={matched:c,matches:[c],name:e,path:n,query:r,meta:o,state:a,depth:1,host:ke("",{}),prefetch:t.prefetch},u=Qt(t)?Gt(t.parent,s):s;return tt(u.path.params,u.query.params),u}function zn(t,e){if(!ht(e))return t;const n=M({path:e});return t.map(r=>M({parent:n,...r}))}class Yn extends Error{constructor(e){super(`Invalid Name "${e}": Router does not support multiple routes with the same name. All name names must be unique.`)}}function Xn(t){const e=t.map(({name:n})=>n);for(const n of e)if(Jt(e,n)>1)throw new Yn(n)}function Zn(t,e){const n=Je(t)?t.flat():t,r=zn(n,e==null?void 0:e.base);Xn(r);const o=jn(r),a=hn({mode:e==null?void 0:e.historyMode,listener:({location:v})=>{const U=z(v);S(U,{state:v.state})}}),{runBeforeRouteHooks:c,runAfterRouteHooks:s}=Rn(),{hooks:u,onBeforeRouteEnter:h,onAfterRouteUpdate:R,onBeforeRouteLeave:l,onAfterRouteEnter:E,onBeforeRouteUpdate:m,onAfterRouteLeave:x}=yn();async function S(v,U={}){if(a.stopListening(),C(v))return a.update(v,U);const q=Ct(r,v,U.state)??k("NotFound"),D={...f},rt=await c({to:q,from:D,hooks:u});switch(rt.status){case"ABORT":return;case"PUSH":a.update(v,U),await L(...rt.to);return;case"REJECT":a.update(v,U),w(rt.type),P(q);break;case"SUCCESS":a.update(v,U),w(null),P(q);break;default:throw new Error(`Switch is not exhaustive for before hook response status: ${JSON.stringify(rt)}`)}const G=await s({to:q,from:D,hooks:u});switch(G.status){case"PUSH":await L(...G.to);break;case"REJECT":w(G.type);break;case"SUCCESS":break;default:const I=G;throw new Error(`Switch is not exhaustive for after hook response status: ${JSON.stringify(I)}`)}a.startListening()}const L=(v,U,q)=>{if(T(v)){const ut={...U},It=o(v,ut);return S(It,ut)}const D={...q},G=o(v,U??{},D),I=Tt(v),Mt=Ae((I==null?void 0:I.state)??{},D.state);return S(G,{...D,state:Mt})},H=(v,U,q)=>{if(T(v)){const ut={...U,replace:!0},It=o(v,ut);return S(It,ut)}const D={...q,replace:!0},G=o(v,U??{},D),I=Tt(v),Mt=Ae((I==null?void 0:I.state)??{},D.state);return S(G,{...D,state:Mt})},_=v=>w(v),g=(v,U={})=>{if(!T(v)){const q=o(v,U);return Ct(r,q)}if(!C(v))return Ct(r,v)},{setRejection:w,rejection:A,getRejectionRoute:k}=vn(e??{}),d=k("NotFound"),{currentRoute:f,routerRoute:p,updateRoute:P}=sn(d,L);a.startListening();const b=Vn(e==null?void 0:e.initialUrl),B=a.location.state,{host:N}=Y(b),C=ln(N),V=S(b,{replace:!0,state:B});function Tt(v){return r.find(U=>U.name===v)}function mr(v){v.component("RouterView",_e),v.component("RouterLink",Oe),v.provide(At,A),v.provide(he,u),v.provide(Pt,De)}const De={route:p,resolve:o,push:L,replace:H,reject:_,find:g,refresh:a.refresh,forward:a.forward,back:a.back,go:a.go,install:mr,initialized:V,isExternal:C,onBeforeRouteEnter:h,onAfterRouteUpdate:R,onBeforeRouteLeave:l,onAfterRouteEnter:E,onBeforeRouteUpdate:m,onAfterRouteLeave:x,prefetch:e==null?void 0:e.prefetch};return De}const Et={template:"<div>This is component</div>"},_t=M({name:"parentA",path:"/parentA/[paramA]"}),Le=M({parent:_t,name:"parentA.childA",path:"/[?paramB]"}),tr=M({parent:_t,name:"parentA.childB",path:"/[paramD]",component:Et}),er=M({parent:Le,name:"parentA.childA.grandChildA",path:"/[paramC]",component:Et});M({name:"parentB",path:"/parentB",component:Et}),M({name:"parentC",path:"/",component:Et});const nr={components:!0};function rr({routerPrefetch:t,routePrefetch:e,linkPrefetch:n},r){return qt(n,r)??qt(e,r)??qt(t,r)??nr[r]}function qt(t,e){return lt(t)?t[e]:t}const or=i.defineAsyncComponent(()=>new Promise(t=>{t({default:{template:""}})}));function Ue(t){return t.name===or.name&&"setup"in t}function Ne(t,e={},n={}){const r=ft(),o=i.toRef(t),a=i.computed(()=>T(o.value)?{}:i.toValue(e)),c=i.computed(()=>T(o.value)?i.toValue(e):i.toValue(n)),s=i.computed(()=>{if(T(o.value))return o.value;try{return r.resolve(o.value,a.value,c.value)}catch(l){throw l instanceof X&&console.error(`Failed to resolve route "${o.value.toString()}" in RouterLink.`,l),l}}),u=i.computed(()=>r.find(s.value,c.value)),h=i.computed(()=>!!u.value&&r.route.matches.includes(u.value.matched)),R=i.computed(()=>!!u.value&&r.route.matched===u.value.matched);return i.watch(u,l=>{if(!l)return;const{prefetch:E}=r,{prefetch:m}=c.value;ar(l,{routerPrefetch:E,linkPrefetch:m})},{immediate:!0}),{route:u,href:s,isMatch:h,isExactMatch:R,push:l=>r.push(s.value,{},{...c.value,...l}),replace:l=>r.replace(s.value,{},{...c.value,...l})}}function ar(t,{routerPrefetch:e,linkPrefetch:n}){t.matches.forEach(r=>{rr({routePrefetch:r.prefetch,routerPrefetch:e,linkPrefetch:n},"components")&&(bt(r)&&Ue(r.component)&&r.component.setup(),St(r)&&Object.values(r.components).forEach(a=>{Ue(a)&&a.setup()}))})}function $e(t,e,{exact:n}={}){if(!an(t))return!1;if(e===void 0)return!0;const r=t.matches.map(o=>Ht(o.name));if(n){const o=r.at(-1);return e===o}return r.includes(e)}function Ce(t,e){const n=ft();function r(){if(!t)return;if(!$e(n.route,t,e))throw new Ft(t,n.route.name)}return i.watch(n.route,r,{immediate:!0,deep:!0}),n.route}const je=Symbol();function Dt(){return i.inject(je,0)}function He(){const t=i.inject(he);if(!t)throw new it;return t}function Ve(t){return e=>{const n=Dt(),o=He().addBeforeRouteHook({lifecycle:t,hook:e,depth:n,timing:"component"});return i.onUnmounted(o),o}}function Wt(t){return e=>{const n=Dt(),o=He().addAfterRouteHook({lifecycle:t,hook:e,depth:n,timing:"component"});return i.onUnmounted(o),o}}const cr=Ve("onBeforeRouteUpdate"),sr=Ve("onBeforeRouteLeave"),ur=Wt("onAfterRouteEnter"),ir=Wt("onAfterRouteUpdate"),fr=Wt("onAfterRouteLeave"),lr=["href"],Oe=i.defineComponent({__name:"routerLink",props:{to:{},prefetch:{type:[Boolean,Object],default:void 0},query:{},hash:{},replace:{type:Boolean},state:{}},setup(t){const e=t,n=ft(),r=i.computed(()=>T(e.to)?e.to:e.to(n.resolve)),o=i.computed(()=>{const{to:l,...E}=e;return E}),{href:a,isMatch:c,isExactMatch:s}=Ne(r,o),u=i.computed(()=>({"router-link--match":c.value,"router-link--exact-match":s.value})),h=i.computed(()=>n.isExternal(r.value));function R(l){l.preventDefault(),n.push(a.value,o.value)}return(l,E)=>(i.openBlock(),i.createElementBlock("a",{href:r.value,class:i.normalizeClass(["router-link",u.value]),onClick:R},[i.renderSlot(l.$slots,"default",i.normalizeProps(i.guardReactiveProps({resolved:r.value,isMatch:i.unref(c),isExactMatch:i.unref(s),isExternal:h.value})))],10,lr))}}),_e=i.defineComponent({__name:"routerView",props:{name:{}},setup(t){const{name:e="default"}=t,n=Ce(),r=se(),o=Dt(),a=i.resolveComponent("RouterView",!0);i.provide(je,o+1);const c=i.computed(()=>{if(r.value)return r.value.component;const l=n.matches.at(o);if(!l)return null;const E=s(l),m=h(l);return E?m?(n.params,zt(E,()=>m(n.params))):E:null});function s(l){return u(l)[e]}function u(l){return St(l)?l.components:bt(l)?{default:l.component}:typeof a=="string"?{}:{default:a}}function h(l){return R(l)[e]}function R(l){return St(l)?l.props??{}:bt(l)?{default:l.props}:{}}return(l,E)=>c.value?i.renderSlot(l.$slots,"default",i.normalizeProps(i.mergeProps({key:0},{route:i.unref(n),component:c.value,rejection:i.unref(r)})),()=>[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(c.value)))]):i.createCommentVNode("",!0)}});function hr(t){return lt(t)&&typeof t.host=="string"}function qe(t){return hr(t)?t:ke(t,{})}function pr(t){const e=Ht(t.name),n=xe(t.path),r=Be(t.query),o=t.meta??{},a=Ke(t)?qe(t.host):qe(""),c=i.markRaw({meta:{},state:{},...t}),s={matched:c,matches:[c],name:e,host:a,path:n,query:r,meta:o,depth:1,state:{}},u=Qt(t)?Gt(t.parent,s):s;return tt(u.path.params,u.query.params,u.host.params),u}y.DuplicateParamsError=F,y.RouterLink=Oe,y.RouterNotInstalledError=it,y.RouterView=_e,y.UseRouteInvalidError=Ft,y.component=zt,y.createExternalRoute=pr,y.createParam=ne,y.createRoute=M,y.createRouter=Zn,y.isParamWithDefault=Yt,y.isRoute=$e,y.onAfterRouteEnter=ur,y.onAfterRouteLeave=ir,y.onAfterRouteUpdate=fr,y.onBeforeRouteLeave=cr,y.onBeforeRouteUpdate=sr,y.path=Vt,y.query=Ot,y.routerInjectionKey=Pt,y.routerRejectionKey=At,y.useLink=Ne,y.useRejection=se,y.useRoute=Ce,y.useRouter=ft,y.withDefault=tn,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kitbag/router",
3
3
  "private": false,
4
- "version": "0.8.1",
4
+ "version": "0.9.0",
5
5
  "bugs": {
6
6
  "url": "https://github.com/kitbagjs/router/issues"
7
7
  },