@drincs/pixi-vn 1.8.4 → 1.8.7
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/ContainerMemory-BjcfYRU7.d.cts +392 -0
- package/dist/ContainerMemory-BjcfYRU7.d.ts +392 -0
- package/dist/HistoryChoiceMenuOption-CEmjDDJH.d.cts +53 -0
- package/dist/HistoryChoiceMenuOption-CN7NkcxU.d.ts +53 -0
- package/dist/HistoryGameState-3ztYdv84.d.cts +12 -0
- package/dist/HistoryGameState-D4t2fY9x.d.ts +12 -0
- package/dist/HistoryStep-DtOryKAZ.d.cts +76 -0
- package/dist/HistoryStep-DtOryKAZ.d.ts +76 -0
- package/dist/OpenedLabel-DJby8qPc.d.ts +8 -0
- package/dist/OpenedLabel-t6PvSzaL.d.cts +8 -0
- package/dist/SoundManagerInterface-TgOPqm2L.d.cts +436 -0
- package/dist/SoundManagerInterface-TgOPqm2L.d.ts +436 -0
- package/dist/StepLabelType-CN97wZzm.d.cts +27 -0
- package/dist/StepLabelType-CN97wZzm.d.ts +27 -0
- package/dist/StorageGameState-BJy57o6K.d.ts +27 -0
- package/dist/StorageGameState-CtjNJpvE.d.cts +27 -0
- package/dist/{StoredClassModel-C9mQxPg-.d.cts → StoredClassModel-Bykjdn8S.d.cts} +1 -1
- package/dist/{StoredClassModel-upXPNQTp.d.ts → StoredClassModel-uMifeNzV.d.ts} +1 -1
- package/dist/canvas.cjs +2 -2
- package/dist/canvas.d.cts +54 -464
- package/dist/canvas.d.ts +54 -464
- package/dist/canvas.mjs +2 -2
- package/dist/characters.cjs +1 -1
- package/dist/characters.d.cts +5 -5
- package/dist/characters.d.ts +5 -5
- package/dist/characters.mjs +1 -1
- package/dist/{chunk-Z4GZCINS.mjs → chunk-3M6A7TU2.mjs} +1 -1
- package/dist/chunk-BQRPDCUT.mjs +1 -0
- package/dist/{chunk-YCWXA3OR.mjs → chunk-IFPF4NRX.mjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.cts +5 -114
- package/dist/core.d.ts +5 -114
- package/dist/core.mjs +1 -1
- package/dist/history.cjs +1 -1
- package/dist/history.d.cts +7 -11
- package/dist/history.d.ts +7 -11
- package/dist/history.mjs +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +20 -826
- package/dist/index.d.ts +20 -826
- package/dist/index.mjs +2 -2
- package/dist/motion.cjs +1 -1
- package/dist/motion.mjs +1 -1
- package/dist/narration.cjs +1 -1
- package/dist/narration.d.cts +57 -22
- package/dist/narration.d.ts +57 -22
- package/dist/narration.mjs +1 -1
- package/dist/pixi/index.d.cts +12 -0
- package/dist/sound.cjs +1 -1
- package/dist/sound.d.cts +4 -435
- package/dist/sound.d.ts +4 -435
- package/dist/sound.mjs +1 -1
- package/dist/storage.cjs +1 -1
- package/dist/storage.d.cts +4 -27
- package/dist/storage.d.ts +4 -27
- package/dist/storage.mjs +1 -1
- package/dist/vite-listener.d.cts +1 -1
- package/dist/vite-listener.d.ts +1 -1
- package/dist/vite.d.cts +1 -1
- package/dist/vite.d.ts +1 -1
- package/package.json +1 -1
- package/dist/HistoryChoiceMenuOption-CS41KG13.d.ts +0 -182
- package/dist/HistoryChoiceMenuOption-DdwePsOm.d.cts +0 -182
- package/dist/chunk-V34PMA2H.mjs +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {d,f as f$1,b as b$1,e,g,h,i}from'./chunk-K7JIC2F2.mjs';import*as nt from'@drincs/pixi-vn/canvas';export*from'@drincs/pixi-vn/canvas';import*as Bt from'@drincs/pixi-vn/characters';export*from'@drincs/pixi-vn/characters';import {PixiError,GameUnifier}from'@drincs/pixi-vn/core';export*from'@drincs/pixi-vn/core';import*as et from'@drincs/pixi-vn/history';export*from'@drincs/pixi-vn/history';import*as C from'@drincs/pixi-vn/narration';export*from'@drincs/pixi-vn/narration';import*as ut from'@drincs/pixi-vn/sound';export*from'@drincs/pixi-vn/sound';import*as G from'@drincs/pixi-vn/storage';export*from'@drincs/pixi-vn/storage';import {motion}from'@drincs/pixi-vn/motion';var de=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Zt=new Set,jt=typeof process=="object"&&process?process:{},te=(m,e,i,s)=>{typeof jt.emitWarning=="function"?jt.emitWarning(m,e,i,s):console.error(`[${i}] ${e}: ${m}`);},Nt=globalThis.AbortController,Xt=globalThis.AbortSignal;if(typeof Nt>"u"){Xt=class{constructor(){d(this,"onabort");d(this,"_onabort",[]);d(this,"reason");d(this,"aborted",false);}addEventListener(i,s){this._onabort.push(s);}},Nt=class{constructor(){d(this,"signal",new Xt);e();}abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let m=jt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{m&&(m=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",e));};}var pe=m=>!Zt.has(m);var at=m=>m&&m===Math.floor(m)&&m>0&&isFinite(m),ee=m=>at(m)?m<=Math.pow(2,8)?Uint8Array:m<=Math.pow(2,16)?Uint16Array:m<=Math.pow(2,32)?Uint32Array:m<=Number.MAX_SAFE_INTEGER?Dt:null:null,Dt=class extends Array{constructor(m){super(m),this.fill(0);}},it,St,ue=(it=class{constructor(e$1,i){d(this,"heap");d(this,"length");if(!e(it,St))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e$1),this.length=0;}static create(e){let i=ee(e);if(!i)return [];g(it,St,true);let s=new it(e,i);return g(it,St,false),s}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},St=new WeakMap,f$1(it,St,false),it),Jt,Qt,K,M,q,ft,$,yt,Et,B,U,X,T,w,f,P,z,N,D,J,L,Q,Z,V,W,tt,dt,j,xt,l,Gt,mt,ot,Ot,Y,se,gt,bt,Tt,lt,ht,It,Lt,Ct,b,Mt,At,ct,zt,wt,ie=(wt=class{constructor(e$1){f$1(this,l);f$1(this,K);f$1(this,M);f$1(this,q);f$1(this,ft);f$1(this,$);f$1(this,yt);f$1(this,Et);f$1(this,B);d(this,"ttl");d(this,"ttlResolution");d(this,"ttlAutopurge");d(this,"updateAgeOnGet");d(this,"updateAgeOnHas");d(this,"allowStale");d(this,"noDisposeOnSet");d(this,"noUpdateTTL");d(this,"maxEntrySize");d(this,"sizeCalculation");d(this,"noDeleteOnFetchRejection");d(this,"noDeleteOnStaleGet");d(this,"allowStaleOnFetchAbort");d(this,"allowStaleOnFetchRejection");d(this,"ignoreFetchAbort");f$1(this,U);f$1(this,X);f$1(this,T);f$1(this,w);f$1(this,f);f$1(this,P);f$1(this,z);f$1(this,N);f$1(this,D);f$1(this,J);f$1(this,L);f$1(this,Q);f$1(this,Z);f$1(this,V);f$1(this,W);f$1(this,tt);f$1(this,dt);f$1(this,j);f$1(this,xt);f$1(this,mt,()=>{});f$1(this,ot,()=>{});f$1(this,Ot,()=>{});f$1(this,Y,()=>false);f$1(this,gt,e=>{});f$1(this,bt,(e,i,s)=>{});f$1(this,Tt,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});d(this,Jt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:n,updateAgeOnGet:o,updateAgeOnHas:h$1,allowStale:d$1,dispose:v,onInsert:R,disposeAfter:S,noDisposeOnSet:rt,noUpdateTTL:I,maxSize:k=0,maxEntrySize:A=0,sizeCalculation:y,fetchMethod:a,memoMethod:E,noDeleteOnFetchRejection:O,noDeleteOnStaleGet:u,allowStaleOnFetchRejection:g$1,allowStaleOnFetchAbort:F,ignoreFetchAbort:H,perf:_t}=e$1;if(_t!==void 0&&typeof _t?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(g(this,B,_t??de),i!==0&&!at(i))throw new TypeError("max option must be a nonnegative integer");let vt=i?ee(i):Array;if(!vt)throw new Error("invalid max value: "+i);if(g(this,K,i),g(this,M,k),this.maxEntrySize=A||e(this,M),this.sizeCalculation=y,this.sizeCalculation){if(!e(this,M)&&!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(g(this,Et,E),a!==void 0&&typeof a!="function")throw new TypeError("fetchMethod must be a function if specified");if(g(this,yt,a),g(this,dt,!!a),g(this,T,new Map),g(this,w,new Array(i).fill(void 0)),g(this,f,new Array(i).fill(void 0)),g(this,P,new vt(i)),g(this,z,new vt(i)),g(this,N,0),g(this,D,0),g(this,J,ue.create(i)),g(this,U,0),g(this,X,0),typeof v=="function"&&g(this,q,v),typeof R=="function"&&g(this,ft,R),typeof S=="function"?(g(this,$,S),g(this,L,[])):(g(this,$,void 0),g(this,L,void 0)),g(this,tt,!!e(this,q)),g(this,xt,!!e(this,ft)),g(this,j,!!e(this,$)),this.noDisposeOnSet=!!rt,this.noUpdateTTL=!!I,this.noDeleteOnFetchRejection=!!O,this.allowStaleOnFetchRejection=!!g$1,this.allowStaleOnFetchAbort=!!F,this.ignoreFetchAbort=!!H,this.maxEntrySize!==0){if(e(this,M)!==0&&!at(e(this,M)))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,l,se).call(this);}if(this.allowStale=!!d$1,this.noDeleteOnStaleGet=!!u,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!h$1,this.ttlResolution=at(r)||r===0?r:1,this.ttlAutopurge=!!n,this.ttl=s||0,this.ttl){if(!at(this.ttl))throw new TypeError("ttl must be a positive integer if specified");h(this,l,Gt).call(this);}if(e(this,K)===0&&this.ttl===0&&e(this,M)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!e(this,K)&&!e(this,M)){let Pt="LRU_CACHE_UNBOUNDED";pe(Pt)&&(Zt.add(Pt),te("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Pt,wt));}}get perf(){return e(this,B)}static unsafeExposeInternals(e$1){return {starts:e(e$1,Z),ttls:e(e$1,V),autopurgeTimers:e(e$1,W),sizes:e(e$1,Q),keyMap:e(e$1,T),keyList:e(e$1,w),valList:e(e$1,f),next:e(e$1,P),prev:e(e$1,z),get head(){return e(e$1,N)},get tail(){return e(e$1,D)},free:e(e$1,J),isBackgroundFetch:i=>{var s;return h(s=e$1,l,b).call(s,i)},backgroundFetch:(i,s,r,n)=>{var o;return h(o=e$1,l,Ct).call(o,i,s,r,n)},moveToTail:i=>{var s;return h(s=e$1,l,At).call(s,i)},indexes:i=>{var s;return h(s=e$1,l,lt).call(s,i)},rindexes:i=>{var s;return h(s=e$1,l,ht).call(s,i)},isStale:i=>{var s;return e(s=e$1,Y).call(s,i)}}}get max(){return e(this,K)}get maxSize(){return e(this,M)}get calculatedSize(){return e(this,X)}get size(){return e(this,U)}get fetchMethod(){return e(this,yt)}get memoMethod(){return e(this,Et)}get dispose(){return e(this,q)}get onInsert(){return e(this,ft)}get disposeAfter(){return e(this,$)}getRemainingTTL(e$1){return e(this,T).has(e$1)?1/0:0}*entries(){for(let e$1 of h(this,l,lt).call(this))e(this,f)[e$1]!==void 0&&e(this,w)[e$1]!==void 0&&!h(this,l,b).call(this,e(this,f)[e$1])&&(yield [e(this,w)[e$1],e(this,f)[e$1]]);}*rentries(){for(let e$1 of h(this,l,ht).call(this))e(this,f)[e$1]!==void 0&&e(this,w)[e$1]!==void 0&&!h(this,l,b).call(this,e(this,f)[e$1])&&(yield [e(this,w)[e$1],e(this,f)[e$1]]);}*keys(){for(let e$1 of h(this,l,lt).call(this)){let i=e(this,w)[e$1];i!==void 0&&!h(this,l,b).call(this,e(this,f)[e$1])&&(yield i);}}*rkeys(){for(let e$1 of h(this,l,ht).call(this)){let i=e(this,w)[e$1];i!==void 0&&!h(this,l,b).call(this,e(this,f)[e$1])&&(yield i);}}*values(){for(let e$1 of h(this,l,lt).call(this))e(this,f)[e$1]!==void 0&&!h(this,l,b).call(this,e(this,f)[e$1])&&(yield e(this,f)[e$1]);}*rvalues(){for(let e$1 of h(this,l,ht).call(this))e(this,f)[e$1]!==void 0&&!h(this,l,b).call(this,e(this,f)[e$1])&&(yield e(this,f)[e$1]);}[(Qt=Symbol.iterator,Jt=Symbol.toStringTag,Qt)](){return this.entries()}find(e$1,i={}){for(let s of h(this,l,lt).call(this)){let r=e(this,f)[s],n=h(this,l,b).call(this,r)?r.__staleWhileFetching:r;if(n!==void 0&&e$1(n,e(this,w)[s],this))return this.get(e(this,w)[s],i)}}forEach(e$1,i=this){for(let s of h(this,l,lt).call(this)){let r=e(this,f)[s],n=h(this,l,b).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e$1.call(i,n,e(this,w)[s],this);}}rforEach(e$1,i=this){for(let s of h(this,l,ht).call(this)){let r=e(this,f)[s],n=h(this,l,b).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e$1.call(i,n,e(this,w)[s],this);}}purgeStale(){let e$1=false;for(let i of h(this,l,ht).call(this,{allowStale:true}))e(this,Y).call(this,i)&&(h(this,l,ct).call(this,e(this,w)[i],"expire"),e$1=true);return e$1}info(e$1){let i=e(this,T).get(e$1);if(i===void 0)return;let s=e(this,f)[i],r=h(this,l,b).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let n={value:r};if(e(this,V)&&e(this,Z)){let o=e(this,V)[i],h=e(this,Z)[i];if(o&&h){let d=o-(e(this,B).now()-h);n.ttl=d,n.start=Date.now();}}return e(this,Q)&&(n.size=e(this,Q)[i]),n}dump(){let e$1=[];for(let i of h(this,l,lt).call(this,{allowStale:true})){let s=e(this,w)[i],r=e(this,f)[i],n=h(this,l,b).call(this,r)?r.__staleWhileFetching:r;if(n===void 0||s===void 0)continue;let o={value:n};if(e(this,V)&&e(this,Z)){o.ttl=e(this,V)[i];let h=e(this,B).now()-e(this,Z)[i];o.start=Math.floor(Date.now()-h);}e(this,Q)&&(o.size=e(this,Q)[i]),e$1.unshift([s,o]);}return e$1}load(e$1){this.clear();for(let[i,s]of e$1){if(s.start){let r=Date.now()-s.start;s.start=e(this,B).now()-r;}this.set(i,s.value,s);}}set(e$1,i$1,s={}){var rt,I,k,A;if(i$1===void 0)return this.delete(e$1),this;let{ttl:r=this.ttl,start:n,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:h$1=this.sizeCalculation,status:d}=s,{noUpdateTTL:v=this.noUpdateTTL}=s,R=e(this,Tt).call(this,e$1,i$1,s.size||0,h$1);if(this.maxEntrySize&&R>this.maxEntrySize)return d&&(d.set="miss",d.maxEntrySizeExceeded=true),h(this,l,ct).call(this,e$1,"set"),this;let S=e(this,U)===0?void 0:e(this,T).get(e$1);if(S===void 0)S=e(this,U)===0?e(this,D):e(this,J).length!==0?e(this,J).pop():e(this,U)===e(this,K)?h(this,l,Lt).call(this,false):e(this,U),e(this,w)[S]=e$1,e(this,f)[S]=i$1,e(this,T).set(e$1,S),e(this,P)[e(this,D)]=S,e(this,z)[S]=e(this,D),g(this,D,S),i(this,U)._++,e(this,bt).call(this,S,R,d),d&&(d.set="add"),v=false,e(this,xt)&&((rt=e(this,ft))==null||rt.call(this,i$1,e$1,"add"));else {h(this,l,At).call(this,S);let y=e(this,f)[S];if(i$1!==y){if(e(this,dt)&&h(this,l,b).call(this,y)){y.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:a}=y;a!==void 0&&!o&&(e(this,tt)&&((I=e(this,q))==null||I.call(this,a,e$1,"set")),e(this,j)&&e(this,L)?.push([a,e$1,"set"]));}else o||(e(this,tt)&&((k=e(this,q))==null||k.call(this,y,e$1,"set")),e(this,j)&&e(this,L)?.push([y,e$1,"set"]));if(e(this,gt).call(this,S),e(this,bt).call(this,S,R,d),e(this,f)[S]=i$1,d){d.set="replace";let a=y&&h(this,l,b).call(this,y)?y.__staleWhileFetching:y;a!==void 0&&(d.oldValue=a);}}else d&&(d.set="update");e(this,xt)&&this.onInsert?.(i$1,e$1,i$1===y?"update":"replace");}if(r!==0&&!e(this,V)&&h(this,l,Gt).call(this),e(this,V)&&(v||e(this,Ot).call(this,S,r,n),d&&e(this,ot).call(this,d,S)),!o&&e(this,j)&&e(this,L)){let y=e(this,L),a;for(;a=y?.shift();)(A=e(this,$))==null||A.call(this,...a);}return this}pop(){var e$1;try{for(;e(this,U);){let i=e(this,f)[e(this,N)];if(h(this,l,Lt).call(this,!0),h(this,l,b).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(e(this,j)&&e(this,L)){let i=e(this,L),s;for(;s=i?.shift();)(e$1=e(this,$))==null||e$1.call(this,...s);}}}has(e$1,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,n=e(this,T).get(e$1);if(n!==void 0){let o=e(this,f)[n];if(h(this,l,b).call(this,o)&&o.__staleWhileFetching===void 0)return false;if(e(this,Y).call(this,n))r&&(r.has="stale",e(this,ot).call(this,r,n));else return s&&e(this,mt).call(this,n),r&&(r.has="hit",e(this,ot).call(this,r,n)),true}else r&&(r.has="miss");return false}peek(e$1,i={}){let{allowStale:s=this.allowStale}=i,r=e(this,T).get(e$1);if(r===void 0||!s&&e(this,Y).call(this,r))return;let n=e(this,f)[r];return h(this,l,b).call(this,n)?n.__staleWhileFetching:n}async fetch(e$1,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:h$1=this.noDisposeOnSet,size:d=0,sizeCalculation:v=this.sizeCalculation,noUpdateTTL:R=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:rt=this.allowStaleOnFetchRejection,ignoreFetchAbort:I=this.ignoreFetchAbort,allowStaleOnFetchAbort:k=this.allowStaleOnFetchAbort,context:A,forceRefresh:y=false,status:a,signal:E}=i;if(!e(this,dt))return a&&(a.fetch="get"),this.get(e$1,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,status:a});let O={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:h$1,size:d,sizeCalculation:v,noUpdateTTL:R,noDeleteOnFetchRejection:S,allowStaleOnFetchRejection:rt,allowStaleOnFetchAbort:k,ignoreFetchAbort:I,status:a,signal:E},u=e(this,T).get(e$1);if(u===void 0){a&&(a.fetch="miss");let g=h(this,l,Ct).call(this,e$1,u,O,A);return g.__returned=g}else {let g=e(this,f)[u];if(h(this,l,b).call(this,g)){let vt=s&&g.__staleWhileFetching!==void 0;return a&&(a.fetch="inflight",vt&&(a.returnedStale=true)),vt?g.__staleWhileFetching:g.__returned=g}let F=e(this,Y).call(this,u);if(!y&&!F)return a&&(a.fetch="hit"),h(this,l,At).call(this,u),r&&e(this,mt).call(this,u),a&&e(this,ot).call(this,a,u),g;let H=h(this,l,Ct).call(this,e$1,u,O,A),_t=H.__staleWhileFetching!==void 0&&s;return a&&(a.fetch=F?"stale":"refresh",_t&&F&&(a.returnedStale=true)),_t?H.__staleWhileFetching:H.__returned=H}}async forceFetch(e,i={}){let s=await this.fetch(e,i);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(e$1,i={}){let s=e(this,Et);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:n,...o}=i,h=this.get(e$1,o);if(!n&&h!==void 0)return h;let d=s(e$1,h,{options:o,context:r});return this.set(e$1,d,o),d}get(e$1,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:o}=i,h$1=e(this,T).get(e$1);if(h$1!==void 0){let d=e(this,f)[h$1],v=h(this,l,b).call(this,d);return o&&e(this,ot).call(this,o,h$1),e(this,Y).call(this,h$1)?(o&&(o.get="stale"),v?(o&&s&&d.__staleWhileFetching!==void 0&&(o.returnedStale=true),s?d.__staleWhileFetching:void 0):(n||h(this,l,ct).call(this,e$1,"expire"),o&&s&&(o.returnedStale=true),s?d:void 0)):(o&&(o.get="hit"),v?d.__staleWhileFetching:(h(this,l,At).call(this,h$1),r&&e(this,mt).call(this,h$1),d))}else o&&(o.get="miss");}delete(e){return h(this,l,ct).call(this,e,"delete")}clear(){return h(this,l,zt).call(this,"delete")}},K=new WeakMap,M=new WeakMap,q=new WeakMap,ft=new WeakMap,$=new WeakMap,yt=new WeakMap,Et=new WeakMap,B=new WeakMap,U=new WeakMap,X=new WeakMap,T=new WeakMap,w=new WeakMap,f=new WeakMap,P=new WeakMap,z=new WeakMap,N=new WeakMap,D=new WeakMap,J=new WeakMap,L=new WeakMap,Q=new WeakMap,Z=new WeakMap,V=new WeakMap,W=new WeakMap,tt=new WeakMap,dt=new WeakMap,j=new WeakMap,xt=new WeakMap,l=new WeakSet,Gt=function(){let e$1=new Dt(e(this,K)),i=new Dt(e(this,K));g(this,V,e$1),g(this,Z,i);let s=this.ttlAutopurge?new Array(e(this,K)):void 0;g(this,W,s),g(this,Ot,(h,d,v=e(this,B).now())=>{i[h]=d!==0?v:0,e$1[h]=d,r(h,d);}),g(this,mt,h=>{i[h]=e$1[h]!==0?e(this,B).now():0,r(h,e$1[h]);});let r=this.ttlAutopurge?(h$1,d)=>{if(s?.[h$1]&&(clearTimeout(s[h$1]),s[h$1]=void 0),d&&d!==0&&s){let v=setTimeout(()=>{e(this,Y).call(this,h$1)&&h(this,l,ct).call(this,e(this,w)[h$1],"expire");},d+1);v.unref&&v.unref(),s[h$1]=v;}}:()=>{};g(this,ot,(h,d)=>{if(e$1[d]){let v=e$1[d],R=i[d];if(!v||!R)return;h.ttl=v,h.start=R,h.now=n||o();let S=h.now-R;h.remainingTTL=v-S;}});let n=0,o=()=>{let h=e(this,B).now();if(this.ttlResolution>0){n=h;let d=setTimeout(()=>n=0,this.ttlResolution);d.unref&&d.unref();}return h};this.getRemainingTTL=h=>{let d=e(this,T).get(h);if(d===void 0)return 0;let v=e$1[d],R=i[d];if(!v||!R)return 1/0;let S=(n||o())-R;return v-S},g(this,Y,h=>{let d=i[h],v=e$1[h];return !!v&&!!d&&(n||o())-d>v});},mt=new WeakMap,ot=new WeakMap,Ot=new WeakMap,Y=new WeakMap,se=function(){let e$1=new Dt(e(this,K));g(this,X,0),g(this,Q,e$1),g(this,gt,i=>{g(this,X,e(this,X)-e$1[i]),e$1[i]=0;}),g(this,Tt,(i,s,r,n)=>{if(h(this,l,b).call(this,s))return 0;if(!at(r))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(r=n(s,i),!at(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}),g(this,bt,(i,s,r)=>{if(e$1[i]=s,e(this,M)){let n=e(this,M)-e$1[i];for(;e(this,X)>n;)h(this,l,Lt).call(this,true);}g(this,X,e(this,X)+e$1[i]),r&&(r.entrySize=s,r.totalCalculatedSize=e(this,X));});},gt=new WeakMap,bt=new WeakMap,Tt=new WeakMap,lt=function*({allowStale:e$1=this.allowStale}={}){if(e(this,U))for(let i=e(this,D);!(!h(this,l,It).call(this,i)||((e$1||!e(this,Y).call(this,i))&&(yield i),i===e(this,N)));)i=e(this,z)[i];},ht=function*({allowStale:e$1=this.allowStale}={}){if(e(this,U))for(let i=e(this,N);!(!h(this,l,It).call(this,i)||((e$1||!e(this,Y).call(this,i))&&(yield i),i===e(this,D)));)i=e(this,P)[i];},It=function(e$1){return e$1!==void 0&&e(this,T).get(e(this,w)[e$1])===e$1},Lt=function(e$1){var n;let i$1=e(this,N),s=e(this,w)[i$1],r=e(this,f)[i$1];return e(this,dt)&&h(this,l,b).call(this,r)?r.__abortController.abort(new Error("evicted")):(e(this,tt)||e(this,j))&&(e(this,tt)&&((n=e(this,q))==null||n.call(this,r,s,"evict")),e(this,j)&&e(this,L)?.push([r,s,"evict"])),e(this,gt).call(this,i$1),e(this,W)?.[i$1]&&(clearTimeout(e(this,W)[i$1]),e(this,W)[i$1]=void 0),e$1&&(e(this,w)[i$1]=void 0,e(this,f)[i$1]=void 0,e(this,J).push(i$1)),e(this,U)===1?(g(this,N,g(this,D,0)),e(this,J).length=0):g(this,N,e(this,P)[i$1]),e(this,T).delete(s),i(this,U)._--,i$1},Ct=function(e$1,i,s,r){let n=i===void 0?void 0:e(this,f)[i];if(h(this,l,b).call(this,n))return n;let o=new Nt,{signal:h$1}=s;h$1?.addEventListener("abort",()=>o.abort(h$1.reason),{signal:o.signal});let d={signal:o.signal,options:s,context:r},v=(A,y=false)=>{let{aborted:a}=o.signal,E=s.ignoreFetchAbort&&A!==void 0,O=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&A!==void 0);if(s.status&&(a&&!y?(s.status.fetchAborted=true,s.status.fetchError=o.signal.reason,E&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),a&&!E&&!y)return S(o.signal.reason,O);let u=I,g=e(this,f)[i];return (g===I||E&&y&&g===void 0)&&(A===void 0?u.__staleWhileFetching!==void 0?e(this,f)[i]=u.__staleWhileFetching:h(this,l,ct).call(this,e$1,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e$1,A,d.options))),A},R=A=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=A),S(A,false)),S=(A,y)=>{let{aborted:a}=o.signal,E=a&&s.allowStaleOnFetchAbort,O=E||s.allowStaleOnFetchRejection,u=O||s.noDeleteOnFetchRejection,g=I;if(e(this,f)[i]===I&&(!u||!y&&g.__staleWhileFetching===void 0?h(this,l,ct).call(this,e$1,"fetch"):E||(e(this,f)[i]=g.__staleWhileFetching)),O)return s.status&&g.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),g.__staleWhileFetching;if(g.__returned===g)throw A},rt=(A,y)=>{var E;let a=(E=e(this,yt))==null?void 0:E.call(this,e$1,n,d);a&&a instanceof Promise&&a.then(O=>A(O===void 0?void 0:O),y),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(A(void 0),s.allowStaleOnFetchAbort&&(A=O=>v(O,true)));});};s.status&&(s.status.fetchDispatched=true);let I=new Promise(rt).then(v,R),k=Object.assign(I,{__abortController:o,__staleWhileFetching:n,__returned:void 0});return i===void 0?(this.set(e$1,k,{...d.options,status:void 0}),i=e(this,T).get(e$1)):e(this,f)[i]=k,k},b=function(e$1){if(!e(this,dt))return false;let i=e$1;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Nt},Mt=function(e$1,i){e(this,z)[i]=e$1,e(this,P)[e$1]=i;},At=function(e$1){e$1!==e(this,D)&&(e$1===e(this,N)?g(this,N,e(this,P)[e$1]):h(this,l,Mt).call(this,e(this,z)[e$1],e(this,P)[e$1]),h(this,l,Mt).call(this,e(this,D),e$1),g(this,D,e$1));},ct=function(e$1,i$1){var r,n;let s=false;if(e(this,U)!==0){let o=e(this,T).get(e$1);if(o!==void 0)if(e(this,W)?.[o]&&(clearTimeout(e(this,W)?.[o]),e(this,W)[o]=void 0),s=true,e(this,U)===1)h(this,l,zt).call(this,i$1);else {e(this,gt).call(this,o);let h$1=e(this,f)[o];if(h(this,l,b).call(this,h$1)?h$1.__abortController.abort(new Error("deleted")):(e(this,tt)||e(this,j))&&(e(this,tt)&&((r=e(this,q))==null||r.call(this,h$1,e$1,i$1)),e(this,j)&&e(this,L)?.push([h$1,e$1,i$1])),e(this,T).delete(e$1),e(this,w)[o]=void 0,e(this,f)[o]=void 0,o===e(this,D))g(this,D,e(this,z)[o]);else if(o===e(this,N))g(this,N,e(this,P)[o]);else {let d=e(this,z)[o];e(this,P)[d]=e(this,P)[o];let v=e(this,P)[o];e(this,z)[v]=e(this,z)[o];}i(this,U)._--,e(this,J).push(o);}}if(e(this,j)&&e(this,L)?.length){let o=e(this,L),h;for(;h=o?.shift();)(n=e(this,$))==null||n.call(this,...h);}return s},zt=function(e$1){var i,s;for(let r of h(this,l,ht).call(this,{allowStale:true})){let n=e(this,f)[r];if(h(this,l,b).call(this,n))n.__abortController.abort(new Error("deleted"));else {let o=e(this,w)[r];e(this,tt)&&((i=e(this,q))==null||i.call(this,n,o,e$1)),e(this,j)&&e(this,L)?.push([n,o,e$1]);}}if(e(this,T).clear(),e(this,f).fill(void 0),e(this,w).fill(void 0),e(this,V)&&e(this,Z)){e(this,V).fill(0),e(this,Z).fill(0);for(let r of e(this,W)??[])r!==void 0&&clearTimeout(r);e(this,W)?.fill(void 0);}if(e(this,Q)&&e(this,Q).fill(0),g(this,N,0),g(this,D,0),e(this,J).length=0,g(this,X,0),g(this,U,0),e(this,j)&&e(this,L)){let r=e(this,L),n;for(;n=r?.shift();)(s=e(this,$))==null||s.call(this,...n);}},wt);var Ft=class{constructor(e){d(this,"cache");d(this,"map",new Map);this.cache=new ie({max:e.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){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 Ut="1.8.4";var Vt={version:Ut};var Wt="repeat";function Yt(m){return {type:"pause",duration:m}}var Ht="__game_layer__";var fe={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 oe={};var Kt={};b$1(Kt,{createExportableElement:()=>ne});var pt;(r=>(r.log=(n,...o)=>console.log(`[Pixi\u2019VN] ${n}`,...o),r.warn=(n,...o)=>console.warn(`[Pixi\u2019VN] ${n}`,...o),r.error=(n,...o)=>console.error(`[Pixi\u2019VN] ${n}`,...o),r.info=(n,...o)=>console.info(`[Pixi\u2019VN] ${n}`,...o)))(pt||(pt={}));function ne(m){try{if(typeof m>"u")return m;let e=JSON.stringify(m);return JSON.parse(e)}catch(e){throw pt.error("Error creating exportable element",m,e),new PixiError("not_json_serializable","Error creating exportable element")}}var ge=typeof window<"u"&&typeof document<"u",ae=[" _______ _ _ _ ____ ____ ____ _____ ","|_ __ \\ (_) (_) | | |_ _| |_ _||_ \\|_ _|"," | |__) |__ _ __ __ \\_| \\ \\ / / | \\ | | "," | ___/[ | [ \\ [ ][ | \\ \\ / / | |\\ \\| | "," _| |_ | | > ' < | | \\ ' / _| |_\\ |_ ",`|_____| [___][__]\`\\_][___] \\_/ |_____|\\____| v${Vt.version}`],le=31,_e="background:#2f90da;color:#fff;font-weight:bold;",ve="background:#c832bb;color:#fff;font-weight:bold;",Se="background:transparent;font-weight:bold;",kt=` v${Vt.version}`;function he(){if(!ge)return;let m=[],e=[];for(let i=0;i<ae.length;i++){let s=ae[i],r=s.endsWith(kt),n=r?s.slice(0,-kt.length):s,o=n.slice(0,le),h=n.slice(le),d=r?"%c%s%c%s%c%s":"%c%s%c%s";m.push(d),e.push(_e,o,ve,h),r&&e.push(Se,kt);}console.info(m.join(`
|
|
2
|
-
`),...e);}function qt(){let m=window.location.pathname+window.location.hash;return m.includes("#")&&(m=m.split("#")[1]),m}
|
|
1
|
+
import {d,f as f$1,b as b$1,e,g,h,i}from'./chunk-K7JIC2F2.mjs';import*as nt from'@drincs/pixi-vn/canvas';export*from'@drincs/pixi-vn/canvas';import*as $t from'@drincs/pixi-vn/characters';export*from'@drincs/pixi-vn/characters';import {PixiError,GameUnifier}from'@drincs/pixi-vn/core';export*from'@drincs/pixi-vn/core';import*as et from'@drincs/pixi-vn/history';export*from'@drincs/pixi-vn/history';import*as C from'@drincs/pixi-vn/narration';export*from'@drincs/pixi-vn/narration';import*as pt from'@drincs/pixi-vn/sound';export*from'@drincs/pixi-vn/sound';import*as G from'@drincs/pixi-vn/storage';export*from'@drincs/pixi-vn/storage';import {motion}from'@drincs/pixi-vn/motion';var de=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Qt=new Set,jt=typeof process=="object"&&process?process:{},Zt=(m,e,i,s)=>{typeof jt.emitWarning=="function"?jt.emitWarning(m,e,i,s):console.error(`[${i}] ${e}: ${m}`);},Nt=globalThis.AbortController,Bt=globalThis.AbortSignal;if(typeof Nt>"u"){Bt=class{constructor(){d(this,"onabort");d(this,"_onabort",[]);d(this,"reason");d(this,"aborted",false);}addEventListener(i,s){this._onabort.push(s);}},Nt=class{constructor(){d(this,"signal",new Bt);e();}abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let m=jt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{m&&(m=false,Zt("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 pe=m=>!Qt.has(m);var at=m=>m&&m===Math.floor(m)&&m>0&&isFinite(m),te=m=>at(m)?m<=Math.pow(2,8)?Uint8Array:m<=Math.pow(2,16)?Uint16Array:m<=Math.pow(2,32)?Uint32Array:m<=Number.MAX_SAFE_INTEGER?Dt:null:null,Dt=class extends Array{constructor(m){super(m),this.fill(0);}},it,St,ue=(it=class{constructor(e$1,i){d(this,"heap");d(this,"length");if(!e(it,St))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e$1),this.length=0;}static create(e){let i=te(e);if(!i)return [];g(it,St,true);let s=new it(e,i);return g(it,St,false),s}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},St=new WeakMap,f$1(it,St,false),it),Xt,Jt,K,M,q,ut,$,yt,Et,B,U,X,T,w,f,P,z,N,D,J,L,Q,Z,V,W,tt,dt,j,xt,l,Gt,ft,ot,Ot,Y,ie,mt,bt,Tt,lt,ht,It,Lt,Ct,b,Mt,At,ct,zt,wt,ee=(wt=class{constructor(e$1){f$1(this,l);f$1(this,K);f$1(this,M);f$1(this,q);f$1(this,ut);f$1(this,$);f$1(this,yt);f$1(this,Et);f$1(this,B);d(this,"ttl");d(this,"ttlResolution");d(this,"ttlAutopurge");d(this,"updateAgeOnGet");d(this,"updateAgeOnHas");d(this,"allowStale");d(this,"noDisposeOnSet");d(this,"noUpdateTTL");d(this,"maxEntrySize");d(this,"sizeCalculation");d(this,"noDeleteOnFetchRejection");d(this,"noDeleteOnStaleGet");d(this,"allowStaleOnFetchAbort");d(this,"allowStaleOnFetchRejection");d(this,"ignoreFetchAbort");f$1(this,U);f$1(this,X);f$1(this,T);f$1(this,w);f$1(this,f);f$1(this,P);f$1(this,z);f$1(this,N);f$1(this,D);f$1(this,J);f$1(this,L);f$1(this,Q);f$1(this,Z);f$1(this,V);f$1(this,W);f$1(this,tt);f$1(this,dt);f$1(this,j);f$1(this,xt);f$1(this,ft,()=>{});f$1(this,ot,()=>{});f$1(this,Ot,()=>{});f$1(this,Y,()=>false);f$1(this,mt,e=>{});f$1(this,bt,(e,i,s)=>{});f$1(this,Tt,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});d(this,Xt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:n,updateAgeOnGet:o,updateAgeOnHas:h$1,allowStale:d$1,dispose:v,onInsert:R,disposeAfter:S,noDisposeOnSet:rt,noUpdateTTL:I,maxSize:k=0,maxEntrySize:A=0,sizeCalculation:y,fetchMethod:a,memoMethod:E,noDeleteOnFetchRejection:O,noDeleteOnStaleGet:u,allowStaleOnFetchRejection:g$1,allowStaleOnFetchAbort:F,ignoreFetchAbort:H,perf:_t}=e$1;if(_t!==void 0&&typeof _t?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(g(this,B,_t??de),i!==0&&!at(i))throw new TypeError("max option must be a nonnegative integer");let vt=i?te(i):Array;if(!vt)throw new Error("invalid max value: "+i);if(g(this,K,i),g(this,M,k),this.maxEntrySize=A||e(this,M),this.sizeCalculation=y,this.sizeCalculation){if(!e(this,M)&&!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(g(this,Et,E),a!==void 0&&typeof a!="function")throw new TypeError("fetchMethod must be a function if specified");if(g(this,yt,a),g(this,dt,!!a),g(this,T,new Map),g(this,w,new Array(i).fill(void 0)),g(this,f,new Array(i).fill(void 0)),g(this,P,new vt(i)),g(this,z,new vt(i)),g(this,N,0),g(this,D,0),g(this,J,ue.create(i)),g(this,U,0),g(this,X,0),typeof v=="function"&&g(this,q,v),typeof R=="function"&&g(this,ut,R),typeof S=="function"?(g(this,$,S),g(this,L,[])):(g(this,$,void 0),g(this,L,void 0)),g(this,tt,!!e(this,q)),g(this,xt,!!e(this,ut)),g(this,j,!!e(this,$)),this.noDisposeOnSet=!!rt,this.noUpdateTTL=!!I,this.noDeleteOnFetchRejection=!!O,this.allowStaleOnFetchRejection=!!g$1,this.allowStaleOnFetchAbort=!!F,this.ignoreFetchAbort=!!H,this.maxEntrySize!==0){if(e(this,M)!==0&&!at(e(this,M)))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,l,ie).call(this);}if(this.allowStale=!!d$1,this.noDeleteOnStaleGet=!!u,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!h$1,this.ttlResolution=at(r)||r===0?r:1,this.ttlAutopurge=!!n,this.ttl=s||0,this.ttl){if(!at(this.ttl))throw new TypeError("ttl must be a positive integer if specified");h(this,l,Gt).call(this);}if(e(this,K)===0&&this.ttl===0&&e(this,M)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!e(this,K)&&!e(this,M)){let Pt="LRU_CACHE_UNBOUNDED";pe(Pt)&&(Qt.add(Pt),Zt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Pt,wt));}}get perf(){return e(this,B)}static unsafeExposeInternals(e$1){return {starts:e(e$1,Z),ttls:e(e$1,V),autopurgeTimers:e(e$1,W),sizes:e(e$1,Q),keyMap:e(e$1,T),keyList:e(e$1,w),valList:e(e$1,f),next:e(e$1,P),prev:e(e$1,z),get head(){return e(e$1,N)},get tail(){return e(e$1,D)},free:e(e$1,J),isBackgroundFetch:i=>{var s;return h(s=e$1,l,b).call(s,i)},backgroundFetch:(i,s,r,n)=>{var o;return h(o=e$1,l,Ct).call(o,i,s,r,n)},moveToTail:i=>{var s;return h(s=e$1,l,At).call(s,i)},indexes:i=>{var s;return h(s=e$1,l,lt).call(s,i)},rindexes:i=>{var s;return h(s=e$1,l,ht).call(s,i)},isStale:i=>{var s;return e(s=e$1,Y).call(s,i)}}}get max(){return e(this,K)}get maxSize(){return e(this,M)}get calculatedSize(){return e(this,X)}get size(){return e(this,U)}get fetchMethod(){return e(this,yt)}get memoMethod(){return e(this,Et)}get dispose(){return e(this,q)}get onInsert(){return e(this,ut)}get disposeAfter(){return e(this,$)}getRemainingTTL(e$1){return e(this,T).has(e$1)?1/0:0}*entries(){for(let e$1 of h(this,l,lt).call(this))e(this,f)[e$1]!==void 0&&e(this,w)[e$1]!==void 0&&!h(this,l,b).call(this,e(this,f)[e$1])&&(yield [e(this,w)[e$1],e(this,f)[e$1]]);}*rentries(){for(let e$1 of h(this,l,ht).call(this))e(this,f)[e$1]!==void 0&&e(this,w)[e$1]!==void 0&&!h(this,l,b).call(this,e(this,f)[e$1])&&(yield [e(this,w)[e$1],e(this,f)[e$1]]);}*keys(){for(let e$1 of h(this,l,lt).call(this)){let i=e(this,w)[e$1];i!==void 0&&!h(this,l,b).call(this,e(this,f)[e$1])&&(yield i);}}*rkeys(){for(let e$1 of h(this,l,ht).call(this)){let i=e(this,w)[e$1];i!==void 0&&!h(this,l,b).call(this,e(this,f)[e$1])&&(yield i);}}*values(){for(let e$1 of h(this,l,lt).call(this))e(this,f)[e$1]!==void 0&&!h(this,l,b).call(this,e(this,f)[e$1])&&(yield e(this,f)[e$1]);}*rvalues(){for(let e$1 of h(this,l,ht).call(this))e(this,f)[e$1]!==void 0&&!h(this,l,b).call(this,e(this,f)[e$1])&&(yield e(this,f)[e$1]);}[(Jt=Symbol.iterator,Xt=Symbol.toStringTag,Jt)](){return this.entries()}find(e$1,i={}){for(let s of h(this,l,lt).call(this)){let r=e(this,f)[s],n=h(this,l,b).call(this,r)?r.__staleWhileFetching:r;if(n!==void 0&&e$1(n,e(this,w)[s],this))return this.get(e(this,w)[s],i)}}forEach(e$1,i=this){for(let s of h(this,l,lt).call(this)){let r=e(this,f)[s],n=h(this,l,b).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e$1.call(i,n,e(this,w)[s],this);}}rforEach(e$1,i=this){for(let s of h(this,l,ht).call(this)){let r=e(this,f)[s],n=h(this,l,b).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e$1.call(i,n,e(this,w)[s],this);}}purgeStale(){let e$1=false;for(let i of h(this,l,ht).call(this,{allowStale:true}))e(this,Y).call(this,i)&&(h(this,l,ct).call(this,e(this,w)[i],"expire"),e$1=true);return e$1}info(e$1){let i=e(this,T).get(e$1);if(i===void 0)return;let s=e(this,f)[i],r=h(this,l,b).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let n={value:r};if(e(this,V)&&e(this,Z)){let o=e(this,V)[i],h=e(this,Z)[i];if(o&&h){let d=o-(e(this,B).now()-h);n.ttl=d,n.start=Date.now();}}return e(this,Q)&&(n.size=e(this,Q)[i]),n}dump(){let e$1=[];for(let i of h(this,l,lt).call(this,{allowStale:true})){let s=e(this,w)[i],r=e(this,f)[i],n=h(this,l,b).call(this,r)?r.__staleWhileFetching:r;if(n===void 0||s===void 0)continue;let o={value:n};if(e(this,V)&&e(this,Z)){o.ttl=e(this,V)[i];let h=e(this,B).now()-e(this,Z)[i];o.start=Math.floor(Date.now()-h);}e(this,Q)&&(o.size=e(this,Q)[i]),e$1.unshift([s,o]);}return e$1}load(e$1){this.clear();for(let[i,s]of e$1){if(s.start){let r=Date.now()-s.start;s.start=e(this,B).now()-r;}this.set(i,s.value,s);}}set(e$1,i$1,s={}){var rt,I,k,A;if(i$1===void 0)return this.delete(e$1),this;let{ttl:r=this.ttl,start:n,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:h$1=this.sizeCalculation,status:d}=s,{noUpdateTTL:v=this.noUpdateTTL}=s,R=e(this,Tt).call(this,e$1,i$1,s.size||0,h$1);if(this.maxEntrySize&&R>this.maxEntrySize)return d&&(d.set="miss",d.maxEntrySizeExceeded=true),h(this,l,ct).call(this,e$1,"set"),this;let S=e(this,U)===0?void 0:e(this,T).get(e$1);if(S===void 0)S=e(this,U)===0?e(this,D):e(this,J).length!==0?e(this,J).pop():e(this,U)===e(this,K)?h(this,l,Lt).call(this,false):e(this,U),e(this,w)[S]=e$1,e(this,f)[S]=i$1,e(this,T).set(e$1,S),e(this,P)[e(this,D)]=S,e(this,z)[S]=e(this,D),g(this,D,S),i(this,U)._++,e(this,bt).call(this,S,R,d),d&&(d.set="add"),v=false,e(this,xt)&&((rt=e(this,ut))==null||rt.call(this,i$1,e$1,"add"));else {h(this,l,At).call(this,S);let y=e(this,f)[S];if(i$1!==y){if(e(this,dt)&&h(this,l,b).call(this,y)){y.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:a}=y;a!==void 0&&!o&&(e(this,tt)&&((I=e(this,q))==null||I.call(this,a,e$1,"set")),e(this,j)&&e(this,L)?.push([a,e$1,"set"]));}else o||(e(this,tt)&&((k=e(this,q))==null||k.call(this,y,e$1,"set")),e(this,j)&&e(this,L)?.push([y,e$1,"set"]));if(e(this,mt).call(this,S),e(this,bt).call(this,S,R,d),e(this,f)[S]=i$1,d){d.set="replace";let a=y&&h(this,l,b).call(this,y)?y.__staleWhileFetching:y;a!==void 0&&(d.oldValue=a);}}else d&&(d.set="update");e(this,xt)&&this.onInsert?.(i$1,e$1,i$1===y?"update":"replace");}if(r!==0&&!e(this,V)&&h(this,l,Gt).call(this),e(this,V)&&(v||e(this,Ot).call(this,S,r,n),d&&e(this,ot).call(this,d,S)),!o&&e(this,j)&&e(this,L)){let y=e(this,L),a;for(;a=y?.shift();)(A=e(this,$))==null||A.call(this,...a);}return this}pop(){var e$1;try{for(;e(this,U);){let i=e(this,f)[e(this,N)];if(h(this,l,Lt).call(this,!0),h(this,l,b).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(e(this,j)&&e(this,L)){let i=e(this,L),s;for(;s=i?.shift();)(e$1=e(this,$))==null||e$1.call(this,...s);}}}has(e$1,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,n=e(this,T).get(e$1);if(n!==void 0){let o=e(this,f)[n];if(h(this,l,b).call(this,o)&&o.__staleWhileFetching===void 0)return false;if(e(this,Y).call(this,n))r&&(r.has="stale",e(this,ot).call(this,r,n));else return s&&e(this,ft).call(this,n),r&&(r.has="hit",e(this,ot).call(this,r,n)),true}else r&&(r.has="miss");return false}peek(e$1,i={}){let{allowStale:s=this.allowStale}=i,r=e(this,T).get(e$1);if(r===void 0||!s&&e(this,Y).call(this,r))return;let n=e(this,f)[r];return h(this,l,b).call(this,n)?n.__staleWhileFetching:n}async fetch(e$1,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:h$1=this.noDisposeOnSet,size:d=0,sizeCalculation:v=this.sizeCalculation,noUpdateTTL:R=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:rt=this.allowStaleOnFetchRejection,ignoreFetchAbort:I=this.ignoreFetchAbort,allowStaleOnFetchAbort:k=this.allowStaleOnFetchAbort,context:A,forceRefresh:y=false,status:a,signal:E}=i;if(!e(this,dt))return a&&(a.fetch="get"),this.get(e$1,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,status:a});let O={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:h$1,size:d,sizeCalculation:v,noUpdateTTL:R,noDeleteOnFetchRejection:S,allowStaleOnFetchRejection:rt,allowStaleOnFetchAbort:k,ignoreFetchAbort:I,status:a,signal:E},u=e(this,T).get(e$1);if(u===void 0){a&&(a.fetch="miss");let g=h(this,l,Ct).call(this,e$1,u,O,A);return g.__returned=g}else {let g=e(this,f)[u];if(h(this,l,b).call(this,g)){let vt=s&&g.__staleWhileFetching!==void 0;return a&&(a.fetch="inflight",vt&&(a.returnedStale=true)),vt?g.__staleWhileFetching:g.__returned=g}let F=e(this,Y).call(this,u);if(!y&&!F)return a&&(a.fetch="hit"),h(this,l,At).call(this,u),r&&e(this,ft).call(this,u),a&&e(this,ot).call(this,a,u),g;let H=h(this,l,Ct).call(this,e$1,u,O,A),_t=H.__staleWhileFetching!==void 0&&s;return a&&(a.fetch=F?"stale":"refresh",_t&&F&&(a.returnedStale=true)),_t?H.__staleWhileFetching:H.__returned=H}}async forceFetch(e,i={}){let s=await this.fetch(e,i);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(e$1,i={}){let s=e(this,Et);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:n,...o}=i,h=this.get(e$1,o);if(!n&&h!==void 0)return h;let d=s(e$1,h,{options:o,context:r});return this.set(e$1,d,o),d}get(e$1,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:o}=i,h$1=e(this,T).get(e$1);if(h$1!==void 0){let d=e(this,f)[h$1],v=h(this,l,b).call(this,d);return o&&e(this,ot).call(this,o,h$1),e(this,Y).call(this,h$1)?(o&&(o.get="stale"),v?(o&&s&&d.__staleWhileFetching!==void 0&&(o.returnedStale=true),s?d.__staleWhileFetching:void 0):(n||h(this,l,ct).call(this,e$1,"expire"),o&&s&&(o.returnedStale=true),s?d:void 0)):(o&&(o.get="hit"),v?d.__staleWhileFetching:(h(this,l,At).call(this,h$1),r&&e(this,ft).call(this,h$1),d))}else o&&(o.get="miss");}delete(e){return h(this,l,ct).call(this,e,"delete")}clear(){return h(this,l,zt).call(this,"delete")}},K=new WeakMap,M=new WeakMap,q=new WeakMap,ut=new WeakMap,$=new WeakMap,yt=new WeakMap,Et=new WeakMap,B=new WeakMap,U=new WeakMap,X=new WeakMap,T=new WeakMap,w=new WeakMap,f=new WeakMap,P=new WeakMap,z=new WeakMap,N=new WeakMap,D=new WeakMap,J=new WeakMap,L=new WeakMap,Q=new WeakMap,Z=new WeakMap,V=new WeakMap,W=new WeakMap,tt=new WeakMap,dt=new WeakMap,j=new WeakMap,xt=new WeakMap,l=new WeakSet,Gt=function(){let e$1=new Dt(e(this,K)),i=new Dt(e(this,K));g(this,V,e$1),g(this,Z,i);let s=this.ttlAutopurge?new Array(e(this,K)):void 0;g(this,W,s),g(this,Ot,(h,d,v=e(this,B).now())=>{i[h]=d!==0?v:0,e$1[h]=d,r(h,d);}),g(this,ft,h=>{i[h]=e$1[h]!==0?e(this,B).now():0,r(h,e$1[h]);});let r=this.ttlAutopurge?(h$1,d)=>{if(s?.[h$1]&&(clearTimeout(s[h$1]),s[h$1]=void 0),d&&d!==0&&s){let v=setTimeout(()=>{e(this,Y).call(this,h$1)&&h(this,l,ct).call(this,e(this,w)[h$1],"expire");},d+1);v.unref&&v.unref(),s[h$1]=v;}}:()=>{};g(this,ot,(h,d)=>{if(e$1[d]){let v=e$1[d],R=i[d];if(!v||!R)return;h.ttl=v,h.start=R,h.now=n||o();let S=h.now-R;h.remainingTTL=v-S;}});let n=0,o=()=>{let h=e(this,B).now();if(this.ttlResolution>0){n=h;let d=setTimeout(()=>n=0,this.ttlResolution);d.unref&&d.unref();}return h};this.getRemainingTTL=h=>{let d=e(this,T).get(h);if(d===void 0)return 0;let v=e$1[d],R=i[d];if(!v||!R)return 1/0;let S=(n||o())-R;return v-S},g(this,Y,h=>{let d=i[h],v=e$1[h];return !!v&&!!d&&(n||o())-d>v});},ft=new WeakMap,ot=new WeakMap,Ot=new WeakMap,Y=new WeakMap,ie=function(){let e$1=new Dt(e(this,K));g(this,X,0),g(this,Q,e$1),g(this,mt,i=>{g(this,X,e(this,X)-e$1[i]),e$1[i]=0;}),g(this,Tt,(i,s,r,n)=>{if(h(this,l,b).call(this,s))return 0;if(!at(r))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(r=n(s,i),!at(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}),g(this,bt,(i,s,r)=>{if(e$1[i]=s,e(this,M)){let n=e(this,M)-e$1[i];for(;e(this,X)>n;)h(this,l,Lt).call(this,true);}g(this,X,e(this,X)+e$1[i]),r&&(r.entrySize=s,r.totalCalculatedSize=e(this,X));});},mt=new WeakMap,bt=new WeakMap,Tt=new WeakMap,lt=function*({allowStale:e$1=this.allowStale}={}){if(e(this,U))for(let i=e(this,D);!(!h(this,l,It).call(this,i)||((e$1||!e(this,Y).call(this,i))&&(yield i),i===e(this,N)));)i=e(this,z)[i];},ht=function*({allowStale:e$1=this.allowStale}={}){if(e(this,U))for(let i=e(this,N);!(!h(this,l,It).call(this,i)||((e$1||!e(this,Y).call(this,i))&&(yield i),i===e(this,D)));)i=e(this,P)[i];},It=function(e$1){return e$1!==void 0&&e(this,T).get(e(this,w)[e$1])===e$1},Lt=function(e$1){var n;let i$1=e(this,N),s=e(this,w)[i$1],r=e(this,f)[i$1];return e(this,dt)&&h(this,l,b).call(this,r)?r.__abortController.abort(new Error("evicted")):(e(this,tt)||e(this,j))&&(e(this,tt)&&((n=e(this,q))==null||n.call(this,r,s,"evict")),e(this,j)&&e(this,L)?.push([r,s,"evict"])),e(this,mt).call(this,i$1),e(this,W)?.[i$1]&&(clearTimeout(e(this,W)[i$1]),e(this,W)[i$1]=void 0),e$1&&(e(this,w)[i$1]=void 0,e(this,f)[i$1]=void 0,e(this,J).push(i$1)),e(this,U)===1?(g(this,N,g(this,D,0)),e(this,J).length=0):g(this,N,e(this,P)[i$1]),e(this,T).delete(s),i(this,U)._--,i$1},Ct=function(e$1,i,s,r){let n=i===void 0?void 0:e(this,f)[i];if(h(this,l,b).call(this,n))return n;let o=new Nt,{signal:h$1}=s;h$1?.addEventListener("abort",()=>o.abort(h$1.reason),{signal:o.signal});let d={signal:o.signal,options:s,context:r},v=(A,y=false)=>{let{aborted:a}=o.signal,E=s.ignoreFetchAbort&&A!==void 0,O=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&A!==void 0);if(s.status&&(a&&!y?(s.status.fetchAborted=true,s.status.fetchError=o.signal.reason,E&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),a&&!E&&!y)return S(o.signal.reason,O);let u=I,g=e(this,f)[i];return (g===I||E&&y&&g===void 0)&&(A===void 0?u.__staleWhileFetching!==void 0?e(this,f)[i]=u.__staleWhileFetching:h(this,l,ct).call(this,e$1,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e$1,A,d.options))),A},R=A=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=A),S(A,false)),S=(A,y)=>{let{aborted:a}=o.signal,E=a&&s.allowStaleOnFetchAbort,O=E||s.allowStaleOnFetchRejection,u=O||s.noDeleteOnFetchRejection,g=I;if(e(this,f)[i]===I&&(!u||!y&&g.__staleWhileFetching===void 0?h(this,l,ct).call(this,e$1,"fetch"):E||(e(this,f)[i]=g.__staleWhileFetching)),O)return s.status&&g.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),g.__staleWhileFetching;if(g.__returned===g)throw A},rt=(A,y)=>{var E;let a=(E=e(this,yt))==null?void 0:E.call(this,e$1,n,d);a&&a instanceof Promise&&a.then(O=>A(O===void 0?void 0:O),y),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(A(void 0),s.allowStaleOnFetchAbort&&(A=O=>v(O,true)));});};s.status&&(s.status.fetchDispatched=true);let I=new Promise(rt).then(v,R),k=Object.assign(I,{__abortController:o,__staleWhileFetching:n,__returned:void 0});return i===void 0?(this.set(e$1,k,{...d.options,status:void 0}),i=e(this,T).get(e$1)):e(this,f)[i]=k,k},b=function(e$1){if(!e(this,dt))return false;let i=e$1;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Nt},Mt=function(e$1,i){e(this,z)[i]=e$1,e(this,P)[e$1]=i;},At=function(e$1){e$1!==e(this,D)&&(e$1===e(this,N)?g(this,N,e(this,P)[e$1]):h(this,l,Mt).call(this,e(this,z)[e$1],e(this,P)[e$1]),h(this,l,Mt).call(this,e(this,D),e$1),g(this,D,e$1));},ct=function(e$1,i$1){var r,n;let s=false;if(e(this,U)!==0){let o=e(this,T).get(e$1);if(o!==void 0)if(e(this,W)?.[o]&&(clearTimeout(e(this,W)?.[o]),e(this,W)[o]=void 0),s=true,e(this,U)===1)h(this,l,zt).call(this,i$1);else {e(this,mt).call(this,o);let h$1=e(this,f)[o];if(h(this,l,b).call(this,h$1)?h$1.__abortController.abort(new Error("deleted")):(e(this,tt)||e(this,j))&&(e(this,tt)&&((r=e(this,q))==null||r.call(this,h$1,e$1,i$1)),e(this,j)&&e(this,L)?.push([h$1,e$1,i$1])),e(this,T).delete(e$1),e(this,w)[o]=void 0,e(this,f)[o]=void 0,o===e(this,D))g(this,D,e(this,z)[o]);else if(o===e(this,N))g(this,N,e(this,P)[o]);else {let d=e(this,z)[o];e(this,P)[d]=e(this,P)[o];let v=e(this,P)[o];e(this,z)[v]=e(this,z)[o];}i(this,U)._--,e(this,J).push(o);}}if(e(this,j)&&e(this,L)?.length){let o=e(this,L),h;for(;h=o?.shift();)(n=e(this,$))==null||n.call(this,...h);}return s},zt=function(e$1){var i,s;for(let r of h(this,l,ht).call(this,{allowStale:true})){let n=e(this,f)[r];if(h(this,l,b).call(this,n))n.__abortController.abort(new Error("deleted"));else {let o=e(this,w)[r];e(this,tt)&&((i=e(this,q))==null||i.call(this,n,o,e$1)),e(this,j)&&e(this,L)?.push([n,o,e$1]);}}if(e(this,T).clear(),e(this,f).fill(void 0),e(this,w).fill(void 0),e(this,V)&&e(this,Z)){e(this,V).fill(0),e(this,Z).fill(0);for(let r of e(this,W)??[])r!==void 0&&clearTimeout(r);e(this,W)?.fill(void 0);}if(e(this,Q)&&e(this,Q).fill(0),g(this,N,0),g(this,D,0),e(this,J).length=0,g(this,X,0),g(this,U,0),e(this,j)&&e(this,L)){let r=e(this,L),n;for(;n=r?.shift();)(s=e(this,$))==null||s.call(this,...n);}},wt);var Ft=class{constructor(e){d(this,"cache");d(this,"map",new Map);this.cache=new ee({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 Ut="1.8.7";var Vt={version:Ut};var Wt="repeat";function Yt(m){return {type:"pause",duration:m}}var Ht="__game_layer__";var fe={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 re={};var Kt={};b$1(Kt,{createExportableElement:()=>oe});var gt;(r=>(r.log=(n,...o)=>console.log(`[Pixi\u2019VN] ${n}`,...o),r.warn=(n,...o)=>console.warn(`[Pixi\u2019VN] ${n}`,...o),r.error=(n,...o)=>console.error(`[Pixi\u2019VN] ${n}`,...o),r.info=(n,...o)=>console.info(`[Pixi\u2019VN] ${n}`,...o)))(gt||={});function oe(m){try{if(typeof m>"u")return m;let e=JSON.stringify(m);return JSON.parse(e)}catch(e){throw gt.error("Error creating exportable element",m,e),new PixiError("not_json_serializable","Error creating exportable element")}}var ge=typeof window<"u"&&typeof document<"u",ne=[" _______ _ _ _ ____ ____ ____ _____ ","|_ __ \\ (_) (_) | | |_ _| |_ _||_ \\|_ _|"," | |__) |__ _ __ __ \\_| \\ \\ / / | \\ | | "," | ___/[ | [ \\ [ ][ | \\ \\ / / | |\\ \\| | "," _| |_ | | > ' < | | \\ ' / _| |_\\ |_ ",`|_____| [___][__]\`\\_][___] \\_/ |_____|\\____| v${Vt.version}`],ae=31,_e="background:#2f90da;color:#fff;font-weight:bold;",ve="background:#c832bb;color:#fff;font-weight:bold;",Se="background:transparent;font-weight:bold;",kt=` v${Vt.version}`;function le(){if(!ge)return;let m=[],e=[];for(let i=0;i<ne.length;i++){let s=ne[i],r=s.endsWith(kt),n=r?s.slice(0,-kt.length):s,o=n.slice(0,ae),h=n.slice(ae),d=r?"%c%s%c%s%c%s":"%c%s%c%s";m.push(d),e.push(_e,o,ve,h),r&&e.push(Se,kt);}console.info(m.join(`
|
|
2
|
+
`),...e);}function qt(){let m=window.location.pathname+window.location.hash;return m.includes("#")&&(m=m.split("#")[1]),m}le();var he;(y=>{async function m(a,E,O){if(GameUnifier.init({navigate:E?.navigate,getCurrentGameStepState:()=>{let u={};try{u=nt.canvas.export();}catch{}return {path:qt(),storage:G.storage.export(),canvas:u,sound:pt.sound.export(),labelIndex:C.NarrationManagerStatic.currentLabelStepIndex||0,openedLabels:C.narration.openedLabels}},restoreGameStepState:async(u,g)=>{et.HistoryManagerStatic._originalStepData=u,C.NarrationManagerStatic.openedLabels=u.openedLabels,G.storage.restore(u.storage);try{await nt.canvas.restore(u.canvas),await pt.sound.restore(u.sound);}catch(F){gt.error("Error restoring game step state:",F);}await g(u.path);},getStepCounter:()=>C.narration.stepCounter,setStepCounter:u=>{C.NarrationManagerStatic._stepCounter=u;},getOpenedLabels:()=>C.narration.openedLabels.length,addHistoryItem:(u,g)=>et.stepHistory.add(u,g),getCharacter:u=>$t.RegisteredCharacters.get(u),processNavigationRequests:(u,g)=>{let F=u,H=Promise.resolve();return u>0?(F--,H=C.narration.continue(g)):u<0&&(F=0,H=et.stepHistory.back(g,{steps:u*-1})),{newValue:F,result:H}},animate:(u,g,F,H)=>motion.animate(u,g,F,H),getVariable:(u,g)=>G.StorageRegistry.getVariable(u,g),setVariable:(u,g,F)=>G.StorageRegistry.setVariable(u,g,F),removeVariable:(u,g)=>G.StorageRegistry.removeVariable(u,g),getFlag:u=>G.storage.getFlag(u),setFlag:(u,g)=>G.storage.setFlag(u,g),onLabelClosing:u=>G.StorageRegistry.clearOldTempVariables(u)}),!a||!E){gt.warn("The canvas element or options are not defined. The canvas will not be initialized.");return}return await nt.canvas.init(a,E,O)}y.init=m;function e(){G.storage.clear();try{nt.canvas.clear();}catch{}pt.sound.clear(),C.narration.clear(),et.stepHistory.clear();}y.clear=e;function i(){let a={};try{a=nt.canvas.export();}catch{}return {pixivn_version:Ut,stepData:C.narration.export(),storageData:G.storage.export(),canvasData:a,soundData:pt.sound.export(),historyData:et.stepHistory.export(),path:qt()}}y.exportGameState=i;async function s(a,E){et.stepHistory.restore(a.historyData);let O=et.stepHistory.lastKey;if(typeof O=="number"){let u=et.stepHistory.stepsInfoMap.get(O)||null;await C.narration.restore(a.stepData,u);}G.storage.restore(a.storageData);try{await nt.canvas.restore(a.canvasData),await pt.sound.restore(a.soundData);}catch{}E?await E(a.path):await GameUnifier.navigate(a.path);}y.restoreGameState=s;async function r(a,E){return y.clear(),await C.narration.call(a,E)}y.start=r;function n(a){return JSON.parse(a)}y.jsonToGameState=n;function o(a){GameUnifier.onEnd=a;}y.onEnd=o;function h(a){return gt.warn("Game.onError is deprecated. Use Game.addOnError / Game.removeOnError to register multiple handlers."),GameUnifier.addOnError((E,O)=>a("step",E,O))}y.onError=h;function d(a){return GameUnifier.addOnError(a)}y.addOnError=d;function v(a){return GameUnifier.removeOnError(a)}y.removeOnError=v;function R(a){C.NarrationManagerStatic.onStepStart=a;}y.onStepStart=R;function S(a){C.NarrationManagerStatic.onLoadingLabel=a;}y.onLoadingLabel=S;function rt(a){C.NarrationManagerStatic.onStepEnd=a;}y.onStepEnd=rt;function I(a){GameUnifier.navigate=a;}y.onNavigate=I;function k(a){return GameUnifier.addOnPreContinue(a)}y.addOnPreContinue=k;function A(a){return GameUnifier.removeOnPreContinue(a)}y.removeOnPreContinue=A;})(he||={});var Be={characterUtils:$t,canvasUtils:nt,narrationUtils:C,soundUtils:pt,CANVAS_APP_GAME_LAYER_ALIAS:Ht,Pause:Yt,Repeat:Wt,PIXIVN_VERSION:Ut,...Kt,...re,canvas:nt.canvas,narration:C.narration,sound:pt.sound,storage:G.storage,history:et.stepHistory,Game:he,GameUnifier:GameUnifier};export{Ht as CANVAS_APP_GAME_LAYER_ALIAS,Ft as CachedMap,he as Game,Ut as PIXIVN_VERSION,Yt as Pause,Wt as Repeat,fe as SYSTEM_RESERVED_STORAGE_KEYS,oe as createExportableElement,Be as default};
|
package/dist/motion.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var canvas=require('@drincs/pixi-vn/canvas'),X=require('@drincs/pixi-vn/pixi.js'),motion=require('motion'),core=require('@drincs/pixi-vn/core');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var X__default=/*#__PURE__*/_interopDefault(X);var tt=Object.create;var E=Object.defineProperty;var et=Object.getOwnPropertyDescriptor;var nt=Object.getOwnPropertyNames;var it=Object.getPrototypeOf,rt=Object.prototype.hasOwnProperty;var at=(a,e,n)=>e in a?E(a,e,{enumerable:true,configurable:true,writable:true,value:n}):a[e]=n;var q=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var U=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports);var ot=(a,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of nt(e))!rt.call(a,r)&&r!==n&&E(a,r,{get:()=>e[r],enumerable:!(i=et(e,r))||i.enumerable});return a};var st=(a,e,n)=>(n=a!=null?tt(it(a)):{},ot(E(n,"default",{value:a,enumerable:true}),a));var v=(a,e,n)=>at(a,typeof e!="symbol"?e+"":e,n);var K=U((P,$)=>{(function(a,e){typeof P=="object"?$.exports=P=e():typeof define=="function"&&define.amd?define([],e):a.CryptoJS=e();})(P,function(){var a=a||(function(e,n){var i;if(typeof window<"u"&&window.crypto&&(i=window.crypto),typeof self<"u"&&self.crypto&&(i=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(i=globalThis.crypto),!i&&typeof window<"u"&&window.msCrypto&&(i=window.msCrypto),!i&&typeof global<"u"&&global.crypto&&(i=global.crypto),!i&&typeof q=="function")try{i=q("crypto");}catch{}var r=function(){if(i){if(typeof i.getRandomValues=="function")try{return i.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof i.randomBytes=="function")try{return i.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||(function(){function t(){}return function(o){var f;return t.prototype=o,f=new t,t.prototype=null,f}})(),c={},y=c.lib={},l=y.Base=(function(){return {extend:function(t){var o=s(this);return t&&o.mixIn(t),(!o.hasOwnProperty("init")||this.init===o.init)&&(o.init=function(){o.$super.init.apply(this,arguments);}),o.init.prototype=o,o.$super=this,o},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var o in t)t.hasOwnProperty(o)&&(this[o]=t[o]);t.hasOwnProperty("toString")&&(this.toString=t.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),m=y.WordArray=l.extend({init:function(t,o){t=this.words=t||[],o!=n?this.sigBytes=o:this.sigBytes=t.length*4;},toString:function(t){return (t||h).stringify(this)},concat:function(t){var o=this.words,f=t.words,p=this.sigBytes,g=t.sigBytes;if(this.clamp(),p%4)for(var T=0;T<g;T++){var W=f[T>>>2]>>>24-T%4*8&255;o[p+T>>>2]|=W<<24-(p+T)%4*8;}else for(var O=0;O<g;O+=4)o[p+O>>>2]=f[O>>>2];return this.sigBytes+=g,this},clamp:function(){var t=this.words,o=this.sigBytes;t[o>>>2]&=4294967295<<32-o%4*8,t.length=e.ceil(o/4);},clone:function(){var t=l.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var o=[],f=0;f<t;f+=4)o.push(r());return new m.init(o,t)}}),u=c.enc={},h=u.Hex={stringify:function(t){for(var o=t.words,f=t.sigBytes,p=[],g=0;g<f;g++){var T=o[g>>>2]>>>24-g%4*8&255;p.push((T>>>4).toString(16)),p.push((T&15).toString(16));}return p.join("")},parse:function(t){for(var o=t.length,f=[],p=0;p<o;p+=2)f[p>>>3]|=parseInt(t.substr(p,2),16)<<24-p%8*4;return new m.init(f,o/2)}},b=u.Latin1={stringify:function(t){for(var o=t.words,f=t.sigBytes,p=[],g=0;g<f;g++){var T=o[g>>>2]>>>24-g%4*8&255;p.push(String.fromCharCode(T));}return p.join("")},parse:function(t){for(var o=t.length,f=[],p=0;p<o;p++)f[p>>>2]|=(t.charCodeAt(p)&255)<<24-p%4*8;return new m.init(f,o)}},A=u.Utf8={stringify:function(t){try{return decodeURIComponent(escape(b.stringify(t)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(t){return b.parse(unescape(encodeURIComponent(t)))}},x=y.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new m.init,this._nDataBytes=0;},_append:function(t){typeof t=="string"&&(t=A.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes;},_process:function(t){var o,f=this._data,p=f.words,g=f.sigBytes,T=this.blockSize,W=T*4,O=g/W;t?O=e.ceil(O):O=e.max((O|0)-this._minBufferSize,0);var I=O*T,Y=e.min(I*4,g);if(I){for(var R=0;R<I;R+=T)this._doProcessBlock(p,R);o=p.splice(0,I),f.sigBytes-=Y;}return new m.init(o,Y)},clone:function(){var t=l.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});y.Hasher=x.extend({cfg:l.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset();},reset:function(){x.reset.call(this),this._doReset();},update:function(t){return this._append(t),this._process(),this},finalize:function(t){t&&this._append(t);var o=this._doFinalize();return o},blockSize:512/32,_createHelper:function(t){return function(o,f){return new t.init(f).finalize(o)}},_createHmacHelper:function(t){return function(o,f){return new d.HMAC.init(t,f).finalize(o)}}});var d=c.algo={};return c})(Math);return a});});var J=U((j,L)=>{(function(a,e){typeof j=="object"?L.exports=j=e(K()):typeof define=="function"&&define.amd?define(["./core"],e):e(a.CryptoJS);})(j,function(a){return (function(){var e=a,n=e.lib,i=n.WordArray,r=n.Hasher,s=e.algo,c=[],y=s.SHA1=r.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(l,m){for(var u=this._hash.words,h=u[0],b=u[1],A=u[2],x=u[3],B=u[4],d=0;d<80;d++){if(d<16)c[d]=l[m+d]|0;else {var t=c[d-3]^c[d-8]^c[d-14]^c[d-16];c[d]=t<<1|t>>>31;}var o=(h<<5|h>>>27)+B+c[d];d<20?o+=(b&A|~b&x)+1518500249:d<40?o+=(b^A^x)+1859775393:d<60?o+=(b&A|b&x|A&x)-1894007588:o+=(b^A^x)-899497514,B=x,x=A,A=b<<30|b>>>2,b=h,h=o;}u[0]=u[0]+h|0,u[1]=u[1]+b|0,u[2]=u[2]+A|0,u[3]=u[3]+x|0,u[4]=u[4]+B|0;},_doFinalize:function(){var l=this._data,m=l.words,u=this._nDataBytes*8,h=l.sigBytes*8;return m[h>>>5]|=128<<24-h%32,m[(h+64>>>9<<4)+14]=Math.floor(u/4294967296),m[(h+64>>>9<<4)+15]=u,l.sigBytes=m.length*4,this._process(),this._hash},clone:function(){var l=r.clone.call(this);return l._hash=this._hash.clone(),l}});e.SHA1=r._createHelper(y),e.HmacSHA1=r._createHmacHelper(y);})(),a.SHA1});});var H=(a,e=100)=>{let n=null;return (...i)=>{n&&clearTimeout(n),n=setTimeout(()=>a(...i),e);}};var M=a=>e=>{let n=({lastTime:i})=>e(i);return {start:(i=true)=>{a.add(n),a.start();},stop:()=>a.remove(n),now:()=>a.lastTime}};function w(a,e,n){if(Array.isArray(a)&&Array.isArray(a[0])){e&&"repeat"in e&&e?.repeat===null&&(e.repeat=1/0),a.forEach(c=>{if(Array.isArray(c)&&c.length===3){let[y,l,m]=c;m&&"repeat"in m&&m?.repeat===null&&(m.repeat=1/0);}});let{ticker:i=new X__default.default.Ticker,driver:r=M(i),...s}=e||{};return motion.animate(a,{driver:r,...s})}else {n&&"repeat"in n&&n?.repeat===null&&(n.repeat=1/0);let{ticker:i=new X__default.default.Ticker,driver:r=M(i),...s}=n||{};return motion.animate(a,e,{driver:r,...s})}}function ct(a,e){let n={x:0},i=[];return a.forEach((r,s)=>{let{onComplete:c,onPlay:y,...l}=r;if(y){let m=motion.motionValue(s);m.on("change",H(y,50)),i.push([m,s+1,{duration:.01}]);}if(i.push([n,{x:s+1},l]),c){let m=motion.motionValue(s);m.on("change",H(c,50)),i.push([m,s+1,{duration:.01}]);}}),w(i,e)}var G=st(J());var S=class{constructor(e,n){v(this,"id");v(this,"_args");v(this,"duration");v(this,"priority");v(this,"ticker",new X__default.default.Ticker);v(this,"_animation");v(this,"stopped",false);v(this,"_paused",false);v(this,"canvasElementAliases",[]);v(this,"timeout",50);v(this,"onComplete",()=>{let e=this.id,n=this._args.options?.aliasToRemoveAfter||[];typeof n=="string"&&(n=[n]);let i=this._args.options?.tickerAliasToResume||[];typeof i=="string"&&(i=[i]);let r=this._args.options?.tickerIdToResume||[];typeof r=="string"&&(r=[r]),canvas.canvas.onTickerComplete(e,{aliasToRemoveAfter:n,tickerAliasToResume:i,tickerIdToResume:r,stopTicker:false});});let{duration:i,priority:r,id:s=this.generateTickerId(n),canvasElementAliases:c=[]}=n||{};this._args=e,this.duration=i,this.priority=r,this.id=s,this.canvasElementAliases=c;}get args(){return {...this._args,time:this._animation?.time}}getItemByAlias(e){if(!this.canvasElementAliases.includes(e))return;let n=canvas.canvas.find(e);if(n)return n}generateTickerId(...e){try{return (0,G.default)(JSON.stringify(e)).toString()+"_motion_"+Math.random().toString(36).substring(7)}catch(n){throw new core.PixiError("not_json_serializable",`Error to generate ticker id: ${n}`)}}async complete(){this.animation.complete(),await new Promise(e=>setTimeout(e,this.timeout));}stop(){this.stopped=true,this.animation.stop();}start(){this.args.options?.autoplay!==false&&(this._paused=false,this.animation.play());}createItem(e){return new Proxy({alias:e},{set:({alias:n},i,r)=>{if(this.stopped||this._paused||this._args.startState&&this._args.startState[i]===r)return true;let s=this.getItemByAlias(n);if(!s)return true;switch(i){case "pivotX":s.pivot.x=r;break;case "pivotY":s.pivot.y=r;break;case "scaleX":s.scale.x=r;break;case "scaleY":s.scale.y=r;break;default:s[i]=r;break}return true},get:({alias:n},i)=>{if(this._args.startState||(this._args.startState={}),i in this._args.startState)return this._args.startState[i];let r=this.getItemByAlias(n);if(!r)return;let s;switch(i){case "pivotX":s=r.pivot.x;break;case "pivotY":s=r.pivot.y;break;case "scaleX":s=r.scale.x;break;case "scaleY":s=r.scale.y;break;default:s=r[i];break}return this._args.startState={...this._args.startState,[i]:s},s},has:({alias:n},i)=>{let r=this.getItemByAlias(n);if(!r)return false;switch(i){case "pivotX":return "pivot"in r&&"x"in r.pivot;case "pivotY":return "pivot"in r&&"y"in r.pivot;case "scaleX":return "scale"in r&&"x"in r.scale;case "scaleY":return "scale"in r&&"y"in r.scale;default:return i in r}},ownKeys:({alias:n})=>{let i=this.getItemByAlias(n);return i?Object.keys(i):[]}})}pause(){this.animation&&(this._paused=true,this.animation.pause());}play(){this._paused=false,this.animation.play();}get paused(){return this.animation?this.animation.state==="paused":true}};var _=class extends S{constructor(){super(...arguments);v(this,"alias","motion-sequence");}get animation(){let n=this._animation;if(n)return n;let i=this.canvasElementAliases[0],r=this.createItem(i),s=this._args.sequence.map((c,y)=>[r,c[0],{...c[1]||{},ticker:this.ticker,onComplete:y===this._args.sequence.length-1?()=>this.onComplete():void 0}]);return n=w(s,this._args.options),this._args.time&&(this.animation.time=this._args.time),this._animation=n,n}};var k=class extends S{constructor(){super(...arguments);v(this,"alias","motion");}get animation(){let n=this._animation;if(n)return n;let i=this.canvasElementAliases.map(r=>this.createItem(r));return n=w(i,this._args.keyframes,{...this._args.options,onComplete:()=>this.onComplete(),ticker:this.ticker}),this._args.time&&(n.time=this._args.time),this._animation=n,n}};var C;(r=>(r.log=(s,...c)=>console.log(`[Pixi\u2019VN] ${s}`,...c),r.warn=(s,...c)=>console.warn(`[Pixi\u2019VN] ${s}`,...c),r.error=(s,...c)=>console.error(`[Pixi\u2019VN] ${s}`,...c),r.info=(s,...c)=>console.info(`[Pixi\u2019VN] ${s}`,...c)))(C||(C={}));function z(a){try{if(typeof a>"u")return a;let e=JSON.stringify(a);return JSON.parse(e)}catch(e){throw C.error("Error creating exportable element",a,e),new core.PixiError("not_json_serializable","Error creating exportable element")}}var D;(e=>{function a(n,i,r,s){try{i=z(i);}catch(h){throw C.error("animate keyframes cannot contain functions or classes"),h}try{r=z(r);}catch(h){throw C.error("animate options cannot contain functions or classes"),h}let c=[];typeof n=="string"?c=[n]:Array.isArray(n)?c=n.map(h=>typeof h=="string"?h:h.label):c=[n.label];let y;Array.isArray(i)?y=new _({sequence:i,options:r},{priority:s,canvasElementAliases:c}):y=new k({keyframes:i,options:r},{priority:s,canvasElementAliases:c});let l=canvas.canvas.addTicker(c,y),{forceCompleteBeforeNext:m}=r||{},{completeOnContinue:u=m}=r||{};return l&&u&&canvas.canvas.completeTickerOnStepEnd({id:l}),l}e.animate=a;})(D||(D={}));var ut=D;canvas.RegisteredTickers.add(k,"motion");canvas.RegisteredTickers.add(_,"motion-sequence");exports.animate=w;exports.motion=ut;exports.motionDriver=M;exports.timeline=ct;
|
|
1
|
+
'use strict';var canvas=require('@drincs/pixi-vn/canvas'),U=require('@drincs/pixi-vn/pixi.js'),motion=require('motion'),core=require('@drincs/pixi-vn/core');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var U__default=/*#__PURE__*/_interopDefault(U);var tt=Object.create;var E=Object.defineProperty;var et=Object.getOwnPropertyDescriptor;var nt=Object.getOwnPropertyNames;var it=Object.getPrototypeOf,rt=Object.prototype.hasOwnProperty;var at=(a,e,n)=>e in a?E(a,e,{enumerable:true,configurable:true,writable:true,value:n}):a[e]=n;var q=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var Y=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports);var ot=(a,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of nt(e))!rt.call(a,r)&&r!==n&&E(a,r,{get:()=>e[r],enumerable:!(i=et(e,r))||i.enumerable});return a};var st=(a,e,n)=>(n=a!=null?tt(it(a)):{},ot(E(n,"default",{value:a,enumerable:true}),a));var v=(a,e,n)=>at(a,typeof e!="symbol"?e+"":e,n);var $=Y((P,N)=>{(function(a,e){typeof P=="object"?N.exports=P=e():typeof define=="function"&&define.amd?define([],e):a.CryptoJS=e();})(P,function(){var a=a||(function(e,n){var i;if(typeof window<"u"&&window.crypto&&(i=window.crypto),typeof self<"u"&&self.crypto&&(i=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(i=globalThis.crypto),!i&&typeof window<"u"&&window.msCrypto&&(i=window.msCrypto),!i&&typeof global<"u"&&global.crypto&&(i=global.crypto),!i&&typeof q=="function")try{i=q("crypto");}catch{}var r=function(){if(i){if(typeof i.getRandomValues=="function")try{return i.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof i.randomBytes=="function")try{return i.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||(function(){function t(){}return function(o){var f;return t.prototype=o,f=new t,t.prototype=null,f}})(),c={},y=c.lib={},l=y.Base=(function(){return {extend:function(t){var o=s(this);return t&&o.mixIn(t),(!o.hasOwnProperty("init")||this.init===o.init)&&(o.init=function(){o.$super.init.apply(this,arguments);}),o.init.prototype=o,o.$super=this,o},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var o in t)t.hasOwnProperty(o)&&(this[o]=t[o]);t.hasOwnProperty("toString")&&(this.toString=t.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),m=y.WordArray=l.extend({init:function(t,o){t=this.words=t||[],o!=n?this.sigBytes=o:this.sigBytes=t.length*4;},toString:function(t){return (t||h).stringify(this)},concat:function(t){var o=this.words,f=t.words,p=this.sigBytes,g=t.sigBytes;if(this.clamp(),p%4)for(var T=0;T<g;T++){var W=f[T>>>2]>>>24-T%4*8&255;o[p+T>>>2]|=W<<24-(p+T)%4*8;}else for(var O=0;O<g;O+=4)o[p+O>>>2]=f[O>>>2];return this.sigBytes+=g,this},clamp:function(){var t=this.words,o=this.sigBytes;t[o>>>2]&=4294967295<<32-o%4*8,t.length=e.ceil(o/4);},clone:function(){var t=l.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var o=[],f=0;f<t;f+=4)o.push(r());return new m.init(o,t)}}),u=c.enc={},h=u.Hex={stringify:function(t){for(var o=t.words,f=t.sigBytes,p=[],g=0;g<f;g++){var T=o[g>>>2]>>>24-g%4*8&255;p.push((T>>>4).toString(16)),p.push((T&15).toString(16));}return p.join("")},parse:function(t){for(var o=t.length,f=[],p=0;p<o;p+=2)f[p>>>3]|=parseInt(t.substr(p,2),16)<<24-p%8*4;return new m.init(f,o/2)}},b=u.Latin1={stringify:function(t){for(var o=t.words,f=t.sigBytes,p=[],g=0;g<f;g++){var T=o[g>>>2]>>>24-g%4*8&255;p.push(String.fromCharCode(T));}return p.join("")},parse:function(t){for(var o=t.length,f=[],p=0;p<o;p++)f[p>>>2]|=(t.charCodeAt(p)&255)<<24-p%4*8;return new m.init(f,o)}},A=u.Utf8={stringify:function(t){try{return decodeURIComponent(escape(b.stringify(t)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(t){return b.parse(unescape(encodeURIComponent(t)))}},x=y.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new m.init,this._nDataBytes=0;},_append:function(t){typeof t=="string"&&(t=A.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes;},_process:function(t){var o,f=this._data,p=f.words,g=f.sigBytes,T=this.blockSize,W=T*4,O=g/W;t?O=e.ceil(O):O=e.max((O|0)-this._minBufferSize,0);var I=O*T,D=e.min(I*4,g);if(I){for(var R=0;R<I;R+=T)this._doProcessBlock(p,R);o=p.splice(0,I),f.sigBytes-=D;}return new m.init(o,D)},clone:function(){var t=l.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});y.Hasher=x.extend({cfg:l.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset();},reset:function(){x.reset.call(this),this._doReset();},update:function(t){return this._append(t),this._process(),this},finalize:function(t){t&&this._append(t);var o=this._doFinalize();return o},blockSize:512/32,_createHelper:function(t){return function(o,f){return new t.init(f).finalize(o)}},_createHmacHelper:function(t){return function(o,f){return new d.HMAC.init(t,f).finalize(o)}}});var d=c.algo={};return c})(Math);return a});});var L=Y((j,K)=>{(function(a,e){typeof j=="object"?K.exports=j=e($()):typeof define=="function"&&define.amd?define(["./core"],e):e(a.CryptoJS);})(j,function(a){return (function(){var e=a,n=e.lib,i=n.WordArray,r=n.Hasher,s=e.algo,c=[],y=s.SHA1=r.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(l,m){for(var u=this._hash.words,h=u[0],b=u[1],A=u[2],x=u[3],B=u[4],d=0;d<80;d++){if(d<16)c[d]=l[m+d]|0;else {var t=c[d-3]^c[d-8]^c[d-14]^c[d-16];c[d]=t<<1|t>>>31;}var o=(h<<5|h>>>27)+B+c[d];d<20?o+=(b&A|~b&x)+1518500249:d<40?o+=(b^A^x)+1859775393:d<60?o+=(b&A|b&x|A&x)-1894007588:o+=(b^A^x)-899497514,B=x,x=A,A=b<<30|b>>>2,b=h,h=o;}u[0]=u[0]+h|0,u[1]=u[1]+b|0,u[2]=u[2]+A|0,u[3]=u[3]+x|0,u[4]=u[4]+B|0;},_doFinalize:function(){var l=this._data,m=l.words,u=this._nDataBytes*8,h=l.sigBytes*8;return m[h>>>5]|=128<<24-h%32,m[(h+64>>>9<<4)+14]=Math.floor(u/4294967296),m[(h+64>>>9<<4)+15]=u,l.sigBytes=m.length*4,this._process(),this._hash},clone:function(){var l=r.clone.call(this);return l._hash=this._hash.clone(),l}});e.SHA1=r._createHelper(y),e.HmacSHA1=r._createHmacHelper(y);})(),a.SHA1});});var H=(a,e=100)=>{let n=null;return (...i)=>{n&&clearTimeout(n),n=setTimeout(()=>a(...i),e);}};var M=a=>e=>{let n=({lastTime:i})=>e(i);return {start:(i=true)=>{a.add(n),a.start();},stop:()=>a.remove(n),now:()=>a.lastTime}};function C(a,e,n){if(Array.isArray(a)&&Array.isArray(a[0])){e&&"repeat"in e&&e?.repeat===null&&(e.repeat=1/0),a.forEach(c=>{if(Array.isArray(c)&&c.length===3){let[y,l,m]=c;m&&"repeat"in m&&m?.repeat===null&&(m.repeat=1/0);}});let{ticker:i=new U__default.default.Ticker,driver:r=M(i),...s}=e||{};return motion.animate(a,{driver:r,...s})}else {n&&"repeat"in n&&n?.repeat===null&&(n.repeat=1/0);let{ticker:i=new U__default.default.Ticker,driver:r=M(i),...s}=n||{};return motion.animate(a,e,{driver:r,...s})}}function ct(a,e){let n={x:0},i=[];return a.forEach((r,s)=>{let{onComplete:c,onPlay:y,...l}=r;if(y){let m=motion.motionValue(s);m.on("change",H(y,50)),i.push([m,s+1,{duration:.01}]);}if(i.push([n,{x:s+1},l]),c){let m=motion.motionValue(s);m.on("change",H(c,50)),i.push([m,s+1,{duration:.01}]);}}),C(i,e)}var V=st(L());var S=class{constructor(e,n){v(this,"id");v(this,"_args");v(this,"duration");v(this,"priority");v(this,"ticker",new U__default.default.Ticker);v(this,"_animation");v(this,"stopped",false);v(this,"_paused",false);v(this,"canvasElementAliases",[]);v(this,"timeout",50);v(this,"onComplete",()=>{let e=this.id,n=this._args.options?.aliasToRemoveAfter||[];typeof n=="string"&&(n=[n]);let i=this._args.options?.tickerAliasToResume||[];typeof i=="string"&&(i=[i]);let r=this._args.options?.tickerIdToResume||[];typeof r=="string"&&(r=[r]),canvas.canvas.onTickerComplete(e,{aliasToRemoveAfter:n,tickerAliasToResume:i,tickerIdToResume:r,stopTicker:false});});let{duration:i,priority:r,id:s=this.generateTickerId(n),canvasElementAliases:c=[]}=n||{};this._args=e,this.duration=i,this.priority=r,this.id=s,this.canvasElementAliases=c;}get args(){return {...this._args,time:this._animation?.time}}getItemByAlias(e){if(!this.canvasElementAliases.includes(e))return;let n=canvas.canvas.find(e);if(n)return n}generateTickerId(...e){try{return (0,V.default)(JSON.stringify(e)).toString()+"_motion_"+Math.random().toString(36).substring(7)}catch(n){throw new core.PixiError("not_json_serializable",`Error to generate ticker id: ${n}`)}}async complete(){this.animation.complete(),await new Promise(e=>setTimeout(e,this.timeout));}stop(){this.stopped=true,this.animation.stop();}start(){this.args.options?.autoplay!==false&&(this._paused=false,this.animation.play());}createItem(e){return new Proxy({alias:e},{set:({alias:n},i,r)=>{if(this.stopped||this._paused||this._args.startState&&this._args.startState[i]===r)return true;let s=this.getItemByAlias(n);if(!s)return true;switch(i){case "pivotX":s.pivot.x=r;break;case "pivotY":s.pivot.y=r;break;case "scaleX":s.scale.x=r;break;case "scaleY":s.scale.y=r;break;default:s[i]=r;break}return true},get:({alias:n},i)=>{if(this._args.startState||(this._args.startState={}),i in this._args.startState)return this._args.startState[i];let r=this.getItemByAlias(n);if(!r)return;let s;switch(i){case "pivotX":s=r.pivot.x;break;case "pivotY":s=r.pivot.y;break;case "scaleX":s=r.scale.x;break;case "scaleY":s=r.scale.y;break;default:s=r[i];break}return this._args.startState={...this._args.startState,[i]:s},s},has:({alias:n},i)=>{let r=this.getItemByAlias(n);if(!r)return false;switch(i){case "pivotX":return "pivot"in r&&"x"in r.pivot;case "pivotY":return "pivot"in r&&"y"in r.pivot;case "scaleX":return "scale"in r&&"x"in r.scale;case "scaleY":return "scale"in r&&"y"in r.scale;default:return i in r}},ownKeys:({alias:n})=>{let i=this.getItemByAlias(n);return i?Object.keys(i):[]}})}pause(){this.animation&&(this._paused=true,this.animation.pause());}play(){this._paused=false,this.animation.play();}get paused(){return this.animation?this.animation.state==="paused":true}};var _=class extends S{constructor(){super(...arguments);v(this,"alias","motion-sequence");}get animation(){let n=this._animation;if(n)return n;let i=this.canvasElementAliases[0],r=this.createItem(i),s=this._args.sequence.map((c,y)=>[r,c[0],{...c[1]||{},ticker:this.ticker,onComplete:y===this._args.sequence.length-1?()=>this.onComplete():void 0}]);return n=C(s,this._args.options),this._args.time&&(this.animation.time=this._args.time),this._animation=n,n}};var k=class extends S{constructor(){super(...arguments);v(this,"alias","motion");}get animation(){let n=this._animation;if(n)return n;let i=this.canvasElementAliases.map(r=>this.createItem(r));return n=C(i,this._args.keyframes,{...this._args.options,onComplete:()=>this.onComplete(),ticker:this.ticker}),this._args.time&&(n.time=this._args.time),this._animation=n,n}};var w;(r=>(r.log=(s,...c)=>console.log(`[Pixi\u2019VN] ${s}`,...c),r.warn=(s,...c)=>console.warn(`[Pixi\u2019VN] ${s}`,...c),r.error=(s,...c)=>console.error(`[Pixi\u2019VN] ${s}`,...c),r.info=(s,...c)=>console.info(`[Pixi\u2019VN] ${s}`,...c)))(w||={});function z(a){try{if(typeof a>"u")return a;let e=JSON.stringify(a);return JSON.parse(e)}catch(e){throw w.error("Error creating exportable element",a,e),new core.PixiError("not_json_serializable","Error creating exportable element")}}var Q;(e=>{function a(n,i,r,s){try{i=z(i);}catch(h){throw w.error("animate keyframes cannot contain functions or classes"),h}try{r=z(r);}catch(h){throw w.error("animate options cannot contain functions or classes"),h}let c=[];typeof n=="string"?c=[n]:Array.isArray(n)?c=n.map(h=>typeof h=="string"?h:h.label):c=[n.label];let y;Array.isArray(i)?y=new _({sequence:i,options:r},{priority:s,canvasElementAliases:c}):y=new k({keyframes:i,options:r},{priority:s,canvasElementAliases:c});let l=canvas.canvas.addTicker(c,y),{forceCompleteBeforeNext:m}=r||{},{completeOnContinue:u=m}=r||{};return l&&u&&canvas.canvas.completeTickerOnStepEnd({id:l}),l}e.animate=a;})(Q||={});var ut=Q;canvas.RegisteredTickers.add(k,"motion");canvas.RegisteredTickers.add(_,"motion-sequence");exports.animate=C;exports.motion=ut;exports.motionDriver=M;exports.timeline=ct;
|
package/dist/motion.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {RegisteredTickers,canvas}from'@drincs/pixi-vn/canvas';import X from'@drincs/pixi-vn/pixi.js';import {animate,motionValue}from'motion';import {PixiError}from'@drincs/pixi-vn/core';var tt=Object.create;var E=Object.defineProperty;var et=Object.getOwnPropertyDescriptor;var nt=Object.getOwnPropertyNames;var it=Object.getPrototypeOf,rt=Object.prototype.hasOwnProperty;var at=(a,e,n)=>e in a?E(a,e,{enumerable:true,configurable:true,writable:true,value:n}):a[e]=n;var q=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var U=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports);var ot=(a,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of nt(e))!rt.call(a,r)&&r!==n&&E(a,r,{get:()=>e[r],enumerable:!(i=et(e,r))||i.enumerable});return a};var st=(a,e,n)=>(n=a!=null?tt(it(a)):{},ot(E(n,"default",{value:a,enumerable:true}),a));var v=(a,e,n)=>at(a,typeof e!="symbol"?e+"":e,n);var K=U((P,$)=>{(function(a,e){typeof P=="object"?$.exports=P=e():typeof define=="function"&&define.amd?define([],e):a.CryptoJS=e();})(P,function(){var a=a||(function(e,n){var i;if(typeof window<"u"&&window.crypto&&(i=window.crypto),typeof self<"u"&&self.crypto&&(i=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(i=globalThis.crypto),!i&&typeof window<"u"&&window.msCrypto&&(i=window.msCrypto),!i&&typeof global<"u"&&global.crypto&&(i=global.crypto),!i&&typeof q=="function")try{i=q("crypto");}catch{}var r=function(){if(i){if(typeof i.getRandomValues=="function")try{return i.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof i.randomBytes=="function")try{return i.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||(function(){function t(){}return function(o){var f;return t.prototype=o,f=new t,t.prototype=null,f}})(),c={},y=c.lib={},l=y.Base=(function(){return {extend:function(t){var o=s(this);return t&&o.mixIn(t),(!o.hasOwnProperty("init")||this.init===o.init)&&(o.init=function(){o.$super.init.apply(this,arguments);}),o.init.prototype=o,o.$super=this,o},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var o in t)t.hasOwnProperty(o)&&(this[o]=t[o]);t.hasOwnProperty("toString")&&(this.toString=t.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),m=y.WordArray=l.extend({init:function(t,o){t=this.words=t||[],o!=n?this.sigBytes=o:this.sigBytes=t.length*4;},toString:function(t){return (t||h).stringify(this)},concat:function(t){var o=this.words,f=t.words,p=this.sigBytes,g=t.sigBytes;if(this.clamp(),p%4)for(var T=0;T<g;T++){var W=f[T>>>2]>>>24-T%4*8&255;o[p+T>>>2]|=W<<24-(p+T)%4*8;}else for(var O=0;O<g;O+=4)o[p+O>>>2]=f[O>>>2];return this.sigBytes+=g,this},clamp:function(){var t=this.words,o=this.sigBytes;t[o>>>2]&=4294967295<<32-o%4*8,t.length=e.ceil(o/4);},clone:function(){var t=l.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var o=[],f=0;f<t;f+=4)o.push(r());return new m.init(o,t)}}),u=c.enc={},h=u.Hex={stringify:function(t){for(var o=t.words,f=t.sigBytes,p=[],g=0;g<f;g++){var T=o[g>>>2]>>>24-g%4*8&255;p.push((T>>>4).toString(16)),p.push((T&15).toString(16));}return p.join("")},parse:function(t){for(var o=t.length,f=[],p=0;p<o;p+=2)f[p>>>3]|=parseInt(t.substr(p,2),16)<<24-p%8*4;return new m.init(f,o/2)}},b=u.Latin1={stringify:function(t){for(var o=t.words,f=t.sigBytes,p=[],g=0;g<f;g++){var T=o[g>>>2]>>>24-g%4*8&255;p.push(String.fromCharCode(T));}return p.join("")},parse:function(t){for(var o=t.length,f=[],p=0;p<o;p++)f[p>>>2]|=(t.charCodeAt(p)&255)<<24-p%4*8;return new m.init(f,o)}},A=u.Utf8={stringify:function(t){try{return decodeURIComponent(escape(b.stringify(t)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(t){return b.parse(unescape(encodeURIComponent(t)))}},x=y.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new m.init,this._nDataBytes=0;},_append:function(t){typeof t=="string"&&(t=A.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes;},_process:function(t){var o,f=this._data,p=f.words,g=f.sigBytes,T=this.blockSize,W=T*4,O=g/W;t?O=e.ceil(O):O=e.max((O|0)-this._minBufferSize,0);var I=O*T,Y=e.min(I*4,g);if(I){for(var R=0;R<I;R+=T)this._doProcessBlock(p,R);o=p.splice(0,I),f.sigBytes-=Y;}return new m.init(o,Y)},clone:function(){var t=l.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});y.Hasher=x.extend({cfg:l.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset();},reset:function(){x.reset.call(this),this._doReset();},update:function(t){return this._append(t),this._process(),this},finalize:function(t){t&&this._append(t);var o=this._doFinalize();return o},blockSize:512/32,_createHelper:function(t){return function(o,f){return new t.init(f).finalize(o)}},_createHmacHelper:function(t){return function(o,f){return new d.HMAC.init(t,f).finalize(o)}}});var d=c.algo={};return c})(Math);return a});});var J=U((j,L)=>{(function(a,e){typeof j=="object"?L.exports=j=e(K()):typeof define=="function"&&define.amd?define(["./core"],e):e(a.CryptoJS);})(j,function(a){return (function(){var e=a,n=e.lib,i=n.WordArray,r=n.Hasher,s=e.algo,c=[],y=s.SHA1=r.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(l,m){for(var u=this._hash.words,h=u[0],b=u[1],A=u[2],x=u[3],B=u[4],d=0;d<80;d++){if(d<16)c[d]=l[m+d]|0;else {var t=c[d-3]^c[d-8]^c[d-14]^c[d-16];c[d]=t<<1|t>>>31;}var o=(h<<5|h>>>27)+B+c[d];d<20?o+=(b&A|~b&x)+1518500249:d<40?o+=(b^A^x)+1859775393:d<60?o+=(b&A|b&x|A&x)-1894007588:o+=(b^A^x)-899497514,B=x,x=A,A=b<<30|b>>>2,b=h,h=o;}u[0]=u[0]+h|0,u[1]=u[1]+b|0,u[2]=u[2]+A|0,u[3]=u[3]+x|0,u[4]=u[4]+B|0;},_doFinalize:function(){var l=this._data,m=l.words,u=this._nDataBytes*8,h=l.sigBytes*8;return m[h>>>5]|=128<<24-h%32,m[(h+64>>>9<<4)+14]=Math.floor(u/4294967296),m[(h+64>>>9<<4)+15]=u,l.sigBytes=m.length*4,this._process(),this._hash},clone:function(){var l=r.clone.call(this);return l._hash=this._hash.clone(),l}});e.SHA1=r._createHelper(y),e.HmacSHA1=r._createHmacHelper(y);})(),a.SHA1});});var H=(a,e=100)=>{let n=null;return (...i)=>{n&&clearTimeout(n),n=setTimeout(()=>a(...i),e);}};var M=a=>e=>{let n=({lastTime:i})=>e(i);return {start:(i=true)=>{a.add(n),a.start();},stop:()=>a.remove(n),now:()=>a.lastTime}};function w(a,e,n){if(Array.isArray(a)&&Array.isArray(a[0])){e&&"repeat"in e&&e?.repeat===null&&(e.repeat=1/0),a.forEach(c=>{if(Array.isArray(c)&&c.length===3){let[y,l,m]=c;m&&"repeat"in m&&m?.repeat===null&&(m.repeat=1/0);}});let{ticker:i=new X.Ticker,driver:r=M(i),...s}=e||{};return animate(a,{driver:r,...s})}else {n&&"repeat"in n&&n?.repeat===null&&(n.repeat=1/0);let{ticker:i=new X.Ticker,driver:r=M(i),...s}=n||{};return animate(a,e,{driver:r,...s})}}function ct(a,e){let n={x:0},i=[];return a.forEach((r,s)=>{let{onComplete:c,onPlay:y,...l}=r;if(y){let m=motionValue(s);m.on("change",H(y,50)),i.push([m,s+1,{duration:.01}]);}if(i.push([n,{x:s+1},l]),c){let m=motionValue(s);m.on("change",H(c,50)),i.push([m,s+1,{duration:.01}]);}}),w(i,e)}var G=st(J());var S=class{constructor(e,n){v(this,"id");v(this,"_args");v(this,"duration");v(this,"priority");v(this,"ticker",new X.Ticker);v(this,"_animation");v(this,"stopped",false);v(this,"_paused",false);v(this,"canvasElementAliases",[]);v(this,"timeout",50);v(this,"onComplete",()=>{let e=this.id,n=this._args.options?.aliasToRemoveAfter||[];typeof n=="string"&&(n=[n]);let i=this._args.options?.tickerAliasToResume||[];typeof i=="string"&&(i=[i]);let r=this._args.options?.tickerIdToResume||[];typeof r=="string"&&(r=[r]),canvas.onTickerComplete(e,{aliasToRemoveAfter:n,tickerAliasToResume:i,tickerIdToResume:r,stopTicker:false});});let{duration:i,priority:r,id:s=this.generateTickerId(n),canvasElementAliases:c=[]}=n||{};this._args=e,this.duration=i,this.priority=r,this.id=s,this.canvasElementAliases=c;}get args(){return {...this._args,time:this._animation?.time}}getItemByAlias(e){if(!this.canvasElementAliases.includes(e))return;let n=canvas.find(e);if(n)return n}generateTickerId(...e){try{return (0,G.default)(JSON.stringify(e)).toString()+"_motion_"+Math.random().toString(36).substring(7)}catch(n){throw new PixiError("not_json_serializable",`Error to generate ticker id: ${n}`)}}async complete(){this.animation.complete(),await new Promise(e=>setTimeout(e,this.timeout));}stop(){this.stopped=true,this.animation.stop();}start(){this.args.options?.autoplay!==false&&(this._paused=false,this.animation.play());}createItem(e){return new Proxy({alias:e},{set:({alias:n},i,r)=>{if(this.stopped||this._paused||this._args.startState&&this._args.startState[i]===r)return true;let s=this.getItemByAlias(n);if(!s)return true;switch(i){case "pivotX":s.pivot.x=r;break;case "pivotY":s.pivot.y=r;break;case "scaleX":s.scale.x=r;break;case "scaleY":s.scale.y=r;break;default:s[i]=r;break}return true},get:({alias:n},i)=>{if(this._args.startState||(this._args.startState={}),i in this._args.startState)return this._args.startState[i];let r=this.getItemByAlias(n);if(!r)return;let s;switch(i){case "pivotX":s=r.pivot.x;break;case "pivotY":s=r.pivot.y;break;case "scaleX":s=r.scale.x;break;case "scaleY":s=r.scale.y;break;default:s=r[i];break}return this._args.startState={...this._args.startState,[i]:s},s},has:({alias:n},i)=>{let r=this.getItemByAlias(n);if(!r)return false;switch(i){case "pivotX":return "pivot"in r&&"x"in r.pivot;case "pivotY":return "pivot"in r&&"y"in r.pivot;case "scaleX":return "scale"in r&&"x"in r.scale;case "scaleY":return "scale"in r&&"y"in r.scale;default:return i in r}},ownKeys:({alias:n})=>{let i=this.getItemByAlias(n);return i?Object.keys(i):[]}})}pause(){this.animation&&(this._paused=true,this.animation.pause());}play(){this._paused=false,this.animation.play();}get paused(){return this.animation?this.animation.state==="paused":true}};var _=class extends S{constructor(){super(...arguments);v(this,"alias","motion-sequence");}get animation(){let n=this._animation;if(n)return n;let i=this.canvasElementAliases[0],r=this.createItem(i),s=this._args.sequence.map((c,y)=>[r,c[0],{...c[1]||{},ticker:this.ticker,onComplete:y===this._args.sequence.length-1?()=>this.onComplete():void 0}]);return n=w(s,this._args.options),this._args.time&&(this.animation.time=this._args.time),this._animation=n,n}};var k=class extends S{constructor(){super(...arguments);v(this,"alias","motion");}get animation(){let n=this._animation;if(n)return n;let i=this.canvasElementAliases.map(r=>this.createItem(r));return n=w(i,this._args.keyframes,{...this._args.options,onComplete:()=>this.onComplete(),ticker:this.ticker}),this._args.time&&(n.time=this._args.time),this._animation=n,n}};var C;(r=>(r.log=(s,...c)=>console.log(`[Pixi\u2019VN] ${s}`,...c),r.warn=(s,...c)=>console.warn(`[Pixi\u2019VN] ${s}`,...c),r.error=(s,...c)=>console.error(`[Pixi\u2019VN] ${s}`,...c),r.info=(s,...c)=>console.info(`[Pixi\u2019VN] ${s}`,...c)))(C||(C={}));function z(a){try{if(typeof a>"u")return a;let e=JSON.stringify(a);return JSON.parse(e)}catch(e){throw C.error("Error creating exportable element",a,e),new PixiError("not_json_serializable","Error creating exportable element")}}var D;(e=>{function a(n,i,r,s){try{i=z(i);}catch(h){throw C.error("animate keyframes cannot contain functions or classes"),h}try{r=z(r);}catch(h){throw C.error("animate options cannot contain functions or classes"),h}let c=[];typeof n=="string"?c=[n]:Array.isArray(n)?c=n.map(h=>typeof h=="string"?h:h.label):c=[n.label];let y;Array.isArray(i)?y=new _({sequence:i,options:r},{priority:s,canvasElementAliases:c}):y=new k({keyframes:i,options:r},{priority:s,canvasElementAliases:c});let l=canvas.addTicker(c,y),{forceCompleteBeforeNext:m}=r||{},{completeOnContinue:u=m}=r||{};return l&&u&&canvas.completeTickerOnStepEnd({id:l}),l}e.animate=a;})(D||(D={}));var ut=D;RegisteredTickers.add(k,"motion");RegisteredTickers.add(_,"motion-sequence");export{w as animate,ut as motion,M as motionDriver,ct as timeline};
|
|
1
|
+
import {RegisteredTickers,canvas}from'@drincs/pixi-vn/canvas';import U from'@drincs/pixi-vn/pixi.js';import {animate,motionValue}from'motion';import {PixiError}from'@drincs/pixi-vn/core';var tt=Object.create;var E=Object.defineProperty;var et=Object.getOwnPropertyDescriptor;var nt=Object.getOwnPropertyNames;var it=Object.getPrototypeOf,rt=Object.prototype.hasOwnProperty;var at=(a,e,n)=>e in a?E(a,e,{enumerable:true,configurable:true,writable:true,value:n}):a[e]=n;var q=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var Y=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports);var ot=(a,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of nt(e))!rt.call(a,r)&&r!==n&&E(a,r,{get:()=>e[r],enumerable:!(i=et(e,r))||i.enumerable});return a};var st=(a,e,n)=>(n=a!=null?tt(it(a)):{},ot(E(n,"default",{value:a,enumerable:true}),a));var v=(a,e,n)=>at(a,typeof e!="symbol"?e+"":e,n);var $=Y((P,N)=>{(function(a,e){typeof P=="object"?N.exports=P=e():typeof define=="function"&&define.amd?define([],e):a.CryptoJS=e();})(P,function(){var a=a||(function(e,n){var i;if(typeof window<"u"&&window.crypto&&(i=window.crypto),typeof self<"u"&&self.crypto&&(i=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(i=globalThis.crypto),!i&&typeof window<"u"&&window.msCrypto&&(i=window.msCrypto),!i&&typeof global<"u"&&global.crypto&&(i=global.crypto),!i&&typeof q=="function")try{i=q("crypto");}catch{}var r=function(){if(i){if(typeof i.getRandomValues=="function")try{return i.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof i.randomBytes=="function")try{return i.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||(function(){function t(){}return function(o){var f;return t.prototype=o,f=new t,t.prototype=null,f}})(),c={},y=c.lib={},l=y.Base=(function(){return {extend:function(t){var o=s(this);return t&&o.mixIn(t),(!o.hasOwnProperty("init")||this.init===o.init)&&(o.init=function(){o.$super.init.apply(this,arguments);}),o.init.prototype=o,o.$super=this,o},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var o in t)t.hasOwnProperty(o)&&(this[o]=t[o]);t.hasOwnProperty("toString")&&(this.toString=t.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),m=y.WordArray=l.extend({init:function(t,o){t=this.words=t||[],o!=n?this.sigBytes=o:this.sigBytes=t.length*4;},toString:function(t){return (t||h).stringify(this)},concat:function(t){var o=this.words,f=t.words,p=this.sigBytes,g=t.sigBytes;if(this.clamp(),p%4)for(var T=0;T<g;T++){var W=f[T>>>2]>>>24-T%4*8&255;o[p+T>>>2]|=W<<24-(p+T)%4*8;}else for(var O=0;O<g;O+=4)o[p+O>>>2]=f[O>>>2];return this.sigBytes+=g,this},clamp:function(){var t=this.words,o=this.sigBytes;t[o>>>2]&=4294967295<<32-o%4*8,t.length=e.ceil(o/4);},clone:function(){var t=l.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var o=[],f=0;f<t;f+=4)o.push(r());return new m.init(o,t)}}),u=c.enc={},h=u.Hex={stringify:function(t){for(var o=t.words,f=t.sigBytes,p=[],g=0;g<f;g++){var T=o[g>>>2]>>>24-g%4*8&255;p.push((T>>>4).toString(16)),p.push((T&15).toString(16));}return p.join("")},parse:function(t){for(var o=t.length,f=[],p=0;p<o;p+=2)f[p>>>3]|=parseInt(t.substr(p,2),16)<<24-p%8*4;return new m.init(f,o/2)}},b=u.Latin1={stringify:function(t){for(var o=t.words,f=t.sigBytes,p=[],g=0;g<f;g++){var T=o[g>>>2]>>>24-g%4*8&255;p.push(String.fromCharCode(T));}return p.join("")},parse:function(t){for(var o=t.length,f=[],p=0;p<o;p++)f[p>>>2]|=(t.charCodeAt(p)&255)<<24-p%4*8;return new m.init(f,o)}},A=u.Utf8={stringify:function(t){try{return decodeURIComponent(escape(b.stringify(t)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(t){return b.parse(unescape(encodeURIComponent(t)))}},x=y.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new m.init,this._nDataBytes=0;},_append:function(t){typeof t=="string"&&(t=A.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes;},_process:function(t){var o,f=this._data,p=f.words,g=f.sigBytes,T=this.blockSize,W=T*4,O=g/W;t?O=e.ceil(O):O=e.max((O|0)-this._minBufferSize,0);var I=O*T,D=e.min(I*4,g);if(I){for(var R=0;R<I;R+=T)this._doProcessBlock(p,R);o=p.splice(0,I),f.sigBytes-=D;}return new m.init(o,D)},clone:function(){var t=l.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});y.Hasher=x.extend({cfg:l.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset();},reset:function(){x.reset.call(this),this._doReset();},update:function(t){return this._append(t),this._process(),this},finalize:function(t){t&&this._append(t);var o=this._doFinalize();return o},blockSize:512/32,_createHelper:function(t){return function(o,f){return new t.init(f).finalize(o)}},_createHmacHelper:function(t){return function(o,f){return new d.HMAC.init(t,f).finalize(o)}}});var d=c.algo={};return c})(Math);return a});});var L=Y((j,K)=>{(function(a,e){typeof j=="object"?K.exports=j=e($()):typeof define=="function"&&define.amd?define(["./core"],e):e(a.CryptoJS);})(j,function(a){return (function(){var e=a,n=e.lib,i=n.WordArray,r=n.Hasher,s=e.algo,c=[],y=s.SHA1=r.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(l,m){for(var u=this._hash.words,h=u[0],b=u[1],A=u[2],x=u[3],B=u[4],d=0;d<80;d++){if(d<16)c[d]=l[m+d]|0;else {var t=c[d-3]^c[d-8]^c[d-14]^c[d-16];c[d]=t<<1|t>>>31;}var o=(h<<5|h>>>27)+B+c[d];d<20?o+=(b&A|~b&x)+1518500249:d<40?o+=(b^A^x)+1859775393:d<60?o+=(b&A|b&x|A&x)-1894007588:o+=(b^A^x)-899497514,B=x,x=A,A=b<<30|b>>>2,b=h,h=o;}u[0]=u[0]+h|0,u[1]=u[1]+b|0,u[2]=u[2]+A|0,u[3]=u[3]+x|0,u[4]=u[4]+B|0;},_doFinalize:function(){var l=this._data,m=l.words,u=this._nDataBytes*8,h=l.sigBytes*8;return m[h>>>5]|=128<<24-h%32,m[(h+64>>>9<<4)+14]=Math.floor(u/4294967296),m[(h+64>>>9<<4)+15]=u,l.sigBytes=m.length*4,this._process(),this._hash},clone:function(){var l=r.clone.call(this);return l._hash=this._hash.clone(),l}});e.SHA1=r._createHelper(y),e.HmacSHA1=r._createHmacHelper(y);})(),a.SHA1});});var H=(a,e=100)=>{let n=null;return (...i)=>{n&&clearTimeout(n),n=setTimeout(()=>a(...i),e);}};var M=a=>e=>{let n=({lastTime:i})=>e(i);return {start:(i=true)=>{a.add(n),a.start();},stop:()=>a.remove(n),now:()=>a.lastTime}};function C(a,e,n){if(Array.isArray(a)&&Array.isArray(a[0])){e&&"repeat"in e&&e?.repeat===null&&(e.repeat=1/0),a.forEach(c=>{if(Array.isArray(c)&&c.length===3){let[y,l,m]=c;m&&"repeat"in m&&m?.repeat===null&&(m.repeat=1/0);}});let{ticker:i=new U.Ticker,driver:r=M(i),...s}=e||{};return animate(a,{driver:r,...s})}else {n&&"repeat"in n&&n?.repeat===null&&(n.repeat=1/0);let{ticker:i=new U.Ticker,driver:r=M(i),...s}=n||{};return animate(a,e,{driver:r,...s})}}function ct(a,e){let n={x:0},i=[];return a.forEach((r,s)=>{let{onComplete:c,onPlay:y,...l}=r;if(y){let m=motionValue(s);m.on("change",H(y,50)),i.push([m,s+1,{duration:.01}]);}if(i.push([n,{x:s+1},l]),c){let m=motionValue(s);m.on("change",H(c,50)),i.push([m,s+1,{duration:.01}]);}}),C(i,e)}var V=st(L());var S=class{constructor(e,n){v(this,"id");v(this,"_args");v(this,"duration");v(this,"priority");v(this,"ticker",new U.Ticker);v(this,"_animation");v(this,"stopped",false);v(this,"_paused",false);v(this,"canvasElementAliases",[]);v(this,"timeout",50);v(this,"onComplete",()=>{let e=this.id,n=this._args.options?.aliasToRemoveAfter||[];typeof n=="string"&&(n=[n]);let i=this._args.options?.tickerAliasToResume||[];typeof i=="string"&&(i=[i]);let r=this._args.options?.tickerIdToResume||[];typeof r=="string"&&(r=[r]),canvas.onTickerComplete(e,{aliasToRemoveAfter:n,tickerAliasToResume:i,tickerIdToResume:r,stopTicker:false});});let{duration:i,priority:r,id:s=this.generateTickerId(n),canvasElementAliases:c=[]}=n||{};this._args=e,this.duration=i,this.priority=r,this.id=s,this.canvasElementAliases=c;}get args(){return {...this._args,time:this._animation?.time}}getItemByAlias(e){if(!this.canvasElementAliases.includes(e))return;let n=canvas.find(e);if(n)return n}generateTickerId(...e){try{return (0,V.default)(JSON.stringify(e)).toString()+"_motion_"+Math.random().toString(36).substring(7)}catch(n){throw new PixiError("not_json_serializable",`Error to generate ticker id: ${n}`)}}async complete(){this.animation.complete(),await new Promise(e=>setTimeout(e,this.timeout));}stop(){this.stopped=true,this.animation.stop();}start(){this.args.options?.autoplay!==false&&(this._paused=false,this.animation.play());}createItem(e){return new Proxy({alias:e},{set:({alias:n},i,r)=>{if(this.stopped||this._paused||this._args.startState&&this._args.startState[i]===r)return true;let s=this.getItemByAlias(n);if(!s)return true;switch(i){case "pivotX":s.pivot.x=r;break;case "pivotY":s.pivot.y=r;break;case "scaleX":s.scale.x=r;break;case "scaleY":s.scale.y=r;break;default:s[i]=r;break}return true},get:({alias:n},i)=>{if(this._args.startState||(this._args.startState={}),i in this._args.startState)return this._args.startState[i];let r=this.getItemByAlias(n);if(!r)return;let s;switch(i){case "pivotX":s=r.pivot.x;break;case "pivotY":s=r.pivot.y;break;case "scaleX":s=r.scale.x;break;case "scaleY":s=r.scale.y;break;default:s=r[i];break}return this._args.startState={...this._args.startState,[i]:s},s},has:({alias:n},i)=>{let r=this.getItemByAlias(n);if(!r)return false;switch(i){case "pivotX":return "pivot"in r&&"x"in r.pivot;case "pivotY":return "pivot"in r&&"y"in r.pivot;case "scaleX":return "scale"in r&&"x"in r.scale;case "scaleY":return "scale"in r&&"y"in r.scale;default:return i in r}},ownKeys:({alias:n})=>{let i=this.getItemByAlias(n);return i?Object.keys(i):[]}})}pause(){this.animation&&(this._paused=true,this.animation.pause());}play(){this._paused=false,this.animation.play();}get paused(){return this.animation?this.animation.state==="paused":true}};var _=class extends S{constructor(){super(...arguments);v(this,"alias","motion-sequence");}get animation(){let n=this._animation;if(n)return n;let i=this.canvasElementAliases[0],r=this.createItem(i),s=this._args.sequence.map((c,y)=>[r,c[0],{...c[1]||{},ticker:this.ticker,onComplete:y===this._args.sequence.length-1?()=>this.onComplete():void 0}]);return n=C(s,this._args.options),this._args.time&&(this.animation.time=this._args.time),this._animation=n,n}};var k=class extends S{constructor(){super(...arguments);v(this,"alias","motion");}get animation(){let n=this._animation;if(n)return n;let i=this.canvasElementAliases.map(r=>this.createItem(r));return n=C(i,this._args.keyframes,{...this._args.options,onComplete:()=>this.onComplete(),ticker:this.ticker}),this._args.time&&(n.time=this._args.time),this._animation=n,n}};var w;(r=>(r.log=(s,...c)=>console.log(`[Pixi\u2019VN] ${s}`,...c),r.warn=(s,...c)=>console.warn(`[Pixi\u2019VN] ${s}`,...c),r.error=(s,...c)=>console.error(`[Pixi\u2019VN] ${s}`,...c),r.info=(s,...c)=>console.info(`[Pixi\u2019VN] ${s}`,...c)))(w||={});function z(a){try{if(typeof a>"u")return a;let e=JSON.stringify(a);return JSON.parse(e)}catch(e){throw w.error("Error creating exportable element",a,e),new PixiError("not_json_serializable","Error creating exportable element")}}var Q;(e=>{function a(n,i,r,s){try{i=z(i);}catch(h){throw w.error("animate keyframes cannot contain functions or classes"),h}try{r=z(r);}catch(h){throw w.error("animate options cannot contain functions or classes"),h}let c=[];typeof n=="string"?c=[n]:Array.isArray(n)?c=n.map(h=>typeof h=="string"?h:h.label):c=[n.label];let y;Array.isArray(i)?y=new _({sequence:i,options:r},{priority:s,canvasElementAliases:c}):y=new k({keyframes:i,options:r},{priority:s,canvasElementAliases:c});let l=canvas.addTicker(c,y),{forceCompleteBeforeNext:m}=r||{},{completeOnContinue:u=m}=r||{};return l&&u&&canvas.completeTickerOnStepEnd({id:l}),l}e.animate=a;})(Q||={});var ut=Q;RegisteredTickers.add(k,"motion");RegisteredTickers.add(_,"motion-sequence");export{C as animate,ut as motion,M as motionDriver,ct as timeline};
|
package/dist/narration.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var core=require('@drincs/pixi-vn/core');var mt=Object.create;var Be=Object.defineProperty;var St=Object.getOwnPropertyDescriptor;var gt=Object.getOwnPropertyNames;var Lt=Object.getPrototypeOf,Tt=Object.prototype.hasOwnProperty;var et=h=>{throw TypeError(h)};var _t=(h,e,t)=>e in h?Be(h,e,{enumerable:true,configurable:true,writable:true,value:t}):h[e]=t;var je=(h=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(h,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):h)(function(h){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+h+'" is not supported')});var tt=(h,e)=>()=>(e||h((e={exports:{}}).exports,e),e.exports);var Et=(h,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of gt(e))!Tt.call(h,i)&&i!==t&&Be(h,i,{get:()=>e[i],enumerable:!(n=St(e,i))||n.enumerable});return h};var Ct=(h,e,t)=>(t=h!=null?mt(Lt(h)):{},Et(Be(t,"default",{value:h,enumerable:true}),h));var E=(h,e,t)=>_t(h,typeof e!="symbol"?e+"":e,t),ke=(h,e,t)=>e.has(h)||et("Cannot "+t);var r=(h,e,t)=>(ke(h,e,"read from private field"),t?t.call(h):e.get(h)),x=(h,e,t)=>e.has(h)?et("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(h):e.set(h,t),S=(h,e,t,n)=>(ke(h,e,"write to private field"),e.set(h,t),t),f=(h,e,t)=>(ke(h,e,"access private method"),t);var Ye=(h,e,t,n)=>({set _(i){S(h,e,i);},get _(){return r(h,e,n)}});var ut=tt((He,ct)=>{(function(h,e){typeof He=="object"?ct.exports=He=e():typeof define=="function"&&define.amd?define([],e):h.CryptoJS=e();})(He,function(){var h=h||(function(e,t){var n;if(typeof window<"u"&&window.crypto&&(n=window.crypto),typeof self<"u"&&self.crypto&&(n=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(n=globalThis.crypto),!n&&typeof window<"u"&&window.msCrypto&&(n=window.msCrypto),!n&&typeof global<"u"&&global.crypto&&(n=global.crypto),!n&&typeof je=="function")try{n=je("crypto");}catch{}var i=function(){if(n){if(typeof n.getRandomValues=="function")try{return n.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof n.randomBytes=="function")try{return n.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||(function(){function a(){}return function(d){var O;return a.prototype=d,O=new a,a.prototype=null,O}})(),o={},l=o.lib={},p=l.Base=(function(){return {extend:function(a){var d=s(this);return a&&d.mixIn(a),(!d.hasOwnProperty("init")||this.init===d.init)&&(d.init=function(){d.$super.init.apply(this,arguments);}),d.init.prototype=d,d.$super=this,d},create:function(){var a=this.extend();return a.init.apply(a,arguments),a},init:function(){},mixIn:function(a){for(var d in a)a.hasOwnProperty(d)&&(this[d]=a[d]);a.hasOwnProperty("toString")&&(this.toString=a.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),m=l.WordArray=p.extend({init:function(a,d){a=this.words=a||[],d!=t?this.sigBytes=d:this.sigBytes=a.length*4;},toString:function(a){return (a||T).stringify(this)},concat:function(a){var d=this.words,O=a.words,I=this.sigBytes,v=a.sigBytes;if(this.clamp(),I%4)for(var Y=0;Y<v;Y++){var le=O[Y>>>2]>>>24-Y%4*8&255;d[I+Y>>>2]|=le<<24-(I+Y)%4*8;}else for(var H=0;H<v;H+=4)d[I+H>>>2]=O[H>>>2];return this.sigBytes+=v,this},clamp:function(){var a=this.words,d=this.sigBytes;a[d>>>2]&=4294967295<<32-d%4*8,a.length=e.ceil(d/4);},clone:function(){var a=p.clone.call(this);return a.words=this.words.slice(0),a},random:function(a){for(var d=[],O=0;O<a;O+=4)d.push(i());return new m.init(d,a)}}),u=o.enc={},T=u.Hex={stringify:function(a){for(var d=a.words,O=a.sigBytes,I=[],v=0;v<O;v++){var Y=d[v>>>2]>>>24-v%4*8&255;I.push((Y>>>4).toString(16)),I.push((Y&15).toString(16));}return I.join("")},parse:function(a){for(var d=a.length,O=[],I=0;I<d;I+=2)O[I>>>3]|=parseInt(a.substr(I,2),16)<<24-I%8*4;return new m.init(O,d/2)}},D=u.Latin1={stringify:function(a){for(var d=a.words,O=a.sigBytes,I=[],v=0;v<O;v++){var Y=d[v>>>2]>>>24-v%4*8&255;I.push(String.fromCharCode(Y));}return I.join("")},parse:function(a){for(var d=a.length,O=[],I=0;I<d;I++)O[I>>>2]|=(a.charCodeAt(I)&255)<<24-I%4*8;return new m.init(O,d)}},P=u.Utf8={stringify:function(a){try{return decodeURIComponent(escape(D.stringify(a)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(a){return D.parse(unescape(encodeURIComponent(a)))}},U=l.BufferedBlockAlgorithm=p.extend({reset:function(){this._data=new m.init,this._nDataBytes=0;},_append:function(a){typeof a=="string"&&(a=P.parse(a)),this._data.concat(a),this._nDataBytes+=a.sigBytes;},_process:function(a){var d,O=this._data,I=O.words,v=O.sigBytes,Y=this.blockSize,le=Y*4,H=v/le;a?H=e.ceil(H):H=e.max((H|0)-this._minBufferSize,0);var Q=H*Y,Te=e.min(Q*4,v);if(Q){for(var We=0;We<Q;We+=Y)this._doProcessBlock(I,We);d=I.splice(0,Q),O.sigBytes-=Te;}return new m.init(d,Te)},clone:function(){var a=p.clone.call(this);return a._data=this._data.clone(),a},_minBufferSize:0});l.Hasher=U.extend({cfg:p.extend(),init:function(a){this.cfg=this.cfg.extend(a),this.reset();},reset:function(){U.reset.call(this),this._doReset();},update:function(a){return this._append(a),this._process(),this},finalize:function(a){a&&this._append(a);var d=this._doFinalize();return d},blockSize:512/32,_createHelper:function(a){return function(d,O){return new a.init(O).finalize(d)}},_createHmacHelper:function(a){return function(d,O){return new C.HMAC.init(a,O).finalize(d)}}});var C=o.algo={};return o})(Math);return h});});var ft=tt((Ke,dt)=>{(function(h,e){typeof Ke=="object"?dt.exports=Ke=e(ut()):typeof define=="function"&&define.amd?define(["./core"],e):e(h.CryptoJS);})(Ke,function(h){return (function(){var e=h,t=e.lib,n=t.WordArray,i=t.Hasher,s=e.algo,o=[],l=s.SHA1=i.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(p,m){for(var u=this._hash.words,T=u[0],D=u[1],P=u[2],U=u[3],A=u[4],C=0;C<80;C++){if(C<16)o[C]=p[m+C]|0;else {var a=o[C-3]^o[C-8]^o[C-14]^o[C-16];o[C]=a<<1|a>>>31;}var d=(T<<5|T>>>27)+A+o[C];C<20?d+=(D&P|~D&U)+1518500249:C<40?d+=(D^P^U)+1859775393:C<60?d+=(D&P|D&U|P&U)-1894007588:d+=(D^P^U)-899497514,A=U,U=P,P=D<<30|D>>>2,D=T,T=d;}u[0]=u[0]+T|0,u[1]=u[1]+D|0,u[2]=u[2]+P|0,u[3]=u[3]+U|0,u[4]=u[4]+A|0;},_doFinalize:function(){var p=this._data,m=p.words,u=this._nDataBytes*8,T=p.sigBytes*8;return m[T>>>5]|=128<<24-T%32,m[(T+64>>>9<<4)+14]=Math.floor(u/4294967296),m[(T+64>>>9<<4)+15]=u,p.sigBytes=m.length*4,this._process(),this._hash},clone:function(){var p=i.clone.call(this);return p._hash=this._hash.clone(),p}});e.SHA1=i._createHelper(l),e.HmacSHA1=i._createHmacHelper(l);})(),h.SHA1});});var w="narration";var R={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 It=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,st=new Set,$e=typeof process=="object"&&process?process:{},ot=(h,e,t,n)=>{typeof $e.emitWarning=="function"?$e.emitWarning(h,e,t,n):console.error(`[${t}] ${e}: ${h}`);},ze=globalThis.AbortController,rt=globalThis.AbortSignal;if(typeof ze>"u"){rt=class{constructor(){E(this,"onabort");E(this,"_onabort",[]);E(this,"reason");E(this,"aborted",false);}addEventListener(t,n){this._onabort.push(n);}},ze=class{constructor(){E(this,"signal",new rt);e();}abort(t){if(!this.signal.aborted){this.signal.reason=t,this.signal.aborted=true;for(let n of this.signal._onabort)n(t);this.signal.onabort?.(t);}}};let h=$e.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{h&&(h=false,ot("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 Ot=h=>!st.has(h);var de=h=>h&&h===Math.floor(h)&&h>0&&isFinite(h),at=h=>de(h)?h<=Math.pow(2,8)?Uint8Array:h<=Math.pow(2,16)?Uint16Array:h<=Math.pow(2,32)?Uint32Array:h<=Number.MAX_SAFE_INTEGER?Fe:null:null,Fe=class extends Array{constructor(h){super(h),this.fill(0);}},he,_e,Rt=(he=class{constructor(e,t){E(this,"heap");E(this,"length");if(!r(he,_e))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0;}static create(e){let t=at(e);if(!t)return [];S(he,_e,true);let n=new he(e,t);return S(he,_e,false),n}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},_e=new WeakMap,x(he,_e,false),he),nt,it,J,j,Z,Se,ee,Ee,Ce,te,V,re,F,N,_,W,k,K,G,ne,z,ie,se,$,q,oe,me,B,Ie,c,qe,ge,pe,Ne,X,ht,Le,Oe,De,fe,be,Xe,Ve,Ge,M,Je,Me,ye,Qe,Re,lt=(Re=class{constructor(e){x(this,c);x(this,J);x(this,j);x(this,Z);x(this,Se);x(this,ee);x(this,Ee);x(this,Ce);x(this,te);E(this,"ttl");E(this,"ttlResolution");E(this,"ttlAutopurge");E(this,"updateAgeOnGet");E(this,"updateAgeOnHas");E(this,"allowStale");E(this,"noDisposeOnSet");E(this,"noUpdateTTL");E(this,"maxEntrySize");E(this,"sizeCalculation");E(this,"noDeleteOnFetchRejection");E(this,"noDeleteOnStaleGet");E(this,"allowStaleOnFetchAbort");E(this,"allowStaleOnFetchRejection");E(this,"ignoreFetchAbort");x(this,V);x(this,re);x(this,F);x(this,N);x(this,_);x(this,W);x(this,k);x(this,K);x(this,G);x(this,ne);x(this,z);x(this,ie);x(this,se);x(this,$);x(this,q);x(this,oe);x(this,me);x(this,B);x(this,Ie);x(this,ge,()=>{});x(this,pe,()=>{});x(this,Ne,()=>{});x(this,X,()=>false);x(this,Le,e=>{});x(this,Oe,(e,t,n)=>{});x(this,De,(e,t,n,i)=>{if(n||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});E(this,nt,"LRUCache");let{max:t=0,ttl:n,ttlResolution:i=1,ttlAutopurge:s,updateAgeOnGet:o,updateAgeOnHas:l,allowStale:p,dispose:m,onInsert:u,disposeAfter:T,noDisposeOnSet:D,noUpdateTTL:P,maxSize:U=0,maxEntrySize:A=0,sizeCalculation:C,fetchMethod:a,memoMethod:d,noDeleteOnFetchRejection:O,noDeleteOnStaleGet:I,allowStaleOnFetchRejection:v,allowStaleOnFetchAbort:Y,ignoreFetchAbort:le,perf:H}=e;if(H!==void 0&&typeof H?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(S(this,te,H??It),t!==0&&!de(t))throw new TypeError("max option must be a nonnegative integer");let Q=t?at(t):Array;if(!Q)throw new Error("invalid max value: "+t);if(S(this,J,t),S(this,j,U),this.maxEntrySize=A||r(this,j),this.sizeCalculation=C,this.sizeCalculation){if(!r(this,j)&&!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(d!==void 0&&typeof d!="function")throw new TypeError("memoMethod must be a function if defined");if(S(this,Ce,d),a!==void 0&&typeof a!="function")throw new TypeError("fetchMethod must be a function if specified");if(S(this,Ee,a),S(this,me,!!a),S(this,F,new Map),S(this,N,new Array(t).fill(void 0)),S(this,_,new Array(t).fill(void 0)),S(this,W,new Q(t)),S(this,k,new Q(t)),S(this,K,0),S(this,G,0),S(this,ne,Rt.create(t)),S(this,V,0),S(this,re,0),typeof m=="function"&&S(this,Z,m),typeof u=="function"&&S(this,Se,u),typeof T=="function"?(S(this,ee,T),S(this,z,[])):(S(this,ee,void 0),S(this,z,void 0)),S(this,oe,!!r(this,Z)),S(this,Ie,!!r(this,Se)),S(this,B,!!r(this,ee)),this.noDisposeOnSet=!!D,this.noUpdateTTL=!!P,this.noDeleteOnFetchRejection=!!O,this.allowStaleOnFetchRejection=!!v,this.allowStaleOnFetchAbort=!!Y,this.ignoreFetchAbort=!!le,this.maxEntrySize!==0){if(r(this,j)!==0&&!de(r(this,j)))throw new TypeError("maxSize must be a positive integer if specified");if(!de(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");f(this,c,ht).call(this);}if(this.allowStale=!!p,this.noDeleteOnStaleGet=!!I,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!l,this.ttlResolution=de(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=n||0,this.ttl){if(!de(this.ttl))throw new TypeError("ttl must be a positive integer if specified");f(this,c,qe).call(this);}if(r(this,J)===0&&this.ttl===0&&r(this,j)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!r(this,J)&&!r(this,j)){let Te="LRU_CACHE_UNBOUNDED";Ot(Te)&&(st.add(Te),ot("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Te,Re));}}get perf(){return r(this,te)}static unsafeExposeInternals(e){return {starts:r(e,se),ttls:r(e,$),autopurgeTimers:r(e,q),sizes:r(e,ie),keyMap:r(e,F),keyList:r(e,N),valList:r(e,_),next:r(e,W),prev:r(e,k),get head(){return r(e,K)},get tail(){return r(e,G)},free:r(e,ne),isBackgroundFetch:t=>{var n;return f(n=e,c,M).call(n,t)},backgroundFetch:(t,n,i,s)=>{var o;return f(o=e,c,Ge).call(o,t,n,i,s)},moveToTail:t=>{var n;return f(n=e,c,Me).call(n,t)},indexes:t=>{var n;return f(n=e,c,fe).call(n,t)},rindexes:t=>{var n;return f(n=e,c,be).call(n,t)},isStale:t=>{var n;return r(n=e,X).call(n,t)}}}get max(){return r(this,J)}get maxSize(){return r(this,j)}get calculatedSize(){return r(this,re)}get size(){return r(this,V)}get fetchMethod(){return r(this,Ee)}get memoMethod(){return r(this,Ce)}get dispose(){return r(this,Z)}get onInsert(){return r(this,Se)}get disposeAfter(){return r(this,ee)}getRemainingTTL(e){return r(this,F).has(e)?1/0:0}*entries(){for(let e of f(this,c,fe).call(this))r(this,_)[e]!==void 0&&r(this,N)[e]!==void 0&&!f(this,c,M).call(this,r(this,_)[e])&&(yield [r(this,N)[e],r(this,_)[e]]);}*rentries(){for(let e of f(this,c,be).call(this))r(this,_)[e]!==void 0&&r(this,N)[e]!==void 0&&!f(this,c,M).call(this,r(this,_)[e])&&(yield [r(this,N)[e],r(this,_)[e]]);}*keys(){for(let e of f(this,c,fe).call(this)){let t=r(this,N)[e];t!==void 0&&!f(this,c,M).call(this,r(this,_)[e])&&(yield t);}}*rkeys(){for(let e of f(this,c,be).call(this)){let t=r(this,N)[e];t!==void 0&&!f(this,c,M).call(this,r(this,_)[e])&&(yield t);}}*values(){for(let e of f(this,c,fe).call(this))r(this,_)[e]!==void 0&&!f(this,c,M).call(this,r(this,_)[e])&&(yield r(this,_)[e]);}*rvalues(){for(let e of f(this,c,be).call(this))r(this,_)[e]!==void 0&&!f(this,c,M).call(this,r(this,_)[e])&&(yield r(this,_)[e]);}[(it=Symbol.iterator,nt=Symbol.toStringTag,it)](){return this.entries()}find(e,t={}){for(let n of f(this,c,fe).call(this)){let i=r(this,_)[n],s=f(this,c,M).call(this,i)?i.__staleWhileFetching:i;if(s!==void 0&&e(s,r(this,N)[n],this))return this.get(r(this,N)[n],t)}}forEach(e,t=this){for(let n of f(this,c,fe).call(this)){let i=r(this,_)[n],s=f(this,c,M).call(this,i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,r(this,N)[n],this);}}rforEach(e,t=this){for(let n of f(this,c,be).call(this)){let i=r(this,_)[n],s=f(this,c,M).call(this,i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,r(this,N)[n],this);}}purgeStale(){let e=false;for(let t of f(this,c,be).call(this,{allowStale:true}))r(this,X).call(this,t)&&(f(this,c,ye).call(this,r(this,N)[t],"expire"),e=true);return e}info(e){let t=r(this,F).get(e);if(t===void 0)return;let n=r(this,_)[t],i=f(this,c,M).call(this,n)?n.__staleWhileFetching:n;if(i===void 0)return;let s={value:i};if(r(this,$)&&r(this,se)){let o=r(this,$)[t],l=r(this,se)[t];if(o&&l){let p=o-(r(this,te).now()-l);s.ttl=p,s.start=Date.now();}}return r(this,ie)&&(s.size=r(this,ie)[t]),s}dump(){let e=[];for(let t of f(this,c,fe).call(this,{allowStale:true})){let n=r(this,N)[t],i=r(this,_)[t],s=f(this,c,M).call(this,i)?i.__staleWhileFetching:i;if(s===void 0||n===void 0)continue;let o={value:s};if(r(this,$)&&r(this,se)){o.ttl=r(this,$)[t];let l=r(this,te).now()-r(this,se)[t];o.start=Math.floor(Date.now()-l);}r(this,ie)&&(o.size=r(this,ie)[t]),e.unshift([n,o]);}return e}load(e){this.clear();for(let[t,n]of e){if(n.start){let i=Date.now()-n.start;n.start=r(this,te).now()-i;}this.set(t,n.value,n);}}set(e,t,n={}){var D,P,U,A;if(t===void 0)return this.delete(e),this;let{ttl:i=this.ttl,start:s,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:l=this.sizeCalculation,status:p}=n,{noUpdateTTL:m=this.noUpdateTTL}=n,u=r(this,De).call(this,e,t,n.size||0,l);if(this.maxEntrySize&&u>this.maxEntrySize)return p&&(p.set="miss",p.maxEntrySizeExceeded=true),f(this,c,ye).call(this,e,"set"),this;let T=r(this,V)===0?void 0:r(this,F).get(e);if(T===void 0)T=r(this,V)===0?r(this,G):r(this,ne).length!==0?r(this,ne).pop():r(this,V)===r(this,J)?f(this,c,Ve).call(this,false):r(this,V),r(this,N)[T]=e,r(this,_)[T]=t,r(this,F).set(e,T),r(this,W)[r(this,G)]=T,r(this,k)[T]=r(this,G),S(this,G,T),Ye(this,V)._++,r(this,Oe).call(this,T,u,p),p&&(p.set="add"),m=false,r(this,Ie)&&((D=r(this,Se))==null||D.call(this,t,e,"add"));else {f(this,c,Me).call(this,T);let C=r(this,_)[T];if(t!==C){if(r(this,me)&&f(this,c,M).call(this,C)){C.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:a}=C;a!==void 0&&!o&&(r(this,oe)&&((P=r(this,Z))==null||P.call(this,a,e,"set")),r(this,B)&&r(this,z)?.push([a,e,"set"]));}else o||(r(this,oe)&&((U=r(this,Z))==null||U.call(this,C,e,"set")),r(this,B)&&r(this,z)?.push([C,e,"set"]));if(r(this,Le).call(this,T),r(this,Oe).call(this,T,u,p),r(this,_)[T]=t,p){p.set="replace";let a=C&&f(this,c,M).call(this,C)?C.__staleWhileFetching:C;a!==void 0&&(p.oldValue=a);}}else p&&(p.set="update");r(this,Ie)&&this.onInsert?.(t,e,t===C?"update":"replace");}if(i!==0&&!r(this,$)&&f(this,c,qe).call(this),r(this,$)&&(m||r(this,Ne).call(this,T,i,s),p&&r(this,pe).call(this,p,T)),!o&&r(this,B)&&r(this,z)){let C=r(this,z),a;for(;a=C?.shift();)(A=r(this,ee))==null||A.call(this,...a);}return this}pop(){var e;try{for(;r(this,V);){let t=r(this,_)[r(this,K)];if(f(this,c,Ve).call(this,!0),f(this,c,M).call(this,t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(r(this,B)&&r(this,z)){let t=r(this,z),n;for(;n=t?.shift();)(e=r(this,ee))==null||e.call(this,...n);}}}has(e,t={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:i}=t,s=r(this,F).get(e);if(s!==void 0){let o=r(this,_)[s];if(f(this,c,M).call(this,o)&&o.__staleWhileFetching===void 0)return false;if(r(this,X).call(this,s))i&&(i.has="stale",r(this,pe).call(this,i,s));else return n&&r(this,ge).call(this,s),i&&(i.has="hit",r(this,pe).call(this,i,s)),true}else i&&(i.has="miss");return false}peek(e,t={}){let{allowStale:n=this.allowStale}=t,i=r(this,F).get(e);if(i===void 0||!n&&r(this,X).call(this,i))return;let s=r(this,_)[i];return f(this,c,M).call(this,s)?s.__staleWhileFetching:s}async fetch(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:l=this.noDisposeOnSet,size:p=0,sizeCalculation:m=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:T=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:D=this.allowStaleOnFetchRejection,ignoreFetchAbort:P=this.ignoreFetchAbort,allowStaleOnFetchAbort:U=this.allowStaleOnFetchAbort,context:A,forceRefresh:C=false,status:a,signal:d}=t;if(!r(this,me))return a&&(a.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:a});let O={allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:o,noDisposeOnSet:l,size:p,sizeCalculation:m,noUpdateTTL:u,noDeleteOnFetchRejection:T,allowStaleOnFetchRejection:D,allowStaleOnFetchAbort:U,ignoreFetchAbort:P,status:a,signal:d},I=r(this,F).get(e);if(I===void 0){a&&(a.fetch="miss");let v=f(this,c,Ge).call(this,e,I,O,A);return v.__returned=v}else {let v=r(this,_)[I];if(f(this,c,M).call(this,v)){let Q=n&&v.__staleWhileFetching!==void 0;return a&&(a.fetch="inflight",Q&&(a.returnedStale=true)),Q?v.__staleWhileFetching:v.__returned=v}let Y=r(this,X).call(this,I);if(!C&&!Y)return a&&(a.fetch="hit"),f(this,c,Me).call(this,I),i&&r(this,ge).call(this,I),a&&r(this,pe).call(this,a,I),v;let le=f(this,c,Ge).call(this,e,I,O,A),H=le.__staleWhileFetching!==void 0&&n;return a&&(a.fetch=Y?"stale":"refresh",H&&Y&&(a.returnedStale=true)),H?le.__staleWhileFetching:le.__returned=le}}async forceFetch(e,t={}){let n=await this.fetch(e,t);if(n===void 0)throw new Error("fetch() returned undefined");return n}memo(e,t={}){let n=r(this,Ce);if(!n)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:s,...o}=t,l=this.get(e,o);if(!s&&l!==void 0)return l;let p=n(e,l,{options:o,context:i});return this.set(e,p,o),p}get(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:o}=t,l=r(this,F).get(e);if(l!==void 0){let p=r(this,_)[l],m=f(this,c,M).call(this,p);return o&&r(this,pe).call(this,o,l),r(this,X).call(this,l)?(o&&(o.get="stale"),m?(o&&n&&p.__staleWhileFetching!==void 0&&(o.returnedStale=true),n?p.__staleWhileFetching:void 0):(s||f(this,c,ye).call(this,e,"expire"),o&&n&&(o.returnedStale=true),n?p:void 0)):(o&&(o.get="hit"),m?p.__staleWhileFetching:(f(this,c,Me).call(this,l),i&&r(this,ge).call(this,l),p))}else o&&(o.get="miss");}delete(e){return f(this,c,ye).call(this,e,"delete")}clear(){return f(this,c,Qe).call(this,"delete")}},J=new WeakMap,j=new WeakMap,Z=new WeakMap,Se=new WeakMap,ee=new WeakMap,Ee=new WeakMap,Ce=new WeakMap,te=new WeakMap,V=new WeakMap,re=new WeakMap,F=new WeakMap,N=new WeakMap,_=new WeakMap,W=new WeakMap,k=new WeakMap,K=new WeakMap,G=new WeakMap,ne=new WeakMap,z=new WeakMap,ie=new WeakMap,se=new WeakMap,$=new WeakMap,q=new WeakMap,oe=new WeakMap,me=new WeakMap,B=new WeakMap,Ie=new WeakMap,c=new WeakSet,qe=function(){let e=new Fe(r(this,J)),t=new Fe(r(this,J));S(this,$,e),S(this,se,t);let n=this.ttlAutopurge?new Array(r(this,J)):void 0;S(this,q,n),S(this,Ne,(l,p,m=r(this,te).now())=>{t[l]=p!==0?m:0,e[l]=p,i(l,p);}),S(this,ge,l=>{t[l]=e[l]!==0?r(this,te).now():0,i(l,e[l]);});let i=this.ttlAutopurge?(l,p)=>{if(n?.[l]&&(clearTimeout(n[l]),n[l]=void 0),p&&p!==0&&n){let m=setTimeout(()=>{r(this,X).call(this,l)&&f(this,c,ye).call(this,r(this,N)[l],"expire");},p+1);m.unref&&m.unref(),n[l]=m;}}:()=>{};S(this,pe,(l,p)=>{if(e[p]){let m=e[p],u=t[p];if(!m||!u)return;l.ttl=m,l.start=u,l.now=s||o();let T=l.now-u;l.remainingTTL=m-T;}});let s=0,o=()=>{let l=r(this,te).now();if(this.ttlResolution>0){s=l;let p=setTimeout(()=>s=0,this.ttlResolution);p.unref&&p.unref();}return l};this.getRemainingTTL=l=>{let p=r(this,F).get(l);if(p===void 0)return 0;let m=e[p],u=t[p];if(!m||!u)return 1/0;let T=(s||o())-u;return m-T},S(this,X,l=>{let p=t[l],m=e[l];return !!m&&!!p&&(s||o())-p>m});},ge=new WeakMap,pe=new WeakMap,Ne=new WeakMap,X=new WeakMap,ht=function(){let e=new Fe(r(this,J));S(this,re,0),S(this,ie,e),S(this,Le,t=>{S(this,re,r(this,re)-e[t]),e[t]=0;}),S(this,De,(t,n,i,s)=>{if(f(this,c,M).call(this,n))return 0;if(!de(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(n,t),!de(i))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 i}),S(this,Oe,(t,n,i)=>{if(e[t]=n,r(this,j)){let s=r(this,j)-e[t];for(;r(this,re)>s;)f(this,c,Ve).call(this,true);}S(this,re,r(this,re)+e[t]),i&&(i.entrySize=n,i.totalCalculatedSize=r(this,re));});},Le=new WeakMap,Oe=new WeakMap,De=new WeakMap,fe=function*({allowStale:e=this.allowStale}={}){if(r(this,V))for(let t=r(this,G);!(!f(this,c,Xe).call(this,t)||((e||!r(this,X).call(this,t))&&(yield t),t===r(this,K)));)t=r(this,k)[t];},be=function*({allowStale:e=this.allowStale}={}){if(r(this,V))for(let t=r(this,K);!(!f(this,c,Xe).call(this,t)||((e||!r(this,X).call(this,t))&&(yield t),t===r(this,G)));)t=r(this,W)[t];},Xe=function(e){return e!==void 0&&r(this,F).get(r(this,N)[e])===e},Ve=function(e){var s;let t=r(this,K),n=r(this,N)[t],i=r(this,_)[t];return r(this,me)&&f(this,c,M).call(this,i)?i.__abortController.abort(new Error("evicted")):(r(this,oe)||r(this,B))&&(r(this,oe)&&((s=r(this,Z))==null||s.call(this,i,n,"evict")),r(this,B)&&r(this,z)?.push([i,n,"evict"])),r(this,Le).call(this,t),r(this,q)?.[t]&&(clearTimeout(r(this,q)[t]),r(this,q)[t]=void 0),e&&(r(this,N)[t]=void 0,r(this,_)[t]=void 0,r(this,ne).push(t)),r(this,V)===1?(S(this,K,S(this,G,0)),r(this,ne).length=0):S(this,K,r(this,W)[t]),r(this,F).delete(n),Ye(this,V)._--,t},Ge=function(e,t,n,i){let s=t===void 0?void 0:r(this,_)[t];if(f(this,c,M).call(this,s))return s;let o=new ze,{signal:l}=n;l?.addEventListener("abort",()=>o.abort(l.reason),{signal:o.signal});let p={signal:o.signal,options:n,context:i},m=(A,C=false)=>{let{aborted:a}=o.signal,d=n.ignoreFetchAbort&&A!==void 0,O=n.ignoreFetchAbort||!!(n.allowStaleOnFetchAbort&&A!==void 0);if(n.status&&(a&&!C?(n.status.fetchAborted=true,n.status.fetchError=o.signal.reason,d&&(n.status.fetchAbortIgnored=true)):n.status.fetchResolved=true),a&&!d&&!C)return T(o.signal.reason,O);let I=P,v=r(this,_)[t];return (v===P||d&&C&&v===void 0)&&(A===void 0?I.__staleWhileFetching!==void 0?r(this,_)[t]=I.__staleWhileFetching:f(this,c,ye).call(this,e,"fetch"):(n.status&&(n.status.fetchUpdated=true),this.set(e,A,p.options))),A},u=A=>(n.status&&(n.status.fetchRejected=true,n.status.fetchError=A),T(A,false)),T=(A,C)=>{let{aborted:a}=o.signal,d=a&&n.allowStaleOnFetchAbort,O=d||n.allowStaleOnFetchRejection,I=O||n.noDeleteOnFetchRejection,v=P;if(r(this,_)[t]===P&&(!I||!C&&v.__staleWhileFetching===void 0?f(this,c,ye).call(this,e,"fetch"):d||(r(this,_)[t]=v.__staleWhileFetching)),O)return n.status&&v.__staleWhileFetching!==void 0&&(n.status.returnedStale=true),v.__staleWhileFetching;if(v.__returned===v)throw A},D=(A,C)=>{var d;let a=(d=r(this,Ee))==null?void 0:d.call(this,e,s,p);a&&a instanceof Promise&&a.then(O=>A(O===void 0?void 0:O),C),o.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(A(void 0),n.allowStaleOnFetchAbort&&(A=O=>m(O,true)));});};n.status&&(n.status.fetchDispatched=true);let P=new Promise(D).then(m,u),U=Object.assign(P,{__abortController:o,__staleWhileFetching:s,__returned:void 0});return t===void 0?(this.set(e,U,{...p.options,status:void 0}),t=r(this,F).get(e)):r(this,_)[t]=U,U},M=function(e){if(!r(this,me))return false;let t=e;return !!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof ze},Je=function(e,t){r(this,k)[t]=e,r(this,W)[e]=t;},Me=function(e){e!==r(this,G)&&(e===r(this,K)?S(this,K,r(this,W)[e]):f(this,c,Je).call(this,r(this,k)[e],r(this,W)[e]),f(this,c,Je).call(this,r(this,G),e),S(this,G,e));},ye=function(e,t){var i,s;let n=false;if(r(this,V)!==0){let o=r(this,F).get(e);if(o!==void 0)if(r(this,q)?.[o]&&(clearTimeout(r(this,q)?.[o]),r(this,q)[o]=void 0),n=true,r(this,V)===1)f(this,c,Qe).call(this,t);else {r(this,Le).call(this,o);let l=r(this,_)[o];if(f(this,c,M).call(this,l)?l.__abortController.abort(new Error("deleted")):(r(this,oe)||r(this,B))&&(r(this,oe)&&((i=r(this,Z))==null||i.call(this,l,e,t)),r(this,B)&&r(this,z)?.push([l,e,t])),r(this,F).delete(e),r(this,N)[o]=void 0,r(this,_)[o]=void 0,o===r(this,G))S(this,G,r(this,k)[o]);else if(o===r(this,K))S(this,K,r(this,W)[o]);else {let p=r(this,k)[o];r(this,W)[p]=r(this,W)[o];let m=r(this,W)[o];r(this,k)[m]=r(this,k)[o];}Ye(this,V)._--,r(this,ne).push(o);}}if(r(this,B)&&r(this,z)?.length){let o=r(this,z),l;for(;l=o?.shift();)(s=r(this,ee))==null||s.call(this,...l);}return n},Qe=function(e){var t,n;for(let i of f(this,c,be).call(this,{allowStale:true})){let s=r(this,_)[i];if(f(this,c,M).call(this,s))s.__abortController.abort(new Error("deleted"));else {let o=r(this,N)[i];r(this,oe)&&((t=r(this,Z))==null||t.call(this,s,o,e)),r(this,B)&&r(this,z)?.push([s,o,e]);}}if(r(this,F).clear(),r(this,_).fill(void 0),r(this,N).fill(void 0),r(this,$)&&r(this,se)){r(this,$).fill(0),r(this,se).fill(0);for(let i of r(this,q)??[])i!==void 0&&clearTimeout(i);r(this,q)?.fill(void 0);}if(r(this,ie)&&r(this,ie).fill(0),S(this,K,0),S(this,G,0),r(this,ne).length=0,S(this,re,0),S(this,V,0),r(this,B)&&r(this,z)){let i=r(this,z),s;for(;s=i?.shift();)(n=r(this,ee))==null||n.call(this,...s);}},Re);var Pe=class{constructor(e){E(this,"cache");E(this,"map",new Map);this.cache=new lt({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 t=this.map.delete(e);return t&&this.cache.delete(e),t}get forEach(){return this.map.forEach}get(e){let t=this.cache.get(e);return t||this.map.get(e)}has(e){return this.map.has(e)}set(e,t){return this.map.set(e,t),this.cache.set(e,t),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var L;(i=>(i.log=(s,...o)=>console.log(`[Pixi\u2019VN] ${s}`,...o),i.warn=(s,...o)=>console.warn(`[Pixi\u2019VN] ${s}`,...o),i.error=(s,...o)=>console.error(`[Pixi\u2019VN] ${s}`,...o),i.info=(s,...o)=>console.info(`[Pixi\u2019VN] ${s}`,...o)))(L||(L={}));var ve=new Pe({cacheSize:10}),Ze;(s=>{function h(o){let l=ve.get(o);if(!l){L.error(`Label "${o}" not found`);return}return l}s.get=h;function e(o){if(Array.isArray(o)){o.forEach(l=>{e(l);});return}ve.has(o.id)&&L.info(`Label "${o.id}" already exists, it will be overwritten`),ve.set(o.id,o);}s.add=e;function t(){return Array.from(ve.values())}s.values=t;function n(o){return ve.has(o)}s.has=n;function i(){return Array.from(ve.keys())}s.keys=i;})(Ze||(Ze={}));var ae=Ze;function ce(h){try{if(typeof h>"u")return h;let e=JSON.stringify(h);return JSON.parse(e)}catch(e){throw L.error("Error creating exportable element",h,e),new core.PixiError("not_json_serializable","Error creating exportable element")}}var y=class y{constructor(){}static get allOpenedLabels(){return core.GameUnifier.getVariable(w,R.OPENED_LABELS_COUNTER_KEY)||{}}static set allOpenedLabels(e){core.GameUnifier.setVariable(w,R.OPENED_LABELS_COUNTER_KEY,e);}static getCurrentStepTimesCounterData(e=""){let t=y.currentLabelStepIndex;if(t===null)return L.error("currentLabelStepIndex is null"),null;let n=`${t}${e}`,i=y.currentLabelId,s=y._currentLabel;if(!i||t===null||!s)return L.error("currentLabelId or currentLabelStepIndex is null or currentLabel not found"),null;let o=s.getStepSha(t)||"error",l=core.GameUnifier.getVariable(w,R.CURRENT_STEP_TIMES_COUNTER_KEY)||{};return l[i]||(l[i]={}),(!l[i][n]||l[i][n].stepSha1!==o)&&(l[i][n]={stepSha1:o}),l[i][n]}static setCurrentStepTimesCounterData(e="",t){let n=y.currentLabelStepIndex,i=n+e,s=y.currentLabelId;if(!s||n===null){L.error("currentLabelId or currentLabelStepIndex is null");return}let o=core.GameUnifier.getVariable(w,R.CURRENT_STEP_TIMES_COUNTER_KEY)||{};o[s]||(o[s]={}),o[s][i]=t,core.GameUnifier.setVariable(w,R.CURRENT_STEP_TIMES_COUNTER_KEY,o);}static getCurrentStepTimesCounter(e=""){let t=y._stepCounter,n=y.getCurrentStepTimesCounterData(e);if(!n)return L.error("getCurrentStepTimesCounter obj is null"),0;let i=n.stepCounters||[];return i.find(o=>o===t)||(i.push(t),n.stepCounters=i,y.setCurrentStepTimesCounterData(e,n)),i.length}static getRandomNumber(e,t,n={}){let i=n.nestedId||"";if(n.onceOnly||false){let o=y.getCurrentStepTimesCounterData(i);if(!o)return;let l=o.usedRandomNumbers||{},p=Array.from({length:t-e+1},(T,D)=>D+e).filter(T=>!l[`${e}-${t}`]?.includes(T));if(p.length===0)return;let m=Math.floor(Math.random()*p.length),u=p[m];return l[`${e}-${t}`]||(l[`${e}-${t}`]=[]),l[`${e}-${t}`].push(u),o.usedRandomNumbers=l,y.setCurrentStepTimesCounterData(i,o),u}return Math.floor(Math.random()*(t-e+1))+e}static resetCurrentStepTimesCounter(e=""){let t=y.currentLabelStepIndex,n=t+e,i=y.currentLabelId;if(!i||t===null){L.error("currentLabelId or currentLabelStepIndex is null");return}let s=core.GameUnifier.getVariable(w,R.CURRENT_STEP_TIMES_COUNTER_KEY)||{};s[i]||(s[i]={}),s[i][n]={stepCounters:[],stepSha1:""},core.GameUnifier.setVariable(w,R.CURRENT_STEP_TIMES_COUNTER_KEY,s);}static get allChoicesMade(){return core.GameUnifier.getVariable(w,R.ALL_CHOICES_MADE_KEY)||[]}static set allChoicesMade(e){core.GameUnifier.setVariable(w,R.ALL_CHOICES_MADE_KEY,e);}static increaseStepCounter(){y._stepCounter++;}static get openedLabels(){return ce(y._openedLabels)}static set openedLabels(e){y._openedLabels=ce(e);}static get originalOpenedLabels(){return ce(y._originalOpenedLabels)}static set originalOpenedLabels(e){y._originalOpenedLabels=ce(e);}static get _currentLabel(){if(y.currentLabelId)return ae.get(y.currentLabelId)}static get currentLabelId(){if(y._openedLabels.length>0)return y._openedLabels[y._openedLabels.length-1].label}static get currentLabelStepIndex(){return y._openedLabels.length>0?y._openedLabels[y._openedLabels.length-1].currentStepIndex:null}static addLabelHistory(e,t){let n=y.allOpenedLabels,i=y.allOpenedLabels[e]?.biggestStep||0,s=y.allOpenedLabels[e]?.openCount||0;(!i||i<t)&&(n[e]={biggestStep:t,openCount:s},y.allOpenedLabels=n);}static addChoicesMade(e,t,n,i){let s=y.allChoicesMade,o=s.findIndex(l=>l.labelId===e&&l.stepIndex===t&&l.choiceIndex===i&&l.stepSha1===n);o<0?s.push({labelId:e,stepIndex:t,choiceIndex:i,stepSha1:n,madeTimes:1}):s[o].madeTimes++,y.allChoicesMade=s;}static pushNewLabel(e){if(!ae.get(e))throw new core.PixiError("unregistered_element",`Label ${e} not found`);y._openedLabels.push({label:e,currentStepIndex:0});let n=y.allOpenedLabels,i=y.allOpenedLabels[e]?.biggestStep||0,s=y.allOpenedLabels[e]?.openCount||0;n[e]={biggestStep:i,openCount:s+1},y.allOpenedLabels=n;}static increaseCurrentStepIndex(){if(y._openedLabels.length>0){let e=y._openedLabels[y._openedLabels.length-1];y._openedLabels[y._openedLabels.length-1]={...e,currentStepIndex:e.currentStepIndex+1};}}static set onStepStart(e){y._onStepStart=e;}static get onStepStart(){return async(e,t)=>{let n=[];return y.onLoadingLabel&&e===0&&n.push(y.onLoadingLabel(e,t)),y._onStepStart&&n.push(y._onStepStart(e,t)),await Promise.all(n)}}};E(y,"choiceMadeTemp"),E(y,"lastHistoryStep",null),E(y,"_stepCounter",0),E(y,"_openedLabels",[]),E(y,"_originalOpenedLabels",[]),E(y,"_onStepStart"),E(y,"onLoadingLabel"),E(y,"onStepEnd");var b=y;var Ue=class{get currentStepTimesCounter(){return b.getCurrentStepTimesCounter()}set currentStepTimesCounter(e){b.resetCurrentStepTimesCounter();}getRandomNumber(e,t,n={}){return b.getRandomNumber(e,t,n)}get stepCounter(){return b._stepCounter}get openedLabels(){return b.openedLabels}get currentLabel(){return b._currentLabel}addStepHistory(e,t={}){let{choiceMade:n,ignoreSameStep:i}=t,s,o,l,p=core.GameUnifier.getVariable(w,R.LAST_STEP_GLUED)===this.stepCounter;core.GameUnifier.getVariable(w,R.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(s=core.GameUnifier.getVariable(w,R.CURRENT_DIALOGUE_MEMORY_KEY)),core.GameUnifier.getVariable(w,R.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(o=core.GameUnifier.getVariable(w,R.CURRENT_MENU_OPTIONS_MEMORY_KEY)),core.GameUnifier.getVariable(w,R.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(l=core.GameUnifier.getVariable(w,R.CURRENT_INPUT_VALUE_MEMORY_KEY));let m=b.openedLabels,u={currentLabel:b.currentLabelId,dialogue:s,choices:o,stepSha1:e,index:this.stepCounter,labelStepIndex:b.currentLabelStepIndex,choiceIndexMade:n,inputValue:l,alreadyMadeChoices:this.alreadyCurrentStepMadeChoices,isGlued:p,openedLabels:m};b.originalOpenedLabels=m,core.GameUnifier.addHistoryItem(u,{ignoreSameStep:i}),b.lastHistoryStep=u,b.increaseStepCounter();}closeCurrentLabel(){if(!b.currentLabelId){L.warn("No label to close");return}if(!this.currentLabel){L.error("currentLabel not found");return}let e=b.openedLabels;e.pop(),b.openedLabels=e,core.GameUnifier.onLabelClosing(this.openedLabels.length);}closeAllLabels(){for(;b.openedLabels.length>0;)this.closeCurrentLabel(),core.GameUnifier.onLabelClosing(this.openedLabels.length);}isLabelAlreadyCompleted(e){let t;typeof e=="string"?t=e:t=e.id;let i=b.allOpenedLabels[t]?.biggestStep||0;if(i){let s=ae.get(t);if(s)return s.stepCount<=i}return false}get alreadyCurrentStepMadeChoicesObj(){let e=b.currentLabelStepIndex,t=this.currentLabel;if(e===null||!t)return;let n=t.getStepSha(e);return n||(L.warn("stepSha not found, setting to ERROR"),n="error"),b.allChoicesMade.filter(i=>i.labelId===t?.id&&i.stepIndex===e&&i.stepSha1===n)}get alreadyCurrentStepMadeChoices(){return this.alreadyCurrentStepMadeChoicesObj?.map(e=>e.choiceIndex)}get isCurrentStepAlreadyOpened(){let e=b.currentLabelId;if(e){let t=b.allOpenedLabels[e]?.openCount||0;if(b.currentLabelStepIndex&&t>=b.currentLabelStepIndex)return true}return false}getTimesLabelOpened(e){return b.allOpenedLabels[e]?.openCount||0}getTimesChoiceMade(e){return this.alreadyCurrentStepMadeChoicesObj?.find(t=>t.choiceIndex===e)?.madeTimes||0}addCurrentStepToHistory(){this.addStepHistory("dev",{ignoreSameStep:true});}getCanContinue(e){let t=e?.showWarn||false,n=this.choices;return n&&n.length>0?(t&&L.warn("The player must make a choice"),false):this.isRequiredInput?(t&&L.warn("The player must enter a value"),false):true}get canContinue(){return core.GameUnifier.runningStepsCount!==0?false:this.getCanContinue()}async onStepStart(e,t){let n=[];return e.onStepStart&&n.push(e.onStepStart(t,e)),b.onStepStart&&n.push(b.onStepStart(t,e)),await Promise.all(n)}async onStepEnd(e,t){let n=[];return e.onStepEnd&&n.push(e.onStepEnd(t,e)),b.onStepEnd&&n.push(b.onStepEnd(t,e)),await Promise.all(n)}async continue(e,t={}){let{runNow:n=false,steps:i=1}=t;if(!Number.isFinite(i)){L.warn(`[continue] The parameter steps must be a valid finite number, received: ${i}`);return}if(i<=0){L.warn(`[continue] The parameter steps must be greater than 0, received: ${i}`);return}if(!n&&!this.getCanContinue({showWarn:true}))return;if(!n&&core.GameUnifier.runningStepsCount!==0){core.GameUnifier.increaseContinueRequest(i);return}i>1&&core.GameUnifier.increaseContinueRequest(i-1),core.GameUnifier.runningStepsCount++;let s;try{core.GameUnifier.runningStepsCount===1&&await core.GameUnifier.onPreContinue(),b.increaseCurrentStepIndex(),s=await this.runCurrentStep(e,t);}catch(o){throw L.error("Error continuing",o),o}return core.GameUnifier.runningStepsCount--,await this.afterRunCurrentStep(e)||s}async afterRunCurrentStep(e){if(core.GameUnifier.runningStepsCount===0&&core.GameUnifier.continueRequestsCount!==0)return await core.GameUnifier.processNavigationRequests(e);if(this.openedLabels.length===0){if(core.GameUnifier.onEnd)return await core.GameUnifier.onEnd(e,{labelId:"end"});L.error("The end of the game is not managed, so the game is blocked. Read this documentation to know how to manage the end of the game: https://pixi-vn.com/start/other-narrative-features.html#how-manage-the-end-of-the-game");}}async runCurrentStep(e,t={}){let{choiceMade:n}=t;if(b.currentLabelId){let i=b.currentLabelStepIndex;if(i===null){L.error("currentLabelStepIndex is null");return}let s=b._currentLabel;if(!s){L.error("currentLabel not found");return}if(s.stepCount>i){try{await this.onStepStart(s,i);}catch(u){L.error("Error running onStepStart",u),this.onStepError&&await this.onStepError(u,e);return}let o=s.getStepById(i);if(!o){L.error("step not found");return}let l=s.getStepSha(i);l||(L.warn("stepSha not found, setting to ERROR"),l="error");let p,m;try{p=await o(e,{labelId:s.id});}catch(u){L.error("Error running step",u),m=u;}try{let u=this.choices;if(u?.length===1&&u[0].autoSelect){let T=u[0];p=await this.selectChoice(T,e);}}catch(u){L.error("Error auto-selecting choice",u),m||(m=u);}try{let u=b.lastHistoryStep;n!==void 0&&u&&(l=u.stepSha1,l||(L.warn("stepSha not found, setting to ERROR"),l="error"),b.addChoicesMade(u.currentLabel||"error",typeof u.labelStepIndex=="number"?u.labelStepIndex:-1,u.stepSha1||"error",n),b.choiceMadeTemp=n);}catch(u){L.warn("Error adding choice made to history",u);}try{core.GameUnifier.runningStepsCount===1&&(b.addLabelHistory(s.id,i),this.addStepHistory(l,{...t,choiceMade:b.choiceMadeTemp}),b.choiceMadeTemp=void 0);}catch(u){L.warn("Error adding step to history",u);}try{this.currentLabel&&await this.onStepEnd(this.currentLabel,b.currentLabelStepIndex||0);}catch(u){L.warn("Error running onStepEnd",u);}return m&&this.onStepError&&await this.onStepError(m,e),p}else {if(this.openedLabels.length>1)return this.closeCurrentLabel(),await this.continue(e,t);if(this.openedLabels.length===1){b.openedLabels=[];return}}}else {if(this.openedLabels.length===0)return;L.error("currentLabelId not found");}}async call(e,t,n){let{choiceMade:i}=n||{},s;typeof e=="string"?s=e:s=e.id,core.GameUnifier.runningStepsCount++;let o;try{let l=ae.get(s);if(!l)throw new core.PixiError("unregistered_element",`Label ${s} not found`);b.pushNewLabel(l.id),o=await this.runCurrentStep(t,{choiceMade:i});}catch(l){throw L.error("Error calling label",l),l}return core.GameUnifier.runningStepsCount--,await this.afterRunCurrentStep(t)||o}async jump(e,t,n){if(this.stepCounter===0)return await this.call(e,t,n);this.openedLabels.length>0&&this.closeCurrentLabel();let{choiceMade:i}=n||{},s;typeof e=="string"?s=e:s=e.id,core.GameUnifier.runningStepsCount++;let o;try{let l=ae.get(s);if(!l)throw new core.PixiError("unregistered_element",`Label ${s} not found`);b.pushNewLabel(l.id),o=await this.runCurrentStep(t,{choiceMade:i});}catch(l){throw L.error("Error jumping to label",l),l}return core.GameUnifier.runningStepsCount--,await this.afterRunCurrentStep(t)||o}async selectChoice(e,t){this.choices=void 0;let n=e.type;switch(n){case "call":return await this.call(e.label,{...e.props,...t},{choiceMade:e.choiceIndex});case "jump":return await this.jump(e.label,{...e.props,...t},{choiceMade:e.choiceIndex});case "close":return await this.closeChoiceMenu(e,{...e.props,...t});default:throw L.error(`Type ${n} not found`),new core.PixiError("invalid_usage",`Type ${n} not found`)}}async closeChoiceMenu(e,t){if(e.type!=="close")throw L.error("For closeChoiceMenu, the type must be close"),new core.PixiError("invalid_usage","For closeChoiceMenu, the type must be close");let n;return typeof e.choiceIndex=="number"&&(n=e.choiceIndex),e.closeCurrentLabel&&this.closeCurrentLabel(),await this.continue(t,{choiceMade:n})}get onStepError(){return async(e,t)=>{try{await core.GameUnifier.runOnError(e,t);}catch(n){L.error("Error in onError handler",n);}}}get dialogue(){let e=core.GameUnifier.getVariable(w,R.CURRENT_DIALOGUE_MEMORY_KEY);if(e)return {...e,character:e.character?core.GameUnifier.getCharacter(e.character)||e.character:void 0}}set dialogue(e){if(e===void 0){core.GameUnifier.setVariable(w,R.CURRENT_DIALOGUE_MEMORY_KEY,void 0);return}if((typeof e=="string"||Array.isArray(e))&&(e={text:e}),this.dialogGlue){let t=core.GameUnifier.getVariable(w,R.CURRENT_DIALOGUE_MEMORY_KEY);if(t){let n=[];Array.isArray(t.text)?n=[...t.text]:n=[t.text],Array.isArray(e.text)?n=[...n,...e.text]:n=[...n,e.text],e.text=n,e.character=e.character||t.character;}core.GameUnifier.setVariable(w,R.LAST_STEP_GLUED,this.stepCounter),this.dialogGlue=false;}try{core.GameUnifier.setVariable(w,R.CURRENT_DIALOGUE_MEMORY_KEY,ce({...e,character:typeof e.character=="string"?e.character:e.character?.id})),core.GameUnifier.setVariable(w,R.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}catch{throw L.error("DialogueInterface cannot contain functions or classes"),new core.PixiError("not_json_serializable","ChoiceInterface cannot contain functions or classes")}}get choices(){let e=core.GameUnifier.getVariable(w,R.CURRENT_MENU_OPTIONS_MEMORY_KEY);if(e){let t=[],n=e.map((s,o)=>({...s,choiceIndex:o})),i=this.alreadyCurrentStepMadeChoices;if(n=n.filter((s,o)=>s.oneTime&&i?.includes(o)?false:s.onlyHaveNoChoice?(t.push(s),false):true),n.length>0)return n;if(t.length>0)return [t[0]]}}set choices(e){if(!e||e.length===0){core.GameUnifier.setVariable(w,R.CURRENT_MENU_OPTIONS_MEMORY_KEY,void 0);return}try{core.GameUnifier.setVariable(w,R.CURRENT_MENU_OPTIONS_MEMORY_KEY,ce(e)),core.GameUnifier.setVariable(w,R.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}catch{throw L.error("ChoiceInterface cannot contain functions or classes"),new core.PixiError("not_json_serializable","ChoiceInterface cannot contain functions or classes")}}get dialogGlue(){return core.GameUnifier.getFlag(R.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)}set dialogGlue(e){core.GameUnifier.setFlag(R.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,e);}get inputValue(){return core.GameUnifier.getVariable(w,R.CURRENT_INPUT_VALUE_MEMORY_KEY)}set inputValue(e){this.removeInputRequest(),core.GameUnifier.setVariable(w,R.CURRENT_INPUT_VALUE_MEMORY_KEY,e),core.GameUnifier.setVariable(w,R.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}get isRequiredInput(){return core.GameUnifier.getVariable(w,R.CURRENT_INPUT_INFO_MEMORY_KEY)?.isRequired||false}get inputType(){return core.GameUnifier.getVariable(w,R.CURRENT_INPUT_INFO_MEMORY_KEY)?.type}requestInput(e,t){e.isRequired=true,core.GameUnifier.setVariable(w,R.CURRENT_INPUT_INFO_MEMORY_KEY,e),t!==void 0?core.GameUnifier.setVariable(w,R.CURRENT_INPUT_VALUE_MEMORY_KEY,t):core.GameUnifier.removeVariable(w,R.CURRENT_INPUT_VALUE_MEMORY_KEY);}removeInputRequest(){core.GameUnifier.removeVariable(w,R.CURRENT_INPUT_INFO_MEMORY_KEY),core.GameUnifier.removeVariable(w,R.CURRENT_INPUT_VALUE_MEMORY_KEY);}clear(){b.openedLabels=[],b._stepCounter=0;}export(){return {openedLabels:ce(b.openedLabels),stepCounter:this.stepCounter}}async onLoadingLabel(e){let t=this.openedLabels.map(async n=>{let i=[],s=ae.get(n.label);return s&&(s.onLoadingLabel&&i.push(s.onLoadingLabel(e,s)),b.onLoadingLabel&&i.push(b.onLoadingLabel(e,s))),await Promise.all(i)});return await Promise.all(t)}async restore(e,t){this.clear();try{b.lastHistoryStep=t,Object.hasOwn(e,"openedLabels")?(b.openedLabels=e.openedLabels,b.originalOpenedLabels=b.openedLabels):L.warn("Could not import openedLabels data, so will be ignored"),Object.hasOwn(e,"stepCounter")?b._stepCounter=e.stepCounter:L.warn("Could not import stepCounter data, so will be ignored");try{await this.onLoadingLabel(b.currentLabelStepIndex||0);}catch(n){L.error("Error running onLoadingLabel",n);}}catch(n){L.error("Error importing data",n);}}};function At(h,e,t,n){let i=typeof e=="string"?e:e.id;return {...n,label:i,props:t,text:h,type:n?.type||"call"}}var pt="close";function Mt(h,e){return {...e,type:pt,text:h}}var bt=Ct(ft());var xe=class{constructor(e,t){E(this,"id");E(this,"_onStepStart");E(this,"_onLoadingLabel");E(this,"_onStepEnd");this.id=e,this._onStepStart=t?.onStepStart,this._onLoadingLabel=t?.onLoadingLabel,this._onStepEnd=t?.onStepEnd;}get onStepStart(){return async(e,t)=>{if(this._onLoadingLabel&&e===0&&await this._onLoadingLabel(e,t),this._onStepStart)return await this._onStepStart(e,t)}}get onLoadingLabel(){return this._onLoadingLabel}get onStepEnd(){return this._onStepEnd}};var Ae=class extends xe{constructor(t,n,i){super(t,i);E(this,"_steps");this._steps=n;}get stepCount(){return this.steps.length}getStepById(t){return this.steps[t]}get steps(){return typeof this._steps=="function"?this._steps():this._steps}getStepSha(t){if(t<0||t>=this.steps.length)return L.warn("stepSha not found, setting to ERROR"),"error";try{let n=this.steps[t];return (0,bt.default)(n.toString().toLocaleLowerCase()).toString()}catch(n){return L.warn("stepSha not found, setting to ERROR",n),"error"}}};function yt(h,e,t){let n=new Ae(h,e,t);return ae.add(n),n}var vr=new Ue;
|
|
1
|
+
'use strict';var core=require('@drincs/pixi-vn/core');var mt=Object.create;var Be=Object.defineProperty;var St=Object.getOwnPropertyDescriptor;var gt=Object.getOwnPropertyNames;var Lt=Object.getPrototypeOf,Tt=Object.prototype.hasOwnProperty;var Ze=h=>{throw TypeError(h)};var _t=(h,e,t)=>e in h?Be(h,e,{enumerable:true,configurable:true,writable:true,value:t}):h[e]=t;var je=(h=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(h,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):h)(function(h){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+h+'" is not supported')});var et=(h,e)=>()=>(e||h((e={exports:{}}).exports,e),e.exports);var Et=(h,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of gt(e))!Tt.call(h,i)&&i!==t&&Be(h,i,{get:()=>e[i],enumerable:!(n=St(e,i))||n.enumerable});return h};var Ct=(h,e,t)=>(t=h!=null?mt(Lt(h)):{},Et(Be(t,"default",{value:h,enumerable:true}),h));var E=(h,e,t)=>_t(h,typeof e!="symbol"?e+"":e,t),ke=(h,e,t)=>e.has(h)||Ze("Cannot "+t);var r=(h,e,t)=>(ke(h,e,"read from private field"),t?t.call(h):e.get(h)),x=(h,e,t)=>e.has(h)?Ze("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(h):e.set(h,t),S=(h,e,t,n)=>(ke(h,e,"write to private field"),e.set(h,t),t),f=(h,e,t)=>(ke(h,e,"access private method"),t);var Ye=(h,e,t,n)=>({set _(i){S(h,e,i);},get _(){return r(h,e,n)}});var ut=et((He,ct)=>{(function(h,e){typeof He=="object"?ct.exports=He=e():typeof define=="function"&&define.amd?define([],e):h.CryptoJS=e();})(He,function(){var h=h||(function(e,t){var n;if(typeof window<"u"&&window.crypto&&(n=window.crypto),typeof self<"u"&&self.crypto&&(n=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(n=globalThis.crypto),!n&&typeof window<"u"&&window.msCrypto&&(n=window.msCrypto),!n&&typeof global<"u"&&global.crypto&&(n=global.crypto),!n&&typeof je=="function")try{n=je("crypto");}catch{}var i=function(){if(n){if(typeof n.getRandomValues=="function")try{return n.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof n.randomBytes=="function")try{return n.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||(function(){function a(){}return function(d){var O;return a.prototype=d,O=new a,a.prototype=null,O}})(),o={},l=o.lib={},p=l.Base=(function(){return {extend:function(a){var d=s(this);return a&&d.mixIn(a),(!d.hasOwnProperty("init")||this.init===d.init)&&(d.init=function(){d.$super.init.apply(this,arguments);}),d.init.prototype=d,d.$super=this,d},create:function(){var a=this.extend();return a.init.apply(a,arguments),a},init:function(){},mixIn:function(a){for(var d in a)a.hasOwnProperty(d)&&(this[d]=a[d]);a.hasOwnProperty("toString")&&(this.toString=a.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),m=l.WordArray=p.extend({init:function(a,d){a=this.words=a||[],d!=t?this.sigBytes=d:this.sigBytes=a.length*4;},toString:function(a){return (a||T).stringify(this)},concat:function(a){var d=this.words,O=a.words,I=this.sigBytes,v=a.sigBytes;if(this.clamp(),I%4)for(var Y=0;Y<v;Y++){var le=O[Y>>>2]>>>24-Y%4*8&255;d[I+Y>>>2]|=le<<24-(I+Y)%4*8;}else for(var H=0;H<v;H+=4)d[I+H>>>2]=O[H>>>2];return this.sigBytes+=v,this},clamp:function(){var a=this.words,d=this.sigBytes;a[d>>>2]&=4294967295<<32-d%4*8,a.length=e.ceil(d/4);},clone:function(){var a=p.clone.call(this);return a.words=this.words.slice(0),a},random:function(a){for(var d=[],O=0;O<a;O+=4)d.push(i());return new m.init(d,a)}}),u=o.enc={},T=u.Hex={stringify:function(a){for(var d=a.words,O=a.sigBytes,I=[],v=0;v<O;v++){var Y=d[v>>>2]>>>24-v%4*8&255;I.push((Y>>>4).toString(16)),I.push((Y&15).toString(16));}return I.join("")},parse:function(a){for(var d=a.length,O=[],I=0;I<d;I+=2)O[I>>>3]|=parseInt(a.substr(I,2),16)<<24-I%8*4;return new m.init(O,d/2)}},D=u.Latin1={stringify:function(a){for(var d=a.words,O=a.sigBytes,I=[],v=0;v<O;v++){var Y=d[v>>>2]>>>24-v%4*8&255;I.push(String.fromCharCode(Y));}return I.join("")},parse:function(a){for(var d=a.length,O=[],I=0;I<d;I++)O[I>>>2]|=(a.charCodeAt(I)&255)<<24-I%4*8;return new m.init(O,d)}},P=u.Utf8={stringify:function(a){try{return decodeURIComponent(escape(D.stringify(a)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(a){return D.parse(unescape(encodeURIComponent(a)))}},U=l.BufferedBlockAlgorithm=p.extend({reset:function(){this._data=new m.init,this._nDataBytes=0;},_append:function(a){typeof a=="string"&&(a=P.parse(a)),this._data.concat(a),this._nDataBytes+=a.sigBytes;},_process:function(a){var d,O=this._data,I=O.words,v=O.sigBytes,Y=this.blockSize,le=Y*4,H=v/le;a?H=e.ceil(H):H=e.max((H|0)-this._minBufferSize,0);var Q=H*Y,Te=e.min(Q*4,v);if(Q){for(var We=0;We<Q;We+=Y)this._doProcessBlock(I,We);d=I.splice(0,Q),O.sigBytes-=Te;}return new m.init(d,Te)},clone:function(){var a=p.clone.call(this);return a._data=this._data.clone(),a},_minBufferSize:0});l.Hasher=U.extend({cfg:p.extend(),init:function(a){this.cfg=this.cfg.extend(a),this.reset();},reset:function(){U.reset.call(this),this._doReset();},update:function(a){return this._append(a),this._process(),this},finalize:function(a){a&&this._append(a);var d=this._doFinalize();return d},blockSize:512/32,_createHelper:function(a){return function(d,O){return new a.init(O).finalize(d)}},_createHmacHelper:function(a){return function(d,O){return new C.HMAC.init(a,O).finalize(d)}}});var C=o.algo={};return o})(Math);return h});});var ft=et((Ke,dt)=>{(function(h,e){typeof Ke=="object"?dt.exports=Ke=e(ut()):typeof define=="function"&&define.amd?define(["./core"],e):e(h.CryptoJS);})(Ke,function(h){return (function(){var e=h,t=e.lib,n=t.WordArray,i=t.Hasher,s=e.algo,o=[],l=s.SHA1=i.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(p,m){for(var u=this._hash.words,T=u[0],D=u[1],P=u[2],U=u[3],A=u[4],C=0;C<80;C++){if(C<16)o[C]=p[m+C]|0;else {var a=o[C-3]^o[C-8]^o[C-14]^o[C-16];o[C]=a<<1|a>>>31;}var d=(T<<5|T>>>27)+A+o[C];C<20?d+=(D&P|~D&U)+1518500249:C<40?d+=(D^P^U)+1859775393:C<60?d+=(D&P|D&U|P&U)-1894007588:d+=(D^P^U)-899497514,A=U,U=P,P=D<<30|D>>>2,D=T,T=d;}u[0]=u[0]+T|0,u[1]=u[1]+D|0,u[2]=u[2]+P|0,u[3]=u[3]+U|0,u[4]=u[4]+A|0;},_doFinalize:function(){var p=this._data,m=p.words,u=this._nDataBytes*8,T=p.sigBytes*8;return m[T>>>5]|=128<<24-T%32,m[(T+64>>>9<<4)+14]=Math.floor(u/4294967296),m[(T+64>>>9<<4)+15]=u,p.sigBytes=m.length*4,this._process(),this._hash},clone:function(){var p=i.clone.call(this);return p._hash=this._hash.clone(),p}});e.SHA1=i._createHelper(l),e.HmacSHA1=i._createHmacHelper(l);})(),h.SHA1});});var w="narration";var R={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 It=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,it=new Set,$e=typeof process=="object"&&process?process:{},st=(h,e,t,n)=>{typeof $e.emitWarning=="function"?$e.emitWarning(h,e,t,n):console.error(`[${t}] ${e}: ${h}`);},ze=globalThis.AbortController,tt=globalThis.AbortSignal;if(typeof ze>"u"){tt=class{constructor(){E(this,"onabort");E(this,"_onabort",[]);E(this,"reason");E(this,"aborted",false);}addEventListener(t,n){this._onabort.push(n);}},ze=class{constructor(){E(this,"signal",new tt);e();}abort(t){if(!this.signal.aborted){this.signal.reason=t,this.signal.aborted=true;for(let n of this.signal._onabort)n(t);this.signal.onabort?.(t);}}};let h=$e.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{h&&(h=false,st("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 Ot=h=>!it.has(h);var de=h=>h&&h===Math.floor(h)&&h>0&&isFinite(h),ot=h=>de(h)?h<=Math.pow(2,8)?Uint8Array:h<=Math.pow(2,16)?Uint16Array:h<=Math.pow(2,32)?Uint32Array:h<=Number.MAX_SAFE_INTEGER?Fe:null:null,Fe=class extends Array{constructor(h){super(h),this.fill(0);}},he,_e,Rt=(he=class{constructor(e,t){E(this,"heap");E(this,"length");if(!r(he,_e))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0;}static create(e){let t=ot(e);if(!t)return [];S(he,_e,true);let n=new he(e,t);return S(he,_e,false),n}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},_e=new WeakMap,x(he,_e,false),he),rt,nt,J,j,Z,Se,ee,Ee,Ce,te,V,re,F,N,_,W,k,K,G,ne,z,ie,se,$,q,oe,me,B,Ie,c,qe,ge,pe,Ne,X,lt,Le,Oe,De,fe,be,Xe,Ve,Ge,M,Je,Me,ye,Qe,Re,at=(Re=class{constructor(e){x(this,c);x(this,J);x(this,j);x(this,Z);x(this,Se);x(this,ee);x(this,Ee);x(this,Ce);x(this,te);E(this,"ttl");E(this,"ttlResolution");E(this,"ttlAutopurge");E(this,"updateAgeOnGet");E(this,"updateAgeOnHas");E(this,"allowStale");E(this,"noDisposeOnSet");E(this,"noUpdateTTL");E(this,"maxEntrySize");E(this,"sizeCalculation");E(this,"noDeleteOnFetchRejection");E(this,"noDeleteOnStaleGet");E(this,"allowStaleOnFetchAbort");E(this,"allowStaleOnFetchRejection");E(this,"ignoreFetchAbort");x(this,V);x(this,re);x(this,F);x(this,N);x(this,_);x(this,W);x(this,k);x(this,K);x(this,G);x(this,ne);x(this,z);x(this,ie);x(this,se);x(this,$);x(this,q);x(this,oe);x(this,me);x(this,B);x(this,Ie);x(this,ge,()=>{});x(this,pe,()=>{});x(this,Ne,()=>{});x(this,X,()=>false);x(this,Le,e=>{});x(this,Oe,(e,t,n)=>{});x(this,De,(e,t,n,i)=>{if(n||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});E(this,rt,"LRUCache");let{max:t=0,ttl:n,ttlResolution:i=1,ttlAutopurge:s,updateAgeOnGet:o,updateAgeOnHas:l,allowStale:p,dispose:m,onInsert:u,disposeAfter:T,noDisposeOnSet:D,noUpdateTTL:P,maxSize:U=0,maxEntrySize:A=0,sizeCalculation:C,fetchMethod:a,memoMethod:d,noDeleteOnFetchRejection:O,noDeleteOnStaleGet:I,allowStaleOnFetchRejection:v,allowStaleOnFetchAbort:Y,ignoreFetchAbort:le,perf:H}=e;if(H!==void 0&&typeof H?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(S(this,te,H??It),t!==0&&!de(t))throw new TypeError("max option must be a nonnegative integer");let Q=t?ot(t):Array;if(!Q)throw new Error("invalid max value: "+t);if(S(this,J,t),S(this,j,U),this.maxEntrySize=A||r(this,j),this.sizeCalculation=C,this.sizeCalculation){if(!r(this,j)&&!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(d!==void 0&&typeof d!="function")throw new TypeError("memoMethod must be a function if defined");if(S(this,Ce,d),a!==void 0&&typeof a!="function")throw new TypeError("fetchMethod must be a function if specified");if(S(this,Ee,a),S(this,me,!!a),S(this,F,new Map),S(this,N,new Array(t).fill(void 0)),S(this,_,new Array(t).fill(void 0)),S(this,W,new Q(t)),S(this,k,new Q(t)),S(this,K,0),S(this,G,0),S(this,ne,Rt.create(t)),S(this,V,0),S(this,re,0),typeof m=="function"&&S(this,Z,m),typeof u=="function"&&S(this,Se,u),typeof T=="function"?(S(this,ee,T),S(this,z,[])):(S(this,ee,void 0),S(this,z,void 0)),S(this,oe,!!r(this,Z)),S(this,Ie,!!r(this,Se)),S(this,B,!!r(this,ee)),this.noDisposeOnSet=!!D,this.noUpdateTTL=!!P,this.noDeleteOnFetchRejection=!!O,this.allowStaleOnFetchRejection=!!v,this.allowStaleOnFetchAbort=!!Y,this.ignoreFetchAbort=!!le,this.maxEntrySize!==0){if(r(this,j)!==0&&!de(r(this,j)))throw new TypeError("maxSize must be a positive integer if specified");if(!de(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");f(this,c,lt).call(this);}if(this.allowStale=!!p,this.noDeleteOnStaleGet=!!I,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!l,this.ttlResolution=de(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=n||0,this.ttl){if(!de(this.ttl))throw new TypeError("ttl must be a positive integer if specified");f(this,c,qe).call(this);}if(r(this,J)===0&&this.ttl===0&&r(this,j)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!r(this,J)&&!r(this,j)){let Te="LRU_CACHE_UNBOUNDED";Ot(Te)&&(it.add(Te),st("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Te,Re));}}get perf(){return r(this,te)}static unsafeExposeInternals(e){return {starts:r(e,se),ttls:r(e,$),autopurgeTimers:r(e,q),sizes:r(e,ie),keyMap:r(e,F),keyList:r(e,N),valList:r(e,_),next:r(e,W),prev:r(e,k),get head(){return r(e,K)},get tail(){return r(e,G)},free:r(e,ne),isBackgroundFetch:t=>{var n;return f(n=e,c,M).call(n,t)},backgroundFetch:(t,n,i,s)=>{var o;return f(o=e,c,Ge).call(o,t,n,i,s)},moveToTail:t=>{var n;return f(n=e,c,Me).call(n,t)},indexes:t=>{var n;return f(n=e,c,fe).call(n,t)},rindexes:t=>{var n;return f(n=e,c,be).call(n,t)},isStale:t=>{var n;return r(n=e,X).call(n,t)}}}get max(){return r(this,J)}get maxSize(){return r(this,j)}get calculatedSize(){return r(this,re)}get size(){return r(this,V)}get fetchMethod(){return r(this,Ee)}get memoMethod(){return r(this,Ce)}get dispose(){return r(this,Z)}get onInsert(){return r(this,Se)}get disposeAfter(){return r(this,ee)}getRemainingTTL(e){return r(this,F).has(e)?1/0:0}*entries(){for(let e of f(this,c,fe).call(this))r(this,_)[e]!==void 0&&r(this,N)[e]!==void 0&&!f(this,c,M).call(this,r(this,_)[e])&&(yield [r(this,N)[e],r(this,_)[e]]);}*rentries(){for(let e of f(this,c,be).call(this))r(this,_)[e]!==void 0&&r(this,N)[e]!==void 0&&!f(this,c,M).call(this,r(this,_)[e])&&(yield [r(this,N)[e],r(this,_)[e]]);}*keys(){for(let e of f(this,c,fe).call(this)){let t=r(this,N)[e];t!==void 0&&!f(this,c,M).call(this,r(this,_)[e])&&(yield t);}}*rkeys(){for(let e of f(this,c,be).call(this)){let t=r(this,N)[e];t!==void 0&&!f(this,c,M).call(this,r(this,_)[e])&&(yield t);}}*values(){for(let e of f(this,c,fe).call(this))r(this,_)[e]!==void 0&&!f(this,c,M).call(this,r(this,_)[e])&&(yield r(this,_)[e]);}*rvalues(){for(let e of f(this,c,be).call(this))r(this,_)[e]!==void 0&&!f(this,c,M).call(this,r(this,_)[e])&&(yield r(this,_)[e]);}[(nt=Symbol.iterator,rt=Symbol.toStringTag,nt)](){return this.entries()}find(e,t={}){for(let n of f(this,c,fe).call(this)){let i=r(this,_)[n],s=f(this,c,M).call(this,i)?i.__staleWhileFetching:i;if(s!==void 0&&e(s,r(this,N)[n],this))return this.get(r(this,N)[n],t)}}forEach(e,t=this){for(let n of f(this,c,fe).call(this)){let i=r(this,_)[n],s=f(this,c,M).call(this,i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,r(this,N)[n],this);}}rforEach(e,t=this){for(let n of f(this,c,be).call(this)){let i=r(this,_)[n],s=f(this,c,M).call(this,i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,r(this,N)[n],this);}}purgeStale(){let e=false;for(let t of f(this,c,be).call(this,{allowStale:true}))r(this,X).call(this,t)&&(f(this,c,ye).call(this,r(this,N)[t],"expire"),e=true);return e}info(e){let t=r(this,F).get(e);if(t===void 0)return;let n=r(this,_)[t],i=f(this,c,M).call(this,n)?n.__staleWhileFetching:n;if(i===void 0)return;let s={value:i};if(r(this,$)&&r(this,se)){let o=r(this,$)[t],l=r(this,se)[t];if(o&&l){let p=o-(r(this,te).now()-l);s.ttl=p,s.start=Date.now();}}return r(this,ie)&&(s.size=r(this,ie)[t]),s}dump(){let e=[];for(let t of f(this,c,fe).call(this,{allowStale:true})){let n=r(this,N)[t],i=r(this,_)[t],s=f(this,c,M).call(this,i)?i.__staleWhileFetching:i;if(s===void 0||n===void 0)continue;let o={value:s};if(r(this,$)&&r(this,se)){o.ttl=r(this,$)[t];let l=r(this,te).now()-r(this,se)[t];o.start=Math.floor(Date.now()-l);}r(this,ie)&&(o.size=r(this,ie)[t]),e.unshift([n,o]);}return e}load(e){this.clear();for(let[t,n]of e){if(n.start){let i=Date.now()-n.start;n.start=r(this,te).now()-i;}this.set(t,n.value,n);}}set(e,t,n={}){var D,P,U,A;if(t===void 0)return this.delete(e),this;let{ttl:i=this.ttl,start:s,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:l=this.sizeCalculation,status:p}=n,{noUpdateTTL:m=this.noUpdateTTL}=n,u=r(this,De).call(this,e,t,n.size||0,l);if(this.maxEntrySize&&u>this.maxEntrySize)return p&&(p.set="miss",p.maxEntrySizeExceeded=true),f(this,c,ye).call(this,e,"set"),this;let T=r(this,V)===0?void 0:r(this,F).get(e);if(T===void 0)T=r(this,V)===0?r(this,G):r(this,ne).length!==0?r(this,ne).pop():r(this,V)===r(this,J)?f(this,c,Ve).call(this,false):r(this,V),r(this,N)[T]=e,r(this,_)[T]=t,r(this,F).set(e,T),r(this,W)[r(this,G)]=T,r(this,k)[T]=r(this,G),S(this,G,T),Ye(this,V)._++,r(this,Oe).call(this,T,u,p),p&&(p.set="add"),m=false,r(this,Ie)&&((D=r(this,Se))==null||D.call(this,t,e,"add"));else {f(this,c,Me).call(this,T);let C=r(this,_)[T];if(t!==C){if(r(this,me)&&f(this,c,M).call(this,C)){C.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:a}=C;a!==void 0&&!o&&(r(this,oe)&&((P=r(this,Z))==null||P.call(this,a,e,"set")),r(this,B)&&r(this,z)?.push([a,e,"set"]));}else o||(r(this,oe)&&((U=r(this,Z))==null||U.call(this,C,e,"set")),r(this,B)&&r(this,z)?.push([C,e,"set"]));if(r(this,Le).call(this,T),r(this,Oe).call(this,T,u,p),r(this,_)[T]=t,p){p.set="replace";let a=C&&f(this,c,M).call(this,C)?C.__staleWhileFetching:C;a!==void 0&&(p.oldValue=a);}}else p&&(p.set="update");r(this,Ie)&&this.onInsert?.(t,e,t===C?"update":"replace");}if(i!==0&&!r(this,$)&&f(this,c,qe).call(this),r(this,$)&&(m||r(this,Ne).call(this,T,i,s),p&&r(this,pe).call(this,p,T)),!o&&r(this,B)&&r(this,z)){let C=r(this,z),a;for(;a=C?.shift();)(A=r(this,ee))==null||A.call(this,...a);}return this}pop(){var e;try{for(;r(this,V);){let t=r(this,_)[r(this,K)];if(f(this,c,Ve).call(this,!0),f(this,c,M).call(this,t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(r(this,B)&&r(this,z)){let t=r(this,z),n;for(;n=t?.shift();)(e=r(this,ee))==null||e.call(this,...n);}}}has(e,t={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:i}=t,s=r(this,F).get(e);if(s!==void 0){let o=r(this,_)[s];if(f(this,c,M).call(this,o)&&o.__staleWhileFetching===void 0)return false;if(r(this,X).call(this,s))i&&(i.has="stale",r(this,pe).call(this,i,s));else return n&&r(this,ge).call(this,s),i&&(i.has="hit",r(this,pe).call(this,i,s)),true}else i&&(i.has="miss");return false}peek(e,t={}){let{allowStale:n=this.allowStale}=t,i=r(this,F).get(e);if(i===void 0||!n&&r(this,X).call(this,i))return;let s=r(this,_)[i];return f(this,c,M).call(this,s)?s.__staleWhileFetching:s}async fetch(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:l=this.noDisposeOnSet,size:p=0,sizeCalculation:m=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:T=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:D=this.allowStaleOnFetchRejection,ignoreFetchAbort:P=this.ignoreFetchAbort,allowStaleOnFetchAbort:U=this.allowStaleOnFetchAbort,context:A,forceRefresh:C=false,status:a,signal:d}=t;if(!r(this,me))return a&&(a.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:a});let O={allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:o,noDisposeOnSet:l,size:p,sizeCalculation:m,noUpdateTTL:u,noDeleteOnFetchRejection:T,allowStaleOnFetchRejection:D,allowStaleOnFetchAbort:U,ignoreFetchAbort:P,status:a,signal:d},I=r(this,F).get(e);if(I===void 0){a&&(a.fetch="miss");let v=f(this,c,Ge).call(this,e,I,O,A);return v.__returned=v}else {let v=r(this,_)[I];if(f(this,c,M).call(this,v)){let Q=n&&v.__staleWhileFetching!==void 0;return a&&(a.fetch="inflight",Q&&(a.returnedStale=true)),Q?v.__staleWhileFetching:v.__returned=v}let Y=r(this,X).call(this,I);if(!C&&!Y)return a&&(a.fetch="hit"),f(this,c,Me).call(this,I),i&&r(this,ge).call(this,I),a&&r(this,pe).call(this,a,I),v;let le=f(this,c,Ge).call(this,e,I,O,A),H=le.__staleWhileFetching!==void 0&&n;return a&&(a.fetch=Y?"stale":"refresh",H&&Y&&(a.returnedStale=true)),H?le.__staleWhileFetching:le.__returned=le}}async forceFetch(e,t={}){let n=await this.fetch(e,t);if(n===void 0)throw new Error("fetch() returned undefined");return n}memo(e,t={}){let n=r(this,Ce);if(!n)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:s,...o}=t,l=this.get(e,o);if(!s&&l!==void 0)return l;let p=n(e,l,{options:o,context:i});return this.set(e,p,o),p}get(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:o}=t,l=r(this,F).get(e);if(l!==void 0){let p=r(this,_)[l],m=f(this,c,M).call(this,p);return o&&r(this,pe).call(this,o,l),r(this,X).call(this,l)?(o&&(o.get="stale"),m?(o&&n&&p.__staleWhileFetching!==void 0&&(o.returnedStale=true),n?p.__staleWhileFetching:void 0):(s||f(this,c,ye).call(this,e,"expire"),o&&n&&(o.returnedStale=true),n?p:void 0)):(o&&(o.get="hit"),m?p.__staleWhileFetching:(f(this,c,Me).call(this,l),i&&r(this,ge).call(this,l),p))}else o&&(o.get="miss");}delete(e){return f(this,c,ye).call(this,e,"delete")}clear(){return f(this,c,Qe).call(this,"delete")}},J=new WeakMap,j=new WeakMap,Z=new WeakMap,Se=new WeakMap,ee=new WeakMap,Ee=new WeakMap,Ce=new WeakMap,te=new WeakMap,V=new WeakMap,re=new WeakMap,F=new WeakMap,N=new WeakMap,_=new WeakMap,W=new WeakMap,k=new WeakMap,K=new WeakMap,G=new WeakMap,ne=new WeakMap,z=new WeakMap,ie=new WeakMap,se=new WeakMap,$=new WeakMap,q=new WeakMap,oe=new WeakMap,me=new WeakMap,B=new WeakMap,Ie=new WeakMap,c=new WeakSet,qe=function(){let e=new Fe(r(this,J)),t=new Fe(r(this,J));S(this,$,e),S(this,se,t);let n=this.ttlAutopurge?new Array(r(this,J)):void 0;S(this,q,n),S(this,Ne,(l,p,m=r(this,te).now())=>{t[l]=p!==0?m:0,e[l]=p,i(l,p);}),S(this,ge,l=>{t[l]=e[l]!==0?r(this,te).now():0,i(l,e[l]);});let i=this.ttlAutopurge?(l,p)=>{if(n?.[l]&&(clearTimeout(n[l]),n[l]=void 0),p&&p!==0&&n){let m=setTimeout(()=>{r(this,X).call(this,l)&&f(this,c,ye).call(this,r(this,N)[l],"expire");},p+1);m.unref&&m.unref(),n[l]=m;}}:()=>{};S(this,pe,(l,p)=>{if(e[p]){let m=e[p],u=t[p];if(!m||!u)return;l.ttl=m,l.start=u,l.now=s||o();let T=l.now-u;l.remainingTTL=m-T;}});let s=0,o=()=>{let l=r(this,te).now();if(this.ttlResolution>0){s=l;let p=setTimeout(()=>s=0,this.ttlResolution);p.unref&&p.unref();}return l};this.getRemainingTTL=l=>{let p=r(this,F).get(l);if(p===void 0)return 0;let m=e[p],u=t[p];if(!m||!u)return 1/0;let T=(s||o())-u;return m-T},S(this,X,l=>{let p=t[l],m=e[l];return !!m&&!!p&&(s||o())-p>m});},ge=new WeakMap,pe=new WeakMap,Ne=new WeakMap,X=new WeakMap,lt=function(){let e=new Fe(r(this,J));S(this,re,0),S(this,ie,e),S(this,Le,t=>{S(this,re,r(this,re)-e[t]),e[t]=0;}),S(this,De,(t,n,i,s)=>{if(f(this,c,M).call(this,n))return 0;if(!de(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(n,t),!de(i))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 i}),S(this,Oe,(t,n,i)=>{if(e[t]=n,r(this,j)){let s=r(this,j)-e[t];for(;r(this,re)>s;)f(this,c,Ve).call(this,true);}S(this,re,r(this,re)+e[t]),i&&(i.entrySize=n,i.totalCalculatedSize=r(this,re));});},Le=new WeakMap,Oe=new WeakMap,De=new WeakMap,fe=function*({allowStale:e=this.allowStale}={}){if(r(this,V))for(let t=r(this,G);!(!f(this,c,Xe).call(this,t)||((e||!r(this,X).call(this,t))&&(yield t),t===r(this,K)));)t=r(this,k)[t];},be=function*({allowStale:e=this.allowStale}={}){if(r(this,V))for(let t=r(this,K);!(!f(this,c,Xe).call(this,t)||((e||!r(this,X).call(this,t))&&(yield t),t===r(this,G)));)t=r(this,W)[t];},Xe=function(e){return e!==void 0&&r(this,F).get(r(this,N)[e])===e},Ve=function(e){var s;let t=r(this,K),n=r(this,N)[t],i=r(this,_)[t];return r(this,me)&&f(this,c,M).call(this,i)?i.__abortController.abort(new Error("evicted")):(r(this,oe)||r(this,B))&&(r(this,oe)&&((s=r(this,Z))==null||s.call(this,i,n,"evict")),r(this,B)&&r(this,z)?.push([i,n,"evict"])),r(this,Le).call(this,t),r(this,q)?.[t]&&(clearTimeout(r(this,q)[t]),r(this,q)[t]=void 0),e&&(r(this,N)[t]=void 0,r(this,_)[t]=void 0,r(this,ne).push(t)),r(this,V)===1?(S(this,K,S(this,G,0)),r(this,ne).length=0):S(this,K,r(this,W)[t]),r(this,F).delete(n),Ye(this,V)._--,t},Ge=function(e,t,n,i){let s=t===void 0?void 0:r(this,_)[t];if(f(this,c,M).call(this,s))return s;let o=new ze,{signal:l}=n;l?.addEventListener("abort",()=>o.abort(l.reason),{signal:o.signal});let p={signal:o.signal,options:n,context:i},m=(A,C=false)=>{let{aborted:a}=o.signal,d=n.ignoreFetchAbort&&A!==void 0,O=n.ignoreFetchAbort||!!(n.allowStaleOnFetchAbort&&A!==void 0);if(n.status&&(a&&!C?(n.status.fetchAborted=true,n.status.fetchError=o.signal.reason,d&&(n.status.fetchAbortIgnored=true)):n.status.fetchResolved=true),a&&!d&&!C)return T(o.signal.reason,O);let I=P,v=r(this,_)[t];return (v===P||d&&C&&v===void 0)&&(A===void 0?I.__staleWhileFetching!==void 0?r(this,_)[t]=I.__staleWhileFetching:f(this,c,ye).call(this,e,"fetch"):(n.status&&(n.status.fetchUpdated=true),this.set(e,A,p.options))),A},u=A=>(n.status&&(n.status.fetchRejected=true,n.status.fetchError=A),T(A,false)),T=(A,C)=>{let{aborted:a}=o.signal,d=a&&n.allowStaleOnFetchAbort,O=d||n.allowStaleOnFetchRejection,I=O||n.noDeleteOnFetchRejection,v=P;if(r(this,_)[t]===P&&(!I||!C&&v.__staleWhileFetching===void 0?f(this,c,ye).call(this,e,"fetch"):d||(r(this,_)[t]=v.__staleWhileFetching)),O)return n.status&&v.__staleWhileFetching!==void 0&&(n.status.returnedStale=true),v.__staleWhileFetching;if(v.__returned===v)throw A},D=(A,C)=>{var d;let a=(d=r(this,Ee))==null?void 0:d.call(this,e,s,p);a&&a instanceof Promise&&a.then(O=>A(O===void 0?void 0:O),C),o.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(A(void 0),n.allowStaleOnFetchAbort&&(A=O=>m(O,true)));});};n.status&&(n.status.fetchDispatched=true);let P=new Promise(D).then(m,u),U=Object.assign(P,{__abortController:o,__staleWhileFetching:s,__returned:void 0});return t===void 0?(this.set(e,U,{...p.options,status:void 0}),t=r(this,F).get(e)):r(this,_)[t]=U,U},M=function(e){if(!r(this,me))return false;let t=e;return !!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof ze},Je=function(e,t){r(this,k)[t]=e,r(this,W)[e]=t;},Me=function(e){e!==r(this,G)&&(e===r(this,K)?S(this,K,r(this,W)[e]):f(this,c,Je).call(this,r(this,k)[e],r(this,W)[e]),f(this,c,Je).call(this,r(this,G),e),S(this,G,e));},ye=function(e,t){var i,s;let n=false;if(r(this,V)!==0){let o=r(this,F).get(e);if(o!==void 0)if(r(this,q)?.[o]&&(clearTimeout(r(this,q)?.[o]),r(this,q)[o]=void 0),n=true,r(this,V)===1)f(this,c,Qe).call(this,t);else {r(this,Le).call(this,o);let l=r(this,_)[o];if(f(this,c,M).call(this,l)?l.__abortController.abort(new Error("deleted")):(r(this,oe)||r(this,B))&&(r(this,oe)&&((i=r(this,Z))==null||i.call(this,l,e,t)),r(this,B)&&r(this,z)?.push([l,e,t])),r(this,F).delete(e),r(this,N)[o]=void 0,r(this,_)[o]=void 0,o===r(this,G))S(this,G,r(this,k)[o]);else if(o===r(this,K))S(this,K,r(this,W)[o]);else {let p=r(this,k)[o];r(this,W)[p]=r(this,W)[o];let m=r(this,W)[o];r(this,k)[m]=r(this,k)[o];}Ye(this,V)._--,r(this,ne).push(o);}}if(r(this,B)&&r(this,z)?.length){let o=r(this,z),l;for(;l=o?.shift();)(s=r(this,ee))==null||s.call(this,...l);}return n},Qe=function(e){var t,n;for(let i of f(this,c,be).call(this,{allowStale:true})){let s=r(this,_)[i];if(f(this,c,M).call(this,s))s.__abortController.abort(new Error("deleted"));else {let o=r(this,N)[i];r(this,oe)&&((t=r(this,Z))==null||t.call(this,s,o,e)),r(this,B)&&r(this,z)?.push([s,o,e]);}}if(r(this,F).clear(),r(this,_).fill(void 0),r(this,N).fill(void 0),r(this,$)&&r(this,se)){r(this,$).fill(0),r(this,se).fill(0);for(let i of r(this,q)??[])i!==void 0&&clearTimeout(i);r(this,q)?.fill(void 0);}if(r(this,ie)&&r(this,ie).fill(0),S(this,K,0),S(this,G,0),r(this,ne).length=0,S(this,re,0),S(this,V,0),r(this,B)&&r(this,z)){let i=r(this,z),s;for(;s=i?.shift();)(n=r(this,ee))==null||n.call(this,...s);}},Re);var Pe=class{constructor(e){E(this,"cache");E(this,"map",new Map);this.cache=new at({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 t=this.map.delete(e);return t&&this.cache.delete(e),t}get forEach(){return this.map.forEach}get(e){let t=this.cache.get(e);return t||this.map.get(e)}has(e){return this.map.has(e)}set(e,t){return this.map.set(e,t),this.cache.set(e,t),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var L;(i=>(i.log=(s,...o)=>console.log(`[Pixi\u2019VN] ${s}`,...o),i.warn=(s,...o)=>console.warn(`[Pixi\u2019VN] ${s}`,...o),i.error=(s,...o)=>console.error(`[Pixi\u2019VN] ${s}`,...o),i.info=(s,...o)=>console.info(`[Pixi\u2019VN] ${s}`,...o)))(L||={});var ve=new Pe({cacheSize:10}),ht;(s=>{function h(o){let l=ve.get(o);if(!l){L.error(`Label "${o}" not found`);return}return l}s.get=h;function e(o){if(Array.isArray(o)){o.forEach(l=>{e(l);});return}ve.has(o.id)&&L.info(`Label "${o.id}" already exists, it will be overwritten`),ve.set(o.id,o);}s.add=e;function t(){return Array.from(ve.values())}s.values=t;function n(o){return ve.has(o)}s.has=n;function i(){return Array.from(ve.keys())}s.keys=i;})(ht||={});var ae=ht;function ce(h){try{if(typeof h>"u")return h;let e=JSON.stringify(h);return JSON.parse(e)}catch(e){throw L.error("Error creating exportable element",h,e),new core.PixiError("not_json_serializable","Error creating exportable element")}}var y=class y{constructor(){}static get allOpenedLabels(){return core.GameUnifier.getVariable(w,R.OPENED_LABELS_COUNTER_KEY)||{}}static set allOpenedLabels(e){core.GameUnifier.setVariable(w,R.OPENED_LABELS_COUNTER_KEY,e);}static getCurrentStepTimesCounterData(e=""){let t=y.currentLabelStepIndex;if(t===null)return L.error("currentLabelStepIndex is null"),null;let n=`${t}${e}`,i=y.currentLabelId,s=y._currentLabel;if(!i||t===null||!s)return L.error("currentLabelId or currentLabelStepIndex is null or currentLabel not found"),null;let o=s.getStepSha(t)||"error",l=core.GameUnifier.getVariable(w,R.CURRENT_STEP_TIMES_COUNTER_KEY)||{};return l[i]||(l[i]={}),(!l[i][n]||l[i][n].stepSha1!==o)&&(l[i][n]={stepSha1:o}),l[i][n]}static setCurrentStepTimesCounterData(e="",t){let n=y.currentLabelStepIndex,i=n+e,s=y.currentLabelId;if(!s||n===null){L.error("currentLabelId or currentLabelStepIndex is null");return}let o=core.GameUnifier.getVariable(w,R.CURRENT_STEP_TIMES_COUNTER_KEY)||{};o[s]||(o[s]={}),o[s][i]=t,core.GameUnifier.setVariable(w,R.CURRENT_STEP_TIMES_COUNTER_KEY,o);}static getCurrentStepTimesCounter(e=""){let t=y._stepCounter,n=y.getCurrentStepTimesCounterData(e);if(!n)return L.error("getCurrentStepTimesCounter obj is null"),0;let i=n.stepCounters||[];return i.find(o=>o===t)||(i.push(t),n.stepCounters=i,y.setCurrentStepTimesCounterData(e,n)),i.length}static getRandomNumber(e,t,n={}){let i=n.nestedId||"";if(n.onceOnly||false){let o=y.getCurrentStepTimesCounterData(i);if(!o)return;let l=o.usedRandomNumbers||{},p=Array.from({length:t-e+1},(T,D)=>D+e).filter(T=>!l[`${e}-${t}`]?.includes(T));if(p.length===0)return;let m=Math.floor(Math.random()*p.length),u=p[m];return l[`${e}-${t}`]||(l[`${e}-${t}`]=[]),l[`${e}-${t}`].push(u),o.usedRandomNumbers=l,y.setCurrentStepTimesCounterData(i,o),u}return Math.floor(Math.random()*(t-e+1))+e}static resetCurrentStepTimesCounter(e=""){let t=y.currentLabelStepIndex,n=t+e,i=y.currentLabelId;if(!i||t===null){L.error("currentLabelId or currentLabelStepIndex is null");return}let s=core.GameUnifier.getVariable(w,R.CURRENT_STEP_TIMES_COUNTER_KEY)||{};s[i]||(s[i]={}),s[i][n]={stepCounters:[],stepSha1:""},core.GameUnifier.setVariable(w,R.CURRENT_STEP_TIMES_COUNTER_KEY,s);}static get allChoicesMade(){return core.GameUnifier.getVariable(w,R.ALL_CHOICES_MADE_KEY)||[]}static set allChoicesMade(e){core.GameUnifier.setVariable(w,R.ALL_CHOICES_MADE_KEY,e);}static increaseStepCounter(){y._stepCounter++;}static get openedLabels(){return ce(y._openedLabels)}static set openedLabels(e){y._openedLabels=ce(e);}static get originalOpenedLabels(){return ce(y._originalOpenedLabels)}static set originalOpenedLabels(e){y._originalOpenedLabels=ce(e);}static get _currentLabel(){if(y.currentLabelId)return ae.get(y.currentLabelId)}static get currentLabelId(){if(y._openedLabels.length>0)return y._openedLabels[y._openedLabels.length-1].label}static get currentLabelStepIndex(){return y._openedLabels.length>0?y._openedLabels[y._openedLabels.length-1].currentStepIndex:null}static addLabelHistory(e,t){let n=y.allOpenedLabels,i=y.allOpenedLabels[e]?.biggestStep||0,s=y.allOpenedLabels[e]?.openCount||0;(!i||i<t)&&(n[e]={biggestStep:t,openCount:s},y.allOpenedLabels=n);}static addChoicesMade(e,t,n,i){let s=y.allChoicesMade,o=s.findIndex(l=>l.labelId===e&&l.stepIndex===t&&l.choiceIndex===i&&l.stepSha1===n);o<0?s.push({labelId:e,stepIndex:t,choiceIndex:i,stepSha1:n,madeTimes:1}):s[o].madeTimes++,y.allChoicesMade=s;}static pushNewLabel(e){if(!ae.get(e))throw new core.PixiError("unregistered_element",`Label ${e} not found`);y._openedLabels.push({label:e,currentStepIndex:0});let n=y.allOpenedLabels,i=y.allOpenedLabels[e]?.biggestStep||0,s=y.allOpenedLabels[e]?.openCount||0;n[e]={biggestStep:i,openCount:s+1},y.allOpenedLabels=n;}static increaseCurrentStepIndex(){if(y._openedLabels.length>0){let e=y._openedLabels[y._openedLabels.length-1];y._openedLabels[y._openedLabels.length-1]={...e,currentStepIndex:e.currentStepIndex+1};}}static set onStepStart(e){y._onStepStart=e;}static get onStepStart(){return async(e,t)=>{let n=[];return y.onLoadingLabel&&e===0&&n.push(y.onLoadingLabel(e,t)),y._onStepStart&&n.push(y._onStepStart(e,t)),await Promise.all(n)}}};E(y,"choiceMadeTemp"),E(y,"lastHistoryStep",null),E(y,"_stepCounter",0),E(y,"_openedLabels",[]),E(y,"_originalOpenedLabels",[]),E(y,"_onStepStart"),E(y,"onLoadingLabel"),E(y,"onStepEnd");var b=y;var Ue=class{get currentStepTimesCounter(){return b.getCurrentStepTimesCounter()}set currentStepTimesCounter(e){b.resetCurrentStepTimesCounter();}getRandomNumber(e,t,n={}){return b.getRandomNumber(e,t,n)}get stepCounter(){return b._stepCounter}get openedLabels(){return b.openedLabels}get currentLabel(){return b._currentLabel}addStepHistory(e,t={}){let{choiceMade:n,ignoreSameStep:i}=t,s,o,l,p=core.GameUnifier.getVariable(w,R.LAST_STEP_GLUED)===this.stepCounter;core.GameUnifier.getVariable(w,R.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(s=core.GameUnifier.getVariable(w,R.CURRENT_DIALOGUE_MEMORY_KEY)),core.GameUnifier.getVariable(w,R.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(o=core.GameUnifier.getVariable(w,R.CURRENT_MENU_OPTIONS_MEMORY_KEY)),core.GameUnifier.getVariable(w,R.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(l=core.GameUnifier.getVariable(w,R.CURRENT_INPUT_VALUE_MEMORY_KEY));let m=b.openedLabels,u={currentLabel:b.currentLabelId,dialogue:s,choices:o,stepSha1:e,index:this.stepCounter,labelStepIndex:b.currentLabelStepIndex,choiceIndexMade:n,inputValue:l,alreadyMadeChoices:this.alreadyCurrentStepMadeChoices,isGlued:p,openedLabels:m};b.originalOpenedLabels=m,core.GameUnifier.addHistoryItem(u,{ignoreSameStep:i}),b.lastHistoryStep=u,b.increaseStepCounter();}closeCurrentLabel(){if(!b.currentLabelId){L.warn("No label to close");return}if(!this.currentLabel){L.error("currentLabel not found");return}let e=b.openedLabels;e.pop(),b.openedLabels=e,core.GameUnifier.onLabelClosing(this.openedLabels.length);}closeAllLabels(){for(;b.openedLabels.length>0;)this.closeCurrentLabel(),core.GameUnifier.onLabelClosing(this.openedLabels.length);}isLabelAlreadyCompleted(e){let t;typeof e=="string"?t=e:t=e.id;let i=b.allOpenedLabels[t]?.biggestStep||0;if(i){let s=ae.get(t);if(s)return s.stepCount<=i}return false}get alreadyCurrentStepMadeChoicesObj(){let e=b.currentLabelStepIndex,t=this.currentLabel;if(e===null||!t)return;let n=t.getStepSha(e);return n||(L.warn("stepSha not found, setting to ERROR"),n="error"),b.allChoicesMade.filter(i=>i.labelId===t?.id&&i.stepIndex===e&&i.stepSha1===n)}get alreadyCurrentStepMadeChoices(){return this.alreadyCurrentStepMadeChoicesObj?.map(e=>e.choiceIndex)}get isCurrentStepAlreadyOpened(){let e=b.currentLabelId;if(e){let t=b.allOpenedLabels[e]?.openCount||0;if(b.currentLabelStepIndex&&t>=b.currentLabelStepIndex)return true}return false}getTimesLabelOpened(e){return b.allOpenedLabels[e]?.openCount||0}getTimesChoiceMade(e){return this.alreadyCurrentStepMadeChoicesObj?.find(t=>t.choiceIndex===e)?.madeTimes||0}addCurrentStepToHistory(){this.addStepHistory("dev",{ignoreSameStep:true});}getCanContinue(e){let t=e?.showWarn||false,n=this.choices;return n&&n.length>0?(t&&L.warn("The player must make a choice"),false):this.isRequiredInput?(t&&L.warn("The player must enter a value"),false):true}get canContinue(){return core.GameUnifier.runningStepsCount!==0?false:this.getCanContinue()}async onStepStart(e,t){let n=[];return e.onStepStart&&n.push(e.onStepStart(t,e)),b.onStepStart&&n.push(b.onStepStart(t,e)),await Promise.all(n)}async onStepEnd(e,t){let n=[];return e.onStepEnd&&n.push(e.onStepEnd(t,e)),b.onStepEnd&&n.push(b.onStepEnd(t,e)),await Promise.all(n)}async continue(e,t={}){let{runNow:n=false,steps:i=1}=t;if(!Number.isFinite(i)){L.warn(`[continue] The parameter steps must be a valid finite number, received: ${i}`);return}if(i<=0){L.warn(`[continue] The parameter steps must be greater than 0, received: ${i}`);return}if(!n&&!this.getCanContinue({showWarn:true}))return;if(!n&&core.GameUnifier.runningStepsCount!==0){core.GameUnifier.increaseContinueRequest(i);return}i>1&&core.GameUnifier.increaseContinueRequest(i-1),core.GameUnifier.runningStepsCount++;let s;try{core.GameUnifier.runningStepsCount===1&&await core.GameUnifier.onPreContinue(),b.increaseCurrentStepIndex(),s=await this.runCurrentStep(e,t);}catch(o){throw L.error("Error continuing",o),o}return core.GameUnifier.runningStepsCount--,await this.afterRunCurrentStep(e)||s}async afterRunCurrentStep(e){if(core.GameUnifier.runningStepsCount===0&&core.GameUnifier.continueRequestsCount!==0)return await core.GameUnifier.processNavigationRequests(e);if(this.openedLabels.length===0){if(core.GameUnifier.onEnd)return await core.GameUnifier.onEnd(e,{labelId:"end"});L.error("The end of the game is not managed, so the game is blocked. Read this documentation to know how to manage the end of the game: https://pixi-vn.com/start/other-narrative-features.html#how-manage-the-end-of-the-game");}}async runCurrentStep(e,t={}){let{choiceMade:n}=t;if(b.currentLabelId){let i=b.currentLabelStepIndex;if(i===null){L.error("currentLabelStepIndex is null");return}let s=b._currentLabel;if(!s){L.error("currentLabel not found");return}if(s.stepCount>i){try{await this.onStepStart(s,i);}catch(u){L.error("Error running onStepStart",u),this.onStepError&&await this.onStepError(u,e);return}let o=s.getStepById(i);if(!o){L.error("step not found");return}let l=s.getStepSha(i);l||(L.warn("stepSha not found, setting to ERROR"),l="error");let p,m;try{p=await o(e,{labelId:s.id});}catch(u){L.error("Error running step",u),m=u;}try{let u=this.choices;if(u?.length===1&&u[0].autoSelect){let T=u[0];p=await this.selectChoice(T,e);}}catch(u){L.error("Error auto-selecting choice",u),m||(m=u);}try{let u=b.lastHistoryStep;n!==void 0&&u&&(l=u.stepSha1,l||(L.warn("stepSha not found, setting to ERROR"),l="error"),b.addChoicesMade(u.currentLabel||"error",typeof u.labelStepIndex=="number"?u.labelStepIndex:-1,u.stepSha1||"error",n),b.choiceMadeTemp=n);}catch(u){L.warn("Error adding choice made to history",u);}try{core.GameUnifier.runningStepsCount===1&&(b.addLabelHistory(s.id,i),this.addStepHistory(l,{...t,choiceMade:b.choiceMadeTemp}),b.choiceMadeTemp=void 0);}catch(u){L.warn("Error adding step to history",u);}try{this.currentLabel&&await this.onStepEnd(this.currentLabel,b.currentLabelStepIndex||0);}catch(u){L.warn("Error running onStepEnd",u);}return m&&this.onStepError&&await this.onStepError(m,e),p}else {if(this.openedLabels.length>1)return this.closeCurrentLabel(),await this.continue(e,t);if(this.openedLabels.length===1){b.openedLabels=[];return}}}else {if(this.openedLabels.length===0)return;L.error("currentLabelId not found");}}async call(e,t,n){let{choiceMade:i}=n||{},s;typeof e=="string"?s=e:s=e.id,core.GameUnifier.runningStepsCount++;let o;try{let l=ae.get(s);if(!l)throw new core.PixiError("unregistered_element",`Label ${s} not found`);b.pushNewLabel(l.id),o=await this.runCurrentStep(t,{choiceMade:i});}catch(l){throw L.error("Error calling label",l),l}return core.GameUnifier.runningStepsCount--,await this.afterRunCurrentStep(t)||o}async jump(e,t,n){if(this.stepCounter===0)return await this.call(e,t,n);this.openedLabels.length>0&&this.closeCurrentLabel();let{choiceMade:i}=n||{},s;typeof e=="string"?s=e:s=e.id,core.GameUnifier.runningStepsCount++;let o;try{let l=ae.get(s);if(!l)throw new core.PixiError("unregistered_element",`Label ${s} not found`);b.pushNewLabel(l.id),o=await this.runCurrentStep(t,{choiceMade:i});}catch(l){throw L.error("Error jumping to label",l),l}return core.GameUnifier.runningStepsCount--,await this.afterRunCurrentStep(t)||o}async selectChoice(e,t){this.choices=void 0;let n=e.type;switch(n){case "call":return await this.call(e.label,{...e.props,...t},{choiceMade:e.choiceIndex});case "jump":return await this.jump(e.label,{...e.props,...t},{choiceMade:e.choiceIndex});case "close":return await this.closeChoiceMenu(e,{...e.props,...t});default:throw L.error(`Type ${n} not found`),new core.PixiError("invalid_usage",`Type ${n} not found`)}}async closeChoiceMenu(e,t){if(e.type!=="close")throw L.error("For closeChoiceMenu, the type must be close"),new core.PixiError("invalid_usage","For closeChoiceMenu, the type must be close");let n;return typeof e.choiceIndex=="number"&&(n=e.choiceIndex),e.closeCurrentLabel&&this.closeCurrentLabel(),await this.continue(t,{choiceMade:n})}get onStepError(){return async(e,t)=>{try{await core.GameUnifier.runOnError(e,t);}catch(n){L.error("Error in onError handler",n);}}}get dialogue(){let e=core.GameUnifier.getVariable(w,R.CURRENT_DIALOGUE_MEMORY_KEY);if(e)return {...e,character:e.character?core.GameUnifier.getCharacter(e.character)||e.character:void 0}}set dialogue(e){if(e===void 0){core.GameUnifier.setVariable(w,R.CURRENT_DIALOGUE_MEMORY_KEY,void 0);return}if((typeof e=="string"||Array.isArray(e))&&(e={text:e}),this.dialogGlue){let t=core.GameUnifier.getVariable(w,R.CURRENT_DIALOGUE_MEMORY_KEY);if(t){let n=[];Array.isArray(t.text)?n=[...t.text]:n=[t.text],Array.isArray(e.text)?n=[...n,...e.text]:n=[...n,e.text],e.text=n,e.character=e.character||t.character;}core.GameUnifier.setVariable(w,R.LAST_STEP_GLUED,this.stepCounter),this.dialogGlue=false;}try{core.GameUnifier.setVariable(w,R.CURRENT_DIALOGUE_MEMORY_KEY,ce({...e,character:typeof e.character=="string"?e.character:e.character?.id})),core.GameUnifier.setVariable(w,R.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}catch{throw L.error("DialogueInterface cannot contain functions or classes"),new core.PixiError("not_json_serializable","ChoiceInterface cannot contain functions or classes")}}get choices(){let e=core.GameUnifier.getVariable(w,R.CURRENT_MENU_OPTIONS_MEMORY_KEY);if(e){let t=[],n=e.map((s,o)=>({...s,choiceIndex:o})),i=this.alreadyCurrentStepMadeChoices;if(n=n.filter((s,o)=>s.oneTime&&i?.includes(o)?false:s.onlyHaveNoChoice?(t.push(s),false):true),n.length>0)return n;if(t.length>0)return [t[0]]}}set choices(e){if(!e||e.length===0){core.GameUnifier.setVariable(w,R.CURRENT_MENU_OPTIONS_MEMORY_KEY,void 0);return}try{core.GameUnifier.setVariable(w,R.CURRENT_MENU_OPTIONS_MEMORY_KEY,ce(e)),core.GameUnifier.setVariable(w,R.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}catch{throw L.error("ChoiceInterface cannot contain functions or classes"),new core.PixiError("not_json_serializable","ChoiceInterface cannot contain functions or classes")}}get dialogGlue(){return core.GameUnifier.getFlag(R.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)}set dialogGlue(e){core.GameUnifier.setFlag(R.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,e);}get inputValue(){return core.GameUnifier.getVariable(w,R.CURRENT_INPUT_VALUE_MEMORY_KEY)}set inputValue(e){this.removeInputRequest(),core.GameUnifier.setVariable(w,R.CURRENT_INPUT_VALUE_MEMORY_KEY,e),core.GameUnifier.setVariable(w,R.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}get isRequiredInput(){return core.GameUnifier.getVariable(w,R.CURRENT_INPUT_INFO_MEMORY_KEY)?.isRequired||false}get inputType(){return core.GameUnifier.getVariable(w,R.CURRENT_INPUT_INFO_MEMORY_KEY)?.type}requestInput(e,t){e.isRequired=true,core.GameUnifier.setVariable(w,R.CURRENT_INPUT_INFO_MEMORY_KEY,e),t!==void 0?core.GameUnifier.setVariable(w,R.CURRENT_INPUT_VALUE_MEMORY_KEY,t):core.GameUnifier.removeVariable(w,R.CURRENT_INPUT_VALUE_MEMORY_KEY);}removeInputRequest(){core.GameUnifier.removeVariable(w,R.CURRENT_INPUT_INFO_MEMORY_KEY),core.GameUnifier.removeVariable(w,R.CURRENT_INPUT_VALUE_MEMORY_KEY);}clear(){b.openedLabels=[],b._stepCounter=0;}export(){return {openedLabels:ce(b.openedLabels),stepCounter:this.stepCounter}}async onLoadingLabel(e){let t=this.openedLabels.map(async n=>{let i=[],s=ae.get(n.label);return s&&(s.onLoadingLabel&&i.push(s.onLoadingLabel(e,s)),b.onLoadingLabel&&i.push(b.onLoadingLabel(e,s))),await Promise.all(i)});return await Promise.all(t)}async restore(e,t){this.clear();try{b.lastHistoryStep=t,Object.hasOwn(e,"openedLabels")?(b.openedLabels=e.openedLabels,b.originalOpenedLabels=b.openedLabels):L.warn("Could not import openedLabels data, so will be ignored"),Object.hasOwn(e,"stepCounter")?b._stepCounter=e.stepCounter:L.warn("Could not import stepCounter data, so will be ignored");try{await this.onLoadingLabel(b.currentLabelStepIndex||0);}catch(n){L.error("Error running onLoadingLabel",n);}}catch(n){L.error("Error importing data",n);}}};function At(h,e,t,n){let i=typeof e=="string"?e:e.id;return {...n,label:i,props:t,text:h,type:n?.type||"call"}}var pt="close";function Mt(h,e){return {...e,type:pt,text:h}}var bt=Ct(ft());var xe=class{constructor(e,t){E(this,"id");E(this,"_onStepStart");E(this,"_onLoadingLabel");E(this,"_onStepEnd");this.id=e,this._onStepStart=t?.onStepStart,this._onLoadingLabel=t?.onLoadingLabel,this._onStepEnd=t?.onStepEnd;}get onStepStart(){return async(e,t)=>{if(this._onLoadingLabel&&e===0&&await this._onLoadingLabel(e,t),this._onStepStart)return await this._onStepStart(e,t)}}get onLoadingLabel(){return this._onLoadingLabel}get onStepEnd(){return this._onStepEnd}};var Ae=class extends xe{constructor(t,n,i){super(t,i);E(this,"_steps");this._steps=n;}get stepCount(){return this.steps.length}getStepById(t){return this.steps[t]}get steps(){return typeof this._steps=="function"?this._steps():this._steps}getStepSha(t){if(t<0||t>=this.steps.length)return L.warn("stepSha not found, setting to ERROR"),"error";try{let n=this.steps[t];return (0,bt.default)(n.toString().toLocaleLowerCase()).toString()}catch(n){return L.warn("stepSha not found, setting to ERROR",n),"error"}}};function yt(h,e,t){let n=new Ae(h,e,t);return ae.add(n),n}var vr=new Ue;
|
|
2
2
|
exports.Label=Ae;exports.LabelAbstract=xe;exports.NarrationManagerStatic=b;exports.RegisteredLabels=ae;exports.narration=vr;exports.newChoiceOption=At;exports.newCloseChoiceOption=Mt;exports.newLabel=yt;
|