@drincs/pixi-vn 1.9.4 → 1.9.5

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/filters.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var core=require('@drincs/pixi-vn/core'),pixi_js=require('@drincs/pixi-vn/pixi.js'),pixiFilters=require('pixi-filters');var Kt=Object.defineProperty;var Ut=t=>{throw TypeError(t)};var $t=(t,i,s)=>i in t?Kt(t,i,{enumerable:true,configurable:true,writable:true,value:s}):t[i]=s;var C=(t,i,s)=>$t(t,typeof i!="symbol"?i+"":i,s),Et=(t,i,s)=>i.has(t)||Ut("Cannot "+s);var e=(t,i,s)=>(Et(t,i,"read from private field"),s?s.call(t):i.get(t)),f=(t,i,s)=>i.has(t)?Ut("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(t):i.set(t,s),u=(t,i,s,o)=>(Et(t,i,"write to private field"),i.set(t,s),s),d=(t,i,s)=>(Et(t,i,"access private method"),s);var Tt=(t,i,s,o)=>({set _(r){u(t,i,r);},get _(){return e(t,i,o)}});var Zt=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Pt=new Set,Dt=typeof process=="object"&&process?process:{},Xt=(t,i,s,o)=>{typeof Dt.emitWarning=="function"?Dt.emitWarning(t,i,s,o):console.error(`[${s}] ${i}: ${t}`);},Mt=globalThis.AbortController,jt=globalThis.AbortSignal;if(typeof Mt>"u"){jt=class{onabort;_onabort=[];reason;aborted=false;addEventListener(s,o){this._onabort.push(o);}},Mt=class{constructor(){i();}signal=new jt;abort(s){if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=true;for(let o of this.signal._onabort)o(s);this.signal.onabort?.(s);}}};let t=Dt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",i=()=>{t&&(t=false,Xt("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",i));};}var Jt=t=>!Pt.has(t);var it=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),It=t=>it(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?zt:null:null,zt=class extends Array{constructor(t){super(t),this.fill(0);}},Q,pt,Qt=(Q=class{heap;length;static create(i){let s=It(i);if(!s)return [];u(Q,pt,true);let o=new Q(i,s);return u(Q,pt,false),o}constructor(i,s){if(!e(Q,pt))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new s(i),this.length=0;}push(i){this.heap[this.length++]=i;}pop(){return this.heap[--this.length]}},pt=new WeakMap,f(Q,pt,false),Q),Yt,Nt,P,W,X,at,I,mt,Ft,H,T,q,_,b,g,B,L,R,z,V,O,K,$,U,j,Z,nt,G,yt,l,Bt,lt,tt,xt,Y,qt,ht,ft,_t,st,ot,Gt,Ot,Ct,S,kt,At,rt,Wt,wt,Ht=(wt=class{constructor(i){f(this,l);f(this,P);f(this,W);f(this,X);f(this,at);f(this,I);f(this,mt);f(this,Ft);f(this,H);C(this,"ttl");C(this,"ttlResolution");C(this,"ttlAutopurge");C(this,"updateAgeOnGet");C(this,"updateAgeOnHas");C(this,"allowStale");C(this,"noDisposeOnSet");C(this,"noUpdateTTL");C(this,"maxEntrySize");C(this,"sizeCalculation");C(this,"noDeleteOnFetchRejection");C(this,"noDeleteOnStaleGet");C(this,"allowStaleOnFetchAbort");C(this,"allowStaleOnFetchRejection");C(this,"ignoreFetchAbort");f(this,T);f(this,q);f(this,_);f(this,b);f(this,g);f(this,B);f(this,L);f(this,R);f(this,z);f(this,V);f(this,O);f(this,K);f(this,$);f(this,U);f(this,j);f(this,Z);f(this,nt);f(this,G);f(this,yt);f(this,lt,()=>{});f(this,tt,()=>{});f(this,xt,()=>{});f(this,Y,()=>false);f(this,ht,i=>{});f(this,ft,(i,s,o)=>{});f(this,_t,(i,s,o,r)=>{if(o||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});C(this,Yt,"LRUCache");let{max:s=0,ttl:o,ttlResolution:r=1,ttlAutopurge:a,updateAgeOnGet:n,updateAgeOnHas:c,allowStale:h,dispose:p,onInsert:w,disposeAfter:y,noDisposeOnSet:et,noUpdateTTL:N,maxSize:J=0,maxEntrySize:A=0,sizeCalculation:v,fetchMethod:m,memoMethod:E,noDeleteOnFetchRejection:k,noDeleteOnStaleGet:D,allowStaleOnFetchRejection:x,allowStaleOnFetchAbort:bt,ignoreFetchAbort:ct,perf:ut}=i;if(ut!==void 0&&typeof ut?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(u(this,H,ut??Zt),s!==0&&!it(s))throw new TypeError("max option must be a nonnegative integer");let gt=s?It(s):Array;if(!gt)throw new Error("invalid max value: "+s);if(u(this,P,s),u(this,W,J),this.maxEntrySize=A||e(this,W),this.sizeCalculation=v,this.sizeCalculation){if(!e(this,W)&&!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(E!==void 0&&typeof E!="function")throw new TypeError("memoMethod must be a function if defined");if(u(this,Ft,E),m!==void 0&&typeof m!="function")throw new TypeError("fetchMethod must be a function if specified");if(u(this,mt,m),u(this,nt,!!m),u(this,_,new Map),u(this,b,new Array(s).fill(void 0)),u(this,g,new Array(s).fill(void 0)),u(this,B,new gt(s)),u(this,L,new gt(s)),u(this,R,0),u(this,z,0),u(this,V,Qt.create(s)),u(this,T,0),u(this,q,0),typeof p=="function"&&u(this,X,p),typeof w=="function"&&u(this,at,w),typeof y=="function"?(u(this,I,y),u(this,O,[])):(u(this,I,void 0),u(this,O,void 0)),u(this,Z,!!e(this,X)),u(this,yt,!!e(this,at)),u(this,G,!!e(this,I)),this.noDisposeOnSet=!!et,this.noUpdateTTL=!!N,this.noDeleteOnFetchRejection=!!k,this.allowStaleOnFetchRejection=!!x,this.allowStaleOnFetchAbort=!!bt,this.ignoreFetchAbort=!!ct,this.maxEntrySize!==0){if(e(this,W)!==0&&!it(e(this,W)))throw new TypeError("maxSize must be a positive integer if specified");if(!it(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");d(this,l,qt).call(this);}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!D,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!c,this.ttlResolution=it(r)||r===0?r:1,this.ttlAutopurge=!!a,this.ttl=o||0,this.ttl){if(!it(this.ttl))throw new TypeError("ttl must be a positive integer if specified");d(this,l,Bt).call(this);}if(e(this,P)===0&&this.ttl===0&&e(this,W)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!e(this,P)&&!e(this,W)){let Rt="LRU_CACHE_UNBOUNDED";Jt(Rt)&&(Pt.add(Rt),Xt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Rt,wt));}}get perf(){return e(this,H)}static unsafeExposeInternals(i){return {starts:e(i,$),ttls:e(i,U),autopurgeTimers:e(i,j),sizes:e(i,K),keyMap:e(i,_),keyList:e(i,b),valList:e(i,g),next:e(i,B),prev:e(i,L),get head(){return e(i,R)},get tail(){return e(i,z)},free:e(i,V),isBackgroundFetch:s=>{var o;return d(o=i,l,S).call(o,s)},backgroundFetch:(s,o,r,a)=>{var n;return d(n=i,l,Ct).call(n,s,o,r,a)},moveToTail:s=>{var o;return d(o=i,l,At).call(o,s)},indexes:s=>{var o;return d(o=i,l,st).call(o,s)},rindexes:s=>{var o;return d(o=i,l,ot).call(o,s)},isStale:s=>{var o;return e(o=i,Y).call(o,s)}}}get max(){return e(this,P)}get maxSize(){return e(this,W)}get calculatedSize(){return e(this,q)}get size(){return e(this,T)}get fetchMethod(){return e(this,mt)}get memoMethod(){return e(this,Ft)}get dispose(){return e(this,X)}get onInsert(){return e(this,at)}get disposeAfter(){return e(this,I)}getRemainingTTL(i){return e(this,_).has(i)?1/0:0}*entries(){for(let i of d(this,l,st).call(this))e(this,g)[i]!==void 0&&e(this,b)[i]!==void 0&&!d(this,l,S).call(this,e(this,g)[i])&&(yield [e(this,b)[i],e(this,g)[i]]);}*rentries(){for(let i of d(this,l,ot).call(this))e(this,g)[i]!==void 0&&e(this,b)[i]!==void 0&&!d(this,l,S).call(this,e(this,g)[i])&&(yield [e(this,b)[i],e(this,g)[i]]);}*keys(){for(let i of d(this,l,st).call(this)){let s=e(this,b)[i];s!==void 0&&!d(this,l,S).call(this,e(this,g)[i])&&(yield s);}}*rkeys(){for(let i of d(this,l,ot).call(this)){let s=e(this,b)[i];s!==void 0&&!d(this,l,S).call(this,e(this,g)[i])&&(yield s);}}*values(){for(let i of d(this,l,st).call(this))e(this,g)[i]!==void 0&&!d(this,l,S).call(this,e(this,g)[i])&&(yield e(this,g)[i]);}*rvalues(){for(let i of d(this,l,ot).call(this))e(this,g)[i]!==void 0&&!d(this,l,S).call(this,e(this,g)[i])&&(yield e(this,g)[i]);}[(Nt=Symbol.iterator,Yt=Symbol.toStringTag,Nt)](){return this.entries()}find(i,s={}){for(let o of d(this,l,st).call(this)){let r=e(this,g)[o],a=d(this,l,S).call(this,r)?r.__staleWhileFetching:r;if(a!==void 0&&i(a,e(this,b)[o],this))return this.get(e(this,b)[o],s)}}forEach(i,s=this){for(let o of d(this,l,st).call(this)){let r=e(this,g)[o],a=d(this,l,S).call(this,r)?r.__staleWhileFetching:r;a!==void 0&&i.call(s,a,e(this,b)[o],this);}}rforEach(i,s=this){for(let o of d(this,l,ot).call(this)){let r=e(this,g)[o],a=d(this,l,S).call(this,r)?r.__staleWhileFetching:r;a!==void 0&&i.call(s,a,e(this,b)[o],this);}}purgeStale(){let i=false;for(let s of d(this,l,ot).call(this,{allowStale:true}))e(this,Y).call(this,s)&&(d(this,l,rt).call(this,e(this,b)[s],"expire"),i=true);return i}info(i){let s=e(this,_).get(i);if(s===void 0)return;let o=e(this,g)[s],r=d(this,l,S).call(this,o)?o.__staleWhileFetching:o;if(r===void 0)return;let a={value:r};if(e(this,U)&&e(this,$)){let n=e(this,U)[s],c=e(this,$)[s];if(n&&c){let h=n-(e(this,H).now()-c);a.ttl=h,a.start=Date.now();}}return e(this,K)&&(a.size=e(this,K)[s]),a}dump(){let i=[];for(let s of d(this,l,st).call(this,{allowStale:true})){let o=e(this,b)[s],r=e(this,g)[s],a=d(this,l,S).call(this,r)?r.__staleWhileFetching:r;if(a===void 0||o===void 0)continue;let n={value:a};if(e(this,U)&&e(this,$)){n.ttl=e(this,U)[s];let c=e(this,H).now()-e(this,$)[s];n.start=Math.floor(Date.now()-c);}e(this,K)&&(n.size=e(this,K)[s]),i.unshift([o,n]);}return i}load(i){this.clear();for(let[s,o]of i){if(o.start){let r=Date.now()-o.start;o.start=e(this,H).now()-r;}this.set(s,o.value,o);}}set(i,s,o={}){var et,N,J,A;if(s===void 0)return this.delete(i),this;let{ttl:r=this.ttl,start:a,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:h}=o,{noUpdateTTL:p=this.noUpdateTTL}=o,w=e(this,_t).call(this,i,s,o.size||0,c);if(this.maxEntrySize&&w>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=true),d(this,l,rt).call(this,i,"set"),this;let y=e(this,T)===0?void 0:e(this,_).get(i);if(y===void 0)y=e(this,T)===0?e(this,z):e(this,V).length!==0?e(this,V).pop():e(this,T)===e(this,P)?d(this,l,Ot).call(this,false):e(this,T),e(this,b)[y]=i,e(this,g)[y]=s,e(this,_).set(i,y),e(this,B)[e(this,z)]=y,e(this,L)[y]=e(this,z),u(this,z,y),Tt(this,T)._++,e(this,ft).call(this,y,w,h),h&&(h.set="add"),p=false,e(this,yt)&&((et=e(this,at))==null||et.call(this,s,i,"add"));else {d(this,l,At).call(this,y);let v=e(this,g)[y];if(s!==v){if(e(this,nt)&&d(this,l,S).call(this,v)){v.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:m}=v;m!==void 0&&!n&&(e(this,Z)&&((N=e(this,X))==null||N.call(this,m,i,"set")),e(this,G)&&e(this,O)?.push([m,i,"set"]));}else n||(e(this,Z)&&((J=e(this,X))==null||J.call(this,v,i,"set")),e(this,G)&&e(this,O)?.push([v,i,"set"]));if(e(this,ht).call(this,y),e(this,ft).call(this,y,w,h),e(this,g)[y]=s,h){h.set="replace";let m=v&&d(this,l,S).call(this,v)?v.__staleWhileFetching:v;m!==void 0&&(h.oldValue=m);}}else h&&(h.set="update");e(this,yt)&&this.onInsert?.(s,i,s===v?"update":"replace");}if(r!==0&&!e(this,U)&&d(this,l,Bt).call(this),e(this,U)&&(p||e(this,xt).call(this,y,r,a),h&&e(this,tt).call(this,h,y)),!n&&e(this,G)&&e(this,O)){let v=e(this,O),m;for(;m=v?.shift();)(A=e(this,I))==null||A.call(this,...m);}return this}pop(){var i;try{for(;e(this,T);){let s=e(this,g)[e(this,R)];if(d(this,l,Ot).call(this,!0),d(this,l,S).call(this,s)){if(s.__staleWhileFetching)return s.__staleWhileFetching}else if(s!==void 0)return s}}finally{if(e(this,G)&&e(this,O)){let s=e(this,O),o;for(;o=s?.shift();)(i=e(this,I))==null||i.call(this,...o);}}}has(i,s={}){let{updateAgeOnHas:o=this.updateAgeOnHas,status:r}=s,a=e(this,_).get(i);if(a!==void 0){let n=e(this,g)[a];if(d(this,l,S).call(this,n)&&n.__staleWhileFetching===void 0)return false;if(e(this,Y).call(this,a))r&&(r.has="stale",e(this,tt).call(this,r,a));else return o&&e(this,lt).call(this,a),r&&(r.has="hit",e(this,tt).call(this,r,a)),true}else r&&(r.has="miss");return false}peek(i,s={}){let{allowStale:o=this.allowStale}=s,r=e(this,_).get(i);if(r===void 0||!o&&e(this,Y).call(this,r))return;let a=e(this,g)[r];return d(this,l,S).call(this,a)?a.__staleWhileFetching:a}async fetch(i,s={}){let{allowStale:o=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:h=0,sizeCalculation:p=this.sizeCalculation,noUpdateTTL:w=this.noUpdateTTL,noDeleteOnFetchRejection:y=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:et=this.allowStaleOnFetchRejection,ignoreFetchAbort:N=this.ignoreFetchAbort,allowStaleOnFetchAbort:J=this.allowStaleOnFetchAbort,context:A,forceRefresh:v=false,status:m,signal:E}=s;if(!e(this,nt))return m&&(m.fetch="get"),this.get(i,{allowStale:o,updateAgeOnGet:r,noDeleteOnStaleGet:a,status:m});let k={allowStale:o,updateAgeOnGet:r,noDeleteOnStaleGet:a,ttl:n,noDisposeOnSet:c,size:h,sizeCalculation:p,noUpdateTTL:w,noDeleteOnFetchRejection:y,allowStaleOnFetchRejection:et,allowStaleOnFetchAbort:J,ignoreFetchAbort:N,status:m,signal:E},D=e(this,_).get(i);if(D===void 0){m&&(m.fetch="miss");let x=d(this,l,Ct).call(this,i,D,k,A);return x.__returned=x}else {let x=e(this,g)[D];if(d(this,l,S).call(this,x)){let gt=o&&x.__staleWhileFetching!==void 0;return m&&(m.fetch="inflight",gt&&(m.returnedStale=true)),gt?x.__staleWhileFetching:x.__returned=x}let bt=e(this,Y).call(this,D);if(!v&&!bt)return m&&(m.fetch="hit"),d(this,l,At).call(this,D),r&&e(this,lt).call(this,D),m&&e(this,tt).call(this,m,D),x;let ct=d(this,l,Ct).call(this,i,D,k,A),ut=ct.__staleWhileFetching!==void 0&&o;return m&&(m.fetch=bt?"stale":"refresh",ut&&bt&&(m.returnedStale=true)),ut?ct.__staleWhileFetching:ct.__returned=ct}}async forceFetch(i,s={}){let o=await this.fetch(i,s);if(o===void 0)throw new Error("fetch() returned undefined");return o}memo(i,s={}){let o=e(this,Ft);if(!o)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:a,...n}=s,c=this.get(i,n);if(!a&&c!==void 0)return c;let h=o(i,c,{options:n,context:r});return this.set(i,h,n),h}get(i,s={}){let{allowStale:o=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,status:n}=s,c=e(this,_).get(i);if(c!==void 0){let h=e(this,g)[c],p=d(this,l,S).call(this,h);return n&&e(this,tt).call(this,n,c),e(this,Y).call(this,c)?(n&&(n.get="stale"),p?(n&&o&&h.__staleWhileFetching!==void 0&&(n.returnedStale=true),o?h.__staleWhileFetching:void 0):(a||d(this,l,rt).call(this,i,"expire"),n&&o&&(n.returnedStale=true),o?h:void 0)):(n&&(n.get="hit"),p?h.__staleWhileFetching:(d(this,l,At).call(this,c),r&&e(this,lt).call(this,c),h))}else n&&(n.get="miss");}delete(i){return d(this,l,rt).call(this,i,"delete")}clear(){return d(this,l,Wt).call(this,"delete")}},P=new WeakMap,W=new WeakMap,X=new WeakMap,at=new WeakMap,I=new WeakMap,mt=new WeakMap,Ft=new WeakMap,H=new WeakMap,T=new WeakMap,q=new WeakMap,_=new WeakMap,b=new WeakMap,g=new WeakMap,B=new WeakMap,L=new WeakMap,R=new WeakMap,z=new WeakMap,V=new WeakMap,O=new WeakMap,K=new WeakMap,$=new WeakMap,U=new WeakMap,j=new WeakMap,Z=new WeakMap,nt=new WeakMap,G=new WeakMap,yt=new WeakMap,l=new WeakSet,Bt=function(){let i=new zt(e(this,P)),s=new zt(e(this,P));u(this,U,i),u(this,$,s);let o=this.ttlAutopurge?new Array(e(this,P)):void 0;u(this,j,o),u(this,xt,(c,h,p=e(this,H).now())=>{s[c]=h!==0?p:0,i[c]=h,r(c,h);}),u(this,lt,c=>{s[c]=i[c]!==0?e(this,H).now():0,r(c,i[c]);});let r=this.ttlAutopurge?(c,h)=>{if(o?.[c]&&(clearTimeout(o[c]),o[c]=void 0),h&&h!==0&&o){let p=setTimeout(()=>{e(this,Y).call(this,c)&&d(this,l,rt).call(this,e(this,b)[c],"expire");},h+1);p.unref&&p.unref(),o[c]=p;}}:()=>{};u(this,tt,(c,h)=>{if(i[h]){let p=i[h],w=s[h];if(!p||!w)return;c.ttl=p,c.start=w,c.now=a||n();let y=c.now-w;c.remainingTTL=p-y;}});let a=0,n=()=>{let c=e(this,H).now();if(this.ttlResolution>0){a=c;let h=setTimeout(()=>a=0,this.ttlResolution);h.unref&&h.unref();}return c};this.getRemainingTTL=c=>{let h=e(this,_).get(c);if(h===void 0)return 0;let p=i[h],w=s[h];if(!p||!w)return 1/0;let y=(a||n())-w;return p-y},u(this,Y,c=>{let h=s[c],p=i[c];return !!p&&!!h&&(a||n())-h>p});},lt=new WeakMap,tt=new WeakMap,xt=new WeakMap,Y=new WeakMap,qt=function(){let i=new zt(e(this,P));u(this,q,0),u(this,K,i),u(this,ht,s=>{u(this,q,e(this,q)-i[s]),i[s]=0;}),u(this,_t,(s,o,r,a)=>{if(d(this,l,S).call(this,o))return 0;if(!it(r))if(a){if(typeof a!="function")throw new TypeError("sizeCalculation must be a function");if(r=a(o,s),!it(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}),u(this,ft,(s,o,r)=>{if(i[s]=o,e(this,W)){let a=e(this,W)-i[s];for(;e(this,q)>a;)d(this,l,Ot).call(this,true);}u(this,q,e(this,q)+i[s]),r&&(r.entrySize=o,r.totalCalculatedSize=e(this,q));});},ht=new WeakMap,ft=new WeakMap,_t=new WeakMap,st=function*({allowStale:i=this.allowStale}={}){if(e(this,T))for(let s=e(this,z);!(!d(this,l,Gt).call(this,s)||((i||!e(this,Y).call(this,s))&&(yield s),s===e(this,R)));)s=e(this,L)[s];},ot=function*({allowStale:i=this.allowStale}={}){if(e(this,T))for(let s=e(this,R);!(!d(this,l,Gt).call(this,s)||((i||!e(this,Y).call(this,s))&&(yield s),s===e(this,z)));)s=e(this,B)[s];},Gt=function(i){return i!==void 0&&e(this,_).get(e(this,b)[i])===i},Ot=function(i){var a;let s=e(this,R),o=e(this,b)[s],r=e(this,g)[s];return e(this,nt)&&d(this,l,S).call(this,r)?r.__abortController.abort(new Error("evicted")):(e(this,Z)||e(this,G))&&(e(this,Z)&&((a=e(this,X))==null||a.call(this,r,o,"evict")),e(this,G)&&e(this,O)?.push([r,o,"evict"])),e(this,ht).call(this,s),e(this,j)?.[s]&&(clearTimeout(e(this,j)[s]),e(this,j)[s]=void 0),i&&(e(this,b)[s]=void 0,e(this,g)[s]=void 0,e(this,V).push(s)),e(this,T)===1?(u(this,R,u(this,z,0)),e(this,V).length=0):u(this,R,e(this,B)[s]),e(this,_).delete(o),Tt(this,T)._--,s},Ct=function(i,s,o,r){let a=s===void 0?void 0:e(this,g)[s];if(d(this,l,S).call(this,a))return a;let n=new Mt,{signal:c}=o;c?.addEventListener("abort",()=>n.abort(c.reason),{signal:n.signal});let h={signal:n.signal,options:o,context:r},p=(A,v=false)=>{let{aborted:m}=n.signal,E=o.ignoreFetchAbort&&A!==void 0,k=o.ignoreFetchAbort||!!(o.allowStaleOnFetchAbort&&A!==void 0);if(o.status&&(m&&!v?(o.status.fetchAborted=true,o.status.fetchError=n.signal.reason,E&&(o.status.fetchAbortIgnored=true)):o.status.fetchResolved=true),m&&!E&&!v)return y(n.signal.reason,k);let D=N,x=e(this,g)[s];return (x===N||E&&v&&x===void 0)&&(A===void 0?D.__staleWhileFetching!==void 0?e(this,g)[s]=D.__staleWhileFetching:d(this,l,rt).call(this,i,"fetch"):(o.status&&(o.status.fetchUpdated=true),this.set(i,A,h.options))),A},w=A=>(o.status&&(o.status.fetchRejected=true,o.status.fetchError=A),y(A,false)),y=(A,v)=>{let{aborted:m}=n.signal,E=m&&o.allowStaleOnFetchAbort,k=E||o.allowStaleOnFetchRejection,D=k||o.noDeleteOnFetchRejection,x=N;if(e(this,g)[s]===N&&(!D||!v&&x.__staleWhileFetching===void 0?d(this,l,rt).call(this,i,"fetch"):E||(e(this,g)[s]=x.__staleWhileFetching)),k)return o.status&&x.__staleWhileFetching!==void 0&&(o.status.returnedStale=true),x.__staleWhileFetching;if(x.__returned===x)throw A},et=(A,v)=>{var E;let m=(E=e(this,mt))==null?void 0:E.call(this,i,a,h);m&&m instanceof Promise&&m.then(k=>A(k===void 0?void 0:k),v),n.signal.addEventListener("abort",()=>{(!o.ignoreFetchAbort||o.allowStaleOnFetchAbort)&&(A(void 0),o.allowStaleOnFetchAbort&&(A=k=>p(k,true)));});};o.status&&(o.status.fetchDispatched=true);let N=new Promise(et).then(p,w),J=Object.assign(N,{__abortController:n,__staleWhileFetching:a,__returned:void 0});return s===void 0?(this.set(i,J,{...h.options,status:void 0}),s=e(this,_).get(i)):e(this,g)[s]=J,J},S=function(i){if(!e(this,nt))return false;let s=i;return !!s&&s instanceof Promise&&s.hasOwnProperty("__staleWhileFetching")&&s.__abortController instanceof Mt},kt=function(i,s){e(this,L)[s]=i,e(this,B)[i]=s;},At=function(i){i!==e(this,z)&&(i===e(this,R)?u(this,R,e(this,B)[i]):d(this,l,kt).call(this,e(this,L)[i],e(this,B)[i]),d(this,l,kt).call(this,e(this,z),i),u(this,z,i));},rt=function(i,s){var r,a;let o=false;if(e(this,T)!==0){let n=e(this,_).get(i);if(n!==void 0)if(e(this,j)?.[n]&&(clearTimeout(e(this,j)?.[n]),e(this,j)[n]=void 0),o=true,e(this,T)===1)d(this,l,Wt).call(this,s);else {e(this,ht).call(this,n);let c=e(this,g)[n];if(d(this,l,S).call(this,c)?c.__abortController.abort(new Error("deleted")):(e(this,Z)||e(this,G))&&(e(this,Z)&&((r=e(this,X))==null||r.call(this,c,i,s)),e(this,G)&&e(this,O)?.push([c,i,s])),e(this,_).delete(i),e(this,b)[n]=void 0,e(this,g)[n]=void 0,n===e(this,z))u(this,z,e(this,L)[n]);else if(n===e(this,R))u(this,R,e(this,B)[n]);else {let h=e(this,L)[n];e(this,B)[h]=e(this,B)[n];let p=e(this,B)[n];e(this,L)[p]=e(this,L)[n];}Tt(this,T)._--,e(this,V).push(n);}}if(e(this,G)&&e(this,O)?.length){let n=e(this,O),c;for(;c=n?.shift();)(a=e(this,I))==null||a.call(this,...c);}return o},Wt=function(i){var s,o;for(let r of d(this,l,ot).call(this,{allowStale:true})){let a=e(this,g)[r];if(d(this,l,S).call(this,a))a.__abortController.abort(new Error("deleted"));else {let n=e(this,b)[r];e(this,Z)&&((s=e(this,X))==null||s.call(this,a,n,i)),e(this,G)&&e(this,O)?.push([a,n,i]);}}if(e(this,_).clear(),e(this,g).fill(void 0),e(this,b).fill(void 0),e(this,U)&&e(this,$)){e(this,U).fill(0),e(this,$).fill(0);for(let r of e(this,j)??[])r!==void 0&&clearTimeout(r);e(this,j)?.fill(void 0);}if(e(this,K)&&e(this,K).fill(0),u(this,R,0),u(this,z,0),e(this,V).length=0,u(this,q,0),u(this,T,0),e(this,G)&&e(this,O)){let r=e(this,O),a;for(;a=r?.shift();)(o=e(this,I))==null||o.call(this,...a);}},wt);var vt=class{cache;map=new Map;constructor(i){this.cache=new Ht({max:i.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){this.cache.clear(),this.map.clear();}delete(i){let s=this.map.delete(i);return s&&this.cache.delete(i),s}get forEach(){return this.map.forEach}get(i){let s=this.cache.get(i);return s||this.map.get(i)}has(i){return this.map.has(i)}set(i,s){return this.map.set(i,s),this.cache.set(i,s),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var dt;(r=>(r.log=(a,...n)=>console.log(`[Pixi\u2019VN] ${a}`,...n),r.warn=(a,...n)=>console.warn(`[Pixi\u2019VN] ${a}`,...n),r.error=(a,...n)=>console.error(`[Pixi\u2019VN] ${a}`,...n),r.info=(a,...n)=>console.info(`[Pixi\u2019VN] ${a}`,...n)))(dt||={});var St=new vt({cacheSize:5}),Vt=new vt({cacheSize:5});function te(t){return i=>{Lt.add(i,t);}}var Lt;(c=>{function t(h,p){let{toMemory:w}=p,y=p.name??h.name;St.get(y)&&dt.info(`Filter "${y}" already exists, it will be overwritten`),h.prototype.pixivnFilterId=y,St.set(y,h),Vt.set(y,w);}c.add=t;function i(h){let p=St.get(h);if(!p){dt.error(`Filter "${h}" not found, did you forget to register it with the filterDecorator?`);return}return p}c.get=i;function s(h,p){let w=i(h);if(w)try{return new w(p)}catch(y){dt.error(`Error while getting Filter instance "${h}"`,y);return}}c.getInstance=s;function o(h,p){let w=Vt.get(h);if(!w){dt.error(`Filter "${h}" not found, did you forget to register it with the filterDecorator?`);return}try{return {filterId:h,args:w(p)}}catch(y){dt.error(`Error while converting Filter "${h}" to memory`,y);return}}c.toMemory=o;function r(){return Array.from(St.values())}c.values=r;function a(h){return St.has(h)}c.has=a;function n(){return Array.from(St.keys())}c.keys=n;})(Lt||={});var F=Lt;function M(t,i){return {x:t,y:i}}F.add(pixi_js.BlurFilter,{name:"BlurFilter",toMemory:t=>({strengthX:t.strengthX,strengthY:t.strengthY,quality:t.quality,repeatEdgePixels:t.repeatEdgePixels})});F.add(pixi_js.AlphaFilter,{name:"AlphaFilter",toMemory:t=>({alpha:t.alpha})});F.add(pixi_js.NoiseFilter,{name:"NoiseFilter",toMemory:t=>({noise:t.noise,seed:t.seed})});F.add(pixiFilters.PixelateFilter,{name:"PixelateFilter",toMemory:t=>[t.sizeX,t.sizeY]});F.add(pixiFilters.AdjustmentFilter,{name:"AdjustmentFilter",toMemory:t=>({gamma:t.gamma,contrast:t.contrast,saturation:t.saturation,brightness:t.brightness,red:t.red,green:t.green,blue:t.blue,alpha:t.alpha})});F.add(pixiFilters.AdvancedBloomFilter,{name:"AdvancedBloomFilter",toMemory:t=>({threshold:t.threshold,bloomScale:t.bloomScale,brightness:t.brightness,blur:t.blur,kernels:t.kernels,quality:t.quality,pixelSize:M(t.pixelSizeX,t.pixelSizeY)})});F.add(pixiFilters.AsciiFilter,{name:"AsciiFilter",toMemory:t=>({size:t.size,color:t.color,replaceColor:t.replaceColor})});F.add(pixiFilters.BackdropBlurFilter,{name:"BackdropBlurFilter",toMemory:t=>({strength:t.strength,quality:t.quality})});F.add(pixiFilters.BevelFilter,{name:"BevelFilter",toMemory:t=>({rotation:t.rotation,thickness:t.thickness,lightColor:t.lightColor,lightAlpha:t.lightAlpha,shadowColor:t.shadowColor,shadowAlpha:t.shadowAlpha})});F.add(pixiFilters.BloomFilter,{name:"BloomFilter",toMemory:t=>({strength:M(t.strengthX,t.strengthY)})});F.add(pixiFilters.BulgePinchFilter,{name:"BulgePinchFilter",toMemory:t=>({center:M(t.centerX,t.centerY),radius:t.radius,strength:t.strength})});F.add(pixiFilters.ColorGradientFilter,{name:"ColorGradientFilter",toMemory:t=>({type:t.type,stops:t.stops,angle:t.angle,alpha:t.alpha,maxColors:t.maxColors,replace:t.replace})});F.add(pixiFilters.ColorOverlayFilter,{name:"ColorOverlayFilter",toMemory:t=>({color:t.color,alpha:t.alpha})});F.add(pixiFilters.ColorReplaceFilter,{name:"ColorReplaceFilter",toMemory:t=>({originalColor:t.originalColor,targetColor:t.targetColor,tolerance:t.tolerance})});F.add(pixiFilters.ConvolutionFilter,{name:"ConvolutionFilter",toMemory:t=>({matrix:t.matrix,width:t.width,height:t.height})});F.add(pixiFilters.CrossHatchFilter,{name:"CrossHatchFilter",toMemory:()=>({})});F.add(pixiFilters.CRTFilter,{name:"CRTFilter",toMemory:t=>({curvature:t.curvature,lineWidth:t.lineWidth,lineContrast:t.lineContrast,verticalLine:t.verticalLine,noise:t.noise,noiseSize:t.noiseSize,vignetting:t.vignetting,vignettingAlpha:t.vignettingAlpha,vignettingBlur:t.vignettingBlur,seed:t.seed,time:t.time})});F.add(pixiFilters.DotFilter,{name:"DotFilter",toMemory:t=>({scale:t.scale,angle:t.angle,grayscale:t.grayscale})});F.add(pixiFilters.DropShadowFilter,{name:"DropShadowFilter",toMemory:t=>({offset:M(t.offsetX,t.offsetY),color:t.color,alpha:t.alpha,shadowOnly:t.shadowOnly,blur:t.blur,quality:t.quality,kernels:t.kernels,pixelSize:M(t.pixelSizeX,t.pixelSizeY)})});F.add(pixiFilters.EmbossFilter,{name:"EmbossFilter",toMemory:t=>t.strength});F.add(pixiFilters.GlitchFilter,{name:"GlitchFilter",toMemory:t=>({slices:t.slices,offset:t.offset,direction:t.direction,fillMode:t.fillMode,seed:t.seed,average:t.average,minSize:t.minSize,sampleSize:t.sampleSize,red:t.red,green:t.green,blue:t.blue})});F.add(pixiFilters.GlowFilter,{name:"GlowFilter",toMemory:t=>({distance:t.distance,outerStrength:t.outerStrength,innerStrength:t.innerStrength,color:t.color,alpha:t.alpha,quality:t.quality,knockout:t.knockout})});F.add(pixiFilters.GodrayFilter,{name:"GodrayFilter",toMemory:t=>({angle:t.angle,parallel:t.parallel,center:M(t.centerX,t.centerY),gain:t.gain,lacunarity:t.lacunarity,time:t.time,alpha:t.alpha})});F.add(pixiFilters.GrayscaleFilter,{name:"GrayscaleFilter",toMemory:()=>({})});F.add(pixiFilters.HslAdjustmentFilter,{name:"HslAdjustmentFilter",toMemory:t=>({hue:t.hue,saturation:t.saturation,lightness:t.lightness,colorize:t.colorize,alpha:t.alpha})});F.add(pixiFilters.KawaseBlurFilter,{name:"KawaseBlurFilter",toMemory:t=>({strength:t.strength,quality:t.quality,pixelSize:M(t.pixelSizeX,t.pixelSizeY)})});F.add(pixiFilters.MotionBlurFilter,{name:"MotionBlurFilter",toMemory:t=>({velocity:M(t.velocityX,t.velocityY),kernelSize:t.kernelSize,offset:t.offset})});F.add(pixiFilters.MultiColorReplaceFilter,{name:"MultiColorReplaceFilter",toMemory:t=>({replacements:t.replacements,tolerance:t.tolerance})});F.add(pixiFilters.OldFilmFilter,{name:"OldFilmFilter",toMemory:t=>({sepia:t.sepia,noise:t.noise,noiseSize:t.noiseSize,scratch:t.scratch,scratchDensity:t.scratchDensity,scratchWidth:t.scratchWidth,vignetting:t.vignetting,vignettingAlpha:t.vignettingAlpha,vignettingBlur:t.vignettingBlur,seed:t.seed})});F.add(pixiFilters.OutlineFilter,{name:"OutlineFilter",toMemory:t=>({thickness:t.thickness,color:t.color,alpha:t.alpha,quality:t.quality,knockout:t.knockout})});F.add(pixiFilters.RadialBlurFilter,{name:"RadialBlurFilter",toMemory:t=>({angle:t.angle,center:M(t.centerX,t.centerY),kernelSize:t.kernelSize,radius:t.radius})});F.add(pixiFilters.ReflectionFilter,{name:"ReflectionFilter",toMemory:t=>({mirror:t.mirror,boundary:t.boundary,amplitude:t.amplitude,waveLength:t.waveLength,alpha:t.alpha,time:t.time})});F.add(pixiFilters.RGBSplitFilter,{name:"RGBSplitFilter",toMemory:t=>({red:M(t.redX,t.redY),green:M(t.greenX,t.greenY),blue:M(t.blueX,t.blueY)})});F.add(pixiFilters.ShockwaveFilter,{name:"ShockwaveFilter",toMemory:t=>({center:M(t.centerX,t.centerY),speed:t.speed,amplitude:t.amplitude,wavelength:t.wavelength,brightness:t.brightness,radius:t.radius,time:t.time})});F.add(pixiFilters.SimplexNoiseFilter,{name:"SimplexNoiseFilter",toMemory:t=>({strength:t.strength,noiseScale:t.noiseScale,offsetX:t.offsetX,offsetY:t.offsetY,offsetZ:t.offsetZ,step:t.step})});F.add(pixiFilters.TiltShiftFilter,{name:"TiltShiftFilter",toMemory:t=>({blur:t.blur,gradientBlur:t.gradientBlur,start:M(t.startX,t.startY),end:M(t.endX,t.endY)})});F.add(pixiFilters.TwistFilter,{name:"TwistFilter",toMemory:t=>({radius:t.radius,angle:t.angle,offset:M(t.offsetX,t.offsetY)})});F.add(pixiFilters.ZoomBlurFilter,{name:"ZoomBlurFilter",toMemory:t=>({strength:t.strength,center:M(t.centerX,t.centerY),innerRadius:t.innerRadius,radius:t.radius})});function xi(t,i,s,o,r,a,n){return core.GameUnifier.animateFilter(t,i,s,o,r,a,n)}var Xi={AlphaFilter:pixi_js.AlphaFilter,BlurFilter:pixi_js.BlurFilter,NoiseFilter:pixi_js.NoiseFilter,AdjustmentFilter:pixiFilters.AdjustmentFilter,AdvancedBloomFilter:pixiFilters.AdvancedBloomFilter,AsciiFilter:pixiFilters.AsciiFilter,BackdropBlurFilter:pixiFilters.BackdropBlurFilter,BevelFilter:pixiFilters.BevelFilter,BloomFilter:pixiFilters.BloomFilter,BulgePinchFilter:pixiFilters.BulgePinchFilter,ColorGradientFilter:pixiFilters.ColorGradientFilter,ColorOverlayFilter:pixiFilters.ColorOverlayFilter,ColorReplaceFilter:pixiFilters.ColorReplaceFilter,ConvolutionFilter:pixiFilters.ConvolutionFilter,CRTFilter:pixiFilters.CRTFilter,CrossHatchFilter:pixiFilters.CrossHatchFilter,DotFilter:pixiFilters.DotFilter,DropShadowFilter:pixiFilters.DropShadowFilter,EmbossFilter:pixiFilters.EmbossFilter,GlitchFilter:pixiFilters.GlitchFilter,GlowFilter:pixiFilters.GlowFilter,GodrayFilter:pixiFilters.GodrayFilter,GrayscaleFilter:pixiFilters.GrayscaleFilter,HslAdjustmentFilter:pixiFilters.HslAdjustmentFilter,KawaseBlurFilter:pixiFilters.KawaseBlurFilter,MotionBlurFilter:pixiFilters.MotionBlurFilter,MultiColorReplaceFilter:pixiFilters.MultiColorReplaceFilter,OldFilmFilter:pixiFilters.OldFilmFilter,OutlineFilter:pixiFilters.OutlineFilter,PixelateFilter:pixiFilters.PixelateFilter,RadialBlurFilter:pixiFilters.RadialBlurFilter,ReflectionFilter:pixiFilters.ReflectionFilter,RGBSplitFilter:pixiFilters.RGBSplitFilter,ShockwaveFilter:pixiFilters.ShockwaveFilter,SimplexNoiseFilter:pixiFilters.SimplexNoiseFilter,TiltShiftFilter:pixiFilters.TiltShiftFilter,TwistFilter:pixiFilters.TwistFilter,ZoomBlurFilter:pixiFilters.ZoomBlurFilter,animate:xi};exports.RegisteredFilters=F;exports.filterDecorator=te;exports.filters=Xi;
1
+ 'use strict';var core=require('@drincs/pixi-vn/core'),pixi_js=require('@drincs/pixi-vn/pixi.js'),pixiFilters=require('pixi-filters');var Kt=Object.defineProperty;var Ut=t=>{throw TypeError(t)};var $t=(t,i,s)=>i in t?Kt(t,i,{enumerable:true,configurable:true,writable:true,value:s}):t[i]=s;var C=(t,i,s)=>$t(t,typeof i!="symbol"?i+"":i,s),Et=(t,i,s)=>i.has(t)||Ut("Cannot "+s);var e=(t,i,s)=>(Et(t,i,"read from private field"),s?s.call(t):i.get(t)),f=(t,i,s)=>i.has(t)?Ut("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(t):i.set(t,s),c=(t,i,s,o)=>(Et(t,i,"write to private field"),i.set(t,s),s),u=(t,i,s)=>(Et(t,i,"access private method"),s);var Tt=(t,i,s,o)=>({set _(r){c(t,i,r);},get _(){return e(t,i,o)}});var Zt=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Pt=new Set,Dt=typeof process=="object"&&process?process:{},Xt=(t,i,s,o)=>{typeof Dt.emitWarning=="function"?Dt.emitWarning(t,i,s,o):console.error(`[${s}] ${i}: ${t}`);},Mt=globalThis.AbortController,jt=globalThis.AbortSignal;if(typeof Mt>"u"){jt=class{onabort;_onabort=[];reason;aborted=false;addEventListener(s,o){this._onabort.push(o);}},Mt=class{constructor(){i();}signal=new jt;abort(s){if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=true;for(let o of this.signal._onabort)o(s);this.signal.onabort?.(s);}}};let t=Dt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",i=()=>{t&&(t=false,Xt("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",i));};}var Jt=t=>!Pt.has(t);var it=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),It=t=>it(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?zt:null:null,zt=class extends Array{constructor(t){super(t),this.fill(0);}},tt,pt,Qt=(tt=class{heap;length;static create(i){let s=It(i);if(!s)return [];c(tt,pt,true);let o=new tt(i,s);return c(tt,pt,false),o}constructor(i,s){if(!e(tt,pt))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new s(i),this.length=0;}push(i){this.heap[this.length++]=i;}pop(){return this.heap[--this.length]}},pt=new WeakMap,f(tt,pt,false),tt),Yt,Nt,X,L,I,at,H,mt,yt,q,T,V,_,b,p,B,U,R,z,K,O,$,Z,j,Y,J,nt,G,Ft,l,Bt,lt,et,xt,N,qt,ht,ft,_t,st,ot,Gt,Ot,Ct,S,kt,At,rt,Wt,wt,Ht=(wt=class{constructor(i){f(this,l);f(this,X);f(this,L);f(this,I);f(this,at);f(this,H);f(this,mt);f(this,yt);f(this,q);C(this,"ttl");C(this,"ttlResolution");C(this,"ttlAutopurge");C(this,"updateAgeOnGet");C(this,"updateAgeOnHas");C(this,"allowStale");C(this,"noDisposeOnSet");C(this,"noUpdateTTL");C(this,"maxEntrySize");C(this,"sizeCalculation");C(this,"noDeleteOnFetchRejection");C(this,"noDeleteOnStaleGet");C(this,"allowStaleOnFetchAbort");C(this,"allowStaleOnFetchRejection");C(this,"ignoreFetchAbort");f(this,T);f(this,V);f(this,_);f(this,b);f(this,p);f(this,B);f(this,U);f(this,R);f(this,z);f(this,K);f(this,O);f(this,$);f(this,Z);f(this,j);f(this,Y);f(this,J);f(this,nt);f(this,G);f(this,Ft);f(this,lt,()=>{});f(this,et,()=>{});f(this,xt,()=>{});f(this,N,()=>false);f(this,ht,i=>{});f(this,ft,(i,s,o)=>{});f(this,_t,(i,s,o,r)=>{if(o||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});C(this,Yt,"LRUCache");let{max:s=0,ttl:o,ttlResolution:r=1,ttlAutopurge:a,updateAgeOnGet:n,updateAgeOnHas:d,allowStale:h,dispose:g,onInsert:w,disposeAfter:m,noDisposeOnSet:W,noUpdateTTL:P,maxSize:Q=0,maxEntrySize:A=0,sizeCalculation:v,fetchMethod:y,memoMethod:E,noDeleteOnFetchRejection:k,noDeleteOnStaleGet:D,allowStaleOnFetchRejection:x,allowStaleOnFetchAbort:bt,ignoreFetchAbort:ut,perf:ct}=i;if(ct!==void 0&&typeof ct?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(c(this,q,ct??Zt),s!==0&&!it(s))throw new TypeError("max option must be a nonnegative integer");let gt=s?It(s):Array;if(!gt)throw new Error("invalid max value: "+s);if(c(this,X,s),c(this,L,Q),this.maxEntrySize=A||e(this,L),this.sizeCalculation=v,this.sizeCalculation){if(!e(this,L)&&!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(E!==void 0&&typeof E!="function")throw new TypeError("memoMethod must be a function if defined");if(c(this,yt,E),y!==void 0&&typeof y!="function")throw new TypeError("fetchMethod must be a function if specified");if(c(this,mt,y),c(this,nt,!!y),c(this,_,new Map),c(this,b,new Array(s).fill(void 0)),c(this,p,new Array(s).fill(void 0)),c(this,B,new gt(s)),c(this,U,new gt(s)),c(this,R,0),c(this,z,0),c(this,K,Qt.create(s)),c(this,T,0),c(this,V,0),typeof g=="function"&&c(this,I,g),typeof w=="function"&&c(this,at,w),typeof m=="function"?(c(this,H,m),c(this,O,[])):(c(this,H,void 0),c(this,O,void 0)),c(this,J,!!e(this,I)),c(this,Ft,!!e(this,at)),c(this,G,!!e(this,H)),this.noDisposeOnSet=!!W,this.noUpdateTTL=!!P,this.noDeleteOnFetchRejection=!!k,this.allowStaleOnFetchRejection=!!x,this.allowStaleOnFetchAbort=!!bt,this.ignoreFetchAbort=!!ut,this.maxEntrySize!==0){if(e(this,L)!==0&&!it(e(this,L)))throw new TypeError("maxSize must be a positive integer if specified");if(!it(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");u(this,l,qt).call(this);}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!D,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!d,this.ttlResolution=it(r)||r===0?r:1,this.ttlAutopurge=!!a,this.ttl=o||0,this.ttl){if(!it(this.ttl))throw new TypeError("ttl must be a positive integer if specified");u(this,l,Bt).call(this);}if(e(this,X)===0&&this.ttl===0&&e(this,L)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!e(this,X)&&!e(this,L)){let Rt="LRU_CACHE_UNBOUNDED";Jt(Rt)&&(Pt.add(Rt),Xt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Rt,wt));}}get perf(){return e(this,q)}static unsafeExposeInternals(i){return {starts:e(i,Z),ttls:e(i,j),autopurgeTimers:e(i,Y),sizes:e(i,$),keyMap:e(i,_),keyList:e(i,b),valList:e(i,p),next:e(i,B),prev:e(i,U),get head(){return e(i,R)},get tail(){return e(i,z)},free:e(i,K),isBackgroundFetch:s=>{var o;return u(o=i,l,S).call(o,s)},backgroundFetch:(s,o,r,a)=>{var n;return u(n=i,l,Ct).call(n,s,o,r,a)},moveToTail:s=>{var o;return u(o=i,l,At).call(o,s)},indexes:s=>{var o;return u(o=i,l,st).call(o,s)},rindexes:s=>{var o;return u(o=i,l,ot).call(o,s)},isStale:s=>{var o;return e(o=i,N).call(o,s)}}}get max(){return e(this,X)}get maxSize(){return e(this,L)}get calculatedSize(){return e(this,V)}get size(){return e(this,T)}get fetchMethod(){return e(this,mt)}get memoMethod(){return e(this,yt)}get dispose(){return e(this,I)}get onInsert(){return e(this,at)}get disposeAfter(){return e(this,H)}getRemainingTTL(i){return e(this,_).has(i)?1/0:0}*entries(){for(let i of u(this,l,st).call(this))e(this,p)[i]!==void 0&&e(this,b)[i]!==void 0&&!u(this,l,S).call(this,e(this,p)[i])&&(yield [e(this,b)[i],e(this,p)[i]]);}*rentries(){for(let i of u(this,l,ot).call(this))e(this,p)[i]!==void 0&&e(this,b)[i]!==void 0&&!u(this,l,S).call(this,e(this,p)[i])&&(yield [e(this,b)[i],e(this,p)[i]]);}*keys(){for(let i of u(this,l,st).call(this)){let s=e(this,b)[i];s!==void 0&&!u(this,l,S).call(this,e(this,p)[i])&&(yield s);}}*rkeys(){for(let i of u(this,l,ot).call(this)){let s=e(this,b)[i];s!==void 0&&!u(this,l,S).call(this,e(this,p)[i])&&(yield s);}}*values(){for(let i of u(this,l,st).call(this))e(this,p)[i]!==void 0&&!u(this,l,S).call(this,e(this,p)[i])&&(yield e(this,p)[i]);}*rvalues(){for(let i of u(this,l,ot).call(this))e(this,p)[i]!==void 0&&!u(this,l,S).call(this,e(this,p)[i])&&(yield e(this,p)[i]);}[(Nt=Symbol.iterator,Yt=Symbol.toStringTag,Nt)](){return this.entries()}find(i,s={}){for(let o of u(this,l,st).call(this)){let r=e(this,p)[o],a=u(this,l,S).call(this,r)?r.__staleWhileFetching:r;if(a!==void 0&&i(a,e(this,b)[o],this))return this.get(e(this,b)[o],s)}}forEach(i,s=this){for(let o of u(this,l,st).call(this)){let r=e(this,p)[o],a=u(this,l,S).call(this,r)?r.__staleWhileFetching:r;a!==void 0&&i.call(s,a,e(this,b)[o],this);}}rforEach(i,s=this){for(let o of u(this,l,ot).call(this)){let r=e(this,p)[o],a=u(this,l,S).call(this,r)?r.__staleWhileFetching:r;a!==void 0&&i.call(s,a,e(this,b)[o],this);}}purgeStale(){let i=false;for(let s of u(this,l,ot).call(this,{allowStale:true}))e(this,N).call(this,s)&&(u(this,l,rt).call(this,e(this,b)[s],"expire"),i=true);return i}info(i){let s=e(this,_).get(i);if(s===void 0)return;let o=e(this,p)[s],r=u(this,l,S).call(this,o)?o.__staleWhileFetching:o;if(r===void 0)return;let a={value:r};if(e(this,j)&&e(this,Z)){let n=e(this,j)[s],d=e(this,Z)[s];if(n&&d){let h=n-(e(this,q).now()-d);a.ttl=h,a.start=Date.now();}}return e(this,$)&&(a.size=e(this,$)[s]),a}dump(){let i=[];for(let s of u(this,l,st).call(this,{allowStale:true})){let o=e(this,b)[s],r=e(this,p)[s],a=u(this,l,S).call(this,r)?r.__staleWhileFetching:r;if(a===void 0||o===void 0)continue;let n={value:a};if(e(this,j)&&e(this,Z)){n.ttl=e(this,j)[s];let d=e(this,q).now()-e(this,Z)[s];n.start=Math.floor(Date.now()-d);}e(this,$)&&(n.size=e(this,$)[s]),i.unshift([o,n]);}return i}load(i){this.clear();for(let[s,o]of i){if(o.start){let r=Date.now()-o.start;o.start=e(this,q).now()-r;}this.set(s,o.value,o);}}set(i,s,o={}){var W,P,Q,A;if(s===void 0)return this.delete(i),this;let{ttl:r=this.ttl,start:a,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:d=this.sizeCalculation,status:h}=o,{noUpdateTTL:g=this.noUpdateTTL}=o,w=e(this,_t).call(this,i,s,o.size||0,d);if(this.maxEntrySize&&w>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=true),u(this,l,rt).call(this,i,"set"),this;let m=e(this,T)===0?void 0:e(this,_).get(i);if(m===void 0)m=e(this,T)===0?e(this,z):e(this,K).length!==0?e(this,K).pop():e(this,T)===e(this,X)?u(this,l,Ot).call(this,false):e(this,T),e(this,b)[m]=i,e(this,p)[m]=s,e(this,_).set(i,m),e(this,B)[e(this,z)]=m,e(this,U)[m]=e(this,z),c(this,z,m),Tt(this,T)._++,e(this,ft).call(this,m,w,h),h&&(h.set="add"),g=false,e(this,Ft)&&((W=e(this,at))==null||W.call(this,s,i,"add"));else {u(this,l,At).call(this,m);let v=e(this,p)[m];if(s!==v){if(e(this,nt)&&u(this,l,S).call(this,v)){v.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:y}=v;y!==void 0&&!n&&(e(this,J)&&((P=e(this,I))==null||P.call(this,y,i,"set")),e(this,G)&&e(this,O)?.push([y,i,"set"]));}else n||(e(this,J)&&((Q=e(this,I))==null||Q.call(this,v,i,"set")),e(this,G)&&e(this,O)?.push([v,i,"set"]));if(e(this,ht).call(this,m),e(this,ft).call(this,m,w,h),e(this,p)[m]=s,h){h.set="replace";let y=v&&u(this,l,S).call(this,v)?v.__staleWhileFetching:v;y!==void 0&&(h.oldValue=y);}}else h&&(h.set="update");e(this,Ft)&&this.onInsert?.(s,i,s===v?"update":"replace");}if(r!==0&&!e(this,j)&&u(this,l,Bt).call(this),e(this,j)&&(g||e(this,xt).call(this,m,r,a),h&&e(this,et).call(this,h,m)),!n&&e(this,G)&&e(this,O)){let v=e(this,O),y;for(;y=v?.shift();)(A=e(this,H))==null||A.call(this,...y);}return this}pop(){var i;try{for(;e(this,T);){let s=e(this,p)[e(this,R)];if(u(this,l,Ot).call(this,!0),u(this,l,S).call(this,s)){if(s.__staleWhileFetching)return s.__staleWhileFetching}else if(s!==void 0)return s}}finally{if(e(this,G)&&e(this,O)){let s=e(this,O),o;for(;o=s?.shift();)(i=e(this,H))==null||i.call(this,...o);}}}has(i,s={}){let{updateAgeOnHas:o=this.updateAgeOnHas,status:r}=s,a=e(this,_).get(i);if(a!==void 0){let n=e(this,p)[a];if(u(this,l,S).call(this,n)&&n.__staleWhileFetching===void 0)return false;if(e(this,N).call(this,a))r&&(r.has="stale",e(this,et).call(this,r,a));else return o&&e(this,lt).call(this,a),r&&(r.has="hit",e(this,et).call(this,r,a)),true}else r&&(r.has="miss");return false}peek(i,s={}){let{allowStale:o=this.allowStale}=s,r=e(this,_).get(i);if(r===void 0||!o&&e(this,N).call(this,r))return;let a=e(this,p)[r];return u(this,l,S).call(this,a)?a.__staleWhileFetching:a}async fetch(i,s={}){let{allowStale:o=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:d=this.noDisposeOnSet,size:h=0,sizeCalculation:g=this.sizeCalculation,noUpdateTTL:w=this.noUpdateTTL,noDeleteOnFetchRejection:m=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:W=this.allowStaleOnFetchRejection,ignoreFetchAbort:P=this.ignoreFetchAbort,allowStaleOnFetchAbort:Q=this.allowStaleOnFetchAbort,context:A,forceRefresh:v=false,status:y,signal:E}=s;if(!e(this,nt))return y&&(y.fetch="get"),this.get(i,{allowStale:o,updateAgeOnGet:r,noDeleteOnStaleGet:a,status:y});let k={allowStale:o,updateAgeOnGet:r,noDeleteOnStaleGet:a,ttl:n,noDisposeOnSet:d,size:h,sizeCalculation:g,noUpdateTTL:w,noDeleteOnFetchRejection:m,allowStaleOnFetchRejection:W,allowStaleOnFetchAbort:Q,ignoreFetchAbort:P,status:y,signal:E},D=e(this,_).get(i);if(D===void 0){y&&(y.fetch="miss");let x=u(this,l,Ct).call(this,i,D,k,A);return x.__returned=x}else {let x=e(this,p)[D];if(u(this,l,S).call(this,x)){let gt=o&&x.__staleWhileFetching!==void 0;return y&&(y.fetch="inflight",gt&&(y.returnedStale=true)),gt?x.__staleWhileFetching:x.__returned=x}let bt=e(this,N).call(this,D);if(!v&&!bt)return y&&(y.fetch="hit"),u(this,l,At).call(this,D),r&&e(this,lt).call(this,D),y&&e(this,et).call(this,y,D),x;let ut=u(this,l,Ct).call(this,i,D,k,A),ct=ut.__staleWhileFetching!==void 0&&o;return y&&(y.fetch=bt?"stale":"refresh",ct&&bt&&(y.returnedStale=true)),ct?ut.__staleWhileFetching:ut.__returned=ut}}async forceFetch(i,s={}){let o=await this.fetch(i,s);if(o===void 0)throw new Error("fetch() returned undefined");return o}memo(i,s={}){let o=e(this,yt);if(!o)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:a,...n}=s,d=this.get(i,n);if(!a&&d!==void 0)return d;let h=o(i,d,{options:n,context:r});return this.set(i,h,n),h}get(i,s={}){let{allowStale:o=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,status:n}=s,d=e(this,_).get(i);if(d!==void 0){let h=e(this,p)[d],g=u(this,l,S).call(this,h);return n&&e(this,et).call(this,n,d),e(this,N).call(this,d)?(n&&(n.get="stale"),g?(n&&o&&h.__staleWhileFetching!==void 0&&(n.returnedStale=true),o?h.__staleWhileFetching:void 0):(a||u(this,l,rt).call(this,i,"expire"),n&&o&&(n.returnedStale=true),o?h:void 0)):(n&&(n.get="hit"),g?h.__staleWhileFetching:(u(this,l,At).call(this,d),r&&e(this,lt).call(this,d),h))}else n&&(n.get="miss");}delete(i){return u(this,l,rt).call(this,i,"delete")}clear(){return u(this,l,Wt).call(this,"delete")}},X=new WeakMap,L=new WeakMap,I=new WeakMap,at=new WeakMap,H=new WeakMap,mt=new WeakMap,yt=new WeakMap,q=new WeakMap,T=new WeakMap,V=new WeakMap,_=new WeakMap,b=new WeakMap,p=new WeakMap,B=new WeakMap,U=new WeakMap,R=new WeakMap,z=new WeakMap,K=new WeakMap,O=new WeakMap,$=new WeakMap,Z=new WeakMap,j=new WeakMap,Y=new WeakMap,J=new WeakMap,nt=new WeakMap,G=new WeakMap,Ft=new WeakMap,l=new WeakSet,Bt=function(){let i=new zt(e(this,X)),s=new zt(e(this,X));c(this,j,i),c(this,Z,s);let o=this.ttlAutopurge?new Array(e(this,X)):void 0;c(this,Y,o),c(this,xt,(d,h,g=e(this,q).now())=>{s[d]=h!==0?g:0,i[d]=h,r(d,h);}),c(this,lt,d=>{s[d]=i[d]!==0?e(this,q).now():0,r(d,i[d]);});let r=this.ttlAutopurge?(d,h)=>{if(o?.[d]&&(clearTimeout(o[d]),o[d]=void 0),h&&h!==0&&o){let g=setTimeout(()=>{e(this,N).call(this,d)&&u(this,l,rt).call(this,e(this,b)[d],"expire");},h+1);g.unref&&g.unref(),o[d]=g;}}:()=>{};c(this,et,(d,h)=>{if(i[h]){let g=i[h],w=s[h];if(!g||!w)return;d.ttl=g,d.start=w,d.now=a||n();let m=d.now-w;d.remainingTTL=g-m;}});let a=0,n=()=>{let d=e(this,q).now();if(this.ttlResolution>0){a=d;let h=setTimeout(()=>a=0,this.ttlResolution);h.unref&&h.unref();}return d};this.getRemainingTTL=d=>{let h=e(this,_).get(d);if(h===void 0)return 0;let g=i[h],w=s[h];if(!g||!w)return 1/0;let m=(a||n())-w;return g-m},c(this,N,d=>{let h=s[d],g=i[d];return !!g&&!!h&&(a||n())-h>g});},lt=new WeakMap,et=new WeakMap,xt=new WeakMap,N=new WeakMap,qt=function(){let i=new zt(e(this,X));c(this,V,0),c(this,$,i),c(this,ht,s=>{c(this,V,e(this,V)-i[s]),i[s]=0;}),c(this,_t,(s,o,r,a)=>{if(u(this,l,S).call(this,o))return 0;if(!it(r))if(a){if(typeof a!="function")throw new TypeError("sizeCalculation must be a function");if(r=a(o,s),!it(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}),c(this,ft,(s,o,r)=>{if(i[s]=o,e(this,L)){let a=e(this,L)-i[s];for(;e(this,V)>a;)u(this,l,Ot).call(this,true);}c(this,V,e(this,V)+i[s]),r&&(r.entrySize=o,r.totalCalculatedSize=e(this,V));});},ht=new WeakMap,ft=new WeakMap,_t=new WeakMap,st=function*({allowStale:i=this.allowStale}={}){if(e(this,T))for(let s=e(this,z);!(!u(this,l,Gt).call(this,s)||((i||!e(this,N).call(this,s))&&(yield s),s===e(this,R)));)s=e(this,U)[s];},ot=function*({allowStale:i=this.allowStale}={}){if(e(this,T))for(let s=e(this,R);!(!u(this,l,Gt).call(this,s)||((i||!e(this,N).call(this,s))&&(yield s),s===e(this,z)));)s=e(this,B)[s];},Gt=function(i){return i!==void 0&&e(this,_).get(e(this,b)[i])===i},Ot=function(i){var a;let s=e(this,R),o=e(this,b)[s],r=e(this,p)[s];return e(this,nt)&&u(this,l,S).call(this,r)?r.__abortController.abort(new Error("evicted")):(e(this,J)||e(this,G))&&(e(this,J)&&((a=e(this,I))==null||a.call(this,r,o,"evict")),e(this,G)&&e(this,O)?.push([r,o,"evict"])),e(this,ht).call(this,s),e(this,Y)?.[s]&&(clearTimeout(e(this,Y)[s]),e(this,Y)[s]=void 0),i&&(e(this,b)[s]=void 0,e(this,p)[s]=void 0,e(this,K).push(s)),e(this,T)===1?(c(this,R,c(this,z,0)),e(this,K).length=0):c(this,R,e(this,B)[s]),e(this,_).delete(o),Tt(this,T)._--,s},Ct=function(i,s,o,r){let a=s===void 0?void 0:e(this,p)[s];if(u(this,l,S).call(this,a))return a;let n=new Mt,{signal:d}=o;d?.addEventListener("abort",()=>n.abort(d.reason),{signal:n.signal});let h={signal:n.signal,options:o,context:r},g=(A,v=false)=>{let{aborted:y}=n.signal,E=o.ignoreFetchAbort&&A!==void 0,k=o.ignoreFetchAbort||!!(o.allowStaleOnFetchAbort&&A!==void 0);if(o.status&&(y&&!v?(o.status.fetchAborted=true,o.status.fetchError=n.signal.reason,E&&(o.status.fetchAbortIgnored=true)):o.status.fetchResolved=true),y&&!E&&!v)return m(n.signal.reason,k);let D=P,x=e(this,p)[s];return (x===P||E&&v&&x===void 0)&&(A===void 0?D.__staleWhileFetching!==void 0?e(this,p)[s]=D.__staleWhileFetching:u(this,l,rt).call(this,i,"fetch"):(o.status&&(o.status.fetchUpdated=true),this.set(i,A,h.options))),A},w=A=>(o.status&&(o.status.fetchRejected=true,o.status.fetchError=A),m(A,false)),m=(A,v)=>{let{aborted:y}=n.signal,E=y&&o.allowStaleOnFetchAbort,k=E||o.allowStaleOnFetchRejection,D=k||o.noDeleteOnFetchRejection,x=P;if(e(this,p)[s]===P&&(!D||!v&&x.__staleWhileFetching===void 0?u(this,l,rt).call(this,i,"fetch"):E||(e(this,p)[s]=x.__staleWhileFetching)),k)return o.status&&x.__staleWhileFetching!==void 0&&(o.status.returnedStale=true),x.__staleWhileFetching;if(x.__returned===x)throw A},W=(A,v)=>{var E;let y=(E=e(this,mt))==null?void 0:E.call(this,i,a,h);y&&y instanceof Promise&&y.then(k=>A(k===void 0?void 0:k),v),n.signal.addEventListener("abort",()=>{(!o.ignoreFetchAbort||o.allowStaleOnFetchAbort)&&(A(void 0),o.allowStaleOnFetchAbort&&(A=k=>g(k,true)));});};o.status&&(o.status.fetchDispatched=true);let P=new Promise(W).then(g,w),Q=Object.assign(P,{__abortController:n,__staleWhileFetching:a,__returned:void 0});return s===void 0?(this.set(i,Q,{...h.options,status:void 0}),s=e(this,_).get(i)):e(this,p)[s]=Q,Q},S=function(i){if(!e(this,nt))return false;let s=i;return !!s&&s instanceof Promise&&s.hasOwnProperty("__staleWhileFetching")&&s.__abortController instanceof Mt},kt=function(i,s){e(this,U)[s]=i,e(this,B)[i]=s;},At=function(i){i!==e(this,z)&&(i===e(this,R)?c(this,R,e(this,B)[i]):u(this,l,kt).call(this,e(this,U)[i],e(this,B)[i]),u(this,l,kt).call(this,e(this,z),i),c(this,z,i));},rt=function(i,s){var r,a;let o=false;if(e(this,T)!==0){let n=e(this,_).get(i);if(n!==void 0)if(e(this,Y)?.[n]&&(clearTimeout(e(this,Y)?.[n]),e(this,Y)[n]=void 0),o=true,e(this,T)===1)u(this,l,Wt).call(this,s);else {e(this,ht).call(this,n);let d=e(this,p)[n];if(u(this,l,S).call(this,d)?d.__abortController.abort(new Error("deleted")):(e(this,J)||e(this,G))&&(e(this,J)&&((r=e(this,I))==null||r.call(this,d,i,s)),e(this,G)&&e(this,O)?.push([d,i,s])),e(this,_).delete(i),e(this,b)[n]=void 0,e(this,p)[n]=void 0,n===e(this,z))c(this,z,e(this,U)[n]);else if(n===e(this,R))c(this,R,e(this,B)[n]);else {let h=e(this,U)[n];e(this,B)[h]=e(this,B)[n];let g=e(this,B)[n];e(this,U)[g]=e(this,U)[n];}Tt(this,T)._--,e(this,K).push(n);}}if(e(this,G)&&e(this,O)?.length){let n=e(this,O),d;for(;d=n?.shift();)(a=e(this,H))==null||a.call(this,...d);}return o},Wt=function(i){var s,o;for(let r of u(this,l,ot).call(this,{allowStale:true})){let a=e(this,p)[r];if(u(this,l,S).call(this,a))a.__abortController.abort(new Error("deleted"));else {let n=e(this,b)[r];e(this,J)&&((s=e(this,I))==null||s.call(this,a,n,i)),e(this,G)&&e(this,O)?.push([a,n,i]);}}if(e(this,_).clear(),e(this,p).fill(void 0),e(this,b).fill(void 0),e(this,j)&&e(this,Z)){e(this,j).fill(0),e(this,Z).fill(0);for(let r of e(this,Y)??[])r!==void 0&&clearTimeout(r);e(this,Y)?.fill(void 0);}if(e(this,$)&&e(this,$).fill(0),c(this,R,0),c(this,z,0),e(this,K).length=0,c(this,V,0),c(this,T,0),e(this,G)&&e(this,O)){let r=e(this,O),a;for(;a=r?.shift();)(o=e(this,H))==null||o.call(this,...a);}},wt);var vt=class{cache;map=new Map;constructor(i){this.cache=new Ht({max:i.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){this.cache.clear(),this.map.clear();}delete(i){let s=this.map.delete(i);return s&&this.cache.delete(i),s}get forEach(){return this.map.forEach}get(i){let s=this.cache.get(i);return s||this.map.get(i)}has(i){return this.map.has(i)}set(i,s){return this.map.set(i,s),this.cache.set(i,s),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var dt;(r=>(r.log=(a,...n)=>console.log(`[Pixi\u2019VN] ${a}`,...n),r.warn=(a,...n)=>console.warn(`[Pixi\u2019VN] ${a}`,...n),r.error=(a,...n)=>console.error(`[Pixi\u2019VN] ${a}`,...n),r.info=(a,...n)=>console.info(`[Pixi\u2019VN] ${a}`,...n)))(dt||={});var St=new vt({cacheSize:5}),Vt=new vt({cacheSize:5});function te(t){return i=>{Lt.add(i,t);}}var Lt;(d=>{function t(h,g){let{toMemory:w}=g,m=g.name??h.name;St.get(m)&&dt.info(`Filter "${m}" already exists, it will be overwritten`),h.prototype.pixivnFilterId=m,St.set(m,h),Vt.set(m,w);}d.add=t;function i(h){let g=St.get(h);if(!g){dt.error(`Filter "${h}" not found, did you forget to register it with the filterDecorator?`);return}return g}d.get=i;function s(h,g,w){let m=i(h);if(m)try{let W=new m(structuredClone(g));return typeof w=="number"&&(W.padding=w),W}catch(W){dt.error(`Error while getting Filter instance "${h}"`,W);return}}d.getInstance=s;function o(h,g){let w=Vt.get(h);if(!w){dt.error(`Filter "${h}" not found, did you forget to register it with the filterDecorator?`);return}try{let m={filterId:h,args:w(g)};return typeof g.padding=="number"&&g.padding!==0&&(m.padding=g.padding),m}catch(m){dt.error(`Error while converting Filter "${h}" to memory`,m);return}}d.toMemory=o;function r(){return Array.from(St.values())}d.values=r;function a(h){return St.has(h)}d.has=a;function n(){return Array.from(St.keys())}d.keys=n;})(Lt||={});var F=Lt;function M(t,i){return {x:t,y:i}}F.add(pixi_js.BlurFilter,{name:"BlurFilter",toMemory:t=>({strengthX:t.strengthX,strengthY:t.strengthY,quality:t.quality,repeatEdgePixels:t.repeatEdgePixels})});F.add(pixi_js.AlphaFilter,{name:"AlphaFilter",toMemory:t=>({alpha:t.alpha})});F.add(pixi_js.NoiseFilter,{name:"NoiseFilter",toMemory:t=>({noise:t.noise,seed:t.seed})});F.add(pixiFilters.PixelateFilter,{name:"PixelateFilter",toMemory:t=>[t.sizeX,t.sizeY]});F.add(pixiFilters.AdjustmentFilter,{name:"AdjustmentFilter",toMemory:t=>({gamma:t.gamma,contrast:t.contrast,saturation:t.saturation,brightness:t.brightness,red:t.red,green:t.green,blue:t.blue,alpha:t.alpha})});F.add(pixiFilters.AdvancedBloomFilter,{name:"AdvancedBloomFilter",toMemory:t=>({threshold:t.threshold,bloomScale:t.bloomScale,brightness:t.brightness,blur:t.blur,kernels:t.kernels,quality:t.quality,pixelSize:M(t.pixelSizeX,t.pixelSizeY)})});F.add(pixiFilters.AsciiFilter,{name:"AsciiFilter",toMemory:t=>({size:t.size,color:t.color,replaceColor:t.replaceColor})});F.add(pixiFilters.BackdropBlurFilter,{name:"BackdropBlurFilter",toMemory:t=>({strength:t.strength,quality:t.quality})});F.add(pixiFilters.BevelFilter,{name:"BevelFilter",toMemory:t=>({rotation:t.rotation,thickness:t.thickness,lightColor:t.lightColor,lightAlpha:t.lightAlpha,shadowColor:t.shadowColor,shadowAlpha:t.shadowAlpha})});F.add(pixiFilters.BloomFilter,{name:"BloomFilter",toMemory:t=>({strength:M(t.strengthX,t.strengthY)})});F.add(pixiFilters.BulgePinchFilter,{name:"BulgePinchFilter",toMemory:t=>({center:M(t.centerX,t.centerY),radius:t.radius,strength:t.strength})});F.add(pixiFilters.ColorGradientFilter,{name:"ColorGradientFilter",toMemory:t=>({type:t.type,stops:t.stops,angle:t.angle,alpha:t.alpha,maxColors:t.maxColors,replace:t.replace})});F.add(pixiFilters.ColorOverlayFilter,{name:"ColorOverlayFilter",toMemory:t=>({color:t.color,alpha:t.alpha})});F.add(pixiFilters.ColorReplaceFilter,{name:"ColorReplaceFilter",toMemory:t=>({originalColor:t.originalColor,targetColor:t.targetColor,tolerance:t.tolerance})});F.add(pixiFilters.ConvolutionFilter,{name:"ConvolutionFilter",toMemory:t=>({matrix:t.matrix,width:t.width,height:t.height})});F.add(pixiFilters.CrossHatchFilter,{name:"CrossHatchFilter",toMemory:()=>({})});F.add(pixiFilters.CRTFilter,{name:"CRTFilter",toMemory:t=>({curvature:t.curvature,lineWidth:t.lineWidth,lineContrast:t.lineContrast,verticalLine:t.verticalLine,noise:t.noise,noiseSize:t.noiseSize,vignetting:t.vignetting,vignettingAlpha:t.vignettingAlpha,vignettingBlur:t.vignettingBlur,seed:t.seed,time:t.time})});F.add(pixiFilters.DotFilter,{name:"DotFilter",toMemory:t=>({scale:t.scale,angle:t.angle,grayscale:t.grayscale})});F.add(pixiFilters.DropShadowFilter,{name:"DropShadowFilter",toMemory:t=>({offset:M(t.offsetX,t.offsetY),color:t.color,alpha:t.alpha,shadowOnly:t.shadowOnly,blur:t.blur,quality:t.quality,kernels:t.kernels,pixelSize:M(t.pixelSizeX,t.pixelSizeY)})});F.add(pixiFilters.EmbossFilter,{name:"EmbossFilter",toMemory:t=>t.strength});F.add(pixiFilters.GlitchFilter,{name:"GlitchFilter",toMemory:t=>({slices:t.slices,offset:t.offset,direction:t.direction,fillMode:t.fillMode,seed:t.seed,average:t.average,minSize:t.minSize,sampleSize:t.sampleSize,red:t.red,green:t.green,blue:t.blue})});F.add(pixiFilters.GlowFilter,{name:"GlowFilter",toMemory:t=>({distance:t.distance,outerStrength:t.outerStrength,innerStrength:t.innerStrength,color:t.color,alpha:t.alpha,quality:t.quality,knockout:t.knockout})});F.add(pixiFilters.GodrayFilter,{name:"GodrayFilter",toMemory:t=>({angle:t.angle,parallel:t.parallel,center:M(t.centerX,t.centerY),gain:t.gain,lacunarity:t.lacunarity,time:t.time,alpha:t.alpha})});F.add(pixiFilters.GrayscaleFilter,{name:"GrayscaleFilter",toMemory:()=>({})});F.add(pixiFilters.HslAdjustmentFilter,{name:"HslAdjustmentFilter",toMemory:t=>({hue:t.hue,saturation:t.saturation,lightness:t.lightness,colorize:t.colorize,alpha:t.alpha})});F.add(pixiFilters.KawaseBlurFilter,{name:"KawaseBlurFilter",toMemory:t=>({strength:t.strength,quality:t.quality,pixelSize:M(t.pixelSizeX,t.pixelSizeY)})});F.add(pixiFilters.MotionBlurFilter,{name:"MotionBlurFilter",toMemory:t=>({velocity:M(t.velocityX,t.velocityY),kernelSize:t.kernelSize,offset:t.offset})});F.add(pixiFilters.MultiColorReplaceFilter,{name:"MultiColorReplaceFilter",toMemory:t=>({replacements:t.replacements,tolerance:t.tolerance})});F.add(pixiFilters.OldFilmFilter,{name:"OldFilmFilter",toMemory:t=>({sepia:t.sepia,noise:t.noise,noiseSize:t.noiseSize,scratch:t.scratch,scratchDensity:t.scratchDensity,scratchWidth:t.scratchWidth,vignetting:t.vignetting,vignettingAlpha:t.vignettingAlpha,vignettingBlur:t.vignettingBlur,seed:t.seed})});F.add(pixiFilters.OutlineFilter,{name:"OutlineFilter",toMemory:t=>({thickness:t.thickness,color:t.color,alpha:t.alpha,quality:t.quality,knockout:t.knockout})});F.add(pixiFilters.RadialBlurFilter,{name:"RadialBlurFilter",toMemory:t=>({angle:t.angle,center:M(t.centerX,t.centerY),kernelSize:t.kernelSize,radius:t.radius})});F.add(pixiFilters.ReflectionFilter,{name:"ReflectionFilter",toMemory:t=>({mirror:t.mirror,boundary:t.boundary,amplitude:t.amplitude,waveLength:t.waveLength,alpha:t.alpha,time:t.time})});F.add(pixiFilters.RGBSplitFilter,{name:"RGBSplitFilter",toMemory:t=>({red:M(t.redX,t.redY),green:M(t.greenX,t.greenY),blue:M(t.blueX,t.blueY)})});F.add(pixiFilters.ShockwaveFilter,{name:"ShockwaveFilter",toMemory:t=>({center:M(t.centerX,t.centerY),speed:t.speed,amplitude:t.amplitude,wavelength:t.wavelength,brightness:t.brightness,radius:t.radius,time:t.time})});F.add(pixiFilters.SimplexNoiseFilter,{name:"SimplexNoiseFilter",toMemory:t=>({strength:t.strength,noiseScale:t.noiseScale,offsetX:t.offsetX,offsetY:t.offsetY,offsetZ:t.offsetZ,step:t.step})});F.add(pixiFilters.TiltShiftFilter,{name:"TiltShiftFilter",toMemory:t=>({blur:t.blur,gradientBlur:t.gradientBlur,start:M(t.startX,t.startY),end:M(t.endX,t.endY)})});F.add(pixiFilters.TwistFilter,{name:"TwistFilter",toMemory:t=>({radius:t.radius,angle:t.angle,offset:M(t.offsetX,t.offsetY)})});F.add(pixiFilters.ZoomBlurFilter,{name:"ZoomBlurFilter",toMemory:t=>({strength:t.strength,center:M(t.centerX,t.centerY),innerRadius:t.innerRadius,radius:t.radius})});function xi(t,i,s,o,r,a,n,d){return core.GameUnifier.animateFilter(t,i,s,o,r,a,n,d)}var Xi={AlphaFilter:pixi_js.AlphaFilter,BlurFilter:pixi_js.BlurFilter,NoiseFilter:pixi_js.NoiseFilter,AdjustmentFilter:pixiFilters.AdjustmentFilter,AdvancedBloomFilter:pixiFilters.AdvancedBloomFilter,AsciiFilter:pixiFilters.AsciiFilter,BackdropBlurFilter:pixiFilters.BackdropBlurFilter,BevelFilter:pixiFilters.BevelFilter,BloomFilter:pixiFilters.BloomFilter,BulgePinchFilter:pixiFilters.BulgePinchFilter,ColorGradientFilter:pixiFilters.ColorGradientFilter,ColorOverlayFilter:pixiFilters.ColorOverlayFilter,ColorReplaceFilter:pixiFilters.ColorReplaceFilter,ConvolutionFilter:pixiFilters.ConvolutionFilter,CRTFilter:pixiFilters.CRTFilter,CrossHatchFilter:pixiFilters.CrossHatchFilter,DotFilter:pixiFilters.DotFilter,DropShadowFilter:pixiFilters.DropShadowFilter,EmbossFilter:pixiFilters.EmbossFilter,GlitchFilter:pixiFilters.GlitchFilter,GlowFilter:pixiFilters.GlowFilter,GodrayFilter:pixiFilters.GodrayFilter,GrayscaleFilter:pixiFilters.GrayscaleFilter,HslAdjustmentFilter:pixiFilters.HslAdjustmentFilter,KawaseBlurFilter:pixiFilters.KawaseBlurFilter,MotionBlurFilter:pixiFilters.MotionBlurFilter,MultiColorReplaceFilter:pixiFilters.MultiColorReplaceFilter,OldFilmFilter:pixiFilters.OldFilmFilter,OutlineFilter:pixiFilters.OutlineFilter,PixelateFilter:pixiFilters.PixelateFilter,RadialBlurFilter:pixiFilters.RadialBlurFilter,ReflectionFilter:pixiFilters.ReflectionFilter,RGBSplitFilter:pixiFilters.RGBSplitFilter,ShockwaveFilter:pixiFilters.ShockwaveFilter,SimplexNoiseFilter:pixiFilters.SimplexNoiseFilter,TiltShiftFilter:pixiFilters.TiltShiftFilter,TwistFilter:pixiFilters.TwistFilter,ZoomBlurFilter:pixiFilters.ZoomBlurFilter,animate:xi};exports.RegisteredFilters=F;exports.filterDecorator=te;exports.filters=Xi;
@@ -51,9 +51,10 @@ declare namespace RegisteredFilters {
51
51
  * Get a filter instance by the id, reconstructed from previously saved `args`.
52
52
  * @param filterId The id of the filter.
53
53
  * @param args The arguments to pass to the filter's constructor, as produced by a previous `toMemory` call.
54
+ * @param padding The filter's saved `padding`, if any (see {@link FilterMemory.padding}).
54
55
  * @returns The filter instance, or `undefined` if the filter isn't registered or construction failed.
55
56
  */
56
- function getInstance(filterId: string, args: any): Filter | undefined;
57
+ function getInstance(filterId: string, args: any, padding?: number): Filter | undefined;
57
58
  /**
58
59
  * Reads a live filter instance's current parameters into a serializable {@link FilterMemory}, using
59
60
  * the `toMemory` function it was registered with.
@@ -64,6 +65,7 @@ declare namespace RegisteredFilters {
64
65
  function toMemory(filterId: string, filter: Filter): {
65
66
  filterId: string;
66
67
  args: any;
68
+ padding?: number;
67
69
  } | undefined;
68
70
  /**
69
71
  * Get a list of all filter classes registered.
@@ -104,6 +106,12 @@ interface FilterMemory {
104
106
  * `toMemory` function.
105
107
  */
106
108
  args: any;
109
+ /**
110
+ * The filter's `padding` (extra pixels its area grows by on every side), when set. It's a property of
111
+ * every `Filter`, not part of a specific filter's constructor `args`, so it's saved on its own -
112
+ * without it a restored distortion/blur would be clipped to the element's bounds again.
113
+ */
114
+ padding?: number;
107
115
  }
108
116
 
109
117
  /**
@@ -123,9 +131,15 @@ interface FilterMemory {
123
131
  * `undefined`, ignored otherwise.
124
132
  * @param cleanup Called once, right before completion handling, to detach/destroy the filter or tear
125
133
  * down whatever `apply` was driving.
134
+ * @param valueRef Plain, serializable description of what `apply`/`cleanup` drive (`{ alias, config }` of a
135
+ * mask-based transition), saved with the ticker so it can be rebuilt after a save restore or a step back -
136
+ * without it an `apply`-only ticker cannot be reconstructed.
126
137
  * @returns The id of the ticker, or `undefined` if the ticker was not added.
127
138
  */
128
- declare function animate(components: string | string[], filter: Filter | undefined, keyframes: Record<string, any>, options?: AnimationOptions, priority?: UPDATE_PRIORITY, apply?: (value: number) => void, cleanup?: () => void): string | undefined;
139
+ declare function animate(components: string | string[], filter: Filter | undefined, keyframes: Record<string, any>, options?: AnimationOptions, priority?: UPDATE_PRIORITY, apply?: (value: number) => void, cleanup?: () => void, valueRef?: {
140
+ alias: string;
141
+ config: unknown;
142
+ }): string | undefined;
129
143
  /**
130
144
  * Every filter class Pixi'VN registers for save/restore out of the box (see
131
145
  * `register-builtin-filters.ts`), grouped in one place so a project can use them without importing
package/dist/filters.d.ts CHANGED
@@ -51,9 +51,10 @@ declare namespace RegisteredFilters {
51
51
  * Get a filter instance by the id, reconstructed from previously saved `args`.
52
52
  * @param filterId The id of the filter.
53
53
  * @param args The arguments to pass to the filter's constructor, as produced by a previous `toMemory` call.
54
+ * @param padding The filter's saved `padding`, if any (see {@link FilterMemory.padding}).
54
55
  * @returns The filter instance, or `undefined` if the filter isn't registered or construction failed.
55
56
  */
56
- function getInstance(filterId: string, args: any): Filter | undefined;
57
+ function getInstance(filterId: string, args: any, padding?: number): Filter | undefined;
57
58
  /**
58
59
  * Reads a live filter instance's current parameters into a serializable {@link FilterMemory}, using
59
60
  * the `toMemory` function it was registered with.
@@ -64,6 +65,7 @@ declare namespace RegisteredFilters {
64
65
  function toMemory(filterId: string, filter: Filter): {
65
66
  filterId: string;
66
67
  args: any;
68
+ padding?: number;
67
69
  } | undefined;
68
70
  /**
69
71
  * Get a list of all filter classes registered.
@@ -104,6 +106,12 @@ interface FilterMemory {
104
106
  * `toMemory` function.
105
107
  */
106
108
  args: any;
109
+ /**
110
+ * The filter's `padding` (extra pixels its area grows by on every side), when set. It's a property of
111
+ * every `Filter`, not part of a specific filter's constructor `args`, so it's saved on its own -
112
+ * without it a restored distortion/blur would be clipped to the element's bounds again.
113
+ */
114
+ padding?: number;
107
115
  }
108
116
 
109
117
  /**
@@ -123,9 +131,15 @@ interface FilterMemory {
123
131
  * `undefined`, ignored otherwise.
124
132
  * @param cleanup Called once, right before completion handling, to detach/destroy the filter or tear
125
133
  * down whatever `apply` was driving.
134
+ * @param valueRef Plain, serializable description of what `apply`/`cleanup` drive (`{ alias, config }` of a
135
+ * mask-based transition), saved with the ticker so it can be rebuilt after a save restore or a step back -
136
+ * without it an `apply`-only ticker cannot be reconstructed.
126
137
  * @returns The id of the ticker, or `undefined` if the ticker was not added.
127
138
  */
128
- declare function animate(components: string | string[], filter: Filter | undefined, keyframes: Record<string, any>, options?: AnimationOptions, priority?: UPDATE_PRIORITY, apply?: (value: number) => void, cleanup?: () => void): string | undefined;
139
+ declare function animate(components: string | string[], filter: Filter | undefined, keyframes: Record<string, any>, options?: AnimationOptions, priority?: UPDATE_PRIORITY, apply?: (value: number) => void, cleanup?: () => void, valueRef?: {
140
+ alias: string;
141
+ config: unknown;
142
+ }): string | undefined;
129
143
  /**
130
144
  * Every filter class Pixi'VN registers for save/restore out of the box (see
131
145
  * `register-builtin-filters.ts`), grouped in one place so a project can use them without importing
package/dist/filters.mjs CHANGED
@@ -1 +1 @@
1
- import {d as d$1,e}from'./chunk-AW5XWF24.mjs';import {GameUnifier}from'@drincs/pixi-vn/core';import {BlurFilter,AlphaFilter,NoiseFilter}from'@drincs/pixi-vn/pixi.js';import {PixelateFilter,AdjustmentFilter,AdvancedBloomFilter,AsciiFilter,BackdropBlurFilter,BevelFilter,BloomFilter,BulgePinchFilter,ColorGradientFilter,ColorOverlayFilter,ColorReplaceFilter,ConvolutionFilter,CrossHatchFilter,CRTFilter,DotFilter,DropShadowFilter,EmbossFilter,GlitchFilter,GlowFilter,GodrayFilter,GrayscaleFilter,HslAdjustmentFilter,KawaseBlurFilter,MotionBlurFilter,MultiColorReplaceFilter,OldFilmFilter,OutlineFilter,RadialBlurFilter,ReflectionFilter,RGBSplitFilter,ShockwaveFilter,SimplexNoiseFilter,TiltShiftFilter,TwistFilter,ZoomBlurFilter}from'pixi-filters';var d=new d$1({cacheSize:5}),y=new d$1({cacheSize:5});function M(e){return i=>{c.add(i,e);}}var c;($e=>{function e$1(o,a){let{toMemory:l}=a,n=a.name??o.name;d.get(n)&&e.info(`Filter "${n}" already exists, it will be overwritten`),o.prototype.pixivnFilterId=n,d.set(n,o),y.set(n,l);}$e.add=e$1;function i(o){let a=d.get(o);if(!a){e.error(`Filter "${o}" not found, did you forget to register it with the filterDecorator?`);return}return a}$e.get=i;function u(o,a){let l=i(o);if(l)try{return new l(a)}catch(n){e.error(`Error while getting Filter instance "${o}"`,n);return}}$e.getInstance=u;function F(o,a){let l=y.get(o);if(!l){e.error(`Filter "${o}" not found, did you forget to register it with the filterDecorator?`);return}try{return {filterId:o,args:l(a)}}catch(n){e.error(`Error while converting Filter "${o}" to memory`,n);return}}$e.toMemory=F;function g(){return Array.from(d.values())}$e.values=g;function h(o){return d.has(o)}$e.has=h;function p(){return Array.from(d.keys())}$e.keys=p;})(c||={});var t=c;function r(e,i){return {x:e,y:i}}t.add(BlurFilter,{name:"BlurFilter",toMemory:e=>({strengthX:e.strengthX,strengthY:e.strengthY,quality:e.quality,repeatEdgePixels:e.repeatEdgePixels})});t.add(AlphaFilter,{name:"AlphaFilter",toMemory:e=>({alpha:e.alpha})});t.add(NoiseFilter,{name:"NoiseFilter",toMemory:e=>({noise:e.noise,seed:e.seed})});t.add(PixelateFilter,{name:"PixelateFilter",toMemory:e=>[e.sizeX,e.sizeY]});t.add(AdjustmentFilter,{name:"AdjustmentFilter",toMemory:e=>({gamma:e.gamma,contrast:e.contrast,saturation:e.saturation,brightness:e.brightness,red:e.red,green:e.green,blue:e.blue,alpha:e.alpha})});t.add(AdvancedBloomFilter,{name:"AdvancedBloomFilter",toMemory:e=>({threshold:e.threshold,bloomScale:e.bloomScale,brightness:e.brightness,blur:e.blur,kernels:e.kernels,quality:e.quality,pixelSize:r(e.pixelSizeX,e.pixelSizeY)})});t.add(AsciiFilter,{name:"AsciiFilter",toMemory:e=>({size:e.size,color:e.color,replaceColor:e.replaceColor})});t.add(BackdropBlurFilter,{name:"BackdropBlurFilter",toMemory:e=>({strength:e.strength,quality:e.quality})});t.add(BevelFilter,{name:"BevelFilter",toMemory:e=>({rotation:e.rotation,thickness:e.thickness,lightColor:e.lightColor,lightAlpha:e.lightAlpha,shadowColor:e.shadowColor,shadowAlpha:e.shadowAlpha})});t.add(BloomFilter,{name:"BloomFilter",toMemory:e=>({strength:r(e.strengthX,e.strengthY)})});t.add(BulgePinchFilter,{name:"BulgePinchFilter",toMemory:e=>({center:r(e.centerX,e.centerY),radius:e.radius,strength:e.strength})});t.add(ColorGradientFilter,{name:"ColorGradientFilter",toMemory:e=>({type:e.type,stops:e.stops,angle:e.angle,alpha:e.alpha,maxColors:e.maxColors,replace:e.replace})});t.add(ColorOverlayFilter,{name:"ColorOverlayFilter",toMemory:e=>({color:e.color,alpha:e.alpha})});t.add(ColorReplaceFilter,{name:"ColorReplaceFilter",toMemory:e=>({originalColor:e.originalColor,targetColor:e.targetColor,tolerance:e.tolerance})});t.add(ConvolutionFilter,{name:"ConvolutionFilter",toMemory:e=>({matrix:e.matrix,width:e.width,height:e.height})});t.add(CrossHatchFilter,{name:"CrossHatchFilter",toMemory:()=>({})});t.add(CRTFilter,{name:"CRTFilter",toMemory:e=>({curvature:e.curvature,lineWidth:e.lineWidth,lineContrast:e.lineContrast,verticalLine:e.verticalLine,noise:e.noise,noiseSize:e.noiseSize,vignetting:e.vignetting,vignettingAlpha:e.vignettingAlpha,vignettingBlur:e.vignettingBlur,seed:e.seed,time:e.time})});t.add(DotFilter,{name:"DotFilter",toMemory:e=>({scale:e.scale,angle:e.angle,grayscale:e.grayscale})});t.add(DropShadowFilter,{name:"DropShadowFilter",toMemory:e=>({offset:r(e.offsetX,e.offsetY),color:e.color,alpha:e.alpha,shadowOnly:e.shadowOnly,blur:e.blur,quality:e.quality,kernels:e.kernels,pixelSize:r(e.pixelSizeX,e.pixelSizeY)})});t.add(EmbossFilter,{name:"EmbossFilter",toMemory:e=>e.strength});t.add(GlitchFilter,{name:"GlitchFilter",toMemory:e=>({slices:e.slices,offset:e.offset,direction:e.direction,fillMode:e.fillMode,seed:e.seed,average:e.average,minSize:e.minSize,sampleSize:e.sampleSize,red:e.red,green:e.green,blue:e.blue})});t.add(GlowFilter,{name:"GlowFilter",toMemory:e=>({distance:e.distance,outerStrength:e.outerStrength,innerStrength:e.innerStrength,color:e.color,alpha:e.alpha,quality:e.quality,knockout:e.knockout})});t.add(GodrayFilter,{name:"GodrayFilter",toMemory:e=>({angle:e.angle,parallel:e.parallel,center:r(e.centerX,e.centerY),gain:e.gain,lacunarity:e.lacunarity,time:e.time,alpha:e.alpha})});t.add(GrayscaleFilter,{name:"GrayscaleFilter",toMemory:()=>({})});t.add(HslAdjustmentFilter,{name:"HslAdjustmentFilter",toMemory:e=>({hue:e.hue,saturation:e.saturation,lightness:e.lightness,colorize:e.colorize,alpha:e.alpha})});t.add(KawaseBlurFilter,{name:"KawaseBlurFilter",toMemory:e=>({strength:e.strength,quality:e.quality,pixelSize:r(e.pixelSizeX,e.pixelSizeY)})});t.add(MotionBlurFilter,{name:"MotionBlurFilter",toMemory:e=>({velocity:r(e.velocityX,e.velocityY),kernelSize:e.kernelSize,offset:e.offset})});t.add(MultiColorReplaceFilter,{name:"MultiColorReplaceFilter",toMemory:e=>({replacements:e.replacements,tolerance:e.tolerance})});t.add(OldFilmFilter,{name:"OldFilmFilter",toMemory:e=>({sepia:e.sepia,noise:e.noise,noiseSize:e.noiseSize,scratch:e.scratch,scratchDensity:e.scratchDensity,scratchWidth:e.scratchWidth,vignetting:e.vignetting,vignettingAlpha:e.vignettingAlpha,vignettingBlur:e.vignettingBlur,seed:e.seed})});t.add(OutlineFilter,{name:"OutlineFilter",toMemory:e=>({thickness:e.thickness,color:e.color,alpha:e.alpha,quality:e.quality,knockout:e.knockout})});t.add(RadialBlurFilter,{name:"RadialBlurFilter",toMemory:e=>({angle:e.angle,center:r(e.centerX,e.centerY),kernelSize:e.kernelSize,radius:e.radius})});t.add(ReflectionFilter,{name:"ReflectionFilter",toMemory:e=>({mirror:e.mirror,boundary:e.boundary,amplitude:e.amplitude,waveLength:e.waveLength,alpha:e.alpha,time:e.time})});t.add(RGBSplitFilter,{name:"RGBSplitFilter",toMemory:e=>({red:r(e.redX,e.redY),green:r(e.greenX,e.greenY),blue:r(e.blueX,e.blueY)})});t.add(ShockwaveFilter,{name:"ShockwaveFilter",toMemory:e=>({center:r(e.centerX,e.centerY),speed:e.speed,amplitude:e.amplitude,wavelength:e.wavelength,brightness:e.brightness,radius:e.radius,time:e.time})});t.add(SimplexNoiseFilter,{name:"SimplexNoiseFilter",toMemory:e=>({strength:e.strength,noiseScale:e.noiseScale,offsetX:e.offsetX,offsetY:e.offsetY,offsetZ:e.offsetZ,step:e.step})});t.add(TiltShiftFilter,{name:"TiltShiftFilter",toMemory:e=>({blur:e.blur,gradientBlur:e.gradientBlur,start:r(e.startX,e.startY),end:r(e.endX,e.endY)})});t.add(TwistFilter,{name:"TwistFilter",toMemory:e=>({radius:e.radius,angle:e.angle,offset:r(e.offsetX,e.offsetY)})});t.add(ZoomBlurFilter,{name:"ZoomBlurFilter",toMemory:e=>({strength:e.strength,center:r(e.centerX,e.centerY),innerRadius:e.innerRadius,radius:e.radius})});function Ze(e,i,u,F,g,h,p){return GameUnifier.animateFilter(e,i,u,F,g,h,p)}var et={AlphaFilter:AlphaFilter,BlurFilter:BlurFilter,NoiseFilter:NoiseFilter,AdjustmentFilter:AdjustmentFilter,AdvancedBloomFilter:AdvancedBloomFilter,AsciiFilter:AsciiFilter,BackdropBlurFilter:BackdropBlurFilter,BevelFilter:BevelFilter,BloomFilter:BloomFilter,BulgePinchFilter:BulgePinchFilter,ColorGradientFilter:ColorGradientFilter,ColorOverlayFilter:ColorOverlayFilter,ColorReplaceFilter:ColorReplaceFilter,ConvolutionFilter:ConvolutionFilter,CRTFilter:CRTFilter,CrossHatchFilter:CrossHatchFilter,DotFilter:DotFilter,DropShadowFilter:DropShadowFilter,EmbossFilter:EmbossFilter,GlitchFilter:GlitchFilter,GlowFilter:GlowFilter,GodrayFilter:GodrayFilter,GrayscaleFilter:GrayscaleFilter,HslAdjustmentFilter:HslAdjustmentFilter,KawaseBlurFilter:KawaseBlurFilter,MotionBlurFilter:MotionBlurFilter,MultiColorReplaceFilter:MultiColorReplaceFilter,OldFilmFilter:OldFilmFilter,OutlineFilter:OutlineFilter,PixelateFilter:PixelateFilter,RadialBlurFilter:RadialBlurFilter,ReflectionFilter:ReflectionFilter,RGBSplitFilter:RGBSplitFilter,ShockwaveFilter:ShockwaveFilter,SimplexNoiseFilter:SimplexNoiseFilter,TiltShiftFilter:TiltShiftFilter,TwistFilter:TwistFilter,ZoomBlurFilter:ZoomBlurFilter,animate:Ze};export{t as RegisteredFilters,M as filterDecorator,et as filters};
1
+ import {d as d$1,e}from'./chunk-AW5XWF24.mjs';import {GameUnifier}from'@drincs/pixi-vn/core';import {BlurFilter,AlphaFilter,NoiseFilter}from'@drincs/pixi-vn/pixi.js';import {PixelateFilter,AdjustmentFilter,AdvancedBloomFilter,AsciiFilter,BackdropBlurFilter,BevelFilter,BloomFilter,BulgePinchFilter,ColorGradientFilter,ColorOverlayFilter,ColorReplaceFilter,ConvolutionFilter,CrossHatchFilter,CRTFilter,DotFilter,DropShadowFilter,EmbossFilter,GlitchFilter,GlowFilter,GodrayFilter,GrayscaleFilter,HslAdjustmentFilter,KawaseBlurFilter,MotionBlurFilter,MultiColorReplaceFilter,OldFilmFilter,OutlineFilter,RadialBlurFilter,ReflectionFilter,RGBSplitFilter,ShockwaveFilter,SimplexNoiseFilter,TiltShiftFilter,TwistFilter,ZoomBlurFilter}from'pixi-filters';var d=new d$1({cacheSize:5}),v=new d$1({cacheSize:5});function S(e){return i=>{u.add(i,e);}}var u;(M=>{function e$1(o,a){let{toMemory:l}=a,n=a.name??o.name;d.get(n)&&e.info(`Filter "${n}" already exists, it will be overwritten`),o.prototype.pixivnFilterId=n,d.set(n,o),v.set(n,l);}M.add=e$1;function i(o){let a=d.get(o);if(!a){e.error(`Filter "${o}" not found, did you forget to register it with the filterDecorator?`);return}return a}M.get=i;function g(o,a,l){let n=i(o);if(n)try{let m=new n(structuredClone(a));return typeof l=="number"&&(m.padding=l),m}catch(m){e.error(`Error while getting Filter instance "${o}"`,m);return}}M.getInstance=g;function F(o,a){let l=v.get(o);if(!l){e.error(`Filter "${o}" not found, did you forget to register it with the filterDecorator?`);return}try{let n={filterId:o,args:l(a)};return typeof a.padding=="number"&&a.padding!==0&&(n.padding=a.padding),n}catch(n){e.error(`Error while converting Filter "${o}" to memory`,n);return}}M.toMemory=F;function p(){return Array.from(d.values())}M.values=p;function h(o){return d.has(o)}M.has=h;function y(){return Array.from(d.keys())}M.keys=y;})(u||={});var t=u;function r(e,i){return {x:e,y:i}}t.add(BlurFilter,{name:"BlurFilter",toMemory:e=>({strengthX:e.strengthX,strengthY:e.strengthY,quality:e.quality,repeatEdgePixels:e.repeatEdgePixels})});t.add(AlphaFilter,{name:"AlphaFilter",toMemory:e=>({alpha:e.alpha})});t.add(NoiseFilter,{name:"NoiseFilter",toMemory:e=>({noise:e.noise,seed:e.seed})});t.add(PixelateFilter,{name:"PixelateFilter",toMemory:e=>[e.sizeX,e.sizeY]});t.add(AdjustmentFilter,{name:"AdjustmentFilter",toMemory:e=>({gamma:e.gamma,contrast:e.contrast,saturation:e.saturation,brightness:e.brightness,red:e.red,green:e.green,blue:e.blue,alpha:e.alpha})});t.add(AdvancedBloomFilter,{name:"AdvancedBloomFilter",toMemory:e=>({threshold:e.threshold,bloomScale:e.bloomScale,brightness:e.brightness,blur:e.blur,kernels:e.kernels,quality:e.quality,pixelSize:r(e.pixelSizeX,e.pixelSizeY)})});t.add(AsciiFilter,{name:"AsciiFilter",toMemory:e=>({size:e.size,color:e.color,replaceColor:e.replaceColor})});t.add(BackdropBlurFilter,{name:"BackdropBlurFilter",toMemory:e=>({strength:e.strength,quality:e.quality})});t.add(BevelFilter,{name:"BevelFilter",toMemory:e=>({rotation:e.rotation,thickness:e.thickness,lightColor:e.lightColor,lightAlpha:e.lightAlpha,shadowColor:e.shadowColor,shadowAlpha:e.shadowAlpha})});t.add(BloomFilter,{name:"BloomFilter",toMemory:e=>({strength:r(e.strengthX,e.strengthY)})});t.add(BulgePinchFilter,{name:"BulgePinchFilter",toMemory:e=>({center:r(e.centerX,e.centerY),radius:e.radius,strength:e.strength})});t.add(ColorGradientFilter,{name:"ColorGradientFilter",toMemory:e=>({type:e.type,stops:e.stops,angle:e.angle,alpha:e.alpha,maxColors:e.maxColors,replace:e.replace})});t.add(ColorOverlayFilter,{name:"ColorOverlayFilter",toMemory:e=>({color:e.color,alpha:e.alpha})});t.add(ColorReplaceFilter,{name:"ColorReplaceFilter",toMemory:e=>({originalColor:e.originalColor,targetColor:e.targetColor,tolerance:e.tolerance})});t.add(ConvolutionFilter,{name:"ConvolutionFilter",toMemory:e=>({matrix:e.matrix,width:e.width,height:e.height})});t.add(CrossHatchFilter,{name:"CrossHatchFilter",toMemory:()=>({})});t.add(CRTFilter,{name:"CRTFilter",toMemory:e=>({curvature:e.curvature,lineWidth:e.lineWidth,lineContrast:e.lineContrast,verticalLine:e.verticalLine,noise:e.noise,noiseSize:e.noiseSize,vignetting:e.vignetting,vignettingAlpha:e.vignettingAlpha,vignettingBlur:e.vignettingBlur,seed:e.seed,time:e.time})});t.add(DotFilter,{name:"DotFilter",toMemory:e=>({scale:e.scale,angle:e.angle,grayscale:e.grayscale})});t.add(DropShadowFilter,{name:"DropShadowFilter",toMemory:e=>({offset:r(e.offsetX,e.offsetY),color:e.color,alpha:e.alpha,shadowOnly:e.shadowOnly,blur:e.blur,quality:e.quality,kernels:e.kernels,pixelSize:r(e.pixelSizeX,e.pixelSizeY)})});t.add(EmbossFilter,{name:"EmbossFilter",toMemory:e=>e.strength});t.add(GlitchFilter,{name:"GlitchFilter",toMemory:e=>({slices:e.slices,offset:e.offset,direction:e.direction,fillMode:e.fillMode,seed:e.seed,average:e.average,minSize:e.minSize,sampleSize:e.sampleSize,red:e.red,green:e.green,blue:e.blue})});t.add(GlowFilter,{name:"GlowFilter",toMemory:e=>({distance:e.distance,outerStrength:e.outerStrength,innerStrength:e.innerStrength,color:e.color,alpha:e.alpha,quality:e.quality,knockout:e.knockout})});t.add(GodrayFilter,{name:"GodrayFilter",toMemory:e=>({angle:e.angle,parallel:e.parallel,center:r(e.centerX,e.centerY),gain:e.gain,lacunarity:e.lacunarity,time:e.time,alpha:e.alpha})});t.add(GrayscaleFilter,{name:"GrayscaleFilter",toMemory:()=>({})});t.add(HslAdjustmentFilter,{name:"HslAdjustmentFilter",toMemory:e=>({hue:e.hue,saturation:e.saturation,lightness:e.lightness,colorize:e.colorize,alpha:e.alpha})});t.add(KawaseBlurFilter,{name:"KawaseBlurFilter",toMemory:e=>({strength:e.strength,quality:e.quality,pixelSize:r(e.pixelSizeX,e.pixelSizeY)})});t.add(MotionBlurFilter,{name:"MotionBlurFilter",toMemory:e=>({velocity:r(e.velocityX,e.velocityY),kernelSize:e.kernelSize,offset:e.offset})});t.add(MultiColorReplaceFilter,{name:"MultiColorReplaceFilter",toMemory:e=>({replacements:e.replacements,tolerance:e.tolerance})});t.add(OldFilmFilter,{name:"OldFilmFilter",toMemory:e=>({sepia:e.sepia,noise:e.noise,noiseSize:e.noiseSize,scratch:e.scratch,scratchDensity:e.scratchDensity,scratchWidth:e.scratchWidth,vignetting:e.vignetting,vignettingAlpha:e.vignettingAlpha,vignettingBlur:e.vignettingBlur,seed:e.seed})});t.add(OutlineFilter,{name:"OutlineFilter",toMemory:e=>({thickness:e.thickness,color:e.color,alpha:e.alpha,quality:e.quality,knockout:e.knockout})});t.add(RadialBlurFilter,{name:"RadialBlurFilter",toMemory:e=>({angle:e.angle,center:r(e.centerX,e.centerY),kernelSize:e.kernelSize,radius:e.radius})});t.add(ReflectionFilter,{name:"ReflectionFilter",toMemory:e=>({mirror:e.mirror,boundary:e.boundary,amplitude:e.amplitude,waveLength:e.waveLength,alpha:e.alpha,time:e.time})});t.add(RGBSplitFilter,{name:"RGBSplitFilter",toMemory:e=>({red:r(e.redX,e.redY),green:r(e.greenX,e.greenY),blue:r(e.blueX,e.blueY)})});t.add(ShockwaveFilter,{name:"ShockwaveFilter",toMemory:e=>({center:r(e.centerX,e.centerY),speed:e.speed,amplitude:e.amplitude,wavelength:e.wavelength,brightness:e.brightness,radius:e.radius,time:e.time})});t.add(SimplexNoiseFilter,{name:"SimplexNoiseFilter",toMemory:e=>({strength:e.strength,noiseScale:e.noiseScale,offsetX:e.offsetX,offsetY:e.offsetY,offsetZ:e.offsetZ,step:e.step})});t.add(TiltShiftFilter,{name:"TiltShiftFilter",toMemory:e=>({blur:e.blur,gradientBlur:e.gradientBlur,start:r(e.startX,e.startY),end:r(e.endX,e.endY)})});t.add(TwistFilter,{name:"TwistFilter",toMemory:e=>({radius:e.radius,angle:e.angle,offset:r(e.offsetX,e.offsetY)})});t.add(ZoomBlurFilter,{name:"ZoomBlurFilter",toMemory:e=>({strength:e.strength,center:r(e.centerX,e.centerY),innerRadius:e.innerRadius,radius:e.radius})});function $e(e,i,g,F,p,h,y,M){return GameUnifier.animateFilter(e,i,g,F,p,h,y,M)}var tt={AlphaFilter:AlphaFilter,BlurFilter:BlurFilter,NoiseFilter:NoiseFilter,AdjustmentFilter:AdjustmentFilter,AdvancedBloomFilter:AdvancedBloomFilter,AsciiFilter:AsciiFilter,BackdropBlurFilter:BackdropBlurFilter,BevelFilter:BevelFilter,BloomFilter:BloomFilter,BulgePinchFilter:BulgePinchFilter,ColorGradientFilter:ColorGradientFilter,ColorOverlayFilter:ColorOverlayFilter,ColorReplaceFilter:ColorReplaceFilter,ConvolutionFilter:ConvolutionFilter,CRTFilter:CRTFilter,CrossHatchFilter:CrossHatchFilter,DotFilter:DotFilter,DropShadowFilter:DropShadowFilter,EmbossFilter:EmbossFilter,GlitchFilter:GlitchFilter,GlowFilter:GlowFilter,GodrayFilter:GodrayFilter,GrayscaleFilter:GrayscaleFilter,HslAdjustmentFilter:HslAdjustmentFilter,KawaseBlurFilter:KawaseBlurFilter,MotionBlurFilter:MotionBlurFilter,MultiColorReplaceFilter:MultiColorReplaceFilter,OldFilmFilter:OldFilmFilter,OutlineFilter:OutlineFilter,PixelateFilter:PixelateFilter,RadialBlurFilter:RadialBlurFilter,ReflectionFilter:ReflectionFilter,RGBSplitFilter:RGBSplitFilter,ShockwaveFilter:ShockwaveFilter,SimplexNoiseFilter:SimplexNoiseFilter,TiltShiftFilter:TiltShiftFilter,TwistFilter:TwistFilter,ZoomBlurFilter:ZoomBlurFilter,animate:$e};export{t as RegisteredFilters,S as filterDecorator,tt as filters};
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var D=require('@drincs/pixi-vn/canvas'),Xt=require('@drincs/pixi-vn/characters'),core=require('@drincs/pixi-vn/core'),ot=require('@drincs/pixi-vn/history'),O=require('@drincs/pixi-vn/narration'),_t=require('@drincs/pixi-vn/sound'),W=require('@drincs/pixi-vn/storage'),tickers=require('@drincs/pixi-vn/tickers'),worker=require('@drincs/pixi-vn/worker'),motion=require('@drincs/pixi-vn/motion');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var D__namespace=/*#__PURE__*/_interopNamespace(D);var Xt__namespace=/*#__PURE__*/_interopNamespace(Xt);var ot__namespace=/*#__PURE__*/_interopNamespace(ot);var O__namespace=/*#__PURE__*/_interopNamespace(O);var _t__namespace=/*#__PURE__*/_interopNamespace(_t);var W__namespace=/*#__PURE__*/_interopNamespace(W);var Jt=Object.defineProperty;var Qt=l=>{throw TypeError(l)};var be=(l,e,i)=>e in l?Jt(l,e,{enumerable:true,configurable:true,writable:true,value:i}):l[e]=i;var Se=(l,e)=>{for(var i in e)Jt(l,i,{get:e[i],enumerable:true});};var F=(l,e,i)=>be(l,typeof e!="symbol"?e+"":e,i),Ft=(l,e,i)=>e.has(l)||Qt("Cannot "+i);var t=(l,e,i)=>(Ft(l,e,"read from private field"),i?i.call(l):e.get(l)),b=(l,e,i)=>e.has(l)?Qt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(l):e.set(l,i),u=(l,e,i,s)=>(Ft(l,e,"write to private field"),e.set(l,i),i),c=(l,e,i)=>(Ft(l,e,"access private method"),i);var Pt=(l,e,i,s)=>({set _(r){u(l,e,r);},get _(){return t(l,e,s)}});var Te=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,ie=new Set,Mt=typeof process=="object"&&process?process:{},se=(l,e,i,s)=>{typeof Mt.emitWarning=="function"?Mt.emitWarning(l,e,i,s):console.error(`[${i}] ${e}: ${l}`);},jt=globalThis.AbortController,Zt=globalThis.AbortSignal;if(typeof jt>"u"){Zt=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,s){this._onabort.push(s);}},jt=class{constructor(){e();}signal=new Zt;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let l=Mt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{l&&(l=false,se("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 we=l=>!ie.has(l);var dt=l=>l&&l===Math.floor(l)&&l>0&&isFinite(l),re=l=>dt(l)?l<=Math.pow(2,8)?Uint8Array:l<=Math.pow(2,16)?Uint16Array:l<=Math.pow(2,32)?Uint32Array:l<=Number.MAX_SAFE_INTEGER?It:null:null,It=class extends Array{constructor(l){super(l),this.fill(0);}},lt,St,xe=(lt=class{heap;length;static create(e){let i=re(e);if(!i)return [];u(lt,St,true);let s=new lt(e,i);return u(lt,St,false),s}constructor(e,i){if(!t(lt,St))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},St=new WeakMap,b(lt,St,false),lt),te,ee,X,K,Q,vt,Z,Tt,wt,tt,I,et,R,E,_,k,Y,z,G,it,j,st,rt,q,B,nt,mt,V,xt,a,zt,yt,ht,Ot,$,oe,bt,Et,Lt,pt,ut,kt,Ct,Gt,x,Vt,At,ft,Ht,Ut,ne=(Ut=class{constructor(e){b(this,a);b(this,X);b(this,K);b(this,Q);b(this,vt);b(this,Z);b(this,Tt);b(this,wt);b(this,tt);F(this,"ttl");F(this,"ttlResolution");F(this,"ttlAutopurge");F(this,"updateAgeOnGet");F(this,"updateAgeOnHas");F(this,"allowStale");F(this,"noDisposeOnSet");F(this,"noUpdateTTL");F(this,"maxEntrySize");F(this,"sizeCalculation");F(this,"noDeleteOnFetchRejection");F(this,"noDeleteOnStaleGet");F(this,"allowStaleOnFetchAbort");F(this,"allowStaleOnFetchRejection");F(this,"ignoreFetchAbort");b(this,I);b(this,et);b(this,R);b(this,E);b(this,_);b(this,k);b(this,Y);b(this,z);b(this,G);b(this,it);b(this,j);b(this,st);b(this,rt);b(this,q);b(this,B);b(this,nt);b(this,mt);b(this,V);b(this,xt);b(this,yt,()=>{});b(this,ht,()=>{});b(this,Ot,()=>{});b(this,$,()=>false);b(this,bt,e=>{});b(this,Et,(e,i,s)=>{});b(this,Lt,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});F(this,te,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:o,updateAgeOnGet:n,updateAgeOnHas:h,allowStale:d,dispose:y,onInsert:U,disposeAfter:S,noDisposeOnSet:M,noUpdateTTL:N,maxSize:H=0,maxEntrySize:m=0,sizeCalculation:v,fetchMethod:g,memoMethod:L,noDeleteOnFetchRejection:A,noDeleteOnStaleGet:p,allowStaleOnFetchRejection:T,allowStaleOnFetchAbort:at,ignoreFetchAbort:f,perf:w}=e;if(w!==void 0&&typeof w?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(u(this,tt,w??Te),i!==0&&!dt(i))throw new TypeError("max option must be a nonnegative integer");let C=i?re(i):Array;if(!C)throw new Error("invalid max value: "+i);if(u(this,X,i),u(this,K,H),this.maxEntrySize=m||t(this,K),this.sizeCalculation=v,this.sizeCalculation){if(!t(this,K)&&!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(L!==void 0&&typeof L!="function")throw new TypeError("memoMethod must be a function if defined");if(u(this,wt,L),g!==void 0&&typeof g!="function")throw new TypeError("fetchMethod must be a function if specified");if(u(this,Tt,g),u(this,mt,!!g),u(this,R,new Map),u(this,E,new Array(i).fill(void 0)),u(this,_,new Array(i).fill(void 0)),u(this,k,new C(i)),u(this,Y,new C(i)),u(this,z,0),u(this,G,0),u(this,it,xe.create(i)),u(this,I,0),u(this,et,0),typeof y=="function"&&u(this,Q,y),typeof U=="function"&&u(this,vt,U),typeof S=="function"?(u(this,Z,S),u(this,j,[])):(u(this,Z,void 0),u(this,j,void 0)),u(this,nt,!!t(this,Q)),u(this,xt,!!t(this,vt)),u(this,V,!!t(this,Z)),this.noDisposeOnSet=!!M,this.noUpdateTTL=!!N,this.noDeleteOnFetchRejection=!!A,this.allowStaleOnFetchRejection=!!T,this.allowStaleOnFetchAbort=!!at,this.ignoreFetchAbort=!!f,this.maxEntrySize!==0){if(t(this,K)!==0&&!dt(t(this,K)))throw new TypeError("maxSize must be a positive integer if specified");if(!dt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");c(this,a,oe).call(this);}if(this.allowStale=!!d,this.noDeleteOnStaleGet=!!p,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!h,this.ttlResolution=dt(r)||r===0?r:1,this.ttlAutopurge=!!o,this.ttl=s||0,this.ttl){if(!dt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");c(this,a,zt).call(this);}if(t(this,X)===0&&this.ttl===0&&t(this,K)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,X)&&!t(this,K)){let J="LRU_CACHE_UNBOUNDED";we(J)&&(ie.add(J),se("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",J,Ut));}}get perf(){return t(this,tt)}static unsafeExposeInternals(e){return {starts:t(e,rt),ttls:t(e,q),autopurgeTimers:t(e,B),sizes:t(e,st),keyMap:t(e,R),keyList:t(e,E),valList:t(e,_),next:t(e,k),prev:t(e,Y),get head(){return t(e,z)},get tail(){return t(e,G)},free:t(e,it),isBackgroundFetch:i=>{var s;return c(s=e,a,x).call(s,i)},backgroundFetch:(i,s,r,o)=>{var n;return c(n=e,a,Gt).call(n,i,s,r,o)},moveToTail:i=>{var s;return c(s=e,a,At).call(s,i)},indexes:i=>{var s;return c(s=e,a,pt).call(s,i)},rindexes:i=>{var s;return c(s=e,a,ut).call(s,i)},isStale:i=>{var s;return t(s=e,$).call(s,i)}}}get max(){return t(this,X)}get maxSize(){return t(this,K)}get calculatedSize(){return t(this,et)}get size(){return t(this,I)}get fetchMethod(){return t(this,Tt)}get memoMethod(){return t(this,wt)}get dispose(){return t(this,Q)}get onInsert(){return t(this,vt)}get disposeAfter(){return t(this,Z)}getRemainingTTL(e){return t(this,R).has(e)?1/0:0}*entries(){for(let e of c(this,a,pt).call(this))t(this,_)[e]!==void 0&&t(this,E)[e]!==void 0&&!c(this,a,x).call(this,t(this,_)[e])&&(yield [t(this,E)[e],t(this,_)[e]]);}*rentries(){for(let e of c(this,a,ut).call(this))t(this,_)[e]!==void 0&&t(this,E)[e]!==void 0&&!c(this,a,x).call(this,t(this,_)[e])&&(yield [t(this,E)[e],t(this,_)[e]]);}*keys(){for(let e of c(this,a,pt).call(this)){let i=t(this,E)[e];i!==void 0&&!c(this,a,x).call(this,t(this,_)[e])&&(yield i);}}*rkeys(){for(let e of c(this,a,ut).call(this)){let i=t(this,E)[e];i!==void 0&&!c(this,a,x).call(this,t(this,_)[e])&&(yield i);}}*values(){for(let e of c(this,a,pt).call(this))t(this,_)[e]!==void 0&&!c(this,a,x).call(this,t(this,_)[e])&&(yield t(this,_)[e]);}*rvalues(){for(let e of c(this,a,ut).call(this))t(this,_)[e]!==void 0&&!c(this,a,x).call(this,t(this,_)[e])&&(yield t(this,_)[e]);}[(ee=Symbol.iterator,te=Symbol.toStringTag,ee)](){return this.entries()}find(e,i={}){for(let s of c(this,a,pt).call(this)){let r=t(this,_)[s],o=c(this,a,x).call(this,r)?r.__staleWhileFetching:r;if(o!==void 0&&e(o,t(this,E)[s],this))return this.get(t(this,E)[s],i)}}forEach(e,i=this){for(let s of c(this,a,pt).call(this)){let r=t(this,_)[s],o=c(this,a,x).call(this,r)?r.__staleWhileFetching:r;o!==void 0&&e.call(i,o,t(this,E)[s],this);}}rforEach(e,i=this){for(let s of c(this,a,ut).call(this)){let r=t(this,_)[s],o=c(this,a,x).call(this,r)?r.__staleWhileFetching:r;o!==void 0&&e.call(i,o,t(this,E)[s],this);}}purgeStale(){let e=false;for(let i of c(this,a,ut).call(this,{allowStale:true}))t(this,$).call(this,i)&&(c(this,a,ft).call(this,t(this,E)[i],"expire"),e=true);return e}info(e){let i=t(this,R).get(e);if(i===void 0)return;let s=t(this,_)[i],r=c(this,a,x).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let o={value:r};if(t(this,q)&&t(this,rt)){let n=t(this,q)[i],h=t(this,rt)[i];if(n&&h){let d=n-(t(this,tt).now()-h);o.ttl=d,o.start=Date.now();}}return t(this,st)&&(o.size=t(this,st)[i]),o}dump(){let e=[];for(let i of c(this,a,pt).call(this,{allowStale:true})){let s=t(this,E)[i],r=t(this,_)[i],o=c(this,a,x).call(this,r)?r.__staleWhileFetching:r;if(o===void 0||s===void 0)continue;let n={value:o};if(t(this,q)&&t(this,rt)){n.ttl=t(this,q)[i];let h=t(this,tt).now()-t(this,rt)[i];n.start=Math.floor(Date.now()-h);}t(this,st)&&(n.size=t(this,st)[i]),e.unshift([s,n]);}return e}load(e){this.clear();for(let[i,s]of e){if(s.start){let r=Date.now()-s.start;s.start=t(this,tt).now()-r;}this.set(i,s.value,s);}}set(e,i,s={}){var M,N,H,m;if(i===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:o,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:h=this.sizeCalculation,status:d}=s,{noUpdateTTL:y=this.noUpdateTTL}=s,U=t(this,Lt).call(this,e,i,s.size||0,h);if(this.maxEntrySize&&U>this.maxEntrySize)return d&&(d.set="miss",d.maxEntrySizeExceeded=true),c(this,a,ft).call(this,e,"set"),this;let S=t(this,I)===0?void 0:t(this,R).get(e);if(S===void 0)S=t(this,I)===0?t(this,G):t(this,it).length!==0?t(this,it).pop():t(this,I)===t(this,X)?c(this,a,Ct).call(this,false):t(this,I),t(this,E)[S]=e,t(this,_)[S]=i,t(this,R).set(e,S),t(this,k)[t(this,G)]=S,t(this,Y)[S]=t(this,G),u(this,G,S),Pt(this,I)._++,t(this,Et).call(this,S,U,d),d&&(d.set="add"),y=false,t(this,xt)&&((M=t(this,vt))==null||M.call(this,i,e,"add"));else {c(this,a,At).call(this,S);let v=t(this,_)[S];if(i!==v){if(t(this,mt)&&c(this,a,x).call(this,v)){v.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:g}=v;g!==void 0&&!n&&(t(this,nt)&&((N=t(this,Q))==null||N.call(this,g,e,"set")),t(this,V)&&t(this,j)?.push([g,e,"set"]));}else n||(t(this,nt)&&((H=t(this,Q))==null||H.call(this,v,e,"set")),t(this,V)&&t(this,j)?.push([v,e,"set"]));if(t(this,bt).call(this,S),t(this,Et).call(this,S,U,d),t(this,_)[S]=i,d){d.set="replace";let g=v&&c(this,a,x).call(this,v)?v.__staleWhileFetching:v;g!==void 0&&(d.oldValue=g);}}else d&&(d.set="update");t(this,xt)&&this.onInsert?.(i,e,i===v?"update":"replace");}if(r!==0&&!t(this,q)&&c(this,a,zt).call(this),t(this,q)&&(y||t(this,Ot).call(this,S,r,o),d&&t(this,ht).call(this,d,S)),!n&&t(this,V)&&t(this,j)){let v=t(this,j),g;for(;g=v?.shift();)(m=t(this,Z))==null||m.call(this,...g);}return this}pop(){var e;try{for(;t(this,I);){let i=t(this,_)[t(this,z)];if(c(this,a,Ct).call(this,!0),c(this,a,x).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(t(this,V)&&t(this,j)){let i=t(this,j),s;for(;s=i?.shift();)(e=t(this,Z))==null||e.call(this,...s);}}}has(e,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,o=t(this,R).get(e);if(o!==void 0){let n=t(this,_)[o];if(c(this,a,x).call(this,n)&&n.__staleWhileFetching===void 0)return false;if(t(this,$).call(this,o))r&&(r.has="stale",t(this,ht).call(this,r,o));else return s&&t(this,yt).call(this,o),r&&(r.has="hit",t(this,ht).call(this,r,o)),true}else r&&(r.has="miss");return false}peek(e,i={}){let{allowStale:s=this.allowStale}=i,r=t(this,R).get(e);if(r===void 0||!s&&t(this,$).call(this,r))return;let o=t(this,_)[r];return c(this,a,x).call(this,o)?o.__staleWhileFetching:o}async fetch(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:h=this.noDisposeOnSet,size:d=0,sizeCalculation:y=this.sizeCalculation,noUpdateTTL:U=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:M=this.allowStaleOnFetchRejection,ignoreFetchAbort:N=this.ignoreFetchAbort,allowStaleOnFetchAbort:H=this.allowStaleOnFetchAbort,context:m,forceRefresh:v=false,status:g,signal:L}=i;if(!t(this,mt))return g&&(g.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:o,status:g});let A={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:o,ttl:n,noDisposeOnSet:h,size:d,sizeCalculation:y,noUpdateTTL:U,noDeleteOnFetchRejection:S,allowStaleOnFetchRejection:M,allowStaleOnFetchAbort:H,ignoreFetchAbort:N,status:g,signal:L},p=t(this,R).get(e);if(p===void 0){g&&(g.fetch="miss");let T=c(this,a,Gt).call(this,e,p,A,m);return T.__returned=T}else {let T=t(this,_)[p];if(c(this,a,x).call(this,T)){let C=s&&T.__staleWhileFetching!==void 0;return g&&(g.fetch="inflight",C&&(g.returnedStale=true)),C?T.__staleWhileFetching:T.__returned=T}let at=t(this,$).call(this,p);if(!v&&!at)return g&&(g.fetch="hit"),c(this,a,At).call(this,p),r&&t(this,yt).call(this,p),g&&t(this,ht).call(this,g,p),T;let f=c(this,a,Gt).call(this,e,p,A,m),w=f.__staleWhileFetching!==void 0&&s;return g&&(g.fetch=at?"stale":"refresh",w&&at&&(g.returnedStale=true)),w?f.__staleWhileFetching:f.__returned=f}}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,wt);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:o,...n}=i,h=this.get(e,n);if(!o&&h!==void 0)return h;let d=s(e,h,{options:n,context:r});return this.set(e,d,n),d}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:n}=i,h=t(this,R).get(e);if(h!==void 0){let d=t(this,_)[h],y=c(this,a,x).call(this,d);return n&&t(this,ht).call(this,n,h),t(this,$).call(this,h)?(n&&(n.get="stale"),y?(n&&s&&d.__staleWhileFetching!==void 0&&(n.returnedStale=true),s?d.__staleWhileFetching:void 0):(o||c(this,a,ft).call(this,e,"expire"),n&&s&&(n.returnedStale=true),s?d:void 0)):(n&&(n.get="hit"),y?d.__staleWhileFetching:(c(this,a,At).call(this,h),r&&t(this,yt).call(this,h),d))}else n&&(n.get="miss");}delete(e){return c(this,a,ft).call(this,e,"delete")}clear(){return c(this,a,Ht).call(this,"delete")}},X=new WeakMap,K=new WeakMap,Q=new WeakMap,vt=new WeakMap,Z=new WeakMap,Tt=new WeakMap,wt=new WeakMap,tt=new WeakMap,I=new WeakMap,et=new WeakMap,R=new WeakMap,E=new WeakMap,_=new WeakMap,k=new WeakMap,Y=new WeakMap,z=new WeakMap,G=new WeakMap,it=new WeakMap,j=new WeakMap,st=new WeakMap,rt=new WeakMap,q=new WeakMap,B=new WeakMap,nt=new WeakMap,mt=new WeakMap,V=new WeakMap,xt=new WeakMap,a=new WeakSet,zt=function(){let e=new It(t(this,X)),i=new It(t(this,X));u(this,q,e),u(this,rt,i);let s=this.ttlAutopurge?new Array(t(this,X)):void 0;u(this,B,s),u(this,Ot,(h,d,y=t(this,tt).now())=>{i[h]=d!==0?y:0,e[h]=d,r(h,d);}),u(this,yt,h=>{i[h]=e[h]!==0?t(this,tt).now():0,r(h,e[h]);});let r=this.ttlAutopurge?(h,d)=>{if(s?.[h]&&(clearTimeout(s[h]),s[h]=void 0),d&&d!==0&&s){let y=setTimeout(()=>{t(this,$).call(this,h)&&c(this,a,ft).call(this,t(this,E)[h],"expire");},d+1);y.unref&&y.unref(),s[h]=y;}}:()=>{};u(this,ht,(h,d)=>{if(e[d]){let y=e[d],U=i[d];if(!y||!U)return;h.ttl=y,h.start=U,h.now=o||n();let S=h.now-U;h.remainingTTL=y-S;}});let o=0,n=()=>{let h=t(this,tt).now();if(this.ttlResolution>0){o=h;let d=setTimeout(()=>o=0,this.ttlResolution);d.unref&&d.unref();}return h};this.getRemainingTTL=h=>{let d=t(this,R).get(h);if(d===void 0)return 0;let y=e[d],U=i[d];if(!y||!U)return 1/0;let S=(o||n())-U;return y-S},u(this,$,h=>{let d=i[h],y=e[h];return !!y&&!!d&&(o||n())-d>y});},yt=new WeakMap,ht=new WeakMap,Ot=new WeakMap,$=new WeakMap,oe=function(){let e=new It(t(this,X));u(this,et,0),u(this,st,e),u(this,bt,i=>{u(this,et,t(this,et)-e[i]),e[i]=0;}),u(this,Lt,(i,s,r,o)=>{if(c(this,a,x).call(this,s))return 0;if(!dt(r))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(r=o(s,i),!dt(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}),u(this,Et,(i,s,r)=>{if(e[i]=s,t(this,K)){let o=t(this,K)-e[i];for(;t(this,et)>o;)c(this,a,Ct).call(this,true);}u(this,et,t(this,et)+e[i]),r&&(r.entrySize=s,r.totalCalculatedSize=t(this,et));});},bt=new WeakMap,Et=new WeakMap,Lt=new WeakMap,pt=function*({allowStale:e=this.allowStale}={}){if(t(this,I))for(let i=t(this,G);!(!c(this,a,kt).call(this,i)||((e||!t(this,$).call(this,i))&&(yield i),i===t(this,z)));)i=t(this,Y)[i];},ut=function*({allowStale:e=this.allowStale}={}){if(t(this,I))for(let i=t(this,z);!(!c(this,a,kt).call(this,i)||((e||!t(this,$).call(this,i))&&(yield i),i===t(this,G)));)i=t(this,k)[i];},kt=function(e){return e!==void 0&&t(this,R).get(t(this,E)[e])===e},Ct=function(e){var o;let i=t(this,z),s=t(this,E)[i],r=t(this,_)[i];return t(this,mt)&&c(this,a,x).call(this,r)?r.__abortController.abort(new Error("evicted")):(t(this,nt)||t(this,V))&&(t(this,nt)&&((o=t(this,Q))==null||o.call(this,r,s,"evict")),t(this,V)&&t(this,j)?.push([r,s,"evict"])),t(this,bt).call(this,i),t(this,B)?.[i]&&(clearTimeout(t(this,B)[i]),t(this,B)[i]=void 0),e&&(t(this,E)[i]=void 0,t(this,_)[i]=void 0,t(this,it).push(i)),t(this,I)===1?(u(this,z,u(this,G,0)),t(this,it).length=0):u(this,z,t(this,k)[i]),t(this,R).delete(s),Pt(this,I)._--,i},Gt=function(e,i,s,r){let o=i===void 0?void 0:t(this,_)[i];if(c(this,a,x).call(this,o))return o;let n=new jt,{signal:h}=s;h?.addEventListener("abort",()=>n.abort(h.reason),{signal:n.signal});let d={signal:n.signal,options:s,context:r},y=(m,v=false)=>{let{aborted:g}=n.signal,L=s.ignoreFetchAbort&&m!==void 0,A=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&m!==void 0);if(s.status&&(g&&!v?(s.status.fetchAborted=true,s.status.fetchError=n.signal.reason,L&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),g&&!L&&!v)return S(n.signal.reason,A);let p=N,T=t(this,_)[i];return (T===N||L&&v&&T===void 0)&&(m===void 0?p.__staleWhileFetching!==void 0?t(this,_)[i]=p.__staleWhileFetching:c(this,a,ft).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,m,d.options))),m},U=m=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=m),S(m,false)),S=(m,v)=>{let{aborted:g}=n.signal,L=g&&s.allowStaleOnFetchAbort,A=L||s.allowStaleOnFetchRejection,p=A||s.noDeleteOnFetchRejection,T=N;if(t(this,_)[i]===N&&(!p||!v&&T.__staleWhileFetching===void 0?c(this,a,ft).call(this,e,"fetch"):L||(t(this,_)[i]=T.__staleWhileFetching)),A)return s.status&&T.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),T.__staleWhileFetching;if(T.__returned===T)throw m},M=(m,v)=>{var L;let g=(L=t(this,Tt))==null?void 0:L.call(this,e,o,d);g&&g instanceof Promise&&g.then(A=>m(A===void 0?void 0:A),v),n.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(m(void 0),s.allowStaleOnFetchAbort&&(m=A=>y(A,true)));});};s.status&&(s.status.fetchDispatched=true);let N=new Promise(M).then(y,U),H=Object.assign(N,{__abortController:n,__staleWhileFetching:o,__returned:void 0});return i===void 0?(this.set(e,H,{...d.options,status:void 0}),i=t(this,R).get(e)):t(this,_)[i]=H,H},x=function(e){if(!t(this,mt))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof jt},Vt=function(e,i){t(this,Y)[i]=e,t(this,k)[e]=i;},At=function(e){e!==t(this,G)&&(e===t(this,z)?u(this,z,t(this,k)[e]):c(this,a,Vt).call(this,t(this,Y)[e],t(this,k)[e]),c(this,a,Vt).call(this,t(this,G),e),u(this,G,e));},ft=function(e,i){var r,o;let s=false;if(t(this,I)!==0){let n=t(this,R).get(e);if(n!==void 0)if(t(this,B)?.[n]&&(clearTimeout(t(this,B)?.[n]),t(this,B)[n]=void 0),s=true,t(this,I)===1)c(this,a,Ht).call(this,i);else {t(this,bt).call(this,n);let h=t(this,_)[n];if(c(this,a,x).call(this,h)?h.__abortController.abort(new Error("deleted")):(t(this,nt)||t(this,V))&&(t(this,nt)&&((r=t(this,Q))==null||r.call(this,h,e,i)),t(this,V)&&t(this,j)?.push([h,e,i])),t(this,R).delete(e),t(this,E)[n]=void 0,t(this,_)[n]=void 0,n===t(this,G))u(this,G,t(this,Y)[n]);else if(n===t(this,z))u(this,z,t(this,k)[n]);else {let d=t(this,Y)[n];t(this,k)[d]=t(this,k)[n];let y=t(this,k)[n];t(this,Y)[y]=t(this,Y)[n];}Pt(this,I)._--,t(this,it).push(n);}}if(t(this,V)&&t(this,j)?.length){let n=t(this,j),h;for(;h=n?.shift();)(o=t(this,Z))==null||o.call(this,...h);}return s},Ht=function(e){var i,s;for(let r of c(this,a,ut).call(this,{allowStale:true})){let o=t(this,_)[r];if(c(this,a,x).call(this,o))o.__abortController.abort(new Error("deleted"));else {let n=t(this,E)[r];t(this,nt)&&((i=t(this,Q))==null||i.call(this,o,n,e)),t(this,V)&&t(this,j)?.push([o,n,e]);}}if(t(this,R).clear(),t(this,_).fill(void 0),t(this,E).fill(void 0),t(this,q)&&t(this,rt)){t(this,q).fill(0),t(this,rt).fill(0);for(let r of t(this,B)??[])r!==void 0&&clearTimeout(r);t(this,B)?.fill(void 0);}if(t(this,st)&&t(this,st).fill(0),u(this,z,0),u(this,G,0),t(this,it).length=0,u(this,et,0),u(this,I,0),t(this,V)&&t(this,j)){let r=t(this,j),o;for(;o=r?.shift();)(s=t(this,Z))==null||s.call(this,...o);}},Ut);var Dt=class{cache;map=new Map;constructor(e){this.cache=new ne({max:e.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){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()}};var Rt="1.9.4";var Wt={version:Rt};var Kt="__game_layer__";var Ee={CURRENT_DIALOGUE_MEMORY_KEY:"dialogue",LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY:"dialogue:step_counter",CURRENT_MENU_OPTIONS_MEMORY_KEY:"choice:options",LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY:"choice:step_counter",CURRENT_INPUT_VALUE_MEMORY_KEY:"input:value",LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY:"input:step_counter",CURRENT_INPUT_INFO_MEMORY_KEY:"input:info",CHARACTER_CATEGORY_KEY:"character",ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY:"___glue___",OPENED_LABELS_COUNTER_KEY:"label:opened",ALL_CHOICES_MADE_KEY:"choices:made",CURRENT_STEP_TIMES_COUNTER_KEY:"label:history",LAST_STEP_GLUED:"glue:last_step"};var le={};var Yt={};Se(Yt,{createExportableElement:()=>he});var gt;(r=>(r.log=(o,...n)=>console.log(`[Pixi\u2019VN] ${o}`,...n),r.warn=(o,...n)=>console.warn(`[Pixi\u2019VN] ${o}`,...n),r.error=(o,...n)=>console.error(`[Pixi\u2019VN] ${o}`,...n),r.info=(o,...n)=>console.info(`[Pixi\u2019VN] ${o}`,...n)))(gt||={});function he(l){try{if(typeof l>"u")return l;let e=JSON.stringify(l);return JSON.parse(e)}catch(e){throw gt.error("Error creating exportable element",l,e),new core.PixiError("not_json_serializable","Error creating exportable element")}}function de(l){let e,i={},s={};function r(y){i=y;}function o(y){s=y;}function n(y){e&&h();let U=y?.windowKey??"pixiVN",S=[],M=m=>({...i,...m}),N={Game:l,narration:O__namespace.narration,storage:W__namespace.storage,stepHistory:ot__namespace.stepHistory,get props(){return i},start:(m,v)=>s.start?s.start(m,v):l.start(m,M(v)),continue:(m,v)=>s.continue?s.continue():O__namespace.narration.continue(M(m),v),call:(m,v)=>s.call?s.call(m,v):O__namespace.narration.call(m,M(v)),jump:(m,v)=>s.jump?s.jump(m,v):O__namespace.narration.jump(m,M(v)),selectChoice:(m,v)=>{let g=O__namespace.narration.choices.list?.find(L=>L.choiceIndex===m);if(!g){let L=O__namespace.narration.choices.list?.map(A=>A.choiceIndex).join(", ")??"none (no choice menu is open)";throw new Error(`Game.testing: no open choice with index ${m}. Available: ${L}`)}return s.selectChoice?s.selectChoice(g):O__namespace.narration.choices.select(g,M(v))},setInput:m=>{O__namespace.narration.input.value=m;},goBack:(m,v)=>s.back?s.back():ot__namespace.stepHistory.back(M(m),v),closeCurrentLabel:()=>O__namespace.narration.labels.closeCurrent(),closeAllLabels:()=>O__namespace.narration.labels.closeAll(),getState:()=>({dialogue:O__namespace.narration.dialogue,dialogueGlue:O__namespace.narration.dialogGlue,choices:O__namespace.narration.choices.list,input:{isRequired:O__namespace.narration.input.isRequired,type:O__namespace.narration.input.type,value:O__namespace.narration.input.value},canContinue:O__namespace.narration.canContinue,canGoBack:ot__namespace.stepHistory.canGoBack,labelsOpened:O__namespace.narration.labels.opened,currentLabelId:O__namespace.narration.labels.current?.id,stepCounter:O__namespace.narration.stepCounter}),get errors(){return S.slice()},clearErrors:()=>{S.length=0;}},H=m=>{S.push({error:m,timestamp:Date.now()});};return l.addOnError(H),typeof window<"u"?window[U]=N:gt.warn('Game.testing.enable(): "window" is not defined, so the API was not attached globally (it was still returned).'),e={api:N,windowKey:U,errorHandler:H},N}function h(){e&&(l.removeOnError(e.errorHandler),typeof window<"u"&&window[e.windowKey]===e.api&&delete window[e.windowKey],e=void 0);}function d(){return e!==void 0}return {setProps:r,setActions:o,enable:n,disable:h,isEnabled:d}}var Ae=typeof window<"u"&&typeof document<"u",pe=[" _______ _ _ _ ____ ____ ____ _____ ","|_ __ \\ (_) (_) | | |_ _| |_ _||_ \\|_ _|"," | |__) |__ _ __ __ \\_| \\ \\ / / | \\ | | "," | ___/[ | [ \\ [ ][ | \\ \\ / / | |\\ \\| | "," _| |_ | | > ' < | | \\ ' / _| |_\\ |_ ",`|_____| [___][__]\`\\_][___] \\_/ |_____|\\____| v${Wt.version}`],ue=31,Oe="background:#2f90da;color:#fff;font-weight:bold;",Le="background:#c832bb;color:#fff;font-weight:bold;",Re="background:transparent;font-weight:bold;",qt=` v${Wt.version}`;function fe(){if(!Ae)return;let l=[],e=[];for(let i=0;i<pe.length;i++){let s=pe[i],r=s.endsWith(qt),o=r?s.slice(0,-qt.length):s,n=o.slice(0,ue),h=o.slice(ue),d=r?"%c%s%c%s%c%s":"%c%s%c%s";l.push(d),e.push(Oe,n,Le,h),r&&e.push(Re,qt);}console.info(l.join(`
2
- `),...e);}function Bt(){let l=window.location.pathname+window.location.hash;return l.includes("#")&&(l=l.split("#")[1]),l}fe();exports.Game=void 0;(A=>{async function l(p,T,at){if(core.GameUnifier.init({navigate:T?.navigate,getCurrentGameStepState:async()=>{let f=D__namespace.canvas.isInitialized?D__namespace.canvas.export():{};return {path:Bt(),storage:await W__namespace.storage.export(),canvas:f,sound:_t__namespace.sound.export(),labelIndex:O__namespace.NarrationManagerStatic.currentLabelStepIndex||0,openedLabels:O__namespace.narration.openedLabels}},restoreGameStepState:async(f,w)=>{ot__namespace.HistoryManagerStatic._originalStepData=f,O__namespace.NarrationManagerStatic.openedLabels=f.openedLabels,W__namespace.storage.restore(f.storage);try{D__namespace.canvas.isInitialized&&await D__namespace.canvas.restore(f.canvas),await _t__namespace.sound.restore(f.sound);}catch(C){gt.error("Error restoring game step state:",C);}await w(f.path);},getStepCounter:()=>O__namespace.narration.stepCounter,setStepCounter:f=>{O__namespace.NarrationManagerStatic._stepCounter=f;},getOpenedLabels:()=>O__namespace.narration.openedLabels.length,addHistoryItem:(f,w)=>ot__namespace.stepHistory.add(f,w),getCharacter:f=>Xt__namespace.RegisteredCharacters.get(f),processNavigationRequests:(f,w)=>{let C=f,J=Promise.resolve();return f>0?(C--,J=O__namespace.narration.continue(w)):f<0&&(C=0,J=ot__namespace.stepHistory.back(w,{steps:f*-1})),{newValue:C,result:J}},animate:(f,w,C,J)=>motion.motion.animate(f,w,C,J),animateFilter:(f,w,C,J,_e,ve,ye)=>motion.motion.animateFilter(f,w,C,J,_e,ve,ye),removeCanvasComponent:f=>{D__namespace.canvas.isInitialized&&D__namespace.canvas.remove(f);},canvasComponentExists:f=>D__namespace.canvas.isInitialized?D__namespace.canvas.find(f)!==void 0:false,getVariable:(f,w)=>W__namespace.StorageRegistry.getVariable(f,w),setVariable:(f,w,C)=>W__namespace.StorageRegistry.setVariable(f,w,C),removeVariable:(f,w)=>W__namespace.StorageRegistry.removeVariable(f,w),getFlag:f=>W__namespace.storage.flags.get(f),setFlag:(f,w)=>W__namespace.storage.flags.set(f,w),onLabelClosing:f=>W__namespace.StorageRegistry.clearOldTempVariables(f)}),!p||!T){gt.warn("The canvas element or options are not defined. The canvas will not be initialized.");return}return await D__namespace.canvas.init(p,T,at)}A.init=l;function e(){W__namespace.storage.clear(),D__namespace.canvas.isInitialized&&D__namespace.canvas.clear(),_t__namespace.sound.clear(),O__namespace.narration.clear(),ot__namespace.stepHistory.clear();}A.clear=e;async function i(){let p=D__namespace.canvas.isInitialized?D__namespace.canvas.export():{};return {pixivn_version:Rt,stepData:O__namespace.narration.export(),storageData:await W__namespace.storage.export(),canvasData:p,soundData:_t__namespace.sound.export(),historyData:await ot__namespace.stepHistory.export(),path:Bt()}}A.exportGameState=i;async function s(p){ot__namespace.stepHistory.restore(p.historyData);let T=ot__namespace.stepHistory.lastKey;if(typeof T=="number"){let at=ot__namespace.stepHistory.stepsInfoMap.get(T)||null;await O__namespace.narration.restore(p.stepData,at);}W__namespace.storage.restore(p.storageData);try{D__namespace.canvas.isInitialized&&await D__namespace.canvas.restore(p.canvasData),await _t__namespace.sound.restore(p.soundData);}catch{}await core.GameUnifier.navigate(p.path);}A.restoreGameState=s;async function r(p,T){return A.clear(),await O__namespace.narration.call(p,T)}A.start=r;function o(p){return JSON.parse(p)}A.jsonToGameState=o;function n(p){core.GameUnifier.onEnd=p;}A.onEnd=n;function h(p){return core.GameUnifier.addOnError(p)}A.addOnError=h;function d(p){return core.GameUnifier.removeOnError(p)}A.removeOnError=d;function y(p){O__namespace.NarrationManagerStatic.onStepStart=p;}A.onStepStart=y;function U(p){O__namespace.NarrationManagerStatic.onLoadingLabel=p;}A.onLoadingLabel=U;function S(p){O__namespace.NarrationManagerStatic.onStepEnd=p;}A.onStepEnd=S;function M(p){O__namespace.NarrationManagerStatic.onLabelStarting=p;}A.onLabelStarting=M;function N(p){O__namespace.NarrationManagerStatic.onLabelClosing=p;}A.onLabelClosing=N;function H(p){core.GameUnifier.navigate=p;}A.onNavigate=H;function m(p){return core.GameUnifier.addOnPreContinue(p)}A.addOnPreContinue=m;function v(p){return core.GameUnifier.removeOnPreContinue(p)}A.removeOnPreContinue=v,A.worker={register:p=>worker.GameWorkerManager.register(p),unregister:()=>worker.GameWorkerManager.unregister(),get isAvailable(){return worker.GameWorkerManager.isAvailable}},A.testing=de(A);})(exports.Game||={});var di={characterUtils:Xt__namespace,canvasUtils:D__namespace,narrationUtils:O__namespace,soundUtils:_t__namespace,CANVAS_APP_GAME_LAYER_ALIAS:Kt,PIXIVN_VERSION:Rt,...Yt,...le,canvas:D__namespace.canvas,narration:O__namespace.narration,sound:_t__namespace.sound,storage:W__namespace.storage,tickers:tickers.tickers,history:ot__namespace.stepHistory,Game:exports.Game,GameUnifier:core.GameUnifier};exports.CANVAS_APP_GAME_LAYER_ALIAS=Kt;exports.CachedMap=Dt;exports.PIXIVN_VERSION=Rt;exports.SYSTEM_RESERVED_STORAGE_KEYS=Ee;exports.createExportableElement=he;exports.default=di;Object.keys(D).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return D[k]}})});Object.keys(Xt).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return Xt[k]}})});Object.keys(core).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return core[k]}})});Object.keys(ot).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return ot[k]}})});Object.keys(O).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return O[k]}})});Object.keys(_t).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return _t[k]}})});Object.keys(W).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return W[k]}})});Object.keys(tickers).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return tickers[k]}})});Object.keys(worker).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return worker[k]}})});
1
+ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var D=require('@drincs/pixi-vn/canvas'),Xt=require('@drincs/pixi-vn/characters'),core=require('@drincs/pixi-vn/core'),ot=require('@drincs/pixi-vn/history'),O=require('@drincs/pixi-vn/narration'),_t=require('@drincs/pixi-vn/sound'),W=require('@drincs/pixi-vn/storage'),tickers=require('@drincs/pixi-vn/tickers'),worker=require('@drincs/pixi-vn/worker'),motion=require('@drincs/pixi-vn/motion');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var D__namespace=/*#__PURE__*/_interopNamespace(D);var Xt__namespace=/*#__PURE__*/_interopNamespace(Xt);var ot__namespace=/*#__PURE__*/_interopNamespace(ot);var O__namespace=/*#__PURE__*/_interopNamespace(O);var _t__namespace=/*#__PURE__*/_interopNamespace(_t);var W__namespace=/*#__PURE__*/_interopNamespace(W);var Jt=Object.defineProperty;var Qt=l=>{throw TypeError(l)};var Se=(l,e,i)=>e in l?Jt(l,e,{enumerable:true,configurable:true,writable:true,value:i}):l[e]=i;var Te=(l,e)=>{for(var i in e)Jt(l,i,{get:e[i],enumerable:true});};var F=(l,e,i)=>Se(l,typeof e!="symbol"?e+"":e,i),Ft=(l,e,i)=>e.has(l)||Qt("Cannot "+i);var t=(l,e,i)=>(Ft(l,e,"read from private field"),i?i.call(l):e.get(l)),b=(l,e,i)=>e.has(l)?Qt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(l):e.set(l,i),u=(l,e,i,s)=>(Ft(l,e,"write to private field"),e.set(l,i),i),c=(l,e,i)=>(Ft(l,e,"access private method"),i);var Pt=(l,e,i,s)=>({set _(r){u(l,e,r);},get _(){return t(l,e,s)}});var we=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,ie=new Set,Mt=typeof process=="object"&&process?process:{},se=(l,e,i,s)=>{typeof Mt.emitWarning=="function"?Mt.emitWarning(l,e,i,s):console.error(`[${i}] ${e}: ${l}`);},jt=globalThis.AbortController,Zt=globalThis.AbortSignal;if(typeof jt>"u"){Zt=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,s){this._onabort.push(s);}},jt=class{constructor(){e();}signal=new Zt;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let l=Mt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{l&&(l=false,se("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 xe=l=>!ie.has(l);var dt=l=>l&&l===Math.floor(l)&&l>0&&isFinite(l),re=l=>dt(l)?l<=Math.pow(2,8)?Uint8Array:l<=Math.pow(2,16)?Uint16Array:l<=Math.pow(2,32)?Uint32Array:l<=Number.MAX_SAFE_INTEGER?It:null:null,It=class extends Array{constructor(l){super(l),this.fill(0);}},lt,St,Ee=(lt=class{heap;length;static create(e){let i=re(e);if(!i)return [];u(lt,St,true);let s=new lt(e,i);return u(lt,St,false),s}constructor(e,i){if(!t(lt,St))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},St=new WeakMap,b(lt,St,false),lt),te,ee,X,K,Q,vt,Z,Tt,wt,tt,I,et,R,E,_,k,Y,z,G,it,j,st,rt,q,B,nt,mt,V,xt,a,zt,yt,ht,Ot,$,oe,bt,Et,Lt,pt,ut,kt,Ct,Gt,x,Vt,At,ft,Ht,Ut,ne=(Ut=class{constructor(e){b(this,a);b(this,X);b(this,K);b(this,Q);b(this,vt);b(this,Z);b(this,Tt);b(this,wt);b(this,tt);F(this,"ttl");F(this,"ttlResolution");F(this,"ttlAutopurge");F(this,"updateAgeOnGet");F(this,"updateAgeOnHas");F(this,"allowStale");F(this,"noDisposeOnSet");F(this,"noUpdateTTL");F(this,"maxEntrySize");F(this,"sizeCalculation");F(this,"noDeleteOnFetchRejection");F(this,"noDeleteOnStaleGet");F(this,"allowStaleOnFetchAbort");F(this,"allowStaleOnFetchRejection");F(this,"ignoreFetchAbort");b(this,I);b(this,et);b(this,R);b(this,E);b(this,_);b(this,k);b(this,Y);b(this,z);b(this,G);b(this,it);b(this,j);b(this,st);b(this,rt);b(this,q);b(this,B);b(this,nt);b(this,mt);b(this,V);b(this,xt);b(this,yt,()=>{});b(this,ht,()=>{});b(this,Ot,()=>{});b(this,$,()=>false);b(this,bt,e=>{});b(this,Et,(e,i,s)=>{});b(this,Lt,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});F(this,te,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:o,updateAgeOnGet:n,updateAgeOnHas:h,allowStale:d,dispose:y,onInsert:U,disposeAfter:S,noDisposeOnSet:M,noUpdateTTL:N,maxSize:H=0,maxEntrySize:m=0,sizeCalculation:v,fetchMethod:g,memoMethod:L,noDeleteOnFetchRejection:A,noDeleteOnStaleGet:p,allowStaleOnFetchRejection:T,allowStaleOnFetchAbort:at,ignoreFetchAbort:f,perf:w}=e;if(w!==void 0&&typeof w?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(u(this,tt,w??we),i!==0&&!dt(i))throw new TypeError("max option must be a nonnegative integer");let C=i?re(i):Array;if(!C)throw new Error("invalid max value: "+i);if(u(this,X,i),u(this,K,H),this.maxEntrySize=m||t(this,K),this.sizeCalculation=v,this.sizeCalculation){if(!t(this,K)&&!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(L!==void 0&&typeof L!="function")throw new TypeError("memoMethod must be a function if defined");if(u(this,wt,L),g!==void 0&&typeof g!="function")throw new TypeError("fetchMethod must be a function if specified");if(u(this,Tt,g),u(this,mt,!!g),u(this,R,new Map),u(this,E,new Array(i).fill(void 0)),u(this,_,new Array(i).fill(void 0)),u(this,k,new C(i)),u(this,Y,new C(i)),u(this,z,0),u(this,G,0),u(this,it,Ee.create(i)),u(this,I,0),u(this,et,0),typeof y=="function"&&u(this,Q,y),typeof U=="function"&&u(this,vt,U),typeof S=="function"?(u(this,Z,S),u(this,j,[])):(u(this,Z,void 0),u(this,j,void 0)),u(this,nt,!!t(this,Q)),u(this,xt,!!t(this,vt)),u(this,V,!!t(this,Z)),this.noDisposeOnSet=!!M,this.noUpdateTTL=!!N,this.noDeleteOnFetchRejection=!!A,this.allowStaleOnFetchRejection=!!T,this.allowStaleOnFetchAbort=!!at,this.ignoreFetchAbort=!!f,this.maxEntrySize!==0){if(t(this,K)!==0&&!dt(t(this,K)))throw new TypeError("maxSize must be a positive integer if specified");if(!dt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");c(this,a,oe).call(this);}if(this.allowStale=!!d,this.noDeleteOnStaleGet=!!p,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!h,this.ttlResolution=dt(r)||r===0?r:1,this.ttlAutopurge=!!o,this.ttl=s||0,this.ttl){if(!dt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");c(this,a,zt).call(this);}if(t(this,X)===0&&this.ttl===0&&t(this,K)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,X)&&!t(this,K)){let J="LRU_CACHE_UNBOUNDED";xe(J)&&(ie.add(J),se("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",J,Ut));}}get perf(){return t(this,tt)}static unsafeExposeInternals(e){return {starts:t(e,rt),ttls:t(e,q),autopurgeTimers:t(e,B),sizes:t(e,st),keyMap:t(e,R),keyList:t(e,E),valList:t(e,_),next:t(e,k),prev:t(e,Y),get head(){return t(e,z)},get tail(){return t(e,G)},free:t(e,it),isBackgroundFetch:i=>{var s;return c(s=e,a,x).call(s,i)},backgroundFetch:(i,s,r,o)=>{var n;return c(n=e,a,Gt).call(n,i,s,r,o)},moveToTail:i=>{var s;return c(s=e,a,At).call(s,i)},indexes:i=>{var s;return c(s=e,a,pt).call(s,i)},rindexes:i=>{var s;return c(s=e,a,ut).call(s,i)},isStale:i=>{var s;return t(s=e,$).call(s,i)}}}get max(){return t(this,X)}get maxSize(){return t(this,K)}get calculatedSize(){return t(this,et)}get size(){return t(this,I)}get fetchMethod(){return t(this,Tt)}get memoMethod(){return t(this,wt)}get dispose(){return t(this,Q)}get onInsert(){return t(this,vt)}get disposeAfter(){return t(this,Z)}getRemainingTTL(e){return t(this,R).has(e)?1/0:0}*entries(){for(let e of c(this,a,pt).call(this))t(this,_)[e]!==void 0&&t(this,E)[e]!==void 0&&!c(this,a,x).call(this,t(this,_)[e])&&(yield [t(this,E)[e],t(this,_)[e]]);}*rentries(){for(let e of c(this,a,ut).call(this))t(this,_)[e]!==void 0&&t(this,E)[e]!==void 0&&!c(this,a,x).call(this,t(this,_)[e])&&(yield [t(this,E)[e],t(this,_)[e]]);}*keys(){for(let e of c(this,a,pt).call(this)){let i=t(this,E)[e];i!==void 0&&!c(this,a,x).call(this,t(this,_)[e])&&(yield i);}}*rkeys(){for(let e of c(this,a,ut).call(this)){let i=t(this,E)[e];i!==void 0&&!c(this,a,x).call(this,t(this,_)[e])&&(yield i);}}*values(){for(let e of c(this,a,pt).call(this))t(this,_)[e]!==void 0&&!c(this,a,x).call(this,t(this,_)[e])&&(yield t(this,_)[e]);}*rvalues(){for(let e of c(this,a,ut).call(this))t(this,_)[e]!==void 0&&!c(this,a,x).call(this,t(this,_)[e])&&(yield t(this,_)[e]);}[(ee=Symbol.iterator,te=Symbol.toStringTag,ee)](){return this.entries()}find(e,i={}){for(let s of c(this,a,pt).call(this)){let r=t(this,_)[s],o=c(this,a,x).call(this,r)?r.__staleWhileFetching:r;if(o!==void 0&&e(o,t(this,E)[s],this))return this.get(t(this,E)[s],i)}}forEach(e,i=this){for(let s of c(this,a,pt).call(this)){let r=t(this,_)[s],o=c(this,a,x).call(this,r)?r.__staleWhileFetching:r;o!==void 0&&e.call(i,o,t(this,E)[s],this);}}rforEach(e,i=this){for(let s of c(this,a,ut).call(this)){let r=t(this,_)[s],o=c(this,a,x).call(this,r)?r.__staleWhileFetching:r;o!==void 0&&e.call(i,o,t(this,E)[s],this);}}purgeStale(){let e=false;for(let i of c(this,a,ut).call(this,{allowStale:true}))t(this,$).call(this,i)&&(c(this,a,ft).call(this,t(this,E)[i],"expire"),e=true);return e}info(e){let i=t(this,R).get(e);if(i===void 0)return;let s=t(this,_)[i],r=c(this,a,x).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let o={value:r};if(t(this,q)&&t(this,rt)){let n=t(this,q)[i],h=t(this,rt)[i];if(n&&h){let d=n-(t(this,tt).now()-h);o.ttl=d,o.start=Date.now();}}return t(this,st)&&(o.size=t(this,st)[i]),o}dump(){let e=[];for(let i of c(this,a,pt).call(this,{allowStale:true})){let s=t(this,E)[i],r=t(this,_)[i],o=c(this,a,x).call(this,r)?r.__staleWhileFetching:r;if(o===void 0||s===void 0)continue;let n={value:o};if(t(this,q)&&t(this,rt)){n.ttl=t(this,q)[i];let h=t(this,tt).now()-t(this,rt)[i];n.start=Math.floor(Date.now()-h);}t(this,st)&&(n.size=t(this,st)[i]),e.unshift([s,n]);}return e}load(e){this.clear();for(let[i,s]of e){if(s.start){let r=Date.now()-s.start;s.start=t(this,tt).now()-r;}this.set(i,s.value,s);}}set(e,i,s={}){var M,N,H,m;if(i===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:o,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:h=this.sizeCalculation,status:d}=s,{noUpdateTTL:y=this.noUpdateTTL}=s,U=t(this,Lt).call(this,e,i,s.size||0,h);if(this.maxEntrySize&&U>this.maxEntrySize)return d&&(d.set="miss",d.maxEntrySizeExceeded=true),c(this,a,ft).call(this,e,"set"),this;let S=t(this,I)===0?void 0:t(this,R).get(e);if(S===void 0)S=t(this,I)===0?t(this,G):t(this,it).length!==0?t(this,it).pop():t(this,I)===t(this,X)?c(this,a,Ct).call(this,false):t(this,I),t(this,E)[S]=e,t(this,_)[S]=i,t(this,R).set(e,S),t(this,k)[t(this,G)]=S,t(this,Y)[S]=t(this,G),u(this,G,S),Pt(this,I)._++,t(this,Et).call(this,S,U,d),d&&(d.set="add"),y=false,t(this,xt)&&((M=t(this,vt))==null||M.call(this,i,e,"add"));else {c(this,a,At).call(this,S);let v=t(this,_)[S];if(i!==v){if(t(this,mt)&&c(this,a,x).call(this,v)){v.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:g}=v;g!==void 0&&!n&&(t(this,nt)&&((N=t(this,Q))==null||N.call(this,g,e,"set")),t(this,V)&&t(this,j)?.push([g,e,"set"]));}else n||(t(this,nt)&&((H=t(this,Q))==null||H.call(this,v,e,"set")),t(this,V)&&t(this,j)?.push([v,e,"set"]));if(t(this,bt).call(this,S),t(this,Et).call(this,S,U,d),t(this,_)[S]=i,d){d.set="replace";let g=v&&c(this,a,x).call(this,v)?v.__staleWhileFetching:v;g!==void 0&&(d.oldValue=g);}}else d&&(d.set="update");t(this,xt)&&this.onInsert?.(i,e,i===v?"update":"replace");}if(r!==0&&!t(this,q)&&c(this,a,zt).call(this),t(this,q)&&(y||t(this,Ot).call(this,S,r,o),d&&t(this,ht).call(this,d,S)),!n&&t(this,V)&&t(this,j)){let v=t(this,j),g;for(;g=v?.shift();)(m=t(this,Z))==null||m.call(this,...g);}return this}pop(){var e;try{for(;t(this,I);){let i=t(this,_)[t(this,z)];if(c(this,a,Ct).call(this,!0),c(this,a,x).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(t(this,V)&&t(this,j)){let i=t(this,j),s;for(;s=i?.shift();)(e=t(this,Z))==null||e.call(this,...s);}}}has(e,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,o=t(this,R).get(e);if(o!==void 0){let n=t(this,_)[o];if(c(this,a,x).call(this,n)&&n.__staleWhileFetching===void 0)return false;if(t(this,$).call(this,o))r&&(r.has="stale",t(this,ht).call(this,r,o));else return s&&t(this,yt).call(this,o),r&&(r.has="hit",t(this,ht).call(this,r,o)),true}else r&&(r.has="miss");return false}peek(e,i={}){let{allowStale:s=this.allowStale}=i,r=t(this,R).get(e);if(r===void 0||!s&&t(this,$).call(this,r))return;let o=t(this,_)[r];return c(this,a,x).call(this,o)?o.__staleWhileFetching:o}async fetch(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:h=this.noDisposeOnSet,size:d=0,sizeCalculation:y=this.sizeCalculation,noUpdateTTL:U=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:M=this.allowStaleOnFetchRejection,ignoreFetchAbort:N=this.ignoreFetchAbort,allowStaleOnFetchAbort:H=this.allowStaleOnFetchAbort,context:m,forceRefresh:v=false,status:g,signal:L}=i;if(!t(this,mt))return g&&(g.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:o,status:g});let A={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:o,ttl:n,noDisposeOnSet:h,size:d,sizeCalculation:y,noUpdateTTL:U,noDeleteOnFetchRejection:S,allowStaleOnFetchRejection:M,allowStaleOnFetchAbort:H,ignoreFetchAbort:N,status:g,signal:L},p=t(this,R).get(e);if(p===void 0){g&&(g.fetch="miss");let T=c(this,a,Gt).call(this,e,p,A,m);return T.__returned=T}else {let T=t(this,_)[p];if(c(this,a,x).call(this,T)){let C=s&&T.__staleWhileFetching!==void 0;return g&&(g.fetch="inflight",C&&(g.returnedStale=true)),C?T.__staleWhileFetching:T.__returned=T}let at=t(this,$).call(this,p);if(!v&&!at)return g&&(g.fetch="hit"),c(this,a,At).call(this,p),r&&t(this,yt).call(this,p),g&&t(this,ht).call(this,g,p),T;let f=c(this,a,Gt).call(this,e,p,A,m),w=f.__staleWhileFetching!==void 0&&s;return g&&(g.fetch=at?"stale":"refresh",w&&at&&(g.returnedStale=true)),w?f.__staleWhileFetching:f.__returned=f}}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,wt);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:o,...n}=i,h=this.get(e,n);if(!o&&h!==void 0)return h;let d=s(e,h,{options:n,context:r});return this.set(e,d,n),d}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:n}=i,h=t(this,R).get(e);if(h!==void 0){let d=t(this,_)[h],y=c(this,a,x).call(this,d);return n&&t(this,ht).call(this,n,h),t(this,$).call(this,h)?(n&&(n.get="stale"),y?(n&&s&&d.__staleWhileFetching!==void 0&&(n.returnedStale=true),s?d.__staleWhileFetching:void 0):(o||c(this,a,ft).call(this,e,"expire"),n&&s&&(n.returnedStale=true),s?d:void 0)):(n&&(n.get="hit"),y?d.__staleWhileFetching:(c(this,a,At).call(this,h),r&&t(this,yt).call(this,h),d))}else n&&(n.get="miss");}delete(e){return c(this,a,ft).call(this,e,"delete")}clear(){return c(this,a,Ht).call(this,"delete")}},X=new WeakMap,K=new WeakMap,Q=new WeakMap,vt=new WeakMap,Z=new WeakMap,Tt=new WeakMap,wt=new WeakMap,tt=new WeakMap,I=new WeakMap,et=new WeakMap,R=new WeakMap,E=new WeakMap,_=new WeakMap,k=new WeakMap,Y=new WeakMap,z=new WeakMap,G=new WeakMap,it=new WeakMap,j=new WeakMap,st=new WeakMap,rt=new WeakMap,q=new WeakMap,B=new WeakMap,nt=new WeakMap,mt=new WeakMap,V=new WeakMap,xt=new WeakMap,a=new WeakSet,zt=function(){let e=new It(t(this,X)),i=new It(t(this,X));u(this,q,e),u(this,rt,i);let s=this.ttlAutopurge?new Array(t(this,X)):void 0;u(this,B,s),u(this,Ot,(h,d,y=t(this,tt).now())=>{i[h]=d!==0?y:0,e[h]=d,r(h,d);}),u(this,yt,h=>{i[h]=e[h]!==0?t(this,tt).now():0,r(h,e[h]);});let r=this.ttlAutopurge?(h,d)=>{if(s?.[h]&&(clearTimeout(s[h]),s[h]=void 0),d&&d!==0&&s){let y=setTimeout(()=>{t(this,$).call(this,h)&&c(this,a,ft).call(this,t(this,E)[h],"expire");},d+1);y.unref&&y.unref(),s[h]=y;}}:()=>{};u(this,ht,(h,d)=>{if(e[d]){let y=e[d],U=i[d];if(!y||!U)return;h.ttl=y,h.start=U,h.now=o||n();let S=h.now-U;h.remainingTTL=y-S;}});let o=0,n=()=>{let h=t(this,tt).now();if(this.ttlResolution>0){o=h;let d=setTimeout(()=>o=0,this.ttlResolution);d.unref&&d.unref();}return h};this.getRemainingTTL=h=>{let d=t(this,R).get(h);if(d===void 0)return 0;let y=e[d],U=i[d];if(!y||!U)return 1/0;let S=(o||n())-U;return y-S},u(this,$,h=>{let d=i[h],y=e[h];return !!y&&!!d&&(o||n())-d>y});},yt=new WeakMap,ht=new WeakMap,Ot=new WeakMap,$=new WeakMap,oe=function(){let e=new It(t(this,X));u(this,et,0),u(this,st,e),u(this,bt,i=>{u(this,et,t(this,et)-e[i]),e[i]=0;}),u(this,Lt,(i,s,r,o)=>{if(c(this,a,x).call(this,s))return 0;if(!dt(r))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(r=o(s,i),!dt(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}),u(this,Et,(i,s,r)=>{if(e[i]=s,t(this,K)){let o=t(this,K)-e[i];for(;t(this,et)>o;)c(this,a,Ct).call(this,true);}u(this,et,t(this,et)+e[i]),r&&(r.entrySize=s,r.totalCalculatedSize=t(this,et));});},bt=new WeakMap,Et=new WeakMap,Lt=new WeakMap,pt=function*({allowStale:e=this.allowStale}={}){if(t(this,I))for(let i=t(this,G);!(!c(this,a,kt).call(this,i)||((e||!t(this,$).call(this,i))&&(yield i),i===t(this,z)));)i=t(this,Y)[i];},ut=function*({allowStale:e=this.allowStale}={}){if(t(this,I))for(let i=t(this,z);!(!c(this,a,kt).call(this,i)||((e||!t(this,$).call(this,i))&&(yield i),i===t(this,G)));)i=t(this,k)[i];},kt=function(e){return e!==void 0&&t(this,R).get(t(this,E)[e])===e},Ct=function(e){var o;let i=t(this,z),s=t(this,E)[i],r=t(this,_)[i];return t(this,mt)&&c(this,a,x).call(this,r)?r.__abortController.abort(new Error("evicted")):(t(this,nt)||t(this,V))&&(t(this,nt)&&((o=t(this,Q))==null||o.call(this,r,s,"evict")),t(this,V)&&t(this,j)?.push([r,s,"evict"])),t(this,bt).call(this,i),t(this,B)?.[i]&&(clearTimeout(t(this,B)[i]),t(this,B)[i]=void 0),e&&(t(this,E)[i]=void 0,t(this,_)[i]=void 0,t(this,it).push(i)),t(this,I)===1?(u(this,z,u(this,G,0)),t(this,it).length=0):u(this,z,t(this,k)[i]),t(this,R).delete(s),Pt(this,I)._--,i},Gt=function(e,i,s,r){let o=i===void 0?void 0:t(this,_)[i];if(c(this,a,x).call(this,o))return o;let n=new jt,{signal:h}=s;h?.addEventListener("abort",()=>n.abort(h.reason),{signal:n.signal});let d={signal:n.signal,options:s,context:r},y=(m,v=false)=>{let{aborted:g}=n.signal,L=s.ignoreFetchAbort&&m!==void 0,A=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&m!==void 0);if(s.status&&(g&&!v?(s.status.fetchAborted=true,s.status.fetchError=n.signal.reason,L&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),g&&!L&&!v)return S(n.signal.reason,A);let p=N,T=t(this,_)[i];return (T===N||L&&v&&T===void 0)&&(m===void 0?p.__staleWhileFetching!==void 0?t(this,_)[i]=p.__staleWhileFetching:c(this,a,ft).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,m,d.options))),m},U=m=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=m),S(m,false)),S=(m,v)=>{let{aborted:g}=n.signal,L=g&&s.allowStaleOnFetchAbort,A=L||s.allowStaleOnFetchRejection,p=A||s.noDeleteOnFetchRejection,T=N;if(t(this,_)[i]===N&&(!p||!v&&T.__staleWhileFetching===void 0?c(this,a,ft).call(this,e,"fetch"):L||(t(this,_)[i]=T.__staleWhileFetching)),A)return s.status&&T.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),T.__staleWhileFetching;if(T.__returned===T)throw m},M=(m,v)=>{var L;let g=(L=t(this,Tt))==null?void 0:L.call(this,e,o,d);g&&g instanceof Promise&&g.then(A=>m(A===void 0?void 0:A),v),n.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(m(void 0),s.allowStaleOnFetchAbort&&(m=A=>y(A,true)));});};s.status&&(s.status.fetchDispatched=true);let N=new Promise(M).then(y,U),H=Object.assign(N,{__abortController:n,__staleWhileFetching:o,__returned:void 0});return i===void 0?(this.set(e,H,{...d.options,status:void 0}),i=t(this,R).get(e)):t(this,_)[i]=H,H},x=function(e){if(!t(this,mt))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof jt},Vt=function(e,i){t(this,Y)[i]=e,t(this,k)[e]=i;},At=function(e){e!==t(this,G)&&(e===t(this,z)?u(this,z,t(this,k)[e]):c(this,a,Vt).call(this,t(this,Y)[e],t(this,k)[e]),c(this,a,Vt).call(this,t(this,G),e),u(this,G,e));},ft=function(e,i){var r,o;let s=false;if(t(this,I)!==0){let n=t(this,R).get(e);if(n!==void 0)if(t(this,B)?.[n]&&(clearTimeout(t(this,B)?.[n]),t(this,B)[n]=void 0),s=true,t(this,I)===1)c(this,a,Ht).call(this,i);else {t(this,bt).call(this,n);let h=t(this,_)[n];if(c(this,a,x).call(this,h)?h.__abortController.abort(new Error("deleted")):(t(this,nt)||t(this,V))&&(t(this,nt)&&((r=t(this,Q))==null||r.call(this,h,e,i)),t(this,V)&&t(this,j)?.push([h,e,i])),t(this,R).delete(e),t(this,E)[n]=void 0,t(this,_)[n]=void 0,n===t(this,G))u(this,G,t(this,Y)[n]);else if(n===t(this,z))u(this,z,t(this,k)[n]);else {let d=t(this,Y)[n];t(this,k)[d]=t(this,k)[n];let y=t(this,k)[n];t(this,Y)[y]=t(this,Y)[n];}Pt(this,I)._--,t(this,it).push(n);}}if(t(this,V)&&t(this,j)?.length){let n=t(this,j),h;for(;h=n?.shift();)(o=t(this,Z))==null||o.call(this,...h);}return s},Ht=function(e){var i,s;for(let r of c(this,a,ut).call(this,{allowStale:true})){let o=t(this,_)[r];if(c(this,a,x).call(this,o))o.__abortController.abort(new Error("deleted"));else {let n=t(this,E)[r];t(this,nt)&&((i=t(this,Q))==null||i.call(this,o,n,e)),t(this,V)&&t(this,j)?.push([o,n,e]);}}if(t(this,R).clear(),t(this,_).fill(void 0),t(this,E).fill(void 0),t(this,q)&&t(this,rt)){t(this,q).fill(0),t(this,rt).fill(0);for(let r of t(this,B)??[])r!==void 0&&clearTimeout(r);t(this,B)?.fill(void 0);}if(t(this,st)&&t(this,st).fill(0),u(this,z,0),u(this,G,0),t(this,it).length=0,u(this,et,0),u(this,I,0),t(this,V)&&t(this,j)){let r=t(this,j),o;for(;o=r?.shift();)(s=t(this,Z))==null||s.call(this,...o);}},Ut);var Dt=class{cache;map=new Map;constructor(e){this.cache=new ne({max:e.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){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()}};var Rt="1.9.5";var Wt={version:Rt};var Kt="__game_layer__";var Ue={CURRENT_DIALOGUE_MEMORY_KEY:"dialogue",LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY:"dialogue:step_counter",CURRENT_MENU_OPTIONS_MEMORY_KEY:"choice:options",LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY:"choice:step_counter",CURRENT_INPUT_VALUE_MEMORY_KEY:"input:value",LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY:"input:step_counter",CURRENT_INPUT_INFO_MEMORY_KEY:"input:info",CHARACTER_CATEGORY_KEY:"character",ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY:"___glue___",OPENED_LABELS_COUNTER_KEY:"label:opened",ALL_CHOICES_MADE_KEY:"choices:made",CURRENT_STEP_TIMES_COUNTER_KEY:"label:history",LAST_STEP_GLUED:"glue:last_step"};var le={};var Yt={};Te(Yt,{createExportableElement:()=>he});var gt;(r=>(r.log=(o,...n)=>console.log(`[Pixi\u2019VN] ${o}`,...n),r.warn=(o,...n)=>console.warn(`[Pixi\u2019VN] ${o}`,...n),r.error=(o,...n)=>console.error(`[Pixi\u2019VN] ${o}`,...n),r.info=(o,...n)=>console.info(`[Pixi\u2019VN] ${o}`,...n)))(gt||={});function he(l){try{if(typeof l>"u")return l;let e=JSON.stringify(l);return JSON.parse(e)}catch(e){throw gt.error("Error creating exportable element",l,e),new core.PixiError("not_json_serializable","Error creating exportable element")}}function de(l){let e,i={},s={};function r(y){i=y;}function o(y){s=y;}function n(y){e&&h();let U=y?.windowKey??"pixiVN",S=[],M=m=>({...i,...m}),N={Game:l,narration:O__namespace.narration,storage:W__namespace.storage,stepHistory:ot__namespace.stepHistory,get props(){return i},start:(m,v)=>s.start?s.start(m,v):l.start(m,M(v)),continue:(m,v)=>s.continue?s.continue():O__namespace.narration.continue(M(m),v),call:(m,v)=>s.call?s.call(m,v):O__namespace.narration.call(m,M(v)),jump:(m,v)=>s.jump?s.jump(m,v):O__namespace.narration.jump(m,M(v)),selectChoice:(m,v)=>{let g=O__namespace.narration.choices.list?.find(L=>L.choiceIndex===m);if(!g){let L=O__namespace.narration.choices.list?.map(A=>A.choiceIndex).join(", ")??"none (no choice menu is open)";throw new Error(`Game.testing: no open choice with index ${m}. Available: ${L}`)}return s.selectChoice?s.selectChoice(g):O__namespace.narration.choices.select(g,M(v))},setInput:m=>{O__namespace.narration.input.value=m;},goBack:(m,v)=>s.back?s.back():ot__namespace.stepHistory.back(M(m),v),closeCurrentLabel:()=>O__namespace.narration.labels.closeCurrent(),closeAllLabels:()=>O__namespace.narration.labels.closeAll(),getState:()=>({dialogue:O__namespace.narration.dialogue,dialogueGlue:O__namespace.narration.dialogGlue,choices:O__namespace.narration.choices.list,input:{isRequired:O__namespace.narration.input.isRequired,type:O__namespace.narration.input.type,value:O__namespace.narration.input.value},canContinue:O__namespace.narration.canContinue,canGoBack:ot__namespace.stepHistory.canGoBack,labelsOpened:O__namespace.narration.labels.opened,currentLabelId:O__namespace.narration.labels.current?.id,stepCounter:O__namespace.narration.stepCounter}),get errors(){return S.slice()},clearErrors:()=>{S.length=0;}},H=m=>{S.push({error:m,timestamp:Date.now()});};return l.addOnError(H),typeof window<"u"?window[U]=N:gt.warn('Game.testing.enable(): "window" is not defined, so the API was not attached globally (it was still returned).'),e={api:N,windowKey:U,errorHandler:H},N}function h(){e&&(l.removeOnError(e.errorHandler),typeof window<"u"&&window[e.windowKey]===e.api&&delete window[e.windowKey],e=void 0);}function d(){return e!==void 0}return {setProps:r,setActions:o,enable:n,disable:h,isEnabled:d}}var Oe=typeof window<"u"&&typeof document<"u",pe=[" _______ _ _ _ ____ ____ ____ _____ ","|_ __ \\ (_) (_) | | |_ _| |_ _||_ \\|_ _|"," | |__) |__ _ __ __ \\_| \\ \\ / / | \\ | | "," | ___/[ | [ \\ [ ][ | \\ \\ / / | |\\ \\| | "," _| |_ | | > ' < | | \\ ' / _| |_\\ |_ ",`|_____| [___][__]\`\\_][___] \\_/ |_____|\\____| v${Wt.version}`],ue=31,Le="background:#2f90da;color:#fff;font-weight:bold;",Re="background:#c832bb;color:#fff;font-weight:bold;",Pe="background:transparent;font-weight:bold;",qt=` v${Wt.version}`;function fe(){if(!Oe)return;let l=[],e=[];for(let i=0;i<pe.length;i++){let s=pe[i],r=s.endsWith(qt),o=r?s.slice(0,-qt.length):s,n=o.slice(0,ue),h=o.slice(ue),d=r?"%c%s%c%s%c%s":"%c%s%c%s";l.push(d),e.push(Le,n,Re,h),r&&e.push(Pe,qt);}console.info(l.join(`
2
+ `),...e);}function Bt(){let l=window.location.pathname+window.location.hash;return l.includes("#")&&(l=l.split("#")[1]),l}fe();exports.Game=void 0;(A=>{async function l(p,T,at){if(core.GameUnifier.init({navigate:T?.navigate,getCurrentGameStepState:async()=>{let f=D__namespace.canvas.isInitialized?D__namespace.canvas.export():{};return {path:Bt(),storage:await W__namespace.storage.export(),canvas:f,sound:_t__namespace.sound.export(),labelIndex:O__namespace.NarrationManagerStatic.currentLabelStepIndex||0,openedLabels:O__namespace.narration.openedLabels}},restoreGameStepState:async(f,w)=>{ot__namespace.HistoryManagerStatic._originalStepData=f,O__namespace.NarrationManagerStatic.openedLabels=f.openedLabels,W__namespace.storage.restore(f.storage);try{D__namespace.canvas.isInitialized&&await D__namespace.canvas.restore(f.canvas),await _t__namespace.sound.restore(f.sound);}catch(C){gt.error("Error restoring game step state:",C);}await w(f.path);},getStepCounter:()=>O__namespace.narration.stepCounter,setStepCounter:f=>{O__namespace.NarrationManagerStatic._stepCounter=f;},getOpenedLabels:()=>O__namespace.narration.openedLabels.length,addHistoryItem:(f,w)=>ot__namespace.stepHistory.add(f,w),getCharacter:f=>Xt__namespace.RegisteredCharacters.get(f),processNavigationRequests:(f,w)=>{let C=f,J=Promise.resolve();return f>0?(C--,J=O__namespace.narration.continue(w)):f<0&&(C=0,J=ot__namespace.stepHistory.back(w,{steps:f*-1})),{newValue:C,result:J}},animate:(f,w,C,J)=>motion.motion.animate(f,w,C,J),animateFilter:(f,w,C,J,_e,ve,ye,be)=>motion.motion.animateFilter(f,w,C,J,_e,ve,ye,be),removeCanvasComponent:f=>{D__namespace.canvas.isInitialized&&D__namespace.canvas.remove(f);},canvasComponentExists:f=>D__namespace.canvas.isInitialized?D__namespace.canvas.find(f)!==void 0:false,getVariable:(f,w)=>W__namespace.StorageRegistry.getVariable(f,w),setVariable:(f,w,C)=>W__namespace.StorageRegistry.setVariable(f,w,C),removeVariable:(f,w)=>W__namespace.StorageRegistry.removeVariable(f,w),getFlag:f=>W__namespace.storage.flags.get(f),setFlag:(f,w)=>W__namespace.storage.flags.set(f,w),onLabelClosing:f=>W__namespace.StorageRegistry.clearOldTempVariables(f)}),!p||!T){gt.warn("The canvas element or options are not defined. The canvas will not be initialized.");return}return await D__namespace.canvas.init(p,T,at)}A.init=l;function e(){W__namespace.storage.clear(),D__namespace.canvas.isInitialized&&D__namespace.canvas.clear(),_t__namespace.sound.clear(),O__namespace.narration.clear(),ot__namespace.stepHistory.clear();}A.clear=e;async function i(){let p=D__namespace.canvas.isInitialized?D__namespace.canvas.export():{};return {pixivn_version:Rt,stepData:O__namespace.narration.export(),storageData:await W__namespace.storage.export(),canvasData:p,soundData:_t__namespace.sound.export(),historyData:await ot__namespace.stepHistory.export(),path:Bt()}}A.exportGameState=i;async function s(p){ot__namespace.stepHistory.restore(p.historyData);let T=ot__namespace.stepHistory.lastKey;if(typeof T=="number"){let at=ot__namespace.stepHistory.stepsInfoMap.get(T)||null;await O__namespace.narration.restore(p.stepData,at);}W__namespace.storage.restore(p.storageData);try{D__namespace.canvas.isInitialized&&await D__namespace.canvas.restore(p.canvasData),await _t__namespace.sound.restore(p.soundData);}catch{}await core.GameUnifier.navigate(p.path);}A.restoreGameState=s;async function r(p,T){return A.clear(),await O__namespace.narration.call(p,T)}A.start=r;function o(p){return JSON.parse(p)}A.jsonToGameState=o;function n(p){core.GameUnifier.onEnd=p;}A.onEnd=n;function h(p){return core.GameUnifier.addOnError(p)}A.addOnError=h;function d(p){return core.GameUnifier.removeOnError(p)}A.removeOnError=d;function y(p){O__namespace.NarrationManagerStatic.onStepStart=p;}A.onStepStart=y;function U(p){O__namespace.NarrationManagerStatic.onLoadingLabel=p;}A.onLoadingLabel=U;function S(p){O__namespace.NarrationManagerStatic.onStepEnd=p;}A.onStepEnd=S;function M(p){O__namespace.NarrationManagerStatic.onLabelStarting=p;}A.onLabelStarting=M;function N(p){O__namespace.NarrationManagerStatic.onLabelClosing=p;}A.onLabelClosing=N;function H(p){core.GameUnifier.navigate=p;}A.onNavigate=H;function m(p){return core.GameUnifier.addOnPreContinue(p)}A.addOnPreContinue=m;function v(p){return core.GameUnifier.removeOnPreContinue(p)}A.removeOnPreContinue=v,A.worker={register:p=>worker.GameWorkerManager.register(p),unregister:()=>worker.GameWorkerManager.unregister(),get isAvailable(){return worker.GameWorkerManager.isAvailable}},A.testing=de(A);})(exports.Game||={});var pi={characterUtils:Xt__namespace,canvasUtils:D__namespace,narrationUtils:O__namespace,soundUtils:_t__namespace,CANVAS_APP_GAME_LAYER_ALIAS:Kt,PIXIVN_VERSION:Rt,...Yt,...le,canvas:D__namespace.canvas,narration:O__namespace.narration,sound:_t__namespace.sound,storage:W__namespace.storage,tickers:tickers.tickers,history:ot__namespace.stepHistory,Game:exports.Game,GameUnifier:core.GameUnifier};exports.CANVAS_APP_GAME_LAYER_ALIAS=Kt;exports.CachedMap=Dt;exports.PIXIVN_VERSION=Rt;exports.SYSTEM_RESERVED_STORAGE_KEYS=Ue;exports.createExportableElement=he;exports.default=pi;Object.keys(D).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return D[k]}})});Object.keys(Xt).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return Xt[k]}})});Object.keys(core).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return core[k]}})});Object.keys(ot).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return ot[k]}})});Object.keys(O).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return O[k]}})});Object.keys(_t).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return _t[k]}})});Object.keys(W).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return W[k]}})});Object.keys(tickers).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return tickers[k]}})});Object.keys(worker).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return worker[k]}})});
package/dist/index.d.cts CHANGED
@@ -136,7 +136,7 @@ interface GameTestingActions<T extends {} = {}> {
136
136
  call?: (label: narrationUtils.LabelAbstract<any, T> | narrationUtils.LabelIdType, props?: T) => Promise<narrationUtils.StepLabelResultType>;
137
137
  }
138
138
 
139
- var version = "1.9.4";
139
+ var version = "1.9.5";
140
140
 
141
141
  /**
142
142
  * Is a special alias to indicate the game layer.
package/dist/index.d.ts CHANGED
@@ -136,7 +136,7 @@ interface GameTestingActions<T extends {} = {}> {
136
136
  call?: (label: narrationUtils.LabelAbstract<any, T> | narrationUtils.LabelIdType, props?: T) => Promise<narrationUtils.StepLabelResultType>;
137
137
  }
138
138
 
139
- var version = "1.9.4";
139
+ var version = "1.9.5";
140
140
 
141
141
  /**
142
142
  * Is a special alias to indicate the game layer.