@kitbag/router 0.20.10 → 0.20.12

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.
Files changed (45) hide show
  1. package/dist/components/routerLink.d.ts +1 -0
  2. package/dist/compositions/useRouterHooks.d.ts +2 -2
  3. package/dist/errors/contextRejectionError.d.ts +1 -2
  4. package/dist/errors/missingRouteContextError.d.ts +10 -0
  5. package/dist/kitbag-router.js +1480 -1352
  6. package/dist/kitbag-router.umd.cjs +3 -3
  7. package/dist/main.d.ts +1 -0
  8. package/dist/models/RouteHooks.d.ts +3 -0
  9. package/dist/models/RouterRouteHooks.d.ts +9 -10
  10. package/dist/services/createCallbackContext.d.ts +2 -2
  11. package/dist/services/createComponentHooks.d.ts +4 -2
  12. package/dist/services/createExternalRoute.d.ts +3 -2
  13. package/dist/services/createRejection.d.ts +6 -0
  14. package/dist/services/createRoute.d.ts +4 -3
  15. package/dist/services/createRouteHooks.d.ts +15 -0
  16. package/dist/services/createRouter.d.ts +2 -2
  17. package/dist/services/createRouterAssets.d.ts +3 -2
  18. package/dist/services/createRouterCallbackContext.d.ts +8 -6
  19. package/dist/services/createRouterHooks.d.ts +17 -20
  20. package/dist/services/createRouterPlugin.d.ts +3 -3
  21. package/dist/services/createRouterPlugin.spec-d.d.ts +1 -0
  22. package/dist/services/createRouterReject.d.ts +4 -6
  23. package/dist/services/getGlobalRouteHooks.d.ts +2 -3
  24. package/dist/services/getRouteHooks.d.ts +3 -9
  25. package/dist/services/getRouteHooksDeprecated.d.ts +10 -0
  26. package/dist/services/routeMatchRules.d.ts +1 -0
  27. package/dist/services/routeRegex.d.ts +1 -0
  28. package/dist/services/zod.d.ts +3 -3
  29. package/dist/types/createRouteOptions.d.ts +14 -5
  30. package/dist/types/hooks.d.ts +79 -7
  31. package/dist/types/props.d.ts +13 -7
  32. package/dist/types/register.d.ts +2 -1
  33. package/dist/types/rejection.d.ts +15 -0
  34. package/dist/types/resolved.d.ts +14 -1
  35. package/dist/types/route.d.ts +28 -2
  36. package/dist/types/routeContext.d.ts +9 -0
  37. package/dist/types/router.d.ts +14 -58
  38. package/dist/types/routerPlugin.d.ts +106 -10
  39. package/dist/types/routerReject.d.ts +2 -2
  40. package/dist/types/routerRoute.d.ts +27 -0
  41. package/dist/types/utilities.d.ts +0 -4
  42. package/dist/utilities/checkMissingContext.d.ts +2 -0
  43. package/dist/utilities/checkMissingContext.spec copy.d.ts +1 -0
  44. package/dist/utilities/testHelpers.d.ts +11 -14
  45. package/package.json +8 -8
