@drincs/pixi-vn 1.8.21 → 1.8.23

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/canvas.d.cts CHANGED
@@ -411,7 +411,7 @@ interface CanvasManagerInterface {
411
411
  readonly currentTickersSteps: Map<string, Map<string, TickersSequence>>;
412
412
  /**
413
413
  * Find a ticker by its id.
414
- * @param tickerId The id of the ticker.
414
+ * @param tickerId The id of the ticker to be found.
415
415
  * @param args The args of the ticker.
416
416
  * @returns The ticker if found, undefined otherwise.
417
417
  */
@@ -422,7 +422,7 @@ interface CanvasManagerInterface {
422
422
  * If already exists a sequence of tickers with the same alias, it will be removed.
423
423
  * @param canvasElementAlias The alias of the canvas element that will use the ticker.
424
424
  * @param ticker The ticker class to be run.
425
- * @returns The id of the ticker.
425
+ * @returns The id of the ticker that was added.
426
426
  * @example
427
427
  * ```ts
428
428
  * canvas.addTicker("alien", new RotateTicker({ speed: 0.2 }))
@@ -466,7 +466,7 @@ interface CanvasManagerInterface {
466
466
  removeAllTickers(): void;
467
467
  /**
468
468
  * Remove a ticker by the id.
469
- * @param tickerId The id of the ticker.
469
+ * @param tickerId The id or an array of ids of the ticker to be removed.
470
470
  */
471
471
  removeTicker(tickerId: string | string[]): void;
472
472
  /**
package/dist/canvas.d.ts CHANGED
@@ -411,7 +411,7 @@ interface CanvasManagerInterface {
411
411
  readonly currentTickersSteps: Map<string, Map<string, TickersSequence>>;
412
412
  /**
413
413
  * Find a ticker by its id.
414
- * @param tickerId The id of the ticker.
414
+ * @param tickerId The id of the ticker to be found.
415
415
  * @param args The args of the ticker.
416
416
  * @returns The ticker if found, undefined otherwise.
417
417
  */
@@ -422,7 +422,7 @@ interface CanvasManagerInterface {
422
422
  * If already exists a sequence of tickers with the same alias, it will be removed.
423
423
  * @param canvasElementAlias The alias of the canvas element that will use the ticker.
424
424
  * @param ticker The ticker class to be run.
425
- * @returns The id of the ticker.
425
+ * @returns The id of the ticker that was added.
426
426
  * @example
427
427
  * ```ts
428
428
  * canvas.addTicker("alien", new RotateTicker({ speed: 0.2 }))
@@ -466,7 +466,7 @@ interface CanvasManagerInterface {
466
466
  removeAllTickers(): void;
467
467
  /**
468
468
  * Remove a ticker by the id.
469
- * @param tickerId The id of the ticker.
469
+ * @param tickerId The id or an array of ids of the ticker to be removed.
470
470
  */
471
471
  removeTicker(tickerId: string | string[]): void;
472
472
  /**
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var nt=require('@drincs/pixi-vn/canvas'),Bt=require('@drincs/pixi-vn/characters'),core=require('@drincs/pixi-vn/core'),et=require('@drincs/pixi-vn/history'),L=require('@drincs/pixi-vn/narration'),pt=require('@drincs/pixi-vn/sound'),G=require('@drincs/pixi-vn/storage'),motion=require('@drincs/pixi-vn/motion');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var nt__namespace=/*#__PURE__*/_interopNamespace(nt);var Bt__namespace=/*#__PURE__*/_interopNamespace(Bt);var et__namespace=/*#__PURE__*/_interopNamespace(et);var L__namespace=/*#__PURE__*/_interopNamespace(L);var pt__namespace=/*#__PURE__*/_interopNamespace(pt);var G__namespace=/*#__PURE__*/_interopNamespace(G);var Xt=Object.defineProperty;var Jt=h=>{throw TypeError(h)};var ue=(h,e,i)=>e in h?Xt(h,e,{enumerable:true,configurable:true,writable:true,value:i}):h[e]=i;var fe=(h,e)=>{for(var i in e)Xt(h,i,{get:e[i],enumerable:true});};var C=(h,e,i)=>ue(h,typeof e!="symbol"?e+"":e,i),jt=(h,e,i)=>e.has(h)||Jt("Cannot "+i);var t=(h,e,i)=>(jt(h,e,"read from private field"),i?i.call(h):e.get(h)),_=(h,e,i)=>e.has(h)?Jt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(h):e.set(h,i),u=(h,e,i,s)=>(jt(h,e,"write to private field"),e.set(h,i),i),d=(h,e,i)=>(jt(h,e,"access private method"),i);var Rt=(h,e,i,s)=>({set _(r){u(h,e,r);},get _(){return t(h,e,s)}});var me=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,ee=new Set,Gt=typeof process=="object"&&process?process:{},ie=(h,e,i,s)=>{typeof Gt.emitWarning=="function"?Gt.emitWarning(h,e,i,s):console.error(`[${i}] ${e}: ${h}`);},Nt=globalThis.AbortController,Qt=globalThis.AbortSignal;if(typeof Nt>"u"){Qt=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,s){this._onabort.push(s);}},Nt=class{constructor(){e();}signal=new Qt;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 h=Gt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{h&&(h=false,ie("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 ge=h=>!ee.has(h);var at=h=>h&&h===Math.floor(h)&&h>0&&isFinite(h),se=h=>at(h)?h<=Math.pow(2,8)?Uint8Array:h<=Math.pow(2,16)?Uint16Array:h<=Math.pow(2,32)?Uint32Array:h<=Number.MAX_SAFE_INTEGER?Dt:null:null,Dt=class extends Array{constructor(h){super(h),this.fill(0);}},it,St,_e=(it=class{heap;length;static create(e){let i=se(e);if(!i)return [];u(it,St,true);let s=new it(e,i);return u(it,St,false),s}constructor(e,i){if(!t(it,St))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},St=new WeakMap,_(it,St,false),it),Zt,te,K,M,q,ut,$,yt,xt,B,O,X,T,b,m,P,z,N,R,J,D,Q,Z,V,W,tt,dt,j,Et,l,It,ft,ot,Tt,Y,oe,mt,bt,Ot,lt,ht,Mt,Lt,Ct,E,zt,At,ct,Vt,wt,re=(wt=class{constructor(e){_(this,l);_(this,K);_(this,M);_(this,q);_(this,ut);_(this,$);_(this,yt);_(this,xt);_(this,B);C(this,"ttl");C(this,"ttlResolution");C(this,"ttlAutopurge");C(this,"updateAgeOnGet");C(this,"updateAgeOnHas");C(this,"allowStale");C(this,"noDisposeOnSet");C(this,"noUpdateTTL");C(this,"maxEntrySize");C(this,"sizeCalculation");C(this,"noDeleteOnFetchRejection");C(this,"noDeleteOnStaleGet");C(this,"allowStaleOnFetchAbort");C(this,"allowStaleOnFetchRejection");C(this,"ignoreFetchAbort");_(this,O);_(this,X);_(this,T);_(this,b);_(this,m);_(this,P);_(this,z);_(this,N);_(this,R);_(this,J);_(this,D);_(this,Q);_(this,Z);_(this,V);_(this,W);_(this,tt);_(this,dt);_(this,j);_(this,Et);_(this,ft,()=>{});_(this,ot,()=>{});_(this,Tt,()=>{});_(this,Y,()=>false);_(this,mt,e=>{});_(this,bt,(e,i,s)=>{});_(this,Ot,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});C(this,Zt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:n,updateAgeOnGet:o,updateAgeOnHas:c,allowStale:p,dispose:v,onInsert:U,disposeAfter:S,noDisposeOnSet:rt,noUpdateTTL:I,maxSize:k=0,maxEntrySize:w=0,sizeCalculation:y,fetchMethod:a,memoMethod:x,noDeleteOnFetchRejection:A,noDeleteOnStaleGet:f,allowStaleOnFetchRejection:g,allowStaleOnFetchAbort:F,ignoreFetchAbort:H,perf:_t}=e;if(_t!==void 0&&typeof _t?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(u(this,B,_t??me),i!==0&&!at(i))throw new TypeError("max option must be a nonnegative integer");let vt=i?se(i):Array;if(!vt)throw new Error("invalid max value: "+i);if(u(this,K,i),u(this,M,k),this.maxEntrySize=w||t(this,M),this.sizeCalculation=y,this.sizeCalculation){if(!t(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(x!==void 0&&typeof x!="function")throw new TypeError("memoMethod must be a function if defined");if(u(this,xt,x),a!==void 0&&typeof a!="function")throw new TypeError("fetchMethod must be a function if specified");if(u(this,yt,a),u(this,dt,!!a),u(this,T,new Map),u(this,b,new Array(i).fill(void 0)),u(this,m,new Array(i).fill(void 0)),u(this,P,new vt(i)),u(this,z,new vt(i)),u(this,N,0),u(this,R,0),u(this,J,_e.create(i)),u(this,O,0),u(this,X,0),typeof v=="function"&&u(this,q,v),typeof U=="function"&&u(this,ut,U),typeof S=="function"?(u(this,$,S),u(this,D,[])):(u(this,$,void 0),u(this,D,void 0)),u(this,tt,!!t(this,q)),u(this,Et,!!t(this,ut)),u(this,j,!!t(this,$)),this.noDisposeOnSet=!!rt,this.noUpdateTTL=!!I,this.noDeleteOnFetchRejection=!!A,this.allowStaleOnFetchRejection=!!g,this.allowStaleOnFetchAbort=!!F,this.ignoreFetchAbort=!!H,this.maxEntrySize!==0){if(t(this,M)!==0&&!at(t(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");d(this,l,oe).call(this);}if(this.allowStale=!!p,this.noDeleteOnStaleGet=!!f,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!c,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");d(this,l,It).call(this);}if(t(this,K)===0&&this.ttl===0&&t(this,M)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,K)&&!t(this,M)){let Pt="LRU_CACHE_UNBOUNDED";ge(Pt)&&(ee.add(Pt),ie("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Pt,wt));}}get perf(){return t(this,B)}static unsafeExposeInternals(e){return {starts:t(e,Z),ttls:t(e,V),autopurgeTimers:t(e,W),sizes:t(e,Q),keyMap:t(e,T),keyList:t(e,b),valList:t(e,m),next:t(e,P),prev:t(e,z),get head(){return t(e,N)},get tail(){return t(e,R)},free:t(e,J),isBackgroundFetch:i=>{var s;return d(s=e,l,E).call(s,i)},backgroundFetch:(i,s,r,n)=>{var o;return d(o=e,l,Ct).call(o,i,s,r,n)},moveToTail:i=>{var s;return d(s=e,l,At).call(s,i)},indexes:i=>{var s;return d(s=e,l,lt).call(s,i)},rindexes:i=>{var s;return d(s=e,l,ht).call(s,i)},isStale:i=>{var s;return t(s=e,Y).call(s,i)}}}get max(){return t(this,K)}get maxSize(){return t(this,M)}get calculatedSize(){return t(this,X)}get size(){return t(this,O)}get fetchMethod(){return t(this,yt)}get memoMethod(){return t(this,xt)}get dispose(){return t(this,q)}get onInsert(){return t(this,ut)}get disposeAfter(){return t(this,$)}getRemainingTTL(e){return t(this,T).has(e)?1/0:0}*entries(){for(let e of d(this,l,lt).call(this))t(this,m)[e]!==void 0&&t(this,b)[e]!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield [t(this,b)[e],t(this,m)[e]]);}*rentries(){for(let e of d(this,l,ht).call(this))t(this,m)[e]!==void 0&&t(this,b)[e]!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield [t(this,b)[e],t(this,m)[e]]);}*keys(){for(let e of d(this,l,lt).call(this)){let i=t(this,b)[e];i!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield i);}}*rkeys(){for(let e of d(this,l,ht).call(this)){let i=t(this,b)[e];i!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield i);}}*values(){for(let e of d(this,l,lt).call(this))t(this,m)[e]!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield t(this,m)[e]);}*rvalues(){for(let e of d(this,l,ht).call(this))t(this,m)[e]!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield t(this,m)[e]);}[(te=Symbol.iterator,Zt=Symbol.toStringTag,te)](){return this.entries()}find(e,i={}){for(let s of d(this,l,lt).call(this)){let r=t(this,m)[s],n=d(this,l,E).call(this,r)?r.__staleWhileFetching:r;if(n!==void 0&&e(n,t(this,b)[s],this))return this.get(t(this,b)[s],i)}}forEach(e,i=this){for(let s of d(this,l,lt).call(this)){let r=t(this,m)[s],n=d(this,l,E).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e.call(i,n,t(this,b)[s],this);}}rforEach(e,i=this){for(let s of d(this,l,ht).call(this)){let r=t(this,m)[s],n=d(this,l,E).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e.call(i,n,t(this,b)[s],this);}}purgeStale(){let e=false;for(let i of d(this,l,ht).call(this,{allowStale:true}))t(this,Y).call(this,i)&&(d(this,l,ct).call(this,t(this,b)[i],"expire"),e=true);return e}info(e){let i=t(this,T).get(e);if(i===void 0)return;let s=t(this,m)[i],r=d(this,l,E).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let n={value:r};if(t(this,V)&&t(this,Z)){let o=t(this,V)[i],c=t(this,Z)[i];if(o&&c){let p=o-(t(this,B).now()-c);n.ttl=p,n.start=Date.now();}}return t(this,Q)&&(n.size=t(this,Q)[i]),n}dump(){let e=[];for(let i of d(this,l,lt).call(this,{allowStale:true})){let s=t(this,b)[i],r=t(this,m)[i],n=d(this,l,E).call(this,r)?r.__staleWhileFetching:r;if(n===void 0||s===void 0)continue;let o={value:n};if(t(this,V)&&t(this,Z)){o.ttl=t(this,V)[i];let c=t(this,B).now()-t(this,Z)[i];o.start=Math.floor(Date.now()-c);}t(this,Q)&&(o.size=t(this,Q)[i]),e.unshift([s,o]);}return e}load(e){this.clear();for(let[i,s]of e){if(s.start){let r=Date.now()-s.start;s.start=t(this,B).now()-r;}this.set(i,s.value,s);}}set(e,i,s={}){var rt,I,k,w;if(i===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:n,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:p}=s,{noUpdateTTL:v=this.noUpdateTTL}=s,U=t(this,Ot).call(this,e,i,s.size||0,c);if(this.maxEntrySize&&U>this.maxEntrySize)return p&&(p.set="miss",p.maxEntrySizeExceeded=true),d(this,l,ct).call(this,e,"set"),this;let S=t(this,O)===0?void 0:t(this,T).get(e);if(S===void 0)S=t(this,O)===0?t(this,R):t(this,J).length!==0?t(this,J).pop():t(this,O)===t(this,K)?d(this,l,Lt).call(this,false):t(this,O),t(this,b)[S]=e,t(this,m)[S]=i,t(this,T).set(e,S),t(this,P)[t(this,R)]=S,t(this,z)[S]=t(this,R),u(this,R,S),Rt(this,O)._++,t(this,bt).call(this,S,U,p),p&&(p.set="add"),v=false,t(this,Et)&&((rt=t(this,ut))==null||rt.call(this,i,e,"add"));else {d(this,l,At).call(this,S);let y=t(this,m)[S];if(i!==y){if(t(this,dt)&&d(this,l,E).call(this,y)){y.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:a}=y;a!==void 0&&!o&&(t(this,tt)&&((I=t(this,q))==null||I.call(this,a,e,"set")),t(this,j)&&t(this,D)?.push([a,e,"set"]));}else o||(t(this,tt)&&((k=t(this,q))==null||k.call(this,y,e,"set")),t(this,j)&&t(this,D)?.push([y,e,"set"]));if(t(this,mt).call(this,S),t(this,bt).call(this,S,U,p),t(this,m)[S]=i,p){p.set="replace";let a=y&&d(this,l,E).call(this,y)?y.__staleWhileFetching:y;a!==void 0&&(p.oldValue=a);}}else p&&(p.set="update");t(this,Et)&&this.onInsert?.(i,e,i===y?"update":"replace");}if(r!==0&&!t(this,V)&&d(this,l,It).call(this),t(this,V)&&(v||t(this,Tt).call(this,S,r,n),p&&t(this,ot).call(this,p,S)),!o&&t(this,j)&&t(this,D)){let y=t(this,D),a;for(;a=y?.shift();)(w=t(this,$))==null||w.call(this,...a);}return this}pop(){var e;try{for(;t(this,O);){let i=t(this,m)[t(this,N)];if(d(this,l,Lt).call(this,!0),d(this,l,E).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(t(this,j)&&t(this,D)){let i=t(this,D),s;for(;s=i?.shift();)(e=t(this,$))==null||e.call(this,...s);}}}has(e,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,n=t(this,T).get(e);if(n!==void 0){let o=t(this,m)[n];if(d(this,l,E).call(this,o)&&o.__staleWhileFetching===void 0)return false;if(t(this,Y).call(this,n))r&&(r.has="stale",t(this,ot).call(this,r,n));else return s&&t(this,ft).call(this,n),r&&(r.has="hit",t(this,ot).call(this,r,n)),true}else r&&(r.has="miss");return false}peek(e,i={}){let{allowStale:s=this.allowStale}=i,r=t(this,T).get(e);if(r===void 0||!s&&t(this,Y).call(this,r))return;let n=t(this,m)[r];return d(this,l,E).call(this,n)?n.__staleWhileFetching:n}async fetch(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:p=0,sizeCalculation:v=this.sizeCalculation,noUpdateTTL:U=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:rt=this.allowStaleOnFetchRejection,ignoreFetchAbort:I=this.ignoreFetchAbort,allowStaleOnFetchAbort:k=this.allowStaleOnFetchAbort,context:w,forceRefresh:y=false,status:a,signal:x}=i;if(!t(this,dt))return a&&(a.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,status:a});let A={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:c,size:p,sizeCalculation:v,noUpdateTTL:U,noDeleteOnFetchRejection:S,allowStaleOnFetchRejection:rt,allowStaleOnFetchAbort:k,ignoreFetchAbort:I,status:a,signal:x},f=t(this,T).get(e);if(f===void 0){a&&(a.fetch="miss");let g=d(this,l,Ct).call(this,e,f,A,w);return g.__returned=g}else {let g=t(this,m)[f];if(d(this,l,E).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=t(this,Y).call(this,f);if(!y&&!F)return a&&(a.fetch="hit"),d(this,l,At).call(this,f),r&&t(this,ft).call(this,f),a&&t(this,ot).call(this,a,f),g;let H=d(this,l,Ct).call(this,e,f,A,w),_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,i={}){let s=t(this,xt);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:n,...o}=i,c=this.get(e,o);if(!n&&c!==void 0)return c;let p=s(e,c,{options:o,context:r});return this.set(e,p,o),p}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:o}=i,c=t(this,T).get(e);if(c!==void 0){let p=t(this,m)[c],v=d(this,l,E).call(this,p);return o&&t(this,ot).call(this,o,c),t(this,Y).call(this,c)?(o&&(o.get="stale"),v?(o&&s&&p.__staleWhileFetching!==void 0&&(o.returnedStale=true),s?p.__staleWhileFetching:void 0):(n||d(this,l,ct).call(this,e,"expire"),o&&s&&(o.returnedStale=true),s?p:void 0)):(o&&(o.get="hit"),v?p.__staleWhileFetching:(d(this,l,At).call(this,c),r&&t(this,ft).call(this,c),p))}else o&&(o.get="miss");}delete(e){return d(this,l,ct).call(this,e,"delete")}clear(){return d(this,l,Vt).call(this,"delete")}},K=new WeakMap,M=new WeakMap,q=new WeakMap,ut=new WeakMap,$=new WeakMap,yt=new WeakMap,xt=new WeakMap,B=new WeakMap,O=new WeakMap,X=new WeakMap,T=new WeakMap,b=new WeakMap,m=new WeakMap,P=new WeakMap,z=new WeakMap,N=new WeakMap,R=new WeakMap,J=new WeakMap,D=new WeakMap,Q=new WeakMap,Z=new WeakMap,V=new WeakMap,W=new WeakMap,tt=new WeakMap,dt=new WeakMap,j=new WeakMap,Et=new WeakMap,l=new WeakSet,It=function(){let e=new Dt(t(this,K)),i=new Dt(t(this,K));u(this,V,e),u(this,Z,i);let s=this.ttlAutopurge?new Array(t(this,K)):void 0;u(this,W,s),u(this,Tt,(c,p,v=t(this,B).now())=>{i[c]=p!==0?v:0,e[c]=p,r(c,p);}),u(this,ft,c=>{i[c]=e[c]!==0?t(this,B).now():0,r(c,e[c]);});let r=this.ttlAutopurge?(c,p)=>{if(s?.[c]&&(clearTimeout(s[c]),s[c]=void 0),p&&p!==0&&s){let v=setTimeout(()=>{t(this,Y).call(this,c)&&d(this,l,ct).call(this,t(this,b)[c],"expire");},p+1);v.unref&&v.unref(),s[c]=v;}}:()=>{};u(this,ot,(c,p)=>{if(e[p]){let v=e[p],U=i[p];if(!v||!U)return;c.ttl=v,c.start=U,c.now=n||o();let S=c.now-U;c.remainingTTL=v-S;}});let n=0,o=()=>{let c=t(this,B).now();if(this.ttlResolution>0){n=c;let p=setTimeout(()=>n=0,this.ttlResolution);p.unref&&p.unref();}return c};this.getRemainingTTL=c=>{let p=t(this,T).get(c);if(p===void 0)return 0;let v=e[p],U=i[p];if(!v||!U)return 1/0;let S=(n||o())-U;return v-S},u(this,Y,c=>{let p=i[c],v=e[c];return !!v&&!!p&&(n||o())-p>v});},ft=new WeakMap,ot=new WeakMap,Tt=new WeakMap,Y=new WeakMap,oe=function(){let e=new Dt(t(this,K));u(this,X,0),u(this,Q,e),u(this,mt,i=>{u(this,X,t(this,X)-e[i]),e[i]=0;}),u(this,Ot,(i,s,r,n)=>{if(d(this,l,E).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}),u(this,bt,(i,s,r)=>{if(e[i]=s,t(this,M)){let n=t(this,M)-e[i];for(;t(this,X)>n;)d(this,l,Lt).call(this,true);}u(this,X,t(this,X)+e[i]),r&&(r.entrySize=s,r.totalCalculatedSize=t(this,X));});},mt=new WeakMap,bt=new WeakMap,Ot=new WeakMap,lt=function*({allowStale:e=this.allowStale}={}){if(t(this,O))for(let i=t(this,R);!(!d(this,l,Mt).call(this,i)||((e||!t(this,Y).call(this,i))&&(yield i),i===t(this,N)));)i=t(this,z)[i];},ht=function*({allowStale:e=this.allowStale}={}){if(t(this,O))for(let i=t(this,N);!(!d(this,l,Mt).call(this,i)||((e||!t(this,Y).call(this,i))&&(yield i),i===t(this,R)));)i=t(this,P)[i];},Mt=function(e){return e!==void 0&&t(this,T).get(t(this,b)[e])===e},Lt=function(e){var n;let i=t(this,N),s=t(this,b)[i],r=t(this,m)[i];return t(this,dt)&&d(this,l,E).call(this,r)?r.__abortController.abort(new Error("evicted")):(t(this,tt)||t(this,j))&&(t(this,tt)&&((n=t(this,q))==null||n.call(this,r,s,"evict")),t(this,j)&&t(this,D)?.push([r,s,"evict"])),t(this,mt).call(this,i),t(this,W)?.[i]&&(clearTimeout(t(this,W)[i]),t(this,W)[i]=void 0),e&&(t(this,b)[i]=void 0,t(this,m)[i]=void 0,t(this,J).push(i)),t(this,O)===1?(u(this,N,u(this,R,0)),t(this,J).length=0):u(this,N,t(this,P)[i]),t(this,T).delete(s),Rt(this,O)._--,i},Ct=function(e,i,s,r){let n=i===void 0?void 0:t(this,m)[i];if(d(this,l,E).call(this,n))return n;let o=new Nt,{signal:c}=s;c?.addEventListener("abort",()=>o.abort(c.reason),{signal:o.signal});let p={signal:o.signal,options:s,context:r},v=(w,y=false)=>{let{aborted:a}=o.signal,x=s.ignoreFetchAbort&&w!==void 0,A=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&w!==void 0);if(s.status&&(a&&!y?(s.status.fetchAborted=true,s.status.fetchError=o.signal.reason,x&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),a&&!x&&!y)return S(o.signal.reason,A);let f=I,g=t(this,m)[i];return (g===I||x&&y&&g===void 0)&&(w===void 0?f.__staleWhileFetching!==void 0?t(this,m)[i]=f.__staleWhileFetching:d(this,l,ct).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,w,p.options))),w},U=w=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=w),S(w,false)),S=(w,y)=>{let{aborted:a}=o.signal,x=a&&s.allowStaleOnFetchAbort,A=x||s.allowStaleOnFetchRejection,f=A||s.noDeleteOnFetchRejection,g=I;if(t(this,m)[i]===I&&(!f||!y&&g.__staleWhileFetching===void 0?d(this,l,ct).call(this,e,"fetch"):x||(t(this,m)[i]=g.__staleWhileFetching)),A)return s.status&&g.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),g.__staleWhileFetching;if(g.__returned===g)throw w},rt=(w,y)=>{var x;let a=(x=t(this,yt))==null?void 0:x.call(this,e,n,p);a&&a instanceof Promise&&a.then(A=>w(A===void 0?void 0:A),y),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(w(void 0),s.allowStaleOnFetchAbort&&(w=A=>v(A,true)));});};s.status&&(s.status.fetchDispatched=true);let I=new Promise(rt).then(v,U),k=Object.assign(I,{__abortController:o,__staleWhileFetching:n,__returned:void 0});return i===void 0?(this.set(e,k,{...p.options,status:void 0}),i=t(this,T).get(e)):t(this,m)[i]=k,k},E=function(e){if(!t(this,dt))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Nt},zt=function(e,i){t(this,z)[i]=e,t(this,P)[e]=i;},At=function(e){e!==t(this,R)&&(e===t(this,N)?u(this,N,t(this,P)[e]):d(this,l,zt).call(this,t(this,z)[e],t(this,P)[e]),d(this,l,zt).call(this,t(this,R),e),u(this,R,e));},ct=function(e,i){var r,n;let s=false;if(t(this,O)!==0){let o=t(this,T).get(e);if(o!==void 0)if(t(this,W)?.[o]&&(clearTimeout(t(this,W)?.[o]),t(this,W)[o]=void 0),s=true,t(this,O)===1)d(this,l,Vt).call(this,i);else {t(this,mt).call(this,o);let c=t(this,m)[o];if(d(this,l,E).call(this,c)?c.__abortController.abort(new Error("deleted")):(t(this,tt)||t(this,j))&&(t(this,tt)&&((r=t(this,q))==null||r.call(this,c,e,i)),t(this,j)&&t(this,D)?.push([c,e,i])),t(this,T).delete(e),t(this,b)[o]=void 0,t(this,m)[o]=void 0,o===t(this,R))u(this,R,t(this,z)[o]);else if(o===t(this,N))u(this,N,t(this,P)[o]);else {let p=t(this,z)[o];t(this,P)[p]=t(this,P)[o];let v=t(this,P)[o];t(this,z)[v]=t(this,z)[o];}Rt(this,O)._--,t(this,J).push(o);}}if(t(this,j)&&t(this,D)?.length){let o=t(this,D),c;for(;c=o?.shift();)(n=t(this,$))==null||n.call(this,...c);}return s},Vt=function(e){var i,s;for(let r of d(this,l,ht).call(this,{allowStale:true})){let n=t(this,m)[r];if(d(this,l,E).call(this,n))n.__abortController.abort(new Error("deleted"));else {let o=t(this,b)[r];t(this,tt)&&((i=t(this,q))==null||i.call(this,n,o,e)),t(this,j)&&t(this,D)?.push([n,o,e]);}}if(t(this,T).clear(),t(this,m).fill(void 0),t(this,b).fill(void 0),t(this,V)&&t(this,Z)){t(this,V).fill(0),t(this,Z).fill(0);for(let r of t(this,W)??[])r!==void 0&&clearTimeout(r);t(this,W)?.fill(void 0);}if(t(this,Q)&&t(this,Q).fill(0),u(this,N,0),u(this,R,0),t(this,J).length=0,u(this,X,0),u(this,O,0),t(this,j)&&t(this,D)){let r=t(this,D),n;for(;n=r?.shift();)(s=t(this,$))==null||s.call(this,...n);}},wt);var Ft=class{cache;map=new Map;constructor(e){this.cache=new re({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.21";var Wt={version:Ut};var Yt="repeat";function Ht(h){return {type:"pause",duration:h}}var Kt="__game_layer__";var ve={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 ae={};var kt={};fe(kt,{createExportableElement:()=>le});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 le(h){try{if(typeof h>"u")return h;let e=JSON.stringify(h);return JSON.parse(e)}catch(e){throw gt.error("Error creating exportable element",h,e),new core.PixiError("not_json_serializable","Error creating exportable element")}}var ye=typeof window<"u"&&typeof document<"u",he=[" _______ _ _ _ ____ ____ ____ _____ ","|_ __ \\ (_) (_) | | |_ _| |_ _||_ \\|_ _|"," | |__) |__ _ __ __ \\_| \\ \\ / / | \\ | | "," | ___/[ | [ \\ [ ][ | \\ \\ / / | |\\ \\| | "," _| |_ | | > ' < | | \\ ' / _| |_\\ |_ ",`|_____| [___][__]\`\\_][___] \\_/ |_____|\\____| v${Wt.version}`],ce=31,xe="background:#2f90da;color:#fff;font-weight:bold;",Ee="background:#c832bb;color:#fff;font-weight:bold;",be="background:transparent;font-weight:bold;",qt=` v${Wt.version}`;function de(){if(!ye)return;let h=[],e=[];for(let i=0;i<he.length;i++){let s=he[i],r=s.endsWith(qt),n=r?s.slice(0,-qt.length):s,o=n.slice(0,ce),c=n.slice(ce),p=r?"%c%s%c%s%c%s":"%c%s%c%s";h.push(p),e.push(xe,o,Ee,c),r&&e.push(be,qt);}console.info(h.join(`
1
+ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var nt=require('@drincs/pixi-vn/canvas'),Bt=require('@drincs/pixi-vn/characters'),core=require('@drincs/pixi-vn/core'),et=require('@drincs/pixi-vn/history'),L=require('@drincs/pixi-vn/narration'),pt=require('@drincs/pixi-vn/sound'),G=require('@drincs/pixi-vn/storage'),motion=require('@drincs/pixi-vn/motion');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var nt__namespace=/*#__PURE__*/_interopNamespace(nt);var Bt__namespace=/*#__PURE__*/_interopNamespace(Bt);var et__namespace=/*#__PURE__*/_interopNamespace(et);var L__namespace=/*#__PURE__*/_interopNamespace(L);var pt__namespace=/*#__PURE__*/_interopNamespace(pt);var G__namespace=/*#__PURE__*/_interopNamespace(G);var Xt=Object.defineProperty;var Jt=h=>{throw TypeError(h)};var ue=(h,e,i)=>e in h?Xt(h,e,{enumerable:true,configurable:true,writable:true,value:i}):h[e]=i;var fe=(h,e)=>{for(var i in e)Xt(h,i,{get:e[i],enumerable:true});};var C=(h,e,i)=>ue(h,typeof e!="symbol"?e+"":e,i),jt=(h,e,i)=>e.has(h)||Jt("Cannot "+i);var t=(h,e,i)=>(jt(h,e,"read from private field"),i?i.call(h):e.get(h)),_=(h,e,i)=>e.has(h)?Jt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(h):e.set(h,i),u=(h,e,i,s)=>(jt(h,e,"write to private field"),e.set(h,i),i),d=(h,e,i)=>(jt(h,e,"access private method"),i);var Rt=(h,e,i,s)=>({set _(r){u(h,e,r);},get _(){return t(h,e,s)}});var me=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,ee=new Set,Gt=typeof process=="object"&&process?process:{},ie=(h,e,i,s)=>{typeof Gt.emitWarning=="function"?Gt.emitWarning(h,e,i,s):console.error(`[${i}] ${e}: ${h}`);},Nt=globalThis.AbortController,Qt=globalThis.AbortSignal;if(typeof Nt>"u"){Qt=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,s){this._onabort.push(s);}},Nt=class{constructor(){e();}signal=new Qt;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 h=Gt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{h&&(h=false,ie("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 ge=h=>!ee.has(h);var at=h=>h&&h===Math.floor(h)&&h>0&&isFinite(h),se=h=>at(h)?h<=Math.pow(2,8)?Uint8Array:h<=Math.pow(2,16)?Uint16Array:h<=Math.pow(2,32)?Uint32Array:h<=Number.MAX_SAFE_INTEGER?Dt:null:null,Dt=class extends Array{constructor(h){super(h),this.fill(0);}},it,St,_e=(it=class{heap;length;static create(e){let i=se(e);if(!i)return [];u(it,St,true);let s=new it(e,i);return u(it,St,false),s}constructor(e,i){if(!t(it,St))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},St=new WeakMap,_(it,St,false),it),Zt,te,K,M,q,ut,$,yt,xt,B,O,X,T,b,m,P,z,N,R,J,D,Q,Z,V,W,tt,dt,j,Et,l,It,ft,ot,Tt,Y,oe,mt,bt,Ot,lt,ht,Mt,Lt,Ct,E,zt,At,ct,Vt,wt,re=(wt=class{constructor(e){_(this,l);_(this,K);_(this,M);_(this,q);_(this,ut);_(this,$);_(this,yt);_(this,xt);_(this,B);C(this,"ttl");C(this,"ttlResolution");C(this,"ttlAutopurge");C(this,"updateAgeOnGet");C(this,"updateAgeOnHas");C(this,"allowStale");C(this,"noDisposeOnSet");C(this,"noUpdateTTL");C(this,"maxEntrySize");C(this,"sizeCalculation");C(this,"noDeleteOnFetchRejection");C(this,"noDeleteOnStaleGet");C(this,"allowStaleOnFetchAbort");C(this,"allowStaleOnFetchRejection");C(this,"ignoreFetchAbort");_(this,O);_(this,X);_(this,T);_(this,b);_(this,m);_(this,P);_(this,z);_(this,N);_(this,R);_(this,J);_(this,D);_(this,Q);_(this,Z);_(this,V);_(this,W);_(this,tt);_(this,dt);_(this,j);_(this,Et);_(this,ft,()=>{});_(this,ot,()=>{});_(this,Tt,()=>{});_(this,Y,()=>false);_(this,mt,e=>{});_(this,bt,(e,i,s)=>{});_(this,Ot,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});C(this,Zt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:n,updateAgeOnGet:o,updateAgeOnHas:c,allowStale:p,dispose:v,onInsert:U,disposeAfter:S,noDisposeOnSet:rt,noUpdateTTL:I,maxSize:k=0,maxEntrySize:w=0,sizeCalculation:y,fetchMethod:a,memoMethod:x,noDeleteOnFetchRejection:A,noDeleteOnStaleGet:f,allowStaleOnFetchRejection:g,allowStaleOnFetchAbort:F,ignoreFetchAbort:H,perf:_t}=e;if(_t!==void 0&&typeof _t?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(u(this,B,_t??me),i!==0&&!at(i))throw new TypeError("max option must be a nonnegative integer");let vt=i?se(i):Array;if(!vt)throw new Error("invalid max value: "+i);if(u(this,K,i),u(this,M,k),this.maxEntrySize=w||t(this,M),this.sizeCalculation=y,this.sizeCalculation){if(!t(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(x!==void 0&&typeof x!="function")throw new TypeError("memoMethod must be a function if defined");if(u(this,xt,x),a!==void 0&&typeof a!="function")throw new TypeError("fetchMethod must be a function if specified");if(u(this,yt,a),u(this,dt,!!a),u(this,T,new Map),u(this,b,new Array(i).fill(void 0)),u(this,m,new Array(i).fill(void 0)),u(this,P,new vt(i)),u(this,z,new vt(i)),u(this,N,0),u(this,R,0),u(this,J,_e.create(i)),u(this,O,0),u(this,X,0),typeof v=="function"&&u(this,q,v),typeof U=="function"&&u(this,ut,U),typeof S=="function"?(u(this,$,S),u(this,D,[])):(u(this,$,void 0),u(this,D,void 0)),u(this,tt,!!t(this,q)),u(this,Et,!!t(this,ut)),u(this,j,!!t(this,$)),this.noDisposeOnSet=!!rt,this.noUpdateTTL=!!I,this.noDeleteOnFetchRejection=!!A,this.allowStaleOnFetchRejection=!!g,this.allowStaleOnFetchAbort=!!F,this.ignoreFetchAbort=!!H,this.maxEntrySize!==0){if(t(this,M)!==0&&!at(t(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");d(this,l,oe).call(this);}if(this.allowStale=!!p,this.noDeleteOnStaleGet=!!f,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!c,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");d(this,l,It).call(this);}if(t(this,K)===0&&this.ttl===0&&t(this,M)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,K)&&!t(this,M)){let Pt="LRU_CACHE_UNBOUNDED";ge(Pt)&&(ee.add(Pt),ie("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Pt,wt));}}get perf(){return t(this,B)}static unsafeExposeInternals(e){return {starts:t(e,Z),ttls:t(e,V),autopurgeTimers:t(e,W),sizes:t(e,Q),keyMap:t(e,T),keyList:t(e,b),valList:t(e,m),next:t(e,P),prev:t(e,z),get head(){return t(e,N)},get tail(){return t(e,R)},free:t(e,J),isBackgroundFetch:i=>{var s;return d(s=e,l,E).call(s,i)},backgroundFetch:(i,s,r,n)=>{var o;return d(o=e,l,Ct).call(o,i,s,r,n)},moveToTail:i=>{var s;return d(s=e,l,At).call(s,i)},indexes:i=>{var s;return d(s=e,l,lt).call(s,i)},rindexes:i=>{var s;return d(s=e,l,ht).call(s,i)},isStale:i=>{var s;return t(s=e,Y).call(s,i)}}}get max(){return t(this,K)}get maxSize(){return t(this,M)}get calculatedSize(){return t(this,X)}get size(){return t(this,O)}get fetchMethod(){return t(this,yt)}get memoMethod(){return t(this,xt)}get dispose(){return t(this,q)}get onInsert(){return t(this,ut)}get disposeAfter(){return t(this,$)}getRemainingTTL(e){return t(this,T).has(e)?1/0:0}*entries(){for(let e of d(this,l,lt).call(this))t(this,m)[e]!==void 0&&t(this,b)[e]!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield [t(this,b)[e],t(this,m)[e]]);}*rentries(){for(let e of d(this,l,ht).call(this))t(this,m)[e]!==void 0&&t(this,b)[e]!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield [t(this,b)[e],t(this,m)[e]]);}*keys(){for(let e of d(this,l,lt).call(this)){let i=t(this,b)[e];i!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield i);}}*rkeys(){for(let e of d(this,l,ht).call(this)){let i=t(this,b)[e];i!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield i);}}*values(){for(let e of d(this,l,lt).call(this))t(this,m)[e]!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield t(this,m)[e]);}*rvalues(){for(let e of d(this,l,ht).call(this))t(this,m)[e]!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield t(this,m)[e]);}[(te=Symbol.iterator,Zt=Symbol.toStringTag,te)](){return this.entries()}find(e,i={}){for(let s of d(this,l,lt).call(this)){let r=t(this,m)[s],n=d(this,l,E).call(this,r)?r.__staleWhileFetching:r;if(n!==void 0&&e(n,t(this,b)[s],this))return this.get(t(this,b)[s],i)}}forEach(e,i=this){for(let s of d(this,l,lt).call(this)){let r=t(this,m)[s],n=d(this,l,E).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e.call(i,n,t(this,b)[s],this);}}rforEach(e,i=this){for(let s of d(this,l,ht).call(this)){let r=t(this,m)[s],n=d(this,l,E).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e.call(i,n,t(this,b)[s],this);}}purgeStale(){let e=false;for(let i of d(this,l,ht).call(this,{allowStale:true}))t(this,Y).call(this,i)&&(d(this,l,ct).call(this,t(this,b)[i],"expire"),e=true);return e}info(e){let i=t(this,T).get(e);if(i===void 0)return;let s=t(this,m)[i],r=d(this,l,E).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let n={value:r};if(t(this,V)&&t(this,Z)){let o=t(this,V)[i],c=t(this,Z)[i];if(o&&c){let p=o-(t(this,B).now()-c);n.ttl=p,n.start=Date.now();}}return t(this,Q)&&(n.size=t(this,Q)[i]),n}dump(){let e=[];for(let i of d(this,l,lt).call(this,{allowStale:true})){let s=t(this,b)[i],r=t(this,m)[i],n=d(this,l,E).call(this,r)?r.__staleWhileFetching:r;if(n===void 0||s===void 0)continue;let o={value:n};if(t(this,V)&&t(this,Z)){o.ttl=t(this,V)[i];let c=t(this,B).now()-t(this,Z)[i];o.start=Math.floor(Date.now()-c);}t(this,Q)&&(o.size=t(this,Q)[i]),e.unshift([s,o]);}return e}load(e){this.clear();for(let[i,s]of e){if(s.start){let r=Date.now()-s.start;s.start=t(this,B).now()-r;}this.set(i,s.value,s);}}set(e,i,s={}){var rt,I,k,w;if(i===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:n,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:p}=s,{noUpdateTTL:v=this.noUpdateTTL}=s,U=t(this,Ot).call(this,e,i,s.size||0,c);if(this.maxEntrySize&&U>this.maxEntrySize)return p&&(p.set="miss",p.maxEntrySizeExceeded=true),d(this,l,ct).call(this,e,"set"),this;let S=t(this,O)===0?void 0:t(this,T).get(e);if(S===void 0)S=t(this,O)===0?t(this,R):t(this,J).length!==0?t(this,J).pop():t(this,O)===t(this,K)?d(this,l,Lt).call(this,false):t(this,O),t(this,b)[S]=e,t(this,m)[S]=i,t(this,T).set(e,S),t(this,P)[t(this,R)]=S,t(this,z)[S]=t(this,R),u(this,R,S),Rt(this,O)._++,t(this,bt).call(this,S,U,p),p&&(p.set="add"),v=false,t(this,Et)&&((rt=t(this,ut))==null||rt.call(this,i,e,"add"));else {d(this,l,At).call(this,S);let y=t(this,m)[S];if(i!==y){if(t(this,dt)&&d(this,l,E).call(this,y)){y.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:a}=y;a!==void 0&&!o&&(t(this,tt)&&((I=t(this,q))==null||I.call(this,a,e,"set")),t(this,j)&&t(this,D)?.push([a,e,"set"]));}else o||(t(this,tt)&&((k=t(this,q))==null||k.call(this,y,e,"set")),t(this,j)&&t(this,D)?.push([y,e,"set"]));if(t(this,mt).call(this,S),t(this,bt).call(this,S,U,p),t(this,m)[S]=i,p){p.set="replace";let a=y&&d(this,l,E).call(this,y)?y.__staleWhileFetching:y;a!==void 0&&(p.oldValue=a);}}else p&&(p.set="update");t(this,Et)&&this.onInsert?.(i,e,i===y?"update":"replace");}if(r!==0&&!t(this,V)&&d(this,l,It).call(this),t(this,V)&&(v||t(this,Tt).call(this,S,r,n),p&&t(this,ot).call(this,p,S)),!o&&t(this,j)&&t(this,D)){let y=t(this,D),a;for(;a=y?.shift();)(w=t(this,$))==null||w.call(this,...a);}return this}pop(){var e;try{for(;t(this,O);){let i=t(this,m)[t(this,N)];if(d(this,l,Lt).call(this,!0),d(this,l,E).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(t(this,j)&&t(this,D)){let i=t(this,D),s;for(;s=i?.shift();)(e=t(this,$))==null||e.call(this,...s);}}}has(e,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,n=t(this,T).get(e);if(n!==void 0){let o=t(this,m)[n];if(d(this,l,E).call(this,o)&&o.__staleWhileFetching===void 0)return false;if(t(this,Y).call(this,n))r&&(r.has="stale",t(this,ot).call(this,r,n));else return s&&t(this,ft).call(this,n),r&&(r.has="hit",t(this,ot).call(this,r,n)),true}else r&&(r.has="miss");return false}peek(e,i={}){let{allowStale:s=this.allowStale}=i,r=t(this,T).get(e);if(r===void 0||!s&&t(this,Y).call(this,r))return;let n=t(this,m)[r];return d(this,l,E).call(this,n)?n.__staleWhileFetching:n}async fetch(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:p=0,sizeCalculation:v=this.sizeCalculation,noUpdateTTL:U=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:rt=this.allowStaleOnFetchRejection,ignoreFetchAbort:I=this.ignoreFetchAbort,allowStaleOnFetchAbort:k=this.allowStaleOnFetchAbort,context:w,forceRefresh:y=false,status:a,signal:x}=i;if(!t(this,dt))return a&&(a.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,status:a});let A={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:c,size:p,sizeCalculation:v,noUpdateTTL:U,noDeleteOnFetchRejection:S,allowStaleOnFetchRejection:rt,allowStaleOnFetchAbort:k,ignoreFetchAbort:I,status:a,signal:x},f=t(this,T).get(e);if(f===void 0){a&&(a.fetch="miss");let g=d(this,l,Ct).call(this,e,f,A,w);return g.__returned=g}else {let g=t(this,m)[f];if(d(this,l,E).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=t(this,Y).call(this,f);if(!y&&!F)return a&&(a.fetch="hit"),d(this,l,At).call(this,f),r&&t(this,ft).call(this,f),a&&t(this,ot).call(this,a,f),g;let H=d(this,l,Ct).call(this,e,f,A,w),_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,i={}){let s=t(this,xt);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:n,...o}=i,c=this.get(e,o);if(!n&&c!==void 0)return c;let p=s(e,c,{options:o,context:r});return this.set(e,p,o),p}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:o}=i,c=t(this,T).get(e);if(c!==void 0){let p=t(this,m)[c],v=d(this,l,E).call(this,p);return o&&t(this,ot).call(this,o,c),t(this,Y).call(this,c)?(o&&(o.get="stale"),v?(o&&s&&p.__staleWhileFetching!==void 0&&(o.returnedStale=true),s?p.__staleWhileFetching:void 0):(n||d(this,l,ct).call(this,e,"expire"),o&&s&&(o.returnedStale=true),s?p:void 0)):(o&&(o.get="hit"),v?p.__staleWhileFetching:(d(this,l,At).call(this,c),r&&t(this,ft).call(this,c),p))}else o&&(o.get="miss");}delete(e){return d(this,l,ct).call(this,e,"delete")}clear(){return d(this,l,Vt).call(this,"delete")}},K=new WeakMap,M=new WeakMap,q=new WeakMap,ut=new WeakMap,$=new WeakMap,yt=new WeakMap,xt=new WeakMap,B=new WeakMap,O=new WeakMap,X=new WeakMap,T=new WeakMap,b=new WeakMap,m=new WeakMap,P=new WeakMap,z=new WeakMap,N=new WeakMap,R=new WeakMap,J=new WeakMap,D=new WeakMap,Q=new WeakMap,Z=new WeakMap,V=new WeakMap,W=new WeakMap,tt=new WeakMap,dt=new WeakMap,j=new WeakMap,Et=new WeakMap,l=new WeakSet,It=function(){let e=new Dt(t(this,K)),i=new Dt(t(this,K));u(this,V,e),u(this,Z,i);let s=this.ttlAutopurge?new Array(t(this,K)):void 0;u(this,W,s),u(this,Tt,(c,p,v=t(this,B).now())=>{i[c]=p!==0?v:0,e[c]=p,r(c,p);}),u(this,ft,c=>{i[c]=e[c]!==0?t(this,B).now():0,r(c,e[c]);});let r=this.ttlAutopurge?(c,p)=>{if(s?.[c]&&(clearTimeout(s[c]),s[c]=void 0),p&&p!==0&&s){let v=setTimeout(()=>{t(this,Y).call(this,c)&&d(this,l,ct).call(this,t(this,b)[c],"expire");},p+1);v.unref&&v.unref(),s[c]=v;}}:()=>{};u(this,ot,(c,p)=>{if(e[p]){let v=e[p],U=i[p];if(!v||!U)return;c.ttl=v,c.start=U,c.now=n||o();let S=c.now-U;c.remainingTTL=v-S;}});let n=0,o=()=>{let c=t(this,B).now();if(this.ttlResolution>0){n=c;let p=setTimeout(()=>n=0,this.ttlResolution);p.unref&&p.unref();}return c};this.getRemainingTTL=c=>{let p=t(this,T).get(c);if(p===void 0)return 0;let v=e[p],U=i[p];if(!v||!U)return 1/0;let S=(n||o())-U;return v-S},u(this,Y,c=>{let p=i[c],v=e[c];return !!v&&!!p&&(n||o())-p>v});},ft=new WeakMap,ot=new WeakMap,Tt=new WeakMap,Y=new WeakMap,oe=function(){let e=new Dt(t(this,K));u(this,X,0),u(this,Q,e),u(this,mt,i=>{u(this,X,t(this,X)-e[i]),e[i]=0;}),u(this,Ot,(i,s,r,n)=>{if(d(this,l,E).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}),u(this,bt,(i,s,r)=>{if(e[i]=s,t(this,M)){let n=t(this,M)-e[i];for(;t(this,X)>n;)d(this,l,Lt).call(this,true);}u(this,X,t(this,X)+e[i]),r&&(r.entrySize=s,r.totalCalculatedSize=t(this,X));});},mt=new WeakMap,bt=new WeakMap,Ot=new WeakMap,lt=function*({allowStale:e=this.allowStale}={}){if(t(this,O))for(let i=t(this,R);!(!d(this,l,Mt).call(this,i)||((e||!t(this,Y).call(this,i))&&(yield i),i===t(this,N)));)i=t(this,z)[i];},ht=function*({allowStale:e=this.allowStale}={}){if(t(this,O))for(let i=t(this,N);!(!d(this,l,Mt).call(this,i)||((e||!t(this,Y).call(this,i))&&(yield i),i===t(this,R)));)i=t(this,P)[i];},Mt=function(e){return e!==void 0&&t(this,T).get(t(this,b)[e])===e},Lt=function(e){var n;let i=t(this,N),s=t(this,b)[i],r=t(this,m)[i];return t(this,dt)&&d(this,l,E).call(this,r)?r.__abortController.abort(new Error("evicted")):(t(this,tt)||t(this,j))&&(t(this,tt)&&((n=t(this,q))==null||n.call(this,r,s,"evict")),t(this,j)&&t(this,D)?.push([r,s,"evict"])),t(this,mt).call(this,i),t(this,W)?.[i]&&(clearTimeout(t(this,W)[i]),t(this,W)[i]=void 0),e&&(t(this,b)[i]=void 0,t(this,m)[i]=void 0,t(this,J).push(i)),t(this,O)===1?(u(this,N,u(this,R,0)),t(this,J).length=0):u(this,N,t(this,P)[i]),t(this,T).delete(s),Rt(this,O)._--,i},Ct=function(e,i,s,r){let n=i===void 0?void 0:t(this,m)[i];if(d(this,l,E).call(this,n))return n;let o=new Nt,{signal:c}=s;c?.addEventListener("abort",()=>o.abort(c.reason),{signal:o.signal});let p={signal:o.signal,options:s,context:r},v=(w,y=false)=>{let{aborted:a}=o.signal,x=s.ignoreFetchAbort&&w!==void 0,A=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&w!==void 0);if(s.status&&(a&&!y?(s.status.fetchAborted=true,s.status.fetchError=o.signal.reason,x&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),a&&!x&&!y)return S(o.signal.reason,A);let f=I,g=t(this,m)[i];return (g===I||x&&y&&g===void 0)&&(w===void 0?f.__staleWhileFetching!==void 0?t(this,m)[i]=f.__staleWhileFetching:d(this,l,ct).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,w,p.options))),w},U=w=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=w),S(w,false)),S=(w,y)=>{let{aborted:a}=o.signal,x=a&&s.allowStaleOnFetchAbort,A=x||s.allowStaleOnFetchRejection,f=A||s.noDeleteOnFetchRejection,g=I;if(t(this,m)[i]===I&&(!f||!y&&g.__staleWhileFetching===void 0?d(this,l,ct).call(this,e,"fetch"):x||(t(this,m)[i]=g.__staleWhileFetching)),A)return s.status&&g.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),g.__staleWhileFetching;if(g.__returned===g)throw w},rt=(w,y)=>{var x;let a=(x=t(this,yt))==null?void 0:x.call(this,e,n,p);a&&a instanceof Promise&&a.then(A=>w(A===void 0?void 0:A),y),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(w(void 0),s.allowStaleOnFetchAbort&&(w=A=>v(A,true)));});};s.status&&(s.status.fetchDispatched=true);let I=new Promise(rt).then(v,U),k=Object.assign(I,{__abortController:o,__staleWhileFetching:n,__returned:void 0});return i===void 0?(this.set(e,k,{...p.options,status:void 0}),i=t(this,T).get(e)):t(this,m)[i]=k,k},E=function(e){if(!t(this,dt))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Nt},zt=function(e,i){t(this,z)[i]=e,t(this,P)[e]=i;},At=function(e){e!==t(this,R)&&(e===t(this,N)?u(this,N,t(this,P)[e]):d(this,l,zt).call(this,t(this,z)[e],t(this,P)[e]),d(this,l,zt).call(this,t(this,R),e),u(this,R,e));},ct=function(e,i){var r,n;let s=false;if(t(this,O)!==0){let o=t(this,T).get(e);if(o!==void 0)if(t(this,W)?.[o]&&(clearTimeout(t(this,W)?.[o]),t(this,W)[o]=void 0),s=true,t(this,O)===1)d(this,l,Vt).call(this,i);else {t(this,mt).call(this,o);let c=t(this,m)[o];if(d(this,l,E).call(this,c)?c.__abortController.abort(new Error("deleted")):(t(this,tt)||t(this,j))&&(t(this,tt)&&((r=t(this,q))==null||r.call(this,c,e,i)),t(this,j)&&t(this,D)?.push([c,e,i])),t(this,T).delete(e),t(this,b)[o]=void 0,t(this,m)[o]=void 0,o===t(this,R))u(this,R,t(this,z)[o]);else if(o===t(this,N))u(this,N,t(this,P)[o]);else {let p=t(this,z)[o];t(this,P)[p]=t(this,P)[o];let v=t(this,P)[o];t(this,z)[v]=t(this,z)[o];}Rt(this,O)._--,t(this,J).push(o);}}if(t(this,j)&&t(this,D)?.length){let o=t(this,D),c;for(;c=o?.shift();)(n=t(this,$))==null||n.call(this,...c);}return s},Vt=function(e){var i,s;for(let r of d(this,l,ht).call(this,{allowStale:true})){let n=t(this,m)[r];if(d(this,l,E).call(this,n))n.__abortController.abort(new Error("deleted"));else {let o=t(this,b)[r];t(this,tt)&&((i=t(this,q))==null||i.call(this,n,o,e)),t(this,j)&&t(this,D)?.push([n,o,e]);}}if(t(this,T).clear(),t(this,m).fill(void 0),t(this,b).fill(void 0),t(this,V)&&t(this,Z)){t(this,V).fill(0),t(this,Z).fill(0);for(let r of t(this,W)??[])r!==void 0&&clearTimeout(r);t(this,W)?.fill(void 0);}if(t(this,Q)&&t(this,Q).fill(0),u(this,N,0),u(this,R,0),t(this,J).length=0,u(this,X,0),u(this,O,0),t(this,j)&&t(this,D)){let r=t(this,D),n;for(;n=r?.shift();)(s=t(this,$))==null||s.call(this,...n);}},wt);var Ft=class{cache;map=new Map;constructor(e){this.cache=new re({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.23";var Wt={version:Ut};var Yt="repeat";function Ht(h){return {type:"pause",duration:h}}var Kt="__game_layer__";var ve={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 ae={};var kt={};fe(kt,{createExportableElement:()=>le});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 le(h){try{if(typeof h>"u")return h;let e=JSON.stringify(h);return JSON.parse(e)}catch(e){throw gt.error("Error creating exportable element",h,e),new core.PixiError("not_json_serializable","Error creating exportable element")}}var ye=typeof window<"u"&&typeof document<"u",he=[" _______ _ _ _ ____ ____ ____ _____ ","|_ __ \\ (_) (_) | | |_ _| |_ _||_ \\|_ _|"," | |__) |__ _ __ __ \\_| \\ \\ / / | \\ | | "," | ___/[ | [ \\ [ ][ | \\ \\ / / | |\\ \\| | "," _| |_ | | > ' < | | \\ ' / _| |_\\ |_ ",`|_____| [___][__]\`\\_][___] \\_/ |_____|\\____| v${Wt.version}`],ce=31,xe="background:#2f90da;color:#fff;font-weight:bold;",Ee="background:#c832bb;color:#fff;font-weight:bold;",be="background:transparent;font-weight:bold;",qt=` v${Wt.version}`;function de(){if(!ye)return;let h=[],e=[];for(let i=0;i<he.length;i++){let s=he[i],r=s.endsWith(qt),n=r?s.slice(0,-qt.length):s,o=n.slice(0,ce),c=n.slice(ce),p=r?"%c%s%c%s%c%s":"%c%s%c%s";h.push(p),e.push(xe,o,Ee,c),r&&e.push(be,qt);}console.info(h.join(`
2
2
  `),...e);}function $t(){let h=window.location.pathname+window.location.hash;return h.includes("#")&&(h=h.split("#")[1]),h}de();exports.Game=void 0;(y=>{async function h(a,x,A){if(core.GameUnifier.init({navigate:x?.navigate,getCurrentGameStepState:()=>{let f={};try{f=nt__namespace.canvas.export();}catch{}return {path:$t(),storage:G__namespace.storage.export(),canvas:f,sound:pt__namespace.sound.export(),labelIndex:L__namespace.NarrationManagerStatic.currentLabelStepIndex||0,openedLabels:L__namespace.narration.openedLabels}},restoreGameStepState:async(f,g)=>{et__namespace.HistoryManagerStatic._originalStepData=f,L__namespace.NarrationManagerStatic.openedLabels=f.openedLabels,G__namespace.storage.restore(f.storage);try{await nt__namespace.canvas.restore(f.canvas),await pt__namespace.sound.restore(f.sound);}catch(F){gt.error("Error restoring game step state:",F);}await g(f.path);},getStepCounter:()=>L__namespace.narration.stepCounter,setStepCounter:f=>{L__namespace.NarrationManagerStatic._stepCounter=f;},getOpenedLabels:()=>L__namespace.narration.openedLabels.length,addHistoryItem:(f,g)=>et__namespace.stepHistory.add(f,g),getCharacter:f=>Bt__namespace.RegisteredCharacters.get(f),processNavigationRequests:(f,g)=>{let F=f,H=Promise.resolve();return f>0?(F--,H=L__namespace.narration.continue(g)):f<0&&(F=0,H=et__namespace.stepHistory.back(g,{steps:f*-1})),{newValue:F,result:H}},animate:(f,g,F,H)=>motion.motion.animate(f,g,F,H),getVariable:(f,g)=>G__namespace.StorageRegistry.getVariable(f,g),setVariable:(f,g,F)=>G__namespace.StorageRegistry.setVariable(f,g,F),removeVariable:(f,g)=>G__namespace.StorageRegistry.removeVariable(f,g),getFlag:f=>G__namespace.storage.getFlag(f),setFlag:(f,g)=>G__namespace.storage.setFlag(f,g),onLabelClosing:f=>G__namespace.StorageRegistry.clearOldTempVariables(f)}),!a||!x){gt.warn("The canvas element or options are not defined. The canvas will not be initialized.");return}return await nt__namespace.canvas.init(a,x,A)}y.init=h;function e(){G__namespace.storage.clear();try{nt__namespace.canvas.clear();}catch{}pt__namespace.sound.clear(),L__namespace.narration.clear(),et__namespace.stepHistory.clear();}y.clear=e;function i(){let a={};try{a=nt__namespace.canvas.export();}catch{}return {pixivn_version:Ut,stepData:L__namespace.narration.export(),storageData:G__namespace.storage.export(),canvasData:a,soundData:pt__namespace.sound.export(),historyData:et__namespace.stepHistory.export(),path:$t()}}y.exportGameState=i;async function s(a,x){et__namespace.stepHistory.restore(a.historyData);let A=et__namespace.stepHistory.lastKey;if(typeof A=="number"){let f=et__namespace.stepHistory.stepsInfoMap.get(A)||null;await L__namespace.narration.restore(a.stepData,f);}G__namespace.storage.restore(a.storageData);try{await nt__namespace.canvas.restore(a.canvasData),await pt__namespace.sound.restore(a.soundData);}catch{}x?await x(a.path):await core.GameUnifier.navigate(a.path);}y.restoreGameState=s;async function r(a,x){return y.clear(),await L__namespace.narration.call(a,x)}y.start=r;function n(a){return JSON.parse(a)}y.jsonToGameState=n;function o(a){core.GameUnifier.onEnd=a;}y.onEnd=o;function c(a){return gt.warn("Game.onError is deprecated. Use Game.addOnError / Game.removeOnError to register multiple handlers."),core.GameUnifier.addOnError((x,A)=>a("step",x,A))}y.onError=c;function p(a){return core.GameUnifier.addOnError(a)}y.addOnError=p;function v(a){return core.GameUnifier.removeOnError(a)}y.removeOnError=v;function U(a){L__namespace.NarrationManagerStatic.onStepStart=a;}y.onStepStart=U;function S(a){L__namespace.NarrationManagerStatic.onLoadingLabel=a;}y.onLoadingLabel=S;function rt(a){L__namespace.NarrationManagerStatic.onStepEnd=a;}y.onStepEnd=rt;function I(a){core.GameUnifier.navigate=a;}y.onNavigate=I;function k(a){return core.GameUnifier.addOnPreContinue(a)}y.addOnPreContinue=k;function w(a){return core.GameUnifier.removeOnPreContinue(a)}y.removeOnPreContinue=w;})(exports.Game||={});var Ze={characterUtils:Bt__namespace,canvasUtils:nt__namespace,narrationUtils:L__namespace,soundUtils:pt__namespace,CANVAS_APP_GAME_LAYER_ALIAS:Kt,Pause:Ht,Repeat:Yt,PIXIVN_VERSION:Ut,...kt,...ae,canvas:nt__namespace.canvas,narration:L__namespace.narration,sound:pt__namespace.sound,storage:G__namespace.storage,history:et__namespace.stepHistory,Game:exports.Game,GameUnifier:core.GameUnifier};exports.CANVAS_APP_GAME_LAYER_ALIAS=Kt;exports.CachedMap=Ft;exports.PIXIVN_VERSION=Ut;exports.Pause=Ht;exports.Repeat=Yt;exports.SYSTEM_RESERVED_STORAGE_KEYS=ve;exports.createExportableElement=le;exports.default=Ze;Object.keys(nt).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return nt[k]}})});Object.keys(Bt).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return Bt[k]}})});Object.keys(core).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return core[k]}})});Object.keys(et).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return et[k]}})});Object.keys(L).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return L[k]}})});Object.keys(pt).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return pt[k]}})});Object.keys(G).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return G[k]}})});
package/dist/index.d.cts CHANGED
@@ -29,7 +29,7 @@ import './HistoryStep-G9dUn0Lf.cjs';
29
29
  import 'microdiff';
30
30
  import './StorageElementType-C7ETezlL.cjs';
31
31
 
32
- var version = "1.8.21";
32
+ var version = "1.8.23";
33
33
 
34
34
  /**
35
35
  * @deprecated
package/dist/index.d.ts CHANGED
@@ -29,7 +29,7 @@ import './HistoryStep-G9dUn0Lf.js';
29
29
  import 'microdiff';
30
30
  import './StorageElementType-C7ETezlL.js';
31
31
 
32
- var version = "1.8.21";
32
+ var version = "1.8.23";
33
33
 
34
34
  /**
35
35
  * @deprecated
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import {f as f$1,b as b$1,g,e,d,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 L 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{onabort;_onabort=[];reason;aborted=false;addEventListener(i,s){this._onabort.push(s);}},Nt=class{constructor(){e();}signal=new Bt;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{heap;length;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}constructor(e$1,i){if(!e(it,St))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e$1),this.length=0;}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,xt,B,O,X,T,b,f,P,z,N,R,J,D,Q,Z,V,W,tt,dt,j,Et,l,Gt,ft,ot,Tt,Y,ie,mt,bt,Ot,lt,ht,It,Lt,Ct,E,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,xt);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,O);f$1(this,X);f$1(this,T);f$1(this,b);f$1(this,f);f$1(this,P);f$1(this,z);f$1(this,N);f$1(this,R);f$1(this,J);f$1(this,D);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,Et);f$1(this,ft,()=>{});f$1(this,ot,()=>{});f$1(this,Tt,()=>{});f$1(this,Y,()=>false);f$1(this,mt,e=>{});f$1(this,bt,(e,i,s)=>{});f$1(this,Ot,(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:U,disposeAfter:S,noDisposeOnSet:rt,noUpdateTTL:I,maxSize:k=0,maxEntrySize:w=0,sizeCalculation:y,fetchMethod:a,memoMethod:x,noDeleteOnFetchRejection:A,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=w||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(x!==void 0&&typeof x!="function")throw new TypeError("memoMethod must be a function if defined");if(g(this,xt,x),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,b,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,R,0),g(this,J,ue.create(i)),g(this,O,0),g(this,X,0),typeof v=="function"&&g(this,q,v),typeof U=="function"&&g(this,ut,U),typeof S=="function"?(g(this,$,S),g(this,D,[])):(g(this,$,void 0),g(this,D,void 0)),g(this,tt,!!e(this,q)),g(this,Et,!!e(this,ut)),g(this,j,!!e(this,$)),this.noDisposeOnSet=!!rt,this.noUpdateTTL=!!I,this.noDeleteOnFetchRejection=!!A,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,b),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,R)},free:e(e$1,J),isBackgroundFetch:i=>{var s;return h(s=e$1,l,E).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,O)}get fetchMethod(){return e(this,yt)}get memoMethod(){return e(this,xt)}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,b)[e$1]!==void 0&&!h(this,l,E).call(this,e(this,f)[e$1])&&(yield [e(this,b)[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,b)[e$1]!==void 0&&!h(this,l,E).call(this,e(this,f)[e$1])&&(yield [e(this,b)[e$1],e(this,f)[e$1]]);}*keys(){for(let e$1 of h(this,l,lt).call(this)){let i=e(this,b)[e$1];i!==void 0&&!h(this,l,E).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,b)[e$1];i!==void 0&&!h(this,l,E).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,E).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,E).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,E).call(this,r)?r.__staleWhileFetching:r;if(n!==void 0&&e$1(n,e(this,b)[s],this))return this.get(e(this,b)[s],i)}}forEach(e$1,i=this){for(let s of h(this,l,lt).call(this)){let r=e(this,f)[s],n=h(this,l,E).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e$1.call(i,n,e(this,b)[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,E).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e$1.call(i,n,e(this,b)[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,b)[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,E).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,b)[i],r=e(this,f)[i],n=h(this,l,E).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,w;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,U=e(this,Ot).call(this,e$1,i$1,s.size||0,h$1);if(this.maxEntrySize&&U>this.maxEntrySize)return d&&(d.set="miss",d.maxEntrySizeExceeded=true),h(this,l,ct).call(this,e$1,"set"),this;let S=e(this,O)===0?void 0:e(this,T).get(e$1);if(S===void 0)S=e(this,O)===0?e(this,R):e(this,J).length!==0?e(this,J).pop():e(this,O)===e(this,K)?h(this,l,Lt).call(this,false):e(this,O),e(this,b)[S]=e$1,e(this,f)[S]=i$1,e(this,T).set(e$1,S),e(this,P)[e(this,R)]=S,e(this,z)[S]=e(this,R),g(this,R,S),i(this,O)._++,e(this,bt).call(this,S,U,d),d&&(d.set="add"),v=false,e(this,Et)&&((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,E).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,D)?.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,D)?.push([y,e$1,"set"]));if(e(this,mt).call(this,S),e(this,bt).call(this,S,U,d),e(this,f)[S]=i$1,d){d.set="replace";let a=y&&h(this,l,E).call(this,y)?y.__staleWhileFetching:y;a!==void 0&&(d.oldValue=a);}}else d&&(d.set="update");e(this,Et)&&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,Tt).call(this,S,r,n),d&&e(this,ot).call(this,d,S)),!o&&e(this,j)&&e(this,D)){let y=e(this,D),a;for(;a=y?.shift();)(w=e(this,$))==null||w.call(this,...a);}return this}pop(){var e$1;try{for(;e(this,O);){let i=e(this,f)[e(this,N)];if(h(this,l,Lt).call(this,!0),h(this,l,E).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(e(this,j)&&e(this,D)){let i=e(this,D),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,E).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,E).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:U=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:rt=this.allowStaleOnFetchRejection,ignoreFetchAbort:I=this.ignoreFetchAbort,allowStaleOnFetchAbort:k=this.allowStaleOnFetchAbort,context:w,forceRefresh:y=false,status:a,signal:x}=i;if(!e(this,dt))return a&&(a.fetch="get"),this.get(e$1,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,status:a});let A={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:h$1,size:d,sizeCalculation:v,noUpdateTTL:U,noDeleteOnFetchRejection:S,allowStaleOnFetchRejection:rt,allowStaleOnFetchAbort:k,ignoreFetchAbort:I,status:a,signal:x},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,A,w);return g.__returned=g}else {let g=e(this,f)[u];if(h(this,l,E).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,A,w),_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,xt);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,E).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,xt=new WeakMap,B=new WeakMap,O=new WeakMap,X=new WeakMap,T=new WeakMap,b=new WeakMap,f=new WeakMap,P=new WeakMap,z=new WeakMap,N=new WeakMap,R=new WeakMap,J=new WeakMap,D=new WeakMap,Q=new WeakMap,Z=new WeakMap,V=new WeakMap,W=new WeakMap,tt=new WeakMap,dt=new WeakMap,j=new WeakMap,Et=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,Tt,(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,b)[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],U=i[d];if(!v||!U)return;h.ttl=v,h.start=U,h.now=n||o();let S=h.now-U;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],U=i[d];if(!v||!U)return 1/0;let S=(n||o())-U;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,Tt=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,Ot,(i,s,r,n)=>{if(h(this,l,E).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,Ot=new WeakMap,lt=function*({allowStale:e$1=this.allowStale}={}){if(e(this,O))for(let i=e(this,R);!(!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,O))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,R)));)i=e(this,P)[i];},It=function(e$1){return e$1!==void 0&&e(this,T).get(e(this,b)[e$1])===e$1},Lt=function(e$1){var n;let i$1=e(this,N),s=e(this,b)[i$1],r=e(this,f)[i$1];return e(this,dt)&&h(this,l,E).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,D)?.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,b)[i$1]=void 0,e(this,f)[i$1]=void 0,e(this,J).push(i$1)),e(this,O)===1?(g(this,N,g(this,R,0)),e(this,J).length=0):g(this,N,e(this,P)[i$1]),e(this,T).delete(s),i(this,O)._--,i$1},Ct=function(e$1,i,s,r){let n=i===void 0?void 0:e(this,f)[i];if(h(this,l,E).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=(w,y=false)=>{let{aborted:a}=o.signal,x=s.ignoreFetchAbort&&w!==void 0,A=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&w!==void 0);if(s.status&&(a&&!y?(s.status.fetchAborted=true,s.status.fetchError=o.signal.reason,x&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),a&&!x&&!y)return S(o.signal.reason,A);let u=I,g=e(this,f)[i];return (g===I||x&&y&&g===void 0)&&(w===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,w,d.options))),w},U=w=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=w),S(w,false)),S=(w,y)=>{let{aborted:a}=o.signal,x=a&&s.allowStaleOnFetchAbort,A=x||s.allowStaleOnFetchRejection,u=A||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"):x||(e(this,f)[i]=g.__staleWhileFetching)),A)return s.status&&g.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),g.__staleWhileFetching;if(g.__returned===g)throw w},rt=(w,y)=>{var x;let a=(x=e(this,yt))==null?void 0:x.call(this,e$1,n,d);a&&a instanceof Promise&&a.then(A=>w(A===void 0?void 0:A),y),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(w(void 0),s.allowStaleOnFetchAbort&&(w=A=>v(A,true)));});};s.status&&(s.status.fetchDispatched=true);let I=new Promise(rt).then(v,U),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},E=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,R)&&(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,R),e$1),g(this,R,e$1));},ct=function(e$1,i$1){var r,n;let s=false;if(e(this,O)!==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,O)===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,E).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,D)?.push([h$1,e$1,i$1])),e(this,T).delete(e$1),e(this,b)[o]=void 0,e(this,f)[o]=void 0,o===e(this,R))g(this,R,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,O)._--,e(this,J).push(o);}}if(e(this,j)&&e(this,D)?.length){let o=e(this,D),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,E).call(this,n))n.__abortController.abort(new Error("deleted"));else {let o=e(this,b)[r];e(this,tt)&&((i=e(this,q))==null||i.call(this,n,o,e$1)),e(this,j)&&e(this,D)?.push([n,o,e$1]);}}if(e(this,T).clear(),e(this,f).fill(void 0),e(this,b).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,R,0),e(this,J).length=0,g(this,X,0),g(this,O,0),e(this,j)&&e(this,D)){let r=e(this,D),n;for(;n=r?.shift();)(s=e(this,$))==null||s.call(this,...n);}},wt);var Ft=class{cache;map=new Map;constructor(e){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.21";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(`
1
+ import {f as f$1,b as b$1,g,e,d,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 L 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{onabort;_onabort=[];reason;aborted=false;addEventListener(i,s){this._onabort.push(s);}},Nt=class{constructor(){e();}signal=new Bt;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{heap;length;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}constructor(e$1,i){if(!e(it,St))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e$1),this.length=0;}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,xt,B,O,X,T,b,f,P,z,N,R,J,D,Q,Z,V,W,tt,dt,j,Et,l,Gt,ft,ot,Tt,Y,ie,mt,bt,Ot,lt,ht,It,Lt,Ct,E,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,xt);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,O);f$1(this,X);f$1(this,T);f$1(this,b);f$1(this,f);f$1(this,P);f$1(this,z);f$1(this,N);f$1(this,R);f$1(this,J);f$1(this,D);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,Et);f$1(this,ft,()=>{});f$1(this,ot,()=>{});f$1(this,Tt,()=>{});f$1(this,Y,()=>false);f$1(this,mt,e=>{});f$1(this,bt,(e,i,s)=>{});f$1(this,Ot,(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:U,disposeAfter:S,noDisposeOnSet:rt,noUpdateTTL:I,maxSize:k=0,maxEntrySize:w=0,sizeCalculation:y,fetchMethod:a,memoMethod:x,noDeleteOnFetchRejection:A,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=w||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(x!==void 0&&typeof x!="function")throw new TypeError("memoMethod must be a function if defined");if(g(this,xt,x),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,b,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,R,0),g(this,J,ue.create(i)),g(this,O,0),g(this,X,0),typeof v=="function"&&g(this,q,v),typeof U=="function"&&g(this,ut,U),typeof S=="function"?(g(this,$,S),g(this,D,[])):(g(this,$,void 0),g(this,D,void 0)),g(this,tt,!!e(this,q)),g(this,Et,!!e(this,ut)),g(this,j,!!e(this,$)),this.noDisposeOnSet=!!rt,this.noUpdateTTL=!!I,this.noDeleteOnFetchRejection=!!A,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,b),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,R)},free:e(e$1,J),isBackgroundFetch:i=>{var s;return h(s=e$1,l,E).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,O)}get fetchMethod(){return e(this,yt)}get memoMethod(){return e(this,xt)}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,b)[e$1]!==void 0&&!h(this,l,E).call(this,e(this,f)[e$1])&&(yield [e(this,b)[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,b)[e$1]!==void 0&&!h(this,l,E).call(this,e(this,f)[e$1])&&(yield [e(this,b)[e$1],e(this,f)[e$1]]);}*keys(){for(let e$1 of h(this,l,lt).call(this)){let i=e(this,b)[e$1];i!==void 0&&!h(this,l,E).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,b)[e$1];i!==void 0&&!h(this,l,E).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,E).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,E).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,E).call(this,r)?r.__staleWhileFetching:r;if(n!==void 0&&e$1(n,e(this,b)[s],this))return this.get(e(this,b)[s],i)}}forEach(e$1,i=this){for(let s of h(this,l,lt).call(this)){let r=e(this,f)[s],n=h(this,l,E).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e$1.call(i,n,e(this,b)[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,E).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e$1.call(i,n,e(this,b)[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,b)[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,E).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,b)[i],r=e(this,f)[i],n=h(this,l,E).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,w;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,U=e(this,Ot).call(this,e$1,i$1,s.size||0,h$1);if(this.maxEntrySize&&U>this.maxEntrySize)return d&&(d.set="miss",d.maxEntrySizeExceeded=true),h(this,l,ct).call(this,e$1,"set"),this;let S=e(this,O)===0?void 0:e(this,T).get(e$1);if(S===void 0)S=e(this,O)===0?e(this,R):e(this,J).length!==0?e(this,J).pop():e(this,O)===e(this,K)?h(this,l,Lt).call(this,false):e(this,O),e(this,b)[S]=e$1,e(this,f)[S]=i$1,e(this,T).set(e$1,S),e(this,P)[e(this,R)]=S,e(this,z)[S]=e(this,R),g(this,R,S),i(this,O)._++,e(this,bt).call(this,S,U,d),d&&(d.set="add"),v=false,e(this,Et)&&((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,E).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,D)?.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,D)?.push([y,e$1,"set"]));if(e(this,mt).call(this,S),e(this,bt).call(this,S,U,d),e(this,f)[S]=i$1,d){d.set="replace";let a=y&&h(this,l,E).call(this,y)?y.__staleWhileFetching:y;a!==void 0&&(d.oldValue=a);}}else d&&(d.set="update");e(this,Et)&&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,Tt).call(this,S,r,n),d&&e(this,ot).call(this,d,S)),!o&&e(this,j)&&e(this,D)){let y=e(this,D),a;for(;a=y?.shift();)(w=e(this,$))==null||w.call(this,...a);}return this}pop(){var e$1;try{for(;e(this,O);){let i=e(this,f)[e(this,N)];if(h(this,l,Lt).call(this,!0),h(this,l,E).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(e(this,j)&&e(this,D)){let i=e(this,D),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,E).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,E).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:U=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:rt=this.allowStaleOnFetchRejection,ignoreFetchAbort:I=this.ignoreFetchAbort,allowStaleOnFetchAbort:k=this.allowStaleOnFetchAbort,context:w,forceRefresh:y=false,status:a,signal:x}=i;if(!e(this,dt))return a&&(a.fetch="get"),this.get(e$1,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,status:a});let A={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:h$1,size:d,sizeCalculation:v,noUpdateTTL:U,noDeleteOnFetchRejection:S,allowStaleOnFetchRejection:rt,allowStaleOnFetchAbort:k,ignoreFetchAbort:I,status:a,signal:x},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,A,w);return g.__returned=g}else {let g=e(this,f)[u];if(h(this,l,E).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,A,w),_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,xt);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,E).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,xt=new WeakMap,B=new WeakMap,O=new WeakMap,X=new WeakMap,T=new WeakMap,b=new WeakMap,f=new WeakMap,P=new WeakMap,z=new WeakMap,N=new WeakMap,R=new WeakMap,J=new WeakMap,D=new WeakMap,Q=new WeakMap,Z=new WeakMap,V=new WeakMap,W=new WeakMap,tt=new WeakMap,dt=new WeakMap,j=new WeakMap,Et=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,Tt,(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,b)[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],U=i[d];if(!v||!U)return;h.ttl=v,h.start=U,h.now=n||o();let S=h.now-U;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],U=i[d];if(!v||!U)return 1/0;let S=(n||o())-U;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,Tt=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,Ot,(i,s,r,n)=>{if(h(this,l,E).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,Ot=new WeakMap,lt=function*({allowStale:e$1=this.allowStale}={}){if(e(this,O))for(let i=e(this,R);!(!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,O))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,R)));)i=e(this,P)[i];},It=function(e$1){return e$1!==void 0&&e(this,T).get(e(this,b)[e$1])===e$1},Lt=function(e$1){var n;let i$1=e(this,N),s=e(this,b)[i$1],r=e(this,f)[i$1];return e(this,dt)&&h(this,l,E).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,D)?.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,b)[i$1]=void 0,e(this,f)[i$1]=void 0,e(this,J).push(i$1)),e(this,O)===1?(g(this,N,g(this,R,0)),e(this,J).length=0):g(this,N,e(this,P)[i$1]),e(this,T).delete(s),i(this,O)._--,i$1},Ct=function(e$1,i,s,r){let n=i===void 0?void 0:e(this,f)[i];if(h(this,l,E).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=(w,y=false)=>{let{aborted:a}=o.signal,x=s.ignoreFetchAbort&&w!==void 0,A=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&w!==void 0);if(s.status&&(a&&!y?(s.status.fetchAborted=true,s.status.fetchError=o.signal.reason,x&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),a&&!x&&!y)return S(o.signal.reason,A);let u=I,g=e(this,f)[i];return (g===I||x&&y&&g===void 0)&&(w===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,w,d.options))),w},U=w=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=w),S(w,false)),S=(w,y)=>{let{aborted:a}=o.signal,x=a&&s.allowStaleOnFetchAbort,A=x||s.allowStaleOnFetchRejection,u=A||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"):x||(e(this,f)[i]=g.__staleWhileFetching)),A)return s.status&&g.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),g.__staleWhileFetching;if(g.__returned===g)throw w},rt=(w,y)=>{var x;let a=(x=e(this,yt))==null?void 0:x.call(this,e$1,n,d);a&&a instanceof Promise&&a.then(A=>w(A===void 0?void 0:A),y),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(w(void 0),s.allowStaleOnFetchAbort&&(w=A=>v(A,true)));});};s.status&&(s.status.fetchDispatched=true);let I=new Promise(rt).then(v,U),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},E=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,R)&&(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,R),e$1),g(this,R,e$1));},ct=function(e$1,i$1){var r,n;let s=false;if(e(this,O)!==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,O)===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,E).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,D)?.push([h$1,e$1,i$1])),e(this,T).delete(e$1),e(this,b)[o]=void 0,e(this,f)[o]=void 0,o===e(this,R))g(this,R,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,O)._--,e(this,J).push(o);}}if(e(this,j)&&e(this,D)?.length){let o=e(this,D),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,E).call(this,n))n.__abortController.abort(new Error("deleted"));else {let o=e(this,b)[r];e(this,tt)&&((i=e(this,q))==null||i.call(this,n,o,e$1)),e(this,j)&&e(this,D)?.push([n,o,e$1]);}}if(e(this,T).clear(),e(this,f).fill(void 0),e(this,b).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,R,0),e(this,J).length=0,g(this,X,0),g(this,O,0),e(this,j)&&e(this,D)){let r=e(this,D),n;for(;n=r?.shift();)(s=e(this,$))==null||s.call(this,...n);}},wt);var Ft=class{cache;map=new Map;constructor(e){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.23";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
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,x,A){if(GameUnifier.init({navigate:x?.navigate,getCurrentGameStepState:()=>{let u={};try{u=nt.canvas.export();}catch{}return {path:qt(),storage:G.storage.export(),canvas:u,sound:pt.sound.export(),labelIndex:L.NarrationManagerStatic.currentLabelStepIndex||0,openedLabels:L.narration.openedLabels}},restoreGameStepState:async(u,g)=>{et.HistoryManagerStatic._originalStepData=u,L.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:()=>L.narration.stepCounter,setStepCounter:u=>{L.NarrationManagerStatic._stepCounter=u;},getOpenedLabels:()=>L.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=L.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||!x){gt.warn("The canvas element or options are not defined. The canvas will not be initialized.");return}return await nt.canvas.init(a,x,A)}y.init=m;function e(){G.storage.clear();try{nt.canvas.clear();}catch{}pt.sound.clear(),L.narration.clear(),et.stepHistory.clear();}y.clear=e;function i(){let a={};try{a=nt.canvas.export();}catch{}return {pixivn_version:Ut,stepData:L.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,x){et.stepHistory.restore(a.historyData);let A=et.stepHistory.lastKey;if(typeof A=="number"){let u=et.stepHistory.stepsInfoMap.get(A)||null;await L.narration.restore(a.stepData,u);}G.storage.restore(a.storageData);try{await nt.canvas.restore(a.canvasData),await pt.sound.restore(a.soundData);}catch{}x?await x(a.path):await GameUnifier.navigate(a.path);}y.restoreGameState=s;async function r(a,x){return y.clear(),await L.narration.call(a,x)}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((x,A)=>a("step",x,A))}y.onError=h;function d(a){return GameUnifier.addOnError(a)}y.addOnError=d;function v(a){return GameUnifier.removeOnError(a)}y.removeOnError=v;function U(a){L.NarrationManagerStatic.onStepStart=a;}y.onStepStart=U;function S(a){L.NarrationManagerStatic.onLoadingLabel=a;}y.onLoadingLabel=S;function rt(a){L.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 w(a){return GameUnifier.removeOnPreContinue(a)}y.removeOnPreContinue=w;})(he||={});var $e={characterUtils:$t,canvasUtils:nt,narrationUtils:L,soundUtils:pt,CANVAS_APP_GAME_LAYER_ALIAS:Ht,Pause:Yt,Repeat:Wt,PIXIVN_VERSION:Ut,...Kt,...re,canvas:nt.canvas,narration:L.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,$e as default};
package/dist/motion.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var canvas=require('@drincs/pixi-vn/canvas'),Y=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 Y__default=/*#__PURE__*/_interopDefault(Y);var Z=Object.create;var z=Object.defineProperty;var tt=Object.getOwnPropertyDescriptor;var et=Object.getOwnPropertyNames;var nt=Object.getPrototypeOf,it=Object.prototype.hasOwnProperty;var R=(o=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(o,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):o)(function(o){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+o+'" is not supported')});var D=(o,t)=>()=>(t||o((t={exports:{}}).exports,t),t.exports);var rt=(o,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of et(t))!it.call(o,i)&&i!==r&&z(o,i,{get:()=>t[i],enumerable:!(n=tt(t,i))||n.enumerable});return o};var at=(o,t,r)=>(r=o!=null?Z(nt(o)):{},rt(z(r,"default",{value:o,enumerable:true}),o));var N=D((I,F)=>{(function(o,t){typeof I=="object"?F.exports=I=t():typeof define=="function"&&define.amd?define([],t):o.CryptoJS=t();})(I,function(){var o=o||(function(t,r){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 R=="function")try{n=R("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 e(){}return function(a){var f;return e.prototype=a,f=new e,e.prototype=null,f}})(),c={},g=c.lib={},l=g.Base=(function(){return {extend:function(e){var a=s(this);return e&&a.mixIn(e),(!a.hasOwnProperty("init")||this.init===a.init)&&(a.init=function(){a.$super.init.apply(this,arguments);}),a.init.prototype=a,a.$super=this,a},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var a in e)e.hasOwnProperty(a)&&(this[a]=e[a]);e.hasOwnProperty("toString")&&(this.toString=e.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),m=g.WordArray=l.extend({init:function(e,a){e=this.words=e||[],a!=r?this.sigBytes=a:this.sigBytes=e.length*4;},toString:function(e){return (e||h).stringify(this)},concat:function(e){var a=this.words,f=e.words,p=this.sigBytes,d=e.sigBytes;if(this.clamp(),p%4)for(var v=0;v<d;v++){var j=f[v>>>2]>>>24-v%4*8&255;a[p+v>>>2]|=j<<24-(p+v)%4*8;}else for(var A=0;A<d;A+=4)a[p+A>>>2]=f[A>>>2];return this.sigBytes+=d,this},clamp:function(){var e=this.words,a=this.sigBytes;e[a>>>2]&=4294967295<<32-a%4*8,e.length=t.ceil(a/4);},clone:function(){var e=l.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var a=[],f=0;f<e;f+=4)a.push(i());return new m.init(a,e)}}),u=c.enc={},h=u.Hex={stringify:function(e){for(var a=e.words,f=e.sigBytes,p=[],d=0;d<f;d++){var v=a[d>>>2]>>>24-d%4*8&255;p.push((v>>>4).toString(16)),p.push((v&15).toString(16));}return p.join("")},parse:function(e){for(var a=e.length,f=[],p=0;p<a;p+=2)f[p>>>3]|=parseInt(e.substr(p,2),16)<<24-p%8*4;return new m.init(f,a/2)}},T=u.Latin1={stringify:function(e){for(var a=e.words,f=e.sigBytes,p=[],d=0;d<f;d++){var v=a[d>>>2]>>>24-d%4*8&255;p.push(String.fromCharCode(v));}return p.join("")},parse:function(e){for(var a=e.length,f=[],p=0;p<a;p++)f[p>>>2]|=(e.charCodeAt(p)&255)<<24-p%4*8;return new m.init(f,a)}},x=u.Utf8={stringify:function(e){try{return decodeURIComponent(escape(T.stringify(e)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(e){return T.parse(unescape(encodeURIComponent(e)))}},b=g.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new m.init,this._nDataBytes=0;},_append:function(e){typeof e=="string"&&(e=x.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes;},_process:function(e){var a,f=this._data,p=f.words,d=f.sigBytes,v=this.blockSize,j=v*4,A=d/j;e?A=t.ceil(A):A=t.max((A|0)-this._minBufferSize,0);var B=A*v,M=t.min(B*4,d);if(B){for(var W=0;W<B;W+=v)this._doProcessBlock(p,W);a=p.splice(0,B),f.sigBytes-=M;}return new m.init(a,M)},clone:function(){var e=l.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});g.Hasher=b.extend({cfg:l.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset();},reset:function(){b.reset.call(this),this._doReset();},update:function(e){return this._append(e),this._process(),this},finalize:function(e){e&&this._append(e);var a=this._doFinalize();return a},blockSize:512/32,_createHelper:function(e){return function(a,f){return new e.init(f).finalize(a)}},_createHmacHelper:function(e){return function(a,f){return new y.HMAC.init(e,f).finalize(a)}}});var y=c.algo={};return c})(Math);return o});});var K=D((P,$)=>{(function(o,t){typeof P=="object"?$.exports=P=t(N()):typeof define=="function"&&define.amd?define(["./core"],t):t(o.CryptoJS);})(P,function(o){return (function(){var t=o,r=t.lib,n=r.WordArray,i=r.Hasher,s=t.algo,c=[],g=s.SHA1=i.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(l,m){for(var u=this._hash.words,h=u[0],T=u[1],x=u[2],b=u[3],w=u[4],y=0;y<80;y++){if(y<16)c[y]=l[m+y]|0;else {var e=c[y-3]^c[y-8]^c[y-14]^c[y-16];c[y]=e<<1|e>>>31;}var a=(h<<5|h>>>27)+w+c[y];y<20?a+=(T&x|~T&b)+1518500249:y<40?a+=(T^x^b)+1859775393:y<60?a+=(T&x|T&b|x&b)-1894007588:a+=(T^x^b)-899497514,w=b,b=x,x=T<<30|T>>>2,T=h,h=a;}u[0]=u[0]+h|0,u[1]=u[1]+T|0,u[2]=u[2]+x|0,u[3]=u[3]+b|0,u[4]=u[4]+w|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=i.clone.call(this);return l._hash=this._hash.clone(),l}});t.SHA1=i._createHelper(g),t.HmacSHA1=i._createHmacHelper(g);})(),o.SHA1});});var E=(o,t=100)=>{let r=null;return (...n)=>{r&&clearTimeout(r),r=setTimeout(()=>o(...n),t);}};var q=o=>t=>{let r=({lastTime:n})=>t(n);return {start:(n=true)=>{o.add(r),o.start();},stop:()=>o.remove(r),now:()=>o.lastTime}};function k(o,t,r){if(Array.isArray(o)&&Array.isArray(o[0])){t&&"repeat"in t&&t?.repeat===null&&(t.repeat=1/0),o.forEach(c=>{if(Array.isArray(c)&&c.length===3){let[g,l,m]=c;m&&"repeat"in m&&m?.repeat===null&&(m.repeat=1/0);}});let{ticker:n=new Y__default.default.Ticker,driver:i=q(n),...s}=t||{};return motion.animate(o,{driver:i,...s})}else {r&&"repeat"in r&&r?.repeat===null&&(r.repeat=1/0);let{ticker:n=new Y__default.default.Ticker,driver:i=q(n),...s}=r||{};return motion.animate(o,t,{driver:i,...s})}}function ot(o,t){let r={x:0},n=[];return o.forEach((i,s)=>{let{onComplete:c,onPlay:g,...l}=i;if(g){let m=motion.motionValue(s);m.on("change",E(g,50)),n.push([m,s+1,{duration:.01}]);}if(n.push([r,{x:s+1},l]),c){let m=motion.motionValue(s);m.on("change",E(c,50)),n.push([m,s+1,{duration:.01}]);}}),k(n,t)}var J=at(K());var O=class{constructor(t,r){let{duration:n,priority:i,id:s=this.generateTickerId(r),canvasElementAliases:c=[]}=r||{};this._args=t,this.duration=n,this.priority=i,this.id=s,this.canvasElementAliases=c;}id;_args;get args(){return {...this._args,time:this._animation?.time}}duration;priority;ticker=new Y__default.default.Ticker;_animation;stopped=false;_paused=false;canvasElementAliases=[];getItemByAlias(t){if(!this.canvasElementAliases.includes(t))return;let r=canvas.canvas.find(t);if(r)return r}generateTickerId(...t){try{return (0,J.default)(JSON.stringify(t)).toString()+"_motion_"+Math.random().toString(36).substring(7)}catch(r){throw new core.PixiError("not_json_serializable",`Error to generate ticker id: ${r}`)}}timeout=50;async complete(){this.animation.complete(),await new Promise(t=>setTimeout(t,this.timeout));}stop(){this.stopped=true,this.animation.stop();}start(){this.args.options?.autoplay!==false&&(this._paused=false,this.animation.play());}onComplete=()=>{let t=this.id,r=this._args.options?.aliasToRemoveAfter||[];typeof r=="string"&&(r=[r]);let n=this._args.options?.tickerAliasToResume||[];typeof n=="string"&&(n=[n]);let i=this._args.options?.tickerIdToResume||[];typeof i=="string"&&(i=[i]),canvas.canvas.onTickerComplete(t,{aliasToRemoveAfter:r,tickerAliasToResume:n,tickerIdToResume:i,stopTicker:false});};createItem(t){return new Proxy({alias:t},{set:({alias:r},n,i)=>{if(this.stopped||this._paused||this._args.startState&&this._args.startState[n]===i)return true;let s=this.getItemByAlias(r);if(!s)return true;switch(n){case "pivotX":s.pivot.x=i;break;case "pivotY":s.pivot.y=i;break;case "scaleX":s.scale.x=i;break;case "scaleY":s.scale.y=i;break;default:s[n]=i;break}return true},get:({alias:r},n)=>{if(this._args.startState||(this._args.startState={}),n in this._args.startState)return this._args.startState[n];let i=this.getItemByAlias(r);if(!i)return;let s;switch(n){case "pivotX":s=i.pivot.x;break;case "pivotY":s=i.pivot.y;break;case "scaleX":s=i.scale.x;break;case "scaleY":s=i.scale.y;break;default:s=i[n];break}return this._args.startState={...this._args.startState,[n]:s},s},has:({alias:r},n)=>{let i=this.getItemByAlias(r);if(!i)return false;switch(n){case "pivotX":return "pivot"in i&&"x"in i.pivot;case "pivotY":return "pivot"in i&&"y"in i.pivot;case "scaleX":return "scale"in i&&"x"in i.scale;case "scaleY":return "scale"in i&&"y"in i.scale;default:return n in i}},ownKeys:({alias:r})=>{let n=this.getItemByAlias(r);return n?Object.keys(n):[]}})}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 S=class extends O{get animation(){let t=this._animation;if(t)return t;let r=this.canvasElementAliases[0],n=this.createItem(r),i=this._args.sequence.map((s,c)=>[n,s[0],{...s[1]||{},ticker:this.ticker,onComplete:c===this._args.sequence.length-1?()=>this.onComplete():void 0}]);return t=k(i,this._args.options),this._args.time&&(this.animation.time=this._args.time),this._animation=t,t}alias="motion-sequence"};var _=class extends O{get animation(){let t=this._animation;if(t)return t;let r=this.canvasElementAliases.map(n=>this.createItem(n));return t=k(r,this._args.keyframes,{...this._args.options,onComplete:()=>this.onComplete(),ticker:this.ticker}),this._args.time&&(t.time=this._args.time),this._animation=t,t}alias="motion"};var C;(i=>(i.log=(s,...c)=>console.log(`[Pixi\u2019VN] ${s}`,...c),i.warn=(s,...c)=>console.warn(`[Pixi\u2019VN] ${s}`,...c),i.error=(s,...c)=>console.error(`[Pixi\u2019VN] ${s}`,...c),i.info=(s,...c)=>console.info(`[Pixi\u2019VN] ${s}`,...c)))(C||={});function H(o){try{if(typeof o>"u")return o;let t=JSON.stringify(o);return JSON.parse(t)}catch(t){throw C.error("Error creating exportable element",o,t),new core.PixiError("not_json_serializable","Error creating exportable element")}}var G;(t=>{function o(r,n,i,s){try{n=H(n);}catch(h){throw C.error("animate keyframes cannot contain functions or classes"),h}try{i=H(i);}catch(h){throw C.error("animate options cannot contain functions or classes"),h}let c=[];typeof r=="string"?c=[r]:Array.isArray(r)?c=r.map(h=>typeof h=="string"?h:h.label):c=[r.label];let g;Array.isArray(n)?g=new S({sequence:n,options:i},{priority:s,canvasElementAliases:c}):g=new _({keyframes:n,options:i},{priority:s,canvasElementAliases:c});let l=canvas.canvas.addTicker(c,g),{forceCompleteBeforeNext:m}=i||{},{completeOnContinue:u=m}=i||{};return l&&u&&canvas.canvas.completeTickerOnStepEnd({id:l}),l}t.animate=o;})(G||={});var pt=G;canvas.RegisteredTickers.add(_,"motion");canvas.RegisteredTickers.add(S,"motion-sequence");exports.animate=k;exports.motion=pt;exports.motionDriver=q;exports.timeline=ot;
1
+ 'use strict';var canvas=require('@drincs/pixi-vn/canvas'),H=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 H__default=/*#__PURE__*/_interopDefault(H);var G=Object.create;var z=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var Z=Object.getOwnPropertyNames;var tt=Object.getPrototypeOf,et=Object.prototype.hasOwnProperty;var q=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(e,a)=>(typeof require<"u"?require:e)[a]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+s+'" is not supported')});var D=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports);var nt=(s,e,a,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Z(e))!et.call(s,n)&&n!==a&&z(s,n,{get:()=>e[n],enumerable:!(i=Q(e,n))||i.enumerable});return s};var it=(s,e,a)=>(a=s!=null?G(tt(s)):{},nt(z(a,"default",{value:s,enumerable:true}),s));var X=D((W,U)=>{(function(s,e){typeof W=="object"?U.exports=W=e():typeof define=="function"&&define.amd?define([],e):s.CryptoJS=e();})(W,function(){var s=s||(function(e,a){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 n=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.")},o=Object.create||(function(){function t(){}return function(r){var p;return t.prototype=r,p=new t,t.prototype=null,p}})(),c={},h=c.lib={},d=h.Base=(function(){return {extend:function(t){var r=o(this);return t&&r.mixIn(t),(!r.hasOwnProperty("init")||this.init===r.init)&&(r.init=function(){r.$super.init.apply(this,arguments);}),r.init.prototype=r,r.$super=this,r},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var r in t)t.hasOwnProperty(r)&&(this[r]=t[r]);t.hasOwnProperty("toString")&&(this.toString=t.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),u=h.WordArray=d.extend({init:function(t,r){t=this.words=t||[],r!=a?this.sigBytes=r:this.sigBytes=t.length*4;},toString:function(t){return (t||l).stringify(this)},concat:function(t){var r=this.words,p=t.words,f=this.sigBytes,g=t.sigBytes;if(this.clamp(),f%4)for(var v=0;v<g;v++){var k=p[v>>>2]>>>24-v%4*8&255;r[f+v>>>2]|=k<<24-(f+v)%4*8;}else for(var O=0;O<g;O+=4)r[f+O>>>2]=p[O>>>2];return this.sigBytes+=g,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4);},clone:function(){var t=d.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var r=[],p=0;p<t;p+=4)r.push(n());return new u.init(r,t)}}),m=c.enc={},l=m.Hex={stringify:function(t){for(var r=t.words,p=t.sigBytes,f=[],g=0;g<p;g++){var v=r[g>>>2]>>>24-g%4*8&255;f.push((v>>>4).toString(16)),f.push((v&15).toString(16));}return f.join("")},parse:function(t){for(var r=t.length,p=[],f=0;f<r;f+=2)p[f>>>3]|=parseInt(t.substr(f,2),16)<<24-f%8*4;return new u.init(p,r/2)}},A=m.Latin1={stringify:function(t){for(var r=t.words,p=t.sigBytes,f=[],g=0;g<p;g++){var v=r[g>>>2]>>>24-g%4*8&255;f.push(String.fromCharCode(v));}return f.join("")},parse:function(t){for(var r=t.length,p=[],f=0;f<r;f++)p[f>>>2]|=(t.charCodeAt(f)&255)<<24-f%4*8;return new u.init(p,r)}},b=m.Utf8={stringify:function(t){try{return decodeURIComponent(escape(A.stringify(t)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(t){return A.parse(unescape(encodeURIComponent(t)))}},x=h.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new u.init,this._nDataBytes=0;},_append:function(t){typeof t=="string"&&(t=b.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes;},_process:function(t){var r,p=this._data,f=p.words,g=p.sigBytes,v=this.blockSize,k=v*4,O=g/k;t?O=e.ceil(O):O=e.max((O|0)-this._minBufferSize,0);var S=O*v,_=e.min(S*4,g);if(S){for(var E=0;E<S;E+=v)this._doProcessBlock(f,E);r=f.splice(0,S),p.sigBytes-=_;}return new u.init(r,_)},clone:function(){var t=d.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});h.Hasher=x.extend({cfg:d.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 r=this._doFinalize();return r},blockSize:512/32,_createHelper:function(t){return function(r,p){return new t.init(p).finalize(r)}},_createHmacHelper:function(t){return function(r,p){return new y.HMAC.init(t,p).finalize(r)}}});var y=c.algo={};return c})(Math);return s});});var $=D((R,N)=>{(function(s,e){typeof R=="object"?N.exports=R=e(X()):typeof define=="function"&&define.amd?define(["./core"],e):e(s.CryptoJS);})(R,function(s){return (function(){var e=s,a=e.lib,i=a.WordArray,n=a.Hasher,o=e.algo,c=[],h=o.SHA1=n.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(d,u){for(var m=this._hash.words,l=m[0],A=m[1],b=m[2],x=m[3],T=m[4],y=0;y<80;y++){if(y<16)c[y]=d[u+y]|0;else {var t=c[y-3]^c[y-8]^c[y-14]^c[y-16];c[y]=t<<1|t>>>31;}var r=(l<<5|l>>>27)+T+c[y];y<20?r+=(A&b|~A&x)+1518500249:y<40?r+=(A^b^x)+1859775393:y<60?r+=(A&b|A&x|b&x)-1894007588:r+=(A^b^x)-899497514,T=x,x=b,b=A<<30|A>>>2,A=l,l=r;}m[0]=m[0]+l|0,m[1]=m[1]+A|0,m[2]=m[2]+b|0,m[3]=m[3]+x|0,m[4]=m[4]+T|0;},_doFinalize:function(){var d=this._data,u=d.words,m=this._nDataBytes*8,l=d.sigBytes*8;return u[l>>>5]|=128<<24-l%32,u[(l+64>>>9<<4)+14]=Math.floor(m/4294967296),u[(l+64>>>9<<4)+15]=m,d.sigBytes=u.length*4,this._process(),this._hash},clone:function(){var d=n.clone.call(this);return d._hash=this._hash.clone(),d}});e.SHA1=n._createHelper(h),e.HmacSHA1=n._createHmacHelper(h);})(),s.SHA1});});var j=s=>e=>{let a=({lastTime:i})=>e(i);return {start:(i=true)=>{s.add(a),s.start();},stop:()=>s.remove(a),now:()=>s.lastTime}};function B(s,e,a){if(Array.isArray(s)&&Array.isArray(s[0])){e&&"repeat"in e&&e?.repeat===null&&(e.repeat=1/0),s.forEach(c=>{if(Array.isArray(c)&&c.length===3){let[h,d,u]=c;u&&"repeat"in u&&u?.repeat===null&&(u.repeat=1/0);}});let{ticker:i=new H__default.default.Ticker,driver:n=j(i),...o}=e||{};return motion.animate(s,{driver:n,...o})}else {a&&"repeat"in a&&a?.repeat===null&&(a.repeat=1/0);let{ticker:i=new H__default.default.Ticker,driver:n=j(i),...o}=a||{};return motion.animate(s,e,{driver:n,...o})}}function rt(s,e){let{ticker:a=new H__default.default.Ticker,driver:i=j(a),repeat:n,...o}=e||{},c={x:0},h=[],d=[],u=0;s.forEach((b,x)=>{let{onComplete:T,onPlay:y,delay:t=0,duration:r=.3,...p}=b,f=typeof t=="function"?t(0,1):t,g=u+f,v=g+r;h.push({start:g,end:v,onPlay:y,onComplete:T}),d.push([c,{x:x+1},{...p,delay:t,duration:r}]),u=v;});let m=u,l=B(d,{...o,repeat:n,driver:i});if(h.length>0&&m>0){let k=function(){if(r)return;for(t+=a.deltaMS/1e3;!r&&t>=m;){if(f(),y++,y>=x){v();return}t-=m;}let S=g(t);S===-1?T>=0&&f():S!==T&&p(S);};let b=n===null?1/0:n,x=b===void 0?1:b+1,T=-1,y=0,t=0,r=false,p=S=>{T>=0&&h[T].onComplete?.(),T=S,h[T].onPlay?.();},f=()=>{T>=0&&h[T].onComplete?.(),T=-1;},g=S=>{for(let _=0;_<h.length;_++){if(S<h[_].start)return -1;if(S<h[_].end)return _}return h.length-1},v=()=>{r=true,a.remove(k);};a.add(k);let O=l.stop.bind(l);l.stop=()=>{v(),O();};}return l}var L=it($());var C=class{constructor(e,a){let{duration:i,priority:n,id:o=this.generateTickerId(a),canvasElementAliases:c=[]}=a||{};this._args=e,this.duration=i,this.priority=n,this.id=o,this.canvasElementAliases=c;}id;_args;get args(){return {...this._args,time:this._animation?.time}}duration;priority;ticker=new H__default.default.Ticker;_animation;stopped=false;_paused=false;canvasElementAliases=[];getItemByAlias(e){if(!this.canvasElementAliases.includes(e))return;let a=canvas.canvas.find(e);if(a)return a}generateTickerId(...e){try{return (0,L.default)(JSON.stringify(e)).toString()+"_motion_"+Math.random().toString(36).substring(7)}catch(a){throw new core.PixiError("not_json_serializable",`Error to generate ticker id: ${a}`)}}timeout=50;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());}onComplete=()=>{let e=this.id,a=this._args.options?.aliasToRemoveAfter||[];typeof a=="string"&&(a=[a]);let i=this._args.options?.tickerAliasToResume||[];typeof i=="string"&&(i=[i]);let n=this._args.options?.tickerIdToResume||[];typeof n=="string"&&(n=[n]),canvas.canvas.onTickerComplete(e,{aliasToRemoveAfter:a,tickerAliasToResume:i,tickerIdToResume:n,stopTicker:false});};createItem(e){return new Proxy({alias:e},{set:({alias:a},i,n)=>{if(this.stopped||this._paused||this._args.startState&&this._args.startState[i]===n)return true;let o=this.getItemByAlias(a);if(!o)return true;switch(i){case "pivotX":o.pivot.x=n;break;case "pivotY":o.pivot.y=n;break;case "scaleX":o.scale.x=n;break;case "scaleY":o.scale.y=n;break;default:o[i]=n;break}return true},get:({alias:a},i)=>{if(this._args.startState||(this._args.startState={}),i in this._args.startState)return this._args.startState[i];let n=this.getItemByAlias(a);if(!n)return;let o;switch(i){case "pivotX":o=n.pivot.x;break;case "pivotY":o=n.pivot.y;break;case "scaleX":o=n.scale.x;break;case "scaleY":o=n.scale.y;break;default:o=n[i];break}return this._args.startState={...this._args.startState,[i]:o},o},has:({alias:a},i)=>{let n=this.getItemByAlias(a);if(!n)return false;switch(i){case "pivotX":return "pivot"in n&&"x"in n.pivot;case "pivotY":return "pivot"in n&&"y"in n.pivot;case "scaleX":return "scale"in n&&"x"in n.scale;case "scaleY":return "scale"in n&&"y"in n.scale;default:return i in n}},ownKeys:({alias:a})=>{let i=this.getItemByAlias(a);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 I=class extends C{get animation(){let e=this._animation;if(e)return e;let a=this.canvasElementAliases[0],i=this.createItem(a),n=this._args.sequence.map((o,c)=>[i,o[0],{...o[1]||{},ticker:this.ticker,onComplete:c===this._args.sequence.length-1?()=>this.onComplete():void 0}]);return e=B(n,this._args.options),this._args.time&&(this.animation.time=this._args.time),this._animation=e,e}alias="motion-sequence"};var w=class extends C{get animation(){let e=this._animation;if(e)return e;let a=this.canvasElementAliases.map(i=>this.createItem(i));return e=B(a,this._args.keyframes,{...this._args.options,onComplete:()=>this.onComplete(),ticker:this.ticker}),this._args.time&&(e.time=this._args.time),this._animation=e,e}alias="motion"};var P;(n=>(n.log=(o,...c)=>console.log(`[Pixi\u2019VN] ${o}`,...c),n.warn=(o,...c)=>console.warn(`[Pixi\u2019VN] ${o}`,...c),n.error=(o,...c)=>console.error(`[Pixi\u2019VN] ${o}`,...c),n.info=(o,...c)=>console.info(`[Pixi\u2019VN] ${o}`,...c)))(P||={});function M(s){try{if(typeof s>"u")return s;let e=JSON.stringify(s);return JSON.parse(e)}catch(e){throw P.error("Error creating exportable element",s,e),new core.PixiError("not_json_serializable","Error creating exportable element")}}var F;(e=>{function s(a,i,n,o){try{i=M(i);}catch(l){throw P.error("animate keyframes cannot contain functions or classes"),l}try{n=M(n);}catch(l){throw P.error("animate options cannot contain functions or classes"),l}let c=[];typeof a=="string"?c=[a]:Array.isArray(a)?c=a.map(l=>typeof l=="string"?l:l.label):c=[a.label];let h;Array.isArray(i)?h=new I({sequence:i,options:n},{priority:o,canvasElementAliases:c}):h=new w({keyframes:i,options:n},{priority:o,canvasElementAliases:c});let d=canvas.canvas.addTicker(c,h),{forceCompleteBeforeNext:u}=n||{},{completeOnContinue:m=u}=n||{};return d&&m&&canvas.canvas.completeTickerOnStepEnd({id:d}),d}e.animate=s;})(F||={});var ct=F;canvas.RegisteredTickers.add(w,"motion");canvas.RegisteredTickers.add(I,"motion-sequence");exports.animate=B;exports.motion=ct;exports.motionDriver=j;exports.timeline=rt;
package/dist/motion.d.cts CHANGED
@@ -99,6 +99,15 @@ declare function animate<T extends {}>(sequence: (ObjectSegment$1<T> | ObjectSeg
99
99
  }): AnimationPlaybackControlsWithThen;
100
100
  /**
101
101
  * Create a timeline for running a sequence of functions with transitions. Each function will be called with the provided arguments and will run for the specified duration.
102
+ *
103
+ * `onPlay`/`onComplete` are driven by a PixiJS-ticker-based scheduler rather than motion's own
104
+ * per-segment callbacks: motion's array/sequence syntax doesn't reliably call `onPlay`/`onComplete`
105
+ * once per segment when the timeline repeats (https://github.com/motiondivision/motion/issues/3563),
106
+ * since the previous workaround (a throwaway `MotionValue` per segment, "change"-debounced into the
107
+ * callback) got reset and replayed by motion's own `repeat` handling, firing extra times per loop.
108
+ * This scheduler only supports segments placed sequentially (via `duration`/`delay`); the `at` label
109
+ * positioning of motion's `At` type is passed through to the underlying visual tween but is not
110
+ * accounted for when timing these callbacks.
102
111
  * @example
103
112
  * timeline([
104
113
  * { duration: 10, onComplete: () => console.log("First step completed") },
package/dist/motion.d.ts CHANGED
@@ -99,6 +99,15 @@ declare function animate<T extends {}>(sequence: (ObjectSegment$1<T> | ObjectSeg
99
99
  }): AnimationPlaybackControlsWithThen;
100
100
  /**
101
101
  * Create a timeline for running a sequence of functions with transitions. Each function will be called with the provided arguments and will run for the specified duration.
102
+ *
103
+ * `onPlay`/`onComplete` are driven by a PixiJS-ticker-based scheduler rather than motion's own
104
+ * per-segment callbacks: motion's array/sequence syntax doesn't reliably call `onPlay`/`onComplete`
105
+ * once per segment when the timeline repeats (https://github.com/motiondivision/motion/issues/3563),
106
+ * since the previous workaround (a throwaway `MotionValue` per segment, "change"-debounced into the
107
+ * callback) got reset and replayed by motion's own `repeat` handling, firing extra times per loop.
108
+ * This scheduler only supports segments placed sequentially (via `duration`/`delay`); the `at` label
109
+ * positioning of motion's `At` type is passed through to the underlying visual tween but is not
110
+ * accounted for when timing these callbacks.
102
111
  * @example
103
112
  * timeline([
104
113
  * { duration: 10, onComplete: () => console.log("First step completed") },
package/dist/motion.mjs CHANGED
@@ -1 +1 @@
1
- import {RegisteredTickers,canvas}from'@drincs/pixi-vn/canvas';import Y from'@drincs/pixi-vn/pixi.js';import {animate,motionValue}from'motion';import {PixiError}from'@drincs/pixi-vn/core';var Z=Object.create;var z=Object.defineProperty;var tt=Object.getOwnPropertyDescriptor;var et=Object.getOwnPropertyNames;var nt=Object.getPrototypeOf,it=Object.prototype.hasOwnProperty;var R=(o=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(o,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):o)(function(o){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+o+'" is not supported')});var D=(o,t)=>()=>(t||o((t={exports:{}}).exports,t),t.exports);var rt=(o,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of et(t))!it.call(o,i)&&i!==r&&z(o,i,{get:()=>t[i],enumerable:!(n=tt(t,i))||n.enumerable});return o};var at=(o,t,r)=>(r=o!=null?Z(nt(o)):{},rt(z(r,"default",{value:o,enumerable:true}),o));var N=D((I,F)=>{(function(o,t){typeof I=="object"?F.exports=I=t():typeof define=="function"&&define.amd?define([],t):o.CryptoJS=t();})(I,function(){var o=o||(function(t,r){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 R=="function")try{n=R("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 e(){}return function(a){var f;return e.prototype=a,f=new e,e.prototype=null,f}})(),c={},g=c.lib={},l=g.Base=(function(){return {extend:function(e){var a=s(this);return e&&a.mixIn(e),(!a.hasOwnProperty("init")||this.init===a.init)&&(a.init=function(){a.$super.init.apply(this,arguments);}),a.init.prototype=a,a.$super=this,a},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var a in e)e.hasOwnProperty(a)&&(this[a]=e[a]);e.hasOwnProperty("toString")&&(this.toString=e.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),m=g.WordArray=l.extend({init:function(e,a){e=this.words=e||[],a!=r?this.sigBytes=a:this.sigBytes=e.length*4;},toString:function(e){return (e||h).stringify(this)},concat:function(e){var a=this.words,f=e.words,p=this.sigBytes,d=e.sigBytes;if(this.clamp(),p%4)for(var v=0;v<d;v++){var j=f[v>>>2]>>>24-v%4*8&255;a[p+v>>>2]|=j<<24-(p+v)%4*8;}else for(var A=0;A<d;A+=4)a[p+A>>>2]=f[A>>>2];return this.sigBytes+=d,this},clamp:function(){var e=this.words,a=this.sigBytes;e[a>>>2]&=4294967295<<32-a%4*8,e.length=t.ceil(a/4);},clone:function(){var e=l.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var a=[],f=0;f<e;f+=4)a.push(i());return new m.init(a,e)}}),u=c.enc={},h=u.Hex={stringify:function(e){for(var a=e.words,f=e.sigBytes,p=[],d=0;d<f;d++){var v=a[d>>>2]>>>24-d%4*8&255;p.push((v>>>4).toString(16)),p.push((v&15).toString(16));}return p.join("")},parse:function(e){for(var a=e.length,f=[],p=0;p<a;p+=2)f[p>>>3]|=parseInt(e.substr(p,2),16)<<24-p%8*4;return new m.init(f,a/2)}},T=u.Latin1={stringify:function(e){for(var a=e.words,f=e.sigBytes,p=[],d=0;d<f;d++){var v=a[d>>>2]>>>24-d%4*8&255;p.push(String.fromCharCode(v));}return p.join("")},parse:function(e){for(var a=e.length,f=[],p=0;p<a;p++)f[p>>>2]|=(e.charCodeAt(p)&255)<<24-p%4*8;return new m.init(f,a)}},x=u.Utf8={stringify:function(e){try{return decodeURIComponent(escape(T.stringify(e)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(e){return T.parse(unescape(encodeURIComponent(e)))}},b=g.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new m.init,this._nDataBytes=0;},_append:function(e){typeof e=="string"&&(e=x.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes;},_process:function(e){var a,f=this._data,p=f.words,d=f.sigBytes,v=this.blockSize,j=v*4,A=d/j;e?A=t.ceil(A):A=t.max((A|0)-this._minBufferSize,0);var B=A*v,M=t.min(B*4,d);if(B){for(var W=0;W<B;W+=v)this._doProcessBlock(p,W);a=p.splice(0,B),f.sigBytes-=M;}return new m.init(a,M)},clone:function(){var e=l.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});g.Hasher=b.extend({cfg:l.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset();},reset:function(){b.reset.call(this),this._doReset();},update:function(e){return this._append(e),this._process(),this},finalize:function(e){e&&this._append(e);var a=this._doFinalize();return a},blockSize:512/32,_createHelper:function(e){return function(a,f){return new e.init(f).finalize(a)}},_createHmacHelper:function(e){return function(a,f){return new y.HMAC.init(e,f).finalize(a)}}});var y=c.algo={};return c})(Math);return o});});var K=D((P,$)=>{(function(o,t){typeof P=="object"?$.exports=P=t(N()):typeof define=="function"&&define.amd?define(["./core"],t):t(o.CryptoJS);})(P,function(o){return (function(){var t=o,r=t.lib,n=r.WordArray,i=r.Hasher,s=t.algo,c=[],g=s.SHA1=i.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(l,m){for(var u=this._hash.words,h=u[0],T=u[1],x=u[2],b=u[3],w=u[4],y=0;y<80;y++){if(y<16)c[y]=l[m+y]|0;else {var e=c[y-3]^c[y-8]^c[y-14]^c[y-16];c[y]=e<<1|e>>>31;}var a=(h<<5|h>>>27)+w+c[y];y<20?a+=(T&x|~T&b)+1518500249:y<40?a+=(T^x^b)+1859775393:y<60?a+=(T&x|T&b|x&b)-1894007588:a+=(T^x^b)-899497514,w=b,b=x,x=T<<30|T>>>2,T=h,h=a;}u[0]=u[0]+h|0,u[1]=u[1]+T|0,u[2]=u[2]+x|0,u[3]=u[3]+b|0,u[4]=u[4]+w|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=i.clone.call(this);return l._hash=this._hash.clone(),l}});t.SHA1=i._createHelper(g),t.HmacSHA1=i._createHmacHelper(g);})(),o.SHA1});});var E=(o,t=100)=>{let r=null;return (...n)=>{r&&clearTimeout(r),r=setTimeout(()=>o(...n),t);}};var q=o=>t=>{let r=({lastTime:n})=>t(n);return {start:(n=true)=>{o.add(r),o.start();},stop:()=>o.remove(r),now:()=>o.lastTime}};function k(o,t,r){if(Array.isArray(o)&&Array.isArray(o[0])){t&&"repeat"in t&&t?.repeat===null&&(t.repeat=1/0),o.forEach(c=>{if(Array.isArray(c)&&c.length===3){let[g,l,m]=c;m&&"repeat"in m&&m?.repeat===null&&(m.repeat=1/0);}});let{ticker:n=new Y.Ticker,driver:i=q(n),...s}=t||{};return animate(o,{driver:i,...s})}else {r&&"repeat"in r&&r?.repeat===null&&(r.repeat=1/0);let{ticker:n=new Y.Ticker,driver:i=q(n),...s}=r||{};return animate(o,t,{driver:i,...s})}}function ot(o,t){let r={x:0},n=[];return o.forEach((i,s)=>{let{onComplete:c,onPlay:g,...l}=i;if(g){let m=motionValue(s);m.on("change",E(g,50)),n.push([m,s+1,{duration:.01}]);}if(n.push([r,{x:s+1},l]),c){let m=motionValue(s);m.on("change",E(c,50)),n.push([m,s+1,{duration:.01}]);}}),k(n,t)}var J=at(K());var O=class{constructor(t,r){let{duration:n,priority:i,id:s=this.generateTickerId(r),canvasElementAliases:c=[]}=r||{};this._args=t,this.duration=n,this.priority=i,this.id=s,this.canvasElementAliases=c;}id;_args;get args(){return {...this._args,time:this._animation?.time}}duration;priority;ticker=new Y.Ticker;_animation;stopped=false;_paused=false;canvasElementAliases=[];getItemByAlias(t){if(!this.canvasElementAliases.includes(t))return;let r=canvas.find(t);if(r)return r}generateTickerId(...t){try{return (0,J.default)(JSON.stringify(t)).toString()+"_motion_"+Math.random().toString(36).substring(7)}catch(r){throw new PixiError("not_json_serializable",`Error to generate ticker id: ${r}`)}}timeout=50;async complete(){this.animation.complete(),await new Promise(t=>setTimeout(t,this.timeout));}stop(){this.stopped=true,this.animation.stop();}start(){this.args.options?.autoplay!==false&&(this._paused=false,this.animation.play());}onComplete=()=>{let t=this.id,r=this._args.options?.aliasToRemoveAfter||[];typeof r=="string"&&(r=[r]);let n=this._args.options?.tickerAliasToResume||[];typeof n=="string"&&(n=[n]);let i=this._args.options?.tickerIdToResume||[];typeof i=="string"&&(i=[i]),canvas.onTickerComplete(t,{aliasToRemoveAfter:r,tickerAliasToResume:n,tickerIdToResume:i,stopTicker:false});};createItem(t){return new Proxy({alias:t},{set:({alias:r},n,i)=>{if(this.stopped||this._paused||this._args.startState&&this._args.startState[n]===i)return true;let s=this.getItemByAlias(r);if(!s)return true;switch(n){case "pivotX":s.pivot.x=i;break;case "pivotY":s.pivot.y=i;break;case "scaleX":s.scale.x=i;break;case "scaleY":s.scale.y=i;break;default:s[n]=i;break}return true},get:({alias:r},n)=>{if(this._args.startState||(this._args.startState={}),n in this._args.startState)return this._args.startState[n];let i=this.getItemByAlias(r);if(!i)return;let s;switch(n){case "pivotX":s=i.pivot.x;break;case "pivotY":s=i.pivot.y;break;case "scaleX":s=i.scale.x;break;case "scaleY":s=i.scale.y;break;default:s=i[n];break}return this._args.startState={...this._args.startState,[n]:s},s},has:({alias:r},n)=>{let i=this.getItemByAlias(r);if(!i)return false;switch(n){case "pivotX":return "pivot"in i&&"x"in i.pivot;case "pivotY":return "pivot"in i&&"y"in i.pivot;case "scaleX":return "scale"in i&&"x"in i.scale;case "scaleY":return "scale"in i&&"y"in i.scale;default:return n in i}},ownKeys:({alias:r})=>{let n=this.getItemByAlias(r);return n?Object.keys(n):[]}})}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 S=class extends O{get animation(){let t=this._animation;if(t)return t;let r=this.canvasElementAliases[0],n=this.createItem(r),i=this._args.sequence.map((s,c)=>[n,s[0],{...s[1]||{},ticker:this.ticker,onComplete:c===this._args.sequence.length-1?()=>this.onComplete():void 0}]);return t=k(i,this._args.options),this._args.time&&(this.animation.time=this._args.time),this._animation=t,t}alias="motion-sequence"};var _=class extends O{get animation(){let t=this._animation;if(t)return t;let r=this.canvasElementAliases.map(n=>this.createItem(n));return t=k(r,this._args.keyframes,{...this._args.options,onComplete:()=>this.onComplete(),ticker:this.ticker}),this._args.time&&(t.time=this._args.time),this._animation=t,t}alias="motion"};var C;(i=>(i.log=(s,...c)=>console.log(`[Pixi\u2019VN] ${s}`,...c),i.warn=(s,...c)=>console.warn(`[Pixi\u2019VN] ${s}`,...c),i.error=(s,...c)=>console.error(`[Pixi\u2019VN] ${s}`,...c),i.info=(s,...c)=>console.info(`[Pixi\u2019VN] ${s}`,...c)))(C||={});function H(o){try{if(typeof o>"u")return o;let t=JSON.stringify(o);return JSON.parse(t)}catch(t){throw C.error("Error creating exportable element",o,t),new PixiError("not_json_serializable","Error creating exportable element")}}var G;(t=>{function o(r,n,i,s){try{n=H(n);}catch(h){throw C.error("animate keyframes cannot contain functions or classes"),h}try{i=H(i);}catch(h){throw C.error("animate options cannot contain functions or classes"),h}let c=[];typeof r=="string"?c=[r]:Array.isArray(r)?c=r.map(h=>typeof h=="string"?h:h.label):c=[r.label];let g;Array.isArray(n)?g=new S({sequence:n,options:i},{priority:s,canvasElementAliases:c}):g=new _({keyframes:n,options:i},{priority:s,canvasElementAliases:c});let l=canvas.addTicker(c,g),{forceCompleteBeforeNext:m}=i||{},{completeOnContinue:u=m}=i||{};return l&&u&&canvas.completeTickerOnStepEnd({id:l}),l}t.animate=o;})(G||={});var pt=G;RegisteredTickers.add(_,"motion");RegisteredTickers.add(S,"motion-sequence");export{k as animate,pt as motion,q as motionDriver,ot as timeline};
1
+ import {RegisteredTickers,canvas}from'@drincs/pixi-vn/canvas';import H from'@drincs/pixi-vn/pixi.js';import {animate}from'motion';import {PixiError}from'@drincs/pixi-vn/core';var G=Object.create;var z=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var Z=Object.getOwnPropertyNames;var tt=Object.getPrototypeOf,et=Object.prototype.hasOwnProperty;var q=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(e,a)=>(typeof require<"u"?require:e)[a]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+s+'" is not supported')});var D=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports);var nt=(s,e,a,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Z(e))!et.call(s,n)&&n!==a&&z(s,n,{get:()=>e[n],enumerable:!(i=Q(e,n))||i.enumerable});return s};var it=(s,e,a)=>(a=s!=null?G(tt(s)):{},nt(z(a,"default",{value:s,enumerable:true}),s));var X=D((W,U)=>{(function(s,e){typeof W=="object"?U.exports=W=e():typeof define=="function"&&define.amd?define([],e):s.CryptoJS=e();})(W,function(){var s=s||(function(e,a){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 n=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.")},o=Object.create||(function(){function t(){}return function(r){var p;return t.prototype=r,p=new t,t.prototype=null,p}})(),c={},h=c.lib={},d=h.Base=(function(){return {extend:function(t){var r=o(this);return t&&r.mixIn(t),(!r.hasOwnProperty("init")||this.init===r.init)&&(r.init=function(){r.$super.init.apply(this,arguments);}),r.init.prototype=r,r.$super=this,r},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var r in t)t.hasOwnProperty(r)&&(this[r]=t[r]);t.hasOwnProperty("toString")&&(this.toString=t.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),u=h.WordArray=d.extend({init:function(t,r){t=this.words=t||[],r!=a?this.sigBytes=r:this.sigBytes=t.length*4;},toString:function(t){return (t||l).stringify(this)},concat:function(t){var r=this.words,p=t.words,f=this.sigBytes,g=t.sigBytes;if(this.clamp(),f%4)for(var v=0;v<g;v++){var k=p[v>>>2]>>>24-v%4*8&255;r[f+v>>>2]|=k<<24-(f+v)%4*8;}else for(var O=0;O<g;O+=4)r[f+O>>>2]=p[O>>>2];return this.sigBytes+=g,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4);},clone:function(){var t=d.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var r=[],p=0;p<t;p+=4)r.push(n());return new u.init(r,t)}}),m=c.enc={},l=m.Hex={stringify:function(t){for(var r=t.words,p=t.sigBytes,f=[],g=0;g<p;g++){var v=r[g>>>2]>>>24-g%4*8&255;f.push((v>>>4).toString(16)),f.push((v&15).toString(16));}return f.join("")},parse:function(t){for(var r=t.length,p=[],f=0;f<r;f+=2)p[f>>>3]|=parseInt(t.substr(f,2),16)<<24-f%8*4;return new u.init(p,r/2)}},A=m.Latin1={stringify:function(t){for(var r=t.words,p=t.sigBytes,f=[],g=0;g<p;g++){var v=r[g>>>2]>>>24-g%4*8&255;f.push(String.fromCharCode(v));}return f.join("")},parse:function(t){for(var r=t.length,p=[],f=0;f<r;f++)p[f>>>2]|=(t.charCodeAt(f)&255)<<24-f%4*8;return new u.init(p,r)}},b=m.Utf8={stringify:function(t){try{return decodeURIComponent(escape(A.stringify(t)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(t){return A.parse(unescape(encodeURIComponent(t)))}},x=h.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new u.init,this._nDataBytes=0;},_append:function(t){typeof t=="string"&&(t=b.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes;},_process:function(t){var r,p=this._data,f=p.words,g=p.sigBytes,v=this.blockSize,k=v*4,O=g/k;t?O=e.ceil(O):O=e.max((O|0)-this._minBufferSize,0);var S=O*v,_=e.min(S*4,g);if(S){for(var E=0;E<S;E+=v)this._doProcessBlock(f,E);r=f.splice(0,S),p.sigBytes-=_;}return new u.init(r,_)},clone:function(){var t=d.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});h.Hasher=x.extend({cfg:d.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 r=this._doFinalize();return r},blockSize:512/32,_createHelper:function(t){return function(r,p){return new t.init(p).finalize(r)}},_createHmacHelper:function(t){return function(r,p){return new y.HMAC.init(t,p).finalize(r)}}});var y=c.algo={};return c})(Math);return s});});var $=D((R,N)=>{(function(s,e){typeof R=="object"?N.exports=R=e(X()):typeof define=="function"&&define.amd?define(["./core"],e):e(s.CryptoJS);})(R,function(s){return (function(){var e=s,a=e.lib,i=a.WordArray,n=a.Hasher,o=e.algo,c=[],h=o.SHA1=n.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(d,u){for(var m=this._hash.words,l=m[0],A=m[1],b=m[2],x=m[3],T=m[4],y=0;y<80;y++){if(y<16)c[y]=d[u+y]|0;else {var t=c[y-3]^c[y-8]^c[y-14]^c[y-16];c[y]=t<<1|t>>>31;}var r=(l<<5|l>>>27)+T+c[y];y<20?r+=(A&b|~A&x)+1518500249:y<40?r+=(A^b^x)+1859775393:y<60?r+=(A&b|A&x|b&x)-1894007588:r+=(A^b^x)-899497514,T=x,x=b,b=A<<30|A>>>2,A=l,l=r;}m[0]=m[0]+l|0,m[1]=m[1]+A|0,m[2]=m[2]+b|0,m[3]=m[3]+x|0,m[4]=m[4]+T|0;},_doFinalize:function(){var d=this._data,u=d.words,m=this._nDataBytes*8,l=d.sigBytes*8;return u[l>>>5]|=128<<24-l%32,u[(l+64>>>9<<4)+14]=Math.floor(m/4294967296),u[(l+64>>>9<<4)+15]=m,d.sigBytes=u.length*4,this._process(),this._hash},clone:function(){var d=n.clone.call(this);return d._hash=this._hash.clone(),d}});e.SHA1=n._createHelper(h),e.HmacSHA1=n._createHmacHelper(h);})(),s.SHA1});});var j=s=>e=>{let a=({lastTime:i})=>e(i);return {start:(i=true)=>{s.add(a),s.start();},stop:()=>s.remove(a),now:()=>s.lastTime}};function B(s,e,a){if(Array.isArray(s)&&Array.isArray(s[0])){e&&"repeat"in e&&e?.repeat===null&&(e.repeat=1/0),s.forEach(c=>{if(Array.isArray(c)&&c.length===3){let[h,d,u]=c;u&&"repeat"in u&&u?.repeat===null&&(u.repeat=1/0);}});let{ticker:i=new H.Ticker,driver:n=j(i),...o}=e||{};return animate(s,{driver:n,...o})}else {a&&"repeat"in a&&a?.repeat===null&&(a.repeat=1/0);let{ticker:i=new H.Ticker,driver:n=j(i),...o}=a||{};return animate(s,e,{driver:n,...o})}}function rt(s,e){let{ticker:a=new H.Ticker,driver:i=j(a),repeat:n,...o}=e||{},c={x:0},h=[],d=[],u=0;s.forEach((b,x)=>{let{onComplete:T,onPlay:y,delay:t=0,duration:r=.3,...p}=b,f=typeof t=="function"?t(0,1):t,g=u+f,v=g+r;h.push({start:g,end:v,onPlay:y,onComplete:T}),d.push([c,{x:x+1},{...p,delay:t,duration:r}]),u=v;});let m=u,l=B(d,{...o,repeat:n,driver:i});if(h.length>0&&m>0){let k=function(){if(r)return;for(t+=a.deltaMS/1e3;!r&&t>=m;){if(f(),y++,y>=x){v();return}t-=m;}let S=g(t);S===-1?T>=0&&f():S!==T&&p(S);};let b=n===null?1/0:n,x=b===void 0?1:b+1,T=-1,y=0,t=0,r=false,p=S=>{T>=0&&h[T].onComplete?.(),T=S,h[T].onPlay?.();},f=()=>{T>=0&&h[T].onComplete?.(),T=-1;},g=S=>{for(let _=0;_<h.length;_++){if(S<h[_].start)return -1;if(S<h[_].end)return _}return h.length-1},v=()=>{r=true,a.remove(k);};a.add(k);let O=l.stop.bind(l);l.stop=()=>{v(),O();};}return l}var L=it($());var C=class{constructor(e,a){let{duration:i,priority:n,id:o=this.generateTickerId(a),canvasElementAliases:c=[]}=a||{};this._args=e,this.duration=i,this.priority=n,this.id=o,this.canvasElementAliases=c;}id;_args;get args(){return {...this._args,time:this._animation?.time}}duration;priority;ticker=new H.Ticker;_animation;stopped=false;_paused=false;canvasElementAliases=[];getItemByAlias(e){if(!this.canvasElementAliases.includes(e))return;let a=canvas.find(e);if(a)return a}generateTickerId(...e){try{return (0,L.default)(JSON.stringify(e)).toString()+"_motion_"+Math.random().toString(36).substring(7)}catch(a){throw new PixiError("not_json_serializable",`Error to generate ticker id: ${a}`)}}timeout=50;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());}onComplete=()=>{let e=this.id,a=this._args.options?.aliasToRemoveAfter||[];typeof a=="string"&&(a=[a]);let i=this._args.options?.tickerAliasToResume||[];typeof i=="string"&&(i=[i]);let n=this._args.options?.tickerIdToResume||[];typeof n=="string"&&(n=[n]),canvas.onTickerComplete(e,{aliasToRemoveAfter:a,tickerAliasToResume:i,tickerIdToResume:n,stopTicker:false});};createItem(e){return new Proxy({alias:e},{set:({alias:a},i,n)=>{if(this.stopped||this._paused||this._args.startState&&this._args.startState[i]===n)return true;let o=this.getItemByAlias(a);if(!o)return true;switch(i){case "pivotX":o.pivot.x=n;break;case "pivotY":o.pivot.y=n;break;case "scaleX":o.scale.x=n;break;case "scaleY":o.scale.y=n;break;default:o[i]=n;break}return true},get:({alias:a},i)=>{if(this._args.startState||(this._args.startState={}),i in this._args.startState)return this._args.startState[i];let n=this.getItemByAlias(a);if(!n)return;let o;switch(i){case "pivotX":o=n.pivot.x;break;case "pivotY":o=n.pivot.y;break;case "scaleX":o=n.scale.x;break;case "scaleY":o=n.scale.y;break;default:o=n[i];break}return this._args.startState={...this._args.startState,[i]:o},o},has:({alias:a},i)=>{let n=this.getItemByAlias(a);if(!n)return false;switch(i){case "pivotX":return "pivot"in n&&"x"in n.pivot;case "pivotY":return "pivot"in n&&"y"in n.pivot;case "scaleX":return "scale"in n&&"x"in n.scale;case "scaleY":return "scale"in n&&"y"in n.scale;default:return i in n}},ownKeys:({alias:a})=>{let i=this.getItemByAlias(a);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 I=class extends C{get animation(){let e=this._animation;if(e)return e;let a=this.canvasElementAliases[0],i=this.createItem(a),n=this._args.sequence.map((o,c)=>[i,o[0],{...o[1]||{},ticker:this.ticker,onComplete:c===this._args.sequence.length-1?()=>this.onComplete():void 0}]);return e=B(n,this._args.options),this._args.time&&(this.animation.time=this._args.time),this._animation=e,e}alias="motion-sequence"};var w=class extends C{get animation(){let e=this._animation;if(e)return e;let a=this.canvasElementAliases.map(i=>this.createItem(i));return e=B(a,this._args.keyframes,{...this._args.options,onComplete:()=>this.onComplete(),ticker:this.ticker}),this._args.time&&(e.time=this._args.time),this._animation=e,e}alias="motion"};var P;(n=>(n.log=(o,...c)=>console.log(`[Pixi\u2019VN] ${o}`,...c),n.warn=(o,...c)=>console.warn(`[Pixi\u2019VN] ${o}`,...c),n.error=(o,...c)=>console.error(`[Pixi\u2019VN] ${o}`,...c),n.info=(o,...c)=>console.info(`[Pixi\u2019VN] ${o}`,...c)))(P||={});function M(s){try{if(typeof s>"u")return s;let e=JSON.stringify(s);return JSON.parse(e)}catch(e){throw P.error("Error creating exportable element",s,e),new PixiError("not_json_serializable","Error creating exportable element")}}var F;(e=>{function s(a,i,n,o){try{i=M(i);}catch(l){throw P.error("animate keyframes cannot contain functions or classes"),l}try{n=M(n);}catch(l){throw P.error("animate options cannot contain functions or classes"),l}let c=[];typeof a=="string"?c=[a]:Array.isArray(a)?c=a.map(l=>typeof l=="string"?l:l.label):c=[a.label];let h;Array.isArray(i)?h=new I({sequence:i,options:n},{priority:o,canvasElementAliases:c}):h=new w({keyframes:i,options:n},{priority:o,canvasElementAliases:c});let d=canvas.addTicker(c,h),{forceCompleteBeforeNext:u}=n||{},{completeOnContinue:m=u}=n||{};return d&&m&&canvas.completeTickerOnStepEnd({id:d}),d}e.animate=s;})(F||={});var ct=F;RegisteredTickers.add(w,"motion");RegisteredTickers.add(I,"motion-sequence");export{B as animate,ct as motion,j as motionDriver,rt as timeline};
@@ -1,2 +1,2 @@
1
- 'use strict';var core=require('@drincs/pixi-vn/core');var St=Object.create;var We=Object.defineProperty;var yt=Object.getOwnPropertyDescriptor;var mt=Object.getOwnPropertyNames;var gt=Object.getPrototypeOf,Lt=Object.prototype.hasOwnProperty;var Qe=s=>{throw TypeError(s)};var _t=(s,e,t)=>e in s?We(s,e,{enumerable:true,configurable:true,writable:true,value:t}):s[e]=t;var Be=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+s+'" is not supported')});var Ze=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports);var Tt=(s,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of mt(e))!Lt.call(s,i)&&i!==t&&We(s,i,{get:()=>e[i],enumerable:!(n=yt(e,i))||n.enumerable});return s};var Et=(s,e,t)=>(t=s!=null?St(gt(s)):{},Tt(We(t,"default",{value:s,enumerable:true}),s));var z=(s,e,t)=>_t(s,typeof e!="symbol"?e+"":e,t),je=(s,e,t)=>e.has(s)||Qe("Cannot "+t);var r=(s,e,t)=>(je(s,e,"read from private field"),t?t.call(s):e.get(s)),v=(s,e,t)=>e.has(s)?Qe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,t),y=(s,e,t,n)=>(je(s,e,"write to private field"),e.set(s,t),t),f=(s,e,t)=>(je(s,e,"access private method"),t);var Ue=(s,e,t,n)=>({set _(i){y(s,e,i);},get _(){return r(s,e,n)}});var ct=Ze((ze,pt)=>{(function(s,e){typeof ze=="object"?pt.exports=ze=e():typeof define=="function"&&define.amd?define([],e):s.CryptoJS=e();})(ze,function(){var s=s||(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 Be=="function")try{n=Be("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.")},a=Object.create||(function(){function l(){}return function(d){var C;return l.prototype=d,C=new l,l.prototype=null,C}})(),o={},h=o.lib={},p=h.Base=(function(){return {extend:function(l){var d=a(this);return l&&d.mixIn(l),(!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 l=this.extend();return l.init.apply(l,arguments),l},init:function(){},mixIn:function(l){for(var d in l)l.hasOwnProperty(d)&&(this[d]=l[d]);l.hasOwnProperty("toString")&&(this.toString=l.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),S=h.WordArray=p.extend({init:function(l,d){l=this.words=l||[],d!=t?this.sigBytes=d:this.sigBytes=l.length*4;},toString:function(l){return (l||L).stringify(this)},concat:function(l){var d=this.words,C=l.words,E=this.sigBytes,O=l.sigBytes;if(this.clamp(),E%4)for(var P=0;P<O;P++){var oe=C[P>>>2]>>>24-P%4*8&255;d[E+P>>>2]|=oe<<24-(E+P)%4*8;}else for(var G=0;G<O;G+=4)d[E+G>>>2]=C[G>>>2];return this.sigBytes+=O,this},clamp:function(){var l=this.words,d=this.sigBytes;l[d>>>2]&=4294967295<<32-d%4*8,l.length=e.ceil(d/4);},clone:function(){var l=p.clone.call(this);return l.words=this.words.slice(0),l},random:function(l){for(var d=[],C=0;C<l;C+=4)d.push(i());return new S.init(d,l)}}),u=o.enc={},L=u.Hex={stringify:function(l){for(var d=l.words,C=l.sigBytes,E=[],O=0;O<C;O++){var P=d[O>>>2]>>>24-O%4*8&255;E.push((P>>>4).toString(16)),E.push((P&15).toString(16));}return E.join("")},parse:function(l){for(var d=l.length,C=[],E=0;E<d;E+=2)C[E>>>3]|=parseInt(l.substr(E,2),16)<<24-E%8*4;return new S.init(C,d/2)}},M=u.Latin1={stringify:function(l){for(var d=l.words,C=l.sigBytes,E=[],O=0;O<C;O++){var P=d[O>>>2]>>>24-O%4*8&255;E.push(String.fromCharCode(P));}return E.join("")},parse:function(l){for(var d=l.length,C=[],E=0;E<d;E++)C[E>>>2]|=(l.charCodeAt(E)&255)<<24-E%4*8;return new S.init(C,d)}},N=u.Utf8={stringify:function(l){try{return decodeURIComponent(escape(M.stringify(l)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(l){return M.parse(unescape(encodeURIComponent(l)))}},D=h.BufferedBlockAlgorithm=p.extend({reset:function(){this._data=new S.init,this._nDataBytes=0;},_append:function(l){typeof l=="string"&&(l=N.parse(l)),this._data.concat(l),this._nDataBytes+=l.sigBytes;},_process:function(l){var d,C=this._data,E=C.words,O=C.sigBytes,P=this.blockSize,oe=P*4,G=O/oe;l?G=e.ceil(G):G=e.max((G|0)-this._minBufferSize,0);var J=G*P,_e=e.min(J*4,O);if(J){for(var Ke=0;Ke<J;Ke+=P)this._doProcessBlock(E,Ke);d=E.splice(0,J),C.sigBytes-=_e;}return new S.init(d,_e)},clone:function(){var l=p.clone.call(this);return l._data=this._data.clone(),l},_minBufferSize:0});h.Hasher=D.extend({cfg:p.extend(),init:function(l){this.cfg=this.cfg.extend(l),this.reset();},reset:function(){D.reset.call(this),this._doReset();},update:function(l){return this._append(l),this._process(),this},finalize:function(l){l&&this._append(l);var d=this._doFinalize();return d},blockSize:512/32,_createHelper:function(l){return function(d,C){return new l.init(C).finalize(d)}},_createHmacHelper:function(l){return function(d,C){return new T.HMAC.init(l,C).finalize(d)}}});var T=o.algo={};return o})(Math);return s});});var dt=Ze((He,ut)=>{(function(s,e){typeof He=="object"?ut.exports=He=e(ct()):typeof define=="function"&&define.amd?define(["./core"],e):e(s.CryptoJS);})(He,function(s){return (function(){var e=s,t=e.lib,n=t.WordArray,i=t.Hasher,a=e.algo,o=[],h=a.SHA1=i.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(p,S){for(var u=this._hash.words,L=u[0],M=u[1],N=u[2],D=u[3],w=u[4],T=0;T<80;T++){if(T<16)o[T]=p[S+T]|0;else {var l=o[T-3]^o[T-8]^o[T-14]^o[T-16];o[T]=l<<1|l>>>31;}var d=(L<<5|L>>>27)+w+o[T];T<20?d+=(M&N|~M&D)+1518500249:T<40?d+=(M^N^D)+1859775393:T<60?d+=(M&N|M&D|N&D)-1894007588:d+=(M^N^D)-899497514,w=D,D=N,N=M<<30|M>>>2,M=L,L=d;}u[0]=u[0]+L|0,u[1]=u[1]+M|0,u[2]=u[2]+N|0,u[3]=u[3]+D|0,u[4]=u[4]+w|0;},_doFinalize:function(){var p=this._data,S=p.words,u=this._nDataBytes*8,L=p.sigBytes*8;return S[L>>>5]|=128<<24-L%32,S[(L+64>>>9<<4)+14]=Math.floor(u/4294967296),S[(L+64>>>9<<4)+15]=u,p.sigBytes=S.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(h),e.HmacSHA1=i._createHmacHelper(h);})(),s.SHA1});});var R="narration";var I={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 Ct=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,nt=new Set,ke=typeof process=="object"&&process?process:{},it=(s,e,t,n)=>{typeof ke.emitWarning=="function"?ke.emitWarning(s,e,t,n):console.error(`[${t}] ${e}: ${s}`);},Ge=globalThis.AbortController,et=globalThis.AbortSignal;if(typeof Ge>"u"){et=class{onabort;_onabort=[];reason;aborted=false;addEventListener(t,n){this._onabort.push(n);}},Ge=class{constructor(){e();}signal=new et;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 s=ke.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{s&&(s=false,it("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 It=s=>!nt.has(s);var ue=s=>s&&s===Math.floor(s)&&s>0&&isFinite(s),at=s=>ue(s)?s<=Math.pow(2,8)?Uint8Array:s<=Math.pow(2,16)?Uint16Array:s<=Math.pow(2,32)?Uint32Array:s<=Number.MAX_SAFE_INTEGER?Ye:null:null,Ye=class extends Array{constructor(s){super(s),this.fill(0);}},le,Te,Ot=(le=class{heap;length;static create(e){let t=at(e);if(!t)return [];y(le,Te,true);let n=new le(e,t);return y(le,Te,false),n}constructor(e,t){if(!r(le,Te))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0;}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},Te=new WeakMap,v(le,Te,false),le),tt,rt,X,B,Q,ye,Z,Ee,Ce,ee,Y,te,U,A,_,K,j,H,F,re,V,ne,ie,k,$,ae,Se,W,Ie,c,$e,me,he,Me,q,ot,ge,Oe,Ne,de,fe,qe,Fe,Ve,x,Xe,Ae,be,Je,Re,st=(Re=class{constructor(e){v(this,c);v(this,X);v(this,B);v(this,Q);v(this,ye);v(this,Z);v(this,Ee);v(this,Ce);v(this,ee);z(this,"ttl");z(this,"ttlResolution");z(this,"ttlAutopurge");z(this,"updateAgeOnGet");z(this,"updateAgeOnHas");z(this,"allowStale");z(this,"noDisposeOnSet");z(this,"noUpdateTTL");z(this,"maxEntrySize");z(this,"sizeCalculation");z(this,"noDeleteOnFetchRejection");z(this,"noDeleteOnStaleGet");z(this,"allowStaleOnFetchAbort");z(this,"allowStaleOnFetchRejection");z(this,"ignoreFetchAbort");v(this,Y);v(this,te);v(this,U);v(this,A);v(this,_);v(this,K);v(this,j);v(this,H);v(this,F);v(this,re);v(this,V);v(this,ne);v(this,ie);v(this,k);v(this,$);v(this,ae);v(this,Se);v(this,W);v(this,Ie);v(this,me,()=>{});v(this,he,()=>{});v(this,Me,()=>{});v(this,q,()=>false);v(this,ge,e=>{});v(this,Oe,(e,t,n)=>{});v(this,Ne,(e,t,n,i)=>{if(n||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});z(this,tt,"LRUCache");let{max:t=0,ttl:n,ttlResolution:i=1,ttlAutopurge:a,updateAgeOnGet:o,updateAgeOnHas:h,allowStale:p,dispose:S,onInsert:u,disposeAfter:L,noDisposeOnSet:M,noUpdateTTL:N,maxSize:D=0,maxEntrySize:w=0,sizeCalculation:T,fetchMethod:l,memoMethod:d,noDeleteOnFetchRejection:C,noDeleteOnStaleGet:E,allowStaleOnFetchRejection:O,allowStaleOnFetchAbort:P,ignoreFetchAbort:oe,perf:G}=e;if(G!==void 0&&typeof G?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(y(this,ee,G??Ct),t!==0&&!ue(t))throw new TypeError("max option must be a nonnegative integer");let J=t?at(t):Array;if(!J)throw new Error("invalid max value: "+t);if(y(this,X,t),y(this,B,D),this.maxEntrySize=w||r(this,B),this.sizeCalculation=T,this.sizeCalculation){if(!r(this,B)&&!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(y(this,Ce,d),l!==void 0&&typeof l!="function")throw new TypeError("fetchMethod must be a function if specified");if(y(this,Ee,l),y(this,Se,!!l),y(this,U,new Map),y(this,A,new Array(t).fill(void 0)),y(this,_,new Array(t).fill(void 0)),y(this,K,new J(t)),y(this,j,new J(t)),y(this,H,0),y(this,F,0),y(this,re,Ot.create(t)),y(this,Y,0),y(this,te,0),typeof S=="function"&&y(this,Q,S),typeof u=="function"&&y(this,ye,u),typeof L=="function"?(y(this,Z,L),y(this,V,[])):(y(this,Z,void 0),y(this,V,void 0)),y(this,ae,!!r(this,Q)),y(this,Ie,!!r(this,ye)),y(this,W,!!r(this,Z)),this.noDisposeOnSet=!!M,this.noUpdateTTL=!!N,this.noDeleteOnFetchRejection=!!C,this.allowStaleOnFetchRejection=!!O,this.allowStaleOnFetchAbort=!!P,this.ignoreFetchAbort=!!oe,this.maxEntrySize!==0){if(r(this,B)!==0&&!ue(r(this,B)))throw new TypeError("maxSize must be a positive integer if specified");if(!ue(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");f(this,c,ot).call(this);}if(this.allowStale=!!p,this.noDeleteOnStaleGet=!!E,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!h,this.ttlResolution=ue(i)||i===0?i:1,this.ttlAutopurge=!!a,this.ttl=n||0,this.ttl){if(!ue(this.ttl))throw new TypeError("ttl must be a positive integer if specified");f(this,c,$e).call(this);}if(r(this,X)===0&&this.ttl===0&&r(this,B)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!r(this,X)&&!r(this,B)){let _e="LRU_CACHE_UNBOUNDED";It(_e)&&(nt.add(_e),it("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",_e,Re));}}get perf(){return r(this,ee)}static unsafeExposeInternals(e){return {starts:r(e,ie),ttls:r(e,k),autopurgeTimers:r(e,$),sizes:r(e,ne),keyMap:r(e,U),keyList:r(e,A),valList:r(e,_),next:r(e,K),prev:r(e,j),get head(){return r(e,H)},get tail(){return r(e,F)},free:r(e,re),isBackgroundFetch:t=>{var n;return f(n=e,c,x).call(n,t)},backgroundFetch:(t,n,i,a)=>{var o;return f(o=e,c,Ve).call(o,t,n,i,a)},moveToTail:t=>{var n;return f(n=e,c,Ae).call(n,t)},indexes:t=>{var n;return f(n=e,c,de).call(n,t)},rindexes:t=>{var n;return f(n=e,c,fe).call(n,t)},isStale:t=>{var n;return r(n=e,q).call(n,t)}}}get max(){return r(this,X)}get maxSize(){return r(this,B)}get calculatedSize(){return r(this,te)}get size(){return r(this,Y)}get fetchMethod(){return r(this,Ee)}get memoMethod(){return r(this,Ce)}get dispose(){return r(this,Q)}get onInsert(){return r(this,ye)}get disposeAfter(){return r(this,Z)}getRemainingTTL(e){return r(this,U).has(e)?1/0:0}*entries(){for(let e of f(this,c,de).call(this))r(this,_)[e]!==void 0&&r(this,A)[e]!==void 0&&!f(this,c,x).call(this,r(this,_)[e])&&(yield [r(this,A)[e],r(this,_)[e]]);}*rentries(){for(let e of f(this,c,fe).call(this))r(this,_)[e]!==void 0&&r(this,A)[e]!==void 0&&!f(this,c,x).call(this,r(this,_)[e])&&(yield [r(this,A)[e],r(this,_)[e]]);}*keys(){for(let e of f(this,c,de).call(this)){let t=r(this,A)[e];t!==void 0&&!f(this,c,x).call(this,r(this,_)[e])&&(yield t);}}*rkeys(){for(let e of f(this,c,fe).call(this)){let t=r(this,A)[e];t!==void 0&&!f(this,c,x).call(this,r(this,_)[e])&&(yield t);}}*values(){for(let e of f(this,c,de).call(this))r(this,_)[e]!==void 0&&!f(this,c,x).call(this,r(this,_)[e])&&(yield r(this,_)[e]);}*rvalues(){for(let e of f(this,c,fe).call(this))r(this,_)[e]!==void 0&&!f(this,c,x).call(this,r(this,_)[e])&&(yield r(this,_)[e]);}[(rt=Symbol.iterator,tt=Symbol.toStringTag,rt)](){return this.entries()}find(e,t={}){for(let n of f(this,c,de).call(this)){let i=r(this,_)[n],a=f(this,c,x).call(this,i)?i.__staleWhileFetching:i;if(a!==void 0&&e(a,r(this,A)[n],this))return this.get(r(this,A)[n],t)}}forEach(e,t=this){for(let n of f(this,c,de).call(this)){let i=r(this,_)[n],a=f(this,c,x).call(this,i)?i.__staleWhileFetching:i;a!==void 0&&e.call(t,a,r(this,A)[n],this);}}rforEach(e,t=this){for(let n of f(this,c,fe).call(this)){let i=r(this,_)[n],a=f(this,c,x).call(this,i)?i.__staleWhileFetching:i;a!==void 0&&e.call(t,a,r(this,A)[n],this);}}purgeStale(){let e=false;for(let t of f(this,c,fe).call(this,{allowStale:true}))r(this,q).call(this,t)&&(f(this,c,be).call(this,r(this,A)[t],"expire"),e=true);return e}info(e){let t=r(this,U).get(e);if(t===void 0)return;let n=r(this,_)[t],i=f(this,c,x).call(this,n)?n.__staleWhileFetching:n;if(i===void 0)return;let a={value:i};if(r(this,k)&&r(this,ie)){let o=r(this,k)[t],h=r(this,ie)[t];if(o&&h){let p=o-(r(this,ee).now()-h);a.ttl=p,a.start=Date.now();}}return r(this,ne)&&(a.size=r(this,ne)[t]),a}dump(){let e=[];for(let t of f(this,c,de).call(this,{allowStale:true})){let n=r(this,A)[t],i=r(this,_)[t],a=f(this,c,x).call(this,i)?i.__staleWhileFetching:i;if(a===void 0||n===void 0)continue;let o={value:a};if(r(this,k)&&r(this,ie)){o.ttl=r(this,k)[t];let h=r(this,ee).now()-r(this,ie)[t];o.start=Math.floor(Date.now()-h);}r(this,ne)&&(o.size=r(this,ne)[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,ee).now()-i;}this.set(t,n.value,n);}}set(e,t,n={}){var M,N,D,w;if(t===void 0)return this.delete(e),this;let{ttl:i=this.ttl,start:a,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:h=this.sizeCalculation,status:p}=n,{noUpdateTTL:S=this.noUpdateTTL}=n,u=r(this,Ne).call(this,e,t,n.size||0,h);if(this.maxEntrySize&&u>this.maxEntrySize)return p&&(p.set="miss",p.maxEntrySizeExceeded=true),f(this,c,be).call(this,e,"set"),this;let L=r(this,Y)===0?void 0:r(this,U).get(e);if(L===void 0)L=r(this,Y)===0?r(this,F):r(this,re).length!==0?r(this,re).pop():r(this,Y)===r(this,X)?f(this,c,Fe).call(this,false):r(this,Y),r(this,A)[L]=e,r(this,_)[L]=t,r(this,U).set(e,L),r(this,K)[r(this,F)]=L,r(this,j)[L]=r(this,F),y(this,F,L),Ue(this,Y)._++,r(this,Oe).call(this,L,u,p),p&&(p.set="add"),S=false,r(this,Ie)&&((M=r(this,ye))==null||M.call(this,t,e,"add"));else {f(this,c,Ae).call(this,L);let T=r(this,_)[L];if(t!==T){if(r(this,Se)&&f(this,c,x).call(this,T)){T.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:l}=T;l!==void 0&&!o&&(r(this,ae)&&((N=r(this,Q))==null||N.call(this,l,e,"set")),r(this,W)&&r(this,V)?.push([l,e,"set"]));}else o||(r(this,ae)&&((D=r(this,Q))==null||D.call(this,T,e,"set")),r(this,W)&&r(this,V)?.push([T,e,"set"]));if(r(this,ge).call(this,L),r(this,Oe).call(this,L,u,p),r(this,_)[L]=t,p){p.set="replace";let l=T&&f(this,c,x).call(this,T)?T.__staleWhileFetching:T;l!==void 0&&(p.oldValue=l);}}else p&&(p.set="update");r(this,Ie)&&this.onInsert?.(t,e,t===T?"update":"replace");}if(i!==0&&!r(this,k)&&f(this,c,$e).call(this),r(this,k)&&(S||r(this,Me).call(this,L,i,a),p&&r(this,he).call(this,p,L)),!o&&r(this,W)&&r(this,V)){let T=r(this,V),l;for(;l=T?.shift();)(w=r(this,Z))==null||w.call(this,...l);}return this}pop(){var e;try{for(;r(this,Y);){let t=r(this,_)[r(this,H)];if(f(this,c,Fe).call(this,!0),f(this,c,x).call(this,t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(r(this,W)&&r(this,V)){let t=r(this,V),n;for(;n=t?.shift();)(e=r(this,Z))==null||e.call(this,...n);}}}has(e,t={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:i}=t,a=r(this,U).get(e);if(a!==void 0){let o=r(this,_)[a];if(f(this,c,x).call(this,o)&&o.__staleWhileFetching===void 0)return false;if(r(this,q).call(this,a))i&&(i.has="stale",r(this,he).call(this,i,a));else return n&&r(this,me).call(this,a),i&&(i.has="hit",r(this,he).call(this,i,a)),true}else i&&(i.has="miss");return false}peek(e,t={}){let{allowStale:n=this.allowStale}=t,i=r(this,U).get(e);if(i===void 0||!n&&r(this,q).call(this,i))return;let a=r(this,_)[i];return f(this,c,x).call(this,a)?a.__staleWhileFetching:a}async fetch(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:h=this.noDisposeOnSet,size:p=0,sizeCalculation:S=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:L=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:M=this.allowStaleOnFetchRejection,ignoreFetchAbort:N=this.ignoreFetchAbort,allowStaleOnFetchAbort:D=this.allowStaleOnFetchAbort,context:w,forceRefresh:T=false,status:l,signal:d}=t;if(!r(this,Se))return l&&(l.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:a,status:l});let C={allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:a,ttl:o,noDisposeOnSet:h,size:p,sizeCalculation:S,noUpdateTTL:u,noDeleteOnFetchRejection:L,allowStaleOnFetchRejection:M,allowStaleOnFetchAbort:D,ignoreFetchAbort:N,status:l,signal:d},E=r(this,U).get(e);if(E===void 0){l&&(l.fetch="miss");let O=f(this,c,Ve).call(this,e,E,C,w);return O.__returned=O}else {let O=r(this,_)[E];if(f(this,c,x).call(this,O)){let J=n&&O.__staleWhileFetching!==void 0;return l&&(l.fetch="inflight",J&&(l.returnedStale=true)),J?O.__staleWhileFetching:O.__returned=O}let P=r(this,q).call(this,E);if(!T&&!P)return l&&(l.fetch="hit"),f(this,c,Ae).call(this,E),i&&r(this,me).call(this,E),l&&r(this,he).call(this,l,E),O;let oe=f(this,c,Ve).call(this,e,E,C,w),G=oe.__staleWhileFetching!==void 0&&n;return l&&(l.fetch=P?"stale":"refresh",G&&P&&(l.returnedStale=true)),G?oe.__staleWhileFetching:oe.__returned=oe}}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:a,...o}=t,h=this.get(e,o);if(!a&&h!==void 0)return h;let p=n(e,h,{options:o,context:i});return this.set(e,p,o),p}get(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,status:o}=t,h=r(this,U).get(e);if(h!==void 0){let p=r(this,_)[h],S=f(this,c,x).call(this,p);return o&&r(this,he).call(this,o,h),r(this,q).call(this,h)?(o&&(o.get="stale"),S?(o&&n&&p.__staleWhileFetching!==void 0&&(o.returnedStale=true),n?p.__staleWhileFetching:void 0):(a||f(this,c,be).call(this,e,"expire"),o&&n&&(o.returnedStale=true),n?p:void 0)):(o&&(o.get="hit"),S?p.__staleWhileFetching:(f(this,c,Ae).call(this,h),i&&r(this,me).call(this,h),p))}else o&&(o.get="miss");}delete(e){return f(this,c,be).call(this,e,"delete")}clear(){return f(this,c,Je).call(this,"delete")}},X=new WeakMap,B=new WeakMap,Q=new WeakMap,ye=new WeakMap,Z=new WeakMap,Ee=new WeakMap,Ce=new WeakMap,ee=new WeakMap,Y=new WeakMap,te=new WeakMap,U=new WeakMap,A=new WeakMap,_=new WeakMap,K=new WeakMap,j=new WeakMap,H=new WeakMap,F=new WeakMap,re=new WeakMap,V=new WeakMap,ne=new WeakMap,ie=new WeakMap,k=new WeakMap,$=new WeakMap,ae=new WeakMap,Se=new WeakMap,W=new WeakMap,Ie=new WeakMap,c=new WeakSet,$e=function(){let e=new Ye(r(this,X)),t=new Ye(r(this,X));y(this,k,e),y(this,ie,t);let n=this.ttlAutopurge?new Array(r(this,X)):void 0;y(this,$,n),y(this,Me,(h,p,S=r(this,ee).now())=>{t[h]=p!==0?S:0,e[h]=p,i(h,p);}),y(this,me,h=>{t[h]=e[h]!==0?r(this,ee).now():0,i(h,e[h]);});let i=this.ttlAutopurge?(h,p)=>{if(n?.[h]&&(clearTimeout(n[h]),n[h]=void 0),p&&p!==0&&n){let S=setTimeout(()=>{r(this,q).call(this,h)&&f(this,c,be).call(this,r(this,A)[h],"expire");},p+1);S.unref&&S.unref(),n[h]=S;}}:()=>{};y(this,he,(h,p)=>{if(e[p]){let S=e[p],u=t[p];if(!S||!u)return;h.ttl=S,h.start=u,h.now=a||o();let L=h.now-u;h.remainingTTL=S-L;}});let a=0,o=()=>{let h=r(this,ee).now();if(this.ttlResolution>0){a=h;let p=setTimeout(()=>a=0,this.ttlResolution);p.unref&&p.unref();}return h};this.getRemainingTTL=h=>{let p=r(this,U).get(h);if(p===void 0)return 0;let S=e[p],u=t[p];if(!S||!u)return 1/0;let L=(a||o())-u;return S-L},y(this,q,h=>{let p=t[h],S=e[h];return !!S&&!!p&&(a||o())-p>S});},me=new WeakMap,he=new WeakMap,Me=new WeakMap,q=new WeakMap,ot=function(){let e=new Ye(r(this,X));y(this,te,0),y(this,ne,e),y(this,ge,t=>{y(this,te,r(this,te)-e[t]),e[t]=0;}),y(this,Ne,(t,n,i,a)=>{if(f(this,c,x).call(this,n))return 0;if(!ue(i))if(a){if(typeof a!="function")throw new TypeError("sizeCalculation must be a function");if(i=a(n,t),!ue(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}),y(this,Oe,(t,n,i)=>{if(e[t]=n,r(this,B)){let a=r(this,B)-e[t];for(;r(this,te)>a;)f(this,c,Fe).call(this,true);}y(this,te,r(this,te)+e[t]),i&&(i.entrySize=n,i.totalCalculatedSize=r(this,te));});},ge=new WeakMap,Oe=new WeakMap,Ne=new WeakMap,de=function*({allowStale:e=this.allowStale}={}){if(r(this,Y))for(let t=r(this,F);!(!f(this,c,qe).call(this,t)||((e||!r(this,q).call(this,t))&&(yield t),t===r(this,H)));)t=r(this,j)[t];},fe=function*({allowStale:e=this.allowStale}={}){if(r(this,Y))for(let t=r(this,H);!(!f(this,c,qe).call(this,t)||((e||!r(this,q).call(this,t))&&(yield t),t===r(this,F)));)t=r(this,K)[t];},qe=function(e){return e!==void 0&&r(this,U).get(r(this,A)[e])===e},Fe=function(e){var a;let t=r(this,H),n=r(this,A)[t],i=r(this,_)[t];return r(this,Se)&&f(this,c,x).call(this,i)?i.__abortController.abort(new Error("evicted")):(r(this,ae)||r(this,W))&&(r(this,ae)&&((a=r(this,Q))==null||a.call(this,i,n,"evict")),r(this,W)&&r(this,V)?.push([i,n,"evict"])),r(this,ge).call(this,t),r(this,$)?.[t]&&(clearTimeout(r(this,$)[t]),r(this,$)[t]=void 0),e&&(r(this,A)[t]=void 0,r(this,_)[t]=void 0,r(this,re).push(t)),r(this,Y)===1?(y(this,H,y(this,F,0)),r(this,re).length=0):y(this,H,r(this,K)[t]),r(this,U).delete(n),Ue(this,Y)._--,t},Ve=function(e,t,n,i){let a=t===void 0?void 0:r(this,_)[t];if(f(this,c,x).call(this,a))return a;let o=new Ge,{signal:h}=n;h?.addEventListener("abort",()=>o.abort(h.reason),{signal:o.signal});let p={signal:o.signal,options:n,context:i},S=(w,T=false)=>{let{aborted:l}=o.signal,d=n.ignoreFetchAbort&&w!==void 0,C=n.ignoreFetchAbort||!!(n.allowStaleOnFetchAbort&&w!==void 0);if(n.status&&(l&&!T?(n.status.fetchAborted=true,n.status.fetchError=o.signal.reason,d&&(n.status.fetchAbortIgnored=true)):n.status.fetchResolved=true),l&&!d&&!T)return L(o.signal.reason,C);let E=N,O=r(this,_)[t];return (O===N||d&&T&&O===void 0)&&(w===void 0?E.__staleWhileFetching!==void 0?r(this,_)[t]=E.__staleWhileFetching:f(this,c,be).call(this,e,"fetch"):(n.status&&(n.status.fetchUpdated=true),this.set(e,w,p.options))),w},u=w=>(n.status&&(n.status.fetchRejected=true,n.status.fetchError=w),L(w,false)),L=(w,T)=>{let{aborted:l}=o.signal,d=l&&n.allowStaleOnFetchAbort,C=d||n.allowStaleOnFetchRejection,E=C||n.noDeleteOnFetchRejection,O=N;if(r(this,_)[t]===N&&(!E||!T&&O.__staleWhileFetching===void 0?f(this,c,be).call(this,e,"fetch"):d||(r(this,_)[t]=O.__staleWhileFetching)),C)return n.status&&O.__staleWhileFetching!==void 0&&(n.status.returnedStale=true),O.__staleWhileFetching;if(O.__returned===O)throw w},M=(w,T)=>{var d;let l=(d=r(this,Ee))==null?void 0:d.call(this,e,a,p);l&&l instanceof Promise&&l.then(C=>w(C===void 0?void 0:C),T),o.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(w(void 0),n.allowStaleOnFetchAbort&&(w=C=>S(C,true)));});};n.status&&(n.status.fetchDispatched=true);let N=new Promise(M).then(S,u),D=Object.assign(N,{__abortController:o,__staleWhileFetching:a,__returned:void 0});return t===void 0?(this.set(e,D,{...p.options,status:void 0}),t=r(this,U).get(e)):r(this,_)[t]=D,D},x=function(e){if(!r(this,Se))return false;let t=e;return !!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof Ge},Xe=function(e,t){r(this,j)[t]=e,r(this,K)[e]=t;},Ae=function(e){e!==r(this,F)&&(e===r(this,H)?y(this,H,r(this,K)[e]):f(this,c,Xe).call(this,r(this,j)[e],r(this,K)[e]),f(this,c,Xe).call(this,r(this,F),e),y(this,F,e));},be=function(e,t){var i,a;let n=false;if(r(this,Y)!==0){let o=r(this,U).get(e);if(o!==void 0)if(r(this,$)?.[o]&&(clearTimeout(r(this,$)?.[o]),r(this,$)[o]=void 0),n=true,r(this,Y)===1)f(this,c,Je).call(this,t);else {r(this,ge).call(this,o);let h=r(this,_)[o];if(f(this,c,x).call(this,h)?h.__abortController.abort(new Error("deleted")):(r(this,ae)||r(this,W))&&(r(this,ae)&&((i=r(this,Q))==null||i.call(this,h,e,t)),r(this,W)&&r(this,V)?.push([h,e,t])),r(this,U).delete(e),r(this,A)[o]=void 0,r(this,_)[o]=void 0,o===r(this,F))y(this,F,r(this,j)[o]);else if(o===r(this,H))y(this,H,r(this,K)[o]);else {let p=r(this,j)[o];r(this,K)[p]=r(this,K)[o];let S=r(this,K)[o];r(this,j)[S]=r(this,j)[o];}Ue(this,Y)._--,r(this,re).push(o);}}if(r(this,W)&&r(this,V)?.length){let o=r(this,V),h;for(;h=o?.shift();)(a=r(this,Z))==null||a.call(this,...h);}return n},Je=function(e){var t,n;for(let i of f(this,c,fe).call(this,{allowStale:true})){let a=r(this,_)[i];if(f(this,c,x).call(this,a))a.__abortController.abort(new Error("deleted"));else {let o=r(this,A)[i];r(this,ae)&&((t=r(this,Q))==null||t.call(this,a,o,e)),r(this,W)&&r(this,V)?.push([a,o,e]);}}if(r(this,U).clear(),r(this,_).fill(void 0),r(this,A).fill(void 0),r(this,k)&&r(this,ie)){r(this,k).fill(0),r(this,ie).fill(0);for(let i of r(this,$)??[])i!==void 0&&clearTimeout(i);r(this,$)?.fill(void 0);}if(r(this,ne)&&r(this,ne).fill(0),y(this,H,0),y(this,F,0),r(this,re).length=0,y(this,te,0),y(this,Y,0),r(this,W)&&r(this,V)){let i=r(this,V),a;for(;a=i?.shift();)(n=r(this,Z))==null||n.call(this,...a);}},Re);var De=class{cache;map=new Map;constructor(e){this.cache=new st({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 g;(i=>(i.log=(a,...o)=>console.log(`[Pixi\u2019VN] ${a}`,...o),i.warn=(a,...o)=>console.warn(`[Pixi\u2019VN] ${a}`,...o),i.error=(a,...o)=>console.error(`[Pixi\u2019VN] ${a}`,...o),i.info=(a,...o)=>console.info(`[Pixi\u2019VN] ${a}`,...o)))(g||={});var Le=new De({cacheSize:10}),lt;(o=>{function s(h){let p=Le.get(h);if(!p){g.error(`Label "${h}" not found`);return}return p}o.get=s;function e(...h){for(let p of h)Le.has(p.id)&&g.info(`Label "${p.id}" already exists, it will be overwritten`),Le.set(p.id,p);}o.add=e;function t(){return Array.from(Le.values())}o.values=t;function n(h){return Le.has(h)}o.has=n;function i(){return Array.from(Le.keys())}o.keys=i;function a(){Le.clear();}o.clear=a;})(lt||={});var se=lt;function pe(s){try{if(typeof s>"u")return s;let e=JSON.stringify(s);return JSON.parse(e)}catch(e){throw g.error("Error creating exportable element",s,e),new core.PixiError("not_json_serializable","Error creating exportable element")}}var b=class s{constructor(){}static choiceMadeTemp=void 0;static lastHistoryStep=null;static get allOpenedLabels(){return core.GameUnifier.getVariable(R,I.OPENED_LABELS_COUNTER_KEY)||{}}static set allOpenedLabels(e){core.GameUnifier.setVariable(R,I.OPENED_LABELS_COUNTER_KEY,e);}static getCurrentStepTimesCounterData(e=""){let t=s.currentLabelStepIndex;if(t===null)return g.error("currentLabelStepIndex is null"),null;let n=`${t}${e}`,i=s.currentLabelId,a=s._currentLabel;if(!i||t===null||!a)return g.error("currentLabelId or currentLabelStepIndex is null or currentLabel not found"),null;let o=a.getStepSha(t)||"error",h=core.GameUnifier.getVariable(R,I.CURRENT_STEP_TIMES_COUNTER_KEY)||{};return h[i]||(h[i]={}),(!h[i][n]||h[i][n].stepSha1!==o)&&(h[i][n]={stepSha1:o}),h[i][n]}static setCurrentStepTimesCounterData(e="",t){let n=s.currentLabelStepIndex,i=n+e,a=s.currentLabelId;if(!a||n===null){g.error("currentLabelId or currentLabelStepIndex is null");return}let o=core.GameUnifier.getVariable(R,I.CURRENT_STEP_TIMES_COUNTER_KEY)||{};o[a]||(o[a]={}),o[a][i]=t,core.GameUnifier.setVariable(R,I.CURRENT_STEP_TIMES_COUNTER_KEY,o);}static getCurrentStepTimesCounter(e=""){let t=s._stepCounter,n=s.getCurrentStepTimesCounterData(e);if(!n)return g.error("getCurrentStepTimesCounter obj is null"),0;let i=n.stepCounters||[];return i.find(o=>o===t)||(i.push(t),n.stepCounters=i,s.setCurrentStepTimesCounterData(e,n)),i.length}static getRandomNumber(e,t,n={}){let i=n.nestedId||"";if(n.onceOnly||false){let o=s.getCurrentStepTimesCounterData(i);if(!o)return;let h=o.usedRandomNumbers||{},p=Array.from({length:t-e+1},(L,M)=>M+e).filter(L=>!h[`${e}-${t}`]?.includes(L));if(p.length===0)return;let S=Math.floor(Math.random()*p.length),u=p[S];return h[`${e}-${t}`]||(h[`${e}-${t}`]=[]),h[`${e}-${t}`].push(u),o.usedRandomNumbers=h,s.setCurrentStepTimesCounterData(i,o),u}return Math.floor(Math.random()*(t-e+1))+e}static resetCurrentStepTimesCounter(e=""){let t=s.currentLabelStepIndex,n=t+e,i=s.currentLabelId;if(!i||t===null){g.error("currentLabelId or currentLabelStepIndex is null");return}let a=core.GameUnifier.getVariable(R,I.CURRENT_STEP_TIMES_COUNTER_KEY)||{};a[i]||(a[i]={}),a[i][n]={stepCounters:[],stepSha1:""},core.GameUnifier.setVariable(R,I.CURRENT_STEP_TIMES_COUNTER_KEY,a);}static get allChoicesMade(){return core.GameUnifier.getVariable(R,I.ALL_CHOICES_MADE_KEY)||[]}static set allChoicesMade(e){core.GameUnifier.setVariable(R,I.ALL_CHOICES_MADE_KEY,e);}static _stepCounter=0;static increaseStepCounter(){s._stepCounter++;}static _openedLabels=[];static get openedLabels(){return pe(s._openedLabels)}static set openedLabels(e){s._openedLabels=pe(e);}static _originalOpenedLabels=[];static get originalOpenedLabels(){return pe(s._originalOpenedLabels)}static set originalOpenedLabels(e){s._originalOpenedLabels=pe(e);}static get _currentLabel(){if(s.currentLabelId)return se.get(s.currentLabelId)}static get currentLabelId(){if(s._openedLabels.length>0)return s._openedLabels[s._openedLabels.length-1].label}static get currentLabelStepIndex(){return s._openedLabels.length>0?s._openedLabels[s._openedLabels.length-1].currentStepIndex:null}static addLabelHistory(e,t){let n=s.allOpenedLabels,i=s.allOpenedLabels[e]?.biggestStep||0,a=s.allOpenedLabels[e]?.openCount||0;(!i||i<t)&&(n[e]={biggestStep:t,openCount:a},s.allOpenedLabels=n);}static addChoicesMade(e,t,n,i){let a=s.allChoicesMade,o=a.findIndex(h=>h.labelId===e&&h.stepIndex===t&&h.choiceIndex===i&&h.stepSha1===n);o<0?a.push({labelId:e,stepIndex:t,choiceIndex:i,stepSha1:n,madeTimes:1}):a[o].madeTimes++,s.allChoicesMade=a;}static pushNewLabel(e){if(!se.get(e))throw new core.PixiError("unregistered_element",`Label ${e} not found`);s._openedLabels.push({label:e,currentStepIndex:0});let n=s.allOpenedLabels,i=s.allOpenedLabels[e]?.biggestStep||0,a=s.allOpenedLabels[e]?.openCount||0;n[e]={biggestStep:i,openCount:a+1},s.allOpenedLabels=n;}static increaseCurrentStepIndex(){if(s._openedLabels.length>0){let e=s._openedLabels[s._openedLabels.length-1];s._openedLabels[s._openedLabels.length-1]={...e,currentStepIndex:e.currentStepIndex+1};}}static _onStepStart;static set onStepStart(e){s._onStepStart=e;}static get onStepStart(){return async(e,t)=>{let n=[];return s.onLoadingLabel&&e===0&&n.push(s.onLoadingLabel(e,t)),s._onStepStart&&n.push(s._onStepStart(e,t)),await Promise.all(n)}}static onLoadingLabel;static onStepEnd};var Pe=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,a,o,h,p=core.GameUnifier.getVariable(R,I.LAST_STEP_GLUED)===this.stepCounter;core.GameUnifier.getVariable(R,I.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(a=core.GameUnifier.getVariable(R,I.CURRENT_DIALOGUE_MEMORY_KEY)),core.GameUnifier.getVariable(R,I.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(o=core.GameUnifier.getVariable(R,I.CURRENT_MENU_OPTIONS_MEMORY_KEY)),core.GameUnifier.getVariable(R,I.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(h=core.GameUnifier.getVariable(R,I.CURRENT_INPUT_VALUE_MEMORY_KEY));let S=b.openedLabels,u={currentLabel:b.currentLabelId,dialogue:a,choices:o,stepSha1:e,index:this.stepCounter,labelStepIndex:b.currentLabelStepIndex,choiceIndexMade:n,inputValue:h,alreadyMadeChoices:this.getAlreadyMadeChoicesForSha(e),isGlued:p,openedLabels:S};b.originalOpenedLabels=S,core.GameUnifier.addHistoryItem(u,{ignoreSameStep:i}),b.lastHistoryStep=u,b.increaseStepCounter();}getAlreadyMadeChoicesForSha(e){let t=b.currentLabelStepIndex,n=this.currentLabel;if(!(t===null||!n))return b.allChoicesMade.filter(i=>i.labelId===n.id&&i.stepIndex===t&&i.stepSha1===e).map(i=>i.choiceIndex)}closeCurrentLabel(){if(!b.currentLabelId){g.warn("No label to close");return}if(!this.currentLabel){g.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 a=se.get(t);if(a)return a.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||(g.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&&g.warn("The player must make a choice"),false):this.isRequiredInput?(t&&g.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)){g.warn(`[continue] The parameter steps must be a valid finite number, received: ${i}`);return}if(i<=0){g.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 a;try{core.GameUnifier.runningStepsCount===1&&await core.GameUnifier.onPreContinue(),b.increaseCurrentStepIndex(),a=await this.runCurrentStep(e,t);}catch(o){throw g.error("Error continuing",o),o}return core.GameUnifier.runningStepsCount--,await this.afterRunCurrentStep(e)||a}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"});g.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){g.error("currentLabelStepIndex is null");return}let a=b._currentLabel;if(!a){g.error("currentLabel not found");return}if(a.stepCount>i){try{await this.onStepStart(a,i);}catch(u){g.error("Error running onStepStart",u),this.onStepError&&await this.onStepError(u,e);return}let o=a.getStepById(i);if(!o){g.error("step not found");return}let h=a.getStepSha(i);h||(g.warn("stepSha not found, setting to ERROR"),h="error");let p,S;try{p=await o(e,{labelId:a.id});}catch(u){g.error("Error running step",u),S=u;}try{let u=this.choices;if(u?.length===1&&u[0].autoSelect){let L=u[0];p=await this.selectChoice(L,e);}}catch(u){g.error("Error auto-selecting choice",u),S||(S=u);}try{let u=b.lastHistoryStep;n!==void 0&&u&&(h=u.stepSha1,h||(g.warn("stepSha not found, setting to ERROR"),h="error"),b.addChoicesMade(u.currentLabel||"error",typeof u.labelStepIndex=="number"?u.labelStepIndex:-1,u.stepSha1||"error",n),b.choiceMadeTemp=n);}catch(u){g.warn("Error adding choice made to history",u);}try{core.GameUnifier.runningStepsCount===1&&(b.addLabelHistory(a.id,i),this.addStepHistory(h,{...t,choiceMade:b.choiceMadeTemp}),b.choiceMadeTemp=void 0);}catch(u){g.warn("Error adding step to history",u);}try{this.currentLabel&&await this.onStepEnd(this.currentLabel,b.currentLabelStepIndex||0);}catch(u){g.warn("Error running onStepEnd",u);}return S&&this.onStepError&&await this.onStepError(S,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;g.error("currentLabelId not found");}}async call(e,t,n){let{choiceMade:i}=n||{},a;typeof e=="string"?a=e:a=e.id,core.GameUnifier.runningStepsCount++;let o;try{let h=se.get(a);if(!h)throw new core.PixiError("unregistered_element",`Label ${a} not found`);b.pushNewLabel(h.id),o=await this.runCurrentStep(t,{choiceMade:i});}catch(h){throw g.error("Error calling label",h),h}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||{},a;typeof e=="string"?a=e:a=e.id,core.GameUnifier.runningStepsCount++;let o;try{let h=se.get(a);if(!h)throw new core.PixiError("unregistered_element",`Label ${a} not found`);b.pushNewLabel(h.id),o=await this.runCurrentStep(t,{choiceMade:i});}catch(h){throw g.error("Error jumping to label",h),h}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 g.error(`Type ${n} not found`),new core.PixiError("invalid_usage",`Type ${n} not found`)}}async closeChoiceMenu(e,t){if(e.type!=="close")throw g.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){g.error("Error in onError handler",n);}}}get dialogue(){let e=core.GameUnifier.getVariable(R,I.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(R,I.CURRENT_DIALOGUE_MEMORY_KEY,void 0);return}if((typeof e=="string"||Array.isArray(e))&&(e={text:e}),this.dialogGlue){let t=core.GameUnifier.getVariable(R,I.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(R,I.LAST_STEP_GLUED,this.stepCounter),this.dialogGlue=false;}try{core.GameUnifier.setVariable(R,I.CURRENT_DIALOGUE_MEMORY_KEY,pe({...e,character:typeof e.character=="string"?e.character:e.character?.id})),core.GameUnifier.setVariable(R,I.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}catch{throw g.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(R,I.CURRENT_MENU_OPTIONS_MEMORY_KEY);if(e){let t=[],n=e.map((a,o)=>({...a,choiceIndex:o})),i=this.alreadyCurrentStepMadeChoices;if(n=n.filter((a,o)=>a.oneTime&&i?.includes(o)?false:a.onlyHaveNoChoice?(t.push(a),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(R,I.CURRENT_MENU_OPTIONS_MEMORY_KEY,void 0);return}try{core.GameUnifier.setVariable(R,I.CURRENT_MENU_OPTIONS_MEMORY_KEY,pe(e)),core.GameUnifier.setVariable(R,I.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}catch{throw g.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(I.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)}set dialogGlue(e){core.GameUnifier.setFlag(I.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,e);}get inputValue(){return core.GameUnifier.getVariable(R,I.CURRENT_INPUT_VALUE_MEMORY_KEY)}set inputValue(e){this.removeInputRequest(),core.GameUnifier.setVariable(R,I.CURRENT_INPUT_VALUE_MEMORY_KEY,e),core.GameUnifier.setVariable(R,I.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}get isRequiredInput(){return core.GameUnifier.getVariable(R,I.CURRENT_INPUT_INFO_MEMORY_KEY)?.isRequired||false}get inputType(){return core.GameUnifier.getVariable(R,I.CURRENT_INPUT_INFO_MEMORY_KEY)?.type}requestInput(e={},t){e.isRequired=true,core.GameUnifier.setVariable(R,I.CURRENT_INPUT_INFO_MEMORY_KEY,e),t!==void 0?core.GameUnifier.setVariable(R,I.CURRENT_INPUT_VALUE_MEMORY_KEY,t):core.GameUnifier.removeVariable(R,I.CURRENT_INPUT_VALUE_MEMORY_KEY);}removeInputRequest(){core.GameUnifier.removeVariable(R,I.CURRENT_INPUT_INFO_MEMORY_KEY),core.GameUnifier.removeVariable(R,I.CURRENT_INPUT_VALUE_MEMORY_KEY);}clear(){b.openedLabels=[],b._stepCounter=0;}export(){return {openedLabels:pe(b.openedLabels),stepCounter:this.stepCounter}}async onLoadingLabel(e){let t=this.openedLabels.map(async n=>{let i=[],a=se.get(n.label);return a&&(a.onLoadingLabel&&i.push(a.onLoadingLabel(e,a)),b.onLoadingLabel&&i.push(b.onLoadingLabel(e,a))),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):g.warn("Could not import openedLabels data, so will be ignored"),Object.hasOwn(e,"stepCounter")?b._stepCounter=e.stepCounter:g.warn("Could not import stepCounter data, so will be ignored");try{await this.onLoadingLabel(b.currentLabelStepIndex||0);}catch(n){g.error("Error running onLoadingLabel",n);}}catch(n){g.error("Error importing data",n);}}};function xt(s,e,t,n){let i=typeof e=="string"?e:e.id;return {...n,label:i,props:t,text:s,type:n?.type||"call"}}var ht="close";function At(s,e){return {...e,type:ht,text:s}}var ft=Et(dt());var we=class{constructor(e,t){this.id=e,this._onStepStart=t?.onStepStart,this._onLoadingLabel=t?.onLoadingLabel,this._onStepEnd=t?.onStepEnd;}id;_onStepStart;get onStepStart(){return async(e,t)=>{if(this._onLoadingLabel&&e===0&&await this._onLoadingLabel(e,t),this._onStepStart)return await this._onStepStart(e,t)}}_onLoadingLabel;get onLoadingLabel(){return this._onLoadingLabel}_onStepEnd;get onStepEnd(){return this._onStepEnd}};var xe=class extends we{get stepCount(){return this.steps.length}getStepById(e){return this.steps[e]}constructor(e,t,n){super(e,n),this._steps=t;}_steps;get steps(){return typeof this._steps=="function"?this._steps():this._steps}getStepSha(e){let t=this.steps;if(e<0||e>=t.length)return typeof this._steps!="function"&&g.warn("stepSha not found, setting to ERROR"),"error";try{return (0,ft.default)(t[e].toString().toLocaleLowerCase()).toString()}catch(n){return g.warn("stepSha not found, setting to ERROR",n),"error"}}};function bt(s,e,t){let n=new xe(s,e,t);return se.add(n),n}var Er=new Pe;
1
+ 'use strict';var core=require('@drincs/pixi-vn/core');var St=Object.create;var We=Object.defineProperty;var yt=Object.getOwnPropertyDescriptor;var mt=Object.getOwnPropertyNames;var gt=Object.getPrototypeOf,Lt=Object.prototype.hasOwnProperty;var Qe=s=>{throw TypeError(s)};var _t=(s,e,t)=>e in s?We(s,e,{enumerable:true,configurable:true,writable:true,value:t}):s[e]=t;var Be=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+s+'" is not supported')});var Ze=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports);var Tt=(s,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of mt(e))!Lt.call(s,i)&&i!==t&&We(s,i,{get:()=>e[i],enumerable:!(n=yt(e,i))||n.enumerable});return s};var Et=(s,e,t)=>(t=s!=null?St(gt(s)):{},Tt(We(t,"default",{value:s,enumerable:true}),s));var z=(s,e,t)=>_t(s,typeof e!="symbol"?e+"":e,t),je=(s,e,t)=>e.has(s)||Qe("Cannot "+t);var r=(s,e,t)=>(je(s,e,"read from private field"),t?t.call(s):e.get(s)),v=(s,e,t)=>e.has(s)?Qe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,t),y=(s,e,t,n)=>(je(s,e,"write to private field"),e.set(s,t),t),f=(s,e,t)=>(je(s,e,"access private method"),t);var Ue=(s,e,t,n)=>({set _(i){y(s,e,i);},get _(){return r(s,e,n)}});var ct=Ze((ze,pt)=>{(function(s,e){typeof ze=="object"?pt.exports=ze=e():typeof define=="function"&&define.amd?define([],e):s.CryptoJS=e();})(ze,function(){var s=s||(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 Be=="function")try{n=Be("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.")},a=Object.create||(function(){function l(){}return function(d){var C;return l.prototype=d,C=new l,l.prototype=null,C}})(),o={},h=o.lib={},p=h.Base=(function(){return {extend:function(l){var d=a(this);return l&&d.mixIn(l),(!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 l=this.extend();return l.init.apply(l,arguments),l},init:function(){},mixIn:function(l){for(var d in l)l.hasOwnProperty(d)&&(this[d]=l[d]);l.hasOwnProperty("toString")&&(this.toString=l.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),S=h.WordArray=p.extend({init:function(l,d){l=this.words=l||[],d!=t?this.sigBytes=d:this.sigBytes=l.length*4;},toString:function(l){return (l||L).stringify(this)},concat:function(l){var d=this.words,C=l.words,E=this.sigBytes,O=l.sigBytes;if(this.clamp(),E%4)for(var P=0;P<O;P++){var oe=C[P>>>2]>>>24-P%4*8&255;d[E+P>>>2]|=oe<<24-(E+P)%4*8;}else for(var G=0;G<O;G+=4)d[E+G>>>2]=C[G>>>2];return this.sigBytes+=O,this},clamp:function(){var l=this.words,d=this.sigBytes;l[d>>>2]&=4294967295<<32-d%4*8,l.length=e.ceil(d/4);},clone:function(){var l=p.clone.call(this);return l.words=this.words.slice(0),l},random:function(l){for(var d=[],C=0;C<l;C+=4)d.push(i());return new S.init(d,l)}}),u=o.enc={},L=u.Hex={stringify:function(l){for(var d=l.words,C=l.sigBytes,E=[],O=0;O<C;O++){var P=d[O>>>2]>>>24-O%4*8&255;E.push((P>>>4).toString(16)),E.push((P&15).toString(16));}return E.join("")},parse:function(l){for(var d=l.length,C=[],E=0;E<d;E+=2)C[E>>>3]|=parseInt(l.substr(E,2),16)<<24-E%8*4;return new S.init(C,d/2)}},M=u.Latin1={stringify:function(l){for(var d=l.words,C=l.sigBytes,E=[],O=0;O<C;O++){var P=d[O>>>2]>>>24-O%4*8&255;E.push(String.fromCharCode(P));}return E.join("")},parse:function(l){for(var d=l.length,C=[],E=0;E<d;E++)C[E>>>2]|=(l.charCodeAt(E)&255)<<24-E%4*8;return new S.init(C,d)}},N=u.Utf8={stringify:function(l){try{return decodeURIComponent(escape(M.stringify(l)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(l){return M.parse(unescape(encodeURIComponent(l)))}},D=h.BufferedBlockAlgorithm=p.extend({reset:function(){this._data=new S.init,this._nDataBytes=0;},_append:function(l){typeof l=="string"&&(l=N.parse(l)),this._data.concat(l),this._nDataBytes+=l.sigBytes;},_process:function(l){var d,C=this._data,E=C.words,O=C.sigBytes,P=this.blockSize,oe=P*4,G=O/oe;l?G=e.ceil(G):G=e.max((G|0)-this._minBufferSize,0);var J=G*P,Le=e.min(J*4,O);if(J){for(var Ke=0;Ke<J;Ke+=P)this._doProcessBlock(E,Ke);d=E.splice(0,J),C.sigBytes-=Le;}return new S.init(d,Le)},clone:function(){var l=p.clone.call(this);return l._data=this._data.clone(),l},_minBufferSize:0});h.Hasher=D.extend({cfg:p.extend(),init:function(l){this.cfg=this.cfg.extend(l),this.reset();},reset:function(){D.reset.call(this),this._doReset();},update:function(l){return this._append(l),this._process(),this},finalize:function(l){l&&this._append(l);var d=this._doFinalize();return d},blockSize:512/32,_createHelper:function(l){return function(d,C){return new l.init(C).finalize(d)}},_createHmacHelper:function(l){return function(d,C){return new T.HMAC.init(l,C).finalize(d)}}});var T=o.algo={};return o})(Math);return s});});var dt=Ze((He,ut)=>{(function(s,e){typeof He=="object"?ut.exports=He=e(ct()):typeof define=="function"&&define.amd?define(["./core"],e):e(s.CryptoJS);})(He,function(s){return (function(){var e=s,t=e.lib,n=t.WordArray,i=t.Hasher,a=e.algo,o=[],h=a.SHA1=i.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(p,S){for(var u=this._hash.words,L=u[0],M=u[1],N=u[2],D=u[3],w=u[4],T=0;T<80;T++){if(T<16)o[T]=p[S+T]|0;else {var l=o[T-3]^o[T-8]^o[T-14]^o[T-16];o[T]=l<<1|l>>>31;}var d=(L<<5|L>>>27)+w+o[T];T<20?d+=(M&N|~M&D)+1518500249:T<40?d+=(M^N^D)+1859775393:T<60?d+=(M&N|M&D|N&D)-1894007588:d+=(M^N^D)-899497514,w=D,D=N,N=M<<30|M>>>2,M=L,L=d;}u[0]=u[0]+L|0,u[1]=u[1]+M|0,u[2]=u[2]+N|0,u[3]=u[3]+D|0,u[4]=u[4]+w|0;},_doFinalize:function(){var p=this._data,S=p.words,u=this._nDataBytes*8,L=p.sigBytes*8;return S[L>>>5]|=128<<24-L%32,S[(L+64>>>9<<4)+14]=Math.floor(u/4294967296),S[(L+64>>>9<<4)+15]=u,p.sigBytes=S.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(h),e.HmacSHA1=i._createHmacHelper(h);})(),s.SHA1});});var R="narration";var I={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 Ct=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,nt=new Set,ke=typeof process=="object"&&process?process:{},it=(s,e,t,n)=>{typeof ke.emitWarning=="function"?ke.emitWarning(s,e,t,n):console.error(`[${t}] ${e}: ${s}`);},Ge=globalThis.AbortController,et=globalThis.AbortSignal;if(typeof Ge>"u"){et=class{onabort;_onabort=[];reason;aborted=false;addEventListener(t,n){this._onabort.push(n);}},Ge=class{constructor(){e();}signal=new et;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 s=ke.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{s&&(s=false,it("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 It=s=>!nt.has(s);var ue=s=>s&&s===Math.floor(s)&&s>0&&isFinite(s),at=s=>ue(s)?s<=Math.pow(2,8)?Uint8Array:s<=Math.pow(2,16)?Uint16Array:s<=Math.pow(2,32)?Uint32Array:s<=Number.MAX_SAFE_INTEGER?Ye:null:null,Ye=class extends Array{constructor(s){super(s),this.fill(0);}},le,_e,Ot=(le=class{heap;length;static create(e){let t=at(e);if(!t)return [];y(le,_e,true);let n=new le(e,t);return y(le,_e,false),n}constructor(e,t){if(!r(le,_e))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0;}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},_e=new WeakMap,v(le,_e,false),le),tt,rt,X,B,Q,ye,Z,Te,Ee,ee,Y,te,U,A,_,K,j,H,F,re,V,ne,ie,k,$,ae,Se,W,Ce,c,$e,me,he,Me,q,ot,ge,Ie,Ne,de,fe,qe,Fe,Ve,x,Xe,Ae,be,Je,Oe,st=(Oe=class{constructor(e){v(this,c);v(this,X);v(this,B);v(this,Q);v(this,ye);v(this,Z);v(this,Te);v(this,Ee);v(this,ee);z(this,"ttl");z(this,"ttlResolution");z(this,"ttlAutopurge");z(this,"updateAgeOnGet");z(this,"updateAgeOnHas");z(this,"allowStale");z(this,"noDisposeOnSet");z(this,"noUpdateTTL");z(this,"maxEntrySize");z(this,"sizeCalculation");z(this,"noDeleteOnFetchRejection");z(this,"noDeleteOnStaleGet");z(this,"allowStaleOnFetchAbort");z(this,"allowStaleOnFetchRejection");z(this,"ignoreFetchAbort");v(this,Y);v(this,te);v(this,U);v(this,A);v(this,_);v(this,K);v(this,j);v(this,H);v(this,F);v(this,re);v(this,V);v(this,ne);v(this,ie);v(this,k);v(this,$);v(this,ae);v(this,Se);v(this,W);v(this,Ce);v(this,me,()=>{});v(this,he,()=>{});v(this,Me,()=>{});v(this,q,()=>false);v(this,ge,e=>{});v(this,Ie,(e,t,n)=>{});v(this,Ne,(e,t,n,i)=>{if(n||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});z(this,tt,"LRUCache");let{max:t=0,ttl:n,ttlResolution:i=1,ttlAutopurge:a,updateAgeOnGet:o,updateAgeOnHas:h,allowStale:p,dispose:S,onInsert:u,disposeAfter:L,noDisposeOnSet:M,noUpdateTTL:N,maxSize:D=0,maxEntrySize:w=0,sizeCalculation:T,fetchMethod:l,memoMethod:d,noDeleteOnFetchRejection:C,noDeleteOnStaleGet:E,allowStaleOnFetchRejection:O,allowStaleOnFetchAbort:P,ignoreFetchAbort:oe,perf:G}=e;if(G!==void 0&&typeof G?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(y(this,ee,G??Ct),t!==0&&!ue(t))throw new TypeError("max option must be a nonnegative integer");let J=t?at(t):Array;if(!J)throw new Error("invalid max value: "+t);if(y(this,X,t),y(this,B,D),this.maxEntrySize=w||r(this,B),this.sizeCalculation=T,this.sizeCalculation){if(!r(this,B)&&!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(y(this,Ee,d),l!==void 0&&typeof l!="function")throw new TypeError("fetchMethod must be a function if specified");if(y(this,Te,l),y(this,Se,!!l),y(this,U,new Map),y(this,A,new Array(t).fill(void 0)),y(this,_,new Array(t).fill(void 0)),y(this,K,new J(t)),y(this,j,new J(t)),y(this,H,0),y(this,F,0),y(this,re,Ot.create(t)),y(this,Y,0),y(this,te,0),typeof S=="function"&&y(this,Q,S),typeof u=="function"&&y(this,ye,u),typeof L=="function"?(y(this,Z,L),y(this,V,[])):(y(this,Z,void 0),y(this,V,void 0)),y(this,ae,!!r(this,Q)),y(this,Ce,!!r(this,ye)),y(this,W,!!r(this,Z)),this.noDisposeOnSet=!!M,this.noUpdateTTL=!!N,this.noDeleteOnFetchRejection=!!C,this.allowStaleOnFetchRejection=!!O,this.allowStaleOnFetchAbort=!!P,this.ignoreFetchAbort=!!oe,this.maxEntrySize!==0){if(r(this,B)!==0&&!ue(r(this,B)))throw new TypeError("maxSize must be a positive integer if specified");if(!ue(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");f(this,c,ot).call(this);}if(this.allowStale=!!p,this.noDeleteOnStaleGet=!!E,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!h,this.ttlResolution=ue(i)||i===0?i:1,this.ttlAutopurge=!!a,this.ttl=n||0,this.ttl){if(!ue(this.ttl))throw new TypeError("ttl must be a positive integer if specified");f(this,c,$e).call(this);}if(r(this,X)===0&&this.ttl===0&&r(this,B)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!r(this,X)&&!r(this,B)){let Le="LRU_CACHE_UNBOUNDED";It(Le)&&(nt.add(Le),it("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Le,Oe));}}get perf(){return r(this,ee)}static unsafeExposeInternals(e){return {starts:r(e,ie),ttls:r(e,k),autopurgeTimers:r(e,$),sizes:r(e,ne),keyMap:r(e,U),keyList:r(e,A),valList:r(e,_),next:r(e,K),prev:r(e,j),get head(){return r(e,H)},get tail(){return r(e,F)},free:r(e,re),isBackgroundFetch:t=>{var n;return f(n=e,c,x).call(n,t)},backgroundFetch:(t,n,i,a)=>{var o;return f(o=e,c,Ve).call(o,t,n,i,a)},moveToTail:t=>{var n;return f(n=e,c,Ae).call(n,t)},indexes:t=>{var n;return f(n=e,c,de).call(n,t)},rindexes:t=>{var n;return f(n=e,c,fe).call(n,t)},isStale:t=>{var n;return r(n=e,q).call(n,t)}}}get max(){return r(this,X)}get maxSize(){return r(this,B)}get calculatedSize(){return r(this,te)}get size(){return r(this,Y)}get fetchMethod(){return r(this,Te)}get memoMethod(){return r(this,Ee)}get dispose(){return r(this,Q)}get onInsert(){return r(this,ye)}get disposeAfter(){return r(this,Z)}getRemainingTTL(e){return r(this,U).has(e)?1/0:0}*entries(){for(let e of f(this,c,de).call(this))r(this,_)[e]!==void 0&&r(this,A)[e]!==void 0&&!f(this,c,x).call(this,r(this,_)[e])&&(yield [r(this,A)[e],r(this,_)[e]]);}*rentries(){for(let e of f(this,c,fe).call(this))r(this,_)[e]!==void 0&&r(this,A)[e]!==void 0&&!f(this,c,x).call(this,r(this,_)[e])&&(yield [r(this,A)[e],r(this,_)[e]]);}*keys(){for(let e of f(this,c,de).call(this)){let t=r(this,A)[e];t!==void 0&&!f(this,c,x).call(this,r(this,_)[e])&&(yield t);}}*rkeys(){for(let e of f(this,c,fe).call(this)){let t=r(this,A)[e];t!==void 0&&!f(this,c,x).call(this,r(this,_)[e])&&(yield t);}}*values(){for(let e of f(this,c,de).call(this))r(this,_)[e]!==void 0&&!f(this,c,x).call(this,r(this,_)[e])&&(yield r(this,_)[e]);}*rvalues(){for(let e of f(this,c,fe).call(this))r(this,_)[e]!==void 0&&!f(this,c,x).call(this,r(this,_)[e])&&(yield r(this,_)[e]);}[(rt=Symbol.iterator,tt=Symbol.toStringTag,rt)](){return this.entries()}find(e,t={}){for(let n of f(this,c,de).call(this)){let i=r(this,_)[n],a=f(this,c,x).call(this,i)?i.__staleWhileFetching:i;if(a!==void 0&&e(a,r(this,A)[n],this))return this.get(r(this,A)[n],t)}}forEach(e,t=this){for(let n of f(this,c,de).call(this)){let i=r(this,_)[n],a=f(this,c,x).call(this,i)?i.__staleWhileFetching:i;a!==void 0&&e.call(t,a,r(this,A)[n],this);}}rforEach(e,t=this){for(let n of f(this,c,fe).call(this)){let i=r(this,_)[n],a=f(this,c,x).call(this,i)?i.__staleWhileFetching:i;a!==void 0&&e.call(t,a,r(this,A)[n],this);}}purgeStale(){let e=false;for(let t of f(this,c,fe).call(this,{allowStale:true}))r(this,q).call(this,t)&&(f(this,c,be).call(this,r(this,A)[t],"expire"),e=true);return e}info(e){let t=r(this,U).get(e);if(t===void 0)return;let n=r(this,_)[t],i=f(this,c,x).call(this,n)?n.__staleWhileFetching:n;if(i===void 0)return;let a={value:i};if(r(this,k)&&r(this,ie)){let o=r(this,k)[t],h=r(this,ie)[t];if(o&&h){let p=o-(r(this,ee).now()-h);a.ttl=p,a.start=Date.now();}}return r(this,ne)&&(a.size=r(this,ne)[t]),a}dump(){let e=[];for(let t of f(this,c,de).call(this,{allowStale:true})){let n=r(this,A)[t],i=r(this,_)[t],a=f(this,c,x).call(this,i)?i.__staleWhileFetching:i;if(a===void 0||n===void 0)continue;let o={value:a};if(r(this,k)&&r(this,ie)){o.ttl=r(this,k)[t];let h=r(this,ee).now()-r(this,ie)[t];o.start=Math.floor(Date.now()-h);}r(this,ne)&&(o.size=r(this,ne)[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,ee).now()-i;}this.set(t,n.value,n);}}set(e,t,n={}){var M,N,D,w;if(t===void 0)return this.delete(e),this;let{ttl:i=this.ttl,start:a,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:h=this.sizeCalculation,status:p}=n,{noUpdateTTL:S=this.noUpdateTTL}=n,u=r(this,Ne).call(this,e,t,n.size||0,h);if(this.maxEntrySize&&u>this.maxEntrySize)return p&&(p.set="miss",p.maxEntrySizeExceeded=true),f(this,c,be).call(this,e,"set"),this;let L=r(this,Y)===0?void 0:r(this,U).get(e);if(L===void 0)L=r(this,Y)===0?r(this,F):r(this,re).length!==0?r(this,re).pop():r(this,Y)===r(this,X)?f(this,c,Fe).call(this,false):r(this,Y),r(this,A)[L]=e,r(this,_)[L]=t,r(this,U).set(e,L),r(this,K)[r(this,F)]=L,r(this,j)[L]=r(this,F),y(this,F,L),Ue(this,Y)._++,r(this,Ie).call(this,L,u,p),p&&(p.set="add"),S=false,r(this,Ce)&&((M=r(this,ye))==null||M.call(this,t,e,"add"));else {f(this,c,Ae).call(this,L);let T=r(this,_)[L];if(t!==T){if(r(this,Se)&&f(this,c,x).call(this,T)){T.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:l}=T;l!==void 0&&!o&&(r(this,ae)&&((N=r(this,Q))==null||N.call(this,l,e,"set")),r(this,W)&&r(this,V)?.push([l,e,"set"]));}else o||(r(this,ae)&&((D=r(this,Q))==null||D.call(this,T,e,"set")),r(this,W)&&r(this,V)?.push([T,e,"set"]));if(r(this,ge).call(this,L),r(this,Ie).call(this,L,u,p),r(this,_)[L]=t,p){p.set="replace";let l=T&&f(this,c,x).call(this,T)?T.__staleWhileFetching:T;l!==void 0&&(p.oldValue=l);}}else p&&(p.set="update");r(this,Ce)&&this.onInsert?.(t,e,t===T?"update":"replace");}if(i!==0&&!r(this,k)&&f(this,c,$e).call(this),r(this,k)&&(S||r(this,Me).call(this,L,i,a),p&&r(this,he).call(this,p,L)),!o&&r(this,W)&&r(this,V)){let T=r(this,V),l;for(;l=T?.shift();)(w=r(this,Z))==null||w.call(this,...l);}return this}pop(){var e;try{for(;r(this,Y);){let t=r(this,_)[r(this,H)];if(f(this,c,Fe).call(this,!0),f(this,c,x).call(this,t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(r(this,W)&&r(this,V)){let t=r(this,V),n;for(;n=t?.shift();)(e=r(this,Z))==null||e.call(this,...n);}}}has(e,t={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:i}=t,a=r(this,U).get(e);if(a!==void 0){let o=r(this,_)[a];if(f(this,c,x).call(this,o)&&o.__staleWhileFetching===void 0)return false;if(r(this,q).call(this,a))i&&(i.has="stale",r(this,he).call(this,i,a));else return n&&r(this,me).call(this,a),i&&(i.has="hit",r(this,he).call(this,i,a)),true}else i&&(i.has="miss");return false}peek(e,t={}){let{allowStale:n=this.allowStale}=t,i=r(this,U).get(e);if(i===void 0||!n&&r(this,q).call(this,i))return;let a=r(this,_)[i];return f(this,c,x).call(this,a)?a.__staleWhileFetching:a}async fetch(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:h=this.noDisposeOnSet,size:p=0,sizeCalculation:S=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:L=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:M=this.allowStaleOnFetchRejection,ignoreFetchAbort:N=this.ignoreFetchAbort,allowStaleOnFetchAbort:D=this.allowStaleOnFetchAbort,context:w,forceRefresh:T=false,status:l,signal:d}=t;if(!r(this,Se))return l&&(l.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:a,status:l});let C={allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:a,ttl:o,noDisposeOnSet:h,size:p,sizeCalculation:S,noUpdateTTL:u,noDeleteOnFetchRejection:L,allowStaleOnFetchRejection:M,allowStaleOnFetchAbort:D,ignoreFetchAbort:N,status:l,signal:d},E=r(this,U).get(e);if(E===void 0){l&&(l.fetch="miss");let O=f(this,c,Ve).call(this,e,E,C,w);return O.__returned=O}else {let O=r(this,_)[E];if(f(this,c,x).call(this,O)){let J=n&&O.__staleWhileFetching!==void 0;return l&&(l.fetch="inflight",J&&(l.returnedStale=true)),J?O.__staleWhileFetching:O.__returned=O}let P=r(this,q).call(this,E);if(!T&&!P)return l&&(l.fetch="hit"),f(this,c,Ae).call(this,E),i&&r(this,me).call(this,E),l&&r(this,he).call(this,l,E),O;let oe=f(this,c,Ve).call(this,e,E,C,w),G=oe.__staleWhileFetching!==void 0&&n;return l&&(l.fetch=P?"stale":"refresh",G&&P&&(l.returnedStale=true)),G?oe.__staleWhileFetching:oe.__returned=oe}}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,Ee);if(!n)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:a,...o}=t,h=this.get(e,o);if(!a&&h!==void 0)return h;let p=n(e,h,{options:o,context:i});return this.set(e,p,o),p}get(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,status:o}=t,h=r(this,U).get(e);if(h!==void 0){let p=r(this,_)[h],S=f(this,c,x).call(this,p);return o&&r(this,he).call(this,o,h),r(this,q).call(this,h)?(o&&(o.get="stale"),S?(o&&n&&p.__staleWhileFetching!==void 0&&(o.returnedStale=true),n?p.__staleWhileFetching:void 0):(a||f(this,c,be).call(this,e,"expire"),o&&n&&(o.returnedStale=true),n?p:void 0)):(o&&(o.get="hit"),S?p.__staleWhileFetching:(f(this,c,Ae).call(this,h),i&&r(this,me).call(this,h),p))}else o&&(o.get="miss");}delete(e){return f(this,c,be).call(this,e,"delete")}clear(){return f(this,c,Je).call(this,"delete")}},X=new WeakMap,B=new WeakMap,Q=new WeakMap,ye=new WeakMap,Z=new WeakMap,Te=new WeakMap,Ee=new WeakMap,ee=new WeakMap,Y=new WeakMap,te=new WeakMap,U=new WeakMap,A=new WeakMap,_=new WeakMap,K=new WeakMap,j=new WeakMap,H=new WeakMap,F=new WeakMap,re=new WeakMap,V=new WeakMap,ne=new WeakMap,ie=new WeakMap,k=new WeakMap,$=new WeakMap,ae=new WeakMap,Se=new WeakMap,W=new WeakMap,Ce=new WeakMap,c=new WeakSet,$e=function(){let e=new Ye(r(this,X)),t=new Ye(r(this,X));y(this,k,e),y(this,ie,t);let n=this.ttlAutopurge?new Array(r(this,X)):void 0;y(this,$,n),y(this,Me,(h,p,S=r(this,ee).now())=>{t[h]=p!==0?S:0,e[h]=p,i(h,p);}),y(this,me,h=>{t[h]=e[h]!==0?r(this,ee).now():0,i(h,e[h]);});let i=this.ttlAutopurge?(h,p)=>{if(n?.[h]&&(clearTimeout(n[h]),n[h]=void 0),p&&p!==0&&n){let S=setTimeout(()=>{r(this,q).call(this,h)&&f(this,c,be).call(this,r(this,A)[h],"expire");},p+1);S.unref&&S.unref(),n[h]=S;}}:()=>{};y(this,he,(h,p)=>{if(e[p]){let S=e[p],u=t[p];if(!S||!u)return;h.ttl=S,h.start=u,h.now=a||o();let L=h.now-u;h.remainingTTL=S-L;}});let a=0,o=()=>{let h=r(this,ee).now();if(this.ttlResolution>0){a=h;let p=setTimeout(()=>a=0,this.ttlResolution);p.unref&&p.unref();}return h};this.getRemainingTTL=h=>{let p=r(this,U).get(h);if(p===void 0)return 0;let S=e[p],u=t[p];if(!S||!u)return 1/0;let L=(a||o())-u;return S-L},y(this,q,h=>{let p=t[h],S=e[h];return !!S&&!!p&&(a||o())-p>S});},me=new WeakMap,he=new WeakMap,Me=new WeakMap,q=new WeakMap,ot=function(){let e=new Ye(r(this,X));y(this,te,0),y(this,ne,e),y(this,ge,t=>{y(this,te,r(this,te)-e[t]),e[t]=0;}),y(this,Ne,(t,n,i,a)=>{if(f(this,c,x).call(this,n))return 0;if(!ue(i))if(a){if(typeof a!="function")throw new TypeError("sizeCalculation must be a function");if(i=a(n,t),!ue(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}),y(this,Ie,(t,n,i)=>{if(e[t]=n,r(this,B)){let a=r(this,B)-e[t];for(;r(this,te)>a;)f(this,c,Fe).call(this,true);}y(this,te,r(this,te)+e[t]),i&&(i.entrySize=n,i.totalCalculatedSize=r(this,te));});},ge=new WeakMap,Ie=new WeakMap,Ne=new WeakMap,de=function*({allowStale:e=this.allowStale}={}){if(r(this,Y))for(let t=r(this,F);!(!f(this,c,qe).call(this,t)||((e||!r(this,q).call(this,t))&&(yield t),t===r(this,H)));)t=r(this,j)[t];},fe=function*({allowStale:e=this.allowStale}={}){if(r(this,Y))for(let t=r(this,H);!(!f(this,c,qe).call(this,t)||((e||!r(this,q).call(this,t))&&(yield t),t===r(this,F)));)t=r(this,K)[t];},qe=function(e){return e!==void 0&&r(this,U).get(r(this,A)[e])===e},Fe=function(e){var a;let t=r(this,H),n=r(this,A)[t],i=r(this,_)[t];return r(this,Se)&&f(this,c,x).call(this,i)?i.__abortController.abort(new Error("evicted")):(r(this,ae)||r(this,W))&&(r(this,ae)&&((a=r(this,Q))==null||a.call(this,i,n,"evict")),r(this,W)&&r(this,V)?.push([i,n,"evict"])),r(this,ge).call(this,t),r(this,$)?.[t]&&(clearTimeout(r(this,$)[t]),r(this,$)[t]=void 0),e&&(r(this,A)[t]=void 0,r(this,_)[t]=void 0,r(this,re).push(t)),r(this,Y)===1?(y(this,H,y(this,F,0)),r(this,re).length=0):y(this,H,r(this,K)[t]),r(this,U).delete(n),Ue(this,Y)._--,t},Ve=function(e,t,n,i){let a=t===void 0?void 0:r(this,_)[t];if(f(this,c,x).call(this,a))return a;let o=new Ge,{signal:h}=n;h?.addEventListener("abort",()=>o.abort(h.reason),{signal:o.signal});let p={signal:o.signal,options:n,context:i},S=(w,T=false)=>{let{aborted:l}=o.signal,d=n.ignoreFetchAbort&&w!==void 0,C=n.ignoreFetchAbort||!!(n.allowStaleOnFetchAbort&&w!==void 0);if(n.status&&(l&&!T?(n.status.fetchAborted=true,n.status.fetchError=o.signal.reason,d&&(n.status.fetchAbortIgnored=true)):n.status.fetchResolved=true),l&&!d&&!T)return L(o.signal.reason,C);let E=N,O=r(this,_)[t];return (O===N||d&&T&&O===void 0)&&(w===void 0?E.__staleWhileFetching!==void 0?r(this,_)[t]=E.__staleWhileFetching:f(this,c,be).call(this,e,"fetch"):(n.status&&(n.status.fetchUpdated=true),this.set(e,w,p.options))),w},u=w=>(n.status&&(n.status.fetchRejected=true,n.status.fetchError=w),L(w,false)),L=(w,T)=>{let{aborted:l}=o.signal,d=l&&n.allowStaleOnFetchAbort,C=d||n.allowStaleOnFetchRejection,E=C||n.noDeleteOnFetchRejection,O=N;if(r(this,_)[t]===N&&(!E||!T&&O.__staleWhileFetching===void 0?f(this,c,be).call(this,e,"fetch"):d||(r(this,_)[t]=O.__staleWhileFetching)),C)return n.status&&O.__staleWhileFetching!==void 0&&(n.status.returnedStale=true),O.__staleWhileFetching;if(O.__returned===O)throw w},M=(w,T)=>{var d;let l=(d=r(this,Te))==null?void 0:d.call(this,e,a,p);l&&l instanceof Promise&&l.then(C=>w(C===void 0?void 0:C),T),o.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(w(void 0),n.allowStaleOnFetchAbort&&(w=C=>S(C,true)));});};n.status&&(n.status.fetchDispatched=true);let N=new Promise(M).then(S,u),D=Object.assign(N,{__abortController:o,__staleWhileFetching:a,__returned:void 0});return t===void 0?(this.set(e,D,{...p.options,status:void 0}),t=r(this,U).get(e)):r(this,_)[t]=D,D},x=function(e){if(!r(this,Se))return false;let t=e;return !!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof Ge},Xe=function(e,t){r(this,j)[t]=e,r(this,K)[e]=t;},Ae=function(e){e!==r(this,F)&&(e===r(this,H)?y(this,H,r(this,K)[e]):f(this,c,Xe).call(this,r(this,j)[e],r(this,K)[e]),f(this,c,Xe).call(this,r(this,F),e),y(this,F,e));},be=function(e,t){var i,a;let n=false;if(r(this,Y)!==0){let o=r(this,U).get(e);if(o!==void 0)if(r(this,$)?.[o]&&(clearTimeout(r(this,$)?.[o]),r(this,$)[o]=void 0),n=true,r(this,Y)===1)f(this,c,Je).call(this,t);else {r(this,ge).call(this,o);let h=r(this,_)[o];if(f(this,c,x).call(this,h)?h.__abortController.abort(new Error("deleted")):(r(this,ae)||r(this,W))&&(r(this,ae)&&((i=r(this,Q))==null||i.call(this,h,e,t)),r(this,W)&&r(this,V)?.push([h,e,t])),r(this,U).delete(e),r(this,A)[o]=void 0,r(this,_)[o]=void 0,o===r(this,F))y(this,F,r(this,j)[o]);else if(o===r(this,H))y(this,H,r(this,K)[o]);else {let p=r(this,j)[o];r(this,K)[p]=r(this,K)[o];let S=r(this,K)[o];r(this,j)[S]=r(this,j)[o];}Ue(this,Y)._--,r(this,re).push(o);}}if(r(this,W)&&r(this,V)?.length){let o=r(this,V),h;for(;h=o?.shift();)(a=r(this,Z))==null||a.call(this,...h);}return n},Je=function(e){var t,n;for(let i of f(this,c,fe).call(this,{allowStale:true})){let a=r(this,_)[i];if(f(this,c,x).call(this,a))a.__abortController.abort(new Error("deleted"));else {let o=r(this,A)[i];r(this,ae)&&((t=r(this,Q))==null||t.call(this,a,o,e)),r(this,W)&&r(this,V)?.push([a,o,e]);}}if(r(this,U).clear(),r(this,_).fill(void 0),r(this,A).fill(void 0),r(this,k)&&r(this,ie)){r(this,k).fill(0),r(this,ie).fill(0);for(let i of r(this,$)??[])i!==void 0&&clearTimeout(i);r(this,$)?.fill(void 0);}if(r(this,ne)&&r(this,ne).fill(0),y(this,H,0),y(this,F,0),r(this,re).length=0,y(this,te,0),y(this,Y,0),r(this,W)&&r(this,V)){let i=r(this,V),a;for(;a=i?.shift();)(n=r(this,Z))==null||n.call(this,...a);}},Oe);var De=class{cache;map=new Map;constructor(e){this.cache=new st({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 g;(i=>(i.log=(a,...o)=>console.log(`[Pixi\u2019VN] ${a}`,...o),i.warn=(a,...o)=>console.warn(`[Pixi\u2019VN] ${a}`,...o),i.error=(a,...o)=>console.error(`[Pixi\u2019VN] ${a}`,...o),i.info=(a,...o)=>console.info(`[Pixi\u2019VN] ${a}`,...o)))(g||={});var Re=new De({cacheSize:10}),lt;(o=>{function s(h){let p=Re.get(h);if(!p){g.error(`Label "${h}" not found`);return}return p}o.get=s;function e(...h){for(let p of h)Re.set(p.id,p);}o.add=e;function t(){return Array.from(Re.values())}o.values=t;function n(h){return Re.has(h)}o.has=n;function i(){return Array.from(Re.keys())}o.keys=i;function a(){Re.clear();}o.clear=a;})(lt||={});var se=lt;function pe(s){try{if(typeof s>"u")return s;let e=JSON.stringify(s);return JSON.parse(e)}catch(e){throw g.error("Error creating exportable element",s,e),new core.PixiError("not_json_serializable","Error creating exportable element")}}var b=class s{constructor(){}static choiceMadeTemp=void 0;static lastHistoryStep=null;static get allOpenedLabels(){return core.GameUnifier.getVariable(R,I.OPENED_LABELS_COUNTER_KEY)||{}}static set allOpenedLabels(e){core.GameUnifier.setVariable(R,I.OPENED_LABELS_COUNTER_KEY,e);}static getCurrentStepTimesCounterData(e=""){let t=s.currentLabelStepIndex;if(t===null)return g.error("currentLabelStepIndex is null"),null;let n=`${t}${e}`,i=s.currentLabelId,a=s._currentLabel;if(!i||t===null||!a)return g.error("currentLabelId or currentLabelStepIndex is null or currentLabel not found"),null;let o=a.getStepSha(t)||"error",h=core.GameUnifier.getVariable(R,I.CURRENT_STEP_TIMES_COUNTER_KEY)||{};return h[i]||(h[i]={}),(!h[i][n]||h[i][n].stepSha1!==o)&&(h[i][n]={stepSha1:o}),h[i][n]}static setCurrentStepTimesCounterData(e="",t){let n=s.currentLabelStepIndex,i=n+e,a=s.currentLabelId;if(!a||n===null){g.error("currentLabelId or currentLabelStepIndex is null");return}let o=core.GameUnifier.getVariable(R,I.CURRENT_STEP_TIMES_COUNTER_KEY)||{};o[a]||(o[a]={}),o[a][i]=t,core.GameUnifier.setVariable(R,I.CURRENT_STEP_TIMES_COUNTER_KEY,o);}static getCurrentStepTimesCounter(e=""){let t=s._stepCounter,n=s.getCurrentStepTimesCounterData(e);if(!n)return g.error("getCurrentStepTimesCounter obj is null"),0;let i=n.stepCounters||[];return i.find(o=>o===t)||(i.push(t),n.stepCounters=i,s.setCurrentStepTimesCounterData(e,n)),i.length}static getRandomNumber(e,t,n={}){let i=n.nestedId||"";if(n.onceOnly||false){let o=s.getCurrentStepTimesCounterData(i);if(!o)return;let h=o.usedRandomNumbers||{},p=Array.from({length:t-e+1},(L,M)=>M+e).filter(L=>!h[`${e}-${t}`]?.includes(L));if(p.length===0)return;let S=Math.floor(Math.random()*p.length),u=p[S];return h[`${e}-${t}`]||(h[`${e}-${t}`]=[]),h[`${e}-${t}`].push(u),o.usedRandomNumbers=h,s.setCurrentStepTimesCounterData(i,o),u}return Math.floor(Math.random()*(t-e+1))+e}static resetCurrentStepTimesCounter(e=""){let t=s.currentLabelStepIndex,n=t+e,i=s.currentLabelId;if(!i||t===null){g.error("currentLabelId or currentLabelStepIndex is null");return}let a=core.GameUnifier.getVariable(R,I.CURRENT_STEP_TIMES_COUNTER_KEY)||{};a[i]||(a[i]={}),a[i][n]={stepCounters:[],stepSha1:""},core.GameUnifier.setVariable(R,I.CURRENT_STEP_TIMES_COUNTER_KEY,a);}static get allChoicesMade(){return core.GameUnifier.getVariable(R,I.ALL_CHOICES_MADE_KEY)||[]}static set allChoicesMade(e){core.GameUnifier.setVariable(R,I.ALL_CHOICES_MADE_KEY,e);}static _stepCounter=0;static increaseStepCounter(){s._stepCounter++;}static _openedLabels=[];static get openedLabels(){return pe(s._openedLabels)}static set openedLabels(e){s._openedLabels=pe(e);}static _originalOpenedLabels=[];static get originalOpenedLabels(){return pe(s._originalOpenedLabels)}static set originalOpenedLabels(e){s._originalOpenedLabels=pe(e);}static get _currentLabel(){if(s.currentLabelId)return se.get(s.currentLabelId)}static get currentLabelId(){if(s._openedLabels.length>0)return s._openedLabels[s._openedLabels.length-1].label}static get currentLabelStepIndex(){return s._openedLabels.length>0?s._openedLabels[s._openedLabels.length-1].currentStepIndex:null}static addLabelHistory(e,t){let n=s.allOpenedLabels,i=s.allOpenedLabels[e]?.biggestStep||0,a=s.allOpenedLabels[e]?.openCount||0;(!i||i<t)&&(n[e]={biggestStep:t,openCount:a},s.allOpenedLabels=n);}static addChoicesMade(e,t,n,i){let a=s.allChoicesMade,o=a.findIndex(h=>h.labelId===e&&h.stepIndex===t&&h.choiceIndex===i&&h.stepSha1===n);o<0?a.push({labelId:e,stepIndex:t,choiceIndex:i,stepSha1:n,madeTimes:1}):a[o].madeTimes++,s.allChoicesMade=a;}static pushNewLabel(e){if(!se.get(e))throw new core.PixiError("unregistered_element",`Label ${e} not found`);s._openedLabels.push({label:e,currentStepIndex:0});let n=s.allOpenedLabels,i=s.allOpenedLabels[e]?.biggestStep||0,a=s.allOpenedLabels[e]?.openCount||0;n[e]={biggestStep:i,openCount:a+1},s.allOpenedLabels=n;}static increaseCurrentStepIndex(){if(s._openedLabels.length>0){let e=s._openedLabels[s._openedLabels.length-1];s._openedLabels[s._openedLabels.length-1]={...e,currentStepIndex:e.currentStepIndex+1};}}static _onStepStart;static set onStepStart(e){s._onStepStart=e;}static get onStepStart(){return async(e,t)=>{let n=[];return s.onLoadingLabel&&e===0&&n.push(s.onLoadingLabel(e,t)),s._onStepStart&&n.push(s._onStepStart(e,t)),await Promise.all(n)}}static onLoadingLabel;static onStepEnd};var Pe=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,a,o,h,p=core.GameUnifier.getVariable(R,I.LAST_STEP_GLUED)===this.stepCounter;core.GameUnifier.getVariable(R,I.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(a=core.GameUnifier.getVariable(R,I.CURRENT_DIALOGUE_MEMORY_KEY)),core.GameUnifier.getVariable(R,I.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(o=core.GameUnifier.getVariable(R,I.CURRENT_MENU_OPTIONS_MEMORY_KEY)),core.GameUnifier.getVariable(R,I.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(h=core.GameUnifier.getVariable(R,I.CURRENT_INPUT_VALUE_MEMORY_KEY));let S=b.openedLabels,u={currentLabel:b.currentLabelId,dialogue:a,choices:o,stepSha1:e,index:this.stepCounter,labelStepIndex:b.currentLabelStepIndex,choiceIndexMade:n,inputValue:h,alreadyMadeChoices:this.getAlreadyMadeChoicesForSha(e),isGlued:p,openedLabels:S};b.originalOpenedLabels=S,core.GameUnifier.addHistoryItem(u,{ignoreSameStep:i}),b.lastHistoryStep=u,b.increaseStepCounter();}getAlreadyMadeChoicesForSha(e){let t=b.currentLabelStepIndex,n=this.currentLabel;if(!(t===null||!n))return b.allChoicesMade.filter(i=>i.labelId===n.id&&i.stepIndex===t&&i.stepSha1===e).map(i=>i.choiceIndex)}closeCurrentLabel(){if(!b.currentLabelId){g.warn("No label to close");return}if(!this.currentLabel){g.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 a=se.get(t);if(a)return a.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||(g.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&&g.warn("The player must make a choice"),false):this.isRequiredInput?(t&&g.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)){g.warn(`[continue] The parameter steps must be a valid finite number, received: ${i}`);return}if(i<=0){g.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 a;try{core.GameUnifier.runningStepsCount===1&&await core.GameUnifier.onPreContinue(),b.increaseCurrentStepIndex(),a=await this.runCurrentStep(e,t);}catch(o){throw g.error("Error continuing",o),o}return core.GameUnifier.runningStepsCount--,await this.afterRunCurrentStep(e)||a}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"});g.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){g.error("currentLabelStepIndex is null");return}let a=b._currentLabel;if(!a){g.error("currentLabel not found");return}if(a.stepCount>i){try{await this.onStepStart(a,i);}catch(u){g.error("Error running onStepStart",u),this.onStepError&&await this.onStepError(u,e);return}let o=a.getStepById(i);if(!o){g.error("step not found");return}let h=a.getStepSha(i);h||(g.warn("stepSha not found, setting to ERROR"),h="error");let p,S;try{p=await o(e,{labelId:a.id});}catch(u){g.error("Error running step",u),S=u;}try{let u=this.choices;if(u?.length===1&&u[0].autoSelect){let L=u[0];p=await this.selectChoice(L,e);}}catch(u){g.error("Error auto-selecting choice",u),S||(S=u);}try{let u=b.lastHistoryStep;n!==void 0&&u&&(h=u.stepSha1,h||(g.warn("stepSha not found, setting to ERROR"),h="error"),b.addChoicesMade(u.currentLabel||"error",typeof u.labelStepIndex=="number"?u.labelStepIndex:-1,u.stepSha1||"error",n),b.choiceMadeTemp=n);}catch(u){g.warn("Error adding choice made to history",u);}try{core.GameUnifier.runningStepsCount===1&&(b.addLabelHistory(a.id,i),this.addStepHistory(h,{...t,choiceMade:b.choiceMadeTemp}),b.choiceMadeTemp=void 0);}catch(u){g.warn("Error adding step to history",u);}try{this.currentLabel&&await this.onStepEnd(this.currentLabel,b.currentLabelStepIndex||0);}catch(u){g.warn("Error running onStepEnd",u);}return S&&this.onStepError&&await this.onStepError(S,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;g.error("currentLabelId not found");}}async call(e,t,n){let{choiceMade:i}=n||{},a;typeof e=="string"?a=e:a=e.id,core.GameUnifier.runningStepsCount++;let o;try{let h=se.get(a);if(!h)throw new core.PixiError("unregistered_element",`Label ${a} not found`);b.pushNewLabel(h.id),o=await this.runCurrentStep(t,{choiceMade:i});}catch(h){throw g.error("Error calling label",h),h}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||{},a;typeof e=="string"?a=e:a=e.id,core.GameUnifier.runningStepsCount++;let o;try{let h=se.get(a);if(!h)throw new core.PixiError("unregistered_element",`Label ${a} not found`);b.pushNewLabel(h.id),o=await this.runCurrentStep(t,{choiceMade:i});}catch(h){throw g.error("Error jumping to label",h),h}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 g.error(`Type ${n} not found`),new core.PixiError("invalid_usage",`Type ${n} not found`)}}async closeChoiceMenu(e,t){if(e.type!=="close")throw g.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){g.error("Error in onError handler",n);}}}get dialogue(){let e=core.GameUnifier.getVariable(R,I.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(R,I.CURRENT_DIALOGUE_MEMORY_KEY,void 0);return}if((typeof e=="string"||Array.isArray(e))&&(e={text:e}),this.dialogGlue){let t=core.GameUnifier.getVariable(R,I.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(R,I.LAST_STEP_GLUED,this.stepCounter),this.dialogGlue=false;}try{core.GameUnifier.setVariable(R,I.CURRENT_DIALOGUE_MEMORY_KEY,pe({...e,character:typeof e.character=="string"?e.character:e.character?.id})),core.GameUnifier.setVariable(R,I.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}catch{throw g.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(R,I.CURRENT_MENU_OPTIONS_MEMORY_KEY);if(e){let t=[],n=e.map((a,o)=>({...a,choiceIndex:o})),i=this.alreadyCurrentStepMadeChoices;if(n=n.filter((a,o)=>a.oneTime&&i?.includes(o)?false:a.onlyHaveNoChoice?(t.push(a),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(R,I.CURRENT_MENU_OPTIONS_MEMORY_KEY,void 0);return}try{core.GameUnifier.setVariable(R,I.CURRENT_MENU_OPTIONS_MEMORY_KEY,pe(e)),core.GameUnifier.setVariable(R,I.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}catch{throw g.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(I.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)}set dialogGlue(e){core.GameUnifier.setFlag(I.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,e);}get inputValue(){return core.GameUnifier.getVariable(R,I.CURRENT_INPUT_VALUE_MEMORY_KEY)}set inputValue(e){this.removeInputRequest(),core.GameUnifier.setVariable(R,I.CURRENT_INPUT_VALUE_MEMORY_KEY,e),core.GameUnifier.setVariable(R,I.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}get isRequiredInput(){return core.GameUnifier.getVariable(R,I.CURRENT_INPUT_INFO_MEMORY_KEY)?.isRequired||false}get inputType(){return core.GameUnifier.getVariable(R,I.CURRENT_INPUT_INFO_MEMORY_KEY)?.type}requestInput(e={},t){e.isRequired=true,core.GameUnifier.setVariable(R,I.CURRENT_INPUT_INFO_MEMORY_KEY,e),t!==void 0?core.GameUnifier.setVariable(R,I.CURRENT_INPUT_VALUE_MEMORY_KEY,t):core.GameUnifier.removeVariable(R,I.CURRENT_INPUT_VALUE_MEMORY_KEY);}removeInputRequest(){core.GameUnifier.removeVariable(R,I.CURRENT_INPUT_INFO_MEMORY_KEY),core.GameUnifier.removeVariable(R,I.CURRENT_INPUT_VALUE_MEMORY_KEY);}clear(){b.openedLabels=[],b._stepCounter=0;}export(){return {openedLabels:pe(b.openedLabels),stepCounter:this.stepCounter}}async onLoadingLabel(e){let t=this.openedLabels.map(async n=>{let i=[],a=se.get(n.label);return a&&(a.onLoadingLabel&&i.push(a.onLoadingLabel(e,a)),b.onLoadingLabel&&i.push(b.onLoadingLabel(e,a))),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):g.warn("Could not import openedLabels data, so will be ignored"),Object.hasOwn(e,"stepCounter")?b._stepCounter=e.stepCounter:g.warn("Could not import stepCounter data, so will be ignored");try{await this.onLoadingLabel(b.currentLabelStepIndex||0);}catch(n){g.error("Error running onLoadingLabel",n);}}catch(n){g.error("Error importing data",n);}}};function xt(s,e,t,n){let i=typeof e=="string"?e:e.id;return {...n,label:i,props:t,text:s,type:n?.type||"call"}}var ht="close";function At(s,e){return {...e,type:ht,text:s}}var ft=Et(dt());var we=class{constructor(e,t){this.id=e,this._onStepStart=t?.onStepStart,this._onLoadingLabel=t?.onLoadingLabel,this._onStepEnd=t?.onStepEnd;}id;_onStepStart;get onStepStart(){return async(e,t)=>{if(this._onLoadingLabel&&e===0&&await this._onLoadingLabel(e,t),this._onStepStart)return await this._onStepStart(e,t)}}_onLoadingLabel;get onLoadingLabel(){return this._onLoadingLabel}_onStepEnd;get onStepEnd(){return this._onStepEnd}};var xe=class extends we{get stepCount(){return this.steps.length}getStepById(e){return this.steps[e]}constructor(e,t,n){super(e,n),this._steps=t;}_steps;get steps(){return typeof this._steps=="function"?this._steps():this._steps}getStepSha(e){let t=this.steps;if(e<0||e>=t.length)return typeof this._steps!="function"&&g.warn("stepSha not found, setting to ERROR"),"error";try{return (0,ft.default)(t[e].toString().toLocaleLowerCase()).toString()}catch(n){return g.warn("stepSha not found, setting to ERROR",n),"error"}}};function bt(s,e,t){let n=new xe(s,e,t);return se.add(n),n}var Er=new Pe;
2
2
  exports.Label=xe;exports.LabelAbstract=we;exports.NarrationManagerStatic=b;exports.RegisteredLabels=se;exports.narration=Er;exports.newChoiceOption=xt;exports.newCloseChoiceOption=At;exports.newLabel=bt;
@@ -1,2 +1,2 @@
1
- import {a}from'./chunk-6GLWL3NH.mjs';import {l,n}from'./chunk-IWAXXFXE.mjs';import {d,c,e,f}from'./chunk-HQQ5WH6C.mjs';import {GameUnifier,PixiError}from'@drincs/pixi-vn/core';var h=new d({cacheSize:10}),R;(d=>{function i(l){let f=h.get(l);if(!f){e.error(`Label "${l}" not found`);return}return f}d.get=i;function e$1(...l){for(let f of l)h.has(f.id)&&e.info(`Label "${f.id}" already exists, it will be overwritten`),h.set(f.id,f);}d.add=e$1;function t(){return Array.from(h.values())}d.values=t;function r(l){return h.has(l)}d.has=r;function n(){return Array.from(h.keys())}d.keys=n;function a(){h.clear();}d.clear=a;})(R||={});var L=R;var o=class i{constructor(){}static choiceMadeTemp=void 0;static lastHistoryStep=null;static get allOpenedLabels(){return GameUnifier.getVariable(l,n.OPENED_LABELS_COUNTER_KEY)||{}}static set allOpenedLabels(e){GameUnifier.setVariable(l,n.OPENED_LABELS_COUNTER_KEY,e);}static getCurrentStepTimesCounterData(e$1=""){let t=i.currentLabelStepIndex;if(t===null)return e.error("currentLabelStepIndex is null"),null;let r=`${t}${e$1}`,n$1=i.currentLabelId,a=i._currentLabel;if(!n$1||t===null||!a)return e.error("currentLabelId or currentLabelStepIndex is null or currentLabel not found"),null;let d=a.getStepSha(t)||"error",l$1=GameUnifier.getVariable(l,n.CURRENT_STEP_TIMES_COUNTER_KEY)||{};return l$1[n$1]||(l$1[n$1]={}),(!l$1[n$1][r]||l$1[n$1][r].stepSha1!==d)&&(l$1[n$1][r]={stepSha1:d}),l$1[n$1][r]}static setCurrentStepTimesCounterData(e$1="",t){let r=i.currentLabelStepIndex,n$1=r+e$1,a=i.currentLabelId;if(!a||r===null){e.error("currentLabelId or currentLabelStepIndex is null");return}let d=GameUnifier.getVariable(l,n.CURRENT_STEP_TIMES_COUNTER_KEY)||{};d[a]||(d[a]={}),d[a][n$1]=t,GameUnifier.setVariable(l,n.CURRENT_STEP_TIMES_COUNTER_KEY,d);}static getCurrentStepTimesCounter(e$1=""){let t=i._stepCounter,r=i.getCurrentStepTimesCounterData(e$1);if(!r)return e.error("getCurrentStepTimesCounter obj is null"),0;let n=r.stepCounters||[];return n.find(d=>d===t)||(n.push(t),r.stepCounters=n,i.setCurrentStepTimesCounterData(e$1,r)),n.length}static getRandomNumber(e,t,r={}){let n=r.nestedId||"";if(r.onceOnly||false){let d=i.getCurrentStepTimesCounterData(n);if(!d)return;let l=d.usedRandomNumbers||{},f=Array.from({length:t-e+1},(E,N)=>N+e).filter(E=>!l[`${e}-${t}`]?.includes(E));if(f.length===0)return;let S=Math.floor(Math.random()*f.length),b=f[S];return l[`${e}-${t}`]||(l[`${e}-${t}`]=[]),l[`${e}-${t}`].push(b),d.usedRandomNumbers=l,i.setCurrentStepTimesCounterData(n,d),b}return Math.floor(Math.random()*(t-e+1))+e}static resetCurrentStepTimesCounter(e$1=""){let t=i.currentLabelStepIndex,r=t+e$1,n$1=i.currentLabelId;if(!n$1||t===null){e.error("currentLabelId or currentLabelStepIndex is null");return}let a=GameUnifier.getVariable(l,n.CURRENT_STEP_TIMES_COUNTER_KEY)||{};a[n$1]||(a[n$1]={}),a[n$1][r]={stepCounters:[],stepSha1:""},GameUnifier.setVariable(l,n.CURRENT_STEP_TIMES_COUNTER_KEY,a);}static get allChoicesMade(){return GameUnifier.getVariable(l,n.ALL_CHOICES_MADE_KEY)||[]}static set allChoicesMade(e){GameUnifier.setVariable(l,n.ALL_CHOICES_MADE_KEY,e);}static _stepCounter=0;static increaseStepCounter(){i._stepCounter++;}static _openedLabels=[];static get openedLabels(){return f(i._openedLabels)}static set openedLabels(e){i._openedLabels=f(e);}static _originalOpenedLabels=[];static get originalOpenedLabels(){return f(i._originalOpenedLabels)}static set originalOpenedLabels(e){i._originalOpenedLabels=f(e);}static get _currentLabel(){if(i.currentLabelId)return L.get(i.currentLabelId)}static get currentLabelId(){if(i._openedLabels.length>0)return i._openedLabels[i._openedLabels.length-1].label}static get currentLabelStepIndex(){return i._openedLabels.length>0?i._openedLabels[i._openedLabels.length-1].currentStepIndex:null}static addLabelHistory(e,t){let r=i.allOpenedLabels,n=i.allOpenedLabels[e]?.biggestStep||0,a=i.allOpenedLabels[e]?.openCount||0;(!n||n<t)&&(r[e]={biggestStep:t,openCount:a},i.allOpenedLabels=r);}static addChoicesMade(e,t,r,n){let a=i.allChoicesMade,d=a.findIndex(l=>l.labelId===e&&l.stepIndex===t&&l.choiceIndex===n&&l.stepSha1===r);d<0?a.push({labelId:e,stepIndex:t,choiceIndex:n,stepSha1:r,madeTimes:1}):a[d].madeTimes++,i.allChoicesMade=a;}static pushNewLabel(e){if(!L.get(e))throw new PixiError("unregistered_element",`Label ${e} not found`);i._openedLabels.push({label:e,currentStepIndex:0});let r=i.allOpenedLabels,n=i.allOpenedLabels[e]?.biggestStep||0,a=i.allOpenedLabels[e]?.openCount||0;r[e]={biggestStep:n,openCount:a+1},i.allOpenedLabels=r;}static increaseCurrentStepIndex(){if(i._openedLabels.length>0){let e=i._openedLabels[i._openedLabels.length-1];i._openedLabels[i._openedLabels.length-1]={...e,currentStepIndex:e.currentStepIndex+1};}}static _onStepStart;static set onStepStart(e){i._onStepStart=e;}static get onStepStart(){return async(e,t)=>{let r=[];return i.onLoadingLabel&&e===0&&r.push(i.onLoadingLabel(e,t)),i._onStepStart&&r.push(i._onStepStart(e,t)),await Promise.all(r)}}static onLoadingLabel;static onStepEnd};var C=class{get currentStepTimesCounter(){return o.getCurrentStepTimesCounter()}set currentStepTimesCounter(e){o.resetCurrentStepTimesCounter();}getRandomNumber(e,t,r={}){return o.getRandomNumber(e,t,r)}get stepCounter(){return o._stepCounter}get openedLabels(){return o.openedLabels}get currentLabel(){return o._currentLabel}addStepHistory(e,t={}){let{choiceMade:r,ignoreSameStep:n$1}=t,a,d,l$1,f=GameUnifier.getVariable(l,n.LAST_STEP_GLUED)===this.stepCounter;GameUnifier.getVariable(l,n.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(a=GameUnifier.getVariable(l,n.CURRENT_DIALOGUE_MEMORY_KEY)),GameUnifier.getVariable(l,n.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(d=GameUnifier.getVariable(l,n.CURRENT_MENU_OPTIONS_MEMORY_KEY)),GameUnifier.getVariable(l,n.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(l$1=GameUnifier.getVariable(l,n.CURRENT_INPUT_VALUE_MEMORY_KEY));let S=o.openedLabels,b={currentLabel:o.currentLabelId,dialogue:a,choices:d,stepSha1:e,index:this.stepCounter,labelStepIndex:o.currentLabelStepIndex,choiceIndexMade:r,inputValue:l$1,alreadyMadeChoices:this.getAlreadyMadeChoicesForSha(e),isGlued:f,openedLabels:S};o.originalOpenedLabels=S,GameUnifier.addHistoryItem(b,{ignoreSameStep:n$1}),o.lastHistoryStep=b,o.increaseStepCounter();}getAlreadyMadeChoicesForSha(e){let t=o.currentLabelStepIndex,r=this.currentLabel;if(!(t===null||!r))return o.allChoicesMade.filter(n=>n.labelId===r.id&&n.stepIndex===t&&n.stepSha1===e).map(n=>n.choiceIndex)}closeCurrentLabel(){if(!o.currentLabelId){e.warn("No label to close");return}if(!this.currentLabel){e.error("currentLabel not found");return}let e$1=o.openedLabels;e$1.pop(),o.openedLabels=e$1,GameUnifier.onLabelClosing(this.openedLabels.length);}closeAllLabels(){for(;o.openedLabels.length>0;)this.closeCurrentLabel(),GameUnifier.onLabelClosing(this.openedLabels.length);}isLabelAlreadyCompleted(e){let t;typeof e=="string"?t=e:t=e.id;let n=o.allOpenedLabels[t]?.biggestStep||0;if(n){let a=L.get(t);if(a)return a.stepCount<=n}return false}get alreadyCurrentStepMadeChoicesObj(){let e$1=o.currentLabelStepIndex,t=this.currentLabel;if(e$1===null||!t)return;let r=t.getStepSha(e$1);return r||(e.warn("stepSha not found, setting to ERROR"),r="error"),o.allChoicesMade.filter(n=>n.labelId===t?.id&&n.stepIndex===e$1&&n.stepSha1===r)}get alreadyCurrentStepMadeChoices(){return this.alreadyCurrentStepMadeChoicesObj?.map(e=>e.choiceIndex)}get isCurrentStepAlreadyOpened(){let e=o.currentLabelId;if(e){let t=o.allOpenedLabels[e]?.openCount||0;if(o.currentLabelStepIndex&&t>=o.currentLabelStepIndex)return true}return false}getTimesLabelOpened(e){return o.allOpenedLabels[e]?.openCount||0}getTimesChoiceMade(e){return this.alreadyCurrentStepMadeChoicesObj?.find(t=>t.choiceIndex===e)?.madeTimes||0}addCurrentStepToHistory(){this.addStepHistory("dev",{ignoreSameStep:true});}getCanContinue(e$1){let t=e$1?.showWarn||false,r=this.choices;return r&&r.length>0?(t&&e.warn("The player must make a choice"),false):this.isRequiredInput?(t&&e.warn("The player must enter a value"),false):true}get canContinue(){return GameUnifier.runningStepsCount!==0?false:this.getCanContinue()}async onStepStart(e,t){let r=[];return e.onStepStart&&r.push(e.onStepStart(t,e)),o.onStepStart&&r.push(o.onStepStart(t,e)),await Promise.all(r)}async onStepEnd(e,t){let r=[];return e.onStepEnd&&r.push(e.onStepEnd(t,e)),o.onStepEnd&&r.push(o.onStepEnd(t,e)),await Promise.all(r)}async continue(e$1,t={}){let{runNow:r=false,steps:n=1}=t;if(!Number.isFinite(n)){e.warn(`[continue] The parameter steps must be a valid finite number, received: ${n}`);return}if(n<=0){e.warn(`[continue] The parameter steps must be greater than 0, received: ${n}`);return}if(!r&&!this.getCanContinue({showWarn:true}))return;if(!r&&GameUnifier.runningStepsCount!==0){GameUnifier.increaseContinueRequest(n);return}n>1&&GameUnifier.increaseContinueRequest(n-1),GameUnifier.runningStepsCount++;let a;try{GameUnifier.runningStepsCount===1&&await GameUnifier.onPreContinue(),o.increaseCurrentStepIndex(),a=await this.runCurrentStep(e$1,t);}catch(d){throw e.error("Error continuing",d),d}return GameUnifier.runningStepsCount--,await this.afterRunCurrentStep(e$1)||a}async afterRunCurrentStep(e$1){if(GameUnifier.runningStepsCount===0&&GameUnifier.continueRequestsCount!==0)return await GameUnifier.processNavigationRequests(e$1);if(this.openedLabels.length===0){if(GameUnifier.onEnd)return await GameUnifier.onEnd(e$1,{labelId:"end"});e.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$1,t={}){let{choiceMade:r}=t;if(o.currentLabelId){let n=o.currentLabelStepIndex;if(n===null){e.error("currentLabelStepIndex is null");return}let a=o._currentLabel;if(!a){e.error("currentLabel not found");return}if(a.stepCount>n){try{await this.onStepStart(a,n);}catch(b){e.error("Error running onStepStart",b),this.onStepError&&await this.onStepError(b,e$1);return}let d=a.getStepById(n);if(!d){e.error("step not found");return}let l=a.getStepSha(n);l||(e.warn("stepSha not found, setting to ERROR"),l="error");let f,S;try{f=await d(e$1,{labelId:a.id});}catch(b){e.error("Error running step",b),S=b;}try{let b=this.choices;if(b?.length===1&&b[0].autoSelect){let E=b[0];f=await this.selectChoice(E,e$1);}}catch(b){e.error("Error auto-selecting choice",b),S||(S=b);}try{let b=o.lastHistoryStep;r!==void 0&&b&&(l=b.stepSha1,l||(e.warn("stepSha not found, setting to ERROR"),l="error"),o.addChoicesMade(b.currentLabel||"error",typeof b.labelStepIndex=="number"?b.labelStepIndex:-1,b.stepSha1||"error",r),o.choiceMadeTemp=r);}catch(b){e.warn("Error adding choice made to history",b);}try{GameUnifier.runningStepsCount===1&&(o.addLabelHistory(a.id,n),this.addStepHistory(l,{...t,choiceMade:o.choiceMadeTemp}),o.choiceMadeTemp=void 0);}catch(b){e.warn("Error adding step to history",b);}try{this.currentLabel&&await this.onStepEnd(this.currentLabel,o.currentLabelStepIndex||0);}catch(b){e.warn("Error running onStepEnd",b);}return S&&this.onStepError&&await this.onStepError(S,e$1),f}else {if(this.openedLabels.length>1)return this.closeCurrentLabel(),await this.continue(e$1,t);if(this.openedLabels.length===1){o.openedLabels=[];return}}}else {if(this.openedLabels.length===0)return;e.error("currentLabelId not found");}}async call(e$1,t,r){let{choiceMade:n}=r||{},a;typeof e$1=="string"?a=e$1:a=e$1.id,GameUnifier.runningStepsCount++;let d;try{let l=L.get(a);if(!l)throw new PixiError("unregistered_element",`Label ${a} not found`);o.pushNewLabel(l.id),d=await this.runCurrentStep(t,{choiceMade:n});}catch(l){throw e.error("Error calling label",l),l}return GameUnifier.runningStepsCount--,await this.afterRunCurrentStep(t)||d}async jump(e$1,t,r){if(this.stepCounter===0)return await this.call(e$1,t,r);this.openedLabels.length>0&&this.closeCurrentLabel();let{choiceMade:n}=r||{},a;typeof e$1=="string"?a=e$1:a=e$1.id,GameUnifier.runningStepsCount++;let d;try{let l=L.get(a);if(!l)throw new PixiError("unregistered_element",`Label ${a} not found`);o.pushNewLabel(l.id),d=await this.runCurrentStep(t,{choiceMade:n});}catch(l){throw e.error("Error jumping to label",l),l}return GameUnifier.runningStepsCount--,await this.afterRunCurrentStep(t)||d}async selectChoice(e$1,t){this.choices=void 0;let r=e$1.type;switch(r){case "call":return await this.call(e$1.label,{...e$1.props,...t},{choiceMade:e$1.choiceIndex});case "jump":return await this.jump(e$1.label,{...e$1.props,...t},{choiceMade:e$1.choiceIndex});case "close":return await this.closeChoiceMenu(e$1,{...e$1.props,...t});default:throw e.error(`Type ${r} not found`),new PixiError("invalid_usage",`Type ${r} not found`)}}async closeChoiceMenu(e$1,t){if(e$1.type!=="close")throw e.error("For closeChoiceMenu, the type must be close"),new PixiError("invalid_usage","For closeChoiceMenu, the type must be close");let r;return typeof e$1.choiceIndex=="number"&&(r=e$1.choiceIndex),e$1.closeCurrentLabel&&this.closeCurrentLabel(),await this.continue(t,{choiceMade:r})}get onStepError(){return async(e$1,t)=>{try{await GameUnifier.runOnError(e$1,t);}catch(r){e.error("Error in onError handler",r);}}}get dialogue(){let e=GameUnifier.getVariable(l,n.CURRENT_DIALOGUE_MEMORY_KEY);if(e)return {...e,character:e.character?GameUnifier.getCharacter(e.character)||e.character:void 0}}set dialogue(e$1){if(e$1===void 0){GameUnifier.setVariable(l,n.CURRENT_DIALOGUE_MEMORY_KEY,void 0);return}if((typeof e$1=="string"||Array.isArray(e$1))&&(e$1={text:e$1}),this.dialogGlue){let t=GameUnifier.getVariable(l,n.CURRENT_DIALOGUE_MEMORY_KEY);if(t){let r=[];Array.isArray(t.text)?r=[...t.text]:r=[t.text],Array.isArray(e$1.text)?r=[...r,...e$1.text]:r=[...r,e$1.text],e$1.text=r,e$1.character=e$1.character||t.character;}GameUnifier.setVariable(l,n.LAST_STEP_GLUED,this.stepCounter),this.dialogGlue=false;}try{GameUnifier.setVariable(l,n.CURRENT_DIALOGUE_MEMORY_KEY,f({...e$1,character:typeof e$1.character=="string"?e$1.character:e$1.character?.id})),GameUnifier.setVariable(l,n.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}catch{throw e.error("DialogueInterface cannot contain functions or classes"),new PixiError("not_json_serializable","ChoiceInterface cannot contain functions or classes")}}get choices(){let e=GameUnifier.getVariable(l,n.CURRENT_MENU_OPTIONS_MEMORY_KEY);if(e){let t=[],r=e.map((a,d)=>({...a,choiceIndex:d})),n=this.alreadyCurrentStepMadeChoices;if(r=r.filter((a,d)=>a.oneTime&&n?.includes(d)?false:a.onlyHaveNoChoice?(t.push(a),false):true),r.length>0)return r;if(t.length>0)return [t[0]]}}set choices(e$1){if(!e$1||e$1.length===0){GameUnifier.setVariable(l,n.CURRENT_MENU_OPTIONS_MEMORY_KEY,void 0);return}try{GameUnifier.setVariable(l,n.CURRENT_MENU_OPTIONS_MEMORY_KEY,f(e$1)),GameUnifier.setVariable(l,n.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}catch{throw e.error("ChoiceInterface cannot contain functions or classes"),new PixiError("not_json_serializable","ChoiceInterface cannot contain functions or classes")}}get dialogGlue(){return GameUnifier.getFlag(n.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)}set dialogGlue(e){GameUnifier.setFlag(n.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,e);}get inputValue(){return GameUnifier.getVariable(l,n.CURRENT_INPUT_VALUE_MEMORY_KEY)}set inputValue(e){this.removeInputRequest(),GameUnifier.setVariable(l,n.CURRENT_INPUT_VALUE_MEMORY_KEY,e),GameUnifier.setVariable(l,n.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}get isRequiredInput(){return GameUnifier.getVariable(l,n.CURRENT_INPUT_INFO_MEMORY_KEY)?.isRequired||false}get inputType(){return GameUnifier.getVariable(l,n.CURRENT_INPUT_INFO_MEMORY_KEY)?.type}requestInput(e={},t){e.isRequired=true,GameUnifier.setVariable(l,n.CURRENT_INPUT_INFO_MEMORY_KEY,e),t!==void 0?GameUnifier.setVariable(l,n.CURRENT_INPUT_VALUE_MEMORY_KEY,t):GameUnifier.removeVariable(l,n.CURRENT_INPUT_VALUE_MEMORY_KEY);}removeInputRequest(){GameUnifier.removeVariable(l,n.CURRENT_INPUT_INFO_MEMORY_KEY),GameUnifier.removeVariable(l,n.CURRENT_INPUT_VALUE_MEMORY_KEY);}clear(){o.openedLabels=[],o._stepCounter=0;}export(){return {openedLabels:f(o.openedLabels),stepCounter:this.stepCounter}}async onLoadingLabel(e){let t=this.openedLabels.map(async r=>{let n=[],a=L.get(r.label);return a&&(a.onLoadingLabel&&n.push(a.onLoadingLabel(e,a)),o.onLoadingLabel&&n.push(o.onLoadingLabel(e,a))),await Promise.all(n)});return await Promise.all(t)}async restore(e$1,t){this.clear();try{o.lastHistoryStep=t,Object.hasOwn(e$1,"openedLabels")?(o.openedLabels=e$1.openedLabels,o.originalOpenedLabels=o.openedLabels):e.warn("Could not import openedLabels data, so will be ignored"),Object.hasOwn(e$1,"stepCounter")?o._stepCounter=e$1.stepCounter:e.warn("Could not import stepCounter data, so will be ignored");try{await this.onLoadingLabel(o.currentLabelStepIndex||0);}catch(r){e.error("Error running onLoadingLabel",r);}}catch(r){e.error("Error importing data",r);}}};function D(i,e,t,r){let n=typeof e=="string"?e:e.id;return {...r,label:n,props:t,text:i,type:r?.type||"call"}}var O="close";function U(i,e){return {...e,type:O,text:i}}var M=c(a(),1);var g=class{constructor(e,t){this.id=e,this._onStepStart=t?.onStepStart,this._onLoadingLabel=t?.onLoadingLabel,this._onStepEnd=t?.onStepEnd;}id;_onStepStart;get onStepStart(){return async(e,t)=>{if(this._onLoadingLabel&&e===0&&await this._onLoadingLabel(e,t),this._onStepStart)return await this._onStepStart(e,t)}}_onLoadingLabel;get onLoadingLabel(){return this._onLoadingLabel}_onStepEnd;get onStepEnd(){return this._onStepEnd}};var I=class extends g{get stepCount(){return this.steps.length}getStepById(e){return this.steps[e]}constructor(e,t,r){super(e,r),this._steps=t;}_steps;get steps(){return typeof this._steps=="function"?this._steps():this._steps}getStepSha(e$1){let t=this.steps;if(e$1<0||e$1>=t.length)return typeof this._steps!="function"&&e.warn("stepSha not found, setting to ERROR"),"error";try{return (0,M.default)(t[e$1].toString().toLocaleLowerCase()).toString()}catch(r){return e.warn("stepSha not found, setting to ERROR",r),"error"}}};function x(i,e,t){let r=new I(i,e,t);return L.add(r),r}var fe=new C;
1
+ import {a}from'./chunk-6GLWL3NH.mjs';import {l,n}from'./chunk-IWAXXFXE.mjs';import {d,c,e,f}from'./chunk-HQQ5WH6C.mjs';import {GameUnifier,PixiError}from'@drincs/pixi-vn/core';var h=new d({cacheSize:10}),R;(d=>{function i(l){let f=h.get(l);if(!f){e.error(`Label "${l}" not found`);return}return f}d.get=i;function e$1(...l){for(let f of l)h.set(f.id,f);}d.add=e$1;function t(){return Array.from(h.values())}d.values=t;function r(l){return h.has(l)}d.has=r;function n(){return Array.from(h.keys())}d.keys=n;function a(){h.clear();}d.clear=a;})(R||={});var L=R;var o=class i{constructor(){}static choiceMadeTemp=void 0;static lastHistoryStep=null;static get allOpenedLabels(){return GameUnifier.getVariable(l,n.OPENED_LABELS_COUNTER_KEY)||{}}static set allOpenedLabels(e){GameUnifier.setVariable(l,n.OPENED_LABELS_COUNTER_KEY,e);}static getCurrentStepTimesCounterData(e$1=""){let t=i.currentLabelStepIndex;if(t===null)return e.error("currentLabelStepIndex is null"),null;let r=`${t}${e$1}`,n$1=i.currentLabelId,a=i._currentLabel;if(!n$1||t===null||!a)return e.error("currentLabelId or currentLabelStepIndex is null or currentLabel not found"),null;let d=a.getStepSha(t)||"error",l$1=GameUnifier.getVariable(l,n.CURRENT_STEP_TIMES_COUNTER_KEY)||{};return l$1[n$1]||(l$1[n$1]={}),(!l$1[n$1][r]||l$1[n$1][r].stepSha1!==d)&&(l$1[n$1][r]={stepSha1:d}),l$1[n$1][r]}static setCurrentStepTimesCounterData(e$1="",t){let r=i.currentLabelStepIndex,n$1=r+e$1,a=i.currentLabelId;if(!a||r===null){e.error("currentLabelId or currentLabelStepIndex is null");return}let d=GameUnifier.getVariable(l,n.CURRENT_STEP_TIMES_COUNTER_KEY)||{};d[a]||(d[a]={}),d[a][n$1]=t,GameUnifier.setVariable(l,n.CURRENT_STEP_TIMES_COUNTER_KEY,d);}static getCurrentStepTimesCounter(e$1=""){let t=i._stepCounter,r=i.getCurrentStepTimesCounterData(e$1);if(!r)return e.error("getCurrentStepTimesCounter obj is null"),0;let n=r.stepCounters||[];return n.find(d=>d===t)||(n.push(t),r.stepCounters=n,i.setCurrentStepTimesCounterData(e$1,r)),n.length}static getRandomNumber(e,t,r={}){let n=r.nestedId||"";if(r.onceOnly||false){let d=i.getCurrentStepTimesCounterData(n);if(!d)return;let l=d.usedRandomNumbers||{},f=Array.from({length:t-e+1},(E,N)=>N+e).filter(E=>!l[`${e}-${t}`]?.includes(E));if(f.length===0)return;let S=Math.floor(Math.random()*f.length),b=f[S];return l[`${e}-${t}`]||(l[`${e}-${t}`]=[]),l[`${e}-${t}`].push(b),d.usedRandomNumbers=l,i.setCurrentStepTimesCounterData(n,d),b}return Math.floor(Math.random()*(t-e+1))+e}static resetCurrentStepTimesCounter(e$1=""){let t=i.currentLabelStepIndex,r=t+e$1,n$1=i.currentLabelId;if(!n$1||t===null){e.error("currentLabelId or currentLabelStepIndex is null");return}let a=GameUnifier.getVariable(l,n.CURRENT_STEP_TIMES_COUNTER_KEY)||{};a[n$1]||(a[n$1]={}),a[n$1][r]={stepCounters:[],stepSha1:""},GameUnifier.setVariable(l,n.CURRENT_STEP_TIMES_COUNTER_KEY,a);}static get allChoicesMade(){return GameUnifier.getVariable(l,n.ALL_CHOICES_MADE_KEY)||[]}static set allChoicesMade(e){GameUnifier.setVariable(l,n.ALL_CHOICES_MADE_KEY,e);}static _stepCounter=0;static increaseStepCounter(){i._stepCounter++;}static _openedLabels=[];static get openedLabels(){return f(i._openedLabels)}static set openedLabels(e){i._openedLabels=f(e);}static _originalOpenedLabels=[];static get originalOpenedLabels(){return f(i._originalOpenedLabels)}static set originalOpenedLabels(e){i._originalOpenedLabels=f(e);}static get _currentLabel(){if(i.currentLabelId)return L.get(i.currentLabelId)}static get currentLabelId(){if(i._openedLabels.length>0)return i._openedLabels[i._openedLabels.length-1].label}static get currentLabelStepIndex(){return i._openedLabels.length>0?i._openedLabels[i._openedLabels.length-1].currentStepIndex:null}static addLabelHistory(e,t){let r=i.allOpenedLabels,n=i.allOpenedLabels[e]?.biggestStep||0,a=i.allOpenedLabels[e]?.openCount||0;(!n||n<t)&&(r[e]={biggestStep:t,openCount:a},i.allOpenedLabels=r);}static addChoicesMade(e,t,r,n){let a=i.allChoicesMade,d=a.findIndex(l=>l.labelId===e&&l.stepIndex===t&&l.choiceIndex===n&&l.stepSha1===r);d<0?a.push({labelId:e,stepIndex:t,choiceIndex:n,stepSha1:r,madeTimes:1}):a[d].madeTimes++,i.allChoicesMade=a;}static pushNewLabel(e){if(!L.get(e))throw new PixiError("unregistered_element",`Label ${e} not found`);i._openedLabels.push({label:e,currentStepIndex:0});let r=i.allOpenedLabels,n=i.allOpenedLabels[e]?.biggestStep||0,a=i.allOpenedLabels[e]?.openCount||0;r[e]={biggestStep:n,openCount:a+1},i.allOpenedLabels=r;}static increaseCurrentStepIndex(){if(i._openedLabels.length>0){let e=i._openedLabels[i._openedLabels.length-1];i._openedLabels[i._openedLabels.length-1]={...e,currentStepIndex:e.currentStepIndex+1};}}static _onStepStart;static set onStepStart(e){i._onStepStart=e;}static get onStepStart(){return async(e,t)=>{let r=[];return i.onLoadingLabel&&e===0&&r.push(i.onLoadingLabel(e,t)),i._onStepStart&&r.push(i._onStepStart(e,t)),await Promise.all(r)}}static onLoadingLabel;static onStepEnd};var C=class{get currentStepTimesCounter(){return o.getCurrentStepTimesCounter()}set currentStepTimesCounter(e){o.resetCurrentStepTimesCounter();}getRandomNumber(e,t,r={}){return o.getRandomNumber(e,t,r)}get stepCounter(){return o._stepCounter}get openedLabels(){return o.openedLabels}get currentLabel(){return o._currentLabel}addStepHistory(e,t={}){let{choiceMade:r,ignoreSameStep:n$1}=t,a,d,l$1,f=GameUnifier.getVariable(l,n.LAST_STEP_GLUED)===this.stepCounter;GameUnifier.getVariable(l,n.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(a=GameUnifier.getVariable(l,n.CURRENT_DIALOGUE_MEMORY_KEY)),GameUnifier.getVariable(l,n.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(d=GameUnifier.getVariable(l,n.CURRENT_MENU_OPTIONS_MEMORY_KEY)),GameUnifier.getVariable(l,n.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(l$1=GameUnifier.getVariable(l,n.CURRENT_INPUT_VALUE_MEMORY_KEY));let S=o.openedLabels,b={currentLabel:o.currentLabelId,dialogue:a,choices:d,stepSha1:e,index:this.stepCounter,labelStepIndex:o.currentLabelStepIndex,choiceIndexMade:r,inputValue:l$1,alreadyMadeChoices:this.getAlreadyMadeChoicesForSha(e),isGlued:f,openedLabels:S};o.originalOpenedLabels=S,GameUnifier.addHistoryItem(b,{ignoreSameStep:n$1}),o.lastHistoryStep=b,o.increaseStepCounter();}getAlreadyMadeChoicesForSha(e){let t=o.currentLabelStepIndex,r=this.currentLabel;if(!(t===null||!r))return o.allChoicesMade.filter(n=>n.labelId===r.id&&n.stepIndex===t&&n.stepSha1===e).map(n=>n.choiceIndex)}closeCurrentLabel(){if(!o.currentLabelId){e.warn("No label to close");return}if(!this.currentLabel){e.error("currentLabel not found");return}let e$1=o.openedLabels;e$1.pop(),o.openedLabels=e$1,GameUnifier.onLabelClosing(this.openedLabels.length);}closeAllLabels(){for(;o.openedLabels.length>0;)this.closeCurrentLabel(),GameUnifier.onLabelClosing(this.openedLabels.length);}isLabelAlreadyCompleted(e){let t;typeof e=="string"?t=e:t=e.id;let n=o.allOpenedLabels[t]?.biggestStep||0;if(n){let a=L.get(t);if(a)return a.stepCount<=n}return false}get alreadyCurrentStepMadeChoicesObj(){let e$1=o.currentLabelStepIndex,t=this.currentLabel;if(e$1===null||!t)return;let r=t.getStepSha(e$1);return r||(e.warn("stepSha not found, setting to ERROR"),r="error"),o.allChoicesMade.filter(n=>n.labelId===t?.id&&n.stepIndex===e$1&&n.stepSha1===r)}get alreadyCurrentStepMadeChoices(){return this.alreadyCurrentStepMadeChoicesObj?.map(e=>e.choiceIndex)}get isCurrentStepAlreadyOpened(){let e=o.currentLabelId;if(e){let t=o.allOpenedLabels[e]?.openCount||0;if(o.currentLabelStepIndex&&t>=o.currentLabelStepIndex)return true}return false}getTimesLabelOpened(e){return o.allOpenedLabels[e]?.openCount||0}getTimesChoiceMade(e){return this.alreadyCurrentStepMadeChoicesObj?.find(t=>t.choiceIndex===e)?.madeTimes||0}addCurrentStepToHistory(){this.addStepHistory("dev",{ignoreSameStep:true});}getCanContinue(e$1){let t=e$1?.showWarn||false,r=this.choices;return r&&r.length>0?(t&&e.warn("The player must make a choice"),false):this.isRequiredInput?(t&&e.warn("The player must enter a value"),false):true}get canContinue(){return GameUnifier.runningStepsCount!==0?false:this.getCanContinue()}async onStepStart(e,t){let r=[];return e.onStepStart&&r.push(e.onStepStart(t,e)),o.onStepStart&&r.push(o.onStepStart(t,e)),await Promise.all(r)}async onStepEnd(e,t){let r=[];return e.onStepEnd&&r.push(e.onStepEnd(t,e)),o.onStepEnd&&r.push(o.onStepEnd(t,e)),await Promise.all(r)}async continue(e$1,t={}){let{runNow:r=false,steps:n=1}=t;if(!Number.isFinite(n)){e.warn(`[continue] The parameter steps must be a valid finite number, received: ${n}`);return}if(n<=0){e.warn(`[continue] The parameter steps must be greater than 0, received: ${n}`);return}if(!r&&!this.getCanContinue({showWarn:true}))return;if(!r&&GameUnifier.runningStepsCount!==0){GameUnifier.increaseContinueRequest(n);return}n>1&&GameUnifier.increaseContinueRequest(n-1),GameUnifier.runningStepsCount++;let a;try{GameUnifier.runningStepsCount===1&&await GameUnifier.onPreContinue(),o.increaseCurrentStepIndex(),a=await this.runCurrentStep(e$1,t);}catch(d){throw e.error("Error continuing",d),d}return GameUnifier.runningStepsCount--,await this.afterRunCurrentStep(e$1)||a}async afterRunCurrentStep(e$1){if(GameUnifier.runningStepsCount===0&&GameUnifier.continueRequestsCount!==0)return await GameUnifier.processNavigationRequests(e$1);if(this.openedLabels.length===0){if(GameUnifier.onEnd)return await GameUnifier.onEnd(e$1,{labelId:"end"});e.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$1,t={}){let{choiceMade:r}=t;if(o.currentLabelId){let n=o.currentLabelStepIndex;if(n===null){e.error("currentLabelStepIndex is null");return}let a=o._currentLabel;if(!a){e.error("currentLabel not found");return}if(a.stepCount>n){try{await this.onStepStart(a,n);}catch(b){e.error("Error running onStepStart",b),this.onStepError&&await this.onStepError(b,e$1);return}let d=a.getStepById(n);if(!d){e.error("step not found");return}let l=a.getStepSha(n);l||(e.warn("stepSha not found, setting to ERROR"),l="error");let f,S;try{f=await d(e$1,{labelId:a.id});}catch(b){e.error("Error running step",b),S=b;}try{let b=this.choices;if(b?.length===1&&b[0].autoSelect){let E=b[0];f=await this.selectChoice(E,e$1);}}catch(b){e.error("Error auto-selecting choice",b),S||(S=b);}try{let b=o.lastHistoryStep;r!==void 0&&b&&(l=b.stepSha1,l||(e.warn("stepSha not found, setting to ERROR"),l="error"),o.addChoicesMade(b.currentLabel||"error",typeof b.labelStepIndex=="number"?b.labelStepIndex:-1,b.stepSha1||"error",r),o.choiceMadeTemp=r);}catch(b){e.warn("Error adding choice made to history",b);}try{GameUnifier.runningStepsCount===1&&(o.addLabelHistory(a.id,n),this.addStepHistory(l,{...t,choiceMade:o.choiceMadeTemp}),o.choiceMadeTemp=void 0);}catch(b){e.warn("Error adding step to history",b);}try{this.currentLabel&&await this.onStepEnd(this.currentLabel,o.currentLabelStepIndex||0);}catch(b){e.warn("Error running onStepEnd",b);}return S&&this.onStepError&&await this.onStepError(S,e$1),f}else {if(this.openedLabels.length>1)return this.closeCurrentLabel(),await this.continue(e$1,t);if(this.openedLabels.length===1){o.openedLabels=[];return}}}else {if(this.openedLabels.length===0)return;e.error("currentLabelId not found");}}async call(e$1,t,r){let{choiceMade:n}=r||{},a;typeof e$1=="string"?a=e$1:a=e$1.id,GameUnifier.runningStepsCount++;let d;try{let l=L.get(a);if(!l)throw new PixiError("unregistered_element",`Label ${a} not found`);o.pushNewLabel(l.id),d=await this.runCurrentStep(t,{choiceMade:n});}catch(l){throw e.error("Error calling label",l),l}return GameUnifier.runningStepsCount--,await this.afterRunCurrentStep(t)||d}async jump(e$1,t,r){if(this.stepCounter===0)return await this.call(e$1,t,r);this.openedLabels.length>0&&this.closeCurrentLabel();let{choiceMade:n}=r||{},a;typeof e$1=="string"?a=e$1:a=e$1.id,GameUnifier.runningStepsCount++;let d;try{let l=L.get(a);if(!l)throw new PixiError("unregistered_element",`Label ${a} not found`);o.pushNewLabel(l.id),d=await this.runCurrentStep(t,{choiceMade:n});}catch(l){throw e.error("Error jumping to label",l),l}return GameUnifier.runningStepsCount--,await this.afterRunCurrentStep(t)||d}async selectChoice(e$1,t){this.choices=void 0;let r=e$1.type;switch(r){case "call":return await this.call(e$1.label,{...e$1.props,...t},{choiceMade:e$1.choiceIndex});case "jump":return await this.jump(e$1.label,{...e$1.props,...t},{choiceMade:e$1.choiceIndex});case "close":return await this.closeChoiceMenu(e$1,{...e$1.props,...t});default:throw e.error(`Type ${r} not found`),new PixiError("invalid_usage",`Type ${r} not found`)}}async closeChoiceMenu(e$1,t){if(e$1.type!=="close")throw e.error("For closeChoiceMenu, the type must be close"),new PixiError("invalid_usage","For closeChoiceMenu, the type must be close");let r;return typeof e$1.choiceIndex=="number"&&(r=e$1.choiceIndex),e$1.closeCurrentLabel&&this.closeCurrentLabel(),await this.continue(t,{choiceMade:r})}get onStepError(){return async(e$1,t)=>{try{await GameUnifier.runOnError(e$1,t);}catch(r){e.error("Error in onError handler",r);}}}get dialogue(){let e=GameUnifier.getVariable(l,n.CURRENT_DIALOGUE_MEMORY_KEY);if(e)return {...e,character:e.character?GameUnifier.getCharacter(e.character)||e.character:void 0}}set dialogue(e$1){if(e$1===void 0){GameUnifier.setVariable(l,n.CURRENT_DIALOGUE_MEMORY_KEY,void 0);return}if((typeof e$1=="string"||Array.isArray(e$1))&&(e$1={text:e$1}),this.dialogGlue){let t=GameUnifier.getVariable(l,n.CURRENT_DIALOGUE_MEMORY_KEY);if(t){let r=[];Array.isArray(t.text)?r=[...t.text]:r=[t.text],Array.isArray(e$1.text)?r=[...r,...e$1.text]:r=[...r,e$1.text],e$1.text=r,e$1.character=e$1.character||t.character;}GameUnifier.setVariable(l,n.LAST_STEP_GLUED,this.stepCounter),this.dialogGlue=false;}try{GameUnifier.setVariable(l,n.CURRENT_DIALOGUE_MEMORY_KEY,f({...e$1,character:typeof e$1.character=="string"?e$1.character:e$1.character?.id})),GameUnifier.setVariable(l,n.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}catch{throw e.error("DialogueInterface cannot contain functions or classes"),new PixiError("not_json_serializable","ChoiceInterface cannot contain functions or classes")}}get choices(){let e=GameUnifier.getVariable(l,n.CURRENT_MENU_OPTIONS_MEMORY_KEY);if(e){let t=[],r=e.map((a,d)=>({...a,choiceIndex:d})),n=this.alreadyCurrentStepMadeChoices;if(r=r.filter((a,d)=>a.oneTime&&n?.includes(d)?false:a.onlyHaveNoChoice?(t.push(a),false):true),r.length>0)return r;if(t.length>0)return [t[0]]}}set choices(e$1){if(!e$1||e$1.length===0){GameUnifier.setVariable(l,n.CURRENT_MENU_OPTIONS_MEMORY_KEY,void 0);return}try{GameUnifier.setVariable(l,n.CURRENT_MENU_OPTIONS_MEMORY_KEY,f(e$1)),GameUnifier.setVariable(l,n.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}catch{throw e.error("ChoiceInterface cannot contain functions or classes"),new PixiError("not_json_serializable","ChoiceInterface cannot contain functions or classes")}}get dialogGlue(){return GameUnifier.getFlag(n.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)}set dialogGlue(e){GameUnifier.setFlag(n.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,e);}get inputValue(){return GameUnifier.getVariable(l,n.CURRENT_INPUT_VALUE_MEMORY_KEY)}set inputValue(e){this.removeInputRequest(),GameUnifier.setVariable(l,n.CURRENT_INPUT_VALUE_MEMORY_KEY,e),GameUnifier.setVariable(l,n.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}get isRequiredInput(){return GameUnifier.getVariable(l,n.CURRENT_INPUT_INFO_MEMORY_KEY)?.isRequired||false}get inputType(){return GameUnifier.getVariable(l,n.CURRENT_INPUT_INFO_MEMORY_KEY)?.type}requestInput(e={},t){e.isRequired=true,GameUnifier.setVariable(l,n.CURRENT_INPUT_INFO_MEMORY_KEY,e),t!==void 0?GameUnifier.setVariable(l,n.CURRENT_INPUT_VALUE_MEMORY_KEY,t):GameUnifier.removeVariable(l,n.CURRENT_INPUT_VALUE_MEMORY_KEY);}removeInputRequest(){GameUnifier.removeVariable(l,n.CURRENT_INPUT_INFO_MEMORY_KEY),GameUnifier.removeVariable(l,n.CURRENT_INPUT_VALUE_MEMORY_KEY);}clear(){o.openedLabels=[],o._stepCounter=0;}export(){return {openedLabels:f(o.openedLabels),stepCounter:this.stepCounter}}async onLoadingLabel(e){let t=this.openedLabels.map(async r=>{let n=[],a=L.get(r.label);return a&&(a.onLoadingLabel&&n.push(a.onLoadingLabel(e,a)),o.onLoadingLabel&&n.push(o.onLoadingLabel(e,a))),await Promise.all(n)});return await Promise.all(t)}async restore(e$1,t){this.clear();try{o.lastHistoryStep=t,Object.hasOwn(e$1,"openedLabels")?(o.openedLabels=e$1.openedLabels,o.originalOpenedLabels=o.openedLabels):e.warn("Could not import openedLabels data, so will be ignored"),Object.hasOwn(e$1,"stepCounter")?o._stepCounter=e$1.stepCounter:e.warn("Could not import stepCounter data, so will be ignored");try{await this.onLoadingLabel(o.currentLabelStepIndex||0);}catch(r){e.error("Error running onLoadingLabel",r);}}catch(r){e.error("Error importing data",r);}}};function D(i,e,t,r){let n=typeof e=="string"?e:e.id;return {...r,label:n,props:t,text:i,type:r?.type||"call"}}var O="close";function U(i,e){return {...e,type:O,text:i}}var M=c(a(),1);var g=class{constructor(e,t){this.id=e,this._onStepStart=t?.onStepStart,this._onLoadingLabel=t?.onLoadingLabel,this._onStepEnd=t?.onStepEnd;}id;_onStepStart;get onStepStart(){return async(e,t)=>{if(this._onLoadingLabel&&e===0&&await this._onLoadingLabel(e,t),this._onStepStart)return await this._onStepStart(e,t)}}_onLoadingLabel;get onLoadingLabel(){return this._onLoadingLabel}_onStepEnd;get onStepEnd(){return this._onStepEnd}};var I=class extends g{get stepCount(){return this.steps.length}getStepById(e){return this.steps[e]}constructor(e,t,r){super(e,r),this._steps=t;}_steps;get steps(){return typeof this._steps=="function"?this._steps():this._steps}getStepSha(e$1){let t=this.steps;if(e$1<0||e$1>=t.length)return typeof this._steps!="function"&&e.warn("stepSha not found, setting to ERROR"),"error";try{return (0,M.default)(t[e$1].toString().toLocaleLowerCase()).toString()}catch(r){return e.warn("stepSha not found, setting to ERROR",r),"error"}}};function x(i,e,t){let r=new I(i,e,t);return L.add(r),r}var fe=new C;
2
2
  export{I as Label,g as LabelAbstract,o as NarrationManagerStatic,L as RegisteredLabels,fe as narration,D as newChoiceOption,U as newCloseChoiceOption,x as newLabel};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drincs/pixi-vn",
3
- "version": "1.8.21",
3
+ "version": "1.8.23",
4
4
  "type": "module",
5
5
  "description": "Pixi'VN is a npm package that provides various features for creating visual novels.",
6
6
  "main": "./dist/index.cjs",