@drincs/pixi-vn 1.9.2 → 1.9.4
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/README.md +1 -1
- package/dist/{ContainerMemory-BpDgacyr.d.cts → ContainerMemory-DNqSVzLY.d.cts} +12 -116
- package/dist/{ContainerMemory-BpDgacyr.d.ts → ContainerMemory-DNqSVzLY.d.ts} +12 -116
- package/dist/canvas.cjs +2 -2
- package/dist/canvas.d.cts +1279 -551
- package/dist/canvas.d.ts +1279 -551
- package/dist/canvas.mjs +2 -2
- package/dist/characters.cjs +1 -1
- package/dist/characters.mjs +1 -1
- package/dist/{chunk-6GLWL3NH.mjs → chunk-5MVDNAT4.mjs} +1 -1
- package/dist/chunk-6OABTG5R.mjs +1 -0
- package/dist/chunk-AW5XWF24.mjs +1 -0
- package/dist/chunk-LXIKP2K5.mjs +1 -0
- package/dist/chunk-S7HZUIEI.mjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.cts +61 -5
- package/dist/core.d.ts +61 -5
- package/dist/core.mjs +1 -1
- package/dist/filters.cjs +1 -0
- package/dist/filters.d.cts +182 -0
- package/dist/filters.d.ts +182 -0
- package/dist/filters.mjs +1 -0
- package/dist/history.cjs +1 -1
- package/dist/history.d.cts +2 -2
- package/dist/history.d.ts +2 -2
- package/dist/history.mjs +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +43 -3
- package/dist/index.d.ts +43 -3
- package/dist/index.mjs +2 -2
- package/dist/motion.cjs +1 -1
- package/dist/motion.d.cts +30 -8
- package/dist/motion.d.ts +30 -8
- package/dist/motion.mjs +1 -1
- package/dist/narration.cjs +1 -1
- package/dist/narration.d.cts +2 -1
- package/dist/narration.d.ts +2 -1
- package/dist/narration.mjs +1 -1
- package/dist/pixi/browser.js +170 -169
- package/dist/sound.mjs +1 -1
- package/dist/storage.cjs +1 -1
- package/dist/storage.d.cts +1 -1
- package/dist/storage.d.ts +1 -1
- package/dist/storage.mjs +1 -1
- package/dist/tickers.cjs +1 -0
- package/dist/tickers.d.cts +555 -0
- package/dist/tickers.d.ts +555 -0
- package/dist/tickers.mjs +1 -0
- package/dist/vite.cjs +6 -4
- package/dist/vite.d.cts +64 -0
- package/dist/vite.d.ts +64 -0
- package/dist/vite.mjs +6 -4
- package/dist/worker.cjs +1 -0
- package/dist/worker.d.cts +153 -0
- package/dist/worker.d.ts +153 -0
- package/dist/worker.mjs +1 -0
- package/package.json +28 -1
- package/dist/chunk-HQQ5WH6C.mjs +0 -1
- package/dist/chunk-I7DOUH5V.mjs +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var k=require('@drincs/pixi-vn/canvas'),$t=require('@drincs/pixi-vn/characters'),core=require('@drincs/pixi-vn/core'),ot=require('@drincs/pixi-vn/history'),L=require('@drincs/pixi-vn/narration'),gt=require('@drincs/pixi-vn/sound'),K=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 k__namespace=/*#__PURE__*/_interopNamespace(k);var $t__namespace=/*#__PURE__*/_interopNamespace($t);var ot__namespace=/*#__PURE__*/_interopNamespace(ot);var L__namespace=/*#__PURE__*/_interopNamespace(L);var gt__namespace=/*#__PURE__*/_interopNamespace(gt);var K__namespace=/*#__PURE__*/_interopNamespace(K);var Xt=Object.defineProperty;var Jt=l=>{throw TypeError(l)};var me=(l,e,i)=>e in l?Xt(l,e,{enumerable:true,configurable:true,writable:true,value:i}):l[e]=i;var ge=(l,e)=>{for(var i in e)Xt(l,i,{get:e[i],enumerable:true});};var N=(l,e,i)=>me(l,typeof e!="symbol"?e+"":e,i),Ft=(l,e,i)=>e.has(l)||Jt("Cannot "+i);var t=(l,e,i)=>(Ft(l,e,"read from private field"),i?i.call(l):e.get(l)),b=(l,e,i)=>e.has(l)?Jt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(l):e.set(l,i),p=(l,e,i,s)=>(Ft(l,e,"write to private field"),e.set(l,i),i),c=(l,e,i)=>(Ft(l,e,"access private method"),i);var Rt=(l,e,i,s)=>({set _(r){p(l,e,r);},get _(){return t(l,e,s)}});var _e=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,ee=new Set,Mt=typeof process=="object"&&process?process:{},ie=(l,e,i,s)=>{typeof Mt.emitWarning=="function"?Mt.emitWarning(l,e,i,s):console.error(`[${i}] ${e}: ${l}`);},Gt=globalThis.AbortController,Qt=globalThis.AbortSignal;if(typeof Gt>"u"){Qt=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,s){this._onabort.push(s);}},Gt=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 l=Mt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{l&&(l=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 ve=l=>!ee.has(l);var ct=l=>l&&l===Math.floor(l)&&l>0&&isFinite(l),se=l=>ct(l)?l<=Math.pow(2,8)?Uint8Array:l<=Math.pow(2,16)?Uint16Array:l<=Math.pow(2,32)?Uint32Array:l<=Number.MAX_SAFE_INTEGER?Pt:null:null,Pt=class extends Array{constructor(l){super(l),this.fill(0);}},at,bt,ye=(at=class{heap;length;static create(e){let i=se(e);if(!i)return [];p(at,bt,true);let s=new at(e,i);return p(at,bt,false),s}constructor(e,i){if(!t(at,bt))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]}},bt=new WeakMap,b(at,bt,false),at),Zt,te,J,W,Q,_t,Z,St,Tt,tt,I,et,R,x,g,z,Y,M,C,it,G,st,rt,q,B,nt,ft,V,wt,a,zt,vt,lt,At,$,ne,yt,xt,Ot,dt,pt,Vt,It,Ct,w,Ht,Ut,ut,kt,Et,re=(Et=class{constructor(e){b(this,a);b(this,J);b(this,W);b(this,Q);b(this,_t);b(this,Z);b(this,St);b(this,Tt);b(this,tt);N(this,"ttl");N(this,"ttlResolution");N(this,"ttlAutopurge");N(this,"updateAgeOnGet");N(this,"updateAgeOnHas");N(this,"allowStale");N(this,"noDisposeOnSet");N(this,"noUpdateTTL");N(this,"maxEntrySize");N(this,"sizeCalculation");N(this,"noDeleteOnFetchRejection");N(this,"noDeleteOnStaleGet");N(this,"allowStaleOnFetchAbort");N(this,"allowStaleOnFetchRejection");N(this,"ignoreFetchAbort");b(this,I);b(this,et);b(this,R);b(this,x);b(this,g);b(this,z);b(this,Y);b(this,M);b(this,C);b(this,it);b(this,G);b(this,st);b(this,rt);b(this,q);b(this,B);b(this,nt);b(this,ft);b(this,V);b(this,wt);b(this,vt,()=>{});b(this,lt,()=>{});b(this,At,()=>{});b(this,$,()=>false);b(this,yt,e=>{});b(this,xt,(e,i,s)=>{});b(this,Ot,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});N(this,Zt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:o,updateAgeOnGet:n,updateAgeOnHas:h,allowStale:d,dispose:y,onInsert:O,disposeAfter:S,noDisposeOnSet:j,noUpdateTTL:D,maxSize:H=0,maxEntrySize:f=0,sizeCalculation:_,fetchMethod:m,memoMethod:U,noDeleteOnFetchRejection:u,noDeleteOnStaleGet:E,allowStaleOnFetchRejection:T,allowStaleOnFetchAbort:v,ignoreFetchAbort:A,perf:F}=e;if(F!==void 0&&typeof F?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(p(this,tt,F??_e),i!==0&&!ct(i))throw new TypeError("max option must be a nonnegative integer");let X=i?se(i):Array;if(!X)throw new Error("invalid max value: "+i);if(p(this,J,i),p(this,W,H),this.maxEntrySize=f||t(this,W),this.sizeCalculation=_,this.sizeCalculation){if(!t(this,W)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(U!==void 0&&typeof U!="function")throw new TypeError("memoMethod must be a function if defined");if(p(this,Tt,U),m!==void 0&&typeof m!="function")throw new TypeError("fetchMethod must be a function if specified");if(p(this,St,m),p(this,ft,!!m),p(this,R,new Map),p(this,x,new Array(i).fill(void 0)),p(this,g,new Array(i).fill(void 0)),p(this,z,new X(i)),p(this,Y,new X(i)),p(this,M,0),p(this,C,0),p(this,it,ye.create(i)),p(this,I,0),p(this,et,0),typeof y=="function"&&p(this,Q,y),typeof O=="function"&&p(this,_t,O),typeof S=="function"?(p(this,Z,S),p(this,G,[])):(p(this,Z,void 0),p(this,G,void 0)),p(this,nt,!!t(this,Q)),p(this,wt,!!t(this,_t)),p(this,V,!!t(this,Z)),this.noDisposeOnSet=!!j,this.noUpdateTTL=!!D,this.noDeleteOnFetchRejection=!!u,this.allowStaleOnFetchRejection=!!T,this.allowStaleOnFetchAbort=!!v,this.ignoreFetchAbort=!!A,this.maxEntrySize!==0){if(t(this,W)!==0&&!ct(t(this,W)))throw new TypeError("maxSize must be a positive integer if specified");if(!ct(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");c(this,a,ne).call(this);}if(this.allowStale=!!d,this.noDeleteOnStaleGet=!!E,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!h,this.ttlResolution=ct(r)||r===0?r:1,this.ttlAutopurge=!!o,this.ttl=s||0,this.ttl){if(!ct(this.ttl))throw new TypeError("ttl must be a positive integer if specified");c(this,a,zt).call(this);}if(t(this,J)===0&&this.ttl===0&&t(this,W)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,J)&&!t(this,W)){let jt="LRU_CACHE_UNBOUNDED";ve(jt)&&(ee.add(jt),ie("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",jt,Et));}}get perf(){return t(this,tt)}static unsafeExposeInternals(e){return {starts:t(e,rt),ttls:t(e,q),autopurgeTimers:t(e,B),sizes:t(e,st),keyMap:t(e,R),keyList:t(e,x),valList:t(e,g),next:t(e,z),prev:t(e,Y),get head(){return t(e,M)},get tail(){return t(e,C)},free:t(e,it),isBackgroundFetch:i=>{var s;return c(s=e,a,w).call(s,i)},backgroundFetch:(i,s,r,o)=>{var n;return c(n=e,a,Ct).call(n,i,s,r,o)},moveToTail:i=>{var s;return c(s=e,a,Ut).call(s,i)},indexes:i=>{var s;return c(s=e,a,dt).call(s,i)},rindexes:i=>{var s;return c(s=e,a,pt).call(s,i)},isStale:i=>{var s;return t(s=e,$).call(s,i)}}}get max(){return t(this,J)}get maxSize(){return t(this,W)}get calculatedSize(){return t(this,et)}get size(){return t(this,I)}get fetchMethod(){return t(this,St)}get memoMethod(){return t(this,Tt)}get dispose(){return t(this,Q)}get onInsert(){return t(this,_t)}get disposeAfter(){return t(this,Z)}getRemainingTTL(e){return t(this,R).has(e)?1/0:0}*entries(){for(let e of c(this,a,dt).call(this))t(this,g)[e]!==void 0&&t(this,x)[e]!==void 0&&!c(this,a,w).call(this,t(this,g)[e])&&(yield [t(this,x)[e],t(this,g)[e]]);}*rentries(){for(let e of c(this,a,pt).call(this))t(this,g)[e]!==void 0&&t(this,x)[e]!==void 0&&!c(this,a,w).call(this,t(this,g)[e])&&(yield [t(this,x)[e],t(this,g)[e]]);}*keys(){for(let e of c(this,a,dt).call(this)){let i=t(this,x)[e];i!==void 0&&!c(this,a,w).call(this,t(this,g)[e])&&(yield i);}}*rkeys(){for(let e of c(this,a,pt).call(this)){let i=t(this,x)[e];i!==void 0&&!c(this,a,w).call(this,t(this,g)[e])&&(yield i);}}*values(){for(let e of c(this,a,dt).call(this))t(this,g)[e]!==void 0&&!c(this,a,w).call(this,t(this,g)[e])&&(yield t(this,g)[e]);}*rvalues(){for(let e of c(this,a,pt).call(this))t(this,g)[e]!==void 0&&!c(this,a,w).call(this,t(this,g)[e])&&(yield t(this,g)[e]);}[(te=Symbol.iterator,Zt=Symbol.toStringTag,te)](){return this.entries()}find(e,i={}){for(let s of c(this,a,dt).call(this)){let r=t(this,g)[s],o=c(this,a,w).call(this,r)?r.__staleWhileFetching:r;if(o!==void 0&&e(o,t(this,x)[s],this))return this.get(t(this,x)[s],i)}}forEach(e,i=this){for(let s of c(this,a,dt).call(this)){let r=t(this,g)[s],o=c(this,a,w).call(this,r)?r.__staleWhileFetching:r;o!==void 0&&e.call(i,o,t(this,x)[s],this);}}rforEach(e,i=this){for(let s of c(this,a,pt).call(this)){let r=t(this,g)[s],o=c(this,a,w).call(this,r)?r.__staleWhileFetching:r;o!==void 0&&e.call(i,o,t(this,x)[s],this);}}purgeStale(){let e=false;for(let i of c(this,a,pt).call(this,{allowStale:true}))t(this,$).call(this,i)&&(c(this,a,ut).call(this,t(this,x)[i],"expire"),e=true);return e}info(e){let i=t(this,R).get(e);if(i===void 0)return;let s=t(this,g)[i],r=c(this,a,w).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let o={value:r};if(t(this,q)&&t(this,rt)){let n=t(this,q)[i],h=t(this,rt)[i];if(n&&h){let d=n-(t(this,tt).now()-h);o.ttl=d,o.start=Date.now();}}return t(this,st)&&(o.size=t(this,st)[i]),o}dump(){let e=[];for(let i of c(this,a,dt).call(this,{allowStale:true})){let s=t(this,x)[i],r=t(this,g)[i],o=c(this,a,w).call(this,r)?r.__staleWhileFetching:r;if(o===void 0||s===void 0)continue;let n={value:o};if(t(this,q)&&t(this,rt)){n.ttl=t(this,q)[i];let h=t(this,tt).now()-t(this,rt)[i];n.start=Math.floor(Date.now()-h);}t(this,st)&&(n.size=t(this,st)[i]),e.unshift([s,n]);}return e}load(e){this.clear();for(let[i,s]of e){if(s.start){let r=Date.now()-s.start;s.start=t(this,tt).now()-r;}this.set(i,s.value,s);}}set(e,i,s={}){var j,D,H,f;if(i===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:o,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:h=this.sizeCalculation,status:d}=s,{noUpdateTTL:y=this.noUpdateTTL}=s,O=t(this,Ot).call(this,e,i,s.size||0,h);if(this.maxEntrySize&&O>this.maxEntrySize)return d&&(d.set="miss",d.maxEntrySizeExceeded=true),c(this,a,ut).call(this,e,"set"),this;let S=t(this,I)===0?void 0:t(this,R).get(e);if(S===void 0)S=t(this,I)===0?t(this,C):t(this,it).length!==0?t(this,it).pop():t(this,I)===t(this,J)?c(this,a,It).call(this,false):t(this,I),t(this,x)[S]=e,t(this,g)[S]=i,t(this,R).set(e,S),t(this,z)[t(this,C)]=S,t(this,Y)[S]=t(this,C),p(this,C,S),Rt(this,I)._++,t(this,xt).call(this,S,O,d),d&&(d.set="add"),y=false,t(this,wt)&&((j=t(this,_t))==null||j.call(this,i,e,"add"));else {c(this,a,Ut).call(this,S);let _=t(this,g)[S];if(i!==_){if(t(this,ft)&&c(this,a,w).call(this,_)){_.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:m}=_;m!==void 0&&!n&&(t(this,nt)&&((D=t(this,Q))==null||D.call(this,m,e,"set")),t(this,V)&&t(this,G)?.push([m,e,"set"]));}else n||(t(this,nt)&&((H=t(this,Q))==null||H.call(this,_,e,"set")),t(this,V)&&t(this,G)?.push([_,e,"set"]));if(t(this,yt).call(this,S),t(this,xt).call(this,S,O,d),t(this,g)[S]=i,d){d.set="replace";let m=_&&c(this,a,w).call(this,_)?_.__staleWhileFetching:_;m!==void 0&&(d.oldValue=m);}}else d&&(d.set="update");t(this,wt)&&this.onInsert?.(i,e,i===_?"update":"replace");}if(r!==0&&!t(this,q)&&c(this,a,zt).call(this),t(this,q)&&(y||t(this,At).call(this,S,r,o),d&&t(this,lt).call(this,d,S)),!n&&t(this,V)&&t(this,G)){let _=t(this,G),m;for(;m=_?.shift();)(f=t(this,Z))==null||f.call(this,...m);}return this}pop(){var e;try{for(;t(this,I);){let i=t(this,g)[t(this,M)];if(c(this,a,It).call(this,!0),c(this,a,w).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(t(this,V)&&t(this,G)){let i=t(this,G),s;for(;s=i?.shift();)(e=t(this,Z))==null||e.call(this,...s);}}}has(e,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,o=t(this,R).get(e);if(o!==void 0){let n=t(this,g)[o];if(c(this,a,w).call(this,n)&&n.__staleWhileFetching===void 0)return false;if(t(this,$).call(this,o))r&&(r.has="stale",t(this,lt).call(this,r,o));else return s&&t(this,vt).call(this,o),r&&(r.has="hit",t(this,lt).call(this,r,o)),true}else r&&(r.has="miss");return false}peek(e,i={}){let{allowStale:s=this.allowStale}=i,r=t(this,R).get(e);if(r===void 0||!s&&t(this,$).call(this,r))return;let o=t(this,g)[r];return c(this,a,w).call(this,o)?o.__staleWhileFetching:o}async fetch(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:h=this.noDisposeOnSet,size:d=0,sizeCalculation:y=this.sizeCalculation,noUpdateTTL:O=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:j=this.allowStaleOnFetchRejection,ignoreFetchAbort:D=this.ignoreFetchAbort,allowStaleOnFetchAbort:H=this.allowStaleOnFetchAbort,context:f,forceRefresh:_=false,status:m,signal:U}=i;if(!t(this,ft))return m&&(m.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:o,status:m});let u={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:o,ttl:n,noDisposeOnSet:h,size:d,sizeCalculation:y,noUpdateTTL:O,noDeleteOnFetchRejection:S,allowStaleOnFetchRejection:j,allowStaleOnFetchAbort:H,ignoreFetchAbort:D,status:m,signal:U},E=t(this,R).get(e);if(E===void 0){m&&(m.fetch="miss");let T=c(this,a,Ct).call(this,e,E,u,f);return T.__returned=T}else {let T=t(this,g)[E];if(c(this,a,w).call(this,T)){let X=s&&T.__staleWhileFetching!==void 0;return m&&(m.fetch="inflight",X&&(m.returnedStale=true)),X?T.__staleWhileFetching:T.__returned=T}let v=t(this,$).call(this,E);if(!_&&!v)return m&&(m.fetch="hit"),c(this,a,Ut).call(this,E),r&&t(this,vt).call(this,E),m&&t(this,lt).call(this,m,E),T;let A=c(this,a,Ct).call(this,e,E,u,f),F=A.__staleWhileFetching!==void 0&&s;return m&&(m.fetch=v?"stale":"refresh",F&&v&&(m.returnedStale=true)),F?A.__staleWhileFetching:A.__returned=A}}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,Tt);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:o,...n}=i,h=this.get(e,n);if(!o&&h!==void 0)return h;let d=s(e,h,{options:n,context:r});return this.set(e,d,n),d}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:n}=i,h=t(this,R).get(e);if(h!==void 0){let d=t(this,g)[h],y=c(this,a,w).call(this,d);return n&&t(this,lt).call(this,n,h),t(this,$).call(this,h)?(n&&(n.get="stale"),y?(n&&s&&d.__staleWhileFetching!==void 0&&(n.returnedStale=true),s?d.__staleWhileFetching:void 0):(o||c(this,a,ut).call(this,e,"expire"),n&&s&&(n.returnedStale=true),s?d:void 0)):(n&&(n.get="hit"),y?d.__staleWhileFetching:(c(this,a,Ut).call(this,h),r&&t(this,vt).call(this,h),d))}else n&&(n.get="miss");}delete(e){return c(this,a,ut).call(this,e,"delete")}clear(){return c(this,a,kt).call(this,"delete")}},J=new WeakMap,W=new WeakMap,Q=new WeakMap,_t=new WeakMap,Z=new WeakMap,St=new WeakMap,Tt=new WeakMap,tt=new WeakMap,I=new WeakMap,et=new WeakMap,R=new WeakMap,x=new WeakMap,g=new WeakMap,z=new WeakMap,Y=new WeakMap,M=new WeakMap,C=new WeakMap,it=new WeakMap,G=new WeakMap,st=new WeakMap,rt=new WeakMap,q=new WeakMap,B=new WeakMap,nt=new WeakMap,ft=new WeakMap,V=new WeakMap,wt=new WeakMap,a=new WeakSet,zt=function(){let e=new Pt(t(this,J)),i=new Pt(t(this,J));p(this,q,e),p(this,rt,i);let s=this.ttlAutopurge?new Array(t(this,J)):void 0;p(this,B,s),p(this,At,(h,d,y=t(this,tt).now())=>{i[h]=d!==0?y:0,e[h]=d,r(h,d);}),p(this,vt,h=>{i[h]=e[h]!==0?t(this,tt).now():0,r(h,e[h]);});let r=this.ttlAutopurge?(h,d)=>{if(s?.[h]&&(clearTimeout(s[h]),s[h]=void 0),d&&d!==0&&s){let y=setTimeout(()=>{t(this,$).call(this,h)&&c(this,a,ut).call(this,t(this,x)[h],"expire");},d+1);y.unref&&y.unref(),s[h]=y;}}:()=>{};p(this,lt,(h,d)=>{if(e[d]){let y=e[d],O=i[d];if(!y||!O)return;h.ttl=y,h.start=O,h.now=o||n();let S=h.now-O;h.remainingTTL=y-S;}});let o=0,n=()=>{let h=t(this,tt).now();if(this.ttlResolution>0){o=h;let d=setTimeout(()=>o=0,this.ttlResolution);d.unref&&d.unref();}return h};this.getRemainingTTL=h=>{let d=t(this,R).get(h);if(d===void 0)return 0;let y=e[d],O=i[d];if(!y||!O)return 1/0;let S=(o||n())-O;return y-S},p(this,$,h=>{let d=i[h],y=e[h];return !!y&&!!d&&(o||n())-d>y});},vt=new WeakMap,lt=new WeakMap,At=new WeakMap,$=new WeakMap,ne=function(){let e=new Pt(t(this,J));p(this,et,0),p(this,st,e),p(this,yt,i=>{p(this,et,t(this,et)-e[i]),e[i]=0;}),p(this,Ot,(i,s,r,o)=>{if(c(this,a,w).call(this,s))return 0;if(!ct(r))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(r=o(s,i),!ct(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}),p(this,xt,(i,s,r)=>{if(e[i]=s,t(this,W)){let o=t(this,W)-e[i];for(;t(this,et)>o;)c(this,a,It).call(this,true);}p(this,et,t(this,et)+e[i]),r&&(r.entrySize=s,r.totalCalculatedSize=t(this,et));});},yt=new WeakMap,xt=new WeakMap,Ot=new WeakMap,dt=function*({allowStale:e=this.allowStale}={}){if(t(this,I))for(let i=t(this,C);!(!c(this,a,Vt).call(this,i)||((e||!t(this,$).call(this,i))&&(yield i),i===t(this,M)));)i=t(this,Y)[i];},pt=function*({allowStale:e=this.allowStale}={}){if(t(this,I))for(let i=t(this,M);!(!c(this,a,Vt).call(this,i)||((e||!t(this,$).call(this,i))&&(yield i),i===t(this,C)));)i=t(this,z)[i];},Vt=function(e){return e!==void 0&&t(this,R).get(t(this,x)[e])===e},It=function(e){var o;let i=t(this,M),s=t(this,x)[i],r=t(this,g)[i];return t(this,ft)&&c(this,a,w).call(this,r)?r.__abortController.abort(new Error("evicted")):(t(this,nt)||t(this,V))&&(t(this,nt)&&((o=t(this,Q))==null||o.call(this,r,s,"evict")),t(this,V)&&t(this,G)?.push([r,s,"evict"])),t(this,yt).call(this,i),t(this,B)?.[i]&&(clearTimeout(t(this,B)[i]),t(this,B)[i]=void 0),e&&(t(this,x)[i]=void 0,t(this,g)[i]=void 0,t(this,it).push(i)),t(this,I)===1?(p(this,M,p(this,C,0)),t(this,it).length=0):p(this,M,t(this,z)[i]),t(this,R).delete(s),Rt(this,I)._--,i},Ct=function(e,i,s,r){let o=i===void 0?void 0:t(this,g)[i];if(c(this,a,w).call(this,o))return o;let n=new Gt,{signal:h}=s;h?.addEventListener("abort",()=>n.abort(h.reason),{signal:n.signal});let d={signal:n.signal,options:s,context:r},y=(f,_=false)=>{let{aborted:m}=n.signal,U=s.ignoreFetchAbort&&f!==void 0,u=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&f!==void 0);if(s.status&&(m&&!_?(s.status.fetchAborted=true,s.status.fetchError=n.signal.reason,U&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),m&&!U&&!_)return S(n.signal.reason,u);let E=D,T=t(this,g)[i];return (T===D||U&&_&&T===void 0)&&(f===void 0?E.__staleWhileFetching!==void 0?t(this,g)[i]=E.__staleWhileFetching:c(this,a,ut).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,f,d.options))),f},O=f=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=f),S(f,false)),S=(f,_)=>{let{aborted:m}=n.signal,U=m&&s.allowStaleOnFetchAbort,u=U||s.allowStaleOnFetchRejection,E=u||s.noDeleteOnFetchRejection,T=D;if(t(this,g)[i]===D&&(!E||!_&&T.__staleWhileFetching===void 0?c(this,a,ut).call(this,e,"fetch"):U||(t(this,g)[i]=T.__staleWhileFetching)),u)return s.status&&T.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),T.__staleWhileFetching;if(T.__returned===T)throw f},j=(f,_)=>{var U;let m=(U=t(this,St))==null?void 0:U.call(this,e,o,d);m&&m instanceof Promise&&m.then(u=>f(u===void 0?void 0:u),_),n.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(f(void 0),s.allowStaleOnFetchAbort&&(f=u=>y(u,true)));});};s.status&&(s.status.fetchDispatched=true);let D=new Promise(j).then(y,O),H=Object.assign(D,{__abortController:n,__staleWhileFetching:o,__returned:void 0});return i===void 0?(this.set(e,H,{...d.options,status:void 0}),i=t(this,R).get(e)):t(this,g)[i]=H,H},w=function(e){if(!t(this,ft))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Gt},Ht=function(e,i){t(this,Y)[i]=e,t(this,z)[e]=i;},Ut=function(e){e!==t(this,C)&&(e===t(this,M)?p(this,M,t(this,z)[e]):c(this,a,Ht).call(this,t(this,Y)[e],t(this,z)[e]),c(this,a,Ht).call(this,t(this,C),e),p(this,C,e));},ut=function(e,i){var r,o;let s=false;if(t(this,I)!==0){let n=t(this,R).get(e);if(n!==void 0)if(t(this,B)?.[n]&&(clearTimeout(t(this,B)?.[n]),t(this,B)[n]=void 0),s=true,t(this,I)===1)c(this,a,kt).call(this,i);else {t(this,yt).call(this,n);let h=t(this,g)[n];if(c(this,a,w).call(this,h)?h.__abortController.abort(new Error("deleted")):(t(this,nt)||t(this,V))&&(t(this,nt)&&((r=t(this,Q))==null||r.call(this,h,e,i)),t(this,V)&&t(this,G)?.push([h,e,i])),t(this,R).delete(e),t(this,x)[n]=void 0,t(this,g)[n]=void 0,n===t(this,C))p(this,C,t(this,Y)[n]);else if(n===t(this,M))p(this,M,t(this,z)[n]);else {let d=t(this,Y)[n];t(this,z)[d]=t(this,z)[n];let y=t(this,z)[n];t(this,Y)[y]=t(this,Y)[n];}Rt(this,I)._--,t(this,it).push(n);}}if(t(this,V)&&t(this,G)?.length){let n=t(this,G),h;for(;h=n?.shift();)(o=t(this,Z))==null||o.call(this,...h);}return s},kt=function(e){var i,s;for(let r of c(this,a,pt).call(this,{allowStale:true})){let o=t(this,g)[r];if(c(this,a,w).call(this,o))o.__abortController.abort(new Error("deleted"));else {let n=t(this,x)[r];t(this,nt)&&((i=t(this,Q))==null||i.call(this,o,n,e)),t(this,V)&&t(this,G)?.push([o,n,e]);}}if(t(this,R).clear(),t(this,g).fill(void 0),t(this,x).fill(void 0),t(this,q)&&t(this,rt)){t(this,q).fill(0),t(this,rt).fill(0);for(let r of t(this,B)??[])r!==void 0&&clearTimeout(r);t(this,B)?.fill(void 0);}if(t(this,st)&&t(this,st).fill(0),p(this,M,0),p(this,C,0),t(this,it).length=0,p(this,et,0),p(this,I,0),t(this,V)&&t(this,G)){let r=t(this,G),o;for(;o=r?.shift();)(s=t(this,Z))==null||s.call(this,...o);}},Et);var Dt=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 Lt="1.9.2";var Kt={version:Lt};var Wt="__game_layer__";var be={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 Yt={};ge(Yt,{createExportableElement:()=>le});var mt;(r=>(r.log=(o,...n)=>console.log(`[Pixi\u2019VN] ${o}`,...n),r.warn=(o,...n)=>console.warn(`[Pixi\u2019VN] ${o}`,...n),r.error=(o,...n)=>console.error(`[Pixi\u2019VN] ${o}`,...n),r.info=(o,...n)=>console.info(`[Pixi\u2019VN] ${o}`,...n)))(mt||={});function le(l){try{if(typeof l>"u")return l;let e=JSON.stringify(l);return JSON.parse(e)}catch(e){throw mt.error("Error creating exportable element",l,e),new core.PixiError("not_json_serializable","Error creating exportable element")}}function ce(l){let e,i={},s={};function r(y){i=y;}function o(y){s=y;}function n(y){e&&h();let O=y?.windowKey??"pixiVN",S=[],j=f=>({...i,...f}),D={Game:l,narration:L__namespace.narration,storage:K__namespace.storage,stepHistory:ot__namespace.stepHistory,get props(){return i},start:(f,_)=>s.start?s.start(f,_):l.start(f,j(_)),continue:(f,_)=>s.continue?s.continue():L__namespace.narration.continue(j(f),_),call:(f,_)=>s.call?s.call(f,_):L__namespace.narration.call(f,j(_)),jump:(f,_)=>s.jump?s.jump(f,_):L__namespace.narration.jump(f,j(_)),selectChoice:(f,_)=>{let m=L__namespace.narration.choices.list?.find(U=>U.choiceIndex===f);if(!m){let U=L__namespace.narration.choices.list?.map(u=>u.choiceIndex).join(", ")??"none (no choice menu is open)";throw new Error(`Game.testing: no open choice with index ${f}. Available: ${U}`)}return s.selectChoice?s.selectChoice(m):L__namespace.narration.choices.select(m,j(_))},setInput:f=>{L__namespace.narration.input.value=f;},goBack:(f,_)=>s.back?s.back():ot__namespace.stepHistory.back(j(f),_),closeCurrentLabel:()=>L__namespace.narration.labels.closeCurrent(),closeAllLabels:()=>L__namespace.narration.labels.closeAll(),getState:()=>({dialogue:L__namespace.narration.dialogue,dialogueGlue:L__namespace.narration.dialogGlue,choices:L__namespace.narration.choices.list,input:{isRequired:L__namespace.narration.input.isRequired,type:L__namespace.narration.input.type,value:L__namespace.narration.input.value},canContinue:L__namespace.narration.canContinue,canGoBack:ot__namespace.stepHistory.canGoBack,labelsOpened:L__namespace.narration.labels.opened,currentLabelId:L__namespace.narration.labels.current?.id,stepCounter:L__namespace.narration.stepCounter}),get errors(){return S.slice()},clearErrors:()=>{S.length=0;}},H=f=>{S.push({error:f,timestamp:Date.now()});};return l.addOnError(H),typeof window<"u"?window[O]=D:mt.warn('Game.testing.enable(): "window" is not defined, so the API was not attached globally (it was still returned).'),e={api:D,windowKey:O,errorHandler:H},D}function h(){e&&(l.removeOnError(e.errorHandler),typeof window<"u"&&window[e.windowKey]===e.api&&delete window[e.windowKey],e=void 0);}function d(){return e!==void 0}return {setProps:r,setActions:o,enable:n,disable:h,isEnabled:d}}var Te=typeof window<"u"&&typeof document<"u",de=[" _______ _ _ _ ____ ____ ____ _____ ","|_ __ \\ (_) (_) | | |_ _| |_ _||_ \\|_ _|"," | |__) |__ _ __ __ \\_| \\ \\ / / | \\ | | "," | ___/[ | [ \\ [ ][ | \\ \\ / / | |\\ \\| | "," _| |_ | | > ' < | | \\ ' / _| |_\\ |_ ",`|_____| [___][__]\`\\_][___] \\_/ |_____|\\____| v${Kt.version}`],pe=31,we="background:#2f90da;color:#fff;font-weight:bold;",xe="background:#c832bb;color:#fff;font-weight:bold;",Ee="background:transparent;font-weight:bold;",qt=` v${Kt.version}`;function ue(){if(!Te)return;let l=[],e=[];for(let i=0;i<de.length;i++){let s=de[i],r=s.endsWith(qt),o=r?s.slice(0,-qt.length):s,n=o.slice(0,pe),h=o.slice(pe),d=r?"%c%s%c%s%c%s":"%c%s%c%s";l.push(d),e.push(we,n,xe,h),r&&e.push(Ee,qt);}console.info(l.join(`
|
|
2
|
-
`),...e);}function Bt(){let l=window.location.pathname+window.location.hash;return l.includes("#")&&(l=l.split("#")[1]),l}
|
|
1
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var D=require('@drincs/pixi-vn/canvas'),Xt=require('@drincs/pixi-vn/characters'),core=require('@drincs/pixi-vn/core'),ot=require('@drincs/pixi-vn/history'),O=require('@drincs/pixi-vn/narration'),_t=require('@drincs/pixi-vn/sound'),W=require('@drincs/pixi-vn/storage'),tickers=require('@drincs/pixi-vn/tickers'),worker=require('@drincs/pixi-vn/worker'),motion=require('@drincs/pixi-vn/motion');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var D__namespace=/*#__PURE__*/_interopNamespace(D);var Xt__namespace=/*#__PURE__*/_interopNamespace(Xt);var ot__namespace=/*#__PURE__*/_interopNamespace(ot);var O__namespace=/*#__PURE__*/_interopNamespace(O);var _t__namespace=/*#__PURE__*/_interopNamespace(_t);var W__namespace=/*#__PURE__*/_interopNamespace(W);var Jt=Object.defineProperty;var Qt=l=>{throw TypeError(l)};var be=(l,e,i)=>e in l?Jt(l,e,{enumerable:true,configurable:true,writable:true,value:i}):l[e]=i;var Se=(l,e)=>{for(var i in e)Jt(l,i,{get:e[i],enumerable:true});};var F=(l,e,i)=>be(l,typeof e!="symbol"?e+"":e,i),Ft=(l,e,i)=>e.has(l)||Qt("Cannot "+i);var t=(l,e,i)=>(Ft(l,e,"read from private field"),i?i.call(l):e.get(l)),b=(l,e,i)=>e.has(l)?Qt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(l):e.set(l,i),u=(l,e,i,s)=>(Ft(l,e,"write to private field"),e.set(l,i),i),c=(l,e,i)=>(Ft(l,e,"access private method"),i);var Pt=(l,e,i,s)=>({set _(r){u(l,e,r);},get _(){return t(l,e,s)}});var Te=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,ie=new Set,Mt=typeof process=="object"&&process?process:{},se=(l,e,i,s)=>{typeof Mt.emitWarning=="function"?Mt.emitWarning(l,e,i,s):console.error(`[${i}] ${e}: ${l}`);},jt=globalThis.AbortController,Zt=globalThis.AbortSignal;if(typeof jt>"u"){Zt=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,s){this._onabort.push(s);}},jt=class{constructor(){e();}signal=new Zt;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let l=Mt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{l&&(l=false,se("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e));};}var we=l=>!ie.has(l);var dt=l=>l&&l===Math.floor(l)&&l>0&&isFinite(l),re=l=>dt(l)?l<=Math.pow(2,8)?Uint8Array:l<=Math.pow(2,16)?Uint16Array:l<=Math.pow(2,32)?Uint32Array:l<=Number.MAX_SAFE_INTEGER?It:null:null,It=class extends Array{constructor(l){super(l),this.fill(0);}},lt,St,xe=(lt=class{heap;length;static create(e){let i=re(e);if(!i)return [];u(lt,St,true);let s=new lt(e,i);return u(lt,St,false),s}constructor(e,i){if(!t(lt,St))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},St=new WeakMap,b(lt,St,false),lt),te,ee,X,K,Q,vt,Z,Tt,wt,tt,I,et,R,E,_,k,Y,z,G,it,j,st,rt,q,B,nt,mt,V,xt,a,zt,yt,ht,Ot,$,oe,bt,Et,Lt,pt,ut,kt,Ct,Gt,x,Vt,At,ft,Ht,Ut,ne=(Ut=class{constructor(e){b(this,a);b(this,X);b(this,K);b(this,Q);b(this,vt);b(this,Z);b(this,Tt);b(this,wt);b(this,tt);F(this,"ttl");F(this,"ttlResolution");F(this,"ttlAutopurge");F(this,"updateAgeOnGet");F(this,"updateAgeOnHas");F(this,"allowStale");F(this,"noDisposeOnSet");F(this,"noUpdateTTL");F(this,"maxEntrySize");F(this,"sizeCalculation");F(this,"noDeleteOnFetchRejection");F(this,"noDeleteOnStaleGet");F(this,"allowStaleOnFetchAbort");F(this,"allowStaleOnFetchRejection");F(this,"ignoreFetchAbort");b(this,I);b(this,et);b(this,R);b(this,E);b(this,_);b(this,k);b(this,Y);b(this,z);b(this,G);b(this,it);b(this,j);b(this,st);b(this,rt);b(this,q);b(this,B);b(this,nt);b(this,mt);b(this,V);b(this,xt);b(this,yt,()=>{});b(this,ht,()=>{});b(this,Ot,()=>{});b(this,$,()=>false);b(this,bt,e=>{});b(this,Et,(e,i,s)=>{});b(this,Lt,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});F(this,te,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:o,updateAgeOnGet:n,updateAgeOnHas:h,allowStale:d,dispose:y,onInsert:U,disposeAfter:S,noDisposeOnSet:M,noUpdateTTL:N,maxSize:H=0,maxEntrySize:m=0,sizeCalculation:v,fetchMethod:g,memoMethod:L,noDeleteOnFetchRejection:A,noDeleteOnStaleGet:p,allowStaleOnFetchRejection:T,allowStaleOnFetchAbort:at,ignoreFetchAbort:f,perf:w}=e;if(w!==void 0&&typeof w?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(u(this,tt,w??Te),i!==0&&!dt(i))throw new TypeError("max option must be a nonnegative integer");let C=i?re(i):Array;if(!C)throw new Error("invalid max value: "+i);if(u(this,X,i),u(this,K,H),this.maxEntrySize=m||t(this,K),this.sizeCalculation=v,this.sizeCalculation){if(!t(this,K)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(L!==void 0&&typeof L!="function")throw new TypeError("memoMethod must be a function if defined");if(u(this,wt,L),g!==void 0&&typeof g!="function")throw new TypeError("fetchMethod must be a function if specified");if(u(this,Tt,g),u(this,mt,!!g),u(this,R,new Map),u(this,E,new Array(i).fill(void 0)),u(this,_,new Array(i).fill(void 0)),u(this,k,new C(i)),u(this,Y,new C(i)),u(this,z,0),u(this,G,0),u(this,it,xe.create(i)),u(this,I,0),u(this,et,0),typeof y=="function"&&u(this,Q,y),typeof U=="function"&&u(this,vt,U),typeof S=="function"?(u(this,Z,S),u(this,j,[])):(u(this,Z,void 0),u(this,j,void 0)),u(this,nt,!!t(this,Q)),u(this,xt,!!t(this,vt)),u(this,V,!!t(this,Z)),this.noDisposeOnSet=!!M,this.noUpdateTTL=!!N,this.noDeleteOnFetchRejection=!!A,this.allowStaleOnFetchRejection=!!T,this.allowStaleOnFetchAbort=!!at,this.ignoreFetchAbort=!!f,this.maxEntrySize!==0){if(t(this,K)!==0&&!dt(t(this,K)))throw new TypeError("maxSize must be a positive integer if specified");if(!dt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");c(this,a,oe).call(this);}if(this.allowStale=!!d,this.noDeleteOnStaleGet=!!p,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!h,this.ttlResolution=dt(r)||r===0?r:1,this.ttlAutopurge=!!o,this.ttl=s||0,this.ttl){if(!dt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");c(this,a,zt).call(this);}if(t(this,X)===0&&this.ttl===0&&t(this,K)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,X)&&!t(this,K)){let J="LRU_CACHE_UNBOUNDED";we(J)&&(ie.add(J),se("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",J,Ut));}}get perf(){return t(this,tt)}static unsafeExposeInternals(e){return {starts:t(e,rt),ttls:t(e,q),autopurgeTimers:t(e,B),sizes:t(e,st),keyMap:t(e,R),keyList:t(e,E),valList:t(e,_),next:t(e,k),prev:t(e,Y),get head(){return t(e,z)},get tail(){return t(e,G)},free:t(e,it),isBackgroundFetch:i=>{var s;return c(s=e,a,x).call(s,i)},backgroundFetch:(i,s,r,o)=>{var n;return c(n=e,a,Gt).call(n,i,s,r,o)},moveToTail:i=>{var s;return c(s=e,a,At).call(s,i)},indexes:i=>{var s;return c(s=e,a,pt).call(s,i)},rindexes:i=>{var s;return c(s=e,a,ut).call(s,i)},isStale:i=>{var s;return t(s=e,$).call(s,i)}}}get max(){return t(this,X)}get maxSize(){return t(this,K)}get calculatedSize(){return t(this,et)}get size(){return t(this,I)}get fetchMethod(){return t(this,Tt)}get memoMethod(){return t(this,wt)}get dispose(){return t(this,Q)}get onInsert(){return t(this,vt)}get disposeAfter(){return t(this,Z)}getRemainingTTL(e){return t(this,R).has(e)?1/0:0}*entries(){for(let e of c(this,a,pt).call(this))t(this,_)[e]!==void 0&&t(this,E)[e]!==void 0&&!c(this,a,x).call(this,t(this,_)[e])&&(yield [t(this,E)[e],t(this,_)[e]]);}*rentries(){for(let e of c(this,a,ut).call(this))t(this,_)[e]!==void 0&&t(this,E)[e]!==void 0&&!c(this,a,x).call(this,t(this,_)[e])&&(yield [t(this,E)[e],t(this,_)[e]]);}*keys(){for(let e of c(this,a,pt).call(this)){let i=t(this,E)[e];i!==void 0&&!c(this,a,x).call(this,t(this,_)[e])&&(yield i);}}*rkeys(){for(let e of c(this,a,ut).call(this)){let i=t(this,E)[e];i!==void 0&&!c(this,a,x).call(this,t(this,_)[e])&&(yield i);}}*values(){for(let e of c(this,a,pt).call(this))t(this,_)[e]!==void 0&&!c(this,a,x).call(this,t(this,_)[e])&&(yield t(this,_)[e]);}*rvalues(){for(let e of c(this,a,ut).call(this))t(this,_)[e]!==void 0&&!c(this,a,x).call(this,t(this,_)[e])&&(yield t(this,_)[e]);}[(ee=Symbol.iterator,te=Symbol.toStringTag,ee)](){return this.entries()}find(e,i={}){for(let s of c(this,a,pt).call(this)){let r=t(this,_)[s],o=c(this,a,x).call(this,r)?r.__staleWhileFetching:r;if(o!==void 0&&e(o,t(this,E)[s],this))return this.get(t(this,E)[s],i)}}forEach(e,i=this){for(let s of c(this,a,pt).call(this)){let r=t(this,_)[s],o=c(this,a,x).call(this,r)?r.__staleWhileFetching:r;o!==void 0&&e.call(i,o,t(this,E)[s],this);}}rforEach(e,i=this){for(let s of c(this,a,ut).call(this)){let r=t(this,_)[s],o=c(this,a,x).call(this,r)?r.__staleWhileFetching:r;o!==void 0&&e.call(i,o,t(this,E)[s],this);}}purgeStale(){let e=false;for(let i of c(this,a,ut).call(this,{allowStale:true}))t(this,$).call(this,i)&&(c(this,a,ft).call(this,t(this,E)[i],"expire"),e=true);return e}info(e){let i=t(this,R).get(e);if(i===void 0)return;let s=t(this,_)[i],r=c(this,a,x).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let o={value:r};if(t(this,q)&&t(this,rt)){let n=t(this,q)[i],h=t(this,rt)[i];if(n&&h){let d=n-(t(this,tt).now()-h);o.ttl=d,o.start=Date.now();}}return t(this,st)&&(o.size=t(this,st)[i]),o}dump(){let e=[];for(let i of c(this,a,pt).call(this,{allowStale:true})){let s=t(this,E)[i],r=t(this,_)[i],o=c(this,a,x).call(this,r)?r.__staleWhileFetching:r;if(o===void 0||s===void 0)continue;let n={value:o};if(t(this,q)&&t(this,rt)){n.ttl=t(this,q)[i];let h=t(this,tt).now()-t(this,rt)[i];n.start=Math.floor(Date.now()-h);}t(this,st)&&(n.size=t(this,st)[i]),e.unshift([s,n]);}return e}load(e){this.clear();for(let[i,s]of e){if(s.start){let r=Date.now()-s.start;s.start=t(this,tt).now()-r;}this.set(i,s.value,s);}}set(e,i,s={}){var M,N,H,m;if(i===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:o,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:h=this.sizeCalculation,status:d}=s,{noUpdateTTL:y=this.noUpdateTTL}=s,U=t(this,Lt).call(this,e,i,s.size||0,h);if(this.maxEntrySize&&U>this.maxEntrySize)return d&&(d.set="miss",d.maxEntrySizeExceeded=true),c(this,a,ft).call(this,e,"set"),this;let S=t(this,I)===0?void 0:t(this,R).get(e);if(S===void 0)S=t(this,I)===0?t(this,G):t(this,it).length!==0?t(this,it).pop():t(this,I)===t(this,X)?c(this,a,Ct).call(this,false):t(this,I),t(this,E)[S]=e,t(this,_)[S]=i,t(this,R).set(e,S),t(this,k)[t(this,G)]=S,t(this,Y)[S]=t(this,G),u(this,G,S),Pt(this,I)._++,t(this,Et).call(this,S,U,d),d&&(d.set="add"),y=false,t(this,xt)&&((M=t(this,vt))==null||M.call(this,i,e,"add"));else {c(this,a,At).call(this,S);let v=t(this,_)[S];if(i!==v){if(t(this,mt)&&c(this,a,x).call(this,v)){v.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:g}=v;g!==void 0&&!n&&(t(this,nt)&&((N=t(this,Q))==null||N.call(this,g,e,"set")),t(this,V)&&t(this,j)?.push([g,e,"set"]));}else n||(t(this,nt)&&((H=t(this,Q))==null||H.call(this,v,e,"set")),t(this,V)&&t(this,j)?.push([v,e,"set"]));if(t(this,bt).call(this,S),t(this,Et).call(this,S,U,d),t(this,_)[S]=i,d){d.set="replace";let g=v&&c(this,a,x).call(this,v)?v.__staleWhileFetching:v;g!==void 0&&(d.oldValue=g);}}else d&&(d.set="update");t(this,xt)&&this.onInsert?.(i,e,i===v?"update":"replace");}if(r!==0&&!t(this,q)&&c(this,a,zt).call(this),t(this,q)&&(y||t(this,Ot).call(this,S,r,o),d&&t(this,ht).call(this,d,S)),!n&&t(this,V)&&t(this,j)){let v=t(this,j),g;for(;g=v?.shift();)(m=t(this,Z))==null||m.call(this,...g);}return this}pop(){var e;try{for(;t(this,I);){let i=t(this,_)[t(this,z)];if(c(this,a,Ct).call(this,!0),c(this,a,x).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(t(this,V)&&t(this,j)){let i=t(this,j),s;for(;s=i?.shift();)(e=t(this,Z))==null||e.call(this,...s);}}}has(e,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,o=t(this,R).get(e);if(o!==void 0){let n=t(this,_)[o];if(c(this,a,x).call(this,n)&&n.__staleWhileFetching===void 0)return false;if(t(this,$).call(this,o))r&&(r.has="stale",t(this,ht).call(this,r,o));else return s&&t(this,yt).call(this,o),r&&(r.has="hit",t(this,ht).call(this,r,o)),true}else r&&(r.has="miss");return false}peek(e,i={}){let{allowStale:s=this.allowStale}=i,r=t(this,R).get(e);if(r===void 0||!s&&t(this,$).call(this,r))return;let o=t(this,_)[r];return c(this,a,x).call(this,o)?o.__staleWhileFetching:o}async fetch(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:h=this.noDisposeOnSet,size:d=0,sizeCalculation:y=this.sizeCalculation,noUpdateTTL:U=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:M=this.allowStaleOnFetchRejection,ignoreFetchAbort:N=this.ignoreFetchAbort,allowStaleOnFetchAbort:H=this.allowStaleOnFetchAbort,context:m,forceRefresh:v=false,status:g,signal:L}=i;if(!t(this,mt))return g&&(g.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:o,status:g});let A={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:o,ttl:n,noDisposeOnSet:h,size:d,sizeCalculation:y,noUpdateTTL:U,noDeleteOnFetchRejection:S,allowStaleOnFetchRejection:M,allowStaleOnFetchAbort:H,ignoreFetchAbort:N,status:g,signal:L},p=t(this,R).get(e);if(p===void 0){g&&(g.fetch="miss");let T=c(this,a,Gt).call(this,e,p,A,m);return T.__returned=T}else {let T=t(this,_)[p];if(c(this,a,x).call(this,T)){let C=s&&T.__staleWhileFetching!==void 0;return g&&(g.fetch="inflight",C&&(g.returnedStale=true)),C?T.__staleWhileFetching:T.__returned=T}let at=t(this,$).call(this,p);if(!v&&!at)return g&&(g.fetch="hit"),c(this,a,At).call(this,p),r&&t(this,yt).call(this,p),g&&t(this,ht).call(this,g,p),T;let f=c(this,a,Gt).call(this,e,p,A,m),w=f.__staleWhileFetching!==void 0&&s;return g&&(g.fetch=at?"stale":"refresh",w&&at&&(g.returnedStale=true)),w?f.__staleWhileFetching:f.__returned=f}}async forceFetch(e,i={}){let s=await this.fetch(e,i);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(e,i={}){let s=t(this,wt);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:o,...n}=i,h=this.get(e,n);if(!o&&h!==void 0)return h;let d=s(e,h,{options:n,context:r});return this.set(e,d,n),d}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:n}=i,h=t(this,R).get(e);if(h!==void 0){let d=t(this,_)[h],y=c(this,a,x).call(this,d);return n&&t(this,ht).call(this,n,h),t(this,$).call(this,h)?(n&&(n.get="stale"),y?(n&&s&&d.__staleWhileFetching!==void 0&&(n.returnedStale=true),s?d.__staleWhileFetching:void 0):(o||c(this,a,ft).call(this,e,"expire"),n&&s&&(n.returnedStale=true),s?d:void 0)):(n&&(n.get="hit"),y?d.__staleWhileFetching:(c(this,a,At).call(this,h),r&&t(this,yt).call(this,h),d))}else n&&(n.get="miss");}delete(e){return c(this,a,ft).call(this,e,"delete")}clear(){return c(this,a,Ht).call(this,"delete")}},X=new WeakMap,K=new WeakMap,Q=new WeakMap,vt=new WeakMap,Z=new WeakMap,Tt=new WeakMap,wt=new WeakMap,tt=new WeakMap,I=new WeakMap,et=new WeakMap,R=new WeakMap,E=new WeakMap,_=new WeakMap,k=new WeakMap,Y=new WeakMap,z=new WeakMap,G=new WeakMap,it=new WeakMap,j=new WeakMap,st=new WeakMap,rt=new WeakMap,q=new WeakMap,B=new WeakMap,nt=new WeakMap,mt=new WeakMap,V=new WeakMap,xt=new WeakMap,a=new WeakSet,zt=function(){let e=new It(t(this,X)),i=new It(t(this,X));u(this,q,e),u(this,rt,i);let s=this.ttlAutopurge?new Array(t(this,X)):void 0;u(this,B,s),u(this,Ot,(h,d,y=t(this,tt).now())=>{i[h]=d!==0?y:0,e[h]=d,r(h,d);}),u(this,yt,h=>{i[h]=e[h]!==0?t(this,tt).now():0,r(h,e[h]);});let r=this.ttlAutopurge?(h,d)=>{if(s?.[h]&&(clearTimeout(s[h]),s[h]=void 0),d&&d!==0&&s){let y=setTimeout(()=>{t(this,$).call(this,h)&&c(this,a,ft).call(this,t(this,E)[h],"expire");},d+1);y.unref&&y.unref(),s[h]=y;}}:()=>{};u(this,ht,(h,d)=>{if(e[d]){let y=e[d],U=i[d];if(!y||!U)return;h.ttl=y,h.start=U,h.now=o||n();let S=h.now-U;h.remainingTTL=y-S;}});let o=0,n=()=>{let h=t(this,tt).now();if(this.ttlResolution>0){o=h;let d=setTimeout(()=>o=0,this.ttlResolution);d.unref&&d.unref();}return h};this.getRemainingTTL=h=>{let d=t(this,R).get(h);if(d===void 0)return 0;let y=e[d],U=i[d];if(!y||!U)return 1/0;let S=(o||n())-U;return y-S},u(this,$,h=>{let d=i[h],y=e[h];return !!y&&!!d&&(o||n())-d>y});},yt=new WeakMap,ht=new WeakMap,Ot=new WeakMap,$=new WeakMap,oe=function(){let e=new It(t(this,X));u(this,et,0),u(this,st,e),u(this,bt,i=>{u(this,et,t(this,et)-e[i]),e[i]=0;}),u(this,Lt,(i,s,r,o)=>{if(c(this,a,x).call(this,s))return 0;if(!dt(r))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(r=o(s,i),!dt(r))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return r}),u(this,Et,(i,s,r)=>{if(e[i]=s,t(this,K)){let o=t(this,K)-e[i];for(;t(this,et)>o;)c(this,a,Ct).call(this,true);}u(this,et,t(this,et)+e[i]),r&&(r.entrySize=s,r.totalCalculatedSize=t(this,et));});},bt=new WeakMap,Et=new WeakMap,Lt=new WeakMap,pt=function*({allowStale:e=this.allowStale}={}){if(t(this,I))for(let i=t(this,G);!(!c(this,a,kt).call(this,i)||((e||!t(this,$).call(this,i))&&(yield i),i===t(this,z)));)i=t(this,Y)[i];},ut=function*({allowStale:e=this.allowStale}={}){if(t(this,I))for(let i=t(this,z);!(!c(this,a,kt).call(this,i)||((e||!t(this,$).call(this,i))&&(yield i),i===t(this,G)));)i=t(this,k)[i];},kt=function(e){return e!==void 0&&t(this,R).get(t(this,E)[e])===e},Ct=function(e){var o;let i=t(this,z),s=t(this,E)[i],r=t(this,_)[i];return t(this,mt)&&c(this,a,x).call(this,r)?r.__abortController.abort(new Error("evicted")):(t(this,nt)||t(this,V))&&(t(this,nt)&&((o=t(this,Q))==null||o.call(this,r,s,"evict")),t(this,V)&&t(this,j)?.push([r,s,"evict"])),t(this,bt).call(this,i),t(this,B)?.[i]&&(clearTimeout(t(this,B)[i]),t(this,B)[i]=void 0),e&&(t(this,E)[i]=void 0,t(this,_)[i]=void 0,t(this,it).push(i)),t(this,I)===1?(u(this,z,u(this,G,0)),t(this,it).length=0):u(this,z,t(this,k)[i]),t(this,R).delete(s),Pt(this,I)._--,i},Gt=function(e,i,s,r){let o=i===void 0?void 0:t(this,_)[i];if(c(this,a,x).call(this,o))return o;let n=new jt,{signal:h}=s;h?.addEventListener("abort",()=>n.abort(h.reason),{signal:n.signal});let d={signal:n.signal,options:s,context:r},y=(m,v=false)=>{let{aborted:g}=n.signal,L=s.ignoreFetchAbort&&m!==void 0,A=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&m!==void 0);if(s.status&&(g&&!v?(s.status.fetchAborted=true,s.status.fetchError=n.signal.reason,L&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),g&&!L&&!v)return S(n.signal.reason,A);let p=N,T=t(this,_)[i];return (T===N||L&&v&&T===void 0)&&(m===void 0?p.__staleWhileFetching!==void 0?t(this,_)[i]=p.__staleWhileFetching:c(this,a,ft).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,m,d.options))),m},U=m=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=m),S(m,false)),S=(m,v)=>{let{aborted:g}=n.signal,L=g&&s.allowStaleOnFetchAbort,A=L||s.allowStaleOnFetchRejection,p=A||s.noDeleteOnFetchRejection,T=N;if(t(this,_)[i]===N&&(!p||!v&&T.__staleWhileFetching===void 0?c(this,a,ft).call(this,e,"fetch"):L||(t(this,_)[i]=T.__staleWhileFetching)),A)return s.status&&T.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),T.__staleWhileFetching;if(T.__returned===T)throw m},M=(m,v)=>{var L;let g=(L=t(this,Tt))==null?void 0:L.call(this,e,o,d);g&&g instanceof Promise&&g.then(A=>m(A===void 0?void 0:A),v),n.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(m(void 0),s.allowStaleOnFetchAbort&&(m=A=>y(A,true)));});};s.status&&(s.status.fetchDispatched=true);let N=new Promise(M).then(y,U),H=Object.assign(N,{__abortController:n,__staleWhileFetching:o,__returned:void 0});return i===void 0?(this.set(e,H,{...d.options,status:void 0}),i=t(this,R).get(e)):t(this,_)[i]=H,H},x=function(e){if(!t(this,mt))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof jt},Vt=function(e,i){t(this,Y)[i]=e,t(this,k)[e]=i;},At=function(e){e!==t(this,G)&&(e===t(this,z)?u(this,z,t(this,k)[e]):c(this,a,Vt).call(this,t(this,Y)[e],t(this,k)[e]),c(this,a,Vt).call(this,t(this,G),e),u(this,G,e));},ft=function(e,i){var r,o;let s=false;if(t(this,I)!==0){let n=t(this,R).get(e);if(n!==void 0)if(t(this,B)?.[n]&&(clearTimeout(t(this,B)?.[n]),t(this,B)[n]=void 0),s=true,t(this,I)===1)c(this,a,Ht).call(this,i);else {t(this,bt).call(this,n);let h=t(this,_)[n];if(c(this,a,x).call(this,h)?h.__abortController.abort(new Error("deleted")):(t(this,nt)||t(this,V))&&(t(this,nt)&&((r=t(this,Q))==null||r.call(this,h,e,i)),t(this,V)&&t(this,j)?.push([h,e,i])),t(this,R).delete(e),t(this,E)[n]=void 0,t(this,_)[n]=void 0,n===t(this,G))u(this,G,t(this,Y)[n]);else if(n===t(this,z))u(this,z,t(this,k)[n]);else {let d=t(this,Y)[n];t(this,k)[d]=t(this,k)[n];let y=t(this,k)[n];t(this,Y)[y]=t(this,Y)[n];}Pt(this,I)._--,t(this,it).push(n);}}if(t(this,V)&&t(this,j)?.length){let n=t(this,j),h;for(;h=n?.shift();)(o=t(this,Z))==null||o.call(this,...h);}return s},Ht=function(e){var i,s;for(let r of c(this,a,ut).call(this,{allowStale:true})){let o=t(this,_)[r];if(c(this,a,x).call(this,o))o.__abortController.abort(new Error("deleted"));else {let n=t(this,E)[r];t(this,nt)&&((i=t(this,Q))==null||i.call(this,o,n,e)),t(this,V)&&t(this,j)?.push([o,n,e]);}}if(t(this,R).clear(),t(this,_).fill(void 0),t(this,E).fill(void 0),t(this,q)&&t(this,rt)){t(this,q).fill(0),t(this,rt).fill(0);for(let r of t(this,B)??[])r!==void 0&&clearTimeout(r);t(this,B)?.fill(void 0);}if(t(this,st)&&t(this,st).fill(0),u(this,z,0),u(this,G,0),t(this,it).length=0,u(this,et,0),u(this,I,0),t(this,V)&&t(this,j)){let r=t(this,j),o;for(;o=r?.shift();)(s=t(this,Z))==null||s.call(this,...o);}},Ut);var Dt=class{cache;map=new Map;constructor(e){this.cache=new ne({max:e.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){this.cache.clear(),this.map.clear();}delete(e){let i=this.map.delete(e);return i&&this.cache.delete(e),i}get forEach(){return this.map.forEach}get(e){let i=this.cache.get(e);return i||this.map.get(e)}has(e){return this.map.has(e)}set(e,i){return this.map.set(e,i),this.cache.set(e,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var Rt="1.9.4";var Wt={version:Rt};var Kt="__game_layer__";var Ee={CURRENT_DIALOGUE_MEMORY_KEY:"dialogue",LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY:"dialogue:step_counter",CURRENT_MENU_OPTIONS_MEMORY_KEY:"choice:options",LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY:"choice:step_counter",CURRENT_INPUT_VALUE_MEMORY_KEY:"input:value",LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY:"input:step_counter",CURRENT_INPUT_INFO_MEMORY_KEY:"input:info",CHARACTER_CATEGORY_KEY:"character",ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY:"___glue___",OPENED_LABELS_COUNTER_KEY:"label:opened",ALL_CHOICES_MADE_KEY:"choices:made",CURRENT_STEP_TIMES_COUNTER_KEY:"label:history",LAST_STEP_GLUED:"glue:last_step"};var le={};var Yt={};Se(Yt,{createExportableElement:()=>he});var gt;(r=>(r.log=(o,...n)=>console.log(`[Pixi\u2019VN] ${o}`,...n),r.warn=(o,...n)=>console.warn(`[Pixi\u2019VN] ${o}`,...n),r.error=(o,...n)=>console.error(`[Pixi\u2019VN] ${o}`,...n),r.info=(o,...n)=>console.info(`[Pixi\u2019VN] ${o}`,...n)))(gt||={});function he(l){try{if(typeof l>"u")return l;let e=JSON.stringify(l);return JSON.parse(e)}catch(e){throw gt.error("Error creating exportable element",l,e),new core.PixiError("not_json_serializable","Error creating exportable element")}}function de(l){let e,i={},s={};function r(y){i=y;}function o(y){s=y;}function n(y){e&&h();let U=y?.windowKey??"pixiVN",S=[],M=m=>({...i,...m}),N={Game:l,narration:O__namespace.narration,storage:W__namespace.storage,stepHistory:ot__namespace.stepHistory,get props(){return i},start:(m,v)=>s.start?s.start(m,v):l.start(m,M(v)),continue:(m,v)=>s.continue?s.continue():O__namespace.narration.continue(M(m),v),call:(m,v)=>s.call?s.call(m,v):O__namespace.narration.call(m,M(v)),jump:(m,v)=>s.jump?s.jump(m,v):O__namespace.narration.jump(m,M(v)),selectChoice:(m,v)=>{let g=O__namespace.narration.choices.list?.find(L=>L.choiceIndex===m);if(!g){let L=O__namespace.narration.choices.list?.map(A=>A.choiceIndex).join(", ")??"none (no choice menu is open)";throw new Error(`Game.testing: no open choice with index ${m}. Available: ${L}`)}return s.selectChoice?s.selectChoice(g):O__namespace.narration.choices.select(g,M(v))},setInput:m=>{O__namespace.narration.input.value=m;},goBack:(m,v)=>s.back?s.back():ot__namespace.stepHistory.back(M(m),v),closeCurrentLabel:()=>O__namespace.narration.labels.closeCurrent(),closeAllLabels:()=>O__namespace.narration.labels.closeAll(),getState:()=>({dialogue:O__namespace.narration.dialogue,dialogueGlue:O__namespace.narration.dialogGlue,choices:O__namespace.narration.choices.list,input:{isRequired:O__namespace.narration.input.isRequired,type:O__namespace.narration.input.type,value:O__namespace.narration.input.value},canContinue:O__namespace.narration.canContinue,canGoBack:ot__namespace.stepHistory.canGoBack,labelsOpened:O__namespace.narration.labels.opened,currentLabelId:O__namespace.narration.labels.current?.id,stepCounter:O__namespace.narration.stepCounter}),get errors(){return S.slice()},clearErrors:()=>{S.length=0;}},H=m=>{S.push({error:m,timestamp:Date.now()});};return l.addOnError(H),typeof window<"u"?window[U]=N:gt.warn('Game.testing.enable(): "window" is not defined, so the API was not attached globally (it was still returned).'),e={api:N,windowKey:U,errorHandler:H},N}function h(){e&&(l.removeOnError(e.errorHandler),typeof window<"u"&&window[e.windowKey]===e.api&&delete window[e.windowKey],e=void 0);}function d(){return e!==void 0}return {setProps:r,setActions:o,enable:n,disable:h,isEnabled:d}}var Ae=typeof window<"u"&&typeof document<"u",pe=[" _______ _ _ _ ____ ____ ____ _____ ","|_ __ \\ (_) (_) | | |_ _| |_ _||_ \\|_ _|"," | |__) |__ _ __ __ \\_| \\ \\ / / | \\ | | "," | ___/[ | [ \\ [ ][ | \\ \\ / / | |\\ \\| | "," _| |_ | | > ' < | | \\ ' / _| |_\\ |_ ",`|_____| [___][__]\`\\_][___] \\_/ |_____|\\____| v${Wt.version}`],ue=31,Oe="background:#2f90da;color:#fff;font-weight:bold;",Le="background:#c832bb;color:#fff;font-weight:bold;",Re="background:transparent;font-weight:bold;",qt=` v${Wt.version}`;function fe(){if(!Ae)return;let l=[],e=[];for(let i=0;i<pe.length;i++){let s=pe[i],r=s.endsWith(qt),o=r?s.slice(0,-qt.length):s,n=o.slice(0,ue),h=o.slice(ue),d=r?"%c%s%c%s%c%s":"%c%s%c%s";l.push(d),e.push(Oe,n,Le,h),r&&e.push(Re,qt);}console.info(l.join(`
|
|
2
|
+
`),...e);}function Bt(){let l=window.location.pathname+window.location.hash;return l.includes("#")&&(l=l.split("#")[1]),l}fe();exports.Game=void 0;(A=>{async function l(p,T,at){if(core.GameUnifier.init({navigate:T?.navigate,getCurrentGameStepState:async()=>{let f=D__namespace.canvas.isInitialized?D__namespace.canvas.export():{};return {path:Bt(),storage:await W__namespace.storage.export(),canvas:f,sound:_t__namespace.sound.export(),labelIndex:O__namespace.NarrationManagerStatic.currentLabelStepIndex||0,openedLabels:O__namespace.narration.openedLabels}},restoreGameStepState:async(f,w)=>{ot__namespace.HistoryManagerStatic._originalStepData=f,O__namespace.NarrationManagerStatic.openedLabels=f.openedLabels,W__namespace.storage.restore(f.storage);try{D__namespace.canvas.isInitialized&&await D__namespace.canvas.restore(f.canvas),await _t__namespace.sound.restore(f.sound);}catch(C){gt.error("Error restoring game step state:",C);}await w(f.path);},getStepCounter:()=>O__namespace.narration.stepCounter,setStepCounter:f=>{O__namespace.NarrationManagerStatic._stepCounter=f;},getOpenedLabels:()=>O__namespace.narration.openedLabels.length,addHistoryItem:(f,w)=>ot__namespace.stepHistory.add(f,w),getCharacter:f=>Xt__namespace.RegisteredCharacters.get(f),processNavigationRequests:(f,w)=>{let C=f,J=Promise.resolve();return f>0?(C--,J=O__namespace.narration.continue(w)):f<0&&(C=0,J=ot__namespace.stepHistory.back(w,{steps:f*-1})),{newValue:C,result:J}},animate:(f,w,C,J)=>motion.motion.animate(f,w,C,J),animateFilter:(f,w,C,J,_e,ve,ye)=>motion.motion.animateFilter(f,w,C,J,_e,ve,ye),removeCanvasComponent:f=>{D__namespace.canvas.isInitialized&&D__namespace.canvas.remove(f);},canvasComponentExists:f=>D__namespace.canvas.isInitialized?D__namespace.canvas.find(f)!==void 0:false,getVariable:(f,w)=>W__namespace.StorageRegistry.getVariable(f,w),setVariable:(f,w,C)=>W__namespace.StorageRegistry.setVariable(f,w,C),removeVariable:(f,w)=>W__namespace.StorageRegistry.removeVariable(f,w),getFlag:f=>W__namespace.storage.flags.get(f),setFlag:(f,w)=>W__namespace.storage.flags.set(f,w),onLabelClosing:f=>W__namespace.StorageRegistry.clearOldTempVariables(f)}),!p||!T){gt.warn("The canvas element or options are not defined. The canvas will not be initialized.");return}return await D__namespace.canvas.init(p,T,at)}A.init=l;function e(){W__namespace.storage.clear(),D__namespace.canvas.isInitialized&&D__namespace.canvas.clear(),_t__namespace.sound.clear(),O__namespace.narration.clear(),ot__namespace.stepHistory.clear();}A.clear=e;async function i(){let p=D__namespace.canvas.isInitialized?D__namespace.canvas.export():{};return {pixivn_version:Rt,stepData:O__namespace.narration.export(),storageData:await W__namespace.storage.export(),canvasData:p,soundData:_t__namespace.sound.export(),historyData:await ot__namespace.stepHistory.export(),path:Bt()}}A.exportGameState=i;async function s(p){ot__namespace.stepHistory.restore(p.historyData);let T=ot__namespace.stepHistory.lastKey;if(typeof T=="number"){let at=ot__namespace.stepHistory.stepsInfoMap.get(T)||null;await O__namespace.narration.restore(p.stepData,at);}W__namespace.storage.restore(p.storageData);try{D__namespace.canvas.isInitialized&&await D__namespace.canvas.restore(p.canvasData),await _t__namespace.sound.restore(p.soundData);}catch{}await core.GameUnifier.navigate(p.path);}A.restoreGameState=s;async function r(p,T){return A.clear(),await O__namespace.narration.call(p,T)}A.start=r;function o(p){return JSON.parse(p)}A.jsonToGameState=o;function n(p){core.GameUnifier.onEnd=p;}A.onEnd=n;function h(p){return core.GameUnifier.addOnError(p)}A.addOnError=h;function d(p){return core.GameUnifier.removeOnError(p)}A.removeOnError=d;function y(p){O__namespace.NarrationManagerStatic.onStepStart=p;}A.onStepStart=y;function U(p){O__namespace.NarrationManagerStatic.onLoadingLabel=p;}A.onLoadingLabel=U;function S(p){O__namespace.NarrationManagerStatic.onStepEnd=p;}A.onStepEnd=S;function M(p){O__namespace.NarrationManagerStatic.onLabelStarting=p;}A.onLabelStarting=M;function N(p){O__namespace.NarrationManagerStatic.onLabelClosing=p;}A.onLabelClosing=N;function H(p){core.GameUnifier.navigate=p;}A.onNavigate=H;function m(p){return core.GameUnifier.addOnPreContinue(p)}A.addOnPreContinue=m;function v(p){return core.GameUnifier.removeOnPreContinue(p)}A.removeOnPreContinue=v,A.worker={register:p=>worker.GameWorkerManager.register(p),unregister:()=>worker.GameWorkerManager.unregister(),get isAvailable(){return worker.GameWorkerManager.isAvailable}},A.testing=de(A);})(exports.Game||={});var di={characterUtils:Xt__namespace,canvasUtils:D__namespace,narrationUtils:O__namespace,soundUtils:_t__namespace,CANVAS_APP_GAME_LAYER_ALIAS:Kt,PIXIVN_VERSION:Rt,...Yt,...le,canvas:D__namespace.canvas,narration:O__namespace.narration,sound:_t__namespace.sound,storage:W__namespace.storage,tickers:tickers.tickers,history:ot__namespace.stepHistory,Game:exports.Game,GameUnifier:core.GameUnifier};exports.CANVAS_APP_GAME_LAYER_ALIAS=Kt;exports.CachedMap=Dt;exports.PIXIVN_VERSION=Rt;exports.SYSTEM_RESERVED_STORAGE_KEYS=Ee;exports.createExportableElement=he;exports.default=di;Object.keys(D).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return D[k]}})});Object.keys(Xt).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return Xt[k]}})});Object.keys(core).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return core[k]}})});Object.keys(ot).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return ot[k]}})});Object.keys(O).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return O[k]}})});Object.keys(_t).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return _t[k]}})});Object.keys(W).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return W[k]}})});Object.keys(tickers).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return tickers[k]}})});Object.keys(worker).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return worker[k]}})});
|
package/dist/index.d.cts
CHANGED
|
@@ -15,14 +15,17 @@ import { ApplicationOptions } from '@drincs/pixi-vn/pixi.js';
|
|
|
15
15
|
export { AllFederatedEventMap, ApplicationOptions, AssetSrc, AssetsBundle, AssetsManifest, FederatedEvent, LoadParserName, ResolvedAsset, ResolvedSrc, UnresolvedAsset } from '@drincs/pixi-vn/pixi.js';
|
|
16
16
|
import * as soundUtils from '@drincs/pixi-vn/sound';
|
|
17
17
|
export * from '@drincs/pixi-vn/sound';
|
|
18
|
+
export * from '@drincs/pixi-vn/tickers';
|
|
19
|
+
export * from '@drincs/pixi-vn/worker';
|
|
18
20
|
export { C as CachedMap } from './CachedMap-DZLvJAnA.cjs';
|
|
19
|
-
import {
|
|
21
|
+
import { b as CanvasGameState } from './ContainerMemory-DNqSVzLY.cjs';
|
|
20
22
|
import { H as HistoryGameState } from './HistoryGameState-CGfvq5iL.cjs';
|
|
21
23
|
import { S as SoundGameState } from './SoundGameState-C_6ZsQX6.cjs';
|
|
22
24
|
import { S as StorageGameState } from './StorageGameState-C3PGrFPr.cjs';
|
|
23
25
|
import { O as OpenedLabel } from './OpenedLabel-Cmd675NI.cjs';
|
|
24
26
|
import { Devtools } from '@pixi/devtools';
|
|
25
27
|
import 'lru-cache';
|
|
28
|
+
import '@drincs/pixi-vn/filters';
|
|
26
29
|
import '@drincs/pixi-vn';
|
|
27
30
|
import './HistoryStep-WGB6nA4N.cjs';
|
|
28
31
|
import 'microdiff';
|
|
@@ -133,7 +136,7 @@ interface GameTestingActions<T extends {} = {}> {
|
|
|
133
136
|
call?: (label: narrationUtils.LabelAbstract<any, T> | narrationUtils.LabelIdType, props?: T) => Promise<narrationUtils.StepLabelResultType>;
|
|
134
137
|
}
|
|
135
138
|
|
|
136
|
-
var version = "1.9.
|
|
139
|
+
var version = "1.9.4";
|
|
137
140
|
|
|
138
141
|
/**
|
|
139
142
|
* Is a special alias to indicate the game layer.
|
|
@@ -308,7 +311,7 @@ declare namespace Game {
|
|
|
308
311
|
* Get all the game data. It can be used to save the game.
|
|
309
312
|
* @returns The game data
|
|
310
313
|
*/
|
|
311
|
-
function exportGameState(): GameState
|
|
314
|
+
function exportGameState(): Promise<GameState>;
|
|
312
315
|
/**
|
|
313
316
|
* Load the save data
|
|
314
317
|
* @param data The save data object to restore the game state from.
|
|
@@ -468,6 +471,42 @@ declare namespace Game {
|
|
|
468
471
|
*/
|
|
469
472
|
function addOnPreContinue(handler: () => Promise<void> | void): void;
|
|
470
473
|
function removeOnPreContinue(handler: () => Promise<void> | void): void;
|
|
474
|
+
/**
|
|
475
|
+
* Optional integration point for offloading Pixi'VN's own heavy, pure computations (state
|
|
476
|
+
* diffing/restoring/cloning for `stepHistory.back()`/`add()`/`export()`) to a Worker the game
|
|
477
|
+
* project provides. Pixi'VN never creates a Worker itself, decides on its own which eligible
|
|
478
|
+
* work actually goes through it, and falls back to computing the same thing synchronously
|
|
479
|
+
* on the main thread whenever none is registered - so projects that can't or don't want to
|
|
480
|
+
* use Workers (SSR, certain embeds, ...) are unaffected either way.
|
|
481
|
+
*
|
|
482
|
+
* The game project stays in control of the actual `new Worker(...)` call (bundler-specific
|
|
483
|
+
* URL/`type: "module"` handling, CSP, lifecycle) and only needs to point that worker's
|
|
484
|
+
* message handling at `handleGameWorkerMessage` from `@drincs/pixi-vn/worker`:
|
|
485
|
+
*
|
|
486
|
+
* ```ts
|
|
487
|
+
* // main thread
|
|
488
|
+
* import { Game } from "@drincs/pixi-vn";
|
|
489
|
+
* const worker = new Worker(new URL("./game-worker.ts", import.meta.url), { type: "module" });
|
|
490
|
+
* Game.worker.register(worker);
|
|
491
|
+
*
|
|
492
|
+
* // game-worker.ts
|
|
493
|
+
* import { handleGameWorkerMessage } from "@drincs/pixi-vn/worker";
|
|
494
|
+
* self.onmessage = async (event) => {
|
|
495
|
+
* const response = await handleGameWorkerMessage(event.data);
|
|
496
|
+
* if (response) self.postMessage(response);
|
|
497
|
+
* };
|
|
498
|
+
* ```
|
|
499
|
+
*
|
|
500
|
+
* A third-party library built on top of Pixi'VN (one with `@drincs/pixi-vn` as a peer
|
|
501
|
+
* dependency) can share this same worker for its own heavy, pure computations instead of
|
|
502
|
+
* needing one of its own - see `registerGameWorkerHandler` (worker side) and
|
|
503
|
+
* `GameWorkerManager.custom` (main-thread side), both from `@drincs/pixi-vn/worker`.
|
|
504
|
+
*/
|
|
505
|
+
const worker: {
|
|
506
|
+
register: (worker: Worker) => void;
|
|
507
|
+
unregister: () => void;
|
|
508
|
+
readonly isAvailable: boolean;
|
|
509
|
+
};
|
|
471
510
|
/**
|
|
472
511
|
* Lets an AI agent (or any external script/browser console) drive and inspect a running game
|
|
473
512
|
* through `window`, without needing to know the app's own UI wiring. Not enabled by default —
|
|
@@ -501,6 +540,7 @@ declare const _default: {
|
|
|
501
540
|
narration: narrationUtils.NarrationManagerInterface;
|
|
502
541
|
sound: soundUtils.SoundManagerInterface;
|
|
503
542
|
storage: storageUtils.StorageManagerInterface;
|
|
543
|
+
tickers: canvasUtils.CanvasTickersInterface;
|
|
504
544
|
history: historyUtils.HistoryManagerInterface;
|
|
505
545
|
Game: typeof Game;
|
|
506
546
|
GameUnifier: typeof GameUnifier;
|
package/dist/index.d.ts
CHANGED
|
@@ -15,14 +15,17 @@ import { ApplicationOptions } from '@drincs/pixi-vn/pixi.js';
|
|
|
15
15
|
export { AllFederatedEventMap, ApplicationOptions, AssetSrc, AssetsBundle, AssetsManifest, FederatedEvent, LoadParserName, ResolvedAsset, ResolvedSrc, UnresolvedAsset } from '@drincs/pixi-vn/pixi.js';
|
|
16
16
|
import * as soundUtils from '@drincs/pixi-vn/sound';
|
|
17
17
|
export * from '@drincs/pixi-vn/sound';
|
|
18
|
+
export * from '@drincs/pixi-vn/tickers';
|
|
19
|
+
export * from '@drincs/pixi-vn/worker';
|
|
18
20
|
export { C as CachedMap } from './CachedMap-DZLvJAnA.js';
|
|
19
|
-
import {
|
|
21
|
+
import { b as CanvasGameState } from './ContainerMemory-DNqSVzLY.js';
|
|
20
22
|
import { H as HistoryGameState } from './HistoryGameState-C8ATx9K6.js';
|
|
21
23
|
import { S as SoundGameState } from './SoundGameState-C_6ZsQX6.js';
|
|
22
24
|
import { S as StorageGameState } from './StorageGameState-jAexrJLj.js';
|
|
23
25
|
import { O as OpenedLabel } from './OpenedLabel-CmRdzTXP.js';
|
|
24
26
|
import { Devtools } from '@pixi/devtools';
|
|
25
27
|
import 'lru-cache';
|
|
28
|
+
import '@drincs/pixi-vn/filters';
|
|
26
29
|
import '@drincs/pixi-vn';
|
|
27
30
|
import './HistoryStep-WGB6nA4N.js';
|
|
28
31
|
import 'microdiff';
|
|
@@ -133,7 +136,7 @@ interface GameTestingActions<T extends {} = {}> {
|
|
|
133
136
|
call?: (label: narrationUtils.LabelAbstract<any, T> | narrationUtils.LabelIdType, props?: T) => Promise<narrationUtils.StepLabelResultType>;
|
|
134
137
|
}
|
|
135
138
|
|
|
136
|
-
var version = "1.9.
|
|
139
|
+
var version = "1.9.4";
|
|
137
140
|
|
|
138
141
|
/**
|
|
139
142
|
* Is a special alias to indicate the game layer.
|
|
@@ -308,7 +311,7 @@ declare namespace Game {
|
|
|
308
311
|
* Get all the game data. It can be used to save the game.
|
|
309
312
|
* @returns The game data
|
|
310
313
|
*/
|
|
311
|
-
function exportGameState(): GameState
|
|
314
|
+
function exportGameState(): Promise<GameState>;
|
|
312
315
|
/**
|
|
313
316
|
* Load the save data
|
|
314
317
|
* @param data The save data object to restore the game state from.
|
|
@@ -468,6 +471,42 @@ declare namespace Game {
|
|
|
468
471
|
*/
|
|
469
472
|
function addOnPreContinue(handler: () => Promise<void> | void): void;
|
|
470
473
|
function removeOnPreContinue(handler: () => Promise<void> | void): void;
|
|
474
|
+
/**
|
|
475
|
+
* Optional integration point for offloading Pixi'VN's own heavy, pure computations (state
|
|
476
|
+
* diffing/restoring/cloning for `stepHistory.back()`/`add()`/`export()`) to a Worker the game
|
|
477
|
+
* project provides. Pixi'VN never creates a Worker itself, decides on its own which eligible
|
|
478
|
+
* work actually goes through it, and falls back to computing the same thing synchronously
|
|
479
|
+
* on the main thread whenever none is registered - so projects that can't or don't want to
|
|
480
|
+
* use Workers (SSR, certain embeds, ...) are unaffected either way.
|
|
481
|
+
*
|
|
482
|
+
* The game project stays in control of the actual `new Worker(...)` call (bundler-specific
|
|
483
|
+
* URL/`type: "module"` handling, CSP, lifecycle) and only needs to point that worker's
|
|
484
|
+
* message handling at `handleGameWorkerMessage` from `@drincs/pixi-vn/worker`:
|
|
485
|
+
*
|
|
486
|
+
* ```ts
|
|
487
|
+
* // main thread
|
|
488
|
+
* import { Game } from "@drincs/pixi-vn";
|
|
489
|
+
* const worker = new Worker(new URL("./game-worker.ts", import.meta.url), { type: "module" });
|
|
490
|
+
* Game.worker.register(worker);
|
|
491
|
+
*
|
|
492
|
+
* // game-worker.ts
|
|
493
|
+
* import { handleGameWorkerMessage } from "@drincs/pixi-vn/worker";
|
|
494
|
+
* self.onmessage = async (event) => {
|
|
495
|
+
* const response = await handleGameWorkerMessage(event.data);
|
|
496
|
+
* if (response) self.postMessage(response);
|
|
497
|
+
* };
|
|
498
|
+
* ```
|
|
499
|
+
*
|
|
500
|
+
* A third-party library built on top of Pixi'VN (one with `@drincs/pixi-vn` as a peer
|
|
501
|
+
* dependency) can share this same worker for its own heavy, pure computations instead of
|
|
502
|
+
* needing one of its own - see `registerGameWorkerHandler` (worker side) and
|
|
503
|
+
* `GameWorkerManager.custom` (main-thread side), both from `@drincs/pixi-vn/worker`.
|
|
504
|
+
*/
|
|
505
|
+
const worker: {
|
|
506
|
+
register: (worker: Worker) => void;
|
|
507
|
+
unregister: () => void;
|
|
508
|
+
readonly isAvailable: boolean;
|
|
509
|
+
};
|
|
471
510
|
/**
|
|
472
511
|
* Lets an AI agent (or any external script/browser console) drive and inspect a running game
|
|
473
512
|
* through `window`, without needing to know the app's own UI wiring. Not enabled by default —
|
|
@@ -501,6 +540,7 @@ declare const _default: {
|
|
|
501
540
|
narration: narrationUtils.NarrationManagerInterface;
|
|
502
541
|
sound: soundUtils.SoundManagerInterface;
|
|
503
542
|
storage: storageUtils.StorageManagerInterface;
|
|
543
|
+
tickers: canvasUtils.CanvasTickersInterface;
|
|
504
544
|
history: historyUtils.HistoryManagerInterface;
|
|
505
545
|
Game: typeof Game;
|
|
506
546
|
GameUnifier: typeof GameUnifier;
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {f,b,g,e,d,h,i}from'./chunk-K7JIC2F2.mjs';import*as k from'@drincs/pixi-vn/canvas';export*from'@drincs/pixi-vn/canvas';import*as Bt from'@drincs/pixi-vn/characters';export*from'@drincs/pixi-vn/characters';import {PixiError,GameUnifier}from'@drincs/pixi-vn/core';export*from'@drincs/pixi-vn/core';import*as ot 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 gt from'@drincs/pixi-vn/sound';export*from'@drincs/pixi-vn/sound';import*as K from'@drincs/pixi-vn/storage';export*from'@drincs/pixi-vn/storage';import {motion}from'@drincs/pixi-vn/motion';var ue=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Qt=new Set,Ft=typeof process=="object"&&process?process:{},Zt=(g,e,i,s)=>{typeof Ft.emitWarning=="function"?Ft.emitWarning(g,e,i,s):console.error(`[${i}] ${e}: ${g}`);},Gt=globalThis.AbortController,$t=globalThis.AbortSignal;if(typeof Gt>"u"){$t=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,s){this._onabort.push(s);}},Gt=class{constructor(){e();}signal=new $t;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 g=Ft.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{g&&(g=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 fe=g=>!Qt.has(g);var ct=g=>g&&g===Math.floor(g)&&g>0&&isFinite(g),te=g=>ct(g)?g<=Math.pow(2,8)?Uint8Array:g<=Math.pow(2,16)?Uint16Array:g<=Math.pow(2,32)?Uint32Array:g<=Number.MAX_SAFE_INTEGER?Pt:null:null,Pt=class extends Array{constructor(g){super(g),this.fill(0);}},at,bt,me=(at=class{heap;length;static create(e){let i=te(e);if(!i)return [];g(at,bt,true);let s=new at(e,i);return g(at,bt,false),s}constructor(e$1,i){if(!e(at,bt))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]}},bt=new WeakMap,f(at,bt,false),at),Xt,Jt,J,W,Q,_t,Z,St,Tt,tt,I,et,R,x,m,z,Y,M,C,it,G,st,rt,q,B,nt,ft,V,wt,a,Mt,vt,lt,At,$,ie,yt,xt,Ot,dt,pt,zt,It,Ct,w,Vt,Ut,ut,Ht,Et,ee=(Et=class{constructor(e$1){f(this,a);f(this,J);f(this,W);f(this,Q);f(this,_t);f(this,Z);f(this,St);f(this,Tt);f(this,tt);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(this,I);f(this,et);f(this,R);f(this,x);f(this,m);f(this,z);f(this,Y);f(this,M);f(this,C);f(this,it);f(this,G);f(this,st);f(this,rt);f(this,q);f(this,B);f(this,nt);f(this,ft);f(this,V);f(this,wt);f(this,vt,()=>{});f(this,lt,()=>{});f(this,At,()=>{});f(this,$,()=>false);f(this,yt,e=>{});f(this,xt,(e,i,s)=>{});f(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:o,updateAgeOnGet:n,updateAgeOnHas:l,allowStale:c,dispose:y,onInsert:O,disposeAfter:S,noDisposeOnSet:j,noUpdateTTL:D,maxSize:H=0,maxEntrySize:u=0,sizeCalculation:_,fetchMethod:f$1,memoMethod:U,noDeleteOnFetchRejection:d$1,noDeleteOnStaleGet:E,allowStaleOnFetchRejection:T,allowStaleOnFetchAbort:v,ignoreFetchAbort:A,perf:F}=e$1;if(F!==void 0&&typeof F?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(g(this,tt,F??ue),i!==0&&!ct(i))throw new TypeError("max option must be a nonnegative integer");let X=i?te(i):Array;if(!X)throw new Error("invalid max value: "+i);if(g(this,J,i),g(this,W,H),this.maxEntrySize=u||e(this,W),this.sizeCalculation=_,this.sizeCalculation){if(!e(this,W)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(U!==void 0&&typeof U!="function")throw new TypeError("memoMethod must be a function if defined");if(g(this,Tt,U),f$1!==void 0&&typeof f$1!="function")throw new TypeError("fetchMethod must be a function if specified");if(g(this,St,f$1),g(this,ft,!!f$1),g(this,R,new Map),g(this,x,new Array(i).fill(void 0)),g(this,m,new Array(i).fill(void 0)),g(this,z,new X(i)),g(this,Y,new X(i)),g(this,M,0),g(this,C,0),g(this,it,me.create(i)),g(this,I,0),g(this,et,0),typeof y=="function"&&g(this,Q,y),typeof O=="function"&&g(this,_t,O),typeof S=="function"?(g(this,Z,S),g(this,G,[])):(g(this,Z,void 0),g(this,G,void 0)),g(this,nt,!!e(this,Q)),g(this,wt,!!e(this,_t)),g(this,V,!!e(this,Z)),this.noDisposeOnSet=!!j,this.noUpdateTTL=!!D,this.noDeleteOnFetchRejection=!!d$1,this.allowStaleOnFetchRejection=!!T,this.allowStaleOnFetchAbort=!!v,this.ignoreFetchAbort=!!A,this.maxEntrySize!==0){if(e(this,W)!==0&&!ct(e(this,W)))throw new TypeError("maxSize must be a positive integer if specified");if(!ct(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");h(this,a,ie).call(this);}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!E,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!l,this.ttlResolution=ct(r)||r===0?r:1,this.ttlAutopurge=!!o,this.ttl=s||0,this.ttl){if(!ct(this.ttl))throw new TypeError("ttl must be a positive integer if specified");h(this,a,Mt).call(this);}if(e(this,J)===0&&this.ttl===0&&e(this,W)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!e(this,J)&&!e(this,W)){let jt="LRU_CACHE_UNBOUNDED";fe(jt)&&(Qt.add(jt),Zt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",jt,Et));}}get perf(){return e(this,tt)}static unsafeExposeInternals(e$1){return {starts:e(e$1,rt),ttls:e(e$1,q),autopurgeTimers:e(e$1,B),sizes:e(e$1,st),keyMap:e(e$1,R),keyList:e(e$1,x),valList:e(e$1,m),next:e(e$1,z),prev:e(e$1,Y),get head(){return e(e$1,M)},get tail(){return e(e$1,C)},free:e(e$1,it),isBackgroundFetch:i=>{var s;return h(s=e$1,a,w).call(s,i)},backgroundFetch:(i,s,r,o)=>{var n;return h(n=e$1,a,Ct).call(n,i,s,r,o)},moveToTail:i=>{var s;return h(s=e$1,a,Ut).call(s,i)},indexes:i=>{var s;return h(s=e$1,a,dt).call(s,i)},rindexes:i=>{var s;return h(s=e$1,a,pt).call(s,i)},isStale:i=>{var s;return e(s=e$1,$).call(s,i)}}}get max(){return e(this,J)}get maxSize(){return e(this,W)}get calculatedSize(){return e(this,et)}get size(){return e(this,I)}get fetchMethod(){return e(this,St)}get memoMethod(){return e(this,Tt)}get dispose(){return e(this,Q)}get onInsert(){return e(this,_t)}get disposeAfter(){return e(this,Z)}getRemainingTTL(e$1){return e(this,R).has(e$1)?1/0:0}*entries(){for(let e$1 of h(this,a,dt).call(this))e(this,m)[e$1]!==void 0&&e(this,x)[e$1]!==void 0&&!h(this,a,w).call(this,e(this,m)[e$1])&&(yield [e(this,x)[e$1],e(this,m)[e$1]]);}*rentries(){for(let e$1 of h(this,a,pt).call(this))e(this,m)[e$1]!==void 0&&e(this,x)[e$1]!==void 0&&!h(this,a,w).call(this,e(this,m)[e$1])&&(yield [e(this,x)[e$1],e(this,m)[e$1]]);}*keys(){for(let e$1 of h(this,a,dt).call(this)){let i=e(this,x)[e$1];i!==void 0&&!h(this,a,w).call(this,e(this,m)[e$1])&&(yield i);}}*rkeys(){for(let e$1 of h(this,a,pt).call(this)){let i=e(this,x)[e$1];i!==void 0&&!h(this,a,w).call(this,e(this,m)[e$1])&&(yield i);}}*values(){for(let e$1 of h(this,a,dt).call(this))e(this,m)[e$1]!==void 0&&!h(this,a,w).call(this,e(this,m)[e$1])&&(yield e(this,m)[e$1]);}*rvalues(){for(let e$1 of h(this,a,pt).call(this))e(this,m)[e$1]!==void 0&&!h(this,a,w).call(this,e(this,m)[e$1])&&(yield e(this,m)[e$1]);}[(Jt=Symbol.iterator,Xt=Symbol.toStringTag,Jt)](){return this.entries()}find(e$1,i={}){for(let s of h(this,a,dt).call(this)){let r=e(this,m)[s],o=h(this,a,w).call(this,r)?r.__staleWhileFetching:r;if(o!==void 0&&e$1(o,e(this,x)[s],this))return this.get(e(this,x)[s],i)}}forEach(e$1,i=this){for(let s of h(this,a,dt).call(this)){let r=e(this,m)[s],o=h(this,a,w).call(this,r)?r.__staleWhileFetching:r;o!==void 0&&e$1.call(i,o,e(this,x)[s],this);}}rforEach(e$1,i=this){for(let s of h(this,a,pt).call(this)){let r=e(this,m)[s],o=h(this,a,w).call(this,r)?r.__staleWhileFetching:r;o!==void 0&&e$1.call(i,o,e(this,x)[s],this);}}purgeStale(){let e$1=false;for(let i of h(this,a,pt).call(this,{allowStale:true}))e(this,$).call(this,i)&&(h(this,a,ut).call(this,e(this,x)[i],"expire"),e$1=true);return e$1}info(e$1){let i=e(this,R).get(e$1);if(i===void 0)return;let s=e(this,m)[i],r=h(this,a,w).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let o={value:r};if(e(this,q)&&e(this,rt)){let n=e(this,q)[i],l=e(this,rt)[i];if(n&&l){let c=n-(e(this,tt).now()-l);o.ttl=c,o.start=Date.now();}}return e(this,st)&&(o.size=e(this,st)[i]),o}dump(){let e$1=[];for(let i of h(this,a,dt).call(this,{allowStale:true})){let s=e(this,x)[i],r=e(this,m)[i],o=h(this,a,w).call(this,r)?r.__staleWhileFetching:r;if(o===void 0||s===void 0)continue;let n={value:o};if(e(this,q)&&e(this,rt)){n.ttl=e(this,q)[i];let l=e(this,tt).now()-e(this,rt)[i];n.start=Math.floor(Date.now()-l);}e(this,st)&&(n.size=e(this,st)[i]),e$1.unshift([s,n]);}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,tt).now()-r;}this.set(i,s.value,s);}}set(e$1,i$1,s={}){var j,D,H,u;if(i$1===void 0)return this.delete(e$1),this;let{ttl:r=this.ttl,start:o,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:l=this.sizeCalculation,status:c}=s,{noUpdateTTL:y=this.noUpdateTTL}=s,O=e(this,Ot).call(this,e$1,i$1,s.size||0,l);if(this.maxEntrySize&&O>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=true),h(this,a,ut).call(this,e$1,"set"),this;let S=e(this,I)===0?void 0:e(this,R).get(e$1);if(S===void 0)S=e(this,I)===0?e(this,C):e(this,it).length!==0?e(this,it).pop():e(this,I)===e(this,J)?h(this,a,It).call(this,false):e(this,I),e(this,x)[S]=e$1,e(this,m)[S]=i$1,e(this,R).set(e$1,S),e(this,z)[e(this,C)]=S,e(this,Y)[S]=e(this,C),g(this,C,S),i(this,I)._++,e(this,xt).call(this,S,O,c),c&&(c.set="add"),y=false,e(this,wt)&&((j=e(this,_t))==null||j.call(this,i$1,e$1,"add"));else {h(this,a,Ut).call(this,S);let _=e(this,m)[S];if(i$1!==_){if(e(this,ft)&&h(this,a,w).call(this,_)){_.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:f}=_;f!==void 0&&!n&&(e(this,nt)&&((D=e(this,Q))==null||D.call(this,f,e$1,"set")),e(this,V)&&e(this,G)?.push([f,e$1,"set"]));}else n||(e(this,nt)&&((H=e(this,Q))==null||H.call(this,_,e$1,"set")),e(this,V)&&e(this,G)?.push([_,e$1,"set"]));if(e(this,yt).call(this,S),e(this,xt).call(this,S,O,c),e(this,m)[S]=i$1,c){c.set="replace";let f=_&&h(this,a,w).call(this,_)?_.__staleWhileFetching:_;f!==void 0&&(c.oldValue=f);}}else c&&(c.set="update");e(this,wt)&&this.onInsert?.(i$1,e$1,i$1===_?"update":"replace");}if(r!==0&&!e(this,q)&&h(this,a,Mt).call(this),e(this,q)&&(y||e(this,At).call(this,S,r,o),c&&e(this,lt).call(this,c,S)),!n&&e(this,V)&&e(this,G)){let _=e(this,G),f;for(;f=_?.shift();)(u=e(this,Z))==null||u.call(this,...f);}return this}pop(){var e$1;try{for(;e(this,I);){let i=e(this,m)[e(this,M)];if(h(this,a,It).call(this,!0),h(this,a,w).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(e(this,V)&&e(this,G)){let i=e(this,G),s;for(;s=i?.shift();)(e$1=e(this,Z))==null||e$1.call(this,...s);}}}has(e$1,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,o=e(this,R).get(e$1);if(o!==void 0){let n=e(this,m)[o];if(h(this,a,w).call(this,n)&&n.__staleWhileFetching===void 0)return false;if(e(this,$).call(this,o))r&&(r.has="stale",e(this,lt).call(this,r,o));else return s&&e(this,vt).call(this,o),r&&(r.has="hit",e(this,lt).call(this,r,o)),true}else r&&(r.has="miss");return false}peek(e$1,i={}){let{allowStale:s=this.allowStale}=i,r=e(this,R).get(e$1);if(r===void 0||!s&&e(this,$).call(this,r))return;let o=e(this,m)[r];return h(this,a,w).call(this,o)?o.__staleWhileFetching:o}async fetch(e$1,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:l=this.noDisposeOnSet,size:c=0,sizeCalculation:y=this.sizeCalculation,noUpdateTTL:O=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:j=this.allowStaleOnFetchRejection,ignoreFetchAbort:D=this.ignoreFetchAbort,allowStaleOnFetchAbort:H=this.allowStaleOnFetchAbort,context:u,forceRefresh:_=false,status:f,signal:U}=i;if(!e(this,ft))return f&&(f.fetch="get"),this.get(e$1,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:o,status:f});let d={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:o,ttl:n,noDisposeOnSet:l,size:c,sizeCalculation:y,noUpdateTTL:O,noDeleteOnFetchRejection:S,allowStaleOnFetchRejection:j,allowStaleOnFetchAbort:H,ignoreFetchAbort:D,status:f,signal:U},E=e(this,R).get(e$1);if(E===void 0){f&&(f.fetch="miss");let T=h(this,a,Ct).call(this,e$1,E,d,u);return T.__returned=T}else {let T=e(this,m)[E];if(h(this,a,w).call(this,T)){let X=s&&T.__staleWhileFetching!==void 0;return f&&(f.fetch="inflight",X&&(f.returnedStale=true)),X?T.__staleWhileFetching:T.__returned=T}let v=e(this,$).call(this,E);if(!_&&!v)return f&&(f.fetch="hit"),h(this,a,Ut).call(this,E),r&&e(this,vt).call(this,E),f&&e(this,lt).call(this,f,E),T;let A=h(this,a,Ct).call(this,e$1,E,d,u),F=A.__staleWhileFetching!==void 0&&s;return f&&(f.fetch=v?"stale":"refresh",F&&v&&(f.returnedStale=true)),F?A.__staleWhileFetching:A.__returned=A}}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,Tt);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:o,...n}=i,l=this.get(e$1,n);if(!o&&l!==void 0)return l;let c=s(e$1,l,{options:n,context:r});return this.set(e$1,c,n),c}get(e$1,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:n}=i,l=e(this,R).get(e$1);if(l!==void 0){let c=e(this,m)[l],y=h(this,a,w).call(this,c);return n&&e(this,lt).call(this,n,l),e(this,$).call(this,l)?(n&&(n.get="stale"),y?(n&&s&&c.__staleWhileFetching!==void 0&&(n.returnedStale=true),s?c.__staleWhileFetching:void 0):(o||h(this,a,ut).call(this,e$1,"expire"),n&&s&&(n.returnedStale=true),s?c:void 0)):(n&&(n.get="hit"),y?c.__staleWhileFetching:(h(this,a,Ut).call(this,l),r&&e(this,vt).call(this,l),c))}else n&&(n.get="miss");}delete(e){return h(this,a,ut).call(this,e,"delete")}clear(){return h(this,a,Ht).call(this,"delete")}},J=new WeakMap,W=new WeakMap,Q=new WeakMap,_t=new WeakMap,Z=new WeakMap,St=new WeakMap,Tt=new WeakMap,tt=new WeakMap,I=new WeakMap,et=new WeakMap,R=new WeakMap,x=new WeakMap,m=new WeakMap,z=new WeakMap,Y=new WeakMap,M=new WeakMap,C=new WeakMap,it=new WeakMap,G=new WeakMap,st=new WeakMap,rt=new WeakMap,q=new WeakMap,B=new WeakMap,nt=new WeakMap,ft=new WeakMap,V=new WeakMap,wt=new WeakMap,a=new WeakSet,Mt=function(){let e$1=new Pt(e(this,J)),i=new Pt(e(this,J));g(this,q,e$1),g(this,rt,i);let s=this.ttlAutopurge?new Array(e(this,J)):void 0;g(this,B,s),g(this,At,(l,c,y=e(this,tt).now())=>{i[l]=c!==0?y:0,e$1[l]=c,r(l,c);}),g(this,vt,l=>{i[l]=e$1[l]!==0?e(this,tt).now():0,r(l,e$1[l]);});let r=this.ttlAutopurge?(l,c)=>{if(s?.[l]&&(clearTimeout(s[l]),s[l]=void 0),c&&c!==0&&s){let y=setTimeout(()=>{e(this,$).call(this,l)&&h(this,a,ut).call(this,e(this,x)[l],"expire");},c+1);y.unref&&y.unref(),s[l]=y;}}:()=>{};g(this,lt,(l,c)=>{if(e$1[c]){let y=e$1[c],O=i[c];if(!y||!O)return;l.ttl=y,l.start=O,l.now=o||n();let S=l.now-O;l.remainingTTL=y-S;}});let o=0,n=()=>{let l=e(this,tt).now();if(this.ttlResolution>0){o=l;let c=setTimeout(()=>o=0,this.ttlResolution);c.unref&&c.unref();}return l};this.getRemainingTTL=l=>{let c=e(this,R).get(l);if(c===void 0)return 0;let y=e$1[c],O=i[c];if(!y||!O)return 1/0;let S=(o||n())-O;return y-S},g(this,$,l=>{let c=i[l],y=e$1[l];return !!y&&!!c&&(o||n())-c>y});},vt=new WeakMap,lt=new WeakMap,At=new WeakMap,$=new WeakMap,ie=function(){let e$1=new Pt(e(this,J));g(this,et,0),g(this,st,e$1),g(this,yt,i=>{g(this,et,e(this,et)-e$1[i]),e$1[i]=0;}),g(this,Ot,(i,s,r,o)=>{if(h(this,a,w).call(this,s))return 0;if(!ct(r))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(r=o(s,i),!ct(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,xt,(i,s,r)=>{if(e$1[i]=s,e(this,W)){let o=e(this,W)-e$1[i];for(;e(this,et)>o;)h(this,a,It).call(this,true);}g(this,et,e(this,et)+e$1[i]),r&&(r.entrySize=s,r.totalCalculatedSize=e(this,et));});},yt=new WeakMap,xt=new WeakMap,Ot=new WeakMap,dt=function*({allowStale:e$1=this.allowStale}={}){if(e(this,I))for(let i=e(this,C);!(!h(this,a,zt).call(this,i)||((e$1||!e(this,$).call(this,i))&&(yield i),i===e(this,M)));)i=e(this,Y)[i];},pt=function*({allowStale:e$1=this.allowStale}={}){if(e(this,I))for(let i=e(this,M);!(!h(this,a,zt).call(this,i)||((e$1||!e(this,$).call(this,i))&&(yield i),i===e(this,C)));)i=e(this,z)[i];},zt=function(e$1){return e$1!==void 0&&e(this,R).get(e(this,x)[e$1])===e$1},It=function(e$1){var o;let i$1=e(this,M),s=e(this,x)[i$1],r=e(this,m)[i$1];return e(this,ft)&&h(this,a,w).call(this,r)?r.__abortController.abort(new Error("evicted")):(e(this,nt)||e(this,V))&&(e(this,nt)&&((o=e(this,Q))==null||o.call(this,r,s,"evict")),e(this,V)&&e(this,G)?.push([r,s,"evict"])),e(this,yt).call(this,i$1),e(this,B)?.[i$1]&&(clearTimeout(e(this,B)[i$1]),e(this,B)[i$1]=void 0),e$1&&(e(this,x)[i$1]=void 0,e(this,m)[i$1]=void 0,e(this,it).push(i$1)),e(this,I)===1?(g(this,M,g(this,C,0)),e(this,it).length=0):g(this,M,e(this,z)[i$1]),e(this,R).delete(s),i(this,I)._--,i$1},Ct=function(e$1,i,s,r){let o=i===void 0?void 0:e(this,m)[i];if(h(this,a,w).call(this,o))return o;let n=new Gt,{signal:l}=s;l?.addEventListener("abort",()=>n.abort(l.reason),{signal:n.signal});let c={signal:n.signal,options:s,context:r},y=(u,_=false)=>{let{aborted:f}=n.signal,U=s.ignoreFetchAbort&&u!==void 0,d=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&u!==void 0);if(s.status&&(f&&!_?(s.status.fetchAborted=true,s.status.fetchError=n.signal.reason,U&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),f&&!U&&!_)return S(n.signal.reason,d);let E=D,T=e(this,m)[i];return (T===D||U&&_&&T===void 0)&&(u===void 0?E.__staleWhileFetching!==void 0?e(this,m)[i]=E.__staleWhileFetching:h(this,a,ut).call(this,e$1,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e$1,u,c.options))),u},O=u=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=u),S(u,false)),S=(u,_)=>{let{aborted:f}=n.signal,U=f&&s.allowStaleOnFetchAbort,d=U||s.allowStaleOnFetchRejection,E=d||s.noDeleteOnFetchRejection,T=D;if(e(this,m)[i]===D&&(!E||!_&&T.__staleWhileFetching===void 0?h(this,a,ut).call(this,e$1,"fetch"):U||(e(this,m)[i]=T.__staleWhileFetching)),d)return s.status&&T.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),T.__staleWhileFetching;if(T.__returned===T)throw u},j=(u,_)=>{var U;let f=(U=e(this,St))==null?void 0:U.call(this,e$1,o,c);f&&f instanceof Promise&&f.then(d=>u(d===void 0?void 0:d),_),n.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(u(void 0),s.allowStaleOnFetchAbort&&(u=d=>y(d,true)));});};s.status&&(s.status.fetchDispatched=true);let D=new Promise(j).then(y,O),H=Object.assign(D,{__abortController:n,__staleWhileFetching:o,__returned:void 0});return i===void 0?(this.set(e$1,H,{...c.options,status:void 0}),i=e(this,R).get(e$1)):e(this,m)[i]=H,H},w=function(e$1){if(!e(this,ft))return false;let i=e$1;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Gt},Vt=function(e$1,i){e(this,Y)[i]=e$1,e(this,z)[e$1]=i;},Ut=function(e$1){e$1!==e(this,C)&&(e$1===e(this,M)?g(this,M,e(this,z)[e$1]):h(this,a,Vt).call(this,e(this,Y)[e$1],e(this,z)[e$1]),h(this,a,Vt).call(this,e(this,C),e$1),g(this,C,e$1));},ut=function(e$1,i$1){var r,o;let s=false;if(e(this,I)!==0){let n=e(this,R).get(e$1);if(n!==void 0)if(e(this,B)?.[n]&&(clearTimeout(e(this,B)?.[n]),e(this,B)[n]=void 0),s=true,e(this,I)===1)h(this,a,Ht).call(this,i$1);else {e(this,yt).call(this,n);let l=e(this,m)[n];if(h(this,a,w).call(this,l)?l.__abortController.abort(new Error("deleted")):(e(this,nt)||e(this,V))&&(e(this,nt)&&((r=e(this,Q))==null||r.call(this,l,e$1,i$1)),e(this,V)&&e(this,G)?.push([l,e$1,i$1])),e(this,R).delete(e$1),e(this,x)[n]=void 0,e(this,m)[n]=void 0,n===e(this,C))g(this,C,e(this,Y)[n]);else if(n===e(this,M))g(this,M,e(this,z)[n]);else {let c=e(this,Y)[n];e(this,z)[c]=e(this,z)[n];let y=e(this,z)[n];e(this,Y)[y]=e(this,Y)[n];}i(this,I)._--,e(this,it).push(n);}}if(e(this,V)&&e(this,G)?.length){let n=e(this,G),l;for(;l=n?.shift();)(o=e(this,Z))==null||o.call(this,...l);}return s},Ht=function(e$1){var i,s;for(let r of h(this,a,pt).call(this,{allowStale:true})){let o=e(this,m)[r];if(h(this,a,w).call(this,o))o.__abortController.abort(new Error("deleted"));else {let n=e(this,x)[r];e(this,nt)&&((i=e(this,Q))==null||i.call(this,o,n,e$1)),e(this,V)&&e(this,G)?.push([o,n,e$1]);}}if(e(this,R).clear(),e(this,m).fill(void 0),e(this,x).fill(void 0),e(this,q)&&e(this,rt)){e(this,q).fill(0),e(this,rt).fill(0);for(let r of e(this,B)??[])r!==void 0&&clearTimeout(r);e(this,B)?.fill(void 0);}if(e(this,st)&&e(this,st).fill(0),g(this,M,0),g(this,C,0),e(this,it).length=0,g(this,et,0),g(this,I,0),e(this,V)&&e(this,G)){let r=e(this,G),o;for(;o=r?.shift();)(s=e(this,Z))==null||s.call(this,...o);}},Et);var Dt=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 Lt="1.9.2";var kt={version:Lt};var Kt="__game_layer__";var ge={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 Wt={};b(Wt,{createExportableElement:()=>ne});var mt;(r=>(r.log=(o,...n)=>console.log(`[Pixi\u2019VN] ${o}`,...n),r.warn=(o,...n)=>console.warn(`[Pixi\u2019VN] ${o}`,...n),r.error=(o,...n)=>console.error(`[Pixi\u2019VN] ${o}`,...n),r.info=(o,...n)=>console.info(`[Pixi\u2019VN] ${o}`,...n)))(mt||={});function ne(g){try{if(typeof g>"u")return g;let e=JSON.stringify(g);return JSON.parse(e)}catch(e){throw mt.error("Error creating exportable element",g,e),new PixiError("not_json_serializable","Error creating exportable element")}}function ae(g){let e,i={},s={};function r(y){i=y;}function o(y){s=y;}function n(y){e&&l();let O=y?.windowKey??"pixiVN",S=[],j=u=>({...i,...u}),D={Game:g,narration:L.narration,storage:K.storage,stepHistory:ot.stepHistory,get props(){return i},start:(u,_)=>s.start?s.start(u,_):g.start(u,j(_)),continue:(u,_)=>s.continue?s.continue():L.narration.continue(j(u),_),call:(u,_)=>s.call?s.call(u,_):L.narration.call(u,j(_)),jump:(u,_)=>s.jump?s.jump(u,_):L.narration.jump(u,j(_)),selectChoice:(u,_)=>{let f=L.narration.choices.list?.find(U=>U.choiceIndex===u);if(!f){let U=L.narration.choices.list?.map(d=>d.choiceIndex).join(", ")??"none (no choice menu is open)";throw new Error(`Game.testing: no open choice with index ${u}. Available: ${U}`)}return s.selectChoice?s.selectChoice(f):L.narration.choices.select(f,j(_))},setInput:u=>{L.narration.input.value=u;},goBack:(u,_)=>s.back?s.back():ot.stepHistory.back(j(u),_),closeCurrentLabel:()=>L.narration.labels.closeCurrent(),closeAllLabels:()=>L.narration.labels.closeAll(),getState:()=>({dialogue:L.narration.dialogue,dialogueGlue:L.narration.dialogGlue,choices:L.narration.choices.list,input:{isRequired:L.narration.input.isRequired,type:L.narration.input.type,value:L.narration.input.value},canContinue:L.narration.canContinue,canGoBack:ot.stepHistory.canGoBack,labelsOpened:L.narration.labels.opened,currentLabelId:L.narration.labels.current?.id,stepCounter:L.narration.stepCounter}),get errors(){return S.slice()},clearErrors:()=>{S.length=0;}},H=u=>{S.push({error:u,timestamp:Date.now()});};return g.addOnError(H),typeof window<"u"?window[O]=D:mt.warn('Game.testing.enable(): "window" is not defined, so the API was not attached globally (it was still returned).'),e={api:D,windowKey:O,errorHandler:H},D}function l(){e&&(g.removeOnError(e.errorHandler),typeof window<"u"&&window[e.windowKey]===e.api&&delete window[e.windowKey],e=void 0);}function c(){return e!==void 0}return {setProps:r,setActions:o,enable:n,disable:l,isEnabled:c}}var ve=typeof window<"u"&&typeof document<"u",le=[" _______ _ _ _ ____ ____ ____ _____ ","|_ __ \\ (_) (_) | | |_ _| |_ _||_ \\|_ _|"," | |__) |__ _ __ __ \\_| \\ \\ / / | \\ | | "," | ___/[ | [ \\ [ ][ | \\ \\ / / | |\\ \\| | "," _| |_ | | > ' < | | \\ ' / _| |_\\ |_ ",`|_____| [___][__]\`\\_][___] \\_/ |_____|\\____| v${kt.version}`],he=31,ye="background:#2f90da;color:#fff;font-weight:bold;",be="background:#c832bb;color:#fff;font-weight:bold;",Se="background:transparent;font-weight:bold;",Yt=` v${kt.version}`;function ce(){if(!ve)return;let g=[],e=[];for(let i=0;i<le.length;i++){let s=le[i],r=s.endsWith(Yt),o=r?s.slice(0,-Yt.length):s,n=o.slice(0,he),l=o.slice(he),c=r?"%c%s%c%s%c%s":"%c%s%c%s";g.push(c),e.push(ye,n,be,l),r&&e.push(Se,Yt);}console.info(g.join(`
|
|
2
|
-
`),...e);}function qt(){let
|
|
1
|
+
import {f,b,g as g$1,e,d,h,i}from'./chunk-K7JIC2F2.mjs';import*as D 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 ot from'@drincs/pixi-vn/history';export*from'@drincs/pixi-vn/history';import*as O from'@drincs/pixi-vn/narration';export*from'@drincs/pixi-vn/narration';import*as _t from'@drincs/pixi-vn/sound';export*from'@drincs/pixi-vn/sound';import*as W from'@drincs/pixi-vn/storage';export*from'@drincs/pixi-vn/storage';import {tickers as tickers$1}from'@drincs/pixi-vn/tickers';export*from'@drincs/pixi-vn/tickers';import {GameWorkerManager}from'@drincs/pixi-vn/worker';export*from'@drincs/pixi-vn/worker';import {motion}from'@drincs/pixi-vn/motion';var ve=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Zt=new Set,Ft=typeof process=="object"&&process?process:{},te=(_,e,i,s)=>{typeof Ft.emitWarning=="function"?Ft.emitWarning(_,e,i,s):console.error(`[${i}] ${e}: ${_}`);},jt=globalThis.AbortController,Xt=globalThis.AbortSignal;if(typeof jt>"u"){Xt=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,s){this._onabort.push(s);}},jt=class{constructor(){e();}signal=new Xt;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 _=Ft.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{_&&(_=false,te("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e));};}var ye=_=>!Zt.has(_);var dt=_=>_&&_===Math.floor(_)&&_>0&&isFinite(_),ee=_=>dt(_)?_<=Math.pow(2,8)?Uint8Array:_<=Math.pow(2,16)?Uint16Array:_<=Math.pow(2,32)?Uint32Array:_<=Number.MAX_SAFE_INTEGER?It:null:null,It=class extends Array{constructor(_){super(_),this.fill(0);}},lt,St,be=(lt=class{heap;length;static create(e){let i=ee(e);if(!i)return [];g$1(lt,St,true);let s=new lt(e,i);return g$1(lt,St,false),s}constructor(e$1,i){if(!e(lt,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(lt,St,false),lt),Jt,Qt,X,K,Q,vt,Z,Tt,wt,tt,I,et,R,E,g,k,Y,z,G,it,j,st,rt,q,B,nt,mt,V,xt,a,Mt,yt,ht,Ot,$,se,bt,Et,Lt,pt,ut,zt,Ct,Gt,x,kt,At,ft,Vt,Ut,ie=(Ut=class{constructor(e$1){f(this,a);f(this,X);f(this,K);f(this,Q);f(this,vt);f(this,Z);f(this,Tt);f(this,wt);f(this,tt);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(this,I);f(this,et);f(this,R);f(this,E);f(this,g);f(this,k);f(this,Y);f(this,z);f(this,G);f(this,it);f(this,j);f(this,st);f(this,rt);f(this,q);f(this,B);f(this,nt);f(this,mt);f(this,V);f(this,xt);f(this,yt,()=>{});f(this,ht,()=>{});f(this,Ot,()=>{});f(this,$,()=>false);f(this,bt,e=>{});f(this,Et,(e,i,s)=>{});f(this,Lt,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});d(this,Jt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:o,updateAgeOnGet:n,updateAgeOnHas:l,allowStale:c,dispose:y,onInsert:U,disposeAfter:S,noDisposeOnSet:M,noUpdateTTL:N,maxSize:H=0,maxEntrySize:f$1=0,sizeCalculation:v,fetchMethod:m,memoMethod:L,noDeleteOnFetchRejection:A,noDeleteOnStaleGet:d$1,allowStaleOnFetchRejection:T,allowStaleOnFetchAbort:at,ignoreFetchAbort:u,perf:w}=e$1;if(w!==void 0&&typeof w?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(g$1(this,tt,w??ve),i!==0&&!dt(i))throw new TypeError("max option must be a nonnegative integer");let C=i?ee(i):Array;if(!C)throw new Error("invalid max value: "+i);if(g$1(this,X,i),g$1(this,K,H),this.maxEntrySize=f$1||e(this,K),this.sizeCalculation=v,this.sizeCalculation){if(!e(this,K)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(L!==void 0&&typeof L!="function")throw new TypeError("memoMethod must be a function if defined");if(g$1(this,wt,L),m!==void 0&&typeof m!="function")throw new TypeError("fetchMethod must be a function if specified");if(g$1(this,Tt,m),g$1(this,mt,!!m),g$1(this,R,new Map),g$1(this,E,new Array(i).fill(void 0)),g$1(this,g,new Array(i).fill(void 0)),g$1(this,k,new C(i)),g$1(this,Y,new C(i)),g$1(this,z,0),g$1(this,G,0),g$1(this,it,be.create(i)),g$1(this,I,0),g$1(this,et,0),typeof y=="function"&&g$1(this,Q,y),typeof U=="function"&&g$1(this,vt,U),typeof S=="function"?(g$1(this,Z,S),g$1(this,j,[])):(g$1(this,Z,void 0),g$1(this,j,void 0)),g$1(this,nt,!!e(this,Q)),g$1(this,xt,!!e(this,vt)),g$1(this,V,!!e(this,Z)),this.noDisposeOnSet=!!M,this.noUpdateTTL=!!N,this.noDeleteOnFetchRejection=!!A,this.allowStaleOnFetchRejection=!!T,this.allowStaleOnFetchAbort=!!at,this.ignoreFetchAbort=!!u,this.maxEntrySize!==0){if(e(this,K)!==0&&!dt(e(this,K)))throw new TypeError("maxSize must be a positive integer if specified");if(!dt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");h(this,a,se).call(this);}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!d$1,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!l,this.ttlResolution=dt(r)||r===0?r:1,this.ttlAutopurge=!!o,this.ttl=s||0,this.ttl){if(!dt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");h(this,a,Mt).call(this);}if(e(this,X)===0&&this.ttl===0&&e(this,K)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!e(this,X)&&!e(this,K)){let J="LRU_CACHE_UNBOUNDED";ye(J)&&(Zt.add(J),te("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",J,Ut));}}get perf(){return e(this,tt)}static unsafeExposeInternals(e$1){return {starts:e(e$1,rt),ttls:e(e$1,q),autopurgeTimers:e(e$1,B),sizes:e(e$1,st),keyMap:e(e$1,R),keyList:e(e$1,E),valList:e(e$1,g),next:e(e$1,k),prev:e(e$1,Y),get head(){return e(e$1,z)},get tail(){return e(e$1,G)},free:e(e$1,it),isBackgroundFetch:i=>{var s;return h(s=e$1,a,x).call(s,i)},backgroundFetch:(i,s,r,o)=>{var n;return h(n=e$1,a,Gt).call(n,i,s,r,o)},moveToTail:i=>{var s;return h(s=e$1,a,At).call(s,i)},indexes:i=>{var s;return h(s=e$1,a,pt).call(s,i)},rindexes:i=>{var s;return h(s=e$1,a,ut).call(s,i)},isStale:i=>{var s;return e(s=e$1,$).call(s,i)}}}get max(){return e(this,X)}get maxSize(){return e(this,K)}get calculatedSize(){return e(this,et)}get size(){return e(this,I)}get fetchMethod(){return e(this,Tt)}get memoMethod(){return e(this,wt)}get dispose(){return e(this,Q)}get onInsert(){return e(this,vt)}get disposeAfter(){return e(this,Z)}getRemainingTTL(e$1){return e(this,R).has(e$1)?1/0:0}*entries(){for(let e$1 of h(this,a,pt).call(this))e(this,g)[e$1]!==void 0&&e(this,E)[e$1]!==void 0&&!h(this,a,x).call(this,e(this,g)[e$1])&&(yield [e(this,E)[e$1],e(this,g)[e$1]]);}*rentries(){for(let e$1 of h(this,a,ut).call(this))e(this,g)[e$1]!==void 0&&e(this,E)[e$1]!==void 0&&!h(this,a,x).call(this,e(this,g)[e$1])&&(yield [e(this,E)[e$1],e(this,g)[e$1]]);}*keys(){for(let e$1 of h(this,a,pt).call(this)){let i=e(this,E)[e$1];i!==void 0&&!h(this,a,x).call(this,e(this,g)[e$1])&&(yield i);}}*rkeys(){for(let e$1 of h(this,a,ut).call(this)){let i=e(this,E)[e$1];i!==void 0&&!h(this,a,x).call(this,e(this,g)[e$1])&&(yield i);}}*values(){for(let e$1 of h(this,a,pt).call(this))e(this,g)[e$1]!==void 0&&!h(this,a,x).call(this,e(this,g)[e$1])&&(yield e(this,g)[e$1]);}*rvalues(){for(let e$1 of h(this,a,ut).call(this))e(this,g)[e$1]!==void 0&&!h(this,a,x).call(this,e(this,g)[e$1])&&(yield e(this,g)[e$1]);}[(Qt=Symbol.iterator,Jt=Symbol.toStringTag,Qt)](){return this.entries()}find(e$1,i={}){for(let s of h(this,a,pt).call(this)){let r=e(this,g)[s],o=h(this,a,x).call(this,r)?r.__staleWhileFetching:r;if(o!==void 0&&e$1(o,e(this,E)[s],this))return this.get(e(this,E)[s],i)}}forEach(e$1,i=this){for(let s of h(this,a,pt).call(this)){let r=e(this,g)[s],o=h(this,a,x).call(this,r)?r.__staleWhileFetching:r;o!==void 0&&e$1.call(i,o,e(this,E)[s],this);}}rforEach(e$1,i=this){for(let s of h(this,a,ut).call(this)){let r=e(this,g)[s],o=h(this,a,x).call(this,r)?r.__staleWhileFetching:r;o!==void 0&&e$1.call(i,o,e(this,E)[s],this);}}purgeStale(){let e$1=false;for(let i of h(this,a,ut).call(this,{allowStale:true}))e(this,$).call(this,i)&&(h(this,a,ft).call(this,e(this,E)[i],"expire"),e$1=true);return e$1}info(e$1){let i=e(this,R).get(e$1);if(i===void 0)return;let s=e(this,g)[i],r=h(this,a,x).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let o={value:r};if(e(this,q)&&e(this,rt)){let n=e(this,q)[i],l=e(this,rt)[i];if(n&&l){let c=n-(e(this,tt).now()-l);o.ttl=c,o.start=Date.now();}}return e(this,st)&&(o.size=e(this,st)[i]),o}dump(){let e$1=[];for(let i of h(this,a,pt).call(this,{allowStale:true})){let s=e(this,E)[i],r=e(this,g)[i],o=h(this,a,x).call(this,r)?r.__staleWhileFetching:r;if(o===void 0||s===void 0)continue;let n={value:o};if(e(this,q)&&e(this,rt)){n.ttl=e(this,q)[i];let l=e(this,tt).now()-e(this,rt)[i];n.start=Math.floor(Date.now()-l);}e(this,st)&&(n.size=e(this,st)[i]),e$1.unshift([s,n]);}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,tt).now()-r;}this.set(i,s.value,s);}}set(e$1,i$1,s={}){var M,N,H,f;if(i$1===void 0)return this.delete(e$1),this;let{ttl:r=this.ttl,start:o,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:l=this.sizeCalculation,status:c}=s,{noUpdateTTL:y=this.noUpdateTTL}=s,U=e(this,Lt).call(this,e$1,i$1,s.size||0,l);if(this.maxEntrySize&&U>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=true),h(this,a,ft).call(this,e$1,"set"),this;let S=e(this,I)===0?void 0:e(this,R).get(e$1);if(S===void 0)S=e(this,I)===0?e(this,G):e(this,it).length!==0?e(this,it).pop():e(this,I)===e(this,X)?h(this,a,Ct).call(this,false):e(this,I),e(this,E)[S]=e$1,e(this,g)[S]=i$1,e(this,R).set(e$1,S),e(this,k)[e(this,G)]=S,e(this,Y)[S]=e(this,G),g$1(this,G,S),i(this,I)._++,e(this,Et).call(this,S,U,c),c&&(c.set="add"),y=false,e(this,xt)&&((M=e(this,vt))==null||M.call(this,i$1,e$1,"add"));else {h(this,a,At).call(this,S);let v=e(this,g)[S];if(i$1!==v){if(e(this,mt)&&h(this,a,x).call(this,v)){v.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:m}=v;m!==void 0&&!n&&(e(this,nt)&&((N=e(this,Q))==null||N.call(this,m,e$1,"set")),e(this,V)&&e(this,j)?.push([m,e$1,"set"]));}else n||(e(this,nt)&&((H=e(this,Q))==null||H.call(this,v,e$1,"set")),e(this,V)&&e(this,j)?.push([v,e$1,"set"]));if(e(this,bt).call(this,S),e(this,Et).call(this,S,U,c),e(this,g)[S]=i$1,c){c.set="replace";let m=v&&h(this,a,x).call(this,v)?v.__staleWhileFetching:v;m!==void 0&&(c.oldValue=m);}}else c&&(c.set="update");e(this,xt)&&this.onInsert?.(i$1,e$1,i$1===v?"update":"replace");}if(r!==0&&!e(this,q)&&h(this,a,Mt).call(this),e(this,q)&&(y||e(this,Ot).call(this,S,r,o),c&&e(this,ht).call(this,c,S)),!n&&e(this,V)&&e(this,j)){let v=e(this,j),m;for(;m=v?.shift();)(f=e(this,Z))==null||f.call(this,...m);}return this}pop(){var e$1;try{for(;e(this,I);){let i=e(this,g)[e(this,z)];if(h(this,a,Ct).call(this,!0),h(this,a,x).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(e(this,V)&&e(this,j)){let i=e(this,j),s;for(;s=i?.shift();)(e$1=e(this,Z))==null||e$1.call(this,...s);}}}has(e$1,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,o=e(this,R).get(e$1);if(o!==void 0){let n=e(this,g)[o];if(h(this,a,x).call(this,n)&&n.__staleWhileFetching===void 0)return false;if(e(this,$).call(this,o))r&&(r.has="stale",e(this,ht).call(this,r,o));else return s&&e(this,yt).call(this,o),r&&(r.has="hit",e(this,ht).call(this,r,o)),true}else r&&(r.has="miss");return false}peek(e$1,i={}){let{allowStale:s=this.allowStale}=i,r=e(this,R).get(e$1);if(r===void 0||!s&&e(this,$).call(this,r))return;let o=e(this,g)[r];return h(this,a,x).call(this,o)?o.__staleWhileFetching:o}async fetch(e$1,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:l=this.noDisposeOnSet,size:c=0,sizeCalculation:y=this.sizeCalculation,noUpdateTTL:U=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:M=this.allowStaleOnFetchRejection,ignoreFetchAbort:N=this.ignoreFetchAbort,allowStaleOnFetchAbort:H=this.allowStaleOnFetchAbort,context:f,forceRefresh:v=false,status:m,signal:L}=i;if(!e(this,mt))return m&&(m.fetch="get"),this.get(e$1,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:o,status:m});let A={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:o,ttl:n,noDisposeOnSet:l,size:c,sizeCalculation:y,noUpdateTTL:U,noDeleteOnFetchRejection:S,allowStaleOnFetchRejection:M,allowStaleOnFetchAbort:H,ignoreFetchAbort:N,status:m,signal:L},d=e(this,R).get(e$1);if(d===void 0){m&&(m.fetch="miss");let T=h(this,a,Gt).call(this,e$1,d,A,f);return T.__returned=T}else {let T=e(this,g)[d];if(h(this,a,x).call(this,T)){let C=s&&T.__staleWhileFetching!==void 0;return m&&(m.fetch="inflight",C&&(m.returnedStale=true)),C?T.__staleWhileFetching:T.__returned=T}let at=e(this,$).call(this,d);if(!v&&!at)return m&&(m.fetch="hit"),h(this,a,At).call(this,d),r&&e(this,yt).call(this,d),m&&e(this,ht).call(this,m,d),T;let u=h(this,a,Gt).call(this,e$1,d,A,f),w=u.__staleWhileFetching!==void 0&&s;return m&&(m.fetch=at?"stale":"refresh",w&&at&&(m.returnedStale=true)),w?u.__staleWhileFetching:u.__returned=u}}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,wt);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:o,...n}=i,l=this.get(e$1,n);if(!o&&l!==void 0)return l;let c=s(e$1,l,{options:n,context:r});return this.set(e$1,c,n),c}get(e$1,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:n}=i,l=e(this,R).get(e$1);if(l!==void 0){let c=e(this,g)[l],y=h(this,a,x).call(this,c);return n&&e(this,ht).call(this,n,l),e(this,$).call(this,l)?(n&&(n.get="stale"),y?(n&&s&&c.__staleWhileFetching!==void 0&&(n.returnedStale=true),s?c.__staleWhileFetching:void 0):(o||h(this,a,ft).call(this,e$1,"expire"),n&&s&&(n.returnedStale=true),s?c:void 0)):(n&&(n.get="hit"),y?c.__staleWhileFetching:(h(this,a,At).call(this,l),r&&e(this,yt).call(this,l),c))}else n&&(n.get="miss");}delete(e){return h(this,a,ft).call(this,e,"delete")}clear(){return h(this,a,Vt).call(this,"delete")}},X=new WeakMap,K=new WeakMap,Q=new WeakMap,vt=new WeakMap,Z=new WeakMap,Tt=new WeakMap,wt=new WeakMap,tt=new WeakMap,I=new WeakMap,et=new WeakMap,R=new WeakMap,E=new WeakMap,g=new WeakMap,k=new WeakMap,Y=new WeakMap,z=new WeakMap,G=new WeakMap,it=new WeakMap,j=new WeakMap,st=new WeakMap,rt=new WeakMap,q=new WeakMap,B=new WeakMap,nt=new WeakMap,mt=new WeakMap,V=new WeakMap,xt=new WeakMap,a=new WeakSet,Mt=function(){let e$1=new It(e(this,X)),i=new It(e(this,X));g$1(this,q,e$1),g$1(this,rt,i);let s=this.ttlAutopurge?new Array(e(this,X)):void 0;g$1(this,B,s),g$1(this,Ot,(l,c,y=e(this,tt).now())=>{i[l]=c!==0?y:0,e$1[l]=c,r(l,c);}),g$1(this,yt,l=>{i[l]=e$1[l]!==0?e(this,tt).now():0,r(l,e$1[l]);});let r=this.ttlAutopurge?(l,c)=>{if(s?.[l]&&(clearTimeout(s[l]),s[l]=void 0),c&&c!==0&&s){let y=setTimeout(()=>{e(this,$).call(this,l)&&h(this,a,ft).call(this,e(this,E)[l],"expire");},c+1);y.unref&&y.unref(),s[l]=y;}}:()=>{};g$1(this,ht,(l,c)=>{if(e$1[c]){let y=e$1[c],U=i[c];if(!y||!U)return;l.ttl=y,l.start=U,l.now=o||n();let S=l.now-U;l.remainingTTL=y-S;}});let o=0,n=()=>{let l=e(this,tt).now();if(this.ttlResolution>0){o=l;let c=setTimeout(()=>o=0,this.ttlResolution);c.unref&&c.unref();}return l};this.getRemainingTTL=l=>{let c=e(this,R).get(l);if(c===void 0)return 0;let y=e$1[c],U=i[c];if(!y||!U)return 1/0;let S=(o||n())-U;return y-S},g$1(this,$,l=>{let c=i[l],y=e$1[l];return !!y&&!!c&&(o||n())-c>y});},yt=new WeakMap,ht=new WeakMap,Ot=new WeakMap,$=new WeakMap,se=function(){let e$1=new It(e(this,X));g$1(this,et,0),g$1(this,st,e$1),g$1(this,bt,i=>{g$1(this,et,e(this,et)-e$1[i]),e$1[i]=0;}),g$1(this,Lt,(i,s,r,o)=>{if(h(this,a,x).call(this,s))return 0;if(!dt(r))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(r=o(s,i),!dt(r))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return r}),g$1(this,Et,(i,s,r)=>{if(e$1[i]=s,e(this,K)){let o=e(this,K)-e$1[i];for(;e(this,et)>o;)h(this,a,Ct).call(this,true);}g$1(this,et,e(this,et)+e$1[i]),r&&(r.entrySize=s,r.totalCalculatedSize=e(this,et));});},bt=new WeakMap,Et=new WeakMap,Lt=new WeakMap,pt=function*({allowStale:e$1=this.allowStale}={}){if(e(this,I))for(let i=e(this,G);!(!h(this,a,zt).call(this,i)||((e$1||!e(this,$).call(this,i))&&(yield i),i===e(this,z)));)i=e(this,Y)[i];},ut=function*({allowStale:e$1=this.allowStale}={}){if(e(this,I))for(let i=e(this,z);!(!h(this,a,zt).call(this,i)||((e$1||!e(this,$).call(this,i))&&(yield i),i===e(this,G)));)i=e(this,k)[i];},zt=function(e$1){return e$1!==void 0&&e(this,R).get(e(this,E)[e$1])===e$1},Ct=function(e$1){var o;let i$1=e(this,z),s=e(this,E)[i$1],r=e(this,g)[i$1];return e(this,mt)&&h(this,a,x).call(this,r)?r.__abortController.abort(new Error("evicted")):(e(this,nt)||e(this,V))&&(e(this,nt)&&((o=e(this,Q))==null||o.call(this,r,s,"evict")),e(this,V)&&e(this,j)?.push([r,s,"evict"])),e(this,bt).call(this,i$1),e(this,B)?.[i$1]&&(clearTimeout(e(this,B)[i$1]),e(this,B)[i$1]=void 0),e$1&&(e(this,E)[i$1]=void 0,e(this,g)[i$1]=void 0,e(this,it).push(i$1)),e(this,I)===1?(g$1(this,z,g$1(this,G,0)),e(this,it).length=0):g$1(this,z,e(this,k)[i$1]),e(this,R).delete(s),i(this,I)._--,i$1},Gt=function(e$1,i,s,r){let o=i===void 0?void 0:e(this,g)[i];if(h(this,a,x).call(this,o))return o;let n=new jt,{signal:l}=s;l?.addEventListener("abort",()=>n.abort(l.reason),{signal:n.signal});let c={signal:n.signal,options:s,context:r},y=(f,v=false)=>{let{aborted:m}=n.signal,L=s.ignoreFetchAbort&&f!==void 0,A=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&f!==void 0);if(s.status&&(m&&!v?(s.status.fetchAborted=true,s.status.fetchError=n.signal.reason,L&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),m&&!L&&!v)return S(n.signal.reason,A);let d=N,T=e(this,g)[i];return (T===N||L&&v&&T===void 0)&&(f===void 0?d.__staleWhileFetching!==void 0?e(this,g)[i]=d.__staleWhileFetching:h(this,a,ft).call(this,e$1,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e$1,f,c.options))),f},U=f=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=f),S(f,false)),S=(f,v)=>{let{aborted:m}=n.signal,L=m&&s.allowStaleOnFetchAbort,A=L||s.allowStaleOnFetchRejection,d=A||s.noDeleteOnFetchRejection,T=N;if(e(this,g)[i]===N&&(!d||!v&&T.__staleWhileFetching===void 0?h(this,a,ft).call(this,e$1,"fetch"):L||(e(this,g)[i]=T.__staleWhileFetching)),A)return s.status&&T.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),T.__staleWhileFetching;if(T.__returned===T)throw f},M=(f,v)=>{var L;let m=(L=e(this,Tt))==null?void 0:L.call(this,e$1,o,c);m&&m instanceof Promise&&m.then(A=>f(A===void 0?void 0:A),v),n.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(f(void 0),s.allowStaleOnFetchAbort&&(f=A=>y(A,true)));});};s.status&&(s.status.fetchDispatched=true);let N=new Promise(M).then(y,U),H=Object.assign(N,{__abortController:n,__staleWhileFetching:o,__returned:void 0});return i===void 0?(this.set(e$1,H,{...c.options,status:void 0}),i=e(this,R).get(e$1)):e(this,g)[i]=H,H},x=function(e$1){if(!e(this,mt))return false;let i=e$1;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof jt},kt=function(e$1,i){e(this,Y)[i]=e$1,e(this,k)[e$1]=i;},At=function(e$1){e$1!==e(this,G)&&(e$1===e(this,z)?g$1(this,z,e(this,k)[e$1]):h(this,a,kt).call(this,e(this,Y)[e$1],e(this,k)[e$1]),h(this,a,kt).call(this,e(this,G),e$1),g$1(this,G,e$1));},ft=function(e$1,i$1){var r,o;let s=false;if(e(this,I)!==0){let n=e(this,R).get(e$1);if(n!==void 0)if(e(this,B)?.[n]&&(clearTimeout(e(this,B)?.[n]),e(this,B)[n]=void 0),s=true,e(this,I)===1)h(this,a,Vt).call(this,i$1);else {e(this,bt).call(this,n);let l=e(this,g)[n];if(h(this,a,x).call(this,l)?l.__abortController.abort(new Error("deleted")):(e(this,nt)||e(this,V))&&(e(this,nt)&&((r=e(this,Q))==null||r.call(this,l,e$1,i$1)),e(this,V)&&e(this,j)?.push([l,e$1,i$1])),e(this,R).delete(e$1),e(this,E)[n]=void 0,e(this,g)[n]=void 0,n===e(this,G))g$1(this,G,e(this,Y)[n]);else if(n===e(this,z))g$1(this,z,e(this,k)[n]);else {let c=e(this,Y)[n];e(this,k)[c]=e(this,k)[n];let y=e(this,k)[n];e(this,Y)[y]=e(this,Y)[n];}i(this,I)._--,e(this,it).push(n);}}if(e(this,V)&&e(this,j)?.length){let n=e(this,j),l;for(;l=n?.shift();)(o=e(this,Z))==null||o.call(this,...l);}return s},Vt=function(e$1){var i,s;for(let r of h(this,a,ut).call(this,{allowStale:true})){let o=e(this,g)[r];if(h(this,a,x).call(this,o))o.__abortController.abort(new Error("deleted"));else {let n=e(this,E)[r];e(this,nt)&&((i=e(this,Q))==null||i.call(this,o,n,e$1)),e(this,V)&&e(this,j)?.push([o,n,e$1]);}}if(e(this,R).clear(),e(this,g).fill(void 0),e(this,E).fill(void 0),e(this,q)&&e(this,rt)){e(this,q).fill(0),e(this,rt).fill(0);for(let r of e(this,B)??[])r!==void 0&&clearTimeout(r);e(this,B)?.fill(void 0);}if(e(this,st)&&e(this,st).fill(0),g$1(this,z,0),g$1(this,G,0),e(this,it).length=0,g$1(this,et,0),g$1(this,I,0),e(this,V)&&e(this,j)){let r=e(this,j),o;for(;o=r?.shift();)(s=e(this,Z))==null||s.call(this,...o);}},Ut);var Dt=class{cache;map=new Map;constructor(e){this.cache=new ie({max:e.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){this.cache.clear(),this.map.clear();}delete(e){let i=this.map.delete(e);return i&&this.cache.delete(e),i}get forEach(){return this.map.forEach}get(e){let i=this.cache.get(e);return i||this.map.get(e)}has(e){return this.map.has(e)}set(e,i){return this.map.set(e,i),this.cache.set(e,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var Rt="1.9.4";var Ht={version:Rt};var Wt="__game_layer__";var Se={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 ne={};var Kt={};b(Kt,{createExportableElement:()=>oe});var gt;(r=>(r.log=(o,...n)=>console.log(`[Pixi\u2019VN] ${o}`,...n),r.warn=(o,...n)=>console.warn(`[Pixi\u2019VN] ${o}`,...n),r.error=(o,...n)=>console.error(`[Pixi\u2019VN] ${o}`,...n),r.info=(o,...n)=>console.info(`[Pixi\u2019VN] ${o}`,...n)))(gt||={});function oe(_){try{if(typeof _>"u")return _;let e=JSON.stringify(_);return JSON.parse(e)}catch(e){throw gt.error("Error creating exportable element",_,e),new PixiError("not_json_serializable","Error creating exportable element")}}function le(_){let e,i={},s={};function r(y){i=y;}function o(y){s=y;}function n(y){e&&l();let U=y?.windowKey??"pixiVN",S=[],M=f=>({...i,...f}),N={Game:_,narration:O.narration,storage:W.storage,stepHistory:ot.stepHistory,get props(){return i},start:(f,v)=>s.start?s.start(f,v):_.start(f,M(v)),continue:(f,v)=>s.continue?s.continue():O.narration.continue(M(f),v),call:(f,v)=>s.call?s.call(f,v):O.narration.call(f,M(v)),jump:(f,v)=>s.jump?s.jump(f,v):O.narration.jump(f,M(v)),selectChoice:(f,v)=>{let m=O.narration.choices.list?.find(L=>L.choiceIndex===f);if(!m){let L=O.narration.choices.list?.map(A=>A.choiceIndex).join(", ")??"none (no choice menu is open)";throw new Error(`Game.testing: no open choice with index ${f}. Available: ${L}`)}return s.selectChoice?s.selectChoice(m):O.narration.choices.select(m,M(v))},setInput:f=>{O.narration.input.value=f;},goBack:(f,v)=>s.back?s.back():ot.stepHistory.back(M(f),v),closeCurrentLabel:()=>O.narration.labels.closeCurrent(),closeAllLabels:()=>O.narration.labels.closeAll(),getState:()=>({dialogue:O.narration.dialogue,dialogueGlue:O.narration.dialogGlue,choices:O.narration.choices.list,input:{isRequired:O.narration.input.isRequired,type:O.narration.input.type,value:O.narration.input.value},canContinue:O.narration.canContinue,canGoBack:ot.stepHistory.canGoBack,labelsOpened:O.narration.labels.opened,currentLabelId:O.narration.labels.current?.id,stepCounter:O.narration.stepCounter}),get errors(){return S.slice()},clearErrors:()=>{S.length=0;}},H=f=>{S.push({error:f,timestamp:Date.now()});};return _.addOnError(H),typeof window<"u"?window[U]=N:gt.warn('Game.testing.enable(): "window" is not defined, so the API was not attached globally (it was still returned).'),e={api:N,windowKey:U,errorHandler:H},N}function l(){e&&(_.removeOnError(e.errorHandler),typeof window<"u"&&window[e.windowKey]===e.api&&delete window[e.windowKey],e=void 0);}function c(){return e!==void 0}return {setProps:r,setActions:o,enable:n,disable:l,isEnabled:c}}var we=typeof window<"u"&&typeof document<"u",he=[" _______ _ _ _ ____ ____ ____ _____ ","|_ __ \\ (_) (_) | | |_ _| |_ _||_ \\|_ _|"," | |__) |__ _ __ __ \\_| \\ \\ / / | \\ | | "," | ___/[ | [ \\ [ ][ | \\ \\ / / | |\\ \\| | "," _| |_ | | > ' < | | \\ ' / _| |_\\ |_ ",`|_____| [___][__]\`\\_][___] \\_/ |_____|\\____| v${Ht.version}`],ce=31,xe="background:#2f90da;color:#fff;font-weight:bold;",Ee="background:#c832bb;color:#fff;font-weight:bold;",Ue="background:transparent;font-weight:bold;",Yt=` v${Ht.version}`;function de(){if(!we)return;let _=[],e=[];for(let i=0;i<he.length;i++){let s=he[i],r=s.endsWith(Yt),o=r?s.slice(0,-Yt.length):s,n=o.slice(0,ce),l=o.slice(ce),c=r?"%c%s%c%s%c%s":"%c%s%c%s";_.push(c),e.push(xe,n,Ee,l),r&&e.push(Ue,Yt);}console.info(_.join(`
|
|
2
|
+
`),...e);}function qt(){let _=window.location.pathname+window.location.hash;return _.includes("#")&&(_=_.split("#")[1]),_}de();var ue;(A=>{async function _(d,T,at){if(GameUnifier.init({navigate:T?.navigate,getCurrentGameStepState:async()=>{let u=D.canvas.isInitialized?D.canvas.export():{};return {path:qt(),storage:await W.storage.export(),canvas:u,sound:_t.sound.export(),labelIndex:O.NarrationManagerStatic.currentLabelStepIndex||0,openedLabels:O.narration.openedLabels}},restoreGameStepState:async(u,w)=>{ot.HistoryManagerStatic._originalStepData=u,O.NarrationManagerStatic.openedLabels=u.openedLabels,W.storage.restore(u.storage);try{D.canvas.isInitialized&&await D.canvas.restore(u.canvas),await _t.sound.restore(u.sound);}catch(C){gt.error("Error restoring game step state:",C);}await w(u.path);},getStepCounter:()=>O.narration.stepCounter,setStepCounter:u=>{O.NarrationManagerStatic._stepCounter=u;},getOpenedLabels:()=>O.narration.openedLabels.length,addHistoryItem:(u,w)=>ot.stepHistory.add(u,w),getCharacter:u=>$t.RegisteredCharacters.get(u),processNavigationRequests:(u,w)=>{let C=u,J=Promise.resolve();return u>0?(C--,J=O.narration.continue(w)):u<0&&(C=0,J=ot.stepHistory.back(w,{steps:u*-1})),{newValue:C,result:J}},animate:(u,w,C,J)=>motion.animate(u,w,C,J),animateFilter:(u,w,C,J,fe,me,ge)=>motion.animateFilter(u,w,C,J,fe,me,ge),removeCanvasComponent:u=>{D.canvas.isInitialized&&D.canvas.remove(u);},canvasComponentExists:u=>D.canvas.isInitialized?D.canvas.find(u)!==void 0:false,getVariable:(u,w)=>W.StorageRegistry.getVariable(u,w),setVariable:(u,w,C)=>W.StorageRegistry.setVariable(u,w,C),removeVariable:(u,w)=>W.StorageRegistry.removeVariable(u,w),getFlag:u=>W.storage.flags.get(u),setFlag:(u,w)=>W.storage.flags.set(u,w),onLabelClosing:u=>W.StorageRegistry.clearOldTempVariables(u)}),!d||!T){gt.warn("The canvas element or options are not defined. The canvas will not be initialized.");return}return await D.canvas.init(d,T,at)}A.init=_;function e(){W.storage.clear(),D.canvas.isInitialized&&D.canvas.clear(),_t.sound.clear(),O.narration.clear(),ot.stepHistory.clear();}A.clear=e;async function i(){let d=D.canvas.isInitialized?D.canvas.export():{};return {pixivn_version:Rt,stepData:O.narration.export(),storageData:await W.storage.export(),canvasData:d,soundData:_t.sound.export(),historyData:await ot.stepHistory.export(),path:qt()}}A.exportGameState=i;async function s(d){ot.stepHistory.restore(d.historyData);let T=ot.stepHistory.lastKey;if(typeof T=="number"){let at=ot.stepHistory.stepsInfoMap.get(T)||null;await O.narration.restore(d.stepData,at);}W.storage.restore(d.storageData);try{D.canvas.isInitialized&&await D.canvas.restore(d.canvasData),await _t.sound.restore(d.soundData);}catch{}await GameUnifier.navigate(d.path);}A.restoreGameState=s;async function r(d,T){return A.clear(),await O.narration.call(d,T)}A.start=r;function o(d){return JSON.parse(d)}A.jsonToGameState=o;function n(d){GameUnifier.onEnd=d;}A.onEnd=n;function l(d){return GameUnifier.addOnError(d)}A.addOnError=l;function c(d){return GameUnifier.removeOnError(d)}A.removeOnError=c;function y(d){O.NarrationManagerStatic.onStepStart=d;}A.onStepStart=y;function U(d){O.NarrationManagerStatic.onLoadingLabel=d;}A.onLoadingLabel=U;function S(d){O.NarrationManagerStatic.onStepEnd=d;}A.onStepEnd=S;function M(d){O.NarrationManagerStatic.onLabelStarting=d;}A.onLabelStarting=M;function N(d){O.NarrationManagerStatic.onLabelClosing=d;}A.onLabelClosing=N;function H(d){GameUnifier.navigate=d;}A.onNavigate=H;function f(d){return GameUnifier.addOnPreContinue(d)}A.addOnPreContinue=f;function v(d){return GameUnifier.removeOnPreContinue(d)}A.removeOnPreContinue=v,A.worker={register:d=>GameWorkerManager.register(d),unregister:()=>GameWorkerManager.unregister(),get isAvailable(){return GameWorkerManager.isAvailable}},A.testing=le(A);})(ue||={});var oi={characterUtils:$t,canvasUtils:D,narrationUtils:O,soundUtils:_t,CANVAS_APP_GAME_LAYER_ALIAS:Wt,PIXIVN_VERSION:Rt,...Kt,...ne,canvas:D.canvas,narration:O.narration,sound:_t.sound,storage:W.storage,tickers:tickers$1,history:ot.stepHistory,Game:ue,GameUnifier:GameUnifier};export{Wt as CANVAS_APP_GAME_LAYER_ALIAS,Dt as CachedMap,ue as Game,Rt as PIXIVN_VERSION,Se as SYSTEM_RESERVED_STORAGE_KEYS,oe as createExportableElement,oi as default};
|