
管理员
站长
- UID
- 1
- 积分
- 224402
- 余额
- 13 R
- Moe币
- 84883
- 在线时间
- 279 小时
- 注册时间
- 2025-12-28
- 最后登录
- 2026-11-13
|
|
")}const c=O(n,e);return c+r+o}function $(e,t,n,r){let o=[],i=[],c=null;const a=({state:i})=>{const a=H(e,location),s=n.value,u=t.value;let l=0;if(i){if(n.value=a,t.value=i,c&&c===s)return void(c=null);l=u?i.position-u.position:0}else r(a);o.forEach(e=>{e(n.value,s,{delta:l,type:A.pop,direction:l?l>0?S.forward:S.back:S.unknown})})};function s(){c=n.value}function u(e){o.push(e);const t=()=>{const t=o.indexOf(e);t>-1&&o.splice(t,1)};return i.push(t),t}function l(){const{history:e}=window;e.state&&e.replaceState(p({},e.state,{scroll:I()}),"")}function f(){for(const e of i)e();i=[],window.removeEventListener("popstate",a),window.removeEventListener("beforeunload",l)}return window.addEventListener("popstate",a),window.addEventListener("beforeunload",l),{pauseListeners:s,listen:u,destroy:f}}function B(e,t,n,r=!1,o=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:o?I():null}}function U(e){const{history:t,location:n}=window;let r={value:H(e,n)},o={value:t.state};function i(r,i,c){const a=e.indexOf("#"),s=a>-1?e.slice(a)+r:D()+e+r;try{t[c?"replaceState":"pushState"](i,"",s),o.value=i}catch(u){console.error(u),n[c?"replace":"assign"](s)}}function c(e,n){const c=p({},t.state,B(o.value.back,e,o.value.forward,!0),n,{position:o.value.position});i(e,c,!0),r.value=e}function a(e,n){const c=p({},o.value,t.state,{forward:e,scroll:I()});i(c.current,c,!0);const a=p({},B(r.value,e,null),{position:c.position+1},n);i(e,a,!1),r.value=e}return o.value||i(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0),{location:r,state:o,push:a,replace:c}}function V(e){e=C(e);const t=U(e),n=$(e,t.state,t.location,t.replace);function r(e,t=!0){t||n.pauseListeners(),history.go(e)}const o=p({location:"",base:e,go:r,createHref:L.bind(null,e)},t,n);return Object.defineProperty(o,"location",{get:()=>t.location.value}),Object.defineProperty(o,"state",{get:()=>t.state.value}),o}function z(e){return e=location.host?e||location.pathname:"",e.indexOf("#")<0&&(e+="#"),V(e)}function K(e){return"string"===typeof e||e&&"object"===typeof e}function G(e){return"string"===typeof e||"symbol"===typeof e}const q={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0},Y=i("nf");var Q;(function(e){e[e["aborted"]=4]="aborted",e[e["cancelled"]=8]="cancelled",e[e["duplicated"]=16]="duplicated"})(Q||(Q={}));function J(e,t){return p(new Error,{type:e,[Y]:!0},t)}function X(e,t){return e instanceof Error&&Y in e&&(null==t||!!(e.type&t))}const Z="[^/]+?",ee={sensitive:!1,strict:!1,start:!0,end:!0},te=/[.+*?^${}()[\]/\\]/g;function ne(e,t){const n=p({},ee,t);let r=[],o=n.start?"^":"";const i=[];for(const l of e){const e=l.length?[]:[90];n.strict&&!l.length&&(o+="/");for(let t=0;t<l.length;t++){const r=l[t];let c=40+(n.sensitive?.25:0);if(0===r.type)t||(o+="/"),o+=r.value.replace(te,"\\$&"),c+=40;else if(1===r.type){const{value:e,repeatable:n,optional:a,regexp:s}=r;i.push({name:e,repeatable:n,optional:a});const l=s||Z;if(l!==Z){c+=10;try{new RegExp(`(${l})`)}catch(u){throw new Error(`Invalid custom RegExp for param "${e}" (${l}): `+u.message)}}let f=n?`((?:${l})(?:/(?:${l}))*)`:`(${l})`;t||(f=a?`(?:/${f})`:"/"+f),a&&(f+="?"),o+=f,c+=20,a&&(c+=-8),n&&(c+=-20),".*"===l&&(c+=-50)}e.push(c)}r.push(e)}if(n.strict&&n.end){const e=r.length-1;r[e][r[e].length-1]+=.7000000000000001}n.strict||(o+="/?"),n.end?o+="$":n.strict&&(o+="(?:/|$)");const c=new RegExp(o,n.sensitive?"":"i");function a(e){const t=e.match(c),n={};if(!t)return null;for(let r=1;r<t.length;r++){const e=t[r]||"",o=i[r-1];n[o.name]=e&&o.repeatable?e.split("/"):e}return n}function s(t){let n="",r=!1;for(const o of e){r&&n.endsWith("/")||(n+="/"),r=!1;for(const e of o)if(0===e.type)n+=e.value;else if(1===e.type){const{value:o,repeatable:i,optional:c}=e,a=o in t?t[o]:"";if(Array.isArray(a)&&!i)throw new Error(`Provided param "${o}" is an array but it is not repeatable (* or + modifiers)`);const s=Array.isArray(a)?a.join("/"):a;if(!s){if(!c)throw new Error(`Missing required param "${o}"`);n.endsWith("/")?n=n.slice(0,-1):r=!0}n+=s}}return n}return{re:c,score:r,keys:i,parse:a,stringify:s}}function re(e,t){let n=0;while(n<e.length&&n<t.length){const r=t[n]-e[n];if(r)return r;n++}return e.length<t.length?1===e.length&&80===e[0]?-1:1:e.length>t.length?1===t.length&&80===t[0]?1:-1:0}function oe(e,t){let n=0;const r=e.score,o=t.score;while(n<r.length&&n<o.length){const e=re(r[n],o[n]);if(e)return e;n++}return o.length-r.length}const ie={type:0,value:""},ce=/[a-zA-Z0-9_]/;function ae(e){if(!e)return[[]];if("/"===e)return[[ie]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(e){throw new Error(`ERR (${n})/"${u}": ${e}`)}let n=0,r=n;const o=[];let i;function c(){i&&o.push(i),i=[]}let a,s=0,u="",l="";function f(){u&&(0===n?i.push({type:0,value:u}):1===n||2===n||3===n?(i.length>1&&("*"===a||"+"===a)&&t(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),i.push({type:1,value:u,regexp:l,repeatable:"*"===a||"+"===a,optional:"*"===a||"?"===a})):t("Invalid state to consume buffer"),u="")}function d(){u+=a}while(s<e.length)if(a=e[s++],"\\"!==a||2===n)switch(n){case 0:"/"===a?(u&&f(),c()):":"===a?(f(),n=1):d();break;case 4:d(),n=r;break;case 1:"("===a?(n=2,l=""):ce.test(a)?d():(f(),n=0,"*"!==a&&"?"!==a&&"+"!==a&&s--);break;case 2:")"===a?"\\"==l[l.length-1]?l=l.slice(0,-1)+a:n=3:l+=a;break;case 3:f(),n=0,"*"!==a&&"?"!==a&&"+"!==a&&s--;break;default:t("Unknown state");break}else r=n,n=4;return 2===n&&t(`Unfinished custom RegExp for param "${u}"`),f(),c(),o}function se(e,t,n){const r=ne(ae(e.path),n);const o=p(r,{record:e,parent:t,children:[],alias:[]});return t&&!o.record.aliasOf===!t.record.aliasOf&&t.children.push(o),o}function ue(e,t){const n=[],r=new Map;function o(e){return r.get(e)}function i(e,n,r){let o=!r,a=fe(e);a.aliasOf=r&&r.record;const u=be(t,e),l=[a];if("alias"in e){const t="string"===typeof e.alias?[e.alias]:e.alias;for(const e of t)l.push(p({},a,{components:r?r.record.components:a.components,path:e,aliasOf:r?r.record:a}))}let f,d;for(const t of l){let{path:l}=t;if(n&&"/"!==l[0]){let e=n.record.path,r="/"===e[e.length-1]?"":"/";t.path=n.record.path+(l&&r+l)}if(f=se(t,n,u),r?r.alias.push(f):(d=d||f,d!==f&&d.alias.push(f),o&&e.name&&!pe(f)&&c(e.name)),"children"in a){let e=a.children;for(let t=0;t<e.length;t++)i(e[t],f,r&&r.children[t])}r=r||f,s(f)}return d?()=>{c(d)}:b}function c(e){if(G(e)){const 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 a(){return n}function s(e){let t=0;while(t<n.length&&oe(e,n[t])>=0)t++;n.splice(t,0,e),e.record.name&&!pe(e)&&r.set(e.record.name,e)}function u(e,t){let o,i,c,a={};if("name"in e&&e.name){if(o=r.get(e.name),!o)throw J(1,{location:e});c=o.record.name,a=p(le(t.params,o.keys.filter(e=>!e.optional).map(e=>e.name)),e.params),i=o.stringify(a)}else if("path"in e)i=e.path,o=n.find(e=>e.re.test(i)),o&&(a=o.parse(i),c=o.record.name);else{if(o=t.name?r.get(t.name):n.find(e=>e.re.test(t.path)),!o)throw J(1,{location:e,currentLocation:t});c=o.record.name,a=p({},t.params,e.params),i=o.stringify(a)}const s=[];let u=o;while(u)s.unshift(u.record),u=u.parent;return{name:c,path:i,params:a,matched:s,meta:he(s)}}return t=be({strict:!1,end:!0,sensitive:!1},t),e.forEach(e=>i(e)),{addRoute:i,resolve:u,removeRoute:c,getRoutes:a,getRecordMatcher:o}}function le(e,t){let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}function fe(e){return{path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:void 0,beforeEnter:e.beforeEnter,props:de(e),children:e.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in e?e.components||{}:{default:e.component}}}function de(e){const t={},n=e.props||!1;if("component"in e)t.default=n;else for(let r in e.components)t[r]="boolean"===typeof n?n:n[r];return t}function pe(e){while(e){if(e.record.aliasOf)return!0;e=e.parent}return!1}function he(e){return e.reduce((e,t)=>p(e,t.meta),{})}function be(e,t){let n={};for(let r in e)n[r]=r in t?t[r]:e[r];return n}const me=/#/g,ge=/&/g,ve=/\//g,ye=/=/g,Oe=/\?/g,_e=/\+/g,je=/%5B/g,we=/%5D/g,xe=/%5E/g,ke=/%60/g,Pe=/%7B/g,Ae=/%7C/g,Se=/%7D/g,Ce=/%20/g;function Ee(e){return encodeURI(""+e).replace(Ae,"|").replace(je,"[").replace(we,"]")}function Le(e){return Ee(e).replace(Pe,"{").replace(Se,"}").replace(xe,"^")}function Te(e){return Ee(e).replace(_e,"%2B").replace(Ce,"+").replace(me,"%23").replace(ge,"%26").replace(ke,"`").replace(Pe,"{").replace(Se,"}").replace(xe,"^")}function Ie(e){return Te(e).replace(ye,"%3D")}function Me(e){return Ee(e).replace(me,"%23").replace(Oe,"%3F")}function Fe(e){return Me(e).replace(ve,"%2F")}function We(e){try{return decodeURIComponent(""+e)}catch(t){}return""+e}function Ne(e){const t={};if(""===e||"?"===e)return t;const n="?"===e[0],r=(n?e.slice(1):e).split("&");for(let o=0;o<r.length;++o){const e=r[o].replace(_e," ");let n=e.indexOf("="),i=We(n<0?e:e.slice(0,n)),c=n<0?null:We(e.slice(n+1));if(i in t){let e=t[i];Array.isArray(e)||(e=t[i]=[e]),e.push(c)}else t[i]=c}return t}function Re(e){let t="";for(let n in e){t.length&&(t+="&");const r=e[n];if(n=Ie(n),null==r){void 0!==r&&(t+=n);continue}let o=Array.isArray(r)?r.map(e=>e&&Te(e)):[r&&Te(r)];for(let e=0;e<o.length;e++)t+=(e?"&":"")+n,null!=o[e]&&(t+="="+o[e])}return t}function De(e){const t={};for(let n in e){let r=e[n];void 0!==r&&(t[n]=Array.isArray(r)?r.map(e=>null==e?null:""+e):null==r?r:""+r)}return t}function He(){let e=[];function t(t){return e.push(t),()=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)}}function n(){e=[]}return{add:t,list:()=>e,reset:n}}function $e(e,t,n,r,o){const i=r&&(r.enterCallbacks[o]=r.enterCallbacks[o]||[]);return()=>new Promise((c,a)=>{const s=e=>{!1===e?a(J(4,{from:n,to:t})):e instanceof Error?a(e):K(e)?a(J(2,{from:t,to:e})):(i&&r.enterCallbacks[o]===i&&"function"===typeof e&&i.push(e),c())},u=e.call(r&&r.instances[o],t,n,s);let l=Promise.resolve(u);e.length<3&&(l=l.then(s)),l.catch(e=>a(e))})}function Be(e,t,n,r){const o=[];for(const i of e)for(const e in i.components){let c=i.components[e];if("beforeRouteEnter"===t||i.instances[e])if(Ue(c)){let a=c.__vccOpts||c;const s=a[t];s&&o.push($e(s,n,r,i,e))}else{let a=c();a=a.catch(console.error),o.push(()=>a.then(o=>{if(!o)return Promise |
|