@drincs/pixi-vn 1.6.4 → 1.7.2
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 +47 -53
- package/dist/canvas.cjs +2 -2
- package/dist/canvas.d.cts +56 -51
- package/dist/canvas.d.ts +56 -51
- package/dist/canvas.mjs +2 -2
- package/dist/characters.cjs +1 -1
- package/dist/characters.mjs +1 -1
- package/dist/chunk-4KCAZKAJ.mjs +1 -0
- package/dist/{chunk-D45QSSXG.mjs → chunk-HNGW4ITF.mjs} +1 -1
- package/dist/{chunk-L4IHQ3VT.mjs → chunk-X4NBVTSJ.mjs} +1 -1
- package/dist/{chunk-ZW3MIPMS.mjs → chunk-YDNEIPJP.mjs} +1 -1
- package/dist/history.cjs +1 -1
- package/dist/history.mjs +1 -1
- package/dist/index.cjs +2 -9
- package/dist/index.d.cts +73 -4
- package/dist/index.d.ts +73 -4
- package/dist/index.mjs +2 -9
- package/dist/motion.cjs +1 -1
- package/dist/motion.d.cts +3 -1
- package/dist/motion.d.ts +3 -1
- package/dist/motion.mjs +1 -1
- package/dist/narration.cjs +2 -2
- package/dist/narration.mjs +2 -2
- package/dist/pixi/browser.js +183 -171
- package/dist/sound.cjs +1 -1
- package/dist/sound.d.cts +74 -14
- package/dist/sound.d.ts +74 -14
- package/dist/sound.mjs +1 -1
- package/dist/storage.cjs +1 -1
- package/dist/storage.d.cts +63 -12
- package/dist/storage.d.ts +63 -12
- package/dist/storage.mjs +1 -1
- package/dist/vite.cjs +1 -1
- package/dist/vite.d.cts +10 -1
- package/dist/vite.d.ts +10 -1
- package/dist/vite.mjs +1 -1
- package/package.json +12 -7
- package/dist/chunk-EWW7VYPM.mjs +0 -1
- /package/dist/{chunk-XSN6P5JL.mjs → chunk-JMOSOAGB.mjs} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var nt=require('@drincs/pixi-vn/canvas'),Xt=require('@drincs/pixi-vn/characters'),core=require('@drincs/pixi-vn/core'),et=require('@drincs/pixi-vn/history'),C=require('@drincs/pixi-vn/narration'),pt=require('@drincs/pixi-vn/sound'),I=require('@drincs/pixi-vn/storage'),motion=require('@drincs/pixi-vn/motion');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var nt__namespace=/*#__PURE__*/_interopNamespace(nt);var Xt__namespace=/*#__PURE__*/_interopNamespace(Xt);var et__namespace=/*#__PURE__*/_interopNamespace(et);var C__namespace=/*#__PURE__*/_interopNamespace(C);var pt__namespace=/*#__PURE__*/_interopNamespace(pt);var I__namespace=/*#__PURE__*/_interopNamespace(I);var $t=Object.defineProperty;var Bt=h=>{throw TypeError(h)};var le=(h,e,i)=>e in h?$t(h,e,{enumerable:true,configurable:true,writable:true,value:i}):h[e]=i;var he=(h,e)=>{for(var i in e)$t(h,i,{get:e[i],enumerable:true});};var E=(h,e,i)=>le(h,typeof e!="symbol"?e+"":e,i),jt=(h,e,i)=>e.has(h)||Bt("Cannot "+i);var t=(h,e,i)=>(jt(h,e,"read from private field"),i?i.call(h):e.get(h)),g=(h,e,i)=>e.has(h)?Bt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(h):e.set(h,i),u=(h,e,i,s)=>(jt(h,e,"write to private field"),e.set(h,i),i),d=(h,e,i)=>(jt(h,e,"access private method"),i);var Rt=(h,e,i,s)=>({set _(r){u(h,e,r);},get _(){return t(h,e,s)}});var de=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,te=new Set,It=typeof process=="object"&&process?process:{},ee=(h,e,i,s)=>{typeof It.emitWarning=="function"?It.emitWarning(h,e,i,s):console.error(`[${i}] ${e}: ${h}`);},Nt=globalThis.AbortController,Jt=globalThis.AbortSignal;if(typeof Nt>"u"){Jt=class{constructor(){E(this,"onabort");E(this,"_onabort",[]);E(this,"reason");E(this,"aborted",false);}addEventListener(i,s){this._onabort.push(s);}},Nt=class{constructor(){E(this,"signal",new Jt);e();}abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let h=It.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{h&&(h=false,ee("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 ce=h=>!te.has(h);var at=h=>h&&h===Math.floor(h)&&h>0&&isFinite(h),ie=h=>at(h)?h<=Math.pow(2,8)?Uint8Array:h<=Math.pow(2,16)?Uint16Array:h<=Math.pow(2,32)?Uint32Array:h<=Number.MAX_SAFE_INTEGER?Dt:null:null,Dt=class extends Array{constructor(h){super(h),this.fill(0);}},it,St,pe=(it=class{constructor(e,i){E(this,"heap");E(this,"length");if(!t(it,St))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}static create(e){let i=ie(e);if(!i)return [];u(it,St,true);let s=new it(e,i);return u(it,St,false),s}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},St=new WeakMap,g(it,St,false),it),Qt,Zt,K,G,q,ut,X,yt,Et,$,U,B,T,b,m,F,z,N,D,J,L,Q,Z,V,W,tt,ct,P,xt,l,Mt,ft,rt,Ot,Y,re,mt,At,Tt,lt,ht,Gt,Lt,Ct,A,zt,wt,dt,Vt,bt,se=(bt=class{constructor(e){g(this,l);g(this,K);g(this,G);g(this,q);g(this,ut);g(this,X);g(this,yt);g(this,Et);g(this,$);E(this,"ttl");E(this,"ttlResolution");E(this,"ttlAutopurge");E(this,"updateAgeOnGet");E(this,"updateAgeOnHas");E(this,"allowStale");E(this,"noDisposeOnSet");E(this,"noUpdateTTL");E(this,"maxEntrySize");E(this,"sizeCalculation");E(this,"noDeleteOnFetchRejection");E(this,"noDeleteOnStaleGet");E(this,"allowStaleOnFetchAbort");E(this,"allowStaleOnFetchRejection");E(this,"ignoreFetchAbort");g(this,U);g(this,B);g(this,T);g(this,b);g(this,m);g(this,F);g(this,z);g(this,N);g(this,D);g(this,J);g(this,L);g(this,Q);g(this,Z);g(this,V);g(this,W);g(this,tt);g(this,ct);g(this,P);g(this,xt);g(this,ft,()=>{});g(this,rt,()=>{});g(this,Ot,()=>{});g(this,Y,()=>false);g(this,mt,e=>{});g(this,At,(e,i,s)=>{});g(this,Tt,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});E(this,Qt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:n,updateAgeOnGet:o,updateAgeOnHas:c,allowStale:p,dispose:v,onInsert:R,disposeAfter:S,noDisposeOnSet:st,noUpdateTTL:M,maxSize:k=0,maxEntrySize:w=0,sizeCalculation:y,fetchMethod:a,memoMethod:x,noDeleteOnFetchRejection:O,noDeleteOnStaleGet:f,allowStaleOnFetchRejection:_,allowStaleOnFetchAbort:j,ignoreFetchAbort:H,perf:gt}=e;if(gt!==void 0&&typeof gt?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(u(this,$,gt??de),i!==0&&!at(i))throw new TypeError("max option must be a nonnegative integer");let vt=i?ie(i):Array;if(!vt)throw new Error("invalid max value: "+i);if(u(this,K,i),u(this,G,k),this.maxEntrySize=w||t(this,G),this.sizeCalculation=y,this.sizeCalculation){if(!t(this,G)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(x!==void 0&&typeof x!="function")throw new TypeError("memoMethod must be a function if defined");if(u(this,Et,x),a!==void 0&&typeof a!="function")throw new TypeError("fetchMethod must be a function if specified");if(u(this,yt,a),u(this,ct,!!a),u(this,T,new Map),u(this,b,new Array(i).fill(void 0)),u(this,m,new Array(i).fill(void 0)),u(this,F,new vt(i)),u(this,z,new vt(i)),u(this,N,0),u(this,D,0),u(this,J,pe.create(i)),u(this,U,0),u(this,B,0),typeof v=="function"&&u(this,q,v),typeof R=="function"&&u(this,ut,R),typeof S=="function"?(u(this,X,S),u(this,L,[])):(u(this,X,void 0),u(this,L,void 0)),u(this,tt,!!t(this,q)),u(this,xt,!!t(this,ut)),u(this,P,!!t(this,X)),this.noDisposeOnSet=!!st,this.noUpdateTTL=!!M,this.noDeleteOnFetchRejection=!!O,this.allowStaleOnFetchRejection=!!_,this.allowStaleOnFetchAbort=!!j,this.ignoreFetchAbort=!!H,this.maxEntrySize!==0){if(t(this,G)!==0&&!at(t(this,G)))throw new TypeError("maxSize must be a positive integer if specified");if(!at(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");d(this,l,re).call(this);}if(this.allowStale=!!p,this.noDeleteOnStaleGet=!!f,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!c,this.ttlResolution=at(r)||r===0?r:1,this.ttlAutopurge=!!n,this.ttl=s||0,this.ttl){if(!at(this.ttl))throw new TypeError("ttl must be a positive integer if specified");d(this,l,Mt).call(this);}if(t(this,K)===0&&this.ttl===0&&t(this,G)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,K)&&!t(this,G)){let Pt="LRU_CACHE_UNBOUNDED";ce(Pt)&&(te.add(Pt),ee("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Pt,bt));}}get perf(){return t(this,$)}static unsafeExposeInternals(e){return {starts:t(e,Z),ttls:t(e,V),autopurgeTimers:t(e,W),sizes:t(e,Q),keyMap:t(e,T),keyList:t(e,b),valList:t(e,m),next:t(e,F),prev:t(e,z),get head(){return t(e,N)},get tail(){return t(e,D)},free:t(e,J),isBackgroundFetch:i=>{var s;return d(s=e,l,A).call(s,i)},backgroundFetch:(i,s,r,n)=>{var o;return d(o=e,l,Ct).call(o,i,s,r,n)},moveToTail:i=>{var s;return d(s=e,l,wt).call(s,i)},indexes:i=>{var s;return d(s=e,l,lt).call(s,i)},rindexes:i=>{var s;return d(s=e,l,ht).call(s,i)},isStale:i=>{var s;return t(s=e,Y).call(s,i)}}}get max(){return t(this,K)}get maxSize(){return t(this,G)}get calculatedSize(){return t(this,B)}get size(){return t(this,U)}get fetchMethod(){return t(this,yt)}get memoMethod(){return t(this,Et)}get dispose(){return t(this,q)}get onInsert(){return t(this,ut)}get disposeAfter(){return t(this,X)}getRemainingTTL(e){return t(this,T).has(e)?1/0:0}*entries(){for(let e of d(this,l,lt).call(this))t(this,m)[e]!==void 0&&t(this,b)[e]!==void 0&&!d(this,l,A).call(this,t(this,m)[e])&&(yield [t(this,b)[e],t(this,m)[e]]);}*rentries(){for(let e of d(this,l,ht).call(this))t(this,m)[e]!==void 0&&t(this,b)[e]!==void 0&&!d(this,l,A).call(this,t(this,m)[e])&&(yield [t(this,b)[e],t(this,m)[e]]);}*keys(){for(let e of d(this,l,lt).call(this)){let i=t(this,b)[e];i!==void 0&&!d(this,l,A).call(this,t(this,m)[e])&&(yield i);}}*rkeys(){for(let e of d(this,l,ht).call(this)){let i=t(this,b)[e];i!==void 0&&!d(this,l,A).call(this,t(this,m)[e])&&(yield i);}}*values(){for(let e of d(this,l,lt).call(this))t(this,m)[e]!==void 0&&!d(this,l,A).call(this,t(this,m)[e])&&(yield t(this,m)[e]);}*rvalues(){for(let e of d(this,l,ht).call(this))t(this,m)[e]!==void 0&&!d(this,l,A).call(this,t(this,m)[e])&&(yield t(this,m)[e]);}[(Zt=Symbol.iterator,Qt=Symbol.toStringTag,Zt)](){return this.entries()}find(e,i={}){for(let s of d(this,l,lt).call(this)){let r=t(this,m)[s],n=d(this,l,A).call(this,r)?r.__staleWhileFetching:r;if(n!==void 0&&e(n,t(this,b)[s],this))return this.get(t(this,b)[s],i)}}forEach(e,i=this){for(let s of d(this,l,lt).call(this)){let r=t(this,m)[s],n=d(this,l,A).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e.call(i,n,t(this,b)[s],this);}}rforEach(e,i=this){for(let s of d(this,l,ht).call(this)){let r=t(this,m)[s],n=d(this,l,A).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e.call(i,n,t(this,b)[s],this);}}purgeStale(){let e=false;for(let i of d(this,l,ht).call(this,{allowStale:true}))t(this,Y).call(this,i)&&(d(this,l,dt).call(this,t(this,b)[i],"expire"),e=true);return e}info(e){let i=t(this,T).get(e);if(i===void 0)return;let s=t(this,m)[i],r=d(this,l,A).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let n={value:r};if(t(this,V)&&t(this,Z)){let o=t(this,V)[i],c=t(this,Z)[i];if(o&&c){let p=o-(t(this,$).now()-c);n.ttl=p,n.start=Date.now();}}return t(this,Q)&&(n.size=t(this,Q)[i]),n}dump(){let e=[];for(let i of d(this,l,lt).call(this,{allowStale:true})){let s=t(this,b)[i],r=t(this,m)[i],n=d(this,l,A).call(this,r)?r.__staleWhileFetching:r;if(n===void 0||s===void 0)continue;let o={value:n};if(t(this,V)&&t(this,Z)){o.ttl=t(this,V)[i];let c=t(this,$).now()-t(this,Z)[i];o.start=Math.floor(Date.now()-c);}t(this,Q)&&(o.size=t(this,Q)[i]),e.unshift([s,o]);}return e}load(e){this.clear();for(let[i,s]of e){if(s.start){let r=Date.now()-s.start;s.start=t(this,$).now()-r;}this.set(i,s.value,s);}}set(e,i,s={}){var st,M,k,w;if(i===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:n,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:p}=s,{noUpdateTTL:v=this.noUpdateTTL}=s,R=t(this,Tt).call(this,e,i,s.size||0,c);if(this.maxEntrySize&&R>this.maxEntrySize)return p&&(p.set="miss",p.maxEntrySizeExceeded=true),d(this,l,dt).call(this,e,"set"),this;let S=t(this,U)===0?void 0:t(this,T).get(e);if(S===void 0)S=t(this,U)===0?t(this,D):t(this,J).length!==0?t(this,J).pop():t(this,U)===t(this,K)?d(this,l,Lt).call(this,false):t(this,U),t(this,b)[S]=e,t(this,m)[S]=i,t(this,T).set(e,S),t(this,F)[t(this,D)]=S,t(this,z)[S]=t(this,D),u(this,D,S),Rt(this,U)._++,t(this,At).call(this,S,R,p),p&&(p.set="add"),v=false,t(this,xt)&&((st=t(this,ut))==null||st.call(this,i,e,"add"));else {d(this,l,wt).call(this,S);let y=t(this,m)[S];if(i!==y){if(t(this,ct)&&d(this,l,A).call(this,y)){y.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:a}=y;a!==void 0&&!o&&(t(this,tt)&&((M=t(this,q))==null||M.call(this,a,e,"set")),t(this,P)&&t(this,L)?.push([a,e,"set"]));}else o||(t(this,tt)&&((k=t(this,q))==null||k.call(this,y,e,"set")),t(this,P)&&t(this,L)?.push([y,e,"set"]));if(t(this,mt).call(this,S),t(this,At).call(this,S,R,p),t(this,m)[S]=i,p){p.set="replace";let a=y&&d(this,l,A).call(this,y)?y.__staleWhileFetching:y;a!==void 0&&(p.oldValue=a);}}else p&&(p.set="update");t(this,xt)&&this.onInsert?.(i,e,i===y?"update":"replace");}if(r!==0&&!t(this,V)&&d(this,l,Mt).call(this),t(this,V)&&(v||t(this,Ot).call(this,S,r,n),p&&t(this,rt).call(this,p,S)),!o&&t(this,P)&&t(this,L)){let y=t(this,L),a;for(;a=y?.shift();)(w=t(this,X))==null||w.call(this,...a);}return this}pop(){var e;try{for(;t(this,U);){let i=t(this,m)[t(this,N)];if(d(this,l,Lt).call(this,!0),d(this,l,A).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(t(this,P)&&t(this,L)){let i=t(this,L),s;for(;s=i?.shift();)(e=t(this,X))==null||e.call(this,...s);}}}has(e,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,n=t(this,T).get(e);if(n!==void 0){let o=t(this,m)[n];if(d(this,l,A).call(this,o)&&o.__staleWhileFetching===void 0)return false;if(t(this,Y).call(this,n))r&&(r.has="stale",t(this,rt).call(this,r,n));else return s&&t(this,ft).call(this,n),r&&(r.has="hit",t(this,rt).call(this,r,n)),true}else r&&(r.has="miss");return false}peek(e,i={}){let{allowStale:s=this.allowStale}=i,r=t(this,T).get(e);if(r===void 0||!s&&t(this,Y).call(this,r))return;let n=t(this,m)[r];return d(this,l,A).call(this,n)?n.__staleWhileFetching:n}async fetch(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:p=0,sizeCalculation:v=this.sizeCalculation,noUpdateTTL:R=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:st=this.allowStaleOnFetchRejection,ignoreFetchAbort:M=this.ignoreFetchAbort,allowStaleOnFetchAbort:k=this.allowStaleOnFetchAbort,context:w,forceRefresh:y=false,status:a,signal:x}=i;if(!t(this,ct))return a&&(a.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,status:a});let O={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:c,size:p,sizeCalculation:v,noUpdateTTL:R,noDeleteOnFetchRejection:S,allowStaleOnFetchRejection:st,allowStaleOnFetchAbort:k,ignoreFetchAbort:M,status:a,signal:x},f=t(this,T).get(e);if(f===void 0){a&&(a.fetch="miss");let _=d(this,l,Ct).call(this,e,f,O,w);return _.__returned=_}else {let _=t(this,m)[f];if(d(this,l,A).call(this,_)){let vt=s&&_.__staleWhileFetching!==void 0;return a&&(a.fetch="inflight",vt&&(a.returnedStale=true)),vt?_.__staleWhileFetching:_.__returned=_}let j=t(this,Y).call(this,f);if(!y&&!j)return a&&(a.fetch="hit"),d(this,l,wt).call(this,f),r&&t(this,ft).call(this,f),a&&t(this,rt).call(this,a,f),_;let H=d(this,l,Ct).call(this,e,f,O,w),gt=H.__staleWhileFetching!==void 0&&s;return a&&(a.fetch=j?"stale":"refresh",gt&&j&&(a.returnedStale=true)),gt?H.__staleWhileFetching:H.__returned=H}}async forceFetch(e,i={}){let s=await this.fetch(e,i);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(e,i={}){let s=t(this,Et);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:n,...o}=i,c=this.get(e,o);if(!n&&c!==void 0)return c;let p=s(e,c,{options:o,context:r});return this.set(e,p,o),p}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:o}=i,c=t(this,T).get(e);if(c!==void 0){let p=t(this,m)[c],v=d(this,l,A).call(this,p);return o&&t(this,rt).call(this,o,c),t(this,Y).call(this,c)?(o&&(o.get="stale"),v?(o&&s&&p.__staleWhileFetching!==void 0&&(o.returnedStale=true),s?p.__staleWhileFetching:void 0):(n||d(this,l,dt).call(this,e,"expire"),o&&s&&(o.returnedStale=true),s?p:void 0)):(o&&(o.get="hit"),v?p.__staleWhileFetching:(d(this,l,wt).call(this,c),r&&t(this,ft).call(this,c),p))}else o&&(o.get="miss");}delete(e){return d(this,l,dt).call(this,e,"delete")}clear(){return d(this,l,Vt).call(this,"delete")}},K=new WeakMap,G=new WeakMap,q=new WeakMap,ut=new WeakMap,X=new WeakMap,yt=new WeakMap,Et=new WeakMap,$=new WeakMap,U=new WeakMap,B=new WeakMap,T=new WeakMap,b=new WeakMap,m=new WeakMap,F=new WeakMap,z=new WeakMap,N=new WeakMap,D=new WeakMap,J=new WeakMap,L=new WeakMap,Q=new WeakMap,Z=new WeakMap,V=new WeakMap,W=new WeakMap,tt=new WeakMap,ct=new WeakMap,P=new WeakMap,xt=new WeakMap,l=new WeakSet,Mt=function(){let e=new Dt(t(this,K)),i=new Dt(t(this,K));u(this,V,e),u(this,Z,i);let s=this.ttlAutopurge?new Array(t(this,K)):void 0;u(this,W,s),u(this,Ot,(c,p,v=t(this,$).now())=>{i[c]=p!==0?v:0,e[c]=p,r(c,p);}),u(this,ft,c=>{i[c]=e[c]!==0?t(this,$).now():0,r(c,e[c]);});let r=this.ttlAutopurge?(c,p)=>{if(s?.[c]&&(clearTimeout(s[c]),s[c]=void 0),p&&p!==0&&s){let v=setTimeout(()=>{t(this,Y).call(this,c)&&d(this,l,dt).call(this,t(this,b)[c],"expire");},p+1);v.unref&&v.unref(),s[c]=v;}}:()=>{};u(this,rt,(c,p)=>{if(e[p]){let v=e[p],R=i[p];if(!v||!R)return;c.ttl=v,c.start=R,c.now=n||o();let S=c.now-R;c.remainingTTL=v-S;}});let n=0,o=()=>{let c=t(this,$).now();if(this.ttlResolution>0){n=c;let p=setTimeout(()=>n=0,this.ttlResolution);p.unref&&p.unref();}return c};this.getRemainingTTL=c=>{let p=t(this,T).get(c);if(p===void 0)return 0;let v=e[p],R=i[p];if(!v||!R)return 1/0;let S=(n||o())-R;return v-S},u(this,Y,c=>{let p=i[c],v=e[c];return !!v&&!!p&&(n||o())-p>v});},ft=new WeakMap,rt=new WeakMap,Ot=new WeakMap,Y=new WeakMap,re=function(){let e=new Dt(t(this,K));u(this,B,0),u(this,Q,e),u(this,mt,i=>{u(this,B,t(this,B)-e[i]),e[i]=0;}),u(this,Tt,(i,s,r,n)=>{if(d(this,l,A).call(this,s))return 0;if(!at(r))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(r=n(s,i),!at(r))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return r}),u(this,At,(i,s,r)=>{if(e[i]=s,t(this,G)){let n=t(this,G)-e[i];for(;t(this,B)>n;)d(this,l,Lt).call(this,true);}u(this,B,t(this,B)+e[i]),r&&(r.entrySize=s,r.totalCalculatedSize=t(this,B));});},mt=new WeakMap,At=new WeakMap,Tt=new WeakMap,lt=function*({allowStale:e=this.allowStale}={}){if(t(this,U))for(let i=t(this,D);!(!d(this,l,Gt).call(this,i)||((e||!t(this,Y).call(this,i))&&(yield i),i===t(this,N)));)i=t(this,z)[i];},ht=function*({allowStale:e=this.allowStale}={}){if(t(this,U))for(let i=t(this,N);!(!d(this,l,Gt).call(this,i)||((e||!t(this,Y).call(this,i))&&(yield i),i===t(this,D)));)i=t(this,F)[i];},Gt=function(e){return e!==void 0&&t(this,T).get(t(this,b)[e])===e},Lt=function(e){var n;let i=t(this,N),s=t(this,b)[i],r=t(this,m)[i];return t(this,ct)&&d(this,l,A).call(this,r)?r.__abortController.abort(new Error("evicted")):(t(this,tt)||t(this,P))&&(t(this,tt)&&((n=t(this,q))==null||n.call(this,r,s,"evict")),t(this,P)&&t(this,L)?.push([r,s,"evict"])),t(this,mt).call(this,i),t(this,W)?.[i]&&(clearTimeout(t(this,W)[i]),t(this,W)[i]=void 0),e&&(t(this,b)[i]=void 0,t(this,m)[i]=void 0,t(this,J).push(i)),t(this,U)===1?(u(this,N,u(this,D,0)),t(this,J).length=0):u(this,N,t(this,F)[i]),t(this,T).delete(s),Rt(this,U)._--,i},Ct=function(e,i,s,r){let n=i===void 0?void 0:t(this,m)[i];if(d(this,l,A).call(this,n))return n;let o=new Nt,{signal:c}=s;c?.addEventListener("abort",()=>o.abort(c.reason),{signal:o.signal});let p={signal:o.signal,options:s,context:r},v=(w,y=false)=>{let{aborted:a}=o.signal,x=s.ignoreFetchAbort&&w!==void 0,O=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&w!==void 0);if(s.status&&(a&&!y?(s.status.fetchAborted=true,s.status.fetchError=o.signal.reason,x&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),a&&!x&&!y)return S(o.signal.reason,O);let f=M,_=t(this,m)[i];return (_===M||x&&y&&_===void 0)&&(w===void 0?f.__staleWhileFetching!==void 0?t(this,m)[i]=f.__staleWhileFetching:d(this,l,dt).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,w,p.options))),w},R=w=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=w),S(w,false)),S=(w,y)=>{let{aborted:a}=o.signal,x=a&&s.allowStaleOnFetchAbort,O=x||s.allowStaleOnFetchRejection,f=O||s.noDeleteOnFetchRejection,_=M;if(t(this,m)[i]===M&&(!f||!y&&_.__staleWhileFetching===void 0?d(this,l,dt).call(this,e,"fetch"):x||(t(this,m)[i]=_.__staleWhileFetching)),O)return s.status&&_.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),_.__staleWhileFetching;if(_.__returned===_)throw w},st=(w,y)=>{var x;let a=(x=t(this,yt))==null?void 0:x.call(this,e,n,p);a&&a instanceof Promise&&a.then(O=>w(O===void 0?void 0:O),y),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(w(void 0),s.allowStaleOnFetchAbort&&(w=O=>v(O,true)));});};s.status&&(s.status.fetchDispatched=true);let M=new Promise(st).then(v,R),k=Object.assign(M,{__abortController:o,__staleWhileFetching:n,__returned:void 0});return i===void 0?(this.set(e,k,{...p.options,status:void 0}),i=t(this,T).get(e)):t(this,m)[i]=k,k},A=function(e){if(!t(this,ct))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Nt},zt=function(e,i){t(this,z)[i]=e,t(this,F)[e]=i;},wt=function(e){e!==t(this,D)&&(e===t(this,N)?u(this,N,t(this,F)[e]):d(this,l,zt).call(this,t(this,z)[e],t(this,F)[e]),d(this,l,zt).call(this,t(this,D),e),u(this,D,e));},dt=function(e,i){var r,n;let s=false;if(t(this,U)!==0){let o=t(this,T).get(e);if(o!==void 0)if(t(this,W)?.[o]&&(clearTimeout(t(this,W)?.[o]),t(this,W)[o]=void 0),s=true,t(this,U)===1)d(this,l,Vt).call(this,i);else {t(this,mt).call(this,o);let c=t(this,m)[o];if(d(this,l,A).call(this,c)?c.__abortController.abort(new Error("deleted")):(t(this,tt)||t(this,P))&&(t(this,tt)&&((r=t(this,q))==null||r.call(this,c,e,i)),t(this,P)&&t(this,L)?.push([c,e,i])),t(this,T).delete(e),t(this,b)[o]=void 0,t(this,m)[o]=void 0,o===t(this,D))u(this,D,t(this,z)[o]);else if(o===t(this,N))u(this,N,t(this,F)[o]);else {let p=t(this,z)[o];t(this,F)[p]=t(this,F)[o];let v=t(this,F)[o];t(this,z)[v]=t(this,z)[o];}Rt(this,U)._--,t(this,J).push(o);}}if(t(this,P)&&t(this,L)?.length){let o=t(this,L),c;for(;c=o?.shift();)(n=t(this,X))==null||n.call(this,...c);}return s},Vt=function(e){var i,s;for(let r of d(this,l,ht).call(this,{allowStale:true})){let n=t(this,m)[r];if(d(this,l,A).call(this,n))n.__abortController.abort(new Error("deleted"));else {let o=t(this,b)[r];t(this,tt)&&((i=t(this,q))==null||i.call(this,n,o,e)),t(this,P)&&t(this,L)?.push([n,o,e]);}}if(t(this,T).clear(),t(this,m).fill(void 0),t(this,b).fill(void 0),t(this,V)&&t(this,Z)){t(this,V).fill(0),t(this,Z).fill(0);for(let r of t(this,W)??[])r!==void 0&&clearTimeout(r);t(this,W)?.fill(void 0);}if(t(this,Q)&&t(this,Q).fill(0),u(this,N,0),u(this,D,0),t(this,J).length=0,u(this,B,0),u(this,U,0),t(this,P)&&t(this,L)){let r=t(this,L),n;for(;n=r?.shift();)(s=t(this,X))==null||s.call(this,...n);}},bt);var Ft=class{constructor(e){E(this,"cache");E(this,"map",new Map);this.cache=new se({max:e.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(e){let i=this.map.delete(e);return i&&this.cache.delete(e),i}get forEach(){return this.map.forEach}get(e){let i=this.cache.get(e);return i||this.map.get(e)}has(e){return this.map.has(e)}set(e,i){return this.map.set(e,i),this.cache.set(e,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var Ut="1.6.4";var Wt="repeat";function Yt(h){return {type:"pause",duration:h}}var Ht="__game_layer__";var fe="general";var me={CURRENT_DIALOGUE_MEMORY_KEY:"dialogue",LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY:"dialogue:step_counter",CURRENT_MENU_OPTIONS_MEMORY_KEY:"choice:options",LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY:"choice:step_counter",CURRENT_INPUT_VALUE_MEMORY_KEY:"input:value",LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY:"input:step_counter",CURRENT_INPUT_INFO_MEMORY_KEY:"input:info",CHARACTER_CATEGORY_KEY:"character",ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY:"___glue___",OPENED_LABELS_COUNTER_KEY:"label:opened",ALL_CHOICES_MADE_KEY:"choices:made",CURRENT_STEP_TIMES_COUNTER_KEY:"label:history",LAST_STEP_GLUED:"glue:last_step"};var oe={};var Kt={};he(Kt,{createExportableElement:()=>ne});var _t;(r=>(r.log=(n,...o)=>console.log(`[Pixi\u2019VN] ${n}`,...o),r.warn=(n,...o)=>console.warn(`[Pixi\u2019VN] ${n}`,...o),r.error=(n,...o)=>console.error(`[Pixi\u2019VN] ${n}`,...o),r.info=(n,...o)=>console.info(`[Pixi\u2019VN] ${n}`,...o)))(_t||(_t={}));function ne(h){try{if(typeof h>"u")return h;let e=JSON.stringify(h);return JSON.parse(e)}catch(e){throw _t.error("Error creating exportable element",h,e),new core.PixiError("not_json_serializable","Error creating exportable element")}}function ae(){console.info(`
|
|
2
|
-
|
|
3
|
-
|_ __ \\ (_) (_) | | |_ _| |_ _||_ \\|_ _|
|
|
4
|
-
| |__) |__ _ __ __ \\_| \\ \\ / / | \\ | |
|
|
5
|
-
| ___/[ | [ \\ [ ][ | \\ \\ / / | |\\ \\| |
|
|
6
|
-
_| |_ | | > ' < | | \\ ' / _| |_\\ |_
|
|
7
|
-
|_____| [___][__]\`\\_][___] \\_/ |_____|\\____|
|
|
8
|
-
|
|
9
|
-
`);}function kt(){let h=window.location.pathname+window.location.hash;return h.includes("#")&&(h=h.split("#")[1]),h}exports.Game=void 0;(y=>{async function h(a,x,O){if(core.GameUnifier.init({navigate:x?.navigate,getCurrentGameStepState:()=>{let f={};try{f=nt__namespace.canvas.export();}catch{}return {path:kt(),storage:I__namespace.storage.export(),canvas:f,sound:pt__namespace.sound.export(),labelIndex:C__namespace.NarrationManagerStatic.currentLabelStepIndex||0,openedLabels:C__namespace.narration.openedLabels}},restoreGameStepState:async(f,_)=>{et__namespace.HistoryManagerStatic._originalStepData=f,C__namespace.NarrationManagerStatic.openedLabels=f.openedLabels,I__namespace.storage.restore(f.storage);try{await nt__namespace.canvas.restore(f.canvas),await pt__namespace.sound.restore(f.sound);}catch{}_(f.path);},getStepCounter:()=>C__namespace.narration.stepCounter,setStepCounter:f=>{C__namespace.NarrationManagerStatic._stepCounter=f;},getOpenedLabels:()=>C__namespace.narration.openedLabels.length,addHistoryItem:(f,_)=>et__namespace.stepHistory.add(f,_),getCharacter:f=>Xt__namespace.RegisteredCharacters.get(f),processNavigationRequests:(f,_)=>{let j=f,H=Promise.resolve();return f>0?(j--,H=C__namespace.narration.continue(_)):f<0&&(j=0,H=et__namespace.stepHistory.back(_,{steps:f*-1})),{newValue:j,result:H}},animate:(f,_,j,H)=>motion.motion.animate(f,_,j,H),getVariable:(f,_)=>I__namespace.StorageManagerStatic.getVariable(f,_),setVariable:(f,_,j)=>I__namespace.StorageManagerStatic.setVariable(f,_,j),removeVariable:(f,_)=>I__namespace.StorageManagerStatic.removeVariable(f,_),getFlag:f=>I__namespace.storage.getFlag(f),setFlag:(f,_)=>I__namespace.storage.setFlag(f,_),onLabelClosing:f=>I__namespace.StorageManagerStatic.clearOldTempVariables(f)}),ae(),!a||!x){_t.warn("The canvas element or options are not defined. The canvas will not be initialized.");return}return await nt__namespace.canvas.init(a,x,O)}y.init=h;function e(){I__namespace.storage.clear();try{nt__namespace.canvas.clear();}catch{}pt__namespace.sound.clear(),C__namespace.narration.clear(),et__namespace.stepHistory.clear();}y.clear=e;function i(){let a={};try{a=nt__namespace.canvas.export();}catch{}return {pixivn_version:Ut,stepData:C__namespace.narration.export(),storageData:I__namespace.storage.export(),canvasData:a,soundData:pt__namespace.sound.export(),historyData:et__namespace.stepHistory.export(),path:kt()}}y.exportGameState=i;async function s(a,x){et__namespace.stepHistory.restore(a.historyData);let O=et__namespace.stepHistory.lastKey;if(typeof O=="number"){let f=et__namespace.stepHistory.stepsInfoMap.get(O)||null;await C__namespace.narration.restore(a.stepData,f);}I__namespace.storage.restore(a.storageData);try{await nt__namespace.canvas.restore(a.canvasData),await pt__namespace.sound.restore(a.soundData);}catch{}await x(a.path);}y.restoreGameState=s;async function r(a,x){return y.clear(),await C__namespace.narration.call(a,x)}y.start=r;function n(a){return JSON.parse(a)}y.jsonToGameState=n;function o(a){core.GameUnifier.onEnd=a;}y.onEnd=o;function c(a){return _t.warn("Game.onError is deprecated. Use Game.addOnError / Game.removeOnError to register multiple handlers."),core.GameUnifier.addOnError((x,O)=>a("step",x,O))}y.onError=c;function p(a){return core.GameUnifier.addOnError(a)}y.addOnError=p;function v(a){return core.GameUnifier.removeOnError(a)}y.removeOnError=v;function R(a){C__namespace.NarrationManagerStatic.onStepStart=a;}y.onStepStart=R;function S(a){C__namespace.NarrationManagerStatic.onLoadingLabel=a;}y.onLoadingLabel=S;function st(a){C__namespace.NarrationManagerStatic.onStepEnd=a;}y.onStepEnd=st;function M(a){core.GameUnifier.navigate=a;}y.onNavigate=M;function k(a){return core.GameUnifier.addOnPreContinue(a)}y.addOnPreContinue=k;function w(a){return core.GameUnifier.removeOnPreContinue(a)}y.removeOnPreContinue=w;})(exports.Game||(exports.Game={}));var Ke={characterUtils:Xt__namespace,canvasUtils:nt__namespace,narrationUtils:C__namespace,soundUtils:pt__namespace,CANVAS_APP_GAME_LAYER_ALIAS:Ht,Pause:Yt,Repeat:Wt,PIXIVN_VERSION:Ut,...Kt,...oe,canvas:nt__namespace.canvas,narration:C__namespace.narration,sound:pt__namespace.sound,storage:I__namespace.storage,history:et__namespace.stepHistory,Game:exports.Game,GameUnifier:core.GameUnifier};exports.CANVAS_APP_GAME_LAYER_ALIAS=Ht;exports.CachedMap=Ft;exports.GENERAL_CHANNEL=fe;exports.PIXIVN_VERSION=Ut;exports.Pause=Yt;exports.Repeat=Wt;exports.SYSTEM_RESERVED_STORAGE_KEYS=me;exports.createExportableElement=ne;exports.default=Ke;Object.keys(nt).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return nt[k]}})});Object.keys(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(et).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return et[k]}})});Object.keys(C).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return C[k]}})});Object.keys(pt).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return pt[k]}})});Object.keys(I).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return I[k]}})});
|
|
1
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var nt=require('@drincs/pixi-vn/canvas'),Bt=require('@drincs/pixi-vn/characters'),core=require('@drincs/pixi-vn/core'),et=require('@drincs/pixi-vn/history'),C=require('@drincs/pixi-vn/narration'),ut=require('@drincs/pixi-vn/sound'),G=require('@drincs/pixi-vn/storage'),motion=require('@drincs/pixi-vn/motion');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var nt__namespace=/*#__PURE__*/_interopNamespace(nt);var Bt__namespace=/*#__PURE__*/_interopNamespace(Bt);var et__namespace=/*#__PURE__*/_interopNamespace(et);var C__namespace=/*#__PURE__*/_interopNamespace(C);var ut__namespace=/*#__PURE__*/_interopNamespace(ut);var G__namespace=/*#__PURE__*/_interopNamespace(G);var Jt=Object.defineProperty;var Qt=h=>{throw TypeError(h)};var ue=(h,e,i)=>e in h?Jt(h,e,{enumerable:true,configurable:true,writable:true,value:i}):h[e]=i;var fe=(h,e)=>{for(var i in e)Jt(h,i,{get:e[i],enumerable:true});};var x=(h,e,i)=>ue(h,typeof e!="symbol"?e+"":e,i),jt=(h,e,i)=>e.has(h)||Qt("Cannot "+i);var t=(h,e,i)=>(jt(h,e,"read from private field"),i?i.call(h):e.get(h)),v=(h,e,i)=>e.has(h)?Qt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(h):e.set(h,i),u=(h,e,i,s)=>(jt(h,e,"write to private field"),e.set(h,i),i),d=(h,e,i)=>(jt(h,e,"access private method"),i);var Rt=(h,e,i,s)=>({set _(r){u(h,e,r);},get _(){return t(h,e,s)}});var me=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,ie=new Set,Gt=typeof process=="object"&&process?process:{},se=(h,e,i,s)=>{typeof Gt.emitWarning=="function"?Gt.emitWarning(h,e,i,s):console.error(`[${i}] ${e}: ${h}`);},Nt=globalThis.AbortController,Zt=globalThis.AbortSignal;if(typeof Nt>"u"){Zt=class{constructor(){x(this,"onabort");x(this,"_onabort",[]);x(this,"reason");x(this,"aborted",false);}addEventListener(i,s){this._onabort.push(s);}},Nt=class{constructor(){x(this,"signal",new Zt);e();}abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let h=Gt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{h&&(h=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 ge=h=>!ie.has(h);var at=h=>h&&h===Math.floor(h)&&h>0&&isFinite(h),re=h=>at(h)?h<=Math.pow(2,8)?Uint8Array:h<=Math.pow(2,16)?Uint16Array:h<=Math.pow(2,32)?Uint32Array:h<=Number.MAX_SAFE_INTEGER?Dt:null:null,Dt=class extends Array{constructor(h){super(h),this.fill(0);}},it,St,ve=(it=class{constructor(e,i){x(this,"heap");x(this,"length");if(!t(it,St))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}static create(e){let i=re(e);if(!i)return [];u(it,St,true);let s=new it(e,i);return u(it,St,false),s}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},St=new WeakMap,v(it,St,false),it),te,ee,K,M,q,ft,$,yt,Et,X,U,B,T,A,m,P,z,N,D,J,L,Q,Z,V,W,tt,dt,j,xt,l,It,mt,ot,Ot,Y,ne,gt,bt,Tt,lt,ht,Mt,Lt,Ct,b,zt,wt,ct,Vt,At,oe=(At=class{constructor(e){v(this,l);v(this,K);v(this,M);v(this,q);v(this,ft);v(this,$);v(this,yt);v(this,Et);v(this,X);x(this,"ttl");x(this,"ttlResolution");x(this,"ttlAutopurge");x(this,"updateAgeOnGet");x(this,"updateAgeOnHas");x(this,"allowStale");x(this,"noDisposeOnSet");x(this,"noUpdateTTL");x(this,"maxEntrySize");x(this,"sizeCalculation");x(this,"noDeleteOnFetchRejection");x(this,"noDeleteOnStaleGet");x(this,"allowStaleOnFetchAbort");x(this,"allowStaleOnFetchRejection");x(this,"ignoreFetchAbort");v(this,U);v(this,B);v(this,T);v(this,A);v(this,m);v(this,P);v(this,z);v(this,N);v(this,D);v(this,J);v(this,L);v(this,Q);v(this,Z);v(this,V);v(this,W);v(this,tt);v(this,dt);v(this,j);v(this,xt);v(this,mt,()=>{});v(this,ot,()=>{});v(this,Ot,()=>{});v(this,Y,()=>false);v(this,gt,e=>{});v(this,bt,(e,i,s)=>{});v(this,Tt,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});x(this,te,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:n,updateAgeOnGet:o,updateAgeOnHas:c,allowStale:p,dispose:_,onInsert:R,disposeAfter:S,noDisposeOnSet:rt,noUpdateTTL:I,maxSize:k=0,maxEntrySize:w=0,sizeCalculation:y,fetchMethod:a,memoMethod:E,noDeleteOnFetchRejection:O,noDeleteOnStaleGet:f,allowStaleOnFetchRejection:g,allowStaleOnFetchAbort:F,ignoreFetchAbort:H,perf:vt}=e;if(vt!==void 0&&typeof vt?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(u(this,X,vt??me),i!==0&&!at(i))throw new TypeError("max option must be a nonnegative integer");let _t=i?re(i):Array;if(!_t)throw new Error("invalid max value: "+i);if(u(this,K,i),u(this,M,k),this.maxEntrySize=w||t(this,M),this.sizeCalculation=y,this.sizeCalculation){if(!t(this,M)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(E!==void 0&&typeof E!="function")throw new TypeError("memoMethod must be a function if defined");if(u(this,Et,E),a!==void 0&&typeof a!="function")throw new TypeError("fetchMethod must be a function if specified");if(u(this,yt,a),u(this,dt,!!a),u(this,T,new Map),u(this,A,new Array(i).fill(void 0)),u(this,m,new Array(i).fill(void 0)),u(this,P,new _t(i)),u(this,z,new _t(i)),u(this,N,0),u(this,D,0),u(this,J,ve.create(i)),u(this,U,0),u(this,B,0),typeof _=="function"&&u(this,q,_),typeof R=="function"&&u(this,ft,R),typeof S=="function"?(u(this,$,S),u(this,L,[])):(u(this,$,void 0),u(this,L,void 0)),u(this,tt,!!t(this,q)),u(this,xt,!!t(this,ft)),u(this,j,!!t(this,$)),this.noDisposeOnSet=!!rt,this.noUpdateTTL=!!I,this.noDeleteOnFetchRejection=!!O,this.allowStaleOnFetchRejection=!!g,this.allowStaleOnFetchAbort=!!F,this.ignoreFetchAbort=!!H,this.maxEntrySize!==0){if(t(this,M)!==0&&!at(t(this,M)))throw new TypeError("maxSize must be a positive integer if specified");if(!at(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");d(this,l,ne).call(this);}if(this.allowStale=!!p,this.noDeleteOnStaleGet=!!f,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!c,this.ttlResolution=at(r)||r===0?r:1,this.ttlAutopurge=!!n,this.ttl=s||0,this.ttl){if(!at(this.ttl))throw new TypeError("ttl must be a positive integer if specified");d(this,l,It).call(this);}if(t(this,K)===0&&this.ttl===0&&t(this,M)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,K)&&!t(this,M)){let Pt="LRU_CACHE_UNBOUNDED";ge(Pt)&&(ie.add(Pt),se("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Pt,At));}}get perf(){return t(this,X)}static unsafeExposeInternals(e){return {starts:t(e,Z),ttls:t(e,V),autopurgeTimers:t(e,W),sizes:t(e,Q),keyMap:t(e,T),keyList:t(e,A),valList:t(e,m),next:t(e,P),prev:t(e,z),get head(){return t(e,N)},get tail(){return t(e,D)},free:t(e,J),isBackgroundFetch:i=>{var s;return d(s=e,l,b).call(s,i)},backgroundFetch:(i,s,r,n)=>{var o;return d(o=e,l,Ct).call(o,i,s,r,n)},moveToTail:i=>{var s;return d(s=e,l,wt).call(s,i)},indexes:i=>{var s;return d(s=e,l,lt).call(s,i)},rindexes:i=>{var s;return d(s=e,l,ht).call(s,i)},isStale:i=>{var s;return t(s=e,Y).call(s,i)}}}get max(){return t(this,K)}get maxSize(){return t(this,M)}get calculatedSize(){return t(this,B)}get size(){return t(this,U)}get fetchMethod(){return t(this,yt)}get memoMethod(){return t(this,Et)}get dispose(){return t(this,q)}get onInsert(){return t(this,ft)}get disposeAfter(){return t(this,$)}getRemainingTTL(e){return t(this,T).has(e)?1/0:0}*entries(){for(let e of d(this,l,lt).call(this))t(this,m)[e]!==void 0&&t(this,A)[e]!==void 0&&!d(this,l,b).call(this,t(this,m)[e])&&(yield [t(this,A)[e],t(this,m)[e]]);}*rentries(){for(let e of d(this,l,ht).call(this))t(this,m)[e]!==void 0&&t(this,A)[e]!==void 0&&!d(this,l,b).call(this,t(this,m)[e])&&(yield [t(this,A)[e],t(this,m)[e]]);}*keys(){for(let e of d(this,l,lt).call(this)){let i=t(this,A)[e];i!==void 0&&!d(this,l,b).call(this,t(this,m)[e])&&(yield i);}}*rkeys(){for(let e of d(this,l,ht).call(this)){let i=t(this,A)[e];i!==void 0&&!d(this,l,b).call(this,t(this,m)[e])&&(yield i);}}*values(){for(let e of d(this,l,lt).call(this))t(this,m)[e]!==void 0&&!d(this,l,b).call(this,t(this,m)[e])&&(yield t(this,m)[e]);}*rvalues(){for(let e of d(this,l,ht).call(this))t(this,m)[e]!==void 0&&!d(this,l,b).call(this,t(this,m)[e])&&(yield t(this,m)[e]);}[(ee=Symbol.iterator,te=Symbol.toStringTag,ee)](){return this.entries()}find(e,i={}){for(let s of d(this,l,lt).call(this)){let r=t(this,m)[s],n=d(this,l,b).call(this,r)?r.__staleWhileFetching:r;if(n!==void 0&&e(n,t(this,A)[s],this))return this.get(t(this,A)[s],i)}}forEach(e,i=this){for(let s of d(this,l,lt).call(this)){let r=t(this,m)[s],n=d(this,l,b).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e.call(i,n,t(this,A)[s],this);}}rforEach(e,i=this){for(let s of d(this,l,ht).call(this)){let r=t(this,m)[s],n=d(this,l,b).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e.call(i,n,t(this,A)[s],this);}}purgeStale(){let e=false;for(let i of d(this,l,ht).call(this,{allowStale:true}))t(this,Y).call(this,i)&&(d(this,l,ct).call(this,t(this,A)[i],"expire"),e=true);return e}info(e){let i=t(this,T).get(e);if(i===void 0)return;let s=t(this,m)[i],r=d(this,l,b).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let n={value:r};if(t(this,V)&&t(this,Z)){let o=t(this,V)[i],c=t(this,Z)[i];if(o&&c){let p=o-(t(this,X).now()-c);n.ttl=p,n.start=Date.now();}}return t(this,Q)&&(n.size=t(this,Q)[i]),n}dump(){let e=[];for(let i of d(this,l,lt).call(this,{allowStale:true})){let s=t(this,A)[i],r=t(this,m)[i],n=d(this,l,b).call(this,r)?r.__staleWhileFetching:r;if(n===void 0||s===void 0)continue;let o={value:n};if(t(this,V)&&t(this,Z)){o.ttl=t(this,V)[i];let c=t(this,X).now()-t(this,Z)[i];o.start=Math.floor(Date.now()-c);}t(this,Q)&&(o.size=t(this,Q)[i]),e.unshift([s,o]);}return e}load(e){this.clear();for(let[i,s]of e){if(s.start){let r=Date.now()-s.start;s.start=t(this,X).now()-r;}this.set(i,s.value,s);}}set(e,i,s={}){var rt,I,k,w;if(i===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:n,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:p}=s,{noUpdateTTL:_=this.noUpdateTTL}=s,R=t(this,Tt).call(this,e,i,s.size||0,c);if(this.maxEntrySize&&R>this.maxEntrySize)return p&&(p.set="miss",p.maxEntrySizeExceeded=true),d(this,l,ct).call(this,e,"set"),this;let S=t(this,U)===0?void 0:t(this,T).get(e);if(S===void 0)S=t(this,U)===0?t(this,D):t(this,J).length!==0?t(this,J).pop():t(this,U)===t(this,K)?d(this,l,Lt).call(this,false):t(this,U),t(this,A)[S]=e,t(this,m)[S]=i,t(this,T).set(e,S),t(this,P)[t(this,D)]=S,t(this,z)[S]=t(this,D),u(this,D,S),Rt(this,U)._++,t(this,bt).call(this,S,R,p),p&&(p.set="add"),_=false,t(this,xt)&&((rt=t(this,ft))==null||rt.call(this,i,e,"add"));else {d(this,l,wt).call(this,S);let y=t(this,m)[S];if(i!==y){if(t(this,dt)&&d(this,l,b).call(this,y)){y.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:a}=y;a!==void 0&&!o&&(t(this,tt)&&((I=t(this,q))==null||I.call(this,a,e,"set")),t(this,j)&&t(this,L)?.push([a,e,"set"]));}else o||(t(this,tt)&&((k=t(this,q))==null||k.call(this,y,e,"set")),t(this,j)&&t(this,L)?.push([y,e,"set"]));if(t(this,gt).call(this,S),t(this,bt).call(this,S,R,p),t(this,m)[S]=i,p){p.set="replace";let a=y&&d(this,l,b).call(this,y)?y.__staleWhileFetching:y;a!==void 0&&(p.oldValue=a);}}else p&&(p.set="update");t(this,xt)&&this.onInsert?.(i,e,i===y?"update":"replace");}if(r!==0&&!t(this,V)&&d(this,l,It).call(this),t(this,V)&&(_||t(this,Ot).call(this,S,r,n),p&&t(this,ot).call(this,p,S)),!o&&t(this,j)&&t(this,L)){let y=t(this,L),a;for(;a=y?.shift();)(w=t(this,$))==null||w.call(this,...a);}return this}pop(){var e;try{for(;t(this,U);){let i=t(this,m)[t(this,N)];if(d(this,l,Lt).call(this,!0),d(this,l,b).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(t(this,j)&&t(this,L)){let i=t(this,L),s;for(;s=i?.shift();)(e=t(this,$))==null||e.call(this,...s);}}}has(e,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,n=t(this,T).get(e);if(n!==void 0){let o=t(this,m)[n];if(d(this,l,b).call(this,o)&&o.__staleWhileFetching===void 0)return false;if(t(this,Y).call(this,n))r&&(r.has="stale",t(this,ot).call(this,r,n));else return s&&t(this,mt).call(this,n),r&&(r.has="hit",t(this,ot).call(this,r,n)),true}else r&&(r.has="miss");return false}peek(e,i={}){let{allowStale:s=this.allowStale}=i,r=t(this,T).get(e);if(r===void 0||!s&&t(this,Y).call(this,r))return;let n=t(this,m)[r];return d(this,l,b).call(this,n)?n.__staleWhileFetching:n}async fetch(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:p=0,sizeCalculation:_=this.sizeCalculation,noUpdateTTL:R=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:rt=this.allowStaleOnFetchRejection,ignoreFetchAbort:I=this.ignoreFetchAbort,allowStaleOnFetchAbort:k=this.allowStaleOnFetchAbort,context:w,forceRefresh:y=false,status:a,signal:E}=i;if(!t(this,dt))return a&&(a.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,status:a});let O={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:c,size:p,sizeCalculation:_,noUpdateTTL:R,noDeleteOnFetchRejection:S,allowStaleOnFetchRejection:rt,allowStaleOnFetchAbort:k,ignoreFetchAbort:I,status:a,signal:E},f=t(this,T).get(e);if(f===void 0){a&&(a.fetch="miss");let g=d(this,l,Ct).call(this,e,f,O,w);return g.__returned=g}else {let g=t(this,m)[f];if(d(this,l,b).call(this,g)){let _t=s&&g.__staleWhileFetching!==void 0;return a&&(a.fetch="inflight",_t&&(a.returnedStale=true)),_t?g.__staleWhileFetching:g.__returned=g}let F=t(this,Y).call(this,f);if(!y&&!F)return a&&(a.fetch="hit"),d(this,l,wt).call(this,f),r&&t(this,mt).call(this,f),a&&t(this,ot).call(this,a,f),g;let H=d(this,l,Ct).call(this,e,f,O,w),vt=H.__staleWhileFetching!==void 0&&s;return a&&(a.fetch=F?"stale":"refresh",vt&&F&&(a.returnedStale=true)),vt?H.__staleWhileFetching:H.__returned=H}}async forceFetch(e,i={}){let s=await this.fetch(e,i);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(e,i={}){let s=t(this,Et);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:n,...o}=i,c=this.get(e,o);if(!n&&c!==void 0)return c;let p=s(e,c,{options:o,context:r});return this.set(e,p,o),p}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:o}=i,c=t(this,T).get(e);if(c!==void 0){let p=t(this,m)[c],_=d(this,l,b).call(this,p);return o&&t(this,ot).call(this,o,c),t(this,Y).call(this,c)?(o&&(o.get="stale"),_?(o&&s&&p.__staleWhileFetching!==void 0&&(o.returnedStale=true),s?p.__staleWhileFetching:void 0):(n||d(this,l,ct).call(this,e,"expire"),o&&s&&(o.returnedStale=true),s?p:void 0)):(o&&(o.get="hit"),_?p.__staleWhileFetching:(d(this,l,wt).call(this,c),r&&t(this,mt).call(this,c),p))}else o&&(o.get="miss");}delete(e){return d(this,l,ct).call(this,e,"delete")}clear(){return d(this,l,Vt).call(this,"delete")}},K=new WeakMap,M=new WeakMap,q=new WeakMap,ft=new WeakMap,$=new WeakMap,yt=new WeakMap,Et=new WeakMap,X=new WeakMap,U=new WeakMap,B=new WeakMap,T=new WeakMap,A=new WeakMap,m=new WeakMap,P=new WeakMap,z=new WeakMap,N=new WeakMap,D=new WeakMap,J=new WeakMap,L=new WeakMap,Q=new WeakMap,Z=new WeakMap,V=new WeakMap,W=new WeakMap,tt=new WeakMap,dt=new WeakMap,j=new WeakMap,xt=new WeakMap,l=new WeakSet,It=function(){let e=new Dt(t(this,K)),i=new Dt(t(this,K));u(this,V,e),u(this,Z,i);let s=this.ttlAutopurge?new Array(t(this,K)):void 0;u(this,W,s),u(this,Ot,(c,p,_=t(this,X).now())=>{i[c]=p!==0?_:0,e[c]=p,r(c,p);}),u(this,mt,c=>{i[c]=e[c]!==0?t(this,X).now():0,r(c,e[c]);});let r=this.ttlAutopurge?(c,p)=>{if(s?.[c]&&(clearTimeout(s[c]),s[c]=void 0),p&&p!==0&&s){let _=setTimeout(()=>{t(this,Y).call(this,c)&&d(this,l,ct).call(this,t(this,A)[c],"expire");},p+1);_.unref&&_.unref(),s[c]=_;}}:()=>{};u(this,ot,(c,p)=>{if(e[p]){let _=e[p],R=i[p];if(!_||!R)return;c.ttl=_,c.start=R,c.now=n||o();let S=c.now-R;c.remainingTTL=_-S;}});let n=0,o=()=>{let c=t(this,X).now();if(this.ttlResolution>0){n=c;let p=setTimeout(()=>n=0,this.ttlResolution);p.unref&&p.unref();}return c};this.getRemainingTTL=c=>{let p=t(this,T).get(c);if(p===void 0)return 0;let _=e[p],R=i[p];if(!_||!R)return 1/0;let S=(n||o())-R;return _-S},u(this,Y,c=>{let p=i[c],_=e[c];return !!_&&!!p&&(n||o())-p>_});},mt=new WeakMap,ot=new WeakMap,Ot=new WeakMap,Y=new WeakMap,ne=function(){let e=new Dt(t(this,K));u(this,B,0),u(this,Q,e),u(this,gt,i=>{u(this,B,t(this,B)-e[i]),e[i]=0;}),u(this,Tt,(i,s,r,n)=>{if(d(this,l,b).call(this,s))return 0;if(!at(r))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(r=n(s,i),!at(r))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return r}),u(this,bt,(i,s,r)=>{if(e[i]=s,t(this,M)){let n=t(this,M)-e[i];for(;t(this,B)>n;)d(this,l,Lt).call(this,true);}u(this,B,t(this,B)+e[i]),r&&(r.entrySize=s,r.totalCalculatedSize=t(this,B));});},gt=new WeakMap,bt=new WeakMap,Tt=new WeakMap,lt=function*({allowStale:e=this.allowStale}={}){if(t(this,U))for(let i=t(this,D);!(!d(this,l,Mt).call(this,i)||((e||!t(this,Y).call(this,i))&&(yield i),i===t(this,N)));)i=t(this,z)[i];},ht=function*({allowStale:e=this.allowStale}={}){if(t(this,U))for(let i=t(this,N);!(!d(this,l,Mt).call(this,i)||((e||!t(this,Y).call(this,i))&&(yield i),i===t(this,D)));)i=t(this,P)[i];},Mt=function(e){return e!==void 0&&t(this,T).get(t(this,A)[e])===e},Lt=function(e){var n;let i=t(this,N),s=t(this,A)[i],r=t(this,m)[i];return t(this,dt)&&d(this,l,b).call(this,r)?r.__abortController.abort(new Error("evicted")):(t(this,tt)||t(this,j))&&(t(this,tt)&&((n=t(this,q))==null||n.call(this,r,s,"evict")),t(this,j)&&t(this,L)?.push([r,s,"evict"])),t(this,gt).call(this,i),t(this,W)?.[i]&&(clearTimeout(t(this,W)[i]),t(this,W)[i]=void 0),e&&(t(this,A)[i]=void 0,t(this,m)[i]=void 0,t(this,J).push(i)),t(this,U)===1?(u(this,N,u(this,D,0)),t(this,J).length=0):u(this,N,t(this,P)[i]),t(this,T).delete(s),Rt(this,U)._--,i},Ct=function(e,i,s,r){let n=i===void 0?void 0:t(this,m)[i];if(d(this,l,b).call(this,n))return n;let o=new Nt,{signal:c}=s;c?.addEventListener("abort",()=>o.abort(c.reason),{signal:o.signal});let p={signal:o.signal,options:s,context:r},_=(w,y=false)=>{let{aborted:a}=o.signal,E=s.ignoreFetchAbort&&w!==void 0,O=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&w!==void 0);if(s.status&&(a&&!y?(s.status.fetchAborted=true,s.status.fetchError=o.signal.reason,E&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),a&&!E&&!y)return S(o.signal.reason,O);let f=I,g=t(this,m)[i];return (g===I||E&&y&&g===void 0)&&(w===void 0?f.__staleWhileFetching!==void 0?t(this,m)[i]=f.__staleWhileFetching:d(this,l,ct).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,w,p.options))),w},R=w=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=w),S(w,false)),S=(w,y)=>{let{aborted:a}=o.signal,E=a&&s.allowStaleOnFetchAbort,O=E||s.allowStaleOnFetchRejection,f=O||s.noDeleteOnFetchRejection,g=I;if(t(this,m)[i]===I&&(!f||!y&&g.__staleWhileFetching===void 0?d(this,l,ct).call(this,e,"fetch"):E||(t(this,m)[i]=g.__staleWhileFetching)),O)return s.status&&g.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),g.__staleWhileFetching;if(g.__returned===g)throw w},rt=(w,y)=>{var E;let a=(E=t(this,yt))==null?void 0:E.call(this,e,n,p);a&&a instanceof Promise&&a.then(O=>w(O===void 0?void 0:O),y),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(w(void 0),s.allowStaleOnFetchAbort&&(w=O=>_(O,true)));});};s.status&&(s.status.fetchDispatched=true);let I=new Promise(rt).then(_,R),k=Object.assign(I,{__abortController:o,__staleWhileFetching:n,__returned:void 0});return i===void 0?(this.set(e,k,{...p.options,status:void 0}),i=t(this,T).get(e)):t(this,m)[i]=k,k},b=function(e){if(!t(this,dt))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Nt},zt=function(e,i){t(this,z)[i]=e,t(this,P)[e]=i;},wt=function(e){e!==t(this,D)&&(e===t(this,N)?u(this,N,t(this,P)[e]):d(this,l,zt).call(this,t(this,z)[e],t(this,P)[e]),d(this,l,zt).call(this,t(this,D),e),u(this,D,e));},ct=function(e,i){var r,n;let s=false;if(t(this,U)!==0){let o=t(this,T).get(e);if(o!==void 0)if(t(this,W)?.[o]&&(clearTimeout(t(this,W)?.[o]),t(this,W)[o]=void 0),s=true,t(this,U)===1)d(this,l,Vt).call(this,i);else {t(this,gt).call(this,o);let c=t(this,m)[o];if(d(this,l,b).call(this,c)?c.__abortController.abort(new Error("deleted")):(t(this,tt)||t(this,j))&&(t(this,tt)&&((r=t(this,q))==null||r.call(this,c,e,i)),t(this,j)&&t(this,L)?.push([c,e,i])),t(this,T).delete(e),t(this,A)[o]=void 0,t(this,m)[o]=void 0,o===t(this,D))u(this,D,t(this,z)[o]);else if(o===t(this,N))u(this,N,t(this,P)[o]);else {let p=t(this,z)[o];t(this,P)[p]=t(this,P)[o];let _=t(this,P)[o];t(this,z)[_]=t(this,z)[o];}Rt(this,U)._--,t(this,J).push(o);}}if(t(this,j)&&t(this,L)?.length){let o=t(this,L),c;for(;c=o?.shift();)(n=t(this,$))==null||n.call(this,...c);}return s},Vt=function(e){var i,s;for(let r of d(this,l,ht).call(this,{allowStale:true})){let n=t(this,m)[r];if(d(this,l,b).call(this,n))n.__abortController.abort(new Error("deleted"));else {let o=t(this,A)[r];t(this,tt)&&((i=t(this,q))==null||i.call(this,n,o,e)),t(this,j)&&t(this,L)?.push([n,o,e]);}}if(t(this,T).clear(),t(this,m).fill(void 0),t(this,A).fill(void 0),t(this,V)&&t(this,Z)){t(this,V).fill(0),t(this,Z).fill(0);for(let r of t(this,W)??[])r!==void 0&&clearTimeout(r);t(this,W)?.fill(void 0);}if(t(this,Q)&&t(this,Q).fill(0),u(this,N,0),u(this,D,0),t(this,J).length=0,u(this,B,0),u(this,U,0),t(this,j)&&t(this,L)){let r=t(this,L),n;for(;n=r?.shift();)(s=t(this,$))==null||s.call(this,...n);}},At);var Ft=class{constructor(e){x(this,"cache");x(this,"map",new Map);this.cache=new oe({max:e.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(e){let i=this.map.delete(e);return i&&this.cache.delete(e),i}get forEach(){return this.map.forEach}get(e){let i=this.cache.get(e);return i||this.map.get(e)}has(e){return this.map.has(e)}set(e,i){return this.map.set(e,i),this.cache.set(e,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var Ut="1.7.2";var Wt={version:Ut};var Yt="repeat";function Ht(h){return {type:"pause",duration:h}}var Kt="__game_layer__";var _e="general";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 le={};var kt={};fe(kt,{createExportableElement:()=>he});var pt;(r=>(r.log=(n,...o)=>console.log(`[Pixi\u2019VN] ${n}`,...o),r.warn=(n,...o)=>console.warn(`[Pixi\u2019VN] ${n}`,...o),r.error=(n,...o)=>console.error(`[Pixi\u2019VN] ${n}`,...o),r.info=(n,...o)=>console.info(`[Pixi\u2019VN] ${n}`,...o)))(pt||(pt={}));function he(h){try{if(typeof h>"u")return h;let e=JSON.stringify(h);return JSON.parse(e)}catch(e){throw pt.error("Error creating exportable element",h,e),new core.PixiError("not_json_serializable","Error creating exportable element")}}var ce=[" ____ _ _ ___ ___ _ "," | _ \\(_)_ _(_| ) \\ / / \\ | |"," | |_) | \\ \\/ / |/ \\ \\ / /| \\| |"," | __/| |> <| | \\ V / | |\\ |",` |_| |_/_/\\_\\_| \\_/ |_| \\_| v${Wt.version}`],de=17,Ee="background:#2f90da;color:#fff;font-weight:bold;",xe="background:#c832bb;color:#fff;font-weight:bold;",be="background:transparent;font-weight:bold;",qt=` v${Wt.version}`;function pe(){let h=[],e=[];for(let i=0;i<ce.length;i++){let s=ce[i],r=s.endsWith(qt),n=r?s.slice(0,-qt.length):s,o=n.slice(0,de),c=n.slice(de),p=r?"%c%s%c%s%c%s":"%c%s%c%s";h.push(p),e.push(Ee,o,xe,c),r&&e.push(be,qt);}console.info(h.join(`
|
|
2
|
+
`),...e);}function $t(){let h=window.location.pathname+window.location.hash;return h.includes("#")&&(h=h.split("#")[1]),h}exports.Game=void 0;(y=>{async function h(a,E,O){if(core.GameUnifier.init({navigate:E?.navigate,getCurrentGameStepState:()=>{let f={};try{f=nt__namespace.canvas.export();}catch{}return {path:$t(),storage:G__namespace.storage.export(),canvas:f,sound:ut__namespace.sound.export(),labelIndex:C__namespace.NarrationManagerStatic.currentLabelStepIndex||0,openedLabels:C__namespace.narration.openedLabels}},restoreGameStepState:async(f,g)=>{et__namespace.HistoryManagerStatic._originalStepData=f,C__namespace.NarrationManagerStatic.openedLabels=f.openedLabels,G__namespace.storage.restore(f.storage);try{await nt__namespace.canvas.restore(f.canvas),await ut__namespace.sound.restore(f.sound);}catch(F){pt.error("Error restoring game step state:",F);}await g(f.path);},getStepCounter:()=>C__namespace.narration.stepCounter,setStepCounter:f=>{C__namespace.NarrationManagerStatic._stepCounter=f;},getOpenedLabels:()=>C__namespace.narration.openedLabels.length,addHistoryItem:(f,g)=>et__namespace.stepHistory.add(f,g),getCharacter:f=>Bt__namespace.RegisteredCharacters.get(f),processNavigationRequests:(f,g)=>{let F=f,H=Promise.resolve();return f>0?(F--,H=C__namespace.narration.continue(g)):f<0&&(F=0,H=et__namespace.stepHistory.back(g,{steps:f*-1})),{newValue:F,result:H}},animate:(f,g,F,H)=>motion.motion.animate(f,g,F,H),getVariable:(f,g)=>G__namespace.StorageManagerStatic.getVariable(f,g),setVariable:(f,g,F)=>G__namespace.StorageManagerStatic.setVariable(f,g,F),removeVariable:(f,g)=>G__namespace.StorageManagerStatic.removeVariable(f,g),getFlag:f=>G__namespace.storage.getFlag(f),setFlag:(f,g)=>G__namespace.storage.setFlag(f,g),onLabelClosing:f=>G__namespace.StorageManagerStatic.clearOldTempVariables(f)}),pe(),!a||!E){pt.warn("The canvas element or options are not defined. The canvas will not be initialized.");return}return await nt__namespace.canvas.init(a,E,O)}y.init=h;function e(){G__namespace.storage.clear();try{nt__namespace.canvas.clear();}catch{}ut__namespace.sound.clear(),C__namespace.narration.clear(),et__namespace.stepHistory.clear();}y.clear=e;function i(){let a={};try{a=nt__namespace.canvas.export();}catch{}return {pixivn_version:Ut,stepData:C__namespace.narration.export(),storageData:G__namespace.storage.export(),canvasData:a,soundData:ut__namespace.sound.export(),historyData:et__namespace.stepHistory.export(),path:$t()}}y.exportGameState=i;async function s(a,E){et__namespace.stepHistory.restore(a.historyData);let O=et__namespace.stepHistory.lastKey;if(typeof O=="number"){let f=et__namespace.stepHistory.stepsInfoMap.get(O)||null;await C__namespace.narration.restore(a.stepData,f);}G__namespace.storage.restore(a.storageData);try{await nt__namespace.canvas.restore(a.canvasData),await ut__namespace.sound.restore(a.soundData);}catch{}E?await E(a.path):await core.GameUnifier.navigate(a.path);}y.restoreGameState=s;async function r(a,E){return y.clear(),await C__namespace.narration.call(a,E)}y.start=r;function n(a){return JSON.parse(a)}y.jsonToGameState=n;function o(a){core.GameUnifier.onEnd=a;}y.onEnd=o;function c(a){return pt.warn("Game.onError is deprecated. Use Game.addOnError / Game.removeOnError to register multiple handlers."),core.GameUnifier.addOnError((E,O)=>a("step",E,O))}y.onError=c;function p(a){return core.GameUnifier.addOnError(a)}y.addOnError=p;function _(a){return core.GameUnifier.removeOnError(a)}y.removeOnError=_;function R(a){C__namespace.NarrationManagerStatic.onStepStart=a;}y.onStepStart=R;function S(a){C__namespace.NarrationManagerStatic.onLoadingLabel=a;}y.onLoadingLabel=S;function rt(a){C__namespace.NarrationManagerStatic.onStepEnd=a;}y.onStepEnd=rt;function I(a){core.GameUnifier.navigate=a;}y.onNavigate=I;function k(a){return core.GameUnifier.addOnPreContinue(a)}y.addOnPreContinue=k;function w(a){return core.GameUnifier.removeOnPreContinue(a)}y.removeOnPreContinue=w;})(exports.Game||(exports.Game={}));var Ze={characterUtils:Bt__namespace,canvasUtils:nt__namespace,narrationUtils:C__namespace,soundUtils:ut__namespace,CANVAS_APP_GAME_LAYER_ALIAS:Kt,Pause:Ht,Repeat:Yt,PIXIVN_VERSION:Ut,...kt,...le,canvas:nt__namespace.canvas,narration:C__namespace.narration,sound:ut__namespace.sound,storage:G__namespace.storage,history:et__namespace.stepHistory,Game:exports.Game,GameUnifier:core.GameUnifier};exports.CANVAS_APP_GAME_LAYER_ALIAS=Kt;exports.CachedMap=Ft;exports.GENERAL_CHANNEL=_e;exports.PIXIVN_VERSION=Ut;exports.Pause=Ht;exports.Repeat=Yt;exports.SYSTEM_RESERVED_STORAGE_KEYS=Se;exports.createExportableElement=he;exports.default=Ze;Object.keys(nt).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return nt[k]}})});Object.keys(Bt).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return Bt[k]}})});Object.keys(core).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return core[k]}})});Object.keys(et).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return et[k]}})});Object.keys(C).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return C[k]}})});Object.keys(ut).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return ut[k]}})});Object.keys(G).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return G[k]}})});
|
package/dist/index.d.cts
CHANGED
|
@@ -31,6 +31,10 @@ interface SoundPlayOptions extends Omit<PlayOptions, "complete" | "loaded"> {
|
|
|
31
31
|
* The delay in seconds before playback becomes audible or resumes. If specified, the sound will be started immediately but delayed (for example, via pause/unpause) so that it is effectively heard only after the delay. If not specified, the sound will play without any additional delay.
|
|
32
32
|
*/
|
|
33
33
|
delay?: number;
|
|
34
|
+
/**
|
|
35
|
+
* Whether the sound is paused. If specified, the sound will be paused or unpaused according to the value. If not specified, the sound will play without being paused or unpaused.
|
|
36
|
+
*/
|
|
37
|
+
paused?: boolean;
|
|
34
38
|
}
|
|
35
39
|
interface SoundPlayOptionsWithChannel extends SoundPlayOptions {
|
|
36
40
|
/**
|
|
@@ -39,7 +43,7 @@ interface SoundPlayOptionsWithChannel extends SoundPlayOptions {
|
|
|
39
43
|
*/
|
|
40
44
|
channel?: string;
|
|
41
45
|
}
|
|
42
|
-
interface ChannelOptions extends Pick<SoundPlayOptions, "filters" | "muted" | "volume"> {
|
|
46
|
+
interface ChannelOptions extends Pick<SoundPlayOptions, "filters" | "muted" | "volume" | "paused"> {
|
|
43
47
|
/**
|
|
44
48
|
* Whether this channel is a background channel.
|
|
45
49
|
* Background channels are special channels. Unlike normal channels, media connected to a background channel does not stop when a scene changes, but continues to play in the background.
|
|
@@ -71,6 +75,21 @@ interface AudioChannelInterface {
|
|
|
71
75
|
* has not yet loaded.
|
|
72
76
|
*/
|
|
73
77
|
play(mediaAlias: string, soundAlias: string, options?: SoundPlayOptions): Promise<IMediaInstance>;
|
|
78
|
+
/**
|
|
79
|
+
* Plays a non-persistent sound on this channel.
|
|
80
|
+
* The returned media is not tracked by the sound manager and is therefore excluded from save/export state.
|
|
81
|
+
* @param soundAlias The sound (asset) alias reference.
|
|
82
|
+
* @param options The options.
|
|
83
|
+
* @return The sound instance.
|
|
84
|
+
*/
|
|
85
|
+
playTransient(soundAlias: string, options?: SoundPlayOptions): Promise<IMediaInstance>;
|
|
86
|
+
/**
|
|
87
|
+
* Stops all media instances that were started with {@link playTransient} on this channel.
|
|
88
|
+
* Instances that have already ended are automatically removed, so this only affects
|
|
89
|
+
* those that are still playing or paused.
|
|
90
|
+
* @return Instance for chaining.
|
|
91
|
+
*/
|
|
92
|
+
stopTransientAll(): this;
|
|
74
93
|
/**
|
|
75
94
|
* The volume of the audio channel, between 0 and 1. This is multiplied with the volume of each sound played through this channel.
|
|
76
95
|
*/
|
|
@@ -98,6 +117,17 @@ interface AudioChannelInterface {
|
|
|
98
117
|
* @return Instance for chaining.
|
|
99
118
|
*/
|
|
100
119
|
pauseAll(): this;
|
|
120
|
+
/**
|
|
121
|
+
* Temporarily pauses this channel without mutating each media instance's persisted paused option.
|
|
122
|
+
* Useful for overlays (for example settings/pause menus) where pause state must not be saved.
|
|
123
|
+
* @return Instance for chaining.
|
|
124
|
+
*/
|
|
125
|
+
pauseUnsavedAll(): this;
|
|
126
|
+
/**
|
|
127
|
+
* Restores this channel after `pauseUnsavedAll()`, reapplying each media instance's persisted paused option.
|
|
128
|
+
* @return Instance for chaining.
|
|
129
|
+
*/
|
|
130
|
+
resumeUnsavedAll(): this;
|
|
101
131
|
/**
|
|
102
132
|
* Resumes any sounds.
|
|
103
133
|
* @return Instance for chaining.
|
|
@@ -179,7 +209,10 @@ interface SoundGameState {
|
|
|
179
209
|
options: Omit<SoundPlayOptions, "filters"> & {
|
|
180
210
|
filters?: SoundFilterMemory[];
|
|
181
211
|
};
|
|
182
|
-
|
|
212
|
+
/**
|
|
213
|
+
* @deprecated Use options.paused instead.
|
|
214
|
+
*/
|
|
215
|
+
paused?: boolean;
|
|
183
216
|
};
|
|
184
217
|
};
|
|
185
218
|
}
|
|
@@ -199,6 +232,22 @@ interface SoundManagerInterface extends Omit<SoundLibrary, "init" | "close" | "a
|
|
|
199
232
|
*/
|
|
200
233
|
play(alias: string, options?: SoundPlayOptionsWithChannel): Promise<IMediaInstance>;
|
|
201
234
|
play(mediaAlias: string, soundAlias: string, options?: SoundPlayOptionsWithChannel): Promise<IMediaInstance>;
|
|
235
|
+
/**
|
|
236
|
+
* Plays a non-persistent sound (for example UI/menu sounds).
|
|
237
|
+
* This playback is not tracked in save/export state.
|
|
238
|
+
* @param alias The sound (asset) alias reference.
|
|
239
|
+
* @param options The options.
|
|
240
|
+
* @return The sound instance.
|
|
241
|
+
*/
|
|
242
|
+
playTransient(alias: string, options?: SoundPlayOptionsWithChannel): Promise<IMediaInstance>;
|
|
243
|
+
/**
|
|
244
|
+
* Stops all transient media instances started with {@link playTransient}.
|
|
245
|
+
* If `channel` is provided only instances on that channel are stopped;
|
|
246
|
+
* otherwise all channels are affected.
|
|
247
|
+
* @param channel Optional channel alias to limit the operation to.
|
|
248
|
+
* @return Instance for chaining.
|
|
249
|
+
*/
|
|
250
|
+
stopTransientAll(channel?: string): this;
|
|
202
251
|
/**
|
|
203
252
|
* Find a media by alias.
|
|
204
253
|
* @param alias - The media alias reference.
|
|
@@ -237,6 +286,21 @@ interface SoundManagerInterface extends Omit<SoundLibrary, "init" | "close" | "a
|
|
|
237
286
|
* @return Instance for chaining.
|
|
238
287
|
*/
|
|
239
288
|
resumeAll(): this;
|
|
289
|
+
/**
|
|
290
|
+
* Temporarily pauses all sounds across all channels (or just the given channel) without
|
|
291
|
+
* mutating each media instance's persisted paused option.
|
|
292
|
+
* Useful for overlays (for example settings/pause menus) where pause state must not be saved.
|
|
293
|
+
* @param channel Optional channel alias to limit the operation to.
|
|
294
|
+
* @return Instance for chaining.
|
|
295
|
+
*/
|
|
296
|
+
pauseUnsavedAll(channel?: string): this;
|
|
297
|
+
/**
|
|
298
|
+
* Restores all channels (or just the given channel) after `pauseUnsavedAll()`,
|
|
299
|
+
* reapplying each media instance's persisted paused option.
|
|
300
|
+
* @param channel Optional channel alias to limit the operation to.
|
|
301
|
+
* @return Instance for chaining.
|
|
302
|
+
*/
|
|
303
|
+
resumeUnsavedAll(channel?: string): this;
|
|
240
304
|
/**
|
|
241
305
|
* Mutes all playing sounds.
|
|
242
306
|
* @return Instance for chaining.
|
|
@@ -535,7 +599,7 @@ interface ContainerMemory<C extends ContainerChild = ContainerChild> extends Con
|
|
|
535
599
|
elements: CanvasBaseItemMemory[];
|
|
536
600
|
}
|
|
537
601
|
|
|
538
|
-
var version = "1.
|
|
602
|
+
var version = "1.7.2";
|
|
539
603
|
|
|
540
604
|
/**
|
|
541
605
|
* @deprecated
|
|
@@ -850,7 +914,12 @@ declare namespace Game {
|
|
|
850
914
|
/**
|
|
851
915
|
* Load the save data
|
|
852
916
|
* @param data The save data
|
|
853
|
-
|
|
917
|
+
*/
|
|
918
|
+
function restoreGameState(data: GameState): Promise<void>;
|
|
919
|
+
/**
|
|
920
|
+
* @deprecated Use `restoreGameState(data)` (without the `navigate` argument) and configure navigation via `Game.init({ navigate })` or `Game.onNavigate(...)`.
|
|
921
|
+
* @param data The save data
|
|
922
|
+
* @param navigate Navigation function to use for this restore call.
|
|
854
923
|
*/
|
|
855
924
|
function restoreGameState(data: GameState, navigate: (path: string) => void | Promise<void>): Promise<void>;
|
|
856
925
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -31,6 +31,10 @@ interface SoundPlayOptions extends Omit<PlayOptions, "complete" | "loaded"> {
|
|
|
31
31
|
* The delay in seconds before playback becomes audible or resumes. If specified, the sound will be started immediately but delayed (for example, via pause/unpause) so that it is effectively heard only after the delay. If not specified, the sound will play without any additional delay.
|
|
32
32
|
*/
|
|
33
33
|
delay?: number;
|
|
34
|
+
/**
|
|
35
|
+
* Whether the sound is paused. If specified, the sound will be paused or unpaused according to the value. If not specified, the sound will play without being paused or unpaused.
|
|
36
|
+
*/
|
|
37
|
+
paused?: boolean;
|
|
34
38
|
}
|
|
35
39
|
interface SoundPlayOptionsWithChannel extends SoundPlayOptions {
|
|
36
40
|
/**
|
|
@@ -39,7 +43,7 @@ interface SoundPlayOptionsWithChannel extends SoundPlayOptions {
|
|
|
39
43
|
*/
|
|
40
44
|
channel?: string;
|
|
41
45
|
}
|
|
42
|
-
interface ChannelOptions extends Pick<SoundPlayOptions, "filters" | "muted" | "volume"> {
|
|
46
|
+
interface ChannelOptions extends Pick<SoundPlayOptions, "filters" | "muted" | "volume" | "paused"> {
|
|
43
47
|
/**
|
|
44
48
|
* Whether this channel is a background channel.
|
|
45
49
|
* Background channels are special channels. Unlike normal channels, media connected to a background channel does not stop when a scene changes, but continues to play in the background.
|
|
@@ -71,6 +75,21 @@ interface AudioChannelInterface {
|
|
|
71
75
|
* has not yet loaded.
|
|
72
76
|
*/
|
|
73
77
|
play(mediaAlias: string, soundAlias: string, options?: SoundPlayOptions): Promise<IMediaInstance>;
|
|
78
|
+
/**
|
|
79
|
+
* Plays a non-persistent sound on this channel.
|
|
80
|
+
* The returned media is not tracked by the sound manager and is therefore excluded from save/export state.
|
|
81
|
+
* @param soundAlias The sound (asset) alias reference.
|
|
82
|
+
* @param options The options.
|
|
83
|
+
* @return The sound instance.
|
|
84
|
+
*/
|
|
85
|
+
playTransient(soundAlias: string, options?: SoundPlayOptions): Promise<IMediaInstance>;
|
|
86
|
+
/**
|
|
87
|
+
* Stops all media instances that were started with {@link playTransient} on this channel.
|
|
88
|
+
* Instances that have already ended are automatically removed, so this only affects
|
|
89
|
+
* those that are still playing or paused.
|
|
90
|
+
* @return Instance for chaining.
|
|
91
|
+
*/
|
|
92
|
+
stopTransientAll(): this;
|
|
74
93
|
/**
|
|
75
94
|
* The volume of the audio channel, between 0 and 1. This is multiplied with the volume of each sound played through this channel.
|
|
76
95
|
*/
|
|
@@ -98,6 +117,17 @@ interface AudioChannelInterface {
|
|
|
98
117
|
* @return Instance for chaining.
|
|
99
118
|
*/
|
|
100
119
|
pauseAll(): this;
|
|
120
|
+
/**
|
|
121
|
+
* Temporarily pauses this channel without mutating each media instance's persisted paused option.
|
|
122
|
+
* Useful for overlays (for example settings/pause menus) where pause state must not be saved.
|
|
123
|
+
* @return Instance for chaining.
|
|
124
|
+
*/
|
|
125
|
+
pauseUnsavedAll(): this;
|
|
126
|
+
/**
|
|
127
|
+
* Restores this channel after `pauseUnsavedAll()`, reapplying each media instance's persisted paused option.
|
|
128
|
+
* @return Instance for chaining.
|
|
129
|
+
*/
|
|
130
|
+
resumeUnsavedAll(): this;
|
|
101
131
|
/**
|
|
102
132
|
* Resumes any sounds.
|
|
103
133
|
* @return Instance for chaining.
|
|
@@ -179,7 +209,10 @@ interface SoundGameState {
|
|
|
179
209
|
options: Omit<SoundPlayOptions, "filters"> & {
|
|
180
210
|
filters?: SoundFilterMemory[];
|
|
181
211
|
};
|
|
182
|
-
|
|
212
|
+
/**
|
|
213
|
+
* @deprecated Use options.paused instead.
|
|
214
|
+
*/
|
|
215
|
+
paused?: boolean;
|
|
183
216
|
};
|
|
184
217
|
};
|
|
185
218
|
}
|
|
@@ -199,6 +232,22 @@ interface SoundManagerInterface extends Omit<SoundLibrary, "init" | "close" | "a
|
|
|
199
232
|
*/
|
|
200
233
|
play(alias: string, options?: SoundPlayOptionsWithChannel): Promise<IMediaInstance>;
|
|
201
234
|
play(mediaAlias: string, soundAlias: string, options?: SoundPlayOptionsWithChannel): Promise<IMediaInstance>;
|
|
235
|
+
/**
|
|
236
|
+
* Plays a non-persistent sound (for example UI/menu sounds).
|
|
237
|
+
* This playback is not tracked in save/export state.
|
|
238
|
+
* @param alias The sound (asset) alias reference.
|
|
239
|
+
* @param options The options.
|
|
240
|
+
* @return The sound instance.
|
|
241
|
+
*/
|
|
242
|
+
playTransient(alias: string, options?: SoundPlayOptionsWithChannel): Promise<IMediaInstance>;
|
|
243
|
+
/**
|
|
244
|
+
* Stops all transient media instances started with {@link playTransient}.
|
|
245
|
+
* If `channel` is provided only instances on that channel are stopped;
|
|
246
|
+
* otherwise all channels are affected.
|
|
247
|
+
* @param channel Optional channel alias to limit the operation to.
|
|
248
|
+
* @return Instance for chaining.
|
|
249
|
+
*/
|
|
250
|
+
stopTransientAll(channel?: string): this;
|
|
202
251
|
/**
|
|
203
252
|
* Find a media by alias.
|
|
204
253
|
* @param alias - The media alias reference.
|
|
@@ -237,6 +286,21 @@ interface SoundManagerInterface extends Omit<SoundLibrary, "init" | "close" | "a
|
|
|
237
286
|
* @return Instance for chaining.
|
|
238
287
|
*/
|
|
239
288
|
resumeAll(): this;
|
|
289
|
+
/**
|
|
290
|
+
* Temporarily pauses all sounds across all channels (or just the given channel) without
|
|
291
|
+
* mutating each media instance's persisted paused option.
|
|
292
|
+
* Useful for overlays (for example settings/pause menus) where pause state must not be saved.
|
|
293
|
+
* @param channel Optional channel alias to limit the operation to.
|
|
294
|
+
* @return Instance for chaining.
|
|
295
|
+
*/
|
|
296
|
+
pauseUnsavedAll(channel?: string): this;
|
|
297
|
+
/**
|
|
298
|
+
* Restores all channels (or just the given channel) after `pauseUnsavedAll()`,
|
|
299
|
+
* reapplying each media instance's persisted paused option.
|
|
300
|
+
* @param channel Optional channel alias to limit the operation to.
|
|
301
|
+
* @return Instance for chaining.
|
|
302
|
+
*/
|
|
303
|
+
resumeUnsavedAll(channel?: string): this;
|
|
240
304
|
/**
|
|
241
305
|
* Mutes all playing sounds.
|
|
242
306
|
* @return Instance for chaining.
|
|
@@ -535,7 +599,7 @@ interface ContainerMemory<C extends ContainerChild = ContainerChild> extends Con
|
|
|
535
599
|
elements: CanvasBaseItemMemory[];
|
|
536
600
|
}
|
|
537
601
|
|
|
538
|
-
var version = "1.
|
|
602
|
+
var version = "1.7.2";
|
|
539
603
|
|
|
540
604
|
/**
|
|
541
605
|
* @deprecated
|
|
@@ -850,7 +914,12 @@ declare namespace Game {
|
|
|
850
914
|
/**
|
|
851
915
|
* Load the save data
|
|
852
916
|
* @param data The save data
|
|
853
|
-
|
|
917
|
+
*/
|
|
918
|
+
function restoreGameState(data: GameState): Promise<void>;
|
|
919
|
+
/**
|
|
920
|
+
* @deprecated Use `restoreGameState(data)` (without the `navigate` argument) and configure navigation via `Game.init({ navigate })` or `Game.onNavigate(...)`.
|
|
921
|
+
* @param data The save data
|
|
922
|
+
* @param navigate Navigation function to use for this restore call.
|
|
854
923
|
*/
|
|
855
924
|
function restoreGameState(data: GameState, navigate: (path: string) => void | Promise<void>): Promise<void>;
|
|
856
925
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
import {b as b$1,d,a,c,e,f as f$1,g}from'./chunk-TTRUPDAB.mjs';import*as nt from'@drincs/pixi-vn/canvas';export*from'@drincs/pixi-vn/canvas';import*as qt from'@drincs/pixi-vn/characters';export*from'@drincs/pixi-vn/characters';import {PixiError,GameUnifier}from'@drincs/pixi-vn/core';export*from'@drincs/pixi-vn/core';import*as et from'@drincs/pixi-vn/history';export*from'@drincs/pixi-vn/history';import*as C from'@drincs/pixi-vn/narration';export*from'@drincs/pixi-vn/narration';import*as pt from'@drincs/pixi-vn/sound';export*from'@drincs/pixi-vn/sound';import*as I from'@drincs/pixi-vn/storage';export*from'@drincs/pixi-vn/storage';import {motion}from'@drincs/pixi-vn/motion';var ne=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Jt=new Set,jt=typeof process=="object"&&process?process:{},Qt=(g,e,i,s)=>{typeof jt.emitWarning=="function"?jt.emitWarning(g,e,i,s):console.error(`[${i}] ${e}: ${g}`);},Nt=globalThis.AbortController,Xt=globalThis.AbortSignal;if(typeof Nt>"u"){Xt=class{constructor(){b$1(this,"onabort");b$1(this,"_onabort",[]);b$1(this,"reason");b$1(this,"aborted",false);}addEventListener(i,s){this._onabort.push(s);}},Nt=class{constructor(){b$1(this,"signal",new Xt);e();}abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let g=jt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{g&&(g=false,Qt("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 ae=g=>!Jt.has(g);var at=g=>g&&g===Math.floor(g)&&g>0&&isFinite(g),Zt=g=>at(g)?g<=Math.pow(2,8)?Uint8Array:g<=Math.pow(2,16)?Uint16Array:g<=Math.pow(2,32)?Uint32Array:g<=Number.MAX_SAFE_INTEGER?Dt:null:null,Dt=class extends Array{constructor(g){super(g),this.fill(0);}},it,St,le=(it=class{constructor(e,i){b$1(this,"heap");b$1(this,"length");if(!c(it,St))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}static create(e$1){let i=Zt(e$1);if(!i)return [];e(it,St,true);let s=new it(e$1,i);return e(it,St,false),s}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},St=new WeakMap,d(it,St,false),it),$t,Bt,K,G,q,ut,X,yt,Et,$,U,B,T,b,f,F,z,N,D,J,L,Q,Z,V,W,tt,ct,P,xt,l,It,ft,rt,Ot,Y,ee,mt,At,Tt,lt,ht,Mt,Lt,Ct,A,Gt,wt,dt,zt,bt,te=(bt=class{constructor(e$1){d(this,l);d(this,K);d(this,G);d(this,q);d(this,ut);d(this,X);d(this,yt);d(this,Et);d(this,$);b$1(this,"ttl");b$1(this,"ttlResolution");b$1(this,"ttlAutopurge");b$1(this,"updateAgeOnGet");b$1(this,"updateAgeOnHas");b$1(this,"allowStale");b$1(this,"noDisposeOnSet");b$1(this,"noUpdateTTL");b$1(this,"maxEntrySize");b$1(this,"sizeCalculation");b$1(this,"noDeleteOnFetchRejection");b$1(this,"noDeleteOnStaleGet");b$1(this,"allowStaleOnFetchAbort");b$1(this,"allowStaleOnFetchRejection");b$1(this,"ignoreFetchAbort");d(this,U);d(this,B);d(this,T);d(this,b);d(this,f);d(this,F);d(this,z);d(this,N);d(this,D);d(this,J);d(this,L);d(this,Q);d(this,Z);d(this,V);d(this,W);d(this,tt);d(this,ct);d(this,P);d(this,xt);d(this,ft,()=>{});d(this,rt,()=>{});d(this,Ot,()=>{});d(this,Y,()=>false);d(this,mt,e=>{});d(this,At,(e,i,s)=>{});d(this,Tt,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});b$1(this,$t,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:n,updateAgeOnGet:o,updateAgeOnHas:d$1,allowStale:c$1,dispose:v,onInsert:R,disposeAfter:S,noDisposeOnSet:st,noUpdateTTL:M,maxSize:k=0,maxEntrySize:w=0,sizeCalculation:y,fetchMethod:a,memoMethod:x,noDeleteOnFetchRejection:O,noDeleteOnStaleGet:u,allowStaleOnFetchRejection:m,allowStaleOnFetchAbort:j,ignoreFetchAbort:H,perf:gt}=e$1;if(gt!==void 0&&typeof gt?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(e(this,$,gt??ne),i!==0&&!at(i))throw new TypeError("max option must be a nonnegative integer");let vt=i?Zt(i):Array;if(!vt)throw new Error("invalid max value: "+i);if(e(this,K,i),e(this,G,k),this.maxEntrySize=w||c(this,G),this.sizeCalculation=y,this.sizeCalculation){if(!c(this,G)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(x!==void 0&&typeof x!="function")throw new TypeError("memoMethod must be a function if defined");if(e(this,Et,x),a!==void 0&&typeof a!="function")throw new TypeError("fetchMethod must be a function if specified");if(e(this,yt,a),e(this,ct,!!a),e(this,T,new Map),e(this,b,new Array(i).fill(void 0)),e(this,f,new Array(i).fill(void 0)),e(this,F,new vt(i)),e(this,z,new vt(i)),e(this,N,0),e(this,D,0),e(this,J,le.create(i)),e(this,U,0),e(this,B,0),typeof v=="function"&&e(this,q,v),typeof R=="function"&&e(this,ut,R),typeof S=="function"?(e(this,X,S),e(this,L,[])):(e(this,X,void 0),e(this,L,void 0)),e(this,tt,!!c(this,q)),e(this,xt,!!c(this,ut)),e(this,P,!!c(this,X)),this.noDisposeOnSet=!!st,this.noUpdateTTL=!!M,this.noDeleteOnFetchRejection=!!O,this.allowStaleOnFetchRejection=!!m,this.allowStaleOnFetchAbort=!!j,this.ignoreFetchAbort=!!H,this.maxEntrySize!==0){if(c(this,G)!==0&&!at(c(this,G)))throw new TypeError("maxSize must be a positive integer if specified");if(!at(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");f$1(this,l,ee).call(this);}if(this.allowStale=!!c$1,this.noDeleteOnStaleGet=!!u,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!d$1,this.ttlResolution=at(r)||r===0?r:1,this.ttlAutopurge=!!n,this.ttl=s||0,this.ttl){if(!at(this.ttl))throw new TypeError("ttl must be a positive integer if specified");f$1(this,l,It).call(this);}if(c(this,K)===0&&this.ttl===0&&c(this,G)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!c(this,K)&&!c(this,G)){let Pt="LRU_CACHE_UNBOUNDED";ae(Pt)&&(Jt.add(Pt),Qt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Pt,bt));}}get perf(){return c(this,$)}static unsafeExposeInternals(e){return {starts:c(e,Z),ttls:c(e,V),autopurgeTimers:c(e,W),sizes:c(e,Q),keyMap:c(e,T),keyList:c(e,b),valList:c(e,f),next:c(e,F),prev:c(e,z),get head(){return c(e,N)},get tail(){return c(e,D)},free:c(e,J),isBackgroundFetch:i=>{var s;return f$1(s=e,l,A).call(s,i)},backgroundFetch:(i,s,r,n)=>{var o;return f$1(o=e,l,Ct).call(o,i,s,r,n)},moveToTail:i=>{var s;return f$1(s=e,l,wt).call(s,i)},indexes:i=>{var s;return f$1(s=e,l,lt).call(s,i)},rindexes:i=>{var s;return f$1(s=e,l,ht).call(s,i)},isStale:i=>{var s;return c(s=e,Y).call(s,i)}}}get max(){return c(this,K)}get maxSize(){return c(this,G)}get calculatedSize(){return c(this,B)}get size(){return c(this,U)}get fetchMethod(){return c(this,yt)}get memoMethod(){return c(this,Et)}get dispose(){return c(this,q)}get onInsert(){return c(this,ut)}get disposeAfter(){return c(this,X)}getRemainingTTL(e){return c(this,T).has(e)?1/0:0}*entries(){for(let e of f$1(this,l,lt).call(this))c(this,f)[e]!==void 0&&c(this,b)[e]!==void 0&&!f$1(this,l,A).call(this,c(this,f)[e])&&(yield [c(this,b)[e],c(this,f)[e]]);}*rentries(){for(let e of f$1(this,l,ht).call(this))c(this,f)[e]!==void 0&&c(this,b)[e]!==void 0&&!f$1(this,l,A).call(this,c(this,f)[e])&&(yield [c(this,b)[e],c(this,f)[e]]);}*keys(){for(let e of f$1(this,l,lt).call(this)){let i=c(this,b)[e];i!==void 0&&!f$1(this,l,A).call(this,c(this,f)[e])&&(yield i);}}*rkeys(){for(let e of f$1(this,l,ht).call(this)){let i=c(this,b)[e];i!==void 0&&!f$1(this,l,A).call(this,c(this,f)[e])&&(yield i);}}*values(){for(let e of f$1(this,l,lt).call(this))c(this,f)[e]!==void 0&&!f$1(this,l,A).call(this,c(this,f)[e])&&(yield c(this,f)[e]);}*rvalues(){for(let e of f$1(this,l,ht).call(this))c(this,f)[e]!==void 0&&!f$1(this,l,A).call(this,c(this,f)[e])&&(yield c(this,f)[e]);}[(Bt=Symbol.iterator,$t=Symbol.toStringTag,Bt)](){return this.entries()}find(e,i={}){for(let s of f$1(this,l,lt).call(this)){let r=c(this,f)[s],n=f$1(this,l,A).call(this,r)?r.__staleWhileFetching:r;if(n!==void 0&&e(n,c(this,b)[s],this))return this.get(c(this,b)[s],i)}}forEach(e,i=this){for(let s of f$1(this,l,lt).call(this)){let r=c(this,f)[s],n=f$1(this,l,A).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e.call(i,n,c(this,b)[s],this);}}rforEach(e,i=this){for(let s of f$1(this,l,ht).call(this)){let r=c(this,f)[s],n=f$1(this,l,A).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e.call(i,n,c(this,b)[s],this);}}purgeStale(){let e=false;for(let i of f$1(this,l,ht).call(this,{allowStale:true}))c(this,Y).call(this,i)&&(f$1(this,l,dt).call(this,c(this,b)[i],"expire"),e=true);return e}info(e){let i=c(this,T).get(e);if(i===void 0)return;let s=c(this,f)[i],r=f$1(this,l,A).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let n={value:r};if(c(this,V)&&c(this,Z)){let o=c(this,V)[i],d=c(this,Z)[i];if(o&&d){let c$1=o-(c(this,$).now()-d);n.ttl=c$1,n.start=Date.now();}}return c(this,Q)&&(n.size=c(this,Q)[i]),n}dump(){let e=[];for(let i of f$1(this,l,lt).call(this,{allowStale:true})){let s=c(this,b)[i],r=c(this,f)[i],n=f$1(this,l,A).call(this,r)?r.__staleWhileFetching:r;if(n===void 0||s===void 0)continue;let o={value:n};if(c(this,V)&&c(this,Z)){o.ttl=c(this,V)[i];let d=c(this,$).now()-c(this,Z)[i];o.start=Math.floor(Date.now()-d);}c(this,Q)&&(o.size=c(this,Q)[i]),e.unshift([s,o]);}return e}load(e){this.clear();for(let[i,s]of e){if(s.start){let r=Date.now()-s.start;s.start=c(this,$).now()-r;}this.set(i,s.value,s);}}set(e$1,i,s={}){var st,M,k,w;if(i===void 0)return this.delete(e$1),this;let{ttl:r=this.ttl,start:n,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:d=this.sizeCalculation,status:c$1}=s,{noUpdateTTL:v=this.noUpdateTTL}=s,R=c(this,Tt).call(this,e$1,i,s.size||0,d);if(this.maxEntrySize&&R>this.maxEntrySize)return c$1&&(c$1.set="miss",c$1.maxEntrySizeExceeded=true),f$1(this,l,dt).call(this,e$1,"set"),this;let S=c(this,U)===0?void 0:c(this,T).get(e$1);if(S===void 0)S=c(this,U)===0?c(this,D):c(this,J).length!==0?c(this,J).pop():c(this,U)===c(this,K)?f$1(this,l,Lt).call(this,false):c(this,U),c(this,b)[S]=e$1,c(this,f)[S]=i,c(this,T).set(e$1,S),c(this,F)[c(this,D)]=S,c(this,z)[S]=c(this,D),e(this,D,S),g(this,U)._++,c(this,At).call(this,S,R,c$1),c$1&&(c$1.set="add"),v=false,c(this,xt)&&((st=c(this,ut))==null||st.call(this,i,e$1,"add"));else {f$1(this,l,wt).call(this,S);let y=c(this,f)[S];if(i!==y){if(c(this,ct)&&f$1(this,l,A).call(this,y)){y.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:a}=y;a!==void 0&&!o&&(c(this,tt)&&((M=c(this,q))==null||M.call(this,a,e$1,"set")),c(this,P)&&c(this,L)?.push([a,e$1,"set"]));}else o||(c(this,tt)&&((k=c(this,q))==null||k.call(this,y,e$1,"set")),c(this,P)&&c(this,L)?.push([y,e$1,"set"]));if(c(this,mt).call(this,S),c(this,At).call(this,S,R,c$1),c(this,f)[S]=i,c$1){c$1.set="replace";let a=y&&f$1(this,l,A).call(this,y)?y.__staleWhileFetching:y;a!==void 0&&(c$1.oldValue=a);}}else c$1&&(c$1.set="update");c(this,xt)&&this.onInsert?.(i,e$1,i===y?"update":"replace");}if(r!==0&&!c(this,V)&&f$1(this,l,It).call(this),c(this,V)&&(v||c(this,Ot).call(this,S,r,n),c$1&&c(this,rt).call(this,c$1,S)),!o&&c(this,P)&&c(this,L)){let y=c(this,L),a;for(;a=y?.shift();)(w=c(this,X))==null||w.call(this,...a);}return this}pop(){var e;try{for(;c(this,U);){let i=c(this,f)[c(this,N)];if(f$1(this,l,Lt).call(this,!0),f$1(this,l,A).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(c(this,P)&&c(this,L)){let i=c(this,L),s;for(;s=i?.shift();)(e=c(this,X))==null||e.call(this,...s);}}}has(e,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,n=c(this,T).get(e);if(n!==void 0){let o=c(this,f)[n];if(f$1(this,l,A).call(this,o)&&o.__staleWhileFetching===void 0)return false;if(c(this,Y).call(this,n))r&&(r.has="stale",c(this,rt).call(this,r,n));else return s&&c(this,ft).call(this,n),r&&(r.has="hit",c(this,rt).call(this,r,n)),true}else r&&(r.has="miss");return false}peek(e,i={}){let{allowStale:s=this.allowStale}=i,r=c(this,T).get(e);if(r===void 0||!s&&c(this,Y).call(this,r))return;let n=c(this,f)[r];return f$1(this,l,A).call(this,n)?n.__staleWhileFetching:n}async fetch(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:d=this.noDisposeOnSet,size:c$1=0,sizeCalculation:v=this.sizeCalculation,noUpdateTTL:R=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:st=this.allowStaleOnFetchRejection,ignoreFetchAbort:M=this.ignoreFetchAbort,allowStaleOnFetchAbort:k=this.allowStaleOnFetchAbort,context:w,forceRefresh:y=false,status:a,signal:x}=i;if(!c(this,ct))return a&&(a.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,status:a});let O={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:d,size:c$1,sizeCalculation:v,noUpdateTTL:R,noDeleteOnFetchRejection:S,allowStaleOnFetchRejection:st,allowStaleOnFetchAbort:k,ignoreFetchAbort:M,status:a,signal:x},u=c(this,T).get(e);if(u===void 0){a&&(a.fetch="miss");let m=f$1(this,l,Ct).call(this,e,u,O,w);return m.__returned=m}else {let m=c(this,f)[u];if(f$1(this,l,A).call(this,m)){let vt=s&&m.__staleWhileFetching!==void 0;return a&&(a.fetch="inflight",vt&&(a.returnedStale=true)),vt?m.__staleWhileFetching:m.__returned=m}let j=c(this,Y).call(this,u);if(!y&&!j)return a&&(a.fetch="hit"),f$1(this,l,wt).call(this,u),r&&c(this,ft).call(this,u),a&&c(this,rt).call(this,a,u),m;let H=f$1(this,l,Ct).call(this,e,u,O,w),gt=H.__staleWhileFetching!==void 0&&s;return a&&(a.fetch=j?"stale":"refresh",gt&&j&&(a.returnedStale=true)),gt?H.__staleWhileFetching:H.__returned=H}}async forceFetch(e,i={}){let s=await this.fetch(e,i);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(e,i={}){let s=c(this,Et);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:n,...o}=i,d=this.get(e,o);if(!n&&d!==void 0)return d;let c$1=s(e,d,{options:o,context:r});return this.set(e,c$1,o),c$1}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:o}=i,d=c(this,T).get(e);if(d!==void 0){let c$1=c(this,f)[d],v=f$1(this,l,A).call(this,c$1);return o&&c(this,rt).call(this,o,d),c(this,Y).call(this,d)?(o&&(o.get="stale"),v?(o&&s&&c$1.__staleWhileFetching!==void 0&&(o.returnedStale=true),s?c$1.__staleWhileFetching:void 0):(n||f$1(this,l,dt).call(this,e,"expire"),o&&s&&(o.returnedStale=true),s?c$1:void 0)):(o&&(o.get="hit"),v?c$1.__staleWhileFetching:(f$1(this,l,wt).call(this,d),r&&c(this,ft).call(this,d),c$1))}else o&&(o.get="miss");}delete(e){return f$1(this,l,dt).call(this,e,"delete")}clear(){return f$1(this,l,zt).call(this,"delete")}},K=new WeakMap,G=new WeakMap,q=new WeakMap,ut=new WeakMap,X=new WeakMap,yt=new WeakMap,Et=new WeakMap,$=new WeakMap,U=new WeakMap,B=new WeakMap,T=new WeakMap,b=new WeakMap,f=new WeakMap,F=new WeakMap,z=new WeakMap,N=new WeakMap,D=new WeakMap,J=new WeakMap,L=new WeakMap,Q=new WeakMap,Z=new WeakMap,V=new WeakMap,W=new WeakMap,tt=new WeakMap,ct=new WeakMap,P=new WeakMap,xt=new WeakMap,l=new WeakSet,It=function(){let e$1=new Dt(c(this,K)),i=new Dt(c(this,K));e(this,V,e$1),e(this,Z,i);let s=this.ttlAutopurge?new Array(c(this,K)):void 0;e(this,W,s),e(this,Ot,(d,c$1,v=c(this,$).now())=>{i[d]=c$1!==0?v:0,e$1[d]=c$1,r(d,c$1);}),e(this,ft,d=>{i[d]=e$1[d]!==0?c(this,$).now():0,r(d,e$1[d]);});let r=this.ttlAutopurge?(d,c$1)=>{if(s?.[d]&&(clearTimeout(s[d]),s[d]=void 0),c$1&&c$1!==0&&s){let v=setTimeout(()=>{c(this,Y).call(this,d)&&f$1(this,l,dt).call(this,c(this,b)[d],"expire");},c$1+1);v.unref&&v.unref(),s[d]=v;}}:()=>{};e(this,rt,(d,c)=>{if(e$1[c]){let v=e$1[c],R=i[c];if(!v||!R)return;d.ttl=v,d.start=R,d.now=n||o();let S=d.now-R;d.remainingTTL=v-S;}});let n=0,o=()=>{let d=c(this,$).now();if(this.ttlResolution>0){n=d;let c=setTimeout(()=>n=0,this.ttlResolution);c.unref&&c.unref();}return d};this.getRemainingTTL=d=>{let c$1=c(this,T).get(d);if(c$1===void 0)return 0;let v=e$1[c$1],R=i[c$1];if(!v||!R)return 1/0;let S=(n||o())-R;return v-S},e(this,Y,d=>{let c=i[d],v=e$1[d];return !!v&&!!c&&(n||o())-c>v});},ft=new WeakMap,rt=new WeakMap,Ot=new WeakMap,Y=new WeakMap,ee=function(){let e$1=new Dt(c(this,K));e(this,B,0),e(this,Q,e$1),e(this,mt,i=>{e(this,B,c(this,B)-e$1[i]),e$1[i]=0;}),e(this,Tt,(i,s,r,n)=>{if(f$1(this,l,A).call(this,s))return 0;if(!at(r))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(r=n(s,i),!at(r))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return r}),e(this,At,(i,s,r)=>{if(e$1[i]=s,c(this,G)){let n=c(this,G)-e$1[i];for(;c(this,B)>n;)f$1(this,l,Lt).call(this,true);}e(this,B,c(this,B)+e$1[i]),r&&(r.entrySize=s,r.totalCalculatedSize=c(this,B));});},mt=new WeakMap,At=new WeakMap,Tt=new WeakMap,lt=function*({allowStale:e=this.allowStale}={}){if(c(this,U))for(let i=c(this,D);!(!f$1(this,l,Mt).call(this,i)||((e||!c(this,Y).call(this,i))&&(yield i),i===c(this,N)));)i=c(this,z)[i];},ht=function*({allowStale:e=this.allowStale}={}){if(c(this,U))for(let i=c(this,N);!(!f$1(this,l,Mt).call(this,i)||((e||!c(this,Y).call(this,i))&&(yield i),i===c(this,D)));)i=c(this,F)[i];},Mt=function(e){return e!==void 0&&c(this,T).get(c(this,b)[e])===e},Lt=function(e$1){var n;let i=c(this,N),s=c(this,b)[i],r=c(this,f)[i];return c(this,ct)&&f$1(this,l,A).call(this,r)?r.__abortController.abort(new Error("evicted")):(c(this,tt)||c(this,P))&&(c(this,tt)&&((n=c(this,q))==null||n.call(this,r,s,"evict")),c(this,P)&&c(this,L)?.push([r,s,"evict"])),c(this,mt).call(this,i),c(this,W)?.[i]&&(clearTimeout(c(this,W)[i]),c(this,W)[i]=void 0),e$1&&(c(this,b)[i]=void 0,c(this,f)[i]=void 0,c(this,J).push(i)),c(this,U)===1?(e(this,N,e(this,D,0)),c(this,J).length=0):e(this,N,c(this,F)[i]),c(this,T).delete(s),g(this,U)._--,i},Ct=function(e,i,s,r){let n=i===void 0?void 0:c(this,f)[i];if(f$1(this,l,A).call(this,n))return n;let o=new Nt,{signal:d}=s;d?.addEventListener("abort",()=>o.abort(d.reason),{signal:o.signal});let c$1={signal:o.signal,options:s,context:r},v=(w,y=false)=>{let{aborted:a}=o.signal,x=s.ignoreFetchAbort&&w!==void 0,O=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&w!==void 0);if(s.status&&(a&&!y?(s.status.fetchAborted=true,s.status.fetchError=o.signal.reason,x&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),a&&!x&&!y)return S(o.signal.reason,O);let u=M,m=c(this,f)[i];return (m===M||x&&y&&m===void 0)&&(w===void 0?u.__staleWhileFetching!==void 0?c(this,f)[i]=u.__staleWhileFetching:f$1(this,l,dt).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,w,c$1.options))),w},R=w=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=w),S(w,false)),S=(w,y)=>{let{aborted:a}=o.signal,x=a&&s.allowStaleOnFetchAbort,O=x||s.allowStaleOnFetchRejection,u=O||s.noDeleteOnFetchRejection,m=M;if(c(this,f)[i]===M&&(!u||!y&&m.__staleWhileFetching===void 0?f$1(this,l,dt).call(this,e,"fetch"):x||(c(this,f)[i]=m.__staleWhileFetching)),O)return s.status&&m.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),m.__staleWhileFetching;if(m.__returned===m)throw w},st=(w,y)=>{var x;let a=(x=c(this,yt))==null?void 0:x.call(this,e,n,c$1);a&&a instanceof Promise&&a.then(O=>w(O===void 0?void 0:O),y),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(w(void 0),s.allowStaleOnFetchAbort&&(w=O=>v(O,true)));});};s.status&&(s.status.fetchDispatched=true);let M=new Promise(st).then(v,R),k=Object.assign(M,{__abortController:o,__staleWhileFetching:n,__returned:void 0});return i===void 0?(this.set(e,k,{...c$1.options,status:void 0}),i=c(this,T).get(e)):c(this,f)[i]=k,k},A=function(e){if(!c(this,ct))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Nt},Gt=function(e,i){c(this,z)[i]=e,c(this,F)[e]=i;},wt=function(e$1){e$1!==c(this,D)&&(e$1===c(this,N)?e(this,N,c(this,F)[e$1]):f$1(this,l,Gt).call(this,c(this,z)[e$1],c(this,F)[e$1]),f$1(this,l,Gt).call(this,c(this,D),e$1),e(this,D,e$1));},dt=function(e$1,i){var r,n;let s=false;if(c(this,U)!==0){let o=c(this,T).get(e$1);if(o!==void 0)if(c(this,W)?.[o]&&(clearTimeout(c(this,W)?.[o]),c(this,W)[o]=void 0),s=true,c(this,U)===1)f$1(this,l,zt).call(this,i);else {c(this,mt).call(this,o);let d=c(this,f)[o];if(f$1(this,l,A).call(this,d)?d.__abortController.abort(new Error("deleted")):(c(this,tt)||c(this,P))&&(c(this,tt)&&((r=c(this,q))==null||r.call(this,d,e$1,i)),c(this,P)&&c(this,L)?.push([d,e$1,i])),c(this,T).delete(e$1),c(this,b)[o]=void 0,c(this,f)[o]=void 0,o===c(this,D))e(this,D,c(this,z)[o]);else if(o===c(this,N))e(this,N,c(this,F)[o]);else {let c$1=c(this,z)[o];c(this,F)[c$1]=c(this,F)[o];let v=c(this,F)[o];c(this,z)[v]=c(this,z)[o];}g(this,U)._--,c(this,J).push(o);}}if(c(this,P)&&c(this,L)?.length){let o=c(this,L),d;for(;d=o?.shift();)(n=c(this,X))==null||n.call(this,...d);}return s},zt=function(e$1){var i,s;for(let r of f$1(this,l,ht).call(this,{allowStale:true})){let n=c(this,f)[r];if(f$1(this,l,A).call(this,n))n.__abortController.abort(new Error("deleted"));else {let o=c(this,b)[r];c(this,tt)&&((i=c(this,q))==null||i.call(this,n,o,e$1)),c(this,P)&&c(this,L)?.push([n,o,e$1]);}}if(c(this,T).clear(),c(this,f).fill(void 0),c(this,b).fill(void 0),c(this,V)&&c(this,Z)){c(this,V).fill(0),c(this,Z).fill(0);for(let r of c(this,W)??[])r!==void 0&&clearTimeout(r);c(this,W)?.fill(void 0);}if(c(this,Q)&&c(this,Q).fill(0),e(this,N,0),e(this,D,0),c(this,J).length=0,e(this,B,0),e(this,U,0),c(this,P)&&c(this,L)){let r=c(this,L),n;for(;n=r?.shift();)(s=c(this,X))==null||s.call(this,...n);}},bt);var Ft=class{constructor(e){b$1(this,"cache");b$1(this,"map",new Map);this.cache=new te({max:e.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(e){let i=this.map.delete(e);return i&&this.cache.delete(e),i}get forEach(){return this.map.forEach}get(e){let i=this.cache.get(e);return i||this.map.get(e)}has(e){return this.map.has(e)}set(e,i){return this.map.set(e,i),this.cache.set(e,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var Ut="1.6.4";var Vt="repeat";function Wt(g){return {type:"pause",duration:g}}var Yt="__game_layer__";var de="general";var ce={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 ie={};var Ht={};a(Ht,{createExportableElement:()=>se});var _t;(r=>(r.log=(n,...o)=>console.log(`[Pixi\u2019VN] ${n}`,...o),r.warn=(n,...o)=>console.warn(`[Pixi\u2019VN] ${n}`,...o),r.error=(n,...o)=>console.error(`[Pixi\u2019VN] ${n}`,...o),r.info=(n,...o)=>console.info(`[Pixi\u2019VN] ${n}`,...o)))(_t||(_t={}));function se(g){try{if(typeof g>"u")return g;let e=JSON.stringify(g);return JSON.parse(e)}catch(e){throw _t.error("Error creating exportable element",g,e),new PixiError("not_json_serializable","Error creating exportable element")}}function re(){console.info(`
|
|
2
|
-
|
|
3
|
-
|_ __ \\ (_) (_) | | |_ _| |_ _||_ \\|_ _|
|
|
4
|
-
| |__) |__ _ __ __ \\_| \\ \\ / / | \\ | |
|
|
5
|
-
| ___/[ | [ \\ [ ][ | \\ \\ / / | |\\ \\| |
|
|
6
|
-
_| |_ | | > ' < | | \\ ' / _| |_\\ |_
|
|
7
|
-
|_____| [___][__]\`\\_][___] \\_/ |_____|\\____|
|
|
8
|
-
|
|
9
|
-
`);}function Kt(){let g=window.location.pathname+window.location.hash;return g.includes("#")&&(g=g.split("#")[1]),g}var kt;(y=>{async function g(a,x,O){if(GameUnifier.init({navigate:x?.navigate,getCurrentGameStepState:()=>{let u={};try{u=nt.canvas.export();}catch{}return {path:Kt(),storage:I.storage.export(),canvas:u,sound:pt.sound.export(),labelIndex:C.NarrationManagerStatic.currentLabelStepIndex||0,openedLabels:C.narration.openedLabels}},restoreGameStepState:async(u,m)=>{et.HistoryManagerStatic._originalStepData=u,C.NarrationManagerStatic.openedLabels=u.openedLabels,I.storage.restore(u.storage);try{await nt.canvas.restore(u.canvas),await pt.sound.restore(u.sound);}catch{}m(u.path);},getStepCounter:()=>C.narration.stepCounter,setStepCounter:u=>{C.NarrationManagerStatic._stepCounter=u;},getOpenedLabels:()=>C.narration.openedLabels.length,addHistoryItem:(u,m)=>et.stepHistory.add(u,m),getCharacter:u=>qt.RegisteredCharacters.get(u),processNavigationRequests:(u,m)=>{let j=u,H=Promise.resolve();return u>0?(j--,H=C.narration.continue(m)):u<0&&(j=0,H=et.stepHistory.back(m,{steps:u*-1})),{newValue:j,result:H}},animate:(u,m,j,H)=>motion.animate(u,m,j,H),getVariable:(u,m)=>I.StorageManagerStatic.getVariable(u,m),setVariable:(u,m,j)=>I.StorageManagerStatic.setVariable(u,m,j),removeVariable:(u,m)=>I.StorageManagerStatic.removeVariable(u,m),getFlag:u=>I.storage.getFlag(u),setFlag:(u,m)=>I.storage.setFlag(u,m),onLabelClosing:u=>I.StorageManagerStatic.clearOldTempVariables(u)}),re(),!a||!x){_t.warn("The canvas element or options are not defined. The canvas will not be initialized.");return}return await nt.canvas.init(a,x,O)}y.init=g;function e(){I.storage.clear();try{nt.canvas.clear();}catch{}pt.sound.clear(),C.narration.clear(),et.stepHistory.clear();}y.clear=e;function i(){let a={};try{a=nt.canvas.export();}catch{}return {pixivn_version:Ut,stepData:C.narration.export(),storageData:I.storage.export(),canvasData:a,soundData:pt.sound.export(),historyData:et.stepHistory.export(),path:Kt()}}y.exportGameState=i;async function s(a,x){et.stepHistory.restore(a.historyData);let O=et.stepHistory.lastKey;if(typeof O=="number"){let u=et.stepHistory.stepsInfoMap.get(O)||null;await C.narration.restore(a.stepData,u);}I.storage.restore(a.storageData);try{await nt.canvas.restore(a.canvasData),await pt.sound.restore(a.soundData);}catch{}await x(a.path);}y.restoreGameState=s;async function r(a,x){return y.clear(),await C.narration.call(a,x)}y.start=r;function n(a){return JSON.parse(a)}y.jsonToGameState=n;function o(a){GameUnifier.onEnd=a;}y.onEnd=o;function d(a){return _t.warn("Game.onError is deprecated. Use Game.addOnError / Game.removeOnError to register multiple handlers."),GameUnifier.addOnError((x,O)=>a("step",x,O))}y.onError=d;function c(a){return GameUnifier.addOnError(a)}y.addOnError=c;function v(a){return GameUnifier.removeOnError(a)}y.removeOnError=v;function R(a){C.NarrationManagerStatic.onStepStart=a;}y.onStepStart=R;function S(a){C.NarrationManagerStatic.onLoadingLabel=a;}y.onLoadingLabel=S;function st(a){C.NarrationManagerStatic.onStepEnd=a;}y.onStepEnd=st;function M(a){GameUnifier.navigate=a;}y.onNavigate=M;function k(a){return GameUnifier.addOnPreContinue(a)}y.addOnPreContinue=k;function w(a){return GameUnifier.removeOnPreContinue(a)}y.removeOnPreContinue=w;})(kt||(kt={}));var ze={characterUtils:qt,canvasUtils:nt,narrationUtils:C,soundUtils:pt,CANVAS_APP_GAME_LAYER_ALIAS:Yt,Pause:Wt,Repeat:Vt,PIXIVN_VERSION:Ut,...Ht,...ie,canvas:nt.canvas,narration:C.narration,sound:pt.sound,storage:I.storage,history:et.stepHistory,Game:kt,GameUnifier:GameUnifier};export{Yt as CANVAS_APP_GAME_LAYER_ALIAS,Ft as CachedMap,de as GENERAL_CHANNEL,kt as Game,Ut as PIXIVN_VERSION,Wt as Pause,Vt as Repeat,ce as SYSTEM_RESERVED_STORAGE_KEYS,se as createExportableElement,ze as default};
|
|
1
|
+
import {b as b$1,d,a,c,e,f as f$1,g}from'./chunk-TTRUPDAB.mjs';import*as nt from'@drincs/pixi-vn/canvas';export*from'@drincs/pixi-vn/canvas';import*as Xt from'@drincs/pixi-vn/characters';export*from'@drincs/pixi-vn/characters';import {PixiError,GameUnifier}from'@drincs/pixi-vn/core';export*from'@drincs/pixi-vn/core';import*as et from'@drincs/pixi-vn/history';export*from'@drincs/pixi-vn/history';import*as C from'@drincs/pixi-vn/narration';export*from'@drincs/pixi-vn/narration';import*as ut from'@drincs/pixi-vn/sound';export*from'@drincs/pixi-vn/sound';import*as G from'@drincs/pixi-vn/storage';export*from'@drincs/pixi-vn/storage';import {motion}from'@drincs/pixi-vn/motion';var de=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Zt=new Set,jt=typeof process=="object"&&process?process:{},te=(m,e,i,s)=>{typeof jt.emitWarning=="function"?jt.emitWarning(m,e,i,s):console.error(`[${i}] ${e}: ${m}`);},Nt=globalThis.AbortController,Bt=globalThis.AbortSignal;if(typeof Nt>"u"){Bt=class{constructor(){b$1(this,"onabort");b$1(this,"_onabort",[]);b$1(this,"reason");b$1(this,"aborted",false);}addEventListener(i,s){this._onabort.push(s);}},Nt=class{constructor(){b$1(this,"signal",new Bt);e();}abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let m=jt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{m&&(m=false,te("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e));};}var pe=m=>!Zt.has(m);var at=m=>m&&m===Math.floor(m)&&m>0&&isFinite(m),ee=m=>at(m)?m<=Math.pow(2,8)?Uint8Array:m<=Math.pow(2,16)?Uint16Array:m<=Math.pow(2,32)?Uint32Array:m<=Number.MAX_SAFE_INTEGER?Dt:null:null,Dt=class extends Array{constructor(m){super(m),this.fill(0);}},it,St,ue=(it=class{constructor(e,i){b$1(this,"heap");b$1(this,"length");if(!c(it,St))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}static create(e$1){let i=ee(e$1);if(!i)return [];e(it,St,true);let s=new it(e$1,i);return e(it,St,false),s}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},St=new WeakMap,d(it,St,false),it),Jt,Qt,K,M,q,ft,$,yt,Et,X,U,B,T,A,f,P,z,N,D,J,L,Q,Z,V,W,tt,dt,j,xt,l,Gt,mt,ot,Ot,Y,se,gt,bt,Tt,lt,ht,It,Lt,Ct,b,Mt,wt,ct,zt,At,ie=(At=class{constructor(e$1){d(this,l);d(this,K);d(this,M);d(this,q);d(this,ft);d(this,$);d(this,yt);d(this,Et);d(this,X);b$1(this,"ttl");b$1(this,"ttlResolution");b$1(this,"ttlAutopurge");b$1(this,"updateAgeOnGet");b$1(this,"updateAgeOnHas");b$1(this,"allowStale");b$1(this,"noDisposeOnSet");b$1(this,"noUpdateTTL");b$1(this,"maxEntrySize");b$1(this,"sizeCalculation");b$1(this,"noDeleteOnFetchRejection");b$1(this,"noDeleteOnStaleGet");b$1(this,"allowStaleOnFetchAbort");b$1(this,"allowStaleOnFetchRejection");b$1(this,"ignoreFetchAbort");d(this,U);d(this,B);d(this,T);d(this,A);d(this,f);d(this,P);d(this,z);d(this,N);d(this,D);d(this,J);d(this,L);d(this,Q);d(this,Z);d(this,V);d(this,W);d(this,tt);d(this,dt);d(this,j);d(this,xt);d(this,mt,()=>{});d(this,ot,()=>{});d(this,Ot,()=>{});d(this,Y,()=>false);d(this,gt,e=>{});d(this,bt,(e,i,s)=>{});d(this,Tt,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});b$1(this,Jt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:n,updateAgeOnGet:o,updateAgeOnHas:h,allowStale:d$1,dispose:_,onInsert:R,disposeAfter:S,noDisposeOnSet:rt,noUpdateTTL:I,maxSize:k=0,maxEntrySize:w=0,sizeCalculation:y,fetchMethod:a,memoMethod:E,noDeleteOnFetchRejection:O,noDeleteOnStaleGet:u,allowStaleOnFetchRejection:g,allowStaleOnFetchAbort:F,ignoreFetchAbort:H,perf:vt}=e$1;if(vt!==void 0&&typeof vt?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(e(this,X,vt??de),i!==0&&!at(i))throw new TypeError("max option must be a nonnegative integer");let _t=i?ee(i):Array;if(!_t)throw new Error("invalid max value: "+i);if(e(this,K,i),e(this,M,k),this.maxEntrySize=w||c(this,M),this.sizeCalculation=y,this.sizeCalculation){if(!c(this,M)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(E!==void 0&&typeof E!="function")throw new TypeError("memoMethod must be a function if defined");if(e(this,Et,E),a!==void 0&&typeof a!="function")throw new TypeError("fetchMethod must be a function if specified");if(e(this,yt,a),e(this,dt,!!a),e(this,T,new Map),e(this,A,new Array(i).fill(void 0)),e(this,f,new Array(i).fill(void 0)),e(this,P,new _t(i)),e(this,z,new _t(i)),e(this,N,0),e(this,D,0),e(this,J,ue.create(i)),e(this,U,0),e(this,B,0),typeof _=="function"&&e(this,q,_),typeof R=="function"&&e(this,ft,R),typeof S=="function"?(e(this,$,S),e(this,L,[])):(e(this,$,void 0),e(this,L,void 0)),e(this,tt,!!c(this,q)),e(this,xt,!!c(this,ft)),e(this,j,!!c(this,$)),this.noDisposeOnSet=!!rt,this.noUpdateTTL=!!I,this.noDeleteOnFetchRejection=!!O,this.allowStaleOnFetchRejection=!!g,this.allowStaleOnFetchAbort=!!F,this.ignoreFetchAbort=!!H,this.maxEntrySize!==0){if(c(this,M)!==0&&!at(c(this,M)))throw new TypeError("maxSize must be a positive integer if specified");if(!at(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");f$1(this,l,se).call(this);}if(this.allowStale=!!d$1,this.noDeleteOnStaleGet=!!u,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!h,this.ttlResolution=at(r)||r===0?r:1,this.ttlAutopurge=!!n,this.ttl=s||0,this.ttl){if(!at(this.ttl))throw new TypeError("ttl must be a positive integer if specified");f$1(this,l,Gt).call(this);}if(c(this,K)===0&&this.ttl===0&&c(this,M)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!c(this,K)&&!c(this,M)){let Pt="LRU_CACHE_UNBOUNDED";pe(Pt)&&(Zt.add(Pt),te("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Pt,At));}}get perf(){return c(this,X)}static unsafeExposeInternals(e){return {starts:c(e,Z),ttls:c(e,V),autopurgeTimers:c(e,W),sizes:c(e,Q),keyMap:c(e,T),keyList:c(e,A),valList:c(e,f),next:c(e,P),prev:c(e,z),get head(){return c(e,N)},get tail(){return c(e,D)},free:c(e,J),isBackgroundFetch:i=>{var s;return f$1(s=e,l,b).call(s,i)},backgroundFetch:(i,s,r,n)=>{var o;return f$1(o=e,l,Ct).call(o,i,s,r,n)},moveToTail:i=>{var s;return f$1(s=e,l,wt).call(s,i)},indexes:i=>{var s;return f$1(s=e,l,lt).call(s,i)},rindexes:i=>{var s;return f$1(s=e,l,ht).call(s,i)},isStale:i=>{var s;return c(s=e,Y).call(s,i)}}}get max(){return c(this,K)}get maxSize(){return c(this,M)}get calculatedSize(){return c(this,B)}get size(){return c(this,U)}get fetchMethod(){return c(this,yt)}get memoMethod(){return c(this,Et)}get dispose(){return c(this,q)}get onInsert(){return c(this,ft)}get disposeAfter(){return c(this,$)}getRemainingTTL(e){return c(this,T).has(e)?1/0:0}*entries(){for(let e of f$1(this,l,lt).call(this))c(this,f)[e]!==void 0&&c(this,A)[e]!==void 0&&!f$1(this,l,b).call(this,c(this,f)[e])&&(yield [c(this,A)[e],c(this,f)[e]]);}*rentries(){for(let e of f$1(this,l,ht).call(this))c(this,f)[e]!==void 0&&c(this,A)[e]!==void 0&&!f$1(this,l,b).call(this,c(this,f)[e])&&(yield [c(this,A)[e],c(this,f)[e]]);}*keys(){for(let e of f$1(this,l,lt).call(this)){let i=c(this,A)[e];i!==void 0&&!f$1(this,l,b).call(this,c(this,f)[e])&&(yield i);}}*rkeys(){for(let e of f$1(this,l,ht).call(this)){let i=c(this,A)[e];i!==void 0&&!f$1(this,l,b).call(this,c(this,f)[e])&&(yield i);}}*values(){for(let e of f$1(this,l,lt).call(this))c(this,f)[e]!==void 0&&!f$1(this,l,b).call(this,c(this,f)[e])&&(yield c(this,f)[e]);}*rvalues(){for(let e of f$1(this,l,ht).call(this))c(this,f)[e]!==void 0&&!f$1(this,l,b).call(this,c(this,f)[e])&&(yield c(this,f)[e]);}[(Qt=Symbol.iterator,Jt=Symbol.toStringTag,Qt)](){return this.entries()}find(e,i={}){for(let s of f$1(this,l,lt).call(this)){let r=c(this,f)[s],n=f$1(this,l,b).call(this,r)?r.__staleWhileFetching:r;if(n!==void 0&&e(n,c(this,A)[s],this))return this.get(c(this,A)[s],i)}}forEach(e,i=this){for(let s of f$1(this,l,lt).call(this)){let r=c(this,f)[s],n=f$1(this,l,b).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e.call(i,n,c(this,A)[s],this);}}rforEach(e,i=this){for(let s of f$1(this,l,ht).call(this)){let r=c(this,f)[s],n=f$1(this,l,b).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e.call(i,n,c(this,A)[s],this);}}purgeStale(){let e=false;for(let i of f$1(this,l,ht).call(this,{allowStale:true}))c(this,Y).call(this,i)&&(f$1(this,l,ct).call(this,c(this,A)[i],"expire"),e=true);return e}info(e){let i=c(this,T).get(e);if(i===void 0)return;let s=c(this,f)[i],r=f$1(this,l,b).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let n={value:r};if(c(this,V)&&c(this,Z)){let o=c(this,V)[i],h=c(this,Z)[i];if(o&&h){let d=o-(c(this,X).now()-h);n.ttl=d,n.start=Date.now();}}return c(this,Q)&&(n.size=c(this,Q)[i]),n}dump(){let e=[];for(let i of f$1(this,l,lt).call(this,{allowStale:true})){let s=c(this,A)[i],r=c(this,f)[i],n=f$1(this,l,b).call(this,r)?r.__staleWhileFetching:r;if(n===void 0||s===void 0)continue;let o={value:n};if(c(this,V)&&c(this,Z)){o.ttl=c(this,V)[i];let h=c(this,X).now()-c(this,Z)[i];o.start=Math.floor(Date.now()-h);}c(this,Q)&&(o.size=c(this,Q)[i]),e.unshift([s,o]);}return e}load(e){this.clear();for(let[i,s]of e){if(s.start){let r=Date.now()-s.start;s.start=c(this,X).now()-r;}this.set(i,s.value,s);}}set(e$1,i,s={}){var rt,I,k,w;if(i===void 0)return this.delete(e$1),this;let{ttl:r=this.ttl,start:n,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:h=this.sizeCalculation,status:d}=s,{noUpdateTTL:_=this.noUpdateTTL}=s,R=c(this,Tt).call(this,e$1,i,s.size||0,h);if(this.maxEntrySize&&R>this.maxEntrySize)return d&&(d.set="miss",d.maxEntrySizeExceeded=true),f$1(this,l,ct).call(this,e$1,"set"),this;let S=c(this,U)===0?void 0:c(this,T).get(e$1);if(S===void 0)S=c(this,U)===0?c(this,D):c(this,J).length!==0?c(this,J).pop():c(this,U)===c(this,K)?f$1(this,l,Lt).call(this,false):c(this,U),c(this,A)[S]=e$1,c(this,f)[S]=i,c(this,T).set(e$1,S),c(this,P)[c(this,D)]=S,c(this,z)[S]=c(this,D),e(this,D,S),g(this,U)._++,c(this,bt).call(this,S,R,d),d&&(d.set="add"),_=false,c(this,xt)&&((rt=c(this,ft))==null||rt.call(this,i,e$1,"add"));else {f$1(this,l,wt).call(this,S);let y=c(this,f)[S];if(i!==y){if(c(this,dt)&&f$1(this,l,b).call(this,y)){y.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:a}=y;a!==void 0&&!o&&(c(this,tt)&&((I=c(this,q))==null||I.call(this,a,e$1,"set")),c(this,j)&&c(this,L)?.push([a,e$1,"set"]));}else o||(c(this,tt)&&((k=c(this,q))==null||k.call(this,y,e$1,"set")),c(this,j)&&c(this,L)?.push([y,e$1,"set"]));if(c(this,gt).call(this,S),c(this,bt).call(this,S,R,d),c(this,f)[S]=i,d){d.set="replace";let a=y&&f$1(this,l,b).call(this,y)?y.__staleWhileFetching:y;a!==void 0&&(d.oldValue=a);}}else d&&(d.set="update");c(this,xt)&&this.onInsert?.(i,e$1,i===y?"update":"replace");}if(r!==0&&!c(this,V)&&f$1(this,l,Gt).call(this),c(this,V)&&(_||c(this,Ot).call(this,S,r,n),d&&c(this,ot).call(this,d,S)),!o&&c(this,j)&&c(this,L)){let y=c(this,L),a;for(;a=y?.shift();)(w=c(this,$))==null||w.call(this,...a);}return this}pop(){var e;try{for(;c(this,U);){let i=c(this,f)[c(this,N)];if(f$1(this,l,Lt).call(this,!0),f$1(this,l,b).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(c(this,j)&&c(this,L)){let i=c(this,L),s;for(;s=i?.shift();)(e=c(this,$))==null||e.call(this,...s);}}}has(e,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,n=c(this,T).get(e);if(n!==void 0){let o=c(this,f)[n];if(f$1(this,l,b).call(this,o)&&o.__staleWhileFetching===void 0)return false;if(c(this,Y).call(this,n))r&&(r.has="stale",c(this,ot).call(this,r,n));else return s&&c(this,mt).call(this,n),r&&(r.has="hit",c(this,ot).call(this,r,n)),true}else r&&(r.has="miss");return false}peek(e,i={}){let{allowStale:s=this.allowStale}=i,r=c(this,T).get(e);if(r===void 0||!s&&c(this,Y).call(this,r))return;let n=c(this,f)[r];return f$1(this,l,b).call(this,n)?n.__staleWhileFetching:n}async fetch(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:h=this.noDisposeOnSet,size:d=0,sizeCalculation:_=this.sizeCalculation,noUpdateTTL:R=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:rt=this.allowStaleOnFetchRejection,ignoreFetchAbort:I=this.ignoreFetchAbort,allowStaleOnFetchAbort:k=this.allowStaleOnFetchAbort,context:w,forceRefresh:y=false,status:a,signal:E}=i;if(!c(this,dt))return a&&(a.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,status:a});let O={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:h,size:d,sizeCalculation:_,noUpdateTTL:R,noDeleteOnFetchRejection:S,allowStaleOnFetchRejection:rt,allowStaleOnFetchAbort:k,ignoreFetchAbort:I,status:a,signal:E},u=c(this,T).get(e);if(u===void 0){a&&(a.fetch="miss");let g=f$1(this,l,Ct).call(this,e,u,O,w);return g.__returned=g}else {let g=c(this,f)[u];if(f$1(this,l,b).call(this,g)){let _t=s&&g.__staleWhileFetching!==void 0;return a&&(a.fetch="inflight",_t&&(a.returnedStale=true)),_t?g.__staleWhileFetching:g.__returned=g}let F=c(this,Y).call(this,u);if(!y&&!F)return a&&(a.fetch="hit"),f$1(this,l,wt).call(this,u),r&&c(this,mt).call(this,u),a&&c(this,ot).call(this,a,u),g;let H=f$1(this,l,Ct).call(this,e,u,O,w),vt=H.__staleWhileFetching!==void 0&&s;return a&&(a.fetch=F?"stale":"refresh",vt&&F&&(a.returnedStale=true)),vt?H.__staleWhileFetching:H.__returned=H}}async forceFetch(e,i={}){let s=await this.fetch(e,i);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(e,i={}){let s=c(this,Et);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:n,...o}=i,h=this.get(e,o);if(!n&&h!==void 0)return h;let d=s(e,h,{options:o,context:r});return this.set(e,d,o),d}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:o}=i,h=c(this,T).get(e);if(h!==void 0){let d=c(this,f)[h],_=f$1(this,l,b).call(this,d);return o&&c(this,ot).call(this,o,h),c(this,Y).call(this,h)?(o&&(o.get="stale"),_?(o&&s&&d.__staleWhileFetching!==void 0&&(o.returnedStale=true),s?d.__staleWhileFetching:void 0):(n||f$1(this,l,ct).call(this,e,"expire"),o&&s&&(o.returnedStale=true),s?d:void 0)):(o&&(o.get="hit"),_?d.__staleWhileFetching:(f$1(this,l,wt).call(this,h),r&&c(this,mt).call(this,h),d))}else o&&(o.get="miss");}delete(e){return f$1(this,l,ct).call(this,e,"delete")}clear(){return f$1(this,l,zt).call(this,"delete")}},K=new WeakMap,M=new WeakMap,q=new WeakMap,ft=new WeakMap,$=new WeakMap,yt=new WeakMap,Et=new WeakMap,X=new WeakMap,U=new WeakMap,B=new WeakMap,T=new WeakMap,A=new WeakMap,f=new WeakMap,P=new WeakMap,z=new WeakMap,N=new WeakMap,D=new WeakMap,J=new WeakMap,L=new WeakMap,Q=new WeakMap,Z=new WeakMap,V=new WeakMap,W=new WeakMap,tt=new WeakMap,dt=new WeakMap,j=new WeakMap,xt=new WeakMap,l=new WeakSet,Gt=function(){let e$1=new Dt(c(this,K)),i=new Dt(c(this,K));e(this,V,e$1),e(this,Z,i);let s=this.ttlAutopurge?new Array(c(this,K)):void 0;e(this,W,s),e(this,Ot,(h,d,_=c(this,X).now())=>{i[h]=d!==0?_:0,e$1[h]=d,r(h,d);}),e(this,mt,h=>{i[h]=e$1[h]!==0?c(this,X).now():0,r(h,e$1[h]);});let r=this.ttlAutopurge?(h,d)=>{if(s?.[h]&&(clearTimeout(s[h]),s[h]=void 0),d&&d!==0&&s){let _=setTimeout(()=>{c(this,Y).call(this,h)&&f$1(this,l,ct).call(this,c(this,A)[h],"expire");},d+1);_.unref&&_.unref(),s[h]=_;}}:()=>{};e(this,ot,(h,d)=>{if(e$1[d]){let _=e$1[d],R=i[d];if(!_||!R)return;h.ttl=_,h.start=R,h.now=n||o();let S=h.now-R;h.remainingTTL=_-S;}});let n=0,o=()=>{let h=c(this,X).now();if(this.ttlResolution>0){n=h;let d=setTimeout(()=>n=0,this.ttlResolution);d.unref&&d.unref();}return h};this.getRemainingTTL=h=>{let d=c(this,T).get(h);if(d===void 0)return 0;let _=e$1[d],R=i[d];if(!_||!R)return 1/0;let S=(n||o())-R;return _-S},e(this,Y,h=>{let d=i[h],_=e$1[h];return !!_&&!!d&&(n||o())-d>_});},mt=new WeakMap,ot=new WeakMap,Ot=new WeakMap,Y=new WeakMap,se=function(){let e$1=new Dt(c(this,K));e(this,B,0),e(this,Q,e$1),e(this,gt,i=>{e(this,B,c(this,B)-e$1[i]),e$1[i]=0;}),e(this,Tt,(i,s,r,n)=>{if(f$1(this,l,b).call(this,s))return 0;if(!at(r))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(r=n(s,i),!at(r))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return r}),e(this,bt,(i,s,r)=>{if(e$1[i]=s,c(this,M)){let n=c(this,M)-e$1[i];for(;c(this,B)>n;)f$1(this,l,Lt).call(this,true);}e(this,B,c(this,B)+e$1[i]),r&&(r.entrySize=s,r.totalCalculatedSize=c(this,B));});},gt=new WeakMap,bt=new WeakMap,Tt=new WeakMap,lt=function*({allowStale:e=this.allowStale}={}){if(c(this,U))for(let i=c(this,D);!(!f$1(this,l,It).call(this,i)||((e||!c(this,Y).call(this,i))&&(yield i),i===c(this,N)));)i=c(this,z)[i];},ht=function*({allowStale:e=this.allowStale}={}){if(c(this,U))for(let i=c(this,N);!(!f$1(this,l,It).call(this,i)||((e||!c(this,Y).call(this,i))&&(yield i),i===c(this,D)));)i=c(this,P)[i];},It=function(e){return e!==void 0&&c(this,T).get(c(this,A)[e])===e},Lt=function(e$1){var n;let i=c(this,N),s=c(this,A)[i],r=c(this,f)[i];return c(this,dt)&&f$1(this,l,b).call(this,r)?r.__abortController.abort(new Error("evicted")):(c(this,tt)||c(this,j))&&(c(this,tt)&&((n=c(this,q))==null||n.call(this,r,s,"evict")),c(this,j)&&c(this,L)?.push([r,s,"evict"])),c(this,gt).call(this,i),c(this,W)?.[i]&&(clearTimeout(c(this,W)[i]),c(this,W)[i]=void 0),e$1&&(c(this,A)[i]=void 0,c(this,f)[i]=void 0,c(this,J).push(i)),c(this,U)===1?(e(this,N,e(this,D,0)),c(this,J).length=0):e(this,N,c(this,P)[i]),c(this,T).delete(s),g(this,U)._--,i},Ct=function(e,i,s,r){let n=i===void 0?void 0:c(this,f)[i];if(f$1(this,l,b).call(this,n))return n;let o=new Nt,{signal:h}=s;h?.addEventListener("abort",()=>o.abort(h.reason),{signal:o.signal});let d={signal:o.signal,options:s,context:r},_=(w,y=false)=>{let{aborted:a}=o.signal,E=s.ignoreFetchAbort&&w!==void 0,O=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&w!==void 0);if(s.status&&(a&&!y?(s.status.fetchAborted=true,s.status.fetchError=o.signal.reason,E&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),a&&!E&&!y)return S(o.signal.reason,O);let u=I,g=c(this,f)[i];return (g===I||E&&y&&g===void 0)&&(w===void 0?u.__staleWhileFetching!==void 0?c(this,f)[i]=u.__staleWhileFetching:f$1(this,l,ct).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,w,d.options))),w},R=w=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=w),S(w,false)),S=(w,y)=>{let{aborted:a}=o.signal,E=a&&s.allowStaleOnFetchAbort,O=E||s.allowStaleOnFetchRejection,u=O||s.noDeleteOnFetchRejection,g=I;if(c(this,f)[i]===I&&(!u||!y&&g.__staleWhileFetching===void 0?f$1(this,l,ct).call(this,e,"fetch"):E||(c(this,f)[i]=g.__staleWhileFetching)),O)return s.status&&g.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),g.__staleWhileFetching;if(g.__returned===g)throw w},rt=(w,y)=>{var E;let a=(E=c(this,yt))==null?void 0:E.call(this,e,n,d);a&&a instanceof Promise&&a.then(O=>w(O===void 0?void 0:O),y),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(w(void 0),s.allowStaleOnFetchAbort&&(w=O=>_(O,true)));});};s.status&&(s.status.fetchDispatched=true);let I=new Promise(rt).then(_,R),k=Object.assign(I,{__abortController:o,__staleWhileFetching:n,__returned:void 0});return i===void 0?(this.set(e,k,{...d.options,status:void 0}),i=c(this,T).get(e)):c(this,f)[i]=k,k},b=function(e){if(!c(this,dt))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Nt},Mt=function(e,i){c(this,z)[i]=e,c(this,P)[e]=i;},wt=function(e$1){e$1!==c(this,D)&&(e$1===c(this,N)?e(this,N,c(this,P)[e$1]):f$1(this,l,Mt).call(this,c(this,z)[e$1],c(this,P)[e$1]),f$1(this,l,Mt).call(this,c(this,D),e$1),e(this,D,e$1));},ct=function(e$1,i){var r,n;let s=false;if(c(this,U)!==0){let o=c(this,T).get(e$1);if(o!==void 0)if(c(this,W)?.[o]&&(clearTimeout(c(this,W)?.[o]),c(this,W)[o]=void 0),s=true,c(this,U)===1)f$1(this,l,zt).call(this,i);else {c(this,gt).call(this,o);let h=c(this,f)[o];if(f$1(this,l,b).call(this,h)?h.__abortController.abort(new Error("deleted")):(c(this,tt)||c(this,j))&&(c(this,tt)&&((r=c(this,q))==null||r.call(this,h,e$1,i)),c(this,j)&&c(this,L)?.push([h,e$1,i])),c(this,T).delete(e$1),c(this,A)[o]=void 0,c(this,f)[o]=void 0,o===c(this,D))e(this,D,c(this,z)[o]);else if(o===c(this,N))e(this,N,c(this,P)[o]);else {let d=c(this,z)[o];c(this,P)[d]=c(this,P)[o];let _=c(this,P)[o];c(this,z)[_]=c(this,z)[o];}g(this,U)._--,c(this,J).push(o);}}if(c(this,j)&&c(this,L)?.length){let o=c(this,L),h;for(;h=o?.shift();)(n=c(this,$))==null||n.call(this,...h);}return s},zt=function(e$1){var i,s;for(let r of f$1(this,l,ht).call(this,{allowStale:true})){let n=c(this,f)[r];if(f$1(this,l,b).call(this,n))n.__abortController.abort(new Error("deleted"));else {let o=c(this,A)[r];c(this,tt)&&((i=c(this,q))==null||i.call(this,n,o,e$1)),c(this,j)&&c(this,L)?.push([n,o,e$1]);}}if(c(this,T).clear(),c(this,f).fill(void 0),c(this,A).fill(void 0),c(this,V)&&c(this,Z)){c(this,V).fill(0),c(this,Z).fill(0);for(let r of c(this,W)??[])r!==void 0&&clearTimeout(r);c(this,W)?.fill(void 0);}if(c(this,Q)&&c(this,Q).fill(0),e(this,N,0),e(this,D,0),c(this,J).length=0,e(this,B,0),e(this,U,0),c(this,j)&&c(this,L)){let r=c(this,L),n;for(;n=r?.shift();)(s=c(this,$))==null||s.call(this,...n);}},At);var Ft=class{constructor(e){b$1(this,"cache");b$1(this,"map",new Map);this.cache=new ie({max:e.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(e){let i=this.map.delete(e);return i&&this.cache.delete(e),i}get forEach(){return this.map.forEach}get(e){let i=this.cache.get(e);return i||this.map.get(e)}has(e){return this.map.has(e)}set(e,i){return this.map.set(e,i),this.cache.set(e,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var Ut="1.7.2";var Vt={version:Ut};var Wt="repeat";function Yt(m){return {type:"pause",duration:m}}var Ht="__game_layer__";var fe="general";var me={CURRENT_DIALOGUE_MEMORY_KEY:"dialogue",LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY:"dialogue:step_counter",CURRENT_MENU_OPTIONS_MEMORY_KEY:"choice:options",LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY:"choice:step_counter",CURRENT_INPUT_VALUE_MEMORY_KEY:"input:value",LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY:"input:step_counter",CURRENT_INPUT_INFO_MEMORY_KEY:"input:info",CHARACTER_CATEGORY_KEY:"character",ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY:"___glue___",OPENED_LABELS_COUNTER_KEY:"label:opened",ALL_CHOICES_MADE_KEY:"choices:made",CURRENT_STEP_TIMES_COUNTER_KEY:"label:history",LAST_STEP_GLUED:"glue:last_step"};var oe={};var Kt={};a(Kt,{createExportableElement:()=>ne});var pt;(r=>(r.log=(n,...o)=>console.log(`[Pixi\u2019VN] ${n}`,...o),r.warn=(n,...o)=>console.warn(`[Pixi\u2019VN] ${n}`,...o),r.error=(n,...o)=>console.error(`[Pixi\u2019VN] ${n}`,...o),r.info=(n,...o)=>console.info(`[Pixi\u2019VN] ${n}`,...o)))(pt||(pt={}));function ne(m){try{if(typeof m>"u")return m;let e=JSON.stringify(m);return JSON.parse(e)}catch(e){throw pt.error("Error creating exportable element",m,e),new PixiError("not_json_serializable","Error creating exportable element")}}var ae=[" ____ _ _ ___ ___ _ "," | _ \\(_)_ _(_| ) \\ / / \\ | |"," | |_) | \\ \\/ / |/ \\ \\ / /| \\| |"," | __/| |> <| | \\ V / | |\\ |",` |_| |_/_/\\_\\_| \\_/ |_| \\_| v${Vt.version}`],le=17,ve="background:#2f90da;color:#fff;font-weight:bold;",_e="background:#c832bb;color:#fff;font-weight:bold;",Se="background:transparent;font-weight:bold;",kt=` v${Vt.version}`;function he(){let m=[],e=[];for(let i=0;i<ae.length;i++){let s=ae[i],r=s.endsWith(kt),n=r?s.slice(0,-kt.length):s,o=n.slice(0,le),h=n.slice(le),d=r?"%c%s%c%s%c%s":"%c%s%c%s";m.push(d),e.push(ve,o,_e,h),r&&e.push(Se,kt);}console.info(m.join(`
|
|
2
|
+
`),...e);}function qt(){let m=window.location.pathname+window.location.hash;return m.includes("#")&&(m=m.split("#")[1]),m}var $t;(y=>{async function m(a,E,O){if(GameUnifier.init({navigate:E?.navigate,getCurrentGameStepState:()=>{let u={};try{u=nt.canvas.export();}catch{}return {path:qt(),storage:G.storage.export(),canvas:u,sound:ut.sound.export(),labelIndex:C.NarrationManagerStatic.currentLabelStepIndex||0,openedLabels:C.narration.openedLabels}},restoreGameStepState:async(u,g)=>{et.HistoryManagerStatic._originalStepData=u,C.NarrationManagerStatic.openedLabels=u.openedLabels,G.storage.restore(u.storage);try{await nt.canvas.restore(u.canvas),await ut.sound.restore(u.sound);}catch(F){pt.error("Error restoring game step state:",F);}await g(u.path);},getStepCounter:()=>C.narration.stepCounter,setStepCounter:u=>{C.NarrationManagerStatic._stepCounter=u;},getOpenedLabels:()=>C.narration.openedLabels.length,addHistoryItem:(u,g)=>et.stepHistory.add(u,g),getCharacter:u=>Xt.RegisteredCharacters.get(u),processNavigationRequests:(u,g)=>{let F=u,H=Promise.resolve();return u>0?(F--,H=C.narration.continue(g)):u<0&&(F=0,H=et.stepHistory.back(g,{steps:u*-1})),{newValue:F,result:H}},animate:(u,g,F,H)=>motion.animate(u,g,F,H),getVariable:(u,g)=>G.StorageManagerStatic.getVariable(u,g),setVariable:(u,g,F)=>G.StorageManagerStatic.setVariable(u,g,F),removeVariable:(u,g)=>G.StorageManagerStatic.removeVariable(u,g),getFlag:u=>G.storage.getFlag(u),setFlag:(u,g)=>G.storage.setFlag(u,g),onLabelClosing:u=>G.StorageManagerStatic.clearOldTempVariables(u)}),he(),!a||!E){pt.warn("The canvas element or options are not defined. The canvas will not be initialized.");return}return await nt.canvas.init(a,E,O)}y.init=m;function e(){G.storage.clear();try{nt.canvas.clear();}catch{}ut.sound.clear(),C.narration.clear(),et.stepHistory.clear();}y.clear=e;function i(){let a={};try{a=nt.canvas.export();}catch{}return {pixivn_version:Ut,stepData:C.narration.export(),storageData:G.storage.export(),canvasData:a,soundData:ut.sound.export(),historyData:et.stepHistory.export(),path:qt()}}y.exportGameState=i;async function s(a,E){et.stepHistory.restore(a.historyData);let O=et.stepHistory.lastKey;if(typeof O=="number"){let u=et.stepHistory.stepsInfoMap.get(O)||null;await C.narration.restore(a.stepData,u);}G.storage.restore(a.storageData);try{await nt.canvas.restore(a.canvasData),await ut.sound.restore(a.soundData);}catch{}E?await E(a.path):await GameUnifier.navigate(a.path);}y.restoreGameState=s;async function r(a,E){return y.clear(),await C.narration.call(a,E)}y.start=r;function n(a){return JSON.parse(a)}y.jsonToGameState=n;function o(a){GameUnifier.onEnd=a;}y.onEnd=o;function h(a){return pt.warn("Game.onError is deprecated. Use Game.addOnError / Game.removeOnError to register multiple handlers."),GameUnifier.addOnError((E,O)=>a("step",E,O))}y.onError=h;function d(a){return GameUnifier.addOnError(a)}y.addOnError=d;function _(a){return GameUnifier.removeOnError(a)}y.removeOnError=_;function R(a){C.NarrationManagerStatic.onStepStart=a;}y.onStepStart=R;function S(a){C.NarrationManagerStatic.onLoadingLabel=a;}y.onLoadingLabel=S;function rt(a){C.NarrationManagerStatic.onStepEnd=a;}y.onStepEnd=rt;function I(a){GameUnifier.navigate=a;}y.onNavigate=I;function k(a){return GameUnifier.addOnPreContinue(a)}y.addOnPreContinue=k;function w(a){return GameUnifier.removeOnPreContinue(a)}y.removeOnPreContinue=w;})($t||($t={}));var $e={characterUtils:Xt,canvasUtils:nt,narrationUtils:C,soundUtils:ut,CANVAS_APP_GAME_LAYER_ALIAS:Ht,Pause:Yt,Repeat:Wt,PIXIVN_VERSION:Ut,...Kt,...oe,canvas:nt.canvas,narration:C.narration,sound:ut.sound,storage:G.storage,history:et.stepHistory,Game:$t,GameUnifier:GameUnifier};export{Ht as CANVAS_APP_GAME_LAYER_ALIAS,Ft as CachedMap,fe as GENERAL_CHANNEL,$t as Game,Ut as PIXIVN_VERSION,Yt as Pause,Wt as Repeat,me as SYSTEM_RESERVED_STORAGE_KEYS,ne as createExportableElement,$e as default};
|