@drincs/pixi-vn
Version:
Pixi'VN is a npm package that provides various features for creating visual novels.
1 lines • 26.3 kB
JavaScript
'use strict';var core=require('@drincs/pixi-vn/core');var se=Object.defineProperty;var Xt=c=>{throw TypeError(c)};var ae=(c,i,e)=>i in c?se(c,i,{enumerable:true,configurable:true,writable:true,value:e}):c[i]=e;var _=(c,i,e)=>ae(c,typeof i!="symbol"?i+"":i,e),Yt=(c,i,e)=>i.has(c)||Xt("Cannot "+e);var t=(c,i,e)=>(Yt(c,i,"read from private field"),e?e.call(c):i.get(c)),m=(c,i,e)=>i.has(c)?Xt("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(c):i.set(c,e),f=(c,i,e,r)=>(Yt(c,i,"write to private field"),i.set(c,e),e),h=(c,i,e)=>(Yt(c,i,"access private method"),e);var Mt=(c,i,e,r)=>({set _(a){f(c,i,a);},get _(){return t(c,i,r)}});var st="storage",ut="temp",Ft="flags",U={CHARACTER_CATEGORY_KEY:"character"};var oe=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Zt=new Set,Kt=typeof process=="object"&&process?process:{},te=(c,i,e,r)=>{typeof Kt.emitWarning=="function"?Kt.emitWarning(c,i,e,r):console.error(`[${e}] ${i}: ${c}`);},Pt=globalThis.AbortController,Jt=globalThis.AbortSignal;if(typeof Pt>"u"){Jt=class{constructor(){_(this,"onabort");_(this,"_onabort",[]);_(this,"reason");_(this,"aborted",false);}addEventListener(e,r){this._onabort.push(r);}},Pt=class{constructor(){_(this,"signal",new Jt);i();}abort(e){if(!this.signal.aborted){this.signal.reason=e,this.signal.aborted=true;for(let r of this.signal._onabort)r(e);this.signal.onabort?.(e);}}};let c=Kt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",i=()=>{c&&(c=false,te("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 ne=c=>!Zt.has(c);var at=c=>c&&c===Math.floor(c)&&c>0&&isFinite(c),ee=c=>at(c)?c<=Math.pow(2,8)?Uint8Array:c<=Math.pow(2,16)?Uint16Array:c<=Math.pow(2,32)?Uint32Array:c<=Number.MAX_SAFE_INTEGER?Gt:null:null,Gt=class extends Array{constructor(c){super(c),this.fill(0);}},it,St,le=(it=class{constructor(i,e){_(this,"heap");_(this,"length");if(!t(it,St))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(i),this.length=0;}static create(i){let e=ee(i);if(!e)return [];f(it,St,true);let r=new it(i,e);return f(it,St,false),r}push(i){this.heap[this.length++]=i;}pop(){return this.heap[--this.length]}},St=new WeakMap,m(it,St,false),it),qt,Qt,j,z,k,ft,B,Et,Tt,X,C,J,R,w,g,V,Y,M,D,q,N,Q,Z,K,W,tt,ht,L,bt,n,Wt,gt,rt,Ct,H,re,dt,yt,It,ot,nt,Ht,Vt,Lt,O,$t,Rt,lt,jt,At,ie=(At=class{constructor(i){m(this,n);m(this,j);m(this,z);m(this,k);m(this,ft);m(this,B);m(this,Et);m(this,Tt);m(this,X);_(this,"ttl");_(this,"ttlResolution");_(this,"ttlAutopurge");_(this,"updateAgeOnGet");_(this,"updateAgeOnHas");_(this,"allowStale");_(this,"noDisposeOnSet");_(this,"noUpdateTTL");_(this,"maxEntrySize");_(this,"sizeCalculation");_(this,"noDeleteOnFetchRejection");_(this,"noDeleteOnStaleGet");_(this,"allowStaleOnFetchAbort");_(this,"allowStaleOnFetchRejection");_(this,"ignoreFetchAbort");m(this,C);m(this,J);m(this,R);m(this,w);m(this,g);m(this,V);m(this,Y);m(this,M);m(this,D);m(this,q);m(this,N);m(this,Q);m(this,Z);m(this,K);m(this,W);m(this,tt);m(this,ht);m(this,L);m(this,bt);m(this,gt,()=>{});m(this,rt,()=>{});m(this,Ct,()=>{});m(this,H,()=>false);m(this,dt,i=>{});m(this,yt,(i,e,r)=>{});m(this,It,(i,e,r,a)=>{if(r||a)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});_(this,qt,"LRUCache");let{max:e=0,ttl:r,ttlResolution:a=1,ttlAutopurge:o,updateAgeOnGet:s,updateAgeOnHas:l,allowStale:u,dispose:E,onInsert:I,disposeAfter:d,noDisposeOnSet:y,noUpdateTTL:b,maxSize:T=0,maxEntrySize:A=0,sizeCalculation:v,fetchMethod:p,memoMethod:F,noDeleteOnFetchRejection:P,noDeleteOnStaleGet:G,allowStaleOnFetchRejection:x,allowStaleOnFetchAbort:xt,ignoreFetchAbort:pt,perf:_t}=i;if(_t!==void 0&&typeof _t?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(f(this,X,_t??oe),e!==0&&!at(e))throw new TypeError("max option must be a nonnegative integer");let mt=e?ee(e):Array;if(!mt)throw new Error("invalid max value: "+e);if(f(this,j,e),f(this,z,T),this.maxEntrySize=A||t(this,z),this.sizeCalculation=v,this.sizeCalculation){if(!t(this,z)&&!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(F!==void 0&&typeof F!="function")throw new TypeError("memoMethod must be a function if defined");if(f(this,Tt,F),p!==void 0&&typeof p!="function")throw new TypeError("fetchMethod must be a function if specified");if(f(this,Et,p),f(this,ht,!!p),f(this,R,new Map),f(this,w,new Array(e).fill(void 0)),f(this,g,new Array(e).fill(void 0)),f(this,V,new mt(e)),f(this,Y,new mt(e)),f(this,M,0),f(this,D,0),f(this,q,le.create(e)),f(this,C,0),f(this,J,0),typeof E=="function"&&f(this,k,E),typeof I=="function"&&f(this,ft,I),typeof d=="function"?(f(this,B,d),f(this,N,[])):(f(this,B,void 0),f(this,N,void 0)),f(this,tt,!!t(this,k)),f(this,bt,!!t(this,ft)),f(this,L,!!t(this,B)),this.noDisposeOnSet=!!y,this.noUpdateTTL=!!b,this.noDeleteOnFetchRejection=!!P,this.allowStaleOnFetchRejection=!!x,this.allowStaleOnFetchAbort=!!xt,this.ignoreFetchAbort=!!pt,this.maxEntrySize!==0){if(t(this,z)!==0&&!at(t(this,z)))throw new TypeError("maxSize must be a positive integer if specified");if(!at(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");h(this,n,re).call(this);}if(this.allowStale=!!u,this.noDeleteOnStaleGet=!!G,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!l,this.ttlResolution=at(a)||a===0?a:1,this.ttlAutopurge=!!o,this.ttl=r||0,this.ttl){if(!at(this.ttl))throw new TypeError("ttl must be a positive integer if specified");h(this,n,Wt).call(this);}if(t(this,j)===0&&this.ttl===0&&t(this,z)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,j)&&!t(this,z)){let zt="LRU_CACHE_UNBOUNDED";ne(zt)&&(Zt.add(zt),te("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",zt,At));}}get perf(){return t(this,X)}static unsafeExposeInternals(i){return {starts:t(i,Z),ttls:t(i,K),autopurgeTimers:t(i,W),sizes:t(i,Q),keyMap:t(i,R),keyList:t(i,w),valList:t(i,g),next:t(i,V),prev:t(i,Y),get head(){return t(i,M)},get tail(){return t(i,D)},free:t(i,q),isBackgroundFetch:e=>{var r;return h(r=i,n,O).call(r,e)},backgroundFetch:(e,r,a,o)=>{var s;return h(s=i,n,Lt).call(s,e,r,a,o)},moveToTail:e=>{var r;return h(r=i,n,Rt).call(r,e)},indexes:e=>{var r;return h(r=i,n,ot).call(r,e)},rindexes:e=>{var r;return h(r=i,n,nt).call(r,e)},isStale:e=>{var r;return t(r=i,H).call(r,e)}}}get max(){return t(this,j)}get maxSize(){return t(this,z)}get calculatedSize(){return t(this,J)}get size(){return t(this,C)}get fetchMethod(){return t(this,Et)}get memoMethod(){return t(this,Tt)}get dispose(){return t(this,k)}get onInsert(){return t(this,ft)}get disposeAfter(){return t(this,B)}getRemainingTTL(i){return t(this,R).has(i)?1/0:0}*entries(){for(let i of h(this,n,ot).call(this))t(this,g)[i]!==void 0&&t(this,w)[i]!==void 0&&!h(this,n,O).call(this,t(this,g)[i])&&(yield [t(this,w)[i],t(this,g)[i]]);}*rentries(){for(let i of h(this,n,nt).call(this))t(this,g)[i]!==void 0&&t(this,w)[i]!==void 0&&!h(this,n,O).call(this,t(this,g)[i])&&(yield [t(this,w)[i],t(this,g)[i]]);}*keys(){for(let i of h(this,n,ot).call(this)){let e=t(this,w)[i];e!==void 0&&!h(this,n,O).call(this,t(this,g)[i])&&(yield e);}}*rkeys(){for(let i of h(this,n,nt).call(this)){let e=t(this,w)[i];e!==void 0&&!h(this,n,O).call(this,t(this,g)[i])&&(yield e);}}*values(){for(let i of h(this,n,ot).call(this))t(this,g)[i]!==void 0&&!h(this,n,O).call(this,t(this,g)[i])&&(yield t(this,g)[i]);}*rvalues(){for(let i of h(this,n,nt).call(this))t(this,g)[i]!==void 0&&!h(this,n,O).call(this,t(this,g)[i])&&(yield t(this,g)[i]);}[(Qt=Symbol.iterator,qt=Symbol.toStringTag,Qt)](){return this.entries()}find(i,e={}){for(let r of h(this,n,ot).call(this)){let a=t(this,g)[r],o=h(this,n,O).call(this,a)?a.__staleWhileFetching:a;if(o!==void 0&&i(o,t(this,w)[r],this))return this.get(t(this,w)[r],e)}}forEach(i,e=this){for(let r of h(this,n,ot).call(this)){let a=t(this,g)[r],o=h(this,n,O).call(this,a)?a.__staleWhileFetching:a;o!==void 0&&i.call(e,o,t(this,w)[r],this);}}rforEach(i,e=this){for(let r of h(this,n,nt).call(this)){let a=t(this,g)[r],o=h(this,n,O).call(this,a)?a.__staleWhileFetching:a;o!==void 0&&i.call(e,o,t(this,w)[r],this);}}purgeStale(){let i=false;for(let e of h(this,n,nt).call(this,{allowStale:true}))t(this,H).call(this,e)&&(h(this,n,lt).call(this,t(this,w)[e],"expire"),i=true);return i}info(i){let e=t(this,R).get(i);if(e===void 0)return;let r=t(this,g)[e],a=h(this,n,O).call(this,r)?r.__staleWhileFetching:r;if(a===void 0)return;let o={value:a};if(t(this,K)&&t(this,Z)){let s=t(this,K)[e],l=t(this,Z)[e];if(s&&l){let u=s-(t(this,X).now()-l);o.ttl=u,o.start=Date.now();}}return t(this,Q)&&(o.size=t(this,Q)[e]),o}dump(){let i=[];for(let e of h(this,n,ot).call(this,{allowStale:true})){let r=t(this,w)[e],a=t(this,g)[e],o=h(this,n,O).call(this,a)?a.__staleWhileFetching:a;if(o===void 0||r===void 0)continue;let s={value:o};if(t(this,K)&&t(this,Z)){s.ttl=t(this,K)[e];let l=t(this,X).now()-t(this,Z)[e];s.start=Math.floor(Date.now()-l);}t(this,Q)&&(s.size=t(this,Q)[e]),i.unshift([r,s]);}return i}load(i){this.clear();for(let[e,r]of i){if(r.start){let a=Date.now()-r.start;r.start=t(this,X).now()-a;}this.set(e,r.value,r);}}set(i,e,r={}){var y,b,T,A;if(e===void 0)return this.delete(i),this;let{ttl:a=this.ttl,start:o,noDisposeOnSet:s=this.noDisposeOnSet,sizeCalculation:l=this.sizeCalculation,status:u}=r,{noUpdateTTL:E=this.noUpdateTTL}=r,I=t(this,It).call(this,i,e,r.size||0,l);if(this.maxEntrySize&&I>this.maxEntrySize)return u&&(u.set="miss",u.maxEntrySizeExceeded=true),h(this,n,lt).call(this,i,"set"),this;let d=t(this,C)===0?void 0:t(this,R).get(i);if(d===void 0)d=t(this,C)===0?t(this,D):t(this,q).length!==0?t(this,q).pop():t(this,C)===t(this,j)?h(this,n,Vt).call(this,false):t(this,C),t(this,w)[d]=i,t(this,g)[d]=e,t(this,R).set(i,d),t(this,V)[t(this,D)]=d,t(this,Y)[d]=t(this,D),f(this,D,d),Mt(this,C)._++,t(this,yt).call(this,d,I,u),u&&(u.set="add"),E=false,t(this,bt)&&((y=t(this,ft))==null||y.call(this,e,i,"add"));else {h(this,n,Rt).call(this,d);let v=t(this,g)[d];if(e!==v){if(t(this,ht)&&h(this,n,O).call(this,v)){v.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=v;p!==void 0&&!s&&(t(this,tt)&&((b=t(this,k))==null||b.call(this,p,i,"set")),t(this,L)&&t(this,N)?.push([p,i,"set"]));}else s||(t(this,tt)&&((T=t(this,k))==null||T.call(this,v,i,"set")),t(this,L)&&t(this,N)?.push([v,i,"set"]));if(t(this,dt).call(this,d),t(this,yt).call(this,d,I,u),t(this,g)[d]=e,u){u.set="replace";let p=v&&h(this,n,O).call(this,v)?v.__staleWhileFetching:v;p!==void 0&&(u.oldValue=p);}}else u&&(u.set="update");t(this,bt)&&this.onInsert?.(e,i,e===v?"update":"replace");}if(a!==0&&!t(this,K)&&h(this,n,Wt).call(this),t(this,K)&&(E||t(this,Ct).call(this,d,a,o),u&&t(this,rt).call(this,u,d)),!s&&t(this,L)&&t(this,N)){let v=t(this,N),p;for(;p=v?.shift();)(A=t(this,B))==null||A.call(this,...p);}return this}pop(){var i;try{for(;t(this,C);){let e=t(this,g)[t(this,M)];if(h(this,n,Vt).call(this,!0),h(this,n,O).call(this,e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(t(this,L)&&t(this,N)){let e=t(this,N),r;for(;r=e?.shift();)(i=t(this,B))==null||i.call(this,...r);}}}has(i,e={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:a}=e,o=t(this,R).get(i);if(o!==void 0){let s=t(this,g)[o];if(h(this,n,O).call(this,s)&&s.__staleWhileFetching===void 0)return false;if(t(this,H).call(this,o))a&&(a.has="stale",t(this,rt).call(this,a,o));else return r&&t(this,gt).call(this,o),a&&(a.has="hit",t(this,rt).call(this,a,o)),true}else a&&(a.has="miss");return false}peek(i,e={}){let{allowStale:r=this.allowStale}=e,a=t(this,R).get(i);if(a===void 0||!r&&t(this,H).call(this,a))return;let o=t(this,g)[a];return h(this,n,O).call(this,o)?o.__staleWhileFetching:o}async fetch(i,e={}){let{allowStale:r=this.allowStale,updateAgeOnGet:a=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:s=this.ttl,noDisposeOnSet:l=this.noDisposeOnSet,size:u=0,sizeCalculation:E=this.sizeCalculation,noUpdateTTL:I=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:y=this.allowStaleOnFetchRejection,ignoreFetchAbort:b=this.ignoreFetchAbort,allowStaleOnFetchAbort:T=this.allowStaleOnFetchAbort,context:A,forceRefresh:v=false,status:p,signal:F}=e;if(!t(this,ht))return p&&(p.fetch="get"),this.get(i,{allowStale:r,updateAgeOnGet:a,noDeleteOnStaleGet:o,status:p});let P={allowStale:r,updateAgeOnGet:a,noDeleteOnStaleGet:o,ttl:s,noDisposeOnSet:l,size:u,sizeCalculation:E,noUpdateTTL:I,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:y,allowStaleOnFetchAbort:T,ignoreFetchAbort:b,status:p,signal:F},G=t(this,R).get(i);if(G===void 0){p&&(p.fetch="miss");let x=h(this,n,Lt).call(this,i,G,P,A);return x.__returned=x}else {let x=t(this,g)[G];if(h(this,n,O).call(this,x)){let mt=r&&x.__staleWhileFetching!==void 0;return p&&(p.fetch="inflight",mt&&(p.returnedStale=true)),mt?x.__staleWhileFetching:x.__returned=x}let xt=t(this,H).call(this,G);if(!v&&!xt)return p&&(p.fetch="hit"),h(this,n,Rt).call(this,G),a&&t(this,gt).call(this,G),p&&t(this,rt).call(this,p,G),x;let pt=h(this,n,Lt).call(this,i,G,P,A),_t=pt.__staleWhileFetching!==void 0&&r;return p&&(p.fetch=xt?"stale":"refresh",_t&&xt&&(p.returnedStale=true)),_t?pt.__staleWhileFetching:pt.__returned=pt}}async forceFetch(i,e={}){let r=await this.fetch(i,e);if(r===void 0)throw new Error("fetch() returned undefined");return r}memo(i,e={}){let r=t(this,Tt);if(!r)throw new Error("no memoMethod provided to constructor");let{context:a,forceRefresh:o,...s}=e,l=this.get(i,s);if(!o&&l!==void 0)return l;let u=r(i,l,{options:s,context:a});return this.set(i,u,s),u}get(i,e={}){let{allowStale:r=this.allowStale,updateAgeOnGet:a=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:s}=e,l=t(this,R).get(i);if(l!==void 0){let u=t(this,g)[l],E=h(this,n,O).call(this,u);return s&&t(this,rt).call(this,s,l),t(this,H).call(this,l)?(s&&(s.get="stale"),E?(s&&r&&u.__staleWhileFetching!==void 0&&(s.returnedStale=true),r?u.__staleWhileFetching:void 0):(o||h(this,n,lt).call(this,i,"expire"),s&&r&&(s.returnedStale=true),r?u:void 0)):(s&&(s.get="hit"),E?u.__staleWhileFetching:(h(this,n,Rt).call(this,l),a&&t(this,gt).call(this,l),u))}else s&&(s.get="miss");}delete(i){return h(this,n,lt).call(this,i,"delete")}clear(){return h(this,n,jt).call(this,"delete")}},j=new WeakMap,z=new WeakMap,k=new WeakMap,ft=new WeakMap,B=new WeakMap,Et=new WeakMap,Tt=new WeakMap,X=new WeakMap,C=new WeakMap,J=new WeakMap,R=new WeakMap,w=new WeakMap,g=new WeakMap,V=new WeakMap,Y=new WeakMap,M=new WeakMap,D=new WeakMap,q=new WeakMap,N=new WeakMap,Q=new WeakMap,Z=new WeakMap,K=new WeakMap,W=new WeakMap,tt=new WeakMap,ht=new WeakMap,L=new WeakMap,bt=new WeakMap,n=new WeakSet,Wt=function(){let i=new Gt(t(this,j)),e=new Gt(t(this,j));f(this,K,i),f(this,Z,e);let r=this.ttlAutopurge?new Array(t(this,j)):void 0;f(this,W,r),f(this,Ct,(l,u,E=t(this,X).now())=>{e[l]=u!==0?E:0,i[l]=u,a(l,u);}),f(this,gt,l=>{e[l]=i[l]!==0?t(this,X).now():0,a(l,i[l]);});let a=this.ttlAutopurge?(l,u)=>{if(r?.[l]&&(clearTimeout(r[l]),r[l]=void 0),u&&u!==0&&r){let E=setTimeout(()=>{t(this,H).call(this,l)&&h(this,n,lt).call(this,t(this,w)[l],"expire");},u+1);E.unref&&E.unref(),r[l]=E;}}:()=>{};f(this,rt,(l,u)=>{if(i[u]){let E=i[u],I=e[u];if(!E||!I)return;l.ttl=E,l.start=I,l.now=o||s();let d=l.now-I;l.remainingTTL=E-d;}});let o=0,s=()=>{let l=t(this,X).now();if(this.ttlResolution>0){o=l;let u=setTimeout(()=>o=0,this.ttlResolution);u.unref&&u.unref();}return l};this.getRemainingTTL=l=>{let u=t(this,R).get(l);if(u===void 0)return 0;let E=i[u],I=e[u];if(!E||!I)return 1/0;let d=(o||s())-I;return E-d},f(this,H,l=>{let u=e[l],E=i[l];return !!E&&!!u&&(o||s())-u>E});},gt=new WeakMap,rt=new WeakMap,Ct=new WeakMap,H=new WeakMap,re=function(){let i=new Gt(t(this,j));f(this,J,0),f(this,Q,i),f(this,dt,e=>{f(this,J,t(this,J)-i[e]),i[e]=0;}),f(this,It,(e,r,a,o)=>{if(h(this,n,O).call(this,r))return 0;if(!at(a))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(a=o(r,e),!at(a))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 a}),f(this,yt,(e,r,a)=>{if(i[e]=r,t(this,z)){let o=t(this,z)-i[e];for(;t(this,J)>o;)h(this,n,Vt).call(this,true);}f(this,J,t(this,J)+i[e]),a&&(a.entrySize=r,a.totalCalculatedSize=t(this,J));});},dt=new WeakMap,yt=new WeakMap,It=new WeakMap,ot=function*({allowStale:i=this.allowStale}={}){if(t(this,C))for(let e=t(this,D);!(!h(this,n,Ht).call(this,e)||((i||!t(this,H).call(this,e))&&(yield e),e===t(this,M)));)e=t(this,Y)[e];},nt=function*({allowStale:i=this.allowStale}={}){if(t(this,C))for(let e=t(this,M);!(!h(this,n,Ht).call(this,e)||((i||!t(this,H).call(this,e))&&(yield e),e===t(this,D)));)e=t(this,V)[e];},Ht=function(i){return i!==void 0&&t(this,R).get(t(this,w)[i])===i},Vt=function(i){var o;let e=t(this,M),r=t(this,w)[e],a=t(this,g)[e];return t(this,ht)&&h(this,n,O).call(this,a)?a.__abortController.abort(new Error("evicted")):(t(this,tt)||t(this,L))&&(t(this,tt)&&((o=t(this,k))==null||o.call(this,a,r,"evict")),t(this,L)&&t(this,N)?.push([a,r,"evict"])),t(this,dt).call(this,e),t(this,W)?.[e]&&(clearTimeout(t(this,W)[e]),t(this,W)[e]=void 0),i&&(t(this,w)[e]=void 0,t(this,g)[e]=void 0,t(this,q).push(e)),t(this,C)===1?(f(this,M,f(this,D,0)),t(this,q).length=0):f(this,M,t(this,V)[e]),t(this,R).delete(r),Mt(this,C)._--,e},Lt=function(i,e,r,a){let o=e===void 0?void 0:t(this,g)[e];if(h(this,n,O).call(this,o))return o;let s=new Pt,{signal:l}=r;l?.addEventListener("abort",()=>s.abort(l.reason),{signal:s.signal});let u={signal:s.signal,options:r,context:a},E=(A,v=false)=>{let{aborted:p}=s.signal,F=r.ignoreFetchAbort&&A!==void 0,P=r.ignoreFetchAbort||!!(r.allowStaleOnFetchAbort&&A!==void 0);if(r.status&&(p&&!v?(r.status.fetchAborted=true,r.status.fetchError=s.signal.reason,F&&(r.status.fetchAbortIgnored=true)):r.status.fetchResolved=true),p&&!F&&!v)return d(s.signal.reason,P);let G=b,x=t(this,g)[e];return (x===b||F&&v&&x===void 0)&&(A===void 0?G.__staleWhileFetching!==void 0?t(this,g)[e]=G.__staleWhileFetching:h(this,n,lt).call(this,i,"fetch"):(r.status&&(r.status.fetchUpdated=true),this.set(i,A,u.options))),A},I=A=>(r.status&&(r.status.fetchRejected=true,r.status.fetchError=A),d(A,false)),d=(A,v)=>{let{aborted:p}=s.signal,F=p&&r.allowStaleOnFetchAbort,P=F||r.allowStaleOnFetchRejection,G=P||r.noDeleteOnFetchRejection,x=b;if(t(this,g)[e]===b&&(!G||!v&&x.__staleWhileFetching===void 0?h(this,n,lt).call(this,i,"fetch"):F||(t(this,g)[e]=x.__staleWhileFetching)),P)return r.status&&x.__staleWhileFetching!==void 0&&(r.status.returnedStale=true),x.__staleWhileFetching;if(x.__returned===x)throw A},y=(A,v)=>{var F;let p=(F=t(this,Et))==null?void 0:F.call(this,i,o,u);p&&p instanceof Promise&&p.then(P=>A(P===void 0?void 0:P),v),s.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(A(void 0),r.allowStaleOnFetchAbort&&(A=P=>E(P,true)));});};r.status&&(r.status.fetchDispatched=true);let b=new Promise(y).then(E,I),T=Object.assign(b,{__abortController:s,__staleWhileFetching:o,__returned:void 0});return e===void 0?(this.set(i,T,{...u.options,status:void 0}),e=t(this,R).get(i)):t(this,g)[e]=T,T},O=function(i){if(!t(this,ht))return false;let e=i;return !!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof Pt},$t=function(i,e){t(this,Y)[e]=i,t(this,V)[i]=e;},Rt=function(i){i!==t(this,D)&&(i===t(this,M)?f(this,M,t(this,V)[i]):h(this,n,$t).call(this,t(this,Y)[i],t(this,V)[i]),h(this,n,$t).call(this,t(this,D),i),f(this,D,i));},lt=function(i,e){var a,o;let r=false;if(t(this,C)!==0){let s=t(this,R).get(i);if(s!==void 0)if(t(this,W)?.[s]&&(clearTimeout(t(this,W)?.[s]),t(this,W)[s]=void 0),r=true,t(this,C)===1)h(this,n,jt).call(this,e);else {t(this,dt).call(this,s);let l=t(this,g)[s];if(h(this,n,O).call(this,l)?l.__abortController.abort(new Error("deleted")):(t(this,tt)||t(this,L))&&(t(this,tt)&&((a=t(this,k))==null||a.call(this,l,i,e)),t(this,L)&&t(this,N)?.push([l,i,e])),t(this,R).delete(i),t(this,w)[s]=void 0,t(this,g)[s]=void 0,s===t(this,D))f(this,D,t(this,Y)[s]);else if(s===t(this,M))f(this,M,t(this,V)[s]);else {let u=t(this,Y)[s];t(this,V)[u]=t(this,V)[s];let E=t(this,V)[s];t(this,Y)[E]=t(this,Y)[s];}Mt(this,C)._--,t(this,q).push(s);}}if(t(this,L)&&t(this,N)?.length){let s=t(this,N),l;for(;l=s?.shift();)(o=t(this,B))==null||o.call(this,...l);}return r},jt=function(i){var e,r;for(let a of h(this,n,nt).call(this,{allowStale:true})){let o=t(this,g)[a];if(h(this,n,O).call(this,o))o.__abortController.abort(new Error("deleted"));else {let s=t(this,w)[a];t(this,tt)&&((e=t(this,k))==null||e.call(this,o,s,i)),t(this,L)&&t(this,N)?.push([o,s,i]);}}if(t(this,R).clear(),t(this,g).fill(void 0),t(this,w).fill(void 0),t(this,K)&&t(this,Z)){t(this,K).fill(0),t(this,Z).fill(0);for(let a of t(this,W)??[])a!==void 0&&clearTimeout(a);t(this,W)?.fill(void 0);}if(t(this,Q)&&t(this,Q).fill(0),f(this,M,0),f(this,D,0),t(this,q).length=0,f(this,J,0),f(this,C,0),t(this,L)&&t(this,N)){let a=t(this,N),o;for(;o=a?.shift();)(r=t(this,B))==null||r.call(this,...o);}},At);var ct=class{constructor(i){_(this,"cache");_(this,"map",new Map);this.cache=new ie({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 e=this.map.delete(i);return e&&this.cache.delete(i),e}get forEach(){return this.map.forEach}get(i){let e=this.cache.get(i);return e||this.map.get(i)}has(i){return this.map.has(i)}set(i,e){return this.map.set(i,e),this.cache.set(i,e),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var et;(a=>(a.log=(o,...s)=>console.log(`[Pixi\u2019VN] ${o}`,...s),a.warn=(o,...s)=>console.warn(`[Pixi\u2019VN] ${o}`,...s),a.error=(o,...s)=>console.error(`[Pixi\u2019VN] ${o}`,...s),a.info=(o,...s)=>console.info(`[Pixi\u2019VN] ${o}`,...s)))(et||(et={}));function Dt(c){try{if(typeof c>"u")return c;let i=JSON.stringify(c);return JSON.parse(i)}catch(i){throw et.error("Error creating exportable element",c,i),new core.PixiError("not_json_serializable","Error creating exportable element")}}var kt;(d=>{d.storage=new ct({cacheSize:50}),d.defaultStorage=new ct({cacheSize:10}),d.tempStorageDeadlines=new Map;let r;function a(y){d.tempStorageDeadlines.forEach((b,T)=>{b>y&&(d.storage.delete(`${ut}:${T}`),r?.onClearOldTempVariable?.(T),d.tempStorageDeadlines.delete(T));});}d.clearOldTempVariables=a;function o(y){r=y;}d.setExternalStoreHandler=o;function s(y,b,T){T==null?d.storage.delete(`${y}:${b}`):d.storage.set(`${y}:${b}`,T),r?.onSetVariable?.(b,T);}d.setVariable=s;function l(y,b){let T=d.storage.get(`${y}:${b}`);return Dt(T)}d.getVariable=l;function u(y,b){d.storage.delete(`${y}:${b}`),r?.onRemoveVariable?.(b);}d.removeVariable=u;function E(y,b){let T=d.storage.get(Ft)||[];if(b)T.includes(y)||T.push(y);else {let A=T.indexOf(y);A>-1&&T.splice(A,1);}d.storage.set(Ft,T);}d.setFlag=E;function I(y){return (d.storage.get(Ft)||[]).includes(y)}d.getFlag=I;})(kt||(kt={}));var S=kt;var vt=class{constructor(i,e){_(this,"id");_(this,"categoryId");this.categoryId=i,this.id=e,this.migrateOldStorage();}migrateOldStorage(i=this.categoryId){let e=S.getVariable(st,i);e&&(Object.entries(e).forEach(([r,a])=>{typeof a=="object"&&a!==null&&Object.entries(a).forEach(([o,s])=>{S.setVariable(this.categoryId,`${r}:${o}`,s);});}),S.removeVariable(st,i));}setStorageProperty(i,e){S.setVariable(this.categoryId,`${this.id}:${i}`,e);}getStorageProperty(i,e=this.id){return S.getVariable(this.categoryId,`${e}:${i}`)}};var ue="@",Ot=class extends vt{constructor(e,r=""){super(U.CHARACTER_CATEGORY_KEY,e+(r?ue+r:""));_(this,"sourceId");this.sourceId=e,this.migrateOldStorage("___character___");}getStorageProperty(e){let r=super.getStorageProperty(e);return r===void 0&&(r=super.getStorageProperty(e,this.sourceId)),r}};var Ut=class extends Ot{constructor(e,r){super(typeof e=="string"?e:e.id,typeof e=="string"?"":e.emotion);_(this,"defaultName");_(this,"defaultSurname");_(this,"defaultAge");_(this,"_icon");_(this,"_color");this.defaultName=r.name,this.defaultSurname=r.surname,this.defaultAge=r.age,this._icon=r.icon,this._color=r.color;}get name(){return this.getStorageProperty("name")||this.defaultName||this.id}set name(e){this.setStorageProperty("name",e);}get surname(){return this.getStorageProperty("surname")||this.defaultSurname}set surname(e){this.setStorageProperty("surname",e);}get age(){return this.getStorageProperty("age")||this.defaultAge}set age(e){this.setStorageProperty("age",e);}get icon(){return this._icon}get color(){return this._color}};var wt=new ct({cacheSize:10}),Bt;(o=>{function c(s){try{let l=wt.get(s);if(!l){et.warn(`Character "${s}" not found, did you forget to register it with the RegisteredCharacters.add?`);return}return l}catch(l){et.error(`Error while getting Character "${s}"`,l);return}}o.get=c;function i(s){if(Array.isArray(s)){s.forEach(l=>{i(l);});return}wt.get(s.id)&&et.info(`Character id "${s.id}" already exists, it will be overwritten`),wt.set(s.id,s);}o.add=i;function e(){return Array.from(wt.values())}o.values=e;function r(s){return wt.has(s)}o.has=r;function a(){return Array.from(wt.keys())}o.keys=a;})(Bt||(Bt={}));var fe=Bt;exports.CharacterBaseModel=Ut;exports.CharacterStoredClass=Ot;exports.RegisteredCharacters=fe;