@kitbag/router 0.20.7 → 0.20.8
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/dist/compositions/useRouterHooks.d.ts +2 -2
- package/dist/kitbag-router.js +1416 -1384
- package/dist/kitbag-router.umd.cjs +3 -3
- package/dist/main.d.ts +4 -4
- package/dist/models/RouterRouteHooks.d.ts +7 -7
- package/dist/services/createCallbackContext.d.ts +6 -0
- package/dist/services/createComponentHooks.d.ts +7 -7
- package/dist/services/createRouterAssets.d.ts +5 -5
- package/dist/services/createRouterCallbackContext.d.ts +45 -0
- package/dist/services/createRouterHooks.d.ts +13 -13
- package/dist/services/getGlobalRouteHooks.d.ts +2 -2
- package/dist/services/getRouteHooks.d.ts +6 -0
- package/dist/types/hooks.d.ts +25 -7
- package/dist/types/register.d.ts +11 -0
- package/dist/types/router.d.ts +16 -15
- package/package.json +5 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(L,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],l):(L=typeof globalThis<"u"?globalThis:L||self,l(L["@kitbag/router"]={},L.Vue))})(this,function(L,l){"use strict";class Ee 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 st(t){return Array.isArray(t)?t:[t]}function be(t,e){return t.filter(n=>e===n).length}function it(...t){const e=t.flatMap(n=>Array.isArray(n)?n:Object.keys(n));for(const n of e)if(be(e,n)>1)throw new Ee(n)}class z extends Error{}const Rt="[",At="]";function Vn(t){return t!==String&&t!==Boolean&&t!==Number&&t!==Date}function Nn(t){return typeof t=="function"&&Vn(t)}function kt(t){return typeof t=="object"&&"get"in t&&typeof t.get=="function"&&"set"in t&&typeof t.set=="function"}function Se(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"}function Pe(t,e){return kt(t)?{...t,defaultValue:e??t.defaultValue}:{get:n=>tt(n,t),set:n=>Y(n,t),defaultValue:e}}function Cn(t){return kt(t)&&t.defaultValue!==void 0}function Bn(t,e){return Pe(t,e)}function On(t){return t!==void 0}function ct(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function D(t){return typeof t=="string"&&t.length>0}let A=null;async function xn(){const{ZodSchema:t,ZodString:e,ZodBoolean:n,ZodDate:r,ZodNumber:o,ZodLiteral:a,ZodObject:s,ZodEnum:c,ZodNativeEnum:f,ZodArray:d,ZodTuple:R,ZodUnion:h,ZodDiscriminatedUnion:k,ZodRecord:S,ZodMap:B,ZodSet:g,ZodIntersection:U,ZodPromise:m,ZodFunction:w}=await import("zod");return{ZodSchema:t,ZodString:e,ZodBoolean:n,ZodDate:r,ZodNumber:o,ZodLiteral:a,ZodObject:s,ZodEnum:c,ZodNativeEnum:f,ZodArray:d,ZodTuple:R,ZodUnion:h,ZodDiscriminatedUnion:k,ZodRecord:S,ZodMap:B,ZodSet:g,ZodIntersection:U,ZodPromise:m,ZodFunction:w}}function jn(t){return Object.values(t).some(e=>Object.values(e.host.params).some(n=>$t(n))||Object.values(e.path.params).some(n=>$t(n))||Object.values(e.query.params).some(n=>$t(n)))}function $t(t){return ct(t)&&"parse"in t&&typeof t.parse=="function"&&"~standard"in t&&ct(t["~standard"])&&"vendor"in t["~standard"]&&t["~standard"].vendor==="zod"}async function Zn(){try{A=await xn()}catch{throw new Error("Failed to initialize Zod")}}function ve(t){return A?t instanceof A.ZodSchema:!1}function Ae(t){return{get:(e,{invalid:n})=>{try{return qt(e,t)}catch{throw n()}},set:(e,{invalid:n})=>{try{return It(e,t)}catch{throw n()}}}}const Hn=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;function ut(t,e){if(typeof e=="string"&&Hn.test(e)){const n=new Date(e);return isNaN(n.getTime())?e:n}return e}function ft(t){for(const e of t)try{return e()}catch{continue}throw new Error("All functions failed")}function Ut(t,e){return A?.ZodString&&t instanceof A.ZodString?1:A?.ZodString&&e instanceof A.ZodString?-1:0}function qt(t,e){if(!A)throw new Error("Zod is not initialized");if(e instanceof A.ZodString)return e.parse(t);if(e instanceof A.ZodBoolean)return e.parse(!!t);if(e instanceof A.ZodDate)return e.parse(new Date(t));if(e instanceof A.ZodNumber)return e.parse(Number(t));if(e instanceof A.ZodLiteral)return ft([()=>e.parse(Number(t)),()=>e.parse(!!t),()=>e.parse(t)]);if(e instanceof A.ZodObject)return e.parse(JSON.parse(t,ut));if(e instanceof A.ZodEnum)return e.parse(t);if(e instanceof A.ZodNativeEnum)return ft([()=>e.parse(Number(t)),()=>e.parse(t)]);if(e instanceof A.ZodArray||e instanceof A.ZodTuple)return e.parse(JSON.parse(t,ut));if(e instanceof A.ZodUnion){const n=Array.from(e._def.options).sort(Ut).map(r=>()=>qt(t,r));return ft(n)}if(e instanceof A.ZodDiscriminatedUnion){const n=Array.from(e.options).sort(Ut).map(r=>()=>qt(t,r));return ft(n)}if(e instanceof A.ZodRecord)return e.parse(JSON.parse(t,ut));if(e instanceof A.ZodMap)return e.parse(new Map(JSON.parse(t,ut)));if(e instanceof A.ZodSet)return e.parse(new Set(JSON.parse(t,ut)));if(e instanceof A.ZodIntersection)throw new Error("Intersection schemas are not supported");if(e instanceof A.ZodPromise)throw new Error("Promise schemas are not supported");if(e instanceof A.ZodFunction)throw new Error("Function schemas are not supported");return e.parse(t)}function It(t,e){if(!A)throw new Error("Zod is not initialized");if(e instanceof A.ZodString)return e.parse(t);if(e instanceof A.ZodBoolean)return e.parse(t).toString();if(e instanceof A.ZodDate)return e.parse(t).toISOString();if(e instanceof A.ZodNumber)return e.parse(Number(t)).toString();if(e instanceof A.ZodLiteral)return e.parse(t).toString();if(e instanceof A.ZodObject)return JSON.stringify(e.parse(t));if(e instanceof A.ZodEnum)return e.parse(t);if(e instanceof A.ZodNativeEnum)return e.parse(t).toString();if(e instanceof A.ZodArray||e instanceof A.ZodTuple)return JSON.stringify(e.parse(t));if(e instanceof A.ZodUnion){const n=Array.from(e._def.options).sort(Ut).map(r=>()=>It(t,r));return ft(n)}if(e instanceof A.ZodDiscriminatedUnion){const n=Array.from(e.options).sort(Ut).map(r=>()=>It(t,r));return ft(n)}if(e instanceof A.ZodRecord)return JSON.stringify(e.parse(t));if(e instanceof A.ZodMap){const n=e.parse(t);return JSON.stringify(Array.from(n.entries()))}if(e instanceof A.ZodSet){const n=e.parse(t);return JSON.stringify(Array.from(n.values()))}if(e instanceof A.ZodIntersection)throw new Error("Intersection schemas are not supported");if(e instanceof A.ZodPromise)throw new Error("Promise schemas are not supported");if(e instanceof A.ZodFunction)throw new Error("Function schemas are not supported");return JSON.stringify(e.parse(t))}function Dt(t){return typeof t=="object"&&t!==null&&"then"in t}function C(t,e){const n=t["~standard"].validate(e);if(Dt(n))throw new Error("Promise schemas are not supported");if(n.issues)throw new Error("Validation failed");return n.value}function $n(t){return ct(t)&&"type"in t&&typeof t.type=="string"&&"~standard"in t&&ct(t["~standard"])&&"vendor"in t["~standard"]&&t["~standard"].vendor==="valibot"}function ke(t){return $n(t)}function Ue(t){return{get:(e,{invalid:n})=>{try{return _t(e,t)}catch{throw n()}},set:(e,{invalid:n})=>{try{return Jt(e,t)}catch{throw n()}}}}const qn=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;function lt(t,e){if(typeof e=="string"&&qn.test(e)){const n=new Date(e);return isNaN(n.getTime())?e:n}return e}function pt(t){for(const e of t)try{return e()}catch{continue}throw new Error("All functions failed")}function Lt(t,e){return t.type==="string"?1:e.type==="string"?-1:0}function _t(t,e){if(e.type==="boolean")return C(e,!!t);if(e.type==="date")return C(e,new Date(t));if(e.type==="number")return C(e,Number(t));if(e.type==="literal")return pt([()=>C(e,Number(t)),()=>C(e,!!t),()=>C(e,t)]);if(e.type==="object")return C(e,JSON.parse(t,lt));if(e.type==="enum")return pt([()=>C(e,Number(t)),()=>C(e,!!t),()=>C(e,t)]);if(e.type==="array"||e.type==="tuple")return C(e,JSON.parse(t,lt));if(e.type==="union"&&"options"in e){const n=e.options.sort(Lt).map(r=>()=>_t(t,r));return pt(n)}if(e.type==="variant"&&"options"in e){const n=e.options.sort(Lt).map(r=>()=>_t(t,r));return pt(n)}if(e.type==="record")return C(e,JSON.parse(t,lt));if(e.type==="map")return C(e,new Map(JSON.parse(t,lt)));if(e.type==="set")return C(e,new Set(JSON.parse(t,lt)));if(e.type==="intersection")throw new Error("Intersection schemas are not supported");if(e.type==="promise")throw new Error("Promise schemas are not supported");if(e.type==="function")throw new Error("Function schemas are not supported");return C(e,t)}function Jt(t,e){if(e.type==="string"||e.type==="boolean")return C(e,t).toString();if(e.type==="date")return C(e,t).toISOString();if(e.type==="number")return C(e,Number(t)).toString();if(e.type==="literal")return C(e,t).toString();if(e.type==="object")return JSON.stringify(C(e,t));if(e.type==="enum"||e.type==="nativeEnum")return C(e,t).toString();if(e.type==="array"||e.type==="tuple")return JSON.stringify(C(e,t));if(e.type==="union"&&"options"in e){const n=e.options.sort(Lt).map(r=>()=>Jt(t,r));return pt(n)}if(e.type==="variant"&&"options"in e){const n=e.options.sort(Lt).map(r=>()=>Jt(t,r));return pt(n)}if(e.type==="record")return JSON.stringify(C(e,t));if(e.type==="map"){const n=C(e,t);return JSON.stringify(Array.from(n.entries()))}if(e.type==="set"){const n=C(e,t);return JSON.stringify(Array.from(n.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(C(e,t))}function In(t,e){return t[e]??String}const x={invalid:t=>{throw new z(t)}},Le={get:t=>t,set:(t,{invalid:e})=>{if(typeof t!="string")throw e();return t}},Tt={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()}},Mt={get:(t,{invalid:e})=>{const n=Number(t);if(isNaN(n))throw e();return n},set:(t,{invalid:e})=>{if(typeof t!="number")throw e();return t.toString()}},Ve={get:(t,{invalid:e})=>{const n=new Date(t);if(isNaN(n.getTime()))throw e();return n},set:(t,{invalid:e})=>{if(typeof t!="object"||!(t instanceof Date))throw e();return t.toISOString()}},Ne={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 Dn(t,e){switch(typeof e){case"string":return Le.get(t,x)===e;case"number":return Mt.get(t,x)===e;case"boolean":return Tt.get(t,x)===e;default:return!1}}function tt(t,e,n=!1){if(t===void 0||!D(t)){if(Cn(e))return e.defaultValue;if(n)return;throw new z}if(e===String)return Le.get(t,x);if(e===Boolean)return Tt.get(t,x);if(e===Number)return Mt.get(t,x);if(e===Date)return Ve.get(t,x);if(e===JSON)return Ne.get(t,x);if(Nn(e))return e(t,x);if(kt(e))return e.get(t,x);if(e instanceof RegExp){if(e.test(t))return t;throw new z}if(Se(e)){if(Dn(t,e))return e;throw new z}return ve(e)?Ae(e).get(t,x):ke(e)?Ue(e).get(t,x):t}function Ft(t,e,n=!1){try{return tt(t,e,n)}catch(r){if(r instanceof z)return;throw r}}function _n(t,e,n=!1){try{return Y(t,e,n)}catch(r){if(r instanceof z)return;throw r}}function Y(t,e,n=!1){if(t===void 0){if(n)return"";throw new z}if(e===Boolean)return Tt.set(t,x);if(e===Number)return Mt.set(t,x);if(e===Date)return Ve.set(t,x);if(e===JSON)return Ne.set(t,x);if(kt(e))return e.set(t,x);if(Se(e)){if(e!==t)throw new z;return t.toString()}if(ve(e))return Ae(e).set(t,x);if(ke(e))return Ue(e).set(t,x);try{return t.toString()}catch{throw new z}}function Wt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Jn(t,e){const n=Array.from(t.matchAll(e));if(n.length===0)return[t];let r=0;const o=n.reduce((s,c)=>{const f=Wt(t.slice(r,c.index));f.length&&s.push(f);const[d]=c;return s.push(d),r=c.index+d.length,s},[]),a=t.slice(r);return a&&o.push(a),o}function Tn(t){const e=Ce(t.path.value);return new RegExp(`^${e}$`,"i")}function Mn(t){const e=new URLSearchParams(t.query.value);return Array.from(e.entries()).filter(([,n])=>!Qt(n)).map(([n,r])=>{const o=Ce(r);return new RegExp(`${Wt(n)}=${o}(&|$)`,"i")})}function Ce(t){return Jn(t,new RegExp(Vt,"g")).map(e=>e.startsWith(Rt)?Be(e):Wt(e)).join("")}function Be(t){return t.replace(new RegExp(Vt,"g"),Gn)}function Fn(t,e){const n=Oe(e);return t.replace(n,Qn)}function Gt(t,e){return zn(e).test(t.value)}function Qt(t){return new RegExp(Wn,"g").test(t)}const Vt=`\\${Rt}\\??([\\w-_]+)\\${At}`,Wn=`\\${Rt}\\?([\\w-_]+)\\${At}`,Gn=".*",Qn="(.*)";function zt(t){const[e]=xe(t,new RegExp(Vt,"g"));return e}function Oe(t){return new RegExp(`\\${Rt}\\??${t}\\${At}`,"g")}function zn(t){return new RegExp(`\\${Rt}\\?${t}\\${At}`,"g")}function xe(t,e){return Array.from(t.matchAll(e)).flatMap(([,...r])=>r.map(o=>D(o)?o:""))}function Yn(t="",e={}){return D(t)?Array.from(t.matchAll(new RegExp(Vt,"g"))).reduce((r,[o,a])=>{const s=zt(o);if(!s)return r;const c=In(e,s);return it([s],r),r[a]=c,r},{}):{}}function Kn(t){return ct(t)&&typeof t.value=="string"}function et(t){return t===void 0?G():Kn(t)?t:G(t,{})}function G(t,e){return{value:t??"",params:Yn(t,e)}}function je(t,e){it(t.params,e.params);const n=`${t.value}${e.value}`;return G(n,{...t.params,...e.params})}function Xn(t,e){return je(t,e)}class Ze extends Error{constructor(e){super(`Child property on meta for ${e} conflicts with the parent meta.`)}}function tr(t,e){return er(t,e),{...t,...e}}function er(t,e){const n=Object.keys(t).find(r=>r in e&&typeof e[r]!=typeof t[r]);if(n)throw new Ze(n)}function nr(t,e){it(t.params,e.params);const n=[t.value,e.value].filter(D).join("&");return G(n,{...t.params,...e.params})}function rr(t,e){return it(t,e),{...t,...e}}function Yt(t){return"parent"in t&&!!t.parent}function Kt(t){return"component"in t&&!!t.component}function Xt(t){return"props"in t&&typeof t.props=="function"}function te(t){return"components"in t&&!!t.components}function ee(t){return"props"in t&&typeof t.props=="object"}function ne(t,e){return{...e,path:je(t.path,e.path),query:nr(t.query,e.query),meta:tr(t.meta,e.meta),state:rr(t.state,e.state),hash:Xn(t.hash,e.hash),matches:[...t.matches,e.matched],host:t.host,depth:t.depth+1}}function _(t){return typeof t!="string"?!1:/^(https?:\/\/|\/).*/g.test(t)}function re(t){return _(t)?t:`/${t}`}class nt extends Error{constructor(){super("Router not installed")}}class He extends Error{constructor(e,n){super(`useRoute called with incorrect route. Given ${e}, expected ${n}`)}}function oe(){let t=0;return()=>(++t).toString()}const or=oe()();function ar(t){return t===or}const ae=oe();function $e(t){return t===void 0?"":t}function rt(t,e){const n=ae(),r=$e(t.name),o=et(t.path),a=et(t.query),s=et(t.hash),c=t.meta??{},f=t.state??{},d=l.markRaw({id:n,meta:c,state:f,...t,props:e}),R={id:n,matched:d,matches:[d],name:r,path:o,query:a,hash:s,meta:c,state:f,depth:1,host:G(),prefetch:t.prefetch},h=Yt(t)?ne(t.parent,R):R;return it(h.path.params,h.query.params,h.hash.params),h}function sr(t){const e=ae(),n=$e(t.name),r=et(t.path),o=et(t.query),a=et(t.hash),s=t.meta??{},c=et(t.host),f=l.markRaw({id:e,meta:{},state:{},...t}),d={id:e,matched:f,matches:[f],name:n,host:c,path:r,query:o,hash:a,meta:s,depth:1,state:{}},R=Yt(t)?ne(t.parent,d):d;return it(R.path.params,R.query.params,R.host.params,R.hash.params),R}function gt(){const t=new Map;return e=>{const n=t.get(e);if(!n){const r=Symbol();return t.set(e,r),r}return n}}const ir=gt();function se(t){const e=ir(t);return({increment:n=!1}={})=>{const r=l.inject(e,0);return n&&l.provide(e,r+1),r}}class qe extends Error{response;constructor(){super("Uncaught CallbackContextAbortError"),this.response={status:"ABORT"}}}class dt extends Error{response;constructor(e){super("Uncaught CallbackContextPushError"),this.response={status:"PUSH",to:e}}}class Nt extends Error{response;constructor(e){super("Uncaught CallbackContextRejectionError"),this.response={status:"REJECT",type:e}}}function Ie(){return{reject:o=>{throw new Nt(o)},push:(...o)=>{throw new dt(o)},replace:(o,a,s)=>{if(_(o)){const d=a??{};throw new dt([o,{...d,replace:!0}])}const c=a,f=s??{};throw new dt([o,c,{...f,replace:!0}])},abort:()=>{throw new qe}}}const wt=(t,e,n)=>{const r=t.matches,o=e?.matches??[];return r.at(n)?.id!==o.at(n)?.id},Et=(t,e,n)=>{const r=t.matches,o=e?.matches??[];return r.at(n)?.id!==o.at(n)?.id},bt=(t,e,n)=>t.matches.at(n)?.id===e?.matches.at(n)?.id;function De(t){switch(t){case"onBeforeRouteEnter":case"onAfterRouteEnter":return wt;case"onBeforeRouteUpdate":case"onAfterRouteUpdate":return bt;case"onBeforeRouteLeave":case"onAfterRouteLeave":return Et;default:throw new Error(`Switch is not exhaustive for lifecycle: ${t}`)}}class _e{onBeforeRouteEnter=new Set;onBeforeRouteUpdate=new Set;onBeforeRouteLeave=new Set;onAfterRouteEnter=new Set;onAfterRouteUpdate=new Set;onAfterRouteLeave=new Set}function cr(t,e){const n=new _e;return t.matches.forEach((r,o)=>{r.onBeforeRouteEnter&&wt(t,e,o)&&st(r.onBeforeRouteEnter).forEach(a=>n.onBeforeRouteEnter.add(a)),r.onBeforeRouteUpdate&&bt(t,e,o)&&st(r.onBeforeRouteUpdate).forEach(a=>n.onBeforeRouteUpdate.add(a))}),e?.matches.forEach((r,o)=>{r.onBeforeRouteLeave&&Et(t,e,o)&&st(r.onBeforeRouteLeave).forEach(a=>n.onBeforeRouteLeave.add(a))}),n}function ur(t,e){const n=new _e;return t.matches.forEach((r,o)=>{r.onAfterRouteEnter&&wt(t,e,o)&&st(r.onAfterRouteEnter).forEach(a=>n.onAfterRouteEnter.add(a)),r.onAfterRouteUpdate&&bt(t,e,o)&&st(r.onAfterRouteUpdate).forEach(a=>n.onAfterRouteUpdate.add(a))}),e?.matches.forEach((r,o)=>{r.onAfterRouteLeave&&Et(t,e,o)&&st(r.onAfterRouteLeave).forEach(a=>n.onAfterRouteLeave.add(a))}),n}class St{onBeforeRouteEnter=new Set;onBeforeRouteUpdate=new Set;onBeforeRouteLeave=new Set;onAfterRouteEnter=new Set;onAfterRouteUpdate=new Set;onAfterRouteLeave=new Set}function fr(t,e,n){const r=new St;return t.matches.forEach((o,a)=>{wt(t,e,a)&&n.onBeforeRouteEnter.forEach(s=>r.onBeforeRouteEnter.add(s)),bt(t,e,a)&&n.onBeforeRouteUpdate.forEach(s=>r.onBeforeRouteUpdate.add(s))}),e?.matches.forEach((o,a)=>{Et(t,e,a)&&n.onBeforeRouteLeave.forEach(s=>r.onBeforeRouteLeave.add(s))}),r}function lr(t,e,n){const r=new St;return t.matches.forEach((o,a)=>{wt(t,e,a)&&n.onAfterRouteEnter.forEach(s=>r.onAfterRouteEnter.add(s)),bt(t,e,a)&&n.onAfterRouteUpdate.forEach(s=>r.onAfterRouteUpdate.add(s))}),e?.matches.forEach((o,a)=>{Et(t,e,a)&&n.onAfterRouteLeave.forEach(s=>r.onAfterRouteLeave.add(s))}),r}function Je(){let t=null;function e(r){t=r}function n(r){return t?t.runWithContext(r):r()}return{setVueApp:e,runWithContext:n}}const Te=gt();function pr(t){const{setVueApp:e,runWithContext:n}=Je(),r={global:new St,component:new St},{reject:o,push:a,replace:s,abort:c}=Ie(),f=i=>(r.global.onBeforeRouteEnter.add(i),()=>r.global.onBeforeRouteEnter.delete(i)),d=i=>(r.global.onBeforeRouteUpdate.add(i),()=>r.global.onBeforeRouteUpdate.delete(i)),R=i=>(r.global.onBeforeRouteLeave.add(i),()=>r.global.onBeforeRouteLeave.delete(i)),h=i=>(r.global.onAfterRouteEnter.add(i),()=>r.global.onAfterRouteEnter.delete(i)),k=i=>(r.global.onAfterRouteUpdate.add(i),()=>r.global.onAfterRouteUpdate.delete(i)),S=i=>(r.global.onAfterRouteLeave.add(i),()=>r.global.onAfterRouteLeave.delete(i));async function B({to:i,from:u}){const{global:P,component:V}=r,y=cr(i,u),p=fr(i,u,P),E=[...p.onBeforeRouteEnter,...y.onBeforeRouteEnter,...p.onBeforeRouteUpdate,...y.onBeforeRouteUpdate,...V.onBeforeRouteUpdate,...p.onBeforeRouteLeave,...y.onBeforeRouteLeave,...V.onBeforeRouteLeave];try{const b=E.map(N=>n(()=>N(i,{from:u,reject:o,push:a,replace:s,abort:c})));await Promise.all(b)}catch(b){if(b instanceof dt||b instanceof Nt||b instanceof qe)return b.response;throw b}return{status:"SUCCESS"}}async function g({to:i,from:u}){const{global:P,component:V}=r,y=ur(i,u),p=lr(i,u,P),E=[...V.onAfterRouteLeave,...y.onAfterRouteLeave,...p.onAfterRouteLeave,...V.onAfterRouteUpdate,...y.onAfterRouteUpdate,...p.onAfterRouteUpdate,...V.onAfterRouteEnter,...y.onAfterRouteEnter,...p.onAfterRouteEnter];try{const b=E.map(N=>n(()=>N(i,{from:u,reject:o,push:a,replace:s})));await Promise.all(b)}catch(b){if(b instanceof dt||b instanceof Nt)return b.response;throw b}return{status:"SUCCESS"}}return{runBeforeRouteHooks:B,runAfterRouteHooks:g,addComponentBeforeRouteHook:({lifecycle:i,depth:u,hook:P})=>{const V=De(i),y=r.component[i],p=(E,b)=>{if(V(E,b.from,u))return P(E,b)};return y.add(p),()=>y.delete(p)},addComponentAfterRouteHook:({lifecycle:i,depth:u,hook:P})=>{const V=De(i),y=r.component[i],p=(E,b)=>{if(V(E,b.from,u))return P(E,b)};return y.add(p),()=>y.delete(p)},addGlobalRouteHooks:i=>{i.onBeforeRouteEnter.forEach(u=>f(u)),i.onBeforeRouteUpdate.forEach(u=>d(u)),i.onBeforeRouteLeave.forEach(u=>R(u)),i.onAfterRouteEnter.forEach(u=>h(u)),i.onAfterRouteUpdate.forEach(u=>k(u)),i.onAfterRouteLeave.forEach(u=>S(u))},onBeforeRouteEnter:f,onBeforeRouteUpdate:d,onBeforeRouteLeave:R,onAfterRouteEnter:h,onAfterRouteUpdate:k,onAfterRouteLeave:S,setVueApp:e}}function Me(t){const e=Te(t);return()=>{const n=l.inject(e);if(!n)throw new nt;return n}}function Fe(t,e){const n=se(t),r=Me(t);return o=>{const a=n(),c=r().addComponentBeforeRouteHook({lifecycle:e,hook:o,depth:a-1});return l.onUnmounted(c),c}}function We(t,e){const n=se(t),r=Me(t);return o=>{const a=n(),c=r().addComponentAfterRouteHook({lifecycle:e,hook:o,depth:a-1});return l.onUnmounted(c),c}}function dr(t){const e=Fe(t,"onBeforeRouteLeave"),n=Fe(t,"onBeforeRouteUpdate"),r=We(t,"onAfterRouteLeave"),o=We(t,"onAfterRouteUpdate");return{onBeforeRouteLeave:e,onBeforeRouteUpdate:n,onAfterRouteLeave:r,onAfterRouteUpdate:o}}const Ge=gt();function hr(t){const e=Ge(t);return()=>{const n=l.inject(e);if(!n)throw new nt;return n}}const Qe=gt();function mr(t){const e=Qe(t);return()=>{const n=l.inject(e);if(!n)throw new nt;return n}}function Pt(t){return()=>{const e=l.inject(t);if(!e)throw new nt;return e}}const ze=Symbol("isRouterRouteSymbol");function yr(t,e){return typeof e=="object"&&e!==null&&ze in e&&t in e}function Rr(t,e,n){function r(m,w,i){if(typeof m=="object"){const P={...e.params,...m};return n(e.name,P,w)}const u={...e.params,[m]:w};return n(e.name,u,i)}const o=(...m)=>{const w=new URLSearchParams(e.query);w.set(...m),r({},{query:w})},a=(...m)=>{const w=new URLSearchParams(e.query);w.append(...m),r({},{query:w})},s=(...m)=>{const w=new URLSearchParams(e.query);w.delete(...m),r({},{query:w})},{id:c,matched:f,matches:d,name:R,hash:h,href:k}=l.toRefs(e),S=l.computed({get(){return new Proxy(e.params,{set(m,w,i){return r(w,i),!0}})},set(m){r(m)}}),B=l.computed({get(){return new Proxy(e.query,{get(m,w,i){switch(w){case"append":return a;case"set":return o;case"delete":return s;default:return Reflect.get(m,w,i)}}})},set(m){r({},{query:m})}}),g=l.computed({get(){return new Proxy(e.state,{set(m,w,i){return r({},{state:{...e.state,[w]:i}}),!0}})},set(m){r({},{state:m})}});return l.reactive({id:c,matched:f,matches:d,state:g,query:B,hash:h,params:S,name:R,href:k,update:r,[ze]:!0,[t]:!0})}function ie(t){return(e,n,{exact:r}={})=>yr(t,e)?n===void 0?!0:r?e.matched.name===n:e.matches.map(o=>o.name).includes(n):!1}function Ct(t){const e=Pt(t),n=ie(t);return(r,o)=>{const a=e();function s(){if(!r)return;if(!n(a.route,r,o))throw new He(r,a.route.name)}return l.watch(a.route,s,{immediate:!0,deep:!0}),a.route}}function ce(t){const e=Ct(t),n=Pt(t),r=mr(t),o=se(t),a=hr(t);return l.defineComponent((s,c)=>{const f=e(),d=n(),R=r(),h=o({increment:!0});l.onServerPrefetch(async()=>{await d.start()});const{getRouteComponents:k}=a(),S=l.computed(()=>{if(!d.started.value)return null;if(R.value)return R.value.component;const B=f.matches.at(h);if(!B)return null;const g=k(B),U=s.name??"default";return g[U]});return()=>c.slots.default?c.slots.default({route:f,component:S,rejection:R.value}):S.value?l.h(S.value):null},{name:"RouterView",props:["name"]})}const Ye=gt();function Ke(t){const e=Ye(t);return()=>{const n=l.inject(e);if(!n)throw new nt;return n}}const gr="lazy",wr={components:!0,props:!1};function Bt(t){return["eager","lazy","intent"].includes(t)}function Xe({routerPrefetch:t,routePrefetch:e,linkPrefetch:n},r){const o=ue(n,r),a=ue(e,r),s=ue(t,r),c=[o,a,s,wr[r],gr].reduce((f,d)=>Bt(f)?f:f===!0&&Bt(d)?d:f===!0&&!Bt(d)?f:f===void 0?d:f,void 0);return Bt(c)?c:!1}function ue(t,e){return ct(t)?t[e]:t}const Er=l.defineAsyncComponent(()=>new Promise(t=>{t({default:{template:"foo"}})}));function tn(t){return t.name===Er.name&&"__asyncLoader"in t}const en=Symbol("visibilityObserver");function br(t){const e=l.inject(en);if(!e)throw new nt;return l.watch(t,(r,o)=>{r&&e.observe(r),o&&e.unobserve(o)},{immediate:!0}),l.onUnmounted(()=>{t.value&&e.unobserve(t.value)}),{isElementVisible:l.computed(()=>t.value?e.isElementVisible(t.value):!1)}}function nn(t,e,n){l.watch(t,(r,o)=>{r&&r.addEventListener(e,n),o&&o.removeEventListener(e,n)},{immediate:!0}),l.onUnmounted(()=>{t.value&&t.value.removeEventListener(e,n)})}function Sr(t){const e=Ke(t);return n=>{const r=new Map,o=l.ref(),{getPrefetchProps:a,setPrefetchProps:s}=e(),{isElementVisible:c}=br(o),f=()=>{const h=Array.from(r.values()).reduce((k,S)=>(Object.assign(k,S),k),{});s(h)};l.watch(()=>l.toValue(n),({route:h,...k})=>{r.clear(),h&&R("eager",h,k)},{immediate:!0}),l.watch(c,h=>{const{route:k,...S}=l.toValue(n);!k||!h||R("lazy",k,S)},{immediate:!0}),nn(o,"focusin",d),nn(o,"mouseover",d);function d(){const{route:h,...k}=l.toValue(n);h&&R("intent",h,k)}function R(h,k,S){Pr(h,k,S),r.has(h)||r.set(h,a(h,k,S))}return{element:o,commit:f}}}function Pr(t,e,n){e.matches.forEach(r=>{Xe({...n,routePrefetch:r.prefetch},"components")===t&&(Kt(r)&&tn(r.component)&&r.component.__asyncLoader(),te(r)&&Object.values(r.components).forEach(a=>{tn(a)&&a.__asyncLoader()}))})}function fe(...t){const e=new URLSearchParams;for(const n of t){const r=new URLSearchParams(n);for(const[o,a]of r.entries())e.append(o,a)}return e}function rn(t){const e=Pt(t),n=Sr(t),r=ie(t);return(o,a={},s={})=>{const c=e(),f=l.computed(()=>{const u=l.toValue(o);return typeof u!="string"?u:_(u)?c.find(u,l.toValue(s)):c.resolve(u,l.toValue(a),l.toValue(s))}),d=l.computed(()=>{if(f.value)return f.value.href;const u=l.toValue(o);if(_(u))return u;console.error(new Error("Failed to resolve route in RouterLink."))}),R=l.computed(()=>r(c.route)&&c.route.matches.some(u=>u.id===f.value?.id)),h=l.computed(()=>c.route.id===f.value?.id),k=l.computed(()=>r(c.route)&&On(f.value)&&c.route.href.startsWith(f.value.href)),S=l.computed(()=>c.route.href===f.value?.href),B=l.computed(()=>!!d.value&&c.isExternal(d.value)),g=l.computed(()=>{const u=l.toValue(o);return typeof u!="string"||_(u)?l.toValue(a):l.toValue(s)}),{element:U,commit:m}=n(()=>({route:f.value,routerPrefetch:c.prefetch,linkPrefetch:g.value.prefetch})),w=u=>{m();const P={replace:u?.replace??g.value.replace,query:fe(g.value.query,u?.query),hash:u?.hash??g.value.hash,state:{...g.value.state,...u?.state}},V=l.toValue(o);return _(V)||typeof V=="object"?c.push(V,P):c.push(V,l.toValue(a),P)};return{element:U,route:f,href:d,isMatch:R,isExactMatch:h,isActive:k,isExactActive:S,isExternal:B,push:w,replace:u=>w({...u,replace:!0})}}}function on(t){const e=Pt(t),n=rn(t);return l.defineComponent((r,o)=>{const a=e(),s=l.computed(()=>m(r.to)),c=l.computed(()=>w(r.to)),f=l.computed(()=>{const{to:u,...P}=r;return P}),{element:d,isMatch:R,isExactMatch:h,isActive:k,isExactActive:S,isExternal:B,push:g}=n(()=>typeof r.to=="function"?r.to(a.resolve):r.to,f),U=l.computed(()=>({"router-link--match":R.value,"router-link--exact-match":h.value,"router-link--active":k.value,"router-link--exact-active":S.value}));function m(u){if(typeof u=="function"){const P=u(a.resolve);return m(P)}return _(u)?a.find(u):u}function w(u){if(typeof u=="function"){const P=u(a.resolve);return w(P)}return _(u)?u:u?.href}function i(u){u.preventDefault(),g()}return()=>l.h("a",{href:c.value,class:["router-link",U.value],ref:d,onClick:i},o.slots.default?.({route:s.value,isMatch:R.value,isExactMatch:h.value,isActive:k.value,isExactActive:S.value,isExternal:B.value}))},{name:"RouterLink",props:["to","prefetch","query","hash","replace","state"]})}function vr(t){const e=Ct(t);return(n,r=String)=>{const o=e(),a=l.computed({get(){const c=o.query.get(l.toValue(n));return c===null?null:Ft(c,r)},set(c){o.query.set(l.toValue(n),Y(c,r))}}),s=l.computed({get(){return o.query.getAll(l.toValue(n)).map(f=>Ft(f,r)).filter(f=>f!==null)},set(c){const f=new URLSearchParams(o.query);f.delete(l.toValue(n)),c.forEach(d=>{f.append(l.toValue(n),Y(d,r))}),o.query=f}});return{value:a,values:s,remove:()=>{o.query.delete(l.toValue(n))}}}}function an(t){const e=typeof t=="object"?t.key:t,{onBeforeRouteLeave:n,onBeforeRouteUpdate:r,onAfterRouteLeave:o,onAfterRouteUpdate:a}=dr(e),s=ie(e),c=ce(e),f=on(e),d=Ct(e),R=Pt(e),h=vr(e),k=rn(e);return{onBeforeRouteLeave:n,onBeforeRouteUpdate:r,onAfterRouteLeave:o,onAfterRouteUpdate:a,isRoute:s,RouterView:c,RouterLink:f,useRoute:d,useRouter:R,useQueryValue:h,useLink:k}}function Ar(t){return{routes:t.routes??[],rejections:t.rejections??{},...t}}function sn(t){return{get:(e,{invalid:n})=>{for(const r of t){const o=Ft(e,r);if(o!==void 0)return o}throw n(`Value ${e} does not satisfy any of the possible values`)},set:(e,{invalid:n})=>{for(const r of t){const o=_n(e,r);if(o!==void 0)return o}throw n(`Value ${e} does not satisfy any of the possible values`)}}}const kr={separator:","};function Ur(t,e={}){const{separator:n}={...kr,...e},r=sn(t);return{get:(o,a)=>o.split(n).map(s=>r.get(s,a)),set:(o,a)=>{if(!Array.isArray(o))throw a.invalid("Expected an array");return o.map(s=>r.set(s,a)).join(n)}}}const Lr={separator:","};function Vr(t,e={}){const{separator:n}={...Lr,...e};return{get:r=>{const o=r.split(n);return t.map((a,s)=>tt(o.at(s),a))},set:(r,{invalid:o})=>{if(!Array.isArray(r))throw o("Expected a tuple");if(r.length!==t.length)throw o(`Expected tuple with ${t.length} values but received ${r.length} values`);return t.map((a,s)=>Y(r.at(s),a)).join(n)}}}function K(){return K=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},K.apply(null,arguments)}var H;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(H||(H={}));var ht=process.env.NODE_ENV!=="production"?function(t){return Object.freeze(t)}:function(t){return t};function ot(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}var Ot="beforeunload",Nr="hashchange",cn="popstate";function un(t){t===void 0&&(t={});var e=t,n=e.window,r=n===void 0?document.defaultView:n,o=r.history;function a(){var y=r.location,p=y.pathname,E=y.search,b=y.hash,N=o.state||{};return[N.idx,ht({pathname:p,search:E,hash:b,state:N.usr||null,key:N.key||"default"})]}var s=null;function c(){if(s)S.call(s),s=null;else{var y=H.Pop,p=a(),E=p[0],b=p[1];if(S.length)if(E!=null){var N=R-E;N&&(s={action:y,location:b,retry:function(){P(N*-1)}},P(N))}else process.env.NODE_ENV!=="production"&&ot(!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 w(y)}}r.addEventListener(cn,c);var f=H.Pop,d=a(),R=d[0],h=d[1],k=mt(),S=mt();R==null&&(R=0,o.replaceState(K({},o.state,{idx:R}),""));function B(y){return typeof y=="string"?y:at(y)}function g(y,p){return p===void 0&&(p=null),ht(K({pathname:h.pathname,hash:"",search:""},typeof y=="string"?vt(y):y,{state:p,key:jt()}))}function U(y,p){return[{usr:y.state,key:y.key,idx:p},B(y)]}function m(y,p,E){return!S.length||(S.call({action:y,location:p,retry:E}),!1)}function w(y){f=y;var p=a();R=p[0],h=p[1],k.call({action:f,location:h})}function i(y,p){var E=H.Push,b=g(y,p);function N(){i(y,p)}if(m(E,b,N)){var j=U(b,R+1),Z=j[0],$=j[1];try{o.pushState(Z,"",$)}catch{r.location.assign($)}w(E)}}function u(y,p){var E=H.Replace,b=g(y,p);function N(){u(y,p)}if(m(E,b,N)){var j=U(b,R),Z=j[0],$=j[1];o.replaceState(Z,"",$),w(E)}}function P(y){o.go(y)}var V={get action(){return f},get location(){return h},createHref:B,push:i,replace:u,go:P,back:function(){P(-1)},forward:function(){P(1)},listen:function(p){return k.push(p)},block:function(p){var E=S.push(p);return S.length===1&&r.addEventListener(Ot,xt),function(){E(),S.length||r.removeEventListener(Ot,xt)}}};return V}function Cr(t){t===void 0&&(t={});var e=t,n=e.window,r=n===void 0?document.defaultView:n,o=r.history;function a(){var p=vt(r.location.hash.substr(1)),E=p.pathname,b=E===void 0?"/":E,N=p.search,j=N===void 0?"":N,Z=p.hash,$=Z===void 0?"":Z,T=o.state||{};return[T.idx,ht({pathname:b,search:j,hash:$,state:T.usr||null,key:T.key||"default"})]}var s=null;function c(){if(s)S.call(s),s=null;else{var p=H.Pop,E=a(),b=E[0],N=E[1];if(S.length)if(b!=null){var j=R-b;j&&(s={action:p,location:N,retry:function(){V(j*-1)}},V(j))}else process.env.NODE_ENV!=="production"&&ot(!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 i(p)}}r.addEventListener(cn,c),r.addEventListener(Nr,function(){var p=a(),E=p[1];at(E)!==at(h)&&c()});var f=H.Pop,d=a(),R=d[0],h=d[1],k=mt(),S=mt();R==null&&(R=0,o.replaceState(K({},o.state,{idx:R}),""));function B(){var p=document.querySelector("base"),E="";if(p&&p.getAttribute("href")){var b=r.location.href,N=b.indexOf("#");E=N===-1?b:b.slice(0,N)}return E}function g(p){return B()+"#"+(typeof p=="string"?p:at(p))}function U(p,E){return E===void 0&&(E=null),ht(K({pathname:h.pathname,hash:"",search:""},typeof p=="string"?vt(p):p,{state:E,key:jt()}))}function m(p,E){return[{usr:p.state,key:p.key,idx:E},g(p)]}function w(p,E,b){return!S.length||(S.call({action:p,location:E,retry:b}),!1)}function i(p){f=p;var E=a();R=E[0],h=E[1],k.call({action:f,location:h})}function u(p,E){var b=H.Push,N=U(p,E);function j(){u(p,E)}if(process.env.NODE_ENV!=="production"&&ot(N.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.push("+JSON.stringify(p)+")"),w(b,N,j)){var Z=m(N,R+1),$=Z[0],T=Z[1];try{o.pushState($,"",T)}catch{r.location.assign(T)}i(b)}}function P(p,E){var b=H.Replace,N=U(p,E);function j(){P(p,E)}if(process.env.NODE_ENV!=="production"&&ot(N.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.replace("+JSON.stringify(p)+")"),w(b,N,j)){var Z=m(N,R),$=Z[0],T=Z[1];o.replaceState($,"",T),i(b)}}function V(p){o.go(p)}var y={get action(){return f},get location(){return h},createHref:g,push:u,replace:P,go:V,back:function(){V(-1)},forward:function(){V(1)},listen:function(E){return k.push(E)},block:function(E){var b=S.push(E);return S.length===1&&r.addEventListener(Ot,xt),function(){b(),S.length||r.removeEventListener(Ot,xt)}}};return y}function fn(t){t===void 0&&(t={});var e=t,n=e.initialEntries,r=n===void 0?["/"]:n,o=e.initialIndex,a=r.map(function(i){var u=ht(K({pathname:"/",search:"",hash:"",state:null,key:jt()},typeof i=="string"?vt(i):i));return process.env.NODE_ENV!=="production"&&ot(u.pathname.charAt(0)==="/","Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(i)+")"),u}),s=ln(o??a.length-1,0,a.length-1),c=H.Pop,f=a[s],d=mt(),R=mt();function h(i){return typeof i=="string"?i:at(i)}function k(i,u){return u===void 0&&(u=null),ht(K({pathname:f.pathname,search:"",hash:""},typeof i=="string"?vt(i):i,{state:u,key:jt()}))}function S(i,u,P){return!R.length||(R.call({action:i,location:u,retry:P}),!1)}function B(i,u){c=i,f=u,d.call({action:c,location:f})}function g(i,u){var P=H.Push,V=k(i,u);function y(){g(i,u)}process.env.NODE_ENV!=="production"&&ot(f.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.push("+JSON.stringify(i)+")"),S(P,V,y)&&(s+=1,a.splice(s,a.length,V),B(P,V))}function U(i,u){var P=H.Replace,V=k(i,u);function y(){U(i,u)}process.env.NODE_ENV!=="production"&&ot(f.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.replace("+JSON.stringify(i)+")"),S(P,V,y)&&(a[s]=V,B(P,V))}function m(i){var u=ln(s+i,0,a.length-1),P=H.Pop,V=a[u];function y(){m(i)}S(P,V,y)&&(s=u,B(P,V))}var w={get index(){return s},get action(){return c},get location(){return f},createHref:h,push:g,replace:U,go:m,back:function(){m(-1)},forward:function(){m(1)},listen:function(u){return d.push(u)},block:function(u){return R.push(u)}};return w}function ln(t,e,n){return Math.min(Math.max(t,e),n)}function xt(t){t.preventDefault(),t.returnValue=""}function mt(){var t=[];return{get length(){return t.length},push:function(n){return t.push(n),function(){t=t.filter(function(r){return r!==n})}},call:function(n){t.forEach(function(r){return r&&r(n)})}}}function jt(){return Math.random().toString(36).substr(2,8)}function at(t){var e=t.pathname,n=e===void 0?"/":e,r=t.search,o=r===void 0?"":r,a=t.hash,s=a===void 0?"":a;return o&&o!=="?"&&(n+=o.charAt(0)==="?"?o:"?"+o),s&&s!=="#"&&(n+=s.charAt(0)==="#"?s:"#"+s),n}function vt(t){var e={};if(t){var n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));var r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function Br(t,e,n){const r=l.reactive({...e}),o=c=>{Object.assign(r,{...c})},a=r,s=Rr(t,a,n);return{currentRoute:a,routerRoute:s,updateRoute:o}}function q(t){return!t.startsWith("http")?xr(t):Or(t)}function Or(t){const{protocol:e,host:n,pathname:r,search:o,searchParams:a,hash:s}=new URL(t,t);return{protocol:e,host:n,pathname:r,search:o,searchParams:a,hash:s}}function xr(t){const{pathname:e,search:n,searchParams:r,hash:o}=new URL(t,"https://localhost");return{pathname:e,search:n,searchParams:r,hash:o}}function jr(t){return e=>{const{host:n}=q(e);return!(n===void 0||n===t)}}function pn(t){try{const e=t();return Dt(e)?e.catch(n=>n):e}catch(e){return e}}function Zr(){const{setVueApp:t,runWithContext:e}=Je(),n=l.reactive(new Map),{push:r,replace:o,reject:a}=Ie(),s=(g,U,m)=>U.matches.filter(w=>Xe({...m,routePrefetch:w.prefetch},"props")===g).flatMap(w=>S(w)).reduce((w,{id:i,name:u,props:P})=>{if(!P)return w;const V=k(i,u,U),y=e(()=>pn(()=>P(U,{push:r,replace:o,reject:a,parent:R(U,!0)})));return w[V]=y,w},{}),c=g=>{Object.entries(g).forEach(([U,m])=>{n.set(U,m)})},f=async g=>{const U=g.matches.flatMap(S),m=[],w=[];for(const{id:i,name:u,props:P}of U){if(!P)continue;const V=k(i,u,g);if(m.push(V),!n.has(V)){const y=e(()=>pn(()=>P(g,{push:r,replace:o,reject:a,parent:R(g)})));n.set(V,y)}w.push((async()=>{const y=await n.get(V);if(y instanceof Error)throw y})())}B(m);try{return await Promise.all(w),{status:"SUCCESS"}}catch(i){if(i instanceof dt||i instanceof Nt)return i.response;throw i}},d=(g,U,m)=>{const w=k(g,U,m);return n.get(w)};function R(g,U=!1){const m=g.matches.at(-2);if(m)return Xt(m)?{name:m.name??"",get props(){return h(m,"default",g,U)}}:ee(m)?{name:m.name??"",props:new Proxy({},{get(w,i){return typeof i!="string"?Reflect.get(w,i):h(m,i,g,U)}})}:{name:m.name??"",props:void 0}}function h(g,U,m,w=!1){const i=d(g.id,U,m);if(w&&!i){const u=g.name??"unknown",P=m.name||"unknown";console.warn(`
|
|
2
|
-
Unable to access parent props "${
|
|
1
|
+
(function(L,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],l):(L=typeof globalThis<"u"?globalThis:L||self,l(L["@kitbag/router"]={},L.Vue))})(this,function(L,l){"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 ie(e){return Array.isArray(e)?e:[e]}function vt(e,t){return e.filter(n=>t===n).length}function ce(...e){const t=e.flatMap(n=>Array.isArray(n)?n:Object.keys(n));for(const n of t)if(vt(t,n)>1)throw new bt(n)}class z extends Error{}const ye="[",Ue="]";function Ln(e){return e!==String&&e!==Boolean&&e!==Number&&e!==Date}function Vn(e){return typeof e=="function"&&Ln(e)}function ke(e){return typeof e=="object"&&"get"in e&&typeof e.get=="function"&&"set"in e&&typeof e.set=="function"}function St(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function Pt(e,t){return ke(e)?{...e,defaultValue:t??e.defaultValue}:{get:n=>te(n,e),set:n=>Y(n,e),defaultValue:t}}function Nn(e){return ke(e)&&e.defaultValue!==void 0}function Bn(e,t){return Pt(e,t)}function Cn(e){return e!==void 0}function ue(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function I(e){return typeof e=="string"&&e.length>0}let A=null;async function On(){const{ZodSchema:e,ZodString:t,ZodBoolean:n,ZodDate:r,ZodNumber:o,ZodLiteral:a,ZodObject:s,ZodEnum:i,ZodNativeEnum:f,ZodArray:d,ZodTuple:R,ZodUnion:h,ZodDiscriminatedUnion:U,ZodRecord:v,ZodMap:C,ZodSet:g,ZodIntersection:k,ZodPromise:m,ZodFunction:w}=await import("zod");return{ZodSchema:e,ZodString:t,ZodBoolean:n,ZodDate:r,ZodNumber:o,ZodLiteral:a,ZodObject:s,ZodEnum:i,ZodNativeEnum:f,ZodArray:d,ZodTuple:R,ZodUnion:h,ZodDiscriminatedUnion:U,ZodRecord:v,ZodMap:C,ZodSet:g,ZodIntersection:k,ZodPromise:m,ZodFunction:w}}function xn(e){return Object.values(e).some(t=>Object.values(t.host.params).some(n=>$e(n))||Object.values(t.path.params).some(n=>$e(n))||Object.values(t.query.params).some(n=>$e(n)))}function $e(e){return ue(e)&&"parse"in e&&typeof e.parse=="function"&&"~standard"in e&&ue(e["~standard"])&&"vendor"in e["~standard"]&&e["~standard"].vendor==="zod"}async function jn(){try{A=await On()}catch{throw new Error("Failed to initialize Zod")}}function At(e){return A?e instanceof A.ZodSchema:!1}function Ut(e){return{get:(t,{invalid:n})=>{try{return qe(t,e)}catch{throw n()}},set:(t,{invalid:n})=>{try{return De(t,e)}catch{throw n()}}}}const Zn=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;function fe(e,t){if(typeof t=="string"&&Zn.test(t)){const n=new Date(t);return isNaN(n.getTime())?t:n}return t}function le(e){for(const t of e)try{return t()}catch{continue}throw new Error("All functions failed")}function Le(e,t){return A?.ZodString&&e instanceof A.ZodString?1:A?.ZodString&&t instanceof A.ZodString?-1:0}function qe(e,t){if(!A)throw new Error("Zod is not initialized");if(t instanceof A.ZodString)return t.parse(e);if(t instanceof A.ZodBoolean)return t.parse(!!e);if(t instanceof A.ZodDate)return t.parse(new Date(e));if(t instanceof A.ZodNumber)return t.parse(Number(e));if(t instanceof A.ZodLiteral)return le([()=>t.parse(Number(e)),()=>t.parse(!!e),()=>t.parse(e)]);if(t instanceof A.ZodObject)return t.parse(JSON.parse(e,fe));if(t instanceof A.ZodEnum)return t.parse(e);if(t instanceof A.ZodNativeEnum)return le([()=>t.parse(Number(e)),()=>t.parse(e)]);if(t instanceof A.ZodArray||t instanceof A.ZodTuple)return t.parse(JSON.parse(e,fe));if(t instanceof A.ZodUnion){const n=Array.from(t._def.options).sort(Le).map(r=>()=>qe(e,r));return le(n)}if(t instanceof A.ZodDiscriminatedUnion){const n=Array.from(t.options).sort(Le).map(r=>()=>qe(e,r));return le(n)}if(t instanceof A.ZodRecord)return t.parse(JSON.parse(e,fe));if(t instanceof A.ZodMap)return t.parse(new Map(JSON.parse(e,fe)));if(t instanceof A.ZodSet)return t.parse(new Set(JSON.parse(e,fe)));if(t instanceof A.ZodIntersection)throw new Error("Intersection schemas are not supported");if(t instanceof A.ZodPromise)throw new Error("Promise schemas are not supported");if(t instanceof A.ZodFunction)throw new Error("Function schemas are not supported");return t.parse(e)}function De(e,t){if(!A)throw new Error("Zod is not initialized");if(t instanceof A.ZodString)return t.parse(e);if(t instanceof A.ZodBoolean)return t.parse(e).toString();if(t instanceof A.ZodDate)return t.parse(e).toISOString();if(t instanceof A.ZodNumber)return t.parse(Number(e)).toString();if(t instanceof A.ZodLiteral)return t.parse(e).toString();if(t instanceof A.ZodObject)return JSON.stringify(t.parse(e));if(t instanceof A.ZodEnum)return t.parse(e);if(t instanceof A.ZodNativeEnum)return t.parse(e).toString();if(t instanceof A.ZodArray||t instanceof A.ZodTuple)return JSON.stringify(t.parse(e));if(t instanceof A.ZodUnion){const n=Array.from(t._def.options).sort(Le).map(r=>()=>De(e,r));return le(n)}if(t instanceof A.ZodDiscriminatedUnion){const n=Array.from(t.options).sort(Le).map(r=>()=>De(e,r));return le(n)}if(t instanceof A.ZodRecord)return JSON.stringify(t.parse(e));if(t instanceof A.ZodMap){const n=t.parse(e);return JSON.stringify(Array.from(n.entries()))}if(t instanceof A.ZodSet){const n=t.parse(e);return JSON.stringify(Array.from(n.values()))}if(t instanceof A.ZodIntersection)throw new Error("Intersection schemas are not supported");if(t instanceof A.ZodPromise)throw new Error("Promise schemas are not supported");if(t instanceof A.ZodFunction)throw new Error("Function schemas are not supported");return JSON.stringify(t.parse(e))}function _e(e){return typeof e=="object"&&e!==null&&"then"in e}function B(e,t){const n=e["~standard"].validate(t);if(_e(n))throw new Error("Promise schemas are not supported");if(n.issues)throw new Error("Validation failed");return n.value}function Hn(e){return ue(e)&&"type"in e&&typeof e.type=="string"&&"~standard"in e&&ue(e["~standard"])&&"vendor"in e["~standard"]&&e["~standard"].vendor==="valibot"}function kt(e){return Hn(e)}function Lt(e){return{get:(t,{invalid:n})=>{try{return Ie(t,e)}catch{throw n()}},set:(t,{invalid:n})=>{try{return Je(t,e)}catch{throw n()}}}}const $n=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;function pe(e,t){if(typeof t=="string"&&$n.test(t)){const n=new Date(t);return isNaN(n.getTime())?t:n}return t}function de(e){for(const t of e)try{return t()}catch{continue}throw new Error("All functions failed")}function Ve(e,t){return e.type==="string"?1:t.type==="string"?-1:0}function Ie(e,t){if(t.type==="boolean")return B(t,!!e);if(t.type==="date")return B(t,new Date(e));if(t.type==="number")return B(t,Number(e));if(t.type==="literal")return de([()=>B(t,Number(e)),()=>B(t,!!e),()=>B(t,e)]);if(t.type==="object")return B(t,JSON.parse(e,pe));if(t.type==="enum")return de([()=>B(t,Number(e)),()=>B(t,!!e),()=>B(t,e)]);if(t.type==="array"||t.type==="tuple")return B(t,JSON.parse(e,pe));if(t.type==="union"&&"options"in t){const n=t.options.sort(Ve).map(r=>()=>Ie(e,r));return de(n)}if(t.type==="variant"&&"options"in t){const n=t.options.sort(Ve).map(r=>()=>Ie(e,r));return de(n)}if(t.type==="record")return B(t,JSON.parse(e,pe));if(t.type==="map")return B(t,new Map(JSON.parse(e,pe)));if(t.type==="set")return B(t,new Set(JSON.parse(e,pe)));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 B(t,e)}function Je(e,t){if(t.type==="string"||t.type==="boolean")return B(t,e).toString();if(t.type==="date")return B(t,e).toISOString();if(t.type==="number")return B(t,Number(e)).toString();if(t.type==="literal")return B(t,e).toString();if(t.type==="object")return JSON.stringify(B(t,e));if(t.type==="enum"||t.type==="nativeEnum")return B(t,e).toString();if(t.type==="array"||t.type==="tuple")return JSON.stringify(B(t,e));if(t.type==="union"&&"options"in t){const n=t.options.sort(Ve).map(r=>()=>Je(e,r));return de(n)}if(t.type==="variant"&&"options"in t){const n=t.options.sort(Ve).map(r=>()=>Je(e,r));return de(n)}if(t.type==="record")return JSON.stringify(B(t,e));if(t.type==="map"){const n=B(t,e);return JSON.stringify(Array.from(n.entries()))}if(t.type==="set"){const n=B(t,e);return JSON.stringify(Array.from(n.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(B(t,e))}function qn(e,t){return e[t]??String}const x={invalid:e=>{throw new z(e)}},Vt={get:e=>e,set:(e,{invalid:t})=>{if(typeof e!="string")throw t();return e}},Te={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()}},Me={get:(e,{invalid:t})=>{const n=Number(e);if(isNaN(n))throw t();return n},set:(e,{invalid:t})=>{if(typeof e!="number")throw t();return e.toString()}},Nt={get:(e,{invalid:t})=>{const n=new Date(e);if(isNaN(n.getTime()))throw t();return n},set:(e,{invalid:t})=>{if(typeof e!="object"||!(e instanceof Date))throw t();return e.toISOString()}},Bt={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 Dn(e,t){switch(typeof t){case"string":return Vt.get(e,x)===t;case"number":return Me.get(e,x)===t;case"boolean":return Te.get(e,x)===t;default:return!1}}function te(e,t,n=!1){if(e===void 0||!I(e)){if(Nn(t))return t.defaultValue;if(n)return;throw new z}if(t===String)return Vt.get(e,x);if(t===Boolean)return Te.get(e,x);if(t===Number)return Me.get(e,x);if(t===Date)return Nt.get(e,x);if(t===JSON)return Bt.get(e,x);if(Vn(t))return t(e,x);if(ke(t))return t.get(e,x);if(t instanceof RegExp){if(t.test(e))return e;throw new z}if(St(t)){if(Dn(e,t))return t;throw new z}return At(t)?Ut(t).get(e,x):kt(t)?Lt(t).get(e,x):e}function Fe(e,t,n=!1){try{return te(e,t,n)}catch(r){if(r instanceof z)return;throw r}}function _n(e,t,n=!1){try{return Y(e,t,n)}catch(r){if(r instanceof z)return;throw r}}function Y(e,t,n=!1){if(e===void 0){if(n)return"";throw new z}if(t===Boolean)return Te.set(e,x);if(t===Number)return Me.set(e,x);if(t===Date)return Nt.set(e,x);if(t===JSON)return Bt.set(e,x);if(ke(t))return t.set(e,x);if(St(t)){if(t!==e)throw new z;return e.toString()}if(At(t))return Ut(t).set(e,x);if(kt(t))return Lt(t).set(e,x);try{return e.toString()}catch{throw new z}}function We(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function In(e,t){const n=Array.from(e.matchAll(t));if(n.length===0)return[e];let r=0;const o=n.reduce((s,i)=>{const f=We(e.slice(r,i.index));f.length&&s.push(f);const[d]=i;return s.push(d),r=i.index+d.length,s},[]),a=e.slice(r);return a&&o.push(a),o}function Jn(e){const t=Ct(e.path.value);return new RegExp(`^${t}$`,"i")}function Tn(e){const t=new URLSearchParams(e.query.value);return Array.from(t.entries()).filter(([,n])=>!Qe(n)).map(([n,r])=>{const o=Ct(r);return new RegExp(`${We(n)}=${o}(&|$)`,"i")})}function Ct(e){return In(e,new RegExp(Ne,"g")).map(t=>t.startsWith(ye)?Ot(t):We(t)).join("")}function Ot(e){return e.replace(new RegExp(Ne,"g"),Wn)}function Mn(e,t){const n=xt(t);return e.replace(n,Gn)}function Ge(e,t){return Qn(t).test(e.value)}function Qe(e){return new RegExp(Fn,"g").test(e)}const Ne=`\\${ye}\\??([\\w-_]+)\\${Ue}`,Fn=`\\${ye}\\?([\\w-_]+)\\${Ue}`,Wn=".*",Gn="(.*)";function ze(e){const[t]=jt(e,new RegExp(Ne,"g"));return t}function xt(e){return new RegExp(`\\${ye}\\??${e}\\${Ue}`,"g")}function Qn(e){return new RegExp(`\\${ye}\\?${e}\\${Ue}`,"g")}function jt(e,t){return Array.from(e.matchAll(t)).flatMap(([,...r])=>r.map(o=>I(o)?o:""))}function zn(e="",t={}){return I(e)?Array.from(e.matchAll(new RegExp(Ne,"g"))).reduce((r,[o,a])=>{const s=ze(o);if(!s)return r;const i=qn(t,s);return ce([s],r),r[a]=i,r},{}):{}}function Yn(e){return ue(e)&&typeof e.value=="string"}function ne(e){return e===void 0?G():Yn(e)?e:G(e,{})}function G(e,t){return{value:e??"",params:zn(e,t)}}function Zt(e,t){ce(e.params,t.params);const n=`${e.value}${t.value}`;return G(n,{...e.params,...t.params})}function Kn(e,t){return Zt(e,t)}class Ht extends Error{constructor(t){super(`Child property on meta for ${t} conflicts with the parent meta.`)}}function Xn(e,t){return er(e,t),{...e,...t}}function er(e,t){const n=Object.keys(e).find(r=>r in t&&typeof t[r]!=typeof e[r]);if(n)throw new Ht(n)}function tr(e,t){ce(e.params,t.params);const n=[e.value,t.value].filter(I).join("&");return G(n,{...e.params,...t.params})}function nr(e,t){return ce(e,t),{...e,...t}}function Ye(e){return"parent"in e&&!!e.parent}function Ke(e){return"component"in e&&!!e.component}function Xe(e){return"props"in e&&typeof e.props=="function"}function et(e){return"components"in e&&!!e.components}function tt(e){return"props"in e&&typeof e.props=="object"}function nt(e,t){return{...t,path:Zt(e.path,t.path),query:tr(e.query,t.query),meta:Xn(e.meta,t.meta),state:nr(e.state,t.state),hash:Kn(e.hash,t.hash),matches:[...e.matches,t.matched],host:e.host,depth:e.depth+1}}function q(e){return typeof e!="string"?!1:/^(https?:\/\/|\/).*/g.test(e)}function rt(e){return q(e)?e:`/${e}`}class re extends Error{constructor(){super("Router not installed")}}class $t extends Error{constructor(t,n){super(`useRoute called with incorrect route. Given ${t}, expected ${n}`)}}function ot(){let e=0;return()=>(++e).toString()}const rr=ot()();function or(e){return e===rr}const at=ot();function qt(e){return e===void 0?"":e}function oe(e,t){const n=at(),r=qt(e.name),o=ne(e.path),a=ne(e.query),s=ne(e.hash),i=e.meta??{},f=e.state??{},d=l.markRaw({id:n,meta:i,state:f,...e,props:t}),R={id:n,matched:d,matches:[d],name:r,path:o,query:a,hash:s,meta:i,state:f,depth:1,host:G(),prefetch:e.prefetch},h=Ye(e)?nt(e.parent,R):R;return ce(h.path.params,h.query.params,h.hash.params),h}function ar(e){const t=at(),n=qt(e.name),r=ne(e.path),o=ne(e.query),a=ne(e.hash),s=e.meta??{},i=ne(e.host),f=l.markRaw({id:t,meta:{},state:{},...e}),d={id:t,matched:f,matches:[f],name:n,host:i,path:r,query:o,hash:a,meta:s,depth:1,state:{}},R=Ye(e)?nt(e.parent,d):d;return ce(R.path.params,R.query.params,R.host.params,R.hash.params),R}function ge(){const e=new Map;return t=>{const n=e.get(t);if(!n){const r=Symbol();return e.set(t,r),r}return n}}const sr=ge();function st(e){const t=sr(e);return({increment:n=!1}={})=>{const r=l.inject(t,0);return n&&l.provide(t,r+1),r}}const we=(e,t,n)=>{const r=e.matches,o=t?.matches??[];return r.at(n)?.id!==o.at(n)?.id},Ee=(e,t,n)=>{const r=e.matches,o=t?.matches??[];return r.at(n)?.id!==o.at(n)?.id},be=(e,t,n)=>e.matches.at(n)?.id===t?.matches.at(n)?.id;function Dt(e){switch(e){case"onBeforeRouteEnter":case"onAfterRouteEnter":return we;case"onBeforeRouteUpdate":case"onAfterRouteUpdate":return be;case"onBeforeRouteLeave":case"onAfterRouteLeave":return Ee;default:throw new Error(`Switch is not exhaustive for lifecycle: ${e}`)}}class _t{onBeforeRouteEnter=new Set;onBeforeRouteUpdate=new Set;onBeforeRouteLeave=new Set;onAfterRouteEnter=new Set;onAfterRouteUpdate=new Set;onAfterRouteLeave=new Set}function ir(e,t){const n=new _t;return e.matches.forEach((r,o)=>{r.onBeforeRouteEnter&&we(e,t,o)&&ie(r.onBeforeRouteEnter).forEach(a=>{process.env.NODE_ENV==="development"&&console.warn("[vue-router] onBeforeRouteEnter is deprecated. Use router.onBeforeRouteEnter instead"),n.onBeforeRouteEnter.add(a)}),r.onBeforeRouteUpdate&&be(e,t,o)&&ie(r.onBeforeRouteUpdate).forEach(a=>{process.env.NODE_ENV==="development"&&console.warn("[vue-router] onBeforeRouteUpdate is deprecated. Use router.onBeforeRouteUpdate instead"),n.onBeforeRouteUpdate.add(a)})}),t?.matches.forEach((r,o)=>{r.onBeforeRouteLeave&&Ee(e,t,o)&&ie(r.onBeforeRouteLeave).forEach(a=>{process.env.NODE_ENV==="development"&&console.warn("[vue-router] onBeforeRouteLeave is deprecated. Use router.onBeforeRouteLeave instead"),n.onBeforeRouteLeave.add(a)})}),n}function cr(e,t){const n=new _t;return e.matches.forEach((r,o)=>{r.onAfterRouteEnter&&we(e,t,o)&&ie(r.onAfterRouteEnter).forEach(a=>{process.env.NODE_ENV==="development"&&console.warn("[vue-router] onAfterRouteEnter is deprecated. Use router.onAfterRouteEnter instead"),n.onAfterRouteEnter.add(a)}),r.onAfterRouteUpdate&&be(e,t,o)&&ie(r.onAfterRouteUpdate).forEach(a=>{process.env.NODE_ENV==="development"&&console.warn("[vue-router] onAfterRouteUpdate is deprecated. Use router.onAfterRouteUpdate instead"),n.onAfterRouteUpdate.add(a)})}),t?.matches.forEach((r,o)=>{r.onAfterRouteLeave&&Ee(e,t,o)&&ie(r.onAfterRouteLeave).forEach(a=>{process.env.NODE_ENV==="development"&&console.warn("[vue-router] onAfterRouteLeave is deprecated. Use router.onAfterRouteLeave instead"),n.onAfterRouteLeave.add(a)})}),n}class K extends Error{response;constructor(t){super("Uncaught CallbackContextPushError"),this.response={status:"PUSH",to:t}}}class ve extends Error{response;constructor(t){super("Uncaught CallbackContextRejectionError"),this.response={status:"REJECT",type:t}}}class it extends Error{response;constructor(){super("Uncaught CallbackContextAbortError"),this.response={status:"ABORT"}}}class Se{onBeforeRouteEnter=new Set;onBeforeRouteUpdate=new Set;onBeforeRouteLeave=new Set;onAfterRouteEnter=new Set;onAfterRouteUpdate=new Set;onAfterRouteLeave=new Set}function ur(e,t,n){const r=new Se;return e.matches.forEach((o,a)=>{we(e,t,a)&&n.onBeforeRouteEnter.forEach(s=>r.onBeforeRouteEnter.add(s)),be(e,t,a)&&n.onBeforeRouteUpdate.forEach(s=>r.onBeforeRouteUpdate.add(s))}),t?.matches.forEach((o,a)=>{Ee(e,t,a)&&n.onBeforeRouteLeave.forEach(s=>r.onBeforeRouteLeave.add(s))}),r}function fr(e,t,n){const r=new Se;return e.matches.forEach((o,a)=>{we(e,t,a)&&n.onAfterRouteEnter.forEach(s=>r.onAfterRouteEnter.add(s)),be(e,t,a)&&n.onAfterRouteUpdate.forEach(s=>r.onAfterRouteUpdate.add(s))}),t?.matches.forEach((o,a)=>{Ee(e,t,a)&&n.onAfterRouteLeave.forEach(s=>r.onAfterRouteLeave.add(s))}),r}function It(){let e=null;function t(r){e=r}function n(r){return e?e.runWithContext(r):r()}return{setVueApp:t,runWithContext:n}}function lr(e){return{reject:a=>{throw new ve(a)},push:(...a)=>{throw new K(a)},replace:(a,s,i)=>{if(q(a)){const R=s??{};throw new K([a,{...R,replace:!0}])}const f=s,d=i??{};throw new K([a,f,{...d,replace:!0}])},abort:()=>{throw new it}}}const Jt=ge();function pr(e){const{setVueApp:t,runWithContext:n}=It(),r={global:new Se,component:new Se},{reject:o,push:a,replace:s,abort:i}=lr(),f=c=>(r.global.onBeforeRouteEnter.add(c),()=>r.global.onBeforeRouteEnter.delete(c)),d=c=>(r.global.onBeforeRouteUpdate.add(c),()=>r.global.onBeforeRouteUpdate.delete(c)),R=c=>(r.global.onBeforeRouteLeave.add(c),()=>r.global.onBeforeRouteLeave.delete(c)),h=c=>(r.global.onAfterRouteEnter.add(c),()=>r.global.onAfterRouteEnter.delete(c)),U=c=>(r.global.onAfterRouteUpdate.add(c),()=>r.global.onAfterRouteUpdate.delete(c)),v=c=>(r.global.onAfterRouteLeave.add(c),()=>r.global.onAfterRouteLeave.delete(c));async function C({to:c,from:u}){const{global:S,component:V}=r,y=ir(c,u),p=ur(c,u,S),E=[...p.onBeforeRouteEnter,...y.onBeforeRouteEnter,...p.onBeforeRouteUpdate,...y.onBeforeRouteUpdate,...V.onBeforeRouteUpdate,...p.onBeforeRouteLeave,...y.onBeforeRouteLeave,...V.onBeforeRouteLeave];try{const b=E.map(N=>n(()=>N(c,{from:u,reject:o,push:a,replace:s,abort:i})));await Promise.all(b)}catch(b){if(b instanceof K||b instanceof ve||b instanceof it)return b.response;throw b}return{status:"SUCCESS"}}async function g({to:c,from:u}){const{global:S,component:V}=r,y=cr(c,u),p=fr(c,u,S),E=[...V.onAfterRouteLeave,...y.onAfterRouteLeave,...p.onAfterRouteLeave,...V.onAfterRouteUpdate,...y.onAfterRouteUpdate,...p.onAfterRouteUpdate,...V.onAfterRouteEnter,...y.onAfterRouteEnter,...p.onAfterRouteEnter];try{const b=E.map(N=>n(()=>N(c,{from:u,reject:o,push:a,replace:s})));await Promise.all(b)}catch(b){if(b instanceof K||b instanceof ve)return b.response;throw b}return{status:"SUCCESS"}}return{runBeforeRouteHooks:C,runAfterRouteHooks:g,addComponentBeforeRouteHook:({lifecycle:c,depth:u,hook:S})=>{const V=Dt(c),y=r.component[c],p=(E,b)=>{if(V(E,b.from,u))return S(E,b)};return y.add(p),()=>y.delete(p)},addComponentAfterRouteHook:({lifecycle:c,depth:u,hook:S})=>{const V=Dt(c),y=r.component[c],p=(E,b)=>{if(V(E,b.from,u))return S(E,b)};return y.add(p),()=>y.delete(p)},addGlobalRouteHooks:c=>{c.onBeforeRouteEnter.forEach(u=>f(u)),c.onBeforeRouteUpdate.forEach(u=>d(u)),c.onBeforeRouteLeave.forEach(u=>R(u)),c.onAfterRouteEnter.forEach(u=>h(u)),c.onAfterRouteUpdate.forEach(u=>U(u)),c.onAfterRouteLeave.forEach(u=>v(u))},onBeforeRouteEnter:f,onBeforeRouteUpdate:d,onBeforeRouteLeave:R,onAfterRouteEnter:h,onAfterRouteUpdate:U,onAfterRouteLeave:v,setVueApp:t}}function Tt(e){const t=Jt(e);return()=>{const n=l.inject(t);if(!n)throw new re;return n}}function Mt(e,t){const n=st(e),r=Tt(e);return o=>{const a=n(),i=r().addComponentBeforeRouteHook({lifecycle:t,hook:o,depth:a-1});return l.onUnmounted(i),i}}function Ft(e,t){const n=st(e),r=Tt(e);return o=>{const a=n(),i=r().addComponentAfterRouteHook({lifecycle:t,hook:o,depth:a-1});return l.onUnmounted(i),i}}function dr(e){const t=Mt(e,"onBeforeRouteLeave"),n=Mt(e,"onBeforeRouteUpdate"),r=Ft(e,"onAfterRouteLeave"),o=Ft(e,"onAfterRouteUpdate");return{onBeforeRouteLeave:t,onBeforeRouteUpdate:n,onAfterRouteLeave:r,onAfterRouteUpdate:o}}const Wt=ge();function hr(e){const t=Wt(e);return()=>{const n=l.inject(t);if(!n)throw new re;return n}}const Gt=ge();function mr(e){const t=Gt(e);return()=>{const n=l.inject(t);if(!n)throw new re;return n}}function Pe(e){return()=>{const t=l.inject(e);if(!t)throw new re;return t}}const Qt=Symbol("isRouterRouteSymbol");function Rr(e,t){return typeof t=="object"&&t!==null&&Qt in t&&e in t}function yr(e,t,n){function r(m,w,c){if(typeof m=="object"){const S={...t.params,...m};return n(t.name,S,w)}const u={...t.params,[m]:w};return n(t.name,u,c)}const o=(...m)=>{const w=new URLSearchParams(t.query);w.set(...m),r({},{query:w})},a=(...m)=>{const w=new URLSearchParams(t.query);w.append(...m),r({},{query:w})},s=(...m)=>{const w=new URLSearchParams(t.query);w.delete(...m),r({},{query:w})},{id:i,matched:f,matches:d,name:R,hash:h,href:U}=l.toRefs(t),v=l.computed({get(){return new Proxy(t.params,{set(m,w,c){return r(w,c),!0}})},set(m){r(m)}}),C=l.computed({get(){return new Proxy(t.query,{get(m,w,c){switch(w){case"append":return a;case"set":return o;case"delete":return s;default:return Reflect.get(m,w,c)}}})},set(m){r({},{query:m})}}),g=l.computed({get(){return new Proxy(t.state,{set(m,w,c){return r({},{state:{...t.state,[w]:c}}),!0}})},set(m){r({},{state:m})}});return l.reactive({id:i,matched:f,matches:d,state:g,query:C,hash:h,params:v,name:R,href:U,update:r,[Qt]:!0,[e]:!0})}function ct(e){return(t,n,{exact:r}={})=>Rr(e,t)?n===void 0?!0:r?t.matched.name===n:t.matches.map(o=>o.name).includes(n):!1}function Be(e){const t=Pe(e),n=ct(e);return(r,o)=>{const a=t();function s(){if(!r)return;if(!n(a.route,r,o))throw new $t(r,a.route.name)}return l.watch(a.route,s,{immediate:!0,deep:!0}),a.route}}function ut(e){const t=Be(e),n=Pe(e),r=mr(e),o=st(e),a=hr(e);return l.defineComponent((s,i)=>{const f=t(),d=n(),R=r(),h=o({increment:!0});l.onServerPrefetch(async()=>{await d.start()});const{getRouteComponents:U}=a(),v=l.computed(()=>{if(!d.started.value)return null;if(R.value)return R.value.component;const C=f.matches.at(h);if(!C)return null;const g=U(C),k=s.name??"default";return g[k]});return()=>i.slots.default?i.slots.default({route:f,component:v,rejection:R.value}):v.value?l.h(v.value):null},{name:"RouterView",props:["name"]})}const zt=ge();function Yt(e){const t=zt(e);return()=>{const n=l.inject(t);if(!n)throw new re;return n}}const gr="lazy",wr={components:!0,props:!1};function Ce(e){return["eager","lazy","intent"].includes(e)}function Kt({routerPrefetch:e,routePrefetch:t,linkPrefetch:n},r){const o=ft(n,r),a=ft(t,r),s=ft(e,r),i=[o,a,s,wr[r],gr].reduce((f,d)=>Ce(f)?f:f===!0&&Ce(d)?d:f===!0&&!Ce(d)?f:f===void 0?d:f,void 0);return Ce(i)?i:!1}function ft(e,t){return ue(e)?e[t]:e}const Er=l.defineAsyncComponent(()=>new Promise(e=>{e({default:{template:"foo"}})}));function Xt(e){return e.name===Er.name&&"__asyncLoader"in e}const en=Symbol("visibilityObserver");function br(e){const t=l.inject(en);if(!t)throw new re;return l.watch(e,(r,o)=>{r&&t.observe(r),o&&t.unobserve(o)},{immediate:!0}),l.onUnmounted(()=>{e.value&&t.unobserve(e.value)}),{isElementVisible:l.computed(()=>e.value?t.isElementVisible(e.value):!1)}}function tn(e,t,n){l.watch(e,(r,o)=>{r&&r.addEventListener(t,n),o&&o.removeEventListener(t,n)},{immediate:!0}),l.onUnmounted(()=>{e.value&&e.value.removeEventListener(t,n)})}function vr(e){const t=Yt(e);return n=>{const r=new Map,o=l.ref(),{getPrefetchProps:a,setPrefetchProps:s}=t(),{isElementVisible:i}=br(o),f=()=>{const h=Array.from(r.values()).reduce((U,v)=>(Object.assign(U,v),U),{});s(h)};l.watch(()=>l.toValue(n),({route:h,...U})=>{r.clear(),h&&R("eager",h,U)},{immediate:!0}),l.watch(i,h=>{const{route:U,...v}=l.toValue(n);!U||!h||R("lazy",U,v)},{immediate:!0}),tn(o,"focusin",d),tn(o,"mouseover",d);function d(){const{route:h,...U}=l.toValue(n);h&&R("intent",h,U)}function R(h,U,v){Sr(h,U,v),r.has(h)||r.set(h,a(h,U,v))}return{element:o,commit:f}}}function Sr(e,t,n){t.matches.forEach(r=>{Kt({...n,routePrefetch:r.prefetch},"components")===e&&(Ke(r)&&Xt(r.component)&&r.component.__asyncLoader(),et(r)&&Object.values(r.components).forEach(a=>{Xt(a)&&a.__asyncLoader()}))})}function lt(...e){const t=new URLSearchParams;for(const n of e){const r=new URLSearchParams(n);for(const[o,a]of r.entries())t.append(o,a)}return t}function nn(e){const t=Pe(e),n=vr(e),r=ct(e);return(o,a={},s={})=>{const i=t(),f=l.computed(()=>{const u=l.toValue(o);return typeof u!="string"?u:q(u)?i.find(u,l.toValue(s)):i.resolve(u,l.toValue(a),l.toValue(s))}),d=l.computed(()=>{if(f.value)return f.value.href;const u=l.toValue(o);if(q(u))return u;console.error(new Error("Failed to resolve route in RouterLink."))}),R=l.computed(()=>r(i.route)&&i.route.matches.some(u=>u.id===f.value?.id)),h=l.computed(()=>i.route.id===f.value?.id),U=l.computed(()=>r(i.route)&&Cn(f.value)&&i.route.href.startsWith(f.value.href)),v=l.computed(()=>i.route.href===f.value?.href),C=l.computed(()=>!!d.value&&i.isExternal(d.value)),g=l.computed(()=>{const u=l.toValue(o);return typeof u!="string"||q(u)?l.toValue(a):l.toValue(s)}),{element:k,commit:m}=n(()=>({route:f.value,routerPrefetch:i.prefetch,linkPrefetch:g.value.prefetch})),w=u=>{m();const S={replace:u?.replace??g.value.replace,query:lt(g.value.query,u?.query),hash:u?.hash??g.value.hash,state:{...g.value.state,...u?.state}},V=l.toValue(o);return q(V)||typeof V=="object"?i.push(V,S):i.push(V,l.toValue(a),S)};return{element:k,route:f,href:d,isMatch:R,isExactMatch:h,isActive:U,isExactActive:v,isExternal:C,push:w,replace:u=>w({...u,replace:!0})}}}function rn(e){const t=Pe(e),n=nn(e);return l.defineComponent((r,o)=>{const a=t(),s=l.computed(()=>m(r.to)),i=l.computed(()=>w(r.to)),f=l.computed(()=>{const{to:u,...S}=r;return S}),{element:d,isMatch:R,isExactMatch:h,isActive:U,isExactActive:v,isExternal:C,push:g}=n(()=>typeof r.to=="function"?r.to(a.resolve):r.to,f),k=l.computed(()=>({"router-link--match":R.value,"router-link--exact-match":h.value,"router-link--active":U.value,"router-link--exact-active":v.value}));function m(u){if(typeof u=="function"){const S=u(a.resolve);return m(S)}return q(u)?a.find(u):u}function w(u){if(typeof u=="function"){const S=u(a.resolve);return w(S)}return q(u)?u:u?.href}function c(u){u.preventDefault(),g()}return()=>l.h("a",{href:i.value,class:["router-link",k.value],ref:d,onClick:c},o.slots.default?.({route:s.value,isMatch:R.value,isExactMatch:h.value,isActive:U.value,isExactActive:v.value,isExternal:C.value}))},{name:"RouterLink",props:["to","prefetch","query","hash","replace","state"]})}function Pr(e){const t=Be(e);return(n,r=String)=>{const o=t(),a=l.computed({get(){const i=o.query.get(l.toValue(n));return i===null?null:Fe(i,r)},set(i){o.query.set(l.toValue(n),Y(i,r))}}),s=l.computed({get(){return o.query.getAll(l.toValue(n)).map(f=>Fe(f,r)).filter(f=>f!==null)},set(i){const f=new URLSearchParams(o.query);f.delete(l.toValue(n)),i.forEach(d=>{f.append(l.toValue(n),Y(d,r))}),o.query=f}});return{value:a,values:s,remove:()=>{o.query.delete(l.toValue(n))}}}}function on(e){const t=typeof e=="object"?e.key:e,{onBeforeRouteLeave:n,onBeforeRouteUpdate:r,onAfterRouteLeave:o,onAfterRouteUpdate:a}=dr(t),s=ct(t),i=ut(t),f=rn(t),d=Be(t),R=Pe(t),h=Pr(t),U=nn(t);return{onBeforeRouteLeave:n,onBeforeRouteUpdate:r,onAfterRouteLeave:o,onAfterRouteUpdate:a,isRoute:s,RouterView:i,RouterLink:f,useRoute:d,useRouter:R,useQueryValue:h,useLink:U}}function Ar(e){return{routes:e.routes??[],rejections:e.rejections??{},...e}}function an(e){return{get:(t,{invalid:n})=>{for(const r of e){const o=Fe(t,r);if(o!==void 0)return o}throw n(`Value ${t} does not satisfy any of the possible values`)},set:(t,{invalid:n})=>{for(const r of e){const o=_n(t,r);if(o!==void 0)return o}throw n(`Value ${t} does not satisfy any of the possible values`)}}}const Ur={separator:","};function kr(e,t={}){const{separator:n}={...Ur,...t},r=an(e);return{get:(o,a)=>o.split(n).map(s=>r.get(s,a)),set:(o,a)=>{if(!Array.isArray(o))throw a.invalid("Expected an array");return o.map(s=>r.set(s,a)).join(n)}}}const Lr={separator:","};function Vr(e,t={}){const{separator:n}={...Lr,...t};return{get:r=>{const o=r.split(n);return e.map((a,s)=>te(o.at(s),a))},set:(r,{invalid:o})=>{if(!Array.isArray(r))throw o("Expected a tuple");if(r.length!==e.length)throw o(`Expected tuple with ${e.length} values but received ${r.length} values`);return e.map((a,s)=>Y(r.at(s),a)).join(n)}}}function X(){return X=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},X.apply(null,arguments)}var H;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(H||(H={}));var he=process.env.NODE_ENV!=="production"?function(e){return Object.freeze(e)}:function(e){return e};function ae(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}var Oe="beforeunload",Nr="hashchange",sn="popstate";function cn(e){e===void 0&&(e={});var t=e,n=t.window,r=n===void 0?document.defaultView:n,o=r.history;function a(){var y=r.location,p=y.pathname,E=y.search,b=y.hash,N=o.state||{};return[N.idx,he({pathname:p,search:E,hash:b,state:N.usr||null,key:N.key||"default"})]}var s=null;function i(){if(s)v.call(s),s=null;else{var y=H.Pop,p=a(),E=p[0],b=p[1];if(v.length)if(E!=null){var N=R-E;N&&(s={action:y,location:b,retry:function(){S(N*-1)}},S(N))}else process.env.NODE_ENV!=="production"&&ae(!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 w(y)}}r.addEventListener(sn,i);var f=H.Pop,d=a(),R=d[0],h=d[1],U=me(),v=me();R==null&&(R=0,o.replaceState(X({},o.state,{idx:R}),""));function C(y){return typeof y=="string"?y:se(y)}function g(y,p){return p===void 0&&(p=null),he(X({pathname:h.pathname,hash:"",search:""},typeof y=="string"?Ae(y):y,{state:p,key:je()}))}function k(y,p){return[{usr:y.state,key:y.key,idx:p},C(y)]}function m(y,p,E){return!v.length||(v.call({action:y,location:p,retry:E}),!1)}function w(y){f=y;var p=a();R=p[0],h=p[1],U.call({action:f,location:h})}function c(y,p){var E=H.Push,b=g(y,p);function N(){c(y,p)}if(m(E,b,N)){var j=k(b,R+1),Z=j[0],$=j[1];try{o.pushState(Z,"",$)}catch{r.location.assign($)}w(E)}}function u(y,p){var E=H.Replace,b=g(y,p);function N(){u(y,p)}if(m(E,b,N)){var j=k(b,R),Z=j[0],$=j[1];o.replaceState(Z,"",$),w(E)}}function S(y){o.go(y)}var V={get action(){return f},get location(){return h},createHref:C,push:c,replace:u,go:S,back:function(){S(-1)},forward:function(){S(1)},listen:function(p){return U.push(p)},block:function(p){var E=v.push(p);return v.length===1&&r.addEventListener(Oe,xe),function(){E(),v.length||r.removeEventListener(Oe,xe)}}};return V}function Br(e){e===void 0&&(e={});var t=e,n=t.window,r=n===void 0?document.defaultView:n,o=r.history;function a(){var p=Ae(r.location.hash.substr(1)),E=p.pathname,b=E===void 0?"/":E,N=p.search,j=N===void 0?"":N,Z=p.hash,$=Z===void 0?"":Z,T=o.state||{};return[T.idx,he({pathname:b,search:j,hash:$,state:T.usr||null,key:T.key||"default"})]}var s=null;function i(){if(s)v.call(s),s=null;else{var p=H.Pop,E=a(),b=E[0],N=E[1];if(v.length)if(b!=null){var j=R-b;j&&(s={action:p,location:N,retry:function(){V(j*-1)}},V(j))}else process.env.NODE_ENV!=="production"&&ae(!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 c(p)}}r.addEventListener(sn,i),r.addEventListener(Nr,function(){var p=a(),E=p[1];se(E)!==se(h)&&i()});var f=H.Pop,d=a(),R=d[0],h=d[1],U=me(),v=me();R==null&&(R=0,o.replaceState(X({},o.state,{idx:R}),""));function C(){var p=document.querySelector("base"),E="";if(p&&p.getAttribute("href")){var b=r.location.href,N=b.indexOf("#");E=N===-1?b:b.slice(0,N)}return E}function g(p){return C()+"#"+(typeof p=="string"?p:se(p))}function k(p,E){return E===void 0&&(E=null),he(X({pathname:h.pathname,hash:"",search:""},typeof p=="string"?Ae(p):p,{state:E,key:je()}))}function m(p,E){return[{usr:p.state,key:p.key,idx:E},g(p)]}function w(p,E,b){return!v.length||(v.call({action:p,location:E,retry:b}),!1)}function c(p){f=p;var E=a();R=E[0],h=E[1],U.call({action:f,location:h})}function u(p,E){var b=H.Push,N=k(p,E);function j(){u(p,E)}if(process.env.NODE_ENV!=="production"&&ae(N.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.push("+JSON.stringify(p)+")"),w(b,N,j)){var Z=m(N,R+1),$=Z[0],T=Z[1];try{o.pushState($,"",T)}catch{r.location.assign(T)}c(b)}}function S(p,E){var b=H.Replace,N=k(p,E);function j(){S(p,E)}if(process.env.NODE_ENV!=="production"&&ae(N.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.replace("+JSON.stringify(p)+")"),w(b,N,j)){var Z=m(N,R),$=Z[0],T=Z[1];o.replaceState($,"",T),c(b)}}function V(p){o.go(p)}var y={get action(){return f},get location(){return h},createHref:g,push:u,replace:S,go:V,back:function(){V(-1)},forward:function(){V(1)},listen:function(E){return U.push(E)},block:function(E){var b=v.push(E);return v.length===1&&r.addEventListener(Oe,xe),function(){b(),v.length||r.removeEventListener(Oe,xe)}}};return y}function un(e){e===void 0&&(e={});var t=e,n=t.initialEntries,r=n===void 0?["/"]:n,o=t.initialIndex,a=r.map(function(c){var u=he(X({pathname:"/",search:"",hash:"",state:null,key:je()},typeof c=="string"?Ae(c):c));return process.env.NODE_ENV!=="production"&&ae(u.pathname.charAt(0)==="/","Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(c)+")"),u}),s=fn(o??a.length-1,0,a.length-1),i=H.Pop,f=a[s],d=me(),R=me();function h(c){return typeof c=="string"?c:se(c)}function U(c,u){return u===void 0&&(u=null),he(X({pathname:f.pathname,search:"",hash:""},typeof c=="string"?Ae(c):c,{state:u,key:je()}))}function v(c,u,S){return!R.length||(R.call({action:c,location:u,retry:S}),!1)}function C(c,u){i=c,f=u,d.call({action:i,location:f})}function g(c,u){var S=H.Push,V=U(c,u);function y(){g(c,u)}process.env.NODE_ENV!=="production"&&ae(f.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.push("+JSON.stringify(c)+")"),v(S,V,y)&&(s+=1,a.splice(s,a.length,V),C(S,V))}function k(c,u){var S=H.Replace,V=U(c,u);function y(){k(c,u)}process.env.NODE_ENV!=="production"&&ae(f.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.replace("+JSON.stringify(c)+")"),v(S,V,y)&&(a[s]=V,C(S,V))}function m(c){var u=fn(s+c,0,a.length-1),S=H.Pop,V=a[u];function y(){m(c)}v(S,V,y)&&(s=u,C(S,V))}var w={get index(){return s},get action(){return i},get location(){return f},createHref:h,push:g,replace:k,go:m,back:function(){m(-1)},forward:function(){m(1)},listen:function(u){return d.push(u)},block:function(u){return R.push(u)}};return w}function fn(e,t,n){return Math.min(Math.max(e,t),n)}function xe(e){e.preventDefault(),e.returnValue=""}function me(){var e=[];return{get length(){return e.length},push:function(n){return e.push(n),function(){e=e.filter(function(r){return r!==n})}},call:function(n){e.forEach(function(r){return r&&r(n)})}}}function je(){return Math.random().toString(36).substr(2,8)}function se(e){var t=e.pathname,n=t===void 0?"/":t,r=e.search,o=r===void 0?"":r,a=e.hash,s=a===void 0?"":a;return o&&o!=="?"&&(n+=o.charAt(0)==="?"?o:"?"+o),s&&s!=="#"&&(n+=s.charAt(0)==="#"?s:"#"+s),n}function Ae(e){var t={};if(e){var n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));var r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function Cr(e,t,n){const r=l.reactive({...t}),o=i=>{Object.assign(r,{...i})},a=r,s=yr(e,a,n);return{currentRoute:a,routerRoute:s,updateRoute:o}}function D(e){return!e.startsWith("http")?xr(e):Or(e)}function Or(e){const{protocol:t,host:n,pathname:r,search:o,searchParams:a,hash:s}=new URL(e,e);return{protocol:t,host:n,pathname:r,search:o,searchParams:a,hash:s}}function xr(e){const{pathname:t,search:n,searchParams:r,hash:o}=new URL(e,"https://localhost");return{pathname:t,search:n,searchParams:r,hash:o}}function jr(e){return t=>{const{host:n}=D(t);return!(n===void 0||n===e)}}function Zr(){return{reject:o=>{throw new ve(o)},push:(...o)=>{throw new K(o)},replace:(o,a,s)=>{if(q(o)){const d=a??{};throw new K([o,{...d,replace:!0}])}const i=a,f=s??{};throw new K([o,i,{...f,replace:!0}])},abort:()=>{throw new it}}}function ln(e){try{const t=e();return _e(t)?t.catch(n=>n):t}catch(t){return t}}function Hr(){const{setVueApp:e,runWithContext:t}=It(),n=l.reactive(new Map),{push:r,replace:o,reject:a}=Zr(),s=(g,k,m)=>k.matches.filter(w=>Kt({...m,routePrefetch:w.prefetch},"props")===g).flatMap(w=>v(w)).reduce((w,{id:c,name:u,props:S})=>{if(!S)return w;const V=U(c,u,k),y=t(()=>ln(()=>S(k,{push:r,replace:o,reject:a,parent:R(k,!0)})));return w[V]=y,w},{}),i=g=>{Object.entries(g).forEach(([k,m])=>{n.set(k,m)})},f=async g=>{const k=g.matches.flatMap(v),m=[],w=[];for(const{id:c,name:u,props:S}of k){if(!S)continue;const V=U(c,u,g);if(m.push(V),!n.has(V)){const y=t(()=>ln(()=>S(g,{push:r,replace:o,reject:a,parent:R(g)})));n.set(V,y)}w.push((async()=>{const y=await n.get(V);if(y instanceof Error)throw y})())}C(m);try{return await Promise.all(w),{status:"SUCCESS"}}catch(c){if(c instanceof K||c instanceof ve)return c.response;throw c}},d=(g,k,m)=>{const w=U(g,k,m);return n.get(w)};function R(g,k=!1){const m=g.matches.at(-2);if(m)return Xe(m)?{name:m.name??"",get props(){return h(m,"default",g,k)}}:tt(m)?{name:m.name??"",props:new Proxy({},{get(w,c){return typeof c!="string"?Reflect.get(w,c):h(m,c,g,k)}})}:{name:m.name??"",props:void 0}}function h(g,k,m,w=!1){const c=d(g.id,k,m);if(w&&!c){const u=g.name??"unknown",S=m.name||"unknown";console.warn(`
|
|
2
|
+
Unable to access parent props "${k}" from route "${u}" while prefetching props for route "${S}".
|
|
3
3
|
This may occur if the parent route's props were not also prefetched.
|
|
4
|
-
`)}return i}function k(g,U,m){return[g,U,m.id,JSON.stringify(m.params)].join("-")}function S(g){return Xt(g)?[{id:g.id,name:"default",props:g.props}]:ee(g)?Object.entries(g.props).map(([U,m])=>({id:g.id,name:U,props:m})):[]}function B(g){for(const U of n.keys())g.includes(U)||n.delete(U)}return{getPrefetchProps:s,setPrefetchProps:c,getProps:d,setProps:f,setVueApp:t}}function le(){return typeof window<"u"&&typeof window.document<"u"}function Hr({mode:t,listener:e}){const n=$r(t),r=(f,d)=>{if(d?.replace){n.replace(f,d.state);return}n.push(f,d?.state)},o=()=>{const f=at(n.location);n.replace(f)};let a;return{...n,update:r,refresh:o,startListening:()=>{a?.(),a=n.listen(e)},stopListening:()=>{a?.()}}}function $r(t="auto"){switch(t){case"auto":return le()?un():fn();case"browser":return un();case"memory":return fn();case"hash":return Cr();default:const e=t;throw new Error(`Switch is not exhaustive for mode: ${e}`)}}function qr(t){return l.defineComponent(()=>()=>l.h("h1",t),{name:t,props:[]})}function pe(t){const e=new URLSearchParams(t);return{get:(...n)=>e.get(...n),getAll:(...n)=>e.getAll(...n),set:(...n)=>{e.set(...n)},append:(...n)=>{e.append(...n)},delete:(...n)=>{e.delete(...n)},toString:(...n)=>e.toString(...n),forEach:(...n)=>{e.forEach(...n)},entries:(...n)=>e.entries(...n),keys:(...n)=>e.keys(...n),values:(...n)=>e.values(...n),has:(...n)=>e.has(...n),size:e.size,sort:()=>{e.sort()},[Symbol.iterator]:()=>e[Symbol.iterator]()}}function Ir(t){const e=a=>l.markRaw(t[a]??qr(a)),n=a=>{const s=l.markRaw(e(a)),c={id:ae(),component:s,meta:{},state:{}};return{id:c.id,matched:c,matches:[c],name:a,query:pe(""),params:{},state:{},href:"/",hash:""}},r=a=>{if(!a){o.value=null;return}const s=e(a);o.value={type:a,component:s}},o=l.ref(null);return{setRejection:r,rejection:o,getRejectionRoute:n}}class Dr extends Error{constructor(){super("initialUrl must be set if window.location is unavailable")}}function _r(t){if(t)return t;if(le())return window.location.toString();throw new Dr}function dn(t){return!!t&&typeof t=="object"}const Zt=!0;function Jr(t,e,n){if(dn(t)&&e in t){const r=t[e];return typeof r=="string"?tt(r,n,Zt):r}return tt(void 0,n,Zt)}function hn(t,e){const n={};for(const[r,o]of Object.entries(t)){const a=Jr(e,r,o);n[r]=a}return n}function Tr(t,e,n){if(dn(t)&&e in t){const r=t[e];return Y(r,n,Zt)}return Y(void 0,n,Zt)}const mn=(t,e)=>{const n={};for(const[r,o]of Object.entries(t)){const a=Tr(e,r,o);n[r]=a}return n};function Mr(){const t=l.reactive(new Map),e=le()?s():null,n=c=>{t.set(c,!1),e?.observe(c)},r=c=>{t.delete(c),e?.unobserve(c)},o=()=>{e?.disconnect()},a=c=>t.get(c)??!1;function s(){return new IntersectionObserver(c=>{c.forEach(f=>{t.set(f.target,f.isIntersecting)})})}return{observe:n,unobserve:r,disconnect:o,isElementVisible:a}}class Fr extends Error{constructor(e){super(`Route not found: "${e}"`)}}function yn(t,e,n){const r=Fn(e.value,n),o=Be(r),[a]=xe(t,new RegExp(o,"g"));return a}function Rn(t,e,n,r){const o=Gt(e,n),a=Y(r,e.params[n],o);return t.replace(Oe(n),a)}function gn({protocol:t,host:e,pathname:n,search:r,searchParams:o,hash:a}){const s=new URL("https://localhost");t&&(s.protocol=t),e&&(s.host=e),n&&(s.pathname=n),o?s.search=new URLSearchParams(o).toString():r&&(s.search=r),a&&(s.hash=a);const c=s.toString().replace(/^https:\/\/localhost\/*/,"/");return re(c)}function Wr(t,e={}){const{params:n={},query:r}=e,o=Qr(t.query,n),a=fe(o,r),s=wn(t.path,n),c=t.hash.value?wn(t.hash,n):e.hash,f=Gr(t.host,n),{protocol:d,host:R}=q(f);return gn({protocol:d,host:R,pathname:s,searchParams:a,hash:c})}function Gr(t,e){const n=t.value&&!t.value.startsWith("http")?`https://${t.value}`:t.value;return Object.keys(t.params).reduce((r,o)=>Rn(r,t,o,e[o]),n)}function wn(t,e){return Object.keys(t.params).reduce((n,r)=>Rn(n,t,r,e[r]),t.value)}function Qr(t,e){const n=new URLSearchParams(t.value);if(!t.value)return n;for(const[r,o]of Array.from(n.entries())){const a=zt(o);if(!a)continue;const c=Qt(o),f=Y(e[a],t.params[a],c),d=e[a]===void 0&&f==="";c&&d?n.delete(r,o):n.set(r,f)}return n}const zr=(t,e)=>{try{de(t,e)}catch{return!1}return!0},de=(t,e)=>{const{protocol:n,host:r,pathname:o,search:a,hash:s}=q(e);return{...he(t.host,`${n}//${r}`),...he(t.path,o),...Yr(t.query,a),...he(t.hash,s)}};function he(t,e){const n={},r=decodeURIComponent(e);for(const[o,a]of Object.entries(t.params)){const s=yn(r,t,o),c=Gt(t,o),f=tt(s,a,c);n[o]=f}return n}function Yr(t,e){const n={},r=new URLSearchParams(t.value),o=new URLSearchParams(e);for(const[a,s]of Array.from(r.entries())){const c=zt(s);if(!c)continue;const d=Qt(s),R=o.get(a)??void 0,h=tt(R,t.params[c],d);n[c]=h}return n}function Kr(t,e={},n={}){const r=Wr(t,{params:e,query:n.query,hash:n.hash}),{search:o,hash:a}=q(r);return{id:t.id,matched:t.matched,matches:t.matches,name:t.name,query:pe(o),params:de(t,r),state:hn(t.state,n.state),hash:a,href:r}}const Ht={template:"<div>This is component</div>"},me=rt({name:"parentA",path:"/parentA/[paramA]"}),En=rt({parent:me,name:"parentA.childA",path:"/childA/[?paramB]"}),Xr=rt({parent:me,name:"parentA.childB",path:"/childB/[paramD]",component:Ht}),to=rt({parent:En,name:"parentA.childA.grandChildA",path:"/[paramC]",component:Ht});rt({name:"parentB",path:"/parentB",component:Ht}),rt({name:"parentC",path:"/",component:Ht});const eo=t=>"name"in t.matched&&!!t.matched.name,no=(t,e)=>{const{pathname:n}=q(e);return Tn(t).test(n)},ro=(t,e)=>{const{search:n}=q(e);return Mn(t).every(o=>o.test(n))},ye=(t,e)=>{const{hash:n}=q(e),{value:r}=t.hash;return D(r)?`#${r.replace(/^#*/,"")}`.toLowerCase()===n.toLowerCase():!0};function oo(t){const{searchParams:e,pathname:n}=q(t),r=-1,o=1;return(a,s)=>{const c=Sn(a,e),f=bn(a,n),d=Sn(s,e),R=bn(s,n);return a.depth>s.depth?r:a.depth<s.depth?o:c+f>d+R?r:c+f<d+R?o:ye(a,t)?r:ye(s,t)?o:0}}function bn(t,e){const n=Object.keys(t.path.params).filter(o=>Gt(t.path,o)).map(o=>o),r=n.filter(o=>yn(e,t.path,o)===void 0);return n.length-r.length}function Sn(t,e){const n=new URLSearchParams(e),r=new URLSearchParams(t.query.value),o=Array.from(r.keys()),a=o.filter(s=>!n.has(s));return o.length-a.length}const ao=[eo,no,ro,ye,zr];function so(t,e){const n=oo(e);return t.filter(r=>ao.every(o=>o(r,e))).sort(n)}function io(t,e,n){const r=so(t,e);if(!r.length)return;const[o]=r,{searchParams:a,hash:s}=q(e);return{id:o.id,matched:o.matched,matches:o.matches,name:o.name,query:pe(a),params:de(o,e),state:hn(o.state,n),hash:s,href:re(e)}}function Pn(t,e){const n=typeof t=="string"?q(t):t,r=typeof e=="string"?q(e):e,o=n.searchParams??new URLSearchParams(n.search),a=r.searchParams??new URLSearchParams(r.search);return gn({protocol:D(r.protocol)?r.protocol:n.protocol,host:D(r.host)?r.host:n.host,pathname:D(r.pathname)?r.pathname:n.pathname,searchParams:fe(a,o),hash:D(r.hash)?r.hash:n.hash})}function co(t,e){return D(e)?t.map(n=>{const r=`${e}${n.path.value}`;return{...n,path:G(r,n.path.params)}}):t}class uo 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 fo(t){const e=t.map(({name:n})=>n);for(const n of e)if(be(e,n)>1)throw new uo(n)}function lo(t,e=[],n){const r=[...t,...e.map(o=>o.routes)].flat().filter(o=>D(o.name));return fo(r),co(r,n)}function po(t={},e=[]){const n=new St;return yt("onBeforeRouteEnter",t,e).forEach(r=>n.onBeforeRouteEnter.add(r)),yt("onBeforeRouteUpdate",t,e).forEach(r=>n.onBeforeRouteUpdate.add(r)),yt("onBeforeRouteLeave",t,e).forEach(r=>n.onBeforeRouteLeave.add(r)),yt("onAfterRouteEnter",t,e).forEach(r=>n.onAfterRouteEnter.add(r)),yt("onAfterRouteUpdate",t,e).forEach(r=>n.onAfterRouteUpdate.add(r)),yt("onAfterRouteLeave",t,e).forEach(r=>n.onAfterRouteLeave.add(r)),n}function yt(t,e,n){return[e[t],...n.map(o=>o[t])].flat().filter(o=>o!==void 0)}function ho(t,{match:e,name:n,component:r}){const o=Ke(t),a=Ct(t);return l.defineComponent({name:"PropsWrapper",expose:[],setup(){const s=l.getCurrentInstance(),c=o(),f=a();return()=>{const d=c.getProps(e.id,n,f);return d instanceof Error?"":Dt(d)?s?.suspense?l.h(yo,{component:r,props:d}):l.h(mo,{component:r,props:d}):l.h(r,d)}}})}const mo=l.defineComponent(t=>{const e=l.ref();return l.watch(()=>t.props,async n=>{e.value=await n},{immediate:!0,deep:!0}),()=>e.value instanceof Error?"":e.value?l.h(t.component,e.value):""},{props:["component","props"]}),yo=l.defineComponent(async t=>{const e=l.ref();return e.value=await t.props,l.watch(()=>e.value,async n=>{e.value=await n},{deep:!0}),()=>e.value instanceof Error?"":e.value?l.h(t.component,e.value):""},{props:["component","props"]});function Ro(t){const e=new Map;return{getRouteComponents:r=>{const o=e.get(r.id);if(o)return o;const a=go(t,r);return e.set(r.id,a),a}}}function go(t,e){const n=ce(t);return te(e)?vn(t,e,e.components):Kt(e)?vn(t,e,{default:e.component}):{default:n}}function vn(t,e,n){return Object.fromEntries(Object.entries(n).map(([r,o])=>[r,ho(t,{match:e,name:r,component:o})]))}const An=Symbol();function wo(t,e,n=[]){const o=e?.isGlobalRouter??!0?An:Symbol(),a=lo(t,n,e?.base),s=pr();s.addGlobalRouteHooks(po(e,n));const c=oe(),f=Zr(),d=Ro(o),R=Mr(),h=Hr({mode:e?.historyMode,listener:({location:v})=>{const O=at(v);S(O,{state:v.state,replace:!0})}});function k(v,O={}){return io(a,v,O.state)}async function S(v,O={}){const M=c();if(h.stopListening(),j(v)){h.update(v,O);return}const F=k(v,O)??u("NotFound"),I=jo(M),X=await s.runBeforeRouteHooks({to:F,from:I});switch(X.status){case"ABORT":return;case"PUSH":h.update(v,O),await g(...X.to);return;case"REJECT":h.update(v,O),w(X.type);break;case"SUCCESS":h.update(v,O),w(null);break;default:throw new Error(`Switch is not exhaustive for before hook response status: ${JSON.stringify(X)}`)}const Re=M;f.setProps(F).then(W=>{if(Re===M)switch(W.status){case"SUCCESS":break;case"PUSH":g(...W.to);break;case"REJECT":w(W.type);break;default:const ge=W;throw new Error(`Switch is not exhaustive for prop store response status: ${JSON.stringify(ge)}`)}}),p(F);const Q=await s.runAfterRouteHooks({to:F,from:I});switch(Q.status){case"PUSH":await g(...Q.to);break;case"REJECT":w(Q.type);break;case"SUCCESS":break;default:const W=Q;throw new Error(`Switch is not exhaustive for after hook response status: ${JSON.stringify(W)}`)}h.startListening()}const B=(v,O={},M={})=>{const F=a.find(I=>I.name===v);if(!F)throw new Fr(v);return Kr(F,O,M)},g=(v,O,M)=>{if(_(v)){const Q={...O},W=Pn(v,{searchParams:Q.query,hash:Q.hash});return S(W,Q)}if(typeof v=="string"){const{replace:Q,...W}={...M},ge={...O},we=B(v,ge,W),Ho=mn({...we.matched.state},{...we.state,...W.state});return S(we.href,{replace:Q,state:Ho})}const{replace:F,...I}={...O},X=mn({...v.matched.state},{...v.state,...I.state}),Re=Pn(v.href,{searchParams:I.query,hash:I.hash});return S(Re,{replace:F,state:X})},U=(v,O,M)=>{if(_(v)){const I={...O,replace:!0};return g(v,I)}if(typeof v=="string"){const I={...M,replace:!0},X={...O};return g(v,X,I)}const F={...O,replace:!0};return g(v,F)},m=v=>{w(v)},{setRejection:w,rejection:i,getRejectionRoute:u}=Ir({...n.reduce((v,O)=>({...v,...O.rejections}),{}),...e?.rejections}),P=u("NotFound"),{currentRoute:V,routerRoute:y,updateRoute:p}=Br(o,P,g),E=_r(e?.initialUrl),b=h.location.state,{host:N}=q(E),j=jr(N);let Z=!1;const $=l.ref(!1),{promise:T,resolve:kn}=Promise.withResolvers();async function Un(){if(Z)return T;Z=!0,jn(a)&&await Zn(),await S(E,{replace:!0,state:b}),h.startListening(),kn(),$.value=!0}function xo(){h.stopListening()}function jo(v){return ar(v)?null:{...V}}function Zo(v){s.setVueApp(v),f.setVueApp(v);const O=ce(o),M=on(o);v.component("RouterView",O),v.component("RouterLink",M),v.provide(Qe(o),i),v.provide(Te(o),s),v.provide(Ye(o),f),v.provide(Ge(o),d),v.provide(en,R),v.provide(o,Ln),Un()}const Ln={route:y,resolve:B,find:k,push:g,replace:U,reject:m,refresh:h.refresh,forward:h.forward,back:h.back,go:h.go,install:Zo,isExternal:j,onBeforeRouteEnter:s.onBeforeRouteEnter,onBeforeRouteUpdate:s.onBeforeRouteUpdate,onBeforeRouteLeave:s.onBeforeRouteLeave,onAfterRouteEnter:s.onAfterRouteEnter,onAfterRouteUpdate:s.onAfterRouteUpdate,onAfterRouteLeave:s.onAfterRouteLeave,prefetch:e?.prefetch,start:Un,started:$,stop:xo,key:o};return Ln}const Eo=G,bo=G,So=G,J=an(An),Po=J.onBeforeRouteLeave,vo=J.onBeforeRouteUpdate,Ao=J.onAfterRouteLeave,ko=J.onAfterRouteUpdate,Uo=J.isRoute,Lo=J.RouterView,Vo=J.RouterLink,No=J.useRoute,Co=J.useRouter,Bo=J.useQueryValue,Oo=J.useLink;L.DuplicateParamsError=Ee,L.MetaPropertyConflict=Ze,L.RouterLink=Vo,L.RouterNotInstalledError=nt,L.RouterView=Lo,L.UseRouteInvalidError=He,L.arrayOf=Ur,L.asUrl=re,L.combineRoutes=ne,L.createExternalRoute=sr,L.createParam=Pe,L.createRoute=rt,L.createRouter=wo,L.createRouterAssets=an,L.createRouterPlugin=Ar,L.host=bo,L.isRoute=Uo,L.isUrl=_,L.isWithComponent=Kt,L.isWithComponentProps=Xt,L.isWithComponentPropsRecord=ee,L.isWithComponents=te,L.isWithParent=Yt,L.onAfterRouteLeave=Ao,L.onAfterRouteUpdate=ko,L.onBeforeRouteLeave=Po,L.onBeforeRouteUpdate=vo,L.path=Eo,L.query=So,L.tupleOf=Vr,L.unionOf=sn,L.useLink=Oo,L.useQueryValue=Bo,L.useRoute=No,L.useRouter=Co,L.withDefault=Bn,L.withParams=G,Object.defineProperty(L,Symbol.toStringTag,{value:"Module"})});
|
|
4
|
+
`)}return c}function U(g,k,m){return[g,k,m.id,JSON.stringify(m.params)].join("-")}function v(g){return Xe(g)?[{id:g.id,name:"default",props:g.props}]:tt(g)?Object.entries(g.props).map(([k,m])=>({id:g.id,name:k,props:m})):[]}function C(g){for(const k of n.keys())g.includes(k)||n.delete(k)}return{getPrefetchProps:s,setPrefetchProps:i,getProps:d,setProps:f,setVueApp:e}}function pt(){return typeof window<"u"&&typeof window.document<"u"}function $r({mode:e,listener:t}){const n=qr(e),r=(f,d)=>{if(d?.replace){n.replace(f,d.state);return}n.push(f,d?.state)},o=()=>{const f=se(n.location);n.replace(f)};let a;return{...n,update:r,refresh:o,startListening:()=>{a?.(),a=n.listen(t)},stopListening:()=>{a?.()}}}function qr(e="auto"){switch(e){case"auto":return pt()?cn():un();case"browser":return cn();case"memory":return un();case"hash":return Br();default:const t=e;throw new Error(`Switch is not exhaustive for mode: ${t}`)}}function Dr(e){return l.defineComponent(()=>()=>l.h("h1",e),{name:e,props:[]})}function dt(e){const t=new URLSearchParams(e);return{get:(...n)=>t.get(...n),getAll:(...n)=>t.getAll(...n),set:(...n)=>{t.set(...n)},append:(...n)=>{t.append(...n)},delete:(...n)=>{t.delete(...n)},toString:(...n)=>t.toString(...n),forEach:(...n)=>{t.forEach(...n)},entries:(...n)=>t.entries(...n),keys:(...n)=>t.keys(...n),values:(...n)=>t.values(...n),has:(...n)=>t.has(...n),size:t.size,sort:()=>{t.sort()},[Symbol.iterator]:()=>t[Symbol.iterator]()}}function _r(e){const t=a=>l.markRaw(e[a]??Dr(a)),n=a=>{const s=l.markRaw(t(a)),i={id:at(),component:s,meta:{},state:{}};return{id:i.id,matched:i,matches:[i],name:a,query:dt(""),params:{},state:{},href:"/",hash:""}},r=a=>{if(!a){o.value=null;return}const s=t(a);o.value={type:a,component:s}},o=l.ref(null);return{setRejection:r,rejection:o,getRejectionRoute:n}}class Ir extends Error{constructor(){super("initialUrl must be set if window.location is unavailable")}}function Jr(e){if(e)return e;if(pt())return window.location.toString();throw new Ir}function pn(e){return!!e&&typeof e=="object"}const Ze=!0;function Tr(e,t,n){if(pn(e)&&t in e){const r=e[t];return typeof r=="string"?te(r,n,Ze):r}return te(void 0,n,Ze)}function dn(e,t){const n={};for(const[r,o]of Object.entries(e)){const a=Tr(t,r,o);n[r]=a}return n}function Mr(e,t,n){if(pn(e)&&t in e){const r=e[t];return Y(r,n,Ze)}return Y(void 0,n,Ze)}const hn=(e,t)=>{const n={};for(const[r,o]of Object.entries(e)){const a=Mr(t,r,o);n[r]=a}return n};function Fr(){const e=l.reactive(new Map),t=pt()?s():null,n=i=>{e.set(i,!1),t?.observe(i)},r=i=>{e.delete(i),t?.unobserve(i)},o=()=>{t?.disconnect()},a=i=>e.get(i)??!1;function s(){return new IntersectionObserver(i=>{i.forEach(f=>{e.set(f.target,f.isIntersecting)})})}return{observe:n,unobserve:r,disconnect:o,isElementVisible:a}}class Wr extends Error{constructor(t){super(`Route not found: "${t}"`)}}function mn(e,t,n){const r=Mn(t.value,n),o=Ot(r),[a]=jt(e,new RegExp(o,"g"));return a}function Rn(e,t,n,r){const o=Ge(t,n),a=Y(r,t.params[n],o);return e.replace(xt(n),a)}function yn({protocol:e,host:t,pathname:n,search:r,searchParams:o,hash:a}){const s=new URL("https://localhost");e&&(s.protocol=e),t&&(s.host=t),n&&(s.pathname=n),o?s.search=new URLSearchParams(o).toString():r&&(s.search=r),a&&(s.hash=a);const i=s.toString().replace(/^https:\/\/localhost\/*/,"/");return rt(i)}function Gr(e,t={}){const{params:n={},query:r}=t,o=zr(e.query,n),a=lt(o,r),s=gn(e.path,n),i=e.hash.value?gn(e.hash,n):t.hash,f=Qr(e.host,n),{protocol:d,host:R}=D(f);return yn({protocol:d,host:R,pathname:s,searchParams:a,hash:i})}function Qr(e,t){const n=e.value&&!e.value.startsWith("http")?`https://${e.value}`:e.value;return Object.keys(e.params).reduce((r,o)=>Rn(r,e,o,t[o]),n)}function gn(e,t){return Object.keys(e.params).reduce((n,r)=>Rn(n,e,r,t[r]),e.value)}function zr(e,t){const n=new URLSearchParams(e.value);if(!e.value)return n;for(const[r,o]of Array.from(n.entries())){const a=ze(o);if(!a)continue;const i=Qe(o),f=Y(t[a],e.params[a],i),d=t[a]===void 0&&f==="";i&&d?n.delete(r,o):n.set(r,f)}return n}const Yr=(e,t)=>{try{ht(e,t)}catch{return!1}return!0},ht=(e,t)=>{const{protocol:n,host:r,pathname:o,search:a,hash:s}=D(t);return{...mt(e.host,`${n}//${r}`),...mt(e.path,o),...Kr(e.query,a),...mt(e.hash,s)}};function mt(e,t){const n={},r=decodeURIComponent(t);for(const[o,a]of Object.entries(e.params)){const s=mn(r,e,o),i=Ge(e,o),f=te(s,a,i);n[o]=f}return n}function Kr(e,t){const n={},r=new URLSearchParams(e.value),o=new URLSearchParams(t);for(const[a,s]of Array.from(r.entries())){const i=ze(s);if(!i)continue;const d=Qe(s),R=o.get(a)??void 0,h=te(R,e.params[i],d);n[i]=h}return n}function Xr(e,t={},n={}){const r=Gr(e,{params:t,query:n.query,hash:n.hash}),{search:o,hash:a}=D(r);return{id:e.id,matched:e.matched,matches:e.matches,name:e.name,query:dt(o),params:ht(e,r),state:dn(e.state,n.state),hash:a,href:r}}const He={template:"<div>This is component</div>"},Rt=oe({name:"parentA",path:"/parentA/[paramA]"}),wn=oe({parent:Rt,name:"parentA.childA",path:"/childA/[?paramB]"}),eo=oe({parent:Rt,name:"parentA.childB",path:"/childB/[paramD]",component:He}),to=oe({parent:wn,name:"parentA.childA.grandChildA",path:"/[paramC]",component:He});oe({name:"parentB",path:"/parentB",component:He}),oe({name:"parentC",path:"/",component:He});const no=e=>"name"in e.matched&&!!e.matched.name,ro=(e,t)=>{const{pathname:n}=D(t);return Jn(e).test(n)},oo=(e,t)=>{const{search:n}=D(t);return Tn(e).every(o=>o.test(n))},yt=(e,t)=>{const{hash:n}=D(t),{value:r}=e.hash;return I(r)?`#${r.replace(/^#*/,"")}`.toLowerCase()===n.toLowerCase():!0};function ao(e){const{searchParams:t,pathname:n}=D(e),r=-1,o=1;return(a,s)=>{const i=bn(a,t),f=En(a,n),d=bn(s,t),R=En(s,n);return a.depth>s.depth?r:a.depth<s.depth?o:i+f>d+R?r:i+f<d+R?o:yt(a,e)?r:yt(s,e)?o:0}}function En(e,t){const n=Object.keys(e.path.params).filter(o=>Ge(e.path,o)).map(o=>o),r=n.filter(o=>mn(t,e.path,o)===void 0);return n.length-r.length}function bn(e,t){const n=new URLSearchParams(t),r=new URLSearchParams(e.query.value),o=Array.from(r.keys()),a=o.filter(s=>!n.has(s));return o.length-a.length}const so=[no,ro,oo,yt,Yr];function io(e,t){const n=ao(t);return e.filter(r=>so.every(o=>o(r,t))).sort(n)}function co(e,t,n){const r=io(e,t);if(!r.length)return;const[o]=r,{searchParams:a,hash:s}=D(t);return{id:o.id,matched:o.matched,matches:o.matches,name:o.name,query:dt(a),params:ht(o,t),state:dn(o.state,n),hash:s,href:rt(t)}}function vn(e,t){const n=typeof e=="string"?D(e):e,r=typeof t=="string"?D(t):t,o=n.searchParams??new URLSearchParams(n.search),a=r.searchParams??new URLSearchParams(r.search);return yn({protocol:I(r.protocol)?r.protocol:n.protocol,host:I(r.host)?r.host:n.host,pathname:I(r.pathname)?r.pathname:n.pathname,searchParams:lt(a,o),hash:I(r.hash)?r.hash:n.hash})}function uo(e,t){return I(t)?e.map(n=>{const r=`${t}${n.path.value}`;return{...n,path:G(r,n.path.params)}}):e}class fo 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 lo(e){const t=e.map(({name:n})=>n);for(const n of t)if(vt(t,n)>1)throw new fo(n)}function po(e,t=[],n){const r=[...e,...t.map(o=>o.routes)].flat().filter(o=>I(o.name));return lo(r),uo(r,n)}function ho(e={},t=[]){const n=new Se;return Re("onBeforeRouteEnter",e,t).forEach(r=>n.onBeforeRouteEnter.add(r)),Re("onBeforeRouteUpdate",e,t).forEach(r=>n.onBeforeRouteUpdate.add(r)),Re("onBeforeRouteLeave",e,t).forEach(r=>n.onBeforeRouteLeave.add(r)),Re("onAfterRouteEnter",e,t).forEach(r=>n.onAfterRouteEnter.add(r)),Re("onAfterRouteUpdate",e,t).forEach(r=>n.onAfterRouteUpdate.add(r)),Re("onAfterRouteLeave",e,t).forEach(r=>n.onAfterRouteLeave.add(r)),n}function Re(e,t,n){return[t[e],...n.map(o=>o[e])].flat().filter(o=>o!==void 0)}function mo(e,{match:t,name:n,component:r}){const o=Yt(e),a=Be(e);return l.defineComponent({name:"PropsWrapper",expose:[],setup(){const s=l.getCurrentInstance(),i=o(),f=a();return()=>{const d=i.getProps(t.id,n,f);return d instanceof Error?"":_e(d)?s?.suspense?l.h(yo,{component:r,props:d}):l.h(Ro,{component:r,props:d}):l.h(r,d)}}})}const Ro=l.defineComponent(e=>{const t=l.ref();return l.watch(()=>e.props,async n=>{t.value=await n},{immediate:!0,deep:!0}),()=>t.value instanceof Error?"":t.value?l.h(e.component,t.value):""},{props:["component","props"]}),yo=l.defineComponent(async e=>{const t=l.ref();return t.value=await e.props,l.watch(()=>t.value,async n=>{t.value=await n},{deep:!0}),()=>t.value instanceof Error?"":t.value?l.h(e.component,t.value):""},{props:["component","props"]});function go(e){const t=new Map;return{getRouteComponents:r=>{const o=t.get(r.id);if(o)return o;const a=wo(e,r);return t.set(r.id,a),a}}}function wo(e,t){const n=ut(e);return et(t)?Sn(e,t,t.components):Ke(t)?Sn(e,t,{default:t.component}):{default:n}}function Sn(e,t,n){return Object.fromEntries(Object.entries(n).map(([r,o])=>[r,mo(e,{match:t,name:r,component:o})]))}const Pn=Symbol();function Eo(e,t,n=[]){const o=t?.isGlobalRouter??!0?Pn:Symbol(),a=po(e,n,t?.base),s=pr();s.addGlobalRouteHooks(ho(t,n));const i=ot(),f=Hr(),d=go(o),R=Fr(),h=$r({mode:t?.historyMode,listener:({location:P})=>{const O=se(P);v(O,{state:P.state,replace:!0})}});function U(P,O={}){return co(a,P,O.state)}async function v(P,O={}){const M=i();if(h.stopListening(),j(P)){h.update(P,O);return}const F=U(P,O)??u("NotFound"),_=Zo(M),ee=await s.runBeforeRouteHooks({to:F,from:_});switch(ee.status){case"ABORT":return;case"PUSH":h.update(P,O),await g(...ee.to);return;case"REJECT":h.update(P,O),w(ee.type);break;case"SUCCESS":h.update(P,O),w(null);break;default:throw new Error(`Switch is not exhaustive for before hook response status: ${JSON.stringify(ee)}`)}const gt=M;f.setProps(F).then(W=>{if(gt===M)switch(W.status){case"SUCCESS":break;case"PUSH":g(...W.to);break;case"REJECT":w(W.type);break;default:const wt=W;throw new Error(`Switch is not exhaustive for prop store response status: ${JSON.stringify(wt)}`)}}),p(F);const Q=await s.runAfterRouteHooks({to:F,from:_});switch(Q.status){case"PUSH":await g(...Q.to);break;case"REJECT":w(Q.type);break;case"SUCCESS":break;default:const W=Q;throw new Error(`Switch is not exhaustive for after hook response status: ${JSON.stringify(W)}`)}h.startListening()}const C=(P,O={},M={})=>{const F=a.find(_=>_.name===P);if(!F)throw new Wr(P);return Xr(F,O,M)},g=(P,O,M)=>{if(q(P)){const Q={...O},W=vn(P,{searchParams:Q.query,hash:Q.hash});return v(W,Q)}if(typeof P=="string"){const{replace:Q,...W}={...M},wt={...O},Et=C(P,wt,W),$o=hn({...Et.matched.state},{...Et.state,...W.state});return v(Et.href,{replace:Q,state:$o})}const{replace:F,..._}={...O},ee=hn({...P.matched.state},{...P.state,..._.state}),gt=vn(P.href,{searchParams:_.query,hash:_.hash});return v(gt,{replace:F,state:ee})},k=(P,O,M)=>{if(q(P)){const _={...O,replace:!0};return g(P,_)}if(typeof P=="string"){const _={...M,replace:!0},ee={...O};return g(P,ee,_)}const F={...O,replace:!0};return g(P,F)},m=P=>{w(P)},{setRejection:w,rejection:c,getRejectionRoute:u}=_r({...n.reduce((P,O)=>({...P,...O.rejections}),{}),...t?.rejections}),S=u("NotFound"),{currentRoute:V,routerRoute:y,updateRoute:p}=Cr(o,S,g),E=Jr(t?.initialUrl),b=h.location.state,{host:N}=D(E),j=jr(N);let Z=!1;const $=l.ref(!1),{promise:T,resolve:An}=Promise.withResolvers();async function Un(){if(Z)return T;Z=!0,xn(a)&&await jn(),await v(E,{replace:!0,state:b}),h.startListening(),An(),$.value=!0}function jo(){h.stopListening()}function Zo(P){return or(P)?null:{...V}}function Ho(P){s.setVueApp(P),f.setVueApp(P);const O=ut(o),M=rn(o);P.component("RouterView",O),P.component("RouterLink",M),P.provide(Gt(o),c),P.provide(Jt(o),s),P.provide(zt(o),f),P.provide(Wt(o),d),P.provide(en,R),P.provide(o,kn),Un()}const kn={route:y,resolve:C,find:U,push:g,replace:k,reject:m,refresh:h.refresh,forward:h.forward,back:h.back,go:h.go,install:Ho,isExternal:j,onBeforeRouteEnter:s.onBeforeRouteEnter,onBeforeRouteUpdate:s.onBeforeRouteUpdate,onBeforeRouteLeave:s.onBeforeRouteLeave,onAfterRouteEnter:s.onAfterRouteEnter,onAfterRouteUpdate:s.onAfterRouteUpdate,onAfterRouteLeave:s.onAfterRouteLeave,prefetch:t?.prefetch,start:Un,started:$,stop:jo,key:o};return kn}const bo=G,vo=G,So=G,J=on(Pn),Po=J.onBeforeRouteLeave,Ao=J.onBeforeRouteUpdate,Uo=J.onAfterRouteLeave,ko=J.onAfterRouteUpdate,Lo=J.isRoute,Vo=J.RouterView,No=J.RouterLink,Bo=J.useRoute,Co=J.useRouter,Oo=J.useQueryValue,xo=J.useLink;L.DuplicateParamsError=bt,L.MetaPropertyConflict=Ht,L.RouterLink=No,L.RouterNotInstalledError=re,L.RouterView=Vo,L.UseRouteInvalidError=$t,L.arrayOf=kr,L.asUrl=rt,L.combineRoutes=nt,L.createExternalRoute=ar,L.createParam=Pt,L.createRoute=oe,L.createRouter=Eo,L.createRouterAssets=on,L.createRouterPlugin=Ar,L.host=vo,L.isRoute=Lo,L.isUrl=q,L.isWithComponent=Ke,L.isWithComponentProps=Xe,L.isWithComponentPropsRecord=tt,L.isWithComponents=et,L.isWithParent=Ye,L.onAfterRouteLeave=Uo,L.onAfterRouteUpdate=ko,L.onBeforeRouteLeave=Po,L.onBeforeRouteUpdate=Ao,L.path=bo,L.query=So,L.tupleOf=Vr,L.unionOf=an,L.useLink=xo,L.useQueryValue=Oo,L.useRoute=Bo,L.useRouter=Co,L.withDefault=Bn,L.withParams=G,Object.defineProperty(L,Symbol.toStringTag,{value:"Module"})});
|
package/dist/main.d.ts
CHANGED
|
@@ -59,7 +59,7 @@ export declare const query: typeof withParams;
|
|
|
59
59
|
* @returns {RouteHookRemove} A function that removes the added hook.
|
|
60
60
|
* @group Hooks
|
|
61
61
|
*/
|
|
62
|
-
export declare const onBeforeRouteLeave: import('./main').AddRouterBeforeRouteHook<any>;
|
|
62
|
+
export declare const onBeforeRouteLeave: import('./main').AddRouterBeforeRouteHook<any, string | number | symbol>;
|
|
63
63
|
/**
|
|
64
64
|
* Registers a hook that is called before a route is updated. Must be called from setup.
|
|
65
65
|
* This is particularly useful for handling changes in route parameters or query while staying within the same component.
|
|
@@ -68,7 +68,7 @@ export declare const onBeforeRouteLeave: import('./main').AddRouterBeforeRouteHo
|
|
|
68
68
|
* @returns {RouteHookRemove} A function that removes the added hook.
|
|
69
69
|
* @group Hooks
|
|
70
70
|
*/
|
|
71
|
-
export declare const onBeforeRouteUpdate: import('./main').AddRouterBeforeRouteHook<any>;
|
|
71
|
+
export declare const onBeforeRouteUpdate: import('./main').AddRouterBeforeRouteHook<any, string | number | symbol>;
|
|
72
72
|
/**
|
|
73
73
|
* Registers a hook that is called after a route has been left. Must be called during setup.
|
|
74
74
|
* This can be used for cleanup actions after the component is no longer active, ensuring proper resource management.
|
|
@@ -77,7 +77,7 @@ export declare const onBeforeRouteUpdate: import('./main').AddRouterBeforeRouteH
|
|
|
77
77
|
* @returns {RouteHookRemove} A function that removes the added hook.
|
|
78
78
|
* @group Hooks
|
|
79
79
|
*/
|
|
80
|
-
export declare const onAfterRouteLeave: import('./main').AddRouterAfterRouteHook<any>;
|
|
80
|
+
export declare const onAfterRouteLeave: import('./main').AddRouterAfterRouteHook<any, string | number | symbol>;
|
|
81
81
|
/**
|
|
82
82
|
* Registers a hook that is called after a route has been updated. Must be called during setup.
|
|
83
83
|
* This is ideal for responding to updates within the same route, such as parameter changes, without full component reloads.
|
|
@@ -86,7 +86,7 @@ export declare const onAfterRouteLeave: import('./main').AddRouterAfterRouteHook
|
|
|
86
86
|
* @returns {RouteHookRemove} A function that removes the added hook.
|
|
87
87
|
* @group Hooks
|
|
88
88
|
*/
|
|
89
|
-
export declare const onAfterRouteUpdate: import('./main').AddRouterAfterRouteHook<any>;
|
|
89
|
+
export declare const onAfterRouteUpdate: import('./main').AddRouterAfterRouteHook<any, string | number | symbol>;
|
|
90
90
|
/**
|
|
91
91
|
* A guard to verify if a route or unknown value matches a given route name.
|
|
92
92
|
*
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Routes } from '../types/route';
|
|
2
2
|
import { RouterAfterRouteHook, RouterBeforeRouteHook } from '../types/router';
|
|
3
|
-
export declare class RouterRouteHooks<TRoutes extends Routes = Routes> {
|
|
4
|
-
onBeforeRouteEnter: Set<RouterBeforeRouteHook<TRoutes>>;
|
|
5
|
-
onBeforeRouteUpdate: Set<RouterBeforeRouteHook<TRoutes>>;
|
|
6
|
-
onBeforeRouteLeave: Set<RouterBeforeRouteHook<TRoutes>>;
|
|
7
|
-
onAfterRouteEnter: Set<RouterAfterRouteHook<TRoutes>>;
|
|
8
|
-
onAfterRouteUpdate: Set<RouterAfterRouteHook<TRoutes>>;
|
|
9
|
-
onAfterRouteLeave: Set<RouterAfterRouteHook<TRoutes>>;
|
|
3
|
+
export declare class RouterRouteHooks<TRoutes extends Routes = Routes, TRejections extends PropertyKey = PropertyKey> {
|
|
4
|
+
onBeforeRouteEnter: Set<RouterBeforeRouteHook<TRoutes, TRejections>>;
|
|
5
|
+
onBeforeRouteUpdate: Set<RouterBeforeRouteHook<TRoutes, TRejections>>;
|
|
6
|
+
onBeforeRouteLeave: Set<RouterBeforeRouteHook<TRoutes, TRejections>>;
|
|
7
|
+
onAfterRouteEnter: Set<RouterAfterRouteHook<TRoutes, TRejections>>;
|
|
8
|
+
onAfterRouteUpdate: Set<RouterAfterRouteHook<TRoutes, TRejections>>;
|
|
9
|
+
onAfterRouteLeave: Set<RouterAfterRouteHook<TRoutes, TRejections>>;
|
|
10
10
|
}
|
|
@@ -29,10 +29,16 @@ export type CallbackRejectResponse = {
|
|
|
29
29
|
* A function that can be called to abort a routing operation.
|
|
30
30
|
*/
|
|
31
31
|
export type CallbackContextAbort = () => void;
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated Use `RouterCallbackContext` instead.
|
|
34
|
+
*/
|
|
32
35
|
export type CallbackContext = {
|
|
33
36
|
reject: RegisteredRouterReject;
|
|
34
37
|
push: RegisteredRouterPush;
|
|
35
38
|
replace: RegisteredRouterReplace;
|
|
36
39
|
abort: CallbackContextAbort;
|
|
37
40
|
};
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated Use `createRouterCallbackContext` instead.
|
|
43
|
+
*/
|
|
38
44
|
export declare function createCallbackContext(): CallbackContext;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { InjectionKey } from 'vue';
|
|
2
|
-
import { AddRouterAfterRouteHook, AddRouterBeforeRouteHook, Router, RouterRoutes } from '../types/router';
|
|
2
|
+
import { AddRouterAfterRouteHook, AddRouterBeforeRouteHook, Router, RouterRejections, RouterRoutes } from '../types/router';
|
|
3
3
|
import { Routes } from '../types/route';
|
|
4
|
-
type ComponentHooks<TRoutes extends Routes> = {
|
|
5
|
-
onBeforeRouteLeave: AddRouterBeforeRouteHook<TRoutes>;
|
|
6
|
-
onBeforeRouteUpdate: AddRouterBeforeRouteHook<TRoutes>;
|
|
7
|
-
onAfterRouteLeave: AddRouterAfterRouteHook<TRoutes>;
|
|
8
|
-
onAfterRouteUpdate: AddRouterAfterRouteHook<TRoutes>;
|
|
4
|
+
type ComponentHooks<TRoutes extends Routes, TRejections extends PropertyKey> = {
|
|
5
|
+
onBeforeRouteLeave: AddRouterBeforeRouteHook<TRoutes, TRejections>;
|
|
6
|
+
onBeforeRouteUpdate: AddRouterBeforeRouteHook<TRoutes, TRejections>;
|
|
7
|
+
onAfterRouteLeave: AddRouterAfterRouteHook<TRoutes, TRejections>;
|
|
8
|
+
onAfterRouteUpdate: AddRouterAfterRouteHook<TRoutes, TRejections>;
|
|
9
9
|
};
|
|
10
|
-
export declare function createComponentHooks<TRouter extends Router>(routerKey: InjectionKey<TRouter>): ComponentHooks<RouterRoutes<TRouter>>;
|
|
10
|
+
export declare function createComponentHooks<TRouter extends Router>(routerKey: InjectionKey<TRouter>): ComponentHooks<RouterRoutes<TRouter>, RouterRejections<TRouter>>;
|
|
11
11
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Router, RouterRoutes, AddRouterBeforeRouteHook, AddRouterAfterRouteHook } from '../types/router';
|
|
1
|
+
import { Router, RouterRoutes, AddRouterBeforeRouteHook, AddRouterAfterRouteHook, RouterRejections } from '../types/router';
|
|
2
2
|
import { InjectionKey } from 'vue';
|
|
3
3
|
import { createRouterView } from '../components/routerView';
|
|
4
4
|
import { createRouterLink } from '../components/routerLink';
|
|
@@ -16,7 +16,7 @@ type RouterAssets<TRouter extends Router> = {
|
|
|
16
16
|
* @returns {RouteHookRemove} A function that removes the added hook.
|
|
17
17
|
* @group Hooks
|
|
18
18
|
*/
|
|
19
|
-
onBeforeRouteLeave: AddRouterBeforeRouteHook<RouterRoutes<TRouter>>;
|
|
19
|
+
onBeforeRouteLeave: AddRouterBeforeRouteHook<RouterRoutes<TRouter>, RouterRejections<TRouter>>;
|
|
20
20
|
/**
|
|
21
21
|
* Registers a hook that is called before a route is updated. Must be called from setup.
|
|
22
22
|
* This is particularly useful for handling changes in route parameters or query while staying within the same component.
|
|
@@ -25,7 +25,7 @@ type RouterAssets<TRouter extends Router> = {
|
|
|
25
25
|
* @returns {RouteHookRemove} A function that removes the added hook.
|
|
26
26
|
* @group Hooks
|
|
27
27
|
*/
|
|
28
|
-
onBeforeRouteUpdate: AddRouterBeforeRouteHook<RouterRoutes<TRouter>>;
|
|
28
|
+
onBeforeRouteUpdate: AddRouterBeforeRouteHook<RouterRoutes<TRouter>, RouterRejections<TRouter>>;
|
|
29
29
|
/**
|
|
30
30
|
* Registers a hook that is called after a route has been left. Must be called during setup.
|
|
31
31
|
* This can be used for cleanup actions after the component is no longer active, ensuring proper resource management.
|
|
@@ -34,7 +34,7 @@ type RouterAssets<TRouter extends Router> = {
|
|
|
34
34
|
* @returns {RouteHookRemove} A function that removes the added hook.
|
|
35
35
|
* @group Hooks
|
|
36
36
|
*/
|
|
37
|
-
onAfterRouteLeave: AddRouterAfterRouteHook<RouterRoutes<TRouter>>;
|
|
37
|
+
onAfterRouteLeave: AddRouterAfterRouteHook<RouterRoutes<TRouter>, RouterRejections<TRouter>>;
|
|
38
38
|
/**
|
|
39
39
|
* Registers a hook that is called after a route has been updated. Must be called during setup.
|
|
40
40
|
* This is ideal for responding to updates within the same route, such as parameter changes, without full component reloads.
|
|
@@ -43,7 +43,7 @@ type RouterAssets<TRouter extends Router> = {
|
|
|
43
43
|
* @returns {RouteHookRemove} A function that removes the added hook.
|
|
44
44
|
* @group Hooks
|
|
45
45
|
*/
|
|
46
|
-
onAfterRouteUpdate: AddRouterAfterRouteHook<RouterRoutes<TRouter>>;
|
|
46
|
+
onAfterRouteUpdate: AddRouterAfterRouteHook<RouterRoutes<TRouter>, RouterRejections<TRouter>>;
|
|
47
47
|
/**
|
|
48
48
|
* A guard to verify if a route or unknown value matches a given route name.
|
|
49
49
|
*
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Router, RouterRejections, RouterRoutes } from '../types/router';
|
|
2
|
+
import { RouterPush } from '../types/routerPush';
|
|
3
|
+
import { RouterReject } from '../types/routerReject';
|
|
4
|
+
import { RouterReplace } from '../types/routerReplace';
|
|
5
|
+
import { InjectionKey } from 'vue';
|
|
6
|
+
import { BuiltInRejectionType } from './createRouterReject';
|
|
7
|
+
import { AsString } from '../types/utilities';
|
|
8
|
+
import { Routes } from '../types/route';
|
|
9
|
+
/**
|
|
10
|
+
* Defines the structure of a successful callback response.
|
|
11
|
+
*/
|
|
12
|
+
export type RouterCallbackSuccessResponse = {
|
|
13
|
+
status: 'SUCCESS';
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Defines the structure of an aborted callback response.
|
|
17
|
+
*/
|
|
18
|
+
export type RouterCallbackAbortResponse = {
|
|
19
|
+
status: 'ABORT';
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Defines the structure of a callback response that results in a push to a new route.
|
|
23
|
+
*/
|
|
24
|
+
export type RouterCallbackPushResponse<TRoutes extends Routes> = {
|
|
25
|
+
status: 'PUSH';
|
|
26
|
+
to: Parameters<RouterPush<TRoutes>>;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Defines the structure of a callback response that results in the rejection of a route transition.
|
|
30
|
+
*/
|
|
31
|
+
export type RouterCallbackRejectResponse<TRejections extends PropertyKey> = {
|
|
32
|
+
status: 'REJECT';
|
|
33
|
+
type: AsString<TRejections> | BuiltInRejectionType;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* A function that can be called to abort a routing operation.
|
|
37
|
+
*/
|
|
38
|
+
export type CallbackContextAbort = () => void;
|
|
39
|
+
export type RouterCallbackContext<TRouter extends Router> = {
|
|
40
|
+
reject: RouterReject<RouterRejections<TRouter>>;
|
|
41
|
+
push: RouterPush<RouterRoutes<TRouter>>;
|
|
42
|
+
replace: RouterReplace<RouterRoutes<TRouter>>;
|
|
43
|
+
abort: CallbackContextAbort;
|
|
44
|
+
};
|
|
45
|
+
export declare function createRouterCallbackContext<TRouter extends Router>(_routerKey: InjectionKey<TRouter>): RouterCallbackContext<TRouter>;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { AddGlobalRouteHooks, AddComponentAfterRouteHook, AddComponentBeforeRouteHook } from '../types/hooks';
|
|
2
2
|
import { HasVueAppStore } from './createVueAppStore';
|
|
3
|
-
import { AddRouterAfterRouteHook, AddRouterBeforeRouteHook, Router, RouterRoutes, RouterRouteHookBeforeRunner, RouterRouteHookAfterRunner } from '../types/router';
|
|
3
|
+
import { AddRouterAfterRouteHook, AddRouterBeforeRouteHook, Router, RouterRoutes, RouterRouteHookBeforeRunner, RouterRouteHookAfterRunner, RouterRejections } from '../types/router';
|
|
4
4
|
import { Routes } from '../types/route';
|
|
5
5
|
import { InjectionKey } from 'vue';
|
|
6
|
-
export declare const getRouterHooksKey: (routerKey: InjectionKey<Router>) => InjectionKey<RouterHooks<any>>;
|
|
7
|
-
export type RouterHooks<TRoutes extends Routes> = HasVueAppStore & {
|
|
6
|
+
export declare const getRouterHooksKey: (routerKey: InjectionKey<Router>) => InjectionKey<RouterHooks<any, any>>;
|
|
7
|
+
export type RouterHooks<TRoutes extends Routes, TRejections extends PropertyKey> = HasVueAppStore & {
|
|
8
8
|
runBeforeRouteHooks: RouterRouteHookBeforeRunner<TRoutes>;
|
|
9
9
|
runAfterRouteHooks: RouterRouteHookAfterRunner<TRoutes>;
|
|
10
|
-
addComponentBeforeRouteHook: AddComponentBeforeRouteHook<TRoutes>;
|
|
11
|
-
addComponentAfterRouteHook: AddComponentAfterRouteHook<TRoutes>;
|
|
12
|
-
addGlobalRouteHooks: AddGlobalRouteHooks<TRoutes>;
|
|
13
|
-
onBeforeRouteEnter: AddRouterBeforeRouteHook<TRoutes>;
|
|
14
|
-
onBeforeRouteUpdate: AddRouterBeforeRouteHook<TRoutes>;
|
|
15
|
-
onBeforeRouteLeave: AddRouterBeforeRouteHook<TRoutes>;
|
|
16
|
-
onAfterRouteEnter: AddRouterAfterRouteHook<TRoutes>;
|
|
17
|
-
onAfterRouteUpdate: AddRouterAfterRouteHook<TRoutes>;
|
|
18
|
-
onAfterRouteLeave: AddRouterAfterRouteHook<TRoutes>;
|
|
10
|
+
addComponentBeforeRouteHook: AddComponentBeforeRouteHook<TRoutes, TRejections>;
|
|
11
|
+
addComponentAfterRouteHook: AddComponentAfterRouteHook<TRoutes, TRejections>;
|
|
12
|
+
addGlobalRouteHooks: AddGlobalRouteHooks<TRoutes, TRejections>;
|
|
13
|
+
onBeforeRouteEnter: AddRouterBeforeRouteHook<TRoutes, TRejections>;
|
|
14
|
+
onBeforeRouteUpdate: AddRouterBeforeRouteHook<TRoutes, TRejections>;
|
|
15
|
+
onBeforeRouteLeave: AddRouterBeforeRouteHook<TRoutes, TRejections>;
|
|
16
|
+
onAfterRouteEnter: AddRouterAfterRouteHook<TRoutes, TRejections>;
|
|
17
|
+
onAfterRouteUpdate: AddRouterAfterRouteHook<TRoutes, TRejections>;
|
|
18
|
+
onAfterRouteLeave: AddRouterAfterRouteHook<TRoutes, TRejections>;
|
|
19
19
|
};
|
|
20
|
-
export declare function createRouterHooks<TRouter extends Router>(_routerKey: InjectionKey<TRouter>): RouterHooks<RouterRoutes<TRouter>>;
|
|
20
|
+
export declare function createRouterHooks<TRouter extends Router>(_routerKey: InjectionKey<TRouter>): RouterHooks<RouterRoutes<TRouter>, RouterRejections<TRouter>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ResolvedRoute } from '../types/resolved';
|
|
2
2
|
import { RouterRouteHooks } from '../models/RouterRouteHooks';
|
|
3
3
|
import { Routes } from '../main';
|
|
4
|
-
export declare function getGlobalBeforeRouteHooks<TRoutes extends Routes>(to: ResolvedRoute, from: ResolvedRoute | null, globalHooks: RouterRouteHooks<TRoutes>): RouterRouteHooks<TRoutes>;
|
|
5
|
-
export declare function getGlobalAfterRouteHooks<TRoutes extends Routes>(to: ResolvedRoute, from: ResolvedRoute | null, globalHooks: RouterRouteHooks<TRoutes>): RouterRouteHooks<TRoutes>;
|
|
4
|
+
export declare function getGlobalBeforeRouteHooks<TRoutes extends Routes, TRejections extends PropertyKey>(to: ResolvedRoute, from: ResolvedRoute | null, globalHooks: RouterRouteHooks<TRoutes, TRejections>): RouterRouteHooks<TRoutes, TRejections>;
|
|
5
|
+
export declare function getGlobalAfterRouteHooks<TRoutes extends Routes, TRejections extends PropertyKey>(to: ResolvedRoute, from: ResolvedRoute | null, globalHooks: RouterRouteHooks<TRoutes, TRejections>): RouterRouteHooks<TRoutes, TRejections>;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { RouteHooks } from '../models/RouteHooks';
|
|
2
2
|
import { ResolvedRoute } from '../types/resolved';
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated will be removed in a future version
|
|
5
|
+
*/
|
|
3
6
|
export declare function getBeforeRouteHooksFromRoutes(to: ResolvedRoute, from: ResolvedRoute | null): RouteHooks;
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated will be removed in a future version
|
|
9
|
+
*/
|
|
4
10
|
export declare function getAfterRouteHooksFromRoutes(to: ResolvedRoute, from: ResolvedRoute | null): RouteHooks;
|
package/dist/types/hooks.d.ts
CHANGED
|
@@ -8,11 +8,29 @@ import { RouterAfterRouteHook, RouterBeforeRouteHook } from './router';
|
|
|
8
8
|
* Defines route hooks that can be applied before entering, updating, or leaving a route, as well as after these events.
|
|
9
9
|
*/
|
|
10
10
|
export type WithHooks = {
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated Use router.onBeforeRouteEnter instead
|
|
13
|
+
*/
|
|
11
14
|
onBeforeRouteEnter?: MaybeArray<BeforeRouteHook>;
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated Use router.onBeforeRouteUpdate instead
|
|
17
|
+
*/
|
|
12
18
|
onBeforeRouteUpdate?: MaybeArray<BeforeRouteHook>;
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Use router.onBeforeRouteLeave instead
|
|
21
|
+
*/
|
|
13
22
|
onBeforeRouteLeave?: MaybeArray<BeforeRouteHook>;
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated Use router.onAfterRouteEnter instead
|
|
25
|
+
*/
|
|
14
26
|
onAfterRouteEnter?: MaybeArray<AfterRouteHook>;
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated Use router.onAfterRouteUpdate instead
|
|
29
|
+
*/
|
|
15
30
|
onAfterRouteUpdate?: MaybeArray<AfterRouteHook>;
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated Use router.onAfterRouteLeave instead
|
|
33
|
+
*/
|
|
16
34
|
onAfterRouteLeave?: MaybeArray<AfterRouteHook>;
|
|
17
35
|
};
|
|
18
36
|
export type BeforeHookContext = {
|
|
@@ -26,19 +44,19 @@ export type AfterHookContext = {
|
|
|
26
44
|
};
|
|
27
45
|
export type RouteHookAfterRunner = (context: AfterHookContext) => Promise<AfterRouteHookResponse>;
|
|
28
46
|
export type RouteHookTiming = 'global' | 'component';
|
|
29
|
-
|
|
47
|
+
type BeforeRouteHookRegistration<TRoutes extends Routes, TRejections extends PropertyKey> = {
|
|
30
48
|
lifecycle: 'onBeforeRouteEnter' | 'onBeforeRouteUpdate' | 'onBeforeRouteLeave';
|
|
31
|
-
hook: RouterBeforeRouteHook<TRoutes>;
|
|
49
|
+
hook: RouterBeforeRouteHook<TRoutes, TRejections>;
|
|
32
50
|
depth: number;
|
|
33
51
|
};
|
|
34
|
-
export type AddComponentBeforeRouteHook<TRoutes extends Routes> = (hook: BeforeRouteHookRegistration<TRoutes>) => RouteHookRemove;
|
|
35
|
-
|
|
52
|
+
export type AddComponentBeforeRouteHook<TRoutes extends Routes, TRejections extends PropertyKey> = (hook: BeforeRouteHookRegistration<TRoutes, TRejections>) => RouteHookRemove;
|
|
53
|
+
type AfterRouteHookRegistration<TRoutes extends Routes, TRejections extends PropertyKey> = {
|
|
36
54
|
lifecycle: 'onAfterRouteEnter' | 'onAfterRouteUpdate' | 'onAfterRouteLeave';
|
|
37
|
-
hook: RouterAfterRouteHook<TRoutes>;
|
|
55
|
+
hook: RouterAfterRouteHook<TRoutes, TRejections>;
|
|
38
56
|
depth: number;
|
|
39
57
|
};
|
|
40
|
-
export type AddComponentAfterRouteHook<TRoutes extends Routes> = (hook: AfterRouteHookRegistration<TRoutes>) => RouteHookRemove;
|
|
41
|
-
export type AddGlobalRouteHooks<TRoutes extends Routes> = (hooks: RouterRouteHooks<TRoutes>) => void;
|
|
58
|
+
export type AddComponentAfterRouteHook<TRoutes extends Routes, TRejections extends PropertyKey> = (hook: AfterRouteHookRegistration<TRoutes, TRejections>) => RouteHookRemove;
|
|
59
|
+
export type AddGlobalRouteHooks<TRoutes extends Routes, TRejections extends PropertyKey> = (hooks: RouterRouteHooks<TRoutes, TRejections>) => void;
|
|
42
60
|
/**
|
|
43
61
|
* Context provided to route hooks, containing context of previous route and functions for triggering rejections and push/replace to another route.
|
|
44
62
|
*/
|
package/dist/types/register.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { Route, Routes } from './route';
|
|
|
3
3
|
import { Router, RouterOptions } from './router';
|
|
4
4
|
import { RouterPush } from './routerPush';
|
|
5
5
|
import { RouterReplace } from './routerReplace';
|
|
6
|
+
import { RoutesName } from './routesMap';
|
|
6
7
|
/**
|
|
7
8
|
* Represents the state of currently registered router, and route meta. Used to provide correct type context for
|
|
8
9
|
* components like `RouterLink`, as well as for composables like `useRouter`, `useRoute`, and hooks.
|
|
@@ -27,12 +28,14 @@ export type RegisteredRouter<T = Register> = T extends {
|
|
|
27
28
|
} ? TRouter : Router;
|
|
28
29
|
/**
|
|
29
30
|
* Represents the Router routes property within {@link Register}
|
|
31
|
+
* @deprecated will be removed in a future version
|
|
30
32
|
*/
|
|
31
33
|
export type RegisteredRoutes<T = Register> = T extends {
|
|
32
34
|
router: Router<infer TRoutes extends Routes>;
|
|
33
35
|
} ? TRoutes : Route[];
|
|
34
36
|
/**
|
|
35
37
|
* Represents the possible Rejections registered within {@link Register}
|
|
38
|
+
* @deprecated use `createRouter(..., { rejections: {}}) instead
|
|
36
39
|
*/
|
|
37
40
|
export type RegisteredRejectionType<T = Register> = T extends {
|
|
38
41
|
router: Router<any, infer TOptions extends RouterOptions>;
|
|
@@ -45,13 +48,21 @@ export type RouteMeta<T = Register> = T extends {
|
|
|
45
48
|
} ? RouteMeta : Record<string, unknown>;
|
|
46
49
|
/**
|
|
47
50
|
* Represents the type for router `push`, with types for routes registered within {@link Register}
|
|
51
|
+
* @deprecated will be removed in a future version
|
|
48
52
|
*/
|
|
49
53
|
export type RegisteredRouterPush = RouterPush<RegisteredRoutes>;
|
|
50
54
|
/**
|
|
51
55
|
* Represents the type for router `replace`, with types for routes registered within {@link Register}
|
|
56
|
+
* @deprecated will be removed in a future version
|
|
52
57
|
*/
|
|
53
58
|
export type RegisteredRouterReplace = RouterReplace<RegisteredRoutes>;
|
|
54
59
|
/**
|
|
55
60
|
* Type for Router Reject method. Triggers rejections registered within {@link Register}
|
|
61
|
+
* @deprecated will be removed in a future version
|
|
56
62
|
*/
|
|
57
63
|
export type RegisteredRouterReject = (type: RegisteredRejectionType) => void;
|
|
64
|
+
/**
|
|
65
|
+
* Represents the union of all possible route names registered within {@link Register}
|
|
66
|
+
* @deprecated will be removed in a future version
|
|
67
|
+
*/
|
|
68
|
+
export type RegisteredRoutesName = RoutesName<RegisteredRoutes>;
|