@kitbag/router 0.20.0 → 0.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,5 @@
1
1
  import { App } from 'vue';
2
2
  import { AsyncComponentLoader } from 'vue';
3
- import { BaseIssue } from 'valibot';
4
- import { BaseSchema } from 'valibot';
5
3
  import { Component } from 'vue';
6
4
  import { ComponentOptionsMixin } from 'vue';
7
5
  import { ComponentProvideOptions } from 'vue';
@@ -11,10 +9,8 @@ import { FunctionalComponent } from 'vue';
11
9
  import { MaybeRefOrGetter } from 'vue';
12
10
  import { PublicProps } from 'vue';
13
11
  import { Ref } from 'vue';
14
- import { UnionOptions } from 'valibot';
15
- import { UnionSchema } from 'valibot';
12
+ import { StandardSchemaV1 } from '@standard-schema/spec';
16
13
  import { UnwrapRef } from 'vue';
17
- import { VariantSchema } from 'valibot';
18
14
  import { VNode } from 'vue';
19
15
 
20
16
  declare const __VLS_component: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
@@ -384,7 +380,7 @@ declare type ExtractParamName<TParam extends PropertyKey> = TParam extends strin
384
380
  * @template TParam - The parameter type.
385
381
  * @returns The extracted type, or 'string' as a fallback.
386
382
  */
387
- declare type ExtractParamType<TParam extends Param> = TParam extends ParamGetSet<infer Type> ? Type : TParam extends ParamGetter ? ReturnType<TParam> : TParam extends ZodSchemaLike<infer Type> ? Type : TParam extends LiteralParam ? TParam : string;
383
+ declare type ExtractParamType<TParam extends Param> = TParam extends ParamGetSet<infer Type> ? Type : TParam extends ParamGetter ? ReturnType<TParam> : TParam extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<TParam> : TParam extends LiteralParam ? TParam : string;
388
384
 
