@kitbag/router 0.20.11 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -87
- package/dist/components/routerLink.d.ts +3 -3
- package/dist/errors/contextAbortError.d.ts +2 -2
- package/dist/errors/contextPushError.d.ts +2 -2
- package/dist/errors/contextRejectionError.d.ts +2 -2
- package/dist/keys.d.ts +1 -3
- package/dist/kitbag-router.js +1780 -1847
- package/dist/kitbag-router.umd.cjs +3 -3
- package/dist/main.d.ts +0 -16
- package/dist/models/hooks.d.ts +10 -0
- package/dist/services/createComponentHooks.d.ts +7 -7
- package/dist/services/createExternalRoute.d.ts +3 -2
- package/dist/services/createHooksFactory.d.ts +15 -0
- package/dist/services/createPropStore.d.ts +2 -2
- package/dist/services/createRoute.d.ts +2 -1
- package/dist/services/createRouterAssets.d.ts +5 -5
- package/dist/services/createRouterCallbackContext.d.ts +8 -6
- package/dist/services/createRouterHooks.d.ts +14 -14
- package/dist/services/createRouterPlugin.d.ts +2 -2
- package/dist/services/createUrlParts.d.ts +13 -0
- package/dist/services/getGlobalHooksForRouter.d.ts +2 -3
- package/dist/services/getGlobalRouteHooks.d.ts +3 -3
- package/dist/services/getRouteHooks.d.ts +3 -3
- package/dist/services/hooks.d.ts +2 -2
- package/dist/services/urlCombine.d.ts +2 -1
- package/dist/services/urlCreator.d.ts +2 -1
- package/dist/services/urlParser.d.ts +1 -1
- package/dist/types/callbackContext.d.ts +15 -0
- package/dist/types/createRouteOptions.d.ts +6 -13
- package/dist/types/hooks.d.ts +56 -136
- package/dist/types/params.d.ts +11 -5
- package/dist/types/props.d.ts +8 -8
- package/dist/types/register.d.ts +1 -41
- package/dist/types/rejection.d.ts +6 -2
- package/dist/types/resolved.d.ts +2 -2
- package/dist/types/route.d.ts +5 -4
- package/dist/types/routeContext.d.ts +11 -5
- package/dist/types/router.d.ts +11 -11
- package/dist/types/routerAbort.d.ts +1 -0
- package/dist/types/routerPlugin.d.ts +17 -41
- package/dist/types/routerReject.d.ts +2 -2
- package/dist/types/url.d.ts +0 -9
- package/dist/types/urlParts.d.ts +53 -0
- package/dist/utilities/makeOptional.d.ts +1 -0
- package/dist/utilities/testHelpers.d.ts +279 -11
- package/package.json +4 -2
- package/dist/models/RouteHooks.d.ts +0 -12
- package/dist/models/RouterRouteHooks.d.ts +0 -10
- package/dist/services/createCallbackContext.d.ts +0 -44
- package/dist/services/createRouteHooks.d.ts +0 -15
- package/dist/services/getRouteHooksDeprecated.d.ts +0 -10
|
@@ -1,4 +1,4 @@
|
|
|
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 Br(e){return e!==String&&e!==Boolean&&e!==Number&&e!==Date}function Nr(e){return typeof e=="function"&&Br(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 Vr(e){return ke(e)&&e.defaultValue!==void 0}function Cr(e,t){return kt(e,t)}function xr(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 Zr(){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 Or(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 jr(){try{m=await Zr()}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 Ir=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;function he(e,t){if(typeof t=="string"&&Ir.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 Dr(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 Dr(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 Hr=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;function Re(e,t){if(typeof t=="string"&&Hr.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 $r(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 qr(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(Vr(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(Nr(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(qr(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 Tr(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 _r(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 Jr(e){const t=ze(e.host.value);return new RegExp(`^${t}$`,"i")}function Mr(e){const t=ze(e.path.value);return new RegExp(`^${t}$`,"i")}function Fr(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 _r(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"),Qr)}function Wr(e,t){const r=jt(t);return e.replace(r,zr)}function Ye(e,t){return Yr(t).test(e.value)}function Xe(e){return new RegExp(Gr,"g").test(e)}const Ne=`\\${Ee}\\??([\\w-_]+)\\${Ue}`,Gr=`\\${Ee}\\?([\\w-_]+)\\${Ue}`,Qr=".*",zr="(.*)";function Ke(e){const[t]=It(e,new RegExp(Ne,"g"));return t}function jt(e){return new RegExp(`\\${Ee}\\??${e}\\${Ue}`,"g")}function Yr(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 Xr(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=$r(t,i);return pe([i],n),n[a]=u,n},{}):{}}function Kr(e){return le(e)&&typeof e.value=="string"}function ne(e){return e===void 0?z():Kr(e)?e:z(e,{})}function z(e,t){return{value:e??"",params:Xr(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 en(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 tn(e,t){return rn(e,t),{...e,...t}}function rn(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 nn(e,t){pe(e.params,t.params);const r=[e.value,t.value].filter(G).join("&");return z(r,{...e.params,...t.params})}function on(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:nn(e.query,t.query),meta:tn(e.meta,t.meta),state:on(e.state,t.state),hash:en(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 an=it()();function sn(e){return e===an}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 un(e){const t=e.component??Tt(e.type);return{type:e.type,component:t}}function cn(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 fn=Ae();function ft(e){const t=fn(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 dn(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 pn(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 ln(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 hn(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 Rn(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 yn(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 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}}}const Ft=Ae();function gn(){const{setVueApp:e,runWithContext:t}=Mt(),r={global:new K,component:new K},{reject:n,push:o,replace:a,abort:i}=mn(),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=dn(s,l),R=ln(s,l),L=Rn(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=pn(s,l),R=hn(s,l),L=yn(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 wn(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 En(e){const t=zt(e);return()=>{const r=f.inject(t);if(!r)throw new oe;return r}}const Yt=Ae();function vn(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 An(e,t){return typeof t=="object"&&t!==null&&Xt in t&&e in t}function Sn(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}={})=>An(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=vn(e),o=ft(e),a=En(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 bn="lazy",Pn={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,Pn[n],bn].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 Un=f.defineAsyncComponent(()=>new Promise(e=>{e({default:{template:"foo"}})}));function rr(e){return e.name===Un.name&&"__asyncLoader"in e}const nr=Symbol("visibilityObserver");function kn(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 Ln(e){const t=er(e);return r=>{const n=new Map,o=f.ref(),{getPrefetchProps:a,setPrefetchProps:i}=t(),{isElementVisible:u}=kn(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){Bn(A,g,E),n.has(A)||n.set(A,a(A,g,E))}return{element:o,commit:c}}}function Bn(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=Ln(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)&&xr(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 Nn(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}=wn(t),i=pt(t),u=lt(t),c=sr(t),h=Ce(t),w=Se(t),A=Nn(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]"}),Vn=ae({parent:mt,name:"parentA.childB",path:"/childB/[paramD]",component:Ze}),Cn=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 xn(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=Tr(t,n);if(o!==void 0)return o}throw r(`Value ${t} does not satisfy any of the possible values`)}}}const Zn={separator:","};function On(e,t={}){const{separator:r}={...Zn,...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 jn={separator:","};function In(e,t={}){const{separator:r}={...jn,...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",Dn="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 Hn(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(Dn,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 $n(e,t,r){const n=f.reactive({...t}),o=u=>{Object.assign(n,{...u})},a=n,i=Sn(e,a,r);return{currentRoute:a,routerRoute:i,updateRoute:o}}function _(e){return!e.startsWith("http")?Tn(e):qn(e)}function qn(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 Tn(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 _n(e){return t=>{const{host:r}=_(t);return!(r===void 0||r===e)}}function Jn(){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 Mn(){const{setVueApp:e,runWithContext:t}=Mt(),r=f.reactive(new Map),{push:n,replace:o,reject:a}=Jn(),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 "${
|
|
1
|
+
(function(V,p){typeof exports=="object"&&typeof module<"u"?p(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],p):(V=typeof globalThis<"u"?globalThis:V||self,p(V["@kitbag/router"]={},V.Vue))})(this,(function(V,p){"use strict";class be extends Error{constructor(e){super(`Invalid Param "${e}": Router does not support multiple params by the same name. All param names must be unique.`)}}function ve(t,e){return t.filter(r=>e===r).length}function ct(...t){const e=t.flatMap(r=>Array.isArray(r)?r:Object.keys(r));for(const r of e)if(ve(e,r)>1)throw new be(r)}class G extends Error{}const yt="[",kt="]";function Vr(t){return t!==String&&t!==Boolean&&t!==Number&&t!==Date}function Br(t){return typeof t=="function"&&Vr(t)}function Ut(t){return typeof t=="object"&&"get"in t&&typeof t.get=="function"&&"set"in t&&typeof t.set=="function"}function Ae(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"}function ke(t,e){return Ut(t)?{...t,defaultValue:e??t.defaultValue}:{get:r=>X(r,t),set:r=>Q(r,t),defaultValue:e}}function Cr(t){return Ut(t)&&t.defaultValue!==void 0}function Nr(t,e){return ke(t,e)}function xr(t){return t!==void 0}function ut(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function _(t){return typeof t=="string"&&t.length>0}let w=null;async function Zr(){const{ZodType:t,ZodString:e,ZodIPv4:r,ZodIPv6:n,ZodCIDRv4:o,ZodCIDRv6:s,ZodURL:a,ZodEmail:i,ZodUUID:u,ZodBase64:y,ZodCUID:E,ZodCUID2:h,ZodULID:c,ZodJWT:d,ZodBigInt:m,ZodNaN:k,ZodBoolean:U,ZodDate:v,ZodISODateTime:g,ZodISODate:l,ZodISOTime:f,ZodNumber:S,ZodLiteral:L,ZodObject:P,ZodEnum:R,ZodArray:b,ZodTuple:B,ZodUnion:C,ZodDiscriminatedUnion:Z,ZodRecord:I,ZodMap:$,ZodSet:q,ZodIntersection:At,ZodPromise:Se}=await import("zod");return{ZodType:t,ZodString:e,ZodIPv4:r,ZodIPv6:n,ZodCIDRv4:o,ZodCIDRv6:s,ZodURL:a,ZodEmail:i,ZodUUID:u,ZodBase64:y,ZodCUID:E,ZodCUID2:h,ZodULID:c,ZodJWT:d,ZodBigInt:m,ZodNaN:k,ZodBoolean:U,ZodDate:v,ZodISODateTime:g,ZodISODate:l,ZodISOTime:f,ZodNumber:S,ZodLiteral:L,ZodObject:P,ZodEnum:R,ZodArray:b,ZodTuple:B,ZodUnion:C,ZodDiscriminatedUnion:Z,ZodRecord:I,ZodMap:$,ZodSet:q,ZodIntersection:At,ZodPromise:Se}}function Or(t){return Object.values(t).some(e=>Object.values(e.host.params).some(r=>qt(r))||Object.values(e.path.params).some(r=>qt(r))||Object.values(e.query.params).some(r=>qt(r)))}function qt(t){return ut(t)&&"parse"in t&&typeof t.parse=="function"&&"~standard"in t&&ut(t["~standard"])&&"vendor"in t["~standard"]&&t["~standard"].vendor==="zod"}async function jr(){try{w=await Zr()}catch{throw new Error("Failed to initialize Zod")}}function Ue(t){return w?t instanceof w.ZodType:!1}function Le(t){return{get:(e,{invalid:r})=>{try{return Tt(e,t)}catch{throw r()}},set:(e,{invalid:r})=>{try{return Jt(e,t)}catch{throw r()}}}}const Ir=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;function ft(t,e){if(typeof e=="string"&&Ir.test(e)){const r=new Date(e);return isNaN(r.getTime())?e:r}return e}function mt(t){for(const e of t)try{return e()}catch{continue}throw new Error("All functions failed")}function Lt(t,e){return w?.ZodString&&t instanceof w.ZodString?1:w?.ZodString&&e instanceof w.ZodString?-1:0}function Tt(t,e){if(!w)throw new Error("Zod is not initialized");if(e instanceof w.ZodString)return e.parse(t);if(e instanceof w.ZodBoolean)return e.parse(!!t);if(e instanceof w.ZodDate)return e.parse(new Date(t));if(e instanceof w.ZodNumber)return e.parse(Number(t));if(e instanceof w.ZodBigInt)return e.parse(BigInt(t));if(e instanceof w.ZodNaN)return e.parse(Number(t));if(e instanceof w.ZodLiteral)return mt([()=>e.parse(Number(t)),()=>e.parse(!!t),()=>e.parse(t)]);if(e instanceof w.ZodObject)return e.parse(JSON.parse(t,ft));if(e instanceof w.ZodEnum)return e.parse(t);if(e instanceof w.ZodArray||e instanceof w.ZodTuple)return e.parse(JSON.parse(t,ft));if(e instanceof w.ZodUnion){const r=Array.from(e.def.options).sort(Lt).map(n=>()=>Tt(t,n));return mt(r)}if(e instanceof w.ZodDiscriminatedUnion){const r=Array.from(e.options).sort(Lt).map(n=>()=>Tt(t,n));return mt(r)}if(e instanceof w.ZodRecord)return e.parse(JSON.parse(t,ft));if(e instanceof w.ZodMap)return e.parse(new Map(JSON.parse(t,ft)));if(e instanceof w.ZodSet)return e.parse(new Set(JSON.parse(t,ft)));if(e instanceof w.ZodIntersection)throw new Error("Intersection schemas are not supported");if(e instanceof w.ZodPromise)throw new Error("Promise schemas are not supported");return e.parse(t)}function Jt(t,e){if(!w)throw new Error("Zod is not initialized");if(e instanceof w.ZodString||e instanceof w.ZodISODateTime||e instanceof w.ZodISODate||e instanceof w.ZodISOTime||e instanceof w.ZodIPv4||e instanceof w.ZodIPv6||e instanceof w.ZodCIDRv4||e instanceof w.ZodCIDRv6||e instanceof w.ZodURL||e instanceof w.ZodEmail||e instanceof w.ZodUUID||e instanceof w.ZodBase64||e instanceof w.ZodCUID||e instanceof w.ZodCUID2||e instanceof w.ZodULID||e instanceof w.ZodJWT)return e.parse(t);if(e instanceof w.ZodBoolean)return e.parse(t).toString();if(e instanceof w.ZodDate)return e.parse(t).toISOString();if(e instanceof w.ZodNumber)return e.parse(Number(t)).toString();if(e instanceof w.ZodBigInt)return e.parse(BigInt(String(t))).toString();if(e instanceof w.ZodNaN)return e.parse(t).toString();if(e instanceof w.ZodLiteral){const r=e.parse(t);return r!=null?r.toString():String(r)}if(e instanceof w.ZodObject)return JSON.stringify(e.parse(t));if(e instanceof w.ZodEnum){const r=e.parse(t);return typeof r=="string"?r:String(r)}if(e instanceof w.ZodArray||e instanceof w.ZodTuple)return JSON.stringify(e.parse(t));if(e instanceof w.ZodUnion){const r=Array.from(e.def.options).sort(Lt).map(n=>()=>Jt(t,n));return mt(r)}if(e instanceof w.ZodDiscriminatedUnion){const r=Array.from(e.options).sort(Lt).map(n=>()=>Jt(t,n));return mt(r)}if(e instanceof w.ZodRecord)return JSON.stringify(e.parse(t));if(e instanceof w.ZodMap){const r=e.parse(t);return JSON.stringify(Array.from(r.entries()))}if(e instanceof w.ZodSet){const r=e.parse(t);return JSON.stringify(Array.from(r.values()))}if(e instanceof w.ZodIntersection)throw new Error("Intersection schemas are not supported");if(e instanceof w.ZodPromise)throw new Error("Promise schemas are not supported");return JSON.stringify(e.parse(t))}function Mt(t){return typeof t=="object"&&t!==null&&"then"in t}function N(t,e){const r=t["~standard"].validate(e);if(Mt(r))throw new Error("Promise schemas are not supported");if(r.issues)throw new Error("Validation failed");return r.value}function Hr(t){return ut(t)&&"type"in t&&typeof t.type=="string"&&"~standard"in t&&ut(t["~standard"])&&"vendor"in t["~standard"]&&t["~standard"].vendor==="valibot"}function Ve(t){return Hr(t)}function Be(t){return{get:(e,{invalid:r})=>{try{return _t(e,t)}catch{throw r()}},set:(e,{invalid:r})=>{try{return Ft(e,t)}catch{throw r()}}}}const $r=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;function pt(t,e){if(typeof e=="string"&&$r.test(e)){const r=new Date(e);return isNaN(r.getTime())?e:r}return e}function dt(t){for(const e of t)try{return e()}catch{continue}throw new Error("All functions failed")}function Vt(t,e){return t.type==="string"?1:e.type==="string"?-1:0}function _t(t,e){if(e.type==="boolean")return N(e,!!t);if(e.type==="date")return N(e,new Date(t));if(e.type==="number")return N(e,Number(t));if(e.type==="literal")return dt([()=>N(e,Number(t)),()=>N(e,!!t),()=>N(e,t)]);if(e.type==="object")return N(e,JSON.parse(t,pt));if(e.type==="enum")return dt([()=>N(e,Number(t)),()=>N(e,!!t),()=>N(e,t)]);if(e.type==="array"||e.type==="tuple")return N(e,JSON.parse(t,pt));if(e.type==="union"&&"options"in e){const r=e.options.sort(Vt).map(n=>()=>_t(t,n));return dt(r)}if(e.type==="variant"&&"options"in e){const r=e.options.sort(Vt).map(n=>()=>_t(t,n));return dt(r)}if(e.type==="record")return N(e,JSON.parse(t,pt));if(e.type==="map")return N(e,new Map(JSON.parse(t,pt)));if(e.type==="set")return N(e,new Set(JSON.parse(t,pt)));if(e.type==="intersection")throw new Error("Intersection schemas are not supported");if(e.type==="promise")throw new Error("Promise schemas are not supported");if(e.type==="function")throw new Error("Function schemas are not supported");return N(e,t)}function Ft(t,e){if(e.type==="string"||e.type==="boolean")return N(e,t).toString();if(e.type==="date")return N(e,t).toISOString();if(e.type==="number")return N(e,Number(t)).toString();if(e.type==="literal")return N(e,t).toString();if(e.type==="object")return JSON.stringify(N(e,t));if(e.type==="enum"||e.type==="nativeEnum")return N(e,t).toString();if(e.type==="array"||e.type==="tuple")return JSON.stringify(N(e,t));if(e.type==="union"&&"options"in e){const r=e.options.sort(Vt).map(n=>()=>Ft(t,n));return dt(r)}if(e.type==="variant"&&"options"in e){const r=e.options.sort(Vt).map(n=>()=>Ft(t,n));return dt(r)}if(e.type==="record")return JSON.stringify(N(e,t));if(e.type==="map"){const r=N(e,t);return JSON.stringify(Array.from(r.entries()))}if(e.type==="set"){const r=N(e,t);return JSON.stringify(Array.from(r.values()))}if(e.type==="intersection")throw new Error("Intersection schemas are not supported");if(e.type==="promise")throw new Error("Promise schemas are not supported");if(e.type==="function")throw new Error("Function schemas are not supported");return JSON.stringify(N(e,t))}function Dr(t,e){return t[e]??String}const j={invalid:t=>{throw new G(t)}},Ce={get:t=>t,set:(t,{invalid:e})=>{if(typeof t!="string")throw e();return t}},Wt={get:(t,{invalid:e})=>{if(t==="true")return!0;if(t==="false")return!1;throw e()},set:(t,{invalid:e})=>{if(typeof t!="boolean")throw e();return t.toString()}},Gt={get:(t,{invalid:e})=>{const r=Number(t);if(isNaN(r))throw e();return r},set:(t,{invalid:e})=>{if(typeof t!="number")throw e();return t.toString()}},Ne={get:(t,{invalid:e})=>{const r=new Date(t);if(isNaN(r.getTime()))throw e();return r},set:(t,{invalid:e})=>{if(typeof t!="object"||!(t instanceof Date))throw e();return t.toISOString()}},xe={get:(t,{invalid:e})=>{try{return JSON.parse(t)}catch{throw e()}},set:(t,{invalid:e})=>{try{return JSON.stringify(t)}catch{throw e()}}};function qr(t,e){switch(typeof e){case"string":return Ce.get(t,j)===e;case"number":return Gt.get(t,j)===e;case"boolean":return Wt.get(t,j)===e;default:return!1}}function X(t,e,r=!1){if(t===void 0||!_(t)){if(Cr(e))return e.defaultValue;if(r)return;throw new G}if(e===String)return Ce.get(t,j);if(e===Boolean)return Wt.get(t,j);if(e===Number)return Gt.get(t,j);if(e===Date)return Ne.get(t,j);if(e===JSON)return xe.get(t,j);if(Br(e))return e(t,j);if(Ut(e))return e.get(t,j);if(e instanceof RegExp){if(e.test(t))return t;throw new G}if(Ae(e)){if(qr(t,e))return e;throw new G}return Ue(e)?Le(e).get(t,j):Ve(e)?Be(e).get(t,j):t}function Qt(t,e,r=!1){try{return X(t,e,r)}catch(n){if(n instanceof G)return;throw n}}function Tr(t,e,r=!1){try{return Q(t,e,r)}catch(n){if(n instanceof G)return;throw n}}function Q(t,e,r=!1){if(t===void 0){if(r)return"";throw new G}if(e===Boolean)return Wt.set(t,j);if(e===Number)return Gt.set(t,j);if(e===Date)return Ne.set(t,j);if(e===JSON)return xe.set(t,j);if(Ut(e))return e.set(t,j);if(Ae(e)){if(e!==t)throw new G;return t.toString()}if(Ue(e))return Le(e).set(t,j);if(Ve(e))return Be(e).set(t,j);try{return t.toString()}catch{throw new G}}function zt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Jr(t,e){const r=Array.from(t.matchAll(e));if(r.length===0)return[t];let n=0;const o=r.reduce((a,i)=>{const u=zt(t.slice(n,i.index));u.length&&a.push(u);const[y]=i;return a.push(y),n=i.index+y.length,a},[]),s=t.slice(n);return s&&o.push(s),o}function Mr(t){const e=Yt(t.host.value);return new RegExp(`^${e}$`,"i")}function _r(t){const e=Yt(t.path.value);return new RegExp(`^${e}$`,"i")}function Fr(t){const e=new URLSearchParams(t.query.value);return Array.from(e.entries()).filter(([,r])=>!Kt(r)).map(([r,n])=>{const o=Yt(n);return new RegExp(`${zt(r)}=${o}(&|$)`,"i")})}function Yt(t){return Jr(t,new RegExp(Bt,"g")).map(e=>e.startsWith(yt)?Ze(e):zt(e)).join("")}function Ze(t){return t.replace(new RegExp(Bt,"g"),Qr)}function Wr(t,e){const r=Oe(e);return t.replace(r,zr)}function Xt(t,e){return Yr(e).test(t.value)}function Kt(t){return new RegExp(Gr,"g").test(t)}const Bt=`\\${yt}\\??([\\w-_]+)\\${kt}`,Gr=`\\${yt}\\?([\\w-_]+)\\${kt}`,Qr=".*",zr="(.*)";function te(t){const[e]=je(t,new RegExp(Bt,"g"));return e}function Oe(t){return new RegExp(`\\${yt}\\??${t}\\${kt}`,"g")}function Yr(t){return new RegExp(`\\${yt}\\?${t}\\${kt}`,"g")}function je(t,e){return Array.from(t.matchAll(e)).flatMap(([,...n])=>n.map(o=>_(o)?o:""))}function Xr(t="",e={}){return _(t)?Array.from(t.matchAll(new RegExp(Bt,"g"))).reduce((n,[o,s])=>{const a=te(o);if(!a)return n;const i=Dr(e,a);return ct([a],n),n[s]=i,n},{}):{}}function Kr(t){return ut(t)&&typeof t.value=="string"}function K(t){return t===void 0?tt():Kr(t)?t:tt(t,{})}function tt(t,e){return{value:t??"",params:Xr(t,e)}}function Ie(t,e){ct(t.params,e.params);const r=`${t.value}${e.value}`;return tt(r,{...t.params,...e.params})}function tn(t,e){return Ie(t,e)}class He extends Error{constructor(e){super(`Child property on meta for ${e} conflicts with the parent meta.`)}}function en(t,e){return rn(t,e),{...t,...e}}function rn(t,e){const r=Object.keys(t).find(n=>n in e&&typeof e[n]!=typeof t[n]);if(r)throw new He(r)}function nn(t,e){ct(t.params,e.params);const r=[t.value,e.value].filter(_).join("&");return tt(r,{...t.params,...e.params})}function on(t,e){return ct(t,e),{...t,...e}}function ee(t){return"parent"in t&&!!t.parent}function re(t){return"component"in t&&!!t.component}function ne(t){return"props"in t&&typeof t.props=="function"}function oe(t){return"components"in t&&!!t.components}function se(t){return"props"in t&&typeof t.props=="object"}function ae(t,e){return{...e,path:Ie(t.path,e.path),query:nn(t.query,e.query),meta:en(t.meta,e.meta),state:on(t.state,e.state),hash:tn(t.hash,e.hash),hooks:[...t.hooks,...e.hooks],matches:[...t.matches,e.matched],context:[...t.context,...e.context],host:t.host,depth:t.depth+1}}function F(t){return typeof t!="string"?!1:/^(https?:\/\/|\/).*/g.test(t)}function ie(t){return F(t)?t:`/${t}`}class et extends Error{constructor(){super("Router not installed")}}class $e extends Error{constructor(e,r){super(`useRoute called with incorrect route. Given ${e}, expected ${r}`)}}function ce(){let t=0;return()=>(++t).toString()}const sn=ce()();function an(t){return t===sn}const ue=ce();function De(t){return t===void 0?"":t}class rt{onBeforeRouteEnter=new Set;onBeforeRouteUpdate=new Set;onBeforeRouteLeave=new Set;onAfterRouteEnter=new Set;onAfterRouteUpdate=new Set;onAfterRouteLeave=new Set;onError=new Set}function Ct(){const t=new rt;return{onBeforeRouteEnter:u=>(t.onBeforeRouteEnter.add(u),()=>t.onBeforeRouteEnter.delete(u)),onBeforeRouteUpdate:u=>(t.onBeforeRouteUpdate.add(u),()=>t.onBeforeRouteUpdate.delete(u)),onBeforeRouteLeave:u=>(t.onBeforeRouteLeave.add(u),()=>t.onBeforeRouteLeave.delete(u)),onAfterRouteEnter:u=>(t.onAfterRouteEnter.add(u),()=>t.onAfterRouteEnter.delete(u)),onAfterRouteUpdate:u=>(t.onAfterRouteUpdate.add(u),()=>t.onAfterRouteUpdate.delete(u)),onAfterRouteLeave:u=>(t.onAfterRouteLeave.add(u),()=>t.onAfterRouteLeave.delete(u)),onError:u=>(t.onError.add(u),()=>t.onError.delete(u)),store:t}}function nt(t,e){const r=ue(),n=De(t.name),o=K(t.path),s=K(t.query),a=K(t.hash),i=t.meta??{},u=t.state??{},y=t.context??[],{store:E,...h}=Ct(),c=p.markRaw({id:r,meta:i,state:u,...t,props:e}),d={id:r,matched:c,matches:[c],hooks:[E],name:n,path:o,query:s,hash:a,meta:i,state:u,context:y,depth:1,host:tt(),prefetch:t.prefetch,...h},m=ee(t)?ae(t.parent,d):d;return ct(m.path.params,m.query.params,m.hash.params),m}function qe(t){return p.defineComponent(()=>()=>p.h("h1",t),{name:t,props:[]})}function cn(t){const e=t.component??qe(t.type);return{type:t.type,component:e}}function un(t){const e=ue(),r=De(t.name),n=K(t.path),o=K(t.query),s=K(t.hash),a=t.meta??{},i=K(t.host),u=t.context??[],{store:y,onBeforeRouteEnter:E}=Ct(),h=p.markRaw({id:e,meta:{},state:{},...t}),c={id:e,matched:h,matches:[h],hooks:[y],name:r,host:i,path:n,query:o,hash:s,meta:a,depth:1,state:{},context:u,onBeforeRouteEnter:E},d=ee(t)?ae(t.parent,c):c;return ct(d.path.params,d.query.params,d.host.params,d.hash.params),d}function gt(){const t=new Map;return e=>{const r=t.get(e);if(!r){const n=Symbol();return t.set(e,n),n}return r}}const fn=gt();function fe(t){const e=fn(t);return({increment:r=!1}={})=>{const n=p.inject(e,0);return r&&p.provide(e,n+1),n}}const wt=(t,e,r)=>{const n=t.matches,o=e?.matches??[];return n.at(r)?.id!==o.at(r)?.id},Et=(t,e,r)=>{const n=t.matches,o=e?.matches??[];return n.at(r)?.id!==o.at(r)?.id},St=(t,e,r)=>t.matches.at(r)?.id===e?.matches.at(r)?.id;function Te(t){switch(t){case"onBeforeRouteEnter":case"onAfterRouteEnter":return wt;case"onBeforeRouteUpdate":case"onAfterRouteUpdate":return St;case"onBeforeRouteLeave":case"onAfterRouteLeave":return Et;default:throw new Error(`Switch is not exhaustive for lifecycle: ${t}`)}}function pn(t,e){const r=new rt;return t.hooks.forEach((n,o)=>{if(wt(t,e,o))return n.onBeforeRouteEnter.forEach(s=>r.onBeforeRouteEnter.add(s));if(St(t,e,o))return n.onBeforeRouteUpdate.forEach(s=>r.onBeforeRouteUpdate.add(s))}),e?.hooks.forEach((n,o)=>{if(Et(t,e,o))return n.onBeforeRouteLeave.forEach(s=>r.onBeforeRouteLeave.add(s))}),r}function dn(t,e){const r=new rt;return t.hooks.forEach((n,o)=>{if(wt(t,e,o))return n.onAfterRouteEnter.forEach(s=>r.onAfterRouteEnter.add(s));if(St(t,e,o))return n.onAfterRouteUpdate.forEach(s=>r.onAfterRouteUpdate.add(s))}),e?.hooks.forEach((n,o)=>{if(Et(t,e,o))return n.onAfterRouteLeave.forEach(s=>r.onAfterRouteLeave.add(s))}),r}class Nt extends Error{}class z extends Nt{response;constructor(e){super("Uncaught ContextPushError"),this.response={status:"PUSH",to:e}}}class ot extends Nt{response;constructor(e){super("Uncaught ContextRejectionError"),this.response={status:"REJECT",type:e}}}class Je extends Nt{response;constructor(){super("Uncaught ContextAbortError"),this.response={status:"ABORT"}}}function ln(t,e,r){const n=new rt;return t.matches.forEach((o,s)=>{wt(t,e,s)&&r.onBeforeRouteEnter.forEach(a=>n.onBeforeRouteEnter.add(a)),St(t,e,s)&&r.onBeforeRouteUpdate.forEach(a=>n.onBeforeRouteUpdate.add(a))}),e?.matches.forEach((o,s)=>{Et(t,e,s)&&r.onBeforeRouteLeave.forEach(a=>n.onBeforeRouteLeave.add(a))}),n}function hn(t,e,r){const n=new rt;return t.matches.forEach((o,s)=>{wt(t,e,s)&&r.onAfterRouteEnter.forEach(a=>n.onAfterRouteEnter.add(a)),St(t,e,s)&&r.onAfterRouteUpdate.forEach(a=>n.onAfterRouteUpdate.add(a))}),e?.matches.forEach((o,s)=>{Et(t,e,s)&&r.onAfterRouteLeave.forEach(a=>n.onAfterRouteLeave.add(a))}),n}function Me(){let t=null;function e(n){t=n}function r(n){return t?t.runWithContext(n):n()}return{setVueApp:e,runWithContext:r}}function Pt({to:t}){const e=a=>{throw new ot(a)},r=(...a)=>{throw new z(a)};return{reject:e,push:r,replace:(a,i,u)=>{if(F(a)){const h=i??{};throw new z([a,{...h,replace:!0}])}const y=i,E=u??{};throw new z([a,y,{...E,replace:!0}])},update:(a,i,u)=>{if(typeof a=="object"){const E={...t.params,...a};return r(t.name,E,i)}const y={...t.params,[a]:i};return r(t.name,y,u)},abort:()=>{throw new Je}}}const _e=gt();function Rn(){const{setVueApp:t,runWithContext:e}=Me(),{store:r,...n}=Ct(),o=new rt,s=async({to:h,from:c})=>{const{reject:d,push:m,replace:k,update:U,abort:v}=Pt({to:h}),g=pn(h,c),l=ln(h,c,r),f=[...l.onBeforeRouteEnter,...g.onBeforeRouteEnter,...l.onBeforeRouteUpdate,...g.onBeforeRouteUpdate,...o.onBeforeRouteUpdate,...l.onBeforeRouteLeave,...g.onBeforeRouteLeave,...o.onBeforeRouteLeave];try{const S=f.map(L=>e(()=>L(h,{from:c,reject:d,push:m,replace:k,update:U,abort:v})));await Promise.all(S)}catch(S){if(S instanceof z||S instanceof ot||S instanceof Je)return S.response;try{i(S,{to:h,from:c,source:"hook"})}catch(L){if(L instanceof z||L instanceof ot)return L.response;throw L}}return{status:"SUCCESS"}},a=async({to:h,from:c})=>{const{reject:d,push:m,replace:k,update:U}=Pt({to:h}),v=dn(h,c),g=hn(h,c,r),l=[...o.onAfterRouteLeave,...v.onAfterRouteLeave,...g.onAfterRouteLeave,...o.onAfterRouteUpdate,...v.onAfterRouteUpdate,...g.onAfterRouteUpdate,...o.onAfterRouteEnter,...v.onAfterRouteEnter,...g.onAfterRouteEnter];try{const f=l.map(S=>e(()=>S(h,{from:c,reject:d,push:m,replace:k,update:U})));await Promise.all(f)}catch(f){if(f instanceof z||f instanceof ot)return f.response;try{i(f,{to:h,from:c,source:"hook"})}catch(S){if(S instanceof z||S instanceof ot)return S.response;throw S}}return{status:"SUCCESS"}},i=(h,{to:c,from:d,source:m})=>{const{reject:k,push:U,replace:v,update:g}=Pt({to:c});for(const l of r.onError)try{l(h,{to:c,from:d,source:m,reject:k,push:U,replace:v,update:g});return}catch(f){if(f instanceof Nt)throw f;if(f===h)continue;throw f}};return{runBeforeRouteHooks:s,runAfterRouteHooks:a,runErrorHooks:i,addComponentBeforeRouteHook:({lifecycle:h,depth:c,hook:d})=>{const m=Te(h),k=o[h],U=(v,g)=>{if(m(v,g.from,c))return d(v,g)};return k.add(U),()=>k.delete(U)},addComponentAfterRouteHook:({lifecycle:h,depth:c,hook:d})=>{const m=Te(h),k=o[h],U=(v,g)=>{if(m(v,g.from,c))return d(v,g)};return k.add(U),()=>k.delete(U)},addGlobalRouteHooks:h=>{h.onBeforeRouteEnter.forEach(c=>n.onBeforeRouteEnter(c)),h.onBeforeRouteUpdate.forEach(c=>n.onBeforeRouteUpdate(c)),h.onBeforeRouteLeave.forEach(c=>n.onBeforeRouteLeave(c)),h.onAfterRouteEnter.forEach(c=>n.onAfterRouteEnter(c)),h.onAfterRouteUpdate.forEach(c=>n.onAfterRouteUpdate(c)),h.onAfterRouteLeave.forEach(c=>n.onAfterRouteLeave(c)),h.onError.forEach(c=>n.onError(c))},setVueApp:t,...n}}function Fe(t){const e=_e(t);return()=>{const r=p.inject(e);if(!r)throw new et;return r}}function We(t,e){const r=fe(t),n=Fe(t);return o=>{const s=r(),i=n().addComponentBeforeRouteHook({lifecycle:e,hook:o,depth:s-1});return p.onUnmounted(i),i}}function Ge(t,e){const r=fe(t),n=Fe(t);return o=>{const s=r(),i=n().addComponentAfterRouteHook({lifecycle:e,hook:o,depth:s-1});return p.onUnmounted(i),i}}function yn(t){const e=We(t,"onBeforeRouteLeave"),r=We(t,"onBeforeRouteUpdate"),n=Ge(t,"onAfterRouteLeave"),o=Ge(t,"onAfterRouteUpdate");return{onBeforeRouteLeave:e,onBeforeRouteUpdate:r,onAfterRouteLeave:n,onAfterRouteUpdate:o}}const Qe=gt();function mn(t){const e=Qe(t);return()=>{const r=p.inject(e);if(!r)throw new et;return r}}const ze=gt();function gn(t){const e=ze(t);return()=>{const r=p.inject(e);if(!r)throw new et;return r}}function bt(t){return()=>{const e=p.inject(t);if(!e)throw new et;return e}}const Ye=Symbol("isRouterRouteSymbol");function wn(t,e){return typeof e=="object"&&e!==null&&Ye in e&&t in e}function En(t,e,r){function n(g,l,f){if(typeof g=="object"){const L={...e.params,...g};return r(e.name,L,l)}const S={...e.params,[g]:l};return r(e.name,S,f)}const o=(...g)=>{const l=new URLSearchParams(e.query);l.set(...g),n({},{query:l})},s=(...g)=>{const l=new URLSearchParams(e.query);l.append(...g),n({},{query:l})},a=(...g)=>{const l=new URLSearchParams(e.query);l.delete(...g),n({},{query:l})},{id:i,matched:u,matches:y,hooks:E,name:h,hash:c,href:d}=p.toRefs(e),m=p.computed({get(){return new Proxy(e.params,{set(g,l,f){return n(l,f),!0}})},set(g){n(g)}}),k=p.computed({get(){return new Proxy(e.query,{get(g,l,f){switch(l){case"append":return s;case"set":return o;case"delete":return a;default:return Reflect.get(g,l,f)}}})},set(g){n({},{query:g})}}),U=p.computed({get(){return new Proxy(e.state,{set(g,l,f){return n({},{state:{...e.state,[l]:f}}),!0}})},set(g){n({},{state:g})}});return p.reactive({id:i,matched:u,matches:y,hooks:E,state:U,query:k,hash:c,params:m,name:h,href:d,update:n,[Ye]:!0,[t]:!0})}function pe(t){return(e,r,{exact:n}={})=>wn(t,e)?r===void 0?!0:n?e.matched.name===r:e.matches.map(o=>o.name).includes(r):!1}function xt(t){const e=bt(t),r=pe(t);return(n,o)=>{const s=e();function a(){if(!n)return;if(!r(s.route,n,o))throw new $e(n,s.route.name)}return p.watch(s.route,a,{immediate:!0,deep:!0}),s.route}}function de(t){const e=xt(t),r=bt(t),n=gn(t),o=fe(t),s=mn(t);return p.defineComponent((a,i)=>{const u=e(),y=r(),E=n(),h=o({increment:!0});p.onServerPrefetch(async()=>{await y.start()});const{getRouteComponents:c}=s(),d=p.computed(()=>{if(!y.started.value)return null;if(E.value)return E.value.component;const m=u.matches.at(h);if(!m)return null;const k=c(m),U=a.name??"default";return k[U]});return()=>i.slots.default?i.slots.default({route:u,component:d,rejection:E.value}):d.value?p.h(d.value):null},{name:"RouterView",props:["name"]})}const Xe=gt();function Ke(t){const e=Xe(t);return()=>{const r=p.inject(e);if(!r)throw new et;return r}}const Sn="lazy",Pn={components:!0,props:!1};function Zt(t){return["eager","lazy","intent"].includes(t)}function tr({routerPrefetch:t,routePrefetch:e,linkPrefetch:r},n){const o=le(r,n),s=le(e,n),a=le(t,n),i=[o,s,a,Pn[n],Sn].reduce((u,y)=>Zt(u)?u:u===!0&&Zt(y)?y:u===!0&&!Zt(y)?u:u===void 0?y:u,void 0);return Zt(i)?i:!1}function le(t,e){return ut(t)?t[e]:t}const bn=p.defineAsyncComponent(()=>new Promise(t=>{t({default:{template:"foo"}})}));function er(t){return t.name===bn.name&&"__asyncLoader"in t}const rr=Symbol("visibilityObserver");function vn(t){const e=p.inject(rr);if(!e)throw new et;return p.watch(t,(n,o)=>{n&&e.observe(n),o&&e.unobserve(o)},{immediate:!0}),p.onUnmounted(()=>{t.value&&e.unobserve(t.value)}),{isElementVisible:p.computed(()=>t.value?e.isElementVisible(t.value):!1)}}function nr(t,e,r){p.watch(t,(n,o)=>{n&&n.addEventListener(e,r),o&&o.removeEventListener(e,r)},{immediate:!0}),p.onUnmounted(()=>{t.value&&t.value.removeEventListener(e,r)})}function An(t){const e=Ke(t);return r=>{const n=new Map,o=p.ref(),{getPrefetchProps:s,setPrefetchProps:a}=e(),{isElementVisible:i}=vn(o),u=()=>{const h=Array.from(n.values()).reduce((c,d)=>(Object.assign(c,d),c),{});a(h)};p.watch(()=>p.toValue(r),({route:h,...c})=>{n.clear(),h&&E("eager",h,c)},{immediate:!0}),p.watch(i,h=>{const{route:c,...d}=p.toValue(r);!c||!h||E("lazy",c,d)},{immediate:!0}),nr(o,"focusin",y),nr(o,"mouseover",y);function y(){const{route:h,...c}=p.toValue(r);h&&E("intent",h,c)}function E(h,c,d){kn(h,c,d),n.has(h)||n.set(h,s(h,c,d))}return{element:o,commit:u}}}function kn(t,e,r){e.matches.forEach(n=>{tr({...r,routePrefetch:n.prefetch},"components")===t&&(re(n)&&er(n.component)&&n.component.__asyncLoader(),oe(n)&&Object.values(n.components).forEach(s=>{er(s)&&s.__asyncLoader()}))})}function he(...t){const e=new URLSearchParams;for(const r of t){const n=new URLSearchParams(r);for(const[o,s]of n.entries())e.append(o,s)}return e}function or(t){const e=bt(t),r=An(t),n=pe(t);return(o,s={},a={})=>{const i=e(),u=p.computed(()=>{const f=p.toValue(o);return typeof f!="string"?f:F(f)?i.find(f,p.toValue(a)):i.resolve(f,p.toValue(s),p.toValue(a))}),y=p.computed(()=>{if(u.value)return u.value.href;const f=p.toValue(o);if(F(f))return f;console.error(new Error("Failed to resolve route in RouterLink."))}),E=p.computed(()=>n(i.route)&&i.route.matches.some(f=>f.id===u.value?.id)),h=p.computed(()=>i.route.id===u.value?.id),c=p.computed(()=>n(i.route)&&xr(u.value)&&i.route.href.startsWith(u.value.href)),d=p.computed(()=>i.route.href===u.value?.href),m=p.computed(()=>!!y.value&&i.isExternal(y.value)),k=p.computed(()=>{const f=p.toValue(o);return typeof f!="string"||F(f)?p.toValue(s):p.toValue(a)}),{element:U,commit:v}=r(()=>({route:u.value,routerPrefetch:i.prefetch,linkPrefetch:k.value.prefetch})),g=f=>{v();const S={replace:f?.replace??k.value.replace,query:he(k.value.query,f?.query),hash:f?.hash??k.value.hash,state:{...k.value.state,...f?.state}},L=p.toValue(o);return F(L)||typeof L=="object"?i.push(L,S):i.push(L,p.toValue(s),S)};return{element:U,route:u,href:y,isMatch:E,isExactMatch:h,isActive:c,isExactActive:d,isExternal:m,push:g,replace:f=>g({...f,replace:!0})}}}function sr(t){const e=bt(t),r=or(t);return p.defineComponent((n,o)=>{const s=e(),a=p.computed(()=>v(n.to)),i=p.computed(()=>g(n.to)),u=p.computed(()=>{const{to:f,...S}=n;return S}),{element:y,isMatch:E,isExactMatch:h,isActive:c,isExactActive:d,isExternal:m,push:k}=r(()=>typeof n.to=="function"?n.to(s.resolve):n.to,u),U=p.computed(()=>({"router-link--match":E.value,"router-link--exact-match":h.value,"router-link--active":c.value,"router-link--exact-active":d.value}));function v(f){if(typeof f=="function"){const S=f(s.resolve);return v(S)}return F(f)?s.find(f):f}function g(f){if(typeof f=="function"){const S=f(s.resolve);return g(S)}return F(f)?f:f?.href}function l(f){f.preventDefault(),k()}return()=>p.h("a",{href:i.value,class:["router-link",U.value],ref:y,onClick:l},o.slots.default?.({route:a.value,isMatch:E.value,isExactMatch:h.value,isActive:c.value,isExactActive:d.value,isExternal:m.value}))},{name:"RouterLink",props:["to","prefetch","query","hash","replace","state"]})}function Un(t){const e=xt(t);return(r,n=String)=>{const o=e(),s=p.computed({get(){const i=o.query.get(p.toValue(r));return i===null?null:Qt(i,n)},set(i){o.query.set(p.toValue(r),Q(i,n))}}),a=p.computed({get(){return o.query.getAll(p.toValue(r)).map(u=>Qt(u,n)).filter(u=>u!==null)},set(i){const u=new URLSearchParams(o.query);u.delete(p.toValue(r)),i.forEach(y=>{u.append(p.toValue(r),Q(y,n))}),o.query=u}});return{value:s,values:a,remove:()=>{o.query.delete(p.toValue(r))}}}}function ar(t){const e=typeof t=="object"?t.key:t,{onBeforeRouteLeave:r,onBeforeRouteUpdate:n,onAfterRouteLeave:o,onAfterRouteUpdate:s}=yn(e),a=pe(e),i=de(e),u=sr(e),y=xt(e),E=bt(e),h=Un(e),c=or(e);return{onBeforeRouteLeave:r,onBeforeRouteUpdate:n,onAfterRouteLeave:o,onAfterRouteUpdate:s,isRoute:a,RouterView:i,RouterLink:u,useRoute:y,useRouter:E,useQueryValue:h,useLink:c}}function Ln(t){const{store:e,...r}=Ct();return{routes:t.routes??[],rejections:t.rejections??[],hooks:e,...r}}function ir(t){return{get:(e,{invalid:r})=>{for(const n of t){const o=Qt(e,n);if(o!==void 0)return o}throw r(`Value ${e} does not satisfy any of the possible values`)},set:(e,{invalid:r})=>{for(const n of t){const o=Tr(e,n);if(o!==void 0)return o}throw r(`Value ${e} does not satisfy any of the possible values`)}}}const Vn={separator:","};function Bn(t,e={}){const{separator:r}={...Vn,...e},n=ir(t);return{get:(o,s)=>o.split(r).map(a=>n.get(a,s)),set:(o,s)=>{if(!Array.isArray(o))throw s.invalid("Expected an array");return o.map(a=>n.set(a,s)).join(r)}}}const Cn={separator:","};function Nn(t,e={}){const{separator:r}={...Cn,...e};return{get:n=>{const o=n.split(r);return t.map((s,a)=>X(o.at(a),s))},set:(n,{invalid:o})=>{if(!Array.isArray(n))throw o("Expected a tuple");if(n.length!==t.length)throw o(`Expected tuple with ${t.length} values but received ${n.length} values`);return t.map((s,a)=>Q(n.at(a),s)).join(r)}}}function Y(){return Y=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Y.apply(null,arguments)}var D;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(D||(D={}));var lt=process.env.NODE_ENV!=="production"?function(t){return Object.freeze(t)}:function(t){return t};function st(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}var Ot="beforeunload",xn="hashchange",cr="popstate";function ur(t){t===void 0&&(t={});var e=t,r=e.window,n=r===void 0?document.defaultView:r,o=n.history;function s(){var P=n.location,R=P.pathname,b=P.search,B=P.hash,C=o.state||{};return[C.idx,lt({pathname:R,search:b,hash:B,state:C.usr||null,key:C.key||"default"})]}var a=null;function i(){if(a)d.call(a),a=null;else{var P=D.Pop,R=s(),b=R[0],B=R[1];if(d.length)if(b!=null){var C=E-b;C&&(a={action:P,location:B,retry:function(){S(C*-1)}},S(C))}else process.env.NODE_ENV!=="production"&&st(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.");else g(P)}}n.addEventListener(cr,i);var u=D.Pop,y=s(),E=y[0],h=y[1],c=ht(),d=ht();E==null&&(E=0,o.replaceState(Y({},o.state,{idx:E}),""));function m(P){return typeof P=="string"?P:at(P)}function k(P,R){return R===void 0&&(R=null),lt(Y({pathname:h.pathname,hash:"",search:""},typeof P=="string"?vt(P):P,{state:R,key:It()}))}function U(P,R){return[{usr:P.state,key:P.key,idx:R},m(P)]}function v(P,R,b){return!d.length||(d.call({action:P,location:R,retry:b}),!1)}function g(P){u=P;var R=s();E=R[0],h=R[1],c.call({action:u,location:h})}function l(P,R){var b=D.Push,B=k(P,R);function C(){l(P,R)}if(v(b,B,C)){var Z=U(B,E+1),I=Z[0],$=Z[1];try{o.pushState(I,"",$)}catch{n.location.assign($)}g(b)}}function f(P,R){var b=D.Replace,B=k(P,R);function C(){f(P,R)}if(v(b,B,C)){var Z=U(B,E),I=Z[0],$=Z[1];o.replaceState(I,"",$),g(b)}}function S(P){o.go(P)}var L={get action(){return u},get location(){return h},createHref:m,push:l,replace:f,go:S,back:function(){S(-1)},forward:function(){S(1)},listen:function(R){return c.push(R)},block:function(R){var b=d.push(R);return d.length===1&&n.addEventListener(Ot,jt),function(){b(),d.length||n.removeEventListener(Ot,jt)}}};return L}function Zn(t){t===void 0&&(t={});var e=t,r=e.window,n=r===void 0?document.defaultView:r,o=n.history;function s(){var R=vt(n.location.hash.substr(1)),b=R.pathname,B=b===void 0?"/":b,C=R.search,Z=C===void 0?"":C,I=R.hash,$=I===void 0?"":I,q=o.state||{};return[q.idx,lt({pathname:B,search:Z,hash:$,state:q.usr||null,key:q.key||"default"})]}var a=null;function i(){if(a)d.call(a),a=null;else{var R=D.Pop,b=s(),B=b[0],C=b[1];if(d.length)if(B!=null){var Z=E-B;Z&&(a={action:R,location:C,retry:function(){L(Z*-1)}},L(Z))}else process.env.NODE_ENV!=="production"&&st(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.");else l(R)}}n.addEventListener(cr,i),n.addEventListener(xn,function(){var R=s(),b=R[1];at(b)!==at(h)&&i()});var u=D.Pop,y=s(),E=y[0],h=y[1],c=ht(),d=ht();E==null&&(E=0,o.replaceState(Y({},o.state,{idx:E}),""));function m(){var R=document.querySelector("base"),b="";if(R&&R.getAttribute("href")){var B=n.location.href,C=B.indexOf("#");b=C===-1?B:B.slice(0,C)}return b}function k(R){return m()+"#"+(typeof R=="string"?R:at(R))}function U(R,b){return b===void 0&&(b=null),lt(Y({pathname:h.pathname,hash:"",search:""},typeof R=="string"?vt(R):R,{state:b,key:It()}))}function v(R,b){return[{usr:R.state,key:R.key,idx:b},k(R)]}function g(R,b,B){return!d.length||(d.call({action:R,location:b,retry:B}),!1)}function l(R){u=R;var b=s();E=b[0],h=b[1],c.call({action:u,location:h})}function f(R,b){var B=D.Push,C=U(R,b);function Z(){f(R,b)}if(process.env.NODE_ENV!=="production"&&st(C.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.push("+JSON.stringify(R)+")"),g(B,C,Z)){var I=v(C,E+1),$=I[0],q=I[1];try{o.pushState($,"",q)}catch{n.location.assign(q)}l(B)}}function S(R,b){var B=D.Replace,C=U(R,b);function Z(){S(R,b)}if(process.env.NODE_ENV!=="production"&&st(C.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.replace("+JSON.stringify(R)+")"),g(B,C,Z)){var I=v(C,E),$=I[0],q=I[1];o.replaceState($,"",q),l(B)}}function L(R){o.go(R)}var P={get action(){return u},get location(){return h},createHref:k,push:f,replace:S,go:L,back:function(){L(-1)},forward:function(){L(1)},listen:function(b){return c.push(b)},block:function(b){var B=d.push(b);return d.length===1&&n.addEventListener(Ot,jt),function(){B(),d.length||n.removeEventListener(Ot,jt)}}};return P}function fr(t){t===void 0&&(t={});var e=t,r=e.initialEntries,n=r===void 0?["/"]:r,o=e.initialIndex,s=n.map(function(l){var f=lt(Y({pathname:"/",search:"",hash:"",state:null,key:It()},typeof l=="string"?vt(l):l));return process.env.NODE_ENV!=="production"&&st(f.pathname.charAt(0)==="/","Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(l)+")"),f}),a=pr(o??s.length-1,0,s.length-1),i=D.Pop,u=s[a],y=ht(),E=ht();function h(l){return typeof l=="string"?l:at(l)}function c(l,f){return f===void 0&&(f=null),lt(Y({pathname:u.pathname,search:"",hash:""},typeof l=="string"?vt(l):l,{state:f,key:It()}))}function d(l,f,S){return!E.length||(E.call({action:l,location:f,retry:S}),!1)}function m(l,f){i=l,u=f,y.call({action:i,location:u})}function k(l,f){var S=D.Push,L=c(l,f);function P(){k(l,f)}process.env.NODE_ENV!=="production"&&st(u.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.push("+JSON.stringify(l)+")"),d(S,L,P)&&(a+=1,s.splice(a,s.length,L),m(S,L))}function U(l,f){var S=D.Replace,L=c(l,f);function P(){U(l,f)}process.env.NODE_ENV!=="production"&&st(u.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.replace("+JSON.stringify(l)+")"),d(S,L,P)&&(s[a]=L,m(S,L))}function v(l){var f=pr(a+l,0,s.length-1),S=D.Pop,L=s[f];function P(){v(l)}d(S,L,P)&&(a=f,m(S,L))}var g={get index(){return a},get action(){return i},get location(){return u},createHref:h,push:k,replace:U,go:v,back:function(){v(-1)},forward:function(){v(1)},listen:function(f){return y.push(f)},block:function(f){return E.push(f)}};return g}function pr(t,e,r){return Math.min(Math.max(t,e),r)}function jt(t){t.preventDefault(),t.returnValue=""}function ht(){var t=[];return{get length(){return t.length},push:function(r){return t.push(r),function(){t=t.filter(function(n){return n!==r})}},call:function(r){t.forEach(function(n){return n&&n(r)})}}}function It(){return Math.random().toString(36).substr(2,8)}function at(t){var e=t.pathname,r=e===void 0?"/":e,n=t.search,o=n===void 0?"":n,s=t.hash,a=s===void 0?"":s;return o&&o!=="?"&&(r+=o.charAt(0)==="?"?o:"?"+o),a&&a!=="#"&&(r+=a.charAt(0)==="#"?a:"#"+a),r}function vt(t){var e={};if(t){var r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));var n=t.indexOf("?");n>=0&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}function On(t,e,r){const n=p.reactive({...e}),o=i=>{Object.assign(n,{...i})},s=n,a=En(t,s,r);return{currentRoute:s,routerRoute:a,updateRoute:o}}function T(t){return!t.startsWith("http")?In(t):jn(t)}function jn(t){const{protocol:e,host:r,pathname:n,search:o,searchParams:s,hash:a}=new URL(t,t);return{protocol:e,host:r,pathname:n,search:o,searchParams:s,hash:a}}function In(t){const{pathname:e,search:r,searchParams:n,hash:o}=new URL(t,"https://localhost");return{pathname:e,search:r,searchParams:n,hash:o}}function Hn(t){return e=>{const{host:r}=T(e);return!(r===void 0||r===t)}}function dr(t){try{const e=t();return Mt(e)?e.catch(r=>r):e}catch(e){return e}}function $n(){const{setVueApp:t,runWithContext:e}=Me(),r=p.reactive(new Map),n=(c,d,m)=>{const{push:k,replace:U,reject:v,update:g}=Pt({to:d});return d.matches.filter(l=>tr({...m,routePrefetch:l.prefetch},"props")===c).flatMap(l=>E(l)).reduce((l,{id:f,name:S,props:L})=>{if(!L)return l;const P=y(f,S,d),R=e(()=>dr(()=>L(d,{push:k,replace:U,reject:v,update:g,parent:i(d,!0)})));return l[P]=R,l},{})},o=c=>{Object.entries(c).forEach(([d,m])=>{r.set(d,m)})},s=async c=>{const{push:d,replace:m,reject:k,update:U}=Pt({to:c}),v=c.matches.flatMap(E),g=[],l=[];for(const{id:f,name:S,props:L}of v){if(!L)continue;const P=y(f,S,c);if(g.push(P),!r.has(P)){const R=e(()=>dr(()=>L(c,{push:d,replace:m,reject:k,update:U,parent:i(c)})));r.set(P,R)}l.push((async()=>{const R=await r.get(P);if(R instanceof Error)throw R})())}h(g);try{return await Promise.all(l),{status:"SUCCESS"}}catch(f){if(f instanceof z||f instanceof ot)return f.response;throw f}},a=(c,d,m)=>{const k=y(c,d,m);return r.get(k)};function i(c,d=!1){const m=c.matches.at(-2);if(m)return ne(m)?{name:m.name??"",get props(){return u(m,"default",c,d)}}:se(m)?{name:m.name??"",props:new Proxy({},{get(k,U){return typeof U!="string"?Reflect.get(k,U):u(m,U,c,d)}})}:{name:m.name??"",props:void 0}}function u(c,d,m,k=!1){const U=a(c.id,d,m);if(k&&!U){const v=c.name??"unknown",g=m.name||"unknown";console.warn(`
|
|
2
|
+
Unable to access parent props "${d}" from route "${v}" while prefetching props for route "${g}".
|
|
3
3
|
This may occur if the parent route's props were not also prefetched.
|
|
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 Fn({mode:e,listener:t}){const r=Wn(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 Wn(e="auto"){switch(e){case"auto":return yt()?dr():pr();case"browser":return dr();case"memory":return pr();case"hash":return Hn();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 Gn(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 Qn extends Error{constructor(){super("initialUrl must be set if window.location is unavailable")}}function zn(e){if(e)return e;if(yt())return window.location.toString();throw new Qn}function Rr(e){return!!e&&typeof e=="object"}const De=!0;function Yn(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=Yn(t,n,o);r[n]=a}return r}function Xn(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=Xn(t,n,o);r[n]=a}return r};function Kn(){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 eo extends Error{constructor(t){super(`Route not found: "${t}"`)}}function gr(e,t,r){const n=Wr(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 to(e,t={}){const{params:r={},query:n}=t,o=no(e.query,r),a=Rt(o,n),i=vr(e.path,r),u=e.hash.value?vr(e.hash,r):t.hash,c=ro(e.host,r),{protocol:h,host:w}=_(c);return Er({protocol:h,host:w,pathname:i,searchParams:a,hash:u})}function ro(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 no(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 oo=(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),...ao(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 ao(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 so(e,t={},r={}){const n=to(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 io=e=>"name"in e.matched&&!!e.matched.name,uo=(e,t)=>{const{protocol:r,host:n}=_(t),o=!n,a=!e.host.value;return o?a:Jr(e).test(`${r}//${n}`)},co=(e,t)=>{const{pathname:r}=_(t);return Mr(e).test(r)},fo=(e,t)=>{const{search:r}=_(t);return Fr(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=Sr(a,t),c=Ar(a,r),h=Sr(i,t),w=Ar(i,r);return a.depth>i.depth?n:a.depth<i.depth?o:u+c>h+w?n:u+c<h+w?o:vt(a,e)?n:vt(i,e)?o:0}}function Ar(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 Sr(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=[io,uo,co,fo,vt,oo];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 br(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)?Pr(e,t,t.components):tt(t)?Pr(e,t,{default:t.component}):{default:r}}function Pr(e,t,r){return Object.fromEntries(Object.entries(r).map(([n,o])=>[n,bo(e,{match:t,name:n,component:o})]))}const Ur=Symbol();function Bo(e,t,r=[]){const o=t?.isGlobalRouter??!0?Ur:Symbol(),a=[...r.flatMap(U=>U.rejections),...t?.rejections??[]],i=Ao(e,r,t?.base),u=gn();u.addGlobalRouteHooks(So(t,r));const c=it(),h=Mn(),w=ko(o),A=Kn(),g=Fn({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 eo(U);return so(W,O,F)},b=(U,O,F)=>{if(J(U)){const de={...O},He=br(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=br(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}=Gn(a),y=k("NotFound"),{currentRoute:d,routerRoute:R,updateRoute:L}=$n(o,y,b),N=zn(t?.initialUrl),V=g.location.state,{host:x}=_(N),$=_n(x);let T=!1;const Pe=f.ref(!1),{promise:At,resolve:Jo}=Promise.withResolvers();async function kr(){if(T)return At;T=!0,Or(i)&&await jr(),await C(N,{replace:!0,state:V}),g.startListening(),Jo(),Pe.value=!0}function Mo(){g.stopListening()}function Fo(U){return sn(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,Lr),kr()}const Lr={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:kr,started:Pe,stop:Mo,key:o};return Lr}const No=z,Vo=z,Co=z,Q=ir(Ur),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=On,B.asUrl=st,B.combineRoutes=at,B.createExternalRoute=cn,B.createParam=kt,B.createRejection=un,B.createRoute=ae,B.createRouter=Bo,B.createRouterAssets=ir,B.createRouterPlugin=xn,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=In,B.unionOf=cr,B.useLink=_o,B.useQueryValue=To,B.useRoute=$o,B.useRouter=qo,B.withDefault=Cr,B.withParams=z,Object.defineProperty(B,Symbol.toStringTag,{value:"Module"})}));
|
|
4
|
+
`)}return U}function y(c,d,m){return[c,d,m.id,JSON.stringify(m.params)].join("-")}function E(c){return ne(c)?[{id:c.id,name:"default",props:c.props}]:se(c)?Object.entries(c.props).map(([d,m])=>({id:c.id,name:d,props:m})):[]}function h(c){for(const d of r.keys())c.includes(d)||r.delete(d)}return{getPrefetchProps:n,setPrefetchProps:o,getProps:a,setProps:s,setVueApp:t}}function Re(){return typeof window<"u"&&typeof window.document<"u"}function Dn({mode:t,listener:e}){const r=qn(t),n=(u,y)=>{if(y?.replace){r.replace(u,y.state);return}r.push(u,y?.state)},o=()=>{const u=at(r.location);r.replace(u)};let s;return{...r,update:n,refresh:o,startListening:()=>{s?.(),s=r.listen(e)},stopListening:()=>{s?.()}}}function qn(t="auto"){switch(t){case"auto":return Re()?ur():fr();case"browser":return ur();case"memory":return fr();case"hash":return Zn();default:const e=t;throw new Error(`Switch is not exhaustive for mode: ${e}`)}}function ye(t){const e=new URLSearchParams(t);return{get:(...r)=>e.get(...r),getAll:(...r)=>e.getAll(...r),set:(...r)=>{e.set(...r)},append:(...r)=>{e.append(...r)},delete:(...r)=>{e.delete(...r)},toString:(...r)=>e.toString(...r),forEach:(...r)=>{e.forEach(...r)},entries:(...r)=>e.entries(...r),keys:(...r)=>e.keys(...r),values:(...r)=>e.values(...r),has:(...r)=>e.has(...r),size:e.size,sort:()=>{e.sort()},[Symbol.iterator]:()=>e[Symbol.iterator]()}}function Tn(t){const e=s=>{const a=t.find(i=>i.type===s);return p.markRaw(a?.component??qe(s))},r=s=>{const a=p.markRaw(e(s)),i={id:ue(),component:a,meta:{},state:{}};return{id:i.id,matched:i,matches:[i],hooks:[],name:s,query:ye(""),params:{},state:{},href:"/",hash:""}},n=s=>{if(!s){o.value=null;return}const a=e(s);o.value={type:s,component:a}},o=p.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 Mn(t){if(t)return t;if(Re())return window.location.toString();throw new Jn}function lr(t){return!!t&&typeof t=="object"}const Ht=!0;function _n(t,e,r){if(lr(t)&&e in t){const n=t[e];return typeof n=="string"?X(n,r,Ht):n}return X(void 0,r,Ht)}function hr(t,e){const r={};for(const[n,o]of Object.entries(t)){const s=_n(e,n,o);r[n]=s}return r}function Fn(t,e,r){if(lr(t)&&e in t){const n=t[e];return Q(n,r,Ht)}return Q(void 0,r,Ht)}const Rr=(t,e)=>{const r={};for(const[n,o]of Object.entries(t)){const s=Fn(e,n,o);r[n]=s}return r};function Wn(){const t=p.reactive(new Map),e=Re()?a():null,r=i=>{t.set(i,!1),e?.observe(i)},n=i=>{t.delete(i),e?.unobserve(i)},o=()=>{e?.disconnect()},s=i=>t.get(i)??!1;function a(){return new IntersectionObserver(i=>{i.forEach(u=>{t.set(u.target,u.isIntersecting)})})}return{observe:r,unobserve:n,disconnect:o,isElementVisible:s}}class Gn extends Error{constructor(e){super(`Route not found: "${e}"`)}}function yr(t,e,r){const n=Wr(e.value,r),o=Ze(n),[s]=je(t,new RegExp(o,"g"));return s}function mr(t,e,r,n){const o=Xt(e,r),s=Q(n,e.params[r],o);return t.replace(Oe(r),s)}function gr({protocol:t,host:e,pathname:r,search:n,searchParams:o,hash:s}){const a=new URL("https://localhost");t&&(a.protocol=t),e&&(a.host=e),r&&(a.pathname=r),o?a.search=new URLSearchParams(o).toString():n&&(a.search=n),s&&(a.hash=s);const i=a.toString().replace(/^https:\/\/localhost\/*/,"/");return ie(i)}function Qn(t,e={}){const{params:r={},query:n}=e,o=Yn(t.query,r),s=he(o,n),a=wr(t.path,r),i=t.hash.value?wr(t.hash,r):e.hash,u=zn(t.host,r),{protocol:y,host:E}=T(u);return gr({protocol:y,host:E,pathname:a,searchParams:s,hash:i})}function zn(t,e){const r=t.value&&!t.value.startsWith("http")?`https://${t.value}`:t.value;return Object.keys(t.params).reduce((n,o)=>mr(n,t,o,e[o]),r)}function wr(t,e){return Object.keys(t.params).reduce((r,n)=>mr(r,t,n,e[n]),t.value)}function Yn(t,e){const r=new URLSearchParams(t.value);if(!t.value)return r;for(const[n,o]of Array.from(r.entries())){const s=te(o);if(!s)continue;const i=Kt(o),u=Q(e[s],t.params[s],i),y=e[s]===void 0&&u==="";i&&y?r.delete(n,o):r.set(n,u)}return r}const Xn=(t,e)=>{try{me(t,e)}catch{return!1}return!0},me=(t,e)=>{const{protocol:r,host:n,pathname:o,search:s,hash:a}=T(e);return{...ge(t.host,`${r}//${n}`),...ge(t.path,o),...Kn(t.query,s),...ge(t.hash,a)}};function ge(t,e){const r={},n=decodeURIComponent(e);for(const[o,s]of Object.entries(t.params)){const a=yr(n,t,o),i=Xt(t,o),u=X(a,s,i);r[o]=u}return r}function Kn(t,e){const r={},n=new URLSearchParams(t.value),o=new URLSearchParams(e);for(const[s,a]of Array.from(n.entries())){const i=te(a);if(!i)continue;const y=Kt(a),E=o.get(s)??void 0,h=X(E,t.params[i],y);r[i]=h}return r}function to(t,e={},r={}){const n=Qn(t,{params:e,query:r.query,hash:r.hash}),{search:o,hash:s}=T(n);return{id:t.id,matched:t.matched,matches:t.matches,name:t.name,hooks:t.hooks,query:ye(o),params:me(t,n),state:hr(t.state,r.state),hash:s,href:n}}const $t={template:"<div>This is component</div>"},we=nt({name:"parentA",path:"/parentA/[paramA]"}),Er=nt({parent:we,name:"parentA.childA",path:"/childA/[?paramB]"}),eo=nt({parent:we,name:"parentA.childB",path:"/childB/[paramD]",component:$t}),ro=nt({parent:Er,name:"parentA.childA.grandChildA",path:"/[paramC]",component:$t});nt({name:"parentB",path:"/parentB",component:$t}),nt({name:"parentC",path:"/",component:$t});const no=t=>"name"in t.matched&&!!t.matched.name,Sr=(t,e)=>{const{protocol:r,host:n}=T(e),o=!n;return t.host.value?Mr(t).test(`${r}//${n}`):o},oo=(t,e)=>{const{pathname:r}=T(e);return _r(t).test(r)},so=(t,e)=>{const{search:r}=T(e);return Fr(t).every(o=>o.test(r))},Ee=(t,e)=>{const{hash:r}=T(e),{value:n}=t.hash;return _(n)?`#${n.replace(/^#*/,"")}`.toLowerCase()===r.toLowerCase():!0};function ao(t){const{searchParams:e,pathname:r}=T(t),n=-1,o=1;return(s,a)=>{const i=br(s,e),u=Pr(s,r),y=br(a,e),E=Pr(a,r);return s.depth>a.depth?n:s.depth<a.depth?o:i+u>y+E?n:i+u<y+E?o:Sr(s,t)?n:Sr(a,t)?o:Ee(s,t)?n:Ee(a,t)?o:0}}function Pr(t,e){const r=Object.keys(t.path.params).filter(o=>Xt(t.path,o)).map(o=>o),n=r.filter(o=>yr(e,t.path,o)===void 0);return r.length-n.length}function br(t,e){const r=new URLSearchParams(e),n=new URLSearchParams(t.query.value),o=Array.from(n.keys()),s=o.filter(a=>!r.has(a));return o.length-s.length}const io=[no,oo,so,Ee,Xn];function co(t,e){const r=ao(e);return t.filter(n=>io.every(o=>o(n,e))).sort(r)}function uo(t,e,r){const n=co(t,e);if(!n.length)return;const[o]=n,{searchParams:s,hash:a}=T(e);return{id:o.id,matched:o.matched,matches:o.matches,name:o.name,hooks:o.hooks,query:ye(s),params:me(o,e),state:hr(o.state,r),hash:a,href:ie(e)}}function vr(t,e){const r=typeof t=="string"?T(t):t,n=typeof e=="string"?T(e):e,o=r.searchParams??new URLSearchParams(r.search),s=n.searchParams??new URLSearchParams(n.search);return gr({protocol:_(n.protocol)?n.protocol:r.protocol,host:_(n.host)?n.host:r.host,pathname:_(n.pathname)?n.pathname:r.pathname,searchParams:he(s,o),hash:_(n.hash)?n.hash:r.hash})}function fo(t,e){return _(e)?t.map(r=>{const n=`${e}${r.path.value}`;return{...r,path:tt(n,r.path.params)}}):t}class po extends Error{constructor(e){super(`Invalid Name "${e}": Router does not support multiple routes with the same name. All name names must be unique.`)}}function lo(t){const e=t.map(({name:r})=>r);for(const r of e)if(ve(e,r)>1)throw new po(r)}class ho extends Error{constructor(e){super(`Missing Route Context: Router is missing the route "${e}", which was declared as context for at least one route.`)}}function Ro(t){const e=new Set(t.map(n=>n.id)),r=t.flatMap(n=>n.context).filter(yo);for(const n of r)if(!e.has(n.id))throw new ho(n.name)}function yo(t){return"id"in t}function mo(t,e=[],r){const n=[...t,...e.map(o=>o.routes)].flat().filter(o=>_(o.name));return lo(n),Ro(n),fo(n,r)}function go(t=[]){const e=new rt;return t.forEach(r=>{r.hooks.onBeforeRouteEnter.forEach(n=>e.onBeforeRouteEnter.add(n)),r.hooks.onBeforeRouteUpdate.forEach(n=>e.onBeforeRouteUpdate.add(n)),r.hooks.onBeforeRouteLeave.forEach(n=>e.onBeforeRouteLeave.add(n)),r.hooks.onAfterRouteEnter.forEach(n=>e.onAfterRouteEnter.add(n)),r.hooks.onAfterRouteUpdate.forEach(n=>e.onAfterRouteUpdate.add(n)),r.hooks.onAfterRouteLeave.forEach(n=>e.onAfterRouteLeave.add(n))}),e}function wo(t,{match:e,name:r,component:n}){const o=Ke(t),s=xt(t);return p.defineComponent({name:"PropsWrapper",expose:[],setup(){const a=p.getCurrentInstance(),i=o(),u=s();return()=>{const y=i.getProps(e.id,r,u);return y instanceof Error?"":Mt(y)?a?.suspense?p.h(So,{component:n,props:y}):p.h(Eo,{component:n,props:y}):p.h(n,y)}}})}const Eo=p.defineComponent(t=>{const e=p.ref();return p.watch(()=>t.props,async r=>{e.value=await r},{immediate:!0,deep:!0}),()=>e.value instanceof Error?"":e.value?p.h(t.component,e.value):""},{props:["component","props"]}),So=p.defineComponent(async t=>{const e=p.ref();return e.value=await t.props,p.watch(()=>e.value,async r=>{e.value=await r},{deep:!0}),()=>e.value instanceof Error?"":e.value?p.h(t.component,e.value):""},{props:["component","props"]});function Po(t){const e=new Map;return{getRouteComponents:n=>{const o=e.get(n.id);if(o)return o;const s=bo(t,n);return e.set(n.id,s),s}}}function bo(t,e){const r=de(t);return oe(e)?Ar(t,e,e.components):re(e)?Ar(t,e,{default:e.component}):{default:r}}function Ar(t,e,r){return Object.fromEntries(Object.entries(r).map(([n,o])=>[n,wo(t,{match:e,name:n,component:o})]))}const kr=Symbol();function vo(t,e,r=[]){const o=e?.isGlobalRouter??!0?kr:Symbol(),s=[...r.flatMap(A=>A.rejections),...e?.rejections??[]],a=mo(t,r,e?.base),i=Rn();i.addGlobalRouteHooks(go(r));const u=ce(),y=$n(),E=Po(o),h=Wn(),c=Dn({mode:e?.historyMode,listener:({location:A})=>{const x=at(A);m(x,{state:A.state,replace:!0})}});function d(A,x={}){return uo(a,A,x.state)}async function m(A,x={}){const J=u();c.stopListening();const M=d(A,x)??L("NotFound"),O=Ho(J),H=await i.runBeforeRouteHooks({to:M,from:O});switch(H.status){case"ABORT":return;case"PUSH":c.update(A,x),await v(...H.to);return;case"REJECT":c.update(A,x),f(H.type);break;case"SUCCESS":c.update(A,x),f(null);break;default:throw new Error(`Switch is not exhaustive for before hook response status: ${JSON.stringify(H)}`)}$(A)||k(J,M,O);const Rt=await i.runAfterRouteHooks({to:M,from:O});switch(Rt.status){case"PUSH":await v(...Rt.to);break;case"REJECT":f(Rt.type);break;case"SUCCESS":break;default:const it=Rt;throw new Error(`Switch is not exhaustive for after hook response status: ${JSON.stringify(it)}`)}c.startListening()}function k(A,x,J){const M=A;y.setProps(x).then(O=>{if(M===A)switch(O.status){case"SUCCESS":break;case"PUSH":v(...O.to);break;case"REJECT":f(O.type);break;default:const H=O;throw new Error(`Switch is not exhaustive for prop store response status: ${JSON.stringify(H)}`)}}).catch(O=>{try{i.runErrorHooks(O,{to:x,from:J,source:"props"})}catch(H){if(H instanceof z){v(...H.response.to);return}if(H instanceof ot){f(H.response.type);return}throw H}}),B(x)}const U=(A,x={},J={})=>{const M=a.find(O=>O.name===A);if(!M)throw new Gn(A);return to(M,x,J)},v=(A,x,J)=>{if(F(A)){const it={...x},Dt=vr(A,{searchParams:it.query,hash:it.hash});return m(Dt,it)}if(typeof A=="string"){const{replace:it,...Dt}={...J},Do={...x},Pe=U(A,Do,Dt),qo=Rr({...Pe.matched.state},{...Pe.state,...Dt.state});return m(Pe.href,{replace:it,state:qo})}const{replace:M,...O}={...x},H=Rr({...A.matched.state},{...A.state,...O.state}),Rt=vr(A.href,{searchParams:O.query,hash:O.hash});return m(Rt,{replace:M,state:H})},g=(A,x,J)=>{if(F(A)){const O={...x,replace:!0};return v(A,O)}if(typeof A=="string"){const O={...J,replace:!0},H={...x};return v(A,H,O)}const M={...x,replace:!0};return v(A,M)},l=A=>{f(A)},{setRejection:f,rejection:S,getRejectionRoute:L}=Tn(s),P=L("NotFound"),{currentRoute:R,routerRoute:b,updateRoute:B}=On(o,P,v),C=Mn(e?.initialUrl),Z=c.location.state,{host:I}=T(C),$=Hn(I);let q=!1;const At=p.ref(!1),{promise:Se,resolve:jo}=Promise.withResolvers();async function Ur(){if(q)return Se;q=!0,Or(a)&&await jr(),await m(C,{replace:!0,state:Z}),c.startListening(),jo(),At.value=!0}function Io(){c.stopListening()}function Ho(A){return an(A)?null:{...R}}function $o(A){i.setVueApp(A),y.setVueApp(A);const x=de(o),J=sr(o);A.component("RouterView",x),A.component("RouterLink",J),A.provide(ze(o),S),A.provide(_e(o),i),A.provide(Xe(o),y),A.provide(Qe(o),E),A.provide(rr,h),A.provide(o,Lr),Ur()}const Lr={route:b,resolve:U,find:d,push:v,replace:g,reject:l,refresh:c.refresh,forward:c.forward,back:c.back,go:c.go,install:$o,isExternal:$,onBeforeRouteEnter:i.onBeforeRouteEnter,onBeforeRouteUpdate:i.onBeforeRouteUpdate,onBeforeRouteLeave:i.onBeforeRouteLeave,onAfterRouteEnter:i.onAfterRouteEnter,onAfterRouteUpdate:i.onAfterRouteUpdate,onAfterRouteLeave:i.onAfterRouteLeave,onError:i.onError,prefetch:e?.prefetch,start:Ur,started:At,stop:Io,key:o};return Lr}const W=ar(kr),Ao=W.onBeforeRouteLeave,ko=W.onBeforeRouteUpdate,Uo=W.onAfterRouteLeave,Lo=W.onAfterRouteUpdate,Vo=W.isRoute,Bo=W.RouterView,Co=W.RouterLink,No=W.useRoute,xo=W.useRouter,Zo=W.useQueryValue,Oo=W.useLink;V.DuplicateParamsError=be,V.MetaPropertyConflict=He,V.RouterLink=Co,V.RouterNotInstalledError=et,V.RouterView=Bo,V.UseRouteInvalidError=$e,V.arrayOf=Bn,V.asUrl=ie,V.combineRoutes=ae,V.createExternalRoute=un,V.createParam=ke,V.createRejection=cn,V.createRoute=nt,V.createRouter=vo,V.createRouterAssets=ar,V.createRouterPlugin=Ln,V.isRoute=Vo,V.isUrl=F,V.isWithComponent=re,V.isWithComponentProps=ne,V.isWithComponentPropsRecord=se,V.isWithComponents=oe,V.isWithParent=ee,V.onAfterRouteLeave=Uo,V.onAfterRouteUpdate=Lo,V.onBeforeRouteLeave=Ao,V.onBeforeRouteUpdate=ko,V.tupleOf=Nn,V.unionOf=ir,V.useLink=Oo,V.useQueryValue=Zo,V.useRoute=No,V.useRouter=xo,V.withDefault=Nr,V.withParams=tt,Object.defineProperty(V,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/main.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { withParams } from './services/withParams';
|
|
2
1
|
import { RouterAssets } from './services/createRouterAssets';
|
|
3
2
|
import { RegisteredRouter } from './types/register';
|
|
4
3
|
export * from './types/createRouteOptions';
|
|
@@ -39,21 +38,6 @@ export { arrayOf } from './services/arrayOf';
|
|
|
39
38
|
export { tupleOf } from './services/tupleOf';
|
|
40
39
|
export { createParam } from './services/createParam';
|
|
41
40
|
export { createRouter } from './services/createRouter';
|
|
42
|
-
/**
|
|
43
|
-
* @deprecated use `withParams` instead
|
|
44
|
-
* @hidden we don't want to expose this in the api docs
|
|
45
|
-
*/
|
|
46
|
-
export declare const path: typeof withParams;
|
|
47
|
-
/**
|
|
48
|
-
* @deprecated use `withParams` instead
|
|
49
|
-
* @hidden we don't want to expose this in the api docs
|
|
50
|
-
*/
|
|
51
|
-
export declare const host: typeof withParams;
|
|
52
|
-
/**
|
|
53
|
-
* @deprecated use `withParams` instead
|
|
54
|
-
* @hidden we don't want to expose this in the api docs
|
|
55
|
-
*/
|
|
56
|
-
export declare const query: typeof withParams;
|
|
57
41
|
/**
|
|
58
42
|
* Registers a hook that is called before a route is left. Must be called from setup.
|
|
59
43
|
* This is useful for performing actions or cleanups before navigating away from a route component.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AfterHook, BeforeHook, ErrorHook } from '../types/hooks';
|
|
2
|
+
export declare class Hooks {
|
|
3
|
+
onBeforeRouteEnter: Set<BeforeHook>;
|
|
4
|
+
onBeforeRouteUpdate: Set<BeforeHook>;
|
|
5
|
+
onBeforeRouteLeave: Set<BeforeHook>;
|
|
6
|
+
onAfterRouteEnter: Set<AfterHook>;
|
|
7
|
+
onAfterRouteUpdate: Set<AfterHook>;
|
|
8
|
+
onAfterRouteLeave: Set<AfterHook>;
|
|
9
|
+
onError: Set<ErrorHook>;
|
|
10
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { InjectionKey } from 'vue';
|
|
2
|
-
import {
|
|
2
|
+
import { AddAfterHook, AddBeforeHook } from '../types/hooks';
|
|
3
3
|
import { Routes } from '../types/route';
|
|
4
4
|
import { Router, RouterRejections, RouterRoutes } from '../types/router';
|
|
5
|
-
import {
|
|
6
|
-
type ComponentHooks<TRoutes extends Routes, TRejections extends
|
|
7
|
-
onBeforeRouteLeave:
|
|
8
|
-
onBeforeRouteUpdate:
|
|
9
|
-
onAfterRouteLeave:
|
|
10
|
-
onAfterRouteUpdate:
|
|
5
|
+
import { Rejections } from '../types/rejection';
|
|
6
|
+
type ComponentHooks<TRoutes extends Routes, TRejections extends Rejections> = {
|
|
7
|
+
onBeforeRouteLeave: AddBeforeHook<TRoutes[number], TRoutes, TRejections>;
|
|
8
|
+
onBeforeRouteUpdate: AddBeforeHook<TRoutes[number], TRoutes, TRejections>;
|
|
9
|
+
onAfterRouteLeave: AddAfterHook<TRoutes[number], TRoutes, TRejections>;
|
|
10
|
+
onAfterRouteUpdate: AddAfterHook<TRoutes[number], TRoutes, TRejections>;
|
|
11
11
|
};
|
|
12
12
|
export declare function createComponentHooks<TRouter extends Router>(routerKey: InjectionKey<TRouter>): ComponentHooks<RouterRoutes<TRouter>, RouterRejections<TRouter>>;
|
|
13
13
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CreateRouteOptions, ToRoute, WithHost, WithoutHost, WithoutParent, WithParent } from '../types/createRouteOptions';
|
|
2
2
|
import { ExternalRouteHooks } from '../types/hooks';
|
|
3
|
-
|
|
4
|
-
export declare function createExternalRoute<const TOptions extends CreateRouteOptions &
|
|
3
|
+
import { ExtractRouteContext } from '../types/routeContext';
|
|
4
|
+
export declare function createExternalRoute<const TOptions extends CreateRouteOptions & WithHost & WithoutParent>(options: TOptions): ToRoute<TOptions> & ExternalRouteHooks<ToRoute<TOptions>, TOptions['context']>;
|
|
5
|
+
export declare function createExternalRoute<const TOptions extends CreateRouteOptions & WithoutHost & WithParent>(options: TOptions): ToRoute<TOptions> & ExternalRouteHooks<ToRoute<TOptions>, ExtractRouteContext<TOptions>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AddBeforeHook, AddAfterHook, AddErrorHook } from '../types/hooks';
|
|
2
|
+
import { Routes } from '../types/route';
|
|
3
|
+
import { Hooks } from '../models/hooks';
|
|
4
|
+
import { Rejection } from '../types/rejection';
|
|
5
|
+
export type RouteHooks<TRoutes extends Routes = Routes, TRejections extends Rejection[] = Rejection[]> = {
|
|
6
|
+
onBeforeRouteEnter: AddBeforeHook<TRoutes[number], TRoutes, TRejections>;
|
|
7
|
+
onBeforeRouteUpdate: AddBeforeHook<TRoutes[number], TRoutes, TRejections>;
|
|
8
|
+
onBeforeRouteLeave: AddBeforeHook<TRoutes[number], TRoutes, TRejections>;
|
|
9
|
+
onAfterRouteEnter: AddAfterHook<TRoutes[number], TRoutes, TRejections>;
|
|
10
|
+
onAfterRouteUpdate: AddAfterHook<TRoutes[number], TRoutes, TRejections>;
|
|
11
|
+
onAfterRouteLeave: AddAfterHook<TRoutes[number], TRoutes, TRejections>;
|
|
12
|
+
onError: AddErrorHook<TRoutes[number], TRoutes, TRejections>;
|
|
13
|
+
store: Hooks;
|
|
14
|
+
};
|
|
15
|
+
export declare function createHooksFactory(): RouteHooks;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { PrefetchConfigs, PrefetchStrategy } from '../types/prefetch';
|
|
2
2
|
import { ResolvedRoute } from '../types/resolved';
|
|
3
|
-
import { CallbackPushResponse, CallbackRejectResponse, CallbackSuccessResponse } from './createCallbackContext';
|
|
4
3
|
import { HasVueAppStore } from './createVueAppStore';
|
|
5
|
-
|
|
4
|
+
import { CallbackContextPush, CallbackContextReject, CallbackContextSuccess } from '../types/callbackContext';
|
|
5
|
+
type SetPropsResponse = CallbackContextSuccess | CallbackContextPush | CallbackContextReject;
|
|
6
6
|
export type PropStore = HasVueAppStore & {
|
|
7
7
|
getPrefetchProps: (strategy: PrefetchStrategy, route: ResolvedRoute, configs: PrefetchConfigs) => Record<string, unknown>;
|
|
8
8
|
setPrefetchProps: (props: Record<string, unknown>) => void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CreateRouteOptions, PropsGetter, CreateRouteProps, ToRoute, RouterViewPropsGetter } from '../types/createRouteOptions';
|
|
2
2
|
import { InternalRouteHooks } from '../types/hooks';
|
|
3
|
+
import { ExtractRouteContext } from '../types/routeContext';
|
|
3
4
|
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,
|
|
5
|
+
export declare function createRoute<const TOptions extends CreateRouteOptions, const TProps extends CreateRouteProps<TOptions>>(options: TOptions, ...args: CreateRouteWithProps<TOptions, TProps>): ToRoute<TOptions, TProps> & InternalRouteHooks<ToRoute<TOptions>, ExtractRouteContext<TOptions>>;
|
|
5
6
|
export {};
|
|
@@ -7,7 +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 {
|
|
10
|
+
import { AddAfterHook, AddBeforeHook } from '../types/hooks';
|
|
11
11
|
export type RouterAssets<TRouter extends Router> = {
|
|
12
12
|
/**
|
|
13
13
|
* Registers a hook that is called before a route is left. Must be called from setup.
|
|
@@ -17,7 +17,7 @@ export type RouterAssets<TRouter extends Router> = {
|
|
|
17
17
|
* @returns {RouteHookRemove} A function that removes the added hook.
|
|
18
18
|
* @group Hooks
|
|
19
19
|
*/
|
|
20
|
-
onBeforeRouteLeave:
|
|
20
|
+
onBeforeRouteLeave: AddBeforeHook<RouterRoutes<TRouter>[number], RouterRoutes<TRouter>, RouterRejections<TRouter>>;
|
|
21
21
|
/**
|
|
22
22
|
* Registers a hook that is called before a route is updated. Must be called from setup.
|
|
23
23
|
* This is particularly useful for handling changes in route parameters or query while staying within the same component.
|
|
@@ -26,7 +26,7 @@ export type RouterAssets<TRouter extends Router> = {
|
|
|
26
26
|
* @returns {RouteHookRemove} A function that removes the added hook.
|
|
27
27
|
* @group Hooks
|
|
28
28
|
*/
|
|
29
|
-
onBeforeRouteUpdate:
|
|
29
|
+
onBeforeRouteUpdate: AddBeforeHook<RouterRoutes<TRouter>[number], RouterRoutes<TRouter>, RouterRejections<TRouter>>;
|
|
30
30
|
/**
|
|
31
31
|
* Registers a hook that is called after a route has been left. Must be called during setup.
|
|
32
32
|
* This can be used for cleanup actions after the component is no longer active, ensuring proper resource management.
|
|
@@ -35,7 +35,7 @@ export type RouterAssets<TRouter extends Router> = {
|
|
|
35
35
|
* @returns {RouteHookRemove} A function that removes the added hook.
|
|
36
36
|
* @group Hooks
|
|
37
37
|
*/
|
|
38
|
-
onAfterRouteLeave:
|
|
38
|
+
onAfterRouteLeave: AddAfterHook<RouterRoutes<TRouter>[number], RouterRoutes<TRouter>, RouterRejections<TRouter>>;
|
|
39
39
|
/**
|
|
40
40
|
* Registers a hook that is called after a route has been updated. Must be called during setup.
|
|
41
41
|
* This is ideal for responding to updates within the same route, such as parameter changes, without full component reloads.
|
|
@@ -44,7 +44,7 @@ export type RouterAssets<TRouter extends Router> = {
|
|
|
44
44
|
* @returns {RouteHookRemove} A function that removes the added hook.
|
|
45
45
|
* @group Hooks
|
|
46
46
|
*/
|
|
47
|
-
onAfterRouteUpdate:
|
|
47
|
+
onAfterRouteUpdate: AddAfterHook<RouterRoutes<TRouter>[number], RouterRoutes<TRouter>, RouterRejections<TRouter>>;
|
|
48
48
|
/**
|
|
49
49
|
* A guard to verify if a route or unknown value matches a given route name.
|
|
50
50
|
*
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Router, RouterRejections, RouterRoutes } from '../types/router';
|
|
2
1
|
import { RouterPush } from '../types/routerPush';
|
|
3
2
|
import { RouterReject } from '../types/routerReject';
|
|
4
3
|
import { RouterReplace } from '../types/routerReplace';
|
|
5
|
-
import { InjectionKey } from 'vue';
|
|
6
4
|
import { BuiltInRejectionType } from './createRouterReject';
|
|
7
5
|
import { AsString } from '../types/utilities';
|
|
8
6
|
import { Routes } from '../types/route';
|
|
9
|
-
import {
|
|
7
|
+
import { Rejections } from '../types/rejection';
|
|
8
|
+
import { RouteUpdate } from '../types/routeUpdate';
|
|
9
|
+
import { ResolvedRoute } from '../types/resolved';
|
|
10
10
|
/**
|
|
11
11
|
* Defines the structure of a successful callback response.
|
|
12
12
|
*/
|
|
@@ -37,11 +37,13 @@ export type RouterCallbackRejectResponse<TRejections extends string> = {
|
|
|
37
37
|
* A function that can be called to abort a routing operation.
|
|
38
38
|
*/
|
|
39
39
|
export type CallbackContextAbort = () => void;
|
|
40
|
-
export type RouterCallbackContext<TRoutes extends Routes = Routes, TRejections extends
|
|
40
|
+
export type RouterCallbackContext<TRoutes extends Routes = Routes, TRejections extends Rejections = Rejections> = {
|
|
41
41
|
reject: RouterReject<TRejections>;
|
|
42
42
|
push: RouterPush<TRoutes>;
|
|
43
43
|
replace: RouterReplace<TRoutes>;
|
|
44
|
+
update: RouteUpdate<ResolvedRoute<TRoutes[number]>>;
|
|
44
45
|
abort: CallbackContextAbort;
|
|
45
46
|
};
|
|
46
|
-
export declare function createRouterCallbackContext<
|
|
47
|
-
|
|
47
|
+
export declare function createRouterCallbackContext<TRoutes extends Routes, TRejections extends Rejections>({ to }: {
|
|
48
|
+
to: ResolvedRoute;
|
|
49
|
+
}): RouterCallbackContext<TRoutes, TRejections>;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AddGlobalHooks, AddComponentAfterHook, AddComponentBeforeHook, AfterHookRunner, BeforeHookRunner, AddBeforeHook, AddAfterHook, ErrorHookRunner, AddErrorHook } from '../types/hooks';
|
|
2
2
|
import { HasVueAppStore } from './createVueAppStore';
|
|
3
3
|
export declare const getRouterHooksKey: (routerKey: import('vue').InjectionKey<import('../main').Router>) => import('vue').InjectionKey<RouterHooks>;
|
|
4
4
|
export type RouterHooks = HasVueAppStore & {
|
|
5
|
-
runBeforeRouteHooks:
|
|
6
|
-
runAfterRouteHooks:
|
|
7
|
-
runErrorHooks:
|
|
8
|
-
addComponentBeforeRouteHook:
|
|
9
|
-
addComponentAfterRouteHook:
|
|
10
|
-
addGlobalRouteHooks:
|
|
11
|
-
onBeforeRouteEnter:
|
|
12
|
-
onBeforeRouteUpdate:
|
|
13
|
-
onBeforeRouteLeave:
|
|
14
|
-
onAfterRouteEnter:
|
|
15
|
-
onAfterRouteUpdate:
|
|
16
|
-
onAfterRouteLeave:
|
|
17
|
-
onError:
|
|
5
|
+
runBeforeRouteHooks: BeforeHookRunner;
|
|
6
|
+
runAfterRouteHooks: AfterHookRunner;
|
|
7
|
+
runErrorHooks: ErrorHookRunner;
|
|
8
|
+
addComponentBeforeRouteHook: AddComponentBeforeHook;
|
|
9
|
+
addComponentAfterRouteHook: AddComponentAfterHook;
|
|
10
|
+
addGlobalRouteHooks: AddGlobalHooks;
|
|
11
|
+
onBeforeRouteEnter: AddBeforeHook;
|
|
12
|
+
onBeforeRouteUpdate: AddBeforeHook;
|
|
13
|
+
onBeforeRouteLeave: AddBeforeHook;
|
|
14
|
+
onAfterRouteEnter: AddAfterHook;
|
|
15
|
+
onAfterRouteUpdate: AddAfterHook;
|
|
16
|
+
onAfterRouteLeave: AddAfterHook;
|
|
17
|
+
onError: AddErrorHook;
|
|
18
18
|
};
|
|
19
19
|
export declare function createRouterHooks(): RouterHooks;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { CreateRouterPluginOptions, RouterPlugin, PluginRouteHooks } from '../types/routerPlugin';
|
|
2
|
-
import {
|
|
2
|
+
import { Rejections } from '../types/rejection';
|
|
3
3
|
import { Routes } from '../types/route';
|
|
4
|
-
export declare function createRouterPlugin<TRoutes extends Routes = Routes, TRejections extends
|
|
4
|
+
export declare function createRouterPlugin<TRoutes extends Routes = Routes, TRejections extends Rejections = Rejections>(plugin: CreateRouterPluginOptions<TRoutes, TRejections>): RouterPlugin<TRoutes, TRejections> & PluginRouteHooks<TRoutes, TRejections>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { UrlParts } from '../types/urlParts';
|
|
2
|
+
import { ToWithParams, WithParams } from './withParams';
|
|
3
|
+
type CreateUrlPartsOptions = {
|
|
4
|
+
protocol?: string | WithParams | undefined;
|
|
5
|
+
host?: string | WithParams | undefined;
|
|
6
|
+
port?: string | WithParams | undefined;
|
|
7
|
+
pathname?: string | WithParams | undefined;
|
|
8
|
+
search?: string | WithParams | undefined;
|
|
9
|
+
hash?: string | WithParams | undefined;
|
|
10
|
+
};
|
|
11
|
+
type ToUrlParts<T extends CreateUrlPartsOptions> = UrlParts<ToWithParams<T['protocol']>, ToWithParams<T['host']>, ToWithParams<T['port']>, ToWithParams<T['pathname']>, ToWithParams<T['search']>, ToWithParams<T['hash']>>;
|
|
12
|
+
export declare function createUrlParts<const T extends CreateUrlPartsOptions>(options: T): ToUrlParts<T>;
|
|
13
|
+
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { RouterOptions } from '../types/router';
|
|
1
|
+
import { Hooks } from '../models/hooks';
|
|
3
2
|
import { RouterPlugin } from '../types/routerPlugin';
|
|
4
|
-
export declare function getGlobalHooksForRouter(
|
|
3
|
+
export declare function getGlobalHooksForRouter(plugins?: RouterPlugin[]): Hooks;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ResolvedRoute } from '../types/resolved';
|
|
2
|
-
import {
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function
|
|
2
|
+
import { Hooks } from '../models/hooks';
|
|
3
|
+
export declare function getGlobalBeforeHooks(to: ResolvedRoute, from: ResolvedRoute | null, globalHooks: Hooks): Hooks;
|
|
4
|
+
export declare function getGlobalAfterHooks(to: ResolvedRoute, from: ResolvedRoute | null, globalHooks: Hooks): Hooks;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ResolvedRoute } from '../types/resolved';
|
|
2
|
-
import {
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function
|
|
2
|
+
import { Hooks } from '../models/hooks';
|
|
3
|
+
export declare function getBeforeHooksFromRoutes(to: ResolvedRoute, from: ResolvedRoute | null): Hooks;
|
|
4
|
+
export declare function getAfterHooksFromRoutes(to: ResolvedRoute, from: ResolvedRoute | null): Hooks;
|
package/dist/services/hooks.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HookLifecycle } from '../types/hooks';
|
|
2
2
|
import { ResolvedRoute } from '../types/resolved';
|
|
3
3
|
type RouteHookCondition = (to: ResolvedRoute, from: ResolvedRoute | null, depth: number) => boolean;
|
|
4
4
|
export declare const isRouteEnter: RouteHookCondition;
|
|
5
5
|
export declare const isRouteLeave: RouteHookCondition;
|
|
6
6
|
export declare const isRouteUpdate: RouteHookCondition;
|
|
7
|
-
export declare function getRouteHookCondition(lifecycle:
|
|
7
|
+
export declare function getRouteHookCondition(lifecycle: HookLifecycle): RouteHookCondition;
|
|
8
8
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { UrlParts } from '../types/
|
|
1
|
+
import { UrlParts } from '../types/urlParts';
|
|
2
2
|
export declare function parseUrl(value: string): UrlParts;
|