@fox-js/fox 3.1.1-25 → 3.1.1-26

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 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let m=require("vue");var xe=typeof window<"u",A=function(){return window},Ue=function(){return window.document};function lt(e,t,r,s=!1){e.addEventListener?e.addEventListener(t,r,s):e.attachEvent?e.attachEvent(`on${t}`,r):e[`on${t}`]=r}function Gt(e,t,r){e.removeEventListener?e.removeEventListener(t,r):e.detachEvent?e.detachEvent(`on${t}`,r):e[`on${t}`]=null}var Ve=(e,t,r)=>{t=t??{bubbles:!1,cancelable:!1,detail:void 0};const s=document.createEvent("Events");let i=!0,n=!0;for(let o in t)o==="bubbles"?i=!!t[o]:o==="cancelable"?n=!!t[o]:s[o]=t[o];s.initEvent(e,i,n),(r??document).dispatchEvent(s)},Dt=Array.isArray,ys=e=>ht(e)==="[object Map]",ds=e=>ht(e)==="[object Set]",ms=e=>e instanceof Date,R=e=>typeof e=="function",vs=e=>typeof e=="string",ps=e=>typeof e=="symbol",Fr=e=>e!==null&&typeof e=="object",gs=e=>Fr(e)&&R(e.then)&&R(e.catch),Pe=e=>e==null,bs=Object.prototype.toString,ht=e=>bs.call(e),Cr=e=>ht(e)==="[object Object]",ws=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol";function yt(e){return e.__esModule||ws&&e[Symbol.toStringTag]==="Module"}var Rs=typeof Promise<"u"&&Promise.toString().indexOf("[native code]")!==-1;function q(...e){let t=e[0]!==void 0&&e[0]!==null?e[0]:{},r=1,s=e.length,i=!1;for(typeof t=="boolean"&&(i=t,t=e[r]??{},r++),typeof t!="object"&&(t={});r<s;r++)if(e[r]!==null&&e[r]!==void 0){let n=e[r];for(let o in n){let u=t[o],l=n[o];if(u!==l)if(i===!0&&l&&typeof l=="object"){let a;Array.isArray(l)?a=u&&Array.isArray(u)?u:[]:a=u&&typeof u=="object"?u:{},t[o]=q(i,a,l)}else l!==void 0&&(t[o]=l)}}return t}function _r(e,t,r=!1){if(typeof t!="object")return{};typeof e!="object"&&(e={});for(let s of Reflect.ownKeys(t)){let i=e[s],n=t[s];if(i!==n)if(typeof n=="object"){if(!Array.isArray(n)&&!Cr(n))continue;i=_r(i,n,r),e[s]=i}else{if(typeof n=="function")continue;e[s]=n}}return e}var Ie=class Ht{static seed=new Date().getTime();static get(){let t=++Ht.seed;return t>=Number.MAX_VALUE&&(Ht.seed=0),t}},gt=Rs?Promise.resolve():null;function Oe(e,...t){gt!==null?t&&t.length>0?gt.then(()=>{e(t)}):gt.then(e):t&&t.length>0?setTimeout(()=>{e(t)}):setTimeout(e)}function Xt(e){return e==null?!1:typeof e=="boolean"?e:typeof e=="string"?e.toLocaleLowerCase()==="true":!!e}function xs(e){return typeof e=="number"?e:Number(e)}var Ss={"[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 Nt(e){let t=Object.prototype.toString.call(e);return e==null?String(e):Ss[t]||"object"}function Ut(e,t){if(e==t)return!0;if(e===void 0||t===void 0)return!1;let r=Nt(e);if(r!==Nt(t))return!1;if(r==="object"){let s=Object.keys(e),i=Object.keys(t);if(s.length!==i.length)return!1;for(let n=0;n<s.length;n++){let o=s[n],u=e[o],l=t[o];if(!Ut(u,l))return!1}return!0}else if(r==="array"){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s++){let i=e[s],n=t[s];if(!Ut(i,n))return!1}return!0}return!1}var Ar=e=>{const t={};for(let r of Reflect.ownKeys(e)){let s=e[r];s&&!Array.isArray(s)&&typeof s=="object"&&(s=Ar(s)),typeof r=="symbol"?t[String(r)]=s:t[r]=s}return t},Ps=/^Symbol\((.*)\)$/,jr=e=>{const t={};for(let r of Reflect.ownKeys(e)){let s=e[r];s&&!Array.isArray(s)&&typeof s=="object"&&(s=jr(s));const i=Ps.exec(r);if(i&&i[1]){const n=Symbol.for(i[1]);t[n]=s}else t[r]=s}return t};function qr(e,t){let r=null;return function(...s){r&&clearTimeout(r),r=setTimeout(()=>{r=null,Reflect.apply(e,null,[...s])},t)}}var ir=Symbol("idKey"),ye=Symbol("valueKey"),x=Symbol("childrenKey"),X=Symbol("growKey"),Kr=class{[X]=!0;[ir];[ye]=(0,m.ref)();[x]=new Map;constructor(e){this[ir]=e}},Es=class{get(e,t){if(t=="value")return e[ye].value;if(t==="grow")return e[X];let r=e[x].get(t);if(r)return De(r);if(e[X])return r=Zt(t),r[X]=e[X],e[x].set(t,r),De(r)}set(e,t,r){return t=="value"?(e[ye].value=r,!0):t==="grow"?(e[X]=Xt(r),!0):r==null?(e[x].delete(t),!0):(console.error(`[Fox]illegal property:${t}`),!1)}deleteProperty(e,t){return t==="value"||t=="grow"?(console.error(`[Fox]can not delete property:${String(t)}`),!1):(e[x].delete(t),!0)}},Qt="__proxy__";function Zt(e){const t=new Kr(e);return Reflect.set(t,Qt,new Proxy(t,new Es)),t}function De(e){return Reflect.get(e,Qt)}var Fs=class{name="";persistPolicy="memory";storage;initFlag=!1;state={};constructor(e={},t){if(e.persistPolicy&&e.persistPolicy!=="memory"&&Pe(e.name))throw new Error("name can not be empty, where persistPolicy is not memory.");this.name=e.name??"",this.persistPolicy=e.persistPolicy??"memory",this.storage=e.storage,t&&typeof t=="object"&&Object.assign(this.state,t)}init(e){this.restore(e),this.initFlag=!0}getStorage(){if(!this.persistPolicy||this.persistPolicy==="memory")return null;let e=null;if(this.persistPolicy==="custom")e=this.storage;else if(xe){const t=A();e=this.persistPolicy==="session"?t.sessionStorage:t.localStorage}return e}saveState(){if(!this.persistPolicy||this.persistPolicy==="memory")return;let e=this.getStorage();if(e===null||!this.state)return;const t=`_bus_${this.name}`,r=JSON.stringify(this.state??{});e.setItem(t,r)}removeState(){if(!this.persistPolicy||this.persistPolicy==="memory")return;let e=this.getStorage();if(e===null||!this.state)return;const t=`_bus_${this.name}`;e.removeItem(t)}restore(e){if(!this.persistPolicy||this.persistPolicy==="memory")return;let t=this.getStorage();if(t===null)return;const r=`_bus_${this.name}`,s=t.getItem(r);if(s){const i=JSON.parse(s);Object.assign(this.state,i),Reflect.ownKeys(this.state).forEach(n=>{if(typeof n!="string")return;const o=this.state[n],u=n.split(/\//g);u.push(o),Reflect.apply(e.put,e,u)})}}put(e){if(this.initFlag&&this.persistPolicy!=="memory")try{const t=e.length,r=e.slice(0,t-1).join("/"),s=e[t-1];this.state[r]=s,this.saveState()}catch(t){console.error(t)}}remove(e){if(this.initFlag&&this.persistPolicy!=="memory")try{const t=e.length,r=e.slice(0,t-1).join("/"),s={};Reflect.ownKeys(this.state).forEach(i=>{typeof i=="string"&&(i===r||i.startsWith(r)||(s[i]=this.state[i]))}),this.state=s,this.saveState()}catch(t){console.error(t)}}clear(){if(this.initFlag)try{this.state={},this.removeState()}catch(e){console.error(e)}}},$r=class extends Kr{_persistHandler;constructor(e={},t){super("__root__"),this._persistHandler=new Fs(e,t),this._persistHandler.init(this)}put(...e){let t=e.length;if(t<2)return console.error("[Fox]参数至少包括一个(key, value)"),!1;let r=this;for(let s=0;s<t-1;s++){let i=e[s],n;r[x].has(i)?n=r[x].get(i):(n=Zt(i),r[x].set(i,n)),r=n}return r[ye].value=e[t-1],this._persistHandler.put(e),!0}get(...e){let t=e.length;if(t===0)return;let r=this;for(let s=0;s<t;s++){let i=e[s];if(r[x].has(i))r=r[x].get(i);else return}return r[ye].value}remove(...e){let t=e.length;if(t==0)return!1;let r=this;for(let i=0;i<t-1;i++){const n=e[i];if(r[x].has(n))r=r[x].get(n);else return!1}const s=e[t-1];return r[x].has(s)?(r[x].delete(s),this._persistHandler.remove(e),!0):!1}contains(...e){const t=e.length;if(t==0)return!1;let r=this;for(let i=0;i<t-1;i++){let n=e[i];if(r[x].has(n))r=r[x].get(n);else return!1}const s=e[t-1];return r[x].has(s)}clear(){this[x].clear(),this._persistHandler.clear()}},Cs=["put","get","contains","remove","clear","_persistHandler"];function nr(e){return Cs.includes(e)}var _s=class{get(e,t){if(t=="value")return e[ye].value;if(t==="grow")return e[X];if(t===x)return e[x];if(typeof t=="string"&&nr(t))return e[t];const r=String(t);let s=e[x].get(r);if(s)return De(s);if(e[X])return s=Zt(r),s[X]=e[X],e[x].set(r,s),De(s)}set(e,t,r){return t=="value"?(e[ye].value=r,!0):t==="grow"?(e[X]=Xt(r),!0):nr(t)?!1:r==null?(e[x].delete(t),!0):(console.error(`[Fox]illegal property:${t}`),!1)}deleteProperty(e,t){return t==="value"||t=="grow"?(console.error(`[Fox]can not delete property:${String(t)}`),!1):(e[x].delete(t),!0)}};function As(e,t){const r=new $r(e,t),s=new _s,i=new Proxy(r,s);return Reflect.set(r,Qt,i),r}var Vt=new Proxy($r,{construct(e,t){const r=t[0]??{},s=t[1];return De(As(r,s))}}),Yt=e=>!e||typeof e!="object"?!0:Reflect.ownKeys(e).length===0,Lr=class{name="";persistPolicy="memory";storage;constructor(e={}){if(e.persistPolicy&&e.persistPolicy!=="memory"&&Pe(e.name))throw new Error("name can not be empty, where persistPolicy is not memory.");this.name=e.name??"",this.persistPolicy=e.persistPolicy??"memory",this.storage=e.storage}getStorage(){if(!this.persistPolicy||this.persistPolicy==="memory")return null;let e=null;if(this.persistPolicy==="custom")e=this.storage;else if(xe){const t=A();e=this.persistPolicy==="session"?t.sessionStorage:t.localStorage}return e}saveState(e){if(!this.persistPolicy||this.persistPolicy==="memory")return;let t=this.getStorage();if(t===null||Yt(e))return;const r=`_state_${this.name}`,s=JSON.stringify(e??{});t.setItem(r,s)}removeState(){if(!this.persistPolicy||this.persistPolicy==="memory")return;let e=this.getStorage();if(e===null)return;const t=`_state_${this.name}`;e.removeItem(t)}restore(e){if(!this.persistPolicy||this.persistPolicy==="memory")return;let t=this.getStorage();if(t===null)return;const r=`_state_${this.name}`,s=t.getItem(r);if(s){const i=JSON.parse(s);Object.assign(e,i)}}};function Mr(e,t,r){const s=new Lr(r);s.restore(t);const i=u=>{const l=(0,m.toRaw)(u),a={};for(let f in l){const c=l[f];Pe(c)||(a[f]=c)}Yt(a)?s.removeState():s.saveState(a)};let n=null;r&&r.debounce===!1?n=i:n=qr(i,r&&r.debounceDelay?r.debounceDelay:250);const o=e?(0,m.shallowReactive)(t):(0,m.reactive)(t);return(0,m.effectScope)(!0).run(()=>{(0,m.watch)(o,u=>{const l=(0,m.toRaw)(u);n(l)})}),o}function js(e,t){return Mr(!1,e,t)}function qs(e,t){return Mr(!0,e,t)}function Ks(e,t){const r=new Lr(t);r.restore(e);const s=n=>{const o=(0,m.toRaw)(n),u={};for(let l in o){const a=o[l];Pe(a)||(u[l]=a)}Yt(u)?r.removeState():r.saveState(u)};let i=null;return t&&t.debounce===!1?i=s:i=qr(s,t&&t.debounceDelay?t.debounceDelay:250),new Proxy(e,{get(n,o){return n[o]},set(n,o,u){return n[o]=u,i(n),!0}})}function $s(e,t){return Ks(e,t)}var he=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e})({}),F=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.ParamRegExp=2]="ParamRegExp",e[e.ParamRegExpEnd=3]="ParamRegExpEnd",e[e.EscapeNext=4]="EscapeNext",e})(F||{}),Ls={type:he.Static,value:""},Ms=/[a-zA-Z0-9_]/;function Ts(e){if(!e)return[[]];if(e==="/")return[[Ls]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(y){throw new Error(`ERR (${r})/"${a}": ${y}`)}let r=F.Static,s=r;const i=[];let n;function o(){n&&i.push(n),n=[]}let u=0,l,a="",f="";function c(){a&&(r===F.Static?n.push({type:he.Static,value:a}):r===F.Param||r===F.ParamRegExp||r===F.ParamRegExpEnd?(n.length>1&&(l==="*"||l==="+")&&t(`A repeatable param (${a}) must be alone in its segment. eg: '/:ids+.`),n.push({type:he.Param,value:a,regexp:f,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):t("Invalid state to consume buffer"),a="")}function h(){a+=l}for(;u<e.length;){if(l=e[u++],l==="\\"&&r!==F.ParamRegExp){s=r,r=F.EscapeNext;continue}switch(r){case F.Static:l==="/"?(a&&c(),o()):l===":"?(c(),r=F.Param):h();break;case F.EscapeNext:h(),r=s;break;case F.Param:l==="("?r=F.ParamRegExp:Ms.test(l)?h():(c(),r=F.Static,l!=="*"&&l!=="?"&&l!=="+"&&u--);break;case F.ParamRegExp:l===")"?f[f.length-1]=="\\"?f=f.slice(0,-1)+l:r=F.ParamRegExpEnd:f+=l;break;case F.ParamRegExpEnd:c(),r=F.Static,l!=="*"&&l!=="?"&&l!=="+"&&u--,f="";break;default:t("Unknown state");break}}return r===F.ParamRegExp&&t(`Unfinished custom RegExp for param "${a}"`),c(),o(),i}var or="[^/]+?",ks={sensitive:!1,strict:!1,start:!0,end:!0},J=(function(e){return e[e._multiplier=10]="_multiplier",e[e.Root=90]="Root",e[e.Segment=40]="Segment",e[e.SubSegment=30]="SubSegment",e[e.Static=40]="Static",e[e.Dynamic=20]="Dynamic",e[e.BonusCustomRegExp=10]="BonusCustomRegExp",e[e.BonusWildcard=-50]="BonusWildcard",e[e.BonusRepeatable=-20]="BonusRepeatable",e[e.BonusOptional=-8]="BonusOptional",e[e.BonusStrict=.7000000000000001]="BonusStrict",e[e.BonusCaseSensitive=.25]="BonusCaseSensitive",e})(J||{}),Is=/[.+*?^${}()[\]/\\]/g;function Os(e,t){const r=q(!0,{},ks,t),s=[];let i=r.start?"^":"";const n=[];for(const a of e){const f=a.length?[]:[J.Root];r.strict&&!a.length&&(i+="/");for(let c=0;c<a.length;c++){const h=a[c];let y=J.Segment+(r.sensitive?J.BonusCaseSensitive:0);if(h.type===he.Static)c||(i+="/"),i+=h.value.replace(Is,"\\$&"),y+=J.Static;else if(h.type===he.Param){const{value:d,repeatable:v,optional:w,regexp:b}=h;n.push({name:d,repeatable:v,optional:w});const p=b||or;if(p!==or){y+=J.BonusCustomRegExp;try{new RegExp(`(${p})`)}catch(M){throw new Error(`Invalid custom RegExp for param "${d}" (${p}): `+M.message)}}let L=v?`((?:${p})(?:/(?:${p}))*)`:`(${p})`;c||(L=w&&a.length<2?`(?:/${L})`:"/"+L),w&&(L+="?"),i+=L,y+=J.Dynamic,w&&(y+=J.BonusOptional),v&&(y+=J.BonusRepeatable),p===".*"&&(y+=J.BonusWildcard)}f.push(y)}s.push(f)}if(r.strict&&r.end){const a=s.length-1;s[a][s[a].length-1]+=J.BonusStrict}r.strict||(i+="/?"),r.end?i+="$":r.strict&&!i.endsWith("/")&&(i+="(?:/|$)");const o=new RegExp(i,r.sensitive?"":"i");function u(a){const f=a.match(o),c={};if(!f)return null;for(let h=1;h<f.length;h++){const y=f[h]||"",d=n[h-1];c[d.name]=y&&d.repeatable?y.split("/"):y}return c}function l(a){let f="",c=!1;for(const h of e){(!c||!f.endsWith("/"))&&(f+="/"),c=!1;for(const y of h)if(y.type===he.Static)f+=y.value;else if(y.type===he.Param){const{value:d,repeatable:v,optional:w}=y,b=d in a?a[d]:"";if(Dt(b)&&!v)throw new Error(`Provided param "${d}" is an array but it is not repeatable (* or + modifiers)`);const p=Dt(b)?b.join("/"):b;if(!p)if(w)h.length<2&&(f.endsWith("/")?f=f.slice(0,-1):c=!0);else throw new Error(`Missing required param "${d}"`);f+=p}}return f||"/"}return{re:o,score:s,keys:n,parse:u,stringify:l}}function Bs(e,t){const r=Os(Ts(e),t);return function(s){const i=r.parse(s);return i?{path:s,params:i}:null}}var Tr="default",kr=Symbol("sync"),O=Symbol("normalizeRoute");function lr(e){let t=!1;return function(...r){if(!t)return t=!0,Reflect.apply(e,{},r)}}function Ds(e){let t=e.src;return new Promise((r,s)=>{const i=lr(u=>{yt(u)&&(u=u.default),e.component=u,console.debug("success load async module"),r()}),n=lr(u=>{`${u}`,console.debug("reject load async module"),s(u)});let o;try{o=t(i,n)}catch(u){n(u)}if(o)if(typeof o.then=="function")o.then(i,n);else{const u=o.component;u&&typeof u.then=="function"&&u.then(i,n)}})}var Hs=class{name;level;rootName;rootIndex=0;constructor(e,t,r,s){this.name=e,this.level=t,this.rootName=r,this.rootIndex=s}},We=class Ir{to;routeModel;from;data={};constructor(t,r){this.to=t,this.from=r}static from(t){const r=new Ir(t.to,t.from),s=t.data??{};return q(!0,r.data,s),r}static clear(t){for(let r in t)t[r]=void 0}},S=class Wt{path;get fullPath(){const t=this.path??`${this.name}`;return`${this.root??"default"}!${t}`}alias;name;root;params;query;traceless;template;matched;meta;success;error;destroy;opsType;updateType;historyUpdatePolicy;viewTagAttrs;index;active;slot;static clone(t,r){let s=new Wt;return _r(s,t,r),s}static isSame(t,r){return!t||!r?!1:t===r?!0:t.root!==r.root||t.index!==r.index?!1:t.path&&r.path&&t.path===r.path?!0:!!(t.name&&r.name&&t.name===r.name)}static isSamePathForRoute(t,r){return!t||!r?!1:t===r||t.path&&r.path&&t.path===r.path?!0:!!(t.name&&r.name&&t.name===r.name)}static from(t){let r=new Wt;if(t==null)return r;let s=r;for(let n in t)s[n]=t[n];const i=Object.getOwnPropertySymbols(t);if(Array.isArray(i)&&i.length>0)for(let n of i)s[n]=t[n];return r}},Ns=class{id;name;props;src;component;constructor(e,t,r){this.id=Ie.get(),this.name=e,this.src=t,typeof t!="function"&&(this.component=t),this.props=r}get isResolved(){return this.component!==void 0}resolve(){return Ds(this)}},ar=class{models=[]},bt=class{path;match;redirect;name;meta;matchedRoutes;layers=[]},_=(function(e){return e[e.Push=0]="Push",e[e.Replace=1]="Replace",e[e.Put=2]="Put",e[e.Append=3]="Append",e[e.Open=4]="Open",e})({}),wt=(function(e){return e[e.Part=0]="Part",e[e.All=1]="All",e})({}),G=Symbol("rootKey"),z=Symbol("rootNodeKey"),ce=Symbol("parentNodeKey"),nt=Symbol("nameKey"),te=class{model;route;active=!0;index=0;constructor(e,t,r=0,s=!0){this.route=e,this.model=t,this.index=r,this.active=s}},Ce=class{_slots;get slots(){return this._slots==null&&(this._slots=(0,m.shallowRef)([])),this._slots}get empty(){return this._slots==null||this._slots.value.length==0}[nt];[G];[z]=null;[ce]=null;get name(){return this[nt]}constructor(e,t,r){this[nt]=e,this[G]=t,r&&(this[z]=r)}},B=class{view;index;level;constructor(e,t,r){this.view=e,this.index=t,this.level=r}static include(e,t){for(let r=0;r<e.length;r++){let s=e[r];if(s.view===t.view&&(t.index==-1||s.index===t.index)&&s.level===t.level)return!0}return!1}},Rt=class{views=[]},Us=class{layers=[]},Vs=class{time;route},Ws=class{forbidTime=300;submitRecorder=new Vs;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)}},E=(function(e){return e.Busy="Busy",e.Free="Free",e.Reject="Reject",e.Exception="Exception",e.Finished="Finished",e})(E||{}),D=Symbol("chainKey"),I=Symbol("cursorKey"),xt=Symbol("$persistentModeKey"),C=Symbol("statusKey"),Z=Symbol("argsKey"),Je=Symbol("exArgsKey"),me=Symbol("successFnsKey"),_e=Symbol("errorFnsKey"),oe=Symbol("sessionKey"),Y=Symbol("_go"),He=class{[D]=[];[I]=0;[xt]=!1;[C]=E.Free;[Z]=[];[Je]=[];[me]=[];[_e]=[];[oe];get session(){return this[oe]}constructor(e,t=!1){this[oe]=e,this[xt]=t}[Y](e,...t){let r=this[C];if(this[C]=E.Busy,this[I]+=e,this[I]<0&&(this[I]=0),this[Z]=t,r===E.Exception||r===E.Reject){let n=[{session:this[oe]},...this[Je]];for(;this[_e].length>0;)try{let o=this[_e].shift();typeof o=="function"&&Oe(()=>{Reflect.apply(o,{},n)})}catch(o){console.error(o.message,o)}return this[C]=r,this[D]=[],this[I]=0,this}else if(r===E.Finished||this[I]>=this[D].length){let n=[{session:this[oe]},...this[Z]];for(;this[me].length>0;){let o=this[me].shift();typeof o=="function"&&Oe(()=>{Reflect.apply(o,{},n)})}return this[C]=E.Free,this}if(this[I]>=this[D].length)return this[C]=E.Free,this;let s=this[D][this[I]];this[xt]||(this[D].splice(0,this[I]+1),this[I]=-1);let i=this[I]+1;try{let n=!1,o={go:(u,...l)=>{n||(n=!0,Reflect.apply(this[Y],this,[u,...l]))},resolve:(...u)=>{n||(n=!0,Reflect.apply(this[Y],this,[1,...u]))},reject:(...u)=>{n||(n=!0,Reflect.apply(this.reject,this,[...u]))},insert:u=>{n||(this[D].splice(i,0,u),i++)},session:this[oe]};Oe(()=>{Reflect.apply(s,{},[o,...this[Z]])})}catch(n){this.throw(n)}return this}go(e,...t){return Reflect.apply(this[Y],this,[e,...t])}finish(...e){return this[C]=E.Finished,this[Z]=e,Reflect.apply(this[Y],this,[0])}reject(...e){return this[C]=E.Reject,this[Je]=e,Reflect.apply(this[Y],this,[0])}throw(...e){return this[C]=E.Exception,this[Je]=e,Reflect.apply(this[Y],this,[0])}reset(...e){this[C]=E.Busy,this[Z]=e,this[D]=[],this[I]=0;let t=[{session:this[oe]},...this[Z]];for(;this[me].length>0;){let r=this[me].shift();Oe(()=>{Reflect.apply(r,this,t)})}return this[C]=E.Free,this}post(e){return this[C]===E.Reject||this[C]===E.Exception?this:(Array.isArray(e)?this[D]=[...this[D],...e]:this[D].push(e),this[C]===E.Busy?this:(Reflect.apply(this[Y],this,[0,...this[Z]]),this))}wait(e,t){return e&&typeof e=="function"&&this[me].push(e),t&&typeof t=="function"&&this[_e].push(t),this[C]===E.Busy?this:(Reflect.apply(this[Y],this,[0,...this[Z]]),this)}exception(e){return e&&typeof e=="function"&&this[_e].push(e),this[C]===E.Busy?this:Reflect.apply(this[Y],this,[0,...this[Z]])}isFinish(){return this[C]==E.Reject||this[C]==E.Free&&this[I]>=this[D].length}},we=Symbol("_notifyChange"),ur=class{currentRoute;routes;constructor(e,t){this.currentRoute=e,this.routes=t}},le=Symbol("historyChangeConsumerKey"),fr=Symbol("_navigateFirstRoute"),ze=Symbol("_getRouteMark"),St=Symbol("_getUrlSearch"),Pt=Symbol("_generateLocation"),Ge=Symbol("_setRouteMarkRecorder"),Ae=Symbol("beforeRestoreFiltersKey"),cr=Symbol("_beforeRestore"),hr="Symbol(_fox_restore_point)";function je(e,...t){return typeof e=="function"?Reflect.apply(e,null,[...t]):e}function yr(e){if(!Array.isArray(e))return!1;if(e.length===0)return!0;const t=e[0];return!!(Reflect.has(t,"path")&&Reflect.has(t,"root"))}var Or=class{base;storage;mode;query;firstNavigate=!0;historyMonitor;traceless=!1;changeHandler;historyChange;[le]=!1;[Ae]=new Array;backTimeout=320;constructor(e="hash",t="",r="",s=!0,i=!0,n=!1,o,u){this.mode=e,this.base=t,this.query=r,this.firstNavigate=s,this.historyMonitor=i,this.traceless=n,this.storage=o??A().sessionStorage,this.backTimeout=u??320}init(e=!0){const t=A();return typeof this.historyChange!="function"&&(this.historyChange=()=>{if(typeof this[le]=="function"){const r=this[le]();if(this[le]=!1,r)return}else if(this[le]===!0){this[le]=!1;return}if(je(this.historyMonitor)){const r=t.history.state;this[we](r);try{let s=[];if(typeof r=="string"?s=JSON.parse(r):s=r,Array.isArray(s)&&s.length>0){const i=this[ze]()??"/";this[Ge](i,s)}}catch{}}}),lt(t,"popstate",this.historyChange),this.firstNavigate&&e&&this[fr](),Promise.resolve()}destroy(){this.historyChange&&Gt(A(),"popstate",this.historyChange)}[cr](e,t,r,s){for(let i of this[Ae])try{const n=Reflect.apply(i,{},[e,t,r,s]);if(n===!1)return n}catch(n){console.error(n.message,n)}return!0}beforeRestoreEach(e){this[Ae].push(e)}removeBeforeRestoreEach(e){const t=this[Ae].indexOf(e);return t!==-1?(this[Ae].splice(t,1),!0):!1}[fr](){const e=this[ze]()??"/",t=this.storage.getItem(hr);if(t)try{const n=JSON.parse(t);if(n.mark===e&&Array.isArray(n.routes)&&n.routes.length>0){const o=n.routes.filter((u,l)=>(u.params=u.params?jr(u.params):{},this[cr](u,l,e,n.routes)));if(o.length>0){const u=this[St](),l=o.length-1;o[l].query=u||o[l].query,this[we](o);return}}}catch{}const r=e.indexOf("!");let s;r!=-1?s=e.substring(r+1):s=e;const i=new S;i.path=s,i.query=this[St](),this[we]([i])}[Ge](e,t){try{t.forEach(s=>{s.params=s.params?Ar(s.params):{}});const r=JSON.stringify({mark:e,routes:t});this.storage.setItem(hr,r)}catch(r){console.error(r.message,r)}}setRestorePoint(e){const t=this[ze]()??"/";this[Ge](t,e)}[we](e){typeof this.changeHandler=="function"&&this.changeHandler(e)}[ze](){const e=A();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,r=t.indexOf("#");if(r!=-1)return t.substring(r+1)}return null}[St](){let e=A().location.search;return e.length>0&&e.indexOf("?")===0&&(e=e.substring(1)),e}listen(e){this.changeHandler=e}go(e,t=!1){const r=A();this[le]=t,r.history.go(e)}goBack(e,t){const r=A(),s=r.history.state;if(yr(s)&&s.length>0){let i=!1;for(let a=s.length-1;a>=0;a--){const f=S.from(s[a]);if(!(f.historyUpdatePolicy==="traceless"||je(this.traceless,f))&&S.isSame(f,e)){i=!0;break}}if(!i){t();return}const n=this.backTimeout;let o=null;const u=()=>{r.history.go(-1),o=setTimeout(u,n)},l=()=>{clearTimeout(o);const a=A().history.state;if(yr(a)&&a.length>0){let f=a.length;const c=a[f-1],h=S.from(c);if(S.isSame(h,e))return t(),!0;if(f>0){let y=!1;for(let d=f-1;d>=0;d--){const v=S.from(a[d]);if(!(v.traceless===!0||je(this.traceless,v))&&S.isSame(v,e)){y=!0;break}}return y?(setTimeout(()=>{o=setTimeout(u,n),this.go(-1,l)},0),!0):(t(),!0)}}return t(),!0};o=setTimeout(u,n),this.go(-1,l)}else t()}setRouteMark(e){const t=e.currentRoute.fullPath;this[Ge](t,e.routes)}push(e){const t=this[Pt](e.currentRoute);e.currentRoute.historyUpdatePolicy!=="traceless"&&!je(this.traceless,e.currentRoute)&&A().history.pushState(e.routes,"",t),this.setRouteMark(e)}replace(e){const t=this[Pt](e.currentRoute);(e.currentRoute.historyUpdatePolicy!=="traceless"||!je(this.traceless,e.currentRoute))&&A().history.replaceState(e.routes,"",t),this.setRouteMark(e)}[Pt](e){const t=A();let r="";if(e.query){let o="";if(typeof e.query=="object")for(let u of Reflect.ownKeys(e.query)){let l=encodeURIComponent(e.query[u]),a=`${encodeURIComponent(String(u))}=${l}`;o.length>0&&(o+="&"),o+=a}else o=e.query;this.query?(r=o.length>0?`${this.query}&${o}`:this.query,r.length>0&&r.charAt(0)!=="?"&&(r=`?${r}`)):o.length>0&&(r=`?${o}`)}const s=t.location;let i=e.alias??e.fullPath;i.startsWith("default")&&(i=i.substring(Tr.length+1));let n;return r?this.mode=="path"?i.indexOf("/")===0?n=`${this.base}${i}${r}`:n=`${this.base}/${i}${r}`:n=`${s.pathname}${r}#${i}`:this.mode=="path"?i.indexOf("/")===0?n=`${this.base}${i}`:n=`${this.base}/${i}`:n=`${s.pathname}#${i}`,`${s.origin}${n}`}};function Js(e=!0,t=null,r="",s=!0,i=!1,n){return t!==null&&(t=A().location.pathname),t&&t.endsWith("/")&&(t=t.substring(0,t.length-1)),new Or("path",t??"",r,e,s,i,n)}function Br(e=!0,t="",r=!0,s=!1,i){return new Or("hash","",t,e,r,s,i)}var zs=class{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=[]}beforeRestoreEach(e){}removeBeforeRestoreEach(e){return!1}listen(e){this.changeHandler=e}[we](e){typeof this.changeHandler=="function"&&this.changeHandler(e)}go(e,t=!1){if(this.queue.length==0||this.cursor<=0)return;let r=this.cursor+e;if(r<0?r=0:r>this.queue.length-1&&(r=this.queue.length-1),r!=this.cursor){this.cursor=r;let s=!1;if(typeof t=="function"?s=t():s=t,!s){const i=this.queue[r];this[we](i.routes)}}}goBack(e,t){if(this.queue.length==0||this.cursor<=0)return;let r=0;if(e===null)r=this.cursor+1;else for(let s=this.cursor;s>=0;s--){const i=this.queue[s];if(S.isSame(i.currentRoute,e))break;r++}if(r===0){t();return}this.go(-r,()=>(t(),!0))}setRouteMark(e){}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 Dr(e="",t=50){return new zs(e,t)}var Xe=Symbol("_constructRouteModel"),Qe=Symbol("_findRouteModel"),Et=Symbol("_findRootView"),Gs=Symbol("_getFirstView"),ae=Symbol("_removeView"),dr=Symbol("_buildPage"),mr=Symbol("_resolveComponent"),vr=Symbol("_update"),re=Symbol("_merge"),Ft=Symbol("_handleHistoryChange"),ue=Symbol("_handleRouteUpdated"),Ze=Symbol("routeUpdatedCallback"),Ct=Symbol("currentRoute"),g=Symbol("currentRoutes"),Ye=Symbol("routeSessionCacheKey"),pr=Symbol("_addRouteRecorder"),qe=Symbol("_removeRouteRecorder"),et=Symbol("_cloneRouteRecorder"),$=Symbol("_handleError"),tt=Symbol("errorCallback"),H=Symbol("registerKey"),rt=Symbol("notFoundKey"),_t=Symbol("notFoundPathKey"),W=Symbol("forestKey"),P=Symbol("historyKey"),Ke=Symbol("beforeFiltersKey"),$e=Symbol("afterFiltersKey"),Le=Symbol("destroyFiltersKey"),At=Symbol("propsFilterKey"),ve=Symbol("mainDispatcherKey"),jt=Symbol("initKey"),fe=Symbol("readyKey"),qt=Symbol("readyHandlersKey"),st=Symbol("_markReady"),gr=Symbol("_createNextFn"),Kt=Symbol("_start"),$t=Symbol("_before"),Lt=Symbol("_after"),br=Symbol("_destroy"),Mt=Symbol("_load"),Me=Symbol("_unload"),Te=Symbol("routerGuardKey");function Xs(e){return e.layers.length==0||e.layers[0].views.length==0}var Hr=class{[H]=new Array;[rt];[_t]="*";[fe]=!1;[qt]=[];[W]=new Us;[P];[g]=new Array;[Ct]=(0,m.shallowRef)(null);[Ye]=new WeakMap;[tt]=null;[Ze]=null;[Ke]=new Array;[$e]=new Array;[Le]=new Array;[At]=null;[ve]=new He;[Te]=new Ws;[jt]=!1;get currentRoute(){return(0,m.readonly)(this[Ct])}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[P]=e.history:this[P]=xe?Br():Dr(),this[P]?.listen(async r=>{let s=!0;try{if(typeof r=="string"){const i=this[O](r);i&&await this[Ft]([i])}else await this[Ft](r)}catch(i){console.error(i.message,i),s=!1}this[fe]===!1&&this[st](s)})}[$](e="error",t){if(t&&typeof t.error=="function")try{t.error(e)}catch{}if(typeof this[tt]=="function")try{this[tt](e,t)}catch{}console.error(e)}init(){this[jt]!==!0&&(this[P]?.init(!this[fe]),this[jt]=!0)}isReady(){return this[fe]?Promise.resolve():new Promise((e,t)=>{this[qt].push([e,t])})}[st](e){this[fe]=!0,this[qt].forEach(([t,r])=>{try{e?t():r()}catch(s){console.error(s.message,s)}})}[Ft](e){try{if(!e){let n=[...this[g]].reverse();return this[Me](n),xe&&A().location.reload(),Promise.resolve()}let t=null,r=[],s=[],i=0;for(;i<e.length&&i<this[g].length&&S.isSame(e[i],this[g][i]);i++)e[i].active===!0&&e[i].active!==this[g][i].active&&(t=e[i]);if(i<e.length&&(r=e.slice(i)),i<this[g].length&&(s=this[g].slice(i).reverse()),s.length===0&&r.length===0){if(t!==null)return this.restore([t])}else if(s.length>0){if(this[Me](s)){if(r.length>0)return this.restore(r);if(t!==null)return this.restore([t])}}else return this.restore(r)}catch(t){this[$](t)}return Promise.resolve()}[ue](e=null){if(this[Ct].value=e,typeof this[Ze]=="function")try{this[Ze](e)}catch{}}[pr](e,t){if(e.opsType===_.Open){let r=!1;const s=this[g].length-1;for(let i=s;i>=0;i--){const n=this[g][i];if(e.root==n.root){if(e.path===n.path){this[g].splice(i,1,e),r=!0;continue}e.active&&(n.active=!1)}}r||this[g].push(e)}else this[g].push(e);this[Ye].set(e,t),this[ue](e)}[et](){let e=[];for(let t of this[g]){let r=S.clone(t,!0);e.push(r)}return e}[qe](e){if(!this[g]){this[ue](null);return}let t=-1;for(let r=0;r<this[g].length;r++)if(S.isSame(this[g][r],e)){t=r;break}if(t!=-1){const r=this[g][t];this[g].splice(t,1);const s=this[Ye].get(r);if(this[Ye].delete(r),this[br](r,s),r.opsType===_.Append){const i=this[g].length-1;this[ue](this[g][i]??null)}else this[ue](null)}else this[ue](null)}set historyMonitor(e){this[P]&&(this[P].historyMonitor=e)}get historyMonitor(){return this[P]?this[P].historyMonitor:!1}set traceless(e){this[P]&&(this[P].traceless=e)}get traceless(){return this[P]?this[P].traceless:!1}set propsFilter(e){this[At]=e}get propsFilter(){return this[At]}setRestorePoint(){const e=this[et]();this[P]?.setRestorePoint(e)}onRouteUpdated(e){this[Ze]=e}onError(e){this[tt]=e}beforeEach(e){this[Ke].push(e)}removeBeforeEach(e){const t=this[Ke].indexOf(e);return t!==-1?(this[Ke].splice(t,1),!0):!1}afterEach(e){this[$e].push(e)}removeAfterEach(e){const t=this[$e].indexOf(e);return t!==-1?(this[$e].splice(t,1),!0):!1}destroyEach(e){this[Le].push(e)}removeDestroyEach(e){const t=this[Le].indexOf(e);return t!==-1?(this[Le].splice(t,1),!0):!1}beforeRestoreEach(e){this[P]?.beforeRestoreEach(e)}removeBeforeRestoreEach(e){return this[P]?.removeBeforeRestoreEach(e)??!1}addRoutes(e){for(let t of e)this.addRoute(t)}addRoute(e,t=-1){if(e.path===this[_t]){this.setNotFoundRoute(e);return}const r=this[Xe](e);if(t==-1)this[H]=[...this[H],...r];else for(let s=r.length-1;s>=0;s--)this[H].splice(t,0,r[s])}removeRoute(e){const t=this[O](e);if(t===null)return console.warn("[Fox]route格式错误",e),!1;for(let r=0;r<this[H].length;r++){const s=this[H][r];if(t?.path&&s.path===t.path)return this[H].splice(r,1),!0;if(t?.name&&s.name===t.name)return this[H].splice(r,1),!0}return!1}hasRoute(e){const t=this[O](e);return t===null?(console.warn("[Fox]route格式错误",e),!1):this[H].findIndex(r=>{if(t?.path&&r.path===t.path||t?.name&&r.name===t.name)return!0})!==-1}setNotFoundPath(e){this[_t]=e}setNotFoundRoute(e){this[rt]=this[Xe](e)[0]}getRoutes(){return[...this[H]]}[Xe](e){let t=e.path??"";t.length>0&&t.charAt(0)!=="/"&&(t=`/${t}`);let r=e.components??(e.component&&{"":e.component});if(!r){const u=new bt;return u.path=t,u.redirect=e.redirect,[u]}const s=new S;s.path=t,s.name=e.name,s.meta=e.meta;let i=[];for(let u in r){const l=r[u];u.length===0&&(u=Tr);const a=new Ns(u,l,e.props);i.push(a)}let n=!1,o=[];if(e.children)for(let u of e.children){const l=this[Xe](u);for(let a of l){let f=new bt;f.name=a.name,a.path&&a.path.length>0?t!=="/"?f.path=`${t}${a.path}`:f.path=a.path:(n=!0,f.path=t);let c=new ar;c.models=[...i],f.layers=[c,...a.layers],f.matchedRoutes=[s,...a.matchedRoutes??[]],o.push(f)}}if(!n){const u=new ar;u.models=i;const l=new bt;l.name=e.name,l.path=t,l.matchedRoutes=[s],l.layers=[u],o.splice(0,0,l)}return o}[Qe](e){const t=e.route;try{for(let r of this[H]){const s=t.path?t.template??t.path:null,i=t.name?t.template??t.name:null;if(s&&r.path){let n=r.match;n||(n=r.match=Bs(r.path));const o=n(s);if(!o)continue;if(r.redirect){const u=new S;q(!0,u,t),u.path=r.redirect;const l={route:u,find:void 0};return this[Qe](l)?(e.route=l.route,e.find=l.find,t.template&&e.find&&(e.find={...e.find},e.find.path=t.path),!0):!1}if(t.params=t.params??{},q(!0,t.params,o.params),t.query){const u=t.query;if(typeof u=="string"){const l={},a=u.split("&");for(let f of a){const c=f.split("=");if(c.length!==2)continue;const h=decodeURIComponent(c[0].trim());l[h]=decodeURIComponent(c[1].trim())}q(!0,t.params,l)}else typeof u=="object"&&q(!0,t.params,u)}return e.find=r,t.template&&e.find&&(e.find={...e.find},e.find.path=t.path),!0}else if(i===r.name)return e.find=r,t.template&&e.find&&(e.find={...e.find},e.find.name=t.name),!0}}catch(r){console.error(r.message,r),typeof t.error=="function"&&t.error(r.message)}return!1}[O](e){let t=null;if(Array.isArray(e))if(t=new S,typeof e[0]=="object")t=S.from(e[0]);else for(let r=0;r<e.length;r++)r===0?e[r].charAt(0)==="/"?t.path=e[r]:t.name=e[r]:r===1?t.params=e[r]:r===2?t.root=e[r]:r===3&&q(!1,t,e[r]);else typeof e=="object"?t=S.from(e):typeof e=="string"&&(t=new S,e.charAt(0)=="/"?t.path=e:t.name=e);if(t){if(t.path){let r=t.path.indexOf("?");r!==-1&&r<t.path.length-1&&(t.query=t.path.substring(r+1),t.path=t.path.substring(0,r))}t.root=t.root??"default",t.opsType=t.opsType??this.options.defaultOperationType??_.Push,t.traceless&&!t.historyUpdatePolicy&&(t.historyUpdatePolicy="traceless")}return t}push(...e){const t=this[O](e);return t?(t.opsType=_.Push,t.historyUpdatePolicy=t.historyUpdatePolicy??"push",this.to(t)):(this[$]("resolve route fail",t),this)}put(...e){const t=this[O](e);return t?(t.opsType=_.Put,t.historyUpdatePolicy=t.historyUpdatePolicy??"traceless",this.to(t)):(this[$]("resolve route fail",t),this)}replace(...e){const t=this[O](e);return t?(t.opsType=_.Replace,t.historyUpdatePolicy=t.historyUpdatePolicy??"replace",this.to(t)):(this[$]("resolve route fail",t),this)}append(...e){const t=this[O](e);return t?(t.opsType=_.Append,t.historyUpdatePolicy=t.historyUpdatePolicy??"push",this.to(t)):(this[$]("resolve route fail",t),this)}remove(e,t){return new Promise(r=>{this[ve].post(s=>{try{if(this[g].length===0){s.resolve(),r(!1);return}let i=-1,n=null,o=[];if(e){if(n=e.root??"default",e.all)for(let l=this[g].length-1;l>0;l--){const a=this[g][l];if(a.opsType===_.Append){const f=a.root??"default";if(n&&n!==f)continue;o.splice(0,0,a),i=l-1}}else if(e.until)for(let l=this[g].length-1;l>0;l--){let a=this[g][l];if(a.opsType===_.Append&&a.root===n){if(e.until.charAt(0)==="/"&&e.until===a.path){i=l;break}else if(e.until===a.name){i=l;break}o.splice(0,0,a)}}else if(e.to)for(let l=this[g].length-1;l>0;l--){const a=this[g][l];if(a.opsType===_.Append){const f=a.root??"default";if(n&&n!==f)continue;if(o.splice(0,0,a),e.to.charAt(0)==="/"&&e.to===a.path){i=l-1;break}else if(e.to===a.name){i=l-1;break}}}}else for(let l=this[g].length-1;l>0;l--){let a=this[g][l];if(a.opsType===_.Append){o.push(a),i=l-1;break}}if(i===-1||o.length===0){const l="[Fox]can not find route";console.warn(l),s.resolve(l),r(!1);return}let u=null;if(i!==-1&&(u=this[g][i]),this[Me](o)){if(t===!1)return s.resolve(),r(!0),!0;const l=()=>(s.resolve(),r(!0),!0),a=this[g].length;if(u&&S.isSame(u,this[g][a-1])){this[P]?.goBack(u,l);return}l()}}catch(i){this[$](i),s.resolve(),r(!1)}})})}open(...e){const t=this[O](e);return t?(t.opsType=_.Open,t.historyUpdatePolicy=t.historyUpdatePolicy??"push",this.to(t)):(this[$]("resolve route fail",t),this)}close(e){return this[ve].post(t=>{try{let r=this[O](e);if(!r){t.reject("resolve route fail");return}let s=[];for(let i=0;i<this[g].length;i++){let n=this[g][i];if(n.root===r.root){if(!r.path&&!r.name){s.push(n);continue}if(r.path&&r.path===n.path){s.push(n);break}else if(r.name&&r.name===n.name){s.push(n);break}}}if(s.length===0){t.resolve();return}this[Me](s),t.resolve()}catch(r){this[$](r),t.resolve()}}),this}to(...e){const t=this[O](e);if(!t)return this[$]("resolve route fail",t),this;const r=this[Te].acquire(t);return r==null?(this[$]("route forbid",t),this):(this[ve].post(s=>{try{let i=this[Kt](t);this[$t](i),this[Mt](i),this[Lt](i),i.wait((n,o)=>{const u=n.session.to;if(n.session.updateResult&&n.session.updateResult.status==="success")try{const l=new ur(S.clone(u,!0),this[et]());u.historyUpdatePolicy==="replace"?this[P]?.replace(l):u.historyUpdatePolicy==="traceless"?this[P]?.setRouteMark(l):this[P]?.push(l)}catch(l){console.error(l.message,l)}if(We.clear(n.session),this[Te].release(r),typeof t.success=="function")try{Reflect.apply(t.success,{},[])}catch(l){console.error(l.message,l)}this[fe]===!1&&this[st](!0),i=null,s.resolve()},(n,o)=>{this[Te].release(r),o!==null&&this[$](o,t),this[fe]===!1&&this[st](!1),We.clear(n.session),i=null,s.resolve()})}catch(i){this[Te].release(r),this[$](i,t),s.resolve()}}),this)}back(e=1){this[P]?.go(-e,!1)}[gr](e){return(t,r)=>{if(typeof t=="boolean")e.session.redirect=!1,t?e.resolve():e.reject(r??null);else if(t){const s=this[O](t);if(s){const i=e.session.to;s.success=i.success,s.error=i.error,e.session.to=s,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()}}[Kt](e){const t=new We(e,this[g].length>0?this[g][this[g].length-1]:void 0),r={route:e,find:null};if(this[Qe](r),r.find){t.routeModel=r.find,e.matched=r.find.matchedRoutes??[];const s={};if(Array.isArray(r.find?.matchedRoutes))for(let i=0;i<r.find.matchedRoutes.length;i++){const n=r.find.matchedRoutes[i];n.meta&&typeof n.meta=="object"&&Object.assign(s,n.meta)}e.meta&&typeof e.meta=="object"&&Object.assign(s,e.meta),e.meta=s}return new He(t)}[$t](e){for(let t of this[Ke])e.post(r=>{const s=this[gr](r);Reflect.apply(t,{},[r.session.to,r.session.from,s,r.session])})}[Lt](e){e.post(t=>{for(let r of this[$e])try{Reflect.apply(r,{},[t.session.to,t.session.from,t.session])}catch(s){console.error(s.message,s)}t.resolve()})}[br](e,t){for(let r of this[Le])try{Reflect.apply(r,{},[e,t])}catch(s){console.error(s.message,s)}typeof e.destroy=="function"&&Reflect.apply(e.destroy,e,[])}[Mt](e){e.post(t=>{const r=t.session.to;let s=t.session.routeModel;if(s==null){let n={route:r,find:null};if(this[Qe](n))s=n.find,t.session.routeModel=s;else if(this[rt])s=this[rt];else{t.reject(`not find route model, path:${r.path??r.name}`);return}}const i=We.from(t.session);this[dr](r,s,i).then(n=>{this[W],t.session.updateResult=n??{status:"success",message:""},t.resolve()},n=>{t.reject(n)})})}[Me](e){if(e.length==0)return!0;let t=this[W],r=[];for(let s of e){let i=this[Et](t,s);i!=null&&r.push({...i,route:s})}if(r.length==0)return this[$]("can not find view index"),!1;for(let s of r.reverse())this[ae](t,{x:s.x,y:s.y},[s.route.index??0],!0);return!0}[Et](e,t){const r=t.root??"default";let s;for(let i=0;i<e.layers.length;i++){const n=e.layers[i];for(let o=n.views.length-1;o>=0;o--){const u=n.views[o];if(u[G]&&u[nt]===r)return s={x:o,y:i},s}}return null}[Gs](e){return e.layers.length>0&&e.layers[0].views.length>0?e.layers[0].views[0]:null}[ae](e,t,r=null,s=!0){if(t.y>=e.layers.length||t.x>=e.layers[t.y].views.length)return;let i=e.layers[t.y].views[t.x],n=!1,o=[],u=!1,l=[...i.slots.value];for(let f=l.length-1;f>=0;f--){let c=l[f];(!r||r.indexOf(c.index)!=-1)&&(c.route&&i[G]&&(this[qe](c.route),c.active===!0&&c.route.opsType==_.Append&&(u=!0)),o.push(new B(i,c.index,t.y)),l.splice(f,1))}if(l.length==0)s?i.slots.value=l:e.layers[t.y].views.splice(t.x,1);else{if(u){let f=l[l.length-1];f.active=!0,f.route&&(f.route.active=f.active)}i.slots.value=l}e.layers[t.y].views.length==0&&(n=!0);let a=t.y+1;for(;a<e.layers.length;a++){let f=e.layers[a].views,c=[];for(let h=f.length-1;(n||o.length>0)&&h>=0;h--){let y=f[h];if(y[ce]&&(n||B.include(o,y[ce]))){let d=y.slots.value;for(let v=d.length-1;v>=0;v--){let w=d[v];w.route&&y[G]&&this[qe](w.route),c.push(new B(y,w.index,a)),d.splice(v,1)}e.layers[a].views.splice(h,1)}}o=c,e.layers[a].views.length==0&&(n=!0)}}restore(e){if(!e||this[H].length==0){let t=this[W];if(t.layers.length>0){let r=t.layers[0].views;r.length>0&&(r[0].slots.value=[])}return this[g]=[],this[ue](null),Promise.resolve()}else return new Promise((t,r)=>{let s=null,i=!1;for(let n=0;n<e.length;n++){const o=e[n];this[ve].post(u=>{const l=this[Kt](o);this[$t](l),this[Mt](l),this[Lt](l),l.wait((a,f)=>{s=a.session.to,i=a.session.redirect,u.resolve()},(a,f)=>{s=null,f!==null&&this[$](f),u.resolve()})})}this[ve].post(n=>{if(s&&i===!0){const o=new ur(S.clone(s,!0),this[et]());this[P]?.replace(o)}n.resolve(),t()})})}async[dr](e,t,r){const s=e.updateType??wt.Part;await this[mr](t);const i=this[vr](t,e,r,s);if(i.status==="error")throw Error(i.message);return i}[mr](e){let t=[];for(let r=0;r<e.layers.length;r++){let s=e.layers[r];for(let i=0;i<s.models.length;i++){let n=s.models[i];n.isResolved||t.push(n.resolve())}}return t.length>0?Promise.all(t):Promise.resolve()}[vr](e,t,r,s){if(e.layers[0].models.length!==1)return{status:"error",message:"illegal route structure(multi root node)"};const i=e.layers[0].models[0];let n=this[W],o=Xs(n),u=t.root??"default",l;!o&&s==wt.Part&&(l=this[Et](n,t));let a,f=0;if(l==null||l==null)if(o||s===wt.All)n.layers.length==0&&(n.layers[0]=new Rt),n.layers[0].views.length==0?(a=new Ce(t.root??"default",!0,null),n.layers[0].views=[a]):a=n.layers[0].views[0],l={x:0,y:0};else{let c=t.slot;if(!c)return{status:"error",message:"can not rebuild view(because not route slot)"};let h=c.level;if(h>n.layers.length)return{status:"error",message:"can not insert view(override level)"};let y;if(c.rootName){let d=n.layers[h-1];for(let v of d.views){if(v[G]&&v.name===c.rootName){y=new B(v,c.rootIndex??0,h-1);break}if(v[z]&&v[z].view.name===c.rootName&&v[z].index===c.rootIndex){y=v[z];break}}}if(!y)return{status:"error",message:"can not insert view(not find root node ref)"};a=new Ce(u,!0,y),n.layers[h].views.push(a),l={x:n.layers[h].views.length-1,y:h}}else a=n.layers[l.y].views[l.x];if(f=l.y,a[G]=!0,t.opsType===_.Append){t.index=t.index??Ie.get(),t.active=!0;let c=a.slots.value;if(c.length>0){let w=c[c.length-1];w.active=!1,w.route&&(w.route.active=w.active)}let h=new te(t,i,t.index,!0);a.slots.value=[...c,h];let y=f+1,d=1,v=new B(a,t.index,f);this[re](n,y,e,d,v)}else if(t.opsType===_.Open){let c=a.slots.value;const h=t.active??!0;let y=!1;for(let d of c){if(d.route!==null&&S.isSamePathForRoute(d.route,t)){if(d.active===h)return t.index=d.index,t.active=h,d.route=t,{status:"noChange",message:""};d.active=h,y=!0,t.index=d.index,t.active=h,d.route=t}else h&&(d.active=!1);d.route&&(d.route.active=d.active)}if(!y){t.index=t.index??Ie.get(),t.active=h;let d=new te(t,i,t.index,h);c.push(d);let v=f+1,w=1,b=new B(a,t.index,f);this[re](n,v,e,w,b)}a.slots.value=[...c]}else{let c=a.slots.value;if(c.length==0){t.index=t.index??Ie.get(),t.active=!0,a.slots.value=[new te(t,i,t.index)];let h=f+1,y=1,d=new B(a,t.index,f);this[re](n,h,e,y,d)}else{let h=c[0];if(h.model!==i){this[ae](n,l,null,!0),t.index=t.index??Ie.get(),t.active=!0,a.slots.value=[new te(t,i,t.index)];let y=f+1,d=1,v=new B(a,t.index,f);this[re](n,y,e,d,v)}else{h.route!==null&&this[qe](h.route);let y=!1;const d=t.active??!0;h.active!==d&&(h.active=d,y=!0),t.active=d,t.index=h.index,h.route=t;let v=[];for(let M=1;M<c.length;M++)v.push(c[M].index);v.length>0?this[ae](n,l,v,!0):y&&(a.slots.value=[...c]);let w=[new B(a,t.index,f)],b=f+1,p=1,L=new B(a,t.index,f);for(;w.length>0&&b<n.layers.length&&p<e.layers.length;b++,p++){let M=[];for(let T=0;T<n.layers[b].views.length;T++){let K=n.layers[b].views[T];K[ce]&&B.include(w,K[ce])&&M.unshift(T)}let Ee=[];for(let T of M){let K=n.layers[b].views[T],ne=e.layers[p].models,ee;for(let k=0;k<ne.length;k++)if(K.name===ne[k].name){ee=ne[k];break}if(!ee)this[ae](n,{x:T,y:b},null,!1);else{let k=K.slots.value;if(k.length==0){let Q=0;K.slots.value=[new te(null,ee,Q)];let U=b+1,V=p+1;this[re](n,U,e,V,L)}else{let Q=k[0];if(Q.model!==ee){this[ae](n,{x:T,y:b},null,!0),K.slots.value=[new te(null,ee,0)];let U=b+1,V=p+1;this[re](n,U,e,V,L)}else{K[G]&&Q.route!==null&&this[qe](Q.route);let U=[];for(let V=1;V<k.length;V++)U.push(k[V].index);U.length>0&&this[ae](n,{x:T,y:b},U,!0),Ee.push(new B(K,Q.index,b))}}K[G]=!1}}w=Ee}this[re](n,b,e,p,L)}}}if(a&&a[z]){let c=a[z];c&&(t.slot=new Hs(u,f,c?.view.name,c?.index??0))}return r.to=void 0,r.routeModel=void 0,this[pr](t,r),{status:"success",message:""}}[re](e,t,r,s,i){let n=s,o=t;for(;o<e.layers.length&&n<r.layers.length;o++,n++){let u=e.layers[o].views;for(let l of r.layers[n].models){let a=new Ce(l.name,!1,i),f=new te(null,l);a.slots.value=[f],u.push(a)}}for(;n<r.layers.length;n++){let u=new Rt;u.views=[];for(let l of r.layers[n].models){let a=new Ce(l.name,!1,i),f=new te(null,l);a.slots.value=[f],u.views.push(a)}e.layers.push(u)}}[kr](e,t,r,s,i,n){if(t<0||t>this[W].layers.length)return null;if(t<this[W].layers.length){let a=this[W].layers[t],f=null;for(let c of a.views){let h=!1;if(r!==null?(h=c.name===e&&c[z]?.view===r,h&&s!==-1&&(h=c[z]?.index===s)):h=c.name===e,!!h){i!==null&&(c[ce]={view:i,index:n,level:t-1}),f=c;break}}if(f!==null)return f}let o=null,u=null;i!==null&&(i[G]?o={view:i,index:n,level:t-1}:o=i[z],u={view:i,index:n,level:t-1});let l=new Ce(e,!0,o);if(l[ce]=u,t==this[W].layers.length){let a=new Rt;a.views=[l],this[W].layers.push(a)}else this[W].layers[t].views.push(l);return l}},dt=Symbol("rk"),Tt=Symbol("vd"),wr=Symbol("rv"),kt=Symbol("rvi"),Rr=Symbol("pv"),It=Symbol("pvi"),ke=Symbol("registerKey"),Nr=Symbol("lc"),Qs=class{[ke]=new Map;constructor(){}set(e,t){this[ke].set(e,t)}get(e){return this[ke].get(e)}has(e){return this[ke].has(e)}delete(e){return this[ke].delete(e)}},ie=new WeakMap,Be=[];function it(e,t=!1){let r=e?ie.get(e)??null:null;return t&&!r&&(r=new Qs,e&&ie.set(e,r),(0,m.onScopeDispose)(()=>{e&&ie.delete(e)}),(0,m.provide)(Nr,r)),r}function Ne(e){let t=e?ie.get(e)??null:null;return!t&&(0,m.hasInjectionContext)()&&(t=(0,m.inject)(Nr,null)),!t&&Be.length>0&&(t=Be[Be.length-1]),t}async function Ur(e,t){Be.push(e);try{return await t()}finally{Be.pop()}}function Zs(e){const t=(0,m.getCurrentScope)();if(!t)return!1;const r=Ne();if(!r)return!1;if(ie.set(t,r),Array.isArray(e))for(let s=0;s<e.length;s++)ie.set(e[s],r);return(0,m.onScopeDispose)(()=>{if(ie.delete(t),Array.isArray(e))for(let s=0;s<e.length;s++)ie.delete(e[s])}),!0}function er(e,t){return Ne(e)?.get(t)??null}function Ys(e,t,r,s){Ne(e)?.set(t,r)}function ei(e,t,r){Ne(e)?.delete(t)}var at=Symbol("hooksKey");function ti(e){let t=e.get(at);t||(t=[],e.set(at,t))}function xr(e,t){const r=e.get(at);r!=null&&Ur(e,async()=>{for(let s=r.length-1;s>=0;s--){let i=r[s];if(i.type===t)try{await Reflect.apply(i.hook,null,[])}catch(n){console.error(n.message,n)}}})}var ut=(function(e){return e.INACTIVATED="ia",e.ACTIVATED="a",e})({}),ri=class{type;hook;constructor(e,t){this.hook=t,this.type=e}};function si(e,t,r){const s=new ri(t,r);return e.push(s),!0}function ii(e,t,r){let s=-1;for(let i=0;i<e.length;i++){const n=e[i];if(n.type===t&&n.hook===r){s=i;break}}return s!=-1?(e.splice(s,1),!0):!1}function Vr(e){return t=>{const r=er(null,at);if(r==null){console.warn("[Fox]hooks context not found");return}(0,m.onScopeDispose)(()=>{ii(r,e,t)}),si(r,e,t)}}var ni=function(e){(0,m.onActivated)(e),Vr(ut.ACTIVATED)(e)},oi=function(e){(0,m.onDeactivated)(e),Vr(ut.INACTIVATED)(e)},Wr=Symbol("routeKey");function Sr(e,t){e.set(Wr,t)}function Jr(e){const t=er(e??null,Wr);return typeof t=="function"?t():t}var zr="FoxBeforeEnter",Gr="FoxEnter",Xr="FoxLeave",Qr="FoxLeave",ft="FoxLeaveEnd";function Zr(e,t=!1){let r=null;return t?r=e.showFromClass??e.enterFromClass:r=e.enterFromClass,r||(r=e.transitionName,r?t?`${r}-show-from`:`${r}-enter-from`:null)}function Yr(e,t=!1){let r=null;return t?r=e.showActiveClass??e.enterActiveClass:r=e.enterActiveClass,r||(r=e.transitionName,r?t?`${r}-show-active`:`${r}-enter-active`:null)}function li(e,t=!1){let r=null;return t?r=e.showToClass??e.enterToClass:r=e.enterToClass,r||(r=e.transitionName,r?t?`${r}-show-to`:`${r}-enter-to`:null)}function es(e,t=!1){let r=null;return t?r=e.hideFromClass??e.leaveFromClass:r=e.leaveFromClass,r||(r=e.transitionName,r?t?`${r}-hide-from`:`${r}-leave-from`:null)}function ts(e,t=!1){let r=null;return t?r=e.hideActiveClass??e.leaveActiveClass:r=e.leaveActiveClass,r||(r=e.transitionName,r?t?`${r}-hide-active`:`${r}-leave-active`:null)}function ai(e,t=!1){let r=null;return t?r=e.hideToClass??e.leaveToClass:r=e.leaveToClass,r||(r=e.transitionName,r?t?`${r}-hide-to`:`${r}-leave-to`:null)}function ui(e,t=!1){let r=null;return t?r=e.beforeShow??e.beforeEnter:r=e.beforeEnter,r}function fi(e,t=!1){let r=null;return t?r=e.show??e.enter:r=e.enter,r}function ci(e,t=!1){let r=null;return t?r=e.afterShow??e.afterEnter:r=e.afterEnter,r}function hi(e,t=!1){let r=null;return t?r=e.showCancelled??e.enterCancelled:r=e.enterCancelled,r}function yi(e,t=!1){let r=null;return t?r=e.beforeHide??e.beforeLeave:r=e.beforeLeave,r}function di(e,t=!1){let r=null;return t?r=e.hide??e.leave:r=e.leave,r}function mi(e,t=!1){let r=null;return t?r=e.afterHide??e.afterLeave:r=e.afterLeave,r}function vi(e,t=!1){let r=null;return t?r=e.hideCancelled??e.leaveCancelled:r=e.leaveCancelled,r}function tr(e){let t,r=e.transitionDuration;return typeof r=="object"?t={enter:r.enter??-1,leave:r.leave??-1,show:r.show??-1,hide:r.hide??-1}:(typeof r=="string"&&(r=r.length==0?-1:Number(r)),t={enter:r,leave:r,show:r,hide:r}),t}function Se(e,t){e.classList.contains(t)||e.classList.add(t)}function Re(e,t){e.classList.remove(t)}var pi=xe&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout;function mt(e){pi(e)}function j(e,t){R(e)&&Reflect.apply(e,null,t)}function rs(e,t,r=-1,s,i,n){let o=[];const u=()=>{for(let l of o)Gt(e,l.type,l.listener);o=[]};if(R(i)){if(s!==void 0&&s>=0){setTimeout(()=>{Reflect.apply(i,null,[e,t,r])},s);return}const l=["animationend","transitionend",ft],a=f=>{(f.target||f.srcElement)===f.currentTarget&&(u(),Reflect.apply(i,null,[e,t,r]))};l.forEach(f=>{lt(e,f,a),o.push({type:f,listener:a})})}if(R(n)){const l="animationcancel",a=f=>{(f.target||f.srcElement)===f.currentTarget&&(u(),Reflect.apply(n,null,[e,t,r]))};lt(e,l,a),o.push({type:l,listener:a})}}function vt(e){return!xe||e===null?!1:e.opsType===_.Append||e.opsType===_.Open}function ss(e,t,r={},s,i=-1){if(e||vt(s)){const n=Zr(r,e);n&&Se(t,n);const o=Yr(r,e);o&&Se(t,o),j(ui(r,e),[t,e,s,i])}}function is(e,t,r={},s,i,n,o){if(!vt(i)&&!e){R(o)&&o(o,[t]);return}const u=Zr(r,e),l=Yr(r,e),a=li(r,e),f=fi(r,e),c=ci(r,e),h=hi(r,e);if(!u&&!l&&!a&&!f){R(o)&&o(o,[t]);return}mt(()=>{rs(t,i,n,s,()=>{l&&Re(t,l),a&&Re(t,a),R(c)&&j(c,[t,e,i,n]),R(o)&&o(o,[t])},()=>{R(h)&&j(h,[t,e,i,n])}),u&&Re(t,u),a&&Se(t,a),R(f)&&j(f,[t,e,i,n])})}function ns(e,t,r={},s,i=-1){if(e||vt(s)){const n=es(r,e);n&&Se(t,n);const o=ts(r,e);o&&Se(t,o),j(yi(r,e),[t,e,s,i])}}function os(e,t,r={},s,i,n,o,u){if(!vt(n)&&!e){R(u)&&j(u,[t]),!e&&R(i)&&i();return}const l=es(r,e),a=ts(r,e),f=ai(r,e),c=di(r,e),h=mi(r,e),y=vi(r,e);if(!l&&!a&&!f&&!c){R(u)&&j(u,[t]),!e&&R(i)&&i();return}mt(()=>{rs(t,n,o,s,()=>{try{a&&Re(t,a),f&&Re(t,f),R(h)&&j(h,[t,e,n,o]),R(u)&&j(u,[t])}finally{!e&&R(i)&&i()}},()=>{try{R(y)&&j(y,[t,e,n,o]),R(u)&&j(u,[t])}finally{!e&&R(i)&&i()}}),l&&Re(t,l),f&&Se(t,f),R(c)&&j(c,[t,e,n,o])})}function Jt(e,t={},r,s=-1){const i=t.mode??"default",n=tr(t);return{mode:i,persisted:!1,beforeEnter:o=>{ss(!1,o,t,r,s)},enter:o=>{is(!1,o,t,n.enter,r,s)},leave:(o,u)=>{ns(!1,o,t,r,s),os(!1,o,t,n.leave,u,r,s,()=>{e.transition=null})},clone:o=>Jt(e,t,r,s)}}function ls(e){return e.el}function gi(e,t={},r,s,i,n){if(i===!0){const o=ls(e);if(o==null)return;const u=tr(t);ss(!0,o,t,r,s),is(!0,o,t,u.show,r,s,l=>{R(n)&&j(n,[l])})}else R(n)&&j(n,[])}function bi(e,t={},r,s,i,n){if(i===!0){const o=ls(e);if(o==null)return;const u=tr(t);ns(!0,o,t,r,s),os(!0,o,t,u.hide,null,r,s,l=>{R(n)&&j(n,[l])})}else R(n)&&j(n,[])}function wi(e){mt(()=>{for(let t=0;t<e.length;t++)Reflect.apply(e[t],null,[])})}function as(e,t={},r,s=-1){return{mode:t.mode??"default",persisted:!1,beforeEnter:i=>{Ve(zr,{},i)},enter:i=>{Ve(Gr,{},i)},leave:(i,n)=>{Ve(Xr,{},i),mt(()=>{const o=u=>{(u.target||u.srcElement)===u.currentTarget&&(Gt(i,ft,o),n&&Reflect.apply(n,null,[]),e.transition=null)};lt(i,ft,o),Ve(Qr,{},i)})},clone:i=>as(e,t,r,s)}}function se(e,t,r){return typeof e=="function"?Reflect.apply(e,{},[t,r]):e}function Ot(e,t){if(!e)return null;const r=e(t);return r.length===1?r[0]:r}function pe(e,t){return typeof t=="function"?t(e):e}var Ri=class{node;state;constructor(e,t){this.node=e,this.state=t}},ct=(0,m.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},transitionDuration:{type:[String,Number,Object],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(e,t){const r=(0,m.getCurrentScope)(),s=e.multi===!0,i=(0,m.inject)(dt,null),n=(0,m.inject)(Tt,0),o=(0,m.inject)(wr,null),u=(0,m.inject)(kt,-1);let l=null,a=e.modelSlot??null;if(a){if((0,m.provide)(Tt,n+1),(0,m.provide)(kt,a.index),(0,m.provide)(It,a.index),!a.route){console.warn("[Fox]child view render error, route not exist");return}const c=it(a,!0);c&&(ti(c),Sr(c,()=>a?.route??null))}else{if(i==null){console.error("[Fox]router is not been injected");return}const c=e.name,h=(0,m.inject)(Rr,null),y=(0,m.inject)(It,0);if(l=i[kr](c,n,o,u,h,y),l===null)return;(0,m.provide)(Rr,l);const d=l[G]===!0;if(d&&(0,m.provide)(wr,l),!s&&((0,m.provide)(kt,-1),(0,m.provide)(Tt,n+1),(0,m.provide)(It,-1),d&&r)){const v=it(r,!0);v&&Sr(v,()=>{const w=l?.slots.value??[];return w.length>0?w[0].route:null})}}const f={value:new Map};return(0,m.onScopeDispose)(()=>{if(f.value&&f.value.clear(),a){const c=a;c.route=null,c.model=null,c.instance=null,a=null}}),()=>{if(s){const c=new Map,h=[],y=l?.slots.value,d=[];for(let b=0;b<y.length;b++){const p=y[b],L=`${e.name}_${p.index}`,M=se(e.transition,p.route,b)??!0,Ee={modelSlot:p};let T;t.slots.default?T=(0,m.h)(ct,Ee,{default:t.slots.default}):T=(0,m.h)(ct,Ee);const K={},ne=se(e.viewClass,p.route,b);typeof ne=="string"&&ne.length>0&&(K[ne]=!0);const ee=se(e.viewActiveClass,p.route,b),k=se(e.viewInactiveClass,p.route,b),Q=f.value.get(L);if(typeof ee=="string"&&ee.length>0&&(K[ee]=p.active),typeof k=="string"&&k.length>0&&(K[k]=!p.active),Q&&p.active!==Q.state){const sr=Q.node;p.active?d.unshift(()=>{const pt=()=>{const Fe=it(p);Fe!=null&&xr(Fe,ut.ACTIVATED)};gi(sr,e,p.route,b,M,pt)}):d.push(()=>{const pt=()=>{const Fe=it(p);Fe!=null&&xr(Fe,ut.INACTIVATED)};bi(sr,e,p.route,b,M,pt)})}const U={class:K,key:L},V=se(e.viewTagProps,p.route,b);V!==null&&typeof V=="object"&&q(!0,U,pe(V,i?.propsFilter)),p.route?.viewTagAttrs&&typeof p.route?.viewTagAttrs=="object"&&q(!0,U,pe(p.route.viewTagAttrs,i?.propsFilter));const de=(0,m.h)(se(e.viewTag,p.route,b),U,{default:()=>[T]});c.set(L,new Ri(de,p.active)),f.value.delete(L),M===!0?de.transition=Jt(de,e,p.route,b):M==="custom"&&(de.transition=as(de,e,p.route,b)),h.push(de)}f.value=c,wi(d);const v=se(e.tag,null,-1),w={};return Object.assign(w,t.attrs),(0,m.h)(v,w,{default:()=>h})}else if(a!=null){const c=a.model,h={};c.props&&(typeof c.props=="object"?q(!1,h,pe(c.props,i?.propsFilter)):c.props===!0&&typeof a.route?.params=="object"&&q(!1,h,pe(a.route.params,i?.propsFilter)));const y=(0,m.h)(c.component,h);return Ot(t.slots.default,{Component:y,route:a.route})??y}else{const c=l?.slots.value??[];if(c.length>0){const h=c[0],y=h.route,d=h.model,v={};d.props&&(typeof d.props=="object"?q(!1,v,pe(d.props,i?.propsFilter)):d.props===!0&&typeof y?.params=="object"&&q(!1,v,pe(y.params,i?.propsFilter)));const w=(0,m.h)(d.component,v);return(se(e.transition,y,-1)??!0)&&(w.transition=Jt(w,e,y,-1)),Ot(t.slots.default,{Component:w,route:y})??w}else return Ot(t.slots.fallback,{})}}}});function xi(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!=null&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){const t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function Si(e,t){return e==null||t==null?!1:!!(e.path&&t.path&&t.path.startsWith(e.path)||e.name&&e.name==t.name)}function ge(e,t){return typeof e=="function"?Reflect.apply(e,{},[t]):e}var us=(0,m.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(e,t){const r=(0,m.inject)(dt,null);return()=>{let s=ge(e.to,null),i=ge(e.tag,s);if(i==null){console.warn("[Fox]can not resolve link tag");return}let n=null,o=null;r!==null&&(n=r[O](s),e.root&&(n.root=e.root),o=r.currentRoute.value);let u={},l=ge(e.activeClass,n);if(typeof l=="string"&&l.length>0&&(u[l]=Si(n,o)),ge(e.exact,n)===!0){let c=ge(e.exactActiveClass,n);typeof c=="string"&&c.length>0&&(u[c]=S.isSamePathForRoute(n,o))}let a={class:u};(i==="a"||i==="A")&&(a.href=n?.path??n?.name??"#"),q(!0,a,t.attrs);const f=ge(e.event,n);if(typeof f=="string"){const c=h=>{if(r==null){console.warn("[Fox]router is not been injected");return}if(n==null){console.warn("[Fox]route is not been resolved");return}xi(h)&&r.to(n)};a[f]=c}return(0,m.h)(i,a,t.slots)}}}),ot=(function(e){return e[e.limitless=0]="limitless",e[e.once=1]="once",e})(ot||{}),be=Symbol("registerKey"),Pi=class{policy;callback;constructor(e,t){this.callback=e,this.policy=t}},zt=class{[be]=new Map;constructor(){}on(e,t,r=!1){let s=this[be].get(e);s||(s=new Array,this[be].set(e,s));let i=new Pi(t,r===!0?ot.once:ot.limitless);return s.push(i),this}off(e,t){if(!t)return this[be].delete(e),this;let r=this[be].get(e);if(r){for(let s=0;s<r.length;s++)if(r[s].callback===t){r.splice(s,1);break}}return this}bind(e,t,r=!1){return this.on(e,t,r)}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 r=e[t-1];if(typeof r!="function")return console.error("[Fox]callback can not be empty"),this;let s=t-1,i=new Array(s),n=[].splice.call(e,0,s);for(let o=0;o<n.length;o++)this.once(n[o],u=>{i[o]=u,s-=1,s==0&&Reflect.apply(r,{},i)});return this}emit(e,...t){let r=this[be].get(e);if(!r)return this;for(let s=0;s<r.length;){let i=r[s];if(i.policy==ot.once?r.splice(s,1):s++,typeof i.callback=="function")try{Oe(()=>{Reflect.apply(i.callback,{},t)})}catch(n){console.error(n.message,n)}}return this}trigger(e,...t){return Reflect.apply(this.emit,this,[e,...t])}},Ei="FoxRouterView",Fi="FoxRouterLink",N=(function(e){return e[e.Loading=0]="Loading",e[e.Loaded=1]="Loaded",e[e.Defining=2]="Defining",e[e.Defined=3]="Defined",e})({});function Ci(e){return e==N.Loaded||e===N.Defined}var Pr=(function(e){return e[e.normal=0]="normal",e[e.factory=1]="factory",e})({}),_i=class{register=new Map;regExpRegisters=[];constructor(){}get(e){let t=this.register.get(e)??null;return t||(t=this.regExpRegisters.find(r=>r.pattern?.test(e))?.module??null),t}has(e){return!!this.get(e)}set(e,t){if(typeof e=="string")this.register.set(e,t);else if(e instanceof RegExp){const r=this.regExpRegisters.find(s=>(s.pattern?.source??"")===(e?.source??""));r?r.module=t:this.regExpRegisters.push({pattern:e,module:t})}}remove(e){if(typeof e=="string"){const t=this.register.get(e);return this.register.delete(e),t??null}else if(e instanceof RegExp){const t=this.regExpRegisters.findIndex(r=>(r.pattern?.source??"")===(e?.source??""));if(t!==-1){const r=this.regExpRegisters[t].module??null;return this.regExpRegisters.splice(t,1),r}}return null}clear(){this.register.clear(),this.regExpRegisters=[]}},Bt=["require","exports","module"];async function Ai(e){return await new Function("url","return import(url)")(e)}var Er=class{moduleManager=new _i;_alias={};set alias(e){this._alias=e}get alias(){return this._alias}_resourceParser;set resourceParser(e){this._resourceParser=e}get resourceParser(){return this._resourceParser}_timeout;set timeout(e){this._timeout=e}get timeout(){return this._timeout}_query;set query(e){this._query=e}get query(){return this._query}get head(){return Ue().head}_cssMountPoint=null;set cssMountPoint(e){this._cssMountPoint=e}get cssMountPoint(){return this._cssMountPoint}_jsMountPoint=null;set jsMountPoint(e){this._jsMountPoint=e}get jsMountPoint(){return this._jsMountPoint}setModule(e,t){const r={id:typeof e=="string"?e:e?.source,src:"",status:N.Loaded};typeof t=="function"?(r.exports=t,r.type=Pr.factory):r.exports=t,this.moduleManager.set(e,r)}removeModule(e){this.moduleManager.remove(e)}getModuleExports(e){const t=this.moduleManager.get(e);return t&&Ci(t.status)?t.type===Pr.factory&&typeof t.exports=="function"?t.exports():t.exports:null}exposeRequire(e="__foxRequire",t,r){const s=t??A();return s&&typeof s=="object"?(s[e]=i=>{const n=this.getModuleExports(i);return r&&!n&&console.error(`[Fox] module:${i}, not found!`),n},!0):!1}resloveResource(e){if(typeof e=="string"){if(Bt.includes(e))return e;if(e=this.alias?.[e]??e,typeof this.resourceParser=="function"){const r=this.resloveResource(e);if(!r)return r}const t=this.getResourcePathSuffix(e);if(t==="mjs")return{path:e,type:"js",format:"es"};if(t==="js")return{path:e,type:"js",format:"umd"};if(t==="css")return{path:e,type:"css"}}return e}ensure(...e){return new Promise((t,r)=>{if(e.length<=0){r("args is empty");return}const s=[];let i=e.length-1,n=null;typeof e[i]=="function"&&(n=e[i],i--);for(let l=0;l<=i;l++)if(Array.isArray(e[l])){const a=e[l];for(let f=0;f<a.length;f++){const c=this.resloveResource(a[f]);s.push(c)}}else if(typeof e[l]=="string"){const a=this.resloveResource(e[l]);s.push(a)}const o=new ji(s.length,(l,a)=>{if(o.isOK())try{typeof n=="function"&&Reflect.apply(n,{},a),t(a)}catch(f){console.error(f),r(f)}else try{console.error(l),typeof n=="function"&&Reflect.apply(n,{},[]),r(l)}catch(f){console.error(f),r(f)}}),u=new He;for(let l=0;l<s.length;l++){const a=new qi(l,s[l],o);this.mount(u,a)}return this})}remove(...e){return new Promise((t,r)=>{if(e.length<=0){r("args is empty");return}const s=[];let i=e.length-1,n=null;typeof e[i]=="function"&&(n=e[i],i--);for(let o=0;o<=i;o++)if(Array.isArray(e[o])){const u=e[o];for(let l=0;l<u.length;l++){const a=this.resloveResource(u[l]);s.push(a)}}else if(typeof e[o]=="string"){const u=this.resloveResource(e[o]);s.push(u)}for(let o=0;o<s.length;o++)try{this.unmount(s[o])}catch(u){console.error(u)}typeof n=="function"&&Reflect.apply(n,{},[!0]),t(!0)})}mount(e,t){if(!t.resource){e.post(s=>{t.progress.work(!1,t.index,null),s.resolve()});return}if(typeof t.resource=="string"){if(Bt.includes(t.resource)){e.post(i=>{t.progress.work(!0,t.index,t.resource),i.resolve()});return}const s=this.getModuleExports(t.resource);if(s){e.post(i=>{t.progress.work(!0,t.index,s),i.resolve()});return}}const r=t.resource;if(r.type==="js")if(r.format==="es")this.mountCJS(e,t);else{const s=this.jsMountPoint??this.head;this.mountJS(e,t,s)}else{const s=this.cssMountPoint??this.head;this.mountCSS(e,t,s)}}mountCSS(e,t,r){e.post(s=>{const i=t.resource,n=this.getModuleExports(i.path);if(n){t.progress.work(!0,t.index,n),s.resolve();return}const o=Ue(),u=o.createElement("link"),l="onload"in u;l&&(u.onload=()=>{u.onload=null,u.onerror=null,t.progress.work(!0,t.index,i.path),s.resolve()},u.onerror=()=>{try{r.removeChild(u)}catch(c){console.error(c)}u.onload=null,u.onerror=null,t.progress.work(!1,t.index,null),s.reject()});const a=this.constructResourceUri(i.path),f=o.getElementById(i.path);f&&f.parentNode&&f.parentNode.removeChild(f),u.rel="stylesheet",u.type="text/css",u.id=i.path,u.href=a,r.appendChild(u),l||(t.progress.work(!0,t.index,i.path),s.resolve())})}mountJS(e,t,r){e.post(s=>{const i=t.resource,n=this.getModuleExports(i.path);if(n){t.progress.work(!0,t.index,n),s.resolve();return}const o={id:i.path,src:i.path,status:N.Loading};this.moduleManager.set(i.path,o);const u=Ue().createElement("script");if("onload"in u)u.onload=()=>{u.onload=null,u.onerror=null,o.status===N.Loading&&(o.status=N.Loaded,t.progress.work(!0,t.index,i.path)),s.resolve()},u.onerror=()=>{try{r.removeChild(u)}catch(h){console.error(h)}u.onload=null,u.onerror=null,this.moduleManager.remove(i.path),t.progress.work(!1,t.index,null),s.resolve()};else{const h=u;h.onreadystatechange=()=>{/loaded|complete/.test(h.readyState)&&(h.onreadystatechange=null,o.status==N.Loading&&(o.status=N.Loaded,t.progress.work(!0,t.index,i.path)),s.resolve())}}const l=this.constructResourceUri(i.path);u.defer=!0,u.src=l;const a=A(),f=this.createRequireLoad();a.__require=a.__require??a.require,a.require=f;const c=this.createDefine(o,f,t);a.__define=a.__define??a.define,a.define=c,typeof t.progress.finalCallback!="function"&&(t.progress.finalCallback=function(){a.require=a.__require,a.__require=void 0,a.define=a.__define,a.__define=void 0}),r.appendChild(u)})}mountCJS(e,t){e.post(async r=>{const s=t.resource,i=this.getModuleExports(s.path);if(i){t.progress.work(!0,t.index,i),r.resolve();return}try{let n=await Ai(s.path);if(yt(n)&&(n=n.default??n),Pe(n)){t.progress.work(!1,t.index,n),r.resolve();return}const o={id:s.path,src:s.path,status:N.Loaded,exports:n};this.moduleManager.set(s.path,o),t.progress.work(!0,t.index,n),r.resolve()}catch(n){console.error(n),t.progress.work(!1,t.index,null),r.resolve()}})}unmount(e){let t="",r="";typeof e=="string"?(this.moduleManager.remove(e),r=this.getResourcePathSuffix(e),t=e):(this.moduleManager.remove(e.path),r=e.type==="css"?"css":e.format??"",t=e.path);const s=Ue();if(r==="umd"){let i=s.getElementById(t);i||(i=s.querySelector(`script[src="${t}"]`)),i&&i.remove()}else if(r==="css"){let i=s.getElementById(t);if(!i){const n=this.constructResourceUri(t);i=s.querySelector(`link[href="${n}"]`)}i&&i.remove()}}trimEmptyElement(e){const t=[];for(let r=0;r<e.length;r++){let s=e[r];s!=null&&(s=s.trim(),s.length!==0&&t.push(s))}return t}createDefine(e,t,r){const s=this,i=function(...n){e.status=N.Defining;let o,u,l,a=n.length;if(a===1?(l=n[0],o=void 0):a===2?(l=n[1],Array.isArray(n[0])?(u=s.trimEmptyElement(n[0]),o=void 0):u=void 0):(o=n[0],u=s.trimEmptyElement(n[1]),l=n[2]),o&&(e.id=o,typeof s._alias=="object"&&(s._alias[o]=e.src)),u&&u.length>0)s.ensure(u,(...f)=>{try{const c=f.map(h=>h==="exports"?((!e.exports||typeof e.exports!="object")&&(e.exports={}),e.exports):h==="module"?e:h==="require"?t:h);if(typeof l=="function"){const h=Reflect.apply(l,e,c);h&&typeof h=="object"&&(e.exports=h)}else e.exports=l;e.status=N.Defined,r.progress.work(!0,r.index,e.exports)}catch(c){console.error(c),r.progress.work(!1,r.index,[])}});else{if(typeof l=="function"){const f=Reflect.apply(l,e,[]);f&&typeof f=="object"&&(e.exports=e.exports??{},Object.assign(e.exports,f))}else e.exports=l;e.status=N.Defined,r.progress.work(!0,r.index,e.exports)}};return i.amd=!0,i}createRequireLoad(){return e=>(e=this._alias?.[e]??e,this.getModuleExports(e))}constructResourceUri(e){try{if(Bt.includes(e)||!this.query)return e;const t=this.createSearch(this.query);return e.indexOf("?")==-1?e+=`?${t}`:t.length>0&&(e+=`&${t}`),e}catch(t){throw console.error(`[Fox]resolve path[${e}] fail`,t),t}}createSearch(e){let t="";if(e&&typeof e=="object"){for(let r in e){let s=`${e[r]}`;t+=`${encodeURIComponent(r)}=${encodeURIComponent(s)}&`}t.length>0&&(t=t.substring(0,t.length-1))}return t}getResourcePathSuffix(e){let t=e.lastIndexOf("?");t==-1&&(t=e.length);let r=e.lastIndexOf(".",t);return r==-1?"":e.substring(r+1,t)}},ji=class{finalCallback;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,r){if(this.status=e,this.status===!0&&(this.lastIndex!==t&&this.size--,this.lastIndex=t,this.values[t]=r),this.size===0||this.status===!1)try{Reflect.apply(this.callback,this,[this.status,this.values])}catch(s){console.error(s.message,s)}finally{typeof this.finalCallback=="function"&&(Reflect.apply(this.finalCallback,null,[]),this.finalCallback=null)}}isOK(){return this.status}},qi=class{index;resource;progress;constructor(e,t,r){this.index=e,this.resource=t,this.progress=r}},fs=Symbol("fk"),cs=Symbol("fbk"),hs=Symbol("fepk");function Ki(e={}){const t=new Hr(e),r=new Vt,s=new zt,i=new Er,n={get router(){return t},get bus(){return r},get Bus(){return Vt},get EventProxy(){return zt},get eventproxy(){return s},get EventChain(){return He},get Require(){return Er},get require(){return i},get isESModule(){return yt},install(o,u={}){o.provide(dt,t),o.provide(fs,n),o.provide(cs,r),o.provide(hs,s),u.install!==!1&&(o.component(Ei,ct),o.component(Fi,us)),u.optionsApi!==!1&&(Reflect.defineProperty(o.config.globalProperties,"$fox",{get(){return n}}),Reflect.defineProperty(o.config.globalProperties,"$router",{get(){return t}}),Reflect.defineProperty(o.config.globalProperties,"$bus",{get(){return r}}),Reflect.defineProperty(o.config.globalProperties,"$bus",{get(){return r}}),Reflect.defineProperty(o.config.globalProperties,"$eventProxy",{get(){return s}}),o.config.globalProperties.$fox_on=function(l,a,f=!1){s.on(l,a,f)},o.config.globalProperties.$fox_off=function(l,a){s.off(l,a)},o.config.globalProperties.$fox_once=function(l,a){s.once(l,a)},o.config.globalProperties.$fox_all=function(...l){let a=s;Reflect.apply(a.all,a,l)},o.config.globalProperties.$fox_trigger=function(l,...a){let f=s;Reflect.apply(f.trigger,f,[l,...a])},o.config.globalProperties.$fox_emit=function(l,...a){let f=s;Reflect.apply(f.trigger,f,[l,...a])},o.mixin({setup(){return{$route:Jr()}}})),t.init()}};return n}function rr(){return(0,m.inject)(dt,null)}function $i(e){return Jr(e)}function Li(){return(0,m.inject)(fs,null)}function Mi(){return(0,m.inject)(cs,null)}function Ti(){return(0,m.inject)(hs,null)}function ki(e){const t=rr();if(!t){console.error("[Fox]router is not exist.");return}const r=(s,i,n)=>{try{Reflect.apply(e,{},[s,i])}catch(o){console.error(o)}n()};t?.beforeEach(r),(0,m.onScopeDispose)(()=>{t?.removeBeforeEach(r)})}function Ii(e){const t=rr();if(!t){console.error("[Fox]router is not exist.");return}const r=(s,i,n)=>{try{Reflect.apply(e,{},[s,i])}catch(o){console.error(o)}n()};t?.afterEach(r),(0,m.onScopeDispose)(()=>{t?.removeAfterEach(r)})}exports.Bus=Vt;exports.EventChain=He;exports.EventProxy=zt;exports.FoxBeforeEnter=zr;exports.FoxBeforeLeave=Xr;exports.FoxEnter=Gr;exports.FoxLeave=Qr;exports.FoxLeaveEnd=ft;exports.OperationType=_;exports.Route=S;exports.Router=Hr;exports.RouterLink=us;exports.RouterView=ct;exports.bindLifecycleContextToCurrentScope=Zs;exports.createFox=Ki;exports.createMemoryHistory=Dr;exports.createWebHashHistory=Br;exports.createWebHistory=Js;exports.deleteContextValue=ei;exports.extend=q;exports.injectContextValue=er;exports.injectLifecycleContext=Ne;exports.isArray=Dt;exports.isDate=ms;exports.isESModule=yt;exports.isEqual=Ut;exports.isFunction=R;exports.isMap=ys;exports.isNil=Pe;exports.isObject=Fr;exports.isPlainObject=Cr;exports.isPromise=gs;exports.isSet=ds;exports.isString=vs;exports.isSymbol=ps;exports.onAfterRouteUpdate=Ii;exports.onBeforeRouteUpdate=ki;exports.onFoxActivated=ni;exports.onFoxInactivated=oi;exports.provideContextValue=Ys;exports.rawState=$s;exports.reactiveState=js;exports.shallowReactiveState=qs;exports.toBoolean=Xt;exports.toNumber=xs;exports.toTypeString=ht;exports.typeOf=Nt;exports.useBus=Mi;exports.useEventProxy=Ti;exports.useFox=Li;exports.useRoute=$i;exports.useRouter=rr;exports.withLifecycleContext=Ur;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let m=require("vue");var xe=typeof window<"u",A=function(){return window},Ve=function(){return window.document};function at(e,t,r,s=!1){e.addEventListener?e.addEventListener(t,r,s):e.attachEvent?e.attachEvent(`on${t}`,r):e[`on${t}`]=r}function Yt(e,t,r){e.removeEventListener?e.removeEventListener(t,r):e.detachEvent?e.detachEvent(`on${t}`,r):e[`on${t}`]=null}var We=(e,t,r)=>{t=t??{bubbles:!1,cancelable:!1,detail:void 0};const s=document.createEvent("Events");let i=!0,n=!0;for(let o in t)o==="bubbles"?i=!!t[o]:o==="cancelable"?n=!!t[o]:s[o]=t[o];s.initEvent(e,i,n),(r??document).dispatchEvent(s)},Dt=Array.isArray,ys=e=>yt(e)==="[object Map]",ds=e=>yt(e)==="[object Set]",ms=e=>e instanceof Date,R=e=>typeof e=="function",ps=e=>typeof e=="string",vs=e=>typeof e=="symbol",jr=e=>e!==null&&typeof e=="object",gs=e=>jr(e)&&R(e.then)&&R(e.catch),Ee=e=>e==null,bs=Object.prototype.toString,yt=e=>bs.call(e),qr=e=>yt(e)==="[object Object]",ws=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol";function dt(e){return e.__esModule||ws&&e[Symbol.toStringTag]==="Module"}var Rs=typeof Promise<"u"&&Promise.toString().indexOf("[native code]")!==-1;function q(...e){let t=e[0]!==void 0&&e[0]!==null?e[0]:{},r=1,s=e.length,i=!1;for(typeof t=="boolean"&&(i=t,t=e[r]??{},r++),typeof t!="object"&&(t={});r<s;r++)if(e[r]!==null&&e[r]!==void 0){let n=e[r];for(let o in n){let u=t[o],l=n[o];if(u!==l)if(i===!0&&l&&typeof l=="object"){let a;Array.isArray(l)?a=u&&Array.isArray(u)?u:[]:a=u&&typeof u=="object"?u:{},t[o]=q(i,a,l)}else l!==void 0&&(t[o]=l)}}return t}function $r(e,t,r=!1){if(typeof t!="object")return{};typeof e!="object"&&(e={});for(let s of Reflect.ownKeys(t)){let i=e[s],n=t[s];if(i!==n)if(typeof n=="object"){if(!Array.isArray(n)&&!qr(n))continue;i=$r(i,n,r),e[s]=i}else{if(typeof n=="function")continue;e[s]=n}}return e}var Ie=class Ht{static seed=new Date().getTime();static get(){let t=++Ht.seed;return t>=Number.MAX_VALUE&&(Ht.seed=0),t}},gt=Rs?Promise.resolve():null;function Be(e,...t){gt!==null?t&&t.length>0?gt.then(()=>{e(t)}):gt.then(e):t&&t.length>0?setTimeout(()=>{e(t)}):setTimeout(e)}function er(e){return e==null?!1:typeof e=="boolean"?e:typeof e=="string"?e.toLocaleLowerCase()==="true":!!e}function xs(e){return typeof e=="number"?e:Number(e)}var Ss={"[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 Nt(e){let t=Object.prototype.toString.call(e);return e==null?String(e):Ss[t]||"object"}function Ut(e,t){if(e==t)return!0;if(e===void 0||t===void 0)return!1;let r=Nt(e);if(r!==Nt(t))return!1;if(r==="object"){let s=Object.keys(e),i=Object.keys(t);if(s.length!==i.length)return!1;for(let n=0;n<s.length;n++){let o=s[n],u=e[o],l=t[o];if(!Ut(u,l))return!1}return!0}else if(r==="array"){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s++){let i=e[s],n=t[s];if(!Ut(i,n))return!1}return!0}return!1}var Kr=e=>{const t={};for(let r of Reflect.ownKeys(e)){let s=e[r];s&&!Array.isArray(s)&&typeof s=="object"&&(s=Kr(s)),typeof r=="symbol"?t[String(r)]=s:t[r]=s}return t},Es=/^Symbol\((.*)\)$/,Lr=e=>{const t={};for(let r of Reflect.ownKeys(e)){let s=e[r];s&&!Array.isArray(s)&&typeof s=="object"&&(s=Lr(s));const i=Es.exec(r);if(i&&i[1]){const n=Symbol.for(i[1]);t[n]=s}else t[r]=s}return t};function Mr(e,t){let r=null;return function(...s){r&&clearTimeout(r),r=setTimeout(()=>{r=null,Reflect.apply(e,null,[...s])},t)}}var ar=Symbol("idKey"),ye=Symbol("valueKey"),x=Symbol("childrenKey"),X=Symbol("growKey"),Tr=class{[X]=!0;[ar];[ye]=(0,m.ref)();[x]=new Map;constructor(e){this[ar]=e}},Ps=class{get(e,t){if(t=="value")return e[ye].value;if(t==="grow")return e[X];let r=e[x].get(t);if(r)return De(r);if(e[X])return r=rr(t),r[X]=e[X],e[x].set(t,r),De(r)}set(e,t,r){return t=="value"?(e[ye].value=r,!0):t==="grow"?(e[X]=er(r),!0):r==null?(e[x].delete(t),!0):(console.error(`[Fox]illegal property:${t}`),!1)}deleteProperty(e,t){return t==="value"||t=="grow"?(console.error(`[Fox]can not delete property:${String(t)}`),!1):(e[x].delete(t),!0)}},tr="__proxy__";function rr(e){const t=new Tr(e);return Reflect.set(t,tr,new Proxy(t,new Ps)),t}function De(e){return Reflect.get(e,tr)}var Cs=class{name="";persistPolicy="memory";storage;initFlag=!1;state={};constructor(e={},t){if(e.persistPolicy&&e.persistPolicy!=="memory"&&Ee(e.name))throw new Error("name can not be empty, where persistPolicy is not memory.");this.name=e.name??"",this.persistPolicy=e.persistPolicy??"memory",this.storage=e.storage,t&&typeof t=="object"&&Object.assign(this.state,t)}init(e){this.restore(e),this.initFlag=!0}getStorage(){if(!this.persistPolicy||this.persistPolicy==="memory")return null;let e=null;if(this.persistPolicy==="custom")e=this.storage;else if(xe){const t=A();e=this.persistPolicy==="session"?t.sessionStorage:t.localStorage}return e}saveState(){if(!this.persistPolicy||this.persistPolicy==="memory")return;let e=this.getStorage();if(e===null||!this.state)return;const t=`_bus_${this.name}`,r=JSON.stringify(this.state??{});e.setItem(t,r)}removeState(){if(!this.persistPolicy||this.persistPolicy==="memory")return;let e=this.getStorage();if(e===null||!this.state)return;const t=`_bus_${this.name}`;e.removeItem(t)}restore(e){if(!this.persistPolicy||this.persistPolicy==="memory")return;let t=this.getStorage();if(t===null)return;const r=`_bus_${this.name}`,s=t.getItem(r);if(s){const i=JSON.parse(s);Object.assign(this.state,i),Reflect.ownKeys(this.state).forEach(n=>{if(typeof n!="string")return;const o=this.state[n],u=n.split(/\//g);u.push(o),Reflect.apply(e.put,e,u)})}}put(e){if(this.initFlag&&this.persistPolicy!=="memory")try{const t=e.length,r=e.slice(0,t-1).join("/"),s=e[t-1];this.state[r]=s,this.saveState()}catch(t){console.error(t)}}remove(e){if(this.initFlag&&this.persistPolicy!=="memory")try{const t=e.length,r=e.slice(0,t-1).join("/"),s={};Reflect.ownKeys(this.state).forEach(i=>{typeof i=="string"&&(i===r||i.startsWith(r)||(s[i]=this.state[i]))}),this.state=s,this.saveState()}catch(t){console.error(t)}}clear(){if(this.initFlag)try{this.state={},this.removeState()}catch(e){console.error(e)}}},kr=class extends Tr{_persistHandler;constructor(e={},t){super("__root__"),this._persistHandler=new Cs(e,t),this._persistHandler.init(this)}put(...e){let t=e.length;if(t<2)return console.error("[Fox]参数至少包括一个(key, value)"),!1;let r=this;for(let s=0;s<t-1;s++){let i=e[s],n;r[x].has(i)?n=r[x].get(i):(n=rr(i),r[x].set(i,n)),r=n}return r[ye].value=e[t-1],this._persistHandler.put(e),!0}get(...e){let t=e.length;if(t===0)return;let r=this;for(let s=0;s<t;s++){let i=e[s];if(r[x].has(i))r=r[x].get(i);else return}return r[ye].value}remove(...e){let t=e.length;if(t==0)return!1;let r=this;for(let i=0;i<t-1;i++){const n=e[i];if(r[x].has(n))r=r[x].get(n);else return!1}const s=e[t-1];return r[x].has(s)?(r[x].delete(s),this._persistHandler.remove(e),!0):!1}contains(...e){const t=e.length;if(t==0)return!1;let r=this;for(let i=0;i<t-1;i++){let n=e[i];if(r[x].has(n))r=r[x].get(n);else return!1}const s=e[t-1];return r[x].has(s)}clear(){this[x].clear(),this._persistHandler.clear()}},Fs=["put","get","contains","remove","clear","_persistHandler"];function ur(e){return Fs.includes(e)}var _s=class{get(e,t){if(t=="value")return e[ye].value;if(t==="grow")return e[X];if(t===x)return e[x];if(typeof t=="string"&&ur(t))return e[t];const r=String(t);let s=e[x].get(r);if(s)return De(s);if(e[X])return s=rr(r),s[X]=e[X],e[x].set(r,s),De(s)}set(e,t,r){return t=="value"?(e[ye].value=r,!0):t==="grow"?(e[X]=er(r),!0):ur(t)?!1:r==null?(e[x].delete(t),!0):(console.error(`[Fox]illegal property:${t}`),!1)}deleteProperty(e,t){return t==="value"||t=="grow"?(console.error(`[Fox]can not delete property:${String(t)}`),!1):(e[x].delete(t),!0)}};function As(e,t){const r=new kr(e,t),s=new _s,i=new Proxy(r,s);return Reflect.set(r,tr,i),r}var Vt=new Proxy(kr,{construct(e,t){const r=t[0]??{},s=t[1];return De(As(r,s))}}),sr=e=>!e||typeof e!="object"?!0:Reflect.ownKeys(e).length===0,Ir=class{name="";persistPolicy="memory";storage;constructor(e={}){if(e.persistPolicy&&e.persistPolicy!=="memory"&&Ee(e.name))throw new Error("name can not be empty, where persistPolicy is not memory.");this.name=e.name??"",this.persistPolicy=e.persistPolicy??"memory",this.storage=e.storage}getStorage(){if(!this.persistPolicy||this.persistPolicy==="memory")return null;let e=null;if(this.persistPolicy==="custom")e=this.storage;else if(xe){const t=A();e=this.persistPolicy==="session"?t.sessionStorage:t.localStorage}return e}saveState(e){if(!this.persistPolicy||this.persistPolicy==="memory")return;let t=this.getStorage();if(t===null||sr(e))return;const r=`_state_${this.name}`,s=JSON.stringify(e??{});t.setItem(r,s)}removeState(){if(!this.persistPolicy||this.persistPolicy==="memory")return;let e=this.getStorage();if(e===null)return;const t=`_state_${this.name}`;e.removeItem(t)}restore(e){if(!this.persistPolicy||this.persistPolicy==="memory")return;let t=this.getStorage();if(t===null)return;const r=`_state_${this.name}`,s=t.getItem(r);if(s){const i=JSON.parse(s);Object.assign(e,i)}}};function Br(e,t,r){const s=new Ir(r);s.restore(t);const i=u=>{const l=(0,m.toRaw)(u),a={};for(let f in l){const c=l[f];Ee(c)||(a[f]=c)}sr(a)?s.removeState():s.saveState(a)};let n=null;r&&r.debounce===!1?n=i:n=Mr(i,r&&r.debounceDelay?r.debounceDelay:250);const o=e?(0,m.shallowReactive)(t):(0,m.reactive)(t);return(0,m.effectScope)(!0).run(()=>{(0,m.watch)(o,u=>{const l=(0,m.toRaw)(u);n(l)})}),o}function js(e,t){return Br(!1,e,t)}function qs(e,t){return Br(!0,e,t)}function $s(e,t){const r=new Ir(t);r.restore(e);const s=n=>{const o=(0,m.toRaw)(n),u={};for(let l in o){const a=o[l];Ee(a)||(u[l]=a)}sr(u)?r.removeState():r.saveState(u)};let i=null;return t&&t.debounce===!1?i=s:i=Mr(s,t&&t.debounceDelay?t.debounceDelay:250),new Proxy(e,{get(n,o){return n[o]},set(n,o,u){return n[o]=u,i(n),!0}})}function Ks(e,t){return $s(e,t)}var he=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e})({}),C=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.ParamRegExp=2]="ParamRegExp",e[e.ParamRegExpEnd=3]="ParamRegExpEnd",e[e.EscapeNext=4]="EscapeNext",e})(C||{}),Ls={type:he.Static,value:""},Ms=/[a-zA-Z0-9_]/;function Ts(e){if(!e)return[[]];if(e==="/")return[[Ls]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(y){throw new Error(`ERR (${r})/"${a}": ${y}`)}let r=C.Static,s=r;const i=[];let n;function o(){n&&i.push(n),n=[]}let u=0,l,a="",f="";function c(){a&&(r===C.Static?n.push({type:he.Static,value:a}):r===C.Param||r===C.ParamRegExp||r===C.ParamRegExpEnd?(n.length>1&&(l==="*"||l==="+")&&t(`A repeatable param (${a}) must be alone in its segment. eg: '/:ids+.`),n.push({type:he.Param,value:a,regexp:f,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):t("Invalid state to consume buffer"),a="")}function h(){a+=l}for(;u<e.length;){if(l=e[u++],l==="\\"&&r!==C.ParamRegExp){s=r,r=C.EscapeNext;continue}switch(r){case C.Static:l==="/"?(a&&c(),o()):l===":"?(c(),r=C.Param):h();break;case C.EscapeNext:h(),r=s;break;case C.Param:l==="("?r=C.ParamRegExp:Ms.test(l)?h():(c(),r=C.Static,l!=="*"&&l!=="?"&&l!=="+"&&u--);break;case C.ParamRegExp:l===")"?f[f.length-1]=="\\"?f=f.slice(0,-1)+l:r=C.ParamRegExpEnd:f+=l;break;case C.ParamRegExpEnd:c(),r=C.Static,l!=="*"&&l!=="?"&&l!=="+"&&u--,f="";break;default:t("Unknown state");break}}return r===C.ParamRegExp&&t(`Unfinished custom RegExp for param "${a}"`),c(),o(),i}var fr="[^/]+?",ks={sensitive:!1,strict:!1,start:!0,end:!0},J=(function(e){return e[e._multiplier=10]="_multiplier",e[e.Root=9*e._multiplier]="Root",e[e.Segment=4*e._multiplier]="Segment",e[e.SubSegment=3*e._multiplier]="SubSegment",e[e.Static=4*e._multiplier]="Static",e[e.Dynamic=2*e._multiplier]="Dynamic",e[e.BonusCustomRegExp=1*e._multiplier]="BonusCustomRegExp",e[e.BonusWildcard=-4*e._multiplier-e.BonusCustomRegExp]="BonusWildcard",e[e.BonusRepeatable=-2*e._multiplier]="BonusRepeatable",e[e.BonusOptional=-.8*e._multiplier]="BonusOptional",e[e.BonusStrict=.07*e._multiplier]="BonusStrict",e[e.BonusCaseSensitive=.025*e._multiplier]="BonusCaseSensitive",e})(J||{}),Is=/[.+*?^${}()[\]/\\]/g;function Bs(e,t){const r=q(!0,{},ks,t),s=[];let i=r.start?"^":"";const n=[];for(const a of e){const f=a.length?[]:[J.Root];r.strict&&!a.length&&(i+="/");for(let c=0;c<a.length;c++){const h=a[c];let y=J.Segment+(r.sensitive?J.BonusCaseSensitive:0);if(h.type===he.Static)c||(i+="/"),i+=h.value.replace(Is,"\\$&"),y+=J.Static;else if(h.type===he.Param){const{value:d,repeatable:p,optional:w,regexp:b}=h;n.push({name:d,repeatable:p,optional:w});const v=b||fr;if(v!==fr){y+=J.BonusCustomRegExp;try{new RegExp(`(${v})`)}catch(M){throw new Error(`Invalid custom RegExp for param "${d}" (${v}): `+M.message)}}let L=p?`((?:${v})(?:/(?:${v}))*)`:`(${v})`;c||(L=w&&a.length<2?`(?:/${L})`:"/"+L),w&&(L+="?"),i+=L,y+=J.Dynamic,w&&(y+=J.BonusOptional),p&&(y+=J.BonusRepeatable),v===".*"&&(y+=J.BonusWildcard)}f.push(y)}s.push(f)}if(r.strict&&r.end){const a=s.length-1;s[a][s[a].length-1]+=J.BonusStrict}r.strict||(i+="/?"),r.end?i+="$":r.strict&&!i.endsWith("/")&&(i+="(?:/|$)");const o=new RegExp(i,r.sensitive?"":"i");function u(a){const f=a.match(o),c={};if(!f)return null;for(let h=1;h<f.length;h++){const y=f[h]||"",d=n[h-1];c[d.name]=y&&d.repeatable?y.split("/"):y}return c}function l(a){let f="",c=!1;for(const h of e){(!c||!f.endsWith("/"))&&(f+="/"),c=!1;for(const y of h)if(y.type===he.Static)f+=y.value;else if(y.type===he.Param){const{value:d,repeatable:p,optional:w}=y,b=d in a?a[d]:"";if(Dt(b)&&!p)throw new Error(`Provided param "${d}" is an array but it is not repeatable (* or + modifiers)`);const v=Dt(b)?b.join("/"):b;if(!v)if(w)h.length<2&&(f.endsWith("/")?f=f.slice(0,-1):c=!0);else throw new Error(`Missing required param "${d}"`);f+=v}}return f||"/"}return{re:o,score:s,keys:n,parse:u,stringify:l}}function Os(e,t){const r=Bs(Ts(e),t);return function(s){const i=r.parse(s);return i?{path:s,params:i}:null}}var Or="default",Dr=Symbol("sync"),B=Symbol("normalizeRoute");function cr(e){let t=!1;return function(...r){if(!t)return t=!0,Reflect.apply(e,{},r)}}function Ds(e){let t=e.src;return new Promise((r,s)=>{const i=cr(u=>{dt(u)&&(u=u.default),e.component=u,console.debug("success load async module"),r()}),n=cr(u=>{`${u}`,console.debug("reject load async module"),s(u)});let o;try{o=t(i,n)}catch(u){n(u)}if(o)if(typeof o.then=="function")o.then(i,n);else{const u=o.component;u&&typeof u.then=="function"&&u.then(i,n)}})}var Hs=class{name;level;rootName;rootIndex=0;constructor(e,t,r,s){this.name=e,this.level=t,this.rootName=r,this.rootIndex=s}},Je=class Hr{to;routeModel;from;data={};constructor(t,r){this.to=t,this.from=r}static from(t){const r=new Hr(t.to,t.from),s=t.data??{};return q(!0,r.data,s),r}static clear(t){for(let r in t)t[r]=void 0}},S=class Wt{path;get fullPath(){const t=this.path??`${this.name}`;return`${this.root??"default"}!${t}`}alias;name;root;params;query;traceless;template;matched;meta;success;error;destroy;opsType;updateType;historyUpdatePolicy;viewTagAttrs;index;active;slot;static clone(t,r){let s=new Wt;return $r(s,t,r),s}static isSame(t,r){return!t||!r?!1:t===r?!0:t.root!==r.root||t.index!==r.index?!1:t.path&&r.path&&t.path===r.path?!0:!!(t.name&&r.name&&t.name===r.name)}static isSamePathForRoute(t,r){return!t||!r?!1:t===r||t.path&&r.path&&t.path===r.path?!0:!!(t.name&&r.name&&t.name===r.name)}static from(t){let r=new Wt;if(t==null)return r;let s=r;for(let n in t)s[n]=t[n];const i=Object.getOwnPropertySymbols(t);if(Array.isArray(i)&&i.length>0)for(let n of i)s[n]=t[n];return r}},Ns=class{id;name;props;src;component;constructor(e,t,r){this.id=Ie.get(),this.name=e,this.src=t,typeof t!="function"&&(this.component=t),this.props=r}get isResolved(){return this.component!==void 0}resolve(){return Ds(this)}},hr=class{models=[]},bt=class{path;match;redirect;name;meta;matchedRoutes;layers=[]},_=(function(e){return e[e.Push=0]="Push",e[e.Replace=1]="Replace",e[e.Put=2]="Put",e[e.Append=3]="Append",e[e.Open=4]="Open",e})({}),wt=(function(e){return e[e.Part=0]="Part",e[e.All=1]="All",e})({}),G=Symbol("rootKey"),z=Symbol("rootNodeKey"),ce=Symbol("parentNodeKey"),ot=Symbol("nameKey"),te=class{model;route;active=!0;index=0;constructor(e,t,r=0,s=!0){this.route=e,this.model=t,this.index=r,this.active=s}},Fe=class{_slots;get slots(){return this._slots==null&&(this._slots=(0,m.shallowRef)([])),this._slots}get empty(){return this._slots==null||this._slots.value.length==0}[ot];[G];[z]=null;[ce]=null;get name(){return this[ot]}constructor(e,t,r){this[ot]=e,this[G]=t,r&&(this[z]=r)}},O=class{view;index;level;constructor(e,t,r){this.view=e,this.index=t,this.level=r}static include(e,t){for(let r=0;r<e.length;r++){let s=e[r];if(s.view===t.view&&(t.index==-1||s.index===t.index)&&s.level===t.level)return!0}return!1}},Rt=class{views=[]},Us=class{layers=[]},Vs=class{time;route},Ws=class{forbidTime=300;submitRecorder=new Vs;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)}},P=(function(e){return e.Busy="Busy",e.Free="Free",e.Reject="Reject",e.Exception="Exception",e.Finished="Finished",e})(P||{}),D=Symbol("chainKey"),I=Symbol("cursorKey"),xt=Symbol("$persistentModeKey"),F=Symbol("statusKey"),Z=Symbol("argsKey"),ze=Symbol("exArgsKey"),me=Symbol("successFnsKey"),_e=Symbol("errorFnsKey"),oe=Symbol("sessionKey"),Y=Symbol("_go"),He=class{[D]=[];[I]=0;[xt]=!1;[F]=P.Free;[Z]=[];[ze]=[];[me]=[];[_e]=[];[oe];get session(){return this[oe]}constructor(e,t=!1){this[oe]=e,this[xt]=t}[Y](e,...t){let r=this[F];if(this[F]=P.Busy,this[I]+=e,this[I]<0&&(this[I]=0),this[Z]=t,r===P.Exception||r===P.Reject){let n=[{session:this[oe]},...this[ze]];for(;this[_e].length>0;)try{let o=this[_e].shift();typeof o=="function"&&Be(()=>{Reflect.apply(o,{},n)})}catch(o){console.error(o.message,o)}return this[F]=r,this[D]=[],this[I]=0,this}else if(r===P.Finished||this[I]>=this[D].length){let n=[{session:this[oe]},...this[Z]];for(;this[me].length>0;){let o=this[me].shift();typeof o=="function"&&Be(()=>{Reflect.apply(o,{},n)})}return this[F]=P.Free,this}if(this[I]>=this[D].length)return this[F]=P.Free,this;let s=this[D][this[I]];this[xt]||(this[D].splice(0,this[I]+1),this[I]=-1);let i=this[I]+1;try{let n=!1,o={go:(u,...l)=>{n||(n=!0,Reflect.apply(this[Y],this,[u,...l]))},resolve:(...u)=>{n||(n=!0,Reflect.apply(this[Y],this,[1,...u]))},reject:(...u)=>{n||(n=!0,Reflect.apply(this.reject,this,[...u]))},insert:u=>{n||(this[D].splice(i,0,u),i++)},session:this[oe]};Be(()=>{Reflect.apply(s,{},[o,...this[Z]])})}catch(n){this.throw(n)}return this}go(e,...t){return Reflect.apply(this[Y],this,[e,...t])}finish(...e){return this[F]=P.Finished,this[Z]=e,Reflect.apply(this[Y],this,[0])}reject(...e){return this[F]=P.Reject,this[ze]=e,Reflect.apply(this[Y],this,[0])}throw(...e){return this[F]=P.Exception,this[ze]=e,Reflect.apply(this[Y],this,[0])}reset(...e){this[F]=P.Busy,this[Z]=e,this[D]=[],this[I]=0;let t=[{session:this[oe]},...this[Z]];for(;this[me].length>0;){let r=this[me].shift();Be(()=>{Reflect.apply(r,this,t)})}return this[F]=P.Free,this}post(e){return this[F]===P.Reject||this[F]===P.Exception?this:(Array.isArray(e)?this[D]=[...this[D],...e]:this[D].push(e),this[F]===P.Busy?this:(Reflect.apply(this[Y],this,[0,...this[Z]]),this))}wait(e,t){return e&&typeof e=="function"&&this[me].push(e),t&&typeof t=="function"&&this[_e].push(t),this[F]===P.Busy?this:(Reflect.apply(this[Y],this,[0,...this[Z]]),this)}exception(e){return e&&typeof e=="function"&&this[_e].push(e),this[F]===P.Busy?this:Reflect.apply(this[Y],this,[0,...this[Z]])}isFinish(){return this[F]==P.Reject||this[F]==P.Free&&this[I]>=this[D].length}},we=Symbol("_notifyChange"),yr=class{currentRoute;routes;constructor(e,t){this.currentRoute=e,this.routes=t}},le=Symbol("historyChangeConsumerKey"),dr=Symbol("_navigateFirstRoute"),Ge=Symbol("_getRouteMark"),St=Symbol("_getUrlSearch"),Et=Symbol("_generateLocation"),Xe=Symbol("_setRouteMarkRecorder"),Ae=Symbol("beforeRestoreFiltersKey"),mr=Symbol("_beforeRestore"),pr="Symbol(_fox_restore_point)";function je(e,...t){return typeof e=="function"?Reflect.apply(e,null,[...t]):e}function vr(e){if(!Array.isArray(e))return!1;if(e.length===0)return!0;const t=e[0];return!!(Reflect.has(t,"path")&&Reflect.has(t,"root"))}var Nr=class{base;storage;mode;query;firstNavigate=!0;historyMonitor;traceless=!1;changeHandler;historyChange;[le]=!1;[Ae]=new Array;backTimeout=320;constructor(e="hash",t="",r="",s=!0,i=!0,n=!1,o,u){this.mode=e,this.base=t,this.query=r,this.firstNavigate=s,this.historyMonitor=i,this.traceless=n,this.storage=o??A().sessionStorage,this.backTimeout=u??320}init(e=!0){const t=A();return typeof this.historyChange!="function"&&(this.historyChange=()=>{if(typeof this[le]=="function"){const r=this[le]();if(this[le]=!1,r)return}else if(this[le]===!0){this[le]=!1;return}if(je(this.historyMonitor)){const r=t.history.state;this[we](r);try{let s=[];if(typeof r=="string"?s=JSON.parse(r):s=r,Array.isArray(s)&&s.length>0){const i=this[Ge]()??"/";this[Xe](i,s)}}catch{}}}),at(t,"popstate",this.historyChange),this.firstNavigate&&e&&this[dr](),Promise.resolve()}destroy(){this.historyChange&&Yt(A(),"popstate",this.historyChange)}[mr](e,t,r,s){for(let i of this[Ae])try{const n=Reflect.apply(i,{},[e,t,r,s]);if(n===!1)return n}catch(n){console.error(n.message,n)}return!0}beforeRestoreEach(e){this[Ae].push(e)}removeBeforeRestoreEach(e){const t=this[Ae].indexOf(e);return t!==-1?(this[Ae].splice(t,1),!0):!1}[dr](){const e=this[Ge]()??"/",t=this.storage.getItem(pr);if(t)try{const n=JSON.parse(t);if(n.mark===e&&Array.isArray(n.routes)&&n.routes.length>0){const o=n.routes.filter((u,l)=>(u.params=u.params?Lr(u.params):{},this[mr](u,l,e,n.routes)));if(o.length>0){const u=this[St](),l=o.length-1;o[l].query=u||o[l].query,this[we](o);return}}}catch{}const r=e.indexOf("!");let s;r!=-1?s=e.substring(r+1):s=e;const i=new S;i.path=s,i.query=this[St](),this[we]([i])}[Xe](e,t){try{t.forEach(s=>{s.params=s.params?Kr(s.params):{}});const r=JSON.stringify({mark:e,routes:t});this.storage.setItem(pr,r)}catch(r){console.error(r.message,r)}}setRestorePoint(e){const t=this[Ge]()??"/";this[Xe](t,e)}[we](e){typeof this.changeHandler=="function"&&this.changeHandler(e)}[Ge](){const e=A();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,r=t.indexOf("#");if(r!=-1)return t.substring(r+1)}return null}[St](){let e=A().location.search;return e.length>0&&e.indexOf("?")===0&&(e=e.substring(1)),e}listen(e){this.changeHandler=e}go(e,t=!1){const r=A();this[le]=t,r.history.go(e)}goBack(e,t){const r=A(),s=r.history.state;if(vr(s)&&s.length>0){let i=!1;for(let a=s.length-1;a>=0;a--){const f=S.from(s[a]);if(!(f.historyUpdatePolicy==="traceless"||je(this.traceless,f))&&S.isSame(f,e)){i=!0;break}}if(!i){t();return}const n=this.backTimeout;let o=null;const u=()=>{r.history.go(-1),o=setTimeout(u,n)},l=()=>{clearTimeout(o);const a=A().history.state;if(vr(a)&&a.length>0){let f=a.length;const c=a[f-1],h=S.from(c);if(S.isSame(h,e))return t(),!0;if(f>0){let y=!1;for(let d=f-1;d>=0;d--){const p=S.from(a[d]);if(!(p.traceless===!0||je(this.traceless,p))&&S.isSame(p,e)){y=!0;break}}return y?(setTimeout(()=>{o=setTimeout(u,n),this.go(-1,l)},0),!0):(t(),!0)}}return t(),!0};o=setTimeout(u,n),this.go(-1,l)}else t()}setRouteMark(e){const t=e.currentRoute.fullPath;this[Xe](t,e.routes)}push(e){const t=this[Et](e.currentRoute);e.currentRoute.historyUpdatePolicy!=="traceless"&&!je(this.traceless,e.currentRoute)&&A().history.pushState(e.routes,"",t),this.setRouteMark(e)}replace(e){const t=this[Et](e.currentRoute);(e.currentRoute.historyUpdatePolicy!=="traceless"||!je(this.traceless,e.currentRoute))&&A().history.replaceState(e.routes,"",t),this.setRouteMark(e)}[Et](e){const t=A();let r="";if(e.query){let o="";if(typeof e.query=="object")for(let u of Reflect.ownKeys(e.query)){let l=encodeURIComponent(e.query[u]),a=`${encodeURIComponent(String(u))}=${l}`;o.length>0&&(o+="&"),o+=a}else o=e.query;this.query?(r=o.length>0?`${this.query}&${o}`:this.query,r.length>0&&r.charAt(0)!=="?"&&(r=`?${r}`)):o.length>0&&(r=`?${o}`)}const s=t.location;let i=e.alias??e.fullPath;i.startsWith("default")&&(i=i.substring(Or.length+1));let n;return r?this.mode=="path"?i.indexOf("/")===0?n=`${this.base}${i}${r}`:n=`${this.base}/${i}${r}`:n=`${s.pathname}${r}#${i}`:this.mode=="path"?i.indexOf("/")===0?n=`${this.base}${i}`:n=`${this.base}/${i}`:n=`${s.pathname}#${i}`,`${s.origin}${n}`}};function Js(e=!0,t=null,r="",s=!0,i=!1,n){return t!==null&&(t=A().location.pathname),t&&t.endsWith("/")&&(t=t.substring(0,t.length-1)),new Nr("path",t??"",r,e,s,i,n)}function Ur(e=!0,t="",r=!0,s=!1,i){return new Nr("hash","",t,e,r,s,i)}var zs=class{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=[]}beforeRestoreEach(e){}removeBeforeRestoreEach(e){return!1}listen(e){this.changeHandler=e}[we](e){typeof this.changeHandler=="function"&&this.changeHandler(e)}go(e,t=!1){if(this.queue.length==0||this.cursor<=0)return;let r=this.cursor+e;if(r<0?r=0:r>this.queue.length-1&&(r=this.queue.length-1),r!=this.cursor){this.cursor=r;let s=!1;if(typeof t=="function"?s=t():s=t,!s){const i=this.queue[r];this[we](i.routes)}}}goBack(e,t){if(this.queue.length==0||this.cursor<=0)return;let r=0;if(e===null)r=this.cursor+1;else for(let s=this.cursor;s>=0;s--){const i=this.queue[s];if(S.isSame(i.currentRoute,e))break;r++}if(r===0){t();return}this.go(-r,()=>(t(),!0))}setRouteMark(e){}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 Vr(e="",t=50){return new zs(e,t)}var Qe=Symbol("_constructRouteModel"),Ze=Symbol("_findRouteModel"),Pt=Symbol("_findRootView"),Gs=Symbol("_getFirstView"),ae=Symbol("_removeView"),gr=Symbol("_buildPage"),br=Symbol("_resolveComponent"),wr=Symbol("_update"),re=Symbol("_merge"),Ct=Symbol("_handleHistoryChange"),ue=Symbol("_handleRouteUpdated"),Ye=Symbol("routeUpdatedCallback"),Ft=Symbol("currentRoute"),g=Symbol("currentRoutes"),et=Symbol("routeSessionCacheKey"),Rr=Symbol("_addRouteRecorder"),qe=Symbol("_removeRouteRecorder"),tt=Symbol("_cloneRouteRecorder"),K=Symbol("_handleError"),rt=Symbol("errorCallback"),H=Symbol("registerKey"),st=Symbol("notFoundKey"),_t=Symbol("notFoundPathKey"),W=Symbol("forestKey"),E=Symbol("historyKey"),$e=Symbol("beforeFiltersKey"),Ke=Symbol("afterFiltersKey"),Le=Symbol("destroyFiltersKey"),At=Symbol("propsFilterKey"),pe=Symbol("mainDispatcherKey"),jt=Symbol("initKey"),fe=Symbol("readyKey"),qt=Symbol("readyHandlersKey"),it=Symbol("_markReady"),xr=Symbol("_createNextFn"),$t=Symbol("_start"),Kt=Symbol("_before"),Lt=Symbol("_after"),Sr=Symbol("_destroy"),Mt=Symbol("_load"),Me=Symbol("_unload"),Te=Symbol("routerGuardKey");function Xs(e){return e.layers.length==0||e.layers[0].views.length==0}var Wr=class{[H]=new Array;[st];[_t]="*";[fe]=!1;[qt]=[];[W]=new Us;[E];[g]=new Array;[Ft]=(0,m.shallowRef)(null);[et]=new WeakMap;[rt]=null;[Ye]=null;[$e]=new Array;[Ke]=new Array;[Le]=new Array;[At]=null;[pe]=new He;[Te]=new Ws;[jt]=!1;get currentRoute(){return(0,m.readonly)(this[Ft])}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[E]=e.history:this[E]=xe?Ur():Vr(),this[E]?.listen(async r=>{let s=!0;try{if(typeof r=="string"){const i=this[B](r);i&&await this[Ct]([i])}else await this[Ct](r)}catch(i){console.error(i.message,i),s=!1}this[fe]===!1&&this[it](s)})}[K](e="error",t){if(t&&typeof t.error=="function")try{t.error(e)}catch{}if(typeof this[rt]=="function")try{this[rt](e,t)}catch{}console.error(e)}init(){this[jt]!==!0&&(this[E]?.init(!this[fe]),this[jt]=!0)}isReady(){return this[fe]?Promise.resolve():new Promise((e,t)=>{this[qt].push([e,t])})}[it](e){this[fe]=!0,this[qt].forEach(([t,r])=>{try{e?t():r()}catch(s){console.error(s.message,s)}})}[Ct](e){try{if(!e){let n=[...this[g]].reverse();return this[Me](n),xe&&A().location.reload(),Promise.resolve()}let t=null,r=[],s=[],i=0;for(;i<e.length&&i<this[g].length&&S.isSame(e[i],this[g][i]);i++)e[i].active===!0&&e[i].active!==this[g][i].active&&(t=e[i]);if(i<e.length&&(r=e.slice(i)),i<this[g].length&&(s=this[g].slice(i).reverse()),s.length===0&&r.length===0){if(t!==null)return this.restore([t])}else if(s.length>0){if(this[Me](s)){if(r.length>0)return this.restore(r);if(t!==null)return this.restore([t])}}else return this.restore(r)}catch(t){this[K](t)}return Promise.resolve()}[ue](e=null){if(this[Ft].value=e,typeof this[Ye]=="function")try{this[Ye](e)}catch{}}[Rr](e,t){if(e.opsType===_.Open){let r=!1;const s=this[g].length-1;for(let i=s;i>=0;i--){const n=this[g][i];if(e.root==n.root){if(e.path===n.path){this[g].splice(i,1,e),r=!0;continue}e.active&&(n.active=!1)}}r||this[g].push(e)}else this[g].push(e);this[et].set(e,t),this[ue](e)}[tt](){let e=[];for(let t of this[g]){let r=S.clone(t,!0);e.push(r)}return e}[qe](e){if(!this[g]){this[ue](null);return}let t=-1;for(let r=0;r<this[g].length;r++)if(S.isSame(this[g][r],e)){t=r;break}if(t!=-1){const r=this[g][t];this[g].splice(t,1);const s=this[et].get(r);if(this[et].delete(r),this[Sr](r,s),r.opsType===_.Append){const i=this[g].length-1;this[ue](this[g][i]??null)}else this[ue](null)}else this[ue](null)}set historyMonitor(e){this[E]&&(this[E].historyMonitor=e)}get historyMonitor(){return this[E]?this[E].historyMonitor:!1}set traceless(e){this[E]&&(this[E].traceless=e)}get traceless(){return this[E]?this[E].traceless:!1}set propsFilter(e){this[At]=e}get propsFilter(){return this[At]}setRestorePoint(){const e=this[tt]();this[E]?.setRestorePoint(e)}onRouteUpdated(e){this[Ye]=e}onError(e){this[rt]=e}beforeEach(e){this[$e].push(e)}removeBeforeEach(e){const t=this[$e].indexOf(e);return t!==-1?(this[$e].splice(t,1),!0):!1}afterEach(e){this[Ke].push(e)}removeAfterEach(e){const t=this[Ke].indexOf(e);return t!==-1?(this[Ke].splice(t,1),!0):!1}destroyEach(e){this[Le].push(e)}removeDestroyEach(e){const t=this[Le].indexOf(e);return t!==-1?(this[Le].splice(t,1),!0):!1}beforeRestoreEach(e){this[E]?.beforeRestoreEach(e)}removeBeforeRestoreEach(e){return this[E]?.removeBeforeRestoreEach(e)??!1}addRoutes(e){for(let t of e)this.addRoute(t)}addRoute(e,t=-1){if(e.path===this[_t]){this.setNotFoundRoute(e);return}const r=this[Qe](e);if(t==-1)this[H]=[...this[H],...r];else for(let s=r.length-1;s>=0;s--)this[H].splice(t,0,r[s])}removeRoute(e){const t=this[B](e);if(t===null)return console.warn("[Fox]route格式错误",e),!1;for(let r=0;r<this[H].length;r++){const s=this[H][r];if(t?.path&&s.path===t.path)return this[H].splice(r,1),!0;if(t?.name&&s.name===t.name)return this[H].splice(r,1),!0}return!1}hasRoute(e){const t=this[B](e);return t===null?(console.warn("[Fox]route格式错误",e),!1):this[H].findIndex(r=>{if(t?.path&&r.path===t.path||t?.name&&r.name===t.name)return!0})!==-1}setNotFoundPath(e){this[_t]=e}setNotFoundRoute(e){const t=this[Qe](e);this[st]=t[0]}getRoutes(){return[...this[H]]}[Qe](e){let t=e.path??"";t.length>0&&t.charAt(0)!=="/"&&(t=`/${t}`);let r=e.components??(e.component&&{"":e.component});if(!r){const u=new bt;return u.path=t,u.redirect=e.redirect,[u]}const s=new S;s.path=t,s.name=e.name,s.meta=e.meta;let i=[];for(let u in r){const l=r[u];u.length===0&&(u=Or);const a=new Ns(u,l,e.props);i.push(a)}let n=!1,o=[];if(e.children)for(let u of e.children){const l=this[Qe](u);for(let a of l){let f=new bt;f.name=a.name,a.path&&a.path.length>0?t!=="/"?f.path=`${t}${a.path}`:f.path=a.path:(n=!0,f.path=t);let c=new hr;c.models=[...i],f.layers=[c,...a.layers],f.matchedRoutes=[s,...a.matchedRoutes??[]],o.push(f)}}if(!n){const u=new hr;u.models=i;const l=new bt;l.name=e.name,l.path=t,l.matchedRoutes=[s],l.layers=[u],o.splice(0,0,l)}return o}[Ze](e){const t=e.route;try{for(let r of this[H]){const s=t.path?t.template??t.path:null,i=t.name?t.template??t.name:null;if(s&&r.path){let n=r.match;n||(n=r.match=Os(r.path));const o=n(s);if(!o)continue;if(r.redirect){const u=new S;q(!0,u,t),u.path=r.redirect;const l={route:u,find:void 0};return this[Ze](l)?(e.route=l.route,e.find=l.find,t.template&&e.find&&(e.find={...e.find},e.find.path=t.path),!0):!1}if(t.params=t.params??{},q(!0,t.params,o.params),t.query){const u=t.query;if(typeof u=="string"){const l={},a=u.split("&");for(let f of a){const c=f.split("=");if(c.length!==2)continue;const h=decodeURIComponent(c[0].trim());l[h]=decodeURIComponent(c[1].trim())}q(!0,t.params,l)}else typeof u=="object"&&q(!0,t.params,u)}return e.find=r,t.template&&e.find&&(e.find={...e.find},e.find.path=t.path),!0}else if(i===r.name)return e.find=r,t.template&&e.find&&(e.find={...e.find},e.find.name=t.name),!0}}catch(r){console.error(r.message,r),typeof t.error=="function"&&t.error(r.message)}return!1}[B](e){let t=null;if(Array.isArray(e))if(t=new S,typeof e[0]=="object")t=S.from(e[0]);else for(let r=0;r<e.length;r++)r===0?e[r].charAt(0)==="/"?t.path=e[r]:t.name=e[r]:r===1?t.params=e[r]:r===2?t.root=e[r]:r===3&&q(!1,t,e[r]);else typeof e=="object"?t=S.from(e):typeof e=="string"&&(t=new S,e.charAt(0)=="/"?t.path=e:t.name=e);if(t){if(t.path){let r=t.path.indexOf("?");r!==-1&&r<t.path.length-1&&(t.query=t.path.substring(r+1),t.path=t.path.substring(0,r))}t.root=t.root??"default",t.opsType=t.opsType??this.options.defaultOperationType??_.Push,t.traceless&&!t.historyUpdatePolicy&&(t.historyUpdatePolicy="traceless")}return t}push(...e){const t=this[B](e);return t?(t.opsType=_.Push,t.historyUpdatePolicy=t.historyUpdatePolicy??"push",this.to(t)):(this[K]("resolve route fail",t),this)}put(...e){const t=this[B](e);return t?(t.opsType=_.Put,t.historyUpdatePolicy=t.historyUpdatePolicy??"traceless",this.to(t)):(this[K]("resolve route fail",t),this)}replace(...e){const t=this[B](e);return t?(t.opsType=_.Replace,t.historyUpdatePolicy=t.historyUpdatePolicy??"replace",this.to(t)):(this[K]("resolve route fail",t),this)}append(...e){const t=this[B](e);return t?(t.opsType=_.Append,t.historyUpdatePolicy=t.historyUpdatePolicy??"push",this.to(t)):(this[K]("resolve route fail",t),this)}remove(e,t){return new Promise(r=>{this[pe].post(s=>{try{if(this[g].length===0){s.resolve(),r(!1);return}let i=-1,n=null,o=[];if(e){if(n=e.root??"default",e.all)for(let l=this[g].length-1;l>0;l--){const a=this[g][l];if(a.opsType===_.Append){const f=a.root??"default";if(n&&n!==f)continue;o.splice(0,0,a),i=l-1}}else if(e.until)for(let l=this[g].length-1;l>0;l--){let a=this[g][l];if(a.opsType===_.Append&&a.root===n){if(e.until.charAt(0)==="/"&&e.until===a.path){i=l;break}else if(e.until===a.name){i=l;break}o.splice(0,0,a)}}else if(e.to)for(let l=this[g].length-1;l>0;l--){const a=this[g][l];if(a.opsType===_.Append){const f=a.root??"default";if(n&&n!==f)continue;if(o.splice(0,0,a),e.to.charAt(0)==="/"&&e.to===a.path){i=l-1;break}else if(e.to===a.name){i=l-1;break}}}}else for(let l=this[g].length-1;l>0;l--){let a=this[g][l];if(a.opsType===_.Append){o.push(a),i=l-1;break}}if(i===-1||o.length===0){const l="[Fox]can not find route";console.warn(l),s.resolve(l),r(!1);return}let u=null;if(i!==-1&&(u=this[g][i]),this[Me](o)){if(t===!1)return s.resolve(),r(!0),!0;const l=()=>(s.resolve(),r(!0),!0),a=this[g].length;if(u&&S.isSame(u,this[g][a-1])){this[E]?.goBack(u,l);return}l()}}catch(i){this[K](i),s.resolve(),r(!1)}})})}open(...e){const t=this[B](e);return t?(t.opsType=_.Open,t.historyUpdatePolicy=t.historyUpdatePolicy??"push",this.to(t)):(this[K]("resolve route fail",t),this)}close(e){return this[pe].post(t=>{try{let r=this[B](e);if(!r){t.reject("resolve route fail");return}let s=[];for(let i=0;i<this[g].length;i++){let n=this[g][i];if(n.root===r.root){if(!r.path&&!r.name){s.push(n);continue}if(r.path&&r.path===n.path){s.push(n);break}else if(r.name&&r.name===n.name){s.push(n);break}}}if(s.length===0){t.resolve();return}this[Me](s),t.resolve()}catch(r){this[K](r),t.resolve()}}),this}to(...e){const t=this[B](e);if(!t)return this[K]("resolve route fail",t),this;const r=this[Te].acquire(t);return r==null?(this[K]("route forbid",t),this):(this[pe].post(s=>{try{let i=this[$t](t);this[Kt](i),this[Mt](i),this[Lt](i),i.wait((n,o)=>{const u=n.session.to;if(n.session.updateResult&&n.session.updateResult.status==="success")try{const l=new yr(S.clone(u,!0),this[tt]());u.historyUpdatePolicy==="replace"?this[E]?.replace(l):u.historyUpdatePolicy==="traceless"?this[E]?.setRouteMark(l):this[E]?.push(l)}catch(l){console.error(l.message,l)}if(Je.clear(n.session),this[Te].release(r),typeof t.success=="function")try{Reflect.apply(t.success,{},[])}catch(l){console.error(l.message,l)}this[fe]===!1&&this[it](!0),i=null,s.resolve()},(n,o)=>{this[Te].release(r),o!==null&&this[K](o,t),this[fe]===!1&&this[it](!1),Je.clear(n.session),i=null,s.resolve()})}catch(i){this[Te].release(r),this[K](i,t),s.resolve()}}),this)}back(e=1){this[E]?.go(-e,!1)}[xr](e){return(t,r)=>{if(typeof t=="boolean")e.session.redirect=!1,t?e.resolve():e.reject(r??null);else if(t){const s=this[B](t);if(s){const i=e.session.to;s.success=i.success,s.error=i.error,e.session.to=s,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()}}[$t](e){const t=new Je(e,this[g].length>0?this[g][this[g].length-1]:void 0),r={route:e,find:null};if(this[Ze](r),r.find){t.routeModel=r.find,e.matched=r.find.matchedRoutes??[];const s={};if(Array.isArray(r.find?.matchedRoutes))for(let i=0;i<r.find.matchedRoutes.length;i++){const n=r.find.matchedRoutes[i];n.meta&&typeof n.meta=="object"&&Object.assign(s,n.meta)}e.meta&&typeof e.meta=="object"&&Object.assign(s,e.meta),e.meta=s}return new He(t)}[Kt](e){for(let t of this[$e])e.post(r=>{const s=this[xr](r);Reflect.apply(t,{},[r.session.to,r.session.from,s,r.session])})}[Lt](e){e.post(t=>{for(let r of this[Ke])try{Reflect.apply(r,{},[t.session.to,t.session.from,t.session])}catch(s){console.error(s.message,s)}t.resolve()})}[Sr](e,t){for(let r of this[Le])try{Reflect.apply(r,{},[e,t])}catch(s){console.error(s.message,s)}typeof e.destroy=="function"&&Reflect.apply(e.destroy,e,[])}[Mt](e){e.post(t=>{const r=t.session.to;let s=t.session.routeModel;if(s==null){let n={route:r,find:null};if(this[Ze](n))s=n.find,t.session.routeModel=s;else if(this[st])s=this[st];else{t.reject(`not find route model, path:${r.path??r.name}`);return}}const i=Je.from(t.session);this[gr](r,s,i).then(n=>{this[W],t.session.updateResult=n??{status:"success",message:""},t.resolve()},n=>{t.reject(n)})})}[Me](e){if(e.length==0)return!0;let t=this[W],r=[];for(let s of e){let i=this[Pt](t,s);i!=null&&r.push({...i,route:s})}if(r.length==0)return this[K]("can not find view index"),!1;for(let s of r.reverse())this[ae](t,{x:s.x,y:s.y},[s.route.index??0],!0);return!0}[Pt](e,t){const r=t.root??"default";let s;for(let i=0;i<e.layers.length;i++){const n=e.layers[i];for(let o=n.views.length-1;o>=0;o--){const u=n.views[o];if(u[G]&&u[ot]===r)return s={x:o,y:i},s}}return null}[Gs](e){return e.layers.length>0&&e.layers[0].views.length>0?e.layers[0].views[0]:null}[ae](e,t,r=null,s=!0){if(t.y>=e.layers.length||t.x>=e.layers[t.y].views.length)return;let i=e.layers[t.y].views[t.x],n=!1,o=[],u=!1,l=[...i.slots.value];for(let f=l.length-1;f>=0;f--){let c=l[f];(!r||r.indexOf(c.index)!=-1)&&(c.route&&i[G]&&(this[qe](c.route),c.active===!0&&c.route.opsType==_.Append&&(u=!0)),o.push(new O(i,c.index,t.y)),l.splice(f,1))}if(l.length==0)s?i.slots.value=l:e.layers[t.y].views.splice(t.x,1);else{if(u){let f=l[l.length-1];f.active=!0,f.route&&(f.route.active=f.active)}i.slots.value=l}e.layers[t.y].views.length==0&&(n=!0);let a=t.y+1;for(;a<e.layers.length;a++){let f=e.layers[a].views,c=[];for(let h=f.length-1;(n||o.length>0)&&h>=0;h--){let y=f[h];if(y[ce]&&(n||O.include(o,y[ce]))){let d=y.slots.value;for(let p=d.length-1;p>=0;p--){let w=d[p];w.route&&y[G]&&this[qe](w.route),c.push(new O(y,w.index,a)),d.splice(p,1)}e.layers[a].views.splice(h,1)}}o=c,e.layers[a].views.length==0&&(n=!0)}}restore(e){if(!e||this[H].length==0){let t=this[W];if(t.layers.length>0){let r=t.layers[0].views;r.length>0&&(r[0].slots.value=[])}return this[g]=[],this[ue](null),Promise.resolve()}else return new Promise((t,r)=>{let s=null,i=!1;for(let n=0;n<e.length;n++){const o=e[n];this[pe].post(u=>{const l=this[$t](o);this[Kt](l),this[Mt](l),this[Lt](l),l.wait((a,f)=>{s=a.session.to,i=a.session.redirect,u.resolve()},(a,f)=>{s=null,f!==null&&this[K](f),u.resolve()})})}this[pe].post(n=>{if(s&&i===!0){const o=new yr(S.clone(s,!0),this[tt]());this[E]?.replace(o)}n.resolve(),t()})})}async[gr](e,t,r){const s=e.updateType??wt.Part;await this[br](t);const i=this[wr](t,e,r,s);if(i.status==="error")throw Error(i.message);return i}[br](e){let t=[];for(let r=0;r<e.layers.length;r++){let s=e.layers[r];for(let i=0;i<s.models.length;i++){let n=s.models[i];n.isResolved||t.push(n.resolve())}}return t.length>0?Promise.all(t):Promise.resolve()}[wr](e,t,r,s){if(e.layers[0].models.length!==1)return{status:"error",message:"illegal route structure(multi root node)"};const i=e.layers[0].models[0];let n=this[W],o=Xs(n),u=t.root??"default",l;!o&&s==wt.Part&&(l=this[Pt](n,t));let a,f=0;if(l==null||l==null)if(o||s===wt.All)n.layers.length==0&&(n.layers[0]=new Rt),n.layers[0].views.length==0?(a=new Fe(t.root??"default",!0,null),n.layers[0].views=[a]):a=n.layers[0].views[0],l={x:0,y:0};else{let c=t.slot;if(!c)return{status:"error",message:"can not rebuild view(because not route slot)"};let h=c.level;if(h>n.layers.length)return{status:"error",message:"can not insert view(override level)"};let y;if(c.rootName){let d=n.layers[h-1];for(let p of d.views){if(p[G]&&p.name===c.rootName){y=new O(p,c.rootIndex??0,h-1);break}if(p[z]&&p[z].view.name===c.rootName&&p[z].index===c.rootIndex){y=p[z];break}}}if(!y)return{status:"error",message:"can not insert view(not find root node ref)"};a=new Fe(u,!0,y),n.layers[h].views.push(a),l={x:n.layers[h].views.length-1,y:h}}else a=n.layers[l.y].views[l.x];if(f=l.y,a[G]=!0,t.opsType===_.Append){t.index=t.index??Ie.get(),t.active=!0;let c=a.slots.value;if(c.length>0){let w=c[c.length-1];w.active=!1,w.route&&(w.route.active=w.active)}let h=new te(t,i,t.index,!0);a.slots.value=[...c,h];let y=f+1,d=1,p=new O(a,t.index,f);this[re](n,y,e,d,p)}else if(t.opsType===_.Open){let c=a.slots.value;const h=t.active??!0;let y=!1;for(let d of c){if(d.route!==null&&S.isSamePathForRoute(d.route,t)){if(d.active===h)return t.index=d.index,t.active=h,d.route=t,{status:"noChange",message:""};d.active=h,y=!0,t.index=d.index,t.active=h,d.route=t}else h&&(d.active=!1);d.route&&(d.route.active=d.active)}if(!y){t.index=t.index??Ie.get(),t.active=h;let d=new te(t,i,t.index,h);c.push(d);let p=f+1,w=1,b=new O(a,t.index,f);this[re](n,p,e,w,b)}a.slots.value=[...c]}else{let c=a.slots.value;if(c.length==0){t.index=t.index??Ie.get(),t.active=!0,a.slots.value=[new te(t,i,t.index)];let h=f+1,y=1,d=new O(a,t.index,f);this[re](n,h,e,y,d)}else{let h=c[0];if(h.model!==i){this[ae](n,l,null,!0),t.index=t.index??Ie.get(),t.active=!0,a.slots.value=[new te(t,i,t.index)];let y=f+1,d=1,p=new O(a,t.index,f);this[re](n,y,e,d,p)}else{h.route!==null&&this[qe](h.route);let y=!1;const d=t.active??!0;h.active!==d&&(h.active=d,y=!0),t.active=d,t.index=h.index,h.route=t;let p=[];for(let M=1;M<c.length;M++)p.push(c[M].index);p.length>0?this[ae](n,l,p,!0):y&&(a.slots.value=[...c]);let w=[new O(a,t.index,f)],b=f+1,v=1,L=new O(a,t.index,f);for(;w.length>0&&b<n.layers.length&&v<e.layers.length;b++,v++){let M=[];for(let T=0;T<n.layers[b].views.length;T++){let $=n.layers[b].views[T];$[ce]&&O.include(w,$[ce])&&M.unshift(T)}let Pe=[];for(let T of M){let $=n.layers[b].views[T],ne=e.layers[v].models,ee;for(let k=0;k<ne.length;k++)if($.name===ne[k].name){ee=ne[k];break}if(!ee)this[ae](n,{x:T,y:b},null,!1);else{let k=$.slots.value;if(k.length==0){let Q=0;$.slots.value=[new te(null,ee,Q)];let U=b+1,V=v+1;this[re](n,U,e,V,L)}else{let Q=k[0];if(Q.model!==ee){this[ae](n,{x:T,y:b},null,!0),$.slots.value=[new te(null,ee,0)];let U=b+1,V=v+1;this[re](n,U,e,V,L)}else{$[G]&&Q.route!==null&&this[qe](Q.route);let U=[];for(let V=1;V<k.length;V++)U.push(k[V].index);U.length>0&&this[ae](n,{x:T,y:b},U,!0),Pe.push(new O($,Q.index,b))}}$[G]=!1}}w=Pe}this[re](n,b,e,v,L)}}}if(a&&a[z]){let c=a[z];c&&(t.slot=new Hs(u,f,c?.view.name,c?.index??0))}return r.to=void 0,r.routeModel=void 0,this[Rr](t,r),{status:"success",message:""}}[re](e,t,r,s,i){let n=s,o=t;for(;o<e.layers.length&&n<r.layers.length;o++,n++){let u=e.layers[o].views;for(let l of r.layers[n].models){let a=new Fe(l.name,!1,i),f=new te(null,l);a.slots.value=[f],u.push(a)}}for(;n<r.layers.length;n++){let u=new Rt;u.views=[];for(let l of r.layers[n].models){let a=new Fe(l.name,!1,i),f=new te(null,l);a.slots.value=[f],u.views.push(a)}e.layers.push(u)}}[Dr](e,t,r,s,i,n){if(t<0||t>this[W].layers.length)return null;if(t<this[W].layers.length){let a=this[W].layers[t],f=null;for(let c of a.views){let h=!1;if(r!==null?(h=c.name===e&&c[z]?.view===r,h&&s!==-1&&(h=c[z]?.index===s)):h=c.name===e,!!h){i!==null&&(c[ce]={view:i,index:n,level:t-1}),f=c;break}}if(f!==null)return f}let o=null,u=null;i!==null&&(i[G]?o={view:i,index:n,level:t-1}:o=i[z],u={view:i,index:n,level:t-1});let l=new Fe(e,!0,o);if(l[ce]=u,t==this[W].layers.length){let a=new Rt;a.views=[l],this[W].layers.push(a)}else this[W].layers[t].views.push(l);return l}},Ne=Symbol("rk"),Tt=Symbol("vd"),Er=Symbol("rv"),kt=Symbol("rvi"),Pr=Symbol("pv"),It=Symbol("pvi"),ke=Symbol("registerKey"),Jr=Symbol("lc"),Qs=class{[ke]=new Map;constructor(){}set(e,t){this[ke].set(e,t)}get(e){return this[ke].get(e)}has(e){return this[ke].has(e)}delete(e){return this[ke].delete(e)}},ie=new WeakMap,Oe=[];function nt(e,t=!1){let r=e?ie.get(e)??null:null;return t&&!r&&(r=new Qs,e&&ie.set(e,r),(0,m.onScopeDispose)(()=>{e&&ie.delete(e)}),(0,m.provide)(Jr,r)),r}function Ue(e){let t=e?ie.get(e)??null:null;return!t&&(0,m.hasInjectionContext)()&&(t=(0,m.inject)(Jr,null)),!t&&Oe.length>0&&(t=Oe[Oe.length-1]),t}async function zr(e,t){Oe.push(e);try{return await t()}finally{Oe.pop()}}function Zs(e){const t=(0,m.getCurrentScope)();if(!t)return!1;const r=Ue();if(!r)return!1;if(ie.set(t,r),Array.isArray(e))for(let s=0;s<e.length;s++)ie.set(e[s],r);return(0,m.onScopeDispose)(()=>{if(ie.delete(t),Array.isArray(e))for(let s=0;s<e.length;s++)ie.delete(e[s])}),!0}function ir(e,t){return Ue(e)?.get(t)??null}function Ys(e,t,r){Ue(e)?.set(t,r)}function ei(e,t,r){Ue(e)?.delete(t)}var ut=Symbol("hooksKey");function ti(e){let t=e.get(ut);t||(t=[],e.set(ut,t))}function Cr(e,t){const r=e.get(ut);r!=null&&zr(e,async()=>{for(let s=r.length-1;s>=0;s--){let i=r[s];if(i.type===t)try{await Reflect.apply(i.hook,null,[])}catch(n){console.error(n.message,n)}}})}var ft=(function(e){return e.INACTIVATED="ia",e.ACTIVATED="a",e})({}),ri=class{type;hook;constructor(e,t){this.hook=t,this.type=e}};function si(e,t,r){const s=new ri(t,r);return e.push(s),!0}function ii(e,t,r){let s=-1;for(let i=0;i<e.length;i++){const n=e[i];if(n.type===t&&n.hook===r){s=i;break}}return s!=-1?(e.splice(s,1),!0):!1}function Gr(e){return t=>{const r=ir(null,ut);if(r==null){console.warn("[Fox]hooks context not found");return}(0,m.onScopeDispose)(()=>{ii(r,e,t)}),si(r,e,t)}}var ni=function(e){(0,m.onActivated)(e),Gr(ft.ACTIVATED)(e)},oi=function(e){(0,m.onDeactivated)(e),Gr(ft.INACTIVATED)(e)},Xr=Symbol("routeKey");function Fr(e,t){e.set(Xr,t)}function Jt(e){const t=ir(e??null,Xr);return typeof t=="function"?t():t}var Qr="FoxBeforeEnter",Zr="FoxEnter",Yr="FoxLeave",es="FoxLeave",ct="FoxLeaveEnd";function ts(e,t=!1){let r=null;return t?r=e.showFromClass??e.enterFromClass:r=e.enterFromClass,r||(r=e.transitionName,r?t?`${r}-show-from`:`${r}-enter-from`:null)}function rs(e,t=!1){let r=null;return t?r=e.showActiveClass??e.enterActiveClass:r=e.enterActiveClass,r||(r=e.transitionName,r?t?`${r}-show-active`:`${r}-enter-active`:null)}function li(e,t=!1){let r=null;return t?r=e.showToClass??e.enterToClass:r=e.enterToClass,r||(r=e.transitionName,r?t?`${r}-show-to`:`${r}-enter-to`:null)}function ss(e,t=!1){let r=null;return t?r=e.hideFromClass??e.leaveFromClass:r=e.leaveFromClass,r||(r=e.transitionName,r?t?`${r}-hide-from`:`${r}-leave-from`:null)}function is(e,t=!1){let r=null;return t?r=e.hideActiveClass??e.leaveActiveClass:r=e.leaveActiveClass,r||(r=e.transitionName,r?t?`${r}-hide-active`:`${r}-leave-active`:null)}function ai(e,t=!1){let r=null;return t?r=e.hideToClass??e.leaveToClass:r=e.leaveToClass,r||(r=e.transitionName,r?t?`${r}-hide-to`:`${r}-leave-to`:null)}function ui(e,t=!1){let r=null;return t?r=e.beforeShow??e.beforeEnter:r=e.beforeEnter,r}function fi(e,t=!1){let r=null;return t?r=e.show??e.enter:r=e.enter,r}function ci(e,t=!1){let r=null;return t?r=e.afterShow??e.afterEnter:r=e.afterEnter,r}function hi(e,t=!1){let r=null;return t?r=e.showCancelled??e.enterCancelled:r=e.enterCancelled,r}function yi(e,t=!1){let r=null;return t?r=e.beforeHide??e.beforeLeave:r=e.beforeLeave,r}function di(e,t=!1){let r=null;return t?r=e.hide??e.leave:r=e.leave,r}function mi(e,t=!1){let r=null;return t?r=e.afterHide??e.afterLeave:r=e.afterLeave,r}function pi(e,t=!1){let r=null;return t?r=e.hideCancelled??e.leaveCancelled:r=e.leaveCancelled,r}function nr(e){let t,r=e.transitionDuration;return typeof r=="object"?t={enter:r.enter??-1,leave:r.leave??-1,show:r.show??-1,hide:r.hide??-1}:(typeof r=="string"&&(r=r.length==0?-1:Number(r)),t={enter:r,leave:r,show:r,hide:r}),t}function Se(e,t){e.classList.contains(t)||e.classList.add(t)}function Re(e,t){e.classList.remove(t)}var vi=xe&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout;function mt(e){vi(e)}function j(e,t){R(e)&&Reflect.apply(e,null,t)}function ns(e,t,r=-1,s,i,n){let o=[];const u=()=>{for(let l of o)Yt(e,l.type,l.listener);o=[]};if(R(i)){if(s!==void 0&&s>=0){setTimeout(()=>{Reflect.apply(i,null,[e,t,r])},s);return}const l=["animationend","transitionend",ct],a=f=>{(f.target||f.srcElement)===f.currentTarget&&(u(),Reflect.apply(i,null,[e,t,r]))};l.forEach(f=>{at(e,f,a),o.push({type:f,listener:a})})}if(R(n)){const l="animationcancel",a=f=>{(f.target||f.srcElement)===f.currentTarget&&(u(),Reflect.apply(n,null,[e,t,r]))};at(e,l,a),o.push({type:l,listener:a})}}function pt(e){return!xe||e===null?!1:e.opsType===_.Append||e.opsType===_.Open}function os(e,t,r={},s,i=-1){if(e||pt(s)){const n=ts(r,e);n&&Se(t,n);const o=rs(r,e);o&&Se(t,o),j(ui(r,e),[t,e,s,i])}}function ls(e,t,r={},s,i,n,o){if(!pt(i)&&!e){R(o)&&o(o,[t]);return}const u=ts(r,e),l=rs(r,e),a=li(r,e),f=fi(r,e),c=ci(r,e),h=hi(r,e);if(!u&&!l&&!a&&!f){R(o)&&o(o,[t]);return}mt(()=>{ns(t,i,n,s,()=>{l&&Re(t,l),a&&Re(t,a),R(c)&&j(c,[t,e,i,n]),R(o)&&o(o,[t])},()=>{R(h)&&j(h,[t,e,i,n])}),u&&Re(t,u),a&&Se(t,a),R(f)&&j(f,[t,e,i,n])})}function as(e,t,r={},s,i=-1){if(e||pt(s)){const n=ss(r,e);n&&Se(t,n);const o=is(r,e);o&&Se(t,o),j(yi(r,e),[t,e,s,i])}}function us(e,t,r={},s,i,n,o,u){if(!pt(n)&&!e){R(u)&&j(u,[t]),!e&&R(i)&&i();return}const l=ss(r,e),a=is(r,e),f=ai(r,e),c=di(r,e),h=mi(r,e),y=pi(r,e);if(!l&&!a&&!f&&!c){R(u)&&j(u,[t]),!e&&R(i)&&i();return}mt(()=>{ns(t,n,o,s,()=>{try{a&&Re(t,a),f&&Re(t,f),R(h)&&j(h,[t,e,n,o]),R(u)&&j(u,[t])}finally{!e&&R(i)&&i()}},()=>{try{R(y)&&j(y,[t,e,n,o]),R(u)&&j(u,[t])}finally{!e&&R(i)&&i()}}),l&&Re(t,l),f&&Se(t,f),R(c)&&j(c,[t,e,n,o])})}function zt(e,t={},r,s=-1){const i=t.mode??"default",n=nr(t);return{mode:i,persisted:!1,beforeEnter:o=>{os(!1,o,t,r,s)},enter:o=>{ls(!1,o,t,n.enter,r,s)},leave:(o,u)=>{as(!1,o,t,r,s),us(!1,o,t,n.leave,u,r,s,()=>{e.transition=null})},clone:o=>zt(e,t,r,s)}}function fs(e){return e.el}function gi(e,t={},r,s,i,n){if(i===!0){const o=fs(e);if(o==null)return;const u=nr(t);os(!0,o,t,r,s),ls(!0,o,t,u.show,r,s,l=>{R(n)&&j(n,[l])})}else R(n)&&j(n,[])}function bi(e,t={},r,s,i,n){if(i===!0){const o=fs(e);if(o==null)return;const u=nr(t);as(!0,o,t,r,s),us(!0,o,t,u.hide,null,r,s,l=>{R(n)&&j(n,[l])})}else R(n)&&j(n,[])}function wi(e){mt(()=>{for(let t=0;t<e.length;t++)Reflect.apply(e[t],null,[])})}function cs(e,t={},r,s=-1){return{mode:t.mode??"default",persisted:!1,beforeEnter:i=>{We(Qr,{},i)},enter:i=>{We(Zr,{},i)},leave:(i,n)=>{We(Yr,{},i),mt(()=>{const o=u=>{(u.target||u.srcElement)===u.currentTarget&&(Yt(i,ct,o),n&&Reflect.apply(n,null,[]),e.transition=null)};at(i,ct,o),We(es,{},i)})},clone:i=>cs(e,t,r,s)}}function se(e,t,r){return typeof e=="function"?Reflect.apply(e,{},[t,r]):e}function Bt(e,t){if(!e)return null;const r=e(t);return r.length===1?r[0]:r}function ve(e,t){return typeof t=="function"?t(e):e}var Ri=class{node;state;constructor(e,t){this.node=e,this.state=t}},ht=(0,m.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},transitionDuration:{type:[String,Number,Object],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(e,t){const r=(0,m.getCurrentScope)(),s=e.multi===!0,i=(0,m.inject)(Ne,null),n=(0,m.inject)(Tt,0),o=(0,m.inject)(Er,null),u=(0,m.inject)(kt,-1);let l=null,a=e.modelSlot??null;if(a){if((0,m.provide)(Tt,n+1),(0,m.provide)(kt,a.index),(0,m.provide)(It,a.index),!a.route){console.warn("[Fox]child view render error, route not exist");return}const c=nt(a,!0);c&&(ti(c),Fr(c,()=>a?.route??null))}else{if(i==null){console.error("[Fox]router is not been injected");return}const c=e.name,h=(0,m.inject)(Pr,null),y=(0,m.inject)(It,0);if(l=i[Dr](c,n,o,u,h,y),l===null)return;(0,m.provide)(Pr,l);const d=l[G]===!0;if(d&&(0,m.provide)(Er,l),!s&&((0,m.provide)(kt,-1),(0,m.provide)(Tt,n+1),(0,m.provide)(It,-1),d&&r)){const p=nt(r,!0);p&&Fr(p,()=>{const w=l?.slots.value??[];return w.length>0?w[0].route:null})}}const f={value:new Map};return(0,m.onScopeDispose)(()=>{if(f.value&&f.value.clear(),a){const c=a;c.route=null,c.model=null,c.instance=null,a=null}}),()=>{if(s){const c=new Map,h=[],y=l?.slots.value,d=[];for(let b=0;b<y.length;b++){const v=y[b],L=`${e.name}_${v.index}`,M=se(e.transition,v.route,b)??!0,Pe={modelSlot:v};let T;t.slots.default?T=(0,m.h)(ht,Pe,{default:t.slots.default}):T=(0,m.h)(ht,Pe);const $={},ne=se(e.viewClass,v.route,b);typeof ne=="string"&&ne.length>0&&($[ne]=!0);const ee=se(e.viewActiveClass,v.route,b),k=se(e.viewInactiveClass,v.route,b),Q=f.value.get(L);if(typeof ee=="string"&&ee.length>0&&($[ee]=v.active),typeof k=="string"&&k.length>0&&($[k]=!v.active),Q&&v.active!==Q.state){const lr=Q.node;v.active?d.unshift(()=>{const vt=()=>{const Ce=nt(v);Ce!=null&&Cr(Ce,ft.ACTIVATED)};gi(lr,e,v.route,b,M,vt)}):d.push(()=>{const vt=()=>{const Ce=nt(v);Ce!=null&&Cr(Ce,ft.INACTIVATED)};bi(lr,e,v.route,b,M,vt)})}const U={class:$,key:L},V=se(e.viewTagProps,v.route,b);V!==null&&typeof V=="object"&&q(!0,U,ve(V,i?.propsFilter)),v.route?.viewTagAttrs&&typeof v.route?.viewTagAttrs=="object"&&q(!0,U,ve(v.route.viewTagAttrs,i?.propsFilter));const de=(0,m.h)(se(e.viewTag,v.route,b),U,{default:()=>[T]});c.set(L,new Ri(de,v.active)),f.value.delete(L),M===!0?de.transition=zt(de,e,v.route,b):M==="custom"&&(de.transition=cs(de,e,v.route,b)),h.push(de)}f.value=c,wi(d);const p=se(e.tag,null,-1),w={};return Object.assign(w,t.attrs),(0,m.h)(p,w,{default:()=>h})}else if(a!=null){const c=a.model,h={};c.props&&(typeof c.props=="object"?q(!1,h,ve(c.props,i?.propsFilter)):c.props===!0&&typeof a.route?.params=="object"&&q(!1,h,ve(a.route.params,i?.propsFilter)));const y=(0,m.h)(c.component,h);return Bt(t.slots.default,{Component:y,route:a.route})??y}else{const c=l?.slots.value??[];if(c.length>0){const h=c[0],y=h.route,d=h.model,p={};d.props&&(typeof d.props=="object"?q(!1,p,ve(d.props,i?.propsFilter)):d.props===!0&&typeof y?.params=="object"&&q(!1,p,ve(y.params,i?.propsFilter)));const w=(0,m.h)(d.component,p);return(se(e.transition,y,-1)??!0)&&(w.transition=zt(w,e,y,-1)),Bt(t.slots.default,{Component:w,route:y})??w}else return Bt(t.slots.fallback,{})}}}});function xi(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!=null&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){const t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function Si(e,t){return e==null||t==null?!1:!!(e.path&&t.path&&t.path.startsWith(e.path)||e.name&&e.name==t.name)}function ge(e,t){return typeof e=="function"?Reflect.apply(e,{},[t]):e}var hs=(0,m.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(e,t){const r=(0,m.inject)(Ne,null);return()=>{let s=ge(e.to,null),i=ge(e.tag,s);if(i==null){console.warn("[Fox]can not resolve link tag");return}let n=null,o=null;r!==null&&(n=r[B](s),e.root&&(n.root=e.root),o=r.currentRoute.value);let u={},l=ge(e.activeClass,n);if(typeof l=="string"&&l.length>0&&(u[l]=Si(n,o)),ge(e.exact,n)===!0){let c=ge(e.exactActiveClass,n);typeof c=="string"&&c.length>0&&(u[c]=S.isSamePathForRoute(n,o))}let a={class:u};(i==="a"||i==="A")&&(a.href=n?.path??n?.name??"#"),q(!0,a,t.attrs);const f=ge(e.event,n);if(typeof f=="string"){const c=h=>{if(r==null){console.warn("[Fox]router is not been injected");return}if(n==null){console.warn("[Fox]route is not been resolved");return}xi(h)&&r.to(n)};a[f]=c}return(0,m.h)(i,a,t.slots)}}}),lt=(function(e){return e[e.limitless=0]="limitless",e[e.once=1]="once",e})(lt||{}),be=Symbol("registerKey"),Ei=class{policy;callback;constructor(e,t){this.callback=e,this.policy=t}},Gt=class{[be]=new Map;constructor(){}on(e,t,r=!1){let s=this[be].get(e);s||(s=new Array,this[be].set(e,s));let i=new Ei(t,r===!0?lt.once:lt.limitless);return s.push(i),this}off(e,t){if(!t)return this[be].delete(e),this;let r=this[be].get(e);if(r){for(let s=0;s<r.length;s++)if(r[s].callback===t){r.splice(s,1);break}}return this}bind(e,t,r=!1){return this.on(e,t,r)}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 r=e[t-1];if(typeof r!="function")return console.error("[Fox]callback can not be empty"),this;let s=t-1,i=new Array(s),n=[].splice.call(e,0,s);for(let o=0;o<n.length;o++)this.once(n[o],u=>{i[o]=u,s-=1,s==0&&Reflect.apply(r,{},i)});return this}emit(e,...t){let r=this[be].get(e);if(!r)return this;for(let s=0;s<r.length;){let i=r[s];if(i.policy==lt.once?r.splice(s,1):s++,typeof i.callback=="function")try{Be(()=>{Reflect.apply(i.callback,{},t)})}catch(n){console.error(n.message,n)}}return this}trigger(e,...t){return Reflect.apply(this.emit,this,[e,...t])}},Pi="FoxRouterView",Ci="FoxRouterLink",N=(function(e){return e[e.Loading=0]="Loading",e[e.Loaded=1]="Loaded",e[e.Defining=2]="Defining",e[e.Defined=3]="Defined",e})({});function Fi(e){return e==N.Loaded||e===N.Defined}var _r=(function(e){return e[e.normal=0]="normal",e[e.factory=1]="factory",e})({}),_i=class{register=new Map;regExpRegisters=[];constructor(){}get(e){let t=this.register.get(e)??null;return t||(t=this.regExpRegisters.find(r=>r.pattern?.test(e))?.module??null),t}has(e){return!!this.get(e)}set(e,t){if(typeof e=="string")this.register.set(e,t);else if(e instanceof RegExp){const r=this.regExpRegisters.find(s=>(s.pattern?.source??"")===(e?.source??""));r?r.module=t:this.regExpRegisters.push({pattern:e,module:t})}}remove(e){if(typeof e=="string"){const t=this.register.get(e);return this.register.delete(e),t??null}else if(e instanceof RegExp){const t=this.regExpRegisters.findIndex(r=>(r.pattern?.source??"")===(e?.source??""));if(t!==-1){const r=this.regExpRegisters[t].module??null;return this.regExpRegisters.splice(t,1),r}}return null}clear(){this.register.clear(),this.regExpRegisters=[]}},Ot=["require","exports","module"];async function Ai(e){return await new Function("url","return import(url)")(e)}var Ar=class{moduleManager=new _i;_alias={};set alias(e){this._alias=e}get alias(){return this._alias}_resourceParser;set resourceParser(e){this._resourceParser=e}get resourceParser(){return this._resourceParser}_timeout;set timeout(e){this._timeout=e}get timeout(){return this._timeout}_query;set query(e){this._query=e}get query(){return this._query}get head(){return Ve().head}_cssMountPoint=null;set cssMountPoint(e){this._cssMountPoint=e}get cssMountPoint(){return this._cssMountPoint}_jsMountPoint=null;set jsMountPoint(e){this._jsMountPoint=e}get jsMountPoint(){return this._jsMountPoint}setModule(e,t){const r={id:typeof e=="string"?e:e?.source,src:"",status:N.Loaded};typeof t=="function"?(r.exports=t,r.type=_r.factory):r.exports=t,this.moduleManager.set(e,r)}removeModule(e){this.moduleManager.remove(e)}getModuleExports(e){const t=this.moduleManager.get(e);return t&&Fi(t.status)?t.type===_r.factory&&typeof t.exports=="function"?t.exports():t.exports:null}exposeRequire(e="__foxRequire",t,r){const s=t??A();return s&&typeof s=="object"?(s[e]=i=>{const n=this.getModuleExports(i);return r&&!n&&console.error(`[Fox] module:${i}, not found!`),n},!0):!1}resloveResource(e){if(typeof e=="string"){if(Ot.includes(e))return e;if(e=this.alias?.[e]??e,typeof this.resourceParser=="function"){const r=this.resloveResource(e);if(!r)return r}const t=this.getResourcePathSuffix(e);if(t==="mjs")return{path:e,type:"js",format:"es"};if(t==="js")return{path:e,type:"js",format:"umd"};if(t==="css")return{path:e,type:"css"}}return e}ensure(...e){return new Promise((t,r)=>{if(e.length<=0){r("args is empty");return}const s=[];let i=e.length-1,n=null;typeof e[i]=="function"&&(n=e[i],i--);for(let l=0;l<=i;l++)if(Array.isArray(e[l])){const a=e[l];for(let f=0;f<a.length;f++){const c=this.resloveResource(a[f]);s.push(c)}}else if(typeof e[l]=="string"){const a=this.resloveResource(e[l]);s.push(a)}const o=new ji(s.length,(l,a)=>{if(o.isOK())try{typeof n=="function"&&Reflect.apply(n,{},a),t(a)}catch(f){console.error(f),r(f)}else try{console.error(l),typeof n=="function"&&Reflect.apply(n,{},[]),r(l)}catch(f){console.error(f),r(f)}}),u=new He;for(let l=0;l<s.length;l++){const a=new qi(l,s[l],o);this.mount(u,a)}return this})}remove(...e){return new Promise((t,r)=>{if(e.length<=0){r("args is empty");return}const s=[];let i=e.length-1,n=null;typeof e[i]=="function"&&(n=e[i],i--);for(let o=0;o<=i;o++)if(Array.isArray(e[o])){const u=e[o];for(let l=0;l<u.length;l++){const a=this.resloveResource(u[l]);s.push(a)}}else if(typeof e[o]=="string"){const u=this.resloveResource(e[o]);s.push(u)}for(let o=0;o<s.length;o++)try{this.unmount(s[o])}catch(u){console.error(u)}typeof n=="function"&&Reflect.apply(n,{},[!0]),t(!0)})}mount(e,t){if(!t.resource){e.post(s=>{t.progress.work(!1,t.index,null),s.resolve()});return}if(typeof t.resource=="string"){if(Ot.includes(t.resource)){e.post(i=>{t.progress.work(!0,t.index,t.resource),i.resolve()});return}const s=this.getModuleExports(t.resource);if(s){e.post(i=>{t.progress.work(!0,t.index,s),i.resolve()});return}}const r=t.resource;if(r.type==="js")if(r.format==="es")this.mountCJS(e,t);else{const s=this.jsMountPoint??this.head;this.mountJS(e,t,s)}else{const s=this.cssMountPoint??this.head;this.mountCSS(e,t,s)}}mountCSS(e,t,r){e.post(s=>{const i=t.resource,n=this.getModuleExports(i.path);if(n){t.progress.work(!0,t.index,n),s.resolve();return}const o=Ve(),u=o.createElement("link"),l="onload"in u;l&&(u.onload=()=>{u.onload=null,u.onerror=null,t.progress.work(!0,t.index,i.path),s.resolve()},u.onerror=()=>{try{r.removeChild(u)}catch(c){console.error(c)}u.onload=null,u.onerror=null,t.progress.work(!1,t.index,null),s.reject()});const a=this.constructResourceUri(i.path),f=o.getElementById(i.path);f&&f.parentNode&&f.parentNode.removeChild(f),u.rel="stylesheet",u.type="text/css",u.id=i.path,u.href=a,r.appendChild(u),l||(t.progress.work(!0,t.index,i.path),s.resolve())})}mountJS(e,t,r){e.post(s=>{const i=t.resource,n=this.getModuleExports(i.path);if(n){t.progress.work(!0,t.index,n),s.resolve();return}const o={id:i.path,src:i.path,status:N.Loading};this.moduleManager.set(i.path,o);const u=Ve().createElement("script");if("onload"in u)u.onload=()=>{u.onload=null,u.onerror=null,o.status===N.Loading&&(o.status=N.Loaded,t.progress.work(!0,t.index,i.path)),s.resolve()},u.onerror=()=>{try{r.removeChild(u)}catch(h){console.error(h)}u.onload=null,u.onerror=null,this.moduleManager.remove(i.path),t.progress.work(!1,t.index,null),s.resolve()};else{const h=u;h.onreadystatechange=()=>{/loaded|complete/.test(h.readyState)&&(h.onreadystatechange=null,o.status==N.Loading&&(o.status=N.Loaded,t.progress.work(!0,t.index,i.path)),s.resolve())}}const l=this.constructResourceUri(i.path);u.defer=!0,u.src=l;const a=A(),f=this.createRequireLoad();a.__require=a.__require??a.require,a.require=f;const c=this.createDefine(o,f,t);a.__define=a.__define??a.define,a.define=c,typeof t.progress.finalCallback!="function"&&(t.progress.finalCallback=function(){a.require=a.__require,a.__require=void 0,a.define=a.__define,a.__define=void 0}),r.appendChild(u)})}mountCJS(e,t){e.post(async r=>{const s=t.resource,i=this.getModuleExports(s.path);if(i){t.progress.work(!0,t.index,i),r.resolve();return}try{let n=await Ai(s.path);if(dt(n)&&(n=n.default??n),Ee(n)){t.progress.work(!1,t.index,n),r.resolve();return}const o={id:s.path,src:s.path,status:N.Loaded,exports:n};this.moduleManager.set(s.path,o),t.progress.work(!0,t.index,n),r.resolve()}catch(n){console.error(n),t.progress.work(!1,t.index,null),r.resolve()}})}unmount(e){let t="",r="";typeof e=="string"?(this.moduleManager.remove(e),r=this.getResourcePathSuffix(e),t=e):(this.moduleManager.remove(e.path),r=e.type==="css"?"css":e.format??"",t=e.path);const s=Ve();if(r==="umd"){let i=s.getElementById(t);i||(i=s.querySelector(`script[src="${t}"]`)),i&&i.remove()}else if(r==="css"){let i=s.getElementById(t);if(!i){const n=this.constructResourceUri(t);i=s.querySelector(`link[href="${n}"]`)}i&&i.remove()}}trimEmptyElement(e){const t=[];for(let r=0;r<e.length;r++){let s=e[r];s!=null&&(s=s.trim(),s.length!==0&&t.push(s))}return t}createDefine(e,t,r){const s=this,i=function(...n){e.status=N.Defining;let o,u,l,a=n.length;if(a===1?(l=n[0],o=void 0):a===2?(l=n[1],Array.isArray(n[0])?(u=s.trimEmptyElement(n[0]),o=void 0):u=void 0):(o=n[0],u=s.trimEmptyElement(n[1]),l=n[2]),o&&(e.id=o,typeof s._alias=="object"&&(s._alias[o]=e.src)),u&&u.length>0)s.ensure(u,(...f)=>{try{const c=f.map(h=>h==="exports"?((!e.exports||typeof e.exports!="object")&&(e.exports={}),e.exports):h==="module"?e:h==="require"?t:h);if(typeof l=="function"){const h=Reflect.apply(l,e,c);h&&typeof h=="object"&&(e.exports=h)}else e.exports=l;e.status=N.Defined,r.progress.work(!0,r.index,e.exports)}catch(c){console.error(c),r.progress.work(!1,r.index,[])}});else{if(typeof l=="function"){const f=Reflect.apply(l,e,[]);f&&typeof f=="object"&&(e.exports=e.exports??{},Object.assign(e.exports,f))}else e.exports=l;e.status=N.Defined,r.progress.work(!0,r.index,e.exports)}};return i.amd=!0,i}createRequireLoad(){return e=>(e=this._alias?.[e]??e,this.getModuleExports(e))}constructResourceUri(e){try{if(Ot.includes(e)||!this.query)return e;const t=this.createSearch(this.query);return e.indexOf("?")==-1?e+=`?${t}`:t.length>0&&(e+=`&${t}`),e}catch(t){throw console.error(`[Fox]resolve path[${e}] fail`,t),t}}createSearch(e){let t="";if(e&&typeof e=="object"){for(let r in e){let s=`${e[r]}`;t+=`${encodeURIComponent(r)}=${encodeURIComponent(s)}&`}t.length>0&&(t=t.substring(0,t.length-1))}return t}getResourcePathSuffix(e){let t=e.lastIndexOf("?");t==-1&&(t=e.length);let r=e.lastIndexOf(".",t);return r==-1?"":e.substring(r+1,t)}},ji=class{finalCallback;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,r){if(this.status=e,this.status===!0&&(this.lastIndex!==t&&this.size--,this.lastIndex=t,this.values[t]=r),this.size===0||this.status===!1)try{Reflect.apply(this.callback,this,[this.status,this.values])}catch(s){console.error(s.message,s)}finally{typeof this.finalCallback=="function"&&(Reflect.apply(this.finalCallback,null,[]),this.finalCallback=null)}}isOK(){return this.status}},qi=class{index;resource;progress;constructor(e,t,r){this.index=e,this.resource=t,this.progress=r}},Xt=Symbol("fk"),Qt=Symbol("fbk"),Zt=Symbol("fepk");function $i(e={}){const t=new Wr(e),r=new Vt,s=new Gt,i=new Ar,n={get router(){return t},get bus(){return r},get Bus(){return Vt},get EventProxy(){return Gt},get eventproxy(){return s},get EventChain(){return He},get Require(){return Ar},get require(){return i},get isESModule(){return dt},install(o,u={}){o.provide(Ne,t),o.provide(Xt,n),o.provide(Qt,r),o.provide(Zt,s),u.install!==!1&&(o.component(Pi,ht),o.component(Ci,hs)),u.optionsApi!==!1&&(Reflect.defineProperty(o.config.globalProperties,"$fox",{get(){return n}}),Reflect.defineProperty(o.config.globalProperties,"$router",{get(){return t}}),Reflect.defineProperty(o.config.globalProperties,"$bus",{get(){return r}}),Reflect.defineProperty(o.config.globalProperties,"$bus",{get(){return r}}),Reflect.defineProperty(o.config.globalProperties,"$eventProxy",{get(){return s}}),o.config.globalProperties.$fox_on=function(l,a,f=!1){s.on(l,a,f)},o.config.globalProperties.$fox_off=function(l,a){s.off(l,a)},o.config.globalProperties.$fox_once=function(l,a){s.once(l,a)},o.config.globalProperties.$fox_all=function(...l){let a=s;Reflect.apply(a.all,a,l)},o.config.globalProperties.$fox_trigger=function(l,...a){let f=s;Reflect.apply(f.trigger,f,[l,...a])},o.config.globalProperties.$fox_emit=function(l,...a){let f=s;Reflect.apply(f.trigger,f,[l,...a])},o.mixin({setup(){return{$route:Jt()}}})),t.init()}};return n}function or(e){return(0,m.hasInjectionContext)()?(0,m.inject)(Ne,null):e?e.$?.appContext?.provides?.[Ne]??null:null}function Ki(e){let t=Jt(e);if(!t&&e&&!(0,m.hasInjectionContext)()){let r=e;for(r=r.$parent;r&&(t=Jt(r),!t);)r=r.$parent}return t}function Li(e){return(0,m.hasInjectionContext)()?(0,m.inject)(Xt,null):e?e.$?.appContext?.provides?.[Xt]??null:null}function Mi(e){return(0,m.hasInjectionContext)()?(0,m.inject)(Qt,null):e?e.$?.appContext?.provides?.[Qt]??null:null}function Ti(e){return(0,m.hasInjectionContext)()?(0,m.inject)(Zt,null):e?e.$?.appContext?.provides?.[Zt]??null:null}function ki(e){const t=or();if(!t){console.error("[Fox]router is not exist.");return}const r=(s,i,n)=>{try{Reflect.apply(e,{},[s,i])}catch(o){console.error(o)}n()};t?.beforeEach(r),(0,m.onScopeDispose)(()=>{t?.removeBeforeEach(r)})}function Ii(e){const t=or();if(!t){console.error("[Fox]router is not exist.");return}const r=(s,i,n)=>{try{Reflect.apply(e,{},[s,i])}catch(o){console.error(o)}n()};t?.afterEach(r),(0,m.onScopeDispose)(()=>{t?.removeAfterEach(r)})}exports.Bus=Vt;exports.EventChain=He;exports.EventProxy=Gt;exports.FoxBeforeEnter=Qr;exports.FoxBeforeLeave=Yr;exports.FoxEnter=Zr;exports.FoxLeave=es;exports.FoxLeaveEnd=ct;exports.OperationType=_;exports.Route=S;exports.Router=Wr;exports.RouterLink=hs;exports.RouterView=ht;exports.bindLifecycleContextToCurrentScope=Zs;exports.createFox=$i;exports.createMemoryHistory=Vr;exports.createWebHashHistory=Ur;exports.createWebHistory=Js;exports.deleteContextValue=ei;exports.extend=q;exports.injectContextValue=ir;exports.injectLifecycleContext=Ue;exports.isArray=Dt;exports.isDate=ms;exports.isESModule=dt;exports.isEqual=Ut;exports.isFunction=R;exports.isMap=ys;exports.isNil=Ee;exports.isObject=jr;exports.isPlainObject=qr;exports.isPromise=gs;exports.isSet=ds;exports.isString=ps;exports.isSymbol=vs;exports.onAfterRouteUpdate=Ii;exports.onBeforeRouteUpdate=ki;exports.onFoxActivated=ni;exports.onFoxInactivated=oi;exports.provideContextValue=Ys;exports.rawState=Ks;exports.reactiveState=js;exports.shallowReactiveState=qs;exports.toBoolean=er;exports.toNumber=xs;exports.toTypeString=yt;exports.typeOf=Nt;exports.useBus=Mi;exports.useEventProxy=Ti;exports.useFox=Li;exports.useRoute=Ki;exports.useRouter=or;exports.withLifecycleContext=zr;
@@ -133,11 +133,11 @@ declare type CustomTransition = 'custom';
133
133
 
134
134
  /**
135
135
  * 删除 context value
136
- * @param refKey
136
+ * @param contextRelationKey 上下文关联key
137
137
  * @param key
138
138
  *
139
139
  */
140
- export declare function deleteContextValue(refKey: LifecycleContextKey | null, key: KeyType_2, route?: Route): void;
140
+ export declare function deleteContextValue(contextRelationKey: FoxContextRelationKey | null, key: KeyType_2, route?: Route): void;
141
141
 
142
142
  declare const _destroy: unique symbol;
143
143
 
@@ -457,6 +457,12 @@ export declare const FoxBeforeEnter = "FoxBeforeEnter";
457
457
  */
458
458
  export declare const FoxBeforeLeave = "FoxLeave";
459
459
 
460
+ /**
461
+ * FoxContextKey
462
+ * 上下文key
463
+ */
464
+ declare type FoxContextRelationKey = Object;
465
+
460
466
  /**
461
467
  * Fox过渡进入事件
462
468
  */
@@ -533,17 +539,17 @@ declare const initKey: unique symbol;
533
539
 
534
540
  /**
535
541
  * inject context value
536
- * @param refKey
542
+ * @param contextRelationKey 上下文关联key
537
543
  * @param key
538
544
  * @returns
539
545
  */
540
- export declare function injectContextValue<T extends unknown>(refKey: LifecycleContextKey | null, key: KeyType_2): T | null;
546
+ export declare function injectContextValue<T extends unknown>(contextRelationKey: FoxContextRelationKey | null, key: KeyType_2): T | null;
541
547
 
542
548
  /**
543
549
  * inject Lifecycle context
544
- * @param refKey
550
+ * @param contextRelationKey 上下文关联key
545
551
  */
546
- export declare function injectLifecycleContext(refKey?: LifecycleContextKey | null): LifecycleContext | null;
552
+ export declare function injectLifecycleContext(contextRelationKey?: FoxContextRelationKey | null): LifecycleContext | null;
547
553
 
548
554
  /**
549
555
  * 是否数组
@@ -635,6 +641,9 @@ export declare const isString: (val: unknown) => val is string;
635
641
  */
636
642
  export declare const isSymbol: (val: unknown) => val is symbol;
637
643
 
644
+ /**
645
+ * 数据类型key
646
+ */
638
647
  declare type KeyType_2 = string | number | Symbol;
639
648
 
640
649
  /**
@@ -685,11 +694,6 @@ declare class LifecycleContext {
685
694
  delete(key: KeyType_2): boolean;
686
695
  }
687
696
 
688
- /**
689
- * LifecycleContextKey
690
- */
691
- declare type LifecycleContextKey = Object;
692
-
693
697
  declare const _load: unique symbol;
694
698
 
695
699
  declare const mainDispatcherKey: unique symbol;
@@ -902,11 +906,11 @@ declare const propsFilterKey: unique symbol;
902
906
 
903
907
  /**
904
908
  * provide context value
905
- * @param refkey
909
+ * @param contextRelationKey 上下文关联key
906
910
  * @param key
907
911
  * @param value
908
912
  */
909
- export declare function provideContextValue(refKey: LifecycleContextKey | null, key: KeyType_2, value: any, route?: Route): void;
913
+ export declare function provideContextValue(contextRelationKey: FoxContextRelationKey | null, key: KeyType_2, value: any): void;
910
914
 
911
915
  /**
912
916
  * raw state
@@ -932,6 +936,9 @@ declare const registerKey: unique symbol;
932
936
 
933
937
  declare const registerKey_2: unique symbol;
934
938
 
939
+ /**
940
+ * 注册表key
941
+ */
935
942
  declare const registerKey_3: unique symbol;
936
943
 
937
944
  /**
@@ -2574,7 +2581,7 @@ declare const sync: unique symbol;
2574
2581
  /**
2575
2582
  * Task类型
2576
2583
  */
2577
- declare interface Task {
2584
+ export declare interface Task {
2578
2585
  (context: EventChainContext, ...args: any[]): void;
2579
2586
  }
2580
2587
 
@@ -2745,33 +2752,38 @@ declare enum UpdateType {
2745
2752
 
2746
2753
  /**
2747
2754
  * Returns the global bus
2755
+ * @param contextRelationKey 上下文关联key
2748
2756
  * @returns
2749
2757
  */
2750
- export declare function useBus(): BusInterface | null;
2758
+ export declare function useBus(contextRelationKey?: FoxContextRelationKey): BusInterface | null;
2751
2759
 
2752
2760
  /**
2753
2761
  * Returns the global event proxy
2754
2762
  * @returns
2755
2763
  */
2756
- export declare function useEventProxy(): EventProxy | null;
2764
+ export declare function useEventProxy(contextRelationKey?: FoxContextRelationKey): EventProxy | null;
2757
2765
 
2758
2766
  /**
2759
2767
  * Returns the current fox
2768
+ * @param contextRelationKey 上下文关联key
2769
+ *
2760
2770
  * @returns
2761
2771
  */
2762
- export declare function useFox(): Fox | null;
2772
+ export declare function useFox(contextRelationKey?: FoxContextRelationKey): Fox | null;
2763
2773
 
2764
2774
  /**
2765
2775
  * Returns the current route
2776
+ * @param 上下文关联key
2766
2777
  * @returns
2767
2778
  */
2768
- export declare function useRoute(refkey?: LifecycleContextKey): Route | null;
2779
+ export declare function useRoute(contextRelationKey?: FoxContextRelationKey): Route | null;
2769
2780
 
2770
2781
  /**
2771
2782
  * Returns the current router
2783
+ * @param 上下文关联key
2772
2784
  * @returns
2773
2785
  */
2774
- export declare function useRouter(): Router | null;
2786
+ export declare function useRouter(contextRelationKey?: FoxContextRelationKey): Router | null;
2775
2787
 
2776
2788
  declare const valueKey: unique symbol;
2777
2789