@fox-js/fox 3.0.1-14 → 3.0.1-15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/libs/index.cjs.js +2 -2
- package/libs/index.esm.d.ts +6 -2
- package/libs/index.esm.js +150 -154
- package/libs/index.umd.js +2 -2
- package/package.json +1 -1
package/libs/index.cjs.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use strict";/*!
|
|
2
|
-
* fox v3.0.0
|
|
3
|
-
*/Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("vue"),Lr=Array.isArray,Mr=r=>Ze(r)==="[object Map]",Nr=r=>Ze(r)==="[object Set]",Ir=r=>r instanceof Date,P=r=>typeof r=="function",Hr=r=>typeof r=="string",Dr=r=>typeof r=="symbol",yr=r=>r!==null&&typeof r=="object",Vr=r=>yr(r)&&P(r.then)&&P(r.catch),Br=Object.prototype.toString,Ze=r=>Br.call(r),Ct=r=>Ze(r)==="[object Object]",Ur=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol";function pr(r){return r.__esModule||Ur&&r[Symbol.toStringTag]==="Module"}const kr=typeof Promise<"u"&&Promise.toString().indexOf("[native code]")!==-1;function j(...r){let e=r[0]!==void 0&&r[0]!==null?r[0]:{},t=1,n=r.length,i=!1;for(typeof e=="boolean"&&(i=e,e=r[t]??{},t++),typeof e!="object"&&(e={});t<n;t++)if(r[t]!==null&&r[t]!==void 0){let s=r[t];for(let o in s){let a=e[o],l=s[o];if(a!==l)if(i===!0&&l&&typeof l=="object"){let u;Array.isArray(l)?u=a&&Array.isArray(a)?a:[]:u=a&&typeof a=="object"?a:{},e[o]=j(i,u,l)}else l!==void 0&&(e[o]=l)}}return e}function _e(r,e,t=!1){if(!t)j(!0,r,e);else{if(typeof e!="object")return{};typeof r!="object"&&(r={});for(let i in e){let s=r[i],o=e[i];if(s!==o)if(typeof o=="object"){if(!Array.isArray(o)&&!Ct(o))continue;s=_e(s,o,t),r[i]=s}else{if(typeof o=="function")continue;r[i]=o}}const n=Object.getOwnPropertySymbols(e);for(let i of n){let s=r[i],o=e[i];if(s!==o)if(typeof o=="object"){if(!Array.isArray(o)&&!Ct(o))continue;s=_e(s,o,t),r[i]=s}else{if(typeof o=="function")continue;r[i]=o}}}return r}class ie{static seed=new Date().getTime();static get(){let e=++ie.seed;return e>=Number.MAX_VALUE&&(ie.seed=0),e}}const it=kr?Promise.resolve():null;function Te(r,...e){it!==null?e&&e.length>0?it.then(()=>{r(e)}):it.then(r):e&&e.length>0?setTimeout(()=>{r(e)}):setTimeout(r)}function Mt(r){return r==null?!1:typeof r=="boolean"?r:typeof r=="string"?r.toLocaleLowerCase()==="true":Boolean(r)}function Wr(r){return typeof r=="number"?r:Number(r)}const zr={"[object Boolean]":"boolean","[object Number]":"number","[object String]":"string","[object Function]":"function","[object Array]":"array","[object Date]":"date","[object RegExp]":"regExp","[object Object]":"object"};function At(r){let t=Object.prototype.toString.call(r);return r==null?String(r):zr[t]||"object"}function Et(r,e){if(r==e)return!0;if(r===void 0||e===void 0)return!1;let t=At(r),n=At(e);if(t!==n)return!1;if(t==="object"){let i=Object.keys(r),s=Object.keys(e);if(i.length!==s.length)return!1;for(let o=0;o<i.length;o++){let a=i[o],l=r[a],u=e[a];if(!Et(l,u))return!1}return!0}else if(t==="array"){if(r.length!==e.length)return!1;for(let i=0;i<r.length;i++){let s=r[i],o=e[i];if(!Et(s,o))return!1}return!0}return!1}const Jt=Symbol("idKey"),ae=Symbol("valueKey"),S=Symbol("childrenKey"),Q=Symbol("growKey");class mr{[Q]=!0;[Jt];[ae]=v.ref();[S]=new Map;constructor(e){this[Jt]=e}}class Jr{get(e,t){if(t=="value")return e[ae].value;if(t==="grow")return e[Q];let n=e[S].get(t);if(n)return Ke(n);if(e[Q])return n=It(t),n[Q]=e[Q],e[S].set(t,n),Ke(n)}set(e,t,n){return t=="value"?(e[ae].value=n,!0):t==="grow"?(e[Q]=Mt(n),!0):n==null?(e[S].delete(t),!0):(console.error(`illegal property:${t}`),!1)}deleteProperty(e,t){return t==="value"||t=="grow"?(console.error(`can not delete property:${String(t)}`),!1):(e[S].delete(t),!0)}}const Nt="__proxy__";function It(r){let e=new mr(r);return Reflect.set(e,Nt,new Proxy(e,new Jr)),e}function Ke(r){return Reflect.get(r,Nt)}class vr extends mr{constructor(){super("__root__")}put(...e){let t=e.length;if(t<2)return console.error("参数至少包括一个(key, value)"),!1;let n=this;for(let i=0;i<t-1;i++){let s=e[i],o;n[S].has(s)?o=n[S].get(s):(o=It(s),n[S].set(s,o)),n=o}return n[ae].value=e[t-1],!0}get(...e){let t=e.length;if(t===0)return;let n=this;for(let i=0;i<t;i++){let s=e[i];if(n[S].has(s))n=n[S].get(s);else return}return n[ae].value}remove(...e){let t=e.length;if(t==0)return!1;let n=this;for(let s=0;s<t-1;s++){let o=e[s];if(n[S].has(o))n=n[S].get(o);else return!1}let i=e[t-1];return n[S].has(i)?(n[S].delete(i),!0):!1}contains(...e){let t=e.length;if(t==0)return!1;let n=this;for(let s=0;s<t-1;s++){let o=e[s];if(n[S].has(o))n=n[S].get(o);else return!1}let i=e[t-1];return n[S].has(i)}clear(){this[S].clear()}}const Gr=["put","get","contains","remove","clear"];function Gt(r){return Gr.includes(r)}class Qr{get(e,t){if(t=="value")return e[ae].value;if(t==="grow")return e[Q];if(t===S)return e[S];if(typeof t=="string"&&Gt(t))return e[t];let n=String(t),i=e[S].get(n);if(i)return Ke(i);if(e[Q])return i=It(n),i[Q]=e[Q],e[S].set(n,i),Ke(i)}set(e,t,n){return t=="value"?(e[ae].value=n,!0):t==="grow"?(e[Q]=Mt(n),!0):Gt(t)?!1:n==null?(e[S].delete(t),!0):(console.error(`illegal property:${t}`),!1)}deleteProperty(e,t){return t==="value"||t=="grow"?(console.error(`can not delete property:${String(t)}`),!1):(e[S].delete(t),!0)}}function Xr(){let r=new vr,e=new Qr,t=new Proxy(r,e);return Object.assign({put(...i){return Reflect.apply(r.put,r,i)},get(...i){return Reflect.apply(r.get,r,i)},remove(...i){return Reflect.apply(r.remove,r,i)},contains(...i){return Reflect.apply(r.contains,r,i)},clear(){return Reflect.apply(r.clear,r,[])}},t),Reflect.set(r,Nt,t),r}let Ft=new Proxy(vr,{construct(r,...e){let t=Xr();return Ke(t)}});const Z="default",gr=Symbol("sync"),H=Symbol("resolveRoute");function Qt(r){let e=!1;return function(...t){if(!e)return e=!0,Reflect.apply(r,{},t)}}function Yr(r){let e=r.src;return new Promise((t,n)=>{const i=Qt(a=>{pr(a)&&(a=a.default),r.component=a,console.debug("success load async module"),t()}),s=Qt(a=>{console.debug("reject load async module"),n(a)});let o;try{o=e(i,s)}catch(a){s(a)}if(o)if(typeof o.then=="function")o.then(i,s);else{const a=o.component;a&&typeof a.then=="function"&&a.then(i,s)}})}class Zr{name;level;rootName;rootIndex=0;constructor(e,t,n,i){this.name=e,this.level=t,this.rootName=n,this.rootIndex=i}}class Xe{to;routeModel;from;data={};constructor(e,t){this.to=e,this.from=t}static from(e){let t=new Xe(e.to,e.from),n=e.data??{};return j(!0,t.data,n),t}}class ${path;get fullPath(){const e=this.path??`/${this.name}`;return`${this.root??Z}!${e}`}name;root;params;query;matched;meta;success;error;destroy;opsType;updateType;viewTagAttrs;index;active;slot;session;static clone(e,t){let n=new $;return _e(n,e,t),n}static isSame(e,t){return e===t?!0:!(e==null||t==null||e.path&&e.path!==t.path||e.name&&e.name!==t.name||e.root!==t.root||e.index!==t.index)}static isSameForRouteModel(e,t){return e===t?!0:!(e==null||t==null||e.path&&e.path!=t.path||e.name&&e.name!=t.name)}static from(e){let t=new $;if(e==null)return t;let n=t;for(let s in e){let o=e[s];n[s]=o}const i=Object.getOwnPropertySymbols(e);if(Array.isArray(i)&&i.length>0)for(let s of i)n[s]=e[s];return t}}class en{id;name;props;meta;src;component;constructor(e,t,n,i){this.id=ie.get(),this.name=e,this.src=t,typeof t!="function"&&(this.component=t),this.props=n,this.meta=i}get isResolved(){return this.component!==void 0}resolve(){return Yr(this)}}class Xt{models=[]}class st{path;match;redirect;name;layers=[]}const V=Symbol("chainKey"),I=Symbol("cursorKey"),ot=Symbol("$persistentModeKey"),F=Symbol("statusKey"),X=Symbol("argsKey"),Oe=Symbol("exArgsKey"),fe=Symbol("successFnsKey"),xe=Symbol("errorFnsKey"),ne=Symbol("sessionKey"),Y=Symbol("_go");class $e{[V]=[];[I]=0;[ot]=!1;[F]="Free";[X]=[];[Oe]=[];[fe]=[];[xe]=[];[ne];get session(){return this[ne]}constructor(e,t=!1){this[ne]=e,this[ot]=t}[Y](e,...t){let n=this[F];if(this[F]="Busy",this[I]+=e,this[I]<0&&(this[I]=0),this[X]=t,n==="Exception"||n==="Reject"){let a=[{session:this[ne]},...this[Oe]];for(;this[xe].length>0;)try{let l=this[xe].shift();typeof l=="function"&&Te(()=>{Reflect.apply(l,{},a)})}catch(l){console.error(l.message,l)}return this[F]=n,this[V]=[],this[I]=0,this}else if(n==="Finished"||this[I]>=this[V].length){let a=[{session:this[ne]},...this[X]];for(;this[fe].length>0;){let l=this[fe].shift();typeof l=="function"&&Te(()=>{Reflect.apply(l,{},a)})}return this[F]="Free",this}if(this[I]>=this[V].length)return this[F]="Free",this;let i=this[V][this[I]];this[ot]||(this[V].splice(0,this[I]+1),this[I]=-1);let s=this[I]+1;try{let o=!1,a={go:(l,...u)=>{o||(o=!0,Reflect.apply(this[Y],this,[l,...u]))},resolve:(...l)=>{o||(o=!0,Reflect.apply(this[Y],this,[1,...l]))},reject:(...l)=>{o||(o=!0,Reflect.apply(this.reject,this,[...l]))},insert:l=>{o||(this[V].splice(s,0,l),s++)},session:this[ne]};Te(()=>{Reflect.apply(i,{},[a,...this[X]])})}catch(o){this.throw(o)}return this}go(e,...t){return Reflect.apply(this[Y],this,[e,...t])}finish(...e){return this[F]="Finished",this[X]=e,Reflect.apply(this[Y],this,[0])}reject(...e){return this[F]="Reject",this[Oe]=e,Reflect.apply(this[Y],this,[0])}throw(...e){return this[F]="Exception",this[Oe]=e,Reflect.apply(this[Y],this,[0])}reset(...e){this[F]="Busy",this[X]=e,this[V]=[],this[I]=0;let n=[{session:this[ne]},...this[X]];for(;this[fe].length>0;){let i=this[fe].shift();Te(()=>{Reflect.apply(i,this,n)})}return this[F]="Free",this}post(e){return this[F]==="Reject"||this[F]==="Exception"?this:(Array.isArray(e)?this[V]=[...this[V],...e]:this[V].push(e),this[F]==="Busy"?this:(Reflect.apply(this[Y],this,[0,...this[X]]),this))}wait(e,t){return e&&typeof e=="function"&&this[fe].push(e),t&&typeof t=="function"&&this[xe].push(t),this[F]==="Busy"?this:(Reflect.apply(this[Y],this,[0,...this[X]]),this)}exception(e){return e&&typeof e=="function"&&this[xe].push(e),this[F]==="Busy"?this:Reflect.apply(this[Y],this,[0,...this[X]])}isFinish(){return this[F]=="Reject"||this[F]=="Free"&&this[I]>=this[V].length}}const ce=Symbol("registerKey");class tn{policy;callback;constructor(e,t){this.callback=e,this.policy=t}}class jt{[ce]=new Map;constructor(){}on(e,t,n=!1){let i=this[ce].get(e);i||(i=new Array,this[ce].set(e,i));let s=n===!0?1:0,o=new tn(t,s);return i.push(o),this}off(e,t){if(!t)return this[ce].delete(e),this;let n=this[ce].get(e);if(n){for(let i=0;i<n.length;i++)if(n[i].callback===t){n.splice(i,1);break}}return this}bind(e,t,n=!1){return this.on(e,t,n)}unbind(e,t){return this.off(e,t)}once(e,t){return this.on(e,t,!0)}all(...e){let t=e.length;if(t<1)return this;let n=e[t-1];if(typeof n!="function")return console.error("callback can not benn empty"),this;let i=t-1,s=new Array(i),o=[].splice.call(e,0,i);for(let a=0;a<o.length;a++)this.once(o[a],l=>{s[a]=l,i-=1,i==0&&Reflect.apply(n,{},s)});return this}emit(e,...t){let n=this[ce].get(e);if(!n)return this;for(let i=0;i<n.length;){let s=n[i];if(s.policy==1?n.splice(i,1):i++,typeof s.callback=="function")try{Te(()=>{Reflect.apply(s.callback,{},t)})}catch(o){console.error(o.message,o)}}return this}trigger(e,...t){return Reflect.apply(this.emit,this,[e,...t])}}const Re=Symbol("registerKey");class rn{[Re]=new Map;constructor(){}set(e,t){this[Re].set(e,t)}get(e){return this[Re].get(e)}has(e){return this[Re].has(e)}delete(e){return this[Re].delete(e)}}const Tt=Symbol("lc");function ze(r,e=!1){let t=r,n=t[Tt];if(!n)if(e)n=new rn,t[Tt]=n;else return null;return n}function wr(r,e){let t=r;for(;t!==null;){const n=t[Tt];if(n&&n.has(e))return n.get(e);t=t.$parent}return null}function Yt(r){if(Array.isArray(r.children)&&r.children.length>0){let e=r.children[0];if(e!=null&&e.component!=null&&e.component.proxy!=null)return ze(e.component.proxy,!1)}return null}const Ye=Symbol("hooksKey");function nn(r){let e=r.get(Ye);e||(e=[],r.set(Ye,e))}function Zt(r,e){let t=r.get(Ye);if(t!=null)for(let n=t.length-1;n>=0;n--){let i=t[n];if(i.type===e)try{Reflect.apply(i.hook,i.target,[])}catch(s){console.error(s.message,s)}}}var _t=(r=>(r.DEACTIVATED="da",r.ACTIVATED="a",r))(_t||{});class sn{type;hook;target;constructor(e,t,n){this.target=n,this.hook=t,this.type=e}}function on(r,e,t,n){let i=new sn(e,t,n);return r.push(i),!0}function ln(r,e,t,n){let i=-1;for(let s=0;s<r.length;s++){let o=r[s];if(o.type===e&&o.hook===t&&o.target===n){i=s;break}}return i!=-1?(r.splice(i,1),!0):!1}function br(r){return(e,t)=>{let n;if(t)n=t;else{let s=v.getCurrentInstance();if(s==null||s.proxy==null){console.error("can not get current instance or proxy");return}n=s.proxy}let i=wr(n,Ye);if(i==null){console.warn("can not get hooks context");return}v.onUnmounted(()=>{ln(i,r,e,n)}),on(i,r,e,n)}}let an=br("a"),un=br("da");function fn(){let r=new $;return r.path="",r.name="",r.params={},r.index=-1,v.shallowReactive(r)}const Kt=Symbol("routeKey");function lt(r,e){let t=r.get(Kt);if(t){let n={path:"",name:"",params:{},index:-1,session:{}};Object.assign(n,e),Object.assign(t,n)}else t=fn(),Object.assign(t,e),r.set(Kt,t)}function xr(r){let e=wr(r,Kt);return e??null}const et=Symbol("rk"),at=Symbol("vd"),er=Symbol("rv"),ut=Symbol("rvi"),tr=Symbol("pv"),ft=Symbol("pvi");function cn(r){for(var e=[],t=0;t<r.length;){var n=r[t];if(n==="*"||n==="+"||n==="?"){e.push({type:"MODIFIER",index:t,value:r[t++]});continue}if(n==="\\"){e.push({type:"ESCAPED_CHAR",index:t++,value:r[t++]});continue}if(n==="{"){e.push({type:"OPEN",index:t,value:r[t++]});continue}if(n==="}"){e.push({type:"CLOSE",index:t,value:r[t++]});continue}if(n===":"){for(var i="",s=t+1;s<r.length;){var o=r.charCodeAt(s);if(o>=48&&o<=57||o>=65&&o<=90||o>=97&&o<=122||o===95){i+=r[s++];continue}break}if(!i)throw new TypeError("Missing parameter name at ".concat(t));e.push({type:"NAME",index:t,value:i}),t=s;continue}if(n==="("){var a=1,l="",s=t+1;if(r[s]==="?")throw new TypeError('Pattern cannot start with "?" at '.concat(s));for(;s<r.length;){if(r[s]==="\\"){l+=r[s++]+r[s++];continue}if(r[s]===")"){if(a--,a===0){s++;break}}else if(r[s]==="("&&(a++,r[s+1]!=="?"))throw new TypeError("Capturing groups are not allowed at ".concat(s));l+=r[s++]}if(a)throw new TypeError("Unbalanced pattern at ".concat(t));if(!l)throw new TypeError("Missing pattern at ".concat(t));e.push({type:"PATTERN",index:t,value:l}),t=s;continue}e.push({type:"CHAR",index:t,value:r[t++]})}return e.push({type:"END",index:t,value:""}),e}function Rr(r,e){e===void 0&&(e={});for(var t=cn(r),n=e.prefixes,i=n===void 0?"./":n,s="[^".concat(me(e.delimiter||"/#?"),"]+?"),o=[],a=0,l=0,u="",f=function(R){if(l<t.length&&t[l].type===R)return t[l++].value},c=function(R){var q=f(R);if(q!==void 0)return q;var _=t[l],K=_.type,M=_.index;throw new TypeError("Unexpected ".concat(K," at ").concat(M,", expected ").concat(R))},h=function(){for(var R="",q;q=f("CHAR")||f("ESCAPED_CHAR");)R+=q;return R};l<t.length;){var d=f("CHAR"),y=f("NAME"),g=f("PATTERN");if(y||g){var p=d||"";i.indexOf(p)===-1&&(u+=p,p=""),u&&(o.push(u),u=""),o.push({name:y||a++,prefix:p,suffix:"",pattern:g||s,modifier:f("MODIFIER")||""});continue}var m=d||f("ESCAPED_CHAR");if(m){u+=m;continue}u&&(o.push(u),u="");var b=f("OPEN");if(b){var p=h(),T=f("NAME")||"",x=f("PATTERN")||"",C=h();c("CLOSE"),o.push({name:T||(x?a++:""),pattern:T&&!x?s:x,prefix:p,suffix:C,modifier:f("MODIFIER")||""});continue}c("END")}return o}function hn(r,e){return dn(Rr(r,e),e)}function dn(r,e){e===void 0&&(e={});var t=Ht(e),n=e.encode,i=n===void 0?function(l){return l}:n,s=e.validate,o=s===void 0?!0:s,a=r.map(function(l){if(typeof l=="object")return new RegExp("^(?:".concat(l.pattern,")$"),t)});return function(l){for(var u="",f=0;f<r.length;f++){var c=r[f];if(typeof c=="string"){u+=c;continue}var h=l?l[c.name]:void 0,d=c.modifier==="?"||c.modifier==="*",y=c.modifier==="*"||c.modifier==="+";if(Array.isArray(h)){if(!y)throw new TypeError('Expected "'.concat(c.name,'" to not repeat, but got an array'));if(h.length===0){if(d)continue;throw new TypeError('Expected "'.concat(c.name,'" to not be empty'))}for(var g=0;g<h.length;g++){var p=i(h[g],c);if(o&&!a[f].test(p))throw new TypeError('Expected all "'.concat(c.name,'" to match "').concat(c.pattern,'", but got "').concat(p,'"'));u+=c.prefix+p+c.suffix}continue}if(typeof h=="string"||typeof h=="number"){var p=i(String(h),c);if(o&&!a[f].test(p))throw new TypeError('Expected "'.concat(c.name,'" to match "').concat(c.pattern,'", but got "').concat(p,'"'));u+=c.prefix+p+c.suffix;continue}if(!d){var m=y?"an array":"a string";throw new TypeError('Expected "'.concat(c.name,'" to be ').concat(m))}}return u}}function yn(r,e){var t=[],n=Sr(r,t,e);return pn(n,t,e)}function pn(r,e,t){t===void 0&&(t={});var n=t.decode,i=n===void 0?function(s){return s}:n;return function(s){var o=r.exec(s);if(!o)return!1;for(var a=o[0],l=o.index,u=Object.create(null),f=function(h){if(o[h]===void 0)return"continue";var d=e[h-1];d.modifier==="*"||d.modifier==="+"?u[d.name]=o[h].split(d.prefix+d.suffix).map(function(y){return i(y,d)}):u[d.name]=i(o[h],d)},c=1;c<o.length;c++)f(c);return{path:a,index:l,params:u}}}function me(r){return r.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function Ht(r){return r&&r.sensitive?"":"i"}function mn(r,e){if(!e)return r;for(var t=/\((?:\?<(.*?)>)?(?!\?)/g,n=0,i=t.exec(r.source);i;)e.push({name:i[1]||n++,prefix:"",suffix:"",modifier:"",pattern:""}),i=t.exec(r.source);return r}function vn(r,e,t){var n=r.map(function(i){return Sr(i,e,t).source});return new RegExp("(?:".concat(n.join("|"),")"),Ht(t))}function gn(r,e,t){return wn(Rr(r,t),e,t)}function wn(r,e,t){t===void 0&&(t={});for(var n=t.strict,i=n===void 0?!1:n,s=t.start,o=s===void 0?!0:s,a=t.end,l=a===void 0?!0:a,u=t.encode,f=u===void 0?function(M){return M}:u,c=t.delimiter,h=c===void 0?"/#?":c,d=t.endsWith,y=d===void 0?"":d,g="[".concat(me(y),"]|$"),p="[".concat(me(h),"]"),m=o?"^":"",b=0,T=r;b<T.length;b++){var x=T[b];if(typeof x=="string")m+=me(f(x));else{var C=me(f(x.prefix)),R=me(f(x.suffix));if(x.pattern)if(e&&e.push(x),C||R)if(x.modifier==="+"||x.modifier==="*"){var q=x.modifier==="*"?"?":"";m+="(?:".concat(C,"((?:").concat(x.pattern,")(?:").concat(R).concat(C,"(?:").concat(x.pattern,"))*)").concat(R,")").concat(q)}else m+="(?:".concat(C,"(").concat(x.pattern,")").concat(R,")").concat(x.modifier);else x.modifier==="+"||x.modifier==="*"?m+="((?:".concat(x.pattern,")").concat(x.modifier,")"):m+="(".concat(x.pattern,")").concat(x.modifier);else m+="(?:".concat(C).concat(R,")").concat(x.modifier)}}if(l)i||(m+="".concat(p,"?")),m+=t.endsWith?"(?=".concat(g,")"):"$";else{var _=r[r.length-1],K=typeof _=="string"?p.indexOf(_[_.length-1])>-1:_===void 0;i||(m+="(?:".concat(p,"(?=").concat(g,"))?")),K||(m+="(?=".concat(p,"|").concat(g,")"))}return new RegExp(m,Ht(t))}function Sr(r,e,t){return r instanceof RegExp?mn(r,e):Array.isArray(r)?vn(r,e,t):gn(r,e,t)}var E=(r=>(r[r.Push=0]="Push",r[r.Replace=1]="Replace",r[r.Put=2]="Put",r[r.Append=3]="Append",r[r.Open=4]="Open",r))(E||{}),Je=(r=>(r[r.Part=0]="Part",r[r.All=1]="All",r))(Je||{});const G=Symbol("rootKey"),J=Symbol("rootNodeKey"),le=Symbol("parentNodeKey"),Ge=Symbol("nameKey");class ee{instance=null;model;route;active=!0;index=0;constructor(e,t,n=0,i=!0){this.route=e,this.model=t,this.index=n,this.active=i}}class Se{scope=null;set compensation(e){this.scope!==null&&this.scope.stop(),this.scope=v.effectScope(),this.scope.run(()=>{v.watch(this.slots,()=>{let t=!1;try{t=e()}catch(n){console.error(n)}t&&this.scope!==null&&(this.scope.stop(),this.scope=null)})})}_slots;get slots(){return this._slots==null&&(this._slots=v.shallowRef([])),this._slots}get empty(){return this._slots==null||this._slots.value.length==0}[Ge];[G];[J]=null;[le]=null;get name(){return this[Ge]}constructor(e,t,n){this[Ge]=e,this[G]=t,n&&(this[J]=n)}}class B{view;index;level;constructor(e,t,n){this.view=e,this.index=t,this.level=n}static include(e,t){for(let n=0;n<e.length;n++){let i=e[n];if(i.view===t.view&&(t.index==-1||i.index===t.index)&&i.level===t.level)return!0}return!1}}class ct{views=[]}class bn{layers=[]}class xn{time;route}class Rn{forbidTime=300;submitRecorder=new xn;isSameRoute(e,t){return e==null||t==null?!1:e.name===t.name&&e.path===t.path&&e.root===t.root}acquire(e){let t=new Date().getTime();if(this.isSameRoute(e,this.submitRecorder.route)&&this.submitRecorder.time&&t-this.submitRecorder.time<=this.forbidTime){this.submitRecorder.time=t;return}return this.submitRecorder.route=e,this.submitRecorder.time=t,t}release(e){this.submitRecorder.time===e&&(this.submitRecorder.route=void 0)}}const ve=Symbol("_notifyChange");class rr{currentRoute;routes;constructor(e,t){this.currentRoute=e,this.routes=t}}const qe=typeof window<"u",N=function(){return window},Le=function(){return window.document};function Sn(r){let e=r,t=e.lastIndexOf("/");return t>0&&t<e.length-1?e=e.substring(0,t+1):t===0&&e.indexOf(".")!==-1?e="/":t===-1&&(e.indexOf(".")==-1?e=`/${e}/`:e="/"),e.indexOf("/")!==0&&(e=`/${e}`),e}function ht(){if(!qe)return"/";let r=N().location,e=`${r.protocol}//${r.host}`;return e+=Sn(r.pathname),e}function $t(r,e,t){r.addEventListener?r.addEventListener(e,t,!1):r.attachEvent?r.attachEvent(`on${e}`,t):r[`on${e}`]=t}function qt(r,e,t){r.removeEventListener?r.removeEventListener(e,t):r.detachEvent?r.detachEvent(`on${e}`,t):r[`on${e}`]=null}const Me=Symbol("ignoreHistoryChangeOnceKey"),nr=Symbol("_navigateFirstRoute"),Ne=Symbol("_getRouteMark"),ir=Symbol("_getUrlSearch"),dt=Symbol("_generateLocation"),Pe=Symbol("_setRouteMarkRecorder"),sr="Symbol(_fox_restore_point)";function yt(r,...e){return typeof r=="function"?Reflect.apply(r,null,[...e]):r}class Pr{base;storage;mode;query;firstNavigate=!0;historyMonitor;traceless=!1;changeHandler;historyChange;[Me]=!1;constructor(e="hash",t="",n="",i=!0,s=!0,o=!1,a){this.mode=e,this.base=t,this.query=n,this.firstNavigate=i,this.historyMonitor=s,this.traceless=o,this.storage=a??N().sessionStorage}init(e=!0){const t=N();return typeof this.historyChange!="function"&&(this.historyChange=()=>{if(this[Me]){this[Me]=!1;return}if(yt(this.historyMonitor)){const n=t.history.state;this[ve](n);try{let i=[];if(typeof n=="string"?i=JSON.parse(n):i=n,Array.isArray(i)&&i.length>0){const s=this[Ne]()??"/";this[Pe](s,i)}}catch{}}}),$t(t,"popstate",this.historyChange),this.firstNavigate&&e&&this[nr](),Promise.resolve()}destroy(){if(this.historyChange){const e=N();qt(e,"popstate",this.historyChange)}}[nr](){const e=this[Ne]()??"/",t=this.storage.getItem(sr);if(t)try{const o=JSON.parse(t);if(o.mark===e){this[ve](o.routes);return}}catch{}const n=e.indexOf("!");let i;n!=-1?i=e.substring(n+1):i=e;const s=new $;s.path=i,s.query=this[ir](),this[ve]([s])}[Pe](e,t){try{const n={mark:e,routes:t},i=JSON.stringify(n);this.storage.setItem(sr,i)}catch(n){console.error(n.message,n)}}setRestorePoint(e){const t=this[Ne]()??"/";this[Pe](t,e)}[ve](e){typeof this.changeHandler=="function"&&this.changeHandler(e)}[Ne](){const e=N();if(this.mode==="path"){let t=e.location.pathname;return this.base&&t.indexOf(this.base)===0&&(t=t.substring(this.base.length)),t}else{const t=e.location.hash,n=t.indexOf("#");if(n!=-1)return t.substring(n+1)}return null}[ir](){return N().location.search}listen(e){this.changeHandler=e}go(e,t=!0){const n=N();this[Me]=!t,n.history.go(e)}push(e){let t=this[dt](e.currentRoute);yt(this.traceless,e.currentRoute)||N().history.pushState(e.routes,"",t),this[Pe](e.currentRoute.fullPath,e.routes)}replace(e){let t=this[dt](e.currentRoute);yt(this.traceless,e.currentRoute)||N().history.replaceState(e.routes,"",t),this[Pe](e.currentRoute.fullPath,e.routes)}[dt](e){const t=N();let n="";if(e.query){let a="";if(typeof e.query=="object")for(let l in e.query){let u=encodeURIComponent(e.query[l]),f=`${encodeURIComponent(l)}=${u}`;a.length>0&&(a+="&"),a+=f}else a=e.query;this.query?(n=`${this.query}&${a}`,n.charAt(0)!=="?"&&(n=`?${n}`)):n=`?${a}`}const i=t.location;let s=e.fullPath;s.startsWith(Z)&&(s=s.substring(Z.length+1));let o;return n?this.mode=="path"?o=`${this.base}/${s}${n}`:o=`${i.pathname}${n}#${s}`:this.mode=="path"?o=`${this.base}/${s}`:o=`${i.pathname}#${s}`,`${i.origin}${o}`}}function Pn(r=!0,e=null,t="",n=!0,i=!1,s){return e!==null&&(e=N().location.pathname),e&&e.endsWith("/")&&(e=e.substring(0,e.length-1)),new Pr("path",e??"",t,r,n,i,s)}function Cr(r=!0,e="",t=!0,n=!1,i){return new Pr("hash","",e,r,t,n,i)}class Cn{maxSize=50;cursor=-1;queue=[];changeHandler;base;historyMonitor=!1;traceless=!1;constructor(e,t=50){this.base=e,this.maxSize=t}init(e=!0){return Promise.resolve()}destroy(){this.queue=[]}listen(e){this.changeHandler=e}[ve](e){typeof this.changeHandler=="function"&&this.changeHandler(e)}go(e,t=!0){if(this.queue.length==0||this.cursor<=0||this.cursor>=this.queue.length-1)return;let n=this.cursor+e;if(n<0?n=0:n>this.queue.length-1&&(n=this.queue.length-1),n!=this.cursor&&(this.cursor=n,t)){const i=this.queue[n];this[ve](i.routes)}}push(e){this.queue.length>=this.maxSize&&this.queue.splice(0,1),this.queue.push(e),this.cursor=this.queue.length-1}replace(e){let t=this.queue.length-this.cursor;this.queue.splice(this.cursor,t),this.queue[this.cursor]=e}setRestorePoint(e){}}function Ar(r="",e=50){return new Cn(r,e)}const Ie=Symbol("_constructRouteModel"),He=Symbol("_findRouteModel"),pt=Symbol("_findRootView"),or=Symbol("_getFirstView"),se=Symbol("_removeView"),lr=Symbol("_buildPage"),ar=Symbol("_resolveComponent"),ur=Symbol("_update"),te=Symbol("_merge"),mt=Symbol("_handleHistoryChange"),De=Symbol("_handleRouteUpdated"),Ve=Symbol("routeUpdatedCallback"),w=Symbol("currentRoutes"),he=Symbol("current"),fr=Symbol("_addRouteRecorder"),de=Symbol("_removeRouteRecorder"),Be=Symbol("_cloneRouteRecorder"),L=Symbol("_handleError"),Ue=Symbol("errorCallback"),U=Symbol("registerKey"),ke=Symbol("notFoundKey"),vt=Symbol("notFoundPathKey"),k=Symbol("forestKey"),A=Symbol("historyKey"),Ce=Symbol("beforeFiltersKey"),Ae=Symbol("afterFiltersKey"),Ee=Symbol("destroyFiltersKey"),ye=Symbol("mainDispatcherKey"),gt=Symbol("initKey"),oe=Symbol("readyKey"),wt=Symbol("readyHandlersKey"),We=Symbol("_markReady"),cr=Symbol("_createNextFn"),bt=Symbol("_start"),xt=Symbol("_before"),Rt=Symbol("_after"),hr=Symbol("_destroy"),St=Symbol("_load"),Fe=Symbol("_unload"),je=Symbol("routerGuardKey");function An(r){return r.layers.length==0||r.layers[0].views.length==0}function En(r){let e=[];return r.layers.forEach(t=>{t.models==null||t.models==null||t.models.forEach(n=>{if(!(n==null||n==null))if(typeof n.meta=="object"){let i=j(!0,{},n.meta);e.push(i)}else n.meta&&e.push(n.meta)})}),e}class Fn{[U]=new Array;[ke];[vt]="*";[oe]=!1;[wt]=[];[k]=new bn;[A];[w]=new Array;[Ue]=null;[Ve]=null;[Ce]=new Array;[Ae]=new Array;[Ee]=new Array;[ye]=new $e;[je]=new Rn;[gt]=!1;[he]=v.ref(null);get current(){return this[he].value}options;constructor(e){this.options=e??{},this.options.notFoundPath&&this.setNotFoundPath(this.options.notFoundPath);let t=this.options.routes||[];this.addRoutes(t),this.options.notFound&&this.setNotFoundRoute(this.options.notFound),e.history?this[A]=e.history:this[A]=qe?Cr():Ar(),this[A]?.listen(async n=>{let i=!0;try{if(typeof n=="string"){const s=this[H](n);s&&await this[mt]([s])}else await this[mt](n)}catch(s){console.error(s.message,s),i=!1}this[oe]===!1&&this[We](i)})}[L](e="error",t){if(t&&typeof t.error=="function")try{t.error(e)}catch{}if(typeof this[Ue]=="function")try{this[Ue](e,t)}catch{}console.error(e)}init(){this[gt]!==!0&&(this[A]?.init(!this[oe]),this[gt]=!0)}isReady(){return this[oe]?Promise.resolve():new Promise((e,t)=>{this[wt].push([e,t])})}[We](e){this[oe]=!0,this[wt].forEach(([t,n])=>{try{e?t():n()}catch(i){console.error(i.message,i)}})}[mt](e){try{if(!e){let o=[...this[w]].reverse();return this[Fe](o),qe&&N().location.reload(),Promise.resolve()}let t=null,n=[],i=[],s=0;for(;s<e.length&&s<this[w].length&&$.isSame(e[s],this[w][s]);s++)e[s].opsType===E.Open&&e[s].active===!0&&e[s].active!==this[w][s].active&&(t=e[s]);if(s<e.length&&(n=e.slice(s)),s<this[w].length&&(i=this[w].slice(s).reverse()),i.length==0&&n.length==0){if(t!==null)return this.restore([t])}else if(i.length>0){if(this[Fe](i)){if(n.length>0)return this.restore(n);if(t!==null)return this.restore([t])}}else return this.restore(n)}catch(t){this[L](t)}return Promise.resolve()}[De](e){if(e)this[he].value=e;else{let t=this[w].length;t>0?this[he].value=this[w][t-1]:this[he].value=null}if(typeof this[Ve]=="function")try{this[Ve](this[he].value)}catch{}}[fr](e,t=-1){t<0||t>=this[w].length?this[w].push(e):this[w].splice(t,0,e)}[Be](){let e=[];for(let t of this[w]){let n=$.clone(t,!0);e.push(n)}return e}[de](e){if(!this[w])return;let t=-1;for(let n=0;n<this[w].length;n++)if($.isSame(this[w][n],e)){t=n;break}if(t!=-1){let n=this[w][t];this[w].splice(t,1),this[hr](n,n.session)}}set historyMonitor(e){this[A]&&(this[A].historyMonitor=e)}get historyMonitor(){return this[A]?this[A].historyMonitor:!1}set traceless(e){this[A]&&(this[A].traceless=e)}get traceless(){return this[A]?this[A].traceless:!1}setRestorePoint(){const e=this[Be]();this[A]?.setRestorePoint(e)}onRouteUpdated(e){this[Ve]=e}onError(e){this[Ue]=e}beforeEach(e){this[Ce].push(e)}removeBeforeEach(e){const t=this[Ce].indexOf(e);return t!==-1?(this[Ce].splice(t,1),!0):!1}afterEach(e){this[Ae].push(e)}removeAfterEach(e){const t=this[Ae].indexOf(e);return t!==-1?(this[Ae].splice(t,1),!0):!1}destroyEach(e){this[Ee].push(e)}removeDestroyEach(e){const t=this[Ee].indexOf(e);return t!==-1?(this[Ee].splice(t,1),!0):!1}addRoutes(e){for(let t of e)this.addRoute(t)}addRoute(e,t=-1){if(e.path===this[vt]){this.setNotFoundRoute(e);return}const n=this[Ie](e);if(t==-1)this[U]=[...this[U],...n];else for(let i=n.length-1;i>=0;i--)this[U].splice(t,0,n[i])}removeRoute(e){const t=this[H](e);if(t===null)return console.warn("route格式错误",e),!1;for(let n=0;n<this[U].length;n++){const i=this[U][n];if(t?.path&&i.path===t.path)return this[U].splice(n,1),!0;if(t?.name&&i.name===t.name)return this[U].splice(n,1),!0}return!1}hasRoute(e){const t=this[H](e);return t===null?(console.warn("route格式错误",e),!1):this[U].findIndex(i=>{if(t?.path&&i.path===t.path||t?.name&&i.name===t.name)return!0})!==-1}setNotFoundPath(e){this[vt]=e}setNotFoundRoute(e){const t=this[Ie](e);this[ke]=t[0]}getRoutes(){return[...this[U]]}[Ie](e){let t=e.path??"";t.length>0&&t.charAt(0)!=="/"&&(t=`/${t}`);let n=e.components??(e.component&&{"":e.component});if(n==null){let a=new st;return a.path=t,a.redirect=e.redirect,[a]}let i=[];for(let a in n){let l=n[a];a.length===0&&(a=Z);let u=new en(a,l,e.props,e.meta);i.push(u)}let s=!1,o=[];if(e.children)for(let a of e.children){let l=this[Ie](a);for(let u of l){let f=new st;f.name=u.name,u.path&&u.path.length>0?t!=="/"?f.path=`${t}${u.path}`:f.path=u.path:(s=!0,f.path=t);let c=new Xt;c.models=[...i],f.layers=[c,...u.layers],o.push(f)}}if(!s){let a=new Xt;a.models=i;let l=new st;l.name=e.name,l.path=t,l.layers=[a],o.splice(0,0,l)}return o}[He](e){const t=e.route;try{for(let n of this[U])if(t.path&&n.path){let i=n.match;i||(i=n.match=yn(n.path));let s=i(t.path);if(!s)continue;if(n.redirect){let o=new $;j(!0,o,t),o.path=n.redirect;let a={route:o,find:void 0};return this[He](a)?(e.route=a.route,e.find=a.find,!0):!1}if(t.params=t.params??{},j(!0,t.params,s.params),t.query){let o=t.query;if(typeof o=="string"){let a={},l=o.split("&");for(let u of l){let f=u.split("=");if(f.length!==2)continue;let c=decodeURIComponent(f[0].trim()),h=decodeURIComponent(f[1].trim());a[c]=h}j(!0,t.params,a)}else typeof o=="object"&&j(!0,t.params,o)}return e.find=n,!0}else if(t.name===n.name){t.params=t.params??{};let i=hn(n.path);return t.path=i(t.params),e.find=n,!0}}catch(n){console.error(n.message,n),typeof t.error=="function"&&t.error(n.message)}return!1}[H](e){let t=null;if(Array.isArray(e))if(t=new $,typeof e[0]=="object")t=$.from(e[0]);else for(let n=0;n<e.length;n++)n===0?e[n].charAt(0)==="/"?t.path=e[n]:t.name=e[n]:n===1?t.params=e[n]:n===2?t.root=e[n]:n===3&&j(!1,t,e[n]);else typeof e=="object"?t=$.from(e):typeof e=="string"&&(t=new $,e.charAt(0)=="/"?t.path=e:t.name=e);if(t){if(t.path){let n=t.path.indexOf("?");n!==-1&&n<t.path.length-1&&(t.query=t.path.substring(n+1),t.path=t.path.substring(0,n))}t.root=t.root??Z,t.opsType=t.opsType??this.options.defaultOperationType??E.Push}return t}push(...e){let t=this[H](e);return t?(t.opsType=t.opsType||E.Push,this.to(t)):(this[L]("resolve route fail",t),this)}put(...e){let t=this[H](e);return t?(t.opsType=E.Put,this.to(t)):(this[L]("resolve route fail",t),this)}replace(...e){let t=this[H](e);return t?(t.opsType=E.Replace,this.to(t)):(this[L]("resolve route fail",t),this)}append(...e){let t=this[H](e);return t?(t.opsType=E.Append,this.to(t)):(this[L]("resolve route fail",t),this)}remove(e){return new Promise(t=>{this[ye].post(n=>{try{if(this[w].length===0){n.resolve(),t(!1);return}let i=-1,s,o=[];if(e){if(e.root?s=e.root:s=this[w][0].root??Z,e.all)for(let l=this[w].length-1;l>0;l--){let u=this[w][l];u.opsType===E.Append&&u.root===s&&(o.splice(0,0,u),i=l-1)}else if(e.until)for(let l=this[w].length-1;l>0;l--){let u=this[w][l];if(u.opsType===E.Append&&u.root===s){if(e.until.charAt(0)==="/"&&e.until===u.path){i=l;break}else if(e.until===u.name){i=l;break}o.splice(0,0,u)}}}else{s=Z;let l=this[or](this[k]);l&&(s=l.name);for(let u=this[w].length-1;u>0;u--){let f=this[w][u];if(f.opsType===E.Append&&f.root===s){o.push(f),i=u-1;break}}}if(o.length===0){let l="can not find route";console.warn(l),n.resolve(l),t(!1);return}let a=0;if(this[w].forEach(l=>{l.opsType!==E.Put&&a++}),this[Fe](o)){let l=0;this[w].forEach(f=>{f.opsType!==E.Put&&l++});const u=l-a;this[A]?.go(u,!1),n.resolve(),t(!0)}}catch(i){this[L](i),n.resolve(),t(!1)}})})}open(...e){let t=this[H](e);return t?(t.opsType=E.Open,this.to(t)):(this[L]("resolve route fail",t),this)}close(e){return this[ye].post(t=>{try{let n=this[H](e);if(!n){t.reject("resolve route fail");return}let i=[];for(let s=0;s<this[w].length;s++){let o=this[w][s];if(o.root===n.root){if(!n.path&&!n.name){i.push(o);continue}if(n.path&&n.path===o.path){i.push(o);break}else if(n.name&&n.name===o.name){i.push(o);break}}}if(i.length===0){t.resolve();return}this[Fe](i)&&this[De](),t.resolve()}catch(n){this[L](n),t.resolve()}}),this}to(...e){let t=this[H](e);if(!t)return this[L]("resolve route fail",t),this;console.debug("route to",t.path,t.root);let n=this[je].acquire(t);return n==null?(this[L]("route forbid",t),this):(this[ye].post(i=>{try{let s=this[bt](t);this[xt](s),this[St](s),this[Rt](s),s.wait((o,a)=>{const l=o.session.to;try{let u=$.clone(l,!0);const f=new rr(u,this[Be]());l.opsType===E.Replace?this[A]?.replace(f):this[A]?.push(f)}catch(u){console.error(u.message,u)}if(this[je].release(n),this[De](l),typeof t.success=="function")try{Reflect.apply(t.success,{},[])}catch(u){console.error(u.message,u)}this[oe]===!1&&this[We](!0),i.resolve()},(o,a)=>{this[je].release(n),a!==null&&this[L](a,t),this[oe]===!1&&this[We](!1),i.resolve()})}catch(s){this[je].release(n),this[L](s,t),i.resolve()}}),this)}back(e=1){this[A]?.go(-e)}[cr](e){return(t,n)=>{if(typeof t=="boolean")e.session.redirect=!1,t?e.resolve():e.reject(n??null);else if(t){const i=this[H](t);if(i){const s=e.session.to;i.success=s.success,i.error=s.error,e.session.to=i,e.session.redirect=!0,e.session.routeModel=null,e.resolve()}else e.session.redirect=!1,e.reject("route resolve fail")}else e.session.redirect=!1,e.resolve()}}[bt](e){let t=this[w].length>0?this[w][0]:void 0,n=new Xe(e,t),i={route:e,find:null};return this[He](i),i.find&&(n.routeModel=i.find,e.matched=En(i.find),Array.isArray(e.matched)&&e.matched.length>0&&(e.meta=i.find.layers[0].models[0].meta)),new $e(n)}[xt](e){for(let t of this[Ce])e.post(n=>{let i=this[cr](n);Reflect.apply(t,{},[n.session.to,n.session.from,i,n.session])})}[Rt](e){e.post(t=>{for(let n of this[Ae])try{Reflect.apply(n,{},[t.session.to,t.session.from,t.session])}catch(i){console.error(i.message,i)}t.resolve()})}[hr](e,t){for(let n of this[Ee])try{Reflect.apply(n,{},[e,t])}catch(i){console.error(i.message,i)}typeof e.destroy=="function"&&Reflect.apply(e.destroy,e,[])}[St](e){e.post(t=>{let n=t.session.to,i=t.session.routeModel;if(i==null){let o={route:n,find:null};if(this[He](o))i=o.find,t.session.routeModel=i;else if(this[ke])i=this[ke];else{t.reject(`not find route model, path:${n.path??n.name}`);return}}let s=Xe.from(t.session);this[lr](n,i,s).then(o=>{this[k],t.resolve()},o=>{t.reject(o)})})}[Fe](e){if(e.length==0)return!0;let t=this[k],n=[];for(let i of e){let s=this[pt](t,i);s!=null&&n.push({...s,route:i})}if(n.length==0){let i="can not find view index";return this[L](i),!1}for(let i of n.reverse())this[se](t,{x:i.x,y:i.y},[i.route.index??0],!0);return!0}[pt](e,t){const n=t.root??Z;let i;for(let s=0;s<e.layers.length;s++){const o=e.layers[s];for(let a=o.views.length-1;a>=0;a--){const l=o.views[a];if(l[G]&&l[Ge]===n)return i={x:a,y:s},i}}return null}[or](e){return e.layers.length>0&&e.layers[0].views.length>0?e.layers[0].views[0]:null}[se](e,t,n=null,i=!0){if(t.y>=e.layers.length||t.x>=e.layers[t.y].views.length)return;let s=e.layers[t.y].views[t.x],o=!1,a=[],l=!1,u=[...s.slots.value];for(let c=u.length-1;c>=0;c--){let h=u[c];(!n||n.indexOf(h.index)!=-1)&&(h.route&&s[G]&&(this[de](h.route),h.active===!0&&h.route.opsType==E.Append&&(l=!0)),a.push(new B(s,h.index,t.y)),u.splice(c,1))}if(u.length==0)i?s.slots.value=u:e.layers[t.y].views.splice(t.x,1);else{if(l){let c=u.length-1,h=u[c];h.active=!0,h.route&&(h.route.active=h.active)}s.slots.value=u}e.layers[t.y].views.length==0&&(o=!0);let f=t.y+1;for(;f<e.layers.length;f++){let c=e.layers[f].views,h=[];for(let d=c.length-1;(o||a.length>0)&&d>=0;d--){let y=c[d];if(y[le]&&(o||B.include(a,y[le]))){let g=y.slots.value;for(let p=g.length-1;p>=0;p--){let m=g[p];m.route&&y[G]&&this[de](m.route),h.push(new B(y,m.index,f)),g.splice(p,1)}e.layers[f].views.splice(d,1)}}a=h,e.layers[f].views.length==0&&(o=!0)}}restore(e){if(!e||this[U].length==0){let t=this[k];if(t.layers.length>0){let n=t.layers[0].views;n.length>0&&(n[0].slots.value=[])}return this[w]=[],this[De](),Promise.resolve()}else return new Promise((n,i)=>{let s=null,o=!1;for(let a=0;a<e.length;a++){let l=e[a];this[ye].post(u=>{let f=this[bt](l);this[xt](f),this[St](f),this[Rt](f),f.wait((c,h)=>{s=c.session.to,o=c.session.redirect,u.resolve()},(c,h)=>{s=null,h!==null&&this[L](h),u.resolve()})})}this[ye].post(a=>{if(s&&o===!0){const l=$.clone(s,!0),u=new rr(l,this[Be]());this[A]?.replace(u)}a.resolve(),n()})})}[lr](e,t,n){let i=e.updateType??Je.Part;return this[ar](t).then(()=>{this[ur](t,e,n,i)})}[ar](e){let t=[];for(let n=0;n<e.layers.length;n++){let i=e.layers[n];for(let s=0;s<i.models.length;s++){let o=i.models[s];o.isResolved||t.push(o.resolve())}}return t.length>0?Promise.all(t):Promise.resolve()}[ur](e,t,n,i){if(e.layers[0].models.length!==1)return Promise.reject("illegal route structure(multi root node)");const s=e.layers[0].models[0];let o=this[k],a=An(o),l=t.root??Z,u;!a&&i==Je.Part&&(u=this[pt](o,t));let f,c=0;if(u==null||u==null)if(a||i===Je.All){if(o.layers.length==0&&(o.layers[0]=new ct),o.layers[0].views.length==0){let h=t.root??Z;f=new Se(h,!0,null),o.layers[0].views=[f]}else f=o.layers[0].views[0];u={x:0,y:0}}else{let h=t.slot;if(!h)return Promise.reject("can not rebuild view(because not route slot)");let d=h.level;if(d>o.layers.length)return Promise.reject("can not insert view(override level)");let y;if(h.rootName){let g=o.layers[d-1];for(let p of g.views){if(p[G]&&p.name===h.rootName){y=new B(p,h.rootIndex??0,d-1);break}if(p[J]&&p[J].view.name===h.rootName&&p[J].index===h.rootIndex){y=p[J];break}}}if(!y)return Promise.reject("can not insert view(not find root node ref)");f=new Se(l,!0,y),o.layers[d].views.push(f),u={x:o.layers[d].views.length-1,y:d}}else f=o.layers[u.y].views[u.x];if(c=u.y,f[G]=!0,t.opsType===E.Append){t.index=ie.get();let h=f.slots.value;if(h.length>0){let m=h[h.length-1];m.active=!1,m.route&&(m.route.active=m.active)}let d=new ee(t,s,t.index,!0);f.slots.value=[...h,d];let y=c+1,g=1,p=new B(f,t.index,c);this[te](o,y,e,g,p)}else if(t.opsType===E.Open){let h=f.slots.value,d=!1;for(let y of h){if(y.route!==null&&$.isSameForRouteModel(y.route,t)){if(y.active==!0)return t.index=y.index,t.active=y.active,y.route=t,Promise.resolve();y.active=!0,d=!0,t.index=y.index,t.active=y.active,y.route=t,this[de](y.route)}else y.active=!1;y.route&&(y.route.active=y.active)}if(!d){t.index=ie.get(),t.active=!0;let y=new ee(t,s,t.index,!0);h.push(y);let g=c+1,p=1,m=new B(f,t.index,c);this[te](o,g,e,p,m)}f.slots.value=[...h]}else{let h=f.slots.value;if(h.length==0){t.index=ie.get(),f.slots.value=[new ee(t,s,t.index)];let d=c+1,y=1,g=new B(f,t.index,c);this[te](o,d,e,y,g)}else{let d=h[0];if(d.model!==s){this[se](o,u,null,!0),t.index=ie.get(),f.slots.value=[new ee(t,s,t.index)];let y=c+1,g=1,p=new B(f,t.index,c);this[te](o,y,e,g,p)}else{d.route!==null&&this[de](d.route);let y=[];for(let T=1;T<h.length;T++)y.push(h[T].index);y.length>0&&this[se](o,u,y,!0),t.index=d.index,d.route=t;let g=[new B(f,t.index,c)],p=c+1,m=1,b=new B(f,t.index,c);for(;g.length>0&&p<o.layers.length&&m<e.layers.length;p++,m++){let T=[];for(let C=0;C<o.layers[p].views.length;C++){let R=o.layers[p].views[C];R[le]&&B.include(g,R[le])&&T.unshift(C)}let x=[];for(let C of T){let R=o.layers[p].views[C],q=e.layers[m].models,_;for(let K=0;K<q.length;K++)if(R.name===q[K].name){_=q[K];break}if(!_)this[se](o,{x:C,y:p},null,!1);else{let K=R.slots.value;if(K.length==0){let M=0;R.slots.value=[new ee(null,_,M)];let W=p+1,z=m+1;this[te](o,W,e,z,b)}else{let M=K[0];if(M.model!==_){this[se](o,{x:C,y:p},null,!0),R.slots.value=[new ee(null,_,0)];let W=p+1,z=m+1;this[te](o,W,e,z,b)}else{R[G]&&M.route!==null&&this[de](M.route);let W=[];for(let z=1;z<K.length;z++)W.push(K[z].index);W.length>0&&this[se](o,{x:C,y:p},W,!0),x.push(new B(R,M.index,p))}}R[G]=!1}}g=x}this[te](o,p,e,m,b)}}}if(f&&f[J]){let h=f[J];h&&(t.slot=new Zr(l,c,h?.view.name,h?.index??0))}n.to=void 0,n.routeModel=void 0,t.session=n,this[fr](t)}[te](e,t,n,i,s){let o=i,a=t;for(;a<e.layers.length&&o<n.layers.length;a++,o++){let l=e.layers[a].views;for(let u of n.layers[o].models){let f=new Se(u.name,!1,s),c=new ee(null,u);f.slots.value=[c],l.push(f)}}for(;o<n.layers.length;o++){let l=new ct;l.views=[];for(let u of n.layers[o].models){let f=new Se(u.name,!1,s),c=new ee(null,u);f.slots.value=[c],l.views.push(f)}e.layers.push(l)}}[gr](e,t,n,i,s,o){if(t<0||t>this[k].layers.length)return null;if(t<this[k].layers.length){let f=this[k].layers[t],c=null;for(let h of f.views){let d=!1;if(n!==null?(d=h.name===e&&h[J]?.view===n,d&&i!==-1&&(d=h[J]?.index===i)):d=h.name===e,!!d){s!==null&&(h[le]={view:s,index:o,level:t-1}),c=h;break}}if(c!==null)return c}let a=null,l=null;s!==null&&(s[G]?a={view:s,index:o,level:t-1}:a=s[J],l={view:s,index:o,level:t-1});let u=new Se(e,!0,a);if(u[le]=l,t==this[k].layers.length){let f=new ct;f.views=[u],this[k].layers.push(f)}else this[k].layers[t].views.push(u);return u}}const jn="fox-router-view",Tn="fox-router-link";function Er(r,e=!1){let t=null;return e?t=r.showFromClass??r.enterFromClass:t=r.enterFromClass,t||(t=r.transitionName,t?e?`${t}-show-from`:`${t}-enter-from`:null)}function Fr(r,e=!1){let t=null;return e?t=r.showActiveClass??r.enterActiveClass:t=r.enterActiveClass,t||(t=r.transitionName,t?e?`${t}-show-active`:`${t}-enter-active`:null)}function _n(r,e=!1){let t=null;return e?t=r.showToClass??r.enterToClass:t=r.enterToClass,t||(t=r.transitionName,t?e?`${t}-show-to`:`${t}-enter-to`:null)}function Kn(r,e=!1){let t=null;return e?t=r.hideFromClass??r.leaveFromClass:t=r.leaveFromClass,t||(t=r.transitionName,t?e?`${t}-hide-from`:`${t}-leave-from`:null)}function $n(r,e=!1){let t=null;return e?t=r.hideActiveClass??r.leaveActiveClass:t=r.leaveActiveClass,t||(t=r.transitionName,t?e?`${t}-hide-active`:`${t}-leave-active`:null)}function qn(r,e=!1){let t=null;return e?t=r.hideToClass??r.leaveToClass:t=r.leaveToClass,t||(t=r.transitionName,t?e?`${t}-hide-to`:`${t}-leave-to`:null)}function On(r,e=!1){let t=null;return e?t=r.beforeShow??r.beforeEnter:t=r.beforeEnter,t}function Ln(r,e=!1){let t=null;return e?t=r.show??r.enter:t=r.enter,t}function Mn(r,e=!1){let t=null;return e?t=r.afterShow??r.afterEnter:t=r.afterEnter,t}function Nn(r,e=!1){let t=null;return e?t=r.showCancelled??r.enterCancelled:t=r.enterCancelled,t}function In(r,e=!1){let t=null;return e?t=r.hide??r.leave:t=r.leave,t}function Hn(r,e=!1){let t=null;return e?t=r.afterHide??r.afterLeave:t=r.afterLeave,t}function Dn(r,e=!1){let t=null;return e?t=r.hideCancelled??r.leaveCancelled:t=r.leaveCancelled,t}function Dt(r){let e,t=r.duration;return typeof t=="object"?e={enter:t.enter??-1,leave:t.leave??-1,show:t.show??-1,hide:t.hide??-1}:(typeof t=="string"&&(t=t.length==0?-1:Number(t)),e={enter:t,leave:t,show:t,hide:t}),e}function ge(r,e){r.classList.contains(e)||r.classList.add(e)}function we(r,e){r.classList.remove(e)}const Vn=qe&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout;function Vt(r){Vn(r)}function D(r,e,t){P(e)&&(r==null&&(r={}),Reflect.apply(e,r,t))}function jr(r,e,t,n=-1,i,s,o,a){if(P(s)){if(i!==void 0&&i>=0){setTimeout(()=>{Reflect.apply(s,r,[e,t,n]),P(a)&&Reflect.apply(a,r,[])},i);return}const l=["animationend","transitionend"],u=f=>{l.forEach(c=>{qt(e,c,u)}),Reflect.apply(s,r,[e,t,n]),a&&Reflect.apply(a,r,[])};l.forEach(f=>{$t(e,f,u)})}if(P(o)){const l="animationcancel",u=f=>{Reflect.apply(o,r,[e,t,n]),qt(e,l,u)};$t(e,l,u)}}function Bt(r){return!qe||r===null?!1:r.opsType===E.Append||r.opsType===E.Open}function Tr(r,e,t,n={},i,s=-1){if(e||Bt(i)){const o=Er(n,e);o&&ge(t,o);const a=Fr(n,e);a&&ge(t,a);const l=On(n,e);D(r,l,[t,e,i,s])}}function _r(r,e,t,n={},i,s,o,a){if(!Bt(s)&&!e){P(a)&&a(r,a,[t]);return}const l=Er(n,e),u=Fr(n,e),f=_n(n,e),c=Ln(n,e),h=Mn(n,e),d=Nn(n,e);Vt(()=>{jr(r,t,s,o,i,()=>{u&&we(t,u),f&&we(t,f),P(h)&&D(r,h,[t,e,s,o]),P(a)&&a(r,a,[t])},()=>{P(d)&&D(r,d,[t,e,s,o])}),l&&we(t,l),f&&ge(t,f),P(c)&&D(r,c,[t,e,s,o])})}function Kr(r,e,t,n={},i,s,o,a,l){if(!Bt(o)&&!e){!e&&P(s)&&s();return}const u=Kn(n,e),f=$n(n,e),c=qn(n,e),h=In(n,e),d=Hn(n,e),y=Dn(n,e);u&&ge(t,u),f&&ge(t,f),P(h)&&D(r,h,[t,e,o,a]),Vt(()=>{jr(r,t,o,a,i,()=>{f&&we(t,f),c&&we(t,c),P(d)&&D(r,d,[t,e,o,a]),P(l)&&D(r,l,[t]),!e&&P(s)&&s()},()=>{P(y)&&D(r,y,[t,e,o,a]),P(l)&&D(r,l,[t]),!e&&P(s)&&s()}),u&&we(t,u),c&&ge(t,c)})}function Ot(r,e={},t,n=-1){const i=e.mode??"default",s=Dt(e);return{mode:i,persisted:!1,beforeEnter:a=>{Tr(r,!1,a,e,t,n)},enter:a=>{_r(r,!1,a,e,s.enter,t,n)},leave:(a,l)=>{Kr(r,!1,a,e,s.leave,l,t,n)},clone:a=>Ot(r,e,t,n)}}function $r(r){return r.el}function Bn(r,e,t={},n,i,s,o){if(s){const a=$r(e);if(a==null)return;const l=Dt(t);Tr(r,!0,a,t,n,i),_r(r,!0,a,t,l.show,n,i,u=>{P(o)&&D(r,o,[u])})}else P(o)&&D(r,o,[])}function Un(r,e,t={},n,i,s,o){if(s){const a=$r(e);if(a==null)return;const l=Dt(t);Kr(r,!0,a,t,l.hide,null,n,i,u=>{P(o)&&D(r,o,[u])})}else P(o)&&D(r,o,[])}function kn(r,e={}){Vt(()=>{for(let t=0;t<r.length;t++)Reflect.apply(r[t],e,[])})}function re(r,e,t){return typeof r=="function"?Reflect.apply(r,{},[e,t]):r}function Pt(r,e){if(!r)return null;const t=r(e);return t.length===1?t[0]:t}class Wn{node;state;constructor(e,t){this.node=e,this.state=t}}const Lt=v.defineComponent({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,required:!1,default:"default"},modelSlot:{type:[Object],required:!1},multi:{type:Boolean,required:!1,default:!1},tag:{type:[String,Object,Function],required:!1,default:"div"},viewTag:{type:[String,Object,Function],required:!1,default:"div"},viewTagProps:{type:[Object,Function],required:!1,default(){return{}}},viewClass:{type:[String,Function],required:!1},viewActiveClass:{type:[String,Function],required:!1},viewInactiveClass:{type:[String,Function],required:!1},transition:{type:[Boolean,String,Function],required:!1,default:!1},transitionName:{type:String,required:!1},enterFromClass:{type:String,required:!1},enterActiveClass:{type:String,required:!1},enterToClass:{type:String,required:!1},leaveFromClass:{type:String,required:!1},leaveActiveClass:{type:String,required:!1},leaveToClass:{type:String,required:!1},showFromClass:{type:String,required:!1},showActiveClass:{type:String,required:!1},showToClass:{type:String,required:!1},hideFromClass:{type:String,required:!1},hideActiveClass:{type:String,required:!1},hideToClass:{type:String,required:!1},beforeEnter:{type:Function,required:!1},enter:{type:Function,required:!1},afterEnter:{type:Function,required:!1},enterCancelled:{type:Function,required:!1},beforeLeave:{type:Function,required:!1},leave:{type:Function,required:!1},afterLeave:{type:Function,required:!1},leaveCancelled:{type:Function,required:!1},beforeShow:{type:Function,required:!1},show:{type:Function,required:!1},afterShow:{type:Function,required:!1},showCancelled:{type:Function,required:!1},beforeHide:{type:Function,required:!1},hide:{type:Function,required:!1},afterHide:{type:Function,required:!1},hideCancelled:{type:Function,required:!1}},setup(r,e){const t=v.getCurrentInstance();if(t===null||t.proxy===null){console.error("instance or instance.proxy not exist");return}const n=r.multi===!0,i=v.inject(et,null),s=v.inject(at,0),o=v.inject(er,null),a=v.inject(ut,-1);let l=null;const u=r.modelSlot;if(u){v.provide(at,s+1),v.provide(ut,u.index),v.provide(ft,u.index);const c=u.route;if(!c){console.warn("child view render error, route not exist");return}const h=ze(t.proxy,!0);nn(h),lt(h,c)}else{if(i==null){console.error("router is not been injected");return}const c=r.name,h=v.inject(tr,null),d=v.inject(ft,0);if(l=i[gr](c,s,o,a,h,d),l===null)return;if(v.provide(tr,l),l[G]===!0&&v.provide(er,l),!n){v.provide(ut,-1),v.provide(at,s+1),v.provide(ft,-1);const g=l.slots.value;if(g.length>0){const p=g[0].route;if(p){const m=ze(t.proxy,!0);lt(m,p)}}else{const p=ze(t.proxy,!0);l.compensation=()=>{const m=l.slots.value;if(m.length>0){const b=m[0].route;return b&<(p,b),!0}return!1}}}}const f={value:new Map};return v.onUnmounted(()=>{f.value&&f.value.clear()}),()=>{if(n){const c=new Map,h=[],d=l?.slots.value,y=[];for(let m=0;m<d.length;m++){const b=d[m],T=`${r.name}-${b.index}`,x=re(r.transition,b.route,m)??!0,C={modelSlot:b};let R;e.slots.default?R=v.h(Lt,C,{default:e.slots.default}):R=v.h(Lt,C);const q={},_=re(r.viewClass,b.route,m);typeof _=="string"&&_.length>0&&(q[_]=!0);const K=re(r.viewActiveClass,b.route,m),M=re(r.viewInactiveClass,b.route,m),W=f.value.get(T);if(typeof K=="string"&&K.length>0&&(q[K]=b.active),typeof M=="string"&&M.length>0&&(q[M]=!b.active),W&&b.active!==W.state){const ue=W.node;b.active?y.unshift(()=>{const nt=()=>{let be=Yt(ue);be!=null&&Zt(be,_t.ACTIVATED)};Bn(t,ue,r,b.route,m,x,nt)}):y.push(()=>{const nt=()=>{const be=Yt(ue);be!=null&&Zt(be,_t.DEACTIVATED)};Un(t,ue,r,b.route,m,x,nt)})}const z={class:q,key:T},tt=re(r.viewTagProps,b.route,m);tt!==null&&typeof tt=="object"&&j(!0,z,tt),b.route?.viewTagAttrs&&typeof b.route?.viewTagAttrs=="object"&&j(!0,z,b.route.viewTagAttrs);const Or=re(r.viewTag,b.route,m),rt=v.h(Or,z,{default:()=>[R]});if(c.set(T,new Wn(rt,b.active)),f.value.delete(T),x){const ue=Ot(t,r,b.route,m);rt.transition=ue}h.push(rt)}f.value.forEach(m=>{m.node.transition=null}),f.value=c,kn(y,t);const g=re(r.tag,null,-1),p={};return Object.assign(p,e.attrs),v.h(g,p,{default:()=>h})}else if(u!=null){const c=u.model,h={};c.props&&(typeof c.props=="object"?j(!1,h,c.props):c.props===!0&&typeof u.route?.params=="object"&&j(!1,h,u.route?.params));const d=v.h(c.component,h);return Pt(e.slots.default,{Component:d,route:u.route})??d}else{const c=l.slots.value;if(c.length>0){const h=c[0],d=h.model,y={};d.props&&(typeof d.props=="object"?j(!1,y,d.props):d.props===!0&&typeof h.route?.params=="object"&&j(!1,y,h.route?.params));const g=v.h(d.component,y);if(re(r.transition,h.route,-1)??!0){const m=Ot(t,r,h.route,-1);g.transition=m}return Pt(e.slots.default,{Component:g,route:h.route})??g}else return Pt(e.slots.fallback,{})}}}});function zn(r){if(!(r.metaKey||r.altKey||r.ctrlKey||r.shiftKey)&&!r.defaultPrevented&&!(r.button!=null&&r.button!==0)){if(r.currentTarget&&r.currentTarget.getAttribute){const e=r.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return r.preventDefault&&r.preventDefault(),!0}}function Jn(r,e){return r==null||e==null?!1:!!(r===e||r.path&&r.path===e.path||r.name&&r.name===e.name)}function Gn(r,e){return r==null||e==null?!1:!!(r.path&&e.path&&e.path.startsWith(r.path)||r.name&&r.name==e.name)}function pe(r,e){return typeof r=="function"?Reflect.apply(r,{},[e]):r}let Qn=v.defineComponent({name:"RouterLink",inheritAttrs:!1,props:{tag:{type:[String,Object,Function],required:!1,default:"a"},to:{type:[String,Object,Function],required:!0},root:{type:String},activeClass:{type:[String,Function],required:!1,default:"fox-router-link-active"},exact:{type:[String,Boolean,Function],required:!1},exactActiveClass:{type:[String,Function],required:!1,default:"fox-router-link-exact-active"},event:{type:[String,Function],required:!1,default:"onClick"}},setup(r,e){const t=v.inject(et,null);return()=>{let n=pe(r.to,null),i=pe(r.tag,n);if(i==null){console.warn("can not resolve link tag");return}let s=null,o=null;t!==null&&(s=t[H](n),r.root&&(s.root=r.root),o=t.current);let a={},l=pe(r.activeClass,s);if(typeof l=="string"&&l.length>0&&(a[l]=Gn(s,o)),pe(r.exact,s)===!0){let h=pe(r.exactActiveClass,s);typeof h=="string"&&h.length>0&&(a[h]=Jn(s,o))}let f={class:a};(i==="a"||i==="A")&&(f.href=s?.path??s?.name??"#"),j(!0,f,e.attrs);let c=pe(r.event,s);if(typeof c=="string"){const h=d=>{if(t==null){console.warn("router is not been injected");return}if(s==null){console.warn("route is not been resolved");return}zn(d)&&t.to(s)};f[c]=h}return v.h(i,f,e.slots)}}});var O=(r=>(r[r.Loading=0]="Loading",r[r.Loaded=1]="Loaded",r[r.Defining=2]="Defining",r[r.Defined=3]="Defined",r))(O||{}),Qe=(r=>(r[r.normal=0]="normal",r[r.factory=1]="factory",r))(Qe||{});class Xn{register=new Map;constructor(){}get(e){return this.register.get(e)??null}set(e,t){this.register.set(e,t)}remove(e){let t=this.register.get(e);return this.register.delete(e),t??null}has(e){return this.register.has(e)}clear(){this.register.clear()}}class dr{moduleManager=new Xn;options={paths:{},alias:{},nature:[],timeout:3e3};set paths(e){this.options.paths=e}get paths(){return this.options.paths}set alias(e){this.options.alias=e}get alias(){return this.options.alias}set naturePaths(e){this.options.nature=e}get naturePaths(){return this.options.nature}set timeout(e){this.options.timeout=e}get timeout(){return this.options.timeout}_query;set query(e){this._query=e}get query(){return this._query}get head(){return Le().head}constructor(){}setModule(e,t){const n={id:e,src:"",status:O.Defined};typeof t=="function"?(n.exports=t,n.type=Qe.factory):n.exports=t,this.moduleManager.set(e,n)}removeModule(e){this.moduleManager.remove(e)}ensure(...e){const t=[];let n=e.length-1;const i={};typeof e[n]=="object"&&(Object.assign(i,e[n]),n--);let s=null;typeof e[n]=="function"&&(s=e[n],n--);for(let l=0;l<=n;l++)if(Array.isArray(e[l])){let u=e[l];for(let f=0;f<u.length;f++)u[f]&&t.push(this.resolvePath(u[f]))}else if(typeof e[l]=="string"){let u=e[l].split(",");for(let f=0;f<u.length;f++)u[f]&&t.push(this.resolvePath(u[f]))}const o=new Yn(t.length,(l,u)=>{if(o.isOK())try{typeof s=="function"&&Reflect.apply(s,{},u)}catch(f){console.error(f.message,f)}else try{console.error(l),typeof s=="function"&&Reflect.apply(s,{},[])}catch(f){console.error(f.message,f)}}),a=new $e;for(let l=0;l<t.length;l++){const u=new Zn(l,t[l],i,o);this.mount(a,u)}return this}remove(...e){let t=[],n=e.length-1,i={};typeof e[n]=="object"&&(Object.assign(i,e[n]),n--);let s=null;typeof e[n]=="function"&&(s=e[n],n--);for(let o=0;o<=n;o++)if(Array.isArray(e[o])){let a=e[o];for(let l=0;l<a.length;l++)a[l]&&t.push(this.resolvePath(a[l]))}else{let a=e[o].split(",");for(let l=0;l<a.length;l++)a[l]&&t.push(this.resolvePath(a[l]))}return t.forEach(o=>{this.unmount(o,i)}),typeof s=="function"&&Reflect.apply(s,{},[]),this}mount(e,t){if(this.isNaturePath(t.src)){let i=t.params.jsPoint;i||(i=this.head),this.mountJS(e,t,i);return}else if(this.isNaturePath(t.src)){let i=t.params.cssPoint;i||(i=this.head),this.mountCSS(e,t,i);return}let n=this.getFileNamePostfix(t.src);if(n==="js"||n.length===0){let i=t.params.jsPoint;i||(i=this.head),this.mountJS(e,t,i);return}else if(n==="css"){let i=t.params.cssPoint;i||(i=this.head),this.mountCSS(e,t,i);return}}mountCSS(e,t,n){e.post(i=>{const s=t.src,o=this.moduleManager.get(s);if(o&&(o.status==O.Defined||o.status==O.Loaded)&&o.exports){o.type===Qe.factory&&typeof o.exports=="function"?t.progress.work(!0,t.index,o.exports()):t.progress.work(!0,t.index,o.exports),i.resolve();return}const a=Le(),l=a.createElement("link");if(Reflect.has(l,"onload"))l.onload=()=>{l.onload=null,l.onerror=null,t.progress.work(!0,t.index,t.src),i.resolve()},l.onerror=()=>{try{n.removeChild(l)}catch(c){console.error(c.message,c)}l.onload=null,l.onerror=null,t.progress.work(!1,t.index,null),i.reject()};else{const c={timeout:this.options.timeout??3e3,time:0,success:()=>{t.progress.work(!0,t.index,t.src),i.resolve()},error:()=>{try{n.removeChild(l)}catch(h){console.error(h.message,h)}t.progress.work(!1,t.index,null),i.resolve()}};setTimeout(()=>{qr(l,c)},1)}let f=a.getElementById(s);f&&f.parentNode&&f.parentNode.removeChild(f),l.rel="stylesheet",l.type="text/css",l.id=s,l.href=s,n.appendChild(l)})}mountJS(e,t,n){e.post(i=>{const s=t.src;if(s==="exports"){const c={exports:{},id:s,src:s,status:O.Loading};t.progress.work(!0,t.index,c.exports),i.resolve();return}else if(s==="module"){const c={exports:{},id:s,src:s,status:O.Loading};t.progress.work(!0,t.index,c),i.resolve();return}let o=this.moduleManager.get(s);if(o&&(o.status==O.Defined||o.status==O.Loaded)){if(o.exports){o.type===Qe.factory&&typeof o.exports=="function"?t.progress.work(!0,t.index,o.exports()):t.progress.work(!0,t.index,o.exports),i.resolve();return}if(document.querySelector(`script[src='${s}`)){t.progress.work(!0,t.index,o.exports),i.resolve();return}}o={id:s,src:s,status:O.Loading},this.moduleManager.set(s,o);const l=Le().createElement("script");if("onload"in l)l.onload=()=>{l.onload=null,l.onerror=null,o.status==O.Loading&&(o.status=O.Loaded,t.progress.work(!0,t.index,s)),i.resolve()},l.onerror=()=>{try{n.removeChild(l)}catch(c){console.error(c.message,c)}l.onload=null,l.onerror=null,this.moduleManager.remove(s),t.progress.work(!1,t.index,null),i.resolve()};else{const c=l;c.onreadystatechange=()=>{/loaded|complete/.test(c.readyState)&&(c.onreadystatechange=null,o.status==O.Loading&&(o.status=O.Loaded,t.progress.work(!0,t.index,s)),i.resolve())}}l.defer=!0,l.src=s;const f=N();f.define=this.createDefine(o,t),n.appendChild(l)})}unmount(e,t={}){const n=Le(),i=this.getFileNamePostfix(e);if(i==="js"||i.length===0){const s=n.querySelector(`script[src="${e}"]`);s&&s.parentNode&&s.parentNode.removeChild(s),this.moduleManager.remove(e);return}else if(i==="css"){const s=n.querySelector(`style[href="${e}"]`);s&&s.parentNode&&s.parentNode.removeChild(s);return}}trimEmptyElement(e){let t=[];for(let n=0;n<e.length;n++){if(e[n]===void 0||e[n]===null)continue;const i=e[n].trim();i.length!==0&&t.push(i)}return t}createDefine(e,t){const n=this,i=function(...s){e.status=O.Defining;let o,a,l,u=s.length;u===1?(l=s[0],o=void 0):u===2?(l=s[1],Array.isArray(s[0])?(a=n.trimEmptyElement(s[0]),o=void 0):a=void 0):(o=s[0],a=n.trimEmptyElement(s[1]),l=s[2]),o&&(e.id=o,n.options.alias[o]=e.src),a&&a.length>0?n.ensure(a,(...f)=>{if(typeof l=="function"){const c=Reflect.apply(l,e,f);c&&typeof c=="object"&&(e.exports=c)}else e.exports=l;e.status=O.Defined,t.progress.work(!0,t.index,e.exports)}):(typeof l=="function"?e.exports=Reflect.apply(l,e,[]):e.exports=l,e.status=O.Defined,t.progress.work(!0,t.index,e.exports))};return i.amd=!0,i}resolvePath(e){try{if(this.isNaturePath(e))return e;e=this.parserPath(e,!0);let t=this.getFileNamePostfix(e);t=t.toLowerCase();let n=this.createSearch(this.query);return e.indexOf("?")==-1?(t!=="js"&&t!=="css"&&(e+=".js"),n.length>0&&(e+=`?${n}`)):n.length>0&&(e+=`&${n}`),e}catch(t){throw console.error(`resolve path[${e}] fail`,t),t}}createSearch(e){let t="";if(e){for(let n in e){let i=`${e[n]}`;t+=`${encodeURIComponent(n)}=${encodeURIComponent(i)}&`}t.length>0&&(t=t.substring(0,t.length-1))}return t}getFileNamePostfix(e){let t=e.lastIndexOf("?");t==-1&&(t=e.length);let n=e.lastIndexOf(".",t);return n==-1?"":e.substring(n+1,t)}isNaturePath(e){if(!this.options.nature)return!1;if(typeof this.options.nature=="function")return this.options.nature(e);const t=this.options.nature;if(t&&Array.isArray(t))for(let n=0;n<t.length;n++){const i=t[n];if(e.indexOf(i)===0)return!0}return!1}parserPath(e,t){if(e.indexOf("http://")==0||e.indexOf("https://")==0||e.indexOf("file:///")==0)return e;if(e.indexOf("/")==0)return`${ht()}${e.slice(1)}`;if(e.indexOf("./")==0)return`${ht()}${e.slice(2)}`;if(e.indexOf("//")==0)return`${N().location.protocol}${e}`;if(t){let i=this.options.alias[e];if(!i){let s=e.indexOf("/");if(s==-1)i=e;else{let o=e.slice(0,s),a=this.options.paths[o];a?i=a+e.slice(s):i=e}}return this.parserPath(i,!1)}return`${ht()}${e}`}}function qr(r,e){let t=r.sheet,n=!1;if(e.isOldWebKit)t&&(n=!0);else if(t)try{t.cssRules&&(n=!0)}catch(i){i.name==="NS_ERROR_DOM_SECURITY_ERR"&&(n=!0)}setTimeout(()=>{e.time+=20,n?e.success():e.timeout>e.timeout?e.error():qr(r,e)},20)}class Yn{callback;values;status;size;lastIndex;constructor(e,t){this.size=e,this.callback=t,this.status=!0,this.values=[],this.lastIndex=-1}work(e,t,n){if(this.status=e,this.status===!0&&(this.lastIndex!==t&&this.size--,this.lastIndex=t,this.values.push(n)),this.size===0||this.status===!1)try{Reflect.apply(this.callback,this,[this.status,this.values])}catch(i){console.error(i.message,i)}}isOK(){return this.status}}class Zn{index;src;params;progress;constructor(e,t,n,i){this.index=e,this.src=t,this.params=n,this.progress=i}}const Ut=Symbol("fk"),kt=Symbol("fbk"),Wt=Symbol("fepk");function ei(r={}){const e=new Fn(r),t=new Ft,n=new jt,i=new dr,s={get router(){return e},get bus(){return t},get Bus(){return Ft},get EventProxy(){return jt},get eventproxy(){return n},get EventChain(){return $e},get Require(){return dr},get require(){return i},get extend(){return j},get clone(){return _e},install(o){o.provide(et,e),o.provide(Ut,s),o.provide(kt,t),o.provide(Wt,n),o.component(jn,Lt),o.component(Tn,Qn),Reflect.defineProperty(o.config.globalProperties,"$fox",{get(){return s}}),Reflect.defineProperty(o.config.globalProperties,"$router",{get(){return e}}),Reflect.defineProperty(o.config.globalProperties,"$bus",{get(){return t}}),Reflect.defineProperty(o.config.globalProperties,"$bus",{get(){return t}}),Reflect.defineProperty(o.config.globalProperties,"$eventProxy",{get(){return n}}),o.config.globalProperties.$fox_on=function(a,l,u=!1){n.on(a,l,u)},o.config.globalProperties.$fox_off=function(a,l){n.off(a,l)},o.config.globalProperties.$fox_once=function(a,l){n.once(a,l)},o.config.globalProperties.$fox_all=function(...a){let l=n;Reflect.apply(l.all,l,a)},o.config.globalProperties.$fox_trigger=function(a,...l){let u=n;Reflect.apply(u.trigger,u,[a,...l])},o.config.globalProperties.$fox_emit=function(a,...l){let u=n;Reflect.apply(u.trigger,u,[a,...l])},o.mixin({computed:{$route(){return xr(this)}}}),e.init()}};return s}function zt(r){return r?r.$router:v.inject(et)}function ti(r){return r||(r=v.getCurrentInstance()?.proxy??void 0),r?xr(r):null}function ri(r){return r?r.$fox:v.inject(Ut)}function ni(r){return r?r.$bus:v.inject(kt)}function ii(r){return r?r.$eventProxy:v.inject(Wt)}function si(r){const e=zt(),t=(n,i,s)=>{try{Reflect.apply(r,{},[n,i])}catch(o){console.error(o)}s()};e.beforeEach(t),v.onUnmounted(()=>{e.removeBeforeEach(t)})}function oi(r){const e=zt(),t=(n,i,s)=>{try{Reflect.apply(r,{},[n,i])}catch(o){console.error(o)}s()};e.afterEach(t),v.onUnmounted(()=>{e.removeAfterEach(t)})}exports.Bus=Ft;exports.EventChain=$e;exports.EventProxy=jt;exports.Route=$;exports.clone=_e;exports.createFox=ei;exports.createMemoryHistory=Ar;exports.createWebHashHistory=Cr;exports.createWebHistory=Pn;exports.extend=j;exports.foxBusKey=kt;exports.foxEventProxyKey=Wt;exports.foxKey=Ut;exports.isArray=Lr;exports.isDate=Ir;exports.isESModule=pr;exports.isEqual=Et;exports.isFunction=P;exports.isMap=Mr;exports.isObject=yr;exports.isPlainObject=Ct;exports.isPromise=Vr;exports.isSet=Nr;exports.isString=Hr;exports.isSymbol=Dr;exports.onAfterRouteUpdate=oi;exports.onBeforeRouteUpdate=si;exports.onFoxActivated=an;exports.onFoxInactivated=un;exports.sessionKey=ne;exports.toBoolean=Mt;exports.toNumber=Wr;exports.toTypeString=Ze;exports.typeOf=At;exports.useBus=ni;exports.useEventProxy=ii;exports.useFox=ri;exports.useRoute=ti;exports.useRouter=zt;
|
|
2
|
+
* fox v3.0.0 Mon Jan 30 2023 14:33:59 GMT+0800 (中国标准时间)
|
|
3
|
+
*/Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("vue"),Lr=Array.isArray,Mr=r=>Ze(r)==="[object Map]",Ir=r=>Ze(r)==="[object Set]",Nr=r=>r instanceof Date,P=r=>typeof r=="function",Hr=r=>typeof r=="string",Dr=r=>typeof r=="symbol",pr=r=>r!==null&&typeof r=="object",Vr=r=>pr(r)&&P(r.then)&&P(r.catch),Br=Object.prototype.toString,Ze=r=>Br.call(r),Ct=r=>Ze(r)==="[object Object]",Ur=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol";function Mt(r){return r.__esModule||Ur&&r[Symbol.toStringTag]==="Module"}const kr=typeof Promise<"u"&&Promise.toString().indexOf("[native code]")!==-1;function j(...r){let e=r[0]!==void 0&&r[0]!==null?r[0]:{},t=1,n=r.length,i=!1;for(typeof e=="boolean"&&(i=e,e=r[t]??{},t++),typeof e!="object"&&(e={});t<n;t++)if(r[t]!==null&&r[t]!==void 0){let s=r[t];for(let o in s){let a=e[o],l=s[o];if(a!==l)if(i===!0&&l&&typeof l=="object"){let u;Array.isArray(l)?u=a&&Array.isArray(a)?a:[]:u=a&&typeof a=="object"?a:{},e[o]=j(i,u,l)}else l!==void 0&&(e[o]=l)}}return e}function _e(r,e,t=!1){if(!t)j(!0,r,e);else{if(typeof e!="object")return{};typeof r!="object"&&(r={});for(let i in e){let s=r[i],o=e[i];if(s!==o)if(typeof o=="object"){if(!Array.isArray(o)&&!Ct(o))continue;s=_e(s,o,t),r[i]=s}else{if(typeof o=="function")continue;r[i]=o}}const n=Object.getOwnPropertySymbols(e);for(let i of n){let s=r[i],o=e[i];if(s!==o)if(typeof o=="object"){if(!Array.isArray(o)&&!Ct(o))continue;s=_e(s,o,t),r[i]=s}else{if(typeof o=="function")continue;r[i]=o}}}return r}class ie{static seed=new Date().getTime();static get(){let e=++ie.seed;return e>=Number.MAX_VALUE&&(ie.seed=0),e}}const it=kr?Promise.resolve():null;function Te(r,...e){it!==null?e&&e.length>0?it.then(()=>{r(e)}):it.then(r):e&&e.length>0?setTimeout(()=>{r(e)}):setTimeout(r)}function It(r){return r==null?!1:typeof r=="boolean"?r:typeof r=="string"?r.toLocaleLowerCase()==="true":Boolean(r)}function Wr(r){return typeof r=="number"?r:Number(r)}const zr={"[object Boolean]":"boolean","[object Number]":"number","[object String]":"string","[object Function]":"function","[object Array]":"array","[object Date]":"date","[object RegExp]":"regExp","[object Object]":"object"};function At(r){let t=Object.prototype.toString.call(r);return r==null?String(r):zr[t]||"object"}function Et(r,e){if(r==e)return!0;if(r===void 0||e===void 0)return!1;let t=At(r),n=At(e);if(t!==n)return!1;if(t==="object"){let i=Object.keys(r),s=Object.keys(e);if(i.length!==s.length)return!1;for(let o=0;o<i.length;o++){let a=i[o],l=r[a],u=e[a];if(!Et(l,u))return!1}return!0}else if(t==="array"){if(r.length!==e.length)return!1;for(let i=0;i<r.length;i++){let s=r[i],o=e[i];if(!Et(s,o))return!1}return!0}return!1}const Gt=Symbol("idKey"),ae=Symbol("valueKey"),S=Symbol("childrenKey"),Q=Symbol("growKey");class mr{[Q]=!0;[Gt];[ae]=v.ref();[S]=new Map;constructor(e){this[Gt]=e}}class Jr{get(e,t){if(t=="value")return e[ae].value;if(t==="grow")return e[Q];let n=e[S].get(t);if(n)return Ke(n);if(e[Q])return n=Ht(t),n[Q]=e[Q],e[S].set(t,n),Ke(n)}set(e,t,n){return t=="value"?(e[ae].value=n,!0):t==="grow"?(e[Q]=It(n),!0):n==null?(e[S].delete(t),!0):(console.error(`illegal property:${t}`),!1)}deleteProperty(e,t){return t==="value"||t=="grow"?(console.error(`can not delete property:${String(t)}`),!1):(e[S].delete(t),!0)}}const Nt="__proxy__";function Ht(r){let e=new mr(r);return Reflect.set(e,Nt,new Proxy(e,new Jr)),e}function Ke(r){return Reflect.get(r,Nt)}class vr extends mr{constructor(){super("__root__")}put(...e){let t=e.length;if(t<2)return console.error("参数至少包括一个(key, value)"),!1;let n=this;for(let i=0;i<t-1;i++){let s=e[i],o;n[S].has(s)?o=n[S].get(s):(o=Ht(s),n[S].set(s,o)),n=o}return n[ae].value=e[t-1],!0}get(...e){let t=e.length;if(t===0)return;let n=this;for(let i=0;i<t;i++){let s=e[i];if(n[S].has(s))n=n[S].get(s);else return}return n[ae].value}remove(...e){let t=e.length;if(t==0)return!1;let n=this;for(let s=0;s<t-1;s++){let o=e[s];if(n[S].has(o))n=n[S].get(o);else return!1}let i=e[t-1];return n[S].has(i)?(n[S].delete(i),!0):!1}contains(...e){let t=e.length;if(t==0)return!1;let n=this;for(let s=0;s<t-1;s++){let o=e[s];if(n[S].has(o))n=n[S].get(o);else return!1}let i=e[t-1];return n[S].has(i)}clear(){this[S].clear()}}const Gr=["put","get","contains","remove","clear"];function Qt(r){return Gr.includes(r)}class Qr{get(e,t){if(t=="value")return e[ae].value;if(t==="grow")return e[Q];if(t===S)return e[S];if(typeof t=="string"&&Qt(t))return e[t];let n=String(t),i=e[S].get(n);if(i)return Ke(i);if(e[Q])return i=Ht(n),i[Q]=e[Q],e[S].set(n,i),Ke(i)}set(e,t,n){return t=="value"?(e[ae].value=n,!0):t==="grow"?(e[Q]=It(n),!0):Qt(t)?!1:n==null?(e[S].delete(t),!0):(console.error(`illegal property:${t}`),!1)}deleteProperty(e,t){return t==="value"||t=="grow"?(console.error(`can not delete property:${String(t)}`),!1):(e[S].delete(t),!0)}}function Xr(){let r=new vr,e=new Qr,t=new Proxy(r,e);return Object.assign({put(...i){return Reflect.apply(r.put,r,i)},get(...i){return Reflect.apply(r.get,r,i)},remove(...i){return Reflect.apply(r.remove,r,i)},contains(...i){return Reflect.apply(r.contains,r,i)},clear(){return Reflect.apply(r.clear,r,[])}},t),Reflect.set(r,Nt,t),r}let Ft=new Proxy(vr,{construct(r,...e){let t=Xr();return Ke(t)}});const Z="default",gr=Symbol("sync"),H=Symbol("resolveRoute");function Xt(r){let e=!1;return function(...t){if(!e)return e=!0,Reflect.apply(r,{},t)}}function Yr(r){let e=r.src;return new Promise((t,n)=>{const i=Xt(a=>{Mt(a)&&(a=a.default),r.component=a,console.debug("success load async module"),t()}),s=Xt(a=>{console.debug("reject load async module"),n(a)});let o;try{o=e(i,s)}catch(a){s(a)}if(o)if(typeof o.then=="function")o.then(i,s);else{const a=o.component;a&&typeof a.then=="function"&&a.then(i,s)}})}class Zr{name;level;rootName;rootIndex=0;constructor(e,t,n,i){this.name=e,this.level=t,this.rootName=n,this.rootIndex=i}}class Xe{to;routeModel;from;data={};constructor(e,t){this.to=e,this.from=t}static from(e){let t=new Xe(e.to,e.from),n=e.data??{};return j(!0,t.data,n),t}}class ${path;get fullPath(){const e=this.path??`/${this.name}`;return`${this.root??Z}!${e}`}name;root;params;query;matched;meta;success;error;destroy;opsType;updateType;viewTagAttrs;index;active;slot;session;static clone(e,t){let n=new $;return _e(n,e,t),n}static isSame(e,t){return e===t?!0:!(e==null||t==null||e.path&&e.path!==t.path||e.name&&e.name!==t.name||e.root!==t.root||e.index!==t.index)}static isSameForRouteModel(e,t){return e===t?!0:!(e==null||t==null||e.path&&e.path!=t.path||e.name&&e.name!=t.name)}static from(e){let t=new $;if(e==null)return t;let n=t;for(let s in e){let o=e[s];n[s]=o}const i=Object.getOwnPropertySymbols(e);if(Array.isArray(i)&&i.length>0)for(let s of i)n[s]=e[s];return t}}class en{id;name;props;meta;src;component;constructor(e,t,n,i){this.id=ie.get(),this.name=e,this.src=t,typeof t!="function"&&(this.component=t),this.props=n,this.meta=i}get isResolved(){return this.component!==void 0}resolve(){return Yr(this)}}class Yt{models=[]}class st{path;match;redirect;name;layers=[]}const V=Symbol("chainKey"),N=Symbol("cursorKey"),ot=Symbol("$persistentModeKey"),F=Symbol("statusKey"),X=Symbol("argsKey"),Oe=Symbol("exArgsKey"),fe=Symbol("successFnsKey"),xe=Symbol("errorFnsKey"),ne=Symbol("sessionKey"),Y=Symbol("_go");class $e{[V]=[];[N]=0;[ot]=!1;[F]="Free";[X]=[];[Oe]=[];[fe]=[];[xe]=[];[ne];get session(){return this[ne]}constructor(e,t=!1){this[ne]=e,this[ot]=t}[Y](e,...t){let n=this[F];if(this[F]="Busy",this[N]+=e,this[N]<0&&(this[N]=0),this[X]=t,n==="Exception"||n==="Reject"){let a=[{session:this[ne]},...this[Oe]];for(;this[xe].length>0;)try{let l=this[xe].shift();typeof l=="function"&&Te(()=>{Reflect.apply(l,{},a)})}catch(l){console.error(l.message,l)}return this[F]=n,this[V]=[],this[N]=0,this}else if(n==="Finished"||this[N]>=this[V].length){let a=[{session:this[ne]},...this[X]];for(;this[fe].length>0;){let l=this[fe].shift();typeof l=="function"&&Te(()=>{Reflect.apply(l,{},a)})}return this[F]="Free",this}if(this[N]>=this[V].length)return this[F]="Free",this;let i=this[V][this[N]];this[ot]||(this[V].splice(0,this[N]+1),this[N]=-1);let s=this[N]+1;try{let o=!1,a={go:(l,...u)=>{o||(o=!0,Reflect.apply(this[Y],this,[l,...u]))},resolve:(...l)=>{o||(o=!0,Reflect.apply(this[Y],this,[1,...l]))},reject:(...l)=>{o||(o=!0,Reflect.apply(this.reject,this,[...l]))},insert:l=>{o||(this[V].splice(s,0,l),s++)},session:this[ne]};Te(()=>{Reflect.apply(i,{},[a,...this[X]])})}catch(o){this.throw(o)}return this}go(e,...t){return Reflect.apply(this[Y],this,[e,...t])}finish(...e){return this[F]="Finished",this[X]=e,Reflect.apply(this[Y],this,[0])}reject(...e){return this[F]="Reject",this[Oe]=e,Reflect.apply(this[Y],this,[0])}throw(...e){return this[F]="Exception",this[Oe]=e,Reflect.apply(this[Y],this,[0])}reset(...e){this[F]="Busy",this[X]=e,this[V]=[],this[N]=0;let n=[{session:this[ne]},...this[X]];for(;this[fe].length>0;){let i=this[fe].shift();Te(()=>{Reflect.apply(i,this,n)})}return this[F]="Free",this}post(e){return this[F]==="Reject"||this[F]==="Exception"?this:(Array.isArray(e)?this[V]=[...this[V],...e]:this[V].push(e),this[F]==="Busy"?this:(Reflect.apply(this[Y],this,[0,...this[X]]),this))}wait(e,t){return e&&typeof e=="function"&&this[fe].push(e),t&&typeof t=="function"&&this[xe].push(t),this[F]==="Busy"?this:(Reflect.apply(this[Y],this,[0,...this[X]]),this)}exception(e){return e&&typeof e=="function"&&this[xe].push(e),this[F]==="Busy"?this:Reflect.apply(this[Y],this,[0,...this[X]])}isFinish(){return this[F]=="Reject"||this[F]=="Free"&&this[N]>=this[V].length}}const ce=Symbol("registerKey");class tn{policy;callback;constructor(e,t){this.callback=e,this.policy=t}}class jt{[ce]=new Map;constructor(){}on(e,t,n=!1){let i=this[ce].get(e);i||(i=new Array,this[ce].set(e,i));let s=n===!0?1:0,o=new tn(t,s);return i.push(o),this}off(e,t){if(!t)return this[ce].delete(e),this;let n=this[ce].get(e);if(n){for(let i=0;i<n.length;i++)if(n[i].callback===t){n.splice(i,1);break}}return this}bind(e,t,n=!1){return this.on(e,t,n)}unbind(e,t){return this.off(e,t)}once(e,t){return this.on(e,t,!0)}all(...e){let t=e.length;if(t<1)return this;let n=e[t-1];if(typeof n!="function")return console.error("callback can not benn empty"),this;let i=t-1,s=new Array(i),o=[].splice.call(e,0,i);for(let a=0;a<o.length;a++)this.once(o[a],l=>{s[a]=l,i-=1,i==0&&Reflect.apply(n,{},s)});return this}emit(e,...t){let n=this[ce].get(e);if(!n)return this;for(let i=0;i<n.length;){let s=n[i];if(s.policy==1?n.splice(i,1):i++,typeof s.callback=="function")try{Te(()=>{Reflect.apply(s.callback,{},t)})}catch(o){console.error(o.message,o)}}return this}trigger(e,...t){return Reflect.apply(this.emit,this,[e,...t])}}const Re=Symbol("registerKey");class rn{[Re]=new Map;constructor(){}set(e,t){this[Re].set(e,t)}get(e){return this[Re].get(e)}has(e){return this[Re].has(e)}delete(e){return this[Re].delete(e)}}const Tt=Symbol("lc");function ze(r,e=!1){let t=r,n=t[Tt];if(!n)if(e)n=new rn,t[Tt]=n;else return null;return n}function wr(r,e){let t=r;for(;t!==null;){const n=t[Tt];if(n&&n.has(e))return n.get(e);t=t.$parent}return null}function Zt(r){if(Array.isArray(r.children)&&r.children.length>0){let e=r.children[0];if(e!=null&&e.component!=null&&e.component.proxy!=null)return ze(e.component.proxy,!1)}return null}const Ye=Symbol("hooksKey");function nn(r){let e=r.get(Ye);e||(e=[],r.set(Ye,e))}function er(r,e){let t=r.get(Ye);if(t!=null)for(let n=t.length-1;n>=0;n--){let i=t[n];if(i.type===e)try{Reflect.apply(i.hook,i.target,[])}catch(s){console.error(s.message,s)}}}var _t=(r=>(r.DEACTIVATED="da",r.ACTIVATED="a",r))(_t||{});class sn{type;hook;target;constructor(e,t,n){this.target=n,this.hook=t,this.type=e}}function on(r,e,t,n){let i=new sn(e,t,n);return r.push(i),!0}function ln(r,e,t,n){let i=-1;for(let s=0;s<r.length;s++){let o=r[s];if(o.type===e&&o.hook===t&&o.target===n){i=s;break}}return i!=-1?(r.splice(i,1),!0):!1}function br(r){return(e,t)=>{let n;if(t)n=t;else{let s=v.getCurrentInstance();if(s==null||s.proxy==null){console.error("can not get current instance or proxy");return}n=s.proxy}let i=wr(n,Ye);if(i==null){console.warn("can not get hooks context");return}v.onUnmounted(()=>{ln(i,r,e,n)}),on(i,r,e,n)}}let an=br("a"),un=br("da");function fn(){let r=new $;return r.path="",r.name="",r.params={},r.index=-1,v.shallowReactive(r)}const Kt=Symbol("routeKey");function lt(r,e){let t=r.get(Kt);if(t){let n={path:"",name:"",params:{},index:-1,session:{}};Object.assign(n,e),Object.assign(t,n)}else t=fn(),Object.assign(t,e),r.set(Kt,t)}function xr(r){let e=wr(r,Kt);return e??null}const et=Symbol("rk"),at=Symbol("vd"),tr=Symbol("rv"),ut=Symbol("rvi"),rr=Symbol("pv"),ft=Symbol("pvi");function cn(r){for(var e=[],t=0;t<r.length;){var n=r[t];if(n==="*"||n==="+"||n==="?"){e.push({type:"MODIFIER",index:t,value:r[t++]});continue}if(n==="\\"){e.push({type:"ESCAPED_CHAR",index:t++,value:r[t++]});continue}if(n==="{"){e.push({type:"OPEN",index:t,value:r[t++]});continue}if(n==="}"){e.push({type:"CLOSE",index:t,value:r[t++]});continue}if(n===":"){for(var i="",s=t+1;s<r.length;){var o=r.charCodeAt(s);if(o>=48&&o<=57||o>=65&&o<=90||o>=97&&o<=122||o===95){i+=r[s++];continue}break}if(!i)throw new TypeError("Missing parameter name at ".concat(t));e.push({type:"NAME",index:t,value:i}),t=s;continue}if(n==="("){var a=1,l="",s=t+1;if(r[s]==="?")throw new TypeError('Pattern cannot start with "?" at '.concat(s));for(;s<r.length;){if(r[s]==="\\"){l+=r[s++]+r[s++];continue}if(r[s]===")"){if(a--,a===0){s++;break}}else if(r[s]==="("&&(a++,r[s+1]!=="?"))throw new TypeError("Capturing groups are not allowed at ".concat(s));l+=r[s++]}if(a)throw new TypeError("Unbalanced pattern at ".concat(t));if(!l)throw new TypeError("Missing pattern at ".concat(t));e.push({type:"PATTERN",index:t,value:l}),t=s;continue}e.push({type:"CHAR",index:t,value:r[t++]})}return e.push({type:"END",index:t,value:""}),e}function Rr(r,e){e===void 0&&(e={});for(var t=cn(r),n=e.prefixes,i=n===void 0?"./":n,s="[^".concat(me(e.delimiter||"/#?"),"]+?"),o=[],a=0,l=0,u="",f=function(R){if(l<t.length&&t[l].type===R)return t[l++].value},c=function(R){var q=f(R);if(q!==void 0)return q;var _=t[l],K=_.type,L=_.index;throw new TypeError("Unexpected ".concat(K," at ").concat(L,", expected ").concat(R))},h=function(){for(var R="",q;q=f("CHAR")||f("ESCAPED_CHAR");)R+=q;return R};l<t.length;){var d=f("CHAR"),y=f("NAME"),g=f("PATTERN");if(y||g){var p=d||"";i.indexOf(p)===-1&&(u+=p,p=""),u&&(o.push(u),u=""),o.push({name:y||a++,prefix:p,suffix:"",pattern:g||s,modifier:f("MODIFIER")||""});continue}var m=d||f("ESCAPED_CHAR");if(m){u+=m;continue}u&&(o.push(u),u="");var b=f("OPEN");if(b){var p=h(),T=f("NAME")||"",x=f("PATTERN")||"",C=h();c("CLOSE"),o.push({name:T||(x?a++:""),pattern:T&&!x?s:x,prefix:p,suffix:C,modifier:f("MODIFIER")||""});continue}c("END")}return o}function hn(r,e){return dn(Rr(r,e),e)}function dn(r,e){e===void 0&&(e={});var t=Dt(e),n=e.encode,i=n===void 0?function(l){return l}:n,s=e.validate,o=s===void 0?!0:s,a=r.map(function(l){if(typeof l=="object")return new RegExp("^(?:".concat(l.pattern,")$"),t)});return function(l){for(var u="",f=0;f<r.length;f++){var c=r[f];if(typeof c=="string"){u+=c;continue}var h=l?l[c.name]:void 0,d=c.modifier==="?"||c.modifier==="*",y=c.modifier==="*"||c.modifier==="+";if(Array.isArray(h)){if(!y)throw new TypeError('Expected "'.concat(c.name,'" to not repeat, but got an array'));if(h.length===0){if(d)continue;throw new TypeError('Expected "'.concat(c.name,'" to not be empty'))}for(var g=0;g<h.length;g++){var p=i(h[g],c);if(o&&!a[f].test(p))throw new TypeError('Expected all "'.concat(c.name,'" to match "').concat(c.pattern,'", but got "').concat(p,'"'));u+=c.prefix+p+c.suffix}continue}if(typeof h=="string"||typeof h=="number"){var p=i(String(h),c);if(o&&!a[f].test(p))throw new TypeError('Expected "'.concat(c.name,'" to match "').concat(c.pattern,'", but got "').concat(p,'"'));u+=c.prefix+p+c.suffix;continue}if(!d){var m=y?"an array":"a string";throw new TypeError('Expected "'.concat(c.name,'" to be ').concat(m))}}return u}}function yn(r,e){var t=[],n=Sr(r,t,e);return pn(n,t,e)}function pn(r,e,t){t===void 0&&(t={});var n=t.decode,i=n===void 0?function(s){return s}:n;return function(s){var o=r.exec(s);if(!o)return!1;for(var a=o[0],l=o.index,u=Object.create(null),f=function(h){if(o[h]===void 0)return"continue";var d=e[h-1];d.modifier==="*"||d.modifier==="+"?u[d.name]=o[h].split(d.prefix+d.suffix).map(function(y){return i(y,d)}):u[d.name]=i(o[h],d)},c=1;c<o.length;c++)f(c);return{path:a,index:l,params:u}}}function me(r){return r.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function Dt(r){return r&&r.sensitive?"":"i"}function mn(r,e){if(!e)return r;for(var t=/\((?:\?<(.*?)>)?(?!\?)/g,n=0,i=t.exec(r.source);i;)e.push({name:i[1]||n++,prefix:"",suffix:"",modifier:"",pattern:""}),i=t.exec(r.source);return r}function vn(r,e,t){var n=r.map(function(i){return Sr(i,e,t).source});return new RegExp("(?:".concat(n.join("|"),")"),Dt(t))}function gn(r,e,t){return wn(Rr(r,t),e,t)}function wn(r,e,t){t===void 0&&(t={});for(var n=t.strict,i=n===void 0?!1:n,s=t.start,o=s===void 0?!0:s,a=t.end,l=a===void 0?!0:a,u=t.encode,f=u===void 0?function(L){return L}:u,c=t.delimiter,h=c===void 0?"/#?":c,d=t.endsWith,y=d===void 0?"":d,g="[".concat(me(y),"]|$"),p="[".concat(me(h),"]"),m=o?"^":"",b=0,T=r;b<T.length;b++){var x=T[b];if(typeof x=="string")m+=me(f(x));else{var C=me(f(x.prefix)),R=me(f(x.suffix));if(x.pattern)if(e&&e.push(x),C||R)if(x.modifier==="+"||x.modifier==="*"){var q=x.modifier==="*"?"?":"";m+="(?:".concat(C,"((?:").concat(x.pattern,")(?:").concat(R).concat(C,"(?:").concat(x.pattern,"))*)").concat(R,")").concat(q)}else m+="(?:".concat(C,"(").concat(x.pattern,")").concat(R,")").concat(x.modifier);else x.modifier==="+"||x.modifier==="*"?m+="((?:".concat(x.pattern,")").concat(x.modifier,")"):m+="(".concat(x.pattern,")").concat(x.modifier);else m+="(?:".concat(C).concat(R,")").concat(x.modifier)}}if(l)i||(m+="".concat(p,"?")),m+=t.endsWith?"(?=".concat(g,")"):"$";else{var _=r[r.length-1],K=typeof _=="string"?p.indexOf(_[_.length-1])>-1:_===void 0;i||(m+="(?:".concat(p,"(?=").concat(g,"))?")),K||(m+="(?=".concat(p,"|").concat(g,")"))}return new RegExp(m,Dt(t))}function Sr(r,e,t){return r instanceof RegExp?mn(r,e):Array.isArray(r)?vn(r,e,t):gn(r,e,t)}var E=(r=>(r[r.Push=0]="Push",r[r.Replace=1]="Replace",r[r.Put=2]="Put",r[r.Append=3]="Append",r[r.Open=4]="Open",r))(E||{}),Je=(r=>(r[r.Part=0]="Part",r[r.All=1]="All",r))(Je||{});const G=Symbol("rootKey"),J=Symbol("rootNodeKey"),le=Symbol("parentNodeKey"),Ge=Symbol("nameKey");class ee{instance=null;model;route;active=!0;index=0;constructor(e,t,n=0,i=!0){this.route=e,this.model=t,this.index=n,this.active=i}}class Se{scope=null;set compensation(e){this.scope!==null&&this.scope.stop(),this.scope=v.effectScope(),this.scope.run(()=>{v.watch(this.slots,()=>{let t=!1;try{t=e()}catch(n){console.error(n)}t&&this.scope!==null&&(this.scope.stop(),this.scope=null)})})}_slots;get slots(){return this._slots==null&&(this._slots=v.shallowRef([])),this._slots}get empty(){return this._slots==null||this._slots.value.length==0}[Ge];[G];[J]=null;[le]=null;get name(){return this[Ge]}constructor(e,t,n){this[Ge]=e,this[G]=t,n&&(this[J]=n)}}class B{view;index;level;constructor(e,t,n){this.view=e,this.index=t,this.level=n}static include(e,t){for(let n=0;n<e.length;n++){let i=e[n];if(i.view===t.view&&(t.index==-1||i.index===t.index)&&i.level===t.level)return!0}return!1}}class ct{views=[]}class bn{layers=[]}class xn{time;route}class Rn{forbidTime=300;submitRecorder=new xn;isSameRoute(e,t){return e==null||t==null?!1:e.name===t.name&&e.path===t.path&&e.root===t.root}acquire(e){let t=new Date().getTime();if(this.isSameRoute(e,this.submitRecorder.route)&&this.submitRecorder.time&&t-this.submitRecorder.time<=this.forbidTime){this.submitRecorder.time=t;return}return this.submitRecorder.route=e,this.submitRecorder.time=t,t}release(e){this.submitRecorder.time===e&&(this.submitRecorder.route=void 0)}}const ve=Symbol("_notifyChange");class nr{currentRoute;routes;constructor(e,t){this.currentRoute=e,this.routes=t}}const qe=typeof window<"u",I=function(){return window},Le=function(){return window.document};function Sn(r){let e=r,t=e.lastIndexOf("/");return t>0&&t<e.length-1?e=e.substring(0,t+1):t===0&&e.indexOf(".")!==-1?e="/":t===-1&&(e.indexOf(".")==-1?e=`/${e}/`:e="/"),e.indexOf("/")!==0&&(e=`/${e}`),e}function ht(){if(!qe)return"/";let r=I().location,e=`${r.protocol}//${r.host}`;return e+=Sn(r.pathname),e}function $t(r,e,t){r.addEventListener?r.addEventListener(e,t,!1):r.attachEvent?r.attachEvent(`on${e}`,t):r[`on${e}`]=t}function qt(r,e,t){r.removeEventListener?r.removeEventListener(e,t):r.detachEvent?r.detachEvent(`on${e}`,t):r[`on${e}`]=null}const Me=Symbol("ignoreHistoryChangeOnceKey"),ir=Symbol("_navigateFirstRoute"),Ie=Symbol("_getRouteMark"),sr=Symbol("_getUrlSearch"),dt=Symbol("_generateLocation"),Pe=Symbol("_setRouteMarkRecorder"),or="Symbol(_fox_restore_point)";function yt(r,...e){return typeof r=="function"?Reflect.apply(r,null,[...e]):r}class Pr{base;storage;mode;query;firstNavigate=!0;historyMonitor;traceless=!1;changeHandler;historyChange;[Me]=!1;constructor(e="hash",t="",n="",i=!0,s=!0,o=!1,a){this.mode=e,this.base=t,this.query=n,this.firstNavigate=i,this.historyMonitor=s,this.traceless=o,this.storage=a??I().sessionStorage}init(e=!0){const t=I();return typeof this.historyChange!="function"&&(this.historyChange=()=>{if(this[Me]){this[Me]=!1;return}if(yt(this.historyMonitor)){const n=t.history.state;this[ve](n);try{let i=[];if(typeof n=="string"?i=JSON.parse(n):i=n,Array.isArray(i)&&i.length>0){const s=this[Ie]()??"/";this[Pe](s,i)}}catch{}}}),$t(t,"popstate",this.historyChange),this.firstNavigate&&e&&this[ir](),Promise.resolve()}destroy(){if(this.historyChange){const e=I();qt(e,"popstate",this.historyChange)}}[ir](){const e=this[Ie]()??"/",t=this.storage.getItem(or);if(t)try{const o=JSON.parse(t);if(o.mark===e){this[ve](o.routes);return}}catch{}const n=e.indexOf("!");let i;n!=-1?i=e.substring(n+1):i=e;const s=new $;s.path=i,s.query=this[sr](),this[ve]([s])}[Pe](e,t){try{const n={mark:e,routes:t},i=JSON.stringify(n);this.storage.setItem(or,i)}catch(n){console.error(n.message,n)}}setRestorePoint(e){const t=this[Ie]()??"/";this[Pe](t,e)}[ve](e){typeof this.changeHandler=="function"&&this.changeHandler(e)}[Ie](){const e=I();if(this.mode==="path"){let t=e.location.pathname;return this.base&&t.indexOf(this.base)===0&&(t=t.substring(this.base.length)),t}else{const t=e.location.hash,n=t.indexOf("#");if(n!=-1)return t.substring(n+1)}return null}[sr](){return I().location.search}listen(e){this.changeHandler=e}go(e,t=!0){const n=I();this[Me]=!t,n.history.go(e)}push(e){let t=this[dt](e.currentRoute);yt(this.traceless,e.currentRoute)||I().history.pushState(e.routes,"",t),this[Pe](e.currentRoute.fullPath,e.routes)}replace(e){let t=this[dt](e.currentRoute);yt(this.traceless,e.currentRoute)||I().history.replaceState(e.routes,"",t),this[Pe](e.currentRoute.fullPath,e.routes)}[dt](e){const t=I();let n="";if(e.query){let a="";if(typeof e.query=="object")for(let l in e.query){let u=encodeURIComponent(e.query[l]),f=`${encodeURIComponent(l)}=${u}`;a.length>0&&(a+="&"),a+=f}else a=e.query;this.query?(n=`${this.query}&${a}`,n.charAt(0)!=="?"&&(n=`?${n}`)):n=`?${a}`}const i=t.location;let s=e.fullPath;s.startsWith(Z)&&(s=s.substring(Z.length+1));let o;return n?this.mode=="path"?o=`${this.base}/${s}${n}`:o=`${i.pathname}${n}#${s}`:this.mode=="path"?o=`${this.base}/${s}`:o=`${i.pathname}#${s}`,`${i.origin}${o}`}}function Pn(r=!0,e=null,t="",n=!0,i=!1,s){return e!==null&&(e=I().location.pathname),e&&e.endsWith("/")&&(e=e.substring(0,e.length-1)),new Pr("path",e??"",t,r,n,i,s)}function Cr(r=!0,e="",t=!0,n=!1,i){return new Pr("hash","",e,r,t,n,i)}class Cn{maxSize=50;cursor=-1;queue=[];changeHandler;base;historyMonitor=!1;traceless=!1;constructor(e,t=50){this.base=e,this.maxSize=t}init(e=!0){return Promise.resolve()}destroy(){this.queue=[]}listen(e){this.changeHandler=e}[ve](e){typeof this.changeHandler=="function"&&this.changeHandler(e)}go(e,t=!0){if(this.queue.length==0||this.cursor<=0||this.cursor>=this.queue.length-1)return;let n=this.cursor+e;if(n<0?n=0:n>this.queue.length-1&&(n=this.queue.length-1),n!=this.cursor&&(this.cursor=n,t)){const i=this.queue[n];this[ve](i.routes)}}push(e){this.queue.length>=this.maxSize&&this.queue.splice(0,1),this.queue.push(e),this.cursor=this.queue.length-1}replace(e){let t=this.queue.length-this.cursor;this.queue.splice(this.cursor,t),this.queue[this.cursor]=e}setRestorePoint(e){}}function Ar(r="",e=50){return new Cn(r,e)}const Ne=Symbol("_constructRouteModel"),He=Symbol("_findRouteModel"),pt=Symbol("_findRootView"),lr=Symbol("_getFirstView"),se=Symbol("_removeView"),ar=Symbol("_buildPage"),ur=Symbol("_resolveComponent"),fr=Symbol("_update"),te=Symbol("_merge"),mt=Symbol("_handleHistoryChange"),De=Symbol("_handleRouteUpdated"),Ve=Symbol("routeUpdatedCallback"),w=Symbol("currentRoutes"),he=Symbol("current"),cr=Symbol("_addRouteRecorder"),de=Symbol("_removeRouteRecorder"),Be=Symbol("_cloneRouteRecorder"),O=Symbol("_handleError"),Ue=Symbol("errorCallback"),U=Symbol("registerKey"),ke=Symbol("notFoundKey"),vt=Symbol("notFoundPathKey"),k=Symbol("forestKey"),A=Symbol("historyKey"),Ce=Symbol("beforeFiltersKey"),Ae=Symbol("afterFiltersKey"),Ee=Symbol("destroyFiltersKey"),ye=Symbol("mainDispatcherKey"),gt=Symbol("initKey"),oe=Symbol("readyKey"),wt=Symbol("readyHandlersKey"),We=Symbol("_markReady"),hr=Symbol("_createNextFn"),bt=Symbol("_start"),xt=Symbol("_before"),Rt=Symbol("_after"),dr=Symbol("_destroy"),St=Symbol("_load"),Fe=Symbol("_unload"),je=Symbol("routerGuardKey");function An(r){return r.layers.length==0||r.layers[0].views.length==0}function En(r){let e=[];return r.layers.forEach(t=>{t.models==null||t.models==null||t.models.forEach(n=>{if(!(n==null||n==null))if(typeof n.meta=="object"){let i=j(!0,{},n.meta);e.push(i)}else n.meta&&e.push(n.meta)})}),e}class Fn{[U]=new Array;[ke];[vt]="*";[oe]=!1;[wt]=[];[k]=new bn;[A];[w]=new Array;[Ue]=null;[Ve]=null;[Ce]=new Array;[Ae]=new Array;[Ee]=new Array;[ye]=new $e;[je]=new Rn;[gt]=!1;[he]=v.ref(null);get current(){return this[he].value}options;constructor(e){this.options=e??{},this.options.notFoundPath&&this.setNotFoundPath(this.options.notFoundPath);let t=this.options.routes||[];this.addRoutes(t),this.options.notFound&&this.setNotFoundRoute(this.options.notFound),e.history?this[A]=e.history:this[A]=qe?Cr():Ar(),this[A]?.listen(async n=>{let i=!0;try{if(typeof n=="string"){const s=this[H](n);s&&await this[mt]([s])}else await this[mt](n)}catch(s){console.error(s.message,s),i=!1}this[oe]===!1&&this[We](i)})}[O](e="error",t){if(t&&typeof t.error=="function")try{t.error(e)}catch{}if(typeof this[Ue]=="function")try{this[Ue](e,t)}catch{}console.error(e)}init(){this[gt]!==!0&&(this[A]?.init(!this[oe]),this[gt]=!0)}isReady(){return this[oe]?Promise.resolve():new Promise((e,t)=>{this[wt].push([e,t])})}[We](e){this[oe]=!0,this[wt].forEach(([t,n])=>{try{e?t():n()}catch(i){console.error(i.message,i)}})}[mt](e){try{if(!e){let o=[...this[w]].reverse();return this[Fe](o),qe&&I().location.reload(),Promise.resolve()}let t=null,n=[],i=[],s=0;for(;s<e.length&&s<this[w].length&&$.isSame(e[s],this[w][s]);s++)e[s].opsType===E.Open&&e[s].active===!0&&e[s].active!==this[w][s].active&&(t=e[s]);if(s<e.length&&(n=e.slice(s)),s<this[w].length&&(i=this[w].slice(s).reverse()),i.length==0&&n.length==0){if(t!==null)return this.restore([t])}else if(i.length>0){if(this[Fe](i)){if(n.length>0)return this.restore(n);if(t!==null)return this.restore([t])}}else return this.restore(n)}catch(t){this[O](t)}return Promise.resolve()}[De](e){if(e)this[he].value=e;else{let t=this[w].length;t>0?this[he].value=this[w][t-1]:this[he].value=null}if(typeof this[Ve]=="function")try{this[Ve](this[he].value)}catch{}}[cr](e,t=-1){t<0||t>=this[w].length?this[w].push(e):this[w].splice(t,0,e)}[Be](){let e=[];for(let t of this[w]){let n=$.clone(t,!0);e.push(n)}return e}[de](e){if(!this[w])return;let t=-1;for(let n=0;n<this[w].length;n++)if($.isSame(this[w][n],e)){t=n;break}if(t!=-1){let n=this[w][t];this[w].splice(t,1),this[dr](n,n.session)}}set historyMonitor(e){this[A]&&(this[A].historyMonitor=e)}get historyMonitor(){return this[A]?this[A].historyMonitor:!1}set traceless(e){this[A]&&(this[A].traceless=e)}get traceless(){return this[A]?this[A].traceless:!1}setRestorePoint(){const e=this[Be]();this[A]?.setRestorePoint(e)}onRouteUpdated(e){this[Ve]=e}onError(e){this[Ue]=e}beforeEach(e){this[Ce].push(e)}removeBeforeEach(e){const t=this[Ce].indexOf(e);return t!==-1?(this[Ce].splice(t,1),!0):!1}afterEach(e){this[Ae].push(e)}removeAfterEach(e){const t=this[Ae].indexOf(e);return t!==-1?(this[Ae].splice(t,1),!0):!1}destroyEach(e){this[Ee].push(e)}removeDestroyEach(e){const t=this[Ee].indexOf(e);return t!==-1?(this[Ee].splice(t,1),!0):!1}addRoutes(e){for(let t of e)this.addRoute(t)}addRoute(e,t=-1){if(e.path===this[vt]){this.setNotFoundRoute(e);return}const n=this[Ne](e);if(t==-1)this[U]=[...this[U],...n];else for(let i=n.length-1;i>=0;i--)this[U].splice(t,0,n[i])}removeRoute(e){const t=this[H](e);if(t===null)return console.warn("route格式错误",e),!1;for(let n=0;n<this[U].length;n++){const i=this[U][n];if(t?.path&&i.path===t.path)return this[U].splice(n,1),!0;if(t?.name&&i.name===t.name)return this[U].splice(n,1),!0}return!1}hasRoute(e){const t=this[H](e);return t===null?(console.warn("route格式错误",e),!1):this[U].findIndex(i=>{if(t?.path&&i.path===t.path||t?.name&&i.name===t.name)return!0})!==-1}setNotFoundPath(e){this[vt]=e}setNotFoundRoute(e){const t=this[Ne](e);this[ke]=t[0]}getRoutes(){return[...this[U]]}[Ne](e){let t=e.path??"";t.length>0&&t.charAt(0)!=="/"&&(t=`/${t}`);let n=e.components??(e.component&&{"":e.component});if(n==null){let a=new st;return a.path=t,a.redirect=e.redirect,[a]}let i=[];for(let a in n){let l=n[a];a.length===0&&(a=Z);let u=new en(a,l,e.props,e.meta);i.push(u)}let s=!1,o=[];if(e.children)for(let a of e.children){let l=this[Ne](a);for(let u of l){let f=new st;f.name=u.name,u.path&&u.path.length>0?t!=="/"?f.path=`${t}${u.path}`:f.path=u.path:(s=!0,f.path=t);let c=new Yt;c.models=[...i],f.layers=[c,...u.layers],o.push(f)}}if(!s){let a=new Yt;a.models=i;let l=new st;l.name=e.name,l.path=t,l.layers=[a],o.splice(0,0,l)}return o}[He](e){const t=e.route;try{for(let n of this[U])if(t.path&&n.path){let i=n.match;i||(i=n.match=yn(n.path));let s=i(t.path);if(!s)continue;if(n.redirect){let o=new $;j(!0,o,t),o.path=n.redirect;let a={route:o,find:void 0};return this[He](a)?(e.route=a.route,e.find=a.find,!0):!1}if(t.params=t.params??{},j(!0,t.params,s.params),t.query){let o=t.query;if(typeof o=="string"){let a={},l=o.split("&");for(let u of l){let f=u.split("=");if(f.length!==2)continue;let c=decodeURIComponent(f[0].trim()),h=decodeURIComponent(f[1].trim());a[c]=h}j(!0,t.params,a)}else typeof o=="object"&&j(!0,t.params,o)}return e.find=n,!0}else if(t.name===n.name){t.params=t.params??{};let i=hn(n.path);return t.path=i(t.params),e.find=n,!0}}catch(n){console.error(n.message,n),typeof t.error=="function"&&t.error(n.message)}return!1}[H](e){let t=null;if(Array.isArray(e))if(t=new $,typeof e[0]=="object")t=$.from(e[0]);else for(let n=0;n<e.length;n++)n===0?e[n].charAt(0)==="/"?t.path=e[n]:t.name=e[n]:n===1?t.params=e[n]:n===2?t.root=e[n]:n===3&&j(!1,t,e[n]);else typeof e=="object"?t=$.from(e):typeof e=="string"&&(t=new $,e.charAt(0)=="/"?t.path=e:t.name=e);if(t){if(t.path){let n=t.path.indexOf("?");n!==-1&&n<t.path.length-1&&(t.query=t.path.substring(n+1),t.path=t.path.substring(0,n))}t.root=t.root??Z,t.opsType=t.opsType??this.options.defaultOperationType??E.Push}return t}push(...e){let t=this[H](e);return t?(t.opsType=t.opsType||E.Push,this.to(t)):(this[O]("resolve route fail",t),this)}put(...e){let t=this[H](e);return t?(t.opsType=E.Put,this.to(t)):(this[O]("resolve route fail",t),this)}replace(...e){let t=this[H](e);return t?(t.opsType=E.Replace,this.to(t)):(this[O]("resolve route fail",t),this)}append(...e){let t=this[H](e);return t?(t.opsType=E.Append,this.to(t)):(this[O]("resolve route fail",t),this)}remove(e){return new Promise(t=>{this[ye].post(n=>{try{if(this[w].length===0){n.resolve(),t(!1);return}let i=-1,s,o=[];if(e){if(e.root?s=e.root:s=this[w][0].root??Z,e.all)for(let l=this[w].length-1;l>0;l--){let u=this[w][l];u.opsType===E.Append&&u.root===s&&(o.splice(0,0,u),i=l-1)}else if(e.until)for(let l=this[w].length-1;l>0;l--){let u=this[w][l];if(u.opsType===E.Append&&u.root===s){if(e.until.charAt(0)==="/"&&e.until===u.path){i=l;break}else if(e.until===u.name){i=l;break}o.splice(0,0,u)}}}else{s=Z;let l=this[lr](this[k]);l&&(s=l.name);for(let u=this[w].length-1;u>0;u--){let f=this[w][u];if(f.opsType===E.Append&&f.root===s){o.push(f),i=u-1;break}}}if(o.length===0){let l="can not find route";console.warn(l),n.resolve(l),t(!1);return}let a=0;if(this[w].forEach(l=>{l.opsType!==E.Put&&a++}),this[Fe](o)){let l=0;this[w].forEach(f=>{f.opsType!==E.Put&&l++});const u=l-a;this[A]?.go(u,!1),n.resolve(),t(!0)}}catch(i){this[O](i),n.resolve(),t(!1)}})})}open(...e){let t=this[H](e);return t?(t.opsType=E.Open,this.to(t)):(this[O]("resolve route fail",t),this)}close(e){return this[ye].post(t=>{try{let n=this[H](e);if(!n){t.reject("resolve route fail");return}let i=[];for(let s=0;s<this[w].length;s++){let o=this[w][s];if(o.root===n.root){if(!n.path&&!n.name){i.push(o);continue}if(n.path&&n.path===o.path){i.push(o);break}else if(n.name&&n.name===o.name){i.push(o);break}}}if(i.length===0){t.resolve();return}this[Fe](i)&&this[De](),t.resolve()}catch(n){this[O](n),t.resolve()}}),this}to(...e){let t=this[H](e);if(!t)return this[O]("resolve route fail",t),this;console.debug("route to",t.path,t.root);let n=this[je].acquire(t);return n==null?(this[O]("route forbid",t),this):(this[ye].post(i=>{try{let s=this[bt](t);this[xt](s),this[St](s),this[Rt](s),s.wait((o,a)=>{const l=o.session.to;try{let u=$.clone(l,!0);const f=new nr(u,this[Be]());l.opsType===E.Replace?this[A]?.replace(f):this[A]?.push(f)}catch(u){console.error(u.message,u)}if(this[je].release(n),this[De](l),typeof t.success=="function")try{Reflect.apply(t.success,{},[])}catch(u){console.error(u.message,u)}this[oe]===!1&&this[We](!0),i.resolve()},(o,a)=>{this[je].release(n),a!==null&&this[O](a,t),this[oe]===!1&&this[We](!1),i.resolve()})}catch(s){this[je].release(n),this[O](s,t),i.resolve()}}),this)}back(e=1){this[A]?.go(-e)}[hr](e){return(t,n)=>{if(typeof t=="boolean")e.session.redirect=!1,t?e.resolve():e.reject(n??null);else if(t){const i=this[H](t);if(i){const s=e.session.to;i.success=s.success,i.error=s.error,e.session.to=i,e.session.redirect=!0,e.session.routeModel=null,e.resolve()}else e.session.redirect=!1,e.reject("route resolve fail")}else e.session.redirect=!1,e.resolve()}}[bt](e){let t=this[w].length>0?this[w][0]:void 0,n=new Xe(e,t),i={route:e,find:null};return this[He](i),i.find&&(n.routeModel=i.find,e.matched=En(i.find),Array.isArray(e.matched)&&e.matched.length>0&&(e.meta=i.find.layers[0].models[0].meta)),new $e(n)}[xt](e){for(let t of this[Ce])e.post(n=>{let i=this[hr](n);Reflect.apply(t,{},[n.session.to,n.session.from,i,n.session])})}[Rt](e){e.post(t=>{for(let n of this[Ae])try{Reflect.apply(n,{},[t.session.to,t.session.from,t.session])}catch(i){console.error(i.message,i)}t.resolve()})}[dr](e,t){for(let n of this[Ee])try{Reflect.apply(n,{},[e,t])}catch(i){console.error(i.message,i)}typeof e.destroy=="function"&&Reflect.apply(e.destroy,e,[])}[St](e){e.post(t=>{let n=t.session.to,i=t.session.routeModel;if(i==null){let o={route:n,find:null};if(this[He](o))i=o.find,t.session.routeModel=i;else if(this[ke])i=this[ke];else{t.reject(`not find route model, path:${n.path??n.name}`);return}}let s=Xe.from(t.session);this[ar](n,i,s).then(o=>{this[k],t.resolve()},o=>{t.reject(o)})})}[Fe](e){if(e.length==0)return!0;let t=this[k],n=[];for(let i of e){let s=this[pt](t,i);s!=null&&n.push({...s,route:i})}if(n.length==0){let i="can not find view index";return this[O](i),!1}for(let i of n.reverse())this[se](t,{x:i.x,y:i.y},[i.route.index??0],!0);return!0}[pt](e,t){const n=t.root??Z;let i;for(let s=0;s<e.layers.length;s++){const o=e.layers[s];for(let a=o.views.length-1;a>=0;a--){const l=o.views[a];if(l[G]&&l[Ge]===n)return i={x:a,y:s},i}}return null}[lr](e){return e.layers.length>0&&e.layers[0].views.length>0?e.layers[0].views[0]:null}[se](e,t,n=null,i=!0){if(t.y>=e.layers.length||t.x>=e.layers[t.y].views.length)return;let s=e.layers[t.y].views[t.x],o=!1,a=[],l=!1,u=[...s.slots.value];for(let c=u.length-1;c>=0;c--){let h=u[c];(!n||n.indexOf(h.index)!=-1)&&(h.route&&s[G]&&(this[de](h.route),h.active===!0&&h.route.opsType==E.Append&&(l=!0)),a.push(new B(s,h.index,t.y)),u.splice(c,1))}if(u.length==0)i?s.slots.value=u:e.layers[t.y].views.splice(t.x,1);else{if(l){let c=u.length-1,h=u[c];h.active=!0,h.route&&(h.route.active=h.active)}s.slots.value=u}e.layers[t.y].views.length==0&&(o=!0);let f=t.y+1;for(;f<e.layers.length;f++){let c=e.layers[f].views,h=[];for(let d=c.length-1;(o||a.length>0)&&d>=0;d--){let y=c[d];if(y[le]&&(o||B.include(a,y[le]))){let g=y.slots.value;for(let p=g.length-1;p>=0;p--){let m=g[p];m.route&&y[G]&&this[de](m.route),h.push(new B(y,m.index,f)),g.splice(p,1)}e.layers[f].views.splice(d,1)}}a=h,e.layers[f].views.length==0&&(o=!0)}}restore(e){if(!e||this[U].length==0){let t=this[k];if(t.layers.length>0){let n=t.layers[0].views;n.length>0&&(n[0].slots.value=[])}return this[w]=[],this[De](),Promise.resolve()}else return new Promise((n,i)=>{let s=null,o=!1;for(let a=0;a<e.length;a++){let l=e[a];this[ye].post(u=>{let f=this[bt](l);this[xt](f),this[St](f),this[Rt](f),f.wait((c,h)=>{s=c.session.to,o=c.session.redirect,u.resolve()},(c,h)=>{s=null,h!==null&&this[O](h),u.resolve()})})}this[ye].post(a=>{if(s&&o===!0){const l=$.clone(s,!0),u=new nr(l,this[Be]());this[A]?.replace(u)}a.resolve(),n()})})}[ar](e,t,n){let i=e.updateType??Je.Part;return this[ur](t).then(()=>{this[fr](t,e,n,i)})}[ur](e){let t=[];for(let n=0;n<e.layers.length;n++){let i=e.layers[n];for(let s=0;s<i.models.length;s++){let o=i.models[s];o.isResolved||t.push(o.resolve())}}return t.length>0?Promise.all(t):Promise.resolve()}[fr](e,t,n,i){if(e.layers[0].models.length!==1)return Promise.reject("illegal route structure(multi root node)");const s=e.layers[0].models[0];let o=this[k],a=An(o),l=t.root??Z,u;!a&&i==Je.Part&&(u=this[pt](o,t));let f,c=0;if(u==null||u==null)if(a||i===Je.All){if(o.layers.length==0&&(o.layers[0]=new ct),o.layers[0].views.length==0){let h=t.root??Z;f=new Se(h,!0,null),o.layers[0].views=[f]}else f=o.layers[0].views[0];u={x:0,y:0}}else{let h=t.slot;if(!h)return Promise.reject("can not rebuild view(because not route slot)");let d=h.level;if(d>o.layers.length)return Promise.reject("can not insert view(override level)");let y;if(h.rootName){let g=o.layers[d-1];for(let p of g.views){if(p[G]&&p.name===h.rootName){y=new B(p,h.rootIndex??0,d-1);break}if(p[J]&&p[J].view.name===h.rootName&&p[J].index===h.rootIndex){y=p[J];break}}}if(!y)return Promise.reject("can not insert view(not find root node ref)");f=new Se(l,!0,y),o.layers[d].views.push(f),u={x:o.layers[d].views.length-1,y:d}}else f=o.layers[u.y].views[u.x];if(c=u.y,f[G]=!0,t.opsType===E.Append){t.index=ie.get();let h=f.slots.value;if(h.length>0){let m=h[h.length-1];m.active=!1,m.route&&(m.route.active=m.active)}let d=new ee(t,s,t.index,!0);f.slots.value=[...h,d];let y=c+1,g=1,p=new B(f,t.index,c);this[te](o,y,e,g,p)}else if(t.opsType===E.Open){let h=f.slots.value,d=!1;for(let y of h){if(y.route!==null&&$.isSameForRouteModel(y.route,t)){if(y.active==!0)return t.index=y.index,t.active=y.active,y.route=t,Promise.resolve();y.active=!0,d=!0,t.index=y.index,t.active=y.active,y.route=t,this[de](y.route)}else y.active=!1;y.route&&(y.route.active=y.active)}if(!d){t.index=ie.get(),t.active=!0;let y=new ee(t,s,t.index,!0);h.push(y);let g=c+1,p=1,m=new B(f,t.index,c);this[te](o,g,e,p,m)}f.slots.value=[...h]}else{let h=f.slots.value;if(h.length==0){t.index=ie.get(),f.slots.value=[new ee(t,s,t.index)];let d=c+1,y=1,g=new B(f,t.index,c);this[te](o,d,e,y,g)}else{let d=h[0];if(d.model!==s){this[se](o,u,null,!0),t.index=ie.get(),f.slots.value=[new ee(t,s,t.index)];let y=c+1,g=1,p=new B(f,t.index,c);this[te](o,y,e,g,p)}else{d.route!==null&&this[de](d.route);let y=[];for(let T=1;T<h.length;T++)y.push(h[T].index);y.length>0&&this[se](o,u,y,!0),t.index=d.index,d.route=t;let g=[new B(f,t.index,c)],p=c+1,m=1,b=new B(f,t.index,c);for(;g.length>0&&p<o.layers.length&&m<e.layers.length;p++,m++){let T=[];for(let C=0;C<o.layers[p].views.length;C++){let R=o.layers[p].views[C];R[le]&&B.include(g,R[le])&&T.unshift(C)}let x=[];for(let C of T){let R=o.layers[p].views[C],q=e.layers[m].models,_;for(let K=0;K<q.length;K++)if(R.name===q[K].name){_=q[K];break}if(!_)this[se](o,{x:C,y:p},null,!1);else{let K=R.slots.value;if(K.length==0){let L=0;R.slots.value=[new ee(null,_,L)];let W=p+1,z=m+1;this[te](o,W,e,z,b)}else{let L=K[0];if(L.model!==_){this[se](o,{x:C,y:p},null,!0),R.slots.value=[new ee(null,_,0)];let W=p+1,z=m+1;this[te](o,W,e,z,b)}else{R[G]&&L.route!==null&&this[de](L.route);let W=[];for(let z=1;z<K.length;z++)W.push(K[z].index);W.length>0&&this[se](o,{x:C,y:p},W,!0),x.push(new B(R,L.index,p))}}R[G]=!1}}g=x}this[te](o,p,e,m,b)}}}if(f&&f[J]){let h=f[J];h&&(t.slot=new Zr(l,c,h?.view.name,h?.index??0))}n.to=void 0,n.routeModel=void 0,t.session=n,this[cr](t)}[te](e,t,n,i,s){let o=i,a=t;for(;a<e.layers.length&&o<n.layers.length;a++,o++){let l=e.layers[a].views;for(let u of n.layers[o].models){let f=new Se(u.name,!1,s),c=new ee(null,u);f.slots.value=[c],l.push(f)}}for(;o<n.layers.length;o++){let l=new ct;l.views=[];for(let u of n.layers[o].models){let f=new Se(u.name,!1,s),c=new ee(null,u);f.slots.value=[c],l.views.push(f)}e.layers.push(l)}}[gr](e,t,n,i,s,o){if(t<0||t>this[k].layers.length)return null;if(t<this[k].layers.length){let f=this[k].layers[t],c=null;for(let h of f.views){let d=!1;if(n!==null?(d=h.name===e&&h[J]?.view===n,d&&i!==-1&&(d=h[J]?.index===i)):d=h.name===e,!!d){s!==null&&(h[le]={view:s,index:o,level:t-1}),c=h;break}}if(c!==null)return c}let a=null,l=null;s!==null&&(s[G]?a={view:s,index:o,level:t-1}:a=s[J],l={view:s,index:o,level:t-1});let u=new Se(e,!0,a);if(u[le]=l,t==this[k].layers.length){let f=new ct;f.views=[u],this[k].layers.push(f)}else this[k].layers[t].views.push(u);return u}}const jn="fox-router-view",Tn="fox-router-link";function Er(r,e=!1){let t=null;return e?t=r.showFromClass??r.enterFromClass:t=r.enterFromClass,t||(t=r.transitionName,t?e?`${t}-show-from`:`${t}-enter-from`:null)}function Fr(r,e=!1){let t=null;return e?t=r.showActiveClass??r.enterActiveClass:t=r.enterActiveClass,t||(t=r.transitionName,t?e?`${t}-show-active`:`${t}-enter-active`:null)}function _n(r,e=!1){let t=null;return e?t=r.showToClass??r.enterToClass:t=r.enterToClass,t||(t=r.transitionName,t?e?`${t}-show-to`:`${t}-enter-to`:null)}function Kn(r,e=!1){let t=null;return e?t=r.hideFromClass??r.leaveFromClass:t=r.leaveFromClass,t||(t=r.transitionName,t?e?`${t}-hide-from`:`${t}-leave-from`:null)}function $n(r,e=!1){let t=null;return e?t=r.hideActiveClass??r.leaveActiveClass:t=r.leaveActiveClass,t||(t=r.transitionName,t?e?`${t}-hide-active`:`${t}-leave-active`:null)}function qn(r,e=!1){let t=null;return e?t=r.hideToClass??r.leaveToClass:t=r.leaveToClass,t||(t=r.transitionName,t?e?`${t}-hide-to`:`${t}-leave-to`:null)}function On(r,e=!1){let t=null;return e?t=r.beforeShow??r.beforeEnter:t=r.beforeEnter,t}function Ln(r,e=!1){let t=null;return e?t=r.show??r.enter:t=r.enter,t}function Mn(r,e=!1){let t=null;return e?t=r.afterShow??r.afterEnter:t=r.afterEnter,t}function In(r,e=!1){let t=null;return e?t=r.showCancelled??r.enterCancelled:t=r.enterCancelled,t}function Nn(r,e=!1){let t=null;return e?t=r.hide??r.leave:t=r.leave,t}function Hn(r,e=!1){let t=null;return e?t=r.afterHide??r.afterLeave:t=r.afterLeave,t}function Dn(r,e=!1){let t=null;return e?t=r.hideCancelled??r.leaveCancelled:t=r.leaveCancelled,t}function Vt(r){let e,t=r.duration;return typeof t=="object"?e={enter:t.enter??-1,leave:t.leave??-1,show:t.show??-1,hide:t.hide??-1}:(typeof t=="string"&&(t=t.length==0?-1:Number(t)),e={enter:t,leave:t,show:t,hide:t}),e}function ge(r,e){r.classList.contains(e)||r.classList.add(e)}function we(r,e){r.classList.remove(e)}const Vn=qe&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout;function Bt(r){Vn(r)}function D(r,e,t){P(e)&&(r==null&&(r={}),Reflect.apply(e,r,t))}function jr(r,e,t,n=-1,i,s,o,a){if(P(s)){if(i!==void 0&&i>=0){setTimeout(()=>{Reflect.apply(s,r,[e,t,n]),P(a)&&Reflect.apply(a,r,[])},i);return}const l=["animationend","transitionend"],u=f=>{l.forEach(c=>{qt(e,c,u)}),Reflect.apply(s,r,[e,t,n]),a&&Reflect.apply(a,r,[])};l.forEach(f=>{$t(e,f,u)})}if(P(o)){const l="animationcancel",u=f=>{Reflect.apply(o,r,[e,t,n]),qt(e,l,u)};$t(e,l,u)}}function Ut(r){return!qe||r===null?!1:r.opsType===E.Append||r.opsType===E.Open}function Tr(r,e,t,n={},i,s=-1){if(e||Ut(i)){const o=Er(n,e);o&&ge(t,o);const a=Fr(n,e);a&&ge(t,a);const l=On(n,e);D(r,l,[t,e,i,s])}}function _r(r,e,t,n={},i,s,o,a){if(!Ut(s)&&!e){P(a)&&a(r,a,[t]);return}const l=Er(n,e),u=Fr(n,e),f=_n(n,e),c=Ln(n,e),h=Mn(n,e),d=In(n,e);Bt(()=>{jr(r,t,s,o,i,()=>{u&&we(t,u),f&&we(t,f),P(h)&&D(r,h,[t,e,s,o]),P(a)&&a(r,a,[t])},()=>{P(d)&&D(r,d,[t,e,s,o])}),l&&we(t,l),f&&ge(t,f),P(c)&&D(r,c,[t,e,s,o])})}function Kr(r,e,t,n={},i,s,o,a,l){if(!Ut(o)&&!e){!e&&P(s)&&s();return}const u=Kn(n,e),f=$n(n,e),c=qn(n,e),h=Nn(n,e),d=Hn(n,e),y=Dn(n,e);u&&ge(t,u),f&&ge(t,f),P(h)&&D(r,h,[t,e,o,a]),Bt(()=>{jr(r,t,o,a,i,()=>{f&&we(t,f),c&&we(t,c),P(d)&&D(r,d,[t,e,o,a]),P(l)&&D(r,l,[t]),!e&&P(s)&&s()},()=>{P(y)&&D(r,y,[t,e,o,a]),P(l)&&D(r,l,[t]),!e&&P(s)&&s()}),u&&we(t,u),c&&ge(t,c)})}function Ot(r,e={},t,n=-1){const i=e.mode??"default",s=Vt(e);return{mode:i,persisted:!1,beforeEnter:a=>{Tr(r,!1,a,e,t,n)},enter:a=>{_r(r,!1,a,e,s.enter,t,n)},leave:(a,l)=>{Kr(r,!1,a,e,s.leave,l,t,n)},clone:a=>Ot(r,e,t,n)}}function $r(r){return r.el}function Bn(r,e,t={},n,i,s,o){if(s){const a=$r(e);if(a==null)return;const l=Vt(t);Tr(r,!0,a,t,n,i),_r(r,!0,a,t,l.show,n,i,u=>{P(o)&&D(r,o,[u])})}else P(o)&&D(r,o,[])}function Un(r,e,t={},n,i,s,o){if(s){const a=$r(e);if(a==null)return;const l=Vt(t);Kr(r,!0,a,t,l.hide,null,n,i,u=>{P(o)&&D(r,o,[u])})}else P(o)&&D(r,o,[])}function kn(r,e={}){Bt(()=>{for(let t=0;t<r.length;t++)Reflect.apply(r[t],e,[])})}function re(r,e,t){return typeof r=="function"?Reflect.apply(r,{},[e,t]):r}function Pt(r,e){if(!r)return null;const t=r(e);return t.length===1?t[0]:t}class Wn{node;state;constructor(e,t){this.node=e,this.state=t}}const Lt=v.defineComponent({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,required:!1,default:"default"},modelSlot:{type:[Object],required:!1},multi:{type:Boolean,required:!1,default:!1},tag:{type:[String,Object,Function],required:!1,default:"div"},viewTag:{type:[String,Object,Function],required:!1,default:"div"},viewTagProps:{type:[Object,Function],required:!1,default(){return{}}},viewClass:{type:[String,Function],required:!1},viewActiveClass:{type:[String,Function],required:!1},viewInactiveClass:{type:[String,Function],required:!1},transition:{type:[Boolean,String,Function],required:!1,default:!1},transitionName:{type:String,required:!1},enterFromClass:{type:String,required:!1},enterActiveClass:{type:String,required:!1},enterToClass:{type:String,required:!1},leaveFromClass:{type:String,required:!1},leaveActiveClass:{type:String,required:!1},leaveToClass:{type:String,required:!1},showFromClass:{type:String,required:!1},showActiveClass:{type:String,required:!1},showToClass:{type:String,required:!1},hideFromClass:{type:String,required:!1},hideActiveClass:{type:String,required:!1},hideToClass:{type:String,required:!1},beforeEnter:{type:Function,required:!1},enter:{type:Function,required:!1},afterEnter:{type:Function,required:!1},enterCancelled:{type:Function,required:!1},beforeLeave:{type:Function,required:!1},leave:{type:Function,required:!1},afterLeave:{type:Function,required:!1},leaveCancelled:{type:Function,required:!1},beforeShow:{type:Function,required:!1},show:{type:Function,required:!1},afterShow:{type:Function,required:!1},showCancelled:{type:Function,required:!1},beforeHide:{type:Function,required:!1},hide:{type:Function,required:!1},afterHide:{type:Function,required:!1},hideCancelled:{type:Function,required:!1}},setup(r,e){const t=v.getCurrentInstance();if(t===null||t.proxy===null){console.error("instance or instance.proxy not exist");return}const n=r.multi===!0,i=v.inject(et,null),s=v.inject(at,0),o=v.inject(tr,null),a=v.inject(ut,-1);let l=null;const u=r.modelSlot;if(u){v.provide(at,s+1),v.provide(ut,u.index),v.provide(ft,u.index);const c=u.route;if(!c){console.warn("child view render error, route not exist");return}const h=ze(t.proxy,!0);nn(h),lt(h,c)}else{if(i==null){console.error("router is not been injected");return}const c=r.name,h=v.inject(rr,null),d=v.inject(ft,0);if(l=i[gr](c,s,o,a,h,d),l===null)return;if(v.provide(rr,l),l[G]===!0&&v.provide(tr,l),!n){v.provide(ut,-1),v.provide(at,s+1),v.provide(ft,-1);const g=l.slots.value;if(g.length>0){const p=g[0].route;if(p){const m=ze(t.proxy,!0);lt(m,p)}}else{const p=ze(t.proxy,!0);l.compensation=()=>{const m=l.slots.value;if(m.length>0){const b=m[0].route;return b&<(p,b),!0}return!1}}}}const f={value:new Map};return v.onUnmounted(()=>{f.value&&f.value.clear()}),()=>{if(n){const c=new Map,h=[],d=l?.slots.value,y=[];for(let m=0;m<d.length;m++){const b=d[m],T=`${r.name}-${b.index}`,x=re(r.transition,b.route,m)??!0,C={modelSlot:b};let R;e.slots.default?R=v.h(Lt,C,{default:e.slots.default}):R=v.h(Lt,C);const q={},_=re(r.viewClass,b.route,m);typeof _=="string"&&_.length>0&&(q[_]=!0);const K=re(r.viewActiveClass,b.route,m),L=re(r.viewInactiveClass,b.route,m),W=f.value.get(T);if(typeof K=="string"&&K.length>0&&(q[K]=b.active),typeof L=="string"&&L.length>0&&(q[L]=!b.active),W&&b.active!==W.state){const ue=W.node;b.active?y.unshift(()=>{const nt=()=>{let be=Zt(ue);be!=null&&er(be,_t.ACTIVATED)};Bn(t,ue,r,b.route,m,x,nt)}):y.push(()=>{const nt=()=>{const be=Zt(ue);be!=null&&er(be,_t.DEACTIVATED)};Un(t,ue,r,b.route,m,x,nt)})}const z={class:q,key:T},tt=re(r.viewTagProps,b.route,m);tt!==null&&typeof tt=="object"&&j(!0,z,tt),b.route?.viewTagAttrs&&typeof b.route?.viewTagAttrs=="object"&&j(!0,z,b.route.viewTagAttrs);const Or=re(r.viewTag,b.route,m),rt=v.h(Or,z,{default:()=>[R]});if(c.set(T,new Wn(rt,b.active)),f.value.delete(T),x){const ue=Ot(t,r,b.route,m);rt.transition=ue}h.push(rt)}f.value.forEach(m=>{m.node.transition=null}),f.value=c,kn(y,t);const g=re(r.tag,null,-1),p={};return Object.assign(p,e.attrs),v.h(g,p,{default:()=>h})}else if(u!=null){const c=u.model,h={};c.props&&(typeof c.props=="object"?j(!1,h,c.props):c.props===!0&&typeof u.route?.params=="object"&&j(!1,h,u.route?.params));const d=v.h(c.component,h);return Pt(e.slots.default,{Component:d,route:u.route})??d}else{const c=l.slots.value;if(c.length>0){const h=c[0],d=h.model,y={};d.props&&(typeof d.props=="object"?j(!1,y,d.props):d.props===!0&&typeof h.route?.params=="object"&&j(!1,y,h.route?.params));const g=v.h(d.component,y);if(re(r.transition,h.route,-1)??!0){const m=Ot(t,r,h.route,-1);g.transition=m}return Pt(e.slots.default,{Component:g,route:h.route})??g}else return Pt(e.slots.fallback,{})}}}});function zn(r){if(!(r.metaKey||r.altKey||r.ctrlKey||r.shiftKey)&&!r.defaultPrevented&&!(r.button!=null&&r.button!==0)){if(r.currentTarget&&r.currentTarget.getAttribute){const e=r.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return r.preventDefault&&r.preventDefault(),!0}}function Jn(r,e){return r==null||e==null?!1:!!(r===e||r.path&&r.path===e.path||r.name&&r.name===e.name)}function Gn(r,e){return r==null||e==null?!1:!!(r.path&&e.path&&e.path.startsWith(r.path)||r.name&&r.name==e.name)}function pe(r,e){return typeof r=="function"?Reflect.apply(r,{},[e]):r}let Qn=v.defineComponent({name:"RouterLink",inheritAttrs:!1,props:{tag:{type:[String,Object,Function],required:!1,default:"a"},to:{type:[String,Object,Function],required:!0},root:{type:String},activeClass:{type:[String,Function],required:!1,default:"fox-router-link-active"},exact:{type:[String,Boolean,Function],required:!1},exactActiveClass:{type:[String,Function],required:!1,default:"fox-router-link-exact-active"},event:{type:[String,Function],required:!1,default:"onClick"}},setup(r,e){const t=v.inject(et,null);return()=>{let n=pe(r.to,null),i=pe(r.tag,n);if(i==null){console.warn("can not resolve link tag");return}let s=null,o=null;t!==null&&(s=t[H](n),r.root&&(s.root=r.root),o=t.current);let a={},l=pe(r.activeClass,s);if(typeof l=="string"&&l.length>0&&(a[l]=Gn(s,o)),pe(r.exact,s)===!0){let h=pe(r.exactActiveClass,s);typeof h=="string"&&h.length>0&&(a[h]=Jn(s,o))}let f={class:a};(i==="a"||i==="A")&&(f.href=s?.path??s?.name??"#"),j(!0,f,e.attrs);let c=pe(r.event,s);if(typeof c=="string"){const h=d=>{if(t==null){console.warn("router is not been injected");return}if(s==null){console.warn("route is not been resolved");return}zn(d)&&t.to(s)};f[c]=h}return v.h(i,f,e.slots)}}});var M=(r=>(r[r.Loading=0]="Loading",r[r.Loaded=1]="Loaded",r[r.Defining=2]="Defining",r[r.Defined=3]="Defined",r))(M||{}),Qe=(r=>(r[r.normal=0]="normal",r[r.factory=1]="factory",r))(Qe||{});class Xn{register=new Map;constructor(){}get(e){return this.register.get(e)??null}set(e,t){this.register.set(e,t)}remove(e){let t=this.register.get(e);return this.register.delete(e),t??null}has(e){return this.register.has(e)}clear(){this.register.clear()}}class yr{moduleManager=new Xn;options={paths:{},alias:{},nature:[],timeout:3e3};set paths(e){this.options.paths=e}get paths(){return this.options.paths}set alias(e){this.options.alias=e}get alias(){return this.options.alias}set naturePaths(e){this.options.nature=e}get naturePaths(){return this.options.nature}set timeout(e){this.options.timeout=e}get timeout(){return this.options.timeout}_query;set query(e){this._query=e}get query(){return this._query}get head(){return Le().head}constructor(){}setModule(e,t){const n={id:e,src:"",status:M.Defined};typeof t=="function"?(n.exports=t,n.type=Qe.factory):n.exports=t,this.moduleManager.set(e,n)}removeModule(e){this.moduleManager.remove(e)}ensure(...e){const t=[];let n=e.length-1;const i={};typeof e[n]=="object"&&(Object.assign(i,e[n]),n--);let s=null;typeof e[n]=="function"&&(s=e[n],n--);for(let l=0;l<=n;l++)if(Array.isArray(e[l])){let u=e[l];for(let f=0;f<u.length;f++)u[f]&&t.push(this.resolvePath(u[f]))}else if(typeof e[l]=="string"){let u=e[l].split(",");for(let f=0;f<u.length;f++)u[f]&&t.push(this.resolvePath(u[f]))}const o=new Yn(t.length,(l,u)=>{if(o.isOK())try{typeof s=="function"&&Reflect.apply(s,{},u)}catch(f){console.error(f.message,f)}else try{console.error(l),typeof s=="function"&&Reflect.apply(s,{},[])}catch(f){console.error(f.message,f)}}),a=new $e;for(let l=0;l<t.length;l++){const u=new Zn(l,t[l],i,o);this.mount(a,u)}return this}remove(...e){let t=[],n=e.length-1,i={};typeof e[n]=="object"&&(Object.assign(i,e[n]),n--);let s=null;typeof e[n]=="function"&&(s=e[n],n--);for(let o=0;o<=n;o++)if(Array.isArray(e[o])){let a=e[o];for(let l=0;l<a.length;l++)a[l]&&t.push(this.resolvePath(a[l]))}else{let a=e[o].split(",");for(let l=0;l<a.length;l++)a[l]&&t.push(this.resolvePath(a[l]))}return t.forEach(o=>{this.unmount(o,i)}),typeof s=="function"&&Reflect.apply(s,{},[]),this}mount(e,t){if(t.src==="exports"){e.post(i=>{t.progress.work(!0,t.index,"exports"),i.resolve()});return}else if(t.src==="module"){e.post(i=>{t.progress.work(!0,t.index,"module"),i.resolve()});return}if(this.isNaturePath(t.src)){let i=t.params.jsPoint;i||(i=this.head),this.mountJS(e,t,i);return}else if(this.isNaturePath(t.src)){let i=t.params.cssPoint;i||(i=this.head),this.mountCSS(e,t,i);return}let n=this.getFileNamePostfix(t.src);if(n==="js"||n.length===0){let i=t.params.jsPoint;i||(i=this.head),this.mountJS(e,t,i);return}else if(n==="css"){let i=t.params.cssPoint;i||(i=this.head),this.mountCSS(e,t,i);return}}mountCSS(e,t,n){e.post(i=>{const s=t.src,o=this.moduleManager.get(s);if(o&&(o.status==M.Defined||o.status==M.Loaded)&&o.exports){o.type===Qe.factory&&typeof o.exports=="function"?t.progress.work(!0,t.index,o.exports()):t.progress.work(!0,t.index,o.exports),i.resolve();return}const a=Le(),l=a.createElement("link");if(Reflect.has(l,"onload"))l.onload=()=>{l.onload=null,l.onerror=null,t.progress.work(!0,t.index,t.src),i.resolve()},l.onerror=()=>{try{n.removeChild(l)}catch(c){console.error(c.message,c)}l.onload=null,l.onerror=null,t.progress.work(!1,t.index,null),i.reject()};else{const c={timeout:this.options.timeout??3e3,time:0,success:()=>{t.progress.work(!0,t.index,t.src),i.resolve()},error:()=>{try{n.removeChild(l)}catch(h){console.error(h.message,h)}t.progress.work(!1,t.index,null),i.resolve()}};setTimeout(()=>{qr(l,c)},1)}let f=a.getElementById(s);f&&f.parentNode&&f.parentNode.removeChild(f),l.rel="stylesheet",l.type="text/css",l.id=s,l.href=s,n.appendChild(l)})}mountJS(e,t,n){e.post(i=>{const s=t.src;let o=this.moduleManager.get(s);if(o&&(o.status==M.Defined||o.status==M.Loaded)){if(o.exports){o.type===Qe.factory&&typeof o.exports=="function"?t.progress.work(!0,t.index,o.exports()):t.progress.work(!0,t.index,o.exports),i.resolve();return}if(document.querySelector(`script[src='${s}`)){t.progress.work(!0,t.index,o.exports),i.resolve();return}}o={id:s,src:s,status:M.Loading},this.moduleManager.set(s,o);const l=Le().createElement("script");if("onload"in l)l.onload=()=>{l.onload=null,l.onerror=null,o.status==M.Loading&&(o.status=M.Loaded,t.progress.work(!0,t.index,s)),i.resolve()},l.onerror=()=>{try{n.removeChild(l)}catch(c){console.error(c.message,c)}l.onload=null,l.onerror=null,this.moduleManager.remove(s),t.progress.work(!1,t.index,null),i.resolve()};else{const c=l;c.onreadystatechange=()=>{/loaded|complete/.test(c.readyState)&&(c.onreadystatechange=null,o.status==M.Loading&&(o.status=M.Loaded,t.progress.work(!0,t.index,s)),i.resolve())}}l.defer=!0,l.src=s;const f=I();f.define=this.createDefine(o,t),n.appendChild(l)})}unmount(e,t={}){const n=Le(),i=this.getFileNamePostfix(e);if(i==="js"||i.length===0){const s=n.querySelector(`script[src="${e}"]`);s&&s.parentNode&&s.parentNode.removeChild(s),this.moduleManager.remove(e);return}else if(i==="css"){const s=n.querySelector(`style[href="${e}"]`);s&&s.parentNode&&s.parentNode.removeChild(s);return}}trimEmptyElement(e){let t=[];for(let n=0;n<e.length;n++){if(e[n]===void 0||e[n]===null)continue;const i=e[n].trim();i.length!==0&&t.push(i)}return t}createDefine(e,t){const n=this,i=function(...s){e.status=M.Defining;let o,a,l,u=s.length;u===1?(l=s[0],o=void 0):u===2?(l=s[1],Array.isArray(s[0])?(a=n.trimEmptyElement(s[0]),o=void 0):a=void 0):(o=s[0],a=n.trimEmptyElement(s[1]),l=s[2]),o&&(e.id=o,n.options.alias[o]=e.src),a&&a.length>0?n.ensure(a,(...f)=>{const c=f.map(h=>h==="exports"?((!e.exports||typeof e.exports!="object")&&(e.exports={}),e.exports):h==="module"?e:h);if(typeof l=="function"){const h=Reflect.apply(l,e,c);h&&typeof h=="object"&&(e.exports=h)}else e.exports=l;e.status=M.Defined,t.progress.work(!0,t.index,e.exports)}):(typeof l=="function"?e.exports=Reflect.apply(l,e,[]):e.exports=l,e.status=M.Defined,t.progress.work(!0,t.index,e.exports))};return i.amd=!0,i}resolvePath(e){try{if(e==="exports"||e==="module"||this.isNaturePath(e))return e;e=this.parserPath(e,!0);let t=this.getFileNamePostfix(e);t=t.toLowerCase();let n=this.createSearch(this.query);return e.indexOf("?")==-1?(t!=="js"&&t!=="css"&&(e+=".js"),n.length>0&&(e+=`?${n}`)):n.length>0&&(e+=`&${n}`),e}catch(t){throw console.error(`resolve path[${e}] fail`,t),t}}createSearch(e){let t="";if(e){for(let n in e){let i=`${e[n]}`;t+=`${encodeURIComponent(n)}=${encodeURIComponent(i)}&`}t.length>0&&(t=t.substring(0,t.length-1))}return t}getFileNamePostfix(e){let t=e.lastIndexOf("?");t==-1&&(t=e.length);let n=e.lastIndexOf(".",t);return n==-1?"":e.substring(n+1,t)}isNaturePath(e){if(!this.options.nature)return!1;if(typeof this.options.nature=="function")return this.options.nature(e);const t=this.options.nature;if(t&&Array.isArray(t))for(let n=0;n<t.length;n++){const i=t[n];if(e.indexOf(i)===0)return!0}return!1}parserPath(e,t){if(e.indexOf("http://")==0||e.indexOf("https://")==0||e.indexOf("file:///")==0)return e;if(e.indexOf("/")==0)return`${ht()}${e.slice(1)}`;if(e.indexOf("./")==0)return`${ht()}${e.slice(2)}`;if(e.indexOf("//")==0)return`${I().location.protocol}${e}`;if(t){let i=this.options.alias[e];if(!i){let s=e.indexOf("/");if(s==-1)i=e;else{let o=e.slice(0,s),a=this.options.paths[o];a?i=a+e.slice(s):i=e}}return this.parserPath(i,!1)}return`${ht()}${e}`}}function qr(r,e){let t=r.sheet,n=!1;if(e.isOldWebKit)t&&(n=!0);else if(t)try{t.cssRules&&(n=!0)}catch(i){i.name==="NS_ERROR_DOM_SECURITY_ERR"&&(n=!0)}setTimeout(()=>{e.time+=20,n?e.success():e.timeout>e.timeout?e.error():qr(r,e)},20)}class Yn{callback;values;status;size;lastIndex;constructor(e,t){this.size=e,this.callback=t,this.status=!0,this.values=[],this.lastIndex=-1}work(e,t,n){if(this.status=e,this.status===!0&&(this.lastIndex!==t&&this.size--,this.lastIndex=t,this.values.push(n)),this.size===0||this.status===!1)try{Reflect.apply(this.callback,this,[this.status,this.values])}catch(i){console.error(i.message,i)}}isOK(){return this.status}}class Zn{index;src;params;progress;constructor(e,t,n,i){this.index=e,this.src=t,this.params=n,this.progress=i}}const kt=Symbol("fk"),Wt=Symbol("fbk"),zt=Symbol("fepk");function ei(r={}){const e=new Fn(r),t=new Ft,n=new jt,i=new yr,s={get router(){return e},get bus(){return t},get Bus(){return Ft},get EventProxy(){return jt},get eventproxy(){return n},get EventChain(){return $e},get Require(){return yr},get require(){return i},get extend(){return j},get clone(){return _e},get isESModule(){return Mt},install(o){o.provide(et,e),o.provide(kt,s),o.provide(Wt,t),o.provide(zt,n),o.component(jn,Lt),o.component(Tn,Qn),Reflect.defineProperty(o.config.globalProperties,"$fox",{get(){return s}}),Reflect.defineProperty(o.config.globalProperties,"$router",{get(){return e}}),Reflect.defineProperty(o.config.globalProperties,"$bus",{get(){return t}}),Reflect.defineProperty(o.config.globalProperties,"$bus",{get(){return t}}),Reflect.defineProperty(o.config.globalProperties,"$eventProxy",{get(){return n}}),o.config.globalProperties.$fox_on=function(a,l,u=!1){n.on(a,l,u)},o.config.globalProperties.$fox_off=function(a,l){n.off(a,l)},o.config.globalProperties.$fox_once=function(a,l){n.once(a,l)},o.config.globalProperties.$fox_all=function(...a){let l=n;Reflect.apply(l.all,l,a)},o.config.globalProperties.$fox_trigger=function(a,...l){let u=n;Reflect.apply(u.trigger,u,[a,...l])},o.config.globalProperties.$fox_emit=function(a,...l){let u=n;Reflect.apply(u.trigger,u,[a,...l])},o.mixin({computed:{$route(){return xr(this)}}}),e.init()}};return s}function Jt(r){return r?r.$router:v.inject(et)}function ti(r){return r||(r=v.getCurrentInstance()?.proxy??void 0),r?xr(r):null}function ri(r){return r?r.$fox:v.inject(kt)}function ni(r){return r?r.$bus:v.inject(Wt)}function ii(r){return r?r.$eventProxy:v.inject(zt)}function si(r){const e=Jt(),t=(n,i,s)=>{try{Reflect.apply(r,{},[n,i])}catch(o){console.error(o)}s()};e.beforeEach(t),v.onUnmounted(()=>{e.removeBeforeEach(t)})}function oi(r){const e=Jt(),t=(n,i,s)=>{try{Reflect.apply(r,{},[n,i])}catch(o){console.error(o)}s()};e.afterEach(t),v.onUnmounted(()=>{e.removeAfterEach(t)})}exports.Bus=Ft;exports.EventChain=$e;exports.EventProxy=jt;exports.Route=$;exports.clone=_e;exports.createFox=ei;exports.createMemoryHistory=Ar;exports.createWebHashHistory=Cr;exports.createWebHistory=Pn;exports.extend=j;exports.foxBusKey=Wt;exports.foxEventProxyKey=zt;exports.foxKey=kt;exports.isArray=Lr;exports.isDate=Nr;exports.isESModule=Mt;exports.isEqual=Et;exports.isFunction=P;exports.isMap=Mr;exports.isObject=pr;exports.isPlainObject=Ct;exports.isPromise=Vr;exports.isSet=Ir;exports.isString=Hr;exports.isSymbol=Dr;exports.onAfterRouteUpdate=oi;exports.onBeforeRouteUpdate=si;exports.onFoxActivated=an;exports.onFoxInactivated=un;exports.sessionKey=ne;exports.toBoolean=It;exports.toNumber=Wr;exports.toTypeString=Ze;exports.typeOf=At;exports.useBus=ni;exports.useEventProxy=ii;exports.useFox=ri;exports.useRoute=ti;exports.useRouter=Jt;
|
package/libs/index.esm.d.ts
CHANGED
|
@@ -412,6 +412,10 @@ export declare interface Fox {
|
|
|
412
412
|
* 返回clone
|
|
413
413
|
*/
|
|
414
414
|
get clone(): Function;
|
|
415
|
+
/**
|
|
416
|
+
* 判断是否为es模块
|
|
417
|
+
*/
|
|
418
|
+
get isESModule(): Function;
|
|
415
419
|
/**
|
|
416
420
|
* 安装
|
|
417
421
|
* @param app
|
|
@@ -875,13 +879,13 @@ declare class Require {
|
|
|
875
879
|
* 创建define函数
|
|
876
880
|
* @param module
|
|
877
881
|
* @param task
|
|
878
|
-
* @returns
|
|
882
|
+
* @returns
|
|
879
883
|
*/
|
|
880
884
|
private createDefine;
|
|
881
885
|
/**
|
|
882
886
|
* 解析路径
|
|
883
887
|
* @param uri
|
|
884
|
-
* @returns
|
|
888
|
+
* @returns
|
|
885
889
|
*/
|
|
886
890
|
private resolvePath;
|
|
887
891
|
/**
|