UNPKG

@drincs/pixi-vn

Version:

Pixi'VN is a npm package that provides various features for creating visual novels.

2 lines 22.5 kB
import {d,f,e,g,h,i}from'./chunk-FIGGUFAM.mjs';var kt=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Gt=new Set,zt=typeof process=="object"&&process?process:{},Mt=(_,e,i,s)=>{typeof zt.emitWarning=="function"?zt.emitWarning(_,e,i,s):console.error(`[${i}] ${e}: ${_}`);},Ft=globalThis.AbortController,Dt=globalThis.AbortSignal;if(typeof Ft>"u"){Dt=class{constructor(){d(this,"onabort");d(this,"_onabort",[]);d(this,"reason");d(this,"aborted",false);}addEventListener(i,s){this._onabort.push(s);}},Ft=class{constructor(){d(this,"signal",new Dt);e();}abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let _=zt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{_&&(_=false,Mt("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e));};}var Ht=_=>!Gt.has(_);var tt=_=>_&&_===Math.floor(_)&&_>0&&isFinite(_),jt=_=>tt(_)?_<=Math.pow(2,8)?Uint8Array:_<=Math.pow(2,16)?Uint16Array:_<=Math.pow(2,32)?Uint32Array:_<=Number.MAX_SAFE_INTEGER?yt:null:null,yt=class extends Array{constructor(_){super(_),this.fill(0);}},J,ft,Vt=(J=class{constructor(e$1,i){d(this,"heap");d(this,"length");if(!e(J,ft))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e$1),this.length=0;}static create(e){let i=jt(e);if(!i)return [];g(J,ft,true);let s=new J(e,i);return g(J,ft,false),s}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},ft=new WeakMap,f(J,ft,false),J),Lt,Ut,k,U,H,ot,V,ct,dt,K,F,P,O,b,c,W,G,x,E,B,T,$,q,M,j,X,ht,D,gt,o,xt,rt,Q,St,I,Nt,nt,pt,bt,et,it,Ct,At,Ot,S,Rt,vt,st,Wt,wt,It=(wt=class{constructor(e$1){f(this,o);f(this,k);f(this,U);f(this,H);f(this,ot);f(this,V);f(this,ct);f(this,dt);f(this,K);d(this,"ttl");d(this,"ttlResolution");d(this,"ttlAutopurge");d(this,"updateAgeOnGet");d(this,"updateAgeOnHas");d(this,"allowStale");d(this,"noDisposeOnSet");d(this,"noUpdateTTL");d(this,"maxEntrySize");d(this,"sizeCalculation");d(this,"noDeleteOnFetchRejection");d(this,"noDeleteOnStaleGet");d(this,"allowStaleOnFetchAbort");d(this,"allowStaleOnFetchRejection");d(this,"ignoreFetchAbort");f(this,F);f(this,P);f(this,O);f(this,b);f(this,c);f(this,W);f(this,G);f(this,x);f(this,E);f(this,B);f(this,T);f(this,$);f(this,q);f(this,M);f(this,j);f(this,X);f(this,ht);f(this,D);f(this,gt);f(this,rt,()=>{});f(this,Q,()=>{});f(this,St,()=>{});f(this,I,()=>false);f(this,nt,e=>{});f(this,pt,(e,i,s)=>{});f(this,bt,(e,i,s,h)=>{if(s||h)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});d(this,Lt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:h$1=1,ttlAutopurge:n,updateAgeOnGet:r,updateAgeOnHas:a,allowStale:u,dispose:p,onInsert:z,disposeAfter:w,noDisposeOnSet:Z,noUpdateTTL:N,maxSize:Y=0,maxEntrySize:y=0,sizeCalculation:v,fetchMethod:d$1,memoMethod:C,noDeleteOnFetchRejection:L,noDeleteOnStaleGet:R,allowStaleOnFetchRejection:A,allowStaleOnFetchAbort:mt,ignoreFetchAbort:lt,perf:at}=e$1;if(at!==void 0&&typeof at?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(g(this,K,at??kt),i!==0&&!tt(i))throw new TypeError("max option must be a nonnegative integer");let ut=i?jt(i):Array;if(!ut)throw new Error("invalid max value: "+i);if(g(this,k,i),g(this,U,Y),this.maxEntrySize=y||e(this,U),this.sizeCalculation=v,this.sizeCalculation){if(!e(this,U)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(C!==void 0&&typeof C!="function")throw new TypeError("memoMethod must be a function if defined");if(g(this,dt,C),d$1!==void 0&&typeof d$1!="function")throw new TypeError("fetchMethod must be a function if specified");if(g(this,ct,d$1),g(this,ht,!!d$1),g(this,O,new Map),g(this,b,new Array(i).fill(void 0)),g(this,c,new Array(i).fill(void 0)),g(this,W,new ut(i)),g(this,G,new ut(i)),g(this,x,0),g(this,E,0),g(this,B,Vt.create(i)),g(this,F,0),g(this,P,0),typeof p=="function"&&g(this,H,p),typeof z=="function"&&g(this,ot,z),typeof w=="function"?(g(this,V,w),g(this,T,[])):(g(this,V,void 0),g(this,T,void 0)),g(this,X,!!e(this,H)),g(this,gt,!!e(this,ot)),g(this,D,!!e(this,V)),this.noDisposeOnSet=!!Z,this.noUpdateTTL=!!N,this.noDeleteOnFetchRejection=!!L,this.allowStaleOnFetchRejection=!!A,this.allowStaleOnFetchAbort=!!mt,this.ignoreFetchAbort=!!lt,this.maxEntrySize!==0){if(e(this,U)!==0&&!tt(e(this,U)))throw new TypeError("maxSize must be a positive integer if specified");if(!tt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");h(this,o,Nt).call(this);}if(this.allowStale=!!u,this.noDeleteOnStaleGet=!!R,this.updateAgeOnGet=!!r,this.updateAgeOnHas=!!a,this.ttlResolution=tt(h$1)||h$1===0?h$1:1,this.ttlAutopurge=!!n,this.ttl=s||0,this.ttl){if(!tt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");h(this,o,xt).call(this);}if(e(this,k)===0&&this.ttl===0&&e(this,U)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!e(this,k)&&!e(this,U)){let Tt="LRU_CACHE_UNBOUNDED";Ht(Tt)&&(Gt.add(Tt),Mt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Tt,wt));}}get perf(){return e(this,K)}static unsafeExposeInternals(e$1){return {starts:e(e$1,q),ttls:e(e$1,M),autopurgeTimers:e(e$1,j),sizes:e(e$1,$),keyMap:e(e$1,O),keyList:e(e$1,b),valList:e(e$1,c),next:e(e$1,W),prev:e(e$1,G),get head(){return e(e$1,x)},get tail(){return e(e$1,E)},free:e(e$1,B),isBackgroundFetch:i=>{var s;return h(s=e$1,o,S).call(s,i)},backgroundFetch:(i,s,h$1,n)=>{var r;return h(r=e$1,o,Ot).call(r,i,s,h$1,n)},moveToTail:i=>{var s;return h(s=e$1,o,vt).call(s,i)},indexes:i=>{var s;return h(s=e$1,o,et).call(s,i)},rindexes:i=>{var s;return h(s=e$1,o,it).call(s,i)},isStale:i=>{var s;return e(s=e$1,I).call(s,i)}}}get max(){return e(this,k)}get maxSize(){return e(this,U)}get calculatedSize(){return e(this,P)}get size(){return e(this,F)}get fetchMethod(){return e(this,ct)}get memoMethod(){return e(this,dt)}get dispose(){return e(this,H)}get onInsert(){return e(this,ot)}get disposeAfter(){return e(this,V)}getRemainingTTL(e$1){return e(this,O).has(e$1)?1/0:0}*entries(){for(let e$1 of h(this,o,et).call(this))e(this,c)[e$1]!==void 0&&e(this,b)[e$1]!==void 0&&!h(this,o,S).call(this,e(this,c)[e$1])&&(yield [e(this,b)[e$1],e(this,c)[e$1]]);}*rentries(){for(let e$1 of h(this,o,it).call(this))e(this,c)[e$1]!==void 0&&e(this,b)[e$1]!==void 0&&!h(this,o,S).call(this,e(this,c)[e$1])&&(yield [e(this,b)[e$1],e(this,c)[e$1]]);}*keys(){for(let e$1 of h(this,o,et).call(this)){let i=e(this,b)[e$1];i!==void 0&&!h(this,o,S).call(this,e(this,c)[e$1])&&(yield i);}}*rkeys(){for(let e$1 of h(this,o,it).call(this)){let i=e(this,b)[e$1];i!==void 0&&!h(this,o,S).call(this,e(this,c)[e$1])&&(yield i);}}*values(){for(let e$1 of h(this,o,et).call(this))e(this,c)[e$1]!==void 0&&!h(this,o,S).call(this,e(this,c)[e$1])&&(yield e(this,c)[e$1]);}*rvalues(){for(let e$1 of h(this,o,it).call(this))e(this,c)[e$1]!==void 0&&!h(this,o,S).call(this,e(this,c)[e$1])&&(yield e(this,c)[e$1]);}[(Ut=Symbol.iterator,Lt=Symbol.toStringTag,Ut)](){return this.entries()}find(e$1,i={}){for(let s of h(this,o,et).call(this)){let h$1=e(this,c)[s],n=h(this,o,S).call(this,h$1)?h$1.__staleWhileFetching:h$1;if(n!==void 0&&e$1(n,e(this,b)[s],this))return this.get(e(this,b)[s],i)}}forEach(e$1,i=this){for(let s of h(this,o,et).call(this)){let h$1=e(this,c)[s],n=h(this,o,S).call(this,h$1)?h$1.__staleWhileFetching:h$1;n!==void 0&&e$1.call(i,n,e(this,b)[s],this);}}rforEach(e$1,i=this){for(let s of h(this,o,it).call(this)){let h$1=e(this,c)[s],n=h(this,o,S).call(this,h$1)?h$1.__staleWhileFetching:h$1;n!==void 0&&e$1.call(i,n,e(this,b)[s],this);}}purgeStale(){let e$1=false;for(let i of h(this,o,it).call(this,{allowStale:true}))e(this,I).call(this,i)&&(h(this,o,st).call(this,e(this,b)[i],"expire"),e$1=true);return e$1}info(e$1){let i=e(this,O).get(e$1);if(i===void 0)return;let s=e(this,c)[i],h$1=h(this,o,S).call(this,s)?s.__staleWhileFetching:s;if(h$1===void 0)return;let n={value:h$1};if(e(this,M)&&e(this,q)){let r=e(this,M)[i],a=e(this,q)[i];if(r&&a){let u=r-(e(this,K).now()-a);n.ttl=u,n.start=Date.now();}}return e(this,$)&&(n.size=e(this,$)[i]),n}dump(){let e$1=[];for(let i of h(this,o,et).call(this,{allowStale:true})){let s=e(this,b)[i],h$1=e(this,c)[i],n=h(this,o,S).call(this,h$1)?h$1.__staleWhileFetching:h$1;if(n===void 0||s===void 0)continue;let r={value:n};if(e(this,M)&&e(this,q)){r.ttl=e(this,M)[i];let a=e(this,K).now()-e(this,q)[i];r.start=Math.floor(Date.now()-a);}e(this,$)&&(r.size=e(this,$)[i]),e$1.unshift([s,r]);}return e$1}load(e$1){this.clear();for(let[i,s]of e$1){if(s.start){let h=Date.now()-s.start;s.start=e(this,K).now()-h;}this.set(i,s.value,s);}}set(e$1,i$1,s={}){var Z,N,Y,y;if(i$1===void 0)return this.delete(e$1),this;let{ttl:h$1=this.ttl,start:n,noDisposeOnSet:r=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:u}=s,{noUpdateTTL:p=this.noUpdateTTL}=s,z=e(this,bt).call(this,e$1,i$1,s.size||0,a);if(this.maxEntrySize&&z>this.maxEntrySize)return u&&(u.set="miss",u.maxEntrySizeExceeded=true),h(this,o,st).call(this,e$1,"set"),this;let w=e(this,F)===0?void 0:e(this,O).get(e$1);if(w===void 0)w=e(this,F)===0?e(this,E):e(this,B).length!==0?e(this,B).pop():e(this,F)===e(this,k)?h(this,o,At).call(this,false):e(this,F),e(this,b)[w]=e$1,e(this,c)[w]=i$1,e(this,O).set(e$1,w),e(this,W)[e(this,E)]=w,e(this,G)[w]=e(this,E),g(this,E,w),i(this,F)._++,e(this,pt).call(this,w,z,u),u&&(u.set="add"),p=false,e(this,gt)&&((Z=e(this,ot))==null||Z.call(this,i$1,e$1,"add"));else {h(this,o,vt).call(this,w);let v=e(this,c)[w];if(i$1!==v){if(e(this,ht)&&h(this,o,S).call(this,v)){v.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:d}=v;d!==void 0&&!r&&(e(this,X)&&((N=e(this,H))==null||N.call(this,d,e$1,"set")),e(this,D)&&e(this,T)?.push([d,e$1,"set"]));}else r||(e(this,X)&&((Y=e(this,H))==null||Y.call(this,v,e$1,"set")),e(this,D)&&e(this,T)?.push([v,e$1,"set"]));if(e(this,nt).call(this,w),e(this,pt).call(this,w,z,u),e(this,c)[w]=i$1,u){u.set="replace";let d=v&&h(this,o,S).call(this,v)?v.__staleWhileFetching:v;d!==void 0&&(u.oldValue=d);}}else u&&(u.set="update");e(this,gt)&&this.onInsert?.(i$1,e$1,i$1===v?"update":"replace");}if(h$1!==0&&!e(this,M)&&h(this,o,xt).call(this),e(this,M)&&(p||e(this,St).call(this,w,h$1,n),u&&e(this,Q).call(this,u,w)),!r&&e(this,D)&&e(this,T)){let v=e(this,T),d;for(;d=v?.shift();)(y=e(this,V))==null||y.call(this,...d);}return this}pop(){var e$1;try{for(;e(this,F);){let i=e(this,c)[e(this,x)];if(h(this,o,At).call(this,!0),h(this,o,S).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(e(this,D)&&e(this,T)){let i=e(this,T),s;for(;s=i?.shift();)(e$1=e(this,V))==null||e$1.call(this,...s);}}}has(e$1,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:h$1}=i,n=e(this,O).get(e$1);if(n!==void 0){let r=e(this,c)[n];if(h(this,o,S).call(this,r)&&r.__staleWhileFetching===void 0)return false;if(e(this,I).call(this,n))h$1&&(h$1.has="stale",e(this,Q).call(this,h$1,n));else return s&&e(this,rt).call(this,n),h$1&&(h$1.has="hit",e(this,Q).call(this,h$1,n)),true}else h$1&&(h$1.has="miss");return false}peek(e$1,i={}){let{allowStale:s=this.allowStale}=i,h$1=e(this,O).get(e$1);if(h$1===void 0||!s&&e(this,I).call(this,h$1))return;let n=e(this,c)[h$1];return h(this,o,S).call(this,n)?n.__staleWhileFetching:n}async fetch(e$1,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:h$1=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:r=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:u=0,sizeCalculation:p=this.sizeCalculation,noUpdateTTL:z=this.noUpdateTTL,noDeleteOnFetchRejection:w=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:Z=this.allowStaleOnFetchRejection,ignoreFetchAbort:N=this.ignoreFetchAbort,allowStaleOnFetchAbort:Y=this.allowStaleOnFetchAbort,context:y,forceRefresh:v=false,status:d,signal:C}=i;if(!e(this,ht))return d&&(d.fetch="get"),this.get(e$1,{allowStale:s,updateAgeOnGet:h$1,noDeleteOnStaleGet:n,status:d});let L={allowStale:s,updateAgeOnGet:h$1,noDeleteOnStaleGet:n,ttl:r,noDisposeOnSet:a,size:u,sizeCalculation:p,noUpdateTTL:z,noDeleteOnFetchRejection:w,allowStaleOnFetchRejection:Z,allowStaleOnFetchAbort:Y,ignoreFetchAbort:N,status:d,signal:C},R=e(this,O).get(e$1);if(R===void 0){d&&(d.fetch="miss");let A=h(this,o,Ot).call(this,e$1,R,L,y);return A.__returned=A}else {let A=e(this,c)[R];if(h(this,o,S).call(this,A)){let ut=s&&A.__staleWhileFetching!==void 0;return d&&(d.fetch="inflight",ut&&(d.returnedStale=true)),ut?A.__staleWhileFetching:A.__returned=A}let mt=e(this,I).call(this,R);if(!v&&!mt)return d&&(d.fetch="hit"),h(this,o,vt).call(this,R),h$1&&e(this,rt).call(this,R),d&&e(this,Q).call(this,d,R),A;let lt=h(this,o,Ot).call(this,e$1,R,L,y),at=lt.__staleWhileFetching!==void 0&&s;return d&&(d.fetch=mt?"stale":"refresh",at&&mt&&(d.returnedStale=true)),at?lt.__staleWhileFetching:lt.__returned=lt}}async forceFetch(e,i={}){let s=await this.fetch(e,i);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(e$1,i={}){let s=e(this,dt);if(!s)throw new Error("no memoMethod provided to constructor");let{context:h,forceRefresh:n,...r}=i,a=this.get(e$1,r);if(!n&&a!==void 0)return a;let u=s(e$1,a,{options:r,context:h});return this.set(e$1,u,r),u}get(e$1,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:h$1=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:r}=i,a=e(this,O).get(e$1);if(a!==void 0){let u=e(this,c)[a],p=h(this,o,S).call(this,u);return r&&e(this,Q).call(this,r,a),e(this,I).call(this,a)?(r&&(r.get="stale"),p?(r&&s&&u.__staleWhileFetching!==void 0&&(r.returnedStale=true),s?u.__staleWhileFetching:void 0):(n||h(this,o,st).call(this,e$1,"expire"),r&&s&&(r.returnedStale=true),s?u:void 0)):(r&&(r.get="hit"),p?u.__staleWhileFetching:(h(this,o,vt).call(this,a),h$1&&e(this,rt).call(this,a),u))}else r&&(r.get="miss");}delete(e){return h(this,o,st).call(this,e,"delete")}clear(){return h(this,o,Wt).call(this,"delete")}},k=new WeakMap,U=new WeakMap,H=new WeakMap,ot=new WeakMap,V=new WeakMap,ct=new WeakMap,dt=new WeakMap,K=new WeakMap,F=new WeakMap,P=new WeakMap,O=new WeakMap,b=new WeakMap,c=new WeakMap,W=new WeakMap,G=new WeakMap,x=new WeakMap,E=new WeakMap,B=new WeakMap,T=new WeakMap,$=new WeakMap,q=new WeakMap,M=new WeakMap,j=new WeakMap,X=new WeakMap,ht=new WeakMap,D=new WeakMap,gt=new WeakMap,o=new WeakSet,xt=function(){let e$1=new yt(e(this,k)),i=new yt(e(this,k));g(this,M,e$1),g(this,q,i);let s=this.ttlAutopurge?new Array(e(this,k)):void 0;g(this,j,s),g(this,St,(a,u,p=e(this,K).now())=>{i[a]=u!==0?p:0,e$1[a]=u,h$1(a,u);}),g(this,rt,a=>{i[a]=e$1[a]!==0?e(this,K).now():0,h$1(a,e$1[a]);});let h$1=this.ttlAutopurge?(a,u)=>{if(s?.[a]&&(clearTimeout(s[a]),s[a]=void 0),u&&u!==0&&s){let p=setTimeout(()=>{e(this,I).call(this,a)&&h(this,o,st).call(this,e(this,b)[a],"expire");},u+1);p.unref&&p.unref(),s[a]=p;}}:()=>{};g(this,Q,(a,u)=>{if(e$1[u]){let p=e$1[u],z=i[u];if(!p||!z)return;a.ttl=p,a.start=z,a.now=n||r();let w=a.now-z;a.remainingTTL=p-w;}});let n=0,r=()=>{let a=e(this,K).now();if(this.ttlResolution>0){n=a;let u=setTimeout(()=>n=0,this.ttlResolution);u.unref&&u.unref();}return a};this.getRemainingTTL=a=>{let u=e(this,O).get(a);if(u===void 0)return 0;let p=e$1[u],z=i[u];if(!p||!z)return 1/0;let w=(n||r())-z;return p-w},g(this,I,a=>{let u=i[a],p=e$1[a];return !!p&&!!u&&(n||r())-u>p});},rt=new WeakMap,Q=new WeakMap,St=new WeakMap,I=new WeakMap,Nt=function(){let e$1=new yt(e(this,k));g(this,P,0),g(this,$,e$1),g(this,nt,i=>{g(this,P,e(this,P)-e$1[i]),e$1[i]=0;}),g(this,bt,(i,s,h$1,n)=>{if(h(this,o,S).call(this,s))return 0;if(!tt(h$1))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(h$1=n(s,i),!tt(h$1))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return h$1}),g(this,pt,(i,s,h$1)=>{if(e$1[i]=s,e(this,U)){let n=e(this,U)-e$1[i];for(;e(this,P)>n;)h(this,o,At).call(this,true);}g(this,P,e(this,P)+e$1[i]),h$1&&(h$1.entrySize=s,h$1.totalCalculatedSize=e(this,P));});},nt=new WeakMap,pt=new WeakMap,bt=new WeakMap,et=function*({allowStale:e$1=this.allowStale}={}){if(e(this,F))for(let i=e(this,E);!(!h(this,o,Ct).call(this,i)||((e$1||!e(this,I).call(this,i))&&(yield i),i===e(this,x)));)i=e(this,G)[i];},it=function*({allowStale:e$1=this.allowStale}={}){if(e(this,F))for(let i=e(this,x);!(!h(this,o,Ct).call(this,i)||((e$1||!e(this,I).call(this,i))&&(yield i),i===e(this,E)));)i=e(this,W)[i];},Ct=function(e$1){return e$1!==void 0&&e(this,O).get(e(this,b)[e$1])===e$1},At=function(e$1){var n;let i$1=e(this,x),s=e(this,b)[i$1],h$1=e(this,c)[i$1];return e(this,ht)&&h(this,o,S).call(this,h$1)?h$1.__abortController.abort(new Error("evicted")):(e(this,X)||e(this,D))&&(e(this,X)&&((n=e(this,H))==null||n.call(this,h$1,s,"evict")),e(this,D)&&e(this,T)?.push([h$1,s,"evict"])),e(this,nt).call(this,i$1),e(this,j)?.[i$1]&&(clearTimeout(e(this,j)[i$1]),e(this,j)[i$1]=void 0),e$1&&(e(this,b)[i$1]=void 0,e(this,c)[i$1]=void 0,e(this,B).push(i$1)),e(this,F)===1?(g(this,x,g(this,E,0)),e(this,B).length=0):g(this,x,e(this,W)[i$1]),e(this,O).delete(s),i(this,F)._--,i$1},Ot=function(e$1,i,s,h$1){let n=i===void 0?void 0:e(this,c)[i];if(h(this,o,S).call(this,n))return n;let r=new Ft,{signal:a}=s;a?.addEventListener("abort",()=>r.abort(a.reason),{signal:r.signal});let u={signal:r.signal,options:s,context:h$1},p=(y,v=false)=>{let{aborted:d}=r.signal,C=s.ignoreFetchAbort&&y!==void 0,L=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&y!==void 0);if(s.status&&(d&&!v?(s.status.fetchAborted=true,s.status.fetchError=r.signal.reason,C&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),d&&!C&&!v)return w(r.signal.reason,L);let R=N,A=e(this,c)[i];return (A===N||C&&v&&A===void 0)&&(y===void 0?R.__staleWhileFetching!==void 0?e(this,c)[i]=R.__staleWhileFetching:h(this,o,st).call(this,e$1,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e$1,y,u.options))),y},z=y=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=y),w(y,false)),w=(y,v)=>{let{aborted:d}=r.signal,C=d&&s.allowStaleOnFetchAbort,L=C||s.allowStaleOnFetchRejection,R=L||s.noDeleteOnFetchRejection,A=N;if(e(this,c)[i]===N&&(!R||!v&&A.__staleWhileFetching===void 0?h(this,o,st).call(this,e$1,"fetch"):C||(e(this,c)[i]=A.__staleWhileFetching)),L)return s.status&&A.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),A.__staleWhileFetching;if(A.__returned===A)throw y},Z=(y,v)=>{var C;let d=(C=e(this,ct))==null?void 0:C.call(this,e$1,n,u);d&&d instanceof Promise&&d.then(L=>y(L===void 0?void 0:L),v),r.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(y(void 0),s.allowStaleOnFetchAbort&&(y=L=>p(L,true)));});};s.status&&(s.status.fetchDispatched=true);let N=new Promise(Z).then(p,z),Y=Object.assign(N,{__abortController:r,__staleWhileFetching:n,__returned:void 0});return i===void 0?(this.set(e$1,Y,{...u.options,status:void 0}),i=e(this,O).get(e$1)):e(this,c)[i]=Y,Y},S=function(e$1){if(!e(this,ht))return false;let i=e$1;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Ft},Rt=function(e$1,i){e(this,G)[i]=e$1,e(this,W)[e$1]=i;},vt=function(e$1){e$1!==e(this,E)&&(e$1===e(this,x)?g(this,x,e(this,W)[e$1]):h(this,o,Rt).call(this,e(this,G)[e$1],e(this,W)[e$1]),h(this,o,Rt).call(this,e(this,E),e$1),g(this,E,e$1));},st=function(e$1,i$1){var h$1,n;let s=false;if(e(this,F)!==0){let r=e(this,O).get(e$1);if(r!==void 0)if(e(this,j)?.[r]&&(clearTimeout(e(this,j)?.[r]),e(this,j)[r]=void 0),s=true,e(this,F)===1)h(this,o,Wt).call(this,i$1);else {e(this,nt).call(this,r);let a=e(this,c)[r];if(h(this,o,S).call(this,a)?a.__abortController.abort(new Error("deleted")):(e(this,X)||e(this,D))&&(e(this,X)&&((h$1=e(this,H))==null||h$1.call(this,a,e$1,i$1)),e(this,D)&&e(this,T)?.push([a,e$1,i$1])),e(this,O).delete(e$1),e(this,b)[r]=void 0,e(this,c)[r]=void 0,r===e(this,E))g(this,E,e(this,G)[r]);else if(r===e(this,x))g(this,x,e(this,W)[r]);else {let u=e(this,G)[r];e(this,W)[u]=e(this,W)[r];let p=e(this,W)[r];e(this,G)[p]=e(this,G)[r];}i(this,F)._--,e(this,B).push(r);}}if(e(this,D)&&e(this,T)?.length){let r=e(this,T),a;for(;a=r?.shift();)(n=e(this,V))==null||n.call(this,...a);}return s},Wt=function(e$1){var i,s;for(let h$1 of h(this,o,it).call(this,{allowStale:true})){let n=e(this,c)[h$1];if(h(this,o,S).call(this,n))n.__abortController.abort(new Error("deleted"));else {let r=e(this,b)[h$1];e(this,X)&&((i=e(this,H))==null||i.call(this,n,r,e$1)),e(this,D)&&e(this,T)?.push([n,r,e$1]);}}if(e(this,O).clear(),e(this,c).fill(void 0),e(this,b).fill(void 0),e(this,M)&&e(this,q)){e(this,M).fill(0),e(this,q).fill(0);for(let h of e(this,j)??[])h!==void 0&&clearTimeout(h);e(this,j)?.fill(void 0);}if(e(this,$)&&e(this,$).fill(0),g(this,x,0),g(this,E,0),e(this,B).length=0,g(this,P,0),g(this,F,0),e(this,D)&&e(this,T)){let h=e(this,T),n;for(;n=h?.shift();)(s=e(this,V))==null||s.call(this,...n);}},wt);var Et=class{constructor(e){d(this,"cache");d(this,"map",new Map);this.cache=new It({max:e.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(e){let i=this.map.delete(e);return i&&this.cache.delete(e),i}get forEach(){return this.map.forEach}get(e){let i=this.cache.get(e);return i||this.map.get(e)}has(e){return this.map.has(e)}set(e,i){return this.map.set(e,i),this.cache.set(e,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};export{Et as a};//# sourceMappingURL=chunk-EC6URLQW.mjs.map //# sourceMappingURL=chunk-EC6URLQW.mjs.map