389
385
  declare type ExtractParamTypes<TParams extends Record<string, Param>> = Identity<MakeOptional<{
390
386
  [K in keyof TParams as ExtractParamName<K>]: ExtractParamType<TParams[K]>;
@@ -1350,7 +1346,9 @@ export declare class UseRouteInvalidError extends Error {
1350
1346
  */
1351
1347
  export declare function useRouter(): RegisteredRouter;
1352
1348
 
1353
- declare type ValibotSchemaLike = BaseSchema<unknown, unknown, BaseIssue<unknown>> | UnionSchema<UnionOptions, any> | VariantSchema<any, any, any>;
1349
+ declare interface ValibotSchemaLike extends StandardSchemaV1<any> {
1350
+ type: string;
1351
+ }
1354
1352
 
1355
1353
  export declare function withDefault<TParam extends Param>(param: TParam, defaultValue: ExtractParamType<TParam>): ParamWithDefault<TParam>;
1356
1354
 
@@ -1402,9 +1400,9 @@ declare type WithParent<TParent extends Route = Route> = {
1402
1400
  parent: TParent;
1403
1401
  };
1404
1402
 
1405
- declare type ZodSchemaLike<TOutput = any> = {
1406
- parse: (input: any) => TOutput;
1407
- };
1403
+ declare interface ZodSchemaLike extends StandardSchemaV1<any> {
1404
+ parse: (input: any) => any;
1405
+ }
1408
1406
 
1409
1407
  export { }
1410
1408
 
@@ -1,7 +1,7 @@
1
1
  var Cr = Object.defineProperty;
2
2
  var Vr = (t, e, r) => e in t ? Cr(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
3
  var T = (t, e, r) => Vr(t, typeof e != "symbol" ? e + "" : e, r);
4
- import { inject as st, markRaw as Nt, reactive as Ht, defineAsyncComponent as Zr, watch as rt, onUnmounted as _t, computed as O, ref as qt, toValue as H, toRefs as Or, defineComponent as Rt, createElementBlock as jr, openBlock as Ze, normalizeClass as $r, renderSlot as Oe, normalizeProps as je, guardReactiveProps as Hr, unref as vt, h as pt, getCurrentInstance as _r, provide as qr, createCommentVNode as Ir, mergeProps as Jr, createBlock as Dr, resolveDynamicComponent as Fr } from "vue";
4
+ import { inject as st, markRaw as Lt, reactive as Ht, defineAsyncComponent as Zr, watch as rt, onUnmounted as _t, computed as O, ref as qt, toValue as H, toRefs as Or, defineComponent as wt, createElementBlock as jr, openBlock as Ze, normalizeClass as $r, renderSlot as Oe, normalizeProps as je, guardReactiveProps as Hr, unref as bt, h as pt, getCurrentInstance as _r, provide as qr, createCommentVNode as Ir, mergeProps as Jr, createBlock as Dr, resolveDynamicComponent as Fr } from "vue";
5
5
  function M(t) {
6
6
  return typeof t != "string" ? !1 : /^(https?:\/\/|\/).*/g.test(t);
7
7
  }
@@ -22,7 +22,7 @@ class Mr extends Error {
22
22
  super(`Child property on meta for ${e} conflicts with the parent meta.`);
23
23
  }
24
24
  }
25
- class wt extends Error {
25
+ class Et extends Error {
26
26
  constructor() {
27
27
  super("Router not installed");
28
28
  }
@@ -42,7 +42,7 @@ const He = Symbol();
42
42
  function ee() {
43
43
  const t = st(He);
44
44
  if (!t)
45
- throw new wt();
45
+ throw new Et();
46
46
  return t;
47
47
  }
48
48
  function dt(t) {
@@ -51,7 +51,7 @@ function dt(t) {
51
51
  function _e(t, e) {
52
52
  return t.filter((r) => e === r).length;
53
53
  }
54
- function Et(...t) {
54
+ function vt(...t) {
55
55
  const e = t.flatMap((r) => Array.isArray(r) ? r : Object.keys(r));
56
56
  for (const r of e)
57
57
  if (_e(e, r) > 1)
@@ -59,7 +59,7 @@ function Et(...t) {
59
59
  }
60
60
  class z extends Error {
61
61
  }
62
- const St = "[", It = "]";
62
+ const Pt = "[", It = "]";
63
63
  function Gr(t) {
64
64
  return t !== String && t !== Boolean && t !== Number && t !== Date;
65
65
  }
@@ -85,7 +85,7 @@ function Kr(t) {
85
85
  function jo(t, e) {
86
86
  return Qr(t, e);
87
87
  }
88
- function Lt(t) {
88
+ function yt(t) {
89
89
  return typeof t == "object" && t !== null && !Array.isArray(t);
90
90
  }
91
91
  function W(t) {
@@ -140,7 +140,7 @@ function Xr(t) {
140
140
  return Object.values(t).some((e) => Object.values(e.host.params).some((r) => Wt(r)) || Object.values(e.path.params).some((r) => Wt(r)) || Object.values(e.query.params).some((r) => Wt(r)));
141
141
  }
142
142
  function Wt(t) {
143
- return typeof t == "object" && "parse" in t && typeof t.parse == "function";
143
+ return yt(t) && "parse" in t && typeof t.parse == "function" && "~standard" in t && yt(t["~standard"]) && "vendor" in t["~standard"] && t["~standard"].vendor === "zod";
144
144
  }
145
145
  async function tn() {
146
146
  try {
@@ -299,7 +299,7 @@ function L(t, e) {
299
299
  return r.value;
300
300
  }
301
301
  function rn(t) {
302
- return Lt(t) && "type" in t && typeof t.type == "string" && "~standard" in t && Lt(t["~standard"]) && "vendor" in t["~standard"] && t["~standard"].vendor === "valibot";
302
+ return yt(t) && "type" in t && typeof t.type == "string" && "~standard" in t && yt(t["~standard"]) && "vendor" in t["~standard"] && t["~standard"].vendor === "valibot";
303
303
  }
304
304
  function De(t) {
305
305
  return rn(t);
@@ -618,7 +618,7 @@ function ln(t) {
618
618
  });
619
619
  }
620
620
  function Ge(t) {
621
- return un(t, new RegExp(Dt, "g")).map((e) => e.startsWith(St) ? ze(e) : ae(e)).join("");
621
+ return un(t, new RegExp(Dt, "g")).map((e) => e.startsWith(Pt) ? ze(e) : ae(e)).join("");
622
622
  }
623
623
  function ze(t) {
624
624
  return t.replace(new RegExp(Dt, "g"), ".+");
@@ -633,16 +633,16 @@ function se(t, e) {
633
633
  function ie(t) {
634
634
  return new RegExp(dn, "g").test(t);
635
635
  }
636
- const Dt = `\\${St}\\??([\\w-_]+)\\${It}`, dn = `\\${St}\\?([\\w-_]+)\\${It}`;
636
+ const Dt = `\\${Pt}\\??([\\w-_]+)\\${It}`, dn = `\\${Pt}\\?([\\w-_]+)\\${It}`;
637
637
  function ce(t) {
638
638
  const [e] = Ke(t, new RegExp(Dt, "g"));
639
639
  return e;
640
640
  }
641
641
  function Qe(t) {
642
- return new RegExp(`\\${St}\\??${t}\\${It}`, "g");
642
+ return new RegExp(`\\${Pt}\\??${t}\\${It}`, "g");
643
643
  }
644
644
  function hn(t) {
645
- return new RegExp(`\\${St}\\?${t}\\${It}`, "g");
645
+ return new RegExp(`\\${Pt}\\?${t}\\${It}`, "g");
646
646
  }
647
647
  function Ke(t, e) {
648
648
  return Array.from(t.matchAll(e)).flatMap(([, ...n]) => n.map((o) => W(o) ? o : ""));
@@ -653,11 +653,11 @@ function yn(t = "", e = {}) {
653
653
  if (!s)
654
654
  return n;
655
655
  const l = on(e, s);
656
- return Et([s], n), n[a] = l, n;
656
+ return vt([s], n), n[a] = l, n;
657
657
  }, {}) : {};
658
658
  }
659
659
  function mn(t) {
660
- return Lt(t) && typeof t.value == "string";
660
+ return yt(t) && typeof t.value == "string";
661
661
  }
662
662
  function X(t) {
663
663
  return t === void 0 ? Q() : mn(t) ? t : Q(t, {});
@@ -669,7 +669,7 @@ function Q(t, e) {
669
669
  };
670
670
  }
671
671
  function Ye(t, e) {
672
- Et(t.params, e.params);
672
+ vt(t.params, e.params);
673
673
  const r = `${t.value}${e.value}`;
674
674
  return Q(r, { ...t.params, ...e.params });
675
675
  }
@@ -685,12 +685,12 @@ function wn(t, e) {
685
685
  throw new Mr(r);
686
686
  }
687
687
  function En(t, e) {
688
- Et(t.params, e.params);
688
+ vt(t.params, e.params);
689
689
  const r = [t.value, e.value].filter(W).join("&");
690
690
  return Q(r, { ...t.params, ...e.params });
691
691
  }
692
692
  function vn(t, e) {
693
- return Et(t, e), { ...t, ...e };
693
+ return vt(t, e), { ...t, ...e };
694
694
  }
695
695
  function Xe(t) {
696
696
  return "parent" in t && !!t.parent;
@@ -764,8 +764,8 @@ const pe = le();
764
764
  function nr(t) {
765
765
  return t === void 0 ? "" : t;
766
766
  }
767
- function yt(t, e) {
768
- const r = pe(), n = nr(t.name), o = X(t.path), a = X(t.query), s = X(t.hash), l = t.meta ?? {}, d = t.state ?? {}, i = Nt({ id: r, meta: l, state: d, ...t, props: e }), m = {
767
+ function mt(t, e) {
768
+ const r = pe(), n = nr(t.name), o = X(t.path), a = X(t.query), s = X(t.hash), l = t.meta ?? {}, d = t.state ?? {}, i = Lt({ id: r, meta: l, state: d, ...t, props: e }), m = {
769
769
  id: r,
770
770
  matched: i,
771
771
  matches: [i],
@@ -779,31 +779,31 @@ function yt(t, e) {
779
779
  host: Q(),
780
780
  prefetch: t.prefetch
781
781
  }, b = Xe(t) ? rr(t.parent, m) : m;
782
- return Et(b.path.params, b.query.params, b.hash.params), b;
782
+ return vt(b.path.params, b.query.params, b.hash.params), b;
783
783
  }
784
- const Ct = { template: "<div>This is component</div>" }, de = yt({
784
+ const Ct = { template: "<div>This is component</div>" }, de = mt({
785
785
  name: "parentA",
786
786
  path: "/parentA/[paramA]"
787
- }), or = yt({
787
+ }), or = mt({
788
788
  parent: de,
789
789
  name: "parentA.childA",
790
790
  path: "/childA/[?paramB]"
791
- }), Pn = yt({
791
+ }), Pn = mt({
792
792
  parent: de,
793
793
  name: "parentA.childB",
794
794
  path: "/childB/[paramD]",
795
795
  component: Ct
796
- }), An = yt({
796
+ }), An = mt({
797
797
  parent: or,
798
798
  name: "parentA.childA.grandChildA",
799
799
  path: "/[paramC]",
800
800
  component: Ct
801
801
  });
802
- yt({
802
+ mt({
803
803
  name: "parentB",
804
804
  path: "/parentB",
805
805
  component: Ct
806
- }), yt({
806
+ }), mt({
807
807
  name: "parentC",
808
808
  path: "/",
809
809
  component: Ct
@@ -812,7 +812,7 @@ const kn = "lazy", xn = {
812
812
  components: !0,
813
813
  props: !1
814
814
  };
815
- function xt(t) {
815
+ function Nt(t) {
816
816
  return ["eager", "lazy", "intent"].includes(t);
817
817
  }
818
818
  function ar({ routerPrefetch: t, routePrefetch: e, linkPrefetch: r }, n) {
@@ -822,11 +822,11 @@ function ar({ routerPrefetch: t, routePrefetch: e, linkPrefetch: r }, n) {
822
822
  s,
823
823
  xn[n],
824
824
  kn
825
- ].reduce((d, i) => xt(d) ? d : d === !0 && xt(i) ? i : d === !0 && !xt(i) ? d : d === void 0 ? i : d, void 0);
826
- return xt(l) ? l : !1;
825
+ ].reduce((d, i) => Nt(d) ? d : d === !0 && Nt(i) ? i : d === !0 && !Nt(i) ? d : d === void 0 ? i : d, void 0);
826
+ return Nt(l) ? l : !1;
827
827
  }
828
828
  function Gt(t, e) {
829
- return Lt(t) ? t[e] : t;
829
+ return yt(t) ? t[e] : t;
830
830
  }
831
831
  class sr extends Error {
832
832
  constructor() {
@@ -993,7 +993,7 @@ function Nn() {
993
993
  function fr() {
994
994
  const t = st(ur);
995
995
  if (!t)
996
- throw new wt();
996
+ throw new Et();
997
997
  return t;
998
998
  }
999
999
  const Ln = Zr(() => new Promise((t) => {
@@ -1006,7 +1006,7 @@ const lr = Symbol("visibilityObserver");
1006
1006
  function Un(t) {
1007
1007
  const e = st(lr);
1008
1008
  if (!e)
1009
- throw new wt();
1009
+ throw new Et();
1010
1010
  return rt(t, (n, o) => {
1011
1011
  n && e.observe(n), o && e.unobserve(o);
1012
1012
  }, { immediate: !0 }), _t(() => {
@@ -1197,7 +1197,7 @@ function On(t, e = {}, r = {}) {
1197
1197
  replace: (w) => U({ ...w, replace: !0 })
1198
1198
  };
1199
1199
  }
1200
- const jn = ["href"], $n = /* @__PURE__ */ Rt({
1200
+ const jn = ["href"], $n = /* @__PURE__ */ wt({
1201
1201
  __name: "routerLink",
1202
1202
  props: {
1203
1203
  to: {},
@@ -1239,14 +1239,14 @@ const jn = ["href"], $n = /* @__PURE__ */ Rt({
1239
1239
  class: $r(["router-link", b.value]),
1240
1240
  onClick: w
1241
1241
  }, [
1242
- Oe(y.$slots, "default", je(Hr({ route: n.value, isMatch: vt(l), isExactMatch: vt(d), isExternal: vt(i) })))
1242
+ Oe(y.$slots, "default", je(Hr({ route: n.value, isMatch: bt(l), isExactMatch: bt(d), isExternal: bt(i) })))
1243
1243
  ], 10, jn));
1244
1244
  }
1245
1245
  }), hr = Symbol();
1246
1246
  function Hn() {
1247
1247
  const t = st(hr);
1248
1248
  if (!t)
1249
- throw new wt();
1249
+ throw new Et();
1250
1250
  return t;
1251
1251
  }
1252
1252
  function yr(t, e) {
@@ -1264,7 +1264,7 @@ function ye() {
1264
1264
  return st(mr, 0);
1265
1265
  }
1266
1266
  function _n(t, e, r) {
1267
- return Rt({
1267
+ return wt({
1268
1268
  name: "PropsWrapper",
1269
1269
  expose: [],
1270
1270
  setup() {
@@ -1276,14 +1276,14 @@ function _n(t, e, r) {
1276
1276
  }
1277
1277
  });
1278
1278
  }
1279
- const qn = Rt((t) => {
1279
+ const qn = wt((t) => {
1280
1280
  const e = qt();
1281
1281
  return rt(() => t.props, async (r) => {
1282
1282
  e.value = await r;
1283
1283
  }, { immediate: !0, deep: !0 }), () => e.value instanceof Error ? "" : e.value ? pt(t.component, e.value) : "";
1284
1284
  }, {
1285
1285
  props: ["component", "props"]
1286
- }), In = Rt(async (t) => {
1286
+ }), In = wt(async (t) => {
1287
1287
  const e = qt();
1288
1288
  return e.value = await t.props, rt(() => e.value, async (r) => {
1289
1289
  e.value = await r;
@@ -1314,10 +1314,10 @@ function Pe(t, e) {
1314
1314
  function Fn() {
1315
1315
  const t = st(gr);
1316
1316
  if (!t)
1317
- throw new wt();
1317
+ throw new Et();
1318
1318
  return t;
1319
1319
  }
1320
- const Rr = /* @__PURE__ */ Rt({
1320
+ const Rr = /* @__PURE__ */ wt({
1321
1321
  __name: "routerView",
1322
1322
  props: {
1323
1323
  name: { default: "default" }
@@ -1331,7 +1331,7 @@ const Rr = /* @__PURE__ */ Rt({
1331
1331
  const s = e.matches.at(n);
1332
1332
  return s ? o(s)[t.name] : null;
1333
1333
  });
1334
- return (s, l) => a.value ? Oe(s.$slots, "default", je(Jr({ key: 0 }, { route: vt(e), component: a.value, rejection: vt(r) })), () => [
1334
+ return (s, l) => a.value ? Oe(s.$slots, "default", je(Jr({ key: 0 }, { route: bt(e), component: a.value, rejection: bt(r) })), () => [
1335
1335
  (Ze(), Dr(Fr(a.value)))
1336
1336
  ]) : Ir("", !0);
1337
1337
  }
@@ -1346,15 +1346,15 @@ class at {
1346
1346
  T(this, "onAfterRouteLeave", /* @__PURE__ */ new Set());
1347
1347
  }
1348
1348
  }
1349
- const Pt = (t, e, r) => {
1349
+ const At = (t, e, r) => {
1350
1350
  var a, s;
1351
1351
  const n = t.matches, o = (e == null ? void 0 : e.matches) ?? [];
1352
1352
  return ((a = n.at(r)) == null ? void 0 : a.id) !== ((s = o.at(r)) == null ? void 0 : s.id);
1353
- }, At = (t, e, r) => {
1353
+ }, kt = (t, e, r) => {
1354
1354
  var a, s;
1355
1355
  const n = t.matches, o = (e == null ? void 0 : e.matches) ?? [];
1356
1356
  return ((a = n.at(r)) == null ? void 0 : a.id) !== ((s = o.at(r)) == null ? void 0 : s.id);
1357
- }, kt = (t, e, r) => {
1357
+ }, xt = (t, e, r) => {
1358
1358
  var n, o;
1359
1359
  return ((n = t.matches.at(r)) == null ? void 0 : n.id) === ((o = e == null ? void 0 : e.matches.at(r)) == null ? void 0 : o.id);
1360
1360
  };
@@ -1362,13 +1362,13 @@ function Ae(t) {
1362
1362
  switch (t) {
1363
1363
  case "onBeforeRouteEnter":
1364
1364
  case "onAfterRouteEnter":
1365
- return Pt;
1365
+ return At;
1366
1366
  case "onBeforeRouteUpdate":
1367
1367
  case "onAfterRouteUpdate":
1368
- return kt;
1368
+ return xt;
1369
1369
  case "onBeforeRouteLeave":
1370
1370
  case "onAfterRouteLeave":
1371
- return At;
1371
+ return kt;
1372
1372
  default:
1373
1373
  throw new Error(`Switch is not exhaustive for lifecycle: ${t}`);
1374
1374
  }
@@ -1376,33 +1376,33 @@ function Ae(t) {
1376
1376
  function Tn(t, e) {
1377
1377
  const r = new at();
1378
1378
  return t.matches.forEach((n, o) => {
1379
- n.onBeforeRouteEnter && Pt(t, e, o) && dt(n.onBeforeRouteEnter).forEach((a) => r.onBeforeRouteEnter.add(a)), n.onBeforeRouteUpdate && kt(t, e, o) && dt(n.onBeforeRouteUpdate).forEach((a) => r.onBeforeRouteUpdate.add(a));
1379
+ n.onBeforeRouteEnter && At(t, e, o) && dt(n.onBeforeRouteEnter).forEach((a) => r.onBeforeRouteEnter.add(a)), n.onBeforeRouteUpdate && xt(t, e, o) && dt(n.onBeforeRouteUpdate).forEach((a) => r.onBeforeRouteUpdate.add(a));
1380
1380
  }), e == null || e.matches.forEach((n, o) => {
1381
- n.onBeforeRouteLeave && At(t, e, o) && dt(n.onBeforeRouteLeave).forEach((a) => r.onBeforeRouteLeave.add(a));
1381
+ n.onBeforeRouteLeave && kt(t, e, o) && dt(n.onBeforeRouteLeave).forEach((a) => r.onBeforeRouteLeave.add(a));
1382
1382
  }), r;
1383
1383
  }
1384
1384
  function Mn(t, e) {
1385
1385
  const r = new at();
1386
1386
  return t.matches.forEach((n, o) => {
1387
- n.onAfterRouteEnter && Pt(t, e, o) && dt(n.onAfterRouteEnter).forEach((a) => r.onAfterRouteEnter.add(a)), n.onAfterRouteUpdate && kt(t, e, o) && dt(n.onAfterRouteUpdate).forEach((a) => r.onAfterRouteUpdate.add(a));
1387
+ n.onAfterRouteEnter && At(t, e, o) && dt(n.onAfterRouteEnter).forEach((a) => r.onAfterRouteEnter.add(a)), n.onAfterRouteUpdate && xt(t, e, o) && dt(n.onAfterRouteUpdate).forEach((a) => r.onAfterRouteUpdate.add(a));
1388
1388
  }), e == null || e.matches.forEach((n, o) => {
1389
- n.onAfterRouteLeave && At(t, e, o) && dt(n.onAfterRouteLeave).forEach((a) => r.onAfterRouteLeave.add(a));
1389
+ n.onAfterRouteLeave && kt(t, e, o) && dt(n.onAfterRouteLeave).forEach((a) => r.onAfterRouteLeave.add(a));
1390
1390
  }), r;
1391
1391
  }
1392
1392
  function Wn(t, e, r) {
1393
1393
  const n = new at();
1394
1394
  return t.matches.forEach((o, a) => {
1395
- Pt(t, e, a) && r.onBeforeRouteEnter.forEach((s) => n.onBeforeRouteEnter.add(s)), kt(t, e, a) && r.onBeforeRouteUpdate.forEach((s) => n.onBeforeRouteUpdate.add(s));
1395
+ At(t, e, a) && r.onBeforeRouteEnter.forEach((s) => n.onBeforeRouteEnter.add(s)), xt(t, e, a) && r.onBeforeRouteUpdate.forEach((s) => n.onBeforeRouteUpdate.add(s));
1396
1396
  }), e == null || e.matches.forEach((o, a) => {
1397
- At(t, e, a) && r.onBeforeRouteLeave.forEach((s) => n.onBeforeRouteLeave.add(s));
1397
+ kt(t, e, a) && r.onBeforeRouteLeave.forEach((s) => n.onBeforeRouteLeave.add(s));
1398
1398
  }), n;
1399
1399
  }
1400
1400
  function Gn(t, e, r) {
1401
1401
  const n = new at();
1402
1402
  return t.matches.forEach((o, a) => {
1403
- Pt(t, e, a) && r.onAfterRouteEnter.forEach((s) => n.onAfterRouteEnter.add(s)), kt(t, e, a) && r.onAfterRouteUpdate.forEach((s) => n.onAfterRouteUpdate.add(s));
1403
+ At(t, e, a) && r.onAfterRouteEnter.forEach((s) => n.onAfterRouteEnter.add(s)), xt(t, e, a) && r.onAfterRouteUpdate.forEach((s) => n.onAfterRouteUpdate.add(s));
1404
1404
  }), e == null || e.matches.forEach((o, a) => {
1405
- At(t, e, a) && r.onAfterRouteLeave.forEach((s) => n.onAfterRouteLeave.add(s));
1405
+ kt(t, e, a) && r.onAfterRouteLeave.forEach((s) => n.onAfterRouteLeave.add(s));
1406
1406
  }), n;
1407
1407
  }
1408
1408
  const wr = Symbol();
@@ -1501,7 +1501,7 @@ function zn() {
1501
1501
  function Er() {
1502
1502
  const t = st(wr);
1503
1503
  if (!t)
1504
- throw new wt();
1504
+ throw new Et();
1505
1505
  return t;
1506
1506
  }
1507
1507
  function vr(t) {
@@ -1530,7 +1530,7 @@ var j;
1530
1530
  (function(t) {
1531
1531
  t.Pop = "POP", t.Push = "PUSH", t.Replace = "REPLACE";
1532
1532
  })(j || (j = {}));
1533
- var mt = process.env.NODE_ENV !== "production" ? function(t) {
1533
+ var gt = process.env.NODE_ENV !== "production" ? function(t) {
1534
1534
  return Object.freeze(t);
1535
1535
  } : function(t) {
1536
1536
  return t;
@@ -1550,7 +1550,7 @@ function ke(t) {
1550
1550
  var e = t, r = e.window, n = r === void 0 ? document.defaultView : r, o = n.history;
1551
1551
  function a() {
1552
1552
  var g = n.location, u = g.pathname, h = g.search, x = g.hash, N = o.state || {};
1553
- return [N.idx, mt({
1553
+ return [N.idx, gt({
1554
1554
  pathname: u,
1555
1555
  search: h,
1556
1556
  hash: x,
@@ -1587,7 +1587,7 @@ function ke(t) {
1587
1587
  }
1588
1588
  }
1589
1589
  n.addEventListener(Sr, l);
1590
- var d = j.Pop, i = a(), m = i[0], b = i[1], U = gt(), P = gt();
1590
+ var d = j.Pop, i = a(), m = i[0], b = i[1], U = Rt(), P = Rt();
1591
1591
  m == null && (m = 0, o.replaceState(Y({}, o.state, {
1592
1592
  idx: m
1593
1593
  }), ""));
@@ -1595,11 +1595,11 @@ function ke(t) {
1595
1595
  return typeof g == "string" ? g : et(g);
1596
1596
  }
1597
1597
  function y(g, u) {
1598
- return u === void 0 && (u = null), mt(Y({
1598
+ return u === void 0 && (u = null), gt(Y({
1599
1599
  pathname: b.pathname,
1600
1600
  hash: "",
1601
1601
  search: ""
1602
- }, typeof g == "string" ? bt(g) : g, {
1602
+ }, typeof g == "string" ? St(g) : g, {
1603
1603
  state: u,
1604
1604
  key: jt()
1605
1605
  }));
@@ -1687,8 +1687,8 @@ function Kn(t) {
1687
1687
  t === void 0 && (t = {});
1688
1688
  var e = t, r = e.window, n = r === void 0 ? document.defaultView : r, o = n.history;
1689
1689
  function a() {
1690
- var u = bt(n.location.hash.substr(1)), h = u.pathname, x = h === void 0 ? "/" : h, N = u.search, V = N === void 0 ? "" : N, Z = u.hash, $ = Z === void 0 ? "" : Z, I = o.state || {};
1691
- return [I.idx, mt({
1690
+ var u = St(n.location.hash.substr(1)), h = u.pathname, x = h === void 0 ? "/" : h, N = u.search, V = N === void 0 ? "" : N, Z = u.hash, $ = Z === void 0 ? "" : Z, I = o.state || {};
1691
+ return [I.idx, gt({
1692
1692
  pathname: x,
1693
1693
  search: V,
1694
1694
  hash: $,
@@ -1728,7 +1728,7 @@ function Kn(t) {
1728
1728
  var u = a(), h = u[1];
1729
1729
  et(h) !== et(b) && l();
1730
1730
  });
1731
- var d = j.Pop, i = a(), m = i[0], b = i[1], U = gt(), P = gt();
1731
+ var d = j.Pop, i = a(), m = i[0], b = i[1], U = Rt(), P = Rt();
1732
1732
  m == null && (m = 0, o.replaceState(Y({}, o.state, {
1733
1733
  idx: m
1734
1734
  }), ""));
@@ -1744,11 +1744,11 @@ function Kn(t) {
1744
1744
  return w() + "#" + (typeof u == "string" ? u : et(u));
1745
1745
  }
1746
1746
  function p(u, h) {
1747
- return h === void 0 && (h = null), mt(Y({
1747
+ return h === void 0 && (h = null), gt(Y({
1748
1748
  pathname: b.pathname,
1749
1749
  hash: "",
1750
1750
  search: ""
1751
- }, typeof u == "string" ? bt(u) : u, {
1751
+ }, typeof u == "string" ? St(u) : u, {
1752
1752
  state: h,
1753
1753
  key: jt()
1754
1754
  }));
@@ -1835,24 +1835,24 @@ function Kn(t) {
1835
1835
  function xe(t) {
1836
1836
  t === void 0 && (t = {});
1837
1837
  var e = t, r = e.initialEntries, n = r === void 0 ? ["/"] : r, o = e.initialIndex, a = n.map(function(c) {
1838
- var v = mt(Y({
1838
+ var v = gt(Y({
1839
1839
  pathname: "/",
1840
1840
  search: "",
1841
1841
  hash: "",
1842
1842
  state: null,
1843
1843
  key: jt()
1844
- }, typeof c == "string" ? bt(c) : c));
1844
+ }, typeof c == "string" ? St(c) : c));
1845
1845
  return process.env.NODE_ENV !== "production" && tt(v.pathname.charAt(0) === "/", "Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: " + JSON.stringify(c) + ")"), v;
1846
- }), s = Ne(o ?? a.length - 1, 0, a.length - 1), l = j.Pop, d = a[s], i = gt(), m = gt();
1846
+ }), s = Ne(o ?? a.length - 1, 0, a.length - 1), l = j.Pop, d = a[s], i = Rt(), m = Rt();
1847
1847
  function b(c) {
1848
1848
  return typeof c == "string" ? c : et(c);
1849
1849
  }
1850
1850
  function U(c, v) {
1851
- return v === void 0 && (v = null), mt(Y({
1851
+ return v === void 0 && (v = null), gt(Y({
1852
1852
  pathname: d.pathname,
1853
1853
  search: "",
1854
1854
  hash: ""
1855
- }, typeof c == "string" ? bt(c) : c, {
1855
+ }, typeof c == "string" ? St(c) : c, {
1856
1856
  state: v,
1857
1857
  key: jt()
1858
1858
  }));
@@ -1926,7 +1926,7 @@ function Ne(t, e, r) {
1926
1926
  function Ot(t) {
1927
1927
  t.preventDefault(), t.returnValue = "";
1928
1928
  }
1929
- function gt() {
1929
+ function Rt() {
1930
1930
  var t = [];
1931
1931
  return {
1932
1932
  get length() {
@@ -1953,7 +1953,7 @@ function et(t) {
1953
1953
  var e = t.pathname, r = e === void 0 ? "/" : e, n = t.search, o = n === void 0 ? "" : n, a = t.hash, s = a === void 0 ? "" : a;
1954
1954
  return o && o !== "?" && (r += o.charAt(0) === "?" ? o : "?" + o), s && s !== "#" && (r += s.charAt(0) === "#" ? s : "#" + s), r;
1955
1955
  }
1956
- function bt(t) {
1956
+ function St(t) {
1957
1957
  var e = {};
1958
1958
  if (t) {
1959
1959
  var r = t.indexOf("#");
@@ -2046,14 +2046,14 @@ function no(t = "auto") {
2046
2046
  }
2047
2047
  }
2048
2048
  function oo(t) {
2049
- return Rt(() => () => pt("h1", t), {
2049
+ return wt(() => () => pt("h1", t), {
2050
2050
  name: t,
2051
2051
  props: []
2052
2052
  });
2053
2053
  }
2054
2054
  function ao(t) {
2055
- const e = (a) => Nt(t[a] ?? oo(a)), r = (a) => {
2056
- const s = Nt(e(a)), l = {
2055
+ const e = (a) => Lt(t[a] ?? oo(a)), r = (a) => {
2056
+ const s = Lt(e(a)), l = {
2057
2057
  id: pe(),
2058
2058
  component: s,
2059
2059
  meta: {},
@@ -2567,7 +2567,7 @@ function Fo(t, e = {}) {
2567
2567
  }
2568
2568
  const To = Q, Mo = Q, Wo = Q;
2569
2569
  function Go(t) {
2570
- const e = pe(), r = nr(t.name), n = X(t.path), o = X(t.query), a = X(t.hash), s = t.meta ?? {}, l = X(t.host), d = Nt({ id: e, meta: {}, state: {}, ...t }), i = {
2570
+ const e = pe(), r = nr(t.name), n = X(t.path), o = X(t.query), a = X(t.hash), s = t.meta ?? {}, l = X(t.host), d = Lt({ id: e, meta: {}, state: {}, ...t }), i = {
2571
2571
  id: e,
2572
2572
  matched: d,
2573
2573
  matches: [d],
@@ -2580,20 +2580,20 @@ function Go(t) {
2580
2580
  depth: 1,
2581
2581
  state: {}
2582
2582
  }, m = Xe(t) ? rr(t.parent, i) : i;
2583
- return Et(m.path.params, m.query.params, m.host.params, m.hash.params), m;
2583
+ return vt(m.path.params, m.query.params, m.host.params, m.hash.params), m;
2584
2584
  }
2585
2585
  export {
2586
2586
  Tr as DuplicateParamsError,
2587
2587
  Mr as MetaPropertyConflict,
2588
2588
  $n as RouterLink,
2589
- wt as RouterNotInstalledError,
2589
+ Et as RouterNotInstalledError,
2590
2590
  Rr as RouterView,
2591
2591
  Wr as UseRouteInvalidError,
2592
2592
  Do as arrayOf,
2593
2593
  $e as asUrl,
2594
2594
  Go as createExternalRoute,
2595
2595
  Qr as createParam,
2596
- yt as createRoute,
2596
+ mt as createRoute,
2597
2597
  Io as createRouter,
2598
2598
  Jo as createRouterPlugin,
2599
2599
  Mo as host,
@@ -1,4 +1,4 @@
1
- (function(v,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],i):(v=typeof globalThis<"u"?globalThis:v||self,i(v["@kitbag/router"]={},v.Vue))})(this,function(v,i){"use strict";var So=Object.defineProperty;var Po=(v,i,Z)=>i in v?So(v,i,{enumerable:!0,configurable:!0,writable:!0,value:Z}):v[i]=Z;var G=(v,i,Z)=>Po(v,typeof i!="symbol"?i+"":i,Z);function Z(t){return typeof t!="string"?!1:/^(https?:\/\/|\/).*/g.test(t)}function Zt(t){return Z(t)?t:`/${t}`}class pe 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 de extends Error{constructor(e){super(`Child property on meta for ${e} conflicts with the parent meta.`)}}class X extends Error{constructor(){super("Router not installed")}}class he extends Error{constructor(e,r){super(`useRoute called with incorrect route. Given ${e}, expected ${r}`)}}const me=Symbol();function St(){const t=i.inject(me);if(!t)throw new X;return t}function it(t){return Array.isArray(t)?t:[t]}function ye(t,e){return t.filter(r=>e===r).length}function ct(...t){const e=t.flatMap(r=>Array.isArray(r)?r:Object.keys(r));for(const r of e)if(ye(e,r)>1)throw new pe(r)}class z extends Error{}const gt="[",Pt="]";function vr(t){return t!==String&&t!==Boolean&&t!==Number&&t!==Date}function kr(t){return typeof t=="function"&&vr(t)}function At(t){return typeof t=="object"&&"get"in t&&typeof t.get=="function"&&"set"in t&&typeof t.set=="function"}function ge(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"}function Re(t,e){return At(t)?{...t,defaultValue:e??t.defaultValue}:{get:r=>tt(r,t),set:r=>et(r,t),defaultValue:e}}function Ur(t){return At(t)&&t.defaultValue!==void 0}function Lr(t,e){return Re(t,e)}function vt(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function F(t){return typeof t=="string"&&t.length>0}let b=null;async function Nr(){const{ZodSchema:t,ZodString:e,ZodBoolean:r,ZodDate:n,ZodNumber:o,ZodLiteral:a,ZodObject:s,ZodEnum:p,ZodNativeEnum:h,ZodArray:c,ZodTuple:g,ZodUnion:P,ZodDiscriminatedUnion:C,ZodRecord:k,ZodMap:E,ZodSet:y,ZodIntersection:d,ZodPromise:w,ZodFunction:l}=await import("zod");return{ZodSchema:t,ZodString:e,ZodBoolean:r,ZodDate:n,ZodNumber:o,ZodLiteral:a,ZodObject:s,ZodEnum:p,ZodNativeEnum:h,ZodArray:c,ZodTuple:g,ZodUnion:P,ZodDiscriminatedUnion:C,ZodRecord:k,ZodMap:E,ZodSet:y,ZodIntersection:d,ZodPromise:w,ZodFunction:l}}function Vr(t){return Object.values(t).some(e=>Object.values(e.host.params).some(r=>$t(r))||Object.values(e.path.params).some(r=>$t(r))||Object.values(e.query.params).some(r=>$t(r)))}function $t(t){return typeof t=="object"&&"parse"in t&&typeof t.parse=="function"}async function Br(){try{b=await Nr()}catch{throw new Error("Failed to initialize Zod")}}function we(t){return b?t instanceof b.ZodSchema:!1}function Ee(t){return{get:(e,{invalid:r})=>{try{return Ht(e,t)}catch{throw r()}},set:(e,{invalid:r})=>{try{return _t(e,t)}catch{throw r()}}}}const Cr=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;function ut(t,e){if(typeof e=="string"&&Cr.test(e)){const r=new Date(e);return isNaN(r.getTime())?e:r}return e}function ft(t){for(const e of t)try{return e()}catch{continue}throw new Error("All functions failed")}function kt(t,e){return b!=null&&b.ZodString&&t instanceof b.ZodString?1:b!=null&&b.ZodString&&e instanceof b.ZodString?-1:0}function Ht(t,e){if(!b)throw new Error("Zod is not initialized");if(e instanceof b.ZodString)return e.parse(t);if(e instanceof b.ZodBoolean)return e.parse(!!t);if(e instanceof b.ZodDate)return e.parse(new Date(t));if(e instanceof b.ZodNumber)return e.parse(Number(t));if(e instanceof b.ZodLiteral)return ft([()=>e.parse(Number(t)),()=>e.parse(!!t),()=>e.parse(t)]);if(e instanceof b.ZodObject)return e.parse(JSON.parse(t,ut));if(e instanceof b.ZodEnum)return e.parse(t);if(e instanceof b.ZodNativeEnum)return ft([()=>e.parse(Number(t)),()=>e.parse(t)]);if(e instanceof b.ZodArray||e instanceof b.ZodTuple)return e.parse(JSON.parse(t,ut));if(e instanceof b.ZodUnion){const r=Array.from(e._def.options).sort(kt).map(n=>()=>Ht(t,n));return ft(r)}if(e instanceof b.ZodDiscriminatedUnion){const r=Array.from(e.options).sort(kt).map(n=>()=>Ht(t,n));return ft(r)}if(e instanceof b.ZodRecord)return e.parse(JSON.parse(t,ut));if(e instanceof b.ZodMap)return e.parse(new Map(JSON.parse(t,ut)));if(e instanceof b.ZodSet)return e.parse(new Set(JSON.parse(t,ut)));if(e instanceof b.ZodIntersection)throw new Error("Intersection schemas are not supported");if(e instanceof b.ZodPromise)throw new Error("Promise schemas are not supported");if(e instanceof b.ZodFunction)throw new Error("Function schemas are not supported");return e.parse(t)}function _t(t,e){if(!b)throw new Error("Zod is not initialized");if(e instanceof b.ZodString)return e.parse(t);if(e instanceof b.ZodBoolean)return e.parse(t).toString();if(e instanceof b.ZodDate)return e.parse(t).toISOString();if(e instanceof b.ZodNumber)return e.parse(Number(t)).toString();if(e instanceof b.ZodLiteral)return e.parse(t).toString();if(e instanceof b.ZodObject)return JSON.stringify(e.parse(t));if(e instanceof b.ZodEnum)return e.parse(t);if(e instanceof b.ZodNativeEnum)return e.parse(t).toString();if(e instanceof b.ZodArray||e instanceof b.ZodTuple)return JSON.stringify(e.parse(t));if(e instanceof b.ZodUnion){const r=Array.from(e._def.options).sort(kt).map(n=>()=>_t(t,n));return ft(r)}if(e instanceof b.ZodDiscriminatedUnion){const r=Array.from(e.options).sort(kt).map(n=>()=>_t(t,n));return ft(r)}if(e instanceof b.ZodRecord)return JSON.stringify(e.parse(t));if(e instanceof b.ZodMap){const r=e.parse(t);return JSON.stringify(Array.from(r.entries()))}if(e instanceof b.ZodSet){const r=e.parse(t);return JSON.stringify(Array.from(r.values()))}if(e instanceof b.ZodIntersection)throw new Error("Intersection schemas are not supported");if(e instanceof b.ZodPromise)throw new Error("Promise schemas are not supported");if(e instanceof b.ZodFunction)throw new Error("Function schemas are not supported");return JSON.stringify(e.parse(t))}function qt(t){return typeof t=="object"&&t!==null&&"then"in t}function V(t,e){const r=t["~standard"].validate(e);if(qt(r))throw new Error("Promise schemas are not supported");if(r.issues)throw new Error("Validation failed");return r.value}function xr(t){return vt(t)&&"type"in t&&typeof t.type=="string"&&"~standard"in t&&vt(t["~standard"])&&"vendor"in t["~standard"]&&t["~standard"].vendor==="valibot"}function be(t){return xr(t)}function Se(t){return{get:(e,{invalid:r})=>{try{return It(e,t)}catch{throw r()}},set:(e,{invalid:r})=>{try{return Dt(e,t)}catch{throw r()}}}}const jr=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;function lt(t,e){if(typeof e=="string"&&jr.test(e)){const r=new Date(e);return isNaN(r.getTime())?e:r}return e}function pt(t){for(const e of t)try{return e()}catch{continue}throw new Error("All functions failed")}function Ut(t,e){return t.type==="string"?1:e.type==="string"?-1:0}function It(t,e){if(e.type==="boolean")return V(e,!!t);if(e.type==="date")return V(e,new Date(t));if(e.type==="number")return V(e,Number(t));if(e.type==="literal")return pt([()=>V(e,Number(t)),()=>V(e,!!t),()=>V(e,t)]);if(e.type==="object")return V(e,JSON.parse(t,lt));if(e.type==="enum")return pt([()=>V(e,Number(t)),()=>V(e,!!t),()=>V(e,t)]);if(e.type==="array"||e.type==="tuple")return V(e,JSON.parse(t,lt));if(e.type==="union"&&"options"in e){const r=e.options.sort(Ut).map(n=>()=>It(t,n));return pt(r)}if(e.type==="variant"&&"options"in e){const r=e.options.sort(Ut).map(n=>()=>It(t,n));return pt(r)}if(e.type==="record")return V(e,JSON.parse(t,lt));if(e.type==="map")return V(e,new Map(JSON.parse(t,lt)));if(e.type==="set")return V(e,new Set(JSON.parse(t,lt)));if(e.type==="intersection")throw new Error("Intersection schemas are not supported");if(e.type==="promise")throw new Error("Promise schemas are not supported");if(e.type==="function")throw new Error("Function schemas are not supported");return V(e,t)}function Dt(t,e){if(e.type==="string"||e.type==="boolean")return V(e,t).toString();if(e.type==="date")return V(e,t).toISOString();if(e.type==="number")return V(e,Number(t)).toString();if(e.type==="literal")return V(e,t).toString();if(e.type==="object")return JSON.stringify(V(e,t));if(e.type==="enum"||e.type==="nativeEnum")return V(e,t).toString();if(e.type==="array"||e.type==="tuple")return JSON.stringify(V(e,t));if(e.type==="union"&&"options"in e){const r=e.options.sort(Ut).map(n=>()=>Dt(t,n));return pt(r)}if(e.type==="variant"&&"options"in e){const r=e.options.sort(Ut).map(n=>()=>Dt(t,n));return pt(r)}if(e.type==="record")return JSON.stringify(V(e,t));if(e.type==="map"){const r=V(e,t);return JSON.stringify(Array.from(r.entries()))}if(e.type==="set"){const r=V(e,t);return JSON.stringify(Array.from(r.values()))}if(e.type==="intersection")throw new Error("Intersection schemas are not supported");if(e.type==="promise")throw new Error("Promise schemas are not supported");if(e.type==="function")throw new Error("Function schemas are not supported");return JSON.stringify(V(e,t))}function Or(t,e){return t[e]??String}const j={invalid:t=>{throw new z(t)}},Pe={get:t=>t,set:(t,{invalid:e})=>{if(typeof t!="string")throw e();return t}},Jt={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()}},Tt={get:(t,{invalid:e})=>{const r=Number(t);if(isNaN(r))throw e();return r},set:(t,{invalid:e})=>{if(typeof t!="number")throw e();return t.toString()}},Ae={get:(t,{invalid:e})=>{const r=new Date(t);if(isNaN(r.getTime()))throw e();return r},set:(t,{invalid:e})=>{if(typeof t!="object"||!(t instanceof Date))throw e();return t.toISOString()}},ve={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 Zr(t,e){switch(typeof e){case"string":return Pe.get(t,j)===e;case"number":return Tt.get(t,j)===e;case"boolean":return Jt.get(t,j)===e;default:return!1}}function tt(t,e,r=!1){if(t===void 0||!F(t)){if(Ur(e))return e.defaultValue;if(r)return;throw new z}if(e===String)return Pe.get(t,j);if(e===Boolean)return Jt.get(t,j);if(e===Number)return Tt.get(t,j);if(e===Date)return Ae.get(t,j);if(e===JSON)return ve.get(t,j);if(kr(e))return e(t,j);if(At(e))return e.get(t,j);if(e instanceof RegExp){if(e.test(t))return t;throw new z}if(ge(e)){if(Zr(t,e))return e;throw new z}return we(e)?Ee(e).get(t,j):be(e)?Se(e).get(t,j):t}function $r(t,e,r=!1){try{return tt(t,e,r)}catch(n){if(n instanceof z)return;throw n}}function Hr(t,e,r=!1){try{return et(t,e,r)}catch(n){if(n instanceof z)return;throw n}}function et(t,e,r=!1){if(t===void 0){if(r)return"";throw new z}if(e===Boolean)return Jt.set(t,j);if(e===Number)return Tt.set(t,j);if(e===Date)return Ae.set(t,j);if(e===JSON)return ve.set(t,j);if(At(e))return e.set(t,j);if(ge(e)){if(e!==t)throw new z;return t.toString()}if(we(e))return Ee(e).set(t,j);if(be(e))return Se(e).set(t,j);try{return t.toString()}catch{throw new z}}function Ft(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _r(t,e){const r=Array.from(t.matchAll(e));if(r.length===0)return[t];let n=0;const o=r.reduce((s,p)=>{const h=Ft(t.slice(n,p.index));h.length&&s.push(h);const[c]=p;return s.push(c),n=p.index+c.length,s},[]),a=t.slice(n);return a&&o.push(a),o}function qr(t){const e=ke(t.path.value);return new RegExp(`^${e}$`,"i")}function Ir(t){const e=new URLSearchParams(t.query.value);return Array.from(e.entries()).filter(([,r])=>!Wt(r)).map(([r,n])=>{const o=ke(n);return new RegExp(`${Ft(r)}=${o}(&|$)`,"i")})}function ke(t){return _r(t,new RegExp(Lt,"g")).map(e=>e.startsWith(gt)?Ue(e):Ft(e)).join("")}function Ue(t){return t.replace(new RegExp(Lt,"g"),".+")}function Dr(t,e){const r=Le(e);return t.replace(r,"(.*)")}function Mt(t,e){return Tr(e).test(t.value)}function Wt(t){return new RegExp(Jr,"g").test(t)}const Lt=`\\${gt}\\??([\\w-_]+)\\${Pt}`,Jr=`\\${gt}\\?([\\w-_]+)\\${Pt}`;function Gt(t){const[e]=Ne(t,new RegExp(Lt,"g"));return e}function Le(t){return new RegExp(`\\${gt}\\??${t}\\${Pt}`,"g")}function Tr(t){return new RegExp(`\\${gt}\\?${t}\\${Pt}`,"g")}function Ne(t,e){return Array.from(t.matchAll(e)).flatMap(([,...n])=>n.map(o=>F(o)?o:""))}function Fr(t="",e={}){return F(t)?Array.from(t.matchAll(new RegExp(Lt,"g"))).reduce((n,[o,a])=>{const s=Gt(o);if(!s)return n;const p=Or(e,s);return ct([s],n),n[a]=p,n},{}):{}}function Mr(t){return vt(t)&&typeof t.value=="string"}function rt(t){return t===void 0?M():Mr(t)?t:M(t,{})}function M(t,e){return{value:t??"",params:Fr(t,e)}}function Ve(t,e){ct(t.params,e.params);const r=`${t.value}${e.value}`;return M(r,{...t.params,...e.params})}function Wr(t,e){return Ve(t,e)}function Gr(t,e){return zr(t,e),{...t,...e}}function zr(t,e){const r=Object.keys(t).find(n=>n in e&&typeof e[n]!=typeof t[n]);if(r)throw new de(r)}function Qr(t,e){ct(t.params,e.params);const r=[t.value,e.value].filter(F).join("&");return M(r,{...t.params,...e.params})}function Kr(t,e){return ct(t,e),{...t,...e}}function Be(t){return"parent"in t&&!!t.parent}function Ce(t){return"component"in t&&!!t.component}function xe(t){return"props"in t&&typeof t.props=="function"}function je(t){return"components"in t&&!!t.components}function Oe(t){return"props"in t&&typeof t.props=="object"}function Ze(t,e){return{...e,path:Ve(t.path,e.path),query:Qr(t.query,e.query),meta:Gr(t.meta,e.meta),state:Kr(t.state,e.state),hash:Wr(t.hash,e.hash),matches:[...t.matches,e.matched],host:t.host,depth:t.depth+1}}function zt(){return typeof window<"u"&&typeof window.document<"u"}function Qt(t){const e=new URLSearchParams(t);return{get:(...r)=>e.get(...r),getAll:(...r)=>e.getAll(...r),set:(...r)=>{e.set(...r)},append:(...r)=>{e.append(...r)},delete:(...r)=>{e.delete(...r)},toString:(...r)=>e.toString(...r),forEach:(...r)=>{e.forEach(...r)},entries:(...r)=>e.entries(...r),keys:(...r)=>e.keys(...r),values:(...r)=>e.values(...r),has:(...r)=>e.has(...r),size:e.size,sort:()=>{e.sort()},[Symbol.iterator]:()=>e[Symbol.iterator]()}}function Kt(){let t=0;return()=>(++t).toString()}const Yr=Kt()();function Xr(t){return t===Yr}const Yt=Kt();function $e(t){return t===void 0?"":t}function nt(t,e){const r=Yt(),n=$e(t.name),o=rt(t.path),a=rt(t.query),s=rt(t.hash),p=t.meta??{},h=t.state??{},c=i.markRaw({id:r,meta:p,state:h,...t,props:e}),g={id:r,matched:c,matches:[c],name:n,path:o,query:a,hash:s,meta:p,state:h,depth:1,host:M(),prefetch:t.prefetch},P=Be(t)?Ze(t.parent,g):g;return ct(P.path.params,P.query.params,P.hash.params),P}const Nt={template:"<div>This is component</div>"},Xt=nt({name:"parentA",path:"/parentA/[paramA]"}),He=nt({parent:Xt,name:"parentA.childA",path:"/childA/[?paramB]"}),tn=nt({parent:Xt,name:"parentA.childB",path:"/childB/[paramD]",component:Nt}),en=nt({parent:He,name:"parentA.childA.grandChildA",path:"/[paramC]",component:Nt});nt({name:"parentB",path:"/parentB",component:Nt}),nt({name:"parentC",path:"/",component:Nt});const rn="lazy",nn={components:!0,props:!1};function Vt(t){return["eager","lazy","intent"].includes(t)}function _e({routerPrefetch:t,routePrefetch:e,linkPrefetch:r},n){const o=te(r,n),a=te(e,n),s=te(t,n),p=[o,a,s,nn[n],rn].reduce((h,c)=>Vt(h)?h:h===!0&&Vt(c)?c:h===!0&&!Vt(c)?h:h===void 0?c:h,void 0);return Vt(p)?p:!1}function te(t,e){return vt(t)?t[e]:t}class qe extends Error{constructor(){super("Uncaught CallbackContextAbortError");G(this,"response");this.response={status:"ABORT"}}}class dt extends Error{constructor(r){super("Uncaught CallbackContextPushError");G(this,"response");this.response={status:"PUSH",to:r}}}class Bt extends Error{constructor(r){super("Uncaught CallbackContextRejectionError");G(this,"response");this.response={status:"REJECT",type:r}}}function Ie(){return{reject:o=>{throw new Bt(o)},push:(...o)=>{throw new dt(o)},replace:(o,a,s)=>{if(Z(o)){const c=a??{};throw new dt([o,{...c,replace:!0}])}const p=a,h=s??{};throw new dt([o,p,{...h,replace:!0}])},abort:()=>{throw new qe}}}function De(t){try{const e=t();return qt(e)?e.catch(r=>r):e}catch(e){return e}}function Je(){let t=null;function e(n){t=n}function r(n){return t?t.runWithContext(n):n()}return{setVueApp:e,runWithContext:r}}const Te=Symbol();function on(){const{setVueApp:t,runWithContext:e}=Je(),r=i.reactive(new Map),{push:n,replace:o,reject:a}=Ie(),s=(y,d,w)=>d.matches.filter(l=>_e({...w,routePrefetch:l.prefetch},"props")===y).flatMap(l=>k(l)).reduce((l,{id:u,name:S,props:L})=>{if(!L)return l;const U=C(u,S,d),R=e(()=>De(()=>L(d,{push:n,replace:o,reject:a,parent:g(d,!0)})));return l[U]=R,l},{}),p=y=>{Object.entries(y).forEach(([d,w])=>{r.set(d,w)})},h=async y=>{const d=y.matches.flatMap(k),w=[],l=[];for(const{id:u,name:S,props:L}of d){if(!L)continue;const U=C(u,S,y);if(w.push(U),!r.has(U)){const R=e(()=>De(()=>L(y,{push:n,replace:o,reject:a,parent:g(y)})));r.set(U,R)}l.push((async()=>{const R=await r.get(U);if(R instanceof Error)throw R})())}E(w);try{return await Promise.all(l),{status:"SUCCESS"}}catch(u){if(u instanceof dt||u instanceof Bt)return u.response;throw u}},c=(y,d,w)=>{const l=C(y,d,w);return r.get(l)};function g(y,d=!1){const w=y.matches.at(-2);if(w)return xe(w)?{name:w.name??"",get props(){return P(w,"default",y,d)}}:Oe(w)?{name:w.name??"",props:new Proxy({},{get(l,u){return typeof u!="string"?Reflect.get(l,u):P(w,u,y,d)}})}:{name:w.name??"",props:void 0}}function P(y,d,w,l=!1){const u=c(y.id,d,w);if(l&&!u){const S=y.name??"unknown",L=w.name||"unknown";console.warn(`
1
+ (function(v,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],i):(v=typeof globalThis<"u"?globalThis:v||self,i(v["@kitbag/router"]={},v.Vue))})(this,function(v,i){"use strict";var So=Object.defineProperty;var Po=(v,i,Z)=>i in v?So(v,i,{enumerable:!0,configurable:!0,writable:!0,value:Z}):v[i]=Z;var G=(v,i,Z)=>Po(v,typeof i!="symbol"?i+"":i,Z);function Z(t){return typeof t!="string"?!1:/^(https?:\/\/|\/).*/g.test(t)}function Zt(t){return Z(t)?t:`/${t}`}class pe 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 de extends Error{constructor(e){super(`Child property on meta for ${e} conflicts with the parent meta.`)}}class X extends Error{constructor(){super("Router not installed")}}class he extends Error{constructor(e,r){super(`useRoute called with incorrect route. Given ${e}, expected ${r}`)}}const ye=Symbol();function Pt(){const t=i.inject(ye);if(!t)throw new X;return t}function it(t){return Array.isArray(t)?t:[t]}function me(t,e){return t.filter(r=>e===r).length}function ct(...t){const e=t.flatMap(r=>Array.isArray(r)?r:Object.keys(r));for(const r of e)if(me(e,r)>1)throw new pe(r)}class z extends Error{}const Rt="[",At="]";function vr(t){return t!==String&&t!==Boolean&&t!==Number&&t!==Date}function kr(t){return typeof t=="function"&&vr(t)}function vt(t){return typeof t=="object"&&"get"in t&&typeof t.get=="function"&&"set"in t&&typeof t.set=="function"}function ge(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"}function Re(t,e){return vt(t)?{...t,defaultValue:e??t.defaultValue}:{get:r=>tt(r,t),set:r=>et(r,t),defaultValue:e}}function Ur(t){return vt(t)&&t.defaultValue!==void 0}function Lr(t,e){return Re(t,e)}function ut(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function F(t){return typeof t=="string"&&t.length>0}let b=null;async function Nr(){const{ZodSchema:t,ZodString:e,ZodBoolean:r,ZodDate:n,ZodNumber:o,ZodLiteral:a,ZodObject:s,ZodEnum:p,ZodNativeEnum:h,ZodArray:c,ZodTuple:g,ZodUnion:P,ZodDiscriminatedUnion:C,ZodRecord:k,ZodMap:E,ZodSet:m,ZodIntersection:d,ZodPromise:w,ZodFunction:l}=await import("zod");return{ZodSchema:t,ZodString:e,ZodBoolean:r,ZodDate:n,ZodNumber:o,ZodLiteral:a,ZodObject:s,ZodEnum:p,ZodNativeEnum:h,ZodArray:c,ZodTuple:g,ZodUnion:P,ZodDiscriminatedUnion:C,ZodRecord:k,ZodMap:E,ZodSet:m,ZodIntersection:d,ZodPromise:w,ZodFunction:l}}function Vr(t){return Object.values(t).some(e=>Object.values(e.host.params).some(r=>$t(r))||Object.values(e.path.params).some(r=>$t(r))||Object.values(e.query.params).some(r=>$t(r)))}function $t(t){return ut(t)&&"parse"in t&&typeof t.parse=="function"&&"~standard"in t&&ut(t["~standard"])&&"vendor"in t["~standard"]&&t["~standard"].vendor==="zod"}async function Br(){try{b=await Nr()}catch{throw new Error("Failed to initialize Zod")}}function we(t){return b?t instanceof b.ZodSchema:!1}function Ee(t){return{get:(e,{invalid:r})=>{try{return Ht(e,t)}catch{throw r()}},set:(e,{invalid:r})=>{try{return _t(e,t)}catch{throw r()}}}}const Cr=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;function ft(t,e){if(typeof e=="string"&&Cr.test(e)){const r=new Date(e);return isNaN(r.getTime())?e:r}return e}function lt(t){for(const e of t)try{return e()}catch{continue}throw new Error("All functions failed")}function kt(t,e){return b!=null&&b.ZodString&&t instanceof b.ZodString?1:b!=null&&b.ZodString&&e instanceof b.ZodString?-1:0}function Ht(t,e){if(!b)throw new Error("Zod is not initialized");if(e instanceof b.ZodString)return e.parse(t);if(e instanceof b.ZodBoolean)return e.parse(!!t);if(e instanceof b.ZodDate)return e.parse(new Date(t));if(e instanceof b.ZodNumber)return e.parse(Number(t));if(e instanceof b.ZodLiteral)return lt([()=>e.parse(Number(t)),()=>e.parse(!!t),()=>e.parse(t)]);if(e instanceof b.ZodObject)return e.parse(JSON.parse(t,ft));if(e instanceof b.ZodEnum)return e.parse(t);if(e instanceof b.ZodNativeEnum)return lt([()=>e.parse(Number(t)),()=>e.parse(t)]);if(e instanceof b.ZodArray||e instanceof b.ZodTuple)return e.parse(JSON.parse(t,ft));if(e instanceof b.ZodUnion){const r=Array.from(e._def.options).sort(kt).map(n=>()=>Ht(t,n));return lt(r)}if(e instanceof b.ZodDiscriminatedUnion){const r=Array.from(e.options).sort(kt).map(n=>()=>Ht(t,n));return lt(r)}if(e instanceof b.ZodRecord)return e.parse(JSON.parse(t,ft));if(e instanceof b.ZodMap)return e.parse(new Map(JSON.parse(t,ft)));if(e instanceof b.ZodSet)return e.parse(new Set(JSON.parse(t,ft)));if(e instanceof b.ZodIntersection)throw new Error("Intersection schemas are not supported");if(e instanceof b.ZodPromise)throw new Error("Promise schemas are not supported");if(e instanceof b.ZodFunction)throw new Error("Function schemas are not supported");return e.parse(t)}function _t(t,e){if(!b)throw new Error("Zod is not initialized");if(e instanceof b.ZodString)return e.parse(t);if(e instanceof b.ZodBoolean)return e.parse(t).toString();if(e instanceof b.ZodDate)return e.parse(t).toISOString();if(e instanceof b.ZodNumber)return e.parse(Number(t)).toString();if(e instanceof b.ZodLiteral)return e.parse(t).toString();if(e instanceof b.ZodObject)return JSON.stringify(e.parse(t));if(e instanceof b.ZodEnum)return e.parse(t);if(e instanceof b.ZodNativeEnum)return e.parse(t).toString();if(e instanceof b.ZodArray||e instanceof b.ZodTuple)return JSON.stringify(e.parse(t));if(e instanceof b.ZodUnion){const r=Array.from(e._def.options).sort(kt).map(n=>()=>_t(t,n));return lt(r)}if(e instanceof b.ZodDiscriminatedUnion){const r=Array.from(e.options).sort(kt).map(n=>()=>_t(t,n));return lt(r)}if(e instanceof b.ZodRecord)return JSON.stringify(e.parse(t));if(e instanceof b.ZodMap){const r=e.parse(t);return JSON.stringify(Array.from(r.entries()))}if(e instanceof b.ZodSet){const r=e.parse(t);return JSON.stringify(Array.from(r.values()))}if(e instanceof b.ZodIntersection)throw new Error("Intersection schemas are not supported");if(e instanceof b.ZodPromise)throw new Error("Promise schemas are not supported");if(e instanceof b.ZodFunction)throw new Error("Function schemas are not supported");return JSON.stringify(e.parse(t))}function qt(t){return typeof t=="object"&&t!==null&&"then"in t}function V(t,e){const r=t["~standard"].validate(e);if(qt(r))throw new Error("Promise schemas are not supported");if(r.issues)throw new Error("Validation failed");return r.value}function xr(t){return ut(t)&&"type"in t&&typeof t.type=="string"&&"~standard"in t&&ut(t["~standard"])&&"vendor"in t["~standard"]&&t["~standard"].vendor==="valibot"}function be(t){return xr(t)}function Se(t){return{get:(e,{invalid:r})=>{try{return It(e,t)}catch{throw r()}},set:(e,{invalid:r})=>{try{return Dt(e,t)}catch{throw r()}}}}const jr=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;function pt(t,e){if(typeof e=="string"&&jr.test(e)){const r=new Date(e);return isNaN(r.getTime())?e:r}return e}function dt(t){for(const e of t)try{return e()}catch{continue}throw new Error("All functions failed")}function Ut(t,e){return t.type==="string"?1:e.type==="string"?-1:0}function It(t,e){if(e.type==="boolean")return V(e,!!t);if(e.type==="date")return V(e,new Date(t));if(e.type==="number")return V(e,Number(t));if(e.type==="literal")return dt([()=>V(e,Number(t)),()=>V(e,!!t),()=>V(e,t)]);if(e.type==="object")return V(e,JSON.parse(t,pt));if(e.type==="enum")return dt([()=>V(e,Number(t)),()=>V(e,!!t),()=>V(e,t)]);if(e.type==="array"||e.type==="tuple")return V(e,JSON.parse(t,pt));if(e.type==="union"&&"options"in e){const r=e.options.sort(Ut).map(n=>()=>It(t,n));return dt(r)}if(e.type==="variant"&&"options"in e){const r=e.options.sort(Ut).map(n=>()=>It(t,n));return dt(r)}if(e.type==="record")return V(e,JSON.parse(t,pt));if(e.type==="map")return V(e,new Map(JSON.parse(t,pt)));if(e.type==="set")return V(e,new Set(JSON.parse(t,pt)));if(e.type==="intersection")throw new Error("Intersection schemas are not supported");if(e.type==="promise")throw new Error("Promise schemas are not supported");if(e.type==="function")throw new Error("Function schemas are not supported");return V(e,t)}function Dt(t,e){if(e.type==="string"||e.type==="boolean")return V(e,t).toString();if(e.type==="date")return V(e,t).toISOString();if(e.type==="number")return V(e,Number(t)).toString();if(e.type==="literal")return V(e,t).toString();if(e.type==="object")return JSON.stringify(V(e,t));if(e.type==="enum"||e.type==="nativeEnum")return V(e,t).toString();if(e.type==="array"||e.type==="tuple")return JSON.stringify(V(e,t));if(e.type==="union"&&"options"in e){const r=e.options.sort(Ut).map(n=>()=>Dt(t,n));return dt(r)}if(e.type==="variant"&&"options"in e){const r=e.options.sort(Ut).map(n=>()=>Dt(t,n));return dt(r)}if(e.type==="record")return JSON.stringify(V(e,t));if(e.type==="map"){const r=V(e,t);return JSON.stringify(Array.from(r.entries()))}if(e.type==="set"){const r=V(e,t);return JSON.stringify(Array.from(r.values()))}if(e.type==="intersection")throw new Error("Intersection schemas are not supported");if(e.type==="promise")throw new Error("Promise schemas are not supported");if(e.type==="function")throw new Error("Function schemas are not supported");return JSON.stringify(V(e,t))}function Or(t,e){return t[e]??String}const j={invalid:t=>{throw new z(t)}},Pe={get:t=>t,set:(t,{invalid:e})=>{if(typeof t!="string")throw e();return t}},Jt={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()}},Tt={get:(t,{invalid:e})=>{const r=Number(t);if(isNaN(r))throw e();return r},set:(t,{invalid:e})=>{if(typeof t!="number")throw e();return t.toString()}},Ae={get:(t,{invalid:e})=>{const r=new Date(t);if(isNaN(r.getTime()))throw e();return r},set:(t,{invalid:e})=>{if(typeof t!="object"||!(t instanceof Date))throw e();return t.toISOString()}},ve={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 Zr(t,e){switch(typeof e){case"string":return Pe.get(t,j)===e;case"number":return Tt.get(t,j)===e;case"boolean":return Jt.get(t,j)===e;default:return!1}}function tt(t,e,r=!1){if(t===void 0||!F(t)){if(Ur(e))return e.defaultValue;if(r)return;throw new z}if(e===String)return Pe.get(t,j);if(e===Boolean)return Jt.get(t,j);if(e===Number)return Tt.get(t,j);if(e===Date)return Ae.get(t,j);if(e===JSON)return ve.get(t,j);if(kr(e))return e(t,j);if(vt(e))return e.get(t,j);if(e instanceof RegExp){if(e.test(t))return t;throw new z}if(ge(e)){if(Zr(t,e))return e;throw new z}return we(e)?Ee(e).get(t,j):be(e)?Se(e).get(t,j):t}function $r(t,e,r=!1){try{return tt(t,e,r)}catch(n){if(n instanceof z)return;throw n}}function Hr(t,e,r=!1){try{return et(t,e,r)}catch(n){if(n instanceof z)return;throw n}}function et(t,e,r=!1){if(t===void 0){if(r)return"";throw new z}if(e===Boolean)return Jt.set(t,j);if(e===Number)return Tt.set(t,j);if(e===Date)return Ae.set(t,j);if(e===JSON)return ve.set(t,j);if(vt(e))return e.set(t,j);if(ge(e)){if(e!==t)throw new z;return t.toString()}if(we(e))return Ee(e).set(t,j);if(be(e))return Se(e).set(t,j);try{return t.toString()}catch{throw new z}}function Ft(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _r(t,e){const r=Array.from(t.matchAll(e));if(r.length===0)return[t];let n=0;const o=r.reduce((s,p)=>{const h=Ft(t.slice(n,p.index));h.length&&s.push(h);const[c]=p;return s.push(c),n=p.index+c.length,s},[]),a=t.slice(n);return a&&o.push(a),o}function qr(t){const e=ke(t.path.value);return new RegExp(`^${e}$`,"i")}function Ir(t){const e=new URLSearchParams(t.query.value);return Array.from(e.entries()).filter(([,r])=>!Wt(r)).map(([r,n])=>{const o=ke(n);return new RegExp(`${Ft(r)}=${o}(&|$)`,"i")})}function ke(t){return _r(t,new RegExp(Lt,"g")).map(e=>e.startsWith(Rt)?Ue(e):Ft(e)).join("")}function Ue(t){return t.replace(new RegExp(Lt,"g"),".+")}function Dr(t,e){const r=Le(e);return t.replace(r,"(.*)")}function Mt(t,e){return Tr(e).test(t.value)}function Wt(t){return new RegExp(Jr,"g").test(t)}const Lt=`\\${Rt}\\??([\\w-_]+)\\${At}`,Jr=`\\${Rt}\\?([\\w-_]+)\\${At}`;function Gt(t){const[e]=Ne(t,new RegExp(Lt,"g"));return e}function Le(t){return new RegExp(`\\${Rt}\\??${t}\\${At}`,"g")}function Tr(t){return new RegExp(`\\${Rt}\\?${t}\\${At}`,"g")}function Ne(t,e){return Array.from(t.matchAll(e)).flatMap(([,...n])=>n.map(o=>F(o)?o:""))}function Fr(t="",e={}){return F(t)?Array.from(t.matchAll(new RegExp(Lt,"g"))).reduce((n,[o,a])=>{const s=Gt(o);if(!s)return n;const p=Or(e,s);return ct([s],n),n[a]=p,n},{}):{}}function Mr(t){return ut(t)&&typeof t.value=="string"}function rt(t){return t===void 0?M():Mr(t)?t:M(t,{})}function M(t,e){return{value:t??"",params:Fr(t,e)}}function Ve(t,e){ct(t.params,e.params);const r=`${t.value}${e.value}`;return M(r,{...t.params,...e.params})}function Wr(t,e){return Ve(t,e)}function Gr(t,e){return zr(t,e),{...t,...e}}function zr(t,e){const r=Object.keys(t).find(n=>n in e&&typeof e[n]!=typeof t[n]);if(r)throw new de(r)}function Qr(t,e){ct(t.params,e.params);const r=[t.value,e.value].filter(F).join("&");return M(r,{...t.params,...e.params})}function Kr(t,e){return ct(t,e),{...t,...e}}function Be(t){return"parent"in t&&!!t.parent}function Ce(t){return"component"in t&&!!t.component}function xe(t){return"props"in t&&typeof t.props=="function"}function je(t){return"components"in t&&!!t.components}function Oe(t){return"props"in t&&typeof t.props=="object"}function Ze(t,e){return{...e,path:Ve(t.path,e.path),query:Qr(t.query,e.query),meta:Gr(t.meta,e.meta),state:Kr(t.state,e.state),hash:Wr(t.hash,e.hash),matches:[...t.matches,e.matched],host:t.host,depth:t.depth+1}}function zt(){return typeof window<"u"&&typeof window.document<"u"}function Qt(t){const e=new URLSearchParams(t);return{get:(...r)=>e.get(...r),getAll:(...r)=>e.getAll(...r),set:(...r)=>{e.set(...r)},append:(...r)=>{e.append(...r)},delete:(...r)=>{e.delete(...r)},toString:(...r)=>e.toString(...r),forEach:(...r)=>{e.forEach(...r)},entries:(...r)=>e.entries(...r),keys:(...r)=>e.keys(...r),values:(...r)=>e.values(...r),has:(...r)=>e.has(...r),size:e.size,sort:()=>{e.sort()},[Symbol.iterator]:()=>e[Symbol.iterator]()}}function Kt(){let t=0;return()=>(++t).toString()}const Yr=Kt()();function Xr(t){return t===Yr}const Yt=Kt();function $e(t){return t===void 0?"":t}function nt(t,e){const r=Yt(),n=$e(t.name),o=rt(t.path),a=rt(t.query),s=rt(t.hash),p=t.meta??{},h=t.state??{},c=i.markRaw({id:r,meta:p,state:h,...t,props:e}),g={id:r,matched:c,matches:[c],name:n,path:o,query:a,hash:s,meta:p,state:h,depth:1,host:M(),prefetch:t.prefetch},P=Be(t)?Ze(t.parent,g):g;return ct(P.path.params,P.query.params,P.hash.params),P}const Nt={template:"<div>This is component</div>"},Xt=nt({name:"parentA",path:"/parentA/[paramA]"}),He=nt({parent:Xt,name:"parentA.childA",path:"/childA/[?paramB]"}),tn=nt({parent:Xt,name:"parentA.childB",path:"/childB/[paramD]",component:Nt}),en=nt({parent:He,name:"parentA.childA.grandChildA",path:"/[paramC]",component:Nt});nt({name:"parentB",path:"/parentB",component:Nt}),nt({name:"parentC",path:"/",component:Nt});const rn="lazy",nn={components:!0,props:!1};function Vt(t){return["eager","lazy","intent"].includes(t)}function _e({routerPrefetch:t,routePrefetch:e,linkPrefetch:r},n){const o=te(r,n),a=te(e,n),s=te(t,n),p=[o,a,s,nn[n],rn].reduce((h,c)=>Vt(h)?h:h===!0&&Vt(c)?c:h===!0&&!Vt(c)?h:h===void 0?c:h,void 0);return Vt(p)?p:!1}function te(t,e){return ut(t)?t[e]:t}class qe extends Error{constructor(){super("Uncaught CallbackContextAbortError");G(this,"response");this.response={status:"ABORT"}}}class ht extends Error{constructor(r){super("Uncaught CallbackContextPushError");G(this,"response");this.response={status:"PUSH",to:r}}}class Bt extends Error{constructor(r){super("Uncaught CallbackContextRejectionError");G(this,"response");this.response={status:"REJECT",type:r}}}function Ie(){return{reject:o=>{throw new Bt(o)},push:(...o)=>{throw new ht(o)},replace:(o,a,s)=>{if(Z(o)){const c=a??{};throw new ht([o,{...c,replace:!0}])}const p=a,h=s??{};throw new ht([o,p,{...h,replace:!0}])},abort:()=>{throw new qe}}}function De(t){try{const e=t();return qt(e)?e.catch(r=>r):e}catch(e){return e}}function Je(){let t=null;function e(n){t=n}function r(n){return t?t.runWithContext(n):n()}return{setVueApp:e,runWithContext:r}}const Te=Symbol();function on(){const{setVueApp:t,runWithContext:e}=Je(),r=i.reactive(new Map),{push:n,replace:o,reject:a}=Ie(),s=(m,d,w)=>d.matches.filter(l=>_e({...w,routePrefetch:l.prefetch},"props")===m).flatMap(l=>k(l)).reduce((l,{id:u,name:S,props:L})=>{if(!L)return l;const U=C(u,S,d),R=e(()=>De(()=>L(d,{push:n,replace:o,reject:a,parent:g(d,!0)})));return l[U]=R,l},{}),p=m=>{Object.entries(m).forEach(([d,w])=>{r.set(d,w)})},h=async m=>{const d=m.matches.flatMap(k),w=[],l=[];for(const{id:u,name:S,props:L}of d){if(!L)continue;const U=C(u,S,m);if(w.push(U),!r.has(U)){const R=e(()=>De(()=>L(m,{push:n,replace:o,reject:a,parent:g(m)})));r.set(U,R)}l.push((async()=>{const R=await r.get(U);if(R instanceof Error)throw R})())}E(w);try{return await Promise.all(l),{status:"SUCCESS"}}catch(u){if(u instanceof ht||u instanceof Bt)return u.response;throw u}},c=(m,d,w)=>{const l=C(m,d,w);return r.get(l)};function g(m,d=!1){const w=m.matches.at(-2);if(w)return xe(w)?{name:w.name??"",get props(){return P(w,"default",m,d)}}:Oe(w)?{name:w.name??"",props:new Proxy({},{get(l,u){return typeof u!="string"?Reflect.get(l,u):P(w,u,m,d)}})}:{name:w.name??"",props:void 0}}function P(m,d,w,l=!1){const u=c(m.id,d,w);if(l&&!u){const S=m.name??"unknown",L=w.name||"unknown";console.warn(`
2
2
  Unable to access parent props "${d}" from route "${S}" while prefetching props for route "${L}".
3
3
  This may occur if the parent route's props were not also prefetched.
4
- `)}return u}function C(y,d,w){return[y,d,w.id,JSON.stringify(w.params)].join("-")}function k(y){return xe(y)?[{id:y.id,name:"default",props:y.props}]:Oe(y)?Object.entries(y.props).map(([d,w])=>({id:y.id,name:d,props:w})):[]}function E(y){for(const d of r.keys())y.includes(d)||r.delete(d)}return{getPrefetchProps:s,setPrefetchProps:p,getProps:c,setProps:h,setVueApp:t}}function Fe(){const t=i.inject(Te);if(!t)throw new X;return t}const an=i.defineAsyncComponent(()=>new Promise(t=>{t({default:{template:"foo"}})}));function Me(t){return t.name===an.name&&"__asyncLoader"in t}const We=Symbol("visibilityObserver");function sn(t){const e=i.inject(We);if(!e)throw new X;return i.watch(t,(n,o)=>{n&&e.observe(n),o&&e.unobserve(o)},{immediate:!0}),i.onUnmounted(()=>{t.value&&e.unobserve(t.value)}),{isElementVisible:i.computed(()=>t.value?e.isElementVisible(t.value):!1)}}function Ge(t,e,r){i.watch(t,(n,o)=>{n&&n.addEventListener(e,r),o&&o.removeEventListener(e,r)},{immediate:!0}),i.onUnmounted(()=>{t.value&&t.value.removeEventListener(e,r)})}function cn(t){const e=new Map,r=i.ref(),{getPrefetchProps:n,setPrefetchProps:o}=Fe(),{isElementVisible:a}=sn(r),s=()=>{const c=Array.from(e.values()).reduce((g,P)=>(Object.assign(g,P),g),{});o(c)};i.watch(()=>i.toValue(t),({route:c,...g})=>{e.clear(),c&&h("eager",c,g)},{immediate:!0}),i.watch(a,c=>{const{route:g,...P}=i.toValue(t);!g||!c||h("lazy",g,P)},{immediate:!0}),Ge(r,"focusin",p),Ge(r,"mouseover",p);function p(){const{route:c,...g}=i.toValue(t);c&&h("intent",c,g)}function h(c,g,P){un(c,g,P),e.has(c)||e.set(c,n(c,g,P))}return{element:r,commit:s}}function un(t,e,r){e.matches.forEach(n=>{_e({...r,routePrefetch:n.prefetch},"components")===t&&(Ce(n)&&Me(n.component)&&n.component.__asyncLoader(),je(n)&&Object.values(n.components).forEach(a=>{Me(a)&&a.__asyncLoader()}))})}const ze=Symbol("isRouterRouteSymbol");function fn(t){return typeof t=="object"&&t!==null&&ze in t}function ln(t,e){function r(d,w,l){if(typeof d=="object"){const S={...t.params,...d};return e(t.name,S,w)}const u={...t.params,[d]:w};return e(t.name,u,l)}const n=(...d)=>{const w=new URLSearchParams(t.query);w.set(...d),r({},{query:w})},o=(...d)=>{const w=new URLSearchParams(t.query);w.append(...d),r({},{query:w})},a=(...d)=>{const w=new URLSearchParams(t.query);w.delete(...d),r({},{query:w})},{id:s,matched:p,matches:h,name:c,hash:g,href:P}=i.toRefs(t),C=i.computed({get(){return new Proxy(t.params,{set(d,w,l){return r(w,l),!0}})},set(d){r(d)}}),k=i.computed({get(){return new Proxy(t.query,{get(d,w,l){switch(w){case"append":return o;case"set":return n;case"delete":return a;default:return Reflect.get(d,w,l)}}})},set(d){r({},{query:d})}}),E=i.computed({get(){return new Proxy(t.state,{set(d,w,l){return r({},{state:{...t.state,[w]:l}}),!0}})},set(d){r({},{state:d})}});return i.reactive({id:s,matched:p,matches:h,state:E,query:k,hash:g,params:C,name:c,href:P,update:r,[ze]:!0})}function ee(t,e,{exact:r}={}){return fn(t)?e===void 0?!0:r?t.matched.name===e:t.matches.map(n=>n.name).includes(e):!1}function re(...t){const e=new URLSearchParams;for(const r of t){const n=new URLSearchParams(r);for(const[o,a]of n.entries())e.append(o,a)}return e}function Qe(t,e={},r={}){const n=St(),o=i.computed(()=>{const E=i.toValue(t);return typeof E!="string"?E:Z(E)?n.find(E,i.toValue(r)):n.resolve(E,i.toValue(e),i.toValue(r))}),a=i.computed(()=>{if(o.value)return o.value.href;const E=i.toValue(t);if(Z(E))return E;console.error(new Error("Failed to resolve route in RouterLink."))}),s=i.computed(()=>ee(n.route)&&n.route.matches.some(E=>{var y;return E.id===((y=o.value)==null?void 0:y.id)})),p=i.computed(()=>{var E;return n.route.id===((E=o.value)==null?void 0:E.id)}),h=i.computed(()=>!!a.value&&n.isExternal(a.value)),c=i.computed(()=>{const E=i.toValue(t);return typeof E!="string"||Z(E)?i.toValue(e):i.toValue(r)}),{element:g,commit:P}=cn(()=>({route:o.value,routerPrefetch:n.prefetch,linkPrefetch:c.value.prefetch})),C=E=>{P();const y={replace:(E==null?void 0:E.replace)??c.value.replace,query:re(c.value.query,E==null?void 0:E.query),hash:(E==null?void 0:E.hash)??c.value.hash,state:{...c.value.state,...E==null?void 0:E.state}},d=i.toValue(t);return Z(d)||typeof d=="object"?n.push(d,y):n.push(d,i.toValue(e),y)};return{element:g,route:o,href:a,isMatch:s,isExactMatch:p,isExternal:h,push:C,replace:E=>C({...E,replace:!0})}}const pn=["href"],Ke=i.defineComponent({__name:"routerLink",props:{to:{},prefetch:{type:[Boolean,String,Object],default:void 0},query:{},hash:{},replace:{type:Boolean},state:{}},setup(t){const e=t,r=St(),n=i.computed(()=>C(e.to)),o=i.computed(()=>k(e.to)),a=i.computed(()=>{const{to:y,...d}=e;return d}),{element:s,isMatch:p,isExactMatch:h,isExternal:c,push:g}=Qe(()=>typeof e.to=="function"?e.to(r.resolve):e.to,a),P=i.computed(()=>({"router-link--match":p.value,"router-link--exact-match":h.value}));function C(y){if(typeof y=="function"){const d=y(r.resolve);return C(d)}return Z(y)?r.find(y):y}function k(y){if(typeof y=="function"){const d=y(r.resolve);return k(d)}return Z(y)?y:y==null?void 0:y.href}function E(y){y.preventDefault(),g()}return(y,d)=>(i.openBlock(),i.createElementBlock("a",{ref_key:"element",ref:s,href:o.value,class:i.normalizeClass(["router-link",P.value]),onClick:E},[i.renderSlot(y.$slots,"default",i.normalizeProps(i.guardReactiveProps({route:n.value,isMatch:i.unref(p),isExactMatch:i.unref(h),isExternal:i.unref(c)})))],10,pn))}}),Ye=Symbol();function dn(){const t=i.inject(Ye);if(!t)throw new X;return t}function ne(t,e){const r=St();function n(){if(!t)return;if(!ee(r.route,t,e))throw new he(t,r.route.name)}return i.watch(r.route,n,{immediate:!0,deep:!0}),r.route}const Xe=Symbol();function oe(){return i.inject(Xe,0)}function hn(t,e,r){return i.defineComponent({name:"PropsWrapper",expose:[],setup(){const n=i.getCurrentInstance(),o=Fe(),a=ne();return()=>{const s=o.getProps(t.id,e,a);return s instanceof Error?"":qt(s)?n!=null&&n.suspense?i.h(yn,{component:r,props:s}):i.h(mn,{component:r,props:s}):i.h(r,s)}}})}const mn=i.defineComponent(t=>{const e=i.ref();return i.watch(()=>t.props,async r=>{e.value=await r},{immediate:!0,deep:!0}),()=>e.value instanceof Error?"":e.value?i.h(t.component,e.value):""},{props:["component","props"]}),yn=i.defineComponent(async t=>{const e=i.ref();return e.value=await t.props,i.watch(()=>e.value,async r=>{e.value=await r},{deep:!0}),()=>e.value instanceof Error?"":e.value?i.h(t.component,e.value):""},{props:["component","props"]}),tr=Symbol();function gn(){const t=new Map;return{getRouteComponents:r=>{const n=t.get(r.id);if(n)return n;const o=Rn(r);return t.set(r.id,o),o}}}function Rn(t){return je(t)?er(t,t.components):Ce(t)?er(t,{default:t.component}):{default:ae}}function er(t,e){return Object.fromEntries(Object.entries(e).map(([r,n])=>[r,hn(t,r,n)]))}function wn(){const t=i.inject(tr);if(!t)throw new X;return t}const ae=i.defineComponent({__name:"routerView",props:{name:{default:"default"}},setup(t){const e=ne(),r=dn(),n=oe(),{getRouteComponents:o}=wn();i.provide(Xe,n+1);const a=i.computed(()=>{if(r.value)return r.value.component;const s=e.matches.at(n);return s?o(s)[t.name]:null});return(s,p)=>a.value?i.renderSlot(s.$slots,"default",i.normalizeProps(i.mergeProps({key:0},{route:i.unref(e),component:a.value,rejection:i.unref(r)})),()=>[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(a.value)))]):i.createCommentVNode("",!0)}});class ot{constructor(){G(this,"onBeforeRouteEnter",new Set);G(this,"onBeforeRouteUpdate",new Set);G(this,"onBeforeRouteLeave",new Set);G(this,"onAfterRouteEnter",new Set);G(this,"onAfterRouteUpdate",new Set);G(this,"onAfterRouteLeave",new Set)}}const Rt=(t,e,r)=>{var a,s;const n=t.matches,o=(e==null?void 0:e.matches)??[];return((a=n.at(r))==null?void 0:a.id)!==((s=o.at(r))==null?void 0:s.id)},wt=(t,e,r)=>{var a,s;const n=t.matches,o=(e==null?void 0:e.matches)??[];return((a=n.at(r))==null?void 0:a.id)!==((s=o.at(r))==null?void 0:s.id)},Et=(t,e,r)=>{var n,o;return((n=t.matches.at(r))==null?void 0:n.id)===((o=e==null?void 0:e.matches.at(r))==null?void 0:o.id)};function rr(t){switch(t){case"onBeforeRouteEnter":case"onAfterRouteEnter":return Rt;case"onBeforeRouteUpdate":case"onAfterRouteUpdate":return Et;case"onBeforeRouteLeave":case"onAfterRouteLeave":return wt;default:throw new Error(`Switch is not exhaustive for lifecycle: ${t}`)}}function En(t,e){const r=new ot;return t.matches.forEach((n,o)=>{n.onBeforeRouteEnter&&Rt(t,e,o)&&it(n.onBeforeRouteEnter).forEach(a=>r.onBeforeRouteEnter.add(a)),n.onBeforeRouteUpdate&&Et(t,e,o)&&it(n.onBeforeRouteUpdate).forEach(a=>r.onBeforeRouteUpdate.add(a))}),e==null||e.matches.forEach((n,o)=>{n.onBeforeRouteLeave&&wt(t,e,o)&&it(n.onBeforeRouteLeave).forEach(a=>r.onBeforeRouteLeave.add(a))}),r}function bn(t,e){const r=new ot;return t.matches.forEach((n,o)=>{n.onAfterRouteEnter&&Rt(t,e,o)&&it(n.onAfterRouteEnter).forEach(a=>r.onAfterRouteEnter.add(a)),n.onAfterRouteUpdate&&Et(t,e,o)&&it(n.onAfterRouteUpdate).forEach(a=>r.onAfterRouteUpdate.add(a))}),e==null||e.matches.forEach((n,o)=>{n.onAfterRouteLeave&&wt(t,e,o)&&it(n.onAfterRouteLeave).forEach(a=>r.onAfterRouteLeave.add(a))}),r}function Sn(t,e,r){const n=new ot;return t.matches.forEach((o,a)=>{Rt(t,e,a)&&r.onBeforeRouteEnter.forEach(s=>n.onBeforeRouteEnter.add(s)),Et(t,e,a)&&r.onBeforeRouteUpdate.forEach(s=>n.onBeforeRouteUpdate.add(s))}),e==null||e.matches.forEach((o,a)=>{wt(t,e,a)&&r.onBeforeRouteLeave.forEach(s=>n.onBeforeRouteLeave.add(s))}),n}function Pn(t,e,r){const n=new ot;return t.matches.forEach((o,a)=>{Rt(t,e,a)&&r.onAfterRouteEnter.forEach(s=>n.onAfterRouteEnter.add(s)),Et(t,e,a)&&r.onAfterRouteUpdate.forEach(s=>n.onAfterRouteUpdate.add(s))}),e==null||e.matches.forEach((o,a)=>{wt(t,e,a)&&r.onAfterRouteLeave.forEach(s=>n.onAfterRouteLeave.add(s))}),n}const nr=Symbol();function An(){const{setVueApp:t,runWithContext:e}=Je(),r={global:new ot,component:new ot},{reject:n,push:o,replace:a,abort:s}=Ie(),p=l=>(r.global.onBeforeRouteEnter.add(l),()=>r.global.onBeforeRouteEnter.delete(l)),h=l=>(r.global.onBeforeRouteUpdate.add(l),()=>r.global.onBeforeRouteUpdate.delete(l)),c=l=>(r.global.onBeforeRouteLeave.add(l),()=>r.global.onBeforeRouteLeave.delete(l)),g=l=>(r.global.onAfterRouteEnter.add(l),()=>r.global.onAfterRouteEnter.delete(l)),P=l=>(r.global.onAfterRouteUpdate.add(l),()=>r.global.onAfterRouteUpdate.delete(l)),C=l=>(r.global.onAfterRouteLeave.add(l),()=>r.global.onAfterRouteLeave.delete(l));async function k({to:l,from:u}){const{global:S,component:L}=r,U=En(l,u),R=Sn(l,u,S),f=[...R.onBeforeRouteEnter,...U.onBeforeRouteEnter,...R.onBeforeRouteUpdate,...U.onBeforeRouteUpdate,...L.onBeforeRouteUpdate,...R.onBeforeRouteLeave,...U.onBeforeRouteLeave,...L.onBeforeRouteLeave];try{const m=f.map(N=>e(()=>N(l,{from:u,reject:n,push:o,replace:a,abort:s})));await Promise.all(m)}catch(m){if(m instanceof dt||m instanceof Bt||m instanceof qe)return m.response;throw m}return{status:"SUCCESS"}}async function E({to:l,from:u}){const{global:S,component:L}=r,U=bn(l,u),R=Pn(l,u,S),f=[...L.onAfterRouteLeave,...U.onAfterRouteLeave,...R.onAfterRouteLeave,...L.onAfterRouteUpdate,...U.onAfterRouteUpdate,...R.onAfterRouteUpdate,...L.onAfterRouteEnter,...U.onAfterRouteEnter,...R.onAfterRouteEnter];try{const m=f.map(N=>e(()=>N(l,{from:u,reject:n,push:o,replace:a})));await Promise.all(m)}catch(m){if(m instanceof dt||m instanceof Bt)return m.response;throw m}return{status:"SUCCESS"}}return{runBeforeRouteHooks:k,runAfterRouteHooks:E,addComponentBeforeRouteHook:({lifecycle:l,depth:u,hook:S})=>{const L=rr(l),U=r.component[l],R=(f,m)=>{if(L(f,m.from,u))return S(f,m)};return U.add(R),()=>U.delete(R)},addComponentAfterRouteHook:({lifecycle:l,depth:u,hook:S})=>{const L=rr(l),U=r.component[l],R=(f,m)=>{if(L(f,m.from,u))return S(f,m)};return U.add(R),()=>U.delete(R)},addGlobalRouteHooks:l=>{l.onBeforeRouteEnter.forEach(u=>p(u)),l.onBeforeRouteUpdate.forEach(u=>h(u)),l.onBeforeRouteLeave.forEach(u=>c(u)),l.onAfterRouteEnter.forEach(u=>g(u)),l.onAfterRouteUpdate.forEach(u=>P(u)),l.onAfterRouteLeave.forEach(u=>C(u))},onBeforeRouteEnter:p,onBeforeRouteUpdate:h,onBeforeRouteLeave:c,onAfterRouteEnter:g,onAfterRouteUpdate:P,onAfterRouteLeave:C,setVueApp:t}}function or(){const t=i.inject(nr);if(!t)throw new X;return t}function ar(t){return e=>{const r=oe(),o=or().addComponentBeforeRouteHook({lifecycle:t,hook:e,depth:r-1});return i.onUnmounted(o),o}}function sr(t){return e=>{const r=oe(),o=or().addComponentAfterRouteHook({lifecycle:t,hook:e,depth:r-1});return i.onUnmounted(o),o}}const vn=ar("onBeforeRouteLeave"),kn=ar("onBeforeRouteUpdate"),Un=sr("onAfterRouteLeave"),Ln=sr("onAfterRouteUpdate");function K(){return K=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},K.apply(null,arguments)}var H;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(H||(H={}));var ht=process.env.NODE_ENV!=="production"?function(t){return Object.freeze(t)}:function(t){return t};function at(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}var Ct="beforeunload",Nn="hashchange",ir="popstate";function cr(t){t===void 0&&(t={});var e=t,r=e.window,n=r===void 0?document.defaultView:r,o=n.history;function a(){var R=n.location,f=R.pathname,m=R.search,N=R.hash,B=o.state||{};return[B.idx,ht({pathname:f,search:m,hash:N,state:B.usr||null,key:B.key||"default"})]}var s=null;function p(){if(s)k.call(s),s=null;else{var R=H.Pop,f=a(),m=f[0],N=f[1];if(k.length)if(m!=null){var B=g-m;B&&(s={action:R,location:N,retry:function(){L(B*-1)}},L(B))}else process.env.NODE_ENV!=="production"&&at(!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 l(R)}}n.addEventListener(ir,p);var h=H.Pop,c=a(),g=c[0],P=c[1],C=mt(),k=mt();g==null&&(g=0,o.replaceState(K({},o.state,{idx:g}),""));function E(R){return typeof R=="string"?R:st(R)}function y(R,f){return f===void 0&&(f=null),ht(K({pathname:P.pathname,hash:"",search:""},typeof R=="string"?bt(R):R,{state:f,key:jt()}))}function d(R,f){return[{usr:R.state,key:R.key,idx:f},E(R)]}function w(R,f,m){return!k.length||(k.call({action:R,location:f,retry:m}),!1)}function l(R){h=R;var f=a();g=f[0],P=f[1],C.call({action:h,location:P})}function u(R,f){var m=H.Push,N=y(R,f);function B(){u(R,f)}if(w(m,N,B)){var O=d(N,g+1),$=O[0],_=O[1];try{o.pushState($,"",_)}catch{n.location.assign(_)}l(m)}}function S(R,f){var m=H.Replace,N=y(R,f);function B(){S(R,f)}if(w(m,N,B)){var O=d(N,g),$=O[0],_=O[1];o.replaceState($,"",_),l(m)}}function L(R){o.go(R)}var U={get action(){return h},get location(){return P},createHref:E,push:u,replace:S,go:L,back:function(){L(-1)},forward:function(){L(1)},listen:function(f){return C.push(f)},block:function(f){var m=k.push(f);return k.length===1&&n.addEventListener(Ct,xt),function(){m(),k.length||n.removeEventListener(Ct,xt)}}};return U}function Vn(t){t===void 0&&(t={});var e=t,r=e.window,n=r===void 0?document.defaultView:r,o=n.history;function a(){var f=bt(n.location.hash.substr(1)),m=f.pathname,N=m===void 0?"/":m,B=f.search,O=B===void 0?"":B,$=f.hash,_=$===void 0?"":$,D=o.state||{};return[D.idx,ht({pathname:N,search:O,hash:_,state:D.usr||null,key:D.key||"default"})]}var s=null;function p(){if(s)k.call(s),s=null;else{var f=H.Pop,m=a(),N=m[0],B=m[1];if(k.length)if(N!=null){var O=g-N;O&&(s={action:f,location:B,retry:function(){U(O*-1)}},U(O))}else process.env.NODE_ENV!=="production"&&at(!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 u(f)}}n.addEventListener(ir,p),n.addEventListener(Nn,function(){var f=a(),m=f[1];st(m)!==st(P)&&p()});var h=H.Pop,c=a(),g=c[0],P=c[1],C=mt(),k=mt();g==null&&(g=0,o.replaceState(K({},o.state,{idx:g}),""));function E(){var f=document.querySelector("base"),m="";if(f&&f.getAttribute("href")){var N=n.location.href,B=N.indexOf("#");m=B===-1?N:N.slice(0,B)}return m}function y(f){return E()+"#"+(typeof f=="string"?f:st(f))}function d(f,m){return m===void 0&&(m=null),ht(K({pathname:P.pathname,hash:"",search:""},typeof f=="string"?bt(f):f,{state:m,key:jt()}))}function w(f,m){return[{usr:f.state,key:f.key,idx:m},y(f)]}function l(f,m,N){return!k.length||(k.call({action:f,location:m,retry:N}),!1)}function u(f){h=f;var m=a();g=m[0],P=m[1],C.call({action:h,location:P})}function S(f,m){var N=H.Push,B=d(f,m);function O(){S(f,m)}if(process.env.NODE_ENV!=="production"&&at(B.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.push("+JSON.stringify(f)+")"),l(N,B,O)){var $=w(B,g+1),_=$[0],D=$[1];try{o.pushState(_,"",D)}catch{n.location.assign(D)}u(N)}}function L(f,m){var N=H.Replace,B=d(f,m);function O(){L(f,m)}if(process.env.NODE_ENV!=="production"&&at(B.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.replace("+JSON.stringify(f)+")"),l(N,B,O)){var $=w(B,g),_=$[0],D=$[1];o.replaceState(_,"",D),u(N)}}function U(f){o.go(f)}var R={get action(){return h},get location(){return P},createHref:y,push:S,replace:L,go:U,back:function(){U(-1)},forward:function(){U(1)},listen:function(m){return C.push(m)},block:function(m){var N=k.push(m);return k.length===1&&n.addEventListener(Ct,xt),function(){N(),k.length||n.removeEventListener(Ct,xt)}}};return R}function ur(t){t===void 0&&(t={});var e=t,r=e.initialEntries,n=r===void 0?["/"]:r,o=e.initialIndex,a=n.map(function(u){var S=ht(K({pathname:"/",search:"",hash:"",state:null,key:jt()},typeof u=="string"?bt(u):u));return process.env.NODE_ENV!=="production"&&at(S.pathname.charAt(0)==="/","Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(u)+")"),S}),s=fr(o??a.length-1,0,a.length-1),p=H.Pop,h=a[s],c=mt(),g=mt();function P(u){return typeof u=="string"?u:st(u)}function C(u,S){return S===void 0&&(S=null),ht(K({pathname:h.pathname,search:"",hash:""},typeof u=="string"?bt(u):u,{state:S,key:jt()}))}function k(u,S,L){return!g.length||(g.call({action:u,location:S,retry:L}),!1)}function E(u,S){p=u,h=S,c.call({action:p,location:h})}function y(u,S){var L=H.Push,U=C(u,S);function R(){y(u,S)}process.env.NODE_ENV!=="production"&&at(h.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.push("+JSON.stringify(u)+")"),k(L,U,R)&&(s+=1,a.splice(s,a.length,U),E(L,U))}function d(u,S){var L=H.Replace,U=C(u,S);function R(){d(u,S)}process.env.NODE_ENV!=="production"&&at(h.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.replace("+JSON.stringify(u)+")"),k(L,U,R)&&(a[s]=U,E(L,U))}function w(u){var S=fr(s+u,0,a.length-1),L=H.Pop,U=a[S];function R(){w(u)}k(L,U,R)&&(s=S,E(L,U))}var l={get index(){return s},get action(){return p},get location(){return h},createHref:P,push:y,replace:d,go:w,back:function(){w(-1)},forward:function(){w(1)},listen:function(S){return c.push(S)},block:function(S){return g.push(S)}};return l}function fr(t,e,r){return Math.min(Math.max(t,e),r)}function xt(t){t.preventDefault(),t.returnValue=""}function mt(){var t=[];return{get length(){return t.length},push:function(r){return t.push(r),function(){t=t.filter(function(n){return n!==r})}},call:function(r){t.forEach(function(n){return n&&n(r)})}}}function jt(){return Math.random().toString(36).substr(2,8)}function st(t){var e=t.pathname,r=e===void 0?"/":e,n=t.search,o=n===void 0?"":n,a=t.hash,s=a===void 0?"":a;return o&&o!=="?"&&(r+=o.charAt(0)==="?"?o:"?"+o),s&&s!=="#"&&(r+=s.charAt(0)==="#"?s:"#"+s),r}function bt(t){var e={};if(t){var r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));var n=t.indexOf("?");n>=0&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}const lr=Symbol();function Bn(t,e){const r=i.reactive({...t}),n=s=>{Object.assign(r,{[lr]:!1,...s})},o=r,a=ln(o,e);return{currentRoute:o,routerRoute:a,updateRoute:n}}function q(t){return!t.startsWith("http")?xn(t):Cn(t)}function Cn(t){const{protocol:e,host:r,pathname:n,search:o,searchParams:a,hash:s}=new URL(t,t);return{protocol:e,host:r,pathname:n,search:o,searchParams:a,hash:s}}function xn(t){const{pathname:e,search:r,searchParams:n,hash:o}=new URL(t,"https://localhost");return{pathname:e,search:r,searchParams:n,hash:o}}function jn(t){return e=>{const{host:r}=q(e);return!(r===void 0||r===t)}}function On({mode:t,listener:e}){const r=Zn(t),n=(h,c)=>{if(c!=null&&c.replace){r.replace(h,c.state);return}r.push(h,c==null?void 0:c.state)},o=()=>{const h=st(r.location);r.replace(h)};let a;return{...r,update:n,refresh:o,startListening:()=>{a==null||a(),a=r.listen(e)},stopListening:()=>{a==null||a()}}}function Zn(t="auto"){switch(t){case"auto":return zt()?cr():ur();case"browser":return cr();case"memory":return ur();case"hash":return Vn();default:const e=t;throw new Error(`Switch is not exhaustive for mode: ${e}`)}}function $n(t){return i.defineComponent(()=>()=>i.h("h1",t),{name:t,props:[]})}function Hn(t){const e=a=>i.markRaw(t[a]??$n(a)),r=a=>{const s=i.markRaw(e(a)),p={id:Yt(),component:s,meta:{},state:{}};return{id:p.id,matched:p,matches:[p],name:a,query:Qt(""),params:{},state:{},href:"/",hash:"",[lr]:!0}},n=a=>{if(!a){o.value=null;return}const s=e(a);o.value={type:a,component:s}},o=i.ref(null);return{setRejection:n,rejection:o,getRejectionRoute:r}}class _n extends Error{constructor(){super("initialUrl must be set if window.location is unavailable")}}function qn(t){if(t)return t;if(zt())return window.location.toString();throw new _n}function pr(t){return!!t&&typeof t=="object"}const Ot=!0;function In(t,e,r){if(pr(t)&&e in t){const n=t[e];return typeof n=="string"?tt(n,r,Ot):n}return tt(void 0,r,Ot)}function dr(t,e){const r={};for(const[n,o]of Object.entries(t)){const a=In(e,n,o);r[n]=a}return r}function Dn(t,e,r){if(pr(t)&&e in t){const n=t[e];return et(n,r,Ot)}return et(void 0,r,Ot)}const hr=(t,e)=>{const r={};for(const[n,o]of Object.entries(t)){const a=Dn(e,n,o);r[n]=a}return r};function Jn(){const t=i.reactive(new Map),e=zt()?s():null,r=p=>{t.set(p,!1),e==null||e.observe(p)},n=p=>{t.delete(p),e==null||e.unobserve(p)},o=()=>{e==null||e.disconnect()},a=p=>t.get(p)??!1;function s(){return new IntersectionObserver(p=>{p.forEach(h=>{t.set(h.target,h.isIntersecting)})})}return{observe:r,unobserve:n,disconnect:o,isElementVisible:a}}class Tn extends Error{constructor(e){super(`Route not found: "${e}"`)}}function mr(t,e,r){const n=Dr(e.value,r),o=Ue(n),[a]=Ne(t,new RegExp(o,"g"));return a}function yr(t,e,r,n){const o=Mt(e,r),a=et(n,e.params[r],o);return t.replace(Le(r),a)}function gr({protocol:t,host:e,pathname:r,search:n,searchParams:o,hash:a}){const s=new URL("https://localhost");t&&(s.protocol=t),e&&(s.host=e),r&&(s.pathname=r),o?s.search=new URLSearchParams(o).toString():n&&(s.search=n),a&&(s.hash=a);const p=s.toString().replace(/^https:\/\/localhost\/*/,"/");return Zt(p)}function Fn(t,e={}){const{params:r={},query:n}=e,o=Wn(t.query,r),a=re(o,n),s=Rr(t.path,r),p=t.hash.value?Rr(t.hash,r):e.hash,h=Mn(t.host,r),{protocol:c,host:g}=q(h);return gr({protocol:c,host:g,pathname:s,searchParams:a,hash:p})}function Mn(t,e){const r=t.value&&!t.value.startsWith("http")?`https://${t.value}`:t.value;return Object.keys(t.params).reduce((n,o)=>yr(n,t,o,e[o]),r)}function Rr(t,e){return Object.keys(t.params).reduce((r,n)=>yr(r,t,n,e[n]),t.value)}function Wn(t,e){const r=new URLSearchParams(t.value);if(!t.value)return r;for(const[n,o]of Array.from(r.entries())){const a=Gt(o);if(!a)continue;const p=Wt(o),h=et(e[a],t.params[a],p),c=e[a]===void 0&&h==="";p&&c?r.delete(n,o):r.set(n,h)}return r}const Gn=(t,e)=>{try{se(t,e)}catch{return!1}return!0},se=(t,e)=>{const{protocol:r,host:n,pathname:o,search:a,hash:s}=q(e);return{...ie(t.host,`${r}//${n}`),...ie(t.path,o),...zn(t.query,a),...ie(t.hash,s)}};function ie(t,e){const r={},n=decodeURIComponent(e);for(const[o,a]of Object.entries(t.params)){const s=mr(n,t,o),p=Mt(t,o),h=tt(s,a,p);r[o]=h}return r}function zn(t,e){const r={},n=new URLSearchParams(t.value),o=new URLSearchParams(e);for(const[a,s]of Array.from(n.entries())){const p=Gt(s);if(!p)continue;const c=Wt(s),g=o.get(a)??void 0,P=tt(g,t.params[p],c);r[p]=P}return r}function Qn(t,e={},r={}){const n=Fn(t,{params:e,query:r.query,hash:r.hash}),{search:o,hash:a}=q(n);return{id:t.id,matched:t.matched,matches:t.matches,name:t.name,query:Qt(o),params:se(t,n),state:dr(t.state,r.state),hash:a,href:n}}const Kn=t=>"name"in t.matched&&!!t.matched.name,Yn=(t,e)=>{const{pathname:r}=q(e);return qr(t).test(r)},Xn=(t,e)=>{const{search:r}=q(e);return Ir(t).every(o=>o.test(r))},ce=(t,e)=>{const{hash:r}=q(e),{value:n}=t.hash;return F(n)?`#${n.replace(/^#*/,"")}`.toLowerCase()===r.toLowerCase():!0};function to(t){const{searchParams:e,pathname:r}=q(t),n=-1,o=1;return(a,s)=>{const p=Er(a,e),h=wr(a,r),c=Er(s,e),g=wr(s,r);return a.depth>s.depth?n:a.depth<s.depth?o:p+h>c+g?n:p+h<c+g?o:ce(a,t)?n:ce(s,t)?o:0}}function wr(t,e){const r=Object.keys(t.path.params).filter(o=>Mt(t.path,o)).map(o=>o),n=r.filter(o=>mr(e,t.path,o)===void 0);return r.length-n.length}function Er(t,e){const r=new URLSearchParams(e),n=new URLSearchParams(t.query.value),o=Array.from(n.keys()),a=o.filter(s=>!r.has(s));return o.length-a.length}const eo=[Kn,Yn,Xn,ce,Gn];function ro(t,e){const r=to(e);return t.filter(n=>eo.every(o=>o(n,e))).sort(r)}function no(t,e,r){const n=ro(t,e);if(!n.length)return;const[o]=n,{searchParams:a,hash:s}=q(e);return{id:o.id,matched:o.matched,matches:o.matches,name:o.name,query:Qt(a),params:se(o,e),state:dr(o.state,r),hash:s,href:Zt(e)}}function br(t,e){const r=typeof t=="string"?q(t):t,n=typeof e=="string"?q(e):e,o=r.searchParams??new URLSearchParams(r.search),a=n.searchParams??new URLSearchParams(n.search);return gr({protocol:F(n.protocol)?n.protocol:r.protocol,host:F(n.host)?n.host:r.host,pathname:F(n.pathname)?n.pathname:r.pathname,searchParams:re(a,o),hash:F(n.hash)?n.hash:r.hash})}function oo(t,e){return F(e)?t.map(r=>{const n=`${e}${r.path.value}`;return{...r,path:M(n,r.path.params)}}):t}class ao 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 so(t){const e=t.map(({name:r})=>r);for(const r of e)if(ye(e,r)>1)throw new ao(r)}function io(t,e=[],r){const n=[...t,...e.map(o=>o.routes)].flat();return so(n),oo(n,r)}function co(t={},e=[]){const r=new ot;return yt("onBeforeRouteEnter",t,e).forEach(n=>r.onBeforeRouteEnter.add(n)),yt("onBeforeRouteUpdate",t,e).forEach(n=>r.onBeforeRouteUpdate.add(n)),yt("onBeforeRouteLeave",t,e).forEach(n=>r.onBeforeRouteLeave.add(n)),yt("onAfterRouteEnter",t,e).forEach(n=>r.onAfterRouteEnter.add(n)),yt("onAfterRouteUpdate",t,e).forEach(n=>r.onAfterRouteUpdate.add(n)),yt("onAfterRouteLeave",t,e).forEach(n=>r.onAfterRouteLeave.add(n)),r}function yt(t,e,r){return[e[t],...r.map(o=>o[t])].flat().filter(o=>o!==void 0)}function uo(t,e,r=[]){const n=io(t,r,e==null?void 0:e.base),o=An();o.addGlobalRouteHooks(co(e,r));const a=Kt(),s=on(),p=gn(),h=Jn(),c=On({mode:e==null?void 0:e.historyMode,listener:({location:A})=>{const x=st(A);P(x,{state:A.state,replace:!0})}});function g(A,x={}){return no(n,A,x.state)}async function P(A,x={}){const Q=a();if(c.stopListening(),N(A)){c.update(A,x);return}const J=g(A,x)??l("NotFound"),I=Pr(Q),Y=await o.runBeforeRouteHooks({to:J,from:I});switch(Y.status){case"ABORT":return;case"PUSH":c.update(A,x),await k(...Y.to);return;case"REJECT":c.update(A,x),d(Y.type);break;case"SUCCESS":c.update(A,x),d(null);break;default:throw new Error(`Switch is not exhaustive for before hook response status: ${JSON.stringify(Y)}`)}const ue=Q;s.setProps(J).then(T=>{if(ue===Q)switch(T.status){case"SUCCESS":break;case"PUSH":k(...T.to);break;case"REJECT":d(T.type);break;default:const fe=T;throw new Error(`Switch is not exhaustive for prop store response status: ${JSON.stringify(fe)}`)}}),U(J);const W=await o.runAfterRouteHooks({to:J,from:I});switch(W.status){case"PUSH":await k(...W.to);break;case"REJECT":d(W.type);break;case"SUCCESS":break;default:const T=W;throw new Error(`Switch is not exhaustive for after hook response status: ${JSON.stringify(T)}`)}c.startListening()}const C=(A,x={},Q={})=>{const J=n.find(I=>I.name===A);if(!J)throw new Tn(String(A));return Qn(J,x,Q)},k=(A,x,Q)=>{if(Z(A)){const W={...x},T=br(A,{searchParams:W.query,hash:W.hash});return P(T,W)}if(typeof A=="string"){const{replace:W,...T}={...Q},fe={...x},le=C(A,fe,T),bo=hr({...le.matched.state},{...le.state,...T.state});return P(le.href,{replace:W,state:bo})}const{replace:J,...I}={...x},Y=hr({...A.matched.state},{...A.state,...I.state}),ue=br(A.href,{searchParams:I.query,hash:I.hash});return P(ue,{replace:J,state:Y})},E=(A,x,Q)=>{if(Z(A)){const I={...x,replace:!0};return k(A,I)}if(typeof A=="string"){const I={...Q,replace:!0},Y={...x};return k(A,Y,I)}const J={...x,replace:!0};return k(A,J)},y=A=>{d(A)},{setRejection:d,rejection:w,getRejectionRoute:l}=Hn({...r.reduce((A,x)=>({...A,...x.rejections}),{}),...e==null?void 0:e.rejections}),u=l("NotFound"),{currentRoute:S,routerRoute:L,updateRoute:U}=Bn(u,k),R=qn(e==null?void 0:e.initialUrl),f=c.location.state,{host:m}=q(R),N=jn(m);let B=!1;const{promise:O,resolve:$}=Promise.withResolvers();async function _(){if(B)return O;Vr(n)&&await Br(),B=!0,await P(R,{replace:!0,state:f}),c.startListening(),$()}function D(){c.stopListening()}function Pr(A){return Xr(A)?null:{...S}}function Eo(A){o.setVueApp(A),s.setVueApp(A),A.component("RouterView",ae),A.component("RouterLink",Ke),A.provide(Ye,w),A.provide(nr,o),A.provide(Te,s),A.provide(tr,p),A.provide(We,h),A.provide(me,Ar),_()}const Ar={route:L,resolve:C,find:g,push:k,replace:E,reject:y,refresh:c.refresh,forward:c.forward,back:c.back,go:c.go,install:Eo,isExternal:N,onBeforeRouteEnter:o.onBeforeRouteEnter,onBeforeRouteUpdate:o.onBeforeRouteUpdate,onBeforeRouteLeave:o.onBeforeRouteLeave,onAfterRouteEnter:o.onAfterRouteEnter,onAfterRouteUpdate:o.onAfterRouteUpdate,onAfterRouteLeave:o.onAfterRouteLeave,prefetch:e==null?void 0:e.prefetch,start:_,stop:D};return Ar}function fo(t){return{routes:t.routes??[],rejections:t.rejections??{},...t}}function Sr(t){return{get:(e,{invalid:r})=>{for(const n of t){const o=$r(e,n);if(o!==void 0)return o}throw r(`Value ${e} does not satisfy any of the possible values`)},set:(e,{invalid:r})=>{for(const n of t){const o=Hr(e,n);if(o!==void 0)return o}throw r(`Value ${e} does not satisfy any of the possible values`)}}}const lo={separator:","};function po(t,e={}){const{separator:r}={...lo,...e},n=Sr(t);return{get:(o,a)=>o.split(r).map(s=>n.get(s,a)),set:(o,a)=>{if(!Array.isArray(o))throw a.invalid("Expected an array");return o.map(s=>n.set(s,a)).join(r)}}}const ho={separator:","};function mo(t,e={}){const{separator:r}={...ho,...e};return{get:n=>{const o=n.split(r);return t.map((a,s)=>tt(o.at(s),a))},set:(n,{invalid:o})=>{if(!Array.isArray(n))throw o("Expected a tuple");if(n.length!==t.length)throw o(`Expected tuple with ${t.length} values but received ${n.length} values`);return t.map((a,s)=>et(n.at(s),a)).join(r)}}}const yo=M,go=M,Ro=M;function wo(t){const e=Yt(),r=$e(t.name),n=rt(t.path),o=rt(t.query),a=rt(t.hash),s=t.meta??{},p=rt(t.host),h=i.markRaw({id:e,meta:{},state:{},...t}),c={id:e,matched:h,matches:[h],name:r,host:p,path:n,query:o,hash:a,meta:s,depth:1,state:{}},g=Be(t)?Ze(t.parent,c):c;return ct(g.path.params,g.query.params,g.host.params,g.hash.params),g}v.DuplicateParamsError=pe,v.MetaPropertyConflict=de,v.RouterLink=Ke,v.RouterNotInstalledError=X,v.RouterView=ae,v.UseRouteInvalidError=he,v.arrayOf=po,v.asUrl=Zt,v.createExternalRoute=wo,v.createParam=Re,v.createRoute=nt,v.createRouter=uo,v.createRouterPlugin=fo,v.host=go,v.isRoute=ee,v.isUrl=Z,v.onAfterRouteLeave=Un,v.onAfterRouteUpdate=Ln,v.onBeforeRouteLeave=vn,v.onBeforeRouteUpdate=kn,v.path=yo,v.query=Ro,v.tupleOf=mo,v.unionOf=Sr,v.useLink=Qe,v.useRoute=ne,v.useRouter=St,v.withDefault=Lr,v.withParams=M,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})});
4
+ `)}return u}function C(m,d,w){return[m,d,w.id,JSON.stringify(w.params)].join("-")}function k(m){return xe(m)?[{id:m.id,name:"default",props:m.props}]:Oe(m)?Object.entries(m.props).map(([d,w])=>({id:m.id,name:d,props:w})):[]}function E(m){for(const d of r.keys())m.includes(d)||r.delete(d)}return{getPrefetchProps:s,setPrefetchProps:p,getProps:c,setProps:h,setVueApp:t}}function Fe(){const t=i.inject(Te);if(!t)throw new X;return t}const an=i.defineAsyncComponent(()=>new Promise(t=>{t({default:{template:"foo"}})}));function Me(t){return t.name===an.name&&"__asyncLoader"in t}const We=Symbol("visibilityObserver");function sn(t){const e=i.inject(We);if(!e)throw new X;return i.watch(t,(n,o)=>{n&&e.observe(n),o&&e.unobserve(o)},{immediate:!0}),i.onUnmounted(()=>{t.value&&e.unobserve(t.value)}),{isElementVisible:i.computed(()=>t.value?e.isElementVisible(t.value):!1)}}function Ge(t,e,r){i.watch(t,(n,o)=>{n&&n.addEventListener(e,r),o&&o.removeEventListener(e,r)},{immediate:!0}),i.onUnmounted(()=>{t.value&&t.value.removeEventListener(e,r)})}function cn(t){const e=new Map,r=i.ref(),{getPrefetchProps:n,setPrefetchProps:o}=Fe(),{isElementVisible:a}=sn(r),s=()=>{const c=Array.from(e.values()).reduce((g,P)=>(Object.assign(g,P),g),{});o(c)};i.watch(()=>i.toValue(t),({route:c,...g})=>{e.clear(),c&&h("eager",c,g)},{immediate:!0}),i.watch(a,c=>{const{route:g,...P}=i.toValue(t);!g||!c||h("lazy",g,P)},{immediate:!0}),Ge(r,"focusin",p),Ge(r,"mouseover",p);function p(){const{route:c,...g}=i.toValue(t);c&&h("intent",c,g)}function h(c,g,P){un(c,g,P),e.has(c)||e.set(c,n(c,g,P))}return{element:r,commit:s}}function un(t,e,r){e.matches.forEach(n=>{_e({...r,routePrefetch:n.prefetch},"components")===t&&(Ce(n)&&Me(n.component)&&n.component.__asyncLoader(),je(n)&&Object.values(n.components).forEach(a=>{Me(a)&&a.__asyncLoader()}))})}const ze=Symbol("isRouterRouteSymbol");function fn(t){return typeof t=="object"&&t!==null&&ze in t}function ln(t,e){function r(d,w,l){if(typeof d=="object"){const S={...t.params,...d};return e(t.name,S,w)}const u={...t.params,[d]:w};return e(t.name,u,l)}const n=(...d)=>{const w=new URLSearchParams(t.query);w.set(...d),r({},{query:w})},o=(...d)=>{const w=new URLSearchParams(t.query);w.append(...d),r({},{query:w})},a=(...d)=>{const w=new URLSearchParams(t.query);w.delete(...d),r({},{query:w})},{id:s,matched:p,matches:h,name:c,hash:g,href:P}=i.toRefs(t),C=i.computed({get(){return new Proxy(t.params,{set(d,w,l){return r(w,l),!0}})},set(d){r(d)}}),k=i.computed({get(){return new Proxy(t.query,{get(d,w,l){switch(w){case"append":return o;case"set":return n;case"delete":return a;default:return Reflect.get(d,w,l)}}})},set(d){r({},{query:d})}}),E=i.computed({get(){return new Proxy(t.state,{set(d,w,l){return r({},{state:{...t.state,[w]:l}}),!0}})},set(d){r({},{state:d})}});return i.reactive({id:s,matched:p,matches:h,state:E,query:k,hash:g,params:C,name:c,href:P,update:r,[ze]:!0})}function ee(t,e,{exact:r}={}){return fn(t)?e===void 0?!0:r?t.matched.name===e:t.matches.map(n=>n.name).includes(e):!1}function re(...t){const e=new URLSearchParams;for(const r of t){const n=new URLSearchParams(r);for(const[o,a]of n.entries())e.append(o,a)}return e}function Qe(t,e={},r={}){const n=Pt(),o=i.computed(()=>{const E=i.toValue(t);return typeof E!="string"?E:Z(E)?n.find(E,i.toValue(r)):n.resolve(E,i.toValue(e),i.toValue(r))}),a=i.computed(()=>{if(o.value)return o.value.href;const E=i.toValue(t);if(Z(E))return E;console.error(new Error("Failed to resolve route in RouterLink."))}),s=i.computed(()=>ee(n.route)&&n.route.matches.some(E=>{var m;return E.id===((m=o.value)==null?void 0:m.id)})),p=i.computed(()=>{var E;return n.route.id===((E=o.value)==null?void 0:E.id)}),h=i.computed(()=>!!a.value&&n.isExternal(a.value)),c=i.computed(()=>{const E=i.toValue(t);return typeof E!="string"||Z(E)?i.toValue(e):i.toValue(r)}),{element:g,commit:P}=cn(()=>({route:o.value,routerPrefetch:n.prefetch,linkPrefetch:c.value.prefetch})),C=E=>{P();const m={replace:(E==null?void 0:E.replace)??c.value.replace,query:re(c.value.query,E==null?void 0:E.query),hash:(E==null?void 0:E.hash)??c.value.hash,state:{...c.value.state,...E==null?void 0:E.state}},d=i.toValue(t);return Z(d)||typeof d=="object"?n.push(d,m):n.push(d,i.toValue(e),m)};return{element:g,route:o,href:a,isMatch:s,isExactMatch:p,isExternal:h,push:C,replace:E=>C({...E,replace:!0})}}const pn=["href"],Ke=i.defineComponent({__name:"routerLink",props:{to:{},prefetch:{type:[Boolean,String,Object],default:void 0},query:{},hash:{},replace:{type:Boolean},state:{}},setup(t){const e=t,r=Pt(),n=i.computed(()=>C(e.to)),o=i.computed(()=>k(e.to)),a=i.computed(()=>{const{to:m,...d}=e;return d}),{element:s,isMatch:p,isExactMatch:h,isExternal:c,push:g}=Qe(()=>typeof e.to=="function"?e.to(r.resolve):e.to,a),P=i.computed(()=>({"router-link--match":p.value,"router-link--exact-match":h.value}));function C(m){if(typeof m=="function"){const d=m(r.resolve);return C(d)}return Z(m)?r.find(m):m}function k(m){if(typeof m=="function"){const d=m(r.resolve);return k(d)}return Z(m)?m:m==null?void 0:m.href}function E(m){m.preventDefault(),g()}return(m,d)=>(i.openBlock(),i.createElementBlock("a",{ref_key:"element",ref:s,href:o.value,class:i.normalizeClass(["router-link",P.value]),onClick:E},[i.renderSlot(m.$slots,"default",i.normalizeProps(i.guardReactiveProps({route:n.value,isMatch:i.unref(p),isExactMatch:i.unref(h),isExternal:i.unref(c)})))],10,pn))}}),Ye=Symbol();function dn(){const t=i.inject(Ye);if(!t)throw new X;return t}function ne(t,e){const r=Pt();function n(){if(!t)return;if(!ee(r.route,t,e))throw new he(t,r.route.name)}return i.watch(r.route,n,{immediate:!0,deep:!0}),r.route}const Xe=Symbol();function oe(){return i.inject(Xe,0)}function hn(t,e,r){return i.defineComponent({name:"PropsWrapper",expose:[],setup(){const n=i.getCurrentInstance(),o=Fe(),a=ne();return()=>{const s=o.getProps(t.id,e,a);return s instanceof Error?"":qt(s)?n!=null&&n.suspense?i.h(mn,{component:r,props:s}):i.h(yn,{component:r,props:s}):i.h(r,s)}}})}const yn=i.defineComponent(t=>{const e=i.ref();return i.watch(()=>t.props,async r=>{e.value=await r},{immediate:!0,deep:!0}),()=>e.value instanceof Error?"":e.value?i.h(t.component,e.value):""},{props:["component","props"]}),mn=i.defineComponent(async t=>{const e=i.ref();return e.value=await t.props,i.watch(()=>e.value,async r=>{e.value=await r},{deep:!0}),()=>e.value instanceof Error?"":e.value?i.h(t.component,e.value):""},{props:["component","props"]}),tr=Symbol();function gn(){const t=new Map;return{getRouteComponents:r=>{const n=t.get(r.id);if(n)return n;const o=Rn(r);return t.set(r.id,o),o}}}function Rn(t){return je(t)?er(t,t.components):Ce(t)?er(t,{default:t.component}):{default:ae}}function er(t,e){return Object.fromEntries(Object.entries(e).map(([r,n])=>[r,hn(t,r,n)]))}function wn(){const t=i.inject(tr);if(!t)throw new X;return t}const ae=i.defineComponent({__name:"routerView",props:{name:{default:"default"}},setup(t){const e=ne(),r=dn(),n=oe(),{getRouteComponents:o}=wn();i.provide(Xe,n+1);const a=i.computed(()=>{if(r.value)return r.value.component;const s=e.matches.at(n);return s?o(s)[t.name]:null});return(s,p)=>a.value?i.renderSlot(s.$slots,"default",i.normalizeProps(i.mergeProps({key:0},{route:i.unref(e),component:a.value,rejection:i.unref(r)})),()=>[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(a.value)))]):i.createCommentVNode("",!0)}});class ot{constructor(){G(this,"onBeforeRouteEnter",new Set);G(this,"onBeforeRouteUpdate",new Set);G(this,"onBeforeRouteLeave",new Set);G(this,"onAfterRouteEnter",new Set);G(this,"onAfterRouteUpdate",new Set);G(this,"onAfterRouteLeave",new Set)}}const wt=(t,e,r)=>{var a,s;const n=t.matches,o=(e==null?void 0:e.matches)??[];return((a=n.at(r))==null?void 0:a.id)!==((s=o.at(r))==null?void 0:s.id)},Et=(t,e,r)=>{var a,s;const n=t.matches,o=(e==null?void 0:e.matches)??[];return((a=n.at(r))==null?void 0:a.id)!==((s=o.at(r))==null?void 0:s.id)},bt=(t,e,r)=>{var n,o;return((n=t.matches.at(r))==null?void 0:n.id)===((o=e==null?void 0:e.matches.at(r))==null?void 0:o.id)};function rr(t){switch(t){case"onBeforeRouteEnter":case"onAfterRouteEnter":return wt;case"onBeforeRouteUpdate":case"onAfterRouteUpdate":return bt;case"onBeforeRouteLeave":case"onAfterRouteLeave":return Et;default:throw new Error(`Switch is not exhaustive for lifecycle: ${t}`)}}function En(t,e){const r=new ot;return t.matches.forEach((n,o)=>{n.onBeforeRouteEnter&&wt(t,e,o)&&it(n.onBeforeRouteEnter).forEach(a=>r.onBeforeRouteEnter.add(a)),n.onBeforeRouteUpdate&&bt(t,e,o)&&it(n.onBeforeRouteUpdate).forEach(a=>r.onBeforeRouteUpdate.add(a))}),e==null||e.matches.forEach((n,o)=>{n.onBeforeRouteLeave&&Et(t,e,o)&&it(n.onBeforeRouteLeave).forEach(a=>r.onBeforeRouteLeave.add(a))}),r}function bn(t,e){const r=new ot;return t.matches.forEach((n,o)=>{n.onAfterRouteEnter&&wt(t,e,o)&&it(n.onAfterRouteEnter).forEach(a=>r.onAfterRouteEnter.add(a)),n.onAfterRouteUpdate&&bt(t,e,o)&&it(n.onAfterRouteUpdate).forEach(a=>r.onAfterRouteUpdate.add(a))}),e==null||e.matches.forEach((n,o)=>{n.onAfterRouteLeave&&Et(t,e,o)&&it(n.onAfterRouteLeave).forEach(a=>r.onAfterRouteLeave.add(a))}),r}function Sn(t,e,r){const n=new ot;return t.matches.forEach((o,a)=>{wt(t,e,a)&&r.onBeforeRouteEnter.forEach(s=>n.onBeforeRouteEnter.add(s)),bt(t,e,a)&&r.onBeforeRouteUpdate.forEach(s=>n.onBeforeRouteUpdate.add(s))}),e==null||e.matches.forEach((o,a)=>{Et(t,e,a)&&r.onBeforeRouteLeave.forEach(s=>n.onBeforeRouteLeave.add(s))}),n}function Pn(t,e,r){const n=new ot;return t.matches.forEach((o,a)=>{wt(t,e,a)&&r.onAfterRouteEnter.forEach(s=>n.onAfterRouteEnter.add(s)),bt(t,e,a)&&r.onAfterRouteUpdate.forEach(s=>n.onAfterRouteUpdate.add(s))}),e==null||e.matches.forEach((o,a)=>{Et(t,e,a)&&r.onAfterRouteLeave.forEach(s=>n.onAfterRouteLeave.add(s))}),n}const nr=Symbol();function An(){const{setVueApp:t,runWithContext:e}=Je(),r={global:new ot,component:new ot},{reject:n,push:o,replace:a,abort:s}=Ie(),p=l=>(r.global.onBeforeRouteEnter.add(l),()=>r.global.onBeforeRouteEnter.delete(l)),h=l=>(r.global.onBeforeRouteUpdate.add(l),()=>r.global.onBeforeRouteUpdate.delete(l)),c=l=>(r.global.onBeforeRouteLeave.add(l),()=>r.global.onBeforeRouteLeave.delete(l)),g=l=>(r.global.onAfterRouteEnter.add(l),()=>r.global.onAfterRouteEnter.delete(l)),P=l=>(r.global.onAfterRouteUpdate.add(l),()=>r.global.onAfterRouteUpdate.delete(l)),C=l=>(r.global.onAfterRouteLeave.add(l),()=>r.global.onAfterRouteLeave.delete(l));async function k({to:l,from:u}){const{global:S,component:L}=r,U=En(l,u),R=Sn(l,u,S),f=[...R.onBeforeRouteEnter,...U.onBeforeRouteEnter,...R.onBeforeRouteUpdate,...U.onBeforeRouteUpdate,...L.onBeforeRouteUpdate,...R.onBeforeRouteLeave,...U.onBeforeRouteLeave,...L.onBeforeRouteLeave];try{const y=f.map(N=>e(()=>N(l,{from:u,reject:n,push:o,replace:a,abort:s})));await Promise.all(y)}catch(y){if(y instanceof ht||y instanceof Bt||y instanceof qe)return y.response;throw y}return{status:"SUCCESS"}}async function E({to:l,from:u}){const{global:S,component:L}=r,U=bn(l,u),R=Pn(l,u,S),f=[...L.onAfterRouteLeave,...U.onAfterRouteLeave,...R.onAfterRouteLeave,...L.onAfterRouteUpdate,...U.onAfterRouteUpdate,...R.onAfterRouteUpdate,...L.onAfterRouteEnter,...U.onAfterRouteEnter,...R.onAfterRouteEnter];try{const y=f.map(N=>e(()=>N(l,{from:u,reject:n,push:o,replace:a})));await Promise.all(y)}catch(y){if(y instanceof ht||y instanceof Bt)return y.response;throw y}return{status:"SUCCESS"}}return{runBeforeRouteHooks:k,runAfterRouteHooks:E,addComponentBeforeRouteHook:({lifecycle:l,depth:u,hook:S})=>{const L=rr(l),U=r.component[l],R=(f,y)=>{if(L(f,y.from,u))return S(f,y)};return U.add(R),()=>U.delete(R)},addComponentAfterRouteHook:({lifecycle:l,depth:u,hook:S})=>{const L=rr(l),U=r.component[l],R=(f,y)=>{if(L(f,y.from,u))return S(f,y)};return U.add(R),()=>U.delete(R)},addGlobalRouteHooks:l=>{l.onBeforeRouteEnter.forEach(u=>p(u)),l.onBeforeRouteUpdate.forEach(u=>h(u)),l.onBeforeRouteLeave.forEach(u=>c(u)),l.onAfterRouteEnter.forEach(u=>g(u)),l.onAfterRouteUpdate.forEach(u=>P(u)),l.onAfterRouteLeave.forEach(u=>C(u))},onBeforeRouteEnter:p,onBeforeRouteUpdate:h,onBeforeRouteLeave:c,onAfterRouteEnter:g,onAfterRouteUpdate:P,onAfterRouteLeave:C,setVueApp:t}}function or(){const t=i.inject(nr);if(!t)throw new X;return t}function ar(t){return e=>{const r=oe(),o=or().addComponentBeforeRouteHook({lifecycle:t,hook:e,depth:r-1});return i.onUnmounted(o),o}}function sr(t){return e=>{const r=oe(),o=or().addComponentAfterRouteHook({lifecycle:t,hook:e,depth:r-1});return i.onUnmounted(o),o}}const vn=ar("onBeforeRouteLeave"),kn=ar("onBeforeRouteUpdate"),Un=sr("onAfterRouteLeave"),Ln=sr("onAfterRouteUpdate");function K(){return K=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},K.apply(null,arguments)}var H;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(H||(H={}));var yt=process.env.NODE_ENV!=="production"?function(t){return Object.freeze(t)}:function(t){return t};function at(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}var Ct="beforeunload",Nn="hashchange",ir="popstate";function cr(t){t===void 0&&(t={});var e=t,r=e.window,n=r===void 0?document.defaultView:r,o=n.history;function a(){var R=n.location,f=R.pathname,y=R.search,N=R.hash,B=o.state||{};return[B.idx,yt({pathname:f,search:y,hash:N,state:B.usr||null,key:B.key||"default"})]}var s=null;function p(){if(s)k.call(s),s=null;else{var R=H.Pop,f=a(),y=f[0],N=f[1];if(k.length)if(y!=null){var B=g-y;B&&(s={action:R,location:N,retry:function(){L(B*-1)}},L(B))}else process.env.NODE_ENV!=="production"&&at(!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 l(R)}}n.addEventListener(ir,p);var h=H.Pop,c=a(),g=c[0],P=c[1],C=mt(),k=mt();g==null&&(g=0,o.replaceState(K({},o.state,{idx:g}),""));function E(R){return typeof R=="string"?R:st(R)}function m(R,f){return f===void 0&&(f=null),yt(K({pathname:P.pathname,hash:"",search:""},typeof R=="string"?St(R):R,{state:f,key:jt()}))}function d(R,f){return[{usr:R.state,key:R.key,idx:f},E(R)]}function w(R,f,y){return!k.length||(k.call({action:R,location:f,retry:y}),!1)}function l(R){h=R;var f=a();g=f[0],P=f[1],C.call({action:h,location:P})}function u(R,f){var y=H.Push,N=m(R,f);function B(){u(R,f)}if(w(y,N,B)){var O=d(N,g+1),$=O[0],_=O[1];try{o.pushState($,"",_)}catch{n.location.assign(_)}l(y)}}function S(R,f){var y=H.Replace,N=m(R,f);function B(){S(R,f)}if(w(y,N,B)){var O=d(N,g),$=O[0],_=O[1];o.replaceState($,"",_),l(y)}}function L(R){o.go(R)}var U={get action(){return h},get location(){return P},createHref:E,push:u,replace:S,go:L,back:function(){L(-1)},forward:function(){L(1)},listen:function(f){return C.push(f)},block:function(f){var y=k.push(f);return k.length===1&&n.addEventListener(Ct,xt),function(){y(),k.length||n.removeEventListener(Ct,xt)}}};return U}function Vn(t){t===void 0&&(t={});var e=t,r=e.window,n=r===void 0?document.defaultView:r,o=n.history;function a(){var f=St(n.location.hash.substr(1)),y=f.pathname,N=y===void 0?"/":y,B=f.search,O=B===void 0?"":B,$=f.hash,_=$===void 0?"":$,D=o.state||{};return[D.idx,yt({pathname:N,search:O,hash:_,state:D.usr||null,key:D.key||"default"})]}var s=null;function p(){if(s)k.call(s),s=null;else{var f=H.Pop,y=a(),N=y[0],B=y[1];if(k.length)if(N!=null){var O=g-N;O&&(s={action:f,location:B,retry:function(){U(O*-1)}},U(O))}else process.env.NODE_ENV!=="production"&&at(!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 u(f)}}n.addEventListener(ir,p),n.addEventListener(Nn,function(){var f=a(),y=f[1];st(y)!==st(P)&&p()});var h=H.Pop,c=a(),g=c[0],P=c[1],C=mt(),k=mt();g==null&&(g=0,o.replaceState(K({},o.state,{idx:g}),""));function E(){var f=document.querySelector("base"),y="";if(f&&f.getAttribute("href")){var N=n.location.href,B=N.indexOf("#");y=B===-1?N:N.slice(0,B)}return y}function m(f){return E()+"#"+(typeof f=="string"?f:st(f))}function d(f,y){return y===void 0&&(y=null),yt(K({pathname:P.pathname,hash:"",search:""},typeof f=="string"?St(f):f,{state:y,key:jt()}))}function w(f,y){return[{usr:f.state,key:f.key,idx:y},m(f)]}function l(f,y,N){return!k.length||(k.call({action:f,location:y,retry:N}),!1)}function u(f){h=f;var y=a();g=y[0],P=y[1],C.call({action:h,location:P})}function S(f,y){var N=H.Push,B=d(f,y);function O(){S(f,y)}if(process.env.NODE_ENV!=="production"&&at(B.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.push("+JSON.stringify(f)+")"),l(N,B,O)){var $=w(B,g+1),_=$[0],D=$[1];try{o.pushState(_,"",D)}catch{n.location.assign(D)}u(N)}}function L(f,y){var N=H.Replace,B=d(f,y);function O(){L(f,y)}if(process.env.NODE_ENV!=="production"&&at(B.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.replace("+JSON.stringify(f)+")"),l(N,B,O)){var $=w(B,g),_=$[0],D=$[1];o.replaceState(_,"",D),u(N)}}function U(f){o.go(f)}var R={get action(){return h},get location(){return P},createHref:m,push:S,replace:L,go:U,back:function(){U(-1)},forward:function(){U(1)},listen:function(y){return C.push(y)},block:function(y){var N=k.push(y);return k.length===1&&n.addEventListener(Ct,xt),function(){N(),k.length||n.removeEventListener(Ct,xt)}}};return R}function ur(t){t===void 0&&(t={});var e=t,r=e.initialEntries,n=r===void 0?["/"]:r,o=e.initialIndex,a=n.map(function(u){var S=yt(K({pathname:"/",search:"",hash:"",state:null,key:jt()},typeof u=="string"?St(u):u));return process.env.NODE_ENV!=="production"&&at(S.pathname.charAt(0)==="/","Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(u)+")"),S}),s=fr(o??a.length-1,0,a.length-1),p=H.Pop,h=a[s],c=mt(),g=mt();function P(u){return typeof u=="string"?u:st(u)}function C(u,S){return S===void 0&&(S=null),yt(K({pathname:h.pathname,search:"",hash:""},typeof u=="string"?St(u):u,{state:S,key:jt()}))}function k(u,S,L){return!g.length||(g.call({action:u,location:S,retry:L}),!1)}function E(u,S){p=u,h=S,c.call({action:p,location:h})}function m(u,S){var L=H.Push,U=C(u,S);function R(){m(u,S)}process.env.NODE_ENV!=="production"&&at(h.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.push("+JSON.stringify(u)+")"),k(L,U,R)&&(s+=1,a.splice(s,a.length,U),E(L,U))}function d(u,S){var L=H.Replace,U=C(u,S);function R(){d(u,S)}process.env.NODE_ENV!=="production"&&at(h.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.replace("+JSON.stringify(u)+")"),k(L,U,R)&&(a[s]=U,E(L,U))}function w(u){var S=fr(s+u,0,a.length-1),L=H.Pop,U=a[S];function R(){w(u)}k(L,U,R)&&(s=S,E(L,U))}var l={get index(){return s},get action(){return p},get location(){return h},createHref:P,push:m,replace:d,go:w,back:function(){w(-1)},forward:function(){w(1)},listen:function(S){return c.push(S)},block:function(S){return g.push(S)}};return l}function fr(t,e,r){return Math.min(Math.max(t,e),r)}function xt(t){t.preventDefault(),t.returnValue=""}function mt(){var t=[];return{get length(){return t.length},push:function(r){return t.push(r),function(){t=t.filter(function(n){return n!==r})}},call:function(r){t.forEach(function(n){return n&&n(r)})}}}function jt(){return Math.random().toString(36).substr(2,8)}function st(t){var e=t.pathname,r=e===void 0?"/":e,n=t.search,o=n===void 0?"":n,a=t.hash,s=a===void 0?"":a;return o&&o!=="?"&&(r+=o.charAt(0)==="?"?o:"?"+o),s&&s!=="#"&&(r+=s.charAt(0)==="#"?s:"#"+s),r}function St(t){var e={};if(t){var r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));var n=t.indexOf("?");n>=0&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}const lr=Symbol();function Bn(t,e){const r=i.reactive({...t}),n=s=>{Object.assign(r,{[lr]:!1,...s})},o=r,a=ln(o,e);return{currentRoute:o,routerRoute:a,updateRoute:n}}function q(t){return!t.startsWith("http")?xn(t):Cn(t)}function Cn(t){const{protocol:e,host:r,pathname:n,search:o,searchParams:a,hash:s}=new URL(t,t);return{protocol:e,host:r,pathname:n,search:o,searchParams:a,hash:s}}function xn(t){const{pathname:e,search:r,searchParams:n,hash:o}=new URL(t,"https://localhost");return{pathname:e,search:r,searchParams:n,hash:o}}function jn(t){return e=>{const{host:r}=q(e);return!(r===void 0||r===t)}}function On({mode:t,listener:e}){const r=Zn(t),n=(h,c)=>{if(c!=null&&c.replace){r.replace(h,c.state);return}r.push(h,c==null?void 0:c.state)},o=()=>{const h=st(r.location);r.replace(h)};let a;return{...r,update:n,refresh:o,startListening:()=>{a==null||a(),a=r.listen(e)},stopListening:()=>{a==null||a()}}}function Zn(t="auto"){switch(t){case"auto":return zt()?cr():ur();case"browser":return cr();case"memory":return ur();case"hash":return Vn();default:const e=t;throw new Error(`Switch is not exhaustive for mode: ${e}`)}}function $n(t){return i.defineComponent(()=>()=>i.h("h1",t),{name:t,props:[]})}function Hn(t){const e=a=>i.markRaw(t[a]??$n(a)),r=a=>{const s=i.markRaw(e(a)),p={id:Yt(),component:s,meta:{},state:{}};return{id:p.id,matched:p,matches:[p],name:a,query:Qt(""),params:{},state:{},href:"/",hash:"",[lr]:!0}},n=a=>{if(!a){o.value=null;return}const s=e(a);o.value={type:a,component:s}},o=i.ref(null);return{setRejection:n,rejection:o,getRejectionRoute:r}}class _n extends Error{constructor(){super("initialUrl must be set if window.location is unavailable")}}function qn(t){if(t)return t;if(zt())return window.location.toString();throw new _n}function pr(t){return!!t&&typeof t=="object"}const Ot=!0;function In(t,e,r){if(pr(t)&&e in t){const n=t[e];return typeof n=="string"?tt(n,r,Ot):n}return tt(void 0,r,Ot)}function dr(t,e){const r={};for(const[n,o]of Object.entries(t)){const a=In(e,n,o);r[n]=a}return r}function Dn(t,e,r){if(pr(t)&&e in t){const n=t[e];return et(n,r,Ot)}return et(void 0,r,Ot)}const hr=(t,e)=>{const r={};for(const[n,o]of Object.entries(t)){const a=Dn(e,n,o);r[n]=a}return r};function Jn(){const t=i.reactive(new Map),e=zt()?s():null,r=p=>{t.set(p,!1),e==null||e.observe(p)},n=p=>{t.delete(p),e==null||e.unobserve(p)},o=()=>{e==null||e.disconnect()},a=p=>t.get(p)??!1;function s(){return new IntersectionObserver(p=>{p.forEach(h=>{t.set(h.target,h.isIntersecting)})})}return{observe:r,unobserve:n,disconnect:o,isElementVisible:a}}class Tn extends Error{constructor(e){super(`Route not found: "${e}"`)}}function yr(t,e,r){const n=Dr(e.value,r),o=Ue(n),[a]=Ne(t,new RegExp(o,"g"));return a}function mr(t,e,r,n){const o=Mt(e,r),a=et(n,e.params[r],o);return t.replace(Le(r),a)}function gr({protocol:t,host:e,pathname:r,search:n,searchParams:o,hash:a}){const s=new URL("https://localhost");t&&(s.protocol=t),e&&(s.host=e),r&&(s.pathname=r),o?s.search=new URLSearchParams(o).toString():n&&(s.search=n),a&&(s.hash=a);const p=s.toString().replace(/^https:\/\/localhost\/*/,"/");return Zt(p)}function Fn(t,e={}){const{params:r={},query:n}=e,o=Wn(t.query,r),a=re(o,n),s=Rr(t.path,r),p=t.hash.value?Rr(t.hash,r):e.hash,h=Mn(t.host,r),{protocol:c,host:g}=q(h);return gr({protocol:c,host:g,pathname:s,searchParams:a,hash:p})}function Mn(t,e){const r=t.value&&!t.value.startsWith("http")?`https://${t.value}`:t.value;return Object.keys(t.params).reduce((n,o)=>mr(n,t,o,e[o]),r)}function Rr(t,e){return Object.keys(t.params).reduce((r,n)=>mr(r,t,n,e[n]),t.value)}function Wn(t,e){const r=new URLSearchParams(t.value);if(!t.value)return r;for(const[n,o]of Array.from(r.entries())){const a=Gt(o);if(!a)continue;const p=Wt(o),h=et(e[a],t.params[a],p),c=e[a]===void 0&&h==="";p&&c?r.delete(n,o):r.set(n,h)}return r}const Gn=(t,e)=>{try{se(t,e)}catch{return!1}return!0},se=(t,e)=>{const{protocol:r,host:n,pathname:o,search:a,hash:s}=q(e);return{...ie(t.host,`${r}//${n}`),...ie(t.path,o),...zn(t.query,a),...ie(t.hash,s)}};function ie(t,e){const r={},n=decodeURIComponent(e);for(const[o,a]of Object.entries(t.params)){const s=yr(n,t,o),p=Mt(t,o),h=tt(s,a,p);r[o]=h}return r}function zn(t,e){const r={},n=new URLSearchParams(t.value),o=new URLSearchParams(e);for(const[a,s]of Array.from(n.entries())){const p=Gt(s);if(!p)continue;const c=Wt(s),g=o.get(a)??void 0,P=tt(g,t.params[p],c);r[p]=P}return r}function Qn(t,e={},r={}){const n=Fn(t,{params:e,query:r.query,hash:r.hash}),{search:o,hash:a}=q(n);return{id:t.id,matched:t.matched,matches:t.matches,name:t.name,query:Qt(o),params:se(t,n),state:dr(t.state,r.state),hash:a,href:n}}const Kn=t=>"name"in t.matched&&!!t.matched.name,Yn=(t,e)=>{const{pathname:r}=q(e);return qr(t).test(r)},Xn=(t,e)=>{const{search:r}=q(e);return Ir(t).every(o=>o.test(r))},ce=(t,e)=>{const{hash:r}=q(e),{value:n}=t.hash;return F(n)?`#${n.replace(/^#*/,"")}`.toLowerCase()===r.toLowerCase():!0};function to(t){const{searchParams:e,pathname:r}=q(t),n=-1,o=1;return(a,s)=>{const p=Er(a,e),h=wr(a,r),c=Er(s,e),g=wr(s,r);return a.depth>s.depth?n:a.depth<s.depth?o:p+h>c+g?n:p+h<c+g?o:ce(a,t)?n:ce(s,t)?o:0}}function wr(t,e){const r=Object.keys(t.path.params).filter(o=>Mt(t.path,o)).map(o=>o),n=r.filter(o=>yr(e,t.path,o)===void 0);return r.length-n.length}function Er(t,e){const r=new URLSearchParams(e),n=new URLSearchParams(t.query.value),o=Array.from(n.keys()),a=o.filter(s=>!r.has(s));return o.length-a.length}const eo=[Kn,Yn,Xn,ce,Gn];function ro(t,e){const r=to(e);return t.filter(n=>eo.every(o=>o(n,e))).sort(r)}function no(t,e,r){const n=ro(t,e);if(!n.length)return;const[o]=n,{searchParams:a,hash:s}=q(e);return{id:o.id,matched:o.matched,matches:o.matches,name:o.name,query:Qt(a),params:se(o,e),state:dr(o.state,r),hash:s,href:Zt(e)}}function br(t,e){const r=typeof t=="string"?q(t):t,n=typeof e=="string"?q(e):e,o=r.searchParams??new URLSearchParams(r.search),a=n.searchParams??new URLSearchParams(n.search);return gr({protocol:F(n.protocol)?n.protocol:r.protocol,host:F(n.host)?n.host:r.host,pathname:F(n.pathname)?n.pathname:r.pathname,searchParams:re(a,o),hash:F(n.hash)?n.hash:r.hash})}function oo(t,e){return F(e)?t.map(r=>{const n=`${e}${r.path.value}`;return{...r,path:M(n,r.path.params)}}):t}class ao 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 so(t){const e=t.map(({name:r})=>r);for(const r of e)if(me(e,r)>1)throw new ao(r)}function io(t,e=[],r){const n=[...t,...e.map(o=>o.routes)].flat();return so(n),oo(n,r)}function co(t={},e=[]){const r=new ot;return gt("onBeforeRouteEnter",t,e).forEach(n=>r.onBeforeRouteEnter.add(n)),gt("onBeforeRouteUpdate",t,e).forEach(n=>r.onBeforeRouteUpdate.add(n)),gt("onBeforeRouteLeave",t,e).forEach(n=>r.onBeforeRouteLeave.add(n)),gt("onAfterRouteEnter",t,e).forEach(n=>r.onAfterRouteEnter.add(n)),gt("onAfterRouteUpdate",t,e).forEach(n=>r.onAfterRouteUpdate.add(n)),gt("onAfterRouteLeave",t,e).forEach(n=>r.onAfterRouteLeave.add(n)),r}function gt(t,e,r){return[e[t],...r.map(o=>o[t])].flat().filter(o=>o!==void 0)}function uo(t,e,r=[]){const n=io(t,r,e==null?void 0:e.base),o=An();o.addGlobalRouteHooks(co(e,r));const a=Kt(),s=on(),p=gn(),h=Jn(),c=On({mode:e==null?void 0:e.historyMode,listener:({location:A})=>{const x=st(A);P(x,{state:A.state,replace:!0})}});function g(A,x={}){return no(n,A,x.state)}async function P(A,x={}){const Q=a();if(c.stopListening(),N(A)){c.update(A,x);return}const J=g(A,x)??l("NotFound"),I=Pr(Q),Y=await o.runBeforeRouteHooks({to:J,from:I});switch(Y.status){case"ABORT":return;case"PUSH":c.update(A,x),await k(...Y.to);return;case"REJECT":c.update(A,x),d(Y.type);break;case"SUCCESS":c.update(A,x),d(null);break;default:throw new Error(`Switch is not exhaustive for before hook response status: ${JSON.stringify(Y)}`)}const ue=Q;s.setProps(J).then(T=>{if(ue===Q)switch(T.status){case"SUCCESS":break;case"PUSH":k(...T.to);break;case"REJECT":d(T.type);break;default:const fe=T;throw new Error(`Switch is not exhaustive for prop store response status: ${JSON.stringify(fe)}`)}}),U(J);const W=await o.runAfterRouteHooks({to:J,from:I});switch(W.status){case"PUSH":await k(...W.to);break;case"REJECT":d(W.type);break;case"SUCCESS":break;default:const T=W;throw new Error(`Switch is not exhaustive for after hook response status: ${JSON.stringify(T)}`)}c.startListening()}const C=(A,x={},Q={})=>{const J=n.find(I=>I.name===A);if(!J)throw new Tn(String(A));return Qn(J,x,Q)},k=(A,x,Q)=>{if(Z(A)){const W={...x},T=br(A,{searchParams:W.query,hash:W.hash});return P(T,W)}if(typeof A=="string"){const{replace:W,...T}={...Q},fe={...x},le=C(A,fe,T),bo=hr({...le.matched.state},{...le.state,...T.state});return P(le.href,{replace:W,state:bo})}const{replace:J,...I}={...x},Y=hr({...A.matched.state},{...A.state,...I.state}),ue=br(A.href,{searchParams:I.query,hash:I.hash});return P(ue,{replace:J,state:Y})},E=(A,x,Q)=>{if(Z(A)){const I={...x,replace:!0};return k(A,I)}if(typeof A=="string"){const I={...Q,replace:!0},Y={...x};return k(A,Y,I)}const J={...x,replace:!0};return k(A,J)},m=A=>{d(A)},{setRejection:d,rejection:w,getRejectionRoute:l}=Hn({...r.reduce((A,x)=>({...A,...x.rejections}),{}),...e==null?void 0:e.rejections}),u=l("NotFound"),{currentRoute:S,routerRoute:L,updateRoute:U}=Bn(u,k),R=qn(e==null?void 0:e.initialUrl),f=c.location.state,{host:y}=q(R),N=jn(y);let B=!1;const{promise:O,resolve:$}=Promise.withResolvers();async function _(){if(B)return O;Vr(n)&&await Br(),B=!0,await P(R,{replace:!0,state:f}),c.startListening(),$()}function D(){c.stopListening()}function Pr(A){return Xr(A)?null:{...S}}function Eo(A){o.setVueApp(A),s.setVueApp(A),A.component("RouterView",ae),A.component("RouterLink",Ke),A.provide(Ye,w),A.provide(nr,o),A.provide(Te,s),A.provide(tr,p),A.provide(We,h),A.provide(ye,Ar),_()}const Ar={route:L,resolve:C,find:g,push:k,replace:E,reject:m,refresh:c.refresh,forward:c.forward,back:c.back,go:c.go,install:Eo,isExternal:N,onBeforeRouteEnter:o.onBeforeRouteEnter,onBeforeRouteUpdate:o.onBeforeRouteUpdate,onBeforeRouteLeave:o.onBeforeRouteLeave,onAfterRouteEnter:o.onAfterRouteEnter,onAfterRouteUpdate:o.onAfterRouteUpdate,onAfterRouteLeave:o.onAfterRouteLeave,prefetch:e==null?void 0:e.prefetch,start:_,stop:D};return Ar}function fo(t){return{routes:t.routes??[],rejections:t.rejections??{},...t}}function Sr(t){return{get:(e,{invalid:r})=>{for(const n of t){const o=$r(e,n);if(o!==void 0)return o}throw r(`Value ${e} does not satisfy any of the possible values`)},set:(e,{invalid:r})=>{for(const n of t){const o=Hr(e,n);if(o!==void 0)return o}throw r(`Value ${e} does not satisfy any of the possible values`)}}}const lo={separator:","};function po(t,e={}){const{separator:r}={...lo,...e},n=Sr(t);return{get:(o,a)=>o.split(r).map(s=>n.get(s,a)),set:(o,a)=>{if(!Array.isArray(o))throw a.invalid("Expected an array");return o.map(s=>n.set(s,a)).join(r)}}}const ho={separator:","};function yo(t,e={}){const{separator:r}={...ho,...e};return{get:n=>{const o=n.split(r);return t.map((a,s)=>tt(o.at(s),a))},set:(n,{invalid:o})=>{if(!Array.isArray(n))throw o("Expected a tuple");if(n.length!==t.length)throw o(`Expected tuple with ${t.length} values but received ${n.length} values`);return t.map((a,s)=>et(n.at(s),a)).join(r)}}}const mo=M,go=M,Ro=M;function wo(t){const e=Yt(),r=$e(t.name),n=rt(t.path),o=rt(t.query),a=rt(t.hash),s=t.meta??{},p=rt(t.host),h=i.markRaw({id:e,meta:{},state:{},...t}),c={id:e,matched:h,matches:[h],name:r,host:p,path:n,query:o,hash:a,meta:s,depth:1,state:{}},g=Be(t)?Ze(t.parent,c):c;return ct(g.path.params,g.query.params,g.host.params,g.hash.params),g}v.DuplicateParamsError=pe,v.MetaPropertyConflict=de,v.RouterLink=Ke,v.RouterNotInstalledError=X,v.RouterView=ae,v.UseRouteInvalidError=he,v.arrayOf=po,v.asUrl=Zt,v.createExternalRoute=wo,v.createParam=Re,v.createRoute=nt,v.createRouter=uo,v.createRouterPlugin=fo,v.host=go,v.isRoute=ee,v.isUrl=Z,v.onAfterRouteLeave=Un,v.onAfterRouteUpdate=Ln,v.onBeforeRouteLeave=vn,v.onBeforeRouteUpdate=kn,v.path=mo,v.query=Ro,v.tupleOf=yo,v.unionOf=Sr,v.useLink=Qe,v.useRoute=ne,v.useRouter=Pt,v.withDefault=Lr,v.withParams=M,Object.defineProperty(v,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.20.0",
4
+ "version": "0.20.1",
5
5
  "bugs": {
6
6
  "url": "https://github.com/kitbagjs/router/issues"
7
7
  },
@@ -67,6 +67,7 @@
67
67
  }
68
68
  },
69
69
  "dependencies": {
70
+ "@standard-schema/spec": "^1.0.0",
70
71
  "history": "^5.3.0"
71
72
  }
72
73
  }