@@ -1,4 +1,4 @@
1
- (function(V,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],u):(V=typeof globalThis<"u"?globalThis:V||self,u(V["@kitbag/router"]={},V.Vue))})(this,function(V,u){"use strict";class vt extends Error{constructor(t){super(`Invalid Param "${t}": Router does not support multiple params by the same name. All param names must be unique.`)}}function ue(e){return Array.isArray(e)?e:[e]}function St(e,t){return e.filter(r=>t===r).length}function fe(...e){const t=e.flatMap(r=>Array.isArray(r)?r:Object.keys(r));for(const r of t)if(St(t,r)>1)throw new vt(r)}class Y extends Error{}const we="[",ke="]";function Lr(e){return e!==String&&e!==Boolean&&e!==Number&&e!==Date}function Vr(e){return typeof e=="function"&&Lr(e)}function Le(e){return typeof e=="object"&&"get"in e&&typeof e.get=="function"&&"set"in e&&typeof e.set=="function"}function Pt(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function At(e,t){return Le(e)?{...e,defaultValue:t??e.defaultValue}:{get:r=>ne(r,e),set:r=>K(r,e),defaultValue:t}}function Nr(e){return Le(e)&&e.defaultValue!==void 0}function Br(e,t){return At(e,t)}function Cr(e){return e!==void 0}function le(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function M(e){return typeof e=="string"&&e.length>0}let U=null;async function Or(){const{ZodSchema:e,ZodString:t,ZodBoolean:r,ZodDate:n,ZodNumber:o,ZodLiteral:a,ZodObject:s,ZodEnum:i,ZodNativeEnum:c,ZodArray:d,ZodTuple:y,ZodUnion:R,ZodDiscriminatedUnion:L,ZodRecord:S,ZodMap:x,ZodSet:w,ZodIntersection:k,ZodPromise:h,ZodFunction:v}=await import("zod");return{ZodSchema:e,ZodString:t,ZodBoolean:r,ZodDate:n,ZodNumber:o,ZodLiteral:a,ZodObject:s,ZodEnum:i,ZodNativeEnum:c,ZodArray:d,ZodTuple:y,ZodUnion:R,ZodDiscriminatedUnion:L,ZodRecord:S,ZodMap:x,ZodSet:w,ZodIntersection:k,ZodPromise:h,ZodFunction:v}}function xr(e){return Object.values(e).some(t=>Object.values(t.host.params).some(r=>De(r))||Object.values(t.path.params).some(r=>De(r))||Object.values(t.query.params).some(r=>De(r)))}function De(e){return le(e)&&"parse"in e&&typeof e.parse=="function"&&"~standard"in e&&le(e["~standard"])&&"vendor"in e["~standard"]&&e["~standard"].vendor==="zod"}async function jr(){try{U=await Or()}catch{throw new Error("Failed to initialize Zod")}}function Ut(e){return U?e instanceof U.ZodSchema:!1}function kt(e){return{get:(t,{invalid:r})=>{try{return _e(t,e)}catch{throw r()}},set:(t,{invalid:r})=>{try{return Ie(t,e)}catch{throw r()}}}}const Zr=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;function pe(e,t){if(typeof t=="string"&&Zr.test(t)){const r=new Date(t);return isNaN(r.getTime())?t:r}return t}function de(e){for(const t of e)try{return t()}catch{continue}throw new Error("All functions failed")}function Ve(e,t){return U?.ZodString&&e instanceof U.ZodString?1:U?.ZodString&&t instanceof U.ZodString?-1:0}function _e(e,t){if(!U)throw new Error("Zod is not initialized");if(t instanceof U.ZodString)return t.parse(e);if(t instanceof U.ZodBoolean)return t.parse(!!e);if(t instanceof U.ZodDate)return t.parse(new Date(e));if(t instanceof U.ZodNumber)return t.parse(Number(e));if(t instanceof U.ZodLiteral)return de([()=>t.parse(Number(e)),()=>t.parse(!!e),()=>t.parse(e)]);if(t instanceof U.ZodObject)return t.parse(JSON.parse(e,pe));if(t instanceof U.ZodEnum)return t.parse(e);if(t instanceof U.ZodNativeEnum)return de([()=>t.parse(Number(e)),()=>t.parse(e)]);if(t instanceof U.ZodArray||t instanceof U.ZodTuple)return t.parse(JSON.parse(e,pe));if(t instanceof U.ZodUnion){const r=Array.from(t._def.options).sort(Ve).map(n=>()=>_e(e,n));return de(r)}if(t instanceof U.ZodDiscriminatedUnion){const r=Array.from(t.options).sort(Ve).map(n=>()=>_e(e,n));return de(r)}if(t instanceof U.ZodRecord)return t.parse(JSON.parse(e,pe));if(t instanceof U.ZodMap)return t.parse(new Map(JSON.parse(e,pe)));if(t instanceof U.ZodSet)return t.parse(new Set(JSON.parse(e,pe)));if(t instanceof U.ZodIntersection)throw new Error("Intersection schemas are not supported");if(t instanceof U.ZodPromise)throw new Error("Promise schemas are not supported");if(t instanceof U.ZodFunction)throw new Error("Function schemas are not supported");return t.parse(e)}function Ie(e,t){if(!U)throw new Error("Zod is not initialized");if(t instanceof U.ZodString)return t.parse(e);if(t instanceof U.ZodBoolean)return t.parse(e).toString();if(t instanceof U.ZodDate)return t.parse(e).toISOString();if(t instanceof U.ZodNumber)return t.parse(Number(e)).toString();if(t instanceof U.ZodLiteral)return t.parse(e).toString();if(t instanceof U.ZodObject)return JSON.stringify(t.parse(e));if(t instanceof U.ZodEnum)return t.parse(e);if(t instanceof U.ZodNativeEnum)return t.parse(e).toString();if(t instanceof U.ZodArray||t instanceof U.ZodTuple)return JSON.stringify(t.parse(e));if(t instanceof U.ZodUnion){const r=Array.from(t._def.options).sort(Ve).map(n=>()=>Ie(e,n));return de(r)}if(t instanceof U.ZodDiscriminatedUnion){const r=Array.from(t.options).sort(Ve).map(n=>()=>Ie(e,n));return de(r)}if(t instanceof U.ZodRecord)return JSON.stringify(t.parse(e));if(t instanceof U.ZodMap){const r=t.parse(e);return JSON.stringify(Array.from(r.entries()))}if(t instanceof U.ZodSet){const r=t.parse(e);return JSON.stringify(Array.from(r.values()))}if(t instanceof U.ZodIntersection)throw new Error("Intersection schemas are not supported");if(t instanceof U.ZodPromise)throw new Error("Promise schemas are not supported");if(t instanceof U.ZodFunction)throw new Error("Function schemas are not supported");return JSON.stringify(t.parse(e))}function Je(e){return typeof e=="object"&&e!==null&&"then"in e}function O(e,t){const r=e["~standard"].validate(t);if(Je(r))throw new Error("Promise schemas are not supported");if(r.issues)throw new Error("Validation failed");return r.value}function Hr(e){return le(e)&&"type"in e&&typeof e.type=="string"&&"~standard"in e&&le(e["~standard"])&&"vendor"in e["~standard"]&&e["~standard"].vendor==="valibot"}function Lt(e){return Hr(e)}function Vt(e){return{get:(t,{invalid:r})=>{try{return Te(t,e)}catch{throw r()}},set:(t,{invalid:r})=>{try{return Me(t,e)}catch{throw r()}}}}const $r=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;function he(e,t){if(typeof t=="string"&&$r.test(t)){const r=new Date(t);return isNaN(r.getTime())?t:r}return t}function me(e){for(const t of e)try{return t()}catch{continue}throw new Error("All functions failed")}function Ne(e,t){return e.type==="string"?1:t.type==="string"?-1:0}function Te(e,t){if(t.type==="boolean")return O(t,!!e);if(t.type==="date")return O(t,new Date(e));if(t.type==="number")return O(t,Number(e));if(t.type==="literal")return me([()=>O(t,Number(e)),()=>O(t,!!e),()=>O(t,e)]);if(t.type==="object")return O(t,JSON.parse(e,he));if(t.type==="enum")return me([()=>O(t,Number(e)),()=>O(t,!!e),()=>O(t,e)]);if(t.type==="array"||t.type==="tuple")return O(t,JSON.parse(e,he));if(t.type==="union"&&"options"in t){const r=t.options.sort(Ne).map(n=>()=>Te(e,n));return me(r)}if(t.type==="variant"&&"options"in t){const r=t.options.sort(Ne).map(n=>()=>Te(e,n));return me(r)}if(t.type==="record")return O(t,JSON.parse(e,he));if(t.type==="map")return O(t,new Map(JSON.parse(e,he)));if(t.type==="set")return O(t,new Set(JSON.parse(e,he)));if(t.type==="intersection")throw new Error("Intersection schemas are not supported");if(t.type==="promise")throw new Error("Promise schemas are not supported");if(t.type==="function")throw new Error("Function schemas are not supported");return O(t,e)}function Me(e,t){if(t.type==="string"||t.type==="boolean")return O(t,e).toString();if(t.type==="date")return O(t,e).toISOString();if(t.type==="number")return O(t,Number(e)).toString();if(t.type==="literal")return O(t,e).toString();if(t.type==="object")return JSON.stringify(O(t,e));if(t.type==="enum"||t.type==="nativeEnum")return O(t,e).toString();if(t.type==="array"||t.type==="tuple")return JSON.stringify(O(t,e));if(t.type==="union"&&"options"in t){const r=t.options.sort(Ne).map(n=>()=>Me(e,n));return me(r)}if(t.type==="variant"&&"options"in t){const r=t.options.sort(Ne).map(n=>()=>Me(e,n));return me(r)}if(t.type==="record")return JSON.stringify(O(t,e));if(t.type==="map"){const r=O(t,e);return JSON.stringify(Array.from(r.entries()))}if(t.type==="set"){const r=O(t,e);return JSON.stringify(Array.from(r.values()))}if(t.type==="intersection")throw new Error("Intersection schemas are not supported");if(t.type==="promise")throw new Error("Promise schemas are not supported");if(t.type==="function")throw new Error("Function schemas are not supported");return JSON.stringify(O(t,e))}function qr(e,t){return e[t]??String}const Z={invalid:e=>{throw new Y(e)}},Nt={get:e=>e,set:(e,{invalid:t})=>{if(typeof e!="string")throw t();return e}},Fe={get:(e,{invalid:t})=>{if(e==="true")return!0;if(e==="false")return!1;throw t()},set:(e,{invalid:t})=>{if(typeof e!="boolean")throw t();return e.toString()}},We={get:(e,{invalid:t})=>{const r=Number(e);if(isNaN(r))throw t();return r},set:(e,{invalid:t})=>{if(typeof e!="number")throw t();return e.toString()}},Bt={get:(e,{invalid:t})=>{const r=new Date(e);if(isNaN(r.getTime()))throw t();return r},set:(e,{invalid:t})=>{if(typeof e!="object"||!(e instanceof Date))throw t();return e.toISOString()}},Ct={get:(e,{invalid:t})=>{try{return JSON.parse(e)}catch{throw t()}},set:(e,{invalid:t})=>{try{return JSON.stringify(e)}catch{throw t()}}};function Dr(e,t){switch(typeof t){case"string":return Nt.get(e,Z)===t;case"number":return We.get(e,Z)===t;case"boolean":return Fe.get(e,Z)===t;default:return!1}}function ne(e,t,r=!1){if(e===void 0||!M(e)){if(Nr(t))return t.defaultValue;if(r)return;throw new Y}if(t===String)return Nt.get(e,Z);if(t===Boolean)return Fe.get(e,Z);if(t===Number)return We.get(e,Z);if(t===Date)return Bt.get(e,Z);if(t===JSON)return Ct.get(e,Z);if(Vr(t))return t(e,Z);if(Le(t))return t.get(e,Z);if(t instanceof RegExp){if(t.test(e))return e;throw new Y}if(Pt(t)){if(Dr(e,t))return t;throw new Y}return Ut(t)?kt(t).get(e,Z):Lt(t)?Vt(t).get(e,Z):e}function Ge(e,t,r=!1){try{return ne(e,t,r)}catch(n){if(n instanceof Y)return;throw n}}function _r(e,t,r=!1){try{return K(e,t,r)}catch(n){if(n instanceof Y)return;throw n}}function K(e,t,r=!1){if(e===void 0){if(r)return"";throw new Y}if(t===Boolean)return Fe.set(e,Z);if(t===Number)return We.set(e,Z);if(t===Date)return Bt.set(e,Z);if(t===JSON)return Ct.set(e,Z);if(Le(t))return t.set(e,Z);if(Pt(t)){if(t!==e)throw new Y;return e.toString()}if(Ut(t))return kt(t).set(e,Z);if(Lt(t))return Vt(t).set(e,Z);try{return e.toString()}catch{throw new Y}}function Qe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ir(e,t){const r=Array.from(e.matchAll(t));if(r.length===0)return[e];let n=0;const o=r.reduce((s,i)=>{const c=Qe(e.slice(n,i.index));c.length&&s.push(c);const[d]=i;return s.push(d),n=i.index+d.length,s},[]),a=e.slice(n);return a&&o.push(a),o}function Jr(e){const t=Ot(e.path.value);return new RegExp(`^${t}$`,"i")}function Tr(e){const t=new URLSearchParams(e.query.value);return Array.from(t.entries()).filter(([,r])=>!Ye(r)).map(([r,n])=>{const o=Ot(n);return new RegExp(`${Qe(r)}=${o}(&|$)`,"i")})}function Ot(e){return Ir(e,new RegExp(Be,"g")).map(t=>t.startsWith(we)?xt(t):Qe(t)).join("")}function xt(e){return e.replace(new RegExp(Be,"g"),Wr)}function Mr(e,t){const r=jt(t);return e.replace(r,Gr)}function ze(e,t){return Qr(t).test(e.value)}function Ye(e){return new RegExp(Fr,"g").test(e)}const Be=`\\${we}\\??([\\w-_]+)\\${ke}`,Fr=`\\${we}\\?([\\w-_]+)\\${ke}`,Wr=".*",Gr="(.*)";function Ke(e){const[t]=Zt(e,new RegExp(Be,"g"));return t}function jt(e){return new RegExp(`\\${we}\\??${e}\\${ke}`,"g")}function Qr(e){return new RegExp(`\\${we}\\?${e}\\${ke}`,"g")}function Zt(e,t){return Array.from(e.matchAll(t)).flatMap(([,...n])=>n.map(o=>M(o)?o:""))}function zr(e="",t={}){return M(e)?Array.from(e.matchAll(new RegExp(Be,"g"))).reduce((n,[o,a])=>{const s=Ke(o);if(!s)return n;const i=qr(t,s);return fe([s],n),n[a]=i,n},{}):{}}function Yr(e){return le(e)&&typeof e.value=="string"}function oe(e){return e===void 0?Q():Yr(e)?e:Q(e,{})}function Q(e,t){return{value:e??"",params:zr(e,t)}}function Ht(e,t){fe(e.params,t.params);const r=`${e.value}${t.value}`;return Q(r,{...e.params,...t.params})}function Kr(e,t){return Ht(e,t)}class $t extends Error{constructor(t){super(`Child property on meta for ${t} conflicts with the parent meta.`)}}function Xr(e,t){return en(e,t),{...e,...t}}function en(e,t){const r=Object.keys(e).find(n=>n in t&&typeof t[n]!=typeof e[n]);if(r)throw new $t(r)}function tn(e,t){fe(e.params,t.params);const r=[e.value,t.value].filter(M).join("&");return Q(r,{...e.params,...t.params})}function rn(e,t){return fe(e,t),{...e,...t}}function Xe(e){return"parent"in e&&!!e.parent}function et(e){return"component"in e&&!!e.component}function tt(e){return"props"in e&&typeof e.props=="function"}function rt(e){return"components"in e&&!!e.components}function nt(e){return"props"in e&&typeof e.props=="object"}function ot(e,t){return{...t,path:Ht(e.path,t.path),query:tn(e.query,t.query),meta:Xr(e.meta,t.meta),state:rn(e.state,t.state),hash:Kr(e.hash,t.hash),matches:[...e.matches,t.matched],host:e.host,depth:e.depth+1}}function _(e){return typeof e!="string"?!1:/^(https?:\/\/|\/).*/g.test(e)}function at(e){return _(e)?e:`/${e}`}class ae extends Error{constructor(){super("Router not installed")}}class qt extends Error{constructor(t,r){super(`useRoute called with incorrect route. Given ${t}, expected ${r}`)}}function st(){let e=0;return()=>(++e).toString()}const nn=st()();function on(e){return e===nn}const it=st();function Dt(e){return e===void 0?"":e}function se(e,t){const r=it(),n=Dt(e.name),o=oe(e.path),a=oe(e.query),s=oe(e.hash),i=e.meta??{},c=e.state??{},d=u.markRaw({id:r,meta:i,state:c,...e,props:t}),y={id:r,matched:d,matches:[d],name:n,path:o,query:a,hash:s,meta:i,state:c,depth:1,host:Q(),prefetch:e.prefetch},R=Xe(e)?ot(e.parent,y):y;return fe(R.path.params,R.query.params,R.hash.params),R}function an(e){const t=it(),r=Dt(e.name),n=oe(e.path),o=oe(e.query),a=oe(e.hash),s=e.meta??{},i=oe(e.host),c=u.markRaw({id:t,meta:{},state:{},...e}),d={id:t,matched:c,matches:[c],name:r,host:i,path:n,query:o,hash:a,meta:s,depth:1,state:{}},y=Xe(e)?ot(e.parent,d):d;return fe(y.path.params,y.query.params,y.host.params,y.hash.params),y}function Ee(){const e=new Map;return t=>{const r=e.get(t);if(!r){const n=Symbol();return e.set(t,n),n}return r}}const sn=Ee();function ct(e){const t=sn(e);return({increment:r=!1}={})=>{const n=u.inject(t,0);return r&&u.provide(t,n+1),n}}const be=(e,t,r)=>{const n=e.matches,o=t?.matches??[];return n.at(r)?.id!==o.at(r)?.id},ve=(e,t,r)=>{const n=e.matches,o=t?.matches??[];return n.at(r)?.id!==o.at(r)?.id},Se=(e,t,r)=>e.matches.at(r)?.id===t?.matches.at(r)?.id;function _t(e){switch(e){case"onBeforeRouteEnter":case"onAfterRouteEnter":return be;case"onBeforeRouteUpdate":case"onAfterRouteUpdate":return Se;case"onBeforeRouteLeave":case"onAfterRouteLeave":return ve;default:throw new Error(`Switch is not exhaustive for lifecycle: ${e}`)}}class It{onBeforeRouteEnter=new Set;onBeforeRouteUpdate=new Set;onBeforeRouteLeave=new Set;onAfterRouteEnter=new Set;onAfterRouteUpdate=new Set;onAfterRouteLeave=new Set}function cn(e,t){const r=new It;return e.matches.forEach((n,o)=>{n.onBeforeRouteEnter&&be(e,t,o)&&ue(n.onBeforeRouteEnter).forEach(a=>{process.env.NODE_ENV==="development"&&console.warn("[vue-router] onBeforeRouteEnter is deprecated. Use router.onBeforeRouteEnter instead"),r.onBeforeRouteEnter.add(a)}),n.onBeforeRouteUpdate&&Se(e,t,o)&&ue(n.onBeforeRouteUpdate).forEach(a=>{process.env.NODE_ENV==="development"&&console.warn("[vue-router] onBeforeRouteUpdate is deprecated. Use router.onBeforeRouteUpdate instead"),r.onBeforeRouteUpdate.add(a)})}),t?.matches.forEach((n,o)=>{n.onBeforeRouteLeave&&ve(e,t,o)&&ue(n.onBeforeRouteLeave).forEach(a=>{process.env.NODE_ENV==="development"&&console.warn("[vue-router] onBeforeRouteLeave is deprecated. Use router.onBeforeRouteLeave instead"),r.onBeforeRouteLeave.add(a)})}),r}function un(e,t){const r=new It;return e.matches.forEach((n,o)=>{n.onAfterRouteEnter&&be(e,t,o)&&ue(n.onAfterRouteEnter).forEach(a=>{process.env.NODE_ENV==="development"&&console.warn("[vue-router] onAfterRouteEnter is deprecated. Use router.onAfterRouteEnter instead"),r.onAfterRouteEnter.add(a)}),n.onAfterRouteUpdate&&Se(e,t,o)&&ue(n.onAfterRouteUpdate).forEach(a=>{process.env.NODE_ENV==="development"&&console.warn("[vue-router] onAfterRouteUpdate is deprecated. Use router.onAfterRouteUpdate instead"),r.onAfterRouteUpdate.add(a)})}),t?.matches.forEach((n,o)=>{n.onAfterRouteLeave&&ve(e,t,o)&&ue(n.onAfterRouteLeave).forEach(a=>{process.env.NODE_ENV==="development"&&console.warn("[vue-router] onAfterRouteLeave is deprecated. Use router.onAfterRouteLeave instead"),r.onAfterRouteLeave.add(a)})}),r}class Ce extends Error{}class I extends Ce{response;constructor(t){super("Uncaught ContextPushError"),this.response={status:"PUSH",to:t}}}class ee extends Ce{response;constructor(t){super("Uncaught ContextRejectionError"),this.response={status:"REJECT",type:t}}}class ut extends Ce{response;constructor(){super("Uncaught ContextAbortError"),this.response={status:"ABORT"}}}class Pe{onBeforeRouteEnter=new Set;onBeforeRouteUpdate=new Set;onBeforeRouteLeave=new Set;onAfterRouteEnter=new Set;onAfterRouteUpdate=new Set;onAfterRouteLeave=new Set;onError=new Set}function fn(e,t,r){const n=new Pe;return e.matches.forEach((o,a)=>{be(e,t,a)&&r.onBeforeRouteEnter.forEach(s=>n.onBeforeRouteEnter.add(s)),Se(e,t,a)&&r.onBeforeRouteUpdate.forEach(s=>n.onBeforeRouteUpdate.add(s))}),t?.matches.forEach((o,a)=>{ve(e,t,a)&&r.onBeforeRouteLeave.forEach(s=>n.onBeforeRouteLeave.add(s))}),n}function ln(e,t,r){const n=new Pe;return e.matches.forEach((o,a)=>{be(e,t,a)&&r.onAfterRouteEnter.forEach(s=>n.onAfterRouteEnter.add(s)),Se(e,t,a)&&r.onAfterRouteUpdate.forEach(s=>n.onAfterRouteUpdate.add(s))}),t?.matches.forEach((o,a)=>{ve(e,t,a)&&r.onAfterRouteLeave.forEach(s=>n.onAfterRouteLeave.add(s))}),n}function Jt(){let e=null;function t(n){e=n}function r(n){return e?e.runWithContext(n):n()}return{setVueApp:t,runWithContext:r}}function pn(e){return{reject:a=>{throw new ee(a)},push:(...a)=>{throw new I(a)},replace:(a,s,i)=>{if(_(a)){const y=s??{};throw new I([a,{...y,replace:!0}])}const c=s,d=i??{};throw new I([a,c,{...d,replace:!0}])},abort:()=>{throw new ut}}}const Tt=Ee();function dn(e){const{setVueApp:t,runWithContext:r}=Jt(),n={global:new Pe,component:new Pe},{reject:o,push:a,replace:s,abort:i}=pn(),c=f=>(n.global.onBeforeRouteEnter.add(f),()=>n.global.onBeforeRouteEnter.delete(f)),d=f=>(n.global.onBeforeRouteUpdate.add(f),()=>n.global.onBeforeRouteUpdate.delete(f)),y=f=>(n.global.onBeforeRouteLeave.add(f),()=>n.global.onBeforeRouteLeave.delete(f)),R=f=>(n.global.onAfterRouteEnter.add(f),()=>n.global.onAfterRouteEnter.delete(f)),L=f=>(n.global.onAfterRouteUpdate.add(f),()=>n.global.onAfterRouteUpdate.delete(f)),S=f=>(n.global.onAfterRouteLeave.add(f),()=>n.global.onAfterRouteLeave.delete(f)),x=f=>(n.global.onError.add(f),()=>n.global.onError.delete(f));async function w({to:f,from:E}){const{global:b,component:l}=n,g=cn(f,E),P=fn(f,E,b),B=[...P.onBeforeRouteEnter,...g.onBeforeRouteEnter,...P.onBeforeRouteUpdate,...g.onBeforeRouteUpdate,...l.onBeforeRouteUpdate,...P.onBeforeRouteLeave,...g.onBeforeRouteLeave,...l.onBeforeRouteLeave];try{const N=B.map(C=>r(()=>C(f,{from:E,reject:o,push:a,replace:s,abort:i})));await Promise.all(N)}catch(N){if(N instanceof I||N instanceof ee||N instanceof ut)return N.response;try{h(N,{to:f,from:E,source:"hook"})}catch(C){if(C instanceof I||C instanceof ee)return C.response;throw C}}return{status:"SUCCESS"}}async function k({to:f,from:E}){const{global:b,component:l}=n,g=un(f,E),P=ln(f,E,b),B=[...l.onAfterRouteLeave,...g.onAfterRouteLeave,...P.onAfterRouteLeave,...l.onAfterRouteUpdate,...g.onAfterRouteUpdate,...P.onAfterRouteUpdate,...l.onAfterRouteEnter,...g.onAfterRouteEnter,...P.onAfterRouteEnter];try{const N=B.map(C=>r(()=>C(f,{from:E,reject:o,push:a,replace:s})));await Promise.all(N)}catch(N){if(N instanceof I||N instanceof ee)return N.response;try{h(N,{to:f,from:E,source:"hook"})}catch(C){if(C instanceof I||C instanceof ee)return C.response;throw C}}return{status:"SUCCESS"}}function h(f,{to:E,from:b,source:l}){for(const g of n.global.onError)try{g(f,{to:E,from:b,source:l,reject:o,push:a,replace:s});return}catch(P){if(P instanceof Ce)throw P;if(P===f)continue;throw P}}return{runBeforeRouteHooks:w,runAfterRouteHooks:k,runErrorHooks:h,addComponentBeforeRouteHook:({lifecycle:f,depth:E,hook:b})=>{const l=_t(f),g=n.component[f],P=(B,N)=>{if(l(B,N.from,E))return b(B,N)};return g.add(P),()=>g.delete(P)},addComponentAfterRouteHook:({lifecycle:f,depth:E,hook:b})=>{const l=_t(f),g=n.component[f],P=(B,N)=>{if(l(B,N.from,E))return b(B,N)};return g.add(P),()=>g.delete(P)},addGlobalRouteHooks:f=>{f.onBeforeRouteEnter.forEach(E=>c(E)),f.onBeforeRouteUpdate.forEach(E=>d(E)),f.onBeforeRouteLeave.forEach(E=>y(E)),f.onAfterRouteEnter.forEach(E=>R(E)),f.onAfterRouteUpdate.forEach(E=>L(E)),f.onAfterRouteLeave.forEach(E=>S(E)),f.onError.forEach(E=>x(E))},onBeforeRouteEnter:c,onBeforeRouteUpdate:d,onBeforeRouteLeave:y,onAfterRouteEnter:R,onAfterRouteUpdate:L,onAfterRouteLeave:S,onError:x,setVueApp:t}}function Mt(e){const t=Tt(e);return()=>{const r=u.inject(t);if(!r)throw new ae;return r}}function Ft(e,t){const r=ct(e),n=Mt(e);return o=>{const a=r(),i=n().addComponentBeforeRouteHook({lifecycle:t,hook:o,depth:a-1});return u.onUnmounted(i),i}}function Wt(e,t){const r=ct(e),n=Mt(e);return o=>{const a=r(),i=n().addComponentAfterRouteHook({lifecycle:t,hook:o,depth:a-1});return u.onUnmounted(i),i}}function hn(e){const t=Ft(e,"onBeforeRouteLeave"),r=Ft(e,"onBeforeRouteUpdate"),n=Wt(e,"onAfterRouteLeave"),o=Wt(e,"onAfterRouteUpdate");return{onBeforeRouteLeave:t,onBeforeRouteUpdate:r,onAfterRouteLeave:n,onAfterRouteUpdate:o}}const Gt=Ee();function mn(e){const t=Gt(e);return()=>{const r=u.inject(t);if(!r)throw new ae;return r}}const Qt=Ee();function Rn(e){const t=Qt(e);return()=>{const r=u.inject(t);if(!r)throw new ae;return r}}function Ae(e){return()=>{const t=u.inject(e);if(!t)throw new ae;return t}}const zt=Symbol("isRouterRouteSymbol");function yn(e,t){return typeof t=="object"&&t!==null&&zt in t&&e in t}function gn(e,t,r){function n(h,v,m){if(typeof h=="object"){const f={...t.params,...h};return r(t.name,f,v)}const p={...t.params,[h]:v};return r(t.name,p,m)}const o=(...h)=>{const v=new URLSearchParams(t.query);v.set(...h),n({},{query:v})},a=(...h)=>{const v=new URLSearchParams(t.query);v.append(...h),n({},{query:v})},s=(...h)=>{const v=new URLSearchParams(t.query);v.delete(...h),n({},{query:v})},{id:i,matched:c,matches:d,name:y,hash:R,href:L}=u.toRefs(t),S=u.computed({get(){return new Proxy(t.params,{set(h,v,m){return n(v,m),!0}})},set(h){n(h)}}),x=u.computed({get(){return new Proxy(t.query,{get(h,v,m){switch(v){case"append":return a;case"set":return o;case"delete":return s;default:return Reflect.get(h,v,m)}}})},set(h){n({},{query:h})}}),w=u.computed({get(){return new Proxy(t.state,{set(h,v,m){return n({},{state:{...t.state,[v]:m}}),!0}})},set(h){n({},{state:h})}});return u.reactive({id:i,matched:c,matches:d,state:w,query:x,hash:R,params:S,name:y,href:L,update:n,[zt]:!0,[e]:!0})}function ft(e){return(t,r,{exact:n}={})=>yn(e,t)?r===void 0?!0:n?t.matched.name===r:t.matches.map(o=>o.name).includes(r):!1}function Oe(e){const t=Ae(e),r=ft(e);return(n,o)=>{const a=t();function s(){if(!n)return;if(!r(a.route,n,o))throw new qt(n,a.route.name)}return u.watch(a.route,s,{immediate:!0,deep:!0}),a.route}}function lt(e){const t=Oe(e),r=Ae(e),n=Rn(e),o=ct(e),a=mn(e);return u.defineComponent((s,i)=>{const c=t(),d=r(),y=n(),R=o({increment:!0});u.onServerPrefetch(async()=>{await d.start()});const{getRouteComponents:L}=a(),S=u.computed(()=>{if(!d.started.value)return null;if(y.value)return y.value.component;const x=c.matches.at(R);if(!x)return null;const w=L(x),k=s.name??"default";return w[k]});return()=>i.slots.default?i.slots.default({route:c,component:S,rejection:y.value}):S.value?u.h(S.value):null},{name:"RouterView",props:["name"]})}const Yt=Ee();function Kt(e){const t=Yt(e);return()=>{const r=u.inject(t);if(!r)throw new ae;return r}}const wn="lazy",En={components:!0,props:!1};function xe(e){return["eager","lazy","intent"].includes(e)}function Xt({routerPrefetch:e,routePrefetch:t,linkPrefetch:r},n){const o=pt(r,n),a=pt(t,n),s=pt(e,n),i=[o,a,s,En[n],wn].reduce((c,d)=>xe(c)?c:c===!0&&xe(d)?d:c===!0&&!xe(d)?c:c===void 0?d:c,void 0);return xe(i)?i:!1}function pt(e,t){return le(e)?e[t]:e}const bn=u.defineAsyncComponent(()=>new Promise(e=>{e({default:{template:"foo"}})}));function er(e){return e.name===bn.name&&"__asyncLoader"in e}const tr=Symbol("visibilityObserver");function vn(e){const t=u.inject(tr);if(!t)throw new ae;return u.watch(e,(n,o)=>{n&&t.observe(n),o&&t.unobserve(o)},{immediate:!0}),u.onUnmounted(()=>{e.value&&t.unobserve(e.value)}),{isElementVisible:u.computed(()=>e.value?t.isElementVisible(e.value):!1)}}function rr(e,t,r){u.watch(e,(n,o)=>{n&&n.addEventListener(t,r),o&&o.removeEventListener(t,r)},{immediate:!0}),u.onUnmounted(()=>{e.value&&e.value.removeEventListener(t,r)})}function Sn(e){const t=Kt(e);return r=>{const n=new Map,o=u.ref(),{getPrefetchProps:a,setPrefetchProps:s}=t(),{isElementVisible:i}=vn(o),c=()=>{const R=Array.from(n.values()).reduce((L,S)=>(Object.assign(L,S),L),{});s(R)};u.watch(()=>u.toValue(r),({route:R,...L})=>{n.clear(),R&&y("eager",R,L)},{immediate:!0}),u.watch(i,R=>{const{route:L,...S}=u.toValue(r);!L||!R||y("lazy",L,S)},{immediate:!0}),rr(o,"focusin",d),rr(o,"mouseover",d);function d(){const{route:R,...L}=u.toValue(r);R&&y("intent",R,L)}function y(R,L,S){Pn(R,L,S),n.has(R)||n.set(R,a(R,L,S))}return{element:o,commit:c}}}function Pn(e,t,r){t.matches.forEach(n=>{Xt({...r,routePrefetch:n.prefetch},"components")===e&&(et(n)&&er(n.component)&&n.component.__asyncLoader(),rt(n)&&Object.values(n.components).forEach(a=>{er(a)&&a.__asyncLoader()}))})}function dt(...e){const t=new URLSearchParams;for(const r of e){const n=new URLSearchParams(r);for(const[o,a]of n.entries())t.append(o,a)}return t}function nr(e){const t=Ae(e),r=Sn(e),n=ft(e);return(o,a={},s={})=>{const i=t(),c=u.computed(()=>{const p=u.toValue(o);return typeof p!="string"?p:_(p)?i.find(p,u.toValue(s)):i.resolve(p,u.toValue(a),u.toValue(s))}),d=u.computed(()=>{if(c.value)return c.value.href;const p=u.toValue(o);if(_(p))return p;console.error(new Error("Failed to resolve route in RouterLink."))}),y=u.computed(()=>n(i.route)&&i.route.matches.some(p=>p.id===c.value?.id)),R=u.computed(()=>i.route.id===c.value?.id),L=u.computed(()=>n(i.route)&&Cr(c.value)&&i.route.href.startsWith(c.value.href)),S=u.computed(()=>i.route.href===c.value?.href),x=u.computed(()=>!!d.value&&i.isExternal(d.value)),w=u.computed(()=>{const p=u.toValue(o);return typeof p!="string"||_(p)?u.toValue(a):u.toValue(s)}),{element:k,commit:h}=r(()=>({route:c.value,routerPrefetch:i.prefetch,linkPrefetch:w.value.prefetch})),v=p=>{h();const f={replace:p?.replace??w.value.replace,query:dt(w.value.query,p?.query),hash:p?.hash??w.value.hash,state:{...w.value.state,...p?.state}},E=u.toValue(o);return _(E)||typeof E=="object"?i.push(E,f):i.push(E,u.toValue(a),f)};return{element:k,route:c,href:d,isMatch:y,isExactMatch:R,isActive:L,isExactActive:S,isExternal:x,push:v,replace:p=>v({...p,replace:!0})}}}function or(e){const t=Ae(e),r=nr(e);return u.defineComponent((n,o)=>{const a=t(),s=u.computed(()=>h(n.to)),i=u.computed(()=>v(n.to)),c=u.computed(()=>{const{to:p,...f}=n;return f}),{element:d,isMatch:y,isExactMatch:R,isActive:L,isExactActive:S,isExternal:x,push:w}=r(()=>typeof n.to=="function"?n.to(a.resolve):n.to,c),k=u.computed(()=>({"router-link--match":y.value,"router-link--exact-match":R.value,"router-link--active":L.value,"router-link--exact-active":S.value}));function h(p){if(typeof p=="function"){const f=p(a.resolve);return h(f)}return _(p)?a.find(p):p}function v(p){if(typeof p=="function"){const f=p(a.resolve);return v(f)}return _(p)?p:p?.href}function m(p){p.preventDefault(),w()}return()=>u.h("a",{href:i.value,class:["router-link",k.value],ref:d,onClick:m},o.slots.default?.({route:s.value,isMatch:y.value,isExactMatch:R.value,isActive:L.value,isExactActive:S.value,isExternal:x.value}))},{name:"RouterLink",props:["to","prefetch","query","hash","replace","state"]})}function An(e){const t=Oe(e);return(r,n=String)=>{const o=t(),a=u.computed({get(){const i=o.query.get(u.toValue(r));return i===null?null:Ge(i,n)},set(i){o.query.set(u.toValue(r),K(i,n))}}),s=u.computed({get(){return o.query.getAll(u.toValue(r)).map(c=>Ge(c,n)).filter(c=>c!==null)},set(i){const c=new URLSearchParams(o.query);c.delete(u.toValue(r)),i.forEach(d=>{c.append(u.toValue(r),K(d,n))}),o.query=c}});return{value:a,values:s,remove:()=>{o.query.delete(u.toValue(r))}}}}function ar(e){const t=typeof e=="object"?e.key:e,{onBeforeRouteLeave:r,onBeforeRouteUpdate:n,onAfterRouteLeave:o,onAfterRouteUpdate:a}=hn(t),s=ft(t),i=lt(t),c=or(t),d=Oe(t),y=Ae(t),R=An(t),L=nr(t);return{onBeforeRouteLeave:r,onBeforeRouteUpdate:n,onAfterRouteLeave:o,onAfterRouteUpdate:a,isRoute:s,RouterView:i,RouterLink:c,useRoute:d,useRouter:y,useQueryValue:R,useLink:L}}function Un(e){return{routes:e.routes??[],rejections:e.rejections??{},...e}}function sr(e){return{get:(t,{invalid:r})=>{for(const n of e){const o=Ge(t,n);if(o!==void 0)return o}throw r(`Value ${t} does not satisfy any of the possible values`)},set:(t,{invalid:r})=>{for(const n of e){const o=_r(t,n);if(o!==void 0)return o}throw r(`Value ${t} does not satisfy any of the possible values`)}}}const kn={separator:","};function Ln(e,t={}){const{separator:r}={...kn,...t},n=sr(e);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 Vn={separator:","};function Nn(e,t={}){const{separator:r}={...Vn,...t};return{get:n=>{const o=n.split(r);return e.map((a,s)=>ne(o.at(s),a))},set:(n,{invalid:o})=>{if(!Array.isArray(n))throw o("Expected a tuple");if(n.length!==e.length)throw o(`Expected tuple with ${e.length} values but received ${n.length} values`);return e.map((a,s)=>K(n.at(s),a)).join(r)}}}function te(){return te=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},te.apply(null,arguments)}var H;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(H||(H={}));var Re=process.env.NODE_ENV!=="production"?function(e){return Object.freeze(e)}:function(e){return e};function ie(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}var je="beforeunload",Bn="hashchange",ir="popstate";function cr(e){e===void 0&&(e={});var t=e,r=t.window,n=r===void 0?document.defaultView:r,o=n.history;function a(){var b=n.location,l=b.pathname,g=b.search,P=b.hash,B=o.state||{};return[B.idx,Re({pathname:l,search:g,hash:P,state:B.usr||null,key:B.key||"default"})]}var s=null;function i(){if(s)S.call(s),s=null;else{var b=H.Pop,l=a(),g=l[0],P=l[1];if(S.length)if(g!=null){var B=y-g;B&&(s={action:b,location:P,retry:function(){f(B*-1)}},f(B))}else process.env.NODE_ENV!=="production"&&ie(!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 v(b)}}n.addEventListener(ir,i);var c=H.Pop,d=a(),y=d[0],R=d[1],L=ye(),S=ye();y==null&&(y=0,o.replaceState(te({},o.state,{idx:y}),""));function x(b){return typeof b=="string"?b:ce(b)}function w(b,l){return l===void 0&&(l=null),Re(te({pathname:R.pathname,hash:"",search:""},typeof b=="string"?Ue(b):b,{state:l,key:He()}))}function k(b,l){return[{usr:b.state,key:b.key,idx:l},x(b)]}function h(b,l,g){return!S.length||(S.call({action:b,location:l,retry:g}),!1)}function v(b){c=b;var l=a();y=l[0],R=l[1],L.call({action:c,location:R})}function m(b,l){var g=H.Push,P=w(b,l);function B(){m(b,l)}if(h(g,P,B)){var N=k(P,y+1),C=N[0],$=N[1];try{o.pushState(C,"",$)}catch{n.location.assign($)}v(g)}}function p(b,l){var g=H.Replace,P=w(b,l);function B(){p(b,l)}if(h(g,P,B)){var N=k(P,y),C=N[0],$=N[1];o.replaceState(C,"",$),v(g)}}function f(b){o.go(b)}var E={get action(){return c},get location(){return R},createHref:x,push:m,replace:p,go:f,back:function(){f(-1)},forward:function(){f(1)},listen:function(l){return L.push(l)},block:function(l){var g=S.push(l);return S.length===1&&n.addEventListener(je,Ze),function(){g(),S.length||n.removeEventListener(je,Ze)}}};return E}function Cn(e){e===void 0&&(e={});var t=e,r=t.window,n=r===void 0?document.defaultView:r,o=n.history;function a(){var l=Ue(n.location.hash.substr(1)),g=l.pathname,P=g===void 0?"/":g,B=l.search,N=B===void 0?"":B,C=l.hash,$=C===void 0?"":C,W=o.state||{};return[W.idx,Re({pathname:P,search:N,hash:$,state:W.usr||null,key:W.key||"default"})]}var s=null;function i(){if(s)S.call(s),s=null;else{var l=H.Pop,g=a(),P=g[0],B=g[1];if(S.length)if(P!=null){var N=y-P;N&&(s={action:l,location:B,retry:function(){E(N*-1)}},E(N))}else process.env.NODE_ENV!=="production"&&ie(!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 m(l)}}n.addEventListener(ir,i),n.addEventListener(Bn,function(){var l=a(),g=l[1];ce(g)!==ce(R)&&i()});var c=H.Pop,d=a(),y=d[0],R=d[1],L=ye(),S=ye();y==null&&(y=0,o.replaceState(te({},o.state,{idx:y}),""));function x(){var l=document.querySelector("base"),g="";if(l&&l.getAttribute("href")){var P=n.location.href,B=P.indexOf("#");g=B===-1?P:P.slice(0,B)}return g}function w(l){return x()+"#"+(typeof l=="string"?l:ce(l))}function k(l,g){return g===void 0&&(g=null),Re(te({pathname:R.pathname,hash:"",search:""},typeof l=="string"?Ue(l):l,{state:g,key:He()}))}function h(l,g){return[{usr:l.state,key:l.key,idx:g},w(l)]}function v(l,g,P){return!S.length||(S.call({action:l,location:g,retry:P}),!1)}function m(l){c=l;var g=a();y=g[0],R=g[1],L.call({action:c,location:R})}function p(l,g){var P=H.Push,B=k(l,g);function N(){p(l,g)}if(process.env.NODE_ENV!=="production"&&ie(B.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.push("+JSON.stringify(l)+")"),v(P,B,N)){var C=h(B,y+1),$=C[0],W=C[1];try{o.pushState($,"",W)}catch{n.location.assign(W)}m(P)}}function f(l,g){var P=H.Replace,B=k(l,g);function N(){f(l,g)}if(process.env.NODE_ENV!=="production"&&ie(B.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.replace("+JSON.stringify(l)+")"),v(P,B,N)){var C=h(B,y),$=C[0],W=C[1];o.replaceState($,"",W),m(P)}}function E(l){o.go(l)}var b={get action(){return c},get location(){return R},createHref:w,push:p,replace:f,go:E,back:function(){E(-1)},forward:function(){E(1)},listen:function(g){return L.push(g)},block:function(g){var P=S.push(g);return S.length===1&&n.addEventListener(je,Ze),function(){P(),S.length||n.removeEventListener(je,Ze)}}};return b}function ur(e){e===void 0&&(e={});var t=e,r=t.initialEntries,n=r===void 0?["/"]:r,o=t.initialIndex,a=n.map(function(m){var p=Re(te({pathname:"/",search:"",hash:"",state:null,key:He()},typeof m=="string"?Ue(m):m));return process.env.NODE_ENV!=="production"&&ie(p.pathname.charAt(0)==="/","Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(m)+")"),p}),s=fr(o??a.length-1,0,a.length-1),i=H.Pop,c=a[s],d=ye(),y=ye();function R(m){return typeof m=="string"?m:ce(m)}function L(m,p){return p===void 0&&(p=null),Re(te({pathname:c.pathname,search:"",hash:""},typeof m=="string"?Ue(m):m,{state:p,key:He()}))}function S(m,p,f){return!y.length||(y.call({action:m,location:p,retry:f}),!1)}function x(m,p){i=m,c=p,d.call({action:i,location:c})}function w(m,p){var f=H.Push,E=L(m,p);function b(){w(m,p)}process.env.NODE_ENV!=="production"&&ie(c.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.push("+JSON.stringify(m)+")"),S(f,E,b)&&(s+=1,a.splice(s,a.length,E),x(f,E))}function k(m,p){var f=H.Replace,E=L(m,p);function b(){k(m,p)}process.env.NODE_ENV!=="production"&&ie(c.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.replace("+JSON.stringify(m)+")"),S(f,E,b)&&(a[s]=E,x(f,E))}function h(m){var p=fr(s+m,0,a.length-1),f=H.Pop,E=a[p];function b(){h(m)}S(f,E,b)&&(s=p,x(f,E))}var v={get index(){return s},get action(){return i},get location(){return c},createHref:R,push:w,replace:k,go:h,back:function(){h(-1)},forward:function(){h(1)},listen:function(p){return d.push(p)},block:function(p){return y.push(p)}};return v}function fr(e,t,r){return Math.min(Math.max(e,t),r)}function Ze(e){e.preventDefault(),e.returnValue=""}function ye(){var e=[];return{get length(){return e.length},push:function(r){return e.push(r),function(){e=e.filter(function(n){return n!==r})}},call:function(r){e.forEach(function(n){return n&&n(r)})}}}function He(){return Math.random().toString(36).substr(2,8)}function ce(e){var t=e.pathname,r=t===void 0?"/":t,n=e.search,o=n===void 0?"":n,a=e.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 Ue(e){var t={};if(e){var r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));var n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function On(e,t,r){const n=u.reactive({...t}),o=i=>{Object.assign(n,{...i})},a=n,s=gn(e,a,r);return{currentRoute:a,routerRoute:s,updateRoute:o}}function J(e){return!e.startsWith("http")?jn(e):xn(e)}function xn(e){const{protocol:t,host:r,pathname:n,search:o,searchParams:a,hash:s}=new URL(e,e);return{protocol:t,host:r,pathname:n,search:o,searchParams:a,hash:s}}function jn(e){const{pathname:t,search:r,searchParams:n,hash:o}=new URL(e,"https://localhost");return{pathname:t,search:r,searchParams:n,hash:o}}function Zn(e){return t=>{const{host:r}=J(t);return!(r===void 0||r===e)}}function Hn(){return{reject:o=>{throw new ee(o)},push:(...o)=>{throw new I(o)},replace:(o,a,s)=>{if(_(o)){const d=a??{};throw new I([o,{...d,replace:!0}])}const i=a,c=s??{};throw new I([o,i,{...c,replace:!0}])},abort:()=>{throw new ut}}}function lr(e){try{const t=e();return Je(t)?t.catch(r=>r):t}catch(t){return t}}function $n(){const{setVueApp:e,runWithContext:t}=Jt(),r=u.reactive(new Map),{push:n,replace:o,reject:a}=Hn(),s=(w,k,h)=>k.matches.filter(v=>Xt({...h,routePrefetch:v.prefetch},"props")===w).flatMap(v=>S(v)).reduce((v,{id:m,name:p,props:f})=>{if(!f)return v;const E=L(m,p,k),b=t(()=>lr(()=>f(k,{push:n,replace:o,reject:a,parent:y(k,!0)})));return v[E]=b,v},{}),i=w=>{Object.entries(w).forEach(([k,h])=>{r.set(k,h)})},c=async w=>{const k=w.matches.flatMap(S),h=[],v=[];for(const{id:m,name:p,props:f}of k){if(!f)continue;const E=L(m,p,w);if(h.push(E),!r.has(E)){const b=t(()=>lr(()=>f(w,{push:n,replace:o,reject:a,parent:y(w)})));r.set(E,b)}v.push((async()=>{const b=await r.get(E);if(b instanceof Error)throw b})())}x(h);try{return await Promise.all(v),{status:"SUCCESS"}}catch(m){if(m instanceof I||m instanceof ee)return m.response;throw m}},d=(w,k,h)=>{const v=L(w,k,h);return r.get(v)};function y(w,k=!1){const h=w.matches.at(-2);if(h)return tt(h)?{name:h.name??"",get props(){return R(h,"default",w,k)}}:nt(h)?{name:h.name??"",props:new Proxy({},{get(v,m){return typeof m!="string"?Reflect.get(v,m):R(h,m,w,k)}})}:{name:h.name??"",props:void 0}}function R(w,k,h,v=!1){const m=d(w.id,k,h);if(v&&!m){const p=w.name??"unknown",f=h.name||"unknown";console.warn(`
2
- Unable to access parent props "${k}" from route "${p}" while prefetching props for route "${f}".
1
+ (function(B,f){typeof exports=="object"&&typeof module<"u"?f(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],f):(B=typeof globalThis<"u"?globalThis:B||self,f(B["@kitbag/router"]={},B.Vue))})(this,(function(B,f){"use strict";class bt extends Error{constructor(t){super(`Invalid Param "${t}": Router does not support multiple params by the same name. All param names must be unique.`)}}function D(e){return Array.isArray(e)?e:[e]}function Pt(e,t){return e.filter(r=>t===r).length}function pe(...e){const t=e.flatMap(r=>Array.isArray(r)?r:Object.keys(r));for(const r of t)if(Pt(t,r)>1)throw new bt(r)}class Y extends Error{}const Ee="[",Ue="]";function Nr(e){return e!==String&&e!==Boolean&&e!==Number&&e!==Date}function Vr(e){return typeof e=="function"&&Nr(e)}function ke(e){return typeof e=="object"&&"get"in e&&typeof e.get=="function"&&"set"in e&&typeof e.set=="function"}function Ut(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function kt(e,t){return ke(e)?{...e,defaultValue:t??e.defaultValue}:{get:r=>re(r,e),set:r=>X(r,e),defaultValue:t}}function Cr(e){return ke(e)&&e.defaultValue!==void 0}function xr(e,t){return kt(e,t)}function Zr(e){return e!==void 0}function le(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function G(e){return typeof e=="string"&&e.length>0}let m=null;async function Or(){const{ZodType:e,ZodString:t,ZodIPv4:r,ZodIPv6:n,ZodCIDRv4:o,ZodCIDRv6:a,ZodURL:i,ZodEmail:u,ZodUUID:c,ZodBase64:h,ZodCUID:w,ZodCUID2:A,ZodULID:g,ZodJWT:E,ZodBigInt:C,ZodNaN:S,ZodBoolean:P,ZodDate:b,ZodISODateTime:v,ZodISODate:p,ZodISOTime:s,ZodNumber:l,ZodLiteral:k,ZodObject:y,ZodEnum:d,ZodArray:R,ZodTuple:L,ZodUnion:N,ZodDiscriminatedUnion:V,ZodRecord:x,ZodMap:$,ZodSet:T,ZodIntersection:Pe,ZodPromise:At}=await import("zod");return{ZodType:e,ZodString:t,ZodIPv4:r,ZodIPv6:n,ZodCIDRv4:o,ZodCIDRv6:a,ZodURL:i,ZodEmail:u,ZodUUID:c,ZodBase64:h,ZodCUID:w,ZodCUID2:A,ZodULID:g,ZodJWT:E,ZodBigInt:C,ZodNaN:S,ZodBoolean:P,ZodDate:b,ZodISODateTime:v,ZodISODate:p,ZodISOTime:s,ZodNumber:l,ZodLiteral:k,ZodObject:y,ZodEnum:d,ZodArray:R,ZodTuple:L,ZodUnion:N,ZodDiscriminatedUnion:V,ZodRecord:x,ZodMap:$,ZodSet:T,ZodIntersection:Pe,ZodPromise:At}}function jr(e){return Object.values(e).some(t=>Object.values(t.host.params).some(r=>$e(r))||Object.values(t.path.params).some(r=>$e(r))||Object.values(t.query.params).some(r=>$e(r)))}function $e(e){return le(e)&&"parse"in e&&typeof e.parse=="function"&&"~standard"in e&&le(e["~standard"])&&"vendor"in e["~standard"]&&e["~standard"].vendor==="zod"}async function Ir(){try{m=await Or()}catch{throw new Error("Failed to initialize Zod")}}function Lt(e){return m?e instanceof m.ZodType:!1}function Bt(e){return{get:(t,{invalid:r})=>{try{return qe(t,e)}catch{throw r()}},set:(t,{invalid:r})=>{try{return Te(t,e)}catch{throw r()}}}}const Dr=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;function he(e,t){if(typeof t=="string"&&Dr.test(t)){const r=new Date(t);return isNaN(r.getTime())?t:r}return t}function ve(e){for(const t of e)try{return t()}catch{continue}throw new Error("All functions failed")}function Le(e,t){return m?.ZodString&&e instanceof m.ZodString?1:m?.ZodString&&t instanceof m.ZodString?-1:0}function qe(e,t){if(!m)throw new Error("Zod is not initialized");if(t instanceof m.ZodString)return t.parse(e);if(t instanceof m.ZodBoolean)return t.parse(!!e);if(t instanceof m.ZodDate)return t.parse(new Date(e));if(t instanceof m.ZodNumber)return t.parse(Number(e));if(t instanceof m.ZodBigInt)return t.parse(BigInt(e));if(t instanceof m.ZodNaN)return t.parse(Number(e));if(t instanceof m.ZodLiteral)return ve([()=>t.parse(Number(e)),()=>t.parse(!!e),()=>t.parse(e)]);if(t instanceof m.ZodObject)return t.parse(JSON.parse(e,he));if(t instanceof m.ZodEnum)return t.parse(e);if(t instanceof m.ZodArray||t instanceof m.ZodTuple)return t.parse(JSON.parse(e,he));if(t instanceof m.ZodUnion){const r=Array.from(t.def.options).sort(Le).map(n=>()=>qe(e,n));return ve(r)}if(t instanceof m.ZodDiscriminatedUnion){const r=Array.from(t.options).sort(Le).map(n=>()=>qe(e,n));return ve(r)}if(t instanceof m.ZodRecord)return t.parse(JSON.parse(e,he));if(t instanceof m.ZodMap)return t.parse(new Map(JSON.parse(e,he)));if(t instanceof m.ZodSet)return t.parse(new Set(JSON.parse(e,he)));if(t instanceof m.ZodIntersection)throw new Error("Intersection schemas are not supported");if(t instanceof m.ZodPromise)throw new Error("Promise schemas are not supported");return t.parse(e)}function Te(e,t){if(!m)throw new Error("Zod is not initialized");if(t instanceof m.ZodString||t instanceof m.ZodISODateTime||t instanceof m.ZodISODate||t instanceof m.ZodISOTime||t instanceof m.ZodIPv4||t instanceof m.ZodIPv6||t instanceof m.ZodCIDRv4||t instanceof m.ZodCIDRv6||t instanceof m.ZodURL||t instanceof m.ZodEmail||t instanceof m.ZodUUID||t instanceof m.ZodBase64||t instanceof m.ZodCUID||t instanceof m.ZodCUID2||t instanceof m.ZodULID||t instanceof m.ZodJWT)return t.parse(e);if(t instanceof m.ZodBoolean)return t.parse(e).toString();if(t instanceof m.ZodDate)return t.parse(e).toISOString();if(t instanceof m.ZodNumber)return t.parse(Number(e)).toString();if(t instanceof m.ZodBigInt)return t.parse(BigInt(String(e))).toString();if(t instanceof m.ZodNaN)return t.parse(e).toString();if(t instanceof m.ZodLiteral){const r=t.parse(e);return r!=null?r.toString():String(r)}if(t instanceof m.ZodObject)return JSON.stringify(t.parse(e));if(t instanceof m.ZodEnum){const r=t.parse(e);return typeof r=="string"?r:String(r)}if(t instanceof m.ZodArray||t instanceof m.ZodTuple)return JSON.stringify(t.parse(e));if(t instanceof m.ZodUnion){const r=Array.from(t.def.options).sort(Le).map(n=>()=>Te(e,n));return ve(r)}if(t instanceof m.ZodDiscriminatedUnion){const r=Array.from(t.options).sort(Le).map(n=>()=>Te(e,n));return ve(r)}if(t instanceof m.ZodRecord)return JSON.stringify(t.parse(e));if(t instanceof m.ZodMap){const r=t.parse(e);return JSON.stringify(Array.from(r.entries()))}if(t instanceof m.ZodSet){const r=t.parse(e);return JSON.stringify(Array.from(r.values()))}if(t instanceof m.ZodIntersection)throw new Error("Intersection schemas are not supported");if(t instanceof m.ZodPromise)throw new Error("Promise schemas are not supported");return JSON.stringify(t.parse(e))}function _e(e){return typeof e=="object"&&e!==null&&"then"in e}function Z(e,t){const r=e["~standard"].validate(t);if(_e(r))throw new Error("Promise schemas are not supported");if(r.issues)throw new Error("Validation failed");return r.value}function Hr(e){return le(e)&&"type"in e&&typeof e.type=="string"&&"~standard"in e&&le(e["~standard"])&&"vendor"in e["~standard"]&&e["~standard"].vendor==="valibot"}function Nt(e){return Hr(e)}function Vt(e){return{get:(t,{invalid:r})=>{try{return Je(t,e)}catch{throw r()}},set:(t,{invalid:r})=>{try{return Me(t,e)}catch{throw r()}}}}const $r=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;function Re(e,t){if(typeof t=="string"&&$r.test(t)){const r=new Date(t);return isNaN(r.getTime())?t:r}return t}function ye(e){for(const t of e)try{return t()}catch{continue}throw new Error("All functions failed")}function Be(e,t){return e.type==="string"?1:t.type==="string"?-1:0}function Je(e,t){if(t.type==="boolean")return Z(t,!!e);if(t.type==="date")return Z(t,new Date(e));if(t.type==="number")return Z(t,Number(e));if(t.type==="literal")return ye([()=>Z(t,Number(e)),()=>Z(t,!!e),()=>Z(t,e)]);if(t.type==="object")return Z(t,JSON.parse(e,Re));if(t.type==="enum")return ye([()=>Z(t,Number(e)),()=>Z(t,!!e),()=>Z(t,e)]);if(t.type==="array"||t.type==="tuple")return Z(t,JSON.parse(e,Re));if(t.type==="union"&&"options"in t){const r=t.options.sort(Be).map(n=>()=>Je(e,n));return ye(r)}if(t.type==="variant"&&"options"in t){const r=t.options.sort(Be).map(n=>()=>Je(e,n));return ye(r)}if(t.type==="record")return Z(t,JSON.parse(e,Re));if(t.type==="map")return Z(t,new Map(JSON.parse(e,Re)));if(t.type==="set")return Z(t,new Set(JSON.parse(e,Re)));if(t.type==="intersection")throw new Error("Intersection schemas are not supported");if(t.type==="promise")throw new Error("Promise schemas are not supported");if(t.type==="function")throw new Error("Function schemas are not supported");return Z(t,e)}function Me(e,t){if(t.type==="string"||t.type==="boolean")return Z(t,e).toString();if(t.type==="date")return Z(t,e).toISOString();if(t.type==="number")return Z(t,Number(e)).toString();if(t.type==="literal")return Z(t,e).toString();if(t.type==="object")return JSON.stringify(Z(t,e));if(t.type==="enum"||t.type==="nativeEnum")return Z(t,e).toString();if(t.type==="array"||t.type==="tuple")return JSON.stringify(Z(t,e));if(t.type==="union"&&"options"in t){const r=t.options.sort(Be).map(n=>()=>Me(e,n));return ye(r)}if(t.type==="variant"&&"options"in t){const r=t.options.sort(Be).map(n=>()=>Me(e,n));return ye(r)}if(t.type==="record")return JSON.stringify(Z(t,e));if(t.type==="map"){const r=Z(t,e);return JSON.stringify(Array.from(r.entries()))}if(t.type==="set"){const r=Z(t,e);return JSON.stringify(Array.from(r.values()))}if(t.type==="intersection")throw new Error("Intersection schemas are not supported");if(t.type==="promise")throw new Error("Promise schemas are not supported");if(t.type==="function")throw new Error("Function schemas are not supported");return JSON.stringify(Z(t,e))}function qr(e,t){return e[t]??String}const I={invalid:e=>{throw new Y(e)}},Ct={get:e=>e,set:(e,{invalid:t})=>{if(typeof e!="string")throw t();return e}},Fe={get:(e,{invalid:t})=>{if(e==="true")return!0;if(e==="false")return!1;throw t()},set:(e,{invalid:t})=>{if(typeof e!="boolean")throw t();return e.toString()}},We={get:(e,{invalid:t})=>{const r=Number(e);if(isNaN(r))throw t();return r},set:(e,{invalid:t})=>{if(typeof e!="number")throw t();return e.toString()}},xt={get:(e,{invalid:t})=>{const r=new Date(e);if(isNaN(r.getTime()))throw t();return r},set:(e,{invalid:t})=>{if(typeof e!="object"||!(e instanceof Date))throw t();return e.toISOString()}},Zt={get:(e,{invalid:t})=>{try{return JSON.parse(e)}catch{throw t()}},set:(e,{invalid:t})=>{try{return JSON.stringify(e)}catch{throw t()}}};function Tr(e,t){switch(typeof t){case"string":return Ct.get(e,I)===t;case"number":return We.get(e,I)===t;case"boolean":return Fe.get(e,I)===t;default:return!1}}function re(e,t,r=!1){if(e===void 0||!G(e)){if(Cr(t))return t.defaultValue;if(r)return;throw new Y}if(t===String)return Ct.get(e,I);if(t===Boolean)return Fe.get(e,I);if(t===Number)return We.get(e,I);if(t===Date)return xt.get(e,I);if(t===JSON)return Zt.get(e,I);if(Vr(t))return t(e,I);if(ke(t))return t.get(e,I);if(t instanceof RegExp){if(t.test(e))return e;throw new Y}if(Ut(t)){if(Tr(e,t))return t;throw new Y}return Lt(t)?Bt(t).get(e,I):Nt(t)?Vt(t).get(e,I):e}function Ge(e,t,r=!1){try{return re(e,t,r)}catch(n){if(n instanceof Y)return;throw n}}function _r(e,t,r=!1){try{return X(e,t,r)}catch(n){if(n instanceof Y)return;throw n}}function X(e,t,r=!1){if(e===void 0){if(r)return"";throw new Y}if(t===Boolean)return Fe.set(e,I);if(t===Number)return We.set(e,I);if(t===Date)return xt.set(e,I);if(t===JSON)return Zt.set(e,I);if(ke(t))return t.set(e,I);if(Ut(t)){if(t!==e)throw new Y;return e.toString()}if(Lt(t))return Bt(t).set(e,I);if(Nt(t))return Vt(t).set(e,I);try{return e.toString()}catch{throw new Y}}function Qe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Jr(e,t){const r=Array.from(e.matchAll(t));if(r.length===0)return[e];let n=0;const o=r.reduce((i,u)=>{const c=Qe(e.slice(n,u.index));c.length&&i.push(c);const[h]=u;return i.push(h),n=u.index+h.length,i},[]),a=e.slice(n);return a&&o.push(a),o}function Mr(e){const t=ze(e.host.value);return new RegExp(`^${t}$`,"i")}function Fr(e){const t=ze(e.path.value);return new RegExp(`^${t}$`,"i")}function Wr(e){const t=new URLSearchParams(e.query.value);return Array.from(t.entries()).filter(([,r])=>!Xe(r)).map(([r,n])=>{const o=ze(n);return new RegExp(`${Qe(r)}=${o}(&|$)`,"i")})}function ze(e){return Jr(e,new RegExp(Ne,"g")).map(t=>t.startsWith(Ee)?Ot(t):Qe(t)).join("")}function Ot(e){return e.replace(new RegExp(Ne,"g"),zr)}function Gr(e,t){const r=jt(t);return e.replace(r,Yr)}function Ye(e,t){return Xr(t).test(e.value)}function Xe(e){return new RegExp(Qr,"g").test(e)}const Ne=`\\${Ee}\\??([\\w-_]+)\\${Ue}`,Qr=`\\${Ee}\\?([\\w-_]+)\\${Ue}`,zr=".*",Yr="(.*)";function Ke(e){const[t]=It(e,new RegExp(Ne,"g"));return t}function jt(e){return new RegExp(`\\${Ee}\\??${e}\\${Ue}`,"g")}function Xr(e){return new RegExp(`\\${Ee}\\?${e}\\${Ue}`,"g")}function It(e,t){return Array.from(e.matchAll(t)).flatMap(([,...n])=>n.map(o=>G(o)?o:""))}function Kr(e="",t={}){return G(e)?Array.from(e.matchAll(new RegExp(Ne,"g"))).reduce((n,[o,a])=>{const i=Ke(o);if(!i)return n;const u=qr(t,i);return pe([i],n),n[a]=u,n},{}):{}}function en(e){return le(e)&&typeof e.value=="string"}function ne(e){return e===void 0?z():en(e)?e:z(e,{})}function z(e,t){return{value:e??"",params:Kr(e,t)}}function Dt(e,t){pe(e.params,t.params);const r=`${e.value}${t.value}`;return z(r,{...e.params,...t.params})}function tn(e,t){return Dt(e,t)}class Ht extends Error{constructor(t){super(`Child property on meta for ${t} conflicts with the parent meta.`)}}function rn(e,t){return nn(e,t),{...e,...t}}function nn(e,t){const r=Object.keys(e).find(n=>n in t&&typeof t[n]!=typeof e[n]);if(r)throw new Ht(r)}function on(e,t){pe(e.params,t.params);const r=[e.value,t.value].filter(G).join("&");return z(r,{...e.params,...t.params})}function an(e,t){return pe(e,t),{...e,...t}}function et(e){return"parent"in e&&!!e.parent}function tt(e){return"component"in e&&!!e.component}function rt(e){return"props"in e&&typeof e.props=="function"}function nt(e){return"components"in e&&!!e.components}function ot(e){return"props"in e&&typeof e.props=="object"}function at(e,t){return{...t,path:Dt(e.path,t.path),query:on(e.query,t.query),meta:rn(e.meta,t.meta),state:an(e.state,t.state),hash:tn(e.hash,t.hash),hooks:[...e.hooks,...t.hooks],matches:[...e.matches,t.matched],context:[...e.context,...t.context],host:e.host,depth:e.depth+1}}function J(e){return typeof e!="string"?!1:/^(https?:\/\/|\/).*/g.test(e)}function st(e){return J(e)?e:`/${e}`}class oe extends Error{constructor(){super("Router not installed")}}class $t extends Error{constructor(t,r){super(`useRoute called with incorrect route. Given ${t}, expected ${r}`)}}function it(){let e=0;return()=>(++e).toString()}const sn=it()();function un(e){return e===sn}const ut=it();function qt(e){return e===void 0?"":e}class K{onBeforeRouteEnter=new Set;onBeforeRouteUpdate=new Set;onBeforeRouteLeave=new Set;onAfterRouteEnter=new Set;onAfterRouteUpdate=new Set;onAfterRouteLeave=new Set;onError=new Set}function ct(){const e=new K;return{onBeforeRouteEnter:c=>(e.onBeforeRouteEnter.add(c),()=>e.onBeforeRouteEnter.delete(c)),onBeforeRouteUpdate:c=>(e.onBeforeRouteUpdate.add(c),()=>e.onBeforeRouteUpdate.delete(c)),onBeforeRouteLeave:c=>(e.onBeforeRouteLeave.add(c),()=>e.onBeforeRouteLeave.delete(c)),onAfterRouteEnter:c=>(e.onAfterRouteEnter.add(c),()=>e.onAfterRouteEnter.delete(c)),onAfterRouteUpdate:c=>(e.onAfterRouteUpdate.add(c),()=>e.onAfterRouteUpdate.delete(c)),onAfterRouteLeave:c=>(e.onAfterRouteLeave.add(c),()=>e.onAfterRouteLeave.delete(c)),onError:c=>(e.onError.add(c),()=>e.onError.delete(c)),store:e}}function ae(e,t){const r=ut(),n=qt(e.name),o=ne(e.path),a=ne(e.query),i=ne(e.hash),u=e.meta??{},c=e.state??{},h=e.context??[],{store:w,...A}=ct(),g=f.markRaw({id:r,meta:u,state:c,...e,props:t}),E={id:r,matched:g,matches:[g],hooks:[w],name:n,path:o,query:a,hash:i,meta:u,state:c,context:h,depth:1,host:z(),prefetch:e.prefetch,...A},C=et(e)?at(e.parent,E):E;return pe(C.path.params,C.query.params,C.hash.params),C}function Tt(e){return f.defineComponent(()=>()=>f.h("h1",e),{name:e,props:[]})}function cn(e){const t=e.component??Tt(e.type);return{type:e.type,component:t}}function fn(e){const t=ut(),r=qt(e.name),n=ne(e.path),o=ne(e.query),a=ne(e.hash),i=e.meta??{},u=ne(e.host),c=e.context??[],{store:h,onBeforeRouteEnter:w}=ct(),A=f.markRaw({id:t,meta:{},state:{},...e}),g={id:t,matched:A,matches:[A],hooks:[h],name:r,host:u,path:n,query:o,hash:a,meta:i,depth:1,state:{},context:c,onBeforeRouteEnter:w},E=et(e)?at(e.parent,g):g;return pe(E.path.params,E.query.params,E.host.params,E.hash.params),E}function Ae(){const e=new Map;return t=>{const r=e.get(t);if(!r){const n=Symbol();return e.set(t,n),n}return r}}const dn=Ae();function ft(e){const t=dn(e);return({increment:r=!1}={})=>{const n=f.inject(t,0);return r&&f.provide(t,n+1),n}}const se=(e,t,r)=>{const n=e.matches,o=t?.matches??[];return n.at(r)?.id!==o.at(r)?.id},ie=(e,t,r)=>{const n=e.matches,o=t?.matches??[];return n.at(r)?.id!==o.at(r)?.id},ue=(e,t,r)=>e.matches.at(r)?.id===t?.matches.at(r)?.id;function _t(e){switch(e){case"onBeforeRouteEnter":case"onAfterRouteEnter":return se;case"onBeforeRouteUpdate":case"onAfterRouteUpdate":return ue;case"onBeforeRouteLeave":case"onAfterRouteLeave":return ie;default:throw new Error(`Switch is not exhaustive for lifecycle: ${e}`)}}class Jt{onBeforeRouteEnter=new Set;onBeforeRouteUpdate=new Set;onBeforeRouteLeave=new Set;onAfterRouteEnter=new Set;onAfterRouteUpdate=new Set;onAfterRouteLeave=new Set}function pn(e,t){const r=new Jt;return e.matches.forEach((n,o)=>{n.onBeforeRouteEnter&&se(e,t,o)&&D(n.onBeforeRouteEnter).forEach(a=>{process.env.NODE_ENV==="development"&&console.warn("[vue-router] onBeforeRouteEnter is deprecated. Use router.onBeforeRouteEnter instead"),r.onBeforeRouteEnter.add(a)}),n.onBeforeRouteUpdate&&ue(e,t,o)&&D(n.onBeforeRouteUpdate).forEach(a=>{process.env.NODE_ENV==="development"&&console.warn("[vue-router] onBeforeRouteUpdate is deprecated. Use router.onBeforeRouteUpdate instead"),r.onBeforeRouteUpdate.add(a)})}),t?.matches.forEach((n,o)=>{n.onBeforeRouteLeave&&ie(e,t,o)&&D(n.onBeforeRouteLeave).forEach(a=>{process.env.NODE_ENV==="development"&&console.warn("[vue-router] onBeforeRouteLeave is deprecated. Use router.onBeforeRouteLeave instead"),r.onBeforeRouteLeave.add(a)})}),r}function ln(e,t){const r=new Jt;return e.matches.forEach((n,o)=>{n.onAfterRouteEnter&&se(e,t,o)&&D(n.onAfterRouteEnter).forEach(a=>{process.env.NODE_ENV==="development"&&console.warn("[vue-router] onAfterRouteEnter is deprecated. Use router.onAfterRouteEnter instead"),r.onAfterRouteEnter.add(a)}),n.onAfterRouteUpdate&&ue(e,t,o)&&D(n.onAfterRouteUpdate).forEach(a=>{process.env.NODE_ENV==="development"&&console.warn("[vue-router] onAfterRouteUpdate is deprecated. Use router.onAfterRouteUpdate instead"),r.onAfterRouteUpdate.add(a)})}),t?.matches.forEach((n,o)=>{n.onAfterRouteLeave&&ie(e,t,o)&&D(n.onAfterRouteLeave).forEach(a=>{process.env.NODE_ENV==="development"&&console.warn("[vue-router] onAfterRouteLeave is deprecated. Use router.onAfterRouteLeave instead"),r.onAfterRouteLeave.add(a)})}),r}function hn(e,t){const r=new K;return e.hooks.forEach((n,o)=>{if(se(e,t,o))return n.onBeforeRouteEnter.forEach(a=>r.onBeforeRouteEnter.add(a));if(ue(e,t,o))return n.onBeforeRouteUpdate.forEach(a=>r.onBeforeRouteUpdate.add(a))}),t?.hooks.forEach((n,o)=>{if(ie(e,t,o))return n.onBeforeRouteLeave.forEach(a=>r.onBeforeRouteLeave.add(a))}),r}function Rn(e,t){const r=new K;return e.hooks.forEach((n,o)=>{if(se(e,t,o))return n.onAfterRouteEnter.forEach(a=>r.onAfterRouteEnter.add(a));if(ue(e,t,o))return n.onAfterRouteUpdate.forEach(a=>r.onAfterRouteUpdate.add(a))}),t?.hooks.forEach((n,o)=>{if(ie(e,t,o))return n.onAfterRouteLeave.forEach(a=>r.onAfterRouteLeave.add(a))}),r}class Ve extends Error{}class M extends Ve{response;constructor(t){super("Uncaught ContextPushError"),this.response={status:"PUSH",to:t}}}class ee extends Ve{response;constructor(t){super("Uncaught ContextRejectionError"),this.response={status:"REJECT",type:t}}}class dt extends Ve{response;constructor(){super("Uncaught ContextAbortError"),this.response={status:"ABORT"}}}function yn(e,t,r){const n=new K;return e.matches.forEach((o,a)=>{se(e,t,a)&&r.onBeforeRouteEnter.forEach(i=>n.onBeforeRouteEnter.add(i)),ue(e,t,a)&&r.onBeforeRouteUpdate.forEach(i=>n.onBeforeRouteUpdate.add(i))}),t?.matches.forEach((o,a)=>{ie(e,t,a)&&r.onBeforeRouteLeave.forEach(i=>n.onBeforeRouteLeave.add(i))}),n}function mn(e,t,r){const n=new K;return e.matches.forEach((o,a)=>{se(e,t,a)&&r.onAfterRouteEnter.forEach(i=>n.onAfterRouteEnter.add(i)),ue(e,t,a)&&r.onAfterRouteUpdate.forEach(i=>n.onAfterRouteUpdate.add(i))}),t?.matches.forEach((o,a)=>{ie(e,t,a)&&r.onAfterRouteLeave.forEach(i=>n.onAfterRouteLeave.add(i))}),n}function Mt(){let e=null;function t(n){e=n}function r(n){return e?e.runWithContext(n):n()}return{setVueApp:t,runWithContext:r}}function gn(){return{reject:o=>{throw new ee(o)},push:(...o)=>{throw new M(o)},replace:(o,a,i)=>{if(J(o)){const h=a??{};throw new M([o,{...h,replace:!0}])}const u=a,c=i??{};throw new M([o,u,{...c,replace:!0}])},abort:()=>{throw new dt}}}const Ft=Ae();function wn(){const{setVueApp:e,runWithContext:t}=Mt(),r={global:new K,component:new K},{reject:n,push:o,replace:a,abort:i}=gn(),u=s=>(r.global.onBeforeRouteEnter.add(s),()=>r.global.onBeforeRouteEnter.delete(s)),c=s=>(r.global.onBeforeRouteUpdate.add(s),()=>r.global.onBeforeRouteUpdate.delete(s)),h=s=>(r.global.onBeforeRouteLeave.add(s),()=>r.global.onBeforeRouteLeave.delete(s)),w=s=>(r.global.onAfterRouteEnter.add(s),()=>r.global.onAfterRouteEnter.delete(s)),A=s=>(r.global.onAfterRouteUpdate.add(s),()=>r.global.onAfterRouteUpdate.delete(s)),g=s=>(r.global.onAfterRouteLeave.add(s),()=>r.global.onAfterRouteLeave.delete(s)),E=s=>(r.global.onError.add(s),()=>r.global.onError.delete(s));async function C({to:s,from:l}){const{global:k,component:y}=r,d=pn(s,l),R=hn(s,l),L=yn(s,l,k),N=[...L.onBeforeRouteEnter,...d.onBeforeRouteEnter,...R.onBeforeRouteEnter,...L.onBeforeRouteUpdate,...d.onBeforeRouteUpdate,...R.onBeforeRouteUpdate,...y.onBeforeRouteUpdate,...L.onBeforeRouteLeave,...d.onBeforeRouteLeave,...R.onBeforeRouteLeave,...y.onBeforeRouteLeave];try{const V=N.map(x=>t(()=>x(s,{from:l,reject:n,push:o,replace:a,abort:i})));await Promise.all(V)}catch(V){if(V instanceof M||V instanceof ee||V instanceof dt)return V.response;try{P(V,{to:s,from:l,source:"hook"})}catch(x){if(x instanceof M||x instanceof ee)return x.response;throw x}}return{status:"SUCCESS"}}async function S({to:s,from:l}){const{global:k,component:y}=r,d=ln(s,l),R=Rn(s,l),L=mn(s,l,k),N=[...y.onAfterRouteLeave,...d.onAfterRouteLeave,...R.onAfterRouteLeave,...L.onAfterRouteLeave,...y.onAfterRouteUpdate,...d.onAfterRouteUpdate,...R.onAfterRouteUpdate,...L.onAfterRouteUpdate,...y.onAfterRouteEnter,...d.onAfterRouteEnter,...R.onAfterRouteEnter,...L.onAfterRouteEnter];try{const V=N.map(x=>t(()=>x(s,{from:l,reject:n,push:o,replace:a})));await Promise.all(V)}catch(V){if(V instanceof M||V instanceof ee)return V.response;try{P(V,{to:s,from:l,source:"hook"})}catch(x){if(x instanceof M||x instanceof ee)return x.response;throw x}}return{status:"SUCCESS"}}function P(s,{to:l,from:k,source:y}){for(const d of r.global.onError)try{d(s,{to:l,from:k,source:y,reject:n,push:o,replace:a});return}catch(R){if(R instanceof Ve)throw R;if(R===s)continue;throw R}}return{runBeforeRouteHooks:C,runAfterRouteHooks:S,runErrorHooks:P,addComponentBeforeRouteHook:({lifecycle:s,depth:l,hook:k})=>{const y=_t(s),d=r.component[s],R=(L,N)=>{if(y(L,N.from,l))return k(L,N)};return d.add(R),()=>d.delete(R)},addComponentAfterRouteHook:({lifecycle:s,depth:l,hook:k})=>{const y=_t(s),d=r.component[s],R=(L,N)=>{if(y(L,N.from,l))return k(L,N)};return d.add(R),()=>d.delete(R)},addGlobalRouteHooks:s=>{s.onBeforeRouteEnter.forEach(l=>u(l)),s.onBeforeRouteUpdate.forEach(l=>c(l)),s.onBeforeRouteLeave.forEach(l=>h(l)),s.onAfterRouteEnter.forEach(l=>w(l)),s.onAfterRouteUpdate.forEach(l=>A(l)),s.onAfterRouteLeave.forEach(l=>g(l)),s.onError.forEach(l=>E(l))},onBeforeRouteEnter:u,onBeforeRouteUpdate:c,onBeforeRouteLeave:h,onAfterRouteEnter:w,onAfterRouteUpdate:A,onAfterRouteLeave:g,onError:E,setVueApp:e}}function Wt(e){const t=Ft(e);return()=>{const r=f.inject(t);if(!r)throw new oe;return r}}function Gt(e,t){const r=ft(e),n=Wt(e);return o=>{const a=r(),u=n().addComponentBeforeRouteHook({lifecycle:t,hook:o,depth:a-1});return f.onUnmounted(u),u}}function Qt(e,t){const r=ft(e),n=Wt(e);return o=>{const a=r(),u=n().addComponentAfterRouteHook({lifecycle:t,hook:o,depth:a-1});return f.onUnmounted(u),u}}function En(e){const t=Gt(e,"onBeforeRouteLeave"),r=Gt(e,"onBeforeRouteUpdate"),n=Qt(e,"onAfterRouteLeave"),o=Qt(e,"onAfterRouteUpdate");return{onBeforeRouteLeave:t,onBeforeRouteUpdate:r,onAfterRouteLeave:n,onAfterRouteUpdate:o}}const zt=Ae();function vn(e){const t=zt(e);return()=>{const r=f.inject(t);if(!r)throw new oe;return r}}const Yt=Ae();function An(e){const t=Yt(e);return()=>{const r=f.inject(t);if(!r)throw new oe;return r}}function Se(e){return()=>{const t=f.inject(e);if(!t)throw new oe;return t}}const Xt=Symbol("isRouterRouteSymbol");function Sn(e,t){return typeof t=="object"&&t!==null&&Xt in t&&e in t}function bn(e,t,r){function n(v,p,s){if(typeof v=="object"){const k={...t.params,...v};return r(t.name,k,p)}const l={...t.params,[v]:p};return r(t.name,l,s)}const o=(...v)=>{const p=new URLSearchParams(t.query);p.set(...v),n({},{query:p})},a=(...v)=>{const p=new URLSearchParams(t.query);p.append(...v),n({},{query:p})},i=(...v)=>{const p=new URLSearchParams(t.query);p.delete(...v),n({},{query:p})},{id:u,matched:c,matches:h,hooks:w,name:A,hash:g,href:E}=f.toRefs(t),C=f.computed({get(){return new Proxy(t.params,{set(v,p,s){return n(p,s),!0}})},set(v){n(v)}}),S=f.computed({get(){return new Proxy(t.query,{get(v,p,s){switch(p){case"append":return a;case"set":return o;case"delete":return i;default:return Reflect.get(v,p,s)}}})},set(v){n({},{query:v})}}),P=f.computed({get(){return new Proxy(t.state,{set(v,p,s){return n({},{state:{...t.state,[p]:s}}),!0}})},set(v){n({},{state:v})}});return f.reactive({id:u,matched:c,matches:h,hooks:w,state:P,query:S,hash:g,params:C,name:A,href:E,update:n,[Xt]:!0,[e]:!0})}function pt(e){return(t,r,{exact:n}={})=>Sn(e,t)?r===void 0?!0:n?t.matched.name===r:t.matches.map(o=>o.name).includes(r):!1}function Ce(e){const t=Se(e),r=pt(e);return(n,o)=>{const a=t();function i(){if(!n)return;if(!r(a.route,n,o))throw new $t(n,a.route.name)}return f.watch(a.route,i,{immediate:!0,deep:!0}),a.route}}function lt(e){const t=Ce(e),r=Se(e),n=An(e),o=ft(e),a=vn(e);return f.defineComponent((i,u)=>{const c=t(),h=r(),w=n(),A=o({increment:!0});f.onServerPrefetch(async()=>{await h.start()});const{getRouteComponents:g}=a(),E=f.computed(()=>{if(!h.started.value)return null;if(w.value)return w.value.component;const C=c.matches.at(A);if(!C)return null;const S=g(C),P=i.name??"default";return S[P]});return()=>u.slots.default?u.slots.default({route:c,component:E,rejection:w.value}):E.value?f.h(E.value):null},{name:"RouterView",props:["name"]})}const Kt=Ae();function er(e){const t=Kt(e);return()=>{const r=f.inject(t);if(!r)throw new oe;return r}}const Pn="lazy",Un={components:!0,props:!1};function xe(e){return["eager","lazy","intent"].includes(e)}function tr({routerPrefetch:e,routePrefetch:t,linkPrefetch:r},n){const o=ht(r,n),a=ht(t,n),i=ht(e,n),u=[o,a,i,Un[n],Pn].reduce((c,h)=>xe(c)?c:c===!0&&xe(h)?h:c===!0&&!xe(h)?c:c===void 0?h:c,void 0);return xe(u)?u:!1}function ht(e,t){return le(e)?e[t]:e}const kn=f.defineAsyncComponent(()=>new Promise(e=>{e({default:{template:"foo"}})}));function rr(e){return e.name===kn.name&&"__asyncLoader"in e}const nr=Symbol("visibilityObserver");function Ln(e){const t=f.inject(nr);if(!t)throw new oe;return f.watch(e,(n,o)=>{n&&t.observe(n),o&&t.unobserve(o)},{immediate:!0}),f.onUnmounted(()=>{e.value&&t.unobserve(e.value)}),{isElementVisible:f.computed(()=>e.value?t.isElementVisible(e.value):!1)}}function or(e,t,r){f.watch(e,(n,o)=>{n&&n.addEventListener(t,r),o&&o.removeEventListener(t,r)},{immediate:!0}),f.onUnmounted(()=>{e.value&&e.value.removeEventListener(t,r)})}function Bn(e){const t=er(e);return r=>{const n=new Map,o=f.ref(),{getPrefetchProps:a,setPrefetchProps:i}=t(),{isElementVisible:u}=Ln(o),c=()=>{const A=Array.from(n.values()).reduce((g,E)=>(Object.assign(g,E),g),{});i(A)};f.watch(()=>f.toValue(r),({route:A,...g})=>{n.clear(),A&&w("eager",A,g)},{immediate:!0}),f.watch(u,A=>{const{route:g,...E}=f.toValue(r);!g||!A||w("lazy",g,E)},{immediate:!0}),or(o,"focusin",h),or(o,"mouseover",h);function h(){const{route:A,...g}=f.toValue(r);A&&w("intent",A,g)}function w(A,g,E){Nn(A,g,E),n.has(A)||n.set(A,a(A,g,E))}return{element:o,commit:c}}}function Nn(e,t,r){t.matches.forEach(n=>{tr({...r,routePrefetch:n.prefetch},"components")===e&&(tt(n)&&rr(n.component)&&n.component.__asyncLoader(),nt(n)&&Object.values(n.components).forEach(a=>{rr(a)&&a.__asyncLoader()}))})}function Rt(...e){const t=new URLSearchParams;for(const r of e){const n=new URLSearchParams(r);for(const[o,a]of n.entries())t.append(o,a)}return t}function ar(e){const t=Se(e),r=Bn(e),n=pt(e);return(o,a={},i={})=>{const u=t(),c=f.computed(()=>{const s=f.toValue(o);return typeof s!="string"?s:J(s)?u.find(s,f.toValue(i)):u.resolve(s,f.toValue(a),f.toValue(i))}),h=f.computed(()=>{if(c.value)return c.value.href;const s=f.toValue(o);if(J(s))return s;console.error(new Error("Failed to resolve route in RouterLink."))}),w=f.computed(()=>n(u.route)&&u.route.matches.some(s=>s.id===c.value?.id)),A=f.computed(()=>u.route.id===c.value?.id),g=f.computed(()=>n(u.route)&&Zr(c.value)&&u.route.href.startsWith(c.value.href)),E=f.computed(()=>u.route.href===c.value?.href),C=f.computed(()=>!!h.value&&u.isExternal(h.value)),S=f.computed(()=>{const s=f.toValue(o);return typeof s!="string"||J(s)?f.toValue(a):f.toValue(i)}),{element:P,commit:b}=r(()=>({route:c.value,routerPrefetch:u.prefetch,linkPrefetch:S.value.prefetch})),v=s=>{b();const l={replace:s?.replace??S.value.replace,query:Rt(S.value.query,s?.query),hash:s?.hash??S.value.hash,state:{...S.value.state,...s?.state}},k=f.toValue(o);return J(k)||typeof k=="object"?u.push(k,l):u.push(k,f.toValue(a),l)};return{element:P,route:c,href:h,isMatch:w,isExactMatch:A,isActive:g,isExactActive:E,isExternal:C,push:v,replace:s=>v({...s,replace:!0})}}}function sr(e){const t=Se(e),r=ar(e);return f.defineComponent((n,o)=>{const a=t(),i=f.computed(()=>b(n.to)),u=f.computed(()=>v(n.to)),c=f.computed(()=>{const{to:s,...l}=n;return l}),{element:h,isMatch:w,isExactMatch:A,isActive:g,isExactActive:E,isExternal:C,push:S}=r(()=>typeof n.to=="function"?n.to(a.resolve):n.to,c),P=f.computed(()=>({"router-link--match":w.value,"router-link--exact-match":A.value,"router-link--active":g.value,"router-link--exact-active":E.value}));function b(s){if(typeof s=="function"){const l=s(a.resolve);return b(l)}return J(s)?a.find(s):s}function v(s){if(typeof s=="function"){const l=s(a.resolve);return v(l)}return J(s)?s:s?.href}function p(s){s.preventDefault(),S()}return()=>f.h("a",{href:u.value,class:["router-link",P.value],ref:h,onClick:p},o.slots.default?.({route:i.value,isMatch:w.value,isExactMatch:A.value,isActive:g.value,isExactActive:E.value,isExternal:C.value}))},{name:"RouterLink",props:["to","prefetch","query","hash","replace","state"]})}function Vn(e){const t=Ce(e);return(r,n=String)=>{const o=t(),a=f.computed({get(){const u=o.query.get(f.toValue(r));return u===null?null:Ge(u,n)},set(u){o.query.set(f.toValue(r),X(u,n))}}),i=f.computed({get(){return o.query.getAll(f.toValue(r)).map(c=>Ge(c,n)).filter(c=>c!==null)},set(u){const c=new URLSearchParams(o.query);c.delete(f.toValue(r)),u.forEach(h=>{c.append(f.toValue(r),X(h,n))}),o.query=c}});return{value:a,values:i,remove:()=>{o.query.delete(f.toValue(r))}}}}function ir(e){const t=typeof e=="object"?e.key:e,{onBeforeRouteLeave:r,onBeforeRouteUpdate:n,onAfterRouteLeave:o,onAfterRouteUpdate:a}=En(t),i=pt(t),u=lt(t),c=sr(t),h=Ce(t),w=Se(t),A=Vn(t),g=ar(t);return{onBeforeRouteLeave:r,onBeforeRouteUpdate:n,onAfterRouteLeave:o,onAfterRouteUpdate:a,isRoute:i,RouterView:u,RouterLink:c,useRoute:h,useRouter:w,useQueryValue:A,useLink:g}}function yt(){return typeof window<"u"&&typeof window.document<"u"}const Ze={template:"<div>This is component</div>"},mt=ae({name:"parentA",path:"/parentA/[paramA]"}),ur=ae({parent:mt,name:"parentA.childA",path:"/childA/[?paramB]"}),Cn=ae({parent:mt,name:"parentA.childB",path:"/childB/[paramD]",component:Ze}),xn=ae({parent:ur,name:"parentA.childA.grandChildA",path:"/[paramC]",component:Ze});ae({name:"parentB",path:"/parentB",component:Ze}),ae({name:"parentC",path:"/",component:Ze});function Zn(e){const{store:t,...r}=ct();return D(e.onBeforeRouteEnter??[]).forEach(n=>{r.onBeforeRouteEnter(n)}),D(e.onAfterRouteEnter??[]).forEach(n=>{r.onAfterRouteEnter(n)}),D(e.onBeforeRouteUpdate??[]).forEach(n=>{r.onBeforeRouteUpdate(n)}),D(e.onAfterRouteUpdate??[]).forEach(n=>{r.onAfterRouteUpdate(n)}),D(e.onBeforeRouteLeave??[]).forEach(n=>{r.onBeforeRouteLeave(n)}),D(e.onAfterRouteLeave??[]).forEach(n=>{r.onAfterRouteLeave(n)}),{routes:e.routes??[],rejections:e.rejections??[],hooks:t,...r}}function cr(e){return{get:(t,{invalid:r})=>{for(const n of e){const o=Ge(t,n);if(o!==void 0)return o}throw r(`Value ${t} does not satisfy any of the possible values`)},set:(t,{invalid:r})=>{for(const n of e){const o=_r(t,n);if(o!==void 0)return o}throw r(`Value ${t} does not satisfy any of the possible values`)}}}const On={separator:","};function jn(e,t={}){const{separator:r}={...On,...t},n=cr(e);return{get:(o,a)=>o.split(r).map(i=>n.get(i,a)),set:(o,a)=>{if(!Array.isArray(o))throw a.invalid("Expected an array");return o.map(i=>n.set(i,a)).join(r)}}}const In={separator:","};function Dn(e,t={}){const{separator:r}={...In,...t};return{get:n=>{const o=n.split(r);return e.map((a,i)=>re(o.at(i),a))},set:(n,{invalid:o})=>{if(!Array.isArray(n))throw o("Expected a tuple");if(n.length!==e.length)throw o(`Expected tuple with ${e.length} values but received ${n.length} values`);return e.map((a,i)=>X(n.at(i),a)).join(r)}}}function te(){return te=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},te.apply(null,arguments)}var q;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(q||(q={}));var me=process.env.NODE_ENV!=="production"?function(e){return Object.freeze(e)}:function(e){return e};function ce(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}var Oe="beforeunload",Hn="hashchange",fr="popstate";function dr(e){e===void 0&&(e={});var t=e,r=t.window,n=r===void 0?document.defaultView:r,o=n.history;function a(){var y=n.location,d=y.pathname,R=y.search,L=y.hash,N=o.state||{};return[N.idx,me({pathname:d,search:R,hash:L,state:N.usr||null,key:N.key||"default"})]}var i=null;function u(){if(i)E.call(i),i=null;else{var y=q.Pop,d=a(),R=d[0],L=d[1];if(E.length)if(R!=null){var N=w-R;N&&(i={action:y,location:L,retry:function(){l(N*-1)}},l(N))}else process.env.NODE_ENV!=="production"&&ce(!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 v(y)}}n.addEventListener(fr,u);var c=q.Pop,h=a(),w=h[0],A=h[1],g=ge(),E=ge();w==null&&(w=0,o.replaceState(te({},o.state,{idx:w}),""));function C(y){return typeof y=="string"?y:fe(y)}function S(y,d){return d===void 0&&(d=null),me(te({pathname:A.pathname,hash:"",search:""},typeof y=="string"?be(y):y,{state:d,key:Ie()}))}function P(y,d){return[{usr:y.state,key:y.key,idx:d},C(y)]}function b(y,d,R){return!E.length||(E.call({action:y,location:d,retry:R}),!1)}function v(y){c=y;var d=a();w=d[0],A=d[1],g.call({action:c,location:A})}function p(y,d){var R=q.Push,L=S(y,d);function N(){p(y,d)}if(b(R,L,N)){var V=P(L,w+1),x=V[0],$=V[1];try{o.pushState(x,"",$)}catch{n.location.assign($)}v(R)}}function s(y,d){var R=q.Replace,L=S(y,d);function N(){s(y,d)}if(b(R,L,N)){var V=P(L,w),x=V[0],$=V[1];o.replaceState(x,"",$),v(R)}}function l(y){o.go(y)}var k={get action(){return c},get location(){return A},createHref:C,push:p,replace:s,go:l,back:function(){l(-1)},forward:function(){l(1)},listen:function(d){return g.push(d)},block:function(d){var R=E.push(d);return E.length===1&&n.addEventListener(Oe,je),function(){R(),E.length||n.removeEventListener(Oe,je)}}};return k}function $n(e){e===void 0&&(e={});var t=e,r=t.window,n=r===void 0?document.defaultView:r,o=n.history;function a(){var d=be(n.location.hash.substr(1)),R=d.pathname,L=R===void 0?"/":R,N=d.search,V=N===void 0?"":N,x=d.hash,$=x===void 0?"":x,T=o.state||{};return[T.idx,me({pathname:L,search:V,hash:$,state:T.usr||null,key:T.key||"default"})]}var i=null;function u(){if(i)E.call(i),i=null;else{var d=q.Pop,R=a(),L=R[0],N=R[1];if(E.length)if(L!=null){var V=w-L;V&&(i={action:d,location:N,retry:function(){k(V*-1)}},k(V))}else process.env.NODE_ENV!=="production"&&ce(!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 p(d)}}n.addEventListener(fr,u),n.addEventListener(Hn,function(){var d=a(),R=d[1];fe(R)!==fe(A)&&u()});var c=q.Pop,h=a(),w=h[0],A=h[1],g=ge(),E=ge();w==null&&(w=0,o.replaceState(te({},o.state,{idx:w}),""));function C(){var d=document.querySelector("base"),R="";if(d&&d.getAttribute("href")){var L=n.location.href,N=L.indexOf("#");R=N===-1?L:L.slice(0,N)}return R}function S(d){return C()+"#"+(typeof d=="string"?d:fe(d))}function P(d,R){return R===void 0&&(R=null),me(te({pathname:A.pathname,hash:"",search:""},typeof d=="string"?be(d):d,{state:R,key:Ie()}))}function b(d,R){return[{usr:d.state,key:d.key,idx:R},S(d)]}function v(d,R,L){return!E.length||(E.call({action:d,location:R,retry:L}),!1)}function p(d){c=d;var R=a();w=R[0],A=R[1],g.call({action:c,location:A})}function s(d,R){var L=q.Push,N=P(d,R);function V(){s(d,R)}if(process.env.NODE_ENV!=="production"&&ce(N.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.push("+JSON.stringify(d)+")"),v(L,N,V)){var x=b(N,w+1),$=x[0],T=x[1];try{o.pushState($,"",T)}catch{n.location.assign(T)}p(L)}}function l(d,R){var L=q.Replace,N=P(d,R);function V(){l(d,R)}if(process.env.NODE_ENV!=="production"&&ce(N.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.replace("+JSON.stringify(d)+")"),v(L,N,V)){var x=b(N,w),$=x[0],T=x[1];o.replaceState($,"",T),p(L)}}function k(d){o.go(d)}var y={get action(){return c},get location(){return A},createHref:S,push:s,replace:l,go:k,back:function(){k(-1)},forward:function(){k(1)},listen:function(R){return g.push(R)},block:function(R){var L=E.push(R);return E.length===1&&n.addEventListener(Oe,je),function(){L(),E.length||n.removeEventListener(Oe,je)}}};return y}function pr(e){e===void 0&&(e={});var t=e,r=t.initialEntries,n=r===void 0?["/"]:r,o=t.initialIndex,a=n.map(function(p){var s=me(te({pathname:"/",search:"",hash:"",state:null,key:Ie()},typeof p=="string"?be(p):p));return process.env.NODE_ENV!=="production"&&ce(s.pathname.charAt(0)==="/","Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(p)+")"),s}),i=lr(o??a.length-1,0,a.length-1),u=q.Pop,c=a[i],h=ge(),w=ge();function A(p){return typeof p=="string"?p:fe(p)}function g(p,s){return s===void 0&&(s=null),me(te({pathname:c.pathname,search:"",hash:""},typeof p=="string"?be(p):p,{state:s,key:Ie()}))}function E(p,s,l){return!w.length||(w.call({action:p,location:s,retry:l}),!1)}function C(p,s){u=p,c=s,h.call({action:u,location:c})}function S(p,s){var l=q.Push,k=g(p,s);function y(){S(p,s)}process.env.NODE_ENV!=="production"&&ce(c.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.push("+JSON.stringify(p)+")"),E(l,k,y)&&(i+=1,a.splice(i,a.length,k),C(l,k))}function P(p,s){var l=q.Replace,k=g(p,s);function y(){P(p,s)}process.env.NODE_ENV!=="production"&&ce(c.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.replace("+JSON.stringify(p)+")"),E(l,k,y)&&(a[i]=k,C(l,k))}function b(p){var s=lr(i+p,0,a.length-1),l=q.Pop,k=a[s];function y(){b(p)}E(l,k,y)&&(i=s,C(l,k))}var v={get index(){return i},get action(){return u},get location(){return c},createHref:A,push:S,replace:P,go:b,back:function(){b(-1)},forward:function(){b(1)},listen:function(s){return h.push(s)},block:function(s){return w.push(s)}};return v}function lr(e,t,r){return Math.min(Math.max(e,t),r)}function je(e){e.preventDefault(),e.returnValue=""}function ge(){var e=[];return{get length(){return e.length},push:function(r){return e.push(r),function(){e=e.filter(function(n){return n!==r})}},call:function(r){e.forEach(function(n){return n&&n(r)})}}}function Ie(){return Math.random().toString(36).substr(2,8)}function fe(e){var t=e.pathname,r=t===void 0?"/":t,n=e.search,o=n===void 0?"":n,a=e.hash,i=a===void 0?"":a;return o&&o!=="?"&&(r+=o.charAt(0)==="?"?o:"?"+o),i&&i!=="#"&&(r+=i.charAt(0)==="#"?i:"#"+i),r}function be(e){var t={};if(e){var r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));var n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function qn(e,t,r){const n=f.reactive({...t}),o=u=>{Object.assign(n,{...u})},a=n,i=bn(e,a,r);return{currentRoute:a,routerRoute:i,updateRoute:o}}function _(e){return!e.startsWith("http")?_n(e):Tn(e)}function Tn(e){const{protocol:t,host:r,pathname:n,search:o,searchParams:a,hash:i}=new URL(e,e);return{protocol:t,host:r,pathname:n,search:o,searchParams:a,hash:i}}function _n(e){const{pathname:t,search:r,searchParams:n,hash:o}=new URL(e,"https://localhost");return{pathname:t,search:r,searchParams:n,hash:o}}function Jn(e){return t=>{const{host:r}=_(t);return!(r===void 0||r===e)}}function Mn(){return{reject:o=>{throw new ee(o)},push:(...o)=>{throw new M(o)},replace:(o,a,i)=>{if(J(o)){const h=a??{};throw new M([o,{...h,replace:!0}])}const u=a,c=i??{};throw new M([o,u,{...c,replace:!0}])},abort:()=>{throw new dt}}}function hr(e){try{const t=e();return _e(t)?t.catch(r=>r):t}catch(t){return t}}function Fn(){const{setVueApp:e,runWithContext:t}=Mt(),r=f.reactive(new Map),{push:n,replace:o,reject:a}=Mn(),i=(S,P,b)=>P.matches.filter(v=>tr({...b,routePrefetch:v.prefetch},"props")===S).flatMap(v=>E(v)).reduce((v,{id:p,name:s,props:l})=>{if(!l)return v;const k=g(p,s,P),y=t(()=>hr(()=>l(P,{push:n,replace:o,reject:a,parent:w(P,!0)})));return v[k]=y,v},{}),u=S=>{Object.entries(S).forEach(([P,b])=>{r.set(P,b)})},c=async S=>{const P=S.matches.flatMap(E),b=[],v=[];for(const{id:p,name:s,props:l}of P){if(!l)continue;const k=g(p,s,S);if(b.push(k),!r.has(k)){const y=t(()=>hr(()=>l(S,{push:n,replace:o,reject:a,parent:w(S)})));r.set(k,y)}v.push((async()=>{const y=await r.get(k);if(y instanceof Error)throw y})())}C(b);try{return await Promise.all(v),{status:"SUCCESS"}}catch(p){if(p instanceof M||p instanceof ee)return p.response;throw p}},h=(S,P,b)=>{const v=g(S,P,b);return r.get(v)};function w(S,P=!1){const b=S.matches.at(-2);if(b)return rt(b)?{name:b.name??"",get props(){return A(b,"default",S,P)}}:ot(b)?{name:b.name??"",props:new Proxy({},{get(v,p){return typeof p!="string"?Reflect.get(v,p):A(b,p,S,P)}})}:{name:b.name??"",props:void 0}}function A(S,P,b,v=!1){const p=h(S.id,P,b);if(v&&!p){const s=S.name??"unknown",l=b.name||"unknown";console.warn(`
2
+ Unable to access parent props "${P}" 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 m}function L(w,k,h){return[w,k,h.id,JSON.stringify(h.params)].join("-")}function S(w){return tt(w)?[{id:w.id,name:"default",props:w.props}]:nt(w)?Object.entries(w.props).map(([k,h])=>({id:w.id,name:k,props:h})):[]}function x(w){for(const k of r.keys())w.includes(k)||r.delete(k)}return{getPrefetchProps:s,setPrefetchProps:i,getProps:d,setProps:c,setVueApp:e}}function ht(){return typeof window<"u"&&typeof window.document<"u"}function qn({mode:e,listener:t}){const r=Dn(e),n=(c,d)=>{if(d?.replace){r.replace(c,d.state);return}r.push(c,d?.state)},o=()=>{const c=ce(r.location);r.replace(c)};let a;return{...r,update:n,refresh:o,startListening:()=>{a?.(),a=r.listen(t)},stopListening:()=>{a?.()}}}function Dn(e="auto"){switch(e){case"auto":return ht()?cr():ur();case"browser":return cr();case"memory":return ur();case"hash":return Cn();default:const t=e;throw new Error(`Switch is not exhaustive for mode: ${t}`)}}function _n(e){return u.defineComponent(()=>()=>u.h("h1",e),{name:e,props:[]})}function mt(e){const t=new URLSearchParams(e);return{get:(...r)=>t.get(...r),getAll:(...r)=>t.getAll(...r),set:(...r)=>{t.set(...r)},append:(...r)=>{t.append(...r)},delete:(...r)=>{t.delete(...r)},toString:(...r)=>t.toString(...r),forEach:(...r)=>{t.forEach(...r)},entries:(...r)=>t.entries(...r),keys:(...r)=>t.keys(...r),values:(...r)=>t.values(...r),has:(...r)=>t.has(...r),size:t.size,sort:()=>{t.sort()},[Symbol.iterator]:()=>t[Symbol.iterator]()}}function In(e){const t=a=>u.markRaw(e[a]??_n(a)),r=a=>{const s=u.markRaw(t(a)),i={id:it(),component:s,meta:{},state:{}};return{id:i.id,matched:i,matches:[i],name:a,query:mt(""),params:{},state:{},href:"/",hash:""}},n=a=>{if(!a){o.value=null;return}const s=t(a);o.value={type:a,component:s}},o=u.ref(null);return{setRejection:n,rejection:o,getRejectionRoute:r}}class Jn extends Error{constructor(){super("initialUrl must be set if window.location is unavailable")}}function Tn(e){if(e)return e;if(ht())return window.location.toString();throw new Jn}function pr(e){return!!e&&typeof e=="object"}const $e=!0;function Mn(e,t,r){if(pr(e)&&t in e){const n=e[t];return typeof n=="string"?ne(n,r,$e):n}return ne(void 0,r,$e)}function dr(e,t){const r={};for(const[n,o]of Object.entries(e)){const a=Mn(t,n,o);r[n]=a}return r}function Fn(e,t,r){if(pr(e)&&t in e){const n=e[t];return K(n,r,$e)}return K(void 0,r,$e)}const hr=(e,t)=>{const r={};for(const[n,o]of Object.entries(e)){const a=Fn(t,n,o);r[n]=a}return r};function Wn(){const e=u.reactive(new Map),t=ht()?s():null,r=i=>{e.set(i,!1),t?.observe(i)},n=i=>{e.delete(i),t?.unobserve(i)},o=()=>{t?.disconnect()},a=i=>e.get(i)??!1;function s(){return new IntersectionObserver(i=>{i.forEach(c=>{e.set(c.target,c.isIntersecting)})})}return{observe:r,unobserve:n,disconnect:o,isElementVisible:a}}class Gn extends Error{constructor(t){super(`Route not found: "${t}"`)}}function mr(e,t,r){const n=Mr(t.value,r),o=xt(n),[a]=Zt(e,new RegExp(o,"g"));return a}function Rr(e,t,r,n){const o=ze(t,r),a=K(n,t.params[r],o);return e.replace(jt(r),a)}function yr({protocol:e,host:t,pathname:r,search:n,searchParams:o,hash:a}){const s=new URL("https://localhost");e&&(s.protocol=e),t&&(s.host=t),r&&(s.pathname=r),o?s.search=new URLSearchParams(o).toString():n&&(s.search=n),a&&(s.hash=a);const i=s.toString().replace(/^https:\/\/localhost\/*/,"/");return at(i)}function Qn(e,t={}){const{params:r={},query:n}=t,o=Yn(e.query,r),a=dt(o,n),s=gr(e.path,r),i=e.hash.value?gr(e.hash,r):t.hash,c=zn(e.host,r),{protocol:d,host:y}=J(c);return yr({protocol:d,host:y,pathname:s,searchParams:a,hash:i})}function zn(e,t){const r=e.value&&!e.value.startsWith("http")?`https://${e.value}`:e.value;return Object.keys(e.params).reduce((n,o)=>Rr(n,e,o,t[o]),r)}function gr(e,t){return Object.keys(e.params).reduce((r,n)=>Rr(r,e,n,t[n]),e.value)}function Yn(e,t){const r=new URLSearchParams(e.value);if(!e.value)return r;for(const[n,o]of Array.from(r.entries())){const a=Ke(o);if(!a)continue;const i=Ye(o),c=K(t[a],e.params[a],i),d=t[a]===void 0&&c==="";i&&d?r.delete(n,o):r.set(n,c)}return r}const Kn=(e,t)=>{try{Rt(e,t)}catch{return!1}return!0},Rt=(e,t)=>{const{protocol:r,host:n,pathname:o,search:a,hash:s}=J(t);return{...yt(e.host,`${r}//${n}`),...yt(e.path,o),...Xn(e.query,a),...yt(e.hash,s)}};function yt(e,t){const r={},n=decodeURIComponent(t);for(const[o,a]of Object.entries(e.params)){const s=mr(n,e,o),i=ze(e,o),c=ne(s,a,i);r[o]=c}return r}function Xn(e,t){const r={},n=new URLSearchParams(e.value),o=new URLSearchParams(t);for(const[a,s]of Array.from(n.entries())){const i=Ke(s);if(!i)continue;const d=Ye(s),y=o.get(a)??void 0,R=ne(y,e.params[i],d);r[i]=R}return r}function eo(e,t={},r={}){const n=Qn(e,{params:t,query:r.query,hash:r.hash}),{search:o,hash:a}=J(n);return{id:e.id,matched:e.matched,matches:e.matches,name:e.name,query:mt(o),params:Rt(e,n),state:dr(e.state,r.state),hash:a,href:n}}const qe={template:"<div>This is component</div>"},gt=se({name:"parentA",path:"/parentA/[paramA]"}),wr=se({parent:gt,name:"parentA.childA",path:"/childA/[?paramB]"}),to=se({parent:gt,name:"parentA.childB",path:"/childB/[paramD]",component:qe}),ro=se({parent:wr,name:"parentA.childA.grandChildA",path:"/[paramC]",component:qe});se({name:"parentB",path:"/parentB",component:qe}),se({name:"parentC",path:"/",component:qe});const no=e=>"name"in e.matched&&!!e.matched.name,oo=(e,t)=>{const{pathname:r}=J(t);return Jr(e).test(r)},ao=(e,t)=>{const{search:r}=J(t);return Tr(e).every(o=>o.test(r))},wt=(e,t)=>{const{hash:r}=J(t),{value:n}=e.hash;return M(n)?`#${n.replace(/^#*/,"")}`.toLowerCase()===r.toLowerCase():!0};function so(e){const{searchParams:t,pathname:r}=J(e),n=-1,o=1;return(a,s)=>{const i=br(a,t),c=Er(a,r),d=br(s,t),y=Er(s,r);return a.depth>s.depth?n:a.depth<s.depth?o:i+c>d+y?n:i+c<d+y?o:wt(a,e)?n:wt(s,e)?o:0}}function Er(e,t){const r=Object.keys(e.path.params).filter(o=>ze(e.path,o)).map(o=>o),n=r.filter(o=>mr(t,e.path,o)===void 0);return r.length-n.length}function br(e,t){const r=new URLSearchParams(t),n=new URLSearchParams(e.query.value),o=Array.from(n.keys()),a=o.filter(s=>!r.has(s));return o.length-a.length}const io=[no,oo,ao,wt,Kn];function co(e,t){const r=so(t);return e.filter(n=>io.every(o=>o(n,t))).sort(r)}function uo(e,t,r){const n=co(e,t);if(!n.length)return;const[o]=n,{searchParams:a,hash:s}=J(t);return{id:o.id,matched:o.matched,matches:o.matches,name:o.name,query:mt(a),params:Rt(o,t),state:dr(o.state,r),hash:s,href:at(t)}}function vr(e,t){const r=typeof e=="string"?J(e):e,n=typeof t=="string"?J(t):t,o=r.searchParams??new URLSearchParams(r.search),a=n.searchParams??new URLSearchParams(n.search);return yr({protocol:M(n.protocol)?n.protocol:r.protocol,host:M(n.host)?n.host:r.host,pathname:M(n.pathname)?n.pathname:r.pathname,searchParams:dt(a,o),hash:M(n.hash)?n.hash:r.hash})}function fo(e,t){return M(t)?e.map(r=>{const n=`${t}${r.path.value}`;return{...r,path:Q(n,r.path.params)}}):e}class lo extends Error{constructor(t){super(`Invalid Name "${t}": Router does not support multiple routes with the same name. All name names must be unique.`)}}function po(e){const t=e.map(({name:r})=>r);for(const r of t)if(St(t,r)>1)throw new lo(r)}function ho(e,t=[],r){const n=[...e,...t.map(o=>o.routes)].flat().filter(o=>M(o.name));return po(n),fo(n,r)}function mo(e={},t=[]){const r=new Pe;return ge("onBeforeRouteEnter",e,t).forEach(n=>r.onBeforeRouteEnter.add(n)),ge("onBeforeRouteUpdate",e,t).forEach(n=>r.onBeforeRouteUpdate.add(n)),ge("onBeforeRouteLeave",e,t).forEach(n=>r.onBeforeRouteLeave.add(n)),ge("onAfterRouteEnter",e,t).forEach(n=>r.onAfterRouteEnter.add(n)),ge("onAfterRouteUpdate",e,t).forEach(n=>r.onAfterRouteUpdate.add(n)),ge("onAfterRouteLeave",e,t).forEach(n=>r.onAfterRouteLeave.add(n)),r}function ge(e,t,r){return[t[e],...r.map(o=>o[e])].flat().filter(o=>o!==void 0)}function Ro(e,{match:t,name:r,component:n}){const o=Kt(e),a=Oe(e);return u.defineComponent({name:"PropsWrapper",expose:[],setup(){const s=u.getCurrentInstance(),i=o(),c=a();return()=>{const d=i.getProps(t.id,r,c);return d instanceof Error?"":Je(d)?s?.suspense?u.h(go,{component:n,props:d}):u.h(yo,{component:n,props:d}):u.h(n,d)}}})}const yo=u.defineComponent(e=>{const t=u.ref();return u.watch(()=>e.props,async r=>{t.value=await r},{immediate:!0,deep:!0}),()=>t.value instanceof Error?"":t.value?u.h(e.component,t.value):""},{props:["component","props"]}),go=u.defineComponent(async e=>{const t=u.ref();return t.value=await e.props,u.watch(()=>t.value,async r=>{t.value=await r},{deep:!0}),()=>t.value instanceof Error?"":t.value?u.h(e.component,t.value):""},{props:["component","props"]});function wo(e){const t=new Map;return{getRouteComponents:n=>{const o=t.get(n.id);if(o)return o;const a=Eo(e,n);return t.set(n.id,a),a}}}function Eo(e,t){const r=lt(e);return rt(t)?Sr(e,t,t.components):et(t)?Sr(e,t,{default:t.component}):{default:r}}function Sr(e,t,r){return Object.fromEntries(Object.entries(r).map(([n,o])=>[n,Ro(e,{match:t,name:n,component:o})]))}const Pr=Symbol();function bo(e,t,r=[]){const o=t?.isGlobalRouter??!0?Pr:Symbol(),a=ho(e,r,t?.base),s=dn();s.addGlobalRouteHooks(mo(t,r));const i=st(),c=$n(),d=wo(o),y=Wn(),R=qn({mode:t?.historyMode,listener:({location:A})=>{const j=ce(A);S(j,{state:A.state,replace:!0})}});function L(A,j={}){return uo(a,A,j.state)}async function S(A,j={}){const G=i();if(R.stopListening(),N(A)){R.update(A,j);return}const T=L(A,j)??p("NotFound"),q=Ho(G),re=await s.runBeforeRouteHooks({to:T,from:q});switch(re.status){case"ABORT":return;case"PUSH":R.update(A,j),await w(...re.to);return;case"REJECT":R.update(A,j),v(re.type);break;case"SUCCESS":R.update(A,j),v(null);break;default:throw new Error(`Switch is not exhaustive for before hook response status: ${JSON.stringify(re)}`)}const Et=G;c.setProps(T).then(D=>{if(Et===G)switch(D.status){case"SUCCESS":break;case"PUSH":w(...D.to);break;case"REJECT":v(D.type);break;default:const X=D;throw new Error(`Switch is not exhaustive for prop store response status: ${JSON.stringify(X)}`)}}).catch(D=>{try{s.runErrorHooks(D,{to:T,from:q,source:"props"})}catch(X){if(X instanceof I){w(...X.response.to);return}if(X instanceof ee){v(X.response.type);return}throw X}}),l(T);const z=await s.runAfterRouteHooks({to:T,from:q});switch(z.status){case"PUSH":await w(...z.to);break;case"REJECT":v(z.type);break;case"SUCCESS":break;default:const D=z;throw new Error(`Switch is not exhaustive for after hook response status: ${JSON.stringify(D)}`)}R.startListening()}const x=(A,j={},G={})=>{const T=a.find(q=>q.name===A);if(!T)throw new Gn(A);return eo(T,j,G)},w=(A,j,G)=>{if(_(A)){const z={...j},D=vr(A,{searchParams:z.query,hash:z.hash});return S(D,z)}if(typeof A=="string"){const{replace:z,...D}={...G},X={...j},bt=x(A,X,D),qo=hr({...bt.matched.state},{...bt.state,...D.state});return S(bt.href,{replace:z,state:qo})}const{replace:T,...q}={...j},re=hr({...A.matched.state},{...A.state,...q.state}),Et=vr(A.href,{searchParams:q.query,hash:q.hash});return S(Et,{replace:T,state:re})},k=(A,j,G)=>{if(_(A)){const q={...j,replace:!0};return w(A,q)}if(typeof A=="string"){const q={...G,replace:!0},re={...j};return w(A,re,q)}const T={...j,replace:!0};return w(A,T)},h=A=>{v(A)},{setRejection:v,rejection:m,getRejectionRoute:p}=In({...r.reduce((A,j)=>({...A,...j.rejections}),{}),...t?.rejections}),f=p("NotFound"),{currentRoute:E,routerRoute:b,updateRoute:l}=On(o,f,w),g=Tn(t?.initialUrl),P=R.location.state,{host:B}=J(g),N=Zn(B);let C=!1;const $=u.ref(!1),{promise:W,resolve:Ar}=Promise.withResolvers();async function Ur(){if(C)return W;C=!0,xr(a)&&await jr(),await S(g,{replace:!0,state:P}),R.startListening(),Ar(),$.value=!0}function Zo(){R.stopListening()}function Ho(A){return on(A)?null:{...E}}function $o(A){s.setVueApp(A),c.setVueApp(A);const j=lt(o),G=or(o);A.component("RouterView",j),A.component("RouterLink",G),A.provide(Qt(o),m),A.provide(Tt(o),s),A.provide(Yt(o),c),A.provide(Gt(o),d),A.provide(tr,y),A.provide(o,kr),Ur()}const kr={route:b,resolve:x,find:L,push:w,replace:k,reject:h,refresh:R.refresh,forward:R.forward,back:R.back,go:R.go,install:$o,isExternal:N,onBeforeRouteEnter:s.onBeforeRouteEnter,onBeforeRouteUpdate:s.onBeforeRouteUpdate,onBeforeRouteLeave:s.onBeforeRouteLeave,onAfterRouteEnter:s.onAfterRouteEnter,onAfterRouteUpdate:s.onAfterRouteUpdate,onAfterRouteLeave:s.onAfterRouteLeave,onError:s.onError,prefetch:t?.prefetch,start:Ur,started:$,stop:Zo,key:o};return kr}const vo=Q,So=Q,Po=Q,F=ar(Pr),Ao=F.onBeforeRouteLeave,Uo=F.onBeforeRouteUpdate,ko=F.onAfterRouteLeave,Lo=F.onAfterRouteUpdate,Vo=F.isRoute,No=F.RouterView,Bo=F.RouterLink,Co=F.useRoute,Oo=F.useRouter,xo=F.useQueryValue,jo=F.useLink;V.DuplicateParamsError=vt,V.MetaPropertyConflict=$t,V.RouterLink=Bo,V.RouterNotInstalledError=ae,V.RouterView=No,V.UseRouteInvalidError=qt,V.arrayOf=Ln,V.asUrl=at,V.combineRoutes=ot,V.createExternalRoute=an,V.createParam=At,V.createRoute=se,V.createRouter=bo,V.createRouterAssets=ar,V.createRouterPlugin=Un,V.host=So,V.isRoute=Vo,V.isUrl=_,V.isWithComponent=et,V.isWithComponentProps=tt,V.isWithComponentPropsRecord=nt,V.isWithComponents=rt,V.isWithParent=Xe,V.onAfterRouteLeave=ko,V.onAfterRouteUpdate=Lo,V.onBeforeRouteLeave=Ao,V.onBeforeRouteUpdate=Uo,V.path=vo,V.query=Po,V.tupleOf=Nn,V.unionOf=sr,V.useLink=jo,V.useQueryValue=xo,V.useRoute=Co,V.useRouter=Oo,V.withDefault=Br,V.withParams=Q,Object.defineProperty(V,Symbol.toStringTag,{value:"Module"})});
4
+ `)}return p}function g(S,P,b){return[S,P,b.id,JSON.stringify(b.params)].join("-")}function E(S){return rt(S)?[{id:S.id,name:"default",props:S.props}]:ot(S)?Object.entries(S.props).map(([P,b])=>({id:S.id,name:P,props:b})):[]}function C(S){for(const P of r.keys())S.includes(P)||r.delete(P)}return{getPrefetchProps:i,setPrefetchProps:u,getProps:h,setProps:c,setVueApp:e}}function Wn({mode:e,listener:t}){const r=Gn(e),n=(c,h)=>{if(h?.replace){r.replace(c,h.state);return}r.push(c,h?.state)},o=()=>{const c=fe(r.location);r.replace(c)};let a;return{...r,update:n,refresh:o,startListening:()=>{a?.(),a=r.listen(t)},stopListening:()=>{a?.()}}}function Gn(e="auto"){switch(e){case"auto":return yt()?dr():pr();case"browser":return dr();case"memory":return pr();case"hash":return $n();default:const t=e;throw new Error(`Switch is not exhaustive for mode: ${t}`)}}function gt(e){const t=new URLSearchParams(e);return{get:(...r)=>t.get(...r),getAll:(...r)=>t.getAll(...r),set:(...r)=>{t.set(...r)},append:(...r)=>{t.append(...r)},delete:(...r)=>{t.delete(...r)},toString:(...r)=>t.toString(...r),forEach:(...r)=>{t.forEach(...r)},entries:(...r)=>t.entries(...r),keys:(...r)=>t.keys(...r),values:(...r)=>t.values(...r),has:(...r)=>t.has(...r),size:t.size,sort:()=>{t.sort()},[Symbol.iterator]:()=>t[Symbol.iterator]()}}function Qn(e){const t=a=>{const i=e.find(u=>u.type===a);return f.markRaw(i?.component??Tt(a))},r=a=>{const i=f.markRaw(t(a)),u={id:ut(),component:i,meta:{},state:{}};return{id:u.id,matched:u,matches:[u],hooks:[],name:a,query:gt(""),params:{},state:{},href:"/",hash:""}},n=a=>{if(!a){o.value=null;return}const i=t(a);o.value={type:a,component:i}},o=f.ref(null);return{setRejection:n,rejection:o,getRejectionRoute:r}}class zn extends Error{constructor(){super("initialUrl must be set if window.location is unavailable")}}function Yn(e){if(e)return e;if(yt())return window.location.toString();throw new zn}function Rr(e){return!!e&&typeof e=="object"}const De=!0;function Xn(e,t,r){if(Rr(e)&&t in e){const n=e[t];return typeof n=="string"?re(n,r,De):n}return re(void 0,r,De)}function yr(e,t){const r={};for(const[n,o]of Object.entries(e)){const a=Xn(t,n,o);r[n]=a}return r}function Kn(e,t,r){if(Rr(e)&&t in e){const n=e[t];return X(n,r,De)}return X(void 0,r,De)}const mr=(e,t)=>{const r={};for(const[n,o]of Object.entries(e)){const a=Kn(t,n,o);r[n]=a}return r};function eo(){const e=f.reactive(new Map),t=yt()?i():null,r=u=>{e.set(u,!1),t?.observe(u)},n=u=>{e.delete(u),t?.unobserve(u)},o=()=>{t?.disconnect()},a=u=>e.get(u)??!1;function i(){return new IntersectionObserver(u=>{u.forEach(c=>{e.set(c.target,c.isIntersecting)})})}return{observe:r,unobserve:n,disconnect:o,isElementVisible:a}}class to extends Error{constructor(t){super(`Route not found: "${t}"`)}}function gr(e,t,r){const n=Gr(t.value,r),o=Ot(n),[a]=It(e,new RegExp(o,"g"));return a}function wr(e,t,r,n){const o=Ye(t,r),a=X(n,t.params[r],o);return e.replace(jt(r),a)}function Er({protocol:e,host:t,pathname:r,search:n,searchParams:o,hash:a}){const i=new URL("https://localhost");e&&(i.protocol=e),t&&(i.host=t),r&&(i.pathname=r),o?i.search=new URLSearchParams(o).toString():n&&(i.search=n),a&&(i.hash=a);const u=i.toString().replace(/^https:\/\/localhost\/*/,"/");return st(u)}function ro(e,t={}){const{params:r={},query:n}=t,o=oo(e.query,r),a=Rt(o,n),i=vr(e.path,r),u=e.hash.value?vr(e.hash,r):t.hash,c=no(e.host,r),{protocol:h,host:w}=_(c);return Er({protocol:h,host:w,pathname:i,searchParams:a,hash:u})}function no(e,t){const r=e.value&&!e.value.startsWith("http")?`https://${e.value}`:e.value;return Object.keys(e.params).reduce((n,o)=>wr(n,e,o,t[o]),r)}function vr(e,t){return Object.keys(e.params).reduce((r,n)=>wr(r,e,n,t[n]),e.value)}function oo(e,t){const r=new URLSearchParams(e.value);if(!e.value)return r;for(const[n,o]of Array.from(r.entries())){const a=Ke(o);if(!a)continue;const u=Xe(o),c=X(t[a],e.params[a],u),h=t[a]===void 0&&c==="";u&&h?r.delete(n,o):r.set(n,c)}return r}const ao=(e,t)=>{try{wt(e,t)}catch{return!1}return!0},wt=(e,t)=>{const{protocol:r,host:n,pathname:o,search:a,hash:i}=_(t);return{...Et(e.host,`${r}//${n}`),...Et(e.path,o),...so(e.query,a),...Et(e.hash,i)}};function Et(e,t){const r={},n=decodeURIComponent(t);for(const[o,a]of Object.entries(e.params)){const i=gr(n,e,o),u=Ye(e,o),c=re(i,a,u);r[o]=c}return r}function so(e,t){const r={},n=new URLSearchParams(e.value),o=new URLSearchParams(t);for(const[a,i]of Array.from(n.entries())){const u=Ke(i);if(!u)continue;const h=Xe(i),w=o.get(a)??void 0,A=re(w,e.params[u],h);r[u]=A}return r}function io(e,t={},r={}){const n=ro(e,{params:t,query:r.query,hash:r.hash}),{search:o,hash:a}=_(n);return{id:e.id,matched:e.matched,matches:e.matches,name:e.name,hooks:e.hooks,query:gt(o),params:wt(e,n),state:yr(e.state,r.state),hash:a,href:n}}const uo=e=>"name"in e.matched&&!!e.matched.name,Ar=(e,t)=>{const{protocol:r,host:n}=_(t),o=!n;return e.host.value?Mr(e).test(`${r}//${n}`):o},co=(e,t)=>{const{pathname:r}=_(t);return Fr(e).test(r)},fo=(e,t)=>{const{search:r}=_(t);return Wr(e).every(o=>o.test(r))},vt=(e,t)=>{const{hash:r}=_(t),{value:n}=e.hash;return G(n)?`#${n.replace(/^#*/,"")}`.toLowerCase()===r.toLowerCase():!0};function po(e){const{searchParams:t,pathname:r}=_(e),n=-1,o=1;return(a,i)=>{const u=br(a,t),c=Sr(a,r),h=br(i,t),w=Sr(i,r);return a.depth>i.depth?n:a.depth<i.depth?o:u+c>h+w?n:u+c<h+w?o:Ar(a,e)?n:Ar(i,e)?o:vt(a,e)?n:vt(i,e)?o:0}}function Sr(e,t){const r=Object.keys(e.path.params).filter(o=>Ye(e.path,o)).map(o=>o),n=r.filter(o=>gr(t,e.path,o)===void 0);return r.length-n.length}function br(e,t){const r=new URLSearchParams(t),n=new URLSearchParams(e.query.value),o=Array.from(n.keys()),a=o.filter(i=>!r.has(i));return o.length-a.length}const lo=[uo,co,fo,vt,ao];function ho(e,t){const r=po(t);return e.filter(n=>lo.every(o=>o(n,t))).sort(r)}function Ro(e,t,r){const n=ho(e,t);if(!n.length)return;const[o]=n,{searchParams:a,hash:i}=_(t);return{id:o.id,matched:o.matched,matches:o.matches,name:o.name,hooks:o.hooks,query:gt(a),params:wt(o,t),state:yr(o.state,r),hash:i,href:st(t)}}function Pr(e,t){const r=typeof e=="string"?_(e):e,n=typeof t=="string"?_(t):t,o=r.searchParams??new URLSearchParams(r.search),a=n.searchParams??new URLSearchParams(n.search);return Er({protocol:G(n.protocol)?n.protocol:r.protocol,host:G(n.host)?n.host:r.host,pathname:G(n.pathname)?n.pathname:r.pathname,searchParams:Rt(a,o),hash:G(n.hash)?n.hash:r.hash})}function yo(e,t){return G(t)?e.map(r=>{const n=`${t}${r.path.value}`;return{...r,path:z(n,r.path.params)}}):e}class mo extends Error{constructor(t){super(`Invalid Name "${t}": Router does not support multiple routes with the same name. All name names must be unique.`)}}function go(e){const t=e.map(({name:r})=>r);for(const r of t)if(Pt(t,r)>1)throw new mo(r)}class wo extends Error{constructor(t){super(`Missing Route Context: Router is missing the route "${t}", which was declared as context for at least one route.`)}}function Eo(e){const t=new Set(e.map(n=>n.id)),r=e.flatMap(n=>n.context).filter(vo);for(const n of r)if(!t.has(n.id))throw new wo(n.name)}function vo(e){return"id"in e}function Ao(e,t=[],r){const n=[...e,...t.map(o=>o.routes)].flat().filter(o=>G(o.name));return go(n),Eo(n),yo(n,r)}function So(e={},t=[]){const r=new K;return D(e.onBeforeRouteEnter??[]).forEach(n=>r.onBeforeRouteEnter.add(n)),D(e.onBeforeRouteUpdate??[]).forEach(n=>r.onBeforeRouteUpdate.add(n)),D(e.onBeforeRouteLeave??[]).forEach(n=>r.onBeforeRouteLeave.add(n)),D(e.onAfterRouteEnter??[]).forEach(n=>r.onAfterRouteEnter.add(n)),D(e.onAfterRouteUpdate??[]).forEach(n=>r.onAfterRouteUpdate.add(n)),D(e.onAfterRouteLeave??[]).forEach(n=>r.onAfterRouteLeave.add(n)),t.forEach(n=>{n.hooks.onBeforeRouteEnter.forEach(o=>r.onBeforeRouteEnter.add(o)),n.hooks.onBeforeRouteUpdate.forEach(o=>r.onBeforeRouteUpdate.add(o)),n.hooks.onBeforeRouteLeave.forEach(o=>r.onBeforeRouteLeave.add(o)),n.hooks.onAfterRouteEnter.forEach(o=>r.onAfterRouteEnter.add(o)),n.hooks.onAfterRouteUpdate.forEach(o=>r.onAfterRouteUpdate.add(o)),n.hooks.onAfterRouteLeave.forEach(o=>r.onAfterRouteLeave.add(o))}),r}function bo(e,{match:t,name:r,component:n}){const o=er(e),a=Ce(e);return f.defineComponent({name:"PropsWrapper",expose:[],setup(){const i=f.getCurrentInstance(),u=o(),c=a();return()=>{const h=u.getProps(t.id,r,c);return h instanceof Error?"":_e(h)?i?.suspense?f.h(Uo,{component:n,props:h}):f.h(Po,{component:n,props:h}):f.h(n,h)}}})}const Po=f.defineComponent(e=>{const t=f.ref();return f.watch(()=>e.props,async r=>{t.value=await r},{immediate:!0,deep:!0}),()=>t.value instanceof Error?"":t.value?f.h(e.component,t.value):""},{props:["component","props"]}),Uo=f.defineComponent(async e=>{const t=f.ref();return t.value=await e.props,f.watch(()=>t.value,async r=>{t.value=await r},{deep:!0}),()=>t.value instanceof Error?"":t.value?f.h(e.component,t.value):""},{props:["component","props"]});function ko(e){const t=new Map;return{getRouteComponents:n=>{const o=t.get(n.id);if(o)return o;const a=Lo(e,n);return t.set(n.id,a),a}}}function Lo(e,t){const r=lt(e);return nt(t)?Ur(e,t,t.components):tt(t)?Ur(e,t,{default:t.component}):{default:r}}function Ur(e,t,r){return Object.fromEntries(Object.entries(r).map(([n,o])=>[n,bo(e,{match:t,name:n,component:o})]))}const kr=Symbol();function Bo(e,t,r=[]){const o=t?.isGlobalRouter??!0?kr:Symbol(),a=[...r.flatMap(U=>U.rejections),...t?.rejections??[]],i=Ao(e,r,t?.base),u=wn();u.addGlobalRouteHooks(So(t,r));const c=it(),h=Fn(),w=ko(o),A=eo(),g=Wn({mode:t?.historyMode,listener:({location:U})=>{const O=fe(U);C(O,{state:U.state,replace:!0})}});function E(U,O={}){return Ro(i,U,O.state)}async function C(U,O={}){const F=c();g.stopListening();const W=E(U,O)??k("NotFound"),j=Fo(F),H=await u.runBeforeRouteHooks({to:W,from:j});switch(H.status){case"ABORT":return;case"PUSH":g.update(U,O),await b(...H.to);return;case"REJECT":g.update(U,O),s(H.type);break;case"SUCCESS":g.update(U,O),s(null);break;default:throw new Error(`Switch is not exhaustive for before hook response status: ${JSON.stringify(H)}`)}$(U)||S(F,W,j);const we=await u.runAfterRouteHooks({to:W,from:j});switch(we.status){case"PUSH":await b(...we.to);break;case"REJECT":s(we.type);break;case"SUCCESS":break;default:const de=we;throw new Error(`Switch is not exhaustive for after hook response status: ${JSON.stringify(de)}`)}g.startListening()}function S(U,O,F){const W=U;h.setProps(O).then(j=>{if(W===U)switch(j.status){case"SUCCESS":break;case"PUSH":b(...j.to);break;case"REJECT":s(j.type);break;default:const H=j;throw new Error(`Switch is not exhaustive for prop store response status: ${JSON.stringify(H)}`)}}).catch(j=>{try{u.runErrorHooks(j,{to:O,from:F,source:"props"})}catch(H){if(H instanceof M){b(...H.response.to);return}if(H instanceof ee){s(H.response.type);return}throw H}}),L(O)}const P=(U,O={},F={})=>{const W=i.find(j=>j.name===U);if(!W)throw new to(U);return io(W,O,F)},b=(U,O,F)=>{if(J(U)){const de={...O},He=Pr(U,{searchParams:de.query,hash:de.hash});return C(He,de)}if(typeof U=="string"){const{replace:de,...He}={...F},Go={...O},St=P(U,Go,He),Qo=mr({...St.matched.state},{...St.state,...He.state});return C(St.href,{replace:de,state:Qo})}const{replace:W,...j}={...O},H=mr({...U.matched.state},{...U.state,...j.state}),we=Pr(U.href,{searchParams:j.query,hash:j.hash});return C(we,{replace:W,state:H})},v=(U,O,F)=>{if(J(U)){const j={...O,replace:!0};return b(U,j)}if(typeof U=="string"){const j={...F,replace:!0},H={...O};return b(U,H,j)}const W={...O,replace:!0};return b(U,W)},p=U=>{s(U)},{setRejection:s,rejection:l,getRejectionRoute:k}=Qn(a),y=k("NotFound"),{currentRoute:d,routerRoute:R,updateRoute:L}=qn(o,y,b),N=Yn(t?.initialUrl),V=g.location.state,{host:x}=_(N),$=Jn(x);let T=!1;const Pe=f.ref(!1),{promise:At,resolve:Jo}=Promise.withResolvers();async function Lr(){if(T)return At;T=!0,jr(i)&&await Ir(),await C(N,{replace:!0,state:V}),g.startListening(),Jo(),Pe.value=!0}function Mo(){g.stopListening()}function Fo(U){return un(U)?null:{...d}}function Wo(U){u.setVueApp(U),h.setVueApp(U);const O=lt(o),F=sr(o);U.component("RouterView",O),U.component("RouterLink",F),U.provide(Yt(o),l),U.provide(Ft(o),u),U.provide(Kt(o),h),U.provide(zt(o),w),U.provide(nr,A),U.provide(o,Br),Lr()}const Br={route:R,resolve:P,find:E,push:b,replace:v,reject:p,refresh:g.refresh,forward:g.forward,back:g.back,go:g.go,install:Wo,isExternal:$,onBeforeRouteEnter:u.onBeforeRouteEnter,onBeforeRouteUpdate:u.onBeforeRouteUpdate,onBeforeRouteLeave:u.onBeforeRouteLeave,onAfterRouteEnter:u.onAfterRouteEnter,onAfterRouteUpdate:u.onAfterRouteUpdate,onAfterRouteLeave:u.onAfterRouteLeave,onError:u.onError,prefetch:t?.prefetch,start:Lr,started:Pe,stop:Mo,key:o};return Br}const No=z,Vo=z,Co=z,Q=ir(kr),xo=Q.onBeforeRouteLeave,Zo=Q.onBeforeRouteUpdate,Oo=Q.onAfterRouteLeave,jo=Q.onAfterRouteUpdate,Io=Q.isRoute,Do=Q.RouterView,Ho=Q.RouterLink,$o=Q.useRoute,qo=Q.useRouter,To=Q.useQueryValue,_o=Q.useLink;B.DuplicateParamsError=bt,B.MetaPropertyConflict=Ht,B.RouterLink=Ho,B.RouterNotInstalledError=oe,B.RouterView=Do,B.UseRouteInvalidError=$t,B.arrayOf=jn,B.asUrl=st,B.combineRoutes=at,B.createExternalRoute=fn,B.createParam=kt,B.createRejection=cn,B.createRoute=ae,B.createRouter=Bo,B.createRouterAssets=ir,B.createRouterPlugin=Zn,B.host=Vo,B.isRoute=Io,B.isUrl=J,B.isWithComponent=tt,B.isWithComponentProps=rt,B.isWithComponentPropsRecord=ot,B.isWithComponents=nt,B.isWithParent=et,B.onAfterRouteLeave=Oo,B.onAfterRouteUpdate=jo,B.onBeforeRouteLeave=xo,B.onBeforeRouteUpdate=Zo,B.path=No,B.query=Co,B.tupleOf=Dn,B.unionOf=cr,B.useLink=_o,B.useQueryValue=To,B.useRoute=$o,B.useRouter=qo,B.withDefault=xr,B.withParams=z,Object.defineProperty(B,Symbol.toStringTag,{value:"Module"})}));
package/dist/main.d.ts CHANGED
@@ -28,6 +28,7 @@ export { MetaPropertyConflict } from './errors/metaPropertyConflict';
28
28
  export { RouterNotInstalledError } from './errors/routerNotInstalledError';
29
29
  export { UseRouteInvalidError } from './errors/useRouteInvalidError';
30
30
  export { createRoute } from './services/createRoute';
31
+ export { createRejection } from './services/createRejection';
31
32
  export { createExternalRoute } from './services/createExternalRoute';
32
33
  export { createRouterAssets, type RouterAssets } from './services/createRouterAssets';
33
34
  export { withParams } from './services/withParams';
@@ -1,4 +1,7 @@
1
1
  import { AfterRouteHook, BeforeRouteHook } from '../types/hooks';
2
+ /**
3
+ * @deprecated will be removed in a future version
4
+ */
2
5
  export declare class RouteHooks {
3
6
  onBeforeRouteEnter: Set<BeforeRouteHook>;
4
7
  onBeforeRouteUpdate: Set<BeforeRouteHook>;
@@ -1,11 +1,10 @@
1
- import { Routes } from '../types/route';
2
- import { RouterAfterRouteHook, RouterBeforeRouteHook, RouterErrorHook } from '../types/router';
3
- export declare class RouterRouteHooks<TRoutes extends Routes = Routes, TRejections extends PropertyKey = PropertyKey> {
4
- onBeforeRouteEnter: Set<RouterBeforeRouteHook<TRoutes, TRejections>>;
5
- onBeforeRouteUpdate: Set<RouterBeforeRouteHook<TRoutes, TRejections>>;
6
- onBeforeRouteLeave: Set<RouterBeforeRouteHook<TRoutes, TRejections>>;
7
- onAfterRouteEnter: Set<RouterAfterRouteHook<TRoutes, TRejections>>;
8
- onAfterRouteUpdate: Set<RouterAfterRouteHook<TRoutes, TRejections>>;
9
- onAfterRouteLeave: Set<RouterAfterRouteHook<TRoutes, TRejections>>;
10
- onError: Set<RouterErrorHook<TRoutes, TRejections>>;
1
+ import { RouterAfterRouteHook, RouterBeforeRouteHook, RouterErrorHook } from '../types/hooks';
2
+ export declare class RouterRouteHooks {
3
+ onBeforeRouteEnter: Set<RouterBeforeRouteHook>;
4
+ onBeforeRouteUpdate: Set<RouterBeforeRouteHook>;
5
+ onBeforeRouteLeave: Set<RouterBeforeRouteHook>;
6
+ onAfterRouteEnter: Set<RouterAfterRouteHook>;
7
+ onAfterRouteUpdate: Set<RouterAfterRouteHook>;
8
+ onAfterRouteLeave: Set<RouterAfterRouteHook>;
9
+ onError: Set<RouterErrorHook>;
11
10
  }
@@ -1,4 +1,4 @@
1
- import { RegisteredRejectionType, RegisteredRouterPush, RegisteredRouterReject, RegisteredRouterReplace } from '../types/register';
1
+ import { RegisteredRouterPush, RegisteredRouterReject, RegisteredRouterReplace } from '../types/register';
2
2
  /**
3
3
  * Defines the structure of a successful callback response.
4
4
  */
@@ -23,7 +23,7 @@ export type CallbackPushResponse = {
23
23
  */
24
24
  export type CallbackRejectResponse = {
25
25
  status: 'REJECT';
26
- type: RegisteredRejectionType;
26
+ type: string;
27
27
  };
28
28
  /**
29
29
  * A function that can be called to abort a routing operation.
@@ -1,7 +1,9 @@
1
1
  import { InjectionKey } from 'vue';
2
- import { AddRouterAfterRouteHook, AddRouterBeforeRouteHook, Router, RouterRejections, RouterRoutes } from '../types/router';
2
+ import { AddRouterAfterRouteHook, AddRouterBeforeRouteHook } from '../types/hooks';
3
3
  import { Routes } from '../types/route';
4
- type ComponentHooks<TRoutes extends Routes, TRejections extends PropertyKey> = {
4
+ import { Router, RouterRejections, RouterRoutes } from '../types/router';
5
+ import { Rejection } from '../types/rejection';
6
+ type ComponentHooks<TRoutes extends Routes, TRejections extends Rejection[]> = {
5
7
  onBeforeRouteLeave: AddRouterBeforeRouteHook<TRoutes, TRejections>;
6
8
  onBeforeRouteUpdate: AddRouterBeforeRouteHook<TRoutes, TRejections>;
7
9
  onAfterRouteLeave: AddRouterAfterRouteHook<TRoutes, TRejections>;
@@ -1,3 +1,4 @@
1
1
  import { CreateRouteOptions, ToRoute, WithHost, WithoutHost, WithoutParent, WithParent } from '../types/createRouteOptions';
2
- export declare function createExternalRoute<const TOptions extends CreateRouteOptions & WithHost & WithoutParent>(options: TOptions): ToRoute<TOptions, undefined>;
3
- export declare function createExternalRoute<const TOptions extends CreateRouteOptions & WithoutHost & WithParent>(options: TOptions): ToRoute<TOptions, undefined>;
2
+ import { ExternalRouteHooks } from '../types/hooks';
3
+ export declare function createExternalRoute<const TOptions extends CreateRouteOptions & WithHost & WithoutParent>(options: TOptions): ToRoute<TOptions, undefined> & ExternalRouteHooks<TOptions['context']>;
4
+ export declare function createExternalRoute<const TOptions extends CreateRouteOptions & WithoutHost & WithParent>(options: TOptions): ToRoute<TOptions, undefined> & ExternalRouteHooks<TOptions['context']>;
@@ -0,0 +1,6 @@
1
+ import { Rejection } from '../types/rejection';
2
+ import { Component } from 'vue';
3
+ export declare function createRejection<TType extends string>(options: {
4
+ type: TType;
5
+ component?: Component;
6
+ }): Rejection<TType>;
@@ -1,4 +1,5 @@
1
- import { CreateRouteOptions, PropsGetter, CreateRouteProps, ToRoute } from '../types/createRouteOptions';
2
- type CreateRouteWithProps<TOptions extends CreateRouteOptions, TProps extends CreateRouteProps<TOptions>> = CreateRouteProps<TOptions> extends PropsGetter<TOptions> ? Partial<ReturnType<CreateRouteProps<TOptions>>> extends ReturnType<CreateRouteProps<TOptions>> ? [props?: TProps] : [props: TProps] : Partial<CreateRouteProps<TOptions>> extends CreateRouteProps<TOptions> ? [props?: TProps] : [props: TProps];
3
- export declare function createRoute<const TOptions extends CreateRouteOptions, const TProps extends CreateRouteProps<TOptions>>(options: TOptions, ...args: CreateRouteWithProps<TOptions, TProps>): ToRoute<TOptions, CreateRouteProps<TOptions> extends TProps ? undefined : TProps>;
1
+ import { CreateRouteOptions, PropsGetter, CreateRouteProps, ToRoute, RouterViewPropsGetter } from '../types/createRouteOptions';
2
+ import { InternalRouteHooks } from '../types/hooks';
3
+ type CreateRouteWithProps<TOptions extends CreateRouteOptions, TProps extends CreateRouteProps<TOptions>> = CreateRouteProps<TOptions> extends RouterViewPropsGetter<TOptions> ? [props?: RouterViewPropsGetter<TOptions>] : CreateRouteProps<TOptions> extends PropsGetter<TOptions> ? Partial<ReturnType<CreateRouteProps<TOptions>>> extends ReturnType<CreateRouteProps<TOptions>> ? [props?: TProps] : [props: TProps] : Partial<CreateRouteProps<TOptions>> extends CreateRouteProps<TOptions> ? [props?: TProps] : [props: TProps];
4
+ export declare function createRoute<const TOptions extends CreateRouteOptions, const TProps extends CreateRouteProps<TOptions>>(options: TOptions, ...args: CreateRouteWithProps<TOptions, TProps>): ToRoute<TOptions, CreateRouteProps<TOptions> extends TProps ? undefined : TProps> & InternalRouteHooks<TOptions['context']>;
4
5
  export {};
@@ -0,0 +1,15 @@
1
+ import { AddRouterBeforeRouteHook, AddRouterAfterRouteHook, AddRouterErrorHook } from '../types/hooks';
2
+ import { Routes } from '../types/route';
3
+ import { RouterRouteHooks } from '../models/RouterRouteHooks';
4
+ import { Rejection } from '../types/rejection';
5
+ export type RouteHooks<TRoutes extends Routes = Routes, TRejections extends Rejection[] = Rejection[]> = {
6
+ onBeforeRouteEnter: AddRouterBeforeRouteHook<TRoutes, TRejections>;
7
+ onBeforeRouteUpdate: AddRouterBeforeRouteHook<TRoutes, TRejections>;
8
+ onBeforeRouteLeave: AddRouterBeforeRouteHook<TRoutes, TRejections>;
9
+ onAfterRouteEnter: AddRouterAfterRouteHook<TRoutes, TRejections>;
10
+ onAfterRouteUpdate: AddRouterAfterRouteHook<TRoutes, TRejections>;
11
+ onAfterRouteLeave: AddRouterAfterRouteHook<TRoutes, TRejections>;
12
+ onError: AddRouterErrorHook<TRoutes, TRejections>;
13
+ store: RouterRouteHooks;
14
+ };
15
+ export declare function createRouteHooks(): RouteHooks;
@@ -24,5 +24,5 @@ import { EmptyRouterPlugin, RouterPlugin } from '../types/routerPlugin';
24
24
  * const router = createRouter(routes)
25
25
  * ```
26
26
  */
27
- export declare function createRouter<const TRoutes extends Routes, const TOptions extends RouterOptions, const TPlugin extends RouterPlugin = EmptyRouterPlugin>(routes: TRoutes, options?: TOptions, plugins?: TPlugin[]): Router<TRoutes, TOptions, TPlugin>;
28
- export declare function createRouter<const TRoutes extends Routes, const TOptions extends RouterOptions, const TPlugin extends RouterPlugin = EmptyRouterPlugin>(routes: TRoutes[], options?: TOptions, plugins?: TPlugin[]): Router<TRoutes, TOptions, TPlugin>;
27
+ export declare function createRouter<const TRoutes extends Routes, const TOptions extends RouterOptions = {}, const TPlugin extends RouterPlugin = EmptyRouterPlugin>(routes: TRoutes, options?: TOptions, plugins?: TPlugin[]): Router<TRoutes, TOptions, TPlugin>;
28
+ export declare function createRouter<const TRoutes extends Routes, const TOptions extends RouterOptions = {}, const TPlugin extends RouterPlugin = EmptyRouterPlugin>(routes: TRoutes[], options?: TOptions, plugins?: TPlugin[]): Router<TRoutes, TOptions, TPlugin>;
@@ -1,4 +1,4 @@
1
- import { Router, RouterRoutes, AddRouterBeforeRouteHook, AddRouterAfterRouteHook, RouterRejections } from '../types/router';
1
+ import { Router, RouterRoutes, RouterRejections } from '../types/router';
2
2
  import { InjectionKey } from 'vue';
3
3
  import { createRouterView } from '../components/routerView';
4
4
  import { createRouterLink } from '../components/routerLink';
@@ -7,6 +7,7 @@ import { createUseRouter } from '../compositions/useRouter';
7
7
  import { createUseQueryValue } from '../compositions/useQueryValue';
8
8
  import { createUseLink } from '../compositions/useLink';
9
9
  import { createIsRoute } from '../guards/routes';
10
+ import { AddRouterAfterRouteHook, AddRouterBeforeRouteHook } from '../types/hooks';
10
11
  export type RouterAssets<TRouter extends Router> = {
11
12
  /**
12
13
  * Registers a hook that is called before a route is left. Must be called from setup.
@@ -77,7 +78,7 @@ export type RouterAssets<TRouter extends Router> = {
77
78
  * The function also sets up a reactive watcher on the route object from the router to continually check the validity of the route name
78
79
  * if provided, throwing an error if the validation fails at any point during the component's lifecycle.
79
80
  *
80
- * @template TRouteName - A string type that should match route name of RouterRouteName<TRouter>, ensuring the route name exists.
81
+ * @template TRouteName - A string type that should match route name of `RouterRouteName<TRouter>`, ensuring the route name exists.
81
82
  * @param routeName - Optional. The name of the route to validate against the current active routes.
82
83
  * @returns The current router route. If a route name is provided, it validates the route name first.
83
84
  * @throws {UseRouteInvalidError} Throws an error if the provided route name is not valid or does not match the current route.
@@ -6,6 +6,7 @@ import { InjectionKey } from 'vue';
6
6
  import { BuiltInRejectionType } from './createRouterReject';
7
7
  import { AsString } from '../types/utilities';
8
8
  import { Routes } from '../types/route';
9
+ import { Rejection } from '../types/rejection';
9
10
  /**
10
11
  * Defines the structure of a successful callback response.
11
12
  */
@@ -28,7 +29,7 @@ export type RouterCallbackPushResponse<TRoutes extends Routes> = {
28
29
  /**
29
30
  * Defines the structure of a callback response that results in the rejection of a route transition.
30
31
  */
31
- export type RouterCallbackRejectResponse<TRejections extends PropertyKey> = {
32
+ export type RouterCallbackRejectResponse<TRejections extends string> = {
32
33
  status: 'REJECT';
33
34
  type: AsString<TRejections> | BuiltInRejectionType;
34
35
  };
@@ -36,10 +37,11 @@ export type RouterCallbackRejectResponse<TRejections extends PropertyKey> = {
36
37
  * A function that can be called to abort a routing operation.
37
38
  */
38
39
  export type CallbackContextAbort = () => void;
39
- export type RouterCallbackContext<TRouter extends Router> = {
40
- reject: RouterReject<RouterRejections<TRouter>>;
41
- push: RouterPush<RouterRoutes<TRouter>>;
42
- replace: RouterReplace<RouterRoutes<TRouter>>;
40
+ export type RouterCallbackContext<TRoutes extends Routes = Routes, TRejections extends Rejection[] = Rejection[]> = {
41
+ reject: RouterReject<TRejections>;
42
+ push: RouterPush<TRoutes>;
43
+ replace: RouterReplace<TRoutes>;
43
44
  abort: CallbackContextAbort;
44
45
  };
45
- export declare function createRouterCallbackContext<TRouter extends Router>(_routerKey: InjectionKey<TRouter>): RouterCallbackContext<TRouter>;
46
+ export declare function createRouterCallbackContext<TRouter extends Router>(_routerKey: InjectionKey<TRouter>): RouterCallbackContext<RouterRoutes<TRouter>, RouterRejections<TRouter>>;
47
+ export declare function createRouterCallbackContext<TRoutes extends Routes, TRejections extends Rejection[]>(): RouterCallbackContext<TRoutes, TRejections>;
@@ -1,22 +1,19 @@
1
- import { AddGlobalRouteHooks, AddComponentAfterRouteHook, AddComponentBeforeRouteHook } from '../types/hooks';
1
+ import { AddGlobalRouteHooks, AddComponentAfterRouteHook, AddComponentBeforeRouteHook, RouterRouteHookAfterRunner, RouterRouteHookErrorRunner, RouterRouteHookBeforeRunner, AddRouterBeforeRouteHook, AddRouterAfterRouteHook, AddRouterErrorHook } from '../types/hooks';
2
2
  import { HasVueAppStore } from './createVueAppStore';
3
- import { AddRouterAfterRouteHook, AddRouterBeforeRouteHook, Router, RouterRoutes, RouterRouteHookBeforeRunner, RouterRouteHookAfterRunner, RouterRejections, AddRouterErrorHook, RouterRouteHookErrorRunner } from '../types/router';
4
- import { Routes } from '../types/route';
5
- import { InjectionKey } from 'vue';
6
- export declare const getRouterHooksKey: (routerKey: InjectionKey<Router>) => InjectionKey<RouterHooks<any, any>>;
7
- export type RouterHooks<TRoutes extends Routes, TRejections extends PropertyKey> = HasVueAppStore & {
8
- runBeforeRouteHooks: RouterRouteHookBeforeRunner<TRoutes>;
9
- runAfterRouteHooks: RouterRouteHookAfterRunner<TRoutes>;
10
- runErrorHooks: RouterRouteHookErrorRunner<TRoutes>;
11
- addComponentBeforeRouteHook: AddComponentBeforeRouteHook<TRoutes, TRejections>;
12
- addComponentAfterRouteHook: AddComponentAfterRouteHook<TRoutes, TRejections>;
13
- addGlobalRouteHooks: AddGlobalRouteHooks<TRoutes, TRejections>;
14
- onBeforeRouteEnter: AddRouterBeforeRouteHook<TRoutes, TRejections>;
15
- onBeforeRouteUpdate: AddRouterBeforeRouteHook<TRoutes, TRejections>;
16
- onBeforeRouteLeave: AddRouterBeforeRouteHook<TRoutes, TRejections>;
17
- onAfterRouteEnter: AddRouterAfterRouteHook<TRoutes, TRejections>;
18
- onAfterRouteUpdate: AddRouterAfterRouteHook<TRoutes, TRejections>;
19
- onAfterRouteLeave: AddRouterAfterRouteHook<TRoutes, TRejections>;
20
- onError: AddRouterErrorHook<TRoutes, TRejections>;
3
+ export declare const getRouterHooksKey: (routerKey: import('vue').InjectionKey<import('../main').Router>) => import('vue').InjectionKey<RouterHooks>;
4
+ export type RouterHooks = HasVueAppStore & {
5
+ runBeforeRouteHooks: RouterRouteHookBeforeRunner;
6
+ runAfterRouteHooks: RouterRouteHookAfterRunner;
7
+ runErrorHooks: RouterRouteHookErrorRunner;
8
+ addComponentBeforeRouteHook: AddComponentBeforeRouteHook;
9
+ addComponentAfterRouteHook: AddComponentAfterRouteHook;
10
+ addGlobalRouteHooks: AddGlobalRouteHooks;
11
+ onBeforeRouteEnter: AddRouterBeforeRouteHook;
12
+ onBeforeRouteUpdate: AddRouterBeforeRouteHook;
13
+ onBeforeRouteLeave: AddRouterBeforeRouteHook;
14
+ onAfterRouteEnter: AddRouterAfterRouteHook;
15
+ onAfterRouteUpdate: AddRouterAfterRouteHook;
16
+ onAfterRouteLeave: AddRouterAfterRouteHook;
17
+ onError: AddRouterErrorHook;
21
18
  };
22
- export declare function createRouterHooks<TRouter extends Router>(_routerKey: InjectionKey<TRouter>): RouterHooks<RouterRoutes<TRouter>, RouterRejections<TRouter>>;
19
+ export declare function createRouterHooks(): RouterHooks;
@@ -1,4 +1,4 @@
1
+ import { CreateRouterPluginOptions, RouterPlugin, PluginRouteHooks } from '../types/routerPlugin';
2
+ import { Rejection } from '../types/rejection';
1
3
  import { Routes } from '../types/route';
2
- import { RouterPlugin } from '../types/routerPlugin';
3
- import { Component } from 'vue';
4
- export declare function createRouterPlugin<TRoutes extends Routes = [], TRejections extends Record<string, Component> = {}>(plugin: Partial<RouterPlugin<TRoutes, TRejections>>): RouterPlugin<TRoutes, TRejections>;
4
+ export declare function createRouterPlugin<TRoutes extends Routes = Routes, TRejections extends Rejection[] = Rejection[]>(plugin: CreateRouterPluginOptions<TRoutes, TRejections>): RouterPlugin<TRoutes, TRejections> & PluginRouteHooks<TRoutes, TRejections>;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,16 +1,14 @@
1
- import { Ref, Component } from 'vue';
1
+ import { Ref } from 'vue';
2
2
  import { ResolvedRoute } from '../types/resolved';
3
+ import { Rejection } from '../types/rejection';
3
4
  export type BuiltInRejectionType = 'NotFound';
4
5
  export type RouterSetReject = (type: string | null) => void;
5
6
  type GetRejectionRoute = (type: string) => ResolvedRoute;
6
- export type RouterRejection = Ref<null | {
7
- type: string;
8
- component: Component;
9
- }>;
7
+ export type RouterRejection = Ref<Rejection | null>;
10
8
  export type CreateRouterReject = {
11
9
  setRejection: RouterSetReject;
12
10
  rejection: RouterRejection;
13
11
  getRejectionRoute: GetRejectionRoute;
14
12
  };
15
- export declare function createRouterReject(rejections: Partial<Record<string, Component>>): CreateRouterReject;
13
+ export declare function createRouterReject(rejections: Rejection[]): CreateRouterReject;
16
14
  export {};
@@ -1,5 +1,4 @@
1
1
  import { ResolvedRoute } from '../types/resolved';
2
2
  import { RouterRouteHooks } from '../models/RouterRouteHooks';
3
- import { Routes } from '../main';
4
- export declare function getGlobalBeforeRouteHooks<TRoutes extends Routes, TRejections extends PropertyKey>(to: ResolvedRoute, from: ResolvedRoute | null, globalHooks: RouterRouteHooks<TRoutes, TRejections>): RouterRouteHooks<TRoutes, TRejections>;
5
- export declare function getGlobalAfterRouteHooks<TRoutes extends Routes, TRejections extends PropertyKey>(to: ResolvedRoute, from: ResolvedRoute | null, globalHooks: RouterRouteHooks<TRoutes, TRejections>): RouterRouteHooks<TRoutes, TRejections>;
3
+ export declare function getGlobalBeforeRouteHooks(to: ResolvedRoute, from: ResolvedRoute | null, globalHooks: RouterRouteHooks): RouterRouteHooks;
4
+ export declare function getGlobalAfterRouteHooks(to: ResolvedRoute, from: ResolvedRoute | null, globalHooks: RouterRouteHooks): RouterRouteHooks;
@@ -1,10 +1,4 @@
1
- import { RouteHooks } from '../models/RouteHooks';
2
1
  import { ResolvedRoute } from '../types/resolved';
3
- /**
4
- * @deprecated will be removed in a future version
5
- */
6
- export declare function getBeforeRouteHooksFromRoutes(to: ResolvedRoute, from: ResolvedRoute | null): RouteHooks;
7
- /**
8
- * @deprecated will be removed in a future version
9
- */
10
- export declare function getAfterRouteHooksFromRoutes(to: ResolvedRoute, from: ResolvedRoute | null): RouteHooks;
2
+ import { RouterRouteHooks } from '../models/RouterRouteHooks';
3
+ export declare function getBeforeRouteHooksFromRoutes(to: ResolvedRoute, from: ResolvedRoute | null): RouterRouteHooks;
4
+ export declare function getAfterRouteHooksFromRoutes(to: ResolvedRoute, from: ResolvedRoute | null): RouterRouteHooks;
@@ -0,0 +1,10 @@
1
+ import { RouteHooks } from '../models/RouteHooks';
2
+ import { ResolvedRoute } from '../types/resolved';
3
+ /**
4
+ * @deprecated will be removed in a future version
5
+ */
6
+ export declare function getBeforeRouteHooksFromRoutesDeprecated(to: ResolvedRoute, from: ResolvedRoute | null): RouteHooks;
7
+ /**
8
+ * @deprecated will be removed in a future version
9
+ */
10
+ export declare function getAfterRouteHooksFromRoutesDeprecated(to: ResolvedRoute, from: ResolvedRoute | null): RouteHooks;
@@ -1,5 +1,6 @@
1
1
  import { RouteMatchRule } from '../types/routeMatchRule';
2
2
  export declare const isNamedRoute: RouteMatchRule;
3
+ export declare const routeHostMatches: RouteMatchRule;
3
4
  export declare const routePathMatches: RouteMatchRule;
4
5
  export declare const routeQueryMatches: RouteMatchRule;
5
6
  export declare const routeHashMatches: RouteMatchRule;