23 lines
44 KiB
JavaScript
23 lines
44 KiB
JavaScript
/*!
|
|
* vue-router v4.6.4
|
|
* (c) 2025 Eduardo San Martin Morote
|
|
* @license MIT
|
|
*/
|
|
let e=require(`vue`),t=require(`@vue/devtools-api`);const n=typeof document<`u`;function r(e){return typeof e==`object`||`displayName`in e||`props`in e||`__vccOpts`in e}function i(e){return e.__esModule||e[Symbol.toStringTag]===`Module`||e.default&&r(e.default)}const a=Object.assign;function o(e,t){let n={};for(let r in t){let i=t[r];n[r]=c(i)?i.map(e):e(i)}return n}const s=()=>{},c=Array.isArray;function l(e,t){let n={};for(let r in e)n[r]=r in t?t[r]:e[r];return n}function u(e){let t=Array.from(arguments).slice(1);console.warn.apply(console,[`[Vue Router warn]: `+e].concat(t))}const d=/#/g,f=/&/g,p=/\//g,m=/=/g,h=/\?/g,g=/\+/g,_=/%5B/g,ee=/%5D/g,v=/%5E/g,te=/%60/g,ne=/%7B/g,re=/%7C/g,ie=/%7D/g,y=/%20/g;function b(e){return e==null?``:encodeURI(``+e).replace(re,`|`).replace(_,`[`).replace(ee,`]`)}function ae(e){return b(e).replace(ne,`{`).replace(ie,`}`).replace(v,`^`)}function x(e){return b(e).replace(g,`%2B`).replace(y,`+`).replace(d,`%23`).replace(f,`%26`).replace(te,"`").replace(ne,`{`).replace(ie,`}`).replace(v,`^`)}function oe(e){return x(e).replace(m,`%3D`)}function se(e){return b(e).replace(d,`%23`).replace(h,`%3F`)}function ce(e){return se(e).replace(p,`%2F`)}function S(e){if(e==null)return null;try{return decodeURIComponent(``+e)}catch{process.env.NODE_ENV!==`production`&&u(`Error decoding "${e}". Using original value`)}return``+e}const le=/\/$/,C=e=>e.replace(le,``);function ue(e,t,n=`/`){let r,i={},a=``,o=``,s=t.indexOf(`#`),c=t.indexOf(`?`);return c=s>=0&&c>s?-1:c,c>=0&&(r=t.slice(0,c),a=t.slice(c,s>0?s:t.length),i=e(a.slice(1))),s>=0&&(r||=t.slice(0,s),o=t.slice(s,t.length)),r=D(r??t,n),{fullPath:r+a+o,path:r,query:i,hash:S(o)}}function de(e,t){let n=t.query?e(t.query):``;return t.path+(n&&`?`)+n+(t.hash||``)}function fe(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||`/`}function pe(e,t,n){let r=t.matched.length-1,i=n.matched.length-1;return r>-1&&r===i&&w(t.matched[r],n.matched[i])&&T(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function w(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function T(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!me(e[n],t[n]))return!1;return!0}function me(e,t){return c(e)?E(e,t):c(t)?E(t,e):e?.valueOf()===t?.valueOf()}function E(e,t){return c(t)?e.length===t.length&&e.every((e,n)=>e===t[n]):e.length===1&&e[0]===t}function D(e,t){if(e.startsWith(`/`))return e;if(process.env.NODE_ENV!==`production`&&!t.startsWith(`/`))return u(`Cannot resolve a relative location without an absolute path. Trying to resolve "${e}" from "${t}". It should look like "/${t}".`),e;if(!e)return t;let n=t.split(`/`),r=e.split(`/`),i=r[r.length-1];(i===`..`||i===`.`)&&r.push(``);let a=n.length-1,o,s;for(o=0;o<r.length;o++)if(s=r[o],s!==`.`)if(s===`..`)a>1&&a--;else break;return n.slice(0,a).join(`/`)+`/`+r.slice(o).join(`/`)}const O={path:`/`,name:void 0,params:{},query:{},hash:``,fullPath:`/`,matched:[],meta:{},redirectedFrom:void 0};let he=function(e){return e.pop=`pop`,e.push=`push`,e}({}),k=function(e){return e.back=`back`,e.forward=`forward`,e.unknown=``,e}({});const ge=``;function A(e){if(!e)if(n){let t=document.querySelector(`base`);e=t&&t.getAttribute(`href`)||`/`,e=e.replace(/^\w+:\/\/[^\/]+/,``)}else e=`/`;return e[0]!==`/`&&e[0]!==`#`&&(e=`/`+e),C(e)}const j=/^[^#]+#/;function M(e,t){return e.replace(j,`#`)+t}function _e(e,t){let n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect();return{behavior:t.behavior,left:r.left-n.left-(t.left||0),top:r.top-n.top-(t.top||0)}}const N=()=>({left:window.scrollX,top:window.scrollY});function ve(e){let t;if(`el`in e){let n=e.el,r=typeof n==`string`&&n.startsWith(`#`);if(process.env.NODE_ENV!==`production`&&typeof e.el==`string`&&(!r||!document.getElementById(e.el.slice(1))))try{let t=document.querySelector(e.el);if(r&&t){u(`The selector "${e.el}" should be passed as "el: document.querySelector('${e.el}')" because it starts with "#".`);return}}catch{u(`The selector "${e.el}" is invalid. If you are using an id selector, make sure to escape it. You can find more information about escaping characters in selectors at https://mathiasbynens.be/notes/css-escapes or use CSS.escape (https://developer.mozilla.org/en-US/docs/Web/API/CSS/escape).`);return}let i=typeof n==`string`?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!i){process.env.NODE_ENV!==`production`&&u(`Couldn't find element using selector "${e.el}" returned by scrollBehavior.`);return}t=_e(i,e)}else t=e;`scrollBehavior`in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left==null?window.scrollX:t.left,t.top==null?window.scrollY:t.top)}function ye(e,t){return(history.state?history.state.position-t:-1)+e}const P=new Map;function be(e,t){P.set(e,t)}function xe(e){let t=P.get(e);return P.delete(e),t}let Se=()=>location.protocol+`//`+location.host;function F(e,t){let{pathname:n,search:r,hash:i}=t,a=e.indexOf(`#`);if(a>-1){let t=i.includes(e.slice(a))?e.slice(a).length:1,n=i.slice(t);return n[0]!==`/`&&(n=`/`+n),fe(n,``)}return fe(n,e)+r+i}function I(e,t,n,r){let i=[],o=[],s=null,c=({state:a})=>{let o=F(e,location),c=n.value,l=t.value,u=0;if(a){if(n.value=o,t.value=a,s&&s===c){s=null;return}u=l?a.position-l.position:0}else r(o);i.forEach(e=>{e(n.value,c,{delta:u,type:he.pop,direction:u?u>0?k.forward:k.back:k.unknown})})};function l(){s=n.value}function u(e){i.push(e);let t=()=>{let t=i.indexOf(e);t>-1&&i.splice(t,1)};return o.push(t),t}function d(){if(document.visibilityState===`hidden`){let{history:e}=window;if(!e.state)return;e.replaceState(a({},e.state,{scroll:N()}),``)}}function f(){for(let e of o)e();o=[],window.removeEventListener(`popstate`,c),window.removeEventListener(`pagehide`,d),document.removeEventListener(`visibilitychange`,d)}return window.addEventListener(`popstate`,c),window.addEventListener(`pagehide`,d),document.addEventListener(`visibilitychange`,d),{pauseListeners:l,listen:u,destroy:f}}function L(e,t,n,r=!1,i=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:i?N():null}}function R(e){let{history:t,location:n}=window,r={value:F(e,n)},i={value:t.state};i.value||o(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function o(r,a,o){let s=e.indexOf(`#`),c=s>-1?(n.host&&document.querySelector(`base`)?e:e.slice(s))+r:Se()+e+r;try{t[o?`replaceState`:`pushState`](a,``,c),i.value=a}catch(e){process.env.NODE_ENV===`production`?console.error(e):u(`Error with push/replace State`,e),n[o?`replace`:`assign`](c)}}function s(e,n){o(e,a({},t.state,L(i.value.back,e,i.value.forward,!0),n,{position:i.value.position}),!0),r.value=e}function c(e,n){let s=a({},i.value,t.state,{forward:e,scroll:N()});process.env.NODE_ENV!==`production`&&!t.state&&u(`history.state seems to have been manually replaced without preserving the necessary values. Make sure to preserve existing history state if you are manually calling history.replaceState:
|
|
|
|
history.replaceState(history.state, '', url)
|
|
|
|
You can find more information at https://router.vuejs.org/guide/migration/#Usage-of-history-state`),o(s.current,s,!0),o(e,a({},L(r.value,e,null),{position:s.position+1},n),!1),r.value=e}return{location:r,state:i,push:c,replace:s}}function z(e){e=A(e);let t=R(e),n=I(e,t.state,t.location,t.replace);function r(e,t=!0){t||n.pauseListeners(),history.go(e)}let i=a({location:``,base:e,go:r,createHref:M.bind(null,e)},t,n);return Object.defineProperty(i,`location`,{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(i,`state`,{enumerable:!0,get:()=>t.state.value}),i}function Ce(e=``){let t=[],n=[[``,{}]],r=0;e=A(e);function i(e,t={}){r++,r!==n.length&&n.splice(r),n.push([e,t])}function a(e,n,{direction:r,delta:i}){let a={direction:r,delta:i,type:he.pop};for(let r of t)r(e,n,a)}let o={location:``,state:{},base:e,createHref:M.bind(null,e),replace(e,t){n.splice(r--,1),i(e,t)},push(e,t){i(e,t)},listen(e){return t.push(e),()=>{let n=t.indexOf(e);n>-1&&t.splice(n,1)}},destroy(){t=[],n=[[``,{}]],r=0},go(e,t=!0){let i=this.location,o=e<0?k.back:k.forward;r=Math.max(0,Math.min(r+e,n.length-1)),t&&a(this.location,i,{direction:o,delta:e})}};return Object.defineProperty(o,`location`,{enumerable:!0,get:()=>n[r][0]}),Object.defineProperty(o,`state`,{enumerable:!0,get:()=>n[r][1]}),o}function we(e){return e=location.host?e||location.pathname+location.search:``,e.includes(`#`)||(e+=`#`),process.env.NODE_ENV!==`production`&&!e.endsWith(`#/`)&&!e.endsWith(`#`)&&u(`A hash base must end with a "#":\n"${e}" should be "${e.replace(/#.*$/,`#`)}".`),z(e)}function B(e){return typeof e==`string`||e&&typeof e==`object`}function Te(e){return typeof e==`string`||typeof e==`symbol`}let V=function(e){return e[e.MATCHER_NOT_FOUND=1]=`MATCHER_NOT_FOUND`,e[e.NAVIGATION_GUARD_REDIRECT=2]=`NAVIGATION_GUARD_REDIRECT`,e[e.NAVIGATION_ABORTED=4]=`NAVIGATION_ABORTED`,e[e.NAVIGATION_CANCELLED=8]=`NAVIGATION_CANCELLED`,e[e.NAVIGATION_DUPLICATED=16]=`NAVIGATION_DUPLICATED`,e}({});const Ee=Symbol(process.env.NODE_ENV===`production`?``:`navigation failure`);let De=function(e){return e[e.aborted=4]=`aborted`,e[e.cancelled=8]=`cancelled`,e[e.duplicated=16]=`duplicated`,e}({});const Oe={[V.MATCHER_NOT_FOUND]({location:e,currentLocation:t}){return`No match for\n ${JSON.stringify(e)}${t?`
|
|
while being at
|
|
`+JSON.stringify(t):``}`},[V.NAVIGATION_GUARD_REDIRECT]({from:e,to:t}){return`Redirected from "${e.fullPath}" to "${Ae(t)}" via a navigation guard.`},[V.NAVIGATION_ABORTED]({from:e,to:t}){return`Navigation aborted from "${e.fullPath}" to "${t.fullPath}" via a navigation guard.`},[V.NAVIGATION_CANCELLED]({from:e,to:t}){return`Navigation cancelled from "${e.fullPath}" to "${t.fullPath}" with a new navigation.`},[V.NAVIGATION_DUPLICATED]({from:e,to:t}){return`Avoided redundant navigation to current location: "${e.fullPath}".`}};function H(e,t){if(process.env.NODE_ENV!==`production`||!0)return a(Error(Oe[e](t)),{type:e,[Ee]:!0},t)}function U(e,t){return e instanceof Error&&Ee in e&&(t==null||!!(e.type&t))}const ke=[`params`,`query`,`hash`];function Ae(e){if(typeof e==`string`)return e;if(e.path!=null)return e.path;let t={};for(let n of ke)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}let W=function(e){return e[e.Static=0]=`Static`,e[e.Param=1]=`Param`,e[e.Group=2]=`Group`,e}({});var G=function(e){return e[e.Static=0]=`Static`,e[e.Param=1]=`Param`,e[e.ParamRegExp=2]=`ParamRegExp`,e[e.ParamRegExpEnd=3]=`ParamRegExpEnd`,e[e.EscapeNext=4]=`EscapeNext`,e}(G||{});const je={type:W.Static,value:``},Me=/[a-zA-Z0-9_]/;function Ne(e){if(!e)return[[]];if(e===`/`)return[[je]];if(!e.startsWith(`/`))throw Error(process.env.NODE_ENV===`production`?`Invalid path "${e}"`:`Route paths should start with a "/": "${e}" should be "/${e}".`);function t(e){throw Error(`ERR (${n})/"${l}": ${e}`)}let n=G.Static,r=n,i=[],a;function o(){a&&i.push(a),a=[]}let s=0,c,l=``,u=``;function d(){l&&=(n===G.Static?a.push({type:W.Static,value:l}):n===G.Param||n===G.ParamRegExp||n===G.ParamRegExpEnd?(a.length>1&&(c===`*`||c===`+`)&&t(`A repeatable param (${l}) must be alone in its segment. eg: '/:ids+.`),a.push({type:W.Param,value:l,regexp:u,repeatable:c===`*`||c===`+`,optional:c===`*`||c===`?`})):t(`Invalid state to consume buffer`),``)}function f(){l+=c}for(;s<e.length;){if(c=e[s++],c===`\\`&&n!==G.ParamRegExp){r=n,n=G.EscapeNext;continue}switch(n){case G.Static:c===`/`?(l&&d(),o()):c===`:`?(d(),n=G.Param):f();break;case G.EscapeNext:f(),n=r;break;case G.Param:c===`(`?n=G.ParamRegExp:Me.test(c)?f():(d(),n=G.Static,c!==`*`&&c!==`?`&&c!==`+`&&s--);break;case G.ParamRegExp:c===`)`?u[u.length-1]==`\\`?u=u.slice(0,-1)+c:n=G.ParamRegExpEnd:u+=c;break;case G.ParamRegExpEnd:d(),n=G.Static,c!==`*`&&c!==`?`&&c!==`+`&&s--,u=``;break;default:t(`Unknown state`);break}}return n===G.ParamRegExp&&t(`Unfinished custom RegExp for param "${l}"`),d(),o(),i}const Pe=`[^/]+?`,Fe={sensitive:!1,strict:!1,start:!0,end:!0};var K=function(e){return e[e._multiplier=10]=`_multiplier`,e[e.Root=90]=`Root`,e[e.Segment=40]=`Segment`,e[e.SubSegment=30]=`SubSegment`,e[e.Static=40]=`Static`,e[e.Dynamic=20]=`Dynamic`,e[e.BonusCustomRegExp=10]=`BonusCustomRegExp`,e[e.BonusWildcard=-50]=`BonusWildcard`,e[e.BonusRepeatable=-20]=`BonusRepeatable`,e[e.BonusOptional=-8]=`BonusOptional`,e[e.BonusStrict=.7000000000000001]=`BonusStrict`,e[e.BonusCaseSensitive=.25]=`BonusCaseSensitive`,e}(K||{});const Ie=/[.+*?^${}()[\]/\\]/g;function Le(e,t){let n=a({},Fe,t),r=[],i=n.start?`^`:``,o=[];for(let t of e){let e=t.length?[]:[K.Root];n.strict&&!t.length&&(i+=`/`);for(let r=0;r<t.length;r++){let a=t[r],s=K.Segment+(n.sensitive?K.BonusCaseSensitive:0);if(a.type===W.Static)r||(i+=`/`),i+=a.value.replace(Ie,`\\$&`),s+=K.Static;else if(a.type===W.Param){let{value:e,repeatable:n,optional:c,regexp:l}=a;o.push({name:e,repeatable:n,optional:c});let u=l||Pe;if(u!==Pe){s+=K.BonusCustomRegExp;try{`${u}`}catch(t){throw Error(`Invalid custom RegExp for param "${e}" (${u}): `+t.message)}}let d=n?`((?:${u})(?:/(?:${u}))*)`:`(${u})`;r||(d=c&&t.length<2?`(?:/${d})`:`/`+d),c&&(d+=`?`),i+=d,s+=K.Dynamic,c&&(s+=K.BonusOptional),n&&(s+=K.BonusRepeatable),u===`.*`&&(s+=K.BonusWildcard)}e.push(s)}r.push(e)}if(n.strict&&n.end){let e=r.length-1;r[e][r[e].length-1]+=K.BonusStrict}n.strict||(i+=`/?`),n.end?i+=`$`:n.strict&&!i.endsWith(`/`)&&(i+=`(?:/|$)`);let s=new RegExp(i,n.sensitive?``:`i`);function l(e){let t=e.match(s),n={};if(!t)return null;for(let e=1;e<t.length;e++){let r=t[e]||``,i=o[e-1];n[i.name]=r&&i.repeatable?r.split(`/`):r}return n}function u(t){let n=``,r=!1;for(let i of e){(!r||!n.endsWith(`/`))&&(n+=`/`),r=!1;for(let e of i)if(e.type===W.Static)n+=e.value;else if(e.type===W.Param){let{value:a,repeatable:o,optional:s}=e,l=a in t?t[a]:``;if(c(l)&&!o)throw Error(`Provided param "${a}" is an array but it is not repeatable (* or + modifiers)`);let u=c(l)?l.join(`/`):l;if(!u)if(s)i.length<2&&(n.endsWith(`/`)?n=n.slice(0,-1):r=!0);else throw Error(`Missing required param "${a}"`);n+=u}}return n||`/`}return{re:s,score:r,keys:o,parse:l,stringify:u}}function Re(e,t){let n=0;for(;n<e.length&&n<t.length;){let r=t[n]-e[n];if(r)return r;n++}return e.length<t.length?e.length===1&&e[0]===K.Static+K.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===K.Static+K.Segment?1:-1:0}function ze(e,t){let n=0,r=e.score,i=t.score;for(;n<r.length&&n<i.length;){let e=Re(r[n],i[n]);if(e)return e;n++}if(Math.abs(i.length-r.length)===1){if(Be(r))return 1;if(Be(i))return-1}return i.length-r.length}function Be(e){let t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const Ve={strict:!1,end:!0,sensitive:!1};function He(e,t,n){let r=Le(Ne(e.path),n);if(process.env.NODE_ENV!==`production`){let t=new Set;for(let n of r.keys)t.has(n.name)&&u(`Found duplicated params with name "${n.name}" for path "${e.path}". Only the last one will be available on "$route.params".`),t.add(n.name)}let i=a(r,{record:e,parent:t,children:[],alias:[]});return t&&!i.record.aliasOf==!t.record.aliasOf&&t.children.push(i),i}function Ue(e,t){let n=[],r=new Map;t=l(Ve,t);function i(e){return r.get(e)}function o(e,n,r){let i=!r,u=Ge(e);process.env.NODE_ENV!==`production`&&Ze(u,n),u.aliasOf=r&&r.record;let d=l(t,e),p=[u];if(`alias`in e){let t=typeof e.alias==`string`?[e.alias]:e.alias;for(let e of t)p.push(Ge(a({},u,{components:r?r.record.components:u.components,path:e,aliasOf:r?r.record:u})))}let m,h;for(let t of p){let{path:a}=t;if(n&&a[0]!==`/`){let e=n.record.path,r=e[e.length-1]===`/`?``:`/`;t.path=n.record.path+(a&&r+a)}if(process.env.NODE_ENV!==`production`&&t.path===`*`)throw Error(`Catch all routes ("*") must now be defined using a param with a custom regexp.
|
|
See more at https://router.vuejs.org/guide/migration/#Removed-star-or-catch-all-routes.`);if(m=He(t,n,d),process.env.NODE_ENV!==`production`&&n&&a[0]===`/`&&$e(m,n),r?(r.alias.push(m),process.env.NODE_ENV!==`production`&&Xe(r,m)):(h||=m,h!==m&&h.alias.push(m),i&&e.name&&!qe(m)&&(process.env.NODE_ENV!==`production`&&Qe(e,n),c(e.name))),nt(m)&&f(m),u.children){let e=u.children;for(let t=0;t<e.length;t++)o(e[t],m,r&&r.children[t])}r||=m}return h?()=>{c(h)}:s}function c(e){if(Te(e)){let t=r.get(e);t&&(r.delete(e),n.splice(n.indexOf(t),1),t.children.forEach(c),t.alias.forEach(c))}else{let t=n.indexOf(e);t>-1&&(n.splice(t,1),e.record.name&&r.delete(e.record.name),e.children.forEach(c),e.alias.forEach(c))}}function d(){return n}function f(e){let t=et(e,n);n.splice(t,0,e),e.record.name&&!qe(e)&&r.set(e.record.name,e)}function p(e,t){let i,o={},s,c;if(`name`in e&&e.name){if(i=r.get(e.name),!i)throw H(V.MATCHER_NOT_FOUND,{location:e});if(process.env.NODE_ENV!==`production`){let t=Object.keys(e.params||{}).filter(e=>!i.keys.find(t=>t.name===e));t.length&&u(`Discarded invalid param(s) "${t.join(`", "`)}" when navigating. See https://github.com/vuejs/router/blob/main/packages/router/CHANGELOG.md#414-2022-08-22 for more details.`)}c=i.record.name,o=a(We(t.params,i.keys.filter(e=>!e.optional).concat(i.parent?i.parent.keys.filter(e=>e.optional):[]).map(e=>e.name)),e.params&&We(e.params,i.keys.map(e=>e.name))),s=i.stringify(o)}else if(e.path!=null)s=e.path,process.env.NODE_ENV!==`production`&&!s.startsWith(`/`)&&u(`The Matcher cannot resolve relative paths but received "${s}". Unless you directly called \`matcher.resolve("${s}")\`, this is probably a bug in vue-router. Please open an issue at https://github.com/vuejs/router/issues/new/choose.`),i=n.find(e=>e.re.test(s)),i&&(o=i.parse(s),c=i.record.name);else{if(i=t.name?r.get(t.name):n.find(e=>e.re.test(t.path)),!i)throw H(V.MATCHER_NOT_FOUND,{location:e,currentLocation:t});c=i.record.name,o=a({},t.params,e.params),s=i.stringify(o)}let l=[],d=i;for(;d;)l.unshift(d.record),d=d.parent;return{name:c,path:s,params:o,matched:l,meta:Je(l)}}e.forEach(e=>o(e));function m(){n.length=0,r.clear()}return{addRoute:o,resolve:p,removeRoute:c,clearRoutes:m,getRoutes:d,getRecordMatcher:i}}function We(e,t){let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}function Ge(e){let t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:Ke(e),children:e.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:`components`in e?e.components||null:e.component&&{default:e.component}};return Object.defineProperty(t,`mods`,{value:{}}),t}function Ke(e){let t={},n=e.props||!1;if(`component`in e)t.default=n;else for(let r in e.components)t[r]=typeof n==`object`?n[r]:n;return t}function qe(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function Je(e){return e.reduce((e,t)=>a(e,t.meta),{})}function Ye(e,t){return e.name===t.name&&e.optional===t.optional&&e.repeatable===t.repeatable}function Xe(e,t){for(let n of e.keys)if(!n.optional&&!t.keys.find(Ye.bind(null,n)))return u(`Alias "${t.record.path}" and the original record: "${e.record.path}" must have the exact same param named "${n.name}"`);for(let n of t.keys)if(!n.optional&&!e.keys.find(Ye.bind(null,n)))return u(`Alias "${t.record.path}" and the original record: "${e.record.path}" must have the exact same param named "${n.name}"`)}function Ze(e,t){t&&t.record.name&&!e.name&&!e.path&&u(`The route named "${String(t.record.name)}" has a child without a name and an empty path. Using that name won't render the empty path child so you probably want to move the name to the child instead. If this is intentional, add a name to the child route to remove the warning.`)}function Qe(e,t){for(let n=t;n;n=n.parent)if(n.record.name===e.name)throw Error(`A route named "${String(e.name)}" has been added as a ${t===n?`child`:`descendant`} of a route with the same name. Route names must be unique and a nested route cannot use the same name as an ancestor.`)}function $e(e,t){for(let n of t.keys)if(!e.keys.find(Ye.bind(null,n)))return u(`Absolute path "${e.record.path}" must have the exact same param named "${n.name}" as its parent "${t.record.path}".`)}function et(e,t){let n=0,r=t.length;for(;n!==r;){let i=n+r>>1;ze(e,t[i])<0?r=i:n=i+1}let i=tt(e);return i&&(r=t.lastIndexOf(i,r-1),process.env.NODE_ENV!==`production`&&r<0&&u(`Finding ancestor route "${i.record.path}" failed for "${e.record.path}"`)),r}function tt(e){let t=e;for(;t=t.parent;)if(nt(t)&&ze(e,t)===0)return t}function nt({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function rt(e){let t={};if(e===``||e===`?`)return t;let n=(e[0]===`?`?e.slice(1):e).split(`&`);for(let e=0;e<n.length;++e){let r=n[e].replace(g,` `),i=r.indexOf(`=`),a=S(i<0?r:r.slice(0,i)),o=i<0?null:S(r.slice(i+1));if(a in t){let e=t[a];c(e)||(e=t[a]=[e]),e.push(o)}else t[a]=o}return t}function it(e){let t=``;for(let n in e){let r=e[n];if(n=oe(n),r==null){r!==void 0&&(t+=(t.length?`&`:``)+n);continue}(c(r)?r.map(e=>e&&x(e)):[r&&x(r)]).forEach(e=>{e!==void 0&&(t+=(t.length?`&`:``)+n,e!=null&&(t+=`=`+e))})}return t}function at(e){let t={};for(let n in e){let r=e[n];r!==void 0&&(t[n]=c(r)?r.map(e=>e==null?null:``+e):r==null?r:``+r)}return t}const q=Symbol(process.env.NODE_ENV===`production`?``:`router view location matched`),ot=Symbol(process.env.NODE_ENV===`production`?``:`router view depth`),J=Symbol(process.env.NODE_ENV===`production`?``:`router`),Y=Symbol(process.env.NODE_ENV===`production`?``:`route location`),X=Symbol(process.env.NODE_ENV===`production`?``:`router view location`);function Z(){let e=[];function t(t){return e.push(t),()=>{let n=e.indexOf(t);n>-1&&e.splice(n,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function st(t,n,r){let i=()=>{t[n].delete(r)};(0,e.onUnmounted)(i),(0,e.onDeactivated)(i),(0,e.onActivated)(()=>{t[n].add(r)}),t[n].add(r)}function ct(t){if(process.env.NODE_ENV!==`production`&&!(0,e.getCurrentInstance)()){u(`getCurrentInstance() returned null. onBeforeRouteLeave() must be called at the top of a setup function`);return}let n=(0,e.inject)(q,{}).value;if(!n){process.env.NODE_ENV!==`production`&&u("No active route record was found when calling `onBeforeRouteLeave()`. Make sure you call this function inside a component child of <router-view>. Maybe you called it inside of App.vue?");return}st(n,`leaveGuards`,t)}function lt(t){if(process.env.NODE_ENV!==`production`&&!(0,e.getCurrentInstance)()){u(`getCurrentInstance() returned null. onBeforeRouteUpdate() must be called at the top of a setup function`);return}let n=(0,e.inject)(q,{}).value;if(!n){process.env.NODE_ENV!==`production`&&u("No active route record was found when calling `onBeforeRouteUpdate()`. Make sure you call this function inside a component child of <router-view>. Maybe you called it inside of App.vue?");return}st(n,`updateGuards`,t)}function Q(e,t,n,r,i,a=e=>e()){let o=r&&(r.enterCallbacks[i]=r.enterCallbacks[i]||[]);return()=>new Promise((s,c)=>{let l=e=>{e===!1?c(H(V.NAVIGATION_ABORTED,{from:n,to:t})):e instanceof Error?c(e):B(e)?c(H(V.NAVIGATION_GUARD_REDIRECT,{from:t,to:e})):(o&&r.enterCallbacks[i]===o&&typeof e==`function`&&o.push(e),s())},d=a(()=>e.call(r&&r.instances[i],t,n,process.env.NODE_ENV===`production`?l:ut(l,t,n))),f=Promise.resolve(d);if(e.length<3&&(f=f.then(l)),process.env.NODE_ENV!==`production`&&e.length>2){let t=`The "next" callback was never called inside of ${e.name?`"`+e.name+`"`:``}:\n${e.toString()}\n. If you are returning a value instead of calling "next", make sure to remove the "next" parameter from your function.`;if(typeof d==`object`&&`then`in d)f=f.then(e=>l._called?e:(u(t),Promise.reject(Error(`Invalid navigation guard`))));else if(d!==void 0&&!l._called){u(t),c(Error(`Invalid navigation guard`));return}}f.catch(e=>c(e))})}function ut(e,t,n){let r=0;return function(){r++===1&&u(`The "next" callback was called more than once in one navigation guard when going from "${n.fullPath}" to "${t.fullPath}". It should be called exactly one time in each navigation guard. This will fail in production.`),e._called=!0,r===1&&e.apply(null,arguments)}}function dt(e,t,n,a,o=e=>e()){let s=[];for(let c of e)for(let e in process.env.NODE_ENV!==`production`&&!c.components&&c.children&&!c.children.length&&u(`Record with path "${c.path}" is either missing a "component(s)" or "children" property.`),c.components){let l=c.components[e];if(process.env.NODE_ENV!==`production`){if(!l||typeof l!=`object`&&typeof l!=`function`)throw u(`Component "${e}" in record with path "${c.path}" is not a valid component. Received "${String(l)}".`),Error(`Invalid route component`);if(`then`in l){u(`Component "${e}" in record with path "${c.path}" is a Promise instead of a function that returns a Promise. Did you write "import('./MyPage.vue')" instead of "() => import('./MyPage.vue')" ? This will break in production if not fixed.`);let t=l;l=()=>t}else l.__asyncLoader&&!l.__warnedDefineAsync&&(l.__warnedDefineAsync=!0,u(`Component "${e}" in record with path "${c.path}" is defined using "defineAsyncComponent()". Write "() => import('./MyPage.vue')" instead of "defineAsyncComponent(() => import('./MyPage.vue'))".`))}if(!(t!==`beforeRouteEnter`&&!c.instances[e]))if(r(l)){let r=(l.__vccOpts||l)[t];r&&s.push(Q(r,n,a,c,e,o))}else{let r=l();process.env.NODE_ENV!==`production`&&!(`catch`in r)&&(u(`Component "${e}" in record with path "${c.path}" is a function that does not return a Promise. If you were passing a functional component, make sure to add a "displayName" to the component. This will break in production if not fixed.`),r=Promise.resolve(r)),s.push(()=>r.then(r=>{if(!r)throw Error(`Couldn't resolve component "${e}" at "${c.path}"`);let s=i(r)?r.default:r;c.mods[e]=r,c.components[e]=s;let l=(s.__vccOpts||s)[t];return l&&Q(l,n,a,c,e,o)()}))}}return s}function ft(e){return e.matched.every(e=>e.redirect)?Promise.reject(Error(`Cannot load a route that redirects.`)):Promise.all(e.matched.map(e=>e.components&&Promise.all(Object.keys(e.components).reduce((t,n)=>{let r=e.components[n];return typeof r==`function`&&!(`displayName`in r)&&t.push(r().then(t=>{if(!t)return Promise.reject(Error(`Couldn't resolve component "${n}" at "${e.path}". Ensure you passed a function that returns a promise.`));let r=i(t)?t.default:t;e.mods[n]=t,e.components[n]=r})),t},[])))).then(()=>e)}function pt(e,t){let n=[],r=[],i=[],a=Math.max(t.matched.length,e.matched.length);for(let o=0;o<a;o++){let a=t.matched[o];a&&(e.matched.find(e=>w(e,a))?r.push(a):n.push(a));let s=e.matched[o];s&&(t.matched.find(e=>w(e,s))||i.push(s))}return[n,r,i]}function mt(t){let r=(0,e.inject)(J),i=(0,e.inject)(Y),a=!1,o=null,c=(0,e.computed)(()=>{let n=(0,e.unref)(t.to);return process.env.NODE_ENV!==`production`&&(!a||n!==o)&&(B(n)||(a?u(`Invalid value for prop "to" in useLink()
|
|
- to:`,n,`
|
|
- previous to:`,o,`
|
|
- props:`,t):u(`Invalid value for prop "to" in useLink()
|
|
- to:`,n,`
|
|
- props:`,t)),o=n,a=!0),r.resolve(n)}),l=(0,e.computed)(()=>{let{matched:e}=c.value,{length:t}=e,n=e[t-1],r=i.matched;if(!n||!r.length)return-1;let a=r.findIndex(w.bind(null,n));if(a>-1)return a;let o=bt(e[t-2]);return t>1&&bt(n)===o&&r[r.length-1].path!==o?r.findIndex(w.bind(null,e[t-2])):a}),d=(0,e.computed)(()=>l.value>-1&&yt(i.params,c.value.params)),f=(0,e.computed)(()=>l.value>-1&&l.value===i.matched.length-1&&T(i.params,c.value.params));function p(n={}){if(vt(n)){let n=r[(0,e.unref)(t.replace)?`replace`:`push`]((0,e.unref)(t.to)).catch(s);return t.viewTransition&&typeof document<`u`&&`startViewTransition`in document&&document.startViewTransition(()=>n),n}return Promise.resolve()}if(process.env.NODE_ENV!==`production`&&n){let n=(0,e.getCurrentInstance)();if(n){let r={route:c.value,isActive:d.value,isExactActive:f.value,error:null};n.__vrl_devtools=n.__vrl_devtools||[],n.__vrl_devtools.push(r),(0,e.watchEffect)(()=>{r.route=c.value,r.isActive=d.value,r.isExactActive=f.value,r.error=B((0,e.unref)(t.to))?null:`Invalid "to" value`},{flush:`post`})}}return{route:c,href:(0,e.computed)(()=>c.value.href),isActive:d,isExactActive:f,navigate:p}}function ht(e){return e.length===1?e[0]:e}const gt=(0,e.defineComponent)({name:`RouterLink`,compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:`page`},viewTransition:Boolean},useLink:mt,setup(t,{slots:n}){let r=(0,e.reactive)(mt(t)),{options:i}=(0,e.inject)(J),a=(0,e.computed)(()=>({[xt(t.activeClass,i.linkActiveClass,`router-link-active`)]:r.isActive,[xt(t.exactActiveClass,i.linkExactActiveClass,`router-link-exact-active`)]:r.isExactActive}));return()=>{let i=n.default&&ht(n.default(r));return t.custom?i:(0,e.h)(`a`,{"aria-current":r.isExactActive?t.ariaCurrentValue:null,href:r.href,onClick:r.navigate,class:a.value},i)}}}),_t=gt;function vt(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){let t=e.currentTarget.getAttribute(`target`);if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function yt(e,t){for(let n in t){let r=t[n],i=e[n];if(typeof r==`string`){if(r!==i)return!1}else if(!c(i)||i.length!==r.length||r.some((e,t)=>e.valueOf()!==i[t].valueOf()))return!1}return!0}function bt(e){return e?e.aliasOf?e.aliasOf.path:e.path:``}const xt=(e,t,n)=>e??t??n,St=(0,e.defineComponent)({name:`RouterView`,inheritAttrs:!1,props:{name:{type:String,default:`default`},route:Object},compatConfig:{MODE:3},setup(t,{attrs:r,slots:i}){process.env.NODE_ENV!==`production`&&Tt();let o=(0,e.inject)(X),s=(0,e.computed)(()=>t.route||o.value),l=(0,e.inject)(ot,0),u=(0,e.computed)(()=>{let t=(0,e.unref)(l),{matched:n}=s.value,r;for(;(r=n[t])&&!r.components;)t++;return t}),d=(0,e.computed)(()=>s.value.matched[u.value]);(0,e.provide)(ot,(0,e.computed)(()=>u.value+1)),(0,e.provide)(q,d),(0,e.provide)(X,s);let f=(0,e.ref)();return(0,e.watch)(()=>[f.value,d.value,t.name],([e,t,n],[r,i,a])=>{t&&(t.instances[n]=e,i&&i!==t&&e&&e===r&&(t.leaveGuards.size||(t.leaveGuards=i.leaveGuards),t.updateGuards.size||(t.updateGuards=i.updateGuards))),e&&t&&(!i||!w(t,i)||!r)&&(t.enterCallbacks[n]||[]).forEach(t=>t(e))},{flush:`post`}),()=>{let o=s.value,l=t.name,p=d.value,m=p&&p.components[l];if(!m)return Ct(i.default,{Component:m,route:o});let h=p.props[l],g=h?h===!0?o.params:typeof h==`function`?h(o):h:null,_=(0,e.h)(m,a({},g,r,{onVnodeUnmounted:e=>{e.component.isUnmounted&&(p.instances[l]=null)},ref:f}));if(process.env.NODE_ENV!==`production`&&n&&_.ref){let e={depth:u.value,name:p.name,path:p.path,meta:p.meta};(c(_.ref)?_.ref.map(e=>e.i):[_.ref.i]).forEach(t=>{t.__vrv_devtools=e})}return Ct(i.default,{Component:_,route:o})||_}}});function Ct(e,t){if(!e)return null;let n=e(t);return n.length===1?n[0]:n}const wt=St;function Tt(){let t=(0,e.getCurrentInstance)(),n=t.parent&&t.parent.type.name,r=t.parent&&t.parent.subTree&&t.parent.subTree.type;if(n&&(n===`KeepAlive`||n.includes(`Transition`))&&typeof r==`object`&&r.name===`RouterView`){let e=n===`KeepAlive`?`keep-alive`:`transition`;u(`<router-view> can no longer be used directly inside <transition> or <keep-alive>.
|
|
Use slot props instead:
|
|
|
|
<router-view v-slot="{ Component }">
|
|
<${e}>\n <component :is="Component" />\n </${e}>\n</router-view>`)}}function $(e,t){let n=a({},e,{matched:e.matched.map(e=>Gt(e,[`instances`,`children`,`aliasOf`]))});return{_custom:{type:null,readOnly:!0,display:e.fullPath,tooltip:t,value:n}}}function Et(e){return{_custom:{display:e}}}let Dt=0;function Ot(n,r,i){if(r.__hasDevtools)return;r.__hasDevtools=!0;let a=Dt++;(0,t.setupDevtoolsPlugin)({id:`org.vuejs.router`+(a?`.`+a:``),label:`Vue Router`,packageName:`vue-router`,homepage:`https://router.vuejs.org`,logo:`https://router.vuejs.org/logo.png`,componentStateTypes:[`Routing`],app:n},t=>{typeof t.now!=`function`&&u(`[Vue Router]: You seem to be using an outdated version of Vue Devtools. Are you still using the Beta release instead of the stable one? You can find the links at https://devtools.vuejs.org/guide/installation.html.`),t.on.inspectComponent((e,t)=>{e.instanceData&&e.instanceData.state.push({type:`Routing`,key:`$route`,editable:!1,value:$(r.currentRoute.value,`Current Route`)})}),t.on.visitComponentTree(({treeNode:e,componentInstance:n})=>{if(n.__vrv_devtools){let t=n.__vrv_devtools;e.tags.push({label:(t.name?`${t.name.toString()}: `:``)+t.path,textColor:0,tooltip:`This component is rendered by <router-view>`,backgroundColor:jt})}c(n.__vrl_devtools)&&(n.__devtoolsApi=t,n.__vrl_devtools.forEach(t=>{let n=t.route.path,r=Ft,i=``,a=0;t.error?(n=t.error,r=Lt,a=Rt):t.isExactActive?(r=Nt,i=`This is exactly active`):t.isActive&&(r=Mt,i=`This link is active`),e.tags.push({label:n,textColor:a,tooltip:i,backgroundColor:r})}))}),(0,e.watch)(r.currentRoute,()=>{d(),t.notifyComponentUpdate(),t.sendInspectorTree(l),t.sendInspectorState(l)});let o=`router:navigations:`+a;t.addTimelineLayer({id:o,label:`Router${a?` `+a:``} Navigations`,color:4237508}),r.onError((e,n)=>{t.addTimelineEvent({layerId:o,event:{title:`Error during Navigation`,subtitle:n.fullPath,logType:`error`,time:t.now(),data:{error:e},groupId:n.meta.__navigationId}})});let s=0;r.beforeEach((e,n)=>{let r={guard:Et(`beforeEach`),from:$(n,`Current Location during this navigation`),to:$(e,`Target location`)};Object.defineProperty(e.meta,`__navigationId`,{value:s++}),t.addTimelineEvent({layerId:o,event:{time:t.now(),title:`Start of navigation`,subtitle:e.fullPath,data:r,groupId:e.meta.__navigationId}})}),r.afterEach((e,n,r)=>{let i={guard:Et(`afterEach`)};r?(i.failure={_custom:{type:Error,readOnly:!0,display:r?r.message:``,tooltip:`Navigation Failure`,value:r}},i.status=Et(`❌`)):i.status=Et(`✅`),i.from=$(n,`Current Location during this navigation`),i.to=$(e,`Target location`),t.addTimelineEvent({layerId:o,event:{title:`End of navigation`,subtitle:e.fullPath,time:t.now(),data:i,logType:r?`warning`:`default`,groupId:e.meta.__navigationId}})});let l=`router-inspector:`+a;t.addInspector({id:l,label:`Routes`+(a?` `+a:``),icon:`book`,treeFilterPlaceholder:`Search routes`});function d(){if(!f)return;let e=f,t=i.getRoutes().filter(e=>!e.parent||!e.parent.record.components);t.forEach(Ut),e.filter&&(t=t.filter(t=>Wt(t,e.filter.toLowerCase()))),t.forEach(e=>Ht(e,r.currentRoute.value)),e.rootNodes=t.map(zt)}let f;t.on.getInspectorTree(e=>{f=e,e.app===n&&e.inspectorId===l&&d()}),t.on.getInspectorState(e=>{if(e.app===n&&e.inspectorId===l){let t=i.getRoutes().find(t=>t.record.__vd_id===e.nodeId);t&&(e.state={options:At(t)})}}),t.sendInspectorTree(l),t.sendInspectorState(l)})}function kt(e){return e.optional?e.repeatable?`*`:`?`:e.repeatable?`+`:``}function At(e){let{record:t}=e,n=[{editable:!1,key:`path`,value:t.path}];return t.name!=null&&n.push({editable:!1,key:`name`,value:t.name}),n.push({editable:!1,key:`regexp`,value:e.re}),e.keys.length&&n.push({editable:!1,key:`keys`,value:{_custom:{type:null,readOnly:!0,display:e.keys.map(e=>`${e.name}${kt(e)}`).join(` `),tooltip:`Param keys`,value:e.keys}}}),t.redirect!=null&&n.push({editable:!1,key:`redirect`,value:t.redirect}),e.alias.length&&n.push({editable:!1,key:`aliases`,value:e.alias.map(e=>e.record.path)}),Object.keys(e.record.meta).length&&n.push({editable:!1,key:`meta`,value:e.record.meta}),n.push({key:`score`,editable:!1,value:{_custom:{type:null,readOnly:!0,display:e.score.map(e=>e.join(`, `)).join(` | `),tooltip:`Score used to sort routes`,value:e.score}}}),n}const jt=15485081,Mt=2450411,Nt=8702998,Pt=2282478,Ft=16486972,It=6710886,Lt=16704226,Rt=12131356;function zt(e){let t=[],{record:n}=e;n.name!=null&&t.push({label:String(n.name),textColor:0,backgroundColor:2282478}),n.aliasOf&&t.push({label:`alias`,textColor:0,backgroundColor:Ft}),e.__vd_match&&t.push({label:`matches`,textColor:0,backgroundColor:jt}),e.__vd_exactActive&&t.push({label:`exact`,textColor:0,backgroundColor:Nt}),e.__vd_active&&t.push({label:`active`,textColor:0,backgroundColor:Mt}),n.redirect&&t.push({label:typeof n.redirect==`string`?`redirect: ${n.redirect}`:`redirects`,textColor:16777215,backgroundColor:6710886});let r=n.__vd_id;return r??(r=String(Bt++),n.__vd_id=r),{id:r,label:n.path,tags:t,children:e.children.map(zt)}}let Bt=0;const Vt=/^\/(.*)\/([a-z]*)$/;function Ht(e,t){let n=t.matched.length&&w(t.matched[t.matched.length-1],e.record);e.__vd_exactActive=e.__vd_active=n,n||(e.__vd_active=t.matched.some(t=>w(t,e.record))),e.children.forEach(e=>Ht(e,t))}function Ut(e){e.__vd_match=!1,e.children.forEach(Ut)}function Wt(e,t){let n=String(e.re).match(Vt);if(e.__vd_match=!1,!n||n.length<3)return!1;if(new RegExp(n[1].replace(/\$$/,``),n[2]).test(t))return e.children.forEach(e=>Wt(e,t)),e.record.path!==`/`||t===`/`?(e.__vd_match=e.re.test(t),!0):!1;let r=e.record.path.toLowerCase(),i=S(r);return!t.startsWith(`/`)&&(i.includes(t)||r.includes(t))||i.startsWith(t)||r.startsWith(t)||e.record.name&&String(e.record.name).includes(t)?!0:e.children.some(e=>Wt(e,t))}function Gt(e,t){let n={};for(let r in e)t.includes(r)||(n[r]=e[r]);return n}function Kt(t){let r=Ue(t.routes,t),i=t.parseQuery||rt,l=t.stringifyQuery||it,d=t.history;if(process.env.NODE_ENV!==`production`&&!d)throw Error(`Provide the "history" option when calling "createRouter()": https://router.vuejs.org/api/interfaces/RouterOptions.html#history`);let f=Z(),p=Z(),m=Z(),h=(0,e.shallowRef)(O),g=O;n&&t.scrollBehavior&&`scrollRestoration`in history&&(history.scrollRestoration=`manual`);let _=o.bind(null,e=>``+e),ee=o.bind(null,ce),v=o.bind(null,S);function te(e,t){let n,i;return Te(e)?(n=r.getRecordMatcher(e),process.env.NODE_ENV!==`production`&&!n&&u(`Parent route "${String(e)}" not found when adding child route`,t),i=t):i=e,r.addRoute(i,n)}function ne(e){let t=r.getRecordMatcher(e);t?r.removeRoute(t):process.env.NODE_ENV!==`production`&&u(`Cannot remove non-existent route "${String(e)}"`)}function re(){return r.getRoutes().map(e=>e.record)}function ie(e){return!!r.getRecordMatcher(e)}function y(e,t){if(t=a({},t||h.value),typeof e==`string`){let n=ue(i,e,t.path),o=r.resolve({path:n.path},t),s=d.createHref(n.fullPath);return process.env.NODE_ENV!==`production`&&(s.startsWith(`//`)?u(`Location "${e}" resolved to "${s}". A resolved location cannot start with multiple slashes.`):o.matched.length||u(`No match found for location with path "${e}"`)),a(n,o,{params:v(o.params),hash:S(n.hash),redirectedFrom:void 0,href:s})}if(process.env.NODE_ENV!==`production`&&!B(e))return u(`router.resolve() was passed an invalid location. This will fail in production.
|
|
- Location:`,e),y({});let n;if(e.path!=null)process.env.NODE_ENV!==`production`&&`params`in e&&!(`name`in e)&&Object.keys(e.params).length&&u(`Path "${e.path}" was passed with params but they will be ignored. Use a named route alongside params instead.`),n=a({},e,{path:ue(i,e.path,t.path).path});else{let r=a({},e.params);for(let e in r)r[e]??delete r[e];n=a({},e,{params:ee(r)}),t.params=ee(t.params)}let o=r.resolve(n,t),s=e.hash||``;process.env.NODE_ENV!==`production`&&s&&!s.startsWith(`#`)&&u(`A \`hash\` should always start with the character "#". Replace "${s}" with "#${s}".`),o.params=_(v(o.params));let c=de(l,a({},e,{hash:ae(s),path:o.path})),f=d.createHref(c);return process.env.NODE_ENV!==`production`&&(f.startsWith(`//`)?u(`Location "${e}" resolved to "${f}". A resolved location cannot start with multiple slashes.`):o.matched.length||u(`No match found for location with path "${e.path==null?e:e.path}"`)),a({fullPath:c,hash:s,query:l===it?at(e.query):e.query||{}},o,{redirectedFrom:void 0,href:f})}function b(e){return typeof e==`string`?ue(i,e,h.value.path):a({},e)}function x(e,t){if(g!==e)return H(V.NAVIGATION_CANCELLED,{from:t,to:e})}function oe(e){return C(e)}function se(e){return oe(a(b(e),{replace:!0}))}function le(e,t){let n=e.matched[e.matched.length-1];if(n&&n.redirect){let{redirect:r}=n,i=typeof r==`function`?r(e,t):r;if(typeof i==`string`&&(i=i.includes(`?`)||i.includes(`#`)?i=b(i):{path:i},i.params={}),process.env.NODE_ENV!==`production`&&i.path==null&&!(`name`in i))throw u(`Invalid redirect found:\n${JSON.stringify(i,null,2)}\n when navigating to "${e.fullPath}". A redirect must contain a name or path. This will break in production.`),Error(`Invalid redirect`);return a({query:e.query,hash:e.hash,params:i.path==null?e.params:{}},i)}}function C(e,t){let n=g=y(e),r=h.value,i=e.state,o=e.force,s=e.replace===!0,c=le(n,r);if(c)return C(a(b(c),{state:typeof c==`object`?a({},i,c.state):i,force:o,replace:s}),t||n);let d=n;d.redirectedFrom=t;let f;return!o&&pe(l,r,n)&&(f=H(V.NAVIGATION_DUPLICATED,{to:d,from:r}),Se(r,r,!0,!1)),(f?Promise.resolve(f):T(d,r)).catch(e=>U(e)?U(e,V.NAVIGATION_GUARD_REDIRECT)?e:P(e):M(e,d,r)).then(e=>{if(e){if(U(e,V.NAVIGATION_GUARD_REDIRECT))return process.env.NODE_ENV!==`production`&&pe(l,y(e.to),d)&&t&&(t._count=t._count?t._count+1:1)>30?(u(`Detected a possibly infinite redirection in a navigation guard when going from "${r.fullPath}" to "${d.fullPath}". Aborting to avoid a Stack Overflow.\n Are you always returning a new location within a navigation guard? That would lead to this error. Only return when redirecting or aborting, that should fix this. This might break in production if not fixed.`),Promise.reject(Error(`Infinite redirect in navigation guard`))):C(a({replace:s},b(e.to),{state:typeof e.to==`object`?a({},i,e.to.state):i,force:o}),t||d)}else e=E(d,r,!0,s,i);return me(d,r,e),e})}function fe(e,t){let n=x(e,t);return n?Promise.reject(n):Promise.resolve()}function w(e){let t=L.values().next().value;return t&&typeof t.runWithContext==`function`?t.runWithContext(e):e()}function T(e,t){let n,[r,i,a]=pt(e,t);n=dt(r.reverse(),`beforeRouteLeave`,e,t);for(let i of r)i.leaveGuards.forEach(r=>{n.push(Q(r,e,t))});let o=fe.bind(null,e,t);return n.push(o),z(n).then(()=>{n=[];for(let r of f.list())n.push(Q(r,e,t));return n.push(o),z(n)}).then(()=>{n=dt(i,`beforeRouteUpdate`,e,t);for(let r of i)r.updateGuards.forEach(r=>{n.push(Q(r,e,t))});return n.push(o),z(n)}).then(()=>{n=[];for(let r of a)if(r.beforeEnter)if(c(r.beforeEnter))for(let i of r.beforeEnter)n.push(Q(i,e,t));else n.push(Q(r.beforeEnter,e,t));return n.push(o),z(n)}).then(()=>(e.matched.forEach(e=>e.enterCallbacks={}),n=dt(a,`beforeRouteEnter`,e,t,w),n.push(o),z(n))).then(()=>{n=[];for(let r of p.list())n.push(Q(r,e,t));return n.push(o),z(n)}).catch(e=>U(e,V.NAVIGATION_CANCELLED)?e:Promise.reject(e))}function me(e,t,n){m.list().forEach(r=>w(()=>r(e,t,n)))}function E(e,t,r,i,o){let s=x(e,t);if(s)return s;let c=t===O,l=n?history.state:{};r&&(i||c?d.replace(e.fullPath,a({scroll:c&&l&&l.scroll},o)):d.push(e.fullPath,o)),h.value=e,Se(e,t,r,c),P()}let D;function k(){D||=d.listen((e,t,r)=>{if(!R.listening)return;let i=y(e),o=le(i,R.currentRoute.value);if(o){C(a(o,{replace:!0,force:!0}),i).catch(s);return}g=i;let c=h.value;n&&be(ye(c.fullPath,r.delta),N()),T(i,c).catch(e=>U(e,V.NAVIGATION_ABORTED|V.NAVIGATION_CANCELLED)?e:U(e,V.NAVIGATION_GUARD_REDIRECT)?(C(a(b(e.to),{force:!0}),i).then(e=>{U(e,V.NAVIGATION_ABORTED|V.NAVIGATION_DUPLICATED)&&!r.delta&&r.type===he.pop&&d.go(-1,!1)}).catch(s),Promise.reject()):(r.delta&&d.go(-r.delta,!1),M(e,i,c))).then(e=>{e||=E(i,c,!1),e&&(r.delta&&!U(e,V.NAVIGATION_CANCELLED)?d.go(-r.delta,!1):r.type===he.pop&&U(e,V.NAVIGATION_ABORTED|V.NAVIGATION_DUPLICATED)&&d.go(-1,!1)),me(i,c,e)}).catch(s)})}let ge=Z(),A=Z(),j;function M(e,t,n){P(e);let r=A.list();return r.length?r.forEach(r=>r(e,t,n)):(process.env.NODE_ENV!==`production`&&u(`uncaught error during route navigation:`),console.error(e)),Promise.reject(e)}function _e(){return j&&h.value!==O?Promise.resolve():new Promise((e,t)=>{ge.add([e,t])})}function P(e){return j||(j=!e,k(),ge.list().forEach(([t,n])=>e?n(e):t()),ge.reset()),e}function Se(r,i,a,o){let{scrollBehavior:s}=t;if(!n||!s)return Promise.resolve();let c=!a&&xe(ye(r.fullPath,0))||(o||!a)&&history.state&&history.state.scroll||null;return(0,e.nextTick)().then(()=>s(r,i,c)).then(e=>e&&ve(e)).catch(e=>M(e,r,i))}let F=e=>d.go(e),I,L=new Set,R={currentRoute:h,listening:!0,addRoute:te,removeRoute:ne,clearRoutes:r.clearRoutes,hasRoute:ie,getRoutes:re,resolve:y,options:t,push:oe,replace:se,go:F,back:()=>F(-1),forward:()=>F(1),beforeEach:f.add,beforeResolve:p.add,afterEach:m.add,onError:A.add,isReady:_e,install(t){t.component(`RouterLink`,_t),t.component(`RouterView`,wt),t.config.globalProperties.$router=R,Object.defineProperty(t.config.globalProperties,`$route`,{enumerable:!0,get:()=>(0,e.unref)(h)}),n&&!I&&h.value===O&&(I=!0,oe(d.location).catch(e=>{process.env.NODE_ENV!==`production`&&u(`Unexpected error when starting the router:`,e)}));let i={};for(let e in O)Object.defineProperty(i,e,{get:()=>h.value[e],enumerable:!0});t.provide(J,R),t.provide(Y,(0,e.shallowReactive)(i)),t.provide(X,h);let a=t.unmount;L.add(t),t.unmount=function(){L.delete(t),L.size<1&&(g=O,D&&D(),D=null,h.value=O,I=!1,j=!1),a()},process.env.NODE_ENV!==`production`&&n&&Ot(t,R,r)}};function z(e){return e.reduce((e,t)=>e.then(()=>w(t)),Promise.resolve())}return R}function qt(){return(0,e.inject)(J)}function Jt(t){return(0,e.inject)(Y)}exports.NavigationFailureType=De,exports.RouterLink=_t,exports.RouterView=wt,exports.START_LOCATION=O,exports.createMemoryHistory=Ce,exports.createRouter=Kt,exports.createRouterMatcher=Ue,exports.createWebHashHistory=we,exports.createWebHistory=z,exports.isNavigationFailure=U,exports.loadRouteLocation=ft,exports.matchedRouteKey=q,exports.onBeforeRouteLeave=ct,exports.onBeforeRouteUpdate=lt,exports.parseQuery=rt,exports.routeLocationKey=Y,exports.routerKey=J,exports.routerViewLocationKey=X,exports.stringifyQuery=it,exports.useLink=mt,exports.useRoute=Jt,exports.useRouter=qt,exports.viewDepthKey=ot; |