@drincs/pixi-vn 1.3.13 → 1.3.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{classes/index.d.cts → CachedMap-DZLvJAnA.d.cts} +1 -1
- package/dist/{classes/index.d.ts → CachedMap-DZLvJAnA.d.ts} +1 -1
- package/dist/{OpenedLabel-DxlOwJKw.d.ts → HistoryChoiceMenuOption-BjnxDyK5.d.cts} +47 -2
- package/dist/{OpenedLabel-Dgkgemkv.d.cts → HistoryChoiceMenuOption-ZdrL_kYX.d.ts} +47 -2
- package/dist/{StorageElementType-DTGcnkzF.d.ts → StorageElementType-dAIVJeiw.d.cts} +1 -1
- package/dist/{StorageElementType-DTGcnkzF.d.cts → StorageElementType-dAIVJeiw.d.ts} +1 -1
- package/dist/history.cjs +1 -0
- package/dist/{history/index.d.ts → history.d.cts} +14 -8
- package/dist/{history/index.d.cts → history.d.ts} +14 -8
- package/dist/history.mjs +1 -0
- package/dist/index.cjs +143 -143
- package/dist/index.d.cts +3076 -216
- package/dist/index.d.ts +3076 -216
- package/dist/index.mjs +143 -143
- package/dist/narration.cjs +2 -0
- package/dist/{index-_rD16ks5.d.ts → narration.d.cts} +27 -44
- package/dist/{index-Bl9hiHQR.d.cts → narration.d.ts} +27 -44
- package/dist/narration.mjs +2 -0
- package/dist/storage.cjs +1 -0
- package/dist/{storage/index.d.ts → storage.d.cts} +75 -6
- package/dist/{storage/index.d.cts → storage.d.ts} +75 -6
- package/dist/storage.mjs +1 -0
- package/dist/unifier.cjs +1 -0
- package/dist/unifier.d.cts +230 -0
- package/dist/unifier.d.ts +230 -0
- package/dist/unifier.mjs +1 -0
- package/package.json +29 -2
- package/dist/ContainerMemory-CrY9QSo2.d.cts +0 -106
- package/dist/ContainerMemory-DrijxCcD.d.ts +0 -106
- package/dist/HistoryChoiceMenuOption-Kj_P28ke.d.ts +0 -49
- package/dist/HistoryChoiceMenuOption-unaLLfKR.d.cts +0 -49
- package/dist/HistoryGameState-i_gx3rGM.d.ts +0 -12
- package/dist/HistoryGameState-qeIMl_DH.d.cts +0 -12
- package/dist/NarrationGameState-CqDh48n_.d.ts +0 -24
- package/dist/NarrationGameState-Cu-OYzph.d.cts +0 -24
- package/dist/SoundGameState-BG_iPwjt.d.cts +0 -85
- package/dist/SoundGameState-BG_iPwjt.d.ts +0 -85
- package/dist/StorageGameState-B2kz-u_2.d.cts +0 -19
- package/dist/StorageGameState-Cnfj75sk.d.ts +0 -19
- package/dist/StoredClassModel-CjdhvNgB.d.cts +0 -56
- package/dist/StoredClassModel-CjdhvNgB.d.ts +0 -56
- package/dist/TickersSequence-Cf1Vcu22.d.cts +0 -133
- package/dist/TickersSequence-Cf1Vcu22.d.ts +0 -133
- package/dist/canvas/index.cjs +0 -3316
- package/dist/canvas/index.d.cts +0 -8
- package/dist/canvas/index.d.ts +0 -8
- package/dist/canvas/index.mjs +0 -3316
- package/dist/canvas/tickers/index.cjs +0 -3316
- package/dist/canvas/tickers/index.d.cts +0 -467
- package/dist/canvas/tickers/index.d.ts +0 -467
- package/dist/canvas/tickers/index.mjs +0 -3316
- package/dist/character/index.cjs +0 -572
- package/dist/character/index.d.cts +0 -3
- package/dist/character/index.d.ts +0 -3
- package/dist/character/index.mjs +0 -572
- package/dist/classes/index.cjs +0 -1
- package/dist/classes/index.mjs +0 -1
- package/dist/history/index.cjs +0 -1
- package/dist/history/index.mjs +0 -1
- package/dist/index-B4F3XaWz.d.cts +0 -1767
- package/dist/index-Cax-mGq_.d.cts +0 -216
- package/dist/index-Cvdua0o-.d.ts +0 -216
- package/dist/index-Czfdktw9.d.ts +0 -93
- package/dist/index-DZ1shoNp.d.cts +0 -93
- package/dist/index-DvpfJ2VQ.d.ts +0 -1767
- package/dist/interfaces/index.cjs +0 -1
- package/dist/interfaces/index.d.cts +0 -55
- package/dist/interfaces/index.d.ts +0 -55
- package/dist/interfaces/index.mjs +0 -0
- package/dist/narration/index.cjs +0 -573
- package/dist/narration/index.d.cts +0 -8
- package/dist/narration/index.d.ts +0 -8
- package/dist/narration/index.mjs +0 -573
- package/dist/sound/index.cjs +0 -572
- package/dist/sound/index.d.cts +0 -3
- package/dist/sound/index.d.ts +0 -3
- package/dist/sound/index.mjs +0 -572
- package/dist/storage/index.cjs +0 -1
- package/dist/storage/index.mjs +0 -1
- package/dist/utils/index.cjs +0 -1
- package/dist/utils/index.d.cts +0 -8
- package/dist/utils/index.d.ts +0 -8
- package/dist/utils/index.mjs +0 -1
package/dist/classes/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var Ht=Object.defineProperty;var Mt=f=>{throw TypeError(f)};var Kt=(f,e,i)=>e in f?Ht(f,e,{enumerable:true,configurable:true,writable:true,value:i}):f[e]=i;var w=(f,e,i)=>Kt(f,typeof e!="symbol"?e+"":e,i),Ot=(f,e,i)=>e.has(f)||Mt("Cannot "+i);var t=(f,e,i)=>(Ot(f,e,"read from private field"),i?i.call(f):e.get(f)),p=(f,e,i)=>e.has(f)?Mt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(f):e.set(f,i),l=(f,e,i,s)=>(Ot(f,e,"write to private field"),e.set(f,i),i),a=(f,e,i)=>(Ot(f,e,"access private method"),i);var _t=(f,e,i,s)=>({set _(r){l(f,e,r);},get _(){return t(f,e,s)}});var at=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,jt=new Set,vt=typeof process=="object"&&process?process:{},Nt=(f,e,i,s)=>{typeof vt.emitWarning=="function"?vt.emitWarning(f,e,i,s):console.error(`[${i}] ${e}: ${f}`);},Ft=globalThis.AbortController,Ut=globalThis.AbortSignal;if(typeof Ft>"u"){Ut=class{constructor(){w(this,"onabort");w(this,"_onabort",[]);w(this,"reason");w(this,"aborted",false);}addEventListener(s,r){this._onabort.push(r);}},Ft=class{constructor(){w(this,"signal",new Ut);e();}abort(s){if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=true;for(let r of this.signal._onabort)r(s);this.signal.onabort?.(s);}}};let f=vt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{f&&(f=false,Nt("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 Bt=f=>!jt.has(f),J=f=>f&&f===Math.floor(f)&&f>0&&isFinite(f),Vt=f=>J(f)?f<=Math.pow(2,8)?Uint8Array:f<=Math.pow(2,16)?Uint16Array:f<=Math.pow(2,32)?Uint32Array:f<=Number.MAX_SAFE_INTEGER?lt:null:null,lt=class extends Array{constructor(e){super(e),this.fill(0);}},ft,it=class it{constructor(e,i){w(this,"heap");w(this,"length");if(!t(it,ft))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}static create(e){let i=Vt(e);if(!i)return [];l(it,ft,true);let s=new it(e,i);return l(it,ft,false),s}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}};ft=new WeakMap,p(it,ft,false);var Ct=it,It,Gt,j,D,N,st,V,ct,ut,T,P,A,S,d,C,L,v,z,H,E,K,B,M,k,et,R,dt,o,Rt,nt,Y,mt,U,Pt,ht,gt,St,Q,Z,Wt,yt,At,m,xt,wt,tt,Dt,Lt=class Lt{constructor(e){p(this,o);p(this,j);p(this,D);p(this,N);p(this,st);p(this,V);p(this,ct);p(this,ut);w(this,"ttl");w(this,"ttlResolution");w(this,"ttlAutopurge");w(this,"updateAgeOnGet");w(this,"updateAgeOnHas");w(this,"allowStale");w(this,"noDisposeOnSet");w(this,"noUpdateTTL");w(this,"maxEntrySize");w(this,"sizeCalculation");w(this,"noDeleteOnFetchRejection");w(this,"noDeleteOnStaleGet");w(this,"allowStaleOnFetchAbort");w(this,"allowStaleOnFetchRejection");w(this,"ignoreFetchAbort");p(this,T);p(this,P);p(this,A);p(this,S);p(this,d);p(this,C);p(this,L);p(this,v);p(this,z);p(this,H);p(this,E);p(this,K);p(this,B);p(this,M);p(this,k);p(this,et);p(this,R);p(this,dt);p(this,nt,()=>{});p(this,Y,()=>{});p(this,mt,()=>{});p(this,U,()=>false);p(this,ht,e=>{});p(this,gt,(e,i,s)=>{});p(this,St,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});w(this,It,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:n,updateAgeOnGet:h,updateAgeOnHas:u,allowStale:c,dispose:F,onInsert:$,disposeAfter:b,noDisposeOnSet:X,noUpdateTTL:I,maxSize:q=0,maxEntrySize:y=0,sizeCalculation:_,fetchMethod:g,memoMethod:W,noDeleteOnFetchRejection:x,noDeleteOnStaleGet:O,allowStaleOnFetchRejection:G,allowStaleOnFetchAbort:pt,ignoreFetchAbort:rt}=e;if(i!==0&&!J(i))throw new TypeError("max option must be a nonnegative integer");let bt=i?Vt(i):Array;if(!bt)throw new Error("invalid max value: "+i);if(l(this,j,i),l(this,D,q),this.maxEntrySize=y||t(this,D),this.sizeCalculation=_,this.sizeCalculation){if(!t(this,D)&&!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(W!==void 0&&typeof W!="function")throw new TypeError("memoMethod must be a function if defined");if(l(this,ut,W),g!==void 0&&typeof g!="function")throw new TypeError("fetchMethod must be a function if specified");if(l(this,ct,g),l(this,et,!!g),l(this,A,new Map),l(this,S,new Array(i).fill(void 0)),l(this,d,new Array(i).fill(void 0)),l(this,C,new bt(i)),l(this,L,new bt(i)),l(this,v,0),l(this,z,0),l(this,H,Ct.create(i)),l(this,T,0),l(this,P,0),typeof F=="function"&&l(this,N,F),typeof $=="function"&&l(this,st,$),typeof b=="function"?(l(this,V,b),l(this,E,[])):(l(this,V,void 0),l(this,E,void 0)),l(this,k,!!t(this,N)),l(this,dt,!!t(this,st)),l(this,R,!!t(this,V)),this.noDisposeOnSet=!!X,this.noUpdateTTL=!!I,this.noDeleteOnFetchRejection=!!x,this.allowStaleOnFetchRejection=!!G,this.allowStaleOnFetchAbort=!!pt,this.ignoreFetchAbort=!!rt,this.maxEntrySize!==0){if(t(this,D)!==0&&!J(t(this,D)))throw new TypeError("maxSize must be a positive integer if specified");if(!J(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");a(this,o,Pt).call(this);}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!O,this.updateAgeOnGet=!!h,this.updateAgeOnHas=!!u,this.ttlResolution=J(r)||r===0?r:1,this.ttlAutopurge=!!n,this.ttl=s||0,this.ttl){if(!J(this.ttl))throw new TypeError("ttl must be a positive integer if specified");a(this,o,Rt).call(this);}if(t(this,j)===0&&this.ttl===0&&t(this,D)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,j)&&!t(this,D)){let ot="LRU_CACHE_UNBOUNDED";Bt(ot)&&(jt.add(ot),Nt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",ot,Lt));}}static unsafeExposeInternals(e){return {starts:t(e,B),ttls:t(e,M),sizes:t(e,K),keyMap:t(e,A),keyList:t(e,S),valList:t(e,d),next:t(e,C),prev:t(e,L),get head(){return t(e,v)},get tail(){return t(e,z)},free:t(e,H),isBackgroundFetch:i=>{var s;return a(s=e,o,m).call(s,i)},backgroundFetch:(i,s,r,n)=>{var h;return a(h=e,o,At).call(h,i,s,r,n)},moveToTail:i=>{var s;return a(s=e,o,wt).call(s,i)},indexes:i=>{var s;return a(s=e,o,Q).call(s,i)},rindexes:i=>{var s;return a(s=e,o,Z).call(s,i)},isStale:i=>{var s;return t(s=e,U).call(s,i)}}}get max(){return t(this,j)}get maxSize(){return t(this,D)}get calculatedSize(){return t(this,P)}get size(){return t(this,T)}get fetchMethod(){return t(this,ct)}get memoMethod(){return t(this,ut)}get dispose(){return t(this,N)}get onInsert(){return t(this,st)}get disposeAfter(){return t(this,V)}getRemainingTTL(e){return t(this,A).has(e)?1/0:0}*entries(){for(let e of a(this,o,Q).call(this))t(this,d)[e]!==void 0&&t(this,S)[e]!==void 0&&!a(this,o,m).call(this,t(this,d)[e])&&(yield [t(this,S)[e],t(this,d)[e]]);}*rentries(){for(let e of a(this,o,Z).call(this))t(this,d)[e]!==void 0&&t(this,S)[e]!==void 0&&!a(this,o,m).call(this,t(this,d)[e])&&(yield [t(this,S)[e],t(this,d)[e]]);}*keys(){for(let e of a(this,o,Q).call(this)){let i=t(this,S)[e];i!==void 0&&!a(this,o,m).call(this,t(this,d)[e])&&(yield i);}}*rkeys(){for(let e of a(this,o,Z).call(this)){let i=t(this,S)[e];i!==void 0&&!a(this,o,m).call(this,t(this,d)[e])&&(yield i);}}*values(){for(let e of a(this,o,Q).call(this))t(this,d)[e]!==void 0&&!a(this,o,m).call(this,t(this,d)[e])&&(yield t(this,d)[e]);}*rvalues(){for(let e of a(this,o,Z).call(this))t(this,d)[e]!==void 0&&!a(this,o,m).call(this,t(this,d)[e])&&(yield t(this,d)[e]);}[(Gt=Symbol.iterator,It=Symbol.toStringTag,Gt)](){return this.entries()}find(e,i={}){for(let s of a(this,o,Q).call(this)){let r=t(this,d)[s],n=a(this,o,m).call(this,r)?r.__staleWhileFetching:r;if(n!==void 0&&e(n,t(this,S)[s],this))return this.get(t(this,S)[s],i)}}forEach(e,i=this){for(let s of a(this,o,Q).call(this)){let r=t(this,d)[s],n=a(this,o,m).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e.call(i,n,t(this,S)[s],this);}}rforEach(e,i=this){for(let s of a(this,o,Z).call(this)){let r=t(this,d)[s],n=a(this,o,m).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e.call(i,n,t(this,S)[s],this);}}purgeStale(){let e=false;for(let i of a(this,o,Z).call(this,{allowStale:true}))t(this,U).call(this,i)&&(a(this,o,tt).call(this,t(this,S)[i],"expire"),e=true);return e}info(e){let i=t(this,A).get(e);if(i===void 0)return;let s=t(this,d)[i],r=a(this,o,m).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let n={value:r};if(t(this,M)&&t(this,B)){let h=t(this,M)[i],u=t(this,B)[i];if(h&&u){let c=h-(at.now()-u);n.ttl=c,n.start=Date.now();}}return t(this,K)&&(n.size=t(this,K)[i]),n}dump(){let e=[];for(let i of a(this,o,Q).call(this,{allowStale:true})){let s=t(this,S)[i],r=t(this,d)[i],n=a(this,o,m).call(this,r)?r.__staleWhileFetching:r;if(n===void 0||s===void 0)continue;let h={value:n};if(t(this,M)&&t(this,B)){h.ttl=t(this,M)[i];let u=at.now()-t(this,B)[i];h.start=Math.floor(Date.now()-u);}t(this,K)&&(h.size=t(this,K)[i]),e.unshift([s,h]);}return e}load(e){this.clear();for(let[i,s]of e){if(s.start){let r=Date.now()-s.start;s.start=at.now()-r;}this.set(i,s.value,s);}}set(e,i,s={}){var X,I,q,y;if(i===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:n,noDisposeOnSet:h=this.noDisposeOnSet,sizeCalculation:u=this.sizeCalculation,status:c}=s,{noUpdateTTL:F=this.noUpdateTTL}=s,$=t(this,St).call(this,e,i,s.size||0,u);if(this.maxEntrySize&&$>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=true),a(this,o,tt).call(this,e,"set"),this;let b=t(this,T)===0?void 0:t(this,A).get(e);if(b===void 0)b=t(this,T)===0?t(this,z):t(this,H).length!==0?t(this,H).pop():t(this,T)===t(this,j)?a(this,o,yt).call(this,false):t(this,T),t(this,S)[b]=e,t(this,d)[b]=i,t(this,A).set(e,b),t(this,C)[t(this,z)]=b,t(this,L)[b]=t(this,z),l(this,z,b),_t(this,T)._++,t(this,gt).call(this,b,$,c),c&&(c.set="add"),F=false,t(this,dt)&&((X=t(this,st))==null||X.call(this,i,e,"add"));else {a(this,o,wt).call(this,b);let _=t(this,d)[b];if(i!==_){if(t(this,et)&&a(this,o,m).call(this,_)){_.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:g}=_;g!==void 0&&!h&&(t(this,k)&&((I=t(this,N))==null||I.call(this,g,e,"set")),t(this,R)&&t(this,E)?.push([g,e,"set"]));}else h||(t(this,k)&&((q=t(this,N))==null||q.call(this,_,e,"set")),t(this,R)&&t(this,E)?.push([_,e,"set"]));if(t(this,ht).call(this,b),t(this,gt).call(this,b,$,c),t(this,d)[b]=i,c){c.set="replace";let g=_&&a(this,o,m).call(this,_)?_.__staleWhileFetching:_;g!==void 0&&(c.oldValue=g);}}else c&&(c.set="update");t(this,dt)&&this.onInsert?.(i,e,i===_?"update":"replace");}if(r!==0&&!t(this,M)&&a(this,o,Rt).call(this),t(this,M)&&(F||t(this,mt).call(this,b,r,n),c&&t(this,Y).call(this,c,b)),!h&&t(this,R)&&t(this,E)){let _=t(this,E),g;for(;g=_?.shift();)(y=t(this,V))==null||y.call(this,...g);}return this}pop(){var e;try{for(;t(this,T);){let i=t(this,d)[t(this,v)];if(a(this,o,yt).call(this,!0),a(this,o,m).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(t(this,R)&&t(this,E)){let i=t(this,E),s;for(;s=i?.shift();)(e=t(this,V))==null||e.call(this,...s);}}}has(e,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,n=t(this,A).get(e);if(n!==void 0){let h=t(this,d)[n];if(a(this,o,m).call(this,h)&&h.__staleWhileFetching===void 0)return false;if(t(this,U).call(this,n))r&&(r.has="stale",t(this,Y).call(this,r,n));else return s&&t(this,nt).call(this,n),r&&(r.has="hit",t(this,Y).call(this,r,n)),true}else r&&(r.has="miss");return false}peek(e,i={}){let{allowStale:s=this.allowStale}=i,r=t(this,A).get(e);if(r===void 0||!s&&t(this,U).call(this,r))return;let n=t(this,d)[r];return a(this,o,m).call(this,n)?n.__staleWhileFetching:n}async fetch(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:h=this.ttl,noDisposeOnSet:u=this.noDisposeOnSet,size:c=0,sizeCalculation:F=this.sizeCalculation,noUpdateTTL:$=this.noUpdateTTL,noDeleteOnFetchRejection:b=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:X=this.allowStaleOnFetchRejection,ignoreFetchAbort:I=this.ignoreFetchAbort,allowStaleOnFetchAbort:q=this.allowStaleOnFetchAbort,context:y,forceRefresh:_=false,status:g,signal:W}=i;if(!t(this,et))return g&&(g.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,status:g});let x={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,ttl:h,noDisposeOnSet:u,size:c,sizeCalculation:F,noUpdateTTL:$,noDeleteOnFetchRejection:b,allowStaleOnFetchRejection:X,allowStaleOnFetchAbort:q,ignoreFetchAbort:I,status:g,signal:W},O=t(this,A).get(e);if(O===void 0){g&&(g.fetch="miss");let G=a(this,o,At).call(this,e,O,x,y);return G.__returned=G}else {let G=t(this,d)[O];if(a(this,o,m).call(this,G)){let Et=s&&G.__staleWhileFetching!==void 0;return g&&(g.fetch="inflight",Et&&(g.returnedStale=true)),Et?G.__staleWhileFetching:G.__returned=G}let pt=t(this,U).call(this,O);if(!_&&!pt)return g&&(g.fetch="hit"),a(this,o,wt).call(this,O),r&&t(this,nt).call(this,O),g&&t(this,Y).call(this,g,O),G;let rt=a(this,o,At).call(this,e,O,x,y),ot=rt.__staleWhileFetching!==void 0&&s;return g&&(g.fetch=pt?"stale":"refresh",ot&&pt&&(g.returnedStale=true)),ot?rt.__staleWhileFetching:rt.__returned=rt}}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,i={}){let s=t(this,ut);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:n,...h}=i,u=this.get(e,h);if(!n&&u!==void 0)return u;let c=s(e,u,{options:h,context:r});return this.set(e,c,h),c}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:h}=i,u=t(this,A).get(e);if(u!==void 0){let c=t(this,d)[u],F=a(this,o,m).call(this,c);return h&&t(this,Y).call(this,h,u),t(this,U).call(this,u)?(h&&(h.get="stale"),F?(h&&s&&c.__staleWhileFetching!==void 0&&(h.returnedStale=true),s?c.__staleWhileFetching:void 0):(n||a(this,o,tt).call(this,e,"expire"),h&&s&&(h.returnedStale=true),s?c:void 0)):(h&&(h.get="hit"),F?c.__staleWhileFetching:(a(this,o,wt).call(this,u),r&&t(this,nt).call(this,u),c))}else h&&(h.get="miss");}delete(e){return a(this,o,tt).call(this,e,"delete")}clear(){return a(this,o,Dt).call(this,"delete")}};j=new WeakMap,D=new WeakMap,N=new WeakMap,st=new WeakMap,V=new WeakMap,ct=new WeakMap,ut=new WeakMap,T=new WeakMap,P=new WeakMap,A=new WeakMap,S=new WeakMap,d=new WeakMap,C=new WeakMap,L=new WeakMap,v=new WeakMap,z=new WeakMap,H=new WeakMap,E=new WeakMap,K=new WeakMap,B=new WeakMap,M=new WeakMap,k=new WeakMap,et=new WeakMap,R=new WeakMap,dt=new WeakMap,o=new WeakSet,Rt=function(){let e=new lt(t(this,j)),i=new lt(t(this,j));l(this,M,e),l(this,B,i),l(this,mt,(n,h,u=at.now())=>{if(i[n]=h!==0?u:0,e[n]=h,h!==0&&this.ttlAutopurge){let c=setTimeout(()=>{t(this,U).call(this,n)&&a(this,o,tt).call(this,t(this,S)[n],"expire");},h+1);c.unref&&c.unref();}}),l(this,nt,n=>{i[n]=e[n]!==0?at.now():0;}),l(this,Y,(n,h)=>{if(e[h]){let u=e[h],c=i[h];if(!u||!c)return;n.ttl=u,n.start=c,n.now=s||r();let F=n.now-c;n.remainingTTL=u-F;}});let s=0,r=()=>{let n=at.now();if(this.ttlResolution>0){s=n;let h=setTimeout(()=>s=0,this.ttlResolution);h.unref&&h.unref();}return n};this.getRemainingTTL=n=>{let h=t(this,A).get(n);if(h===void 0)return 0;let u=e[h],c=i[h];if(!u||!c)return 1/0;let F=(s||r())-c;return u-F},l(this,U,n=>{let h=i[n],u=e[n];return !!u&&!!h&&(s||r())-h>u});},nt=new WeakMap,Y=new WeakMap,mt=new WeakMap,U=new WeakMap,Pt=function(){let e=new lt(t(this,j));l(this,P,0),l(this,K,e),l(this,ht,i=>{l(this,P,t(this,P)-e[i]),e[i]=0;}),l(this,St,(i,s,r,n)=>{if(a(this,o,m).call(this,s))return 0;if(!J(r))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(r=n(s,i),!J(r))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 r}),l(this,gt,(i,s,r)=>{if(e[i]=s,t(this,D)){let n=t(this,D)-e[i];for(;t(this,P)>n;)a(this,o,yt).call(this,true);}l(this,P,t(this,P)+e[i]),r&&(r.entrySize=s,r.totalCalculatedSize=t(this,P));});},ht=new WeakMap,gt=new WeakMap,St=new WeakMap,Q=function*({allowStale:e=this.allowStale}={}){if(t(this,T))for(let i=t(this,z);!(!a(this,o,Wt).call(this,i)||((e||!t(this,U).call(this,i))&&(yield i),i===t(this,v)));)i=t(this,L)[i];},Z=function*({allowStale:e=this.allowStale}={}){if(t(this,T))for(let i=t(this,v);!(!a(this,o,Wt).call(this,i)||((e||!t(this,U).call(this,i))&&(yield i),i===t(this,z)));)i=t(this,C)[i];},Wt=function(e){return e!==void 0&&t(this,A).get(t(this,S)[e])===e},yt=function(e){var n;let i=t(this,v),s=t(this,S)[i],r=t(this,d)[i];return t(this,et)&&a(this,o,m).call(this,r)?r.__abortController.abort(new Error("evicted")):(t(this,k)||t(this,R))&&(t(this,k)&&((n=t(this,N))==null||n.call(this,r,s,"evict")),t(this,R)&&t(this,E)?.push([r,s,"evict"])),t(this,ht).call(this,i),e&&(t(this,S)[i]=void 0,t(this,d)[i]=void 0,t(this,H).push(i)),t(this,T)===1?(l(this,v,l(this,z,0)),t(this,H).length=0):l(this,v,t(this,C)[i]),t(this,A).delete(s),_t(this,T)._--,i},At=function(e,i,s,r){let n=i===void 0?void 0:t(this,d)[i];if(a(this,o,m).call(this,n))return n;let h=new Ft,{signal:u}=s;u?.addEventListener("abort",()=>h.abort(u.reason),{signal:h.signal});let c={signal:h.signal,options:s,context:r},F=(y,_=false)=>{let{aborted:g}=h.signal,W=s.ignoreFetchAbort&&y!==void 0;if(s.status&&(g&&!_?(s.status.fetchAborted=true,s.status.fetchError=h.signal.reason,W&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),g&&!W&&!_)return b(h.signal.reason);let x=I;return t(this,d)[i]===I&&(y===void 0?x.__staleWhileFetching?t(this,d)[i]=x.__staleWhileFetching:a(this,o,tt).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,y,c.options))),y},$=y=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=y),b(y)),b=y=>{let{aborted:_}=h.signal,g=_&&s.allowStaleOnFetchAbort,W=g||s.allowStaleOnFetchRejection,x=W||s.noDeleteOnFetchRejection,O=I;if(t(this,d)[i]===I&&(!x||O.__staleWhileFetching===void 0?a(this,o,tt).call(this,e,"fetch"):g||(t(this,d)[i]=O.__staleWhileFetching)),W)return s.status&&O.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),O.__staleWhileFetching;if(O.__returned===O)throw y},X=(y,_)=>{var W;let g=(W=t(this,ct))==null?void 0:W.call(this,e,n,c);g&&g instanceof Promise&&g.then(x=>y(x===void 0?void 0:x),_),h.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(y(void 0),s.allowStaleOnFetchAbort&&(y=x=>F(x,true)));});};s.status&&(s.status.fetchDispatched=true);let I=new Promise(X).then(F,$),q=Object.assign(I,{__abortController:h,__staleWhileFetching:n,__returned:void 0});return i===void 0?(this.set(e,q,{...c.options,status:void 0}),i=t(this,A).get(e)):t(this,d)[i]=q,q},m=function(e){if(!t(this,et))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Ft},xt=function(e,i){t(this,L)[i]=e,t(this,C)[e]=i;},wt=function(e){e!==t(this,z)&&(e===t(this,v)?l(this,v,t(this,C)[e]):a(this,o,xt).call(this,t(this,L)[e],t(this,C)[e]),a(this,o,xt).call(this,t(this,z),e),l(this,z,e));},tt=function(e,i){var r,n;let s=false;if(t(this,T)!==0){let h=t(this,A).get(e);if(h!==void 0)if(s=true,t(this,T)===1)a(this,o,Dt).call(this,i);else {t(this,ht).call(this,h);let u=t(this,d)[h];if(a(this,o,m).call(this,u)?u.__abortController.abort(new Error("deleted")):(t(this,k)||t(this,R))&&(t(this,k)&&((r=t(this,N))==null||r.call(this,u,e,i)),t(this,R)&&t(this,E)?.push([u,e,i])),t(this,A).delete(e),t(this,S)[h]=void 0,t(this,d)[h]=void 0,h===t(this,z))l(this,z,t(this,L)[h]);else if(h===t(this,v))l(this,v,t(this,C)[h]);else {let c=t(this,L)[h];t(this,C)[c]=t(this,C)[h];let F=t(this,C)[h];t(this,L)[F]=t(this,L)[h];}_t(this,T)._--,t(this,H).push(h);}}if(t(this,R)&&t(this,E)?.length){let h=t(this,E),u;for(;u=h?.shift();)(n=t(this,V))==null||n.call(this,...u);}return s},Dt=function(e){var i,s;for(let r of a(this,o,Z).call(this,{allowStale:true})){let n=t(this,d)[r];if(a(this,o,m).call(this,n))n.__abortController.abort(new Error("deleted"));else {let h=t(this,S)[r];t(this,k)&&((i=t(this,N))==null||i.call(this,n,h,e)),t(this,R)&&t(this,E)?.push([n,h,e]);}}if(t(this,A).clear(),t(this,d).fill(void 0),t(this,S).fill(void 0),t(this,M)&&t(this,B)&&(t(this,M).fill(0),t(this,B).fill(0)),t(this,K)&&t(this,K).fill(0),l(this,v,0),l(this,z,0),t(this,H).length=0,l(this,P,0),l(this,T,0),t(this,R)&&t(this,E)){let r=t(this,E),n;for(;n=r?.shift();)(s=t(this,V))==null||s.call(this,...n);}};var Tt=Lt;var zt=class{constructor(e){w(this,"cache");w(this,"map",new Map);this.cache=new Tt({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()}};exports.CachedMap=zt;
|
package/dist/classes/index.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var Ht=Object.defineProperty;var Mt=f=>{throw TypeError(f)};var Kt=(f,e,i)=>e in f?Ht(f,e,{enumerable:true,configurable:true,writable:true,value:i}):f[e]=i;var w=(f,e,i)=>Kt(f,typeof e!="symbol"?e+"":e,i),Ot=(f,e,i)=>e.has(f)||Mt("Cannot "+i);var t=(f,e,i)=>(Ot(f,e,"read from private field"),i?i.call(f):e.get(f)),p=(f,e,i)=>e.has(f)?Mt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(f):e.set(f,i),l=(f,e,i,s)=>(Ot(f,e,"write to private field"),e.set(f,i),i),a=(f,e,i)=>(Ot(f,e,"access private method"),i);var _t=(f,e,i,s)=>({set _(r){l(f,e,r);},get _(){return t(f,e,s)}});var at=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,jt=new Set,vt=typeof process=="object"&&process?process:{},Nt=(f,e,i,s)=>{typeof vt.emitWarning=="function"?vt.emitWarning(f,e,i,s):console.error(`[${i}] ${e}: ${f}`);},Ft=globalThis.AbortController,Ut=globalThis.AbortSignal;if(typeof Ft>"u"){Ut=class{constructor(){w(this,"onabort");w(this,"_onabort",[]);w(this,"reason");w(this,"aborted",false);}addEventListener(s,r){this._onabort.push(r);}},Ft=class{constructor(){w(this,"signal",new Ut);e();}abort(s){if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=true;for(let r of this.signal._onabort)r(s);this.signal.onabort?.(s);}}};let f=vt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{f&&(f=false,Nt("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 Bt=f=>!jt.has(f),J=f=>f&&f===Math.floor(f)&&f>0&&isFinite(f),Vt=f=>J(f)?f<=Math.pow(2,8)?Uint8Array:f<=Math.pow(2,16)?Uint16Array:f<=Math.pow(2,32)?Uint32Array:f<=Number.MAX_SAFE_INTEGER?lt:null:null,lt=class extends Array{constructor(e){super(e),this.fill(0);}},ft,it=class it{constructor(e,i){w(this,"heap");w(this,"length");if(!t(it,ft))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}static create(e){let i=Vt(e);if(!i)return [];l(it,ft,true);let s=new it(e,i);return l(it,ft,false),s}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}};ft=new WeakMap,p(it,ft,false);var Ct=it,It,Gt,j,D,N,st,V,ct,ut,T,P,A,S,d,C,L,v,z,H,E,K,B,M,k,et,R,dt,o,Rt,nt,Y,mt,U,Pt,ht,gt,St,Q,Z,Wt,yt,At,m,xt,wt,tt,Dt,Lt=class Lt{constructor(e){p(this,o);p(this,j);p(this,D);p(this,N);p(this,st);p(this,V);p(this,ct);p(this,ut);w(this,"ttl");w(this,"ttlResolution");w(this,"ttlAutopurge");w(this,"updateAgeOnGet");w(this,"updateAgeOnHas");w(this,"allowStale");w(this,"noDisposeOnSet");w(this,"noUpdateTTL");w(this,"maxEntrySize");w(this,"sizeCalculation");w(this,"noDeleteOnFetchRejection");w(this,"noDeleteOnStaleGet");w(this,"allowStaleOnFetchAbort");w(this,"allowStaleOnFetchRejection");w(this,"ignoreFetchAbort");p(this,T);p(this,P);p(this,A);p(this,S);p(this,d);p(this,C);p(this,L);p(this,v);p(this,z);p(this,H);p(this,E);p(this,K);p(this,B);p(this,M);p(this,k);p(this,et);p(this,R);p(this,dt);p(this,nt,()=>{});p(this,Y,()=>{});p(this,mt,()=>{});p(this,U,()=>false);p(this,ht,e=>{});p(this,gt,(e,i,s)=>{});p(this,St,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});w(this,It,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:n,updateAgeOnGet:h,updateAgeOnHas:u,allowStale:c,dispose:F,onInsert:$,disposeAfter:b,noDisposeOnSet:X,noUpdateTTL:I,maxSize:q=0,maxEntrySize:y=0,sizeCalculation:_,fetchMethod:g,memoMethod:W,noDeleteOnFetchRejection:x,noDeleteOnStaleGet:O,allowStaleOnFetchRejection:G,allowStaleOnFetchAbort:pt,ignoreFetchAbort:rt}=e;if(i!==0&&!J(i))throw new TypeError("max option must be a nonnegative integer");let bt=i?Vt(i):Array;if(!bt)throw new Error("invalid max value: "+i);if(l(this,j,i),l(this,D,q),this.maxEntrySize=y||t(this,D),this.sizeCalculation=_,this.sizeCalculation){if(!t(this,D)&&!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(W!==void 0&&typeof W!="function")throw new TypeError("memoMethod must be a function if defined");if(l(this,ut,W),g!==void 0&&typeof g!="function")throw new TypeError("fetchMethod must be a function if specified");if(l(this,ct,g),l(this,et,!!g),l(this,A,new Map),l(this,S,new Array(i).fill(void 0)),l(this,d,new Array(i).fill(void 0)),l(this,C,new bt(i)),l(this,L,new bt(i)),l(this,v,0),l(this,z,0),l(this,H,Ct.create(i)),l(this,T,0),l(this,P,0),typeof F=="function"&&l(this,N,F),typeof $=="function"&&l(this,st,$),typeof b=="function"?(l(this,V,b),l(this,E,[])):(l(this,V,void 0),l(this,E,void 0)),l(this,k,!!t(this,N)),l(this,dt,!!t(this,st)),l(this,R,!!t(this,V)),this.noDisposeOnSet=!!X,this.noUpdateTTL=!!I,this.noDeleteOnFetchRejection=!!x,this.allowStaleOnFetchRejection=!!G,this.allowStaleOnFetchAbort=!!pt,this.ignoreFetchAbort=!!rt,this.maxEntrySize!==0){if(t(this,D)!==0&&!J(t(this,D)))throw new TypeError("maxSize must be a positive integer if specified");if(!J(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");a(this,o,Pt).call(this);}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!O,this.updateAgeOnGet=!!h,this.updateAgeOnHas=!!u,this.ttlResolution=J(r)||r===0?r:1,this.ttlAutopurge=!!n,this.ttl=s||0,this.ttl){if(!J(this.ttl))throw new TypeError("ttl must be a positive integer if specified");a(this,o,Rt).call(this);}if(t(this,j)===0&&this.ttl===0&&t(this,D)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,j)&&!t(this,D)){let ot="LRU_CACHE_UNBOUNDED";Bt(ot)&&(jt.add(ot),Nt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",ot,Lt));}}static unsafeExposeInternals(e){return {starts:t(e,B),ttls:t(e,M),sizes:t(e,K),keyMap:t(e,A),keyList:t(e,S),valList:t(e,d),next:t(e,C),prev:t(e,L),get head(){return t(e,v)},get tail(){return t(e,z)},free:t(e,H),isBackgroundFetch:i=>{var s;return a(s=e,o,m).call(s,i)},backgroundFetch:(i,s,r,n)=>{var h;return a(h=e,o,At).call(h,i,s,r,n)},moveToTail:i=>{var s;return a(s=e,o,wt).call(s,i)},indexes:i=>{var s;return a(s=e,o,Q).call(s,i)},rindexes:i=>{var s;return a(s=e,o,Z).call(s,i)},isStale:i=>{var s;return t(s=e,U).call(s,i)}}}get max(){return t(this,j)}get maxSize(){return t(this,D)}get calculatedSize(){return t(this,P)}get size(){return t(this,T)}get fetchMethod(){return t(this,ct)}get memoMethod(){return t(this,ut)}get dispose(){return t(this,N)}get onInsert(){return t(this,st)}get disposeAfter(){return t(this,V)}getRemainingTTL(e){return t(this,A).has(e)?1/0:0}*entries(){for(let e of a(this,o,Q).call(this))t(this,d)[e]!==void 0&&t(this,S)[e]!==void 0&&!a(this,o,m).call(this,t(this,d)[e])&&(yield [t(this,S)[e],t(this,d)[e]]);}*rentries(){for(let e of a(this,o,Z).call(this))t(this,d)[e]!==void 0&&t(this,S)[e]!==void 0&&!a(this,o,m).call(this,t(this,d)[e])&&(yield [t(this,S)[e],t(this,d)[e]]);}*keys(){for(let e of a(this,o,Q).call(this)){let i=t(this,S)[e];i!==void 0&&!a(this,o,m).call(this,t(this,d)[e])&&(yield i);}}*rkeys(){for(let e of a(this,o,Z).call(this)){let i=t(this,S)[e];i!==void 0&&!a(this,o,m).call(this,t(this,d)[e])&&(yield i);}}*values(){for(let e of a(this,o,Q).call(this))t(this,d)[e]!==void 0&&!a(this,o,m).call(this,t(this,d)[e])&&(yield t(this,d)[e]);}*rvalues(){for(let e of a(this,o,Z).call(this))t(this,d)[e]!==void 0&&!a(this,o,m).call(this,t(this,d)[e])&&(yield t(this,d)[e]);}[(Gt=Symbol.iterator,It=Symbol.toStringTag,Gt)](){return this.entries()}find(e,i={}){for(let s of a(this,o,Q).call(this)){let r=t(this,d)[s],n=a(this,o,m).call(this,r)?r.__staleWhileFetching:r;if(n!==void 0&&e(n,t(this,S)[s],this))return this.get(t(this,S)[s],i)}}forEach(e,i=this){for(let s of a(this,o,Q).call(this)){let r=t(this,d)[s],n=a(this,o,m).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e.call(i,n,t(this,S)[s],this);}}rforEach(e,i=this){for(let s of a(this,o,Z).call(this)){let r=t(this,d)[s],n=a(this,o,m).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e.call(i,n,t(this,S)[s],this);}}purgeStale(){let e=false;for(let i of a(this,o,Z).call(this,{allowStale:true}))t(this,U).call(this,i)&&(a(this,o,tt).call(this,t(this,S)[i],"expire"),e=true);return e}info(e){let i=t(this,A).get(e);if(i===void 0)return;let s=t(this,d)[i],r=a(this,o,m).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let n={value:r};if(t(this,M)&&t(this,B)){let h=t(this,M)[i],u=t(this,B)[i];if(h&&u){let c=h-(at.now()-u);n.ttl=c,n.start=Date.now();}}return t(this,K)&&(n.size=t(this,K)[i]),n}dump(){let e=[];for(let i of a(this,o,Q).call(this,{allowStale:true})){let s=t(this,S)[i],r=t(this,d)[i],n=a(this,o,m).call(this,r)?r.__staleWhileFetching:r;if(n===void 0||s===void 0)continue;let h={value:n};if(t(this,M)&&t(this,B)){h.ttl=t(this,M)[i];let u=at.now()-t(this,B)[i];h.start=Math.floor(Date.now()-u);}t(this,K)&&(h.size=t(this,K)[i]),e.unshift([s,h]);}return e}load(e){this.clear();for(let[i,s]of e){if(s.start){let r=Date.now()-s.start;s.start=at.now()-r;}this.set(i,s.value,s);}}set(e,i,s={}){var X,I,q,y;if(i===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:n,noDisposeOnSet:h=this.noDisposeOnSet,sizeCalculation:u=this.sizeCalculation,status:c}=s,{noUpdateTTL:F=this.noUpdateTTL}=s,$=t(this,St).call(this,e,i,s.size||0,u);if(this.maxEntrySize&&$>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=true),a(this,o,tt).call(this,e,"set"),this;let b=t(this,T)===0?void 0:t(this,A).get(e);if(b===void 0)b=t(this,T)===0?t(this,z):t(this,H).length!==0?t(this,H).pop():t(this,T)===t(this,j)?a(this,o,yt).call(this,false):t(this,T),t(this,S)[b]=e,t(this,d)[b]=i,t(this,A).set(e,b),t(this,C)[t(this,z)]=b,t(this,L)[b]=t(this,z),l(this,z,b),_t(this,T)._++,t(this,gt).call(this,b,$,c),c&&(c.set="add"),F=false,t(this,dt)&&((X=t(this,st))==null||X.call(this,i,e,"add"));else {a(this,o,wt).call(this,b);let _=t(this,d)[b];if(i!==_){if(t(this,et)&&a(this,o,m).call(this,_)){_.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:g}=_;g!==void 0&&!h&&(t(this,k)&&((I=t(this,N))==null||I.call(this,g,e,"set")),t(this,R)&&t(this,E)?.push([g,e,"set"]));}else h||(t(this,k)&&((q=t(this,N))==null||q.call(this,_,e,"set")),t(this,R)&&t(this,E)?.push([_,e,"set"]));if(t(this,ht).call(this,b),t(this,gt).call(this,b,$,c),t(this,d)[b]=i,c){c.set="replace";let g=_&&a(this,o,m).call(this,_)?_.__staleWhileFetching:_;g!==void 0&&(c.oldValue=g);}}else c&&(c.set="update");t(this,dt)&&this.onInsert?.(i,e,i===_?"update":"replace");}if(r!==0&&!t(this,M)&&a(this,o,Rt).call(this),t(this,M)&&(F||t(this,mt).call(this,b,r,n),c&&t(this,Y).call(this,c,b)),!h&&t(this,R)&&t(this,E)){let _=t(this,E),g;for(;g=_?.shift();)(y=t(this,V))==null||y.call(this,...g);}return this}pop(){var e;try{for(;t(this,T);){let i=t(this,d)[t(this,v)];if(a(this,o,yt).call(this,!0),a(this,o,m).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(t(this,R)&&t(this,E)){let i=t(this,E),s;for(;s=i?.shift();)(e=t(this,V))==null||e.call(this,...s);}}}has(e,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,n=t(this,A).get(e);if(n!==void 0){let h=t(this,d)[n];if(a(this,o,m).call(this,h)&&h.__staleWhileFetching===void 0)return false;if(t(this,U).call(this,n))r&&(r.has="stale",t(this,Y).call(this,r,n));else return s&&t(this,nt).call(this,n),r&&(r.has="hit",t(this,Y).call(this,r,n)),true}else r&&(r.has="miss");return false}peek(e,i={}){let{allowStale:s=this.allowStale}=i,r=t(this,A).get(e);if(r===void 0||!s&&t(this,U).call(this,r))return;let n=t(this,d)[r];return a(this,o,m).call(this,n)?n.__staleWhileFetching:n}async fetch(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:h=this.ttl,noDisposeOnSet:u=this.noDisposeOnSet,size:c=0,sizeCalculation:F=this.sizeCalculation,noUpdateTTL:$=this.noUpdateTTL,noDeleteOnFetchRejection:b=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:X=this.allowStaleOnFetchRejection,ignoreFetchAbort:I=this.ignoreFetchAbort,allowStaleOnFetchAbort:q=this.allowStaleOnFetchAbort,context:y,forceRefresh:_=false,status:g,signal:W}=i;if(!t(this,et))return g&&(g.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,status:g});let x={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,ttl:h,noDisposeOnSet:u,size:c,sizeCalculation:F,noUpdateTTL:$,noDeleteOnFetchRejection:b,allowStaleOnFetchRejection:X,allowStaleOnFetchAbort:q,ignoreFetchAbort:I,status:g,signal:W},O=t(this,A).get(e);if(O===void 0){g&&(g.fetch="miss");let G=a(this,o,At).call(this,e,O,x,y);return G.__returned=G}else {let G=t(this,d)[O];if(a(this,o,m).call(this,G)){let Et=s&&G.__staleWhileFetching!==void 0;return g&&(g.fetch="inflight",Et&&(g.returnedStale=true)),Et?G.__staleWhileFetching:G.__returned=G}let pt=t(this,U).call(this,O);if(!_&&!pt)return g&&(g.fetch="hit"),a(this,o,wt).call(this,O),r&&t(this,nt).call(this,O),g&&t(this,Y).call(this,g,O),G;let rt=a(this,o,At).call(this,e,O,x,y),ot=rt.__staleWhileFetching!==void 0&&s;return g&&(g.fetch=pt?"stale":"refresh",ot&&pt&&(g.returnedStale=true)),ot?rt.__staleWhileFetching:rt.__returned=rt}}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,i={}){let s=t(this,ut);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:n,...h}=i,u=this.get(e,h);if(!n&&u!==void 0)return u;let c=s(e,u,{options:h,context:r});return this.set(e,c,h),c}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:h}=i,u=t(this,A).get(e);if(u!==void 0){let c=t(this,d)[u],F=a(this,o,m).call(this,c);return h&&t(this,Y).call(this,h,u),t(this,U).call(this,u)?(h&&(h.get="stale"),F?(h&&s&&c.__staleWhileFetching!==void 0&&(h.returnedStale=true),s?c.__staleWhileFetching:void 0):(n||a(this,o,tt).call(this,e,"expire"),h&&s&&(h.returnedStale=true),s?c:void 0)):(h&&(h.get="hit"),F?c.__staleWhileFetching:(a(this,o,wt).call(this,u),r&&t(this,nt).call(this,u),c))}else h&&(h.get="miss");}delete(e){return a(this,o,tt).call(this,e,"delete")}clear(){return a(this,o,Dt).call(this,"delete")}};j=new WeakMap,D=new WeakMap,N=new WeakMap,st=new WeakMap,V=new WeakMap,ct=new WeakMap,ut=new WeakMap,T=new WeakMap,P=new WeakMap,A=new WeakMap,S=new WeakMap,d=new WeakMap,C=new WeakMap,L=new WeakMap,v=new WeakMap,z=new WeakMap,H=new WeakMap,E=new WeakMap,K=new WeakMap,B=new WeakMap,M=new WeakMap,k=new WeakMap,et=new WeakMap,R=new WeakMap,dt=new WeakMap,o=new WeakSet,Rt=function(){let e=new lt(t(this,j)),i=new lt(t(this,j));l(this,M,e),l(this,B,i),l(this,mt,(n,h,u=at.now())=>{if(i[n]=h!==0?u:0,e[n]=h,h!==0&&this.ttlAutopurge){let c=setTimeout(()=>{t(this,U).call(this,n)&&a(this,o,tt).call(this,t(this,S)[n],"expire");},h+1);c.unref&&c.unref();}}),l(this,nt,n=>{i[n]=e[n]!==0?at.now():0;}),l(this,Y,(n,h)=>{if(e[h]){let u=e[h],c=i[h];if(!u||!c)return;n.ttl=u,n.start=c,n.now=s||r();let F=n.now-c;n.remainingTTL=u-F;}});let s=0,r=()=>{let n=at.now();if(this.ttlResolution>0){s=n;let h=setTimeout(()=>s=0,this.ttlResolution);h.unref&&h.unref();}return n};this.getRemainingTTL=n=>{let h=t(this,A).get(n);if(h===void 0)return 0;let u=e[h],c=i[h];if(!u||!c)return 1/0;let F=(s||r())-c;return u-F},l(this,U,n=>{let h=i[n],u=e[n];return !!u&&!!h&&(s||r())-h>u});},nt=new WeakMap,Y=new WeakMap,mt=new WeakMap,U=new WeakMap,Pt=function(){let e=new lt(t(this,j));l(this,P,0),l(this,K,e),l(this,ht,i=>{l(this,P,t(this,P)-e[i]),e[i]=0;}),l(this,St,(i,s,r,n)=>{if(a(this,o,m).call(this,s))return 0;if(!J(r))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(r=n(s,i),!J(r))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 r}),l(this,gt,(i,s,r)=>{if(e[i]=s,t(this,D)){let n=t(this,D)-e[i];for(;t(this,P)>n;)a(this,o,yt).call(this,true);}l(this,P,t(this,P)+e[i]),r&&(r.entrySize=s,r.totalCalculatedSize=t(this,P));});},ht=new WeakMap,gt=new WeakMap,St=new WeakMap,Q=function*({allowStale:e=this.allowStale}={}){if(t(this,T))for(let i=t(this,z);!(!a(this,o,Wt).call(this,i)||((e||!t(this,U).call(this,i))&&(yield i),i===t(this,v)));)i=t(this,L)[i];},Z=function*({allowStale:e=this.allowStale}={}){if(t(this,T))for(let i=t(this,v);!(!a(this,o,Wt).call(this,i)||((e||!t(this,U).call(this,i))&&(yield i),i===t(this,z)));)i=t(this,C)[i];},Wt=function(e){return e!==void 0&&t(this,A).get(t(this,S)[e])===e},yt=function(e){var n;let i=t(this,v),s=t(this,S)[i],r=t(this,d)[i];return t(this,et)&&a(this,o,m).call(this,r)?r.__abortController.abort(new Error("evicted")):(t(this,k)||t(this,R))&&(t(this,k)&&((n=t(this,N))==null||n.call(this,r,s,"evict")),t(this,R)&&t(this,E)?.push([r,s,"evict"])),t(this,ht).call(this,i),e&&(t(this,S)[i]=void 0,t(this,d)[i]=void 0,t(this,H).push(i)),t(this,T)===1?(l(this,v,l(this,z,0)),t(this,H).length=0):l(this,v,t(this,C)[i]),t(this,A).delete(s),_t(this,T)._--,i},At=function(e,i,s,r){let n=i===void 0?void 0:t(this,d)[i];if(a(this,o,m).call(this,n))return n;let h=new Ft,{signal:u}=s;u?.addEventListener("abort",()=>h.abort(u.reason),{signal:h.signal});let c={signal:h.signal,options:s,context:r},F=(y,_=false)=>{let{aborted:g}=h.signal,W=s.ignoreFetchAbort&&y!==void 0;if(s.status&&(g&&!_?(s.status.fetchAborted=true,s.status.fetchError=h.signal.reason,W&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),g&&!W&&!_)return b(h.signal.reason);let x=I;return t(this,d)[i]===I&&(y===void 0?x.__staleWhileFetching?t(this,d)[i]=x.__staleWhileFetching:a(this,o,tt).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,y,c.options))),y},$=y=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=y),b(y)),b=y=>{let{aborted:_}=h.signal,g=_&&s.allowStaleOnFetchAbort,W=g||s.allowStaleOnFetchRejection,x=W||s.noDeleteOnFetchRejection,O=I;if(t(this,d)[i]===I&&(!x||O.__staleWhileFetching===void 0?a(this,o,tt).call(this,e,"fetch"):g||(t(this,d)[i]=O.__staleWhileFetching)),W)return s.status&&O.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),O.__staleWhileFetching;if(O.__returned===O)throw y},X=(y,_)=>{var W;let g=(W=t(this,ct))==null?void 0:W.call(this,e,n,c);g&&g instanceof Promise&&g.then(x=>y(x===void 0?void 0:x),_),h.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(y(void 0),s.allowStaleOnFetchAbort&&(y=x=>F(x,true)));});};s.status&&(s.status.fetchDispatched=true);let I=new Promise(X).then(F,$),q=Object.assign(I,{__abortController:h,__staleWhileFetching:n,__returned:void 0});return i===void 0?(this.set(e,q,{...c.options,status:void 0}),i=t(this,A).get(e)):t(this,d)[i]=q,q},m=function(e){if(!t(this,et))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Ft},xt=function(e,i){t(this,L)[i]=e,t(this,C)[e]=i;},wt=function(e){e!==t(this,z)&&(e===t(this,v)?l(this,v,t(this,C)[e]):a(this,o,xt).call(this,t(this,L)[e],t(this,C)[e]),a(this,o,xt).call(this,t(this,z),e),l(this,z,e));},tt=function(e,i){var r,n;let s=false;if(t(this,T)!==0){let h=t(this,A).get(e);if(h!==void 0)if(s=true,t(this,T)===1)a(this,o,Dt).call(this,i);else {t(this,ht).call(this,h);let u=t(this,d)[h];if(a(this,o,m).call(this,u)?u.__abortController.abort(new Error("deleted")):(t(this,k)||t(this,R))&&(t(this,k)&&((r=t(this,N))==null||r.call(this,u,e,i)),t(this,R)&&t(this,E)?.push([u,e,i])),t(this,A).delete(e),t(this,S)[h]=void 0,t(this,d)[h]=void 0,h===t(this,z))l(this,z,t(this,L)[h]);else if(h===t(this,v))l(this,v,t(this,C)[h]);else {let c=t(this,L)[h];t(this,C)[c]=t(this,C)[h];let F=t(this,C)[h];t(this,L)[F]=t(this,L)[h];}_t(this,T)._--,t(this,H).push(h);}}if(t(this,R)&&t(this,E)?.length){let h=t(this,E),u;for(;u=h?.shift();)(n=t(this,V))==null||n.call(this,...u);}return s},Dt=function(e){var i,s;for(let r of a(this,o,Z).call(this,{allowStale:true})){let n=t(this,d)[r];if(a(this,o,m).call(this,n))n.__abortController.abort(new Error("deleted"));else {let h=t(this,S)[r];t(this,k)&&((i=t(this,N))==null||i.call(this,n,h,e)),t(this,R)&&t(this,E)?.push([n,h,e]);}}if(t(this,A).clear(),t(this,d).fill(void 0),t(this,S).fill(void 0),t(this,M)&&t(this,B)&&(t(this,M).fill(0),t(this,B).fill(0)),t(this,K)&&t(this,K).fill(0),l(this,v,0),l(this,z,0),t(this,H).length=0,l(this,P,0),l(this,T,0),t(this,R)&&t(this,E)){let r=t(this,E),n;for(;n=r?.shift();)(s=t(this,V))==null||s.call(this,...n);}};var Tt=Lt;var zt=class{constructor(e){w(this,"cache");w(this,"map",new Map);this.cache=new Tt({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{zt as CachedMap};
|
package/dist/history/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var Qe=Object.defineProperty;var je=u=>{throw TypeError(u)};var Ze=(u,e,t)=>e in u?Qe(u,e,{enumerable:true,configurable:true,writable:true,value:t}):u[e]=t;var p=(u,e,t)=>Ze(u,typeof e!="symbol"?e+"":e,t),Me=(u,e,t)=>e.has(u)||je("Cannot "+t);var i=(u,e,t)=>(Me(u,e,"read from private field"),t?t.call(u):e.get(u)),E=(u,e,t)=>e.has(u)?je("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(u):e.set(u,t),d=(u,e,t,r)=>(Me(u,e,"write to private field"),e.set(u,t),t),f=(u,e,t)=>(Me(u,e,"access private method"),t);var Ce=(u,e,t,r)=>({set _(s){d(u,e,s);},get _(){return i(u,e,r)}});var et={Date:true,RegExp:true,String:true,Number:true};function Te(u,e,t={cyclesFix:true},r=[]){let s=[],n=Array.isArray(u);for(let h in u){let l=u[h],b=n?+h:h;if(!(h in e)){s.push({type:"REMOVE",path:[b],oldValue:u[h]});continue}let w=e[h],v=typeof l=="object"&&typeof w=="object"&&Array.isArray(l)===Array.isArray(w);l&&w&&v&&!et[Object.getPrototypeOf(l)?.constructor?.name]&&(!t.cyclesFix||!r.includes(l))?s.push.apply(s,Te(l,w,t,t.cyclesFix?r.concat([l]):[]).map(_=>(_.path.unshift(b),_))):l!==w&&!(Number.isNaN(l)&&Number.isNaN(w))&&!(v&&(isNaN(l)?l+""==w+"":+l==+w))&&s.push({path:[b],type:"CHANGE",value:w,oldValue:l});}let o=Array.isArray(e);for(let h in e)h in u||s.push({type:"CREATE",path:[o?+h:h],value:e[h]});return s}var S;(s=>(s.log=(n,...o)=>console.log(`[Pixi\u2019VN] ${n}`,...o),s.warn=(n,...o)=>console.warn(`[Pixi\u2019VN] ${n}`,...o),s.error=(n,...o)=>console.error(`[Pixi\u2019VN] ${n}`,...o),s.info=(n,...o)=>console.info(`[Pixi\u2019VN] ${n}`,...o)))(S||(S={}));var m=class m{static init(e){m._getStepCounter=e.getStepCounter,m._setStepCounter=e.setStepCounter,m._getCurrentGameStepState=e.getCurrentGameStepState,m._restoreGameStepState=e.restoreGameStepState,m._getOpenedLabels=e.getOpenedLabels,e.onGoNextEnd&&(m._onGoNextEnd=e.onGoNextEnd),m._getVariable=e.getVariable,m._setVariable=e.setVariable,m._removeVariable=e.removeVariable,m._getFlag=e.getFlag,m._setFlag=e.setFlag,e.onLabelClosing&&(m._onLabelClosing=e.onLabelClosing),m._addHistoryItem=e.addHistoryItem,m._getCurrentStepsRunningNumber=e.getCurrentStepsRunningNumber,m._getCharacter=e.getCharacter;}static get stepCounter(){return m._getStepCounter()}static set stepCounter(e){m._setStepCounter(e);}static get currentGameStepState(){return m._getCurrentGameStepState()}static get restoreGameStepState(){return m._restoreGameStepState}static get openedLabels(){return m._getOpenedLabels()}static get onGoNextEnd(){return m._onGoNextEnd}static get getVariable(){return m._getVariable}static get setVariable(){return m._setVariable}static get removeVariable(){return m._removeVariable}static get getFlag(){return m._getFlag}static get setFlag(){return m._setFlag}static get onLabelClosing(){return m._onLabelClosing}static get addHistoryItem(){return m._addHistoryItem}static get currentStepsRunningNumber(){return m._getCurrentStepsRunningNumber()}static get getCharacter(){return m._getCharacter}};p(m,"_getStepCounter",()=>{throw S.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),p(m,"_setStepCounter",()=>{throw S.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),p(m,"_getCurrentGameStepState",()=>{throw S.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),p(m,"_restoreGameStepState",()=>{throw S.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),p(m,"_getOpenedLabels",()=>{throw S.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),p(m,"_onGoNextEnd",async()=>{}),p(m,"_getVariable",()=>{throw S.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),p(m,"_setVariable",()=>{throw S.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),p(m,"_removeVariable",()=>{throw S.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),p(m,"_getFlag",()=>{throw S.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),p(m,"_setFlag",()=>{throw S.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),p(m,"_onLabelClosing",()=>{}),p(m,"_addHistoryItem",()=>{throw S.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),p(m,"_getCurrentStepsRunningNumber",()=>{throw S.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),p(m,"_getCharacter",()=>{throw S.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")}),p(m,"onEnd"),p(m,"onError");var ee=m;function te(u){try{if(typeof u>"u")return u;let e=JSON.stringify(u);return JSON.parse(e)}catch(e){throw S.error("Error creating exportable element",u,e),new Error("[Pixi\u2019VN] Error creating exportable element")}}function Ke(u,e){let t=te(u);return e.length>1&&"type"in e[0]&&(e=e.reverse()),e.forEach(r=>{"type"in r?tt(t,r):it(t,r);}),t}function tt(u,e){let t=u;e.path&&e.path.length>0?e.path.forEach((r,s)=>{if(e.path&&s===e.path.length-1)switch(e.type){case "CHANGE":case "REMOVE":t[r]=e.oldValue;break;case "CREATE":Array.isArray(t)&&typeof r=="number"?t.splice(r,1):delete t[r];break}else t=t[r];}):S.warn("No path found, skipping diff",e);}function it(u,e){let t=u;e.path&&e.path.length>0?e.path.forEach((r,s)=>{if(e.path&&s===e.path.length-1){if(e.kind==="E"||e.kind==="D")t[r]=e.lhs;else if(e.kind==="N")Number.isInteger(r)?Array.isArray(t)&&t.splice(r,1):typeof r=="string"&&delete t[r];else if(e.kind==="A"){let n=e.index;e.item.kind==="N"?t[r].splice(n,1):e.item.kind==="E"||e.item.kind==="D"?t[r][n]=e.item.lhs:e.item.kind==="A"?S.warn("Nested array found, skipping diff",e):S.warn("No array found, skipping diff",e);}}else t=t[r];}):S.warn("No path found, skipping diff",e);}var me=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Ye=new Set,Ne=typeof process=="object"&&process?process:{},Je=(u,e,t,r)=>{typeof Ne.emitWarning=="function"?Ne.emitWarning(u,e,t,r):console.error(`[${t}] ${e}: ${u}`);},Fe=globalThis.AbortController,Be=globalThis.AbortSignal;if(typeof Fe>"u"){Be=class{constructor(){p(this,"onabort");p(this,"_onabort",[]);p(this,"reason");p(this,"aborted",false);}addEventListener(r,s){this._onabort.push(s);}},Fe=class{constructor(){p(this,"signal",new Be);e();}abort(r){if(!this.signal.aborted){this.signal.reason=r,this.signal.aborted=true;for(let s of this.signal._onabort)s(r);this.signal.onabort?.(r);}}};let u=Ne.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{u&&(u=false,Je("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 rt=u=>!Ye.has(u),re=u=>u&&u===Math.floor(u)&&u>0&&isFinite(u),qe=u=>re(u)?u<=Math.pow(2,8)?Uint8Array:u<=Math.pow(2,16)?Uint16Array:u<=Math.pow(2,32)?Uint32Array:u<=Number.MAX_SAFE_INTEGER?ge:null:null,ge=class extends Array{constructor(e){super(e),this.fill(0);}},ye,he=class he{constructor(e,t){p(this,"heap");p(this,"length");if(!i(he,ye))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0;}static create(e){let t=qe(e);if(!t)return [];d(he,ye,true);let r=new he(e,t);return d(he,ye,false),r}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}};ye=new WeakMap,E(he,ye,false);var Le=he,$e,Ue,K,R,B,ue,$,Se,be,T,U,C,x,g,D,k,I,z,Y,O,J,q,V,X,ae,M,we,a,Re,fe,ie,He,W,Xe,ce,ve,xe,se,ne,ke,ze,Oe,H,Ve,_e,oe,We,Pe=class Pe{constructor(e){E(this,a);E(this,K);E(this,R);E(this,B);E(this,ue);E(this,$);E(this,Se);E(this,be);p(this,"ttl");p(this,"ttlResolution");p(this,"ttlAutopurge");p(this,"updateAgeOnGet");p(this,"updateAgeOnHas");p(this,"allowStale");p(this,"noDisposeOnSet");p(this,"noUpdateTTL");p(this,"maxEntrySize");p(this,"sizeCalculation");p(this,"noDeleteOnFetchRejection");p(this,"noDeleteOnStaleGet");p(this,"allowStaleOnFetchAbort");p(this,"allowStaleOnFetchRejection");p(this,"ignoreFetchAbort");E(this,T);E(this,U);E(this,C);E(this,x);E(this,g);E(this,D);E(this,k);E(this,I);E(this,z);E(this,Y);E(this,O);E(this,J);E(this,q);E(this,V);E(this,X);E(this,ae);E(this,M);E(this,we);E(this,fe,()=>{});E(this,ie,()=>{});E(this,He,()=>{});E(this,W,()=>false);E(this,ce,e=>{});E(this,ve,(e,t,r)=>{});E(this,xe,(e,t,r,s)=>{if(r||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});p(this,$e,"LRUCache");let{max:t=0,ttl:r,ttlResolution:s=1,ttlAutopurge:n,updateAgeOnGet:o,updateAgeOnHas:h,allowStale:l,dispose:b,onInsert:w,disposeAfter:v,noDisposeOnSet:_,noUpdateTTL:P,maxSize:Z=0,maxEntrySize:G=0,sizeCalculation:A,fetchMethod:y,memoMethod:N,noDeleteOnFetchRejection:L,noDeleteOnStaleGet:F,allowStaleOnFetchRejection:j,allowStaleOnFetchAbort:Ee,ignoreFetchAbort:de}=e;if(t!==0&&!re(t))throw new TypeError("max option must be a nonnegative integer");let Ge=t?qe(t):Array;if(!Ge)throw new Error("invalid max value: "+t);if(d(this,K,t),d(this,R,Z),this.maxEntrySize=G||i(this,R),this.sizeCalculation=A,this.sizeCalculation){if(!i(this,R)&&!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(N!==void 0&&typeof N!="function")throw new TypeError("memoMethod must be a function if defined");if(d(this,be,N),y!==void 0&&typeof y!="function")throw new TypeError("fetchMethod must be a function if specified");if(d(this,Se,y),d(this,ae,!!y),d(this,C,new Map),d(this,x,new Array(t).fill(void 0)),d(this,g,new Array(t).fill(void 0)),d(this,D,new Ge(t)),d(this,k,new Ge(t)),d(this,I,0),d(this,z,0),d(this,Y,Le.create(t)),d(this,T,0),d(this,U,0),typeof b=="function"&&d(this,B,b),typeof w=="function"&&d(this,ue,w),typeof v=="function"?(d(this,$,v),d(this,O,[])):(d(this,$,void 0),d(this,O,void 0)),d(this,X,!!i(this,B)),d(this,we,!!i(this,ue)),d(this,M,!!i(this,$)),this.noDisposeOnSet=!!_,this.noUpdateTTL=!!P,this.noDeleteOnFetchRejection=!!L,this.allowStaleOnFetchRejection=!!j,this.allowStaleOnFetchAbort=!!Ee,this.ignoreFetchAbort=!!de,this.maxEntrySize!==0){if(i(this,R)!==0&&!re(i(this,R)))throw new TypeError("maxSize must be a positive integer if specified");if(!re(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");f(this,a,Xe).call(this);}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!F,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!h,this.ttlResolution=re(s)||s===0?s:1,this.ttlAutopurge=!!n,this.ttl=r||0,this.ttl){if(!re(this.ttl))throw new TypeError("ttl must be a positive integer if specified");f(this,a,Re).call(this);}if(i(this,K)===0&&this.ttl===0&&i(this,R)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!i(this,K)&&!i(this,R)){let pe="LRU_CACHE_UNBOUNDED";rt(pe)&&(Ye.add(pe),Je("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",pe,Pe));}}static unsafeExposeInternals(e){return {starts:i(e,q),ttls:i(e,V),sizes:i(e,J),keyMap:i(e,C),keyList:i(e,x),valList:i(e,g),next:i(e,D),prev:i(e,k),get head(){return i(e,I)},get tail(){return i(e,z)},free:i(e,Y),isBackgroundFetch:t=>{var r;return f(r=e,a,H).call(r,t)},backgroundFetch:(t,r,s,n)=>{var o;return f(o=e,a,Oe).call(o,t,r,s,n)},moveToTail:t=>{var r;return f(r=e,a,_e).call(r,t)},indexes:t=>{var r;return f(r=e,a,se).call(r,t)},rindexes:t=>{var r;return f(r=e,a,ne).call(r,t)},isStale:t=>{var r;return i(r=e,W).call(r,t)}}}get max(){return i(this,K)}get maxSize(){return i(this,R)}get calculatedSize(){return i(this,U)}get size(){return i(this,T)}get fetchMethod(){return i(this,Se)}get memoMethod(){return i(this,be)}get dispose(){return i(this,B)}get onInsert(){return i(this,ue)}get disposeAfter(){return i(this,$)}getRemainingTTL(e){return i(this,C).has(e)?1/0:0}*entries(){for(let e of f(this,a,se).call(this))i(this,g)[e]!==void 0&&i(this,x)[e]!==void 0&&!f(this,a,H).call(this,i(this,g)[e])&&(yield [i(this,x)[e],i(this,g)[e]]);}*rentries(){for(let e of f(this,a,ne).call(this))i(this,g)[e]!==void 0&&i(this,x)[e]!==void 0&&!f(this,a,H).call(this,i(this,g)[e])&&(yield [i(this,x)[e],i(this,g)[e]]);}*keys(){for(let e of f(this,a,se).call(this)){let t=i(this,x)[e];t!==void 0&&!f(this,a,H).call(this,i(this,g)[e])&&(yield t);}}*rkeys(){for(let e of f(this,a,ne).call(this)){let t=i(this,x)[e];t!==void 0&&!f(this,a,H).call(this,i(this,g)[e])&&(yield t);}}*values(){for(let e of f(this,a,se).call(this))i(this,g)[e]!==void 0&&!f(this,a,H).call(this,i(this,g)[e])&&(yield i(this,g)[e]);}*rvalues(){for(let e of f(this,a,ne).call(this))i(this,g)[e]!==void 0&&!f(this,a,H).call(this,i(this,g)[e])&&(yield i(this,g)[e]);}[(Ue=Symbol.iterator,$e=Symbol.toStringTag,Ue)](){return this.entries()}find(e,t={}){for(let r of f(this,a,se).call(this)){let s=i(this,g)[r],n=f(this,a,H).call(this,s)?s.__staleWhileFetching:s;if(n!==void 0&&e(n,i(this,x)[r],this))return this.get(i(this,x)[r],t)}}forEach(e,t=this){for(let r of f(this,a,se).call(this)){let s=i(this,g)[r],n=f(this,a,H).call(this,s)?s.__staleWhileFetching:s;n!==void 0&&e.call(t,n,i(this,x)[r],this);}}rforEach(e,t=this){for(let r of f(this,a,ne).call(this)){let s=i(this,g)[r],n=f(this,a,H).call(this,s)?s.__staleWhileFetching:s;n!==void 0&&e.call(t,n,i(this,x)[r],this);}}purgeStale(){let e=false;for(let t of f(this,a,ne).call(this,{allowStale:true}))i(this,W).call(this,t)&&(f(this,a,oe).call(this,i(this,x)[t],"expire"),e=true);return e}info(e){let t=i(this,C).get(e);if(t===void 0)return;let r=i(this,g)[t],s=f(this,a,H).call(this,r)?r.__staleWhileFetching:r;if(s===void 0)return;let n={value:s};if(i(this,V)&&i(this,q)){let o=i(this,V)[t],h=i(this,q)[t];if(o&&h){let l=o-(me.now()-h);n.ttl=l,n.start=Date.now();}}return i(this,J)&&(n.size=i(this,J)[t]),n}dump(){let e=[];for(let t of f(this,a,se).call(this,{allowStale:true})){let r=i(this,x)[t],s=i(this,g)[t],n=f(this,a,H).call(this,s)?s.__staleWhileFetching:s;if(n===void 0||r===void 0)continue;let o={value:n};if(i(this,V)&&i(this,q)){o.ttl=i(this,V)[t];let h=me.now()-i(this,q)[t];o.start=Math.floor(Date.now()-h);}i(this,J)&&(o.size=i(this,J)[t]),e.unshift([r,o]);}return e}load(e){this.clear();for(let[t,r]of e){if(r.start){let s=Date.now()-r.start;r.start=me.now()-s;}this.set(t,r.value,r);}}set(e,t,r={}){var _,P,Z,G;if(t===void 0)return this.delete(e),this;let{ttl:s=this.ttl,start:n,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:h=this.sizeCalculation,status:l}=r,{noUpdateTTL:b=this.noUpdateTTL}=r,w=i(this,xe).call(this,e,t,r.size||0,h);if(this.maxEntrySize&&w>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=true),f(this,a,oe).call(this,e,"set"),this;let v=i(this,T)===0?void 0:i(this,C).get(e);if(v===void 0)v=i(this,T)===0?i(this,z):i(this,Y).length!==0?i(this,Y).pop():i(this,T)===i(this,K)?f(this,a,ze).call(this,false):i(this,T),i(this,x)[v]=e,i(this,g)[v]=t,i(this,C).set(e,v),i(this,D)[i(this,z)]=v,i(this,k)[v]=i(this,z),d(this,z,v),Ce(this,T)._++,i(this,ve).call(this,v,w,l),l&&(l.set="add"),b=false,i(this,we)&&((_=i(this,ue))==null||_.call(this,t,e,"add"));else {f(this,a,_e).call(this,v);let A=i(this,g)[v];if(t!==A){if(i(this,ae)&&f(this,a,H).call(this,A)){A.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:y}=A;y!==void 0&&!o&&(i(this,X)&&((P=i(this,B))==null||P.call(this,y,e,"set")),i(this,M)&&i(this,O)?.push([y,e,"set"]));}else o||(i(this,X)&&((Z=i(this,B))==null||Z.call(this,A,e,"set")),i(this,M)&&i(this,O)?.push([A,e,"set"]));if(i(this,ce).call(this,v),i(this,ve).call(this,v,w,l),i(this,g)[v]=t,l){l.set="replace";let y=A&&f(this,a,H).call(this,A)?A.__staleWhileFetching:A;y!==void 0&&(l.oldValue=y);}}else l&&(l.set="update");i(this,we)&&this.onInsert?.(t,e,t===A?"update":"replace");}if(s!==0&&!i(this,V)&&f(this,a,Re).call(this),i(this,V)&&(b||i(this,He).call(this,v,s,n),l&&i(this,ie).call(this,l,v)),!o&&i(this,M)&&i(this,O)){let A=i(this,O),y;for(;y=A?.shift();)(G=i(this,$))==null||G.call(this,...y);}return this}pop(){var e;try{for(;i(this,T);){let t=i(this,g)[i(this,I)];if(f(this,a,ze).call(this,!0),f(this,a,H).call(this,t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(i(this,M)&&i(this,O)){let t=i(this,O),r;for(;r=t?.shift();)(e=i(this,$))==null||e.call(this,...r);}}}has(e,t={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:s}=t,n=i(this,C).get(e);if(n!==void 0){let o=i(this,g)[n];if(f(this,a,H).call(this,o)&&o.__staleWhileFetching===void 0)return false;if(i(this,W).call(this,n))s&&(s.has="stale",i(this,ie).call(this,s,n));else return r&&i(this,fe).call(this,n),s&&(s.has="hit",i(this,ie).call(this,s,n)),true}else s&&(s.has="miss");return false}peek(e,t={}){let{allowStale:r=this.allowStale}=t,s=i(this,C).get(e);if(s===void 0||!r&&i(this,W).call(this,s))return;let n=i(this,g)[s];return f(this,a,H).call(this,n)?n.__staleWhileFetching:n}async fetch(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:h=this.noDisposeOnSet,size:l=0,sizeCalculation:b=this.sizeCalculation,noUpdateTTL:w=this.noUpdateTTL,noDeleteOnFetchRejection:v=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:_=this.allowStaleOnFetchRejection,ignoreFetchAbort:P=this.ignoreFetchAbort,allowStaleOnFetchAbort:Z=this.allowStaleOnFetchAbort,context:G,forceRefresh:A=false,status:y,signal:N}=t;if(!i(this,ae))return y&&(y.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:s,noDeleteOnStaleGet:n,status:y});let L={allowStale:r,updateAgeOnGet:s,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:h,size:l,sizeCalculation:b,noUpdateTTL:w,noDeleteOnFetchRejection:v,allowStaleOnFetchRejection:_,allowStaleOnFetchAbort:Z,ignoreFetchAbort:P,status:y,signal:N},F=i(this,C).get(e);if(F===void 0){y&&(y.fetch="miss");let j=f(this,a,Oe).call(this,e,F,L,G);return j.__returned=j}else {let j=i(this,g)[F];if(f(this,a,H).call(this,j)){let De=r&&j.__staleWhileFetching!==void 0;return y&&(y.fetch="inflight",De&&(y.returnedStale=true)),De?j.__staleWhileFetching:j.__returned=j}let Ee=i(this,W).call(this,F);if(!A&&!Ee)return y&&(y.fetch="hit"),f(this,a,_e).call(this,F),s&&i(this,fe).call(this,F),y&&i(this,ie).call(this,y,F),j;let de=f(this,a,Oe).call(this,e,F,L,G),pe=de.__staleWhileFetching!==void 0&&r;return y&&(y.fetch=Ee?"stale":"refresh",pe&&Ee&&(y.returnedStale=true)),pe?de.__staleWhileFetching:de.__returned=de}}async forceFetch(e,t={}){let r=await this.fetch(e,t);if(r===void 0)throw new Error("fetch() returned undefined");return r}memo(e,t={}){let r=i(this,be);if(!r)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:n,...o}=t,h=this.get(e,o);if(!n&&h!==void 0)return h;let l=r(e,h,{options:o,context:s});return this.set(e,l,o),l}get(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:o}=t,h=i(this,C).get(e);if(h!==void 0){let l=i(this,g)[h],b=f(this,a,H).call(this,l);return o&&i(this,ie).call(this,o,h),i(this,W).call(this,h)?(o&&(o.get="stale"),b?(o&&r&&l.__staleWhileFetching!==void 0&&(o.returnedStale=true),r?l.__staleWhileFetching:void 0):(n||f(this,a,oe).call(this,e,"expire"),o&&r&&(o.returnedStale=true),r?l:void 0)):(o&&(o.get="hit"),b?l.__staleWhileFetching:(f(this,a,_e).call(this,h),s&&i(this,fe).call(this,h),l))}else o&&(o.get="miss");}delete(e){return f(this,a,oe).call(this,e,"delete")}clear(){return f(this,a,We).call(this,"delete")}};K=new WeakMap,R=new WeakMap,B=new WeakMap,ue=new WeakMap,$=new WeakMap,Se=new WeakMap,be=new WeakMap,T=new WeakMap,U=new WeakMap,C=new WeakMap,x=new WeakMap,g=new WeakMap,D=new WeakMap,k=new WeakMap,I=new WeakMap,z=new WeakMap,Y=new WeakMap,O=new WeakMap,J=new WeakMap,q=new WeakMap,V=new WeakMap,X=new WeakMap,ae=new WeakMap,M=new WeakMap,we=new WeakMap,a=new WeakSet,Re=function(){let e=new ge(i(this,K)),t=new ge(i(this,K));d(this,V,e),d(this,q,t),d(this,He,(n,o,h=me.now())=>{if(t[n]=o!==0?h:0,e[n]=o,o!==0&&this.ttlAutopurge){let l=setTimeout(()=>{i(this,W).call(this,n)&&f(this,a,oe).call(this,i(this,x)[n],"expire");},o+1);l.unref&&l.unref();}}),d(this,fe,n=>{t[n]=e[n]!==0?me.now():0;}),d(this,ie,(n,o)=>{if(e[o]){let h=e[o],l=t[o];if(!h||!l)return;n.ttl=h,n.start=l,n.now=r||s();let b=n.now-l;n.remainingTTL=h-b;}});let r=0,s=()=>{let n=me.now();if(this.ttlResolution>0){r=n;let o=setTimeout(()=>r=0,this.ttlResolution);o.unref&&o.unref();}return n};this.getRemainingTTL=n=>{let o=i(this,C).get(n);if(o===void 0)return 0;let h=e[o],l=t[o];if(!h||!l)return 1/0;let b=(r||s())-l;return h-b},d(this,W,n=>{let o=t[n],h=e[n];return !!h&&!!o&&(r||s())-o>h});},fe=new WeakMap,ie=new WeakMap,He=new WeakMap,W=new WeakMap,Xe=function(){let e=new ge(i(this,K));d(this,U,0),d(this,J,e),d(this,ce,t=>{d(this,U,i(this,U)-e[t]),e[t]=0;}),d(this,xe,(t,r,s,n)=>{if(f(this,a,H).call(this,r))return 0;if(!re(s))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(s=n(r,t),!re(s))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 s}),d(this,ve,(t,r,s)=>{if(e[t]=r,i(this,R)){let n=i(this,R)-e[t];for(;i(this,U)>n;)f(this,a,ze).call(this,true);}d(this,U,i(this,U)+e[t]),s&&(s.entrySize=r,s.totalCalculatedSize=i(this,U));});},ce=new WeakMap,ve=new WeakMap,xe=new WeakMap,se=function*({allowStale:e=this.allowStale}={}){if(i(this,T))for(let t=i(this,z);!(!f(this,a,ke).call(this,t)||((e||!i(this,W).call(this,t))&&(yield t),t===i(this,I)));)t=i(this,k)[t];},ne=function*({allowStale:e=this.allowStale}={}){if(i(this,T))for(let t=i(this,I);!(!f(this,a,ke).call(this,t)||((e||!i(this,W).call(this,t))&&(yield t),t===i(this,z)));)t=i(this,D)[t];},ke=function(e){return e!==void 0&&i(this,C).get(i(this,x)[e])===e},ze=function(e){var n;let t=i(this,I),r=i(this,x)[t],s=i(this,g)[t];return i(this,ae)&&f(this,a,H).call(this,s)?s.__abortController.abort(new Error("evicted")):(i(this,X)||i(this,M))&&(i(this,X)&&((n=i(this,B))==null||n.call(this,s,r,"evict")),i(this,M)&&i(this,O)?.push([s,r,"evict"])),i(this,ce).call(this,t),e&&(i(this,x)[t]=void 0,i(this,g)[t]=void 0,i(this,Y).push(t)),i(this,T)===1?(d(this,I,d(this,z,0)),i(this,Y).length=0):d(this,I,i(this,D)[t]),i(this,C).delete(r),Ce(this,T)._--,t},Oe=function(e,t,r,s){let n=t===void 0?void 0:i(this,g)[t];if(f(this,a,H).call(this,n))return n;let o=new Fe,{signal:h}=r;h?.addEventListener("abort",()=>o.abort(h.reason),{signal:o.signal});let l={signal:o.signal,options:r,context:s},b=(G,A=false)=>{let{aborted:y}=o.signal,N=r.ignoreFetchAbort&&G!==void 0;if(r.status&&(y&&!A?(r.status.fetchAborted=true,r.status.fetchError=o.signal.reason,N&&(r.status.fetchAbortIgnored=true)):r.status.fetchResolved=true),y&&!N&&!A)return v(o.signal.reason);let L=P;return i(this,g)[t]===P&&(G===void 0?L.__staleWhileFetching?i(this,g)[t]=L.__staleWhileFetching:f(this,a,oe).call(this,e,"fetch"):(r.status&&(r.status.fetchUpdated=true),this.set(e,G,l.options))),G},w=G=>(r.status&&(r.status.fetchRejected=true,r.status.fetchError=G),v(G)),v=G=>{let{aborted:A}=o.signal,y=A&&r.allowStaleOnFetchAbort,N=y||r.allowStaleOnFetchRejection,L=N||r.noDeleteOnFetchRejection,F=P;if(i(this,g)[t]===P&&(!L||F.__staleWhileFetching===void 0?f(this,a,oe).call(this,e,"fetch"):y||(i(this,g)[t]=F.__staleWhileFetching)),N)return r.status&&F.__staleWhileFetching!==void 0&&(r.status.returnedStale=true),F.__staleWhileFetching;if(F.__returned===F)throw G},_=(G,A)=>{var N;let y=(N=i(this,Se))==null?void 0:N.call(this,e,n,l);y&&y instanceof Promise&&y.then(L=>G(L===void 0?void 0:L),A),o.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(G(void 0),r.allowStaleOnFetchAbort&&(G=L=>b(L,true)));});};r.status&&(r.status.fetchDispatched=true);let P=new Promise(_).then(b,w),Z=Object.assign(P,{__abortController:o,__staleWhileFetching:n,__returned:void 0});return t===void 0?(this.set(e,Z,{...l.options,status:void 0}),t=i(this,C).get(e)):i(this,g)[t]=Z,Z},H=function(e){if(!i(this,ae))return false;let t=e;return !!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof Fe},Ve=function(e,t){i(this,k)[t]=e,i(this,D)[e]=t;},_e=function(e){e!==i(this,z)&&(e===i(this,I)?d(this,I,i(this,D)[e]):f(this,a,Ve).call(this,i(this,k)[e],i(this,D)[e]),f(this,a,Ve).call(this,i(this,z),e),d(this,z,e));},oe=function(e,t){var s,n;let r=false;if(i(this,T)!==0){let o=i(this,C).get(e);if(o!==void 0)if(r=true,i(this,T)===1)f(this,a,We).call(this,t);else {i(this,ce).call(this,o);let h=i(this,g)[o];if(f(this,a,H).call(this,h)?h.__abortController.abort(new Error("deleted")):(i(this,X)||i(this,M))&&(i(this,X)&&((s=i(this,B))==null||s.call(this,h,e,t)),i(this,M)&&i(this,O)?.push([h,e,t])),i(this,C).delete(e),i(this,x)[o]=void 0,i(this,g)[o]=void 0,o===i(this,z))d(this,z,i(this,k)[o]);else if(o===i(this,I))d(this,I,i(this,D)[o]);else {let l=i(this,k)[o];i(this,D)[l]=i(this,D)[o];let b=i(this,D)[o];i(this,k)[b]=i(this,k)[o];}Ce(this,T)._--,i(this,Y).push(o);}}if(i(this,M)&&i(this,O)?.length){let o=i(this,O),h;for(;h=o?.shift();)(n=i(this,$))==null||n.call(this,...h);}return r},We=function(e){var t,r;for(let s of f(this,a,ne).call(this,{allowStale:true})){let n=i(this,g)[s];if(f(this,a,H).call(this,n))n.__abortController.abort(new Error("deleted"));else {let o=i(this,x)[s];i(this,X)&&((t=i(this,B))==null||t.call(this,n,o,e)),i(this,M)&&i(this,O)?.push([n,o,e]);}}if(i(this,C).clear(),i(this,g).fill(void 0),i(this,x).fill(void 0),i(this,V)&&i(this,q)&&(i(this,V).fill(0),i(this,q).fill(0)),i(this,J)&&i(this,J).fill(0),d(this,I,0),d(this,z,0),i(this,Y).length=0,d(this,U,0),d(this,T,0),i(this,M)&&i(this,O)){let s=i(this,O),n;for(;n=s?.shift();)(r=i(this,$))==null||r.call(this,...n);}};var Ie=Pe;var le=class{constructor(e){p(this,"cache");p(this,"map",new Map);this.cache=new Ie({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 t=this.map.delete(e);return t&&this.cache.delete(e),t}get forEach(){return this.map.forEach}get(e){let t=this.cache.get(e);return t||this.map.get(e)}has(e){return this.map.has(e)}set(e,t){return this.map.set(e,t),this.cache.set(e,t),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var Q=class Q{static get originalStepData(){return Q._originalStepData?te(Q._originalStepData):{path:"",storage:{},canvas:{elementAliasesOrder:[],elements:{},stage:{},tickers:{},tickersSteps:{},tickersOnPause:{},tickersToCompleteOnStepEnd:{tikersIds:[],stepAlias:[]}},sound:{soundAliasesOrder:[],soundsPlaying:{},playInStepIndex:{},filters:void 0},labelIndex:-1,openedLabels:[]}}static set originalStepData(e){Q._originalStepData=te(e);}};p(Q,"_diffHistory",new le({cacheSize:5})),p(Q,"_stepsInfoHistory",new le({cacheSize:5})),p(Q,"_narrationHistory",new le({cacheSize:50})),p(Q,"stepLimitSaved",20),p(Q,"goBackRunning",false),p(Q,"_originalStepData");var c=Q;var Ae=class{get stepsInfoMap(){return c._stepsInfoHistory}get diffMap(){return c._diffHistory}get narrationMap(){return c._narrationHistory}get size(){return c._stepsInfoHistory.size}get lastKey(){return this.size===0?null:Math.max(...Array.from(this.keys()))}keys(){return c._stepsInfoHistory.keys()}get(e){let t=c._narrationHistory.get(e);if(!(t&&Object.keys(t).length===1&&t.stepIndex!==void 0))return t}delete(e){c._stepsInfoHistory.delete(e),c._diffHistory.delete(e),c._narrationHistory.delete(e);}internalRestoreOldGameState(e,t){if(e<=0||this.size==0)return t;let r=this.lastKey;if(typeof r!="number")return S.error("You can't go back, there is no step to go back"),t;let s=c._diffHistory.get(r);if(s)try{let n=Ke(t,s);return ee.stepCounter=r,this.delete(r),this.internalRestoreOldGameState(e-1,n)}catch(n){return S.error("Error applying diff",n),t}else return S.error("You can't go back, there is no step to go back"),t}async goBack(e,t=1){if(t<=0){S.warn("The parameter steps must be greater than 0");return}if(c._diffHistory.size<1){S.warn("You can't go back, there is no step to go back");return}if(c.goBackRunning){S.warn("Go back is already running");return}c.goBackRunning=true;try{let r=te(this.internalRestoreOldGameState(t,c.originalStepData));if(r){await ee.restoreGameStepState(r,e);let s=ee.stepCounter-1,n=c._narrationHistory.get(s);if(n&&Object.keys(n).length===1&&n.stepIndex!==void 0){let o=c._stepsInfoHistory.get(s);if(o){let h=this.itemMapper({step:o});c._narrationHistory.set(o.index,h);}}}else S.error("Error going back");c.originalStepData=r,c.goBackRunning=!1;}catch(r){S.error("Error going back",r),c.goBackRunning=false;}}add(e,t={}){let r=c.originalStepData,{ignoreSameStep:s}=t,n=ee.currentGameStepState;if(!s&&this.isSameStep(r,n))return;let o=this.lastKey;(async()=>{try{let l,b;if(typeof o=="number"&&(l=c._stepsInfoHistory.get(o),b=c._narrationHistory.get(o)),c._stepsInfoHistory.set(e.index,e),e.index!==0){let _=Te(r,n);_?c._diffHistory.set(e.index,_):S.warn("It was not possible to create the difference between the two steps");}let w={},v=this.itemMapper({step:e},w);if(c._narrationHistory.set(e.index,v),l&&b&&typeof o=="number"){let _=this.itemMapper({...w,step:l},{});c._narrationHistory.set(o,_);}}catch(l){S.error("Error adding history step",l);}})(),c.originalStepData=n;}itemMapper(e,t){let{step:r,choiceIndexMade:s,inputValue:n,removeDialogue:o}=e,h=r.dialogue||r.dialoge;t&&r.isGlued&&(t.removeDialogue=true),o&&(h=void 0);let l=r.choices;if(t&&r.currentLabel&&r.choiceIndexMade!==void 0&&(t.choiceIndexMade=r.choiceIndexMade),r.inputValue&&t&&(t.inputValue=r.inputValue),h||l||n){let b=l?.map((w,v)=>{let _=false;return w.oneTime&&r.alreadyMadeChoices&&r.alreadyMadeChoices.includes(v)&&(_=true),{text:w.text,type:w.type,isResponse:false,hidden:_}});if(b){if(b.every(w=>w.hidden)){let w=b.find(v=>v.hidden===false);w&&(w.hidden=false);}s!==void 0&&(b[s].isResponse=true);}return {dialogue:h?{...h,character:h.character?ee.getCharacter(h.character)||h.character:void 0}:void 0,playerMadeChoice:typeof s=="number",choices:b,stepIndex:r.index,inputValue:n}}return {stepIndex:r.index}}get narrativeHistory(){let e=[];return Array.from(this.keys()).sort((r,s)=>r-s).forEach(r=>{let s=this.get(r);s&&e.push(s);}),e}get currentLabelHistory(){let e=[],t=Array.from(this.keys()).sort((l,b)=>b-l);if(t.length===0)return e;let r=t[0];if(typeof r!="number")return e;let s=c._stepsInfoHistory.get(r);if(!s)return e;let n=s.openedLabels;if(!n||!Array.isArray(n)||n.length===0)return e;let o=n[0].currentStepIndex,h=n[0].label;return t.every((l,b)=>{let w=this.get(l);if(w){if(b===0)return e.push(w),true;let v=c._stepsInfoHistory.get(l);if(!v)return true;let _=v.openedLabels;if(!_||!Array.isArray(_)||_.length===0||_[0].label!==h||_[0].currentStepIndex>=o)return false;o=_[0].currentStepIndex,e.push(w);}return true}),e.reverse()}removeNarrativeHistory(e){if(e){let t=Array.from(this.keys()).sort((r,s)=>r-s);t=t.slice(0,e),t.forEach(r=>{c._narrationHistory.delete(r),c._stepsInfoHistory.delete(r),c._diffHistory.delete(r);});}else c._stepsInfoHistory.clear(),c._diffHistory.clear(),c._narrationHistory.clear();}get canGoBack(){let e=this.lastKey;return typeof e!="number"?false:c._diffHistory.has(e)}blockGoBack(){ee.currentStepsRunningNumber===0&&c._diffHistory.clear();}isSameStep(e,t){if(e.openedLabels.length===t.openedLabels.length)try{let r=JSON.stringify(e.openedLabels),s=JSON.stringify(t.openedLabels);if(r===s&&e.path===t.path&&e.labelIndex===t.labelIndex)return !0}catch(r){return S.error("Error comparing opened labels",r),true}return false}clear(){c._stepsInfoHistory.clear(),c._diffHistory.clear(),c._narrationHistory.clear(),c._originalStepData=void 0;}get stepLimitSaved(){return c.stepLimitSaved}set stepLimitSaved(e){c.stepLimitSaved=e;}export(){let e=Array.from(this.keys()).sort((r,s)=>r-s);e.length>this.stepLimitSaved&&(e=e.slice(e.length-this.stepLimitSaved));let t=[];return e.forEach(r=>{let s=c._stepsInfoHistory.get(r);if(s){let n=c._diffHistory.get(r);t.push({...s,diff:n});}}),{stepsHistory:te(t),originalStepData:te(c._originalStepData)}}restoreNarrativeHistory(){let e=Array.from(this.keys()).sort((r,s)=>r-s),t={};e.forEach(r=>{let s=c._stepsInfoHistory.get(r);if(s){let n={...t};t={};let o=this.itemMapper({step:s,choiceIndexMade:n.choiceIndexMade,inputValue:n.inputValue,removeDialogue:n.removeDialogue},t);o&&c._narrationHistory.set(r,o);}});}async restore(e){this.clear();try{e.hasOwnProperty("stepsHistory")?(e.stepsHistory.forEach(r=>{r.diff&&c._diffHistory.set(r.index,r.diff);let s={...r,diff:void 0};c._stepsInfoHistory.set(r.index,s);}),this.restoreNarrativeHistory()):S.warn("Could not import stepsHistory data, so will be ignored"),e.hasOwnProperty("originalStepData")?c._originalStepData=e.originalStepData:S.warn("Could not import originalStepData data, so will be ignored");}catch(t){S.error("Error importing data",t);}}};var kt=new Ae;exports.HistoryManagerStatic=c;exports.stepHistory=kt;
|
package/dist/history/index.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var Qe=Object.defineProperty;var je=u=>{throw TypeError(u)};var Ze=(u,e,t)=>e in u?Qe(u,e,{enumerable:true,configurable:true,writable:true,value:t}):u[e]=t;var p=(u,e,t)=>Ze(u,typeof e!="symbol"?e+"":e,t),Me=(u,e,t)=>e.has(u)||je("Cannot "+t);var i=(u,e,t)=>(Me(u,e,"read from private field"),t?t.call(u):e.get(u)),E=(u,e,t)=>e.has(u)?je("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(u):e.set(u,t),d=(u,e,t,r)=>(Me(u,e,"write to private field"),e.set(u,t),t),f=(u,e,t)=>(Me(u,e,"access private method"),t);var Ce=(u,e,t,r)=>({set _(s){d(u,e,s);},get _(){return i(u,e,r)}});var et={Date:true,RegExp:true,String:true,Number:true};function Te(u,e,t={cyclesFix:true},r=[]){let s=[],n=Array.isArray(u);for(let h in u){let l=u[h],b=n?+h:h;if(!(h in e)){s.push({type:"REMOVE",path:[b],oldValue:u[h]});continue}let w=e[h],v=typeof l=="object"&&typeof w=="object"&&Array.isArray(l)===Array.isArray(w);l&&w&&v&&!et[Object.getPrototypeOf(l)?.constructor?.name]&&(!t.cyclesFix||!r.includes(l))?s.push.apply(s,Te(l,w,t,t.cyclesFix?r.concat([l]):[]).map(_=>(_.path.unshift(b),_))):l!==w&&!(Number.isNaN(l)&&Number.isNaN(w))&&!(v&&(isNaN(l)?l+""==w+"":+l==+w))&&s.push({path:[b],type:"CHANGE",value:w,oldValue:l});}let o=Array.isArray(e);for(let h in e)h in u||s.push({type:"CREATE",path:[o?+h:h],value:e[h]});return s}var S;(s=>(s.log=(n,...o)=>console.log(`[Pixi\u2019VN] ${n}`,...o),s.warn=(n,...o)=>console.warn(`[Pixi\u2019VN] ${n}`,...o),s.error=(n,...o)=>console.error(`[Pixi\u2019VN] ${n}`,...o),s.info=(n,...o)=>console.info(`[Pixi\u2019VN] ${n}`,...o)))(S||(S={}));var m=class m{static init(e){m._getStepCounter=e.getStepCounter,m._setStepCounter=e.setStepCounter,m._getCurrentGameStepState=e.getCurrentGameStepState,m._restoreGameStepState=e.restoreGameStepState,m._getOpenedLabels=e.getOpenedLabels,e.onGoNextEnd&&(m._onGoNextEnd=e.onGoNextEnd),m._getVariable=e.getVariable,m._setVariable=e.setVariable,m._removeVariable=e.removeVariable,m._getFlag=e.getFlag,m._setFlag=e.setFlag,e.onLabelClosing&&(m._onLabelClosing=e.onLabelClosing),m._addHistoryItem=e.addHistoryItem,m._getCurrentStepsRunningNumber=e.getCurrentStepsRunningNumber,m._getCharacter=e.getCharacter;}static get stepCounter(){return m._getStepCounter()}static set stepCounter(e){m._setStepCounter(e);}static get currentGameStepState(){return m._getCurrentGameStepState()}static get restoreGameStepState(){return m._restoreGameStepState}static get openedLabels(){return m._getOpenedLabels()}static get onGoNextEnd(){return m._onGoNextEnd}static get getVariable(){return m._getVariable}static get setVariable(){return m._setVariable}static get removeVariable(){return m._removeVariable}static get getFlag(){return m._getFlag}static get setFlag(){return m._setFlag}static get onLabelClosing(){return m._onLabelClosing}static get addHistoryItem(){return m._addHistoryItem}static get currentStepsRunningNumber(){return m._getCurrentStepsRunningNumber()}static get getCharacter(){return m._getCharacter}};p(m,"_getStepCounter",()=>{throw S.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),p(m,"_setStepCounter",()=>{throw S.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),p(m,"_getCurrentGameStepState",()=>{throw S.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),p(m,"_restoreGameStepState",()=>{throw S.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),p(m,"_getOpenedLabels",()=>{throw S.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),p(m,"_onGoNextEnd",async()=>{}),p(m,"_getVariable",()=>{throw S.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),p(m,"_setVariable",()=>{throw S.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),p(m,"_removeVariable",()=>{throw S.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),p(m,"_getFlag",()=>{throw S.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),p(m,"_setFlag",()=>{throw S.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),p(m,"_onLabelClosing",()=>{}),p(m,"_addHistoryItem",()=>{throw S.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),p(m,"_getCurrentStepsRunningNumber",()=>{throw S.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),p(m,"_getCharacter",()=>{throw S.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")}),p(m,"onEnd"),p(m,"onError");var ee=m;function te(u){try{if(typeof u>"u")return u;let e=JSON.stringify(u);return JSON.parse(e)}catch(e){throw S.error("Error creating exportable element",u,e),new Error("[Pixi\u2019VN] Error creating exportable element")}}function Ke(u,e){let t=te(u);return e.length>1&&"type"in e[0]&&(e=e.reverse()),e.forEach(r=>{"type"in r?tt(t,r):it(t,r);}),t}function tt(u,e){let t=u;e.path&&e.path.length>0?e.path.forEach((r,s)=>{if(e.path&&s===e.path.length-1)switch(e.type){case "CHANGE":case "REMOVE":t[r]=e.oldValue;break;case "CREATE":Array.isArray(t)&&typeof r=="number"?t.splice(r,1):delete t[r];break}else t=t[r];}):S.warn("No path found, skipping diff",e);}function it(u,e){let t=u;e.path&&e.path.length>0?e.path.forEach((r,s)=>{if(e.path&&s===e.path.length-1){if(e.kind==="E"||e.kind==="D")t[r]=e.lhs;else if(e.kind==="N")Number.isInteger(r)?Array.isArray(t)&&t.splice(r,1):typeof r=="string"&&delete t[r];else if(e.kind==="A"){let n=e.index;e.item.kind==="N"?t[r].splice(n,1):e.item.kind==="E"||e.item.kind==="D"?t[r][n]=e.item.lhs:e.item.kind==="A"?S.warn("Nested array found, skipping diff",e):S.warn("No array found, skipping diff",e);}}else t=t[r];}):S.warn("No path found, skipping diff",e);}var me=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Ye=new Set,Ne=typeof process=="object"&&process?process:{},Je=(u,e,t,r)=>{typeof Ne.emitWarning=="function"?Ne.emitWarning(u,e,t,r):console.error(`[${t}] ${e}: ${u}`);},Fe=globalThis.AbortController,Be=globalThis.AbortSignal;if(typeof Fe>"u"){Be=class{constructor(){p(this,"onabort");p(this,"_onabort",[]);p(this,"reason");p(this,"aborted",false);}addEventListener(r,s){this._onabort.push(s);}},Fe=class{constructor(){p(this,"signal",new Be);e();}abort(r){if(!this.signal.aborted){this.signal.reason=r,this.signal.aborted=true;for(let s of this.signal._onabort)s(r);this.signal.onabort?.(r);}}};let u=Ne.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{u&&(u=false,Je("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 rt=u=>!Ye.has(u),re=u=>u&&u===Math.floor(u)&&u>0&&isFinite(u),qe=u=>re(u)?u<=Math.pow(2,8)?Uint8Array:u<=Math.pow(2,16)?Uint16Array:u<=Math.pow(2,32)?Uint32Array:u<=Number.MAX_SAFE_INTEGER?ge:null:null,ge=class extends Array{constructor(e){super(e),this.fill(0);}},ye,he=class he{constructor(e,t){p(this,"heap");p(this,"length");if(!i(he,ye))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0;}static create(e){let t=qe(e);if(!t)return [];d(he,ye,true);let r=new he(e,t);return d(he,ye,false),r}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}};ye=new WeakMap,E(he,ye,false);var Le=he,$e,Ue,K,R,B,ue,$,Se,be,T,U,C,x,g,D,k,I,z,Y,O,J,q,V,X,ae,M,we,a,Re,fe,ie,He,W,Xe,ce,ve,xe,se,ne,ke,ze,Oe,H,Ve,_e,oe,We,Pe=class Pe{constructor(e){E(this,a);E(this,K);E(this,R);E(this,B);E(this,ue);E(this,$);E(this,Se);E(this,be);p(this,"ttl");p(this,"ttlResolution");p(this,"ttlAutopurge");p(this,"updateAgeOnGet");p(this,"updateAgeOnHas");p(this,"allowStale");p(this,"noDisposeOnSet");p(this,"noUpdateTTL");p(this,"maxEntrySize");p(this,"sizeCalculation");p(this,"noDeleteOnFetchRejection");p(this,"noDeleteOnStaleGet");p(this,"allowStaleOnFetchAbort");p(this,"allowStaleOnFetchRejection");p(this,"ignoreFetchAbort");E(this,T);E(this,U);E(this,C);E(this,x);E(this,g);E(this,D);E(this,k);E(this,I);E(this,z);E(this,Y);E(this,O);E(this,J);E(this,q);E(this,V);E(this,X);E(this,ae);E(this,M);E(this,we);E(this,fe,()=>{});E(this,ie,()=>{});E(this,He,()=>{});E(this,W,()=>false);E(this,ce,e=>{});E(this,ve,(e,t,r)=>{});E(this,xe,(e,t,r,s)=>{if(r||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});p(this,$e,"LRUCache");let{max:t=0,ttl:r,ttlResolution:s=1,ttlAutopurge:n,updateAgeOnGet:o,updateAgeOnHas:h,allowStale:l,dispose:b,onInsert:w,disposeAfter:v,noDisposeOnSet:_,noUpdateTTL:P,maxSize:Z=0,maxEntrySize:G=0,sizeCalculation:A,fetchMethod:y,memoMethod:N,noDeleteOnFetchRejection:L,noDeleteOnStaleGet:F,allowStaleOnFetchRejection:j,allowStaleOnFetchAbort:Ee,ignoreFetchAbort:de}=e;if(t!==0&&!re(t))throw new TypeError("max option must be a nonnegative integer");let Ge=t?qe(t):Array;if(!Ge)throw new Error("invalid max value: "+t);if(d(this,K,t),d(this,R,Z),this.maxEntrySize=G||i(this,R),this.sizeCalculation=A,this.sizeCalculation){if(!i(this,R)&&!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(N!==void 0&&typeof N!="function")throw new TypeError("memoMethod must be a function if defined");if(d(this,be,N),y!==void 0&&typeof y!="function")throw new TypeError("fetchMethod must be a function if specified");if(d(this,Se,y),d(this,ae,!!y),d(this,C,new Map),d(this,x,new Array(t).fill(void 0)),d(this,g,new Array(t).fill(void 0)),d(this,D,new Ge(t)),d(this,k,new Ge(t)),d(this,I,0),d(this,z,0),d(this,Y,Le.create(t)),d(this,T,0),d(this,U,0),typeof b=="function"&&d(this,B,b),typeof w=="function"&&d(this,ue,w),typeof v=="function"?(d(this,$,v),d(this,O,[])):(d(this,$,void 0),d(this,O,void 0)),d(this,X,!!i(this,B)),d(this,we,!!i(this,ue)),d(this,M,!!i(this,$)),this.noDisposeOnSet=!!_,this.noUpdateTTL=!!P,this.noDeleteOnFetchRejection=!!L,this.allowStaleOnFetchRejection=!!j,this.allowStaleOnFetchAbort=!!Ee,this.ignoreFetchAbort=!!de,this.maxEntrySize!==0){if(i(this,R)!==0&&!re(i(this,R)))throw new TypeError("maxSize must be a positive integer if specified");if(!re(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");f(this,a,Xe).call(this);}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!F,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!h,this.ttlResolution=re(s)||s===0?s:1,this.ttlAutopurge=!!n,this.ttl=r||0,this.ttl){if(!re(this.ttl))throw new TypeError("ttl must be a positive integer if specified");f(this,a,Re).call(this);}if(i(this,K)===0&&this.ttl===0&&i(this,R)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!i(this,K)&&!i(this,R)){let pe="LRU_CACHE_UNBOUNDED";rt(pe)&&(Ye.add(pe),Je("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",pe,Pe));}}static unsafeExposeInternals(e){return {starts:i(e,q),ttls:i(e,V),sizes:i(e,J),keyMap:i(e,C),keyList:i(e,x),valList:i(e,g),next:i(e,D),prev:i(e,k),get head(){return i(e,I)},get tail(){return i(e,z)},free:i(e,Y),isBackgroundFetch:t=>{var r;return f(r=e,a,H).call(r,t)},backgroundFetch:(t,r,s,n)=>{var o;return f(o=e,a,Oe).call(o,t,r,s,n)},moveToTail:t=>{var r;return f(r=e,a,_e).call(r,t)},indexes:t=>{var r;return f(r=e,a,se).call(r,t)},rindexes:t=>{var r;return f(r=e,a,ne).call(r,t)},isStale:t=>{var r;return i(r=e,W).call(r,t)}}}get max(){return i(this,K)}get maxSize(){return i(this,R)}get calculatedSize(){return i(this,U)}get size(){return i(this,T)}get fetchMethod(){return i(this,Se)}get memoMethod(){return i(this,be)}get dispose(){return i(this,B)}get onInsert(){return i(this,ue)}get disposeAfter(){return i(this,$)}getRemainingTTL(e){return i(this,C).has(e)?1/0:0}*entries(){for(let e of f(this,a,se).call(this))i(this,g)[e]!==void 0&&i(this,x)[e]!==void 0&&!f(this,a,H).call(this,i(this,g)[e])&&(yield [i(this,x)[e],i(this,g)[e]]);}*rentries(){for(let e of f(this,a,ne).call(this))i(this,g)[e]!==void 0&&i(this,x)[e]!==void 0&&!f(this,a,H).call(this,i(this,g)[e])&&(yield [i(this,x)[e],i(this,g)[e]]);}*keys(){for(let e of f(this,a,se).call(this)){let t=i(this,x)[e];t!==void 0&&!f(this,a,H).call(this,i(this,g)[e])&&(yield t);}}*rkeys(){for(let e of f(this,a,ne).call(this)){let t=i(this,x)[e];t!==void 0&&!f(this,a,H).call(this,i(this,g)[e])&&(yield t);}}*values(){for(let e of f(this,a,se).call(this))i(this,g)[e]!==void 0&&!f(this,a,H).call(this,i(this,g)[e])&&(yield i(this,g)[e]);}*rvalues(){for(let e of f(this,a,ne).call(this))i(this,g)[e]!==void 0&&!f(this,a,H).call(this,i(this,g)[e])&&(yield i(this,g)[e]);}[(Ue=Symbol.iterator,$e=Symbol.toStringTag,Ue)](){return this.entries()}find(e,t={}){for(let r of f(this,a,se).call(this)){let s=i(this,g)[r],n=f(this,a,H).call(this,s)?s.__staleWhileFetching:s;if(n!==void 0&&e(n,i(this,x)[r],this))return this.get(i(this,x)[r],t)}}forEach(e,t=this){for(let r of f(this,a,se).call(this)){let s=i(this,g)[r],n=f(this,a,H).call(this,s)?s.__staleWhileFetching:s;n!==void 0&&e.call(t,n,i(this,x)[r],this);}}rforEach(e,t=this){for(let r of f(this,a,ne).call(this)){let s=i(this,g)[r],n=f(this,a,H).call(this,s)?s.__staleWhileFetching:s;n!==void 0&&e.call(t,n,i(this,x)[r],this);}}purgeStale(){let e=false;for(let t of f(this,a,ne).call(this,{allowStale:true}))i(this,W).call(this,t)&&(f(this,a,oe).call(this,i(this,x)[t],"expire"),e=true);return e}info(e){let t=i(this,C).get(e);if(t===void 0)return;let r=i(this,g)[t],s=f(this,a,H).call(this,r)?r.__staleWhileFetching:r;if(s===void 0)return;let n={value:s};if(i(this,V)&&i(this,q)){let o=i(this,V)[t],h=i(this,q)[t];if(o&&h){let l=o-(me.now()-h);n.ttl=l,n.start=Date.now();}}return i(this,J)&&(n.size=i(this,J)[t]),n}dump(){let e=[];for(let t of f(this,a,se).call(this,{allowStale:true})){let r=i(this,x)[t],s=i(this,g)[t],n=f(this,a,H).call(this,s)?s.__staleWhileFetching:s;if(n===void 0||r===void 0)continue;let o={value:n};if(i(this,V)&&i(this,q)){o.ttl=i(this,V)[t];let h=me.now()-i(this,q)[t];o.start=Math.floor(Date.now()-h);}i(this,J)&&(o.size=i(this,J)[t]),e.unshift([r,o]);}return e}load(e){this.clear();for(let[t,r]of e){if(r.start){let s=Date.now()-r.start;r.start=me.now()-s;}this.set(t,r.value,r);}}set(e,t,r={}){var _,P,Z,G;if(t===void 0)return this.delete(e),this;let{ttl:s=this.ttl,start:n,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:h=this.sizeCalculation,status:l}=r,{noUpdateTTL:b=this.noUpdateTTL}=r,w=i(this,xe).call(this,e,t,r.size||0,h);if(this.maxEntrySize&&w>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=true),f(this,a,oe).call(this,e,"set"),this;let v=i(this,T)===0?void 0:i(this,C).get(e);if(v===void 0)v=i(this,T)===0?i(this,z):i(this,Y).length!==0?i(this,Y).pop():i(this,T)===i(this,K)?f(this,a,ze).call(this,false):i(this,T),i(this,x)[v]=e,i(this,g)[v]=t,i(this,C).set(e,v),i(this,D)[i(this,z)]=v,i(this,k)[v]=i(this,z),d(this,z,v),Ce(this,T)._++,i(this,ve).call(this,v,w,l),l&&(l.set="add"),b=false,i(this,we)&&((_=i(this,ue))==null||_.call(this,t,e,"add"));else {f(this,a,_e).call(this,v);let A=i(this,g)[v];if(t!==A){if(i(this,ae)&&f(this,a,H).call(this,A)){A.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:y}=A;y!==void 0&&!o&&(i(this,X)&&((P=i(this,B))==null||P.call(this,y,e,"set")),i(this,M)&&i(this,O)?.push([y,e,"set"]));}else o||(i(this,X)&&((Z=i(this,B))==null||Z.call(this,A,e,"set")),i(this,M)&&i(this,O)?.push([A,e,"set"]));if(i(this,ce).call(this,v),i(this,ve).call(this,v,w,l),i(this,g)[v]=t,l){l.set="replace";let y=A&&f(this,a,H).call(this,A)?A.__staleWhileFetching:A;y!==void 0&&(l.oldValue=y);}}else l&&(l.set="update");i(this,we)&&this.onInsert?.(t,e,t===A?"update":"replace");}if(s!==0&&!i(this,V)&&f(this,a,Re).call(this),i(this,V)&&(b||i(this,He).call(this,v,s,n),l&&i(this,ie).call(this,l,v)),!o&&i(this,M)&&i(this,O)){let A=i(this,O),y;for(;y=A?.shift();)(G=i(this,$))==null||G.call(this,...y);}return this}pop(){var e;try{for(;i(this,T);){let t=i(this,g)[i(this,I)];if(f(this,a,ze).call(this,!0),f(this,a,H).call(this,t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(i(this,M)&&i(this,O)){let t=i(this,O),r;for(;r=t?.shift();)(e=i(this,$))==null||e.call(this,...r);}}}has(e,t={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:s}=t,n=i(this,C).get(e);if(n!==void 0){let o=i(this,g)[n];if(f(this,a,H).call(this,o)&&o.__staleWhileFetching===void 0)return false;if(i(this,W).call(this,n))s&&(s.has="stale",i(this,ie).call(this,s,n));else return r&&i(this,fe).call(this,n),s&&(s.has="hit",i(this,ie).call(this,s,n)),true}else s&&(s.has="miss");return false}peek(e,t={}){let{allowStale:r=this.allowStale}=t,s=i(this,C).get(e);if(s===void 0||!r&&i(this,W).call(this,s))return;let n=i(this,g)[s];return f(this,a,H).call(this,n)?n.__staleWhileFetching:n}async fetch(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:h=this.noDisposeOnSet,size:l=0,sizeCalculation:b=this.sizeCalculation,noUpdateTTL:w=this.noUpdateTTL,noDeleteOnFetchRejection:v=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:_=this.allowStaleOnFetchRejection,ignoreFetchAbort:P=this.ignoreFetchAbort,allowStaleOnFetchAbort:Z=this.allowStaleOnFetchAbort,context:G,forceRefresh:A=false,status:y,signal:N}=t;if(!i(this,ae))return y&&(y.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:s,noDeleteOnStaleGet:n,status:y});let L={allowStale:r,updateAgeOnGet:s,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:h,size:l,sizeCalculation:b,noUpdateTTL:w,noDeleteOnFetchRejection:v,allowStaleOnFetchRejection:_,allowStaleOnFetchAbort:Z,ignoreFetchAbort:P,status:y,signal:N},F=i(this,C).get(e);if(F===void 0){y&&(y.fetch="miss");let j=f(this,a,Oe).call(this,e,F,L,G);return j.__returned=j}else {let j=i(this,g)[F];if(f(this,a,H).call(this,j)){let De=r&&j.__staleWhileFetching!==void 0;return y&&(y.fetch="inflight",De&&(y.returnedStale=true)),De?j.__staleWhileFetching:j.__returned=j}let Ee=i(this,W).call(this,F);if(!A&&!Ee)return y&&(y.fetch="hit"),f(this,a,_e).call(this,F),s&&i(this,fe).call(this,F),y&&i(this,ie).call(this,y,F),j;let de=f(this,a,Oe).call(this,e,F,L,G),pe=de.__staleWhileFetching!==void 0&&r;return y&&(y.fetch=Ee?"stale":"refresh",pe&&Ee&&(y.returnedStale=true)),pe?de.__staleWhileFetching:de.__returned=de}}async forceFetch(e,t={}){let r=await this.fetch(e,t);if(r===void 0)throw new Error("fetch() returned undefined");return r}memo(e,t={}){let r=i(this,be);if(!r)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:n,...o}=t,h=this.get(e,o);if(!n&&h!==void 0)return h;let l=r(e,h,{options:o,context:s});return this.set(e,l,o),l}get(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:o}=t,h=i(this,C).get(e);if(h!==void 0){let l=i(this,g)[h],b=f(this,a,H).call(this,l);return o&&i(this,ie).call(this,o,h),i(this,W).call(this,h)?(o&&(o.get="stale"),b?(o&&r&&l.__staleWhileFetching!==void 0&&(o.returnedStale=true),r?l.__staleWhileFetching:void 0):(n||f(this,a,oe).call(this,e,"expire"),o&&r&&(o.returnedStale=true),r?l:void 0)):(o&&(o.get="hit"),b?l.__staleWhileFetching:(f(this,a,_e).call(this,h),s&&i(this,fe).call(this,h),l))}else o&&(o.get="miss");}delete(e){return f(this,a,oe).call(this,e,"delete")}clear(){return f(this,a,We).call(this,"delete")}};K=new WeakMap,R=new WeakMap,B=new WeakMap,ue=new WeakMap,$=new WeakMap,Se=new WeakMap,be=new WeakMap,T=new WeakMap,U=new WeakMap,C=new WeakMap,x=new WeakMap,g=new WeakMap,D=new WeakMap,k=new WeakMap,I=new WeakMap,z=new WeakMap,Y=new WeakMap,O=new WeakMap,J=new WeakMap,q=new WeakMap,V=new WeakMap,X=new WeakMap,ae=new WeakMap,M=new WeakMap,we=new WeakMap,a=new WeakSet,Re=function(){let e=new ge(i(this,K)),t=new ge(i(this,K));d(this,V,e),d(this,q,t),d(this,He,(n,o,h=me.now())=>{if(t[n]=o!==0?h:0,e[n]=o,o!==0&&this.ttlAutopurge){let l=setTimeout(()=>{i(this,W).call(this,n)&&f(this,a,oe).call(this,i(this,x)[n],"expire");},o+1);l.unref&&l.unref();}}),d(this,fe,n=>{t[n]=e[n]!==0?me.now():0;}),d(this,ie,(n,o)=>{if(e[o]){let h=e[o],l=t[o];if(!h||!l)return;n.ttl=h,n.start=l,n.now=r||s();let b=n.now-l;n.remainingTTL=h-b;}});let r=0,s=()=>{let n=me.now();if(this.ttlResolution>0){r=n;let o=setTimeout(()=>r=0,this.ttlResolution);o.unref&&o.unref();}return n};this.getRemainingTTL=n=>{let o=i(this,C).get(n);if(o===void 0)return 0;let h=e[o],l=t[o];if(!h||!l)return 1/0;let b=(r||s())-l;return h-b},d(this,W,n=>{let o=t[n],h=e[n];return !!h&&!!o&&(r||s())-o>h});},fe=new WeakMap,ie=new WeakMap,He=new WeakMap,W=new WeakMap,Xe=function(){let e=new ge(i(this,K));d(this,U,0),d(this,J,e),d(this,ce,t=>{d(this,U,i(this,U)-e[t]),e[t]=0;}),d(this,xe,(t,r,s,n)=>{if(f(this,a,H).call(this,r))return 0;if(!re(s))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(s=n(r,t),!re(s))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 s}),d(this,ve,(t,r,s)=>{if(e[t]=r,i(this,R)){let n=i(this,R)-e[t];for(;i(this,U)>n;)f(this,a,ze).call(this,true);}d(this,U,i(this,U)+e[t]),s&&(s.entrySize=r,s.totalCalculatedSize=i(this,U));});},ce=new WeakMap,ve=new WeakMap,xe=new WeakMap,se=function*({allowStale:e=this.allowStale}={}){if(i(this,T))for(let t=i(this,z);!(!f(this,a,ke).call(this,t)||((e||!i(this,W).call(this,t))&&(yield t),t===i(this,I)));)t=i(this,k)[t];},ne=function*({allowStale:e=this.allowStale}={}){if(i(this,T))for(let t=i(this,I);!(!f(this,a,ke).call(this,t)||((e||!i(this,W).call(this,t))&&(yield t),t===i(this,z)));)t=i(this,D)[t];},ke=function(e){return e!==void 0&&i(this,C).get(i(this,x)[e])===e},ze=function(e){var n;let t=i(this,I),r=i(this,x)[t],s=i(this,g)[t];return i(this,ae)&&f(this,a,H).call(this,s)?s.__abortController.abort(new Error("evicted")):(i(this,X)||i(this,M))&&(i(this,X)&&((n=i(this,B))==null||n.call(this,s,r,"evict")),i(this,M)&&i(this,O)?.push([s,r,"evict"])),i(this,ce).call(this,t),e&&(i(this,x)[t]=void 0,i(this,g)[t]=void 0,i(this,Y).push(t)),i(this,T)===1?(d(this,I,d(this,z,0)),i(this,Y).length=0):d(this,I,i(this,D)[t]),i(this,C).delete(r),Ce(this,T)._--,t},Oe=function(e,t,r,s){let n=t===void 0?void 0:i(this,g)[t];if(f(this,a,H).call(this,n))return n;let o=new Fe,{signal:h}=r;h?.addEventListener("abort",()=>o.abort(h.reason),{signal:o.signal});let l={signal:o.signal,options:r,context:s},b=(G,A=false)=>{let{aborted:y}=o.signal,N=r.ignoreFetchAbort&&G!==void 0;if(r.status&&(y&&!A?(r.status.fetchAborted=true,r.status.fetchError=o.signal.reason,N&&(r.status.fetchAbortIgnored=true)):r.status.fetchResolved=true),y&&!N&&!A)return v(o.signal.reason);let L=P;return i(this,g)[t]===P&&(G===void 0?L.__staleWhileFetching?i(this,g)[t]=L.__staleWhileFetching:f(this,a,oe).call(this,e,"fetch"):(r.status&&(r.status.fetchUpdated=true),this.set(e,G,l.options))),G},w=G=>(r.status&&(r.status.fetchRejected=true,r.status.fetchError=G),v(G)),v=G=>{let{aborted:A}=o.signal,y=A&&r.allowStaleOnFetchAbort,N=y||r.allowStaleOnFetchRejection,L=N||r.noDeleteOnFetchRejection,F=P;if(i(this,g)[t]===P&&(!L||F.__staleWhileFetching===void 0?f(this,a,oe).call(this,e,"fetch"):y||(i(this,g)[t]=F.__staleWhileFetching)),N)return r.status&&F.__staleWhileFetching!==void 0&&(r.status.returnedStale=true),F.__staleWhileFetching;if(F.__returned===F)throw G},_=(G,A)=>{var N;let y=(N=i(this,Se))==null?void 0:N.call(this,e,n,l);y&&y instanceof Promise&&y.then(L=>G(L===void 0?void 0:L),A),o.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(G(void 0),r.allowStaleOnFetchAbort&&(G=L=>b(L,true)));});};r.status&&(r.status.fetchDispatched=true);let P=new Promise(_).then(b,w),Z=Object.assign(P,{__abortController:o,__staleWhileFetching:n,__returned:void 0});return t===void 0?(this.set(e,Z,{...l.options,status:void 0}),t=i(this,C).get(e)):i(this,g)[t]=Z,Z},H=function(e){if(!i(this,ae))return false;let t=e;return !!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof Fe},Ve=function(e,t){i(this,k)[t]=e,i(this,D)[e]=t;},_e=function(e){e!==i(this,z)&&(e===i(this,I)?d(this,I,i(this,D)[e]):f(this,a,Ve).call(this,i(this,k)[e],i(this,D)[e]),f(this,a,Ve).call(this,i(this,z),e),d(this,z,e));},oe=function(e,t){var s,n;let r=false;if(i(this,T)!==0){let o=i(this,C).get(e);if(o!==void 0)if(r=true,i(this,T)===1)f(this,a,We).call(this,t);else {i(this,ce).call(this,o);let h=i(this,g)[o];if(f(this,a,H).call(this,h)?h.__abortController.abort(new Error("deleted")):(i(this,X)||i(this,M))&&(i(this,X)&&((s=i(this,B))==null||s.call(this,h,e,t)),i(this,M)&&i(this,O)?.push([h,e,t])),i(this,C).delete(e),i(this,x)[o]=void 0,i(this,g)[o]=void 0,o===i(this,z))d(this,z,i(this,k)[o]);else if(o===i(this,I))d(this,I,i(this,D)[o]);else {let l=i(this,k)[o];i(this,D)[l]=i(this,D)[o];let b=i(this,D)[o];i(this,k)[b]=i(this,k)[o];}Ce(this,T)._--,i(this,Y).push(o);}}if(i(this,M)&&i(this,O)?.length){let o=i(this,O),h;for(;h=o?.shift();)(n=i(this,$))==null||n.call(this,...h);}return r},We=function(e){var t,r;for(let s of f(this,a,ne).call(this,{allowStale:true})){let n=i(this,g)[s];if(f(this,a,H).call(this,n))n.__abortController.abort(new Error("deleted"));else {let o=i(this,x)[s];i(this,X)&&((t=i(this,B))==null||t.call(this,n,o,e)),i(this,M)&&i(this,O)?.push([n,o,e]);}}if(i(this,C).clear(),i(this,g).fill(void 0),i(this,x).fill(void 0),i(this,V)&&i(this,q)&&(i(this,V).fill(0),i(this,q).fill(0)),i(this,J)&&i(this,J).fill(0),d(this,I,0),d(this,z,0),i(this,Y).length=0,d(this,U,0),d(this,T,0),i(this,M)&&i(this,O)){let s=i(this,O),n;for(;n=s?.shift();)(r=i(this,$))==null||r.call(this,...n);}};var Ie=Pe;var le=class{constructor(e){p(this,"cache");p(this,"map",new Map);this.cache=new Ie({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 t=this.map.delete(e);return t&&this.cache.delete(e),t}get forEach(){return this.map.forEach}get(e){let t=this.cache.get(e);return t||this.map.get(e)}has(e){return this.map.has(e)}set(e,t){return this.map.set(e,t),this.cache.set(e,t),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var Q=class Q{static get originalStepData(){return Q._originalStepData?te(Q._originalStepData):{path:"",storage:{},canvas:{elementAliasesOrder:[],elements:{},stage:{},tickers:{},tickersSteps:{},tickersOnPause:{},tickersToCompleteOnStepEnd:{tikersIds:[],stepAlias:[]}},sound:{soundAliasesOrder:[],soundsPlaying:{},playInStepIndex:{},filters:void 0},labelIndex:-1,openedLabels:[]}}static set originalStepData(e){Q._originalStepData=te(e);}};p(Q,"_diffHistory",new le({cacheSize:5})),p(Q,"_stepsInfoHistory",new le({cacheSize:5})),p(Q,"_narrationHistory",new le({cacheSize:50})),p(Q,"stepLimitSaved",20),p(Q,"goBackRunning",false),p(Q,"_originalStepData");var c=Q;var Ae=class{get stepsInfoMap(){return c._stepsInfoHistory}get diffMap(){return c._diffHistory}get narrationMap(){return c._narrationHistory}get size(){return c._stepsInfoHistory.size}get lastKey(){return this.size===0?null:Math.max(...Array.from(this.keys()))}keys(){return c._stepsInfoHistory.keys()}get(e){let t=c._narrationHistory.get(e);if(!(t&&Object.keys(t).length===1&&t.stepIndex!==void 0))return t}delete(e){c._stepsInfoHistory.delete(e),c._diffHistory.delete(e),c._narrationHistory.delete(e);}internalRestoreOldGameState(e,t){if(e<=0||this.size==0)return t;let r=this.lastKey;if(typeof r!="number")return S.error("You can't go back, there is no step to go back"),t;let s=c._diffHistory.get(r);if(s)try{let n=Ke(t,s);return ee.stepCounter=r,this.delete(r),this.internalRestoreOldGameState(e-1,n)}catch(n){return S.error("Error applying diff",n),t}else return S.error("You can't go back, there is no step to go back"),t}async goBack(e,t=1){if(t<=0){S.warn("The parameter steps must be greater than 0");return}if(c._diffHistory.size<1){S.warn("You can't go back, there is no step to go back");return}if(c.goBackRunning){S.warn("Go back is already running");return}c.goBackRunning=true;try{let r=te(this.internalRestoreOldGameState(t,c.originalStepData));if(r){await ee.restoreGameStepState(r,e);let s=ee.stepCounter-1,n=c._narrationHistory.get(s);if(n&&Object.keys(n).length===1&&n.stepIndex!==void 0){let o=c._stepsInfoHistory.get(s);if(o){let h=this.itemMapper({step:o});c._narrationHistory.set(o.index,h);}}}else S.error("Error going back");c.originalStepData=r,c.goBackRunning=!1;}catch(r){S.error("Error going back",r),c.goBackRunning=false;}}add(e,t={}){let r=c.originalStepData,{ignoreSameStep:s}=t,n=ee.currentGameStepState;if(!s&&this.isSameStep(r,n))return;let o=this.lastKey;(async()=>{try{let l,b;if(typeof o=="number"&&(l=c._stepsInfoHistory.get(o),b=c._narrationHistory.get(o)),c._stepsInfoHistory.set(e.index,e),e.index!==0){let _=Te(r,n);_?c._diffHistory.set(e.index,_):S.warn("It was not possible to create the difference between the two steps");}let w={},v=this.itemMapper({step:e},w);if(c._narrationHistory.set(e.index,v),l&&b&&typeof o=="number"){let _=this.itemMapper({...w,step:l},{});c._narrationHistory.set(o,_);}}catch(l){S.error("Error adding history step",l);}})(),c.originalStepData=n;}itemMapper(e,t){let{step:r,choiceIndexMade:s,inputValue:n,removeDialogue:o}=e,h=r.dialogue||r.dialoge;t&&r.isGlued&&(t.removeDialogue=true),o&&(h=void 0);let l=r.choices;if(t&&r.currentLabel&&r.choiceIndexMade!==void 0&&(t.choiceIndexMade=r.choiceIndexMade),r.inputValue&&t&&(t.inputValue=r.inputValue),h||l||n){let b=l?.map((w,v)=>{let _=false;return w.oneTime&&r.alreadyMadeChoices&&r.alreadyMadeChoices.includes(v)&&(_=true),{text:w.text,type:w.type,isResponse:false,hidden:_}});if(b){if(b.every(w=>w.hidden)){let w=b.find(v=>v.hidden===false);w&&(w.hidden=false);}s!==void 0&&(b[s].isResponse=true);}return {dialogue:h?{...h,character:h.character?ee.getCharacter(h.character)||h.character:void 0}:void 0,playerMadeChoice:typeof s=="number",choices:b,stepIndex:r.index,inputValue:n}}return {stepIndex:r.index}}get narrativeHistory(){let e=[];return Array.from(this.keys()).sort((r,s)=>r-s).forEach(r=>{let s=this.get(r);s&&e.push(s);}),e}get currentLabelHistory(){let e=[],t=Array.from(this.keys()).sort((l,b)=>b-l);if(t.length===0)return e;let r=t[0];if(typeof r!="number")return e;let s=c._stepsInfoHistory.get(r);if(!s)return e;let n=s.openedLabels;if(!n||!Array.isArray(n)||n.length===0)return e;let o=n[0].currentStepIndex,h=n[0].label;return t.every((l,b)=>{let w=this.get(l);if(w){if(b===0)return e.push(w),true;let v=c._stepsInfoHistory.get(l);if(!v)return true;let _=v.openedLabels;if(!_||!Array.isArray(_)||_.length===0||_[0].label!==h||_[0].currentStepIndex>=o)return false;o=_[0].currentStepIndex,e.push(w);}return true}),e.reverse()}removeNarrativeHistory(e){if(e){let t=Array.from(this.keys()).sort((r,s)=>r-s);t=t.slice(0,e),t.forEach(r=>{c._narrationHistory.delete(r),c._stepsInfoHistory.delete(r),c._diffHistory.delete(r);});}else c._stepsInfoHistory.clear(),c._diffHistory.clear(),c._narrationHistory.clear();}get canGoBack(){let e=this.lastKey;return typeof e!="number"?false:c._diffHistory.has(e)}blockGoBack(){ee.currentStepsRunningNumber===0&&c._diffHistory.clear();}isSameStep(e,t){if(e.openedLabels.length===t.openedLabels.length)try{let r=JSON.stringify(e.openedLabels),s=JSON.stringify(t.openedLabels);if(r===s&&e.path===t.path&&e.labelIndex===t.labelIndex)return !0}catch(r){return S.error("Error comparing opened labels",r),true}return false}clear(){c._stepsInfoHistory.clear(),c._diffHistory.clear(),c._narrationHistory.clear(),c._originalStepData=void 0;}get stepLimitSaved(){return c.stepLimitSaved}set stepLimitSaved(e){c.stepLimitSaved=e;}export(){let e=Array.from(this.keys()).sort((r,s)=>r-s);e.length>this.stepLimitSaved&&(e=e.slice(e.length-this.stepLimitSaved));let t=[];return e.forEach(r=>{let s=c._stepsInfoHistory.get(r);if(s){let n=c._diffHistory.get(r);t.push({...s,diff:n});}}),{stepsHistory:te(t),originalStepData:te(c._originalStepData)}}restoreNarrativeHistory(){let e=Array.from(this.keys()).sort((r,s)=>r-s),t={};e.forEach(r=>{let s=c._stepsInfoHistory.get(r);if(s){let n={...t};t={};let o=this.itemMapper({step:s,choiceIndexMade:n.choiceIndexMade,inputValue:n.inputValue,removeDialogue:n.removeDialogue},t);o&&c._narrationHistory.set(r,o);}});}async restore(e){this.clear();try{e.hasOwnProperty("stepsHistory")?(e.stepsHistory.forEach(r=>{r.diff&&c._diffHistory.set(r.index,r.diff);let s={...r,diff:void 0};c._stepsInfoHistory.set(r.index,s);}),this.restoreNarrativeHistory()):S.warn("Could not import stepsHistory data, so will be ignored"),e.hasOwnProperty("originalStepData")?c._originalStepData=e.originalStepData:S.warn("Could not import originalStepData data, so will be ignored");}catch(t){S.error("Error importing data",t);}}};var kt=new Ae;export{c as HistoryManagerStatic,kt as stepHistory};
|