@fox-js/fox 3.0.1-13 → 3.0.1-14

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 CHANGED
@@ -1,3 +1,3 @@
1
1
  "use strict";/*!
2
- * fox v3.0.0 Mon Jan 16 2023 10:46:28 GMT+0800 (中国标准时间)
3
- */Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("vue"),fr=Array.isArray,$r=r=>Ze(r)==="[object Map]",Mr=r=>Ze(r)==="[object Set]",Or=r=>r instanceof Date,S=r=>typeof r=="function",Lr=r=>typeof r=="string",Nr=r=>typeof r=="symbol",cr=r=>r!==null&&typeof r=="object",Hr=r=>cr(r)&&S(r.then)&&S(r.catch),Ir=Object.prototype.toString,Ze=r=>Ir.call(r),Ge=r=>Ze(r)==="[object Object]",kr=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol";function hr(r){return r.__esModule||kr&&r[Symbol.toStringTag]==="Module"}const Dr=typeof Promise<"u"&&Promise.toString().indexOf("[native code]")!==-1;function T(...r){let t=r[0]!==void 0&&r[0]!==null?r[0]:{},e=1,n=r.length,i=!1;for(typeof t=="boolean"&&(i=t,t=r[e]??{},e++),typeof t!="object"&&(t={});e<n;e++)if(r[e]!==null&&r[e]!==void 0){let s=r[e];for(let o in s){let l=t[o],u=s[o];if(l!==u)if(i===!0&&u&&typeof u=="object"){let a;Array.isArray(u)?a=l&&Array.isArray(l)?l:[]:a=l&&typeof l=="object"?l:{},t[o]=T(i,a,u)}else u!==void 0&&(t[o]=u)}}return t}function Ke(r,t,e=!1){if(!e)T(!0,r,t);else{if(typeof t!="object")return{};typeof r!="object"&&(r={});for(let i in t){let s=r[i],o=t[i];if(s!==o)if(typeof o=="object"){if(!Array.isArray(o)&&!Ge(o))continue;s=Ke(s,o,e),r[i]=s}else{if(typeof o=="function")continue;r[i]=o}}const n=Object.getOwnPropertySymbols(t);for(let i of n){let s=r[i],o=t[i];if(s!==o)if(typeof o=="object"){if(!Array.isArray(o)&&!Ge(o))continue;s=Ke(s,o,e),r[i]=s}else{if(typeof o=="function")continue;r[i]=o}}}return r}class ne{static seed=new Date().getTime();static get(){let t=++ne.seed;return t>=Number.MAX_VALUE&&(ne.seed=0),t}}const it=Dr?Promise.resolve():null;function Te(r,...t){it!==null?t&&t.length>0?it.then(()=>{r(t)}):it.then(r):t&&t.length>0?setTimeout(()=>{r(t)}):setTimeout(r)}function jt(r){return r==null?!1:typeof r=="boolean"?r:typeof r=="string"?r.toLocaleLowerCase()==="true":Boolean(r)}function Vr(r){return typeof r=="number"?r:Number(r)}const Br={"[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 _e(r){let e=Object.prototype.toString.call(r);return r==null?String(r):Br[e]||"object"}function yr(r){return r&&typeof r=="object"&&"setInterval"in r}function $t(r){let t=!!r&&"length"in r&&r.length,e=_e(r);return e==="function"||yr(r)?!1:e==="array"||t===0||typeof t=="number"&&t>0&&t-1 in r}function dr(r,t){let e=+t.length,n=0,i=r.length;for(;n<e;n++)r[i++]=t[n];return r.length=i,r}function Ur(r,t=[]){let e=t;return r!=null&&($t(Object(r))?dr(e,typeof r=="string"?[r]:r):e.push(r)),e}function Wr(r,t,e){if($t(r))Reflect.apply([].forEach,r,[t]);else for(let n in r)if(e&&r.hasOwnProperty(n)){if(Reflect.apply(t,r,[r[n]])===!1)break}else if(Reflect.apply(t,r,[r[n]])===!1)break;return r}function Je(r,t){if(r==t)return!0;if(r===void 0||t===void 0)return!1;let e=_e(r),n=_e(t);if(e!==n)return!1;if(e==="object"){let i=Object.keys(r),s=Object.keys(t);if(i.length!==s.length)return!1;for(let o=0;o<i.length;o++){let l=i[o],u=r[l],a=t[l];if(!Je(u,a))return!1}return!0}else if(e==="array"){if(r.length!==t.length)return!1;for(let i=0;i<r.length;i++){let s=r[i],o=t[i];if(!Je(s,o))return!1}return!0}return!1}const Ut=Symbol("idKey"),le=Symbol("valueKey"),P=Symbol("childrenKey"),J=Symbol("growKey");class vr{[J]=!0;[Ut];[le]=p.ref();[P]=new Map;constructor(t){this[Ut]=t}}class zr{get(t,e){if(e=="value")return t[le].value;if(e==="grow")return t[J];let n=t[P].get(e);if(n)return qe(n);if(t[J])return n=Ot(e),n[J]=t[J],t[P].set(e,n),qe(n)}set(t,e,n){return e=="value"?(t[le].value=n,!0):e==="grow"?(t[J]=jt(n),!0):n==null?(t[P].delete(e),!0):(console.error(`illegal property:${e}`),!1)}deleteProperty(t,e){return e==="value"||e=="grow"?(console.error(`can not delete property:${String(e)}`),!1):(t[P].delete(e),!0)}}const Mt="__proxy__";function Ot(r){let t=new vr(r);return Reflect.set(t,Mt,new Proxy(t,new zr)),t}function qe(r){return Reflect.get(r,Mt)}class mr extends vr{constructor(){super("__root__")}put(...t){let e=t.length;if(e<2)return console.error("参数至少包括一个(key, value)"),!1;let n=this;for(let i=0;i<e-1;i++){let s=t[i],o;n[P].has(s)?o=n[P].get(s):(o=Ot(s),n[P].set(s,o)),n=o}return n[le].value=t[e-1],!0}get(...t){let e=t.length;if(e===0)return;let n=this;for(let i=0;i<e;i++){let s=t[i];if(n[P].has(s))n=n[P].get(s);else return}return n[le].value}remove(...t){let e=t.length;if(e==0)return!1;let n=this;for(let s=0;s<e-1;s++){let o=t[s];if(n[P].has(o))n=n[P].get(o);else return!1}let i=t[e-1];return n[P].has(i)?(n[P].delete(i),!0):!1}contains(...t){let e=t.length;if(e==0)return!1;let n=this;for(let s=0;s<e-1;s++){let o=t[s];if(n[P].has(o))n=n[P].get(o);else return!1}let i=t[e-1];return n[P].has(i)}clear(){this[P].clear()}}const Gr=["put","get","contains","remove","clear"];function Wt(r){return Gr.includes(r)}class Jr{get(t,e){if(e=="value")return t[le].value;if(e==="grow")return t[J];if(e===P)return t[P];if(typeof e=="string"&&Wt(e))return t[e];let n=String(e),i=t[P].get(n);if(i)return qe(i);if(t[J])return i=Ot(n),i[J]=t[J],t[P].set(n,i),qe(i)}set(t,e,n){return e=="value"?(t[le].value=n,!0):e==="grow"?(t[J]=jt(n),!0):Wt(e)?!1:n==null?(t[P].delete(e),!0):(console.error(`illegal property:${e}`),!1)}deleteProperty(t,e){return e==="value"||e=="grow"?(console.error(`can not delete property:${String(e)}`),!1):(t[P].delete(e),!0)}}function Qr(){let r=new mr,t=new Jr,e=new Proxy(r,t);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,[])}},e),Reflect.set(r,Mt,e),r}let Pt=new Proxy(mr,{construct(r,...t){let e=Qr();return qe(e)}});const Y="default",pr=Symbol("sync"),N=Symbol("resolveRoute");function zt(r){let t=!1;return function(...e){if(!t)return t=!0,Reflect.apply(r,{},e)}}function Xr(r){let t=r.src;return new Promise((e,n)=>{const i=zt(l=>{hr(l)&&(l=l.default),r.component=l,console.debug("success load async module"),e()}),s=zt(l=>{console.debug("reject load async module"),n(l)});let o;try{o=t(i,s)}catch(l){s(l)}if(o)if(typeof o.then=="function")o.then(i,s);else{const l=o.component;l&&typeof l.then=="function"&&l.then(i,s)}})}class Yr{name;level;rootName;rootIndex=0;constructor(t,e,n,i){this.name=t,this.level=e,this.rootName=n,this.rootIndex=i}}class Qe{to;routeModel;from;data={};constructor(t,e){this.to=t,this.from=e}static from(t){let e=new Qe(t.to,t.from),n=t.data??{};return T(!0,e.data,n),e}}class j{path;get fullPath(){const t=this.path??`/${this.name}`;return`${this.root??Y}!${t}`}name;root;params;query;matched;meta;success;error;destroy;opsType;updateType;viewTagAttrs;index;active;slot;session;static clone(t,e){let n=new j;return Ke(n,t,e),n}static isSame(t,e){return t===e?!0:!(t==null||e==null||t.path&&t.path!==e.path||t.name&&t.name!==e.name||t.root!==e.root||t.index!==e.index)}static isSameForRouteModel(t,e){return t===e?!0:!(t==null||e==null||t.path&&t.path!=e.path||t.name&&t.name!=e.name)}static from(t){let e=new j;if(t==null)return e;let n=e;for(let s in t){let o=t[s];n[s]=o}const i=Object.getOwnPropertySymbols(t);if(Array.isArray(i)&&i.length>0)for(let s of i)n[s]=t[s];return e}}class Zr{id;name;props;meta;src;component;constructor(t,e,n,i){this.id=ne.get(),this.name=t,this.src=e,typeof e!="function"&&(this.component=e),this.props=n,this.meta=i}get isResolved(){return this.component!==void 0}resolve(){return Xr(this)}}class Gt{models=[]}class st{path;match;redirect;name;layers=[]}const I=Symbol("chainKey"),L=Symbol("cursorKey"),ot=Symbol("$persistentModeKey"),F=Symbol("statusKey"),Q=Symbol("argsKey"),$e=Symbol("exArgsKey"),ae=Symbol("successFnsKey"),be=Symbol("errorFnsKey"),re=Symbol("sessionKey"),X=Symbol("_go");class Xe{[I]=[];[L]=0;[ot]=!1;[F]="Free";[Q]=[];[$e]=[];[ae]=[];[be]=[];[re];get session(){return this[re]}constructor(t,e=!1){this[re]=t,this[ot]=e}[X](t,...e){let n=this[F];if(this[F]="Busy",this[L]+=t,this[L]<0&&(this[L]=0),this[Q]=e,n==="Exception"||n==="Reject"){let l=[{session:this[re]},...this[$e]];for(;this[be].length>0;)try{let u=this[be].shift();typeof u=="function"&&Te(()=>{Reflect.apply(u,{},l)})}catch(u){console.error(u.message,u)}return this[F]=n,this[I]=[],this[L]=0,this}else if(n==="Finished"||this[L]>=this[I].length){let l=[{session:this[re]},...this[Q]];for(;this[ae].length>0;){let u=this[ae].shift();typeof u=="function"&&Te(()=>{Reflect.apply(u,{},l)})}return this[F]="Free",this}if(this[L]>=this[I].length)return this[F]="Free",this;let i=this[I][this[L]];this[ot]||(this[I].splice(0,this[L]+1),this[L]=-1);let s=this[L]+1;try{let o=!1,l={go:(u,...a)=>{o||(o=!0,Reflect.apply(this[X],this,[u,...a]))},resolve:(...u)=>{o||(o=!0,Reflect.apply(this[X],this,[1,...u]))},reject:(...u)=>{o||(o=!0,Reflect.apply(this.reject,this,[...u]))},insert:u=>{o||(this[I].splice(s,0,u),s++)},session:this[re]};Te(()=>{Reflect.apply(i,{},[l,...this[Q]])})}catch(o){this.throw(o)}return this}go(t,...e){return Reflect.apply(this[X],this,[t,...e])}finish(...t){return this[F]="Finished",this[Q]=t,Reflect.apply(this[X],this,[0])}reject(...t){return this[F]="Reject",this[$e]=t,Reflect.apply(this[X],this,[0])}throw(...t){return this[F]="Exception",this[$e]=t,Reflect.apply(this[X],this,[0])}reset(...t){this[F]="Busy",this[Q]=t,this[I]=[],this[L]=0;let n=[{session:this[re]},...this[Q]];for(;this[ae].length>0;){let i=this[ae].shift();Te(()=>{Reflect.apply(i,this,n)})}return this[F]="Free",this}post(t){return this[F]==="Reject"||this[F]==="Exception"?this:(Array.isArray(t)?this[I]=[...this[I],...t]:this[I].push(t),this[F]==="Busy"?this:(Reflect.apply(this[X],this,[0,...this[Q]]),this))}wait(t,e){return t&&typeof t=="function"&&this[ae].push(t),e&&typeof e=="function"&&this[be].push(e),this[F]==="Busy"?this:(Reflect.apply(this[X],this,[0,...this[Q]]),this)}exception(t){return t&&typeof t=="function"&&this[be].push(t),this[F]==="Busy"?this:Reflect.apply(this[X],this,[0,...this[Q]])}isFinish(){return this[F]=="Reject"||this[F]=="Free"&&this[L]>=this[I].length}}const fe=Symbol("registerKey");class en{policy;callback;constructor(t,e){this.callback=t,this.policy=e}}class At{[fe]=new Map;constructor(){}on(t,e,n=!1){let i=this[fe].get(t);i||(i=new Array,this[fe].set(t,i));let s=n===!0?1:0,o=new en(e,s);return i.push(o),this}off(t,e){if(!e)return this[fe].delete(t),this;let n=this[fe].get(t);if(n){for(let i=0;i<n.length;i++)if(n[i].callback===e){n.splice(i,1);break}}return this}bind(t,e,n=!1){return this.on(t,e,n)}unbind(t,e){return this.off(t,e)}once(t,e){return this.on(t,e,!0)}all(...t){let e=t.length;if(e<1)return this;let n=t[e-1];if(typeof n!="function")return console.error("callback can not benn empty"),this;let i=e-1,s=new Array(i),o=[].splice.call(t,0,i);for(let l=0;l<o.length;l++)this.once(o[l],u=>{s[l]=u,i-=1,i==0&&Reflect.apply(n,{},s)});return this}emit(t,...e){let n=this[fe].get(t);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,{},e)})}catch(o){console.error(o.message,o)}}return this}trigger(t,...e){return Reflect.apply(this.emit,this,[t,...e])}}const Re=Symbol("registerKey");class tn{[Re]=new Map;constructor(){}set(t,e){this[Re].set(t,e)}get(t){return this[Re].get(t)}has(t){return this[Re].has(t)}delete(t){return this[Re].delete(t)}}const Ct=Symbol("lc");function Ue(r,t=!1){let e=r,n=e[Ct];if(!n)if(t)n=new tn,e[Ct]=n;else return null;return n}function gr(r,t){let e=r;for(;e!==null;){const n=e[Ct];if(n&&n.has(t))return n.get(t);e=e.$parent}return null}function Jt(r){if(Array.isArray(r.children)&&r.children.length>0){let t=r.children[0];if(t!=null&&t.component!=null&&t.component.proxy!=null)return Ue(t.component.proxy,!1)}return null}const Ye=Symbol("hooksKey");function rn(r){let t=r.get(Ye);t||(t=[],r.set(Ye,t))}function Qt(r,t){let e=r.get(Ye);if(e!=null)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.type===t)try{Reflect.apply(i.hook,i.target,[])}catch(s){console.error(s.message,s)}}}var Et=(r=>(r.DEACTIVATED="da",r.ACTIVATED="a",r))(Et||{});class nn{type;hook;target;constructor(t,e,n){this.target=n,this.hook=e,this.type=t}}function sn(r,t,e,n){let i=new nn(t,e,n);return r.push(i),!0}function on(r,t,e,n){let i=-1;for(let s=0;s<r.length;s++){let o=r[s];if(o.type===t&&o.hook===e&&o.target===n){i=s;break}}return i!=-1?(r.splice(i,1),!0):!1}function wr(r){return(t,e)=>{let n;if(e)n=e;else{let s=p.getCurrentInstance();if(s==null||s.proxy==null){console.error("can not get current instance or proxy");return}n=s.proxy}let i=gr(n,Ye);if(i==null){console.warn("can not get hooks context");return}p.onUnmounted(()=>{on(i,r,t,n)}),sn(i,r,t,n)}}let ln=wr("a"),un=wr("da");function an(){let r=new j;return r.path="",r.name="",r.params={},r.index=-1,p.shallowReactive(r)}const Ft=Symbol("routeKey");function lt(r,t){let e=r.get(Ft);if(e){let n={path:"",name:"",params:{},index:-1,session:{}};Object.assign(n,t),Object.assign(e,n)}else e=an(),Object.assign(e,t),r.set(Ft,e)}function br(r){let t=gr(r,Ft);return t??null}const et=Symbol("rk"),ut=Symbol("vd"),Xt=Symbol("rv"),at=Symbol("rvi"),Yt=Symbol("pv"),ft=Symbol("pvi");function fn(r){for(var t=[],e=0;e<r.length;){var n=r[e];if(n==="*"||n==="+"||n==="?"){t.push({type:"MODIFIER",index:e,value:r[e++]});continue}if(n==="\\"){t.push({type:"ESCAPED_CHAR",index:e++,value:r[e++]});continue}if(n==="{"){t.push({type:"OPEN",index:e,value:r[e++]});continue}if(n==="}"){t.push({type:"CLOSE",index:e,value:r[e++]});continue}if(n===":"){for(var i="",s=e+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(e));t.push({type:"NAME",index:e,value:i}),e=s;continue}if(n==="("){var l=1,u="",s=e+1;if(r[s]==="?")throw new TypeError('Pattern cannot start with "?" at '.concat(s));for(;s<r.length;){if(r[s]==="\\"){u+=r[s++]+r[s++];continue}if(r[s]===")"){if(l--,l===0){s++;break}}else if(r[s]==="("&&(l++,r[s+1]!=="?"))throw new TypeError("Capturing groups are not allowed at ".concat(s));u+=r[s++]}if(l)throw new TypeError("Unbalanced pattern at ".concat(e));if(!u)throw new TypeError("Missing pattern at ".concat(e));t.push({type:"PATTERN",index:e,value:u}),e=s;continue}t.push({type:"CHAR",index:e,value:r[e++]})}return t.push({type:"END",index:e,value:""}),t}function Rr(r,t){t===void 0&&(t={});for(var e=fn(r),n=t.prefixes,i=n===void 0?"./":n,s="[^".concat(ve(t.delimiter||"/#?"),"]+?"),o=[],l=0,u=0,a="",f=function(x){if(u<e.length&&e[u].type===x)return e[u++].value},h=function(x){var $=f(x);if($!==void 0)return $;var _=e[u],q=_.type,O=_.index;throw new TypeError("Unexpected ".concat(q," at ").concat(O,", expected ").concat(x))},c=function(){for(var x="",$;$=f("CHAR")||f("ESCAPED_CHAR");)x+=$;return x};u<e.length;){var y=f("CHAR"),d=f("NAME"),g=f("PATTERN");if(d||g){var v=y||"";i.indexOf(v)===-1&&(a+=v,v=""),a&&(o.push(a),a=""),o.push({name:d||l++,prefix:v,suffix:"",pattern:g||s,modifier:f("MODIFIER")||""});continue}var m=y||f("ESCAPED_CHAR");if(m){a+=m;continue}a&&(o.push(a),a="");var b=f("OPEN");if(b){var v=c(),K=f("NAME")||"",R=f("PATTERN")||"",A=c();h("CLOSE"),o.push({name:K||(R?l++:""),pattern:K&&!R?s:R,prefix:v,suffix:A,modifier:f("MODIFIER")||""});continue}h("END")}return o}function cn(r,t){return hn(Rr(r,t),t)}function hn(r,t){t===void 0&&(t={});var e=Lt(t),n=t.encode,i=n===void 0?function(u){return u}:n,s=t.validate,o=s===void 0?!0:s,l=r.map(function(u){if(typeof u=="object")return new RegExp("^(?:".concat(u.pattern,")$"),e)});return function(u){for(var a="",f=0;f<r.length;f++){var h=r[f];if(typeof h=="string"){a+=h;continue}var c=u?u[h.name]:void 0,y=h.modifier==="?"||h.modifier==="*",d=h.modifier==="*"||h.modifier==="+";if(Array.isArray(c)){if(!d)throw new TypeError('Expected "'.concat(h.name,'" to not repeat, but got an array'));if(c.length===0){if(y)continue;throw new TypeError('Expected "'.concat(h.name,'" to not be empty'))}for(var g=0;g<c.length;g++){var v=i(c[g],h);if(o&&!l[f].test(v))throw new TypeError('Expected all "'.concat(h.name,'" to match "').concat(h.pattern,'", but got "').concat(v,'"'));a+=h.prefix+v+h.suffix}continue}if(typeof c=="string"||typeof c=="number"){var v=i(String(c),h);if(o&&!l[f].test(v))throw new TypeError('Expected "'.concat(h.name,'" to match "').concat(h.pattern,'", but got "').concat(v,'"'));a+=h.prefix+v+h.suffix;continue}if(!y){var m=d?"an array":"a string";throw new TypeError('Expected "'.concat(h.name,'" to be ').concat(m))}}return a}}function yn(r,t){var e=[],n=xr(r,e,t);return dn(n,e,t)}function dn(r,t,e){e===void 0&&(e={});var n=e.decode,i=n===void 0?function(s){return s}:n;return function(s){var o=r.exec(s);if(!o)return!1;for(var l=o[0],u=o.index,a=Object.create(null),f=function(c){if(o[c]===void 0)return"continue";var y=t[c-1];y.modifier==="*"||y.modifier==="+"?a[y.name]=o[c].split(y.prefix+y.suffix).map(function(d){return i(d,y)}):a[y.name]=i(o[c],y)},h=1;h<o.length;h++)f(h);return{path:l,index:u,params:a}}}function ve(r){return r.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function Lt(r){return r&&r.sensitive?"":"i"}function vn(r,t){if(!t)return r;for(var e=/\((?:\?<(.*?)>)?(?!\?)/g,n=0,i=e.exec(r.source);i;)t.push({name:i[1]||n++,prefix:"",suffix:"",modifier:"",pattern:""}),i=e.exec(r.source);return r}function mn(r,t,e){var n=r.map(function(i){return xr(i,t,e).source});return new RegExp("(?:".concat(n.join("|"),")"),Lt(e))}function pn(r,t,e){return gn(Rr(r,e),t,e)}function gn(r,t,e){e===void 0&&(e={});for(var n=e.strict,i=n===void 0?!1:n,s=e.start,o=s===void 0?!0:s,l=e.end,u=l===void 0?!0:l,a=e.encode,f=a===void 0?function(O){return O}:a,h=e.delimiter,c=h===void 0?"/#?":h,y=e.endsWith,d=y===void 0?"":y,g="[".concat(ve(d),"]|$"),v="[".concat(ve(c),"]"),m=o?"^":"",b=0,K=r;b<K.length;b++){var R=K[b];if(typeof R=="string")m+=ve(f(R));else{var A=ve(f(R.prefix)),x=ve(f(R.suffix));if(R.pattern)if(t&&t.push(R),A||x)if(R.modifier==="+"||R.modifier==="*"){var $=R.modifier==="*"?"?":"";m+="(?:".concat(A,"((?:").concat(R.pattern,")(?:").concat(x).concat(A,"(?:").concat(R.pattern,"))*)").concat(x,")").concat($)}else m+="(?:".concat(A,"(").concat(R.pattern,")").concat(x,")").concat(R.modifier);else R.modifier==="+"||R.modifier==="*"?m+="((?:".concat(R.pattern,")").concat(R.modifier,")"):m+="(".concat(R.pattern,")").concat(R.modifier);else m+="(?:".concat(A).concat(x,")").concat(R.modifier)}}if(u)i||(m+="".concat(v,"?")),m+=e.endsWith?"(?=".concat(g,")"):"$";else{var _=r[r.length-1],q=typeof _=="string"?v.indexOf(_[_.length-1])>-1:_===void 0;i||(m+="(?:".concat(v,"(?=").concat(g,"))?")),q||(m+="(?=".concat(v,"|").concat(g,")"))}return new RegExp(m,Lt(e))}function xr(r,t,e){return r instanceof RegExp?vn(r,t):Array.isArray(r)?mn(r,t,e):pn(r,t,e)}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||{}),We=(r=>(r[r.Part=0]="Part",r[r.All=1]="All",r))(We||{});const G=Symbol("rootKey"),z=Symbol("rootNodeKey"),oe=Symbol("parentNodeKey"),ze=Symbol("nameKey");class Z{instance=null;model;route;active=!0;index=0;constructor(t,e,n=0,i=!0){this.route=t,this.model=e,this.index=n,this.active=i}}class xe{scope=null;set compensation(t){this.scope!==null&&this.scope.stop(),this.scope=p.effectScope(),this.scope.run(()=>{p.watch(this.slots,()=>{let e=!1;try{e=t()}catch(n){console.error(n)}e&&this.scope!==null&&(this.scope.stop(),this.scope=null)})})}_slots;get slots(){return this._slots==null&&(this._slots=p.shallowRef([])),this._slots}get empty(){return this._slots==null||this._slots.value.length==0}[ze];[G];[z]=null;[oe]=null;get name(){return this[ze]}constructor(t,e,n){this[ze]=t,this[G]=e,n&&(this[z]=n)}}class k{view;index;level;constructor(t,e,n){this.view=t,this.index=e,this.level=n}static include(t,e){for(let n=0;n<t.length;n++){let i=t[n];if(i.view===e.view&&(e.index==-1||i.index===e.index)&&i.level===e.level)return!0}return!1}}class ct{views=[]}class wn{layers=[]}class bn{time;route}class Rn{forbidTime=300;submitRecorder=new bn;isSameRoute(t,e){return t==null||e==null?!1:t.name===e.name&&t.path===e.path&&t.root===e.root}acquire(t){let e=new Date().getTime();if(this.isSameRoute(t,this.submitRecorder.route)&&this.submitRecorder.time&&e-this.submitRecorder.time<=this.forbidTime){this.submitRecorder.time=e;return}return this.submitRecorder.route=t,this.submitRecorder.time=e,e}release(t){this.submitRecorder.time===t&&(this.submitRecorder.route=void 0)}}const me=Symbol("_notifyChange");class Zt{currentRoute;routes;constructor(t,e){this.currentRoute=t,this.routes=e}}const je=typeof window<"u",B=function(){return window};function xn(r){let t=r,e=t.lastIndexOf("/");return e>0&&e<t.length-1?t=t.substring(0,e+1):e===0&&t.indexOf(".")!==-1?t="/":e===-1&&(t.indexOf(".")==-1?t=`/${t}/`:t="/"),t.indexOf("/")!==0&&(t=`/${t}`),t}function Sn(){if(!je)return"/";let r=B().location,t=`${r.protocol}//${r.host}`;return t+=xn(r.pathname),t}function Tt(r,t,e){r.addEventListener?r.addEventListener(t,e,!1):r.attachEvent?r.attachEvent(`on${t}`,e):r[`on${t}`]=e}function Kt(r,t,e){r.removeEventListener?r.removeEventListener(t,e):r.detachEvent?r.detachEvent(`on${t}`,e):r[`on${t}`]=null}Sn();const Me=Symbol("ignoreHistoryChangeOnceKey"),er=Symbol("_navigateFirstRoute"),Oe=Symbol("_getRouteMark"),tr=Symbol("_getUrlSearch"),ht=Symbol("_generateLocation"),Se=Symbol("_setRouteMarkRecorder"),rr="Symbol(_fox_restore_point)";function yt(r,...t){return typeof r=="function"?Reflect.apply(r,null,[...t]):r}class Sr{base;storage;mode;query;firstNavigate=!0;historyMonitor;traceless=!1;changeHandler;historyChange;[Me]=!1;constructor(t="hash",e="",n="",i=!0,s=!0,o=!1,l){this.mode=t,this.base=e,this.query=n,this.firstNavigate=i,this.historyMonitor=s,this.traceless=o,this.storage=l??B().sessionStorage}init(t=!0){const e=B();return typeof this.historyChange!="function"&&(this.historyChange=()=>{if(this[Me]){this[Me]=!1;return}if(yt(this.historyMonitor)){const n=e.history.state;this[me](n);try{let i=[];if(typeof n=="string"?i=JSON.parse(n):i=n,Array.isArray(i)&&i.length>0){const s=this[Oe]()??"/";this[Se](s,i)}}catch{}}}),Tt(e,"popstate",this.historyChange),this.firstNavigate&&t&&this[er](),Promise.resolve()}destroy(){if(this.historyChange){const t=B();Kt(t,"popstate",this.historyChange)}}[er](){const t=this[Oe]()??"/",e=this.storage.getItem(rr);if(e)try{const o=JSON.parse(e);if(o.mark===t){this[me](o.routes);return}}catch{}const n=t.indexOf("!");let i;n!=-1?i=t.substring(n+1):i=t;const s=new j;s.path=i,s.query=this[tr](),this[me]([s])}[Se](t,e){try{const n={mark:t,routes:e},i=JSON.stringify(n);this.storage.setItem(rr,i)}catch(n){console.error(n.message,n)}}setRestorePoint(t){const e=this[Oe]()??"/";this[Se](e,t)}[me](t){typeof this.changeHandler=="function"&&this.changeHandler(t)}[Oe](){const t=B();if(this.mode==="path"){let e=t.location.pathname;return this.base&&e.indexOf(this.base)===0&&(e=e.substring(this.base.length)),e}else{const e=t.location.hash,n=e.indexOf("#");if(n!=-1)return e.substring(n+1)}return null}[tr](){return B().location.search}listen(t){this.changeHandler=t}go(t,e=!0){const n=B();this[Me]=!e,n.history.go(t)}push(t){let e=this[ht](t.currentRoute);yt(this.traceless,t.currentRoute)||B().history.pushState(t.routes,"",e),this[Se](t.currentRoute.fullPath,t.routes)}replace(t){let e=this[ht](t.currentRoute);yt(this.traceless,t.currentRoute)||B().history.replaceState(t.routes,"",e),this[Se](t.currentRoute.fullPath,t.routes)}[ht](t){const e=B();let n="";if(t.query){let l="";if(typeof t.query=="object")for(let u in t.query){let a=encodeURIComponent(t.query[u]),f=`${encodeURIComponent(u)}=${a}`;l.length>0&&(l+="&"),l+=f}else l=t.query;this.query?(n=`${this.query}&${l}`,n.charAt(0)!=="?"&&(n=`?${n}`)):n=`?${l}`}const i=e.location;let s=t.fullPath;s.startsWith(Y)&&(s=s.substring(Y.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,t=null,e="",n=!0,i=!1,s){return t!==null&&(t=B().location.pathname),t&&t.endsWith("/")&&(t=t.substring(0,t.length-1)),new Sr("path",t??"",e,r,n,i,s)}function Pr(r=!0,t="",e=!0,n=!1,i){return new Sr("hash","",t,r,e,n,i)}class An{maxSize=50;cursor=-1;queue=[];changeHandler;base;historyMonitor=!1;traceless=!1;constructor(t,e=50){this.base=t,this.maxSize=e}init(t=!0){return Promise.resolve()}destroy(){this.queue=[]}listen(t){this.changeHandler=t}[me](t){typeof this.changeHandler=="function"&&this.changeHandler(t)}go(t,e=!0){if(this.queue.length==0||this.cursor<=0||this.cursor>=this.queue.length-1)return;let n=this.cursor+t;if(n<0?n=0:n>this.queue.length-1&&(n=this.queue.length-1),n!=this.cursor&&(this.cursor=n,e)){const i=this.queue[n];this[me](i.routes)}}push(t){this.queue.length>=this.maxSize&&this.queue.splice(0,1),this.queue.push(t),this.cursor=this.queue.length-1}replace(t){let e=this.queue.length-this.cursor;this.queue.splice(this.cursor,e),this.queue[this.cursor]=t}setRestorePoint(t){}}function Ar(r="",t=50){return new An(r,t)}const Le=Symbol("_constructRouteModel"),Ne=Symbol("_findRouteModel"),dt=Symbol("_findRootView"),nr=Symbol("_getFirstView"),ie=Symbol("_removeView"),ir=Symbol("_buildPage"),sr=Symbol("_resolveComponent"),or=Symbol("_update"),ee=Symbol("_merge"),vt=Symbol("_handleHistoryChange"),He=Symbol("_handleRouteUpdated"),Ie=Symbol("routeUpdatedCallback"),w=Symbol("currentRoutes"),ce=Symbol("current"),lr=Symbol("_addRouteRecorder"),he=Symbol("_removeRouteRecorder"),ke=Symbol("_cloneRouteRecorder"),M=Symbol("_handleError"),De=Symbol("errorCallback"),D=Symbol("registerKey"),Ve=Symbol("notFoundKey"),mt=Symbol("notFoundPathKey"),V=Symbol("forestKey"),C=Symbol("historyKey"),Pe=Symbol("beforeFiltersKey"),Ae=Symbol("afterFiltersKey"),Ce=Symbol("destroyFiltersKey"),ye=Symbol("mainDispatcherKey"),pt=Symbol("initKey"),se=Symbol("readyKey"),gt=Symbol("readyHandlersKey"),Be=Symbol("_markReady"),ur=Symbol("_createNextFn"),wt=Symbol("_start"),bt=Symbol("_before"),Rt=Symbol("_after"),ar=Symbol("_destroy"),xt=Symbol("_load"),Ee=Symbol("_unload"),Fe=Symbol("routerGuardKey");function Cn(r){return r.layers.length==0||r.layers[0].views.length==0}function En(r){let t=[];return r.layers.forEach(e=>{e.models==null||e.models==null||e.models.forEach(n=>{if(!(n==null||n==null))if(typeof n.meta=="object"){let i=T(!0,{},n.meta);t.push(i)}else n.meta&&t.push(n.meta)})}),t}class Fn{[D]=new Array;[Ve];[mt]="*";[se]=!1;[gt]=[];[V]=new wn;[C];[w]=new Array;[De]=null;[Ie]=null;[Pe]=new Array;[Ae]=new Array;[Ce]=new Array;[ye]=new Xe;[Fe]=new Rn;[pt]=!1;[ce]=p.ref(null);get current(){return this[ce].value}options;constructor(t){this.options=t??{},this.options.notFoundPath&&this.setNotFoundPath(this.options.notFoundPath);let e=this.options.routes||[];this.addRoutes(e),this.options.notFound&&this.setNotFoundRoute(this.options.notFound),t.history?this[C]=t.history:this[C]=je?Pr():Ar(),this[C]?.listen(async n=>{let i=!0;try{if(typeof n=="string"){const s=this[N](n);s&&await this[vt]([s])}else await this[vt](n)}catch(s){console.error(s.message,s),i=!1}this[se]===!1&&this[Be](i)})}[M](t="error",e){if(e&&typeof e.error=="function")try{e.error(t)}catch{}if(typeof this[De]=="function")try{this[De](t,e)}catch{}console.error(t)}init(){this[pt]!==!0&&(this[C]?.init(!this[se]),this[pt]=!0)}isReady(){return this[se]?Promise.resolve():new Promise((t,e)=>{this[gt].push([t,e])})}[Be](t){this[se]=!0,this[gt].forEach(([e,n])=>{try{t?e():n()}catch(i){console.error(i.message,i)}})}[vt](t){try{if(!t){let o=[...this[w]].reverse();return this[Ee](o),je&&B().location.reload(),Promise.resolve()}let e=null,n=[],i=[],s=0;for(;s<t.length&&s<this[w].length&&j.isSame(t[s],this[w][s]);s++)t[s].opsType===E.Open&&t[s].active===!0&&t[s].active!==this[w][s].active&&(e=t[s]);if(s<t.length&&(n=t.slice(s)),s<this[w].length&&(i=this[w].slice(s).reverse()),i.length==0&&n.length==0){if(e!==null)return this.restore([e])}else if(i.length>0){if(this[Ee](i)){if(n.length>0)return this.restore(n);if(e!==null)return this.restore([e])}}else return this.restore(n)}catch(e){this[M](e)}return Promise.resolve()}[He](t){if(t)this[ce].value=t;else{let e=this[w].length;e>0?this[ce].value=this[w][e-1]:this[ce].value=null}if(typeof this[Ie]=="function")try{this[Ie](this[ce].value)}catch{}}[lr](t,e=-1){e<0||e>=this[w].length?this[w].push(t):this[w].splice(e,0,t)}[ke](){let t=[];for(let e of this[w]){let n=j.clone(e,!0);t.push(n)}return t}[he](t){if(!this[w])return;let e=-1;for(let n=0;n<this[w].length;n++)if(j.isSame(this[w][n],t)){e=n;break}if(e!=-1){let n=this[w][e];this[w].splice(e,1),this[ar](n,n.session)}}set historyMonitor(t){this[C]&&(this[C].historyMonitor=t)}get historyMonitor(){return this[C]?this[C].historyMonitor:!1}set traceless(t){this[C]&&(this[C].traceless=t)}get traceless(){return this[C]?this[C].traceless:!1}setRestorePoint(){const t=this[ke]();this[C]?.setRestorePoint(t)}onRouteUpdated(t){this[Ie]=t}onError(t){this[De]=t}beforeEach(t){this[Pe].push(t)}removeBeforeEach(t){const e=this[Pe].indexOf(t);return e!==-1?(this[Pe].splice(e,1),!0):!1}afterEach(t){this[Ae].push(t)}removeAfterEach(t){const e=this[Ae].indexOf(t);return e!==-1?(this[Ae].splice(e,1),!0):!1}destroyEach(t){this[Ce].push(t)}removeDestroyEach(t){const e=this[Ce].indexOf(t);return e!==-1?(this[Ce].splice(e,1),!0):!1}addRoutes(t){for(let e of t)this.addRoute(e)}addRoute(t,e=-1){if(t.path===this[mt]){this.setNotFoundRoute(t);return}const n=this[Le](t);if(e==-1)this[D]=[...this[D],...n];else for(let i=n.length-1;i>=0;i--)this[D].splice(e,0,n[i])}removeRoute(t){const e=this[N](t);if(e===null)return console.warn("route格式错误",t),!1;for(let n=0;n<this[D].length;n++){const i=this[D][n];if(e?.path&&i.path===e.path)return this[D].splice(n,1),!0;if(e?.name&&i.name===e.name)return this[D].splice(n,1),!0}return!1}hasRoute(t){const e=this[N](t);return e===null?(console.warn("route格式错误",t),!1):this[D].findIndex(i=>{if(e?.path&&i.path===e.path||e?.name&&i.name===e.name)return!0})!==-1}setNotFoundPath(t){this[mt]=t}setNotFoundRoute(t){const e=this[Le](t);this[Ve]=e[0]}getRoutes(){return[...this[D]]}[Le](t){let e=t.path??"";e.length>0&&e.charAt(0)!=="/"&&(e=`/${e}`);let n=t.components??(t.component&&{"":t.component});if(n==null){let l=new st;return l.path=e,l.redirect=t.redirect,[l]}let i=[];for(let l in n){let u=n[l];l.length===0&&(l=Y);let a=new Zr(l,u,t.props,t.meta);i.push(a)}let s=!1,o=[];if(t.children)for(let l of t.children){let u=this[Le](l);for(let a of u){let f=new st;f.name=a.name,a.path&&a.path.length>0?e!=="/"?f.path=`${e}${a.path}`:f.path=a.path:(s=!0,f.path=e);let h=new Gt;h.models=[...i],f.layers=[h,...a.layers],o.push(f)}}if(!s){let l=new Gt;l.models=i;let u=new st;u.name=t.name,u.path=e,u.layers=[l],o.splice(0,0,u)}return o}[Ne](t){const e=t.route;try{for(let n of this[D])if(e.path&&n.path){let i=n.match;i||(i=n.match=yn(n.path));let s=i(e.path);if(!s)continue;if(n.redirect){let o=new j;T(!0,o,e),o.path=n.redirect;let l={route:o,find:void 0};return this[Ne](l)?(t.route=l.route,t.find=l.find,!0):!1}if(e.params=e.params??{},T(!0,e.params,s.params),e.query){let o=e.query;if(typeof o=="string"){let l={},u=o.split("&");for(let a of u){let f=a.split("=");if(f.length!==2)continue;let h=decodeURIComponent(f[0].trim()),c=decodeURIComponent(f[1].trim());l[h]=c}T(!0,e.params,l)}else typeof o=="object"&&T(!0,e.params,o)}return t.find=n,!0}else if(e.name===n.name){e.params=e.params??{};let i=cn(n.path);return e.path=i(e.params),t.find=n,!0}}catch(n){console.error(n.message,n),typeof e.error=="function"&&e.error(n.message)}return!1}[N](t){let e=null;if(Array.isArray(t))if(e=new j,typeof t[0]=="object")e=j.from(t[0]);else for(let n=0;n<t.length;n++)n===0?t[n].charAt(0)==="/"?e.path=t[n]:e.name=t[n]:n===1?e.params=t[n]:n===2?e.root=t[n]:n===3&&T(!1,e,t[n]);else typeof t=="object"?e=j.from(t):typeof t=="string"&&(e=new j,t.charAt(0)=="/"?e.path=t:e.name=t);if(e){if(e.path){let n=e.path.indexOf("?");n!==-1&&n<e.path.length-1&&(e.query=e.path.substring(n+1),e.path=e.path.substring(0,n))}e.root=e.root??Y,e.opsType=e.opsType??this.options.defaultOperationType??E.Push}return e}push(...t){let e=this[N](t);return e?(e.opsType=e.opsType||E.Push,this.to(e)):(this[M]("resolve route fail",e),this)}put(...t){let e=this[N](t);return e?(e.opsType=E.Put,this.to(e)):(this[M]("resolve route fail",e),this)}replace(...t){let e=this[N](t);return e?(e.opsType=E.Replace,this.to(e)):(this[M]("resolve route fail",e),this)}append(...t){let e=this[N](t);return e?(e.opsType=E.Append,this.to(e)):(this[M]("resolve route fail",e),this)}remove(t){return new Promise(e=>{this[ye].post(n=>{try{if(this[w].length===0){n.resolve(),e(!1);return}let i=-1,s,o=[];if(t){if(t.root?s=t.root:s=this[w][0].root??Y,t.all)for(let u=this[w].length-1;u>0;u--){let a=this[w][u];a.opsType===E.Append&&a.root===s&&(o.splice(0,0,a),i=u-1)}else if(t.until)for(let u=this[w].length-1;u>0;u--){let a=this[w][u];if(a.opsType===E.Append&&a.root===s){if(t.until.charAt(0)==="/"&&t.until===a.path){i=u;break}else if(t.until===a.name){i=u;break}o.splice(0,0,a)}}}else{s=Y;let u=this[nr](this[V]);u&&(s=u.name);for(let a=this[w].length-1;a>0;a--){let f=this[w][a];if(f.opsType===E.Append&&f.root===s){o.push(f),i=a-1;break}}}if(o.length===0){let u="can not find route";console.warn(u),n.resolve(u),e(!1);return}let l=0;if(this[w].forEach(u=>{u.opsType!==E.Put&&l++}),this[Ee](o)){let u=0;this[w].forEach(f=>{f.opsType!==E.Put&&u++});const a=u-l;this[C]?.go(a,!1),n.resolve(),e(!0)}}catch(i){this[M](i),n.resolve(),e(!1)}})})}open(...t){let e=this[N](t);return e?(e.opsType=E.Open,this.to(e)):(this[M]("resolve route fail",e),this)}close(t){return this[ye].post(e=>{try{let n=this[N](t);if(!n){e.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){e.resolve();return}this[Ee](i)&&this[He](),e.resolve()}catch(n){this[M](n),e.resolve()}}),this}to(...t){let e=this[N](t);if(!e)return this[M]("resolve route fail",e),this;console.debug("route to",e.path,e.root);let n=this[Fe].acquire(e);return n==null?(this[M]("route forbid",e),this):(this[ye].post(i=>{try{let s=this[wt](e);this[bt](s),this[xt](s),this[Rt](s),s.wait((o,l)=>{const u=o.session.to;try{let a=j.clone(u,!0);const f=new Zt(a,this[ke]());u.opsType===E.Replace?this[C]?.replace(f):this[C]?.push(f)}catch(a){console.error(a.message,a)}if(this[Fe].release(n),this[He](u),typeof e.success=="function")try{Reflect.apply(e.success,{},[])}catch(a){console.error(a.message,a)}this[se]===!1&&this[Be](!0),i.resolve()},(o,l)=>{this[Fe].release(n),l!==null&&this[M](l,e),this[se]===!1&&this[Be](!1),i.resolve()})}catch(s){this[Fe].release(n),this[M](s,e),i.resolve()}}),this)}back(t=1){this[C]?.go(-t)}[ur](t){return(e,n)=>{if(typeof e=="boolean")t.session.redirect=!1,e?t.resolve():t.reject(n??null);else if(e){const i=this[N](e);if(i){const s=t.session.to;i.success=s.success,i.error=s.error,t.session.to=i,t.session.redirect=!0,t.session.routeModel=null,t.resolve()}else t.session.redirect=!1,t.reject("route resolve fail")}else t.session.redirect=!1,t.resolve()}}[wt](t){let e=this[w].length>0?this[w][0]:void 0,n=new Qe(t,e),i={route:t,find:null};return this[Ne](i),i.find&&(n.routeModel=i.find,t.matched=En(i.find),Array.isArray(t.matched)&&t.matched.length>0&&(t.meta=i.find.layers[0].models[0].meta)),new Xe(n)}[bt](t){for(let e of this[Pe])t.post(n=>{let i=this[ur](n);Reflect.apply(e,{},[n.session.to,n.session.from,i,n.session])})}[Rt](t){t.post(e=>{for(let n of this[Ae])try{Reflect.apply(n,{},[e.session.to,e.session.from,e.session])}catch(i){console.error(i.message,i)}e.resolve()})}[ar](t,e){for(let n of this[Ce])try{Reflect.apply(n,{},[t,e])}catch(i){console.error(i.message,i)}typeof t.destroy=="function"&&Reflect.apply(t.destroy,t,[])}[xt](t){t.post(e=>{let n=e.session.to,i=e.session.routeModel;if(i==null){let o={route:n,find:null};if(this[Ne](o))i=o.find,e.session.routeModel=i;else if(this[Ve])i=this[Ve];else{e.reject(`not find route model, path:${n.path??n.name}`);return}}let s=Qe.from(e.session);this[ir](n,i,s).then(o=>{this[V],e.resolve()},o=>{e.reject(o)})})}[Ee](t){if(t.length==0)return!0;let e=this[V],n=[];for(let i of t){let s=this[dt](e,i);s!=null&&n.push({...s,route:i})}if(n.length==0){let i="can not find view index";return this[M](i),!1}for(let i of n.reverse())this[ie](e,{x:i.x,y:i.y},[i.route.index??0],!0);return!0}[dt](t,e){const n=e.root??Y;let i;for(let s=0;s<t.layers.length;s++){const o=t.layers[s];for(let l=o.views.length-1;l>=0;l--){const u=o.views[l];if(u[G]&&u[ze]===n)return i={x:l,y:s},i}}return null}[nr](t){return t.layers.length>0&&t.layers[0].views.length>0?t.layers[0].views[0]:null}[ie](t,e,n=null,i=!0){if(e.y>=t.layers.length||e.x>=t.layers[e.y].views.length)return;let s=t.layers[e.y].views[e.x],o=!1,l=[],u=!1,a=[...s.slots.value];for(let h=a.length-1;h>=0;h--){let c=a[h];(!n||n.indexOf(c.index)!=-1)&&(c.route&&s[G]&&(this[he](c.route),c.active===!0&&c.route.opsType==E.Append&&(u=!0)),l.push(new k(s,c.index,e.y)),a.splice(h,1))}if(a.length==0)i?s.slots.value=a:t.layers[e.y].views.splice(e.x,1);else{if(u){let h=a.length-1,c=a[h];c.active=!0,c.route&&(c.route.active=c.active)}s.slots.value=a}t.layers[e.y].views.length==0&&(o=!0);let f=e.y+1;for(;f<t.layers.length;f++){let h=t.layers[f].views,c=[];for(let y=h.length-1;(o||l.length>0)&&y>=0;y--){let d=h[y];if(d[oe]&&(o||k.include(l,d[oe]))){let g=d.slots.value;for(let v=g.length-1;v>=0;v--){let m=g[v];m.route&&d[G]&&this[he](m.route),c.push(new k(d,m.index,f)),g.splice(v,1)}t.layers[f].views.splice(y,1)}}l=c,t.layers[f].views.length==0&&(o=!0)}}restore(t){if(!t||this[D].length==0){let e=this[V];if(e.layers.length>0){let n=e.layers[0].views;n.length>0&&(n[0].slots.value=[])}return this[w]=[],this[He](),Promise.resolve()}else return new Promise((n,i)=>{let s=null,o=!1;for(let l=0;l<t.length;l++){let u=t[l];this[ye].post(a=>{let f=this[wt](u);this[bt](f),this[xt](f),this[Rt](f),f.wait((h,c)=>{s=h.session.to,o=h.session.redirect,a.resolve()},(h,c)=>{s=null,c!==null&&this[M](c),a.resolve()})})}this[ye].post(l=>{if(s&&o===!0){const u=j.clone(s,!0),a=new Zt(u,this[ke]());this[C]?.replace(a)}l.resolve(),n()})})}[ir](t,e,n){let i=t.updateType??We.Part;return this[sr](e).then(()=>{this[or](e,t,n,i)})}[sr](t){let e=[];for(let n=0;n<t.layers.length;n++){let i=t.layers[n];for(let s=0;s<i.models.length;s++){let o=i.models[s];o.isResolved||e.push(o.resolve())}}return e.length>0?Promise.all(e):Promise.resolve()}[or](t,e,n,i){if(t.layers[0].models.length!==1)return Promise.reject("illegal route structure(multi root node)");const s=t.layers[0].models[0];let o=this[V],l=Cn(o),u=e.root??Y,a;!l&&i==We.Part&&(a=this[dt](o,e));let f,h=0;if(a==null||a==null)if(l||i===We.All){if(o.layers.length==0&&(o.layers[0]=new ct),o.layers[0].views.length==0){let c=e.root??Y;f=new xe(c,!0,null),o.layers[0].views=[f]}else f=o.layers[0].views[0];a={x:0,y:0}}else{let c=e.slot;if(!c)return Promise.reject("can not rebuild view(because not route slot)");let y=c.level;if(y>o.layers.length)return Promise.reject("can not insert view(override level)");let d;if(c.rootName){let g=o.layers[y-1];for(let v of g.views){if(v[G]&&v.name===c.rootName){d=new k(v,c.rootIndex??0,y-1);break}if(v[z]&&v[z].view.name===c.rootName&&v[z].index===c.rootIndex){d=v[z];break}}}if(!d)return Promise.reject("can not insert view(not find root node ref)");f=new xe(u,!0,d),o.layers[y].views.push(f),a={x:o.layers[y].views.length-1,y}}else f=o.layers[a.y].views[a.x];if(h=a.y,f[G]=!0,e.opsType===E.Append){e.index=ne.get();let c=f.slots.value;if(c.length>0){let m=c[c.length-1];m.active=!1,m.route&&(m.route.active=m.active)}let y=new Z(e,s,e.index,!0);f.slots.value=[...c,y];let d=h+1,g=1,v=new k(f,e.index,h);this[ee](o,d,t,g,v)}else if(e.opsType===E.Open){let c=f.slots.value,y=!1;for(let d of c){if(d.route!==null&&j.isSameForRouteModel(d.route,e)){if(d.active==!0)return e.index=d.index,e.active=d.active,d.route=e,Promise.resolve();d.active=!0,y=!0,e.index=d.index,e.active=d.active,d.route=e,this[he](d.route)}else d.active=!1;d.route&&(d.route.active=d.active)}if(!y){e.index=ne.get(),e.active=!0;let d=new Z(e,s,e.index,!0);c.push(d);let g=h+1,v=1,m=new k(f,e.index,h);this[ee](o,g,t,v,m)}f.slots.value=[...c]}else{let c=f.slots.value;if(c.length==0){e.index=ne.get(),f.slots.value=[new Z(e,s,e.index)];let y=h+1,d=1,g=new k(f,e.index,h);this[ee](o,y,t,d,g)}else{let y=c[0];if(y.model!==s){this[ie](o,a,null,!0),e.index=ne.get(),f.slots.value=[new Z(e,s,e.index)];let d=h+1,g=1,v=new k(f,e.index,h);this[ee](o,d,t,g,v)}else{y.route!==null&&this[he](y.route);let d=[];for(let K=1;K<c.length;K++)d.push(c[K].index);d.length>0&&this[ie](o,a,d,!0),e.index=y.index,y.route=e;let g=[new k(f,e.index,h)],v=h+1,m=1,b=new k(f,e.index,h);for(;g.length>0&&v<o.layers.length&&m<t.layers.length;v++,m++){let K=[];for(let A=0;A<o.layers[v].views.length;A++){let x=o.layers[v].views[A];x[oe]&&k.include(g,x[oe])&&K.unshift(A)}let R=[];for(let A of K){let x=o.layers[v].views[A],$=t.layers[m].models,_;for(let q=0;q<$.length;q++)if(x.name===$[q].name){_=$[q];break}if(!_)this[ie](o,{x:A,y:v},null,!1);else{let q=x.slots.value;if(q.length==0){let O=0;x.slots.value=[new Z(null,_,O)];let U=v+1,W=m+1;this[ee](o,U,t,W,b)}else{let O=q[0];if(O.model!==_){this[ie](o,{x:A,y:v},null,!0),x.slots.value=[new Z(null,_,0)];let U=v+1,W=m+1;this[ee](o,U,t,W,b)}else{x[G]&&O.route!==null&&this[he](O.route);let U=[];for(let W=1;W<q.length;W++)U.push(q[W].index);U.length>0&&this[ie](o,{x:A,y:v},U,!0),R.push(new k(x,O.index,v))}}x[G]=!1}}g=R}this[ee](o,v,t,m,b)}}}if(f&&f[z]){let c=f[z];c&&(e.slot=new Yr(u,h,c?.view.name,c?.index??0))}n.to=void 0,n.routeModel=void 0,e.session=n,this[lr](e)}[ee](t,e,n,i,s){let o=i,l=e;for(;l<t.layers.length&&o<n.layers.length;l++,o++){let u=t.layers[l].views;for(let a of n.layers[o].models){let f=new xe(a.name,!1,s),h=new Z(null,a);f.slots.value=[h],u.push(f)}}for(;o<n.layers.length;o++){let u=new ct;u.views=[];for(let a of n.layers[o].models){let f=new xe(a.name,!1,s),h=new Z(null,a);f.slots.value=[h],u.views.push(f)}t.layers.push(u)}}[pr](t,e,n,i,s,o){if(e<0||e>this[V].layers.length)return null;if(e<this[V].layers.length){let f=this[V].layers[e],h=null;for(let c of f.views){let y=!1;if(n!==null?(y=c.name===t&&c[z]?.view===n,y&&i!==-1&&(y=c[z]?.index===i)):y=c.name===t,!!y){s!==null&&(c[oe]={view:s,index:o,level:e-1}),h=c;break}}if(h!==null)return h}let l=null,u=null;s!==null&&(s[G]?l={view:s,index:o,level:e-1}:l=s[z],u={view:s,index:o,level:e-1});let a=new xe(t,!0,l);if(a[oe]=u,e==this[V].layers.length){let f=new ct;f.views=[a],this[V].layers.push(f)}else this[V].layers[e].views.push(a);return a}}const Tn="fox-router-view",Kn="fox-router-link";function Cr(r,t=!1){let e=null;return t?e=r.showFromClass??r.enterFromClass:e=r.enterFromClass,e||(e=r.transitionName,e?t?`${e}-show-from`:`${e}-enter-from`:null)}function Er(r,t=!1){let e=null;return t?e=r.showActiveClass??r.enterActiveClass:e=r.enterActiveClass,e||(e=r.transitionName,e?t?`${e}-show-active`:`${e}-enter-active`:null)}function _n(r,t=!1){let e=null;return t?e=r.showToClass??r.enterToClass:e=r.enterToClass,e||(e=r.transitionName,e?t?`${e}-show-to`:`${e}-enter-to`:null)}function qn(r,t=!1){let e=null;return t?e=r.hideFromClass??r.leaveFromClass:e=r.leaveFromClass,e||(e=r.transitionName,e?t?`${e}-hide-from`:`${e}-leave-from`:null)}function jn(r,t=!1){let e=null;return t?e=r.hideActiveClass??r.leaveActiveClass:e=r.leaveActiveClass,e||(e=r.transitionName,e?t?`${e}-hide-active`:`${e}-leave-active`:null)}function $n(r,t=!1){let e=null;return t?e=r.hideToClass??r.leaveToClass:e=r.leaveToClass,e||(e=r.transitionName,e?t?`${e}-hide-to`:`${e}-leave-to`:null)}function Mn(r,t=!1){let e=null;return t?e=r.beforeShow??r.beforeEnter:e=r.beforeEnter,e}function On(r,t=!1){let e=null;return t?e=r.show??r.enter:e=r.enter,e}function Ln(r,t=!1){let e=null;return t?e=r.afterShow??r.afterEnter:e=r.afterEnter,e}function Nn(r,t=!1){let e=null;return t?e=r.showCancelled??r.enterCancelled:e=r.enterCancelled,e}function Hn(r,t=!1){let e=null;return t?e=r.hide??r.leave:e=r.leave,e}function In(r,t=!1){let e=null;return t?e=r.afterHide??r.afterLeave:e=r.afterLeave,e}function kn(r,t=!1){let e=null;return t?e=r.hideCancelled??r.leaveCancelled:e=r.leaveCancelled,e}function Nt(r){let t,e=r.duration;return typeof e=="object"?t={enter:e.enter??-1,leave:e.leave??-1,show:e.show??-1,hide:e.hide??-1}:(typeof e=="string"&&(e=e.length==0?-1:Number(e)),t={enter:e,leave:e,show:e,hide:e}),t}function pe(r,t){r.classList.contains(t)||r.classList.add(t)}function ge(r,t){r.classList.remove(t)}const Dn=je&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout;function Ht(r){Dn(r)}function H(r,t,e){S(t)&&(r==null&&(r={}),Reflect.apply(t,r,e))}function Fr(r,t,e,n=-1,i,s,o,l){if(S(s)){if(i!==void 0&&i>=0){setTimeout(()=>{Reflect.apply(s,r,[t,e,n]),S(l)&&Reflect.apply(l,r,[])},i);return}const u=["animationend","transitionend"],a=f=>{u.forEach(h=>{Kt(t,h,a)}),Reflect.apply(s,r,[t,e,n]),l&&Reflect.apply(l,r,[])};u.forEach(f=>{Tt(t,f,a)})}if(S(o)){const u="animationcancel",a=f=>{Reflect.apply(o,r,[t,e,n]),Kt(t,u,a)};Tt(t,u,a)}}function It(r){return!je||r===null?!1:r.opsType===E.Append||r.opsType===E.Open}function Tr(r,t,e,n={},i,s=-1){if(t||It(i)){const o=Cr(n,t);o&&pe(e,o);const l=Er(n,t);l&&pe(e,l);const u=Mn(n,t);H(r,u,[e,t,i,s])}}function Kr(r,t,e,n={},i,s,o,l){if(!It(s)&&!t){S(l)&&l(r,l,[e]);return}const u=Cr(n,t),a=Er(n,t),f=_n(n,t),h=On(n,t),c=Ln(n,t),y=Nn(n,t);Ht(()=>{Fr(r,e,s,o,i,()=>{a&&ge(e,a),f&&ge(e,f),S(c)&&H(r,c,[e,t,s,o]),S(l)&&l(r,l,[e])},()=>{S(y)&&H(r,y,[e,t,s,o])}),u&&ge(e,u),f&&pe(e,f),S(h)&&H(r,h,[e,t,s,o])})}function _r(r,t,e,n={},i,s,o,l,u){if(!It(o)&&!t){!t&&S(s)&&s();return}const a=qn(n,t),f=jn(n,t),h=$n(n,t),c=Hn(n,t),y=In(n,t),d=kn(n,t);a&&pe(e,a),f&&pe(e,f),S(c)&&H(r,c,[e,t,o,l]),Ht(()=>{Fr(r,e,o,l,i,()=>{f&&ge(e,f),h&&ge(e,h),S(y)&&H(r,y,[e,t,o,l]),S(u)&&H(r,u,[e]),!t&&S(s)&&s()},()=>{S(d)&&H(r,d,[e,t,o,l]),S(u)&&H(r,u,[e]),!t&&S(s)&&s()}),a&&ge(e,a),h&&pe(e,h)})}function _t(r,t={},e,n=-1){const i=t.mode??"default",s=Nt(t);return{mode:i,persisted:!1,beforeEnter:l=>{Tr(r,!1,l,t,e,n)},enter:l=>{Kr(r,!1,l,t,s.enter,e,n)},leave:(l,u)=>{_r(r,!1,l,t,s.leave,u,e,n)},clone:l=>_t(r,t,e,n)}}function qr(r){return r.el}function Vn(r,t,e={},n,i,s,o){if(s){const l=qr(t);if(l==null)return;const u=Nt(e);Tr(r,!0,l,e,n,i),Kr(r,!0,l,e,u.show,n,i,a=>{S(o)&&H(r,o,[a])})}else S(o)&&H(r,o,[])}function Bn(r,t,e={},n,i,s,o){if(s){const l=qr(t);if(l==null)return;const u=Nt(e);_r(r,!0,l,e,u.hide,null,n,i,a=>{S(o)&&H(r,o,[a])})}else S(o)&&H(r,o,[])}function Un(r,t={}){Ht(()=>{for(let e=0;e<r.length;e++)Reflect.apply(r[e],t,[])})}function te(r,t,e){return typeof r=="function"?Reflect.apply(r,{},[t,e]):r}function St(r,t){if(!r)return null;const e=r(t);return e.length===1?e[0]:e}class Wn{node;state;constructor(t,e){this.node=t,this.state=e}}const qt=p.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,t){const e=p.getCurrentInstance();if(e===null||e.proxy===null){console.error("instance or instance.proxy not exist");return}const n=r.multi===!0,i=p.inject(et,null),s=p.inject(ut,0),o=p.inject(Xt,null),l=p.inject(at,-1);let u=null;const a=r.modelSlot;if(a){p.provide(ut,s+1),p.provide(at,a.index),p.provide(ft,a.index);const h=a.route;if(!h){console.warn("child view render error, route not exist");return}const c=Ue(e.proxy,!0);rn(c),lt(c,h)}else{if(i==null){console.error("router is not been injected");return}const h=r.name,c=p.inject(Yt,null),y=p.inject(ft,0);if(u=i[pr](h,s,o,l,c,y),u===null)return;if(p.provide(Yt,u),u[G]===!0&&p.provide(Xt,u),!n){p.provide(at,-1),p.provide(ut,s+1),p.provide(ft,-1);const g=u.slots.value;if(g.length>0){const v=g[0].route;if(v){const m=Ue(e.proxy,!0);lt(m,v)}}else{const v=Ue(e.proxy,!0);u.compensation=()=>{const m=u.slots.value;if(m.length>0){const b=m[0].route;return b&&lt(v,b),!0}return!1}}}}const f={value:new Map};return p.onUnmounted(()=>{f.value&&f.value.clear()}),()=>{if(n){const h=new Map,c=[],y=u?.slots.value,d=[];for(let m=0;m<y.length;m++){const b=y[m],K=`${r.name}-${b.index}`,R=te(r.transition,b.route,m)??!0,A={modelSlot:b};let x;t.slots.default?x=p.h(qt,A,{default:t.slots.default}):x=p.h(qt,A);const $={},_=te(r.viewClass,b.route,m);typeof _=="string"&&_.length>0&&($[_]=!0);const q=te(r.viewActiveClass,b.route,m),O=te(r.viewInactiveClass,b.route,m),U=f.value.get(K);if(typeof q=="string"&&q.length>0&&($[q]=b.active),typeof O=="string"&&O.length>0&&($[O]=!b.active),U&&b.active!==U.state){const ue=U.node;b.active?d.unshift(()=>{const nt=()=>{let we=Jt(ue);we!=null&&Qt(we,Et.ACTIVATED)};Vn(e,ue,r,b.route,m,R,nt)}):d.push(()=>{const nt=()=>{const we=Jt(ue);we!=null&&Qt(we,Et.DEACTIVATED)};Bn(e,ue,r,b.route,m,R,nt)})}const W={class:$,key:K},tt=te(r.viewTagProps,b.route,m);tt!==null&&typeof tt=="object"&&T(!0,W,tt),b.route?.viewTagAttrs&&typeof b.route?.viewTagAttrs=="object"&&T(!0,W,b.route.viewTagAttrs);const jr=te(r.viewTag,b.route,m),rt=p.h(jr,W,{default:()=>[x]});if(h.set(K,new Wn(rt,b.active)),f.value.delete(K),R){const ue=_t(e,r,b.route,m);rt.transition=ue}c.push(rt)}f.value.forEach(m=>{m.node.transition=null}),f.value=h,Un(d,e);const g=te(r.tag,null,-1),v={};return Object.assign(v,t.attrs),p.h(g,v,{default:()=>c})}else if(a!=null){const h=a.model,c={};h.props&&(typeof h.props=="object"?T(!1,c,h.props):h.props===!0&&typeof a.route?.params=="object"&&T(!1,c,a.route?.params));const y=p.h(h.component,c);return St(t.slots.default,{Component:y,route:a.route})??y}else{const h=u.slots.value;if(h.length>0){const c=h[0],y=c.model,d={};y.props&&(typeof y.props=="object"?T(!1,d,y.props):y.props===!0&&typeof c.route?.params=="object"&&T(!1,d,c.route?.params));const g=p.h(y.component,d);if(te(r.transition,c.route,-1)??!0){const m=_t(e,r,c.route,-1);g.transition=m}return St(t.slots.default,{Component:g,route:c.route})??g}else return St(t.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 t=r.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return r.preventDefault&&r.preventDefault(),!0}}function Gn(r,t){return r==null||t==null?!1:!!(r===t||r.path&&r.path===t.path||r.name&&r.name===t.name)}function Jn(r,t){return r==null||t==null?!1:!!(r.path&&t.path&&t.path.startsWith(r.path)||r.name&&r.name==t.name)}function de(r,t){return typeof r=="function"?Reflect.apply(r,{},[t]):r}let Qn=p.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,t){const e=p.inject(et,null);return()=>{let n=de(r.to,null),i=de(r.tag,n);if(i==null){console.warn("can not resolve link tag");return}let s=null,o=null;e!==null&&(s=e[N](n),r.root&&(s.root=r.root),o=e.current);let l={},u=de(r.activeClass,s);if(typeof u=="string"&&u.length>0&&(l[u]=Jn(s,o)),de(r.exact,s)===!0){let c=de(r.exactActiveClass,s);typeof c=="string"&&c.length>0&&(l[c]=Gn(s,o))}let f={class:l};(i==="a"||i==="A")&&(f.href=s?.path??s?.name??"#"),T(!0,f,t.attrs);let h=de(r.event,s);if(typeof h=="string"){const c=y=>{if(e==null){console.warn("router is not been injected");return}if(s==null){console.warn("route is not been resolved");return}zn(y)&&e.to(s)};f[h]=c}return p.h(i,f,t.slots)}}}),Xn={get each(){return Wr},get type(){return _e},get isFunction(){return S},get isArray(){return fr},get isArrayLike(){return $t},get makeArray(){return Ur},get merge(){return dr},get isWindow(){return yr},get isPlainObject(){return Ge},get isEqual(){return Je}};const kt=Symbol("fk"),Dt=Symbol("fbk"),Vt=Symbol("fepk");function Yn(r={}){const t=new Fn(r),e=new Pt,n=new At,i={...Xn,get router(){return t},get bus(){return e},get Bus(){return Pt},get eventproxy(){return n},get EventProxy(){return At},get EventChain(){return Xe},get require(){return t.require},get request(){return request},get extend(){return T},get clone(){return Ke},install(s){s.provide(et,t),s.provide(kt,i),s.provide(Dt,e),s.provide(Vt,n),s.component(Tn,qt),s.component(Kn,Qn),Reflect.defineProperty(s.config.globalProperties,"$fox",{get(){return i}}),Reflect.defineProperty(s.config.globalProperties,"$router",{get(){return t}}),Reflect.defineProperty(s.config.globalProperties,"$bus",{get(){return e}}),Reflect.defineProperty(s.config.globalProperties,"$bus",{get(){return e}}),Reflect.defineProperty(s.config.globalProperties,"$eventProxy",{get(){return n}}),s.config.globalProperties.$fox_on=function(o,l,u=!1){n.on(o,l,u)},s.config.globalProperties.$fox_off=function(o,l){n.off(o,l)},s.config.globalProperties.$fox_once=function(o,l){n.once(o,l)},s.config.globalProperties.$fox_all=function(...o){let l=n;Reflect.apply(l.all,l,o)},s.config.globalProperties.$fox_trigger=function(o,...l){let u=n;Reflect.apply(u.trigger,u,[o,...l])},s.config.globalProperties.$fox_emit=function(o,...l){let u=n;Reflect.apply(u.trigger,u,[o,...l])},s.mixin({computed:{$route(){return br(this)}}}),t.init()}};return i}function Bt(r){return r?r.$router:p.inject(et)}function Zn(r){return r||(r=p.getCurrentInstance()?.proxy??void 0),r?br(r):null}function ei(r){return r?r.$fox:p.inject(kt)}function ti(r){return r?r.$bus:p.inject(Dt)}function ri(r){return r?r.$eventProxy:p.inject(Vt)}function ni(r){const t=Bt(),e=(n,i,s)=>{try{Reflect.apply(r,{},[n,i])}catch(o){console.error(o)}s()};t.beforeEach(e),p.onUnmounted(()=>{t.removeBeforeEach(e)})}function ii(r){const t=Bt(),e=(n,i,s)=>{try{Reflect.apply(r,{},[n,i])}catch(o){console.error(o)}s()};t.afterEach(e),p.onUnmounted(()=>{t.removeAfterEach(e)})}exports.Bus=Pt;exports.EventChain=Xe;exports.EventProxy=At;exports.Route=j;exports.clone=Ke;exports.createFox=Yn;exports.createMemoryHistory=Ar;exports.createWebHashHistory=Pr;exports.createWebHistory=Pn;exports.extend=T;exports.foxBusKey=Dt;exports.foxEventProxyKey=Vt;exports.foxKey=kt;exports.isArray=fr;exports.isDate=Or;exports.isESModule=hr;exports.isEqual=Je;exports.isFunction=S;exports.isMap=$r;exports.isObject=cr;exports.isPlainObject=Ge;exports.isPromise=Hr;exports.isSet=Mr;exports.isString=Lr;exports.isSymbol=Nr;exports.onAfterRouteUpdate=ii;exports.onBeforeRouteUpdate=ni;exports.onFoxActivated=ln;exports.onFoxInactivated=un;exports.sessionKey=re;exports.toBoolean=jt;exports.toNumber=Vr;exports.toTypeString=Ze;exports.typeOf=_e;exports.useBus=ti;exports.useEventProxy=ri;exports.useFox=ei;exports.useRoute=Zn;exports.useRouter=Bt;
2
+ * fox v3.0.0 Sun Jan 29 2023 23:14:02 GMT+0800 (中国标准时间)
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&&lt(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;
@@ -371,7 +371,7 @@ declare const forestKey: unique symbol;
371
371
  /**
372
372
  * Fox接口
373
373
  */
374
- export declare interface Fox extends Tools {
374
+ export declare interface Fox {
375
375
  /**
376
376
  * 返回router
377
377
  */
@@ -381,21 +381,29 @@ export declare interface Fox extends Tools {
381
381
  */
382
382
  get bus(): Tree;
383
383
  /**
384
- * 返回Bus类型
384
+ * 返回Bus构造函数
385
385
  */
386
386
  get Bus(): typeof Bus;
387
387
  /**
388
- * 返回全局event proxy
388
+ * 返回event proxy构造函数
389
389
  */
390
- get eventproxy(): EventProxy;
390
+ get EventProxy(): typeof EventProxy;
391
391
  /**
392
392
  * 返回全局event proxy
393
393
  */
394
- get EventProxy(): typeof EventProxy;
394
+ get eventproxy(): EventProxy;
395
395
  /**
396
- * 返回event chain类型
396
+ * 返回event chain构造函数
397
397
  */
398
398
  get EventChain(): typeof EventChain;
399
+ /**
400
+ * 获取require构造函数
401
+ */
402
+ get Require(): typeof Require;
403
+ /**
404
+ * 获取require
405
+ */
406
+ get require(): Require;
399
407
  /**
400
408
  * 返回extend
401
409
  */
@@ -752,6 +760,154 @@ declare const _removeRouteRecorder: unique symbol;
752
760
 
753
761
  declare const _removeView: unique symbol;
754
762
 
763
+ /**
764
+ * AMD加载器
765
+ */
766
+ declare class Require {
767
+ /**
768
+ * module manager
769
+ */
770
+ private moduleManager;
771
+ /**
772
+ * 参数配置
773
+ */
774
+ private options;
775
+ /**
776
+ * 设置路径映射
777
+ */
778
+ set paths(paths: Record<string, string>);
779
+ /**
780
+ * 获取路径映射
781
+ */
782
+ get paths(): Record<string, string>;
783
+ /**
784
+ * 设置路径别名
785
+ */
786
+ set alias(alias: Record<string, string>);
787
+ /**
788
+ * 获取路径别名
789
+ */
790
+ get alias(): Record<string, string>;
791
+ /**
792
+ * 设置不需要解析路径或判断函数
793
+ */
794
+ set naturePaths(nature: string[] | {
795
+ (path: string): boolean;
796
+ });
797
+ /**
798
+ * 获取不需要解析路径或判断函数
799
+ */
800
+ get naturePaths(): string[] | {
801
+ (path: string): boolean;
802
+ };
803
+ /**
804
+ * 设置超时时间
805
+ */
806
+ set timeout(t: number);
807
+ /**
808
+ * 获取超时时间
809
+ */
810
+ get timeout(): number;
811
+ /**
812
+ * 设置query
813
+ */
814
+ private _query?;
815
+ set query(val: Record<string, string | number> | undefined);
816
+ get query(): Record<string, string | number> | undefined;
817
+ /**
818
+ * 获取document head
819
+ */
820
+ get head(): any;
821
+ /**
822
+ * 构造函数
823
+ */
824
+ constructor();
825
+ /**
826
+ * 安装module
827
+ */
828
+ setModule(id: string, exports: Record<string, any> | {
829
+ (): Record<string, any>;
830
+ }): void;
831
+ /**
832
+ * 移除module
833
+ */
834
+ removeModule(id: string): void;
835
+ /**
836
+ * 加载
837
+ * @params args
838
+ */
839
+ ensure(...args: any[]): Require;
840
+ /**
841
+ * 卸载
842
+ */
843
+ remove(...args: any): Require;
844
+ /**
845
+ * 加载
846
+ *
847
+ * @param chain
848
+ * @param taskNode
849
+ */
850
+ private mount;
851
+ /**
852
+ * 加载css
853
+ * @param chain
854
+ * @param task
855
+ * @param point
856
+ */
857
+ private mountCSS;
858
+ /**
859
+ * 加载js
860
+ *
861
+ * @param chain
862
+ * @param task
863
+ * @param point
864
+ */
865
+ private mountJS;
866
+ /**
867
+ * 卸载资源
868
+ */
869
+ private unmount;
870
+ /**
871
+ * 去掉空元素
872
+ */
873
+ private trimEmptyElement;
874
+ /**
875
+ * 创建define函数
876
+ * @param module
877
+ * @param task
878
+ * @returns {Function}
879
+ */
880
+ private createDefine;
881
+ /**
882
+ * 解析路径
883
+ * @param uri
884
+ * @returns {string}
885
+ */
886
+ private resolvePath;
887
+ /**
888
+ * 创建search字符串
889
+ */
890
+ private createSearch;
891
+ /**
892
+ * 获取文件名后缀
893
+ * @param name
894
+ * @returns {string}
895
+ */
896
+ private getFileNamePostfix;
897
+ /**
898
+ * 是否为不处理的路径
899
+ * @param uri
900
+ * @return
901
+ */
902
+ private isNaturePath;
903
+ /**
904
+ * 解析路径
905
+ * @param uri
906
+ * @param replace
907
+ */
908
+ private parserPath;
909
+ }
910
+
755
911
  declare const _resolveComponent: unique symbol;
756
912
 
757
913
  declare const resolveRoute: unique symbol;
@@ -1542,22 +1698,6 @@ export declare function toBoolean(val: unknown): boolean;
1542
1698
  */
1543
1699
  export declare function toNumber(val: unknown): number;
1544
1700
 
1545
- /**
1546
- * Tool工具集合接口
1547
- */
1548
- declare interface Tools {
1549
- get each(): Function;
1550
- get type(): Function;
1551
- get isFunction(): Function;
1552
- get isArray(): Function;
1553
- get isArrayLike(): Function;
1554
- get makeArray(): Function;
1555
- get merge(): Function;
1556
- get isWindow(): Function;
1557
- get isPlainObject(): Function;
1558
- get isEqual(): Function;
1559
- }
1560
-
1561
1701
  export declare const toTypeString: (value: unknown) => string;
1562
1702
 
1563
1703
  /**