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