@kitbag/router 0.20.8 → 0.20.10
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/errors/{callbackContextAbortError.d.ts → contextAbortError.d.ts} +2 -1
- package/dist/errors/contextError.d.ts +2 -0
- package/dist/errors/{callbackContextPushError.d.ts → contextPushError.d.ts} +2 -1
- package/dist/errors/{callbackContextRejectionError.d.ts → contextRejectionError.d.ts} +2 -1
- package/dist/kitbag-router.js +1322 -1277
- package/dist/kitbag-router.umd.cjs +3 -3
- package/dist/main.d.ts +14 -151
- package/dist/models/RouterRouteHooks.d.ts +2 -1
- package/dist/services/createRouterAssets.d.ts +1 -2
- package/dist/services/createRouterHooks.d.ts +3 -1
- package/dist/types/createRouteOptions.d.ts +5 -1
- package/dist/types/meta.d.ts +3 -1
- package/dist/types/router.d.ts +21 -0
- package/dist/utilities/testHelpers.d.ts +43 -27
- package/package.json +9 -8
|
@@ -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 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 "${
|
|
1
|
+
(function(V,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],u):(V=typeof globalThis<"u"?globalThis:V||self,u(V["@kitbag/router"]={},V.Vue))})(this,function(V,u){"use strict";class vt extends Error{constructor(t){super(`Invalid Param "${t}": Router does not support multiple params by the same name. All param names must be unique.`)}}function ue(e){return Array.isArray(e)?e:[e]}function St(e,t){return e.filter(r=>t===r).length}function fe(...e){const t=e.flatMap(r=>Array.isArray(r)?r:Object.keys(r));for(const r of t)if(St(t,r)>1)throw new vt(r)}class Y extends Error{}const we="[",ke="]";function Lr(e){return e!==String&&e!==Boolean&&e!==Number&&e!==Date}function Vr(e){return typeof e=="function"&&Lr(e)}function Le(e){return typeof e=="object"&&"get"in e&&typeof e.get=="function"&&"set"in e&&typeof e.set=="function"}function Pt(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function At(e,t){return Le(e)?{...e,defaultValue:t??e.defaultValue}:{get:r=>ne(r,e),set:r=>K(r,e),defaultValue:t}}function Nr(e){return Le(e)&&e.defaultValue!==void 0}function Br(e,t){return At(e,t)}function Cr(e){return e!==void 0}function le(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function M(e){return typeof e=="string"&&e.length>0}let U=null;async function Or(){const{ZodSchema:e,ZodString:t,ZodBoolean:r,ZodDate:n,ZodNumber:o,ZodLiteral:a,ZodObject:s,ZodEnum:i,ZodNativeEnum:c,ZodArray:d,ZodTuple:y,ZodUnion:R,ZodDiscriminatedUnion:L,ZodRecord:S,ZodMap:x,ZodSet:w,ZodIntersection:k,ZodPromise:h,ZodFunction:v}=await import("zod");return{ZodSchema:e,ZodString:t,ZodBoolean:r,ZodDate:n,ZodNumber:o,ZodLiteral:a,ZodObject:s,ZodEnum:i,ZodNativeEnum:c,ZodArray:d,ZodTuple:y,ZodUnion:R,ZodDiscriminatedUnion:L,ZodRecord:S,ZodMap:x,ZodSet:w,ZodIntersection:k,ZodPromise:h,ZodFunction:v}}function xr(e){return Object.values(e).some(t=>Object.values(t.host.params).some(r=>De(r))||Object.values(t.path.params).some(r=>De(r))||Object.values(t.query.params).some(r=>De(r)))}function De(e){return le(e)&&"parse"in e&&typeof e.parse=="function"&&"~standard"in e&&le(e["~standard"])&&"vendor"in e["~standard"]&&e["~standard"].vendor==="zod"}async function jr(){try{U=await Or()}catch{throw new Error("Failed to initialize Zod")}}function Ut(e){return U?e instanceof U.ZodSchema:!1}function kt(e){return{get:(t,{invalid:r})=>{try{return _e(t,e)}catch{throw r()}},set:(t,{invalid:r})=>{try{return Ie(t,e)}catch{throw r()}}}}const Zr=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;function pe(e,t){if(typeof t=="string"&&Zr.test(t)){const r=new Date(t);return isNaN(r.getTime())?t:r}return t}function de(e){for(const t of e)try{return t()}catch{continue}throw new Error("All functions failed")}function Ve(e,t){return U?.ZodString&&e instanceof U.ZodString?1:U?.ZodString&&t instanceof U.ZodString?-1:0}function _e(e,t){if(!U)throw new Error("Zod is not initialized");if(t instanceof U.ZodString)return t.parse(e);if(t instanceof U.ZodBoolean)return t.parse(!!e);if(t instanceof U.ZodDate)return t.parse(new Date(e));if(t instanceof U.ZodNumber)return t.parse(Number(e));if(t instanceof U.ZodLiteral)return de([()=>t.parse(Number(e)),()=>t.parse(!!e),()=>t.parse(e)]);if(t instanceof U.ZodObject)return t.parse(JSON.parse(e,pe));if(t instanceof U.ZodEnum)return t.parse(e);if(t instanceof U.ZodNativeEnum)return de([()=>t.parse(Number(e)),()=>t.parse(e)]);if(t instanceof U.ZodArray||t instanceof U.ZodTuple)return t.parse(JSON.parse(e,pe));if(t instanceof U.ZodUnion){const r=Array.from(t._def.options).sort(Ve).map(n=>()=>_e(e,n));return de(r)}if(t instanceof U.ZodDiscriminatedUnion){const r=Array.from(t.options).sort(Ve).map(n=>()=>_e(e,n));return de(r)}if(t instanceof U.ZodRecord)return t.parse(JSON.parse(e,pe));if(t instanceof U.ZodMap)return t.parse(new Map(JSON.parse(e,pe)));if(t instanceof U.ZodSet)return t.parse(new Set(JSON.parse(e,pe)));if(t instanceof U.ZodIntersection)throw new Error("Intersection schemas are not supported");if(t instanceof U.ZodPromise)throw new Error("Promise schemas are not supported");if(t instanceof U.ZodFunction)throw new Error("Function schemas are not supported");return t.parse(e)}function Ie(e,t){if(!U)throw new Error("Zod is not initialized");if(t instanceof U.ZodString)return t.parse(e);if(t instanceof U.ZodBoolean)return t.parse(e).toString();if(t instanceof U.ZodDate)return t.parse(e).toISOString();if(t instanceof U.ZodNumber)return t.parse(Number(e)).toString();if(t instanceof U.ZodLiteral)return t.parse(e).toString();if(t instanceof U.ZodObject)return JSON.stringify(t.parse(e));if(t instanceof U.ZodEnum)return t.parse(e);if(t instanceof U.ZodNativeEnum)return t.parse(e).toString();if(t instanceof U.ZodArray||t instanceof U.ZodTuple)return JSON.stringify(t.parse(e));if(t instanceof U.ZodUnion){const r=Array.from(t._def.options).sort(Ve).map(n=>()=>Ie(e,n));return de(r)}if(t instanceof U.ZodDiscriminatedUnion){const r=Array.from(t.options).sort(Ve).map(n=>()=>Ie(e,n));return de(r)}if(t instanceof U.ZodRecord)return JSON.stringify(t.parse(e));if(t instanceof U.ZodMap){const r=t.parse(e);return JSON.stringify(Array.from(r.entries()))}if(t instanceof U.ZodSet){const r=t.parse(e);return JSON.stringify(Array.from(r.values()))}if(t instanceof U.ZodIntersection)throw new Error("Intersection schemas are not supported");if(t instanceof U.ZodPromise)throw new Error("Promise schemas are not supported");if(t instanceof U.ZodFunction)throw new Error("Function schemas are not supported");return JSON.stringify(t.parse(e))}function Je(e){return typeof e=="object"&&e!==null&&"then"in e}function O(e,t){const r=e["~standard"].validate(t);if(Je(r))throw new Error("Promise schemas are not supported");if(r.issues)throw new Error("Validation failed");return r.value}function Hr(e){return le(e)&&"type"in e&&typeof e.type=="string"&&"~standard"in e&&le(e["~standard"])&&"vendor"in e["~standard"]&&e["~standard"].vendor==="valibot"}function Lt(e){return Hr(e)}function Vt(e){return{get:(t,{invalid:r})=>{try{return Te(t,e)}catch{throw r()}},set:(t,{invalid:r})=>{try{return Me(t,e)}catch{throw r()}}}}const $r=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;function he(e,t){if(typeof t=="string"&&$r.test(t)){const r=new Date(t);return isNaN(r.getTime())?t:r}return t}function me(e){for(const t of e)try{return t()}catch{continue}throw new Error("All functions failed")}function Ne(e,t){return e.type==="string"?1:t.type==="string"?-1:0}function Te(e,t){if(t.type==="boolean")return O(t,!!e);if(t.type==="date")return O(t,new Date(e));if(t.type==="number")return O(t,Number(e));if(t.type==="literal")return me([()=>O(t,Number(e)),()=>O(t,!!e),()=>O(t,e)]);if(t.type==="object")return O(t,JSON.parse(e,he));if(t.type==="enum")return me([()=>O(t,Number(e)),()=>O(t,!!e),()=>O(t,e)]);if(t.type==="array"||t.type==="tuple")return O(t,JSON.parse(e,he));if(t.type==="union"&&"options"in t){const r=t.options.sort(Ne).map(n=>()=>Te(e,n));return me(r)}if(t.type==="variant"&&"options"in t){const r=t.options.sort(Ne).map(n=>()=>Te(e,n));return me(r)}if(t.type==="record")return O(t,JSON.parse(e,he));if(t.type==="map")return O(t,new Map(JSON.parse(e,he)));if(t.type==="set")return O(t,new Set(JSON.parse(e,he)));if(t.type==="intersection")throw new Error("Intersection schemas are not supported");if(t.type==="promise")throw new Error("Promise schemas are not supported");if(t.type==="function")throw new Error("Function schemas are not supported");return O(t,e)}function Me(e,t){if(t.type==="string"||t.type==="boolean")return O(t,e).toString();if(t.type==="date")return O(t,e).toISOString();if(t.type==="number")return O(t,Number(e)).toString();if(t.type==="literal")return O(t,e).toString();if(t.type==="object")return JSON.stringify(O(t,e));if(t.type==="enum"||t.type==="nativeEnum")return O(t,e).toString();if(t.type==="array"||t.type==="tuple")return JSON.stringify(O(t,e));if(t.type==="union"&&"options"in t){const r=t.options.sort(Ne).map(n=>()=>Me(e,n));return me(r)}if(t.type==="variant"&&"options"in t){const r=t.options.sort(Ne).map(n=>()=>Me(e,n));return me(r)}if(t.type==="record")return JSON.stringify(O(t,e));if(t.type==="map"){const r=O(t,e);return JSON.stringify(Array.from(r.entries()))}if(t.type==="set"){const r=O(t,e);return JSON.stringify(Array.from(r.values()))}if(t.type==="intersection")throw new Error("Intersection schemas are not supported");if(t.type==="promise")throw new Error("Promise schemas are not supported");if(t.type==="function")throw new Error("Function schemas are not supported");return JSON.stringify(O(t,e))}function qr(e,t){return e[t]??String}const Z={invalid:e=>{throw new Y(e)}},Nt={get:e=>e,set:(e,{invalid:t})=>{if(typeof e!="string")throw t();return e}},Fe={get:(e,{invalid:t})=>{if(e==="true")return!0;if(e==="false")return!1;throw t()},set:(e,{invalid:t})=>{if(typeof e!="boolean")throw t();return e.toString()}},We={get:(e,{invalid:t})=>{const r=Number(e);if(isNaN(r))throw t();return r},set:(e,{invalid:t})=>{if(typeof e!="number")throw t();return e.toString()}},Bt={get:(e,{invalid:t})=>{const r=new Date(e);if(isNaN(r.getTime()))throw t();return r},set:(e,{invalid:t})=>{if(typeof e!="object"||!(e instanceof Date))throw t();return e.toISOString()}},Ct={get:(e,{invalid:t})=>{try{return JSON.parse(e)}catch{throw t()}},set:(e,{invalid:t})=>{try{return JSON.stringify(e)}catch{throw t()}}};function Dr(e,t){switch(typeof t){case"string":return Nt.get(e,Z)===t;case"number":return We.get(e,Z)===t;case"boolean":return Fe.get(e,Z)===t;default:return!1}}function ne(e,t,r=!1){if(e===void 0||!M(e)){if(Nr(t))return t.defaultValue;if(r)return;throw new Y}if(t===String)return Nt.get(e,Z);if(t===Boolean)return Fe.get(e,Z);if(t===Number)return We.get(e,Z);if(t===Date)return Bt.get(e,Z);if(t===JSON)return Ct.get(e,Z);if(Vr(t))return t(e,Z);if(Le(t))return t.get(e,Z);if(t instanceof RegExp){if(t.test(e))return e;throw new Y}if(Pt(t)){if(Dr(e,t))return t;throw new Y}return Ut(t)?kt(t).get(e,Z):Lt(t)?Vt(t).get(e,Z):e}function Ge(e,t,r=!1){try{return ne(e,t,r)}catch(n){if(n instanceof Y)return;throw n}}function _r(e,t,r=!1){try{return K(e,t,r)}catch(n){if(n instanceof Y)return;throw n}}function K(e,t,r=!1){if(e===void 0){if(r)return"";throw new Y}if(t===Boolean)return Fe.set(e,Z);if(t===Number)return We.set(e,Z);if(t===Date)return Bt.set(e,Z);if(t===JSON)return Ct.set(e,Z);if(Le(t))return t.set(e,Z);if(Pt(t)){if(t!==e)throw new Y;return e.toString()}if(Ut(t))return kt(t).set(e,Z);if(Lt(t))return Vt(t).set(e,Z);try{return e.toString()}catch{throw new Y}}function Qe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ir(e,t){const r=Array.from(e.matchAll(t));if(r.length===0)return[e];let n=0;const o=r.reduce((s,i)=>{const c=Qe(e.slice(n,i.index));c.length&&s.push(c);const[d]=i;return s.push(d),n=i.index+d.length,s},[]),a=e.slice(n);return a&&o.push(a),o}function Jr(e){const t=Ot(e.path.value);return new RegExp(`^${t}$`,"i")}function Tr(e){const t=new URLSearchParams(e.query.value);return Array.from(t.entries()).filter(([,r])=>!Ye(r)).map(([r,n])=>{const o=Ot(n);return new RegExp(`${Qe(r)}=${o}(&|$)`,"i")})}function Ot(e){return Ir(e,new RegExp(Be,"g")).map(t=>t.startsWith(we)?xt(t):Qe(t)).join("")}function xt(e){return e.replace(new RegExp(Be,"g"),Wr)}function Mr(e,t){const r=jt(t);return e.replace(r,Gr)}function ze(e,t){return Qr(t).test(e.value)}function Ye(e){return new RegExp(Fr,"g").test(e)}const Be=`\\${we}\\??([\\w-_]+)\\${ke}`,Fr=`\\${we}\\?([\\w-_]+)\\${ke}`,Wr=".*",Gr="(.*)";function Ke(e){const[t]=Zt(e,new RegExp(Be,"g"));return t}function jt(e){return new RegExp(`\\${we}\\??${e}\\${ke}`,"g")}function Qr(e){return new RegExp(`\\${we}\\?${e}\\${ke}`,"g")}function Zt(e,t){return Array.from(e.matchAll(t)).flatMap(([,...n])=>n.map(o=>M(o)?o:""))}function zr(e="",t={}){return M(e)?Array.from(e.matchAll(new RegExp(Be,"g"))).reduce((n,[o,a])=>{const s=Ke(o);if(!s)return n;const i=qr(t,s);return fe([s],n),n[a]=i,n},{}):{}}function Yr(e){return le(e)&&typeof e.value=="string"}function oe(e){return e===void 0?Q():Yr(e)?e:Q(e,{})}function Q(e,t){return{value:e??"",params:zr(e,t)}}function Ht(e,t){fe(e.params,t.params);const r=`${e.value}${t.value}`;return Q(r,{...e.params,...t.params})}function Kr(e,t){return Ht(e,t)}class $t extends Error{constructor(t){super(`Child property on meta for ${t} conflicts with the parent meta.`)}}function Xr(e,t){return en(e,t),{...e,...t}}function en(e,t){const r=Object.keys(e).find(n=>n in t&&typeof t[n]!=typeof e[n]);if(r)throw new $t(r)}function tn(e,t){fe(e.params,t.params);const r=[e.value,t.value].filter(M).join("&");return Q(r,{...e.params,...t.params})}function rn(e,t){return fe(e,t),{...e,...t}}function Xe(e){return"parent"in e&&!!e.parent}function et(e){return"component"in e&&!!e.component}function tt(e){return"props"in e&&typeof e.props=="function"}function rt(e){return"components"in e&&!!e.components}function nt(e){return"props"in e&&typeof e.props=="object"}function ot(e,t){return{...t,path:Ht(e.path,t.path),query:tn(e.query,t.query),meta:Xr(e.meta,t.meta),state:rn(e.state,t.state),hash:Kr(e.hash,t.hash),matches:[...e.matches,t.matched],host:e.host,depth:e.depth+1}}function _(e){return typeof e!="string"?!1:/^(https?:\/\/|\/).*/g.test(e)}function at(e){return _(e)?e:`/${e}`}class ae extends Error{constructor(){super("Router not installed")}}class qt extends Error{constructor(t,r){super(`useRoute called with incorrect route. Given ${t}, expected ${r}`)}}function st(){let e=0;return()=>(++e).toString()}const nn=st()();function on(e){return e===nn}const it=st();function Dt(e){return e===void 0?"":e}function se(e,t){const r=it(),n=Dt(e.name),o=oe(e.path),a=oe(e.query),s=oe(e.hash),i=e.meta??{},c=e.state??{},d=u.markRaw({id:r,meta:i,state:c,...e,props:t}),y={id:r,matched:d,matches:[d],name:n,path:o,query:a,hash:s,meta:i,state:c,depth:1,host:Q(),prefetch:e.prefetch},R=Xe(e)?ot(e.parent,y):y;return fe(R.path.params,R.query.params,R.hash.params),R}function an(e){const t=it(),r=Dt(e.name),n=oe(e.path),o=oe(e.query),a=oe(e.hash),s=e.meta??{},i=oe(e.host),c=u.markRaw({id:t,meta:{},state:{},...e}),d={id:t,matched:c,matches:[c],name:r,host:i,path:n,query:o,hash:a,meta:s,depth:1,state:{}},y=Xe(e)?ot(e.parent,d):d;return fe(y.path.params,y.query.params,y.host.params,y.hash.params),y}function Ee(){const e=new Map;return t=>{const r=e.get(t);if(!r){const n=Symbol();return e.set(t,n),n}return r}}const sn=Ee();function ct(e){const t=sn(e);return({increment:r=!1}={})=>{const n=u.inject(t,0);return r&&u.provide(t,n+1),n}}const be=(e,t,r)=>{const n=e.matches,o=t?.matches??[];return n.at(r)?.id!==o.at(r)?.id},ve=(e,t,r)=>{const n=e.matches,o=t?.matches??[];return n.at(r)?.id!==o.at(r)?.id},Se=(e,t,r)=>e.matches.at(r)?.id===t?.matches.at(r)?.id;function _t(e){switch(e){case"onBeforeRouteEnter":case"onAfterRouteEnter":return be;case"onBeforeRouteUpdate":case"onAfterRouteUpdate":return Se;case"onBeforeRouteLeave":case"onAfterRouteLeave":return ve;default:throw new Error(`Switch is not exhaustive for lifecycle: ${e}`)}}class It{onBeforeRouteEnter=new Set;onBeforeRouteUpdate=new Set;onBeforeRouteLeave=new Set;onAfterRouteEnter=new Set;onAfterRouteUpdate=new Set;onAfterRouteLeave=new Set}function cn(e,t){const r=new It;return e.matches.forEach((n,o)=>{n.onBeforeRouteEnter&&be(e,t,o)&&ue(n.onBeforeRouteEnter).forEach(a=>{process.env.NODE_ENV==="development"&&console.warn("[vue-router] onBeforeRouteEnter is deprecated. Use router.onBeforeRouteEnter instead"),r.onBeforeRouteEnter.add(a)}),n.onBeforeRouteUpdate&&Se(e,t,o)&&ue(n.onBeforeRouteUpdate).forEach(a=>{process.env.NODE_ENV==="development"&&console.warn("[vue-router] onBeforeRouteUpdate is deprecated. Use router.onBeforeRouteUpdate instead"),r.onBeforeRouteUpdate.add(a)})}),t?.matches.forEach((n,o)=>{n.onBeforeRouteLeave&&ve(e,t,o)&&ue(n.onBeforeRouteLeave).forEach(a=>{process.env.NODE_ENV==="development"&&console.warn("[vue-router] onBeforeRouteLeave is deprecated. Use router.onBeforeRouteLeave instead"),r.onBeforeRouteLeave.add(a)})}),r}function un(e,t){const r=new It;return e.matches.forEach((n,o)=>{n.onAfterRouteEnter&&be(e,t,o)&&ue(n.onAfterRouteEnter).forEach(a=>{process.env.NODE_ENV==="development"&&console.warn("[vue-router] onAfterRouteEnter is deprecated. Use router.onAfterRouteEnter instead"),r.onAfterRouteEnter.add(a)}),n.onAfterRouteUpdate&&Se(e,t,o)&&ue(n.onAfterRouteUpdate).forEach(a=>{process.env.NODE_ENV==="development"&&console.warn("[vue-router] onAfterRouteUpdate is deprecated. Use router.onAfterRouteUpdate instead"),r.onAfterRouteUpdate.add(a)})}),t?.matches.forEach((n,o)=>{n.onAfterRouteLeave&&ve(e,t,o)&&ue(n.onAfterRouteLeave).forEach(a=>{process.env.NODE_ENV==="development"&&console.warn("[vue-router] onAfterRouteLeave is deprecated. Use router.onAfterRouteLeave instead"),r.onAfterRouteLeave.add(a)})}),r}class Ce extends Error{}class I extends Ce{response;constructor(t){super("Uncaught ContextPushError"),this.response={status:"PUSH",to:t}}}class ee extends Ce{response;constructor(t){super("Uncaught ContextRejectionError"),this.response={status:"REJECT",type:t}}}class ut extends Ce{response;constructor(){super("Uncaught ContextAbortError"),this.response={status:"ABORT"}}}class Pe{onBeforeRouteEnter=new Set;onBeforeRouteUpdate=new Set;onBeforeRouteLeave=new Set;onAfterRouteEnter=new Set;onAfterRouteUpdate=new Set;onAfterRouteLeave=new Set;onError=new Set}function fn(e,t,r){const n=new Pe;return e.matches.forEach((o,a)=>{be(e,t,a)&&r.onBeforeRouteEnter.forEach(s=>n.onBeforeRouteEnter.add(s)),Se(e,t,a)&&r.onBeforeRouteUpdate.forEach(s=>n.onBeforeRouteUpdate.add(s))}),t?.matches.forEach((o,a)=>{ve(e,t,a)&&r.onBeforeRouteLeave.forEach(s=>n.onBeforeRouteLeave.add(s))}),n}function ln(e,t,r){const n=new Pe;return e.matches.forEach((o,a)=>{be(e,t,a)&&r.onAfterRouteEnter.forEach(s=>n.onAfterRouteEnter.add(s)),Se(e,t,a)&&r.onAfterRouteUpdate.forEach(s=>n.onAfterRouteUpdate.add(s))}),t?.matches.forEach((o,a)=>{ve(e,t,a)&&r.onAfterRouteLeave.forEach(s=>n.onAfterRouteLeave.add(s))}),n}function Jt(){let e=null;function t(n){e=n}function r(n){return e?e.runWithContext(n):n()}return{setVueApp:t,runWithContext:r}}function pn(e){return{reject:a=>{throw new ee(a)},push:(...a)=>{throw new I(a)},replace:(a,s,i)=>{if(_(a)){const y=s??{};throw new I([a,{...y,replace:!0}])}const c=s,d=i??{};throw new I([a,c,{...d,replace:!0}])},abort:()=>{throw new ut}}}const Tt=Ee();function dn(e){const{setVueApp:t,runWithContext:r}=Jt(),n={global:new Pe,component:new Pe},{reject:o,push:a,replace:s,abort:i}=pn(),c=f=>(n.global.onBeforeRouteEnter.add(f),()=>n.global.onBeforeRouteEnter.delete(f)),d=f=>(n.global.onBeforeRouteUpdate.add(f),()=>n.global.onBeforeRouteUpdate.delete(f)),y=f=>(n.global.onBeforeRouteLeave.add(f),()=>n.global.onBeforeRouteLeave.delete(f)),R=f=>(n.global.onAfterRouteEnter.add(f),()=>n.global.onAfterRouteEnter.delete(f)),L=f=>(n.global.onAfterRouteUpdate.add(f),()=>n.global.onAfterRouteUpdate.delete(f)),S=f=>(n.global.onAfterRouteLeave.add(f),()=>n.global.onAfterRouteLeave.delete(f)),x=f=>(n.global.onError.add(f),()=>n.global.onError.delete(f));async function w({to:f,from:E}){const{global:b,component:l}=n,g=cn(f,E),P=fn(f,E,b),B=[...P.onBeforeRouteEnter,...g.onBeforeRouteEnter,...P.onBeforeRouteUpdate,...g.onBeforeRouteUpdate,...l.onBeforeRouteUpdate,...P.onBeforeRouteLeave,...g.onBeforeRouteLeave,...l.onBeforeRouteLeave];try{const N=B.map(C=>r(()=>C(f,{from:E,reject:o,push:a,replace:s,abort:i})));await Promise.all(N)}catch(N){if(N instanceof I||N instanceof ee||N instanceof ut)return N.response;try{h(N,{to:f,from:E,source:"hook"})}catch(C){if(C instanceof I||C instanceof ee)return C.response;throw C}}return{status:"SUCCESS"}}async function k({to:f,from:E}){const{global:b,component:l}=n,g=un(f,E),P=ln(f,E,b),B=[...l.onAfterRouteLeave,...g.onAfterRouteLeave,...P.onAfterRouteLeave,...l.onAfterRouteUpdate,...g.onAfterRouteUpdate,...P.onAfterRouteUpdate,...l.onAfterRouteEnter,...g.onAfterRouteEnter,...P.onAfterRouteEnter];try{const N=B.map(C=>r(()=>C(f,{from:E,reject:o,push:a,replace:s})));await Promise.all(N)}catch(N){if(N instanceof I||N instanceof ee)return N.response;try{h(N,{to:f,from:E,source:"hook"})}catch(C){if(C instanceof I||C instanceof ee)return C.response;throw C}}return{status:"SUCCESS"}}function h(f,{to:E,from:b,source:l}){for(const g of n.global.onError)try{g(f,{to:E,from:b,source:l,reject:o,push:a,replace:s});return}catch(P){if(P instanceof Ce)throw P;if(P===f)continue;throw P}}return{runBeforeRouteHooks:w,runAfterRouteHooks:k,runErrorHooks:h,addComponentBeforeRouteHook:({lifecycle:f,depth:E,hook:b})=>{const l=_t(f),g=n.component[f],P=(B,N)=>{if(l(B,N.from,E))return b(B,N)};return g.add(P),()=>g.delete(P)},addComponentAfterRouteHook:({lifecycle:f,depth:E,hook:b})=>{const l=_t(f),g=n.component[f],P=(B,N)=>{if(l(B,N.from,E))return b(B,N)};return g.add(P),()=>g.delete(P)},addGlobalRouteHooks:f=>{f.onBeforeRouteEnter.forEach(E=>c(E)),f.onBeforeRouteUpdate.forEach(E=>d(E)),f.onBeforeRouteLeave.forEach(E=>y(E)),f.onAfterRouteEnter.forEach(E=>R(E)),f.onAfterRouteUpdate.forEach(E=>L(E)),f.onAfterRouteLeave.forEach(E=>S(E)),f.onError.forEach(E=>x(E))},onBeforeRouteEnter:c,onBeforeRouteUpdate:d,onBeforeRouteLeave:y,onAfterRouteEnter:R,onAfterRouteUpdate:L,onAfterRouteLeave:S,onError:x,setVueApp:t}}function Mt(e){const t=Tt(e);return()=>{const r=u.inject(t);if(!r)throw new ae;return r}}function Ft(e,t){const r=ct(e),n=Mt(e);return o=>{const a=r(),i=n().addComponentBeforeRouteHook({lifecycle:t,hook:o,depth:a-1});return u.onUnmounted(i),i}}function Wt(e,t){const r=ct(e),n=Mt(e);return o=>{const a=r(),i=n().addComponentAfterRouteHook({lifecycle:t,hook:o,depth:a-1});return u.onUnmounted(i),i}}function hn(e){const t=Ft(e,"onBeforeRouteLeave"),r=Ft(e,"onBeforeRouteUpdate"),n=Wt(e,"onAfterRouteLeave"),o=Wt(e,"onAfterRouteUpdate");return{onBeforeRouteLeave:t,onBeforeRouteUpdate:r,onAfterRouteLeave:n,onAfterRouteUpdate:o}}const Gt=Ee();function mn(e){const t=Gt(e);return()=>{const r=u.inject(t);if(!r)throw new ae;return r}}const Qt=Ee();function Rn(e){const t=Qt(e);return()=>{const r=u.inject(t);if(!r)throw new ae;return r}}function Ae(e){return()=>{const t=u.inject(e);if(!t)throw new ae;return t}}const zt=Symbol("isRouterRouteSymbol");function yn(e,t){return typeof t=="object"&&t!==null&&zt in t&&e in t}function gn(e,t,r){function n(h,v,m){if(typeof h=="object"){const f={...t.params,...h};return r(t.name,f,v)}const p={...t.params,[h]:v};return r(t.name,p,m)}const o=(...h)=>{const v=new URLSearchParams(t.query);v.set(...h),n({},{query:v})},a=(...h)=>{const v=new URLSearchParams(t.query);v.append(...h),n({},{query:v})},s=(...h)=>{const v=new URLSearchParams(t.query);v.delete(...h),n({},{query:v})},{id:i,matched:c,matches:d,name:y,hash:R,href:L}=u.toRefs(t),S=u.computed({get(){return new Proxy(t.params,{set(h,v,m){return n(v,m),!0}})},set(h){n(h)}}),x=u.computed({get(){return new Proxy(t.query,{get(h,v,m){switch(v){case"append":return a;case"set":return o;case"delete":return s;default:return Reflect.get(h,v,m)}}})},set(h){n({},{query:h})}}),w=u.computed({get(){return new Proxy(t.state,{set(h,v,m){return n({},{state:{...t.state,[v]:m}}),!0}})},set(h){n({},{state:h})}});return u.reactive({id:i,matched:c,matches:d,state:w,query:x,hash:R,params:S,name:y,href:L,update:n,[zt]:!0,[e]:!0})}function ft(e){return(t,r,{exact:n}={})=>yn(e,t)?r===void 0?!0:n?t.matched.name===r:t.matches.map(o=>o.name).includes(r):!1}function Oe(e){const t=Ae(e),r=ft(e);return(n,o)=>{const a=t();function s(){if(!n)return;if(!r(a.route,n,o))throw new qt(n,a.route.name)}return u.watch(a.route,s,{immediate:!0,deep:!0}),a.route}}function lt(e){const t=Oe(e),r=Ae(e),n=Rn(e),o=ct(e),a=mn(e);return u.defineComponent((s,i)=>{const c=t(),d=r(),y=n(),R=o({increment:!0});u.onServerPrefetch(async()=>{await d.start()});const{getRouteComponents:L}=a(),S=u.computed(()=>{if(!d.started.value)return null;if(y.value)return y.value.component;const x=c.matches.at(R);if(!x)return null;const w=L(x),k=s.name??"default";return w[k]});return()=>i.slots.default?i.slots.default({route:c,component:S,rejection:y.value}):S.value?u.h(S.value):null},{name:"RouterView",props:["name"]})}const Yt=Ee();function Kt(e){const t=Yt(e);return()=>{const r=u.inject(t);if(!r)throw new ae;return r}}const wn="lazy",En={components:!0,props:!1};function xe(e){return["eager","lazy","intent"].includes(e)}function Xt({routerPrefetch:e,routePrefetch:t,linkPrefetch:r},n){const o=pt(r,n),a=pt(t,n),s=pt(e,n),i=[o,a,s,En[n],wn].reduce((c,d)=>xe(c)?c:c===!0&&xe(d)?d:c===!0&&!xe(d)?c:c===void 0?d:c,void 0);return xe(i)?i:!1}function pt(e,t){return le(e)?e[t]:e}const bn=u.defineAsyncComponent(()=>new Promise(e=>{e({default:{template:"foo"}})}));function er(e){return e.name===bn.name&&"__asyncLoader"in e}const tr=Symbol("visibilityObserver");function vn(e){const t=u.inject(tr);if(!t)throw new ae;return u.watch(e,(n,o)=>{n&&t.observe(n),o&&t.unobserve(o)},{immediate:!0}),u.onUnmounted(()=>{e.value&&t.unobserve(e.value)}),{isElementVisible:u.computed(()=>e.value?t.isElementVisible(e.value):!1)}}function rr(e,t,r){u.watch(e,(n,o)=>{n&&n.addEventListener(t,r),o&&o.removeEventListener(t,r)},{immediate:!0}),u.onUnmounted(()=>{e.value&&e.value.removeEventListener(t,r)})}function Sn(e){const t=Kt(e);return r=>{const n=new Map,o=u.ref(),{getPrefetchProps:a,setPrefetchProps:s}=t(),{isElementVisible:i}=vn(o),c=()=>{const R=Array.from(n.values()).reduce((L,S)=>(Object.assign(L,S),L),{});s(R)};u.watch(()=>u.toValue(r),({route:R,...L})=>{n.clear(),R&&y("eager",R,L)},{immediate:!0}),u.watch(i,R=>{const{route:L,...S}=u.toValue(r);!L||!R||y("lazy",L,S)},{immediate:!0}),rr(o,"focusin",d),rr(o,"mouseover",d);function d(){const{route:R,...L}=u.toValue(r);R&&y("intent",R,L)}function y(R,L,S){Pn(R,L,S),n.has(R)||n.set(R,a(R,L,S))}return{element:o,commit:c}}}function Pn(e,t,r){t.matches.forEach(n=>{Xt({...r,routePrefetch:n.prefetch},"components")===e&&(et(n)&&er(n.component)&&n.component.__asyncLoader(),rt(n)&&Object.values(n.components).forEach(a=>{er(a)&&a.__asyncLoader()}))})}function dt(...e){const t=new URLSearchParams;for(const r of e){const n=new URLSearchParams(r);for(const[o,a]of n.entries())t.append(o,a)}return t}function nr(e){const t=Ae(e),r=Sn(e),n=ft(e);return(o,a={},s={})=>{const i=t(),c=u.computed(()=>{const p=u.toValue(o);return typeof p!="string"?p:_(p)?i.find(p,u.toValue(s)):i.resolve(p,u.toValue(a),u.toValue(s))}),d=u.computed(()=>{if(c.value)return c.value.href;const p=u.toValue(o);if(_(p))return p;console.error(new Error("Failed to resolve route in RouterLink."))}),y=u.computed(()=>n(i.route)&&i.route.matches.some(p=>p.id===c.value?.id)),R=u.computed(()=>i.route.id===c.value?.id),L=u.computed(()=>n(i.route)&&Cr(c.value)&&i.route.href.startsWith(c.value.href)),S=u.computed(()=>i.route.href===c.value?.href),x=u.computed(()=>!!d.value&&i.isExternal(d.value)),w=u.computed(()=>{const p=u.toValue(o);return typeof p!="string"||_(p)?u.toValue(a):u.toValue(s)}),{element:k,commit:h}=r(()=>({route:c.value,routerPrefetch:i.prefetch,linkPrefetch:w.value.prefetch})),v=p=>{h();const f={replace:p?.replace??w.value.replace,query:dt(w.value.query,p?.query),hash:p?.hash??w.value.hash,state:{...w.value.state,...p?.state}},E=u.toValue(o);return _(E)||typeof E=="object"?i.push(E,f):i.push(E,u.toValue(a),f)};return{element:k,route:c,href:d,isMatch:y,isExactMatch:R,isActive:L,isExactActive:S,isExternal:x,push:v,replace:p=>v({...p,replace:!0})}}}function or(e){const t=Ae(e),r=nr(e);return u.defineComponent((n,o)=>{const a=t(),s=u.computed(()=>h(n.to)),i=u.computed(()=>v(n.to)),c=u.computed(()=>{const{to:p,...f}=n;return f}),{element:d,isMatch:y,isExactMatch:R,isActive:L,isExactActive:S,isExternal:x,push:w}=r(()=>typeof n.to=="function"?n.to(a.resolve):n.to,c),k=u.computed(()=>({"router-link--match":y.value,"router-link--exact-match":R.value,"router-link--active":L.value,"router-link--exact-active":S.value}));function h(p){if(typeof p=="function"){const f=p(a.resolve);return h(f)}return _(p)?a.find(p):p}function v(p){if(typeof p=="function"){const f=p(a.resolve);return v(f)}return _(p)?p:p?.href}function m(p){p.preventDefault(),w()}return()=>u.h("a",{href:i.value,class:["router-link",k.value],ref:d,onClick:m},o.slots.default?.({route:s.value,isMatch:y.value,isExactMatch:R.value,isActive:L.value,isExactActive:S.value,isExternal:x.value}))},{name:"RouterLink",props:["to","prefetch","query","hash","replace","state"]})}function An(e){const t=Oe(e);return(r,n=String)=>{const o=t(),a=u.computed({get(){const i=o.query.get(u.toValue(r));return i===null?null:Ge(i,n)},set(i){o.query.set(u.toValue(r),K(i,n))}}),s=u.computed({get(){return o.query.getAll(u.toValue(r)).map(c=>Ge(c,n)).filter(c=>c!==null)},set(i){const c=new URLSearchParams(o.query);c.delete(u.toValue(r)),i.forEach(d=>{c.append(u.toValue(r),K(d,n))}),o.query=c}});return{value:a,values:s,remove:()=>{o.query.delete(u.toValue(r))}}}}function ar(e){const t=typeof e=="object"?e.key:e,{onBeforeRouteLeave:r,onBeforeRouteUpdate:n,onAfterRouteLeave:o,onAfterRouteUpdate:a}=hn(t),s=ft(t),i=lt(t),c=or(t),d=Oe(t),y=Ae(t),R=An(t),L=nr(t);return{onBeforeRouteLeave:r,onBeforeRouteUpdate:n,onAfterRouteLeave:o,onAfterRouteUpdate:a,isRoute:s,RouterView:i,RouterLink:c,useRoute:d,useRouter:y,useQueryValue:R,useLink:L}}function Un(e){return{routes:e.routes??[],rejections:e.rejections??{},...e}}function sr(e){return{get:(t,{invalid:r})=>{for(const n of e){const o=Ge(t,n);if(o!==void 0)return o}throw r(`Value ${t} does not satisfy any of the possible values`)},set:(t,{invalid:r})=>{for(const n of e){const o=_r(t,n);if(o!==void 0)return o}throw r(`Value ${t} does not satisfy any of the possible values`)}}}const kn={separator:","};function Ln(e,t={}){const{separator:r}={...kn,...t},n=sr(e);return{get:(o,a)=>o.split(r).map(s=>n.get(s,a)),set:(o,a)=>{if(!Array.isArray(o))throw a.invalid("Expected an array");return o.map(s=>n.set(s,a)).join(r)}}}const Vn={separator:","};function Nn(e,t={}){const{separator:r}={...Vn,...t};return{get:n=>{const o=n.split(r);return e.map((a,s)=>ne(o.at(s),a))},set:(n,{invalid:o})=>{if(!Array.isArray(n))throw o("Expected a tuple");if(n.length!==e.length)throw o(`Expected tuple with ${e.length} values but received ${n.length} values`);return e.map((a,s)=>K(n.at(s),a)).join(r)}}}function te(){return te=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},te.apply(null,arguments)}var H;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(H||(H={}));var Re=process.env.NODE_ENV!=="production"?function(e){return Object.freeze(e)}:function(e){return e};function ie(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}var je="beforeunload",Bn="hashchange",ir="popstate";function cr(e){e===void 0&&(e={});var t=e,r=t.window,n=r===void 0?document.defaultView:r,o=n.history;function a(){var b=n.location,l=b.pathname,g=b.search,P=b.hash,B=o.state||{};return[B.idx,Re({pathname:l,search:g,hash:P,state:B.usr||null,key:B.key||"default"})]}var s=null;function i(){if(s)S.call(s),s=null;else{var b=H.Pop,l=a(),g=l[0],P=l[1];if(S.length)if(g!=null){var B=y-g;B&&(s={action:b,location:P,retry:function(){f(B*-1)}},f(B))}else process.env.NODE_ENV!=="production"&&ie(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.");else v(b)}}n.addEventListener(ir,i);var c=H.Pop,d=a(),y=d[0],R=d[1],L=ye(),S=ye();y==null&&(y=0,o.replaceState(te({},o.state,{idx:y}),""));function x(b){return typeof b=="string"?b:ce(b)}function w(b,l){return l===void 0&&(l=null),Re(te({pathname:R.pathname,hash:"",search:""},typeof b=="string"?Ue(b):b,{state:l,key:He()}))}function k(b,l){return[{usr:b.state,key:b.key,idx:l},x(b)]}function h(b,l,g){return!S.length||(S.call({action:b,location:l,retry:g}),!1)}function v(b){c=b;var l=a();y=l[0],R=l[1],L.call({action:c,location:R})}function m(b,l){var g=H.Push,P=w(b,l);function B(){m(b,l)}if(h(g,P,B)){var N=k(P,y+1),C=N[0],$=N[1];try{o.pushState(C,"",$)}catch{n.location.assign($)}v(g)}}function p(b,l){var g=H.Replace,P=w(b,l);function B(){p(b,l)}if(h(g,P,B)){var N=k(P,y),C=N[0],$=N[1];o.replaceState(C,"",$),v(g)}}function f(b){o.go(b)}var E={get action(){return c},get location(){return R},createHref:x,push:m,replace:p,go:f,back:function(){f(-1)},forward:function(){f(1)},listen:function(l){return L.push(l)},block:function(l){var g=S.push(l);return S.length===1&&n.addEventListener(je,Ze),function(){g(),S.length||n.removeEventListener(je,Ze)}}};return E}function Cn(e){e===void 0&&(e={});var t=e,r=t.window,n=r===void 0?document.defaultView:r,o=n.history;function a(){var l=Ue(n.location.hash.substr(1)),g=l.pathname,P=g===void 0?"/":g,B=l.search,N=B===void 0?"":B,C=l.hash,$=C===void 0?"":C,W=o.state||{};return[W.idx,Re({pathname:P,search:N,hash:$,state:W.usr||null,key:W.key||"default"})]}var s=null;function i(){if(s)S.call(s),s=null;else{var l=H.Pop,g=a(),P=g[0],B=g[1];if(S.length)if(P!=null){var N=y-P;N&&(s={action:l,location:B,retry:function(){E(N*-1)}},E(N))}else process.env.NODE_ENV!=="production"&&ie(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.");else m(l)}}n.addEventListener(ir,i),n.addEventListener(Bn,function(){var l=a(),g=l[1];ce(g)!==ce(R)&&i()});var c=H.Pop,d=a(),y=d[0],R=d[1],L=ye(),S=ye();y==null&&(y=0,o.replaceState(te({},o.state,{idx:y}),""));function x(){var l=document.querySelector("base"),g="";if(l&&l.getAttribute("href")){var P=n.location.href,B=P.indexOf("#");g=B===-1?P:P.slice(0,B)}return g}function w(l){return x()+"#"+(typeof l=="string"?l:ce(l))}function k(l,g){return g===void 0&&(g=null),Re(te({pathname:R.pathname,hash:"",search:""},typeof l=="string"?Ue(l):l,{state:g,key:He()}))}function h(l,g){return[{usr:l.state,key:l.key,idx:g},w(l)]}function v(l,g,P){return!S.length||(S.call({action:l,location:g,retry:P}),!1)}function m(l){c=l;var g=a();y=g[0],R=g[1],L.call({action:c,location:R})}function p(l,g){var P=H.Push,B=k(l,g);function N(){p(l,g)}if(process.env.NODE_ENV!=="production"&&ie(B.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.push("+JSON.stringify(l)+")"),v(P,B,N)){var C=h(B,y+1),$=C[0],W=C[1];try{o.pushState($,"",W)}catch{n.location.assign(W)}m(P)}}function f(l,g){var P=H.Replace,B=k(l,g);function N(){f(l,g)}if(process.env.NODE_ENV!=="production"&&ie(B.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.replace("+JSON.stringify(l)+")"),v(P,B,N)){var C=h(B,y),$=C[0],W=C[1];o.replaceState($,"",W),m(P)}}function E(l){o.go(l)}var b={get action(){return c},get location(){return R},createHref:w,push:p,replace:f,go:E,back:function(){E(-1)},forward:function(){E(1)},listen:function(g){return L.push(g)},block:function(g){var P=S.push(g);return S.length===1&&n.addEventListener(je,Ze),function(){P(),S.length||n.removeEventListener(je,Ze)}}};return b}function ur(e){e===void 0&&(e={});var t=e,r=t.initialEntries,n=r===void 0?["/"]:r,o=t.initialIndex,a=n.map(function(m){var p=Re(te({pathname:"/",search:"",hash:"",state:null,key:He()},typeof m=="string"?Ue(m):m));return process.env.NODE_ENV!=="production"&&ie(p.pathname.charAt(0)==="/","Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(m)+")"),p}),s=fr(o??a.length-1,0,a.length-1),i=H.Pop,c=a[s],d=ye(),y=ye();function R(m){return typeof m=="string"?m:ce(m)}function L(m,p){return p===void 0&&(p=null),Re(te({pathname:c.pathname,search:"",hash:""},typeof m=="string"?Ue(m):m,{state:p,key:He()}))}function S(m,p,f){return!y.length||(y.call({action:m,location:p,retry:f}),!1)}function x(m,p){i=m,c=p,d.call({action:i,location:c})}function w(m,p){var f=H.Push,E=L(m,p);function b(){w(m,p)}process.env.NODE_ENV!=="production"&&ie(c.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.push("+JSON.stringify(m)+")"),S(f,E,b)&&(s+=1,a.splice(s,a.length,E),x(f,E))}function k(m,p){var f=H.Replace,E=L(m,p);function b(){k(m,p)}process.env.NODE_ENV!=="production"&&ie(c.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.replace("+JSON.stringify(m)+")"),S(f,E,b)&&(a[s]=E,x(f,E))}function h(m){var p=fr(s+m,0,a.length-1),f=H.Pop,E=a[p];function b(){h(m)}S(f,E,b)&&(s=p,x(f,E))}var v={get index(){return s},get action(){return i},get location(){return c},createHref:R,push:w,replace:k,go:h,back:function(){h(-1)},forward:function(){h(1)},listen:function(p){return d.push(p)},block:function(p){return y.push(p)}};return v}function fr(e,t,r){return Math.min(Math.max(e,t),r)}function Ze(e){e.preventDefault(),e.returnValue=""}function ye(){var e=[];return{get length(){return e.length},push:function(r){return e.push(r),function(){e=e.filter(function(n){return n!==r})}},call:function(r){e.forEach(function(n){return n&&n(r)})}}}function He(){return Math.random().toString(36).substr(2,8)}function ce(e){var t=e.pathname,r=t===void 0?"/":t,n=e.search,o=n===void 0?"":n,a=e.hash,s=a===void 0?"":a;return o&&o!=="?"&&(r+=o.charAt(0)==="?"?o:"?"+o),s&&s!=="#"&&(r+=s.charAt(0)==="#"?s:"#"+s),r}function Ue(e){var t={};if(e){var r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));var n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function On(e,t,r){const n=u.reactive({...t}),o=i=>{Object.assign(n,{...i})},a=n,s=gn(e,a,r);return{currentRoute:a,routerRoute:s,updateRoute:o}}function J(e){return!e.startsWith("http")?jn(e):xn(e)}function xn(e){const{protocol:t,host:r,pathname:n,search:o,searchParams:a,hash:s}=new URL(e,e);return{protocol:t,host:r,pathname:n,search:o,searchParams:a,hash:s}}function jn(e){const{pathname:t,search:r,searchParams:n,hash:o}=new URL(e,"https://localhost");return{pathname:t,search:r,searchParams:n,hash:o}}function Zn(e){return t=>{const{host:r}=J(t);return!(r===void 0||r===e)}}function Hn(){return{reject:o=>{throw new ee(o)},push:(...o)=>{throw new I(o)},replace:(o,a,s)=>{if(_(o)){const d=a??{};throw new I([o,{...d,replace:!0}])}const i=a,c=s??{};throw new I([o,i,{...c,replace:!0}])},abort:()=>{throw new ut}}}function lr(e){try{const t=e();return Je(t)?t.catch(r=>r):t}catch(t){return t}}function $n(){const{setVueApp:e,runWithContext:t}=Jt(),r=u.reactive(new Map),{push:n,replace:o,reject:a}=Hn(),s=(w,k,h)=>k.matches.filter(v=>Xt({...h,routePrefetch:v.prefetch},"props")===w).flatMap(v=>S(v)).reduce((v,{id:m,name:p,props:f})=>{if(!f)return v;const E=L(m,p,k),b=t(()=>lr(()=>f(k,{push:n,replace:o,reject:a,parent:y(k,!0)})));return v[E]=b,v},{}),i=w=>{Object.entries(w).forEach(([k,h])=>{r.set(k,h)})},c=async w=>{const k=w.matches.flatMap(S),h=[],v=[];for(const{id:m,name:p,props:f}of k){if(!f)continue;const E=L(m,p,w);if(h.push(E),!r.has(E)){const b=t(()=>lr(()=>f(w,{push:n,replace:o,reject:a,parent:y(w)})));r.set(E,b)}v.push((async()=>{const b=await r.get(E);if(b instanceof Error)throw b})())}x(h);try{return await Promise.all(v),{status:"SUCCESS"}}catch(m){if(m instanceof I||m instanceof ee)return m.response;throw m}},d=(w,k,h)=>{const v=L(w,k,h);return r.get(v)};function y(w,k=!1){const h=w.matches.at(-2);if(h)return tt(h)?{name:h.name??"",get props(){return R(h,"default",w,k)}}:nt(h)?{name:h.name??"",props:new Proxy({},{get(v,m){return typeof m!="string"?Reflect.get(v,m):R(h,m,w,k)}})}:{name:h.name??"",props:void 0}}function R(w,k,h,v=!1){const m=d(w.id,k,h);if(v&&!m){const p=w.name??"unknown",f=h.name||"unknown";console.warn(`
|
|
2
|
+
Unable to access parent props "${k}" from route "${p}" while prefetching props for route "${f}".
|
|
3
3
|
This may occur if the parent route's props were not also prefetched.
|
|
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"})});
|
|
4
|
+
`)}return m}function L(w,k,h){return[w,k,h.id,JSON.stringify(h.params)].join("-")}function S(w){return tt(w)?[{id:w.id,name:"default",props:w.props}]:nt(w)?Object.entries(w.props).map(([k,h])=>({id:w.id,name:k,props:h})):[]}function x(w){for(const k of r.keys())w.includes(k)||r.delete(k)}return{getPrefetchProps:s,setPrefetchProps:i,getProps:d,setProps:c,setVueApp:e}}function ht(){return typeof window<"u"&&typeof window.document<"u"}function qn({mode:e,listener:t}){const r=Dn(e),n=(c,d)=>{if(d?.replace){r.replace(c,d.state);return}r.push(c,d?.state)},o=()=>{const c=ce(r.location);r.replace(c)};let a;return{...r,update:n,refresh:o,startListening:()=>{a?.(),a=r.listen(t)},stopListening:()=>{a?.()}}}function Dn(e="auto"){switch(e){case"auto":return ht()?cr():ur();case"browser":return cr();case"memory":return ur();case"hash":return Cn();default:const t=e;throw new Error(`Switch is not exhaustive for mode: ${t}`)}}function _n(e){return u.defineComponent(()=>()=>u.h("h1",e),{name:e,props:[]})}function mt(e){const t=new URLSearchParams(e);return{get:(...r)=>t.get(...r),getAll:(...r)=>t.getAll(...r),set:(...r)=>{t.set(...r)},append:(...r)=>{t.append(...r)},delete:(...r)=>{t.delete(...r)},toString:(...r)=>t.toString(...r),forEach:(...r)=>{t.forEach(...r)},entries:(...r)=>t.entries(...r),keys:(...r)=>t.keys(...r),values:(...r)=>t.values(...r),has:(...r)=>t.has(...r),size:t.size,sort:()=>{t.sort()},[Symbol.iterator]:()=>t[Symbol.iterator]()}}function In(e){const t=a=>u.markRaw(e[a]??_n(a)),r=a=>{const s=u.markRaw(t(a)),i={id:it(),component:s,meta:{},state:{}};return{id:i.id,matched:i,matches:[i],name:a,query:mt(""),params:{},state:{},href:"/",hash:""}},n=a=>{if(!a){o.value=null;return}const s=t(a);o.value={type:a,component:s}},o=u.ref(null);return{setRejection:n,rejection:o,getRejectionRoute:r}}class Jn extends Error{constructor(){super("initialUrl must be set if window.location is unavailable")}}function Tn(e){if(e)return e;if(ht())return window.location.toString();throw new Jn}function pr(e){return!!e&&typeof e=="object"}const $e=!0;function Mn(e,t,r){if(pr(e)&&t in e){const n=e[t];return typeof n=="string"?ne(n,r,$e):n}return ne(void 0,r,$e)}function dr(e,t){const r={};for(const[n,o]of Object.entries(e)){const a=Mn(t,n,o);r[n]=a}return r}function Fn(e,t,r){if(pr(e)&&t in e){const n=e[t];return K(n,r,$e)}return K(void 0,r,$e)}const hr=(e,t)=>{const r={};for(const[n,o]of Object.entries(e)){const a=Fn(t,n,o);r[n]=a}return r};function Wn(){const e=u.reactive(new Map),t=ht()?s():null,r=i=>{e.set(i,!1),t?.observe(i)},n=i=>{e.delete(i),t?.unobserve(i)},o=()=>{t?.disconnect()},a=i=>e.get(i)??!1;function s(){return new IntersectionObserver(i=>{i.forEach(c=>{e.set(c.target,c.isIntersecting)})})}return{observe:r,unobserve:n,disconnect:o,isElementVisible:a}}class Gn extends Error{constructor(t){super(`Route not found: "${t}"`)}}function mr(e,t,r){const n=Mr(t.value,r),o=xt(n),[a]=Zt(e,new RegExp(o,"g"));return a}function Rr(e,t,r,n){const o=ze(t,r),a=K(n,t.params[r],o);return e.replace(jt(r),a)}function yr({protocol:e,host:t,pathname:r,search:n,searchParams:o,hash:a}){const s=new URL("https://localhost");e&&(s.protocol=e),t&&(s.host=t),r&&(s.pathname=r),o?s.search=new URLSearchParams(o).toString():n&&(s.search=n),a&&(s.hash=a);const i=s.toString().replace(/^https:\/\/localhost\/*/,"/");return at(i)}function Qn(e,t={}){const{params:r={},query:n}=t,o=Yn(e.query,r),a=dt(o,n),s=gr(e.path,r),i=e.hash.value?gr(e.hash,r):t.hash,c=zn(e.host,r),{protocol:d,host:y}=J(c);return yr({protocol:d,host:y,pathname:s,searchParams:a,hash:i})}function zn(e,t){const r=e.value&&!e.value.startsWith("http")?`https://${e.value}`:e.value;return Object.keys(e.params).reduce((n,o)=>Rr(n,e,o,t[o]),r)}function gr(e,t){return Object.keys(e.params).reduce((r,n)=>Rr(r,e,n,t[n]),e.value)}function Yn(e,t){const r=new URLSearchParams(e.value);if(!e.value)return r;for(const[n,o]of Array.from(r.entries())){const a=Ke(o);if(!a)continue;const i=Ye(o),c=K(t[a],e.params[a],i),d=t[a]===void 0&&c==="";i&&d?r.delete(n,o):r.set(n,c)}return r}const Kn=(e,t)=>{try{Rt(e,t)}catch{return!1}return!0},Rt=(e,t)=>{const{protocol:r,host:n,pathname:o,search:a,hash:s}=J(t);return{...yt(e.host,`${r}//${n}`),...yt(e.path,o),...Xn(e.query,a),...yt(e.hash,s)}};function yt(e,t){const r={},n=decodeURIComponent(t);for(const[o,a]of Object.entries(e.params)){const s=mr(n,e,o),i=ze(e,o),c=ne(s,a,i);r[o]=c}return r}function Xn(e,t){const r={},n=new URLSearchParams(e.value),o=new URLSearchParams(t);for(const[a,s]of Array.from(n.entries())){const i=Ke(s);if(!i)continue;const d=Ye(s),y=o.get(a)??void 0,R=ne(y,e.params[i],d);r[i]=R}return r}function eo(e,t={},r={}){const n=Qn(e,{params:t,query:r.query,hash:r.hash}),{search:o,hash:a}=J(n);return{id:e.id,matched:e.matched,matches:e.matches,name:e.name,query:mt(o),params:Rt(e,n),state:dr(e.state,r.state),hash:a,href:n}}const qe={template:"<div>This is component</div>"},gt=se({name:"parentA",path:"/parentA/[paramA]"}),wr=se({parent:gt,name:"parentA.childA",path:"/childA/[?paramB]"}),to=se({parent:gt,name:"parentA.childB",path:"/childB/[paramD]",component:qe}),ro=se({parent:wr,name:"parentA.childA.grandChildA",path:"/[paramC]",component:qe});se({name:"parentB",path:"/parentB",component:qe}),se({name:"parentC",path:"/",component:qe});const no=e=>"name"in e.matched&&!!e.matched.name,oo=(e,t)=>{const{pathname:r}=J(t);return Jr(e).test(r)},ao=(e,t)=>{const{search:r}=J(t);return Tr(e).every(o=>o.test(r))},wt=(e,t)=>{const{hash:r}=J(t),{value:n}=e.hash;return M(n)?`#${n.replace(/^#*/,"")}`.toLowerCase()===r.toLowerCase():!0};function so(e){const{searchParams:t,pathname:r}=J(e),n=-1,o=1;return(a,s)=>{const i=br(a,t),c=Er(a,r),d=br(s,t),y=Er(s,r);return a.depth>s.depth?n:a.depth<s.depth?o:i+c>d+y?n:i+c<d+y?o:wt(a,e)?n:wt(s,e)?o:0}}function Er(e,t){const r=Object.keys(e.path.params).filter(o=>ze(e.path,o)).map(o=>o),n=r.filter(o=>mr(t,e.path,o)===void 0);return r.length-n.length}function br(e,t){const r=new URLSearchParams(t),n=new URLSearchParams(e.query.value),o=Array.from(n.keys()),a=o.filter(s=>!r.has(s));return o.length-a.length}const io=[no,oo,ao,wt,Kn];function co(e,t){const r=so(t);return e.filter(n=>io.every(o=>o(n,t))).sort(r)}function uo(e,t,r){const n=co(e,t);if(!n.length)return;const[o]=n,{searchParams:a,hash:s}=J(t);return{id:o.id,matched:o.matched,matches:o.matches,name:o.name,query:mt(a),params:Rt(o,t),state:dr(o.state,r),hash:s,href:at(t)}}function vr(e,t){const r=typeof e=="string"?J(e):e,n=typeof t=="string"?J(t):t,o=r.searchParams??new URLSearchParams(r.search),a=n.searchParams??new URLSearchParams(n.search);return yr({protocol:M(n.protocol)?n.protocol:r.protocol,host:M(n.host)?n.host:r.host,pathname:M(n.pathname)?n.pathname:r.pathname,searchParams:dt(a,o),hash:M(n.hash)?n.hash:r.hash})}function fo(e,t){return M(t)?e.map(r=>{const n=`${t}${r.path.value}`;return{...r,path:Q(n,r.path.params)}}):e}class lo extends Error{constructor(t){super(`Invalid Name "${t}": Router does not support multiple routes with the same name. All name names must be unique.`)}}function po(e){const t=e.map(({name:r})=>r);for(const r of t)if(St(t,r)>1)throw new lo(r)}function ho(e,t=[],r){const n=[...e,...t.map(o=>o.routes)].flat().filter(o=>M(o.name));return po(n),fo(n,r)}function mo(e={},t=[]){const r=new Pe;return ge("onBeforeRouteEnter",e,t).forEach(n=>r.onBeforeRouteEnter.add(n)),ge("onBeforeRouteUpdate",e,t).forEach(n=>r.onBeforeRouteUpdate.add(n)),ge("onBeforeRouteLeave",e,t).forEach(n=>r.onBeforeRouteLeave.add(n)),ge("onAfterRouteEnter",e,t).forEach(n=>r.onAfterRouteEnter.add(n)),ge("onAfterRouteUpdate",e,t).forEach(n=>r.onAfterRouteUpdate.add(n)),ge("onAfterRouteLeave",e,t).forEach(n=>r.onAfterRouteLeave.add(n)),r}function ge(e,t,r){return[t[e],...r.map(o=>o[e])].flat().filter(o=>o!==void 0)}function Ro(e,{match:t,name:r,component:n}){const o=Kt(e),a=Oe(e);return u.defineComponent({name:"PropsWrapper",expose:[],setup(){const s=u.getCurrentInstance(),i=o(),c=a();return()=>{const d=i.getProps(t.id,r,c);return d instanceof Error?"":Je(d)?s?.suspense?u.h(go,{component:n,props:d}):u.h(yo,{component:n,props:d}):u.h(n,d)}}})}const yo=u.defineComponent(e=>{const t=u.ref();return u.watch(()=>e.props,async r=>{t.value=await r},{immediate:!0,deep:!0}),()=>t.value instanceof Error?"":t.value?u.h(e.component,t.value):""},{props:["component","props"]}),go=u.defineComponent(async e=>{const t=u.ref();return t.value=await e.props,u.watch(()=>t.value,async r=>{t.value=await r},{deep:!0}),()=>t.value instanceof Error?"":t.value?u.h(e.component,t.value):""},{props:["component","props"]});function wo(e){const t=new Map;return{getRouteComponents:n=>{const o=t.get(n.id);if(o)return o;const a=Eo(e,n);return t.set(n.id,a),a}}}function Eo(e,t){const r=lt(e);return rt(t)?Sr(e,t,t.components):et(t)?Sr(e,t,{default:t.component}):{default:r}}function Sr(e,t,r){return Object.fromEntries(Object.entries(r).map(([n,o])=>[n,Ro(e,{match:t,name:n,component:o})]))}const Pr=Symbol();function bo(e,t,r=[]){const o=t?.isGlobalRouter??!0?Pr:Symbol(),a=ho(e,r,t?.base),s=dn();s.addGlobalRouteHooks(mo(t,r));const i=st(),c=$n(),d=wo(o),y=Wn(),R=qn({mode:t?.historyMode,listener:({location:A})=>{const j=ce(A);S(j,{state:A.state,replace:!0})}});function L(A,j={}){return uo(a,A,j.state)}async function S(A,j={}){const G=i();if(R.stopListening(),N(A)){R.update(A,j);return}const T=L(A,j)??p("NotFound"),q=Ho(G),re=await s.runBeforeRouteHooks({to:T,from:q});switch(re.status){case"ABORT":return;case"PUSH":R.update(A,j),await w(...re.to);return;case"REJECT":R.update(A,j),v(re.type);break;case"SUCCESS":R.update(A,j),v(null);break;default:throw new Error(`Switch is not exhaustive for before hook response status: ${JSON.stringify(re)}`)}const Et=G;c.setProps(T).then(D=>{if(Et===G)switch(D.status){case"SUCCESS":break;case"PUSH":w(...D.to);break;case"REJECT":v(D.type);break;default:const X=D;throw new Error(`Switch is not exhaustive for prop store response status: ${JSON.stringify(X)}`)}}).catch(D=>{try{s.runErrorHooks(D,{to:T,from:q,source:"props"})}catch(X){if(X instanceof I){w(...X.response.to);return}if(X instanceof ee){v(X.response.type);return}throw X}}),l(T);const z=await s.runAfterRouteHooks({to:T,from:q});switch(z.status){case"PUSH":await w(...z.to);break;case"REJECT":v(z.type);break;case"SUCCESS":break;default:const D=z;throw new Error(`Switch is not exhaustive for after hook response status: ${JSON.stringify(D)}`)}R.startListening()}const x=(A,j={},G={})=>{const T=a.find(q=>q.name===A);if(!T)throw new Gn(A);return eo(T,j,G)},w=(A,j,G)=>{if(_(A)){const z={...j},D=vr(A,{searchParams:z.query,hash:z.hash});return S(D,z)}if(typeof A=="string"){const{replace:z,...D}={...G},X={...j},bt=x(A,X,D),qo=hr({...bt.matched.state},{...bt.state,...D.state});return S(bt.href,{replace:z,state:qo})}const{replace:T,...q}={...j},re=hr({...A.matched.state},{...A.state,...q.state}),Et=vr(A.href,{searchParams:q.query,hash:q.hash});return S(Et,{replace:T,state:re})},k=(A,j,G)=>{if(_(A)){const q={...j,replace:!0};return w(A,q)}if(typeof A=="string"){const q={...G,replace:!0},re={...j};return w(A,re,q)}const T={...j,replace:!0};return w(A,T)},h=A=>{v(A)},{setRejection:v,rejection:m,getRejectionRoute:p}=In({...r.reduce((A,j)=>({...A,...j.rejections}),{}),...t?.rejections}),f=p("NotFound"),{currentRoute:E,routerRoute:b,updateRoute:l}=On(o,f,w),g=Tn(t?.initialUrl),P=R.location.state,{host:B}=J(g),N=Zn(B);let C=!1;const $=u.ref(!1),{promise:W,resolve:Ar}=Promise.withResolvers();async function Ur(){if(C)return W;C=!0,xr(a)&&await jr(),await S(g,{replace:!0,state:P}),R.startListening(),Ar(),$.value=!0}function Zo(){R.stopListening()}function Ho(A){return on(A)?null:{...E}}function $o(A){s.setVueApp(A),c.setVueApp(A);const j=lt(o),G=or(o);A.component("RouterView",j),A.component("RouterLink",G),A.provide(Qt(o),m),A.provide(Tt(o),s),A.provide(Yt(o),c),A.provide(Gt(o),d),A.provide(tr,y),A.provide(o,kr),Ur()}const kr={route:b,resolve:x,find:L,push:w,replace:k,reject:h,refresh:R.refresh,forward:R.forward,back:R.back,go:R.go,install:$o,isExternal:N,onBeforeRouteEnter:s.onBeforeRouteEnter,onBeforeRouteUpdate:s.onBeforeRouteUpdate,onBeforeRouteLeave:s.onBeforeRouteLeave,onAfterRouteEnter:s.onAfterRouteEnter,onAfterRouteUpdate:s.onAfterRouteUpdate,onAfterRouteLeave:s.onAfterRouteLeave,onError:s.onError,prefetch:t?.prefetch,start:Ur,started:$,stop:Zo,key:o};return kr}const vo=Q,So=Q,Po=Q,F=ar(Pr),Ao=F.onBeforeRouteLeave,Uo=F.onBeforeRouteUpdate,ko=F.onAfterRouteLeave,Lo=F.onAfterRouteUpdate,Vo=F.isRoute,No=F.RouterView,Bo=F.RouterLink,Co=F.useRoute,Oo=F.useRouter,xo=F.useQueryValue,jo=F.useLink;V.DuplicateParamsError=vt,V.MetaPropertyConflict=$t,V.RouterLink=Bo,V.RouterNotInstalledError=ae,V.RouterView=No,V.UseRouteInvalidError=qt,V.arrayOf=Ln,V.asUrl=at,V.combineRoutes=ot,V.createExternalRoute=an,V.createParam=At,V.createRoute=se,V.createRouter=bo,V.createRouterAssets=ar,V.createRouterPlugin=Un,V.host=So,V.isRoute=Vo,V.isUrl=_,V.isWithComponent=et,V.isWithComponentProps=tt,V.isWithComponentPropsRecord=nt,V.isWithComponents=rt,V.isWithParent=Xe,V.onAfterRouteLeave=ko,V.onAfterRouteUpdate=Lo,V.onBeforeRouteLeave=Ao,V.onBeforeRouteUpdate=Uo,V.path=vo,V.query=Po,V.tupleOf=Nn,V.unionOf=sr,V.useLink=jo,V.useQueryValue=xo,V.useRoute=Co,V.useRouter=Oo,V.withDefault=Br,V.withParams=Q,Object.defineProperty(V,Symbol.toStringTag,{value:"Module"})});
|
package/dist/main.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { withParams } from './services/withParams';
|
|
2
|
+
import { RouterAssets } from './services/createRouterAssets';
|
|
3
|
+
import { RegisteredRouter } from './types/register';
|
|
2
4
|
export * from './types/createRouteOptions';
|
|
3
5
|
export * from './types/hooks';
|
|
4
6
|
export * from './types/paramTypes';
|
|
@@ -27,7 +29,7 @@ export { RouterNotInstalledError } from './errors/routerNotInstalledError';
|
|
|
27
29
|
export { UseRouteInvalidError } from './errors/useRouteInvalidError';
|
|
28
30
|
export { createRoute } from './services/createRoute';
|
|
29
31
|
export { createExternalRoute } from './services/createExternalRoute';
|
|
30
|
-
export { createRouterAssets } from './services/createRouterAssets';
|
|
32
|
+
export { createRouterAssets, type RouterAssets } from './services/createRouterAssets';
|
|
31
33
|
export { withParams } from './services/withParams';
|
|
32
34
|
export { withDefault } from './services/withDefault';
|
|
33
35
|
export { createRouterPlugin } from './services/createRouterPlugin';
|
|
@@ -59,7 +61,7 @@ export declare const query: typeof withParams;
|
|
|
59
61
|
* @returns {RouteHookRemove} A function that removes the added hook.
|
|
60
62
|
* @group Hooks
|
|
61
63
|
*/
|
|
62
|
-
export declare const onBeforeRouteLeave:
|
|
64
|
+
export declare const onBeforeRouteLeave: RouterAssets<RegisteredRouter>['onBeforeRouteLeave'];
|
|
63
65
|
/**
|
|
64
66
|
* Registers a hook that is called before a route is updated. Must be called from setup.
|
|
65
67
|
* This is particularly useful for handling changes in route parameters or query while staying within the same component.
|
|
@@ -68,7 +70,7 @@ export declare const onBeforeRouteLeave: import('./main').AddRouterBeforeRouteHo
|
|
|
68
70
|
* @returns {RouteHookRemove} A function that removes the added hook.
|
|
69
71
|
* @group Hooks
|
|
70
72
|
*/
|
|
71
|
-
export declare const onBeforeRouteUpdate:
|
|
73
|
+
export declare const onBeforeRouteUpdate: RouterAssets<RegisteredRouter>['onBeforeRouteUpdate'];
|
|
72
74
|
/**
|
|
73
75
|
* Registers a hook that is called after a route has been left. Must be called during setup.
|
|
74
76
|
* This can be used for cleanup actions after the component is no longer active, ensuring proper resource management.
|
|
@@ -77,7 +79,7 @@ export declare const onBeforeRouteUpdate: import('./main').AddRouterBeforeRouteH
|
|
|
77
79
|
* @returns {RouteHookRemove} A function that removes the added hook.
|
|
78
80
|
* @group Hooks
|
|
79
81
|
*/
|
|
80
|
-
export declare const onAfterRouteLeave:
|
|
82
|
+
export declare const onAfterRouteLeave: RouterAssets<RegisteredRouter>['onAfterRouteLeave'];
|
|
81
83
|
/**
|
|
82
84
|
* Registers a hook that is called after a route has been updated. Must be called during setup.
|
|
83
85
|
* This is ideal for responding to updates within the same route, such as parameter changes, without full component reloads.
|
|
@@ -86,7 +88,7 @@ export declare const onAfterRouteLeave: import('./main').AddRouterAfterRouteHook
|
|
|
86
88
|
* @returns {RouteHookRemove} A function that removes the added hook.
|
|
87
89
|
* @group Hooks
|
|
88
90
|
*/
|
|
89
|
-
export declare const onAfterRouteUpdate:
|
|
91
|
+
export declare const onAfterRouteUpdate: RouterAssets<RegisteredRouter>['onAfterRouteUpdate'];
|
|
90
92
|
/**
|
|
91
93
|
* A guard to verify if a route or unknown value matches a given route name.
|
|
92
94
|
*
|
|
@@ -94,44 +96,7 @@ export declare const onAfterRouteUpdate: import('./main').AddRouterAfterRouteHoo
|
|
|
94
96
|
* @returns True if the current route matches the given route name, false otherwise.
|
|
95
97
|
* @group Type Guards
|
|
96
98
|
*/
|
|
97
|
-
export declare const isRoute:
|
|
98
|
-
(route: unknown): route is import('./main').RouterRoute;
|
|
99
|
-
<TRoute extends import('./main').RouterRoute<Readonly<{
|
|
100
|
-
id: any;
|
|
101
|
-
matched: any;
|
|
102
|
-
matches: any;
|
|
103
|
-
name: any;
|
|
104
|
-
query: URLSearchParams;
|
|
105
|
-
hash: string;
|
|
106
|
-
params: {
|
|
107
|
-
[x: string]: unknown;
|
|
108
|
-
[x: number]: unknown;
|
|
109
|
-
[x: symbol]: unknown;
|
|
110
|
-
};
|
|
111
|
-
state: import('./types/state').ExtractRouteStateParamsAsOptional<any>;
|
|
112
|
-
href: import('./main').Url;
|
|
113
|
-
}>>, TRouteName extends any>(route: TRoute, routeName: TRouteName, options: import('./guards/routes').IsRouteOptions & {
|
|
114
|
-
exact: true;
|
|
115
|
-
}): route is TRoute & {
|
|
116
|
-
name: TRouteName;
|
|
117
|
-
};
|
|
118
|
-
<TRoute extends import('./main').RouterRoute<Readonly<{
|
|
119
|
-
id: any;
|
|
120
|
-
matched: any;
|
|
121
|
-
matches: any;
|
|
122
|
-
name: any;
|
|
123
|
-
query: URLSearchParams;
|
|
124
|
-
hash: string;
|
|
125
|
-
params: {
|
|
126
|
-
[x: string]: unknown;
|
|
127
|
-
[x: number]: unknown;
|
|
128
|
-
[x: symbol]: unknown;
|
|
129
|
-
};
|
|
130
|
-
state: import('./types/state').ExtractRouteStateParamsAsOptional<any>;
|
|
131
|
-
href: import('./main').Url;
|
|
132
|
-
}>>, TRouteName extends TRoute["name"]>(route: TRoute, routeName: TRouteName, options?: import('./guards/routes').IsRouteOptions): route is TRoute extends import('./main').RouterRoute ? TRouteName extends TRoute["matches"][number]["name"] ? TRoute : never : never;
|
|
133
|
-
(route: unknown, routeName?: string, options?: import('./guards/routes').IsRouteOptions): boolean;
|
|
134
|
-
};
|
|
99
|
+
export declare const isRoute: RouterAssets<RegisteredRouter>['isRoute'];
|
|
135
100
|
/**
|
|
136
101
|
* A component to render the current route's component.
|
|
137
102
|
*
|
|
@@ -139,17 +104,7 @@ export declare const isRoute: {
|
|
|
139
104
|
* @returns The router view component.
|
|
140
105
|
* @group Components
|
|
141
106
|
*/
|
|
142
|
-
export declare const RouterView:
|
|
143
|
-
default?: (props: {
|
|
144
|
-
route: import('./main').RouterRoute;
|
|
145
|
-
component: import('vue').Component;
|
|
146
|
-
rejection: import('vue').UnwrapRef<import('./services/createRouterReject').RouterRejection>;
|
|
147
|
-
}) => import('vue').VNode;
|
|
148
|
-
}>, import('./components/routerView').RouterViewProps & ({
|
|
149
|
-
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
|
150
|
-
} | {
|
|
151
|
-
[x: `on${Capitalize<string>}`]: ((...args: never) => any) | undefined;
|
|
152
|
-
}), import('vue').PublicProps>;
|
|
107
|
+
export declare const RouterView: RouterAssets<RegisteredRouter>['RouterView'];
|
|
153
108
|
/**
|
|
154
109
|
* A component to render a link to a route or any url.
|
|
155
110
|
*
|
|
@@ -157,35 +112,7 @@ export declare const RouterView: import('vue').DefineSetupFnComponent<import('./
|
|
|
157
112
|
* @returns The router link component.
|
|
158
113
|
* @group Components
|
|
159
114
|
*/
|
|
160
|
-
export declare const RouterLink:
|
|
161
|
-
default?: (props: {
|
|
162
|
-
route: import('./main').ResolvedRoute | undefined;
|
|
163
|
-
isMatch: boolean;
|
|
164
|
-
isExactMatch: boolean;
|
|
165
|
-
isActive: boolean;
|
|
166
|
-
isExactActive: boolean;
|
|
167
|
-
isExternal: boolean;
|
|
168
|
-
}) => import('vue').VNode[];
|
|
169
|
-
}>, import('./main').RouterPushOptions & ({
|
|
170
|
-
to: import('./main').Url | Readonly<{
|
|
171
|
-
id: string;
|
|
172
|
-
matched: import('./main').CreatedRouteOptions;
|
|
173
|
-
matches: import('./main').CreatedRouteOptions[];
|
|
174
|
-
name: string;
|
|
175
|
-
query: URLSearchParams;
|
|
176
|
-
hash: string;
|
|
177
|
-
params: {
|
|
178
|
-
[x: string]: unknown;
|
|
179
|
-
};
|
|
180
|
-
state: import('./types/state').ExtractRouteStateParamsAsOptional<Record<string, import('./main').Param>>;
|
|
181
|
-
href: import('./main').Url;
|
|
182
|
-
}> | import('./main').ToCallback<import('./main').Router>;
|
|
183
|
-
prefetch?: import('./main').PrefetchConfig;
|
|
184
|
-
} & ({
|
|
185
|
-
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
|
186
|
-
} | {
|
|
187
|
-
[x: `on${Capitalize<string>}`]: ((...args: never) => any) | undefined;
|
|
188
|
-
})), import('vue').PublicProps>;
|
|
115
|
+
export declare const RouterLink: RouterAssets<RegisteredRouter>['RouterLink'];
|
|
189
116
|
/**
|
|
190
117
|
* A composition to access the current route or verify a specific route name within a Vue component.
|
|
191
118
|
* This function provides two overloads:
|
|
@@ -201,59 +128,7 @@ export declare const RouterLink: import('vue').DefineSetupFnComponent<import('./
|
|
|
201
128
|
* @throws {UseRouteInvalidError} Throws an error if the provided route name is not valid or does not match the current route.
|
|
202
129
|
* @group Compositions
|
|
203
130
|
*/
|
|
204
|
-
export declare const useRoute:
|
|
205
|
-
(): import('./main').RouterRoute<Readonly<{
|
|
206
|
-
id: any;
|
|
207
|
-
matched: any;
|
|
208
|
-
matches: any;
|
|
209
|
-
name: any;
|
|
210
|
-
query: URLSearchParams;
|
|
211
|
-
hash: string;
|
|
212
|
-
params: {
|
|
213
|
-
[x: string]: unknown;
|
|
214
|
-
[x: number]: unknown;
|
|
215
|
-
[x: symbol]: unknown;
|
|
216
|
-
};
|
|
217
|
-
state: import('./types/state').ExtractRouteStateParamsAsOptional<any>;
|
|
218
|
-
href: import('./main').Url;
|
|
219
|
-
}>>;
|
|
220
|
-
<TRouteName extends any>(routeName: TRouteName, options: import('./guards/routes').IsRouteOptions & {
|
|
221
|
-
exact: true;
|
|
222
|
-
}): import('./main').RouterRoute<Readonly<{
|
|
223
|
-
id: any;
|
|
224
|
-
matched: any;
|
|
225
|
-
matches: any;
|
|
226
|
-
name: any;
|
|
227
|
-
query: URLSearchParams;
|
|
228
|
-
hash: string;
|
|
229
|
-
params: {
|
|
230
|
-
[x: string]: unknown;
|
|
231
|
-
[x: number]: unknown;
|
|
232
|
-
[x: symbol]: unknown;
|
|
233
|
-
};
|
|
234
|
-
state: import('./types/state').ExtractRouteStateParamsAsOptional<any>;
|
|
235
|
-
href: import('./main').Url;
|
|
236
|
-
}>> & {
|
|
237
|
-
name: TRouteName;
|
|
238
|
-
};
|
|
239
|
-
<TRouteName extends any>(routeName: TRouteName, options?: import('./guards/routes').IsRouteOptions): import('./main').RouterRoute<Readonly<{
|
|
240
|
-
id: any;
|
|
241
|
-
matched: any;
|
|
242
|
-
matches: any;
|
|
243
|
-
name: any;
|
|
244
|
-
query: URLSearchParams;
|
|
245
|
-
hash: string;
|
|
246
|
-
params: {
|
|
247
|
-
[x: string]: unknown;
|
|
248
|
-
[x: number]: unknown;
|
|
249
|
-
[x: symbol]: unknown;
|
|
250
|
-
};
|
|
251
|
-
state: import('./types/state').ExtractRouteStateParamsAsOptional<any>;
|
|
252
|
-
href: import('./main').Url;
|
|
253
|
-
}>> & {
|
|
254
|
-
name: `${TRouteName}${string}`;
|
|
255
|
-
};
|
|
256
|
-
};
|
|
131
|
+
export declare const useRoute: RouterAssets<RegisteredRouter>['useRoute'];
|
|
257
132
|
/**
|
|
258
133
|
* A composition to access the installed router instance within a Vue component.
|
|
259
134
|
*
|
|
@@ -262,17 +137,14 @@ export declare const useRoute: {
|
|
|
262
137
|
* ensuring the component does not operate without routing functionality.
|
|
263
138
|
* @group Compositions
|
|
264
139
|
*/
|
|
265
|
-
export declare const useRouter:
|
|
140
|
+
export declare const useRouter: RouterAssets<RegisteredRouter>['useRouter'];
|
|
266
141
|
/**
|
|
267
142
|
* A composition to access a specific query value from the current route.
|
|
268
143
|
*
|
|
269
144
|
* @returns The query value from the router.
|
|
270
145
|
* @group Compositions
|
|
271
146
|
*/
|
|
272
|
-
export declare const useQueryValue:
|
|
273
|
-
(key: import('vue').MaybeRefOrGetter<string>): import('./compositions/useQueryValue').UseQueryValue<string>;
|
|
274
|
-
<TParam extends import('./main').Param>(key: import('vue').MaybeRefOrGetter<string>, param: TParam): import('./compositions/useQueryValue').UseQueryValue<import('./types/params').ExtractParamType<TParam>>;
|
|
275
|
-
};
|
|
147
|
+
export declare const useQueryValue: RouterAssets<RegisteredRouter>['useQueryValue'];
|
|
276
148
|
/**
|
|
277
149
|
* A composition to export much of the functionality that drives RouterLink component.
|
|
278
150
|
* Also exports some useful context about routes relationship to current URL and convenience methods
|
|
@@ -284,16 +156,7 @@ export declare const useQueryValue: {
|
|
|
284
156
|
* @returns {UseLink} Reactive context values for as well as navigation methods.
|
|
285
157
|
* @group Compositions
|
|
286
158
|
*/
|
|
287
|
-
export declare const useLink:
|
|
288
|
-
<TRouteKey extends any>(name: import('vue').MaybeRefOrGetter<TRouteKey>, params?: import('vue').MaybeRefOrGetter<Record<string, unknown> | {
|
|
289
|
-
[x: string]: unknown;
|
|
290
|
-
[x: number]: unknown;
|
|
291
|
-
[x: symbol]: unknown;
|
|
292
|
-
}> | undefined, options?: import('vue').MaybeRefOrGetter<import('./main').UseLinkOptions> | undefined): import('./main').UseLink;
|
|
293
|
-
(url: import('vue').MaybeRefOrGetter<import('./main').Url>, options?: import('vue').MaybeRefOrGetter<import('./main').UseLinkOptions>): import('./main').UseLink;
|
|
294
|
-
(resolvedRoute: import('vue').MaybeRefOrGetter<import('./main').ResolvedRoute | undefined>, options?: import('vue').MaybeRefOrGetter<import('./main').UseLinkOptions>): import('./main').UseLink;
|
|
295
|
-
(source: import('vue').MaybeRefOrGetter<string | import('./main').ResolvedRoute | undefined>, paramsOrOptions?: import('vue').MaybeRefOrGetter<Record<PropertyKey, unknown> | import('./main').UseLinkOptions>, maybeOptions?: import('vue').MaybeRefOrGetter<import('./main').UseLinkOptions>): import('./main').UseLink;
|
|
296
|
-
};
|
|
159
|
+
export declare const useLink: RouterAssets<RegisteredRouter>['useLink'];
|
|
297
160
|
declare module 'vue' {
|
|
298
161
|
interface GlobalComponents {
|
|
299
162
|
RouterView: typeof RouterView;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Routes } from '../types/route';
|
|
2
|
-
import { RouterAfterRouteHook, RouterBeforeRouteHook } from '../types/router';
|
|
2
|
+
import { RouterAfterRouteHook, RouterBeforeRouteHook, RouterErrorHook } from '../types/router';
|
|
3
3
|
export declare class RouterRouteHooks<TRoutes extends Routes = Routes, TRejections extends PropertyKey = PropertyKey> {
|
|
4
4
|
onBeforeRouteEnter: Set<RouterBeforeRouteHook<TRoutes, TRejections>>;
|
|
5
5
|
onBeforeRouteUpdate: Set<RouterBeforeRouteHook<TRoutes, TRejections>>;
|
|
@@ -7,4 +7,5 @@ export declare class RouterRouteHooks<TRoutes extends Routes = Routes, TRejectio
|
|
|
7
7
|
onAfterRouteEnter: Set<RouterAfterRouteHook<TRoutes, TRejections>>;
|
|
8
8
|
onAfterRouteUpdate: Set<RouterAfterRouteHook<TRoutes, TRejections>>;
|
|
9
9
|
onAfterRouteLeave: Set<RouterAfterRouteHook<TRoutes, TRejections>>;
|
|
10
|
+
onError: Set<RouterErrorHook<TRoutes, TRejections>>;
|
|
10
11
|
}
|
|
@@ -7,7 +7,7 @@ import { createUseRouter } from '../compositions/useRouter';
|
|
|
7
7
|
import { createUseQueryValue } from '../compositions/useQueryValue';
|
|
8
8
|
import { createUseLink } from '../compositions/useLink';
|
|
9
9
|
import { createIsRoute } from '../guards/routes';
|
|
10
|
-
type RouterAssets<TRouter extends Router> = {
|
|
10
|
+
export type RouterAssets<TRouter extends Router> = {
|
|
11
11
|
/**
|
|
12
12
|
* Registers a hook that is called before a route is left. Must be called from setup.
|
|
13
13
|
* This is useful for performing actions or cleanups before navigating away from a route component.
|
|
@@ -115,4 +115,3 @@ type RouterAssets<TRouter extends Router> = {
|
|
|
115
115
|
};
|
|
116
116
|
export declare function createRouterAssets<TRouter extends Router>(router: TRouter): RouterAssets<TRouter>;
|
|
117
117
|
export declare function createRouterAssets<TRouter extends Router>(routerKey: InjectionKey<TRouter>): RouterAssets<TRouter>;
|
|
118
|
-
export {};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { AddGlobalRouteHooks, AddComponentAfterRouteHook, AddComponentBeforeRouteHook } from '../types/hooks';
|
|
2
2
|
import { HasVueAppStore } from './createVueAppStore';
|
|
3
|
-
import { AddRouterAfterRouteHook, AddRouterBeforeRouteHook, Router, RouterRoutes, RouterRouteHookBeforeRunner, RouterRouteHookAfterRunner, RouterRejections } from '../types/router';
|
|
3
|
+
import { AddRouterAfterRouteHook, AddRouterBeforeRouteHook, Router, RouterRoutes, RouterRouteHookBeforeRunner, RouterRouteHookAfterRunner, RouterRejections, AddRouterErrorHook, RouterRouteHookErrorRunner } from '../types/router';
|
|
4
4
|
import { Routes } from '../types/route';
|
|
5
5
|
import { InjectionKey } from 'vue';
|
|
6
6
|
export declare const getRouterHooksKey: (routerKey: InjectionKey<Router>) => InjectionKey<RouterHooks<any, any>>;
|
|
7
7
|
export type RouterHooks<TRoutes extends Routes, TRejections extends PropertyKey> = HasVueAppStore & {
|
|
8
8
|
runBeforeRouteHooks: RouterRouteHookBeforeRunner<TRoutes>;
|
|
9
9
|
runAfterRouteHooks: RouterRouteHookAfterRunner<TRoutes>;
|
|
10
|
+
runErrorHooks: RouterRouteHookErrorRunner<TRoutes>;
|
|
10
11
|
addComponentBeforeRouteHook: AddComponentBeforeRouteHook<TRoutes, TRejections>;
|
|
11
12
|
addComponentAfterRouteHook: AddComponentAfterRouteHook<TRoutes, TRejections>;
|
|
12
13
|
addGlobalRouteHooks: AddGlobalRouteHooks<TRoutes, TRejections>;
|
|
@@ -16,5 +17,6 @@ export type RouterHooks<TRoutes extends Routes, TRejections extends PropertyKey>
|
|
|
16
17
|
onAfterRouteEnter: AddRouterAfterRouteHook<TRoutes, TRejections>;
|
|
17
18
|
onAfterRouteUpdate: AddRouterAfterRouteHook<TRoutes, TRejections>;
|
|
18
19
|
onAfterRouteLeave: AddRouterAfterRouteHook<TRoutes, TRejections>;
|
|
20
|
+
onError: AddRouterErrorHook<TRoutes, TRejections>;
|
|
19
21
|
};
|
|
20
22
|
export declare function createRouterHooks<TRouter extends Router>(_routerKey: InjectionKey<TRouter>): RouterHooks<RouterRoutes<TRouter>, RouterRejections<TRouter>>;
|
|
@@ -104,9 +104,13 @@ type RoutePropsRecord<TOptions extends CreateRouteOptions = CreateRouteOptions,
|
|
|
104
104
|
[K in keyof TComponents as ComponentPropsAreOptional<TComponents[K]> extends false ? K : never]: PropsGetter<TOptions, TComponents[K]>;
|
|
105
105
|
};
|
|
106
106
|
export type CreateRouteProps<TOptions extends CreateRouteOptions = CreateRouteOptions> = TOptions['component'] extends Component ? PropsGetter<TOptions, TOptions['component']> : TOptions['components'] extends Record<string, Component> ? RoutePropsRecord<TOptions, TOptions['components']> : PropsGetter<TOptions, typeof RouterView>;
|
|
107
|
-
type ToMatch<TOptions extends CreateRouteOptions, TProps extends CreateRouteProps<TOptions> | undefined> = Omit<TOptions, 'props'> & {
|
|
107
|
+
type ToMatch<TOptions extends CreateRouteOptions, TProps extends CreateRouteProps<TOptions> | undefined> = Omit<TOptions, 'props' | 'meta'> & {
|
|
108
108
|
id: string;
|
|
109
109
|
props: TProps;
|
|
110
|
+
/**
|
|
111
|
+
* Represents additional metadata associated with a route. Always present, defaults to empty object.
|
|
112
|
+
*/
|
|
113
|
+
meta: ToMeta<TOptions['meta']>;
|
|
110
114
|
};
|
|
111
115
|
type ToMatches<TOptions extends CreateRouteOptions, TProps extends CreateRouteProps<TOptions> | undefined> = TOptions extends {
|
|
112
116
|
parent: infer TParent extends Route;
|
package/dist/types/meta.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
import { RouteMeta } from './register';
|
|
2
|
-
|
|
2
|
+
type EmptyMeta = Readonly<{}>;
|
|
3
|
+
export type ToMeta<TMeta extends RouteMeta | undefined> = TMeta extends undefined ? EmptyMeta : unknown extends TMeta ? EmptyMeta : TMeta;
|
|
4
|
+
export {};
|