@kitbag/router 0.14.0 → 0.14.2

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.
@@ -1 +1 @@
1
- (function(b,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],u):(b=typeof globalThis<"u"?globalThis:b||self,u(b["@kitbag/router"]={},b.Vue))})(this,function(b,u){"use strict";var Tr=Object.defineProperty;var Dr=(b,u,j)=>u in b?Tr(b,u,{enumerable:!0,configurable:!0,writable:!0,value:j}):b[u]=j;var W=(b,u,j)=>Dr(b,typeof u!="symbol"?u+"":u,j);function j(e){return typeof e!="string"?!1:/^(https?:\/\/|\/).*/g.test(e)}function xe(e){return j(e)?e:`/${e}`}class Ke extends Error{constructor(t){super(`Invalid Param "${t}": Router does not support multiple params by the same name. All param names must be unique.`)}}class ze extends Error{constructor(t){super(`Child property on meta for ${t} conflicts with the parent meta.`)}}class ee extends Error{constructor(){super("Router not installed")}}class Ye extends Error{constructor(t,n){super(`useRoute called with incorrect route. Given ${t}, expected ${n}`)}}const Xe=Symbol();function he(){const e=u.inject(Xe);if(!e)throw new ee;return e}function se(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function on(e){return e.every(t=>Array.isArray(t))}function ce(e){return typeof e=="string"&&e.length>0}function pe(e){return{value:ce(e)?e.replace(/^#*/,""):void 0}}function an(e,t){return pe(`${e.value??""}${t.value??""}`)}function sn(e,t){return cn(e,t),{...e,...t}}function cn(e,t){const n=Object.keys(e).find(r=>r in t&&typeof t[r]!=typeof e[r]);if(n)throw new ze(n)}function te(e){return Array.isArray(e)?e:[e]}function Ze(e,t){return e.filter(n=>t===n).length}function ne(...e){const t=e.flatMap(n=>Array.isArray(n)?n:Object.keys(n).map(un));for(const n of t)if(Ze(t,n)>1)throw new Ke(n)}function un(e){return e.startsWith("?")?e.slice(1):e}function fn(e,t){return ne(e.params,t.params),{value:`${e.value}${t.value}`,params:{...e.params,...t.params}}}function ln(e,t){return ne(e.params,t.params),{value:[e.value,t.value].filter(ce).join("&"),params:{...e.params,...t.params}}}function hn(e,t){return ne(e,t),{...e,...t}}function pn(e){return"host"in e&&!!e.host}function et(e){return"parent"in e&&!!e.parent}function Ue(e){return"component"in e&&!!e.component}function Ce(e){return"components"in e&&!!e.components}function dn(e){return"state"in e&&!!e.state}function tt(e,t){return{...t,path:fn(e.path,t.path),query:ln(e.query,t.query),meta:sn(e.meta,t.meta),state:hn(e.state,t.state),hash:an(e.hash,t.hash),matches:[...e.matches,t.matched],host:e.host,depth:e.depth+1}}function Le(){return typeof window<"u"&&typeof window.document<"u"}class ie extends Error{}const F="[",J="]";function mn(e){return e!==String&&e!==Boolean&&e!==Number&&e!==Date}function yn(e){return typeof e=="function"&&mn(e)}function de(e){return typeof e=="object"&&"get"in e&&typeof e.get=="function"&&"set"in e&&typeof e.set=="function"}function gn(e){return de(e)&&e.defaultValue!==void 0}function Rn(e,t){return st(e,t)}function wn(e,t){return e[t]??String}const _={invalid:e=>{throw new ie(e)}},vn={get:e=>e,set:(e,{invalid:t})=>{if(typeof e!="string")throw t();return e}},nt={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()}},rt={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()}},ot={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()}},at={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 ue(e,t,n=!1){if(e===void 0||!ce(e)){if(gn(t))return t.defaultValue;if(n)return;throw new ie}if(t===String)return vn.get(e,_);if(t===Boolean)return nt.get(e,_);if(t===Number)return rt.get(e,_);if(t===Date)return ot.get(e,_);if(t===JSON)return at.get(e,_);if(yn(t))return t(e,_);if(de(t))return t.get(e,_);if(t instanceof RegExp){if(t.test(e))return e;throw new ie}return e}function fe(e,t,n=!1){if(e===void 0){if(n)return"";throw new ie}if(t===Boolean)return nt.set(e,_);if(t===Number)return rt.set(e,_);if(t===Date)return ot.set(e,_);if(t===JSON)return at.set(e,_);if(de(t))return t.set(e,_);try{return e.toString()}catch{throw new ie}}function st(e,t){return de(e)?{...e,defaultValue:t??e.defaultValue}:{get:n=>ue(n,e),set:n=>fe(n,e),defaultValue:t}}function Q(){return Q=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Q.apply(this,arguments)}var H;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(H||(H={}));var re=process.env.NODE_ENV!=="production"?function(e){return Object.freeze(e)}:function(e){return e};function z(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}var me="beforeunload",Pn="hashchange",ct="popstate";function it(e){e===void 0&&(e={});var t=e,n=t.window,r=n===void 0?document.defaultView:n,o=r.history;function a(){var R=r.location,h=R.pathname,g=R.search,A=R.hash,x=o.state||{};return[x.idx,re({pathname:h,search:g,hash:A,state:x.usr||null,key:x.key||"default"})]}var c=null;function s(){if(c)p.call(c),c=null;else{var R=H.Pop,h=a(),g=h[0],A=h[1];if(p.length)if(g!=null){var x=l-g;x&&(c={action:R,location:A,retry:function(){L(x*-1)}},L(x))}else process.env.NODE_ENV!=="production"&&z(!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 U(R)}}r.addEventListener(ct,s);var i=H.Pop,f=a(),l=f[0],d=f[1],E=oe(),p=oe();l==null&&(l=0,o.replaceState(Q({},o.state,{idx:l}),""));function y(R){return typeof R=="string"?R:Y(R)}function w(R,h){return h===void 0&&(h=null),re(Q({pathname:d.pathname,hash:"",search:""},typeof R=="string"?le(R):R,{state:h,key:ge()}))}function P(R,h){return[{usr:R.state,key:R.key,idx:h},y(R)]}function v(R,h,g){return!p.length||(p.call({action:R,location:h,retry:g}),!1)}function U(R){i=R;var h=a();l=h[0],d=h[1],E.call({action:i,location:d})}function m(R,h){var g=H.Push,A=w(R,h);function x(){m(R,h)}if(v(g,A,x)){var B=P(A,l+1),V=B[0],T=B[1];try{o.pushState(V,"",T)}catch{r.location.assign(T)}U(g)}}function k(R,h){var g=H.Replace,A=w(R,h);function x(){k(R,h)}if(v(g,A,x)){var B=P(A,l),V=B[0],T=B[1];o.replaceState(V,"",T),U(g)}}function L(R){o.go(R)}var C={get action(){return i},get location(){return d},createHref:y,push:m,replace:k,go:L,back:function(){L(-1)},forward:function(){L(1)},listen:function(h){return E.push(h)},block:function(h){var g=p.push(h);return p.length===1&&r.addEventListener(me,ye),function(){g(),p.length||r.removeEventListener(me,ye)}}};return C}function En(e){e===void 0&&(e={});var t=e,n=t.window,r=n===void 0?document.defaultView:n,o=r.history;function a(){var h=le(r.location.hash.substr(1)),g=h.pathname,A=g===void 0?"/":g,x=h.search,B=x===void 0?"":x,V=h.hash,T=V===void 0?"":V,I=o.state||{};return[I.idx,re({pathname:A,search:B,hash:T,state:I.usr||null,key:I.key||"default"})]}var c=null;function s(){if(c)p.call(c),c=null;else{var h=H.Pop,g=a(),A=g[0],x=g[1];if(p.length)if(A!=null){var B=l-A;B&&(c={action:h,location:x,retry:function(){C(B*-1)}},C(B))}else process.env.NODE_ENV!=="production"&&z(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.");else m(h)}}r.addEventListener(ct,s),r.addEventListener(Pn,function(){var h=a(),g=h[1];Y(g)!==Y(d)&&s()});var i=H.Pop,f=a(),l=f[0],d=f[1],E=oe(),p=oe();l==null&&(l=0,o.replaceState(Q({},o.state,{idx:l}),""));function y(){var h=document.querySelector("base"),g="";if(h&&h.getAttribute("href")){var A=r.location.href,x=A.indexOf("#");g=x===-1?A:A.slice(0,x)}return g}function w(h){return y()+"#"+(typeof h=="string"?h:Y(h))}function P(h,g){return g===void 0&&(g=null),re(Q({pathname:d.pathname,hash:"",search:""},typeof h=="string"?le(h):h,{state:g,key:ge()}))}function v(h,g){return[{usr:h.state,key:h.key,idx:g},w(h)]}function U(h,g,A){return!p.length||(p.call({action:h,location:g,retry:A}),!1)}function m(h){i=h;var g=a();l=g[0],d=g[1],E.call({action:i,location:d})}function k(h,g){var A=H.Push,x=P(h,g);function B(){k(h,g)}if(process.env.NODE_ENV!=="production"&&z(x.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.push("+JSON.stringify(h)+")"),U(A,x,B)){var V=v(x,l+1),T=V[0],I=V[1];try{o.pushState(T,"",I)}catch{r.location.assign(I)}m(A)}}function L(h,g){var A=H.Replace,x=P(h,g);function B(){L(h,g)}if(process.env.NODE_ENV!=="production"&&z(x.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.replace("+JSON.stringify(h)+")"),U(A,x,B)){var V=v(x,l),T=V[0],I=V[1];o.replaceState(T,"",I),m(A)}}function C(h){o.go(h)}var R={get action(){return i},get location(){return d},createHref:w,push:k,replace:L,go:C,back:function(){C(-1)},forward:function(){C(1)},listen:function(g){return E.push(g)},block:function(g){var A=p.push(g);return p.length===1&&r.addEventListener(me,ye),function(){A(),p.length||r.removeEventListener(me,ye)}}};return R}function ut(e){e===void 0&&(e={});var t=e,n=t.initialEntries,r=n===void 0?["/"]:n,o=t.initialIndex,a=r.map(function(m){var k=re(Q({pathname:"/",search:"",hash:"",state:null,key:ge()},typeof m=="string"?le(m):m));return process.env.NODE_ENV!=="production"&&z(k.pathname.charAt(0)==="/","Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(m)+")"),k}),c=ft(o??a.length-1,0,a.length-1),s=H.Pop,i=a[c],f=oe(),l=oe();function d(m){return typeof m=="string"?m:Y(m)}function E(m,k){return k===void 0&&(k=null),re(Q({pathname:i.pathname,search:"",hash:""},typeof m=="string"?le(m):m,{state:k,key:ge()}))}function p(m,k,L){return!l.length||(l.call({action:m,location:k,retry:L}),!1)}function y(m,k){s=m,i=k,f.call({action:s,location:i})}function w(m,k){var L=H.Push,C=E(m,k);function R(){w(m,k)}process.env.NODE_ENV!=="production"&&z(i.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.push("+JSON.stringify(m)+")"),p(L,C,R)&&(c+=1,a.splice(c,a.length,C),y(L,C))}function P(m,k){var L=H.Replace,C=E(m,k);function R(){P(m,k)}process.env.NODE_ENV!=="production"&&z(i.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.replace("+JSON.stringify(m)+")"),p(L,C,R)&&(a[c]=C,y(L,C))}function v(m){var k=ft(c+m,0,a.length-1),L=H.Pop,C=a[k];function R(){v(m)}p(L,C,R)&&(c=k,y(L,C))}var U={get index(){return c},get action(){return s},get location(){return i},createHref:d,push:w,replace:P,go:v,back:function(){v(-1)},forward:function(){v(1)},listen:function(k){return f.push(k)},block:function(k){return l.push(k)}};return U}function ft(e,t,n){return Math.min(Math.max(e,t),n)}function ye(e){e.preventDefault(),e.returnValue=""}function oe(){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 ge(){return Math.random().toString(36).substr(2,8)}function Y(e){var t=e.pathname,n=t===void 0?"/":t,r=e.search,o=r===void 0?"":r,a=e.hash,c=a===void 0?"":a;return o&&o!=="?"&&(n+=o.charAt(0)==="?"?o:"?"+o),c&&c!=="#"&&(n+=c.charAt(0)==="#"?c:"#"+c),n}function le(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}const lt=Symbol();function bn(){const e=u.inject(lt);if(!e)throw new ee;return e}const ht=Symbol("isRouterRouteSymbol");function Sn(e){return typeof e=="object"&&e!==null&&ht in e}function kn(e,t){function n(P,v,U){if(typeof P=="object"){const k={...e.params,...P};return t(e.name,k,v)}const m={...e.params,[P]:v};return t(e.name,m,U)}const r=(...P)=>{const v=new URLSearchParams(e.query.toString());v.set(...P),n({},{query:v})},o=(...P)=>{const v=new URLSearchParams(e.query.toString());v.append(...P),n({},{query:v})},a=(...P)=>{const v=new URLSearchParams(e.query.toString());v.delete(...P),n({},{query:v})},{id:c,matched:s,matches:i,name:f,hash:l,href:d}=u.toRefs(e),E=u.computed({get(){return new Proxy(e.params,{set(P,v,U){return n(v,U),!0}})},set(P){n(P)}}),p=u.computed({get(){return new Proxy(e.query,{get(P,v,U){switch(v){case"append":return o;case"set":return r;case"delete":return a;default:return Reflect.get(P,v,U)}}})},set(P){n({},{query:P})}}),y=u.computed({get(){return new Proxy(e.state,{set(P,v,U){return n({},{state:{...e.state,[v]:U}}),!0}})},set(P){n({},{state:P})}});return u.reactive({id:c,matched:s,matches:i,state:y,query:p,hash:l,params:E,name:f,href:d,update:n,[ht]:!0})}const pt=Symbol();function An(e,t){const n=u.reactive({...e}),r=c=>{Object.assign(n,{[pt]:!1,...c})},o=n,a=kn(o,t);return{currentRoute:o,routerRoute:a,updateRoute:r}}function M(e){return!e.startsWith("http")?Un(e):xn(e)}function xn(e){const{protocol:t,host:n,pathname:r,search:o,searchParams:a,hash:c}=new URL(e,e);return{protocol:t,host:n,pathname:r,search:o,searchParams:a,hash:c}}function Un(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 Cn(e){return t=>{const{host:n}=M(t);return!(n===void 0||n===e)}}function Ln({mode:e,listener:t}){const n=Bn(e),r=(i,f)=>{if(f!=null&&f.replace){n.replace(i,f.state);return}n.push(i,f==null?void 0:f.state)},o=()=>{const i=Y(n.location);n.replace(i)};let a;return{...n,update:r,refresh:o,startListening:()=>{a==null||a(),a=n.listen(t)},stopListening:()=>{a==null||a()}}}function Bn(e="auto"){switch(e){case"auto":return Le()?it():ut();case"browser":return it();case"memory":return ut();case"hash":return En();default:const t=e;throw new Error(`Switch is not exhaustive for mode: ${t}`)}}class Re{constructor(){W(this,"onBeforeRouteEnter",new Set);W(this,"onBeforeRouteUpdate",new Set);W(this,"onBeforeRouteLeave",new Set);W(this,"onAfterRouteEnter",new Set);W(this,"onAfterRouteUpdate",new Set);W(this,"onAfterRouteLeave",new Set)}}class dt extends Error{constructor(){super("Uncaught CallbackContextAbortError");W(this,"response");this.response={status:"ABORT"}}}class ae extends Error{constructor(n){super("Uncaught CallbackContextPushError");W(this,"response");this.response={status:"PUSH",to:n}}}class we extends Error{constructor(n){super("Uncaught CallbackContextRejectionError");W(this,"response");this.response={status:"REJECT",type:n}}}function Vn(e,t){const n=new Re;return e.matches.forEach((r,o)=>{r.onBeforeRouteEnter&&Be(e,t,o)&&te(r.onBeforeRouteEnter).forEach(a=>n.onBeforeRouteEnter.add(a)),r.onBeforeRouteUpdate&&Ne(e,t,o)&&te(r.onBeforeRouteUpdate).forEach(a=>n.onBeforeRouteUpdate.add(a))}),t.matches.forEach((r,o)=>{r.onBeforeRouteLeave&&Ve(e,t,o)&&te(r.onBeforeRouteLeave).forEach(a=>n.onBeforeRouteLeave.add(a))}),n}function Nn(e,t){const n=new Re;return e.matches.forEach((r,o)=>{r.onAfterRouteEnter&&Be(e,t,o)&&te(r.onAfterRouteEnter).forEach(a=>n.onAfterRouteEnter.add(a)),r.onAfterRouteUpdate&&Ne(e,t,o)&&te(r.onAfterRouteUpdate).forEach(a=>n.onAfterRouteUpdate.add(a))}),t.matches.forEach((r,o)=>{r.onAfterRouteLeave&&Ve(e,t,o)&&te(r.onAfterRouteLeave).forEach(a=>n.onAfterRouteLeave.add(a))}),n}function mt(){return{reject:o=>{throw new we(o)},push:(...o)=>{throw new ae(o)},replace:(o,a,c)=>{if(j(o)){const f=a??{};throw new ae([o,{...f,replace:!0}])}const s=a,i=c??{};throw new ae([o,s,{...i,replace:!0}])},abort:()=>{throw new dt}}}function jn(){const{reject:e,push:t,replace:n,abort:r}=mt();async function o({to:c,from:s,hooks:i}){const{global:f,component:l}=i,d=Vn(c,s),E=[...f.onBeforeRouteEnter,...d.onBeforeRouteEnter,...f.onBeforeRouteUpdate,...d.onBeforeRouteUpdate,...l.onBeforeRouteUpdate,...f.onBeforeRouteLeave,...d.onBeforeRouteLeave,...l.onBeforeRouteLeave];try{const p=E.map(y=>y(c,{from:s,reject:e,push:t,replace:n,abort:r}));await Promise.all(p)}catch(p){if(p instanceof ae||p instanceof we||p instanceof dt)return p.response;throw p}return{status:"SUCCESS"}}async function a({to:c,from:s,hooks:i}){const{global:f,component:l}=i,d=Nn(c,s),E=[...l.onAfterRouteLeave,...d.onAfterRouteLeave,...f.onAfterRouteLeave,...l.onAfterRouteUpdate,...d.onAfterRouteUpdate,...f.onAfterRouteUpdate,...l.onAfterRouteEnter,...d.onAfterRouteEnter,...f.onAfterRouteEnter];try{const p=E.map(y=>y(c,{from:s,reject:e,push:t,replace:n}));await Promise.all(p)}catch(p){if(p instanceof ae||p instanceof we)return p.response;throw p}return{status:"SUCCESS"}}return{runBeforeRouteHooks:o,runAfterRouteHooks:a}}const Be=(e,t,n)=>{var a;const r=e.matches,o=(t==null?void 0:t.matches)??[];return r.length<n||r[n].id!==((a=o[n])==null?void 0:a.id)},Ve=(e,t,n)=>{var a;const r=e.matches,o=(t==null?void 0:t.matches)??[];return r.length<n||r[n].id!==((a=o[n])==null?void 0:a.id)},Ne=(e,t,n)=>{var r;return e.matches[n].id===((r=t==null?void 0:t.matches[n])==null?void 0:r.id)};function yt(e){switch(e){case"onBeforeRouteEnter":case"onAfterRouteEnter":return Be;case"onBeforeRouteUpdate":case"onAfterRouteUpdate":return Ne;case"onBeforeRouteLeave":case"onAfterRouteLeave":return Ve;default:throw new Error(`Switch is not exhaustive for lifecycle: ${e}`)}}function Hn(){const e={global:new Re,component:new Re};function t({lifecycle:r,timing:o,depth:a,hook:c}){const s=yt(r),i=e[o][r],f=(l,d)=>{if(s(l,d.from,a))return c(l,d)};return i.add(f),()=>i.delete(f)}function n({lifecycle:r,timing:o,depth:a,hook:c}){const s=yt(r),i=e[o][r],f=(l,d)=>{if(s(l,d.from,a))return c(l,d)};return i.add(f),()=>i.delete(f)}return{...e,addBeforeRouteHook:t,addAfterRouteHook:n}}const gt=Symbol();function $n(){const e=Hn();return{onBeforeRouteEnter:s=>e.addBeforeRouteHook({lifecycle:"onBeforeRouteEnter",hook:s,timing:"global",depth:0}),onBeforeRouteUpdate:s=>e.addBeforeRouteHook({lifecycle:"onBeforeRouteUpdate",hook:s,timing:"global",depth:0}),onBeforeRouteLeave:s=>e.addBeforeRouteHook({lifecycle:"onBeforeRouteLeave",hook:s,timing:"global",depth:0}),onAfterRouteEnter:s=>e.addAfterRouteHook({lifecycle:"onAfterRouteEnter",hook:s,timing:"global",depth:0}),onAfterRouteUpdate:s=>e.addAfterRouteHook({lifecycle:"onAfterRouteUpdate",hook:s,timing:"global",depth:0}),onAfterRouteLeave:s=>e.addAfterRouteHook({lifecycle:"onAfterRouteLeave",hook:s,timing:"global",depth:0}),hooks:e}}function On(e){return u.defineComponent(()=>()=>u.h("h1",e),{name:e,props:[]})}function je(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)}}function Rt(){let e=0;return()=>(++e).toString()}const He=Rt();function qn({rejections:e}){const t=a=>{const c={...e};return u.markRaw(c[a]??On(a))},n=a=>{const c=u.markRaw(t(a)),s={id:He(),component:c,meta:{},state:{}};return{id:s.id,matched:s,matches:[s],name:a,query:je(""),params:{},state:{},href:"/",[pt]:!0}},r=a=>{if(!a){o.value=null;return}const c=t(a);o.value={type:a,component:c}},o=u.ref(null);return{setRejection:r,rejection:o,getRejectionRoute:n}}class _n extends Error{constructor(){super("initialUrl must be set if window.location is unavailable")}}function Tn(e){if(e)return e;if(Le())return window.location.toString();throw new _n}function $e(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Dn(e,t){const n=Array.from(e.matchAll(t));if(n.length===0)return[e];let r=0;const o=n.reduce((c,s)=>{const i=$e(e.slice(r,s.index));i.length&&c.push(i);const[f]=s;return c.push(f),r=s.index+f.length,c},[]),a=e.slice(r);return a&&o.push(a),o}function Mn(e){const t=wt(e.path.value);return new RegExp(`^${t}$`,"i")}function In(e){const t=new URLSearchParams(e.query.value);return Array.from(t.entries()).filter(([,n])=>!qe(n)).map(([n,r])=>{const o=wt(r);return new RegExp(`${$e(n)}=${o}(&|$)`,"i")})}function wt(e){return Dn(e,new RegExp(Wn,"g")).map(t=>t.startsWith(F)?vt(t):$e(t)).join("")}function vt(e){return[Fn,Jn].reduce((t,n)=>n(t),e)}const Wn=`\\${F}\\??([\\w-_]+)\\${J}`,Oe=`\\${F}\\?([\\w-_]+)\\${J}`,Pt=`\\${F}([\\w-_]+)\\${J}`;function Fn(e){return e.replace(new RegExp(Oe,"g"),".*")}function qe(e){return new RegExp(Oe,"g").test(e)}function Jn(e){return e.replace(new RegExp(Pt,"g"),".+")}function ve(e){const[t]=Pe(e,new RegExp(Oe,"g")),[n]=Pe(e,new RegExp(Pt,"g"));return t??n}function Pe(e,t){return Array.from(e.matchAll(t)).flatMap(([,...r])=>r.map(o=>ce(o)?o:""))}function Et(e,t,n){const r=St(t,n),[o]=Pe(e,r);return o}function bt(e,t){if(!t)return e;const{name:n,param:r,value:o}=t,a=St(e,n);return Pe(e,a).reduce((s,i)=>i===void 0?s:s.replace(i,()=>fe(o,r,n.startsWith("?"))),e)}function St(e,t){const n=[Qn,Gn,vt].reduce((r,o)=>o(r,t),e);return new RegExp(n,"g")}function Qn(e,t){if(!t.startsWith("?"))return e;const n=new RegExp(`\\${F}\\${t}\\${J}`,"g");return e.replace(n,"(.*)")}function Gn(e,t){if(t.startsWith("?"))return e;const n=new RegExp(`\\${F}${t}\\${J}`,"g");return e.replace(n,"(.+)")}const Kn=(e,t)=>{try{_e(e,t)}catch{return!1}return!0},_e=(e,t)=>{const{pathname:n,search:r}=M(t);return{...zn(e.path,n),...Yn(e.query,r)}};function zn(e,t){const n={},r=decodeURIComponent(t);for(const[o,a]of Object.entries(e.params)){const c=o.startsWith("?"),s=c?o.slice(1):o,i=Et(r,e.value,o),f=ue(i,a,c);n[s]=f}return n}function Yn(e,t){const n={},r=new URLSearchParams(t);for(const[o,a]of Object.entries(e.params)){const c=o.startsWith("?"),s=c?o.slice(1):o,i=r.get(s)??void 0,f=ue(i,a,c);n[s]=f}return n}const Xn=e=>"name"in e.matched&&!!e.matched.name,Zn=(e,t)=>{const{pathname:n}=M(t);return Mn(e).test(n)},er=(e,t)=>{const{search:n}=M(t);return In(e).every(o=>o.test(n))},Te=(e,t)=>{const{hash:n}=M(t),{value:r}=e.hash;return r===void 0||`#${r.toLowerCase()}`===n.toLowerCase()};function tr(e){const{searchParams:t,pathname:n}=M(e),r=-1,o=1;return(a,c)=>{const s=At(a,t),i=kt(a,n),f=At(c,t),l=kt(c,n);return a.depth>c.depth?r:a.depth<c.depth?o:s+i>f+l?r:s+i<f+l?o:Te(a,e)?r:Te(c,e)?o:0}}function kt(e,t){const n=Object.keys(e.path.params).filter(o=>o.startsWith("?")).map(o=>o),r=n.filter(o=>Et(t,e.path.value,o)===void 0);return n.length-r.length}function At(e,t){const n=new URLSearchParams(e.query.value),r=Array.from(n.keys()),o=r.filter(a=>!t.has(a));return r.length-o.length}function xt(e){return!!e&&typeof e=="object"}const Ee=!0;function nr(e,t,n){if(xt(e)&&t in e){const r=e[t];if(typeof r=="string")return ue(r,n,Ee)}return ue(void 0,n,Ee)}function Ut(e,t){const n={};for(const[r,o]of Object.entries(e)){const a=nr(t,r,o);n[r]=a}return n}function rr(e,t,n){if(xt(e)&&t in e){const r=e[t];return fe(r,n,Ee)}return fe(void 0,n,Ee)}const Ct=(e,t)=>{const n={};for(const[r,o]of Object.entries(e)){const a=rr(t,r,o);n[r]=a}return n},or=[Xn,Zn,er,Te,Kn];function Lt(e,t,n){const r=tr(t),o=e.filter(i=>or.every(f=>f(i,t))).sort(r);if(o.length===0)return;const[a]=o,{search:c,hash:s}=M(t);return{id:a.id,matched:a.matched,matches:a.matches,name:a.name,query:je(c),params:_e(a,t),state:Ut(a.state,n),hash:s,href:xe(t)}}function De(e,t){const n=new RegExp(`\\${F}(\\??[\\w-_]+)\\${J}`,"g");return Array.from(e.matchAll(n)).reduce((o,[a,c])=>{const s=ve(a);if(!s)return o;const i=wn(t,s);return ne([s],o),o[c]=i,o},{})}function be(e,t){return{value:e,params:De(e,t)}}function ar(e,t){return ce(t)?e.map(n=>{const r=`${t}${n.path.value}`;return{...n,path:be(r,n.path.params)}}):e}class sr 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 cr(e){const t=e.map(({name:n})=>n);for(const n of t)if(Ze(t,n)>1)throw new sr(n)}function ir(){const e=u.reactive(new Map),t=Le()?c():null,n=s=>{e.set(s,!1),t==null||t.observe(s)},r=s=>{e.delete(s),t==null||t.unobserve(s)},o=()=>{t==null||t.disconnect()},a=s=>e.get(s)??!1;function c(){return new IntersectionObserver(s=>{s.forEach(i=>{e.set(i.target,i.isIntersecting)})})}return{observe:n,unobserve:r,disconnect:o,isElementVisible:a}}const Bt=Symbol("visibilityObserver");function ur(e){const t=u.inject(Bt);if(!t)throw new ee;return u.watch(e,(r,o)=>{r&&t.observe(r),o&&t.unobserve(o)},{immediate:!0}),{isElementVisible:u.computed(()=>e.value?t.isElementVisible(e.value):!1)}}class Vt extends Error{constructor(t){super(`Route not found: "${t}"`)}}function Nt({protocol:e,host:t,pathname:n,search:r,searchParams:o,hash:a}){const c=new URL("https://localhost");e&&(c.protocol=e),t&&(c.host=t),n&&(c.pathname=n),o?c.search=o.toString():r&&(c.search=r),a&&(c.hash=a);const s=c.toString().replace(/^https:\/\/localhost\/*/,"/");return xe(s)}function jt(e,t){const n=new URLSearchParams(e),r=new URLSearchParams(t);for(const[o,a]of r.entries())n.append(o,a);return n}function Me(e,t){const{searchParams:n,...r}=M(e);return Nt({...r,searchParams:jt(n,t)})}function fr(e,t={}){const{params:n={},query:r}=t,o=pr(e.query,n),a=jt(o,r),c=hr(e.path,n),s=pe(e.hash.value??t.hash).value,i=lr(e.host,n),{protocol:f,host:l}=M(i);return Nt({protocol:f,host:l,pathname:c,searchParams:a,hash:s})}function lr(e,t){const n=e.value&&!e.value.startsWith("http")?`https://${e.value}`:e.value;return Object.entries(e.params).reduce((r,[o,a])=>{const c=ve(`${F}${o}${J}`);return c?bt(r,{name:o,param:a,value:t[c]}):r},n)}function hr(e,t){return Object.entries(e.params).reduce((n,[r,o])=>{const a=ve(`${F}${r}${J}`);return a?bt(n,{name:r,param:o,value:t[a]}):n},e.value)}function pr(e,t){const n=new URLSearchParams(e.value);if(!e.value)return n;for(const[r,o]of Array.from(n.entries())){const a=ve(o);if(!a)continue;const s=fe(t[a],e.params[a],qe(o)),i=t[a]===void 0&&s==="";qe(o)&&i?n.delete(r,o):n.set(r,s)}return n}function dr(e,t={},n={}){const r=fr(e,{params:t,query:n.query,hash:n.hash}),{search:o,hash:a}=M(r);return{id:e.id,matched:e.matched,matches:e.matches,name:e.name,query:je(o),params:_e(e,r),state:Ut(e.state,n.state),hash:a,href:r}}function mr(e,t){const n=on(e)?e.flat():e,r=ar(n,t==null?void 0:t.base);cr(r);const o=Rt(),a=br(),c=ir(),s=Ln({mode:t==null?void 0:t.historyMode,listener:({location:S})=>{const N=Y(S);v(N,{state:S.state,replace:!0})}}),{runBeforeRouteHooks:i,runAfterRouteHooks:f}=jn(),{hooks:l,onBeforeRouteEnter:d,onAfterRouteUpdate:E,onBeforeRouteLeave:p,onAfterRouteEnter:y,onBeforeRouteUpdate:w,onAfterRouteLeave:P}=$n();async function v(S,N={}){const G=o();if(s.stopListening(),Ae(S)){s.update(S,N);return}const $=Lt(r,S,N.state)??h("NotFound"),K={...A},O=await i({to:$,from:K,hooks:l});switch(O.status){case"ABORT":return;case"PUSH":s.update(S,N),await m(...O.to);return;case"REJECT":s.update(S,N),C(O.type);break;case"SUCCESS":s.update(S,N),C(null);break;default:throw new Error(`Switch is not exhaustive for before hook response status: ${JSON.stringify(O)}`)}const Z=G;a.setProps($).then(D=>{if(Z===G)switch(D.status){case"SUCCESS":break;case"PUSH":m(...D.to);break;case"REJECT":C(D.type);break;default:const _r=D;throw new Error(`Switch is not exhaustive for prop store response status: ${JSON.stringify(_r)}`)}}),B($);const q=await f({to:$,from:K,hooks:l});switch(q.status){case"PUSH":await m(...q.to);break;case"REJECT":C(q.type);break;case"SUCCESS":break;default:const D=q;throw new Error(`Switch is not exhaustive for after hook response status: ${JSON.stringify(D)}`)}s.startListening()}const U=(S,N,G)=>{if(!j(S)){const O=N??{},Z=G??{},q=r.find(D=>D.name===S);return q?dr(q,O,Z):void 0}if(Ae(S))return;const $={...N},K=Me(S,$.query);return Lt(r,K)},m=(S,N,G)=>{if(j(S)){const q={...N},D=Me(S,q.query);return v(D,q)}const $={...G},K={...N},O=U(S,K,$);if(!O)throw new Vt(String(S));const Z=Ct({...O.state},$.state);return v(O.href,{...$,state:Z})},k=(S,N,G)=>{if(j(S)){const q={...N,replace:!0},D=Me(S,q.query);return v(D,q)}const $={...G,replace:!0},K={...N},O=U(S,K,$);if(!O)throw new Vt(String(S));const Z=Ct({...O.state},$.state);return v(O.href,{...$,state:Z})},L=S=>{C(S)},{setRejection:C,rejection:R,getRejectionRoute:h}=qn(t??{}),g=h("NotFound"),{currentRoute:A,routerRoute:x,updateRoute:B}=An(g,m);s.startListening();const V=Tn(t==null?void 0:t.initialUrl),T=s.location.state,{host:I}=M(V),Ae=Cn(I);let tn=!1;async function nn(){tn||(await v(V,{replace:!0,state:T}),tn=!0)}function qr(S){S.component("RouterView",Yt),S.component("RouterLink",Gt),S.provide(lt,R),S.provide(gt,l),S.provide(Wt,a),S.provide(Bt,c),S.provide(Xe,rn),nn()}const rn={route:x,resolve:U,push:m,replace:k,reject:L,refresh:s.refresh,forward:s.forward,back:s.back,go:s.go,install:qr,isExternal:Ae,onBeforeRouteEnter:d,onAfterRouteUpdate:E,onBeforeRouteLeave:p,onAfterRouteEnter:y,onBeforeRouteUpdate:w,onAfterRouteLeave:P,prefetch:t==null?void 0:t.prefetch,start:nn};return rn}function Ie(e,t){return{value:e,params:De(e,t)}}function Ht(e,t){return{value:e,params:De(e,t)}}function yr(e){return se(e)&&typeof e.hash=="string"}function $t(e){return e===void 0?pe():yr(e)?e:pe(e)}function Ot(e){return e===void 0?"":e}function gr(e){return se(e)&&typeof e.value=="string"}function qt(e){return e===void 0?be("",{}):gr(e)?e:be(e,{})}function Rr(e){return se(e)&&typeof e.value=="string"}function _t(e){return e===void 0?Ie("",{}):Rr(e)?e:Ie(e,{})}function X(e){const t=He(),n=Ot(e.name),r=qt(e.path),o=_t(e.query),a=$t(e.hash),c=e.meta??{},s=dn(e)?e.state:{},i=u.markRaw({id:t,meta:{},state:{},...e}),f={id:t,matched:i,matches:[i],name:n,path:r,query:o,hash:a,meta:c,state:s,depth:1,host:Ht("",{}),prefetch:e.prefetch},l=et(e)?tt(e.parent,f):f;return ne(l.path.params,l.query.params),l}const Se={template:"<div>This is component</div>"},We=X({name:"parentA",path:"/parentA/[paramA]"}),Tt=X({parent:We,name:"parentA.childA",path:"/[?paramB]"}),wr=X({parent:We,name:"parentA.childB",path:"/[paramD]",component:Se}),vr=X({parent:Tt,name:"parentA.childA.grandChildA",path:"/[paramC]",component:Se});X({name:"parentB",path:"/parentB",component:Se}),X({name:"parentC",path:"/",component:Se});const Pr="lazy",Er={components:!0,props:!1};function ke(e){return["eager","lazy"].includes(e)}function Dt({routerPrefetch:e,routePrefetch:t,linkPrefetch:n},r){const o=Fe(n,r),a=Fe(t,r),c=Fe(e,r),s=[o,a,c,Er[r],Pr].reduce((i,f)=>ke(i)?i:i===!0&&ke(f)?f:i===!0&&!ke(f)?i:i===void 0?f:i,void 0);return ke(s)?s:!1}function Fe(e,t){return se(e)?e[t]:e}function Mt(e){return typeof e=="object"&&e!==null&&"then"in e}function It(e){try{const t=e();return Mt(t)?t.catch(n=>n):t}catch(t){return t}}const Wt=Symbol();function br(){const e=u.reactive(new Map),{push:t,replace:n,reject:r}=mt(),o=(d,E,p)=>E.matches.filter(y=>Dt({...p,routePrefetch:y.prefetch},"props")===d).flatMap(y=>f(y)).reduce((y,{id:w,name:P,props:v})=>{if(!v)return y;const U=i(w,P,E),m=It(()=>v(E,{push:t,replace:n,reject:r}));return y[U]=m,y},{}),a=d=>{Object.entries(d).forEach(([E,p])=>{e.set(E,p)})},c=async d=>{const E=d.matches.flatMap(f),p=[],y=[];for(const{id:w,name:P,props:v}of E){if(!v)continue;const U=i(w,P,d);if(p.push(U),!e.has(U)){const m=It(()=>v(d,{push:t,replace:n,reject:r}));e.set(U,m)}y.push((async()=>{const m=await e.get(U);if(m instanceof Error)throw m})())}l(p);try{return await Promise.all(y),{status:"SUCCESS"}}catch(w){if(w instanceof ae||w instanceof we)return w.response;throw w}},s=(d,E,p)=>{const y=i(d,E,p);return e.get(y)};function i(d,E,p){return[d,E,p.id,JSON.stringify(p.params)].join("-")}function f(d){return Ce(d)?Object.entries(d.props??{}).map(([E,p])=>({id:d.id,name:E,props:p})):Ue(d)?[{id:d.id,name:"default",props:d.props}]:[]}function l(d){for(const E in e.keys())d.includes(E)||e.delete(E)}return{getPrefetchProps:o,setPrefetchProps:a,getProps:s,setProps:c}}function Ft(){const e=u.inject(Wt);if(!e)throw new ee;return e}const Sr=u.defineAsyncComponent(()=>new Promise(e=>{e({default:{template:"foo"}})}));function Jt(e){return e.name===Sr.name&&"__asyncLoader"in e}function kr(e){const t=new Map,n=u.ref(),{getPrefetchProps:r,setPrefetchProps:o}=Ft(),{isElementVisible:a}=ur(n),c=()=>{const i=Array.from(t.values()).reduce((f,l)=>(Object.assign(f,l),f),{});o(i)};u.watch(()=>u.toValue(e),({route:i,...f})=>{t.clear(),i&&s("eager",i,f)},{immediate:!0}),u.watch(a,i=>{const{route:f,...l}=u.toValue(e);!f||!i||s("lazy",f,l)},{immediate:!0});function s(i,f,l){Ar(i,f,l),t.has(i)||t.set(i,r(i,f,l))}return{element:n,commit:c}}function Ar(e,t,n){t.matches.forEach(r=>{Dt({...n,routePrefetch:r.prefetch},"components")===e&&(Ue(r)&&Jt(r.component)&&r.component.__asyncLoader(),Ce(r)&&Object.values(r.components).forEach(a=>{Jt(a)&&a.__asyncLoader()}))})}function Je(e,t,{exact:n}={}){return Sn(e)?t===void 0?!0:n?e.matched.name===t:e.matches.map(r=>r.name).includes(t):!1}function Qt(e,t={},n={}){const r=he(),o=u.computed(()=>{const y=u.toValue(e);return typeof y!="string"?y:r.resolve(y,u.toValue(t),u.toValue(n))}),a=u.computed(()=>{if(o.value)return o.value.href;const y=u.toValue(e);if(j(y))return y;console.error(new Error("Failed to resolve route in RouterLink."))}),c=u.computed(()=>Je(r.route)&&r.route.matches.some(y=>{var w;return y.id===((w=o.value)==null?void 0:w.id)})),s=u.computed(()=>{var y;return r.route.id===((y=o.value)==null?void 0:y.id)}),i=u.computed(()=>!!a.value&&r.isExternal(a.value)),f=u.computed(()=>{const y=u.toValue(e);return typeof y!="string"||j(y)?u.toValue(t):u.toValue(n)}),{element:l,commit:d}=kr(()=>({route:o.value,routerPrefetch:r.prefetch,linkPrefetch:f.value.prefetch})),E=y=>(d(),r.push(a.value,{...f.value,...y}));return{element:l,route:o,href:a,isMatch:c,isExactMatch:s,isExternal:i,push:E,replace:y=>E(y)}}const xr=["href"],Gt=u.defineComponent({__name:"routerLink",props:{to:{},prefetch:{type:[Boolean,String,Object],default:void 0},query:{},hash:{},replace:{type:Boolean},state:{}},setup(e){const t=e,n=he(),r=u.computed(()=>E(t.to)),o=u.computed(()=>p(t.to)),a=u.computed(()=>{const{to:w,...P}=t;return P}),{element:c,isMatch:s,isExactMatch:i,isExternal:f,push:l}=Qt(()=>typeof t.to=="function"?t.to(n.resolve):t.to,a),d=u.computed(()=>({"router-link--match":s.value,"router-link--exact-match":i.value}));function E(w){if(typeof w=="function"){const P=w(n.resolve);return E(P)}return j(w)?n.resolve(w):w}function p(w){if(typeof w=="function"){const P=w(n.resolve);return p(P)}return j(w)?w:w==null?void 0:w.href}function y(w){w.preventDefault(),l()}return(w,P)=>(u.openBlock(),u.createElementBlock("a",{ref_key:"element",ref:c,href:o.value,class:u.normalizeClass(["router-link",d.value]),onClick:y},[u.renderSlot(w.$slots,"default",u.normalizeProps(u.guardReactiveProps({route:r.value,isMatch:u.unref(s),isExactMatch:u.unref(i),isExternal:u.unref(f)})))],10,xr))}});function Kt(e,t){const n=he();function r(){if(!e)return;if(!Je(n.route,e,t))throw new Ye(e,n.route.name)}return u.watch(n.route,r,{immediate:!0,deep:!0}),n.route}const zt=Symbol();function Qe(){return u.inject(zt,0)}function Ur(e,t){return u.defineComponent({name:"PropsWrapper",expose:[],setup(){const n=t(),r=u.getCurrentInstance();return()=>n instanceof Error?"":Mt(n)?r!=null&&r.suspense?u.h(Lr(e,n)):u.h(Cr(e,n)):u.h(e,n)}})}function Cr(e,t){return u.defineComponent({name:"AsyncPropsWrapper",expose:[],setup(){const n=u.ref();return(async()=>n.value=await t)(),()=>n.value instanceof Error?"":n.value?u.h(e,n.value):""}})}function Lr(e,t){return u.defineComponent({name:"SuspenseAsyncPropsWrapper",expose:[],async setup(){const n=await t;return()=>u.h(e,n)}})}const Yt=u.defineComponent({__name:"routerView",props:{name:{default:"default"}},setup(e){const t=Kt(),n=bn(),r=Qe(),{getProps:o}=Ft(),a=u.resolveComponent("RouterView",!0);u.provide(zt,r+1);const c=u.computed(()=>{if(n.value)return n.value.component;const f=t.matches.at(r);if(!f)return null;const l=s(f),d=o(f.id,e.name,t);return l?d?Ur(l,()=>d):l:null});function s(f){return i(f)[e.name]}function i(f){return Ce(f)?f.components:Ue(f)?{default:f.component}:typeof a=="string"?{}:{default:a}}return(f,l)=>c.value?u.renderSlot(f.$slots,"default",u.normalizeProps(u.mergeProps({key:0},{route:u.unref(t),component:c.value,rejection:u.unref(n)})),()=>[(u.openBlock(),u.createBlock(u.resolveDynamicComponent(c.value)))]):u.createCommentVNode("",!0)}});function Xt(){const e=u.inject(gt);if(!e)throw new ee;return e}function Zt(e){return t=>{const n=Qe(),o=Xt().addBeforeRouteHook({lifecycle:e,hook:t,depth:n,timing:"component"});return u.onUnmounted(o),o}}function Ge(e){return t=>{const n=Qe(),o=Xt().addAfterRouteHook({lifecycle:e,hook:t,depth:n,timing:"component"});return u.onUnmounted(o),o}}const Br=Zt("onBeforeRouteUpdate"),Vr=Zt("onBeforeRouteLeave"),Nr=Ge("onAfterRouteEnter"),jr=Ge("onAfterRouteUpdate"),Hr=Ge("onAfterRouteLeave");function $r(e){return se(e)&&typeof e.value=="string"}function en(e){return $r(e)?e:Ht(e,{})}function Or(e){const t=He(),n=Ot(e.name),r=qt(e.path),o=_t(e.query),a=$t(e.hash),c=e.meta??{},s=pn(e)?en(e.host):en(""),i=u.markRaw({id:t,meta:{},state:{},...e}),f={id:t,matched:i,matches:[i],name:n,host:s,path:r,query:o,hash:a,meta:c,depth:1,state:{}},l=et(e)?tt(e.parent,f):f;return ne(l.path.params,l.query.params,l.host.params),l}b.DuplicateParamsError=Ke,b.MetaPropertyConflict=ze,b.RouterLink=Gt,b.RouterNotInstalledError=ee,b.RouterView=Yt,b.UseRouteInvalidError=Ye,b.asUrl=xe,b.createExternalRoute=Or,b.createParam=st,b.createRoute=X,b.createRouter=mr,b.isRoute=Je,b.isUrl=j,b.onAfterRouteEnter=Nr,b.onAfterRouteLeave=jr,b.onAfterRouteUpdate=Hr,b.onBeforeRouteLeave=Br,b.onBeforeRouteUpdate=Vr,b.path=be,b.query=Ie,b.useLink=Qt,b.useRoute=Kt,b.useRouter=he,b.withDefault=Rn,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})});
1
+ (function(k,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],u):(k=typeof globalThis<"u"?globalThis:k||self,u(k["@kitbag/router"]={},k.Vue))})(this,function(k,u){"use strict";var Wn=Object.defineProperty;var Fn=(k,u,N)=>u in k?Wn(k,u,{enumerable:!0,configurable:!0,writable:!0,value:N}):k[u]=N;var W=(k,u,N)=>Fn(k,typeof u!="symbol"?u+"":u,N);function N(e){return typeof e!="string"?!1:/^(https?:\/\/|\/).*/g.test(e)}function ke(e){return N(e)?e:`/${e}`}class Ke extends Error{constructor(t){super(`Invalid Param "${t}": Router does not support multiple params by the same name. All param names must be unique.`)}}class Ye extends Error{constructor(t){super(`Child property on meta for ${t} conflicts with the parent meta.`)}}class ee extends Error{constructor(){super("Router not installed")}}class Xe extends Error{constructor(t,r){super(`useRoute called with incorrect route. Given ${t}, expected ${r}`)}}const Ze=Symbol();function le(){const e=u.inject(Ze);if(!e)throw new ee;return e}function se(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ar(e){return e.every(t=>Array.isArray(t))}function F(e){return typeof e=="string"&&e.length>0}function he(e){return{value:F(e)?e.replace(/^#*/,""):void 0}}function sr(e,t){return he(`${e.value??""}${t.value??""}`)}function cr(e,t){return ur(e,t),{...e,...t}}function ur(e,t){const r=Object.keys(e).find(n=>n in t&&typeof t[n]!=typeof e[n]);if(r)throw new Ye(r)}function te(e){return Array.isArray(e)?e:[e]}function et(e,t){return e.filter(r=>t===r).length}function re(...e){const t=e.flatMap(r=>Array.isArray(r)?r:Object.keys(r).map(ir));for(const r of t)if(et(t,r)>1)throw new Ke(r)}function ir(e){return e.startsWith("?")?e.slice(1):e}function fr(e,t){return re(e.params,t.params),{value:`${e.value}${t.value}`,params:{...e.params,...t.params}}}function lr(e,t){return re(e.params,t.params),{value:[e.value,t.value].filter(F).join("&"),params:{...e.params,...t.params}}}function hr(e,t){return re(e,t),{...e,...t}}function pr(e){return"host"in e&&!!e.host}function tt(e){return"parent"in e&&!!e.parent}function Ae(e){return"component"in e&&!!e.component}function xe(e){return"components"in e&&!!e.components}function dr(e){return"state"in e&&!!e.state}function rt(e,t){return{...t,path:fr(e.path,t.path),query:lr(e.query,t.query),meta:cr(e.meta,t.meta),state:hr(e.state,t.state),hash:sr(e.hash,t.hash),matches:[...e.matches,t.matched],host:e.host,depth:e.depth+1}}function Ue(){return typeof window<"u"&&typeof window.document<"u"}class ce extends Error{}const J="[",Q="]";function mr(e){return e!==String&&e!==Boolean&&e!==Number&&e!==Date}function yr(e){return typeof e=="function"&&mr(e)}function pe(e){return typeof e=="object"&&"get"in e&&typeof e.get=="function"&&"set"in e&&typeof e.set=="function"}function gr(e){return pe(e)&&e.defaultValue!==void 0}function Rr(e,t){return ct(e,t)}function wr(e,t){return e[t]??String}const q={invalid:e=>{throw new ce(e)}},vr={get:e=>e,set:(e,{invalid:t})=>{if(typeof e!="string")throw t();return e}},nt={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()}},ot={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()}},at={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()}},st={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 ue(e,t,r=!1){if(e===void 0||!F(e)){if(gr(t))return t.defaultValue;if(r)return;throw new ce}if(t===String)return vr.get(e,q);if(t===Boolean)return nt.get(e,q);if(t===Number)return ot.get(e,q);if(t===Date)return at.get(e,q);if(t===JSON)return st.get(e,q);if(yr(t))return t(e,q);if(pe(t))return t.get(e,q);if(t instanceof RegExp){if(t.test(e))return e;throw new ce}return e}function ie(e,t,r=!1){if(e===void 0){if(r)return"";throw new ce}if(t===Boolean)return nt.set(e,q);if(t===Number)return ot.set(e,q);if(t===Date)return at.set(e,q);if(t===JSON)return st.set(e,q);if(pe(t))return t.set(e,q);try{return e.toString()}catch{throw new ce}}function ct(e,t){return pe(e)?{...e,defaultValue:t??e.defaultValue}:{get:r=>ue(r,e),set:r=>ie(r,e),defaultValue:t}}function z(){return z=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},z.apply(this,arguments)}var H;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(H||(H={}));var ne=process.env.NODE_ENV!=="production"?function(e){return Object.freeze(e)}:function(e){return e};function Y(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}var de="beforeunload",Pr="hashchange",ut="popstate";function it(e){e===void 0&&(e={});var t=e,r=t.window,n=r===void 0?document.defaultView:r,o=n.history;function a(){var R=n.location,h=R.pathname,g=R.search,A=R.hash,U=o.state||{};return[U.idx,ne({pathname:h,search:g,hash:A,state:U.usr||null,key:U.key||"default"})]}var s=null;function c(){if(s)d.call(s),s=null;else{var R=H.Pop,h=a(),g=h[0],A=h[1];if(d.length)if(g!=null){var U=l-g;U&&(s={action:R,location:A,retry:function(){L(U*-1)}},L(U))}else process.env.NODE_ENV!=="production"&&Y(!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 x(R)}}n.addEventListener(ut,c);var f=H.Pop,i=a(),l=i[0],m=i[1],E=oe(),d=oe();l==null&&(l=0,o.replaceState(z({},o.state,{idx:l}),""));function p(R){return typeof R=="string"?R:X(R)}function w(R,h){return h===void 0&&(h=null),ne(z({pathname:m.pathname,hash:"",search:""},typeof R=="string"?fe(R):R,{state:h,key:ye()}))}function v(R,h){return[{usr:R.state,key:R.key,idx:h},p(R)]}function b(R,h,g){return!d.length||(d.call({action:R,location:h,retry:g}),!1)}function x(R){f=R;var h=a();l=h[0],m=h[1],E.call({action:f,location:m})}function y(R,h){var g=H.Push,A=w(R,h);function U(){y(R,h)}if(b(g,A,U)){var V=v(A,l+1),j=V[0],$=V[1];try{o.pushState(j,"",$)}catch{n.location.assign($)}x(g)}}function P(R,h){var g=H.Replace,A=w(R,h);function U(){P(R,h)}if(b(g,A,U)){var V=v(A,l),j=V[0],$=V[1];o.replaceState(j,"",$),x(g)}}function L(R){o.go(R)}var C={get action(){return f},get location(){return m},createHref:p,push:y,replace:P,go:L,back:function(){L(-1)},forward:function(){L(1)},listen:function(h){return E.push(h)},block:function(h){var g=d.push(h);return d.length===1&&n.addEventListener(de,me),function(){g(),d.length||n.removeEventListener(de,me)}}};return C}function Er(e){e===void 0&&(e={});var t=e,r=t.window,n=r===void 0?document.defaultView:r,o=n.history;function a(){var h=fe(n.location.hash.substr(1)),g=h.pathname,A=g===void 0?"/":g,U=h.search,V=U===void 0?"":U,j=h.hash,$=j===void 0?"":j,T=o.state||{};return[T.idx,ne({pathname:A,search:V,hash:$,state:T.usr||null,key:T.key||"default"})]}var s=null;function c(){if(s)d.call(s),s=null;else{var h=H.Pop,g=a(),A=g[0],U=g[1];if(d.length)if(A!=null){var V=l-A;V&&(s={action:h,location:U,retry:function(){C(V*-1)}},C(V))}else process.env.NODE_ENV!=="production"&&Y(!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 y(h)}}n.addEventListener(ut,c),n.addEventListener(Pr,function(){var h=a(),g=h[1];X(g)!==X(m)&&c()});var f=H.Pop,i=a(),l=i[0],m=i[1],E=oe(),d=oe();l==null&&(l=0,o.replaceState(z({},o.state,{idx:l}),""));function p(){var h=document.querySelector("base"),g="";if(h&&h.getAttribute("href")){var A=n.location.href,U=A.indexOf("#");g=U===-1?A:A.slice(0,U)}return g}function w(h){return p()+"#"+(typeof h=="string"?h:X(h))}function v(h,g){return g===void 0&&(g=null),ne(z({pathname:m.pathname,hash:"",search:""},typeof h=="string"?fe(h):h,{state:g,key:ye()}))}function b(h,g){return[{usr:h.state,key:h.key,idx:g},w(h)]}function x(h,g,A){return!d.length||(d.call({action:h,location:g,retry:A}),!1)}function y(h){f=h;var g=a();l=g[0],m=g[1],E.call({action:f,location:m})}function P(h,g){var A=H.Push,U=v(h,g);function V(){P(h,g)}if(process.env.NODE_ENV!=="production"&&Y(U.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.push("+JSON.stringify(h)+")"),x(A,U,V)){var j=b(U,l+1),$=j[0],T=j[1];try{o.pushState($,"",T)}catch{n.location.assign(T)}y(A)}}function L(h,g){var A=H.Replace,U=v(h,g);function V(){L(h,g)}if(process.env.NODE_ENV!=="production"&&Y(U.pathname.charAt(0)==="/","Relative pathnames are not supported in hash history.replace("+JSON.stringify(h)+")"),x(A,U,V)){var j=b(U,l),$=j[0],T=j[1];o.replaceState($,"",T),y(A)}}function C(h){o.go(h)}var R={get action(){return f},get location(){return m},createHref:w,push:P,replace:L,go:C,back:function(){C(-1)},forward:function(){C(1)},listen:function(g){return E.push(g)},block:function(g){var A=d.push(g);return d.length===1&&n.addEventListener(de,me),function(){A(),d.length||n.removeEventListener(de,me)}}};return R}function ft(e){e===void 0&&(e={});var t=e,r=t.initialEntries,n=r===void 0?["/"]:r,o=t.initialIndex,a=n.map(function(y){var P=ne(z({pathname:"/",search:"",hash:"",state:null,key:ye()},typeof y=="string"?fe(y):y));return process.env.NODE_ENV!=="production"&&Y(P.pathname.charAt(0)==="/","Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(y)+")"),P}),s=lt(o??a.length-1,0,a.length-1),c=H.Pop,f=a[s],i=oe(),l=oe();function m(y){return typeof y=="string"?y:X(y)}function E(y,P){return P===void 0&&(P=null),ne(z({pathname:f.pathname,search:"",hash:""},typeof y=="string"?fe(y):y,{state:P,key:ye()}))}function d(y,P,L){return!l.length||(l.call({action:y,location:P,retry:L}),!1)}function p(y,P){c=y,f=P,i.call({action:c,location:f})}function w(y,P){var L=H.Push,C=E(y,P);function R(){w(y,P)}process.env.NODE_ENV!=="production"&&Y(f.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.push("+JSON.stringify(y)+")"),d(L,C,R)&&(s+=1,a.splice(s,a.length,C),p(L,C))}function v(y,P){var L=H.Replace,C=E(y,P);function R(){v(y,P)}process.env.NODE_ENV!=="production"&&Y(f.pathname.charAt(0)==="/","Relative pathnames are not supported in memory history.replace("+JSON.stringify(y)+")"),d(L,C,R)&&(a[s]=C,p(L,C))}function b(y){var P=lt(s+y,0,a.length-1),L=H.Pop,C=a[P];function R(){b(y)}d(L,C,R)&&(s=P,p(L,C))}var x={get index(){return s},get action(){return c},get location(){return f},createHref:m,push:w,replace:v,go:b,back:function(){b(-1)},forward:function(){b(1)},listen:function(P){return i.push(P)},block:function(P){return l.push(P)}};return x}function lt(e,t,r){return Math.min(Math.max(e,t),r)}function me(e){e.preventDefault(),e.returnValue=""}function oe(){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 ye(){return Math.random().toString(36).substr(2,8)}function X(e){var t=e.pathname,r=t===void 0?"/":t,n=e.search,o=n===void 0?"":n,a=e.hash,s=a===void 0?"":a;return o&&o!=="?"&&(r+=o.charAt(0)==="?"?o:"?"+o),s&&s!=="#"&&(r+=s.charAt(0)==="#"?s:"#"+s),r}function fe(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}const ht=Symbol();function br(){const e=u.inject(ht);if(!e)throw new ee;return e}const pt=Symbol("isRouterRouteSymbol");function Sr(e){return typeof e=="object"&&e!==null&&pt in e}function kr(e,t){function r(v,b,x){if(typeof v=="object"){const P={...e.params,...v};return t(e.name,P,b)}const y={...e.params,[v]:b};return t(e.name,y,x)}const n=(...v)=>{const b=new URLSearchParams(e.query);b.set(...v),r({},{query:b})},o=(...v)=>{const b=new URLSearchParams(e.query);b.append(...v),r({},{query:b})},a=(...v)=>{const b=new URLSearchParams(e.query);b.delete(...v),r({},{query:b})},{id:s,matched:c,matches:f,name:i,hash:l,href:m}=u.toRefs(e),E=u.computed({get(){return new Proxy(e.params,{set(v,b,x){return r(b,x),!0}})},set(v){r(v)}}),d=u.computed({get(){return new Proxy(e.query,{get(v,b,x){switch(b){case"append":return o;case"set":return n;case"delete":return a;default:return Reflect.get(v,b,x)}}})},set(v){r({},{query:v})}}),p=u.computed({get(){return new Proxy(e.state,{set(v,b,x){return r({},{state:{...e.state,[b]:x}}),!0}})},set(v){r({},{state:v})}});return u.reactive({id:s,matched:c,matches:f,state:p,query:d,hash:l,params:E,name:i,href:m,update:r,[pt]:!0})}const dt=Symbol();function Ar(e,t){const r=u.reactive({...e}),n=s=>{Object.assign(r,{[dt]:!1,...s})},o=r,a=kr(o,t);return{currentRoute:o,routerRoute:a,updateRoute:n}}function _(e){return!e.startsWith("http")?Ur(e):xr(e)}function xr(e){const{protocol:t,host:r,pathname:n,search:o,searchParams:a,hash:s}=new URL(e,e);return{protocol:t,host:r,pathname:n,search:o,searchParams:a,hash:s}}function Ur(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 Lr(e){return t=>{const{host:r}=_(t);return!(r===void 0||r===e)}}function Cr({mode:e,listener:t}){const r=Br(e),n=(f,i)=>{if(i!=null&&i.replace){r.replace(f,i.state);return}r.push(f,i==null?void 0:i.state)},o=()=>{const f=X(r.location);r.replace(f)};let a;return{...r,update:n,refresh:o,startListening:()=>{a==null||a(),a=r.listen(t)},stopListening:()=>{a==null||a()}}}function Br(e="auto"){switch(e){case"auto":return Ue()?it():ft();case"browser":return it();case"memory":return ft();case"hash":return Er();default:const t=e;throw new Error(`Switch is not exhaustive for mode: ${t}`)}}class ge{constructor(){W(this,"onBeforeRouteEnter",new Set);W(this,"onBeforeRouteUpdate",new Set);W(this,"onBeforeRouteLeave",new Set);W(this,"onAfterRouteEnter",new Set);W(this,"onAfterRouteUpdate",new Set);W(this,"onAfterRouteLeave",new Set)}}class mt extends Error{constructor(){super("Uncaught CallbackContextAbortError");W(this,"response");this.response={status:"ABORT"}}}class ae extends Error{constructor(r){super("Uncaught CallbackContextPushError");W(this,"response");this.response={status:"PUSH",to:r}}}class Re extends Error{constructor(r){super("Uncaught CallbackContextRejectionError");W(this,"response");this.response={status:"REJECT",type:r}}}function Vr(e,t){const r=new ge;return e.matches.forEach((n,o)=>{n.onBeforeRouteEnter&&Le(e,t,o)&&te(n.onBeforeRouteEnter).forEach(a=>r.onBeforeRouteEnter.add(a)),n.onBeforeRouteUpdate&&Be(e,t,o)&&te(n.onBeforeRouteUpdate).forEach(a=>r.onBeforeRouteUpdate.add(a))}),t.matches.forEach((n,o)=>{n.onBeforeRouteLeave&&Ce(e,t,o)&&te(n.onBeforeRouteLeave).forEach(a=>r.onBeforeRouteLeave.add(a))}),r}function Nr(e,t){const r=new ge;return e.matches.forEach((n,o)=>{n.onAfterRouteEnter&&Le(e,t,o)&&te(n.onAfterRouteEnter).forEach(a=>r.onAfterRouteEnter.add(a)),n.onAfterRouteUpdate&&Be(e,t,o)&&te(n.onAfterRouteUpdate).forEach(a=>r.onAfterRouteUpdate.add(a))}),t.matches.forEach((n,o)=>{n.onAfterRouteLeave&&Ce(e,t,o)&&te(n.onAfterRouteLeave).forEach(a=>r.onAfterRouteLeave.add(a))}),r}function yt(){return{reject:o=>{throw new Re(o)},push:(...o)=>{throw new ae(o)},replace:(o,a,s)=>{if(N(o)){const i=a??{};throw new ae([o,{...i,replace:!0}])}const c=a,f=s??{};throw new ae([o,c,{...f,replace:!0}])},abort:()=>{throw new mt}}}function jr(){const{reject:e,push:t,replace:r,abort:n}=yt();async function o({to:s,from:c,hooks:f}){const{global:i,component:l}=f,m=Vr(s,c),E=[...i.onBeforeRouteEnter,...m.onBeforeRouteEnter,...i.onBeforeRouteUpdate,...m.onBeforeRouteUpdate,...l.onBeforeRouteUpdate,...i.onBeforeRouteLeave,...m.onBeforeRouteLeave,...l.onBeforeRouteLeave];try{const d=E.map(p=>p(s,{from:c,reject:e,push:t,replace:r,abort:n}));await Promise.all(d)}catch(d){if(d instanceof ae||d instanceof Re||d instanceof mt)return d.response;throw d}return{status:"SUCCESS"}}async function a({to:s,from:c,hooks:f}){const{global:i,component:l}=f,m=Nr(s,c),E=[...l.onAfterRouteLeave,...m.onAfterRouteLeave,...i.onAfterRouteLeave,...l.onAfterRouteUpdate,...m.onAfterRouteUpdate,...i.onAfterRouteUpdate,...l.onAfterRouteEnter,...m.onAfterRouteEnter,...i.onAfterRouteEnter];try{const d=E.map(p=>p(s,{from:c,reject:e,push:t,replace:r}));await Promise.all(d)}catch(d){if(d instanceof ae||d instanceof Re)return d.response;throw d}return{status:"SUCCESS"}}return{runBeforeRouteHooks:o,runAfterRouteHooks:a}}const Le=(e,t,r)=>{var a;const n=e.matches,o=(t==null?void 0:t.matches)??[];return n.length<r||n[r].id!==((a=o[r])==null?void 0:a.id)},Ce=(e,t,r)=>{var a;const n=e.matches,o=(t==null?void 0:t.matches)??[];return n.length<r||n[r].id!==((a=o[r])==null?void 0:a.id)},Be=(e,t,r)=>{var n;return e.matches[r].id===((n=t==null?void 0:t.matches[r])==null?void 0:n.id)};function gt(e){switch(e){case"onBeforeRouteEnter":case"onAfterRouteEnter":return Le;case"onBeforeRouteUpdate":case"onAfterRouteUpdate":return Be;case"onBeforeRouteLeave":case"onAfterRouteLeave":return Ce;default:throw new Error(`Switch is not exhaustive for lifecycle: ${e}`)}}function Hr(){const e={global:new ge,component:new ge};function t({lifecycle:n,timing:o,depth:a,hook:s}){const c=gt(n),f=e[o][n],i=(l,m)=>{if(c(l,m.from,a))return s(l,m)};return f.add(i),()=>f.delete(i)}function r({lifecycle:n,timing:o,depth:a,hook:s}){const c=gt(n),f=e[o][n],i=(l,m)=>{if(c(l,m.from,a))return s(l,m)};return f.add(i),()=>f.delete(i)}return{...e,addBeforeRouteHook:t,addAfterRouteHook:r}}const Rt=Symbol();function $r(){const e=Hr();return{onBeforeRouteEnter:c=>e.addBeforeRouteHook({lifecycle:"onBeforeRouteEnter",hook:c,timing:"global",depth:0}),onBeforeRouteUpdate:c=>e.addBeforeRouteHook({lifecycle:"onBeforeRouteUpdate",hook:c,timing:"global",depth:0}),onBeforeRouteLeave:c=>e.addBeforeRouteHook({lifecycle:"onBeforeRouteLeave",hook:c,timing:"global",depth:0}),onAfterRouteEnter:c=>e.addAfterRouteHook({lifecycle:"onAfterRouteEnter",hook:c,timing:"global",depth:0}),onAfterRouteUpdate:c=>e.addAfterRouteHook({lifecycle:"onAfterRouteUpdate",hook:c,timing:"global",depth:0}),onAfterRouteLeave:c=>e.addAfterRouteHook({lifecycle:"onAfterRouteLeave",hook:c,timing:"global",depth:0}),hooks:e}}function qr(e){return u.defineComponent(()=>()=>u.h("h1",e),{name:e,props:[]})}function Ve(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 wt(){let e=0;return()=>(++e).toString()}const Ne=wt();function _r({rejections:e}){const t=a=>{const s={...e};return u.markRaw(s[a]??qr(a))},r=a=>{const s=u.markRaw(t(a)),c={id:Ne(),component:s,meta:{},state:{}};return{id:c.id,matched:c,matches:[c],name:a,query:Ve(""),params:{},state:{},href:"/",hash:"",[dt]:!0}},n=a=>{if(!a){o.value=null;return}const s=t(a);o.value={type:a,component:s}},o=u.ref(null);return{setRejection:n,rejection:o,getRejectionRoute:r}}class Mr extends Error{constructor(){super("initialUrl must be set if window.location is unavailable")}}function Tr(e){if(e)return e;if(Ue())return window.location.toString();throw new Mr}function je(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Dr(e,t){const r=Array.from(e.matchAll(t));if(r.length===0)return[e];let n=0;const o=r.reduce((s,c)=>{const f=je(e.slice(n,c.index));f.length&&s.push(f);const[i]=c;return s.push(i),n=c.index+i.length,s},[]),a=e.slice(n);return a&&o.push(a),o}function Ir(e){const t=vt(e.path.value);return new RegExp(`^${t}$`,"i")}function Or(e){const t=new URLSearchParams(e.query.value);return Array.from(t.entries()).filter(([,r])=>!$e(r)).map(([r,n])=>{const o=vt(n);return new RegExp(`${je(r)}=${o}(&|$)`,"i")})}function vt(e){return Dr(e,new RegExp(Wr,"g")).map(t=>t.startsWith(J)?Pt(t):je(t)).join("")}function Pt(e){return[Fr,Jr].reduce((t,r)=>r(t),e)}const Wr=`\\${J}\\??([\\w-_]+)\\${Q}`,He=`\\${J}\\?([\\w-_]+)\\${Q}`,Et=`\\${J}([\\w-_]+)\\${Q}`;function Fr(e){return e.replace(new RegExp(He,"g"),".*")}function $e(e){return new RegExp(He,"g").test(e)}function Jr(e){return e.replace(new RegExp(Et,"g"),".+")}function we(e){const[t]=ve(e,new RegExp(He,"g")),[r]=ve(e,new RegExp(Et,"g"));return t??r}function ve(e,t){return Array.from(e.matchAll(t)).flatMap(([,...n])=>n.map(o=>F(o)?o:""))}function qe(e,t){const r=new RegExp(`\\${J}(\\??[\\w-_]+)\\${Q}`,"g");return Array.from(e.matchAll(r)).reduce((o,[a,s])=>{const c=we(a);if(!c)return o;const f=wr(t,c);return re([c],o),o[s]=f,o},{})}function Pe(e,t){return{value:e,params:qe(e,t)}}function Qr(e,t){return F(t)?e.map(r=>{const n=`${t}${r.path.value}`;return{...r,path:Pe(n,r.path.params)}}):e}function bt(e){return!!e&&typeof e=="object"}const Ee=!0;function zr(e,t,r){if(bt(e)&&t in e){const n=e[t];return typeof n=="string"?ue(n,r,Ee):n}return ue(void 0,r,Ee)}function St(e,t){const r={};for(const[n,o]of Object.entries(e)){const a=zr(t,n,o);r[n]=a}return r}function Gr(e,t,r){if(bt(e)&&t in e){const n=e[t];return ie(n,r,Ee)}return ie(void 0,r,Ee)}const kt=(e,t)=>{const r={};for(const[n,o]of Object.entries(e)){const a=Gr(t,n,o);r[n]=a}return r};class Kr 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 Yr(e){const t=e.map(({name:r})=>r);for(const r of t)if(et(t,r)>1)throw new Kr(r)}function Xr(){const e=u.reactive(new Map),t=Ue()?s():null,r=c=>{e.set(c,!1),t==null||t.observe(c)},n=c=>{e.delete(c),t==null||t.unobserve(c)},o=()=>{t==null||t.disconnect()},a=c=>e.get(c)??!1;function s(){return new IntersectionObserver(c=>{c.forEach(f=>{e.set(f.target,f.isIntersecting)})})}return{observe:r,unobserve:n,disconnect:o,isElementVisible:a}}const At=Symbol("visibilityObserver");function Zr(e){const t=u.inject(At);if(!t)throw new ee;return u.watch(e,(n,o)=>{n&&t.observe(n),o&&t.unobserve(o)},{immediate:!0}),{isElementVisible:u.computed(()=>e.value?t.isElementVisible(e.value):!1)}}class en extends Error{constructor(t){super(`Route not found: "${t}"`)}}function xt(e,t,r){const n=Lt(t,r),[o]=ve(e,n);return o}function Ut(e,t){if(!t)return e;const{name:r,param:n,value:o}=t,a=Lt(e,r);return ve(e,a).reduce((c,f)=>f===void 0?c:c.replace(f,()=>ie(o,n,r.startsWith("?"))),e)}function Lt(e,t){const r=[tn,rn,Pt].reduce((n,o)=>o(n,t),e);return new RegExp(r,"g")}function tn(e,t){if(!t.startsWith("?"))return e;const r=new RegExp(`\\${J}\\${t}\\${Q}`,"g");return e.replace(r,"(.*)")}function rn(e,t){if(t.startsWith("?"))return e;const r=new RegExp(`\\${J}${t}\\${Q}`,"g");return e.replace(r,"(.+)")}function Ct({protocol:e,host:t,pathname:r,search:n,searchParams:o,hash:a}){const s=new URL("https://localhost");e&&(s.protocol=e),t&&(s.host=t),r&&(s.pathname=r),o?s.search=new URLSearchParams(o).toString():n&&(s.search=n),a&&(s.hash=a);const c=s.toString().replace(/^https:\/\/localhost\/*/,"/");return ke(c)}function _e(...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 nn(e,t={}){const{params:r={},query:n}=t,o=sn(e.query,r),a=_e(o,n),s=an(e.path,r),c=he(e.hash.value??t.hash).value,f=on(e.host,r),{protocol:i,host:l}=_(f);return Ct({protocol:i,host:l,pathname:s,searchParams:a,hash:c})}function on(e,t){const r=e.value&&!e.value.startsWith("http")?`https://${e.value}`:e.value;return Object.entries(e.params).reduce((n,[o,a])=>{const s=we(`${J}${o}${Q}`);return s?Ut(n,{name:o,param:a,value:t[s]}):n},r)}function an(e,t){return Object.entries(e.params).reduce((r,[n,o])=>{const a=we(`${J}${n}${Q}`);return a?Ut(r,{name:n,param:o,value:t[a]}):r},e.value)}function sn(e,t){const r=new URLSearchParams(e.value);if(!e.value)return r;for(const[n,o]of Array.from(r.entries())){const a=we(o);if(!a)continue;const c=ie(t[a],e.params[a],$e(o)),f=t[a]===void 0&&c==="";$e(o)&&f?r.delete(n,o):r.set(n,c)}return r}const cn=(e,t)=>{try{Me(e,t)}catch{return!1}return!0},Me=(e,t)=>{const{pathname:r,search:n}=_(t);return{...un(e.path,r),...fn(e.query,n)}};function un(e,t){const r={},n=decodeURIComponent(t);for(const[o,a]of Object.entries(e.params)){const s=o.startsWith("?"),c=s?o.slice(1):o,f=xt(n,e.value,o),i=ue(f,a,s);r[c]=i}return r}function fn(e,t){const r={},n=new URLSearchParams(t);for(const[o,a]of Object.entries(e.params)){const s=o.startsWith("?"),c=s?o.slice(1):o,f=n.get(c)??void 0,i=ue(f,a,s);r[c]=i}return r}function ln(e,t={},r={}){const n=nn(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,query:Ve(o),params:Me(e,n),state:St(e.state,r.state),hash:a,href:n}}const hn=e=>"name"in e.matched&&!!e.matched.name,pn=(e,t)=>{const{pathname:r}=_(t);return Ir(e).test(r)},dn=(e,t)=>{const{search:r}=_(t);return Or(e).every(o=>o.test(r))},Te=(e,t)=>{const{hash:r}=_(t),{value:n}=e.hash;return n===void 0||`#${n.toLowerCase()}`===r.toLowerCase()};function mn(e){const{searchParams:t,pathname:r}=_(e),n=-1,o=1;return(a,s)=>{const c=Vt(a,t),f=Bt(a,r),i=Vt(s,t),l=Bt(s,r);return a.depth>s.depth?n:a.depth<s.depth?o:c+f>i+l?n:c+f<i+l?o:Te(a,e)?n:Te(s,e)?o:0}}function Bt(e,t){const r=Object.keys(e.path.params).filter(o=>o.startsWith("?")).map(o=>o),n=r.filter(o=>xt(t,e.path.value,o)===void 0);return r.length-n.length}function Vt(e,t){const r=new URLSearchParams(t),n=new URLSearchParams(e.query.value),o=Array.from(n.keys()),a=o.filter(s=>!r.has(s));return o.length-a.length}const yn=[hn,pn,dn,Te,cn];function gn(e,t){const r=mn(t);return e.filter(n=>yn.every(o=>o(n,t))).sort(r)}function Rn(e,t,r){const n=gn(e,t);if(!n.length)return;const[o]=n,{searchParams:a,hash:s}=_(t);return{id:o.id,matched:o.matched,matches:o.matches,name:o.name,query:Ve(a),params:Me(o,t),state:St(o.state,r),hash:s,href:ke(t)}}function Nt(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 Ct({protocol:F(n.protocol)?n.protocol:r.protocol,host:F(n.host)?n.host:r.host,pathname:F(n.pathname)?n.pathname:r.pathname,searchParams:_e(a,o),hash:F(n.hash)?n.hash:r.hash})}function wn(e,t){const r=ar(e)?e.flat():e,n=Qr(r,t==null?void 0:t.base);Yr(n);const o=wt(),a=xn(),s=Xr(),c=Cr({mode:t==null?void 0:t.historyMode,listener:({location:S})=>{const B=X(S);x(B,{state:S.state,replace:!0})}}),{runBeforeRouteHooks:f,runAfterRouteHooks:i}=jr(),{hooks:l,onBeforeRouteEnter:m,onAfterRouteUpdate:E,onBeforeRouteLeave:d,onAfterRouteEnter:p,onBeforeRouteUpdate:w,onAfterRouteLeave:v}=$r();function b(S,B={}){return Rn(n,S,B.state)}async function x(S,B={}){const G=o();if(c.stopListening(),tr(S)){c.update(S,B);return}const D=b(S,B)??g("NotFound"),M={...U},K=await f({to:D,from:M,hooks:l});switch(K.status){case"ABORT":return;case"PUSH":c.update(S,B),await P(...K.to);return;case"REJECT":c.update(S,B),R(K.type);break;case"SUCCESS":c.update(S,B),R(null);break;default:throw new Error(`Switch is not exhaustive for before hook response status: ${JSON.stringify(K)}`)}const Qe=G;a.setProps(D).then(I=>{if(Qe===G)switch(I.status){case"SUCCESS":break;case"PUSH":P(...I.to);break;case"REJECT":R(I.type);break;default:const ze=I;throw new Error(`Switch is not exhaustive for prop store response status: ${JSON.stringify(ze)}`)}}),j(D);const O=await i({to:D,from:M,hooks:l});switch(O.status){case"PUSH":await P(...O.to);break;case"REJECT":R(O.type);break;case"SUCCESS":break;default:const I=O;throw new Error(`Switch is not exhaustive for after hook response status: ${JSON.stringify(I)}`)}c.startListening()}const y=(S,B={},G={})=>{const D=n.find(M=>M.name===S);if(!D)throw new en(String(S));return ln(D,B,G)},P=(S,B,G)=>{if(N(S)){const O={...B},I=Nt(S,{searchParams:O.query,hash:O.hash});return x(I,O)}if(typeof S=="string"){const{replace:O,...I}={...G},ze={...B},Ge=y(S,ze,I),On=kt({...Ge.matched.state},{...Ge.state,...I.state});return x(Ge.href,{replace:O,state:On})}const{replace:D,...M}={...B},K=kt({...S.matched.state},{...S.state,...M.state}),Qe=Nt(S.href,{searchParams:M.query,hash:M.hash});return x(Qe,{replace:D,state:K})},L=(S,B,G)=>{if(N(S)){const M={...B,replace:!0};return P(S,M)}if(typeof S=="string"){const M={...G,replace:!0},K={...B};return P(S,K,M)}const D={...B,replace:!0};return P(S,D)},C=S=>{R(S)},{setRejection:R,rejection:h,getRejectionRoute:g}=_r(t??{}),A=g("NotFound"),{currentRoute:U,routerRoute:V,updateRoute:j}=Ar(A,P);c.startListening();const $=Tr(t==null?void 0:t.initialUrl),T=c.location.state,{host:er}=_($),tr=Lr(er);let rr=!1;async function nr(){rr||(await x($,{replace:!0,state:T}),rr=!0)}function In(S){S.component("RouterView",Kt),S.component("RouterLink",Qt),S.provide(ht,h),S.provide(Rt,l),S.provide(Ot,a),S.provide(At,s),S.provide(Ze,or),nr()}const or={route:V,resolve:y,find:b,push:P,replace:L,reject:C,refresh:c.refresh,forward:c.forward,back:c.back,go:c.go,install:In,isExternal:tr,onBeforeRouteEnter:m,onAfterRouteUpdate:E,onBeforeRouteLeave:d,onAfterRouteEnter:p,onBeforeRouteUpdate:w,onAfterRouteLeave:v,prefetch:t==null?void 0:t.prefetch,start:nr};return or}function De(e,t){return{value:e,params:qe(e,t)}}function jt(e,t){return{value:e,params:qe(e,t)}}function vn(e){return se(e)&&typeof e.hash=="string"}function Ht(e){return e===void 0?he():vn(e)?e:he(e)}function $t(e){return e===void 0?"":e}function Pn(e){return se(e)&&typeof e.value=="string"}function qt(e){return e===void 0?Pe("",{}):Pn(e)?e:Pe(e,{})}function En(e){return se(e)&&typeof e.value=="string"}function _t(e){return e===void 0?De("",{}):En(e)?e:De(e,{})}function Z(e){const t=Ne(),r=$t(e.name),n=qt(e.path),o=_t(e.query),a=Ht(e.hash),s=e.meta??{},c=dr(e)?e.state:{},f=u.markRaw({id:t,meta:{},state:{},...e}),i={id:t,matched:f,matches:[f],name:r,path:n,query:o,hash:a,meta:s,state:c,depth:1,host:jt("",{}),prefetch:e.prefetch},l=tt(e)?rt(e.parent,i):i;return re(l.path.params,l.query.params),l}const be={template:"<div>This is component</div>"},Ie=Z({name:"parentA",path:"/parentA/[paramA]"}),Mt=Z({parent:Ie,name:"parentA.childA",path:"/[?paramB]"}),bn=Z({parent:Ie,name:"parentA.childB",path:"/[paramD]",component:be}),Sn=Z({parent:Mt,name:"parentA.childA.grandChildA",path:"/[paramC]",component:be});Z({name:"parentB",path:"/parentB",component:be}),Z({name:"parentC",path:"/",component:be});const kn="lazy",An={components:!0,props:!1};function Se(e){return["eager","lazy"].includes(e)}function Tt({routerPrefetch:e,routePrefetch:t,linkPrefetch:r},n){const o=Oe(r,n),a=Oe(t,n),s=Oe(e,n),c=[o,a,s,An[n],kn].reduce((f,i)=>Se(f)?f:f===!0&&Se(i)?i:f===!0&&!Se(i)?f:f===void 0?i:f,void 0);return Se(c)?c:!1}function Oe(e,t){return se(e)?e[t]:e}function Dt(e){return typeof e=="object"&&e!==null&&"then"in e}function It(e){try{const t=e();return Dt(t)?t.catch(r=>r):t}catch(t){return t}}const Ot=Symbol();function xn(){const e=u.reactive(new Map),{push:t,replace:r,reject:n}=yt(),o=(m,E,d)=>E.matches.filter(p=>Tt({...d,routePrefetch:p.prefetch},"props")===m).flatMap(p=>i(p)).reduce((p,{id:w,name:v,props:b})=>{if(!b)return p;const x=f(w,v,E),y=It(()=>b(E,{push:t,replace:r,reject:n}));return p[x]=y,p},{}),a=m=>{Object.entries(m).forEach(([E,d])=>{e.set(E,d)})},s=async m=>{const E=m.matches.flatMap(i),d=[],p=[];for(const{id:w,name:v,props:b}of E){if(!b)continue;const x=f(w,v,m);if(d.push(x),!e.has(x)){const y=It(()=>b(m,{push:t,replace:r,reject:n}));e.set(x,y)}p.push((async()=>{const y=await e.get(x);if(y instanceof Error)throw y})())}l(d);try{return await Promise.all(p),{status:"SUCCESS"}}catch(w){if(w instanceof ae||w instanceof Re)return w.response;throw w}},c=(m,E,d)=>{const p=f(m,E,d);return e.get(p)};function f(m,E,d){return[m,E,d.id,JSON.stringify(d.params)].join("-")}function i(m){return xe(m)?Object.entries(m.props??{}).map(([E,d])=>({id:m.id,name:E,props:d})):Ae(m)?[{id:m.id,name:"default",props:m.props}]:[]}function l(m){for(const E in e.keys())m.includes(E)||e.delete(E)}return{getPrefetchProps:o,setPrefetchProps:a,getProps:c,setProps:s}}function Wt(){const e=u.inject(Ot);if(!e)throw new ee;return e}const Un=u.defineAsyncComponent(()=>new Promise(e=>{e({default:{template:"foo"}})}));function Ft(e){return e.name===Un.name&&"__asyncLoader"in e}function Ln(e){const t=new Map,r=u.ref(),{getPrefetchProps:n,setPrefetchProps:o}=Wt(),{isElementVisible:a}=Zr(r),s=()=>{const f=Array.from(t.values()).reduce((i,l)=>(Object.assign(i,l),i),{});o(f)};u.watch(()=>u.toValue(e),({route:f,...i})=>{t.clear(),f&&c("eager",f,i)},{immediate:!0}),u.watch(a,f=>{const{route:i,...l}=u.toValue(e);!i||!f||c("lazy",i,l)},{immediate:!0});function c(f,i,l){Cn(f,i,l),t.has(f)||t.set(f,n(f,i,l))}return{element:r,commit:s}}function Cn(e,t,r){t.matches.forEach(n=>{Tt({...r,routePrefetch:n.prefetch},"components")===e&&(Ae(n)&&Ft(n.component)&&n.component.__asyncLoader(),xe(n)&&Object.values(n.components).forEach(a=>{Ft(a)&&a.__asyncLoader()}))})}function We(e,t,{exact:r}={}){return Sr(e)?t===void 0?!0:r?e.matched.name===t:e.matches.map(n=>n.name).includes(t):!1}function Jt(e,t={},r={}){const n=le(),o=u.computed(()=>{const p=u.toValue(e);return typeof p!="string"?p:N(p)?n.find(p,u.toValue(r)):n.resolve(p,u.toValue(t),u.toValue(r))}),a=u.computed(()=>{if(o.value)return o.value.href;const p=u.toValue(e);if(N(p))return p;console.error(new Error("Failed to resolve route in RouterLink."))}),s=u.computed(()=>We(n.route)&&n.route.matches.some(p=>{var w;return p.id===((w=o.value)==null?void 0:w.id)})),c=u.computed(()=>{var p;return n.route.id===((p=o.value)==null?void 0:p.id)}),f=u.computed(()=>!!a.value&&n.isExternal(a.value)),i=u.computed(()=>{const p=u.toValue(e);return typeof p!="string"||N(p)?u.toValue(t):u.toValue(r)}),{element:l,commit:m}=Ln(()=>({route:o.value,routerPrefetch:n.prefetch,linkPrefetch:i.value.prefetch})),E=p=>{m();const w={replace:(p==null?void 0:p.replace)??i.value.replace,query:_e(i.value.query,p==null?void 0:p.query),hash:(p==null?void 0:p.hash)??i.value.hash,state:{...i.value.state,...p==null?void 0:p.state}},v=u.toValue(e);return N(v)||typeof v=="object"?n.push(v,w):n.push(v,u.toValue(t),w)};return{element:l,route:o,href:a,isMatch:s,isExactMatch:c,isExternal:f,push:E,replace:p=>E({...p,replace:!0})}}const Bn=["href"],Qt=u.defineComponent({__name:"routerLink",props:{to:{},prefetch:{type:[Boolean,String,Object],default:void 0},query:{},hash:{},replace:{type:Boolean},state:{}},setup(e){const t=e,r=le(),n=u.computed(()=>E(t.to)),o=u.computed(()=>d(t.to)),a=u.computed(()=>{const{to:w,...v}=t;return v}),{element:s,isMatch:c,isExactMatch:f,isExternal:i,push:l}=Jt(()=>typeof t.to=="function"?t.to(r.resolve):t.to,a),m=u.computed(()=>({"router-link--match":c.value,"router-link--exact-match":f.value}));function E(w){if(typeof w=="function"){const v=w(r.resolve);return E(v)}return N(w)?r.find(w):w}function d(w){if(typeof w=="function"){const v=w(r.resolve);return d(v)}return N(w)?w:w==null?void 0:w.href}function p(w){w.preventDefault(),l()}return(w,v)=>(u.openBlock(),u.createElementBlock("a",{ref_key:"element",ref:s,href:o.value,class:u.normalizeClass(["router-link",m.value]),onClick:p},[u.renderSlot(w.$slots,"default",u.normalizeProps(u.guardReactiveProps({route:n.value,isMatch:u.unref(c),isExactMatch:u.unref(f),isExternal:u.unref(i)})))],10,Bn))}});function zt(e,t){const r=le();function n(){if(!e)return;if(!We(r.route,e,t))throw new Xe(e,r.route.name)}return u.watch(r.route,n,{immediate:!0,deep:!0}),r.route}const Gt=Symbol();function Fe(){return u.inject(Gt,0)}function Vn(e,t){return u.defineComponent({name:"PropsWrapper",expose:[],setup(){const r=t(),n=u.getCurrentInstance();return()=>r instanceof Error?"":Dt(r)?n!=null&&n.suspense?u.h(jn(e,r)):u.h(Nn(e,r)):u.h(e,r)}})}function Nn(e,t){return u.defineComponent({name:"AsyncPropsWrapper",expose:[],setup(){const r=u.ref();return(async()=>r.value=await t)(),()=>r.value instanceof Error?"":r.value?u.h(e,r.value):""}})}function jn(e,t){return u.defineComponent({name:"SuspenseAsyncPropsWrapper",expose:[],async setup(){const r=await t;return()=>u.h(e,r)}})}const Kt=u.defineComponent({__name:"routerView",props:{name:{default:"default"}},setup(e){const t=zt(),r=br(),n=Fe(),{getProps:o}=Wt(),a=u.resolveComponent("RouterView",!0);u.provide(Gt,n+1);const s=u.computed(()=>{if(r.value)return r.value.component;const i=t.matches.at(n);if(!i)return null;const l=c(i),m=o(i.id,e.name,t);return l?m?Vn(l,()=>m):l:null});function c(i){return f(i)[e.name]}function f(i){return xe(i)?i.components:Ae(i)?{default:i.component}:typeof a=="string"?{}:{default:a}}return(i,l)=>s.value?u.renderSlot(i.$slots,"default",u.normalizeProps(u.mergeProps({key:0},{route:u.unref(t),component:s.value,rejection:u.unref(r)})),()=>[(u.openBlock(),u.createBlock(u.resolveDynamicComponent(s.value)))]):u.createCommentVNode("",!0)}});function Yt(){const e=u.inject(Rt);if(!e)throw new ee;return e}function Xt(e){return t=>{const r=Fe(),o=Yt().addBeforeRouteHook({lifecycle:e,hook:t,depth:r,timing:"component"});return u.onUnmounted(o),o}}function Je(e){return t=>{const r=Fe(),o=Yt().addAfterRouteHook({lifecycle:e,hook:t,depth:r,timing:"component"});return u.onUnmounted(o),o}}const Hn=Xt("onBeforeRouteUpdate"),$n=Xt("onBeforeRouteLeave"),qn=Je("onAfterRouteEnter"),_n=Je("onAfterRouteUpdate"),Mn=Je("onAfterRouteLeave");function Tn(e){return se(e)&&typeof e.value=="string"}function Zt(e){return Tn(e)?e:jt(e,{})}function Dn(e){const t=Ne(),r=$t(e.name),n=qt(e.path),o=_t(e.query),a=Ht(e.hash),s=e.meta??{},c=pr(e)?Zt(e.host):Zt(""),f=u.markRaw({id:t,meta:{},state:{},...e}),i={id:t,matched:f,matches:[f],name:r,host:c,path:n,query:o,hash:a,meta:s,depth:1,state:{}},l=tt(e)?rt(e.parent,i):i;return re(l.path.params,l.query.params,l.host.params),l}k.DuplicateParamsError=Ke,k.MetaPropertyConflict=Ye,k.RouterLink=Qt,k.RouterNotInstalledError=ee,k.RouterView=Kt,k.UseRouteInvalidError=Xe,k.asUrl=ke,k.createExternalRoute=Dn,k.createParam=ct,k.createRoute=Z,k.createRouter=wn,k.isRoute=We,k.isUrl=N,k.onAfterRouteEnter=qn,k.onAfterRouteLeave=_n,k.onAfterRouteUpdate=Mn,k.onBeforeRouteLeave=Hn,k.onBeforeRouteUpdate=$n,k.path=Pe,k.query=De,k.useLink=Jt,k.useRoute=zt,k.useRouter=le,k.withDefault=Rr,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kitbag/router",
3
3
  "private": false,
4
- "version": "0.14.0",
4
+ "version": "0.14.2",
5
5
  "bugs": {
6
6
  "url": "https://github.com/kitbagjs/router/issues"
7
7
  },
@@ -35,14 +35,14 @@
35
35
  "@kitbag/eslint-config": "1.0.2",
36
36
  "@vitejs/plugin-vue": "^5.2.1",
37
37
  "@vue/test-utils": "^2.4.6",
38
- "eslint": "^9.16.0",
38
+ "eslint": "^9.17.0",
39
39
  "globals": "^15.13.0",
40
40
  "happy-dom": "^15.11.7",
41
- "typedoc": "^0.27.3",
41
+ "typedoc": "^0.27.5",
42
42
  "typedoc-plugin-markdown": "^4.3.2",
43
43
  "typedoc-vitepress-theme": "^1.1.1",
44
44
  "typescript": "^5.6.3",
45
- "vite": "^6.0.1",
45
+ "vite": "^6.0.3",
46
46
  "vite-plugin-dts": "^4.3.0",
47
47
  "vitepress": "^1.5.0",
48
48
  "vitest": "^2.1.6",