@drincs/pixi-vn 1.8.0 → 1.8.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.
Files changed (49) hide show
  1. package/README.md +3 -47
  2. package/dist/{HistoryChoiceMenuOption-BP9Tsbyd.d.ts → HistoryChoiceMenuOption-CS41KG13.d.ts} +2 -2
  3. package/dist/{HistoryChoiceMenuOption-DSSNUXEq.d.cts → HistoryChoiceMenuOption-DdwePsOm.d.cts} +2 -2
  4. package/dist/{StorageElementType-DkJ394kq.d.cts → StorageElementType-C7ETezlL.d.cts} +1 -1
  5. package/dist/{StorageElementType-DkJ394kq.d.ts → StorageElementType-C7ETezlL.d.ts} +1 -1
  6. package/dist/{StoredClassModel-a4pvgJXD.d.ts → StoredClassModel-C9mQxPg-.d.cts} +9 -6
  7. package/dist/{StoredClassModel-LtyakzOw.d.cts → StoredClassModel-upXPNQTp.d.ts} +9 -6
  8. package/dist/canvas.cjs +1 -1
  9. package/dist/canvas.mjs +2 -2
  10. package/dist/characters.cjs +1 -1
  11. package/dist/characters.d.cts +54 -50
  12. package/dist/characters.d.ts +54 -50
  13. package/dist/characters.mjs +1 -1
  14. package/dist/chunk-3BBZHKU4.mjs +1 -0
  15. package/dist/chunk-K7JIC2F2.mjs +1 -0
  16. package/dist/chunk-V34PMA2H.mjs +1 -0
  17. package/dist/{chunk-3SLELYPF.mjs → chunk-YCWXA3OR.mjs} +1 -1
  18. package/dist/{chunk-6HI66YQL.mjs → chunk-Z4GZCINS.mjs} +1 -1
  19. package/dist/history.cjs +1 -1
  20. package/dist/history.d.cts +2 -2
  21. package/dist/history.d.ts +2 -2
  22. package/dist/history.mjs +1 -1
  23. package/dist/index.cjs +2 -2
  24. package/dist/index.d.cts +21 -6
  25. package/dist/index.d.ts +21 -6
  26. package/dist/index.mjs +2 -2
  27. package/dist/narration.cjs +1 -1
  28. package/dist/narration.d.cts +3 -3
  29. package/dist/narration.d.ts +3 -3
  30. package/dist/narration.mjs +1 -1
  31. package/dist/sound.cjs +1 -1
  32. package/dist/sound.d.cts +6 -2
  33. package/dist/sound.d.ts +6 -2
  34. package/dist/sound.mjs +1 -1
  35. package/dist/storage.cjs +1 -1
  36. package/dist/storage.d.cts +12 -8
  37. package/dist/storage.d.ts +12 -8
  38. package/dist/storage.mjs +1 -1
  39. package/dist/vite-listener.cjs +1 -1
  40. package/dist/vite-listener.d.cts +31 -5
  41. package/dist/vite-listener.d.ts +31 -5
  42. package/dist/vite-listener.mjs +1 -1
  43. package/dist/vite.cjs +1 -1
  44. package/dist/vite.d.cts +89 -21
  45. package/dist/vite.d.ts +89 -21
  46. package/dist/vite.mjs +1 -1
  47. package/package.json +14 -6
  48. package/dist/chunk-TTRUPDAB.mjs +0 -1
  49. package/dist/chunk-XYO5SLSM.mjs +0 -1
package/dist/sound.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var core=require('@drincs/pixi-vn/core'),kt=require('@drincs/pixi-vn/pixi.js'),j=require('tone');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}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 kt__default=/*#__PURE__*/_interopDefault(kt);var j__namespace=/*#__PURE__*/_interopNamespace(j);var Rt=Object.defineProperty;var Tt=r=>{throw TypeError(r)};var Nt=(r,t,e)=>t in r?Rt(r,t,{enumerable:true,configurable:true,writable:true,value:e}):r[t]=e;var m=(r,t,e)=>Nt(r,typeof t!="symbol"?t+"":t,e),Le=(r,t,e)=>t.has(r)||Tt("Cannot "+e);var i=(r,t,e)=>(Le(r,t,"read from private field"),e?e.call(r):t.get(r)),v=(r,t,e)=>t.has(r)?Tt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,e),c=(r,t,e,n)=>(Le(r,t,"write to private field"),t.set(r,e),e),d=(r,t,e)=>(Le(r,t,"access private method"),e);var xe=(r,t,e,n)=>({set _(s){c(r,t,s);},get _(){return i(r,t,n)}});var At="general";var Gt=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,_t=new Set,ze=typeof process=="object"&&process?process:{},Ct=(r,t,e,n)=>{typeof ze.emitWarning=="function"?ze.emitWarning(r,t,e,n):console.error(`[${e}] ${t}: ${r}`);},ke=globalThis.AbortController,Ft=globalThis.AbortSignal;if(typeof ke>"u"){Ft=class{constructor(){m(this,"onabort");m(this,"_onabort",[]);m(this,"reason");m(this,"aborted",false);}addEventListener(e,n){this._onabort.push(n);}},ke=class{constructor(){m(this,"signal",new Ft);t();}abort(e){if(!this.signal.aborted){this.signal.reason=e,this.signal.aborted=true;for(let n of this.signal._onabort)n(e);this.signal.onabort?.(e);}}};let r=ze.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{r&&(r=false,Ct("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",t));};}var Lt=r=>!_t.has(r);var se=r=>r&&r===Math.floor(r)&&r>0&&isFinite(r),Et=r=>se(r)?r<=Math.pow(2,8)?Uint8Array:r<=Math.pow(2,16)?Uint16Array:r<=Math.pow(2,32)?Uint32Array:r<=Number.MAX_SAFE_INTEGER?Ie:null:null,Ie=class extends Array{constructor(r){super(r),this.fill(0);}},te,fe,zt=(te=class{constructor(t,e){m(this,"heap");m(this,"length");if(!i(te,fe))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0;}static create(t){let e=Et(t);if(!e)return [];c(te,fe,true);let n=new te(t,e);return c(te,fe,false),n}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}},fe=new WeakMap,v(te,fe,false),te),St,Ot,Y,z,B,he,K,ye,ge,$,E,H,C,F,f,N,q,D,P,X,x,Q,Z,U,W,J,le,G,ve,h,qe,ue,ie,Se,V,xt,de,be,Oe,ae,re,Ue,De,Me,A,We,Fe,oe,Ve,we,Pt=(we=class{constructor(t){v(this,h);v(this,Y);v(this,z);v(this,B);v(this,he);v(this,K);v(this,ye);v(this,ge);v(this,$);m(this,"ttl");m(this,"ttlResolution");m(this,"ttlAutopurge");m(this,"updateAgeOnGet");m(this,"updateAgeOnHas");m(this,"allowStale");m(this,"noDisposeOnSet");m(this,"noUpdateTTL");m(this,"maxEntrySize");m(this,"sizeCalculation");m(this,"noDeleteOnFetchRejection");m(this,"noDeleteOnStaleGet");m(this,"allowStaleOnFetchAbort");m(this,"allowStaleOnFetchRejection");m(this,"ignoreFetchAbort");v(this,E);v(this,H);v(this,C);v(this,F);v(this,f);v(this,N);v(this,q);v(this,D);v(this,P);v(this,X);v(this,x);v(this,Q);v(this,Z);v(this,U);v(this,W);v(this,J);v(this,le);v(this,G);v(this,ve);v(this,ue,()=>{});v(this,ie,()=>{});v(this,Se,()=>{});v(this,V,()=>false);v(this,de,t=>{});v(this,be,(t,e,n)=>{});v(this,Oe,(t,e,n,s)=>{if(n||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});m(this,St,"LRUCache");let{max:e=0,ttl:n,ttlResolution:s=1,ttlAutopurge:o,updateAgeOnGet:a,updateAgeOnHas:l,allowStale:u,dispose:g,onInsert:w,disposeAfter:b,noDisposeOnSet:M,noUpdateTTL:I,maxSize:ee=0,maxEntrySize:S=0,sizeCalculation:T,fetchMethod:y,memoMethod:k,noDeleteOnFetchRejection:L,noDeleteOnStaleGet:R,allowStaleOnFetchRejection:O,allowStaleOnFetchAbort:Ae,ignoreFetchAbort:ce,perf:pe}=t;if(pe!==void 0&&typeof pe?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(c(this,$,pe??Gt),e!==0&&!se(e))throw new TypeError("max option must be a nonnegative integer");let me=e?Et(e):Array;if(!me)throw new Error("invalid max value: "+e);if(c(this,Y,e),c(this,z,ee),this.maxEntrySize=S||i(this,z),this.sizeCalculation=T,this.sizeCalculation){if(!i(this,z)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(k!==void 0&&typeof k!="function")throw new TypeError("memoMethod must be a function if defined");if(c(this,ge,k),y!==void 0&&typeof y!="function")throw new TypeError("fetchMethod must be a function if specified");if(c(this,ye,y),c(this,le,!!y),c(this,C,new Map),c(this,F,new Array(e).fill(void 0)),c(this,f,new Array(e).fill(void 0)),c(this,N,new me(e)),c(this,q,new me(e)),c(this,D,0),c(this,P,0),c(this,X,zt.create(e)),c(this,E,0),c(this,H,0),typeof g=="function"&&c(this,B,g),typeof w=="function"&&c(this,he,w),typeof b=="function"?(c(this,K,b),c(this,x,[])):(c(this,K,void 0),c(this,x,void 0)),c(this,J,!!i(this,B)),c(this,ve,!!i(this,he)),c(this,G,!!i(this,K)),this.noDisposeOnSet=!!M,this.noUpdateTTL=!!I,this.noDeleteOnFetchRejection=!!L,this.allowStaleOnFetchRejection=!!O,this.allowStaleOnFetchAbort=!!Ae,this.ignoreFetchAbort=!!ce,this.maxEntrySize!==0){if(i(this,z)!==0&&!se(i(this,z)))throw new TypeError("maxSize must be a positive integer if specified");if(!se(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");d(this,h,xt).call(this);}if(this.allowStale=!!u,this.noDeleteOnStaleGet=!!R,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!l,this.ttlResolution=se(s)||s===0?s:1,this.ttlAutopurge=!!o,this.ttl=n||0,this.ttl){if(!se(this.ttl))throw new TypeError("ttl must be a positive integer if specified");d(this,h,qe).call(this);}if(i(this,Y)===0&&this.ttl===0&&i(this,z)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!i(this,Y)&&!i(this,z)){let Ge="LRU_CACHE_UNBOUNDED";Lt(Ge)&&(_t.add(Ge),Ct("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Ge,we));}}get perf(){return i(this,$)}static unsafeExposeInternals(t){return {starts:i(t,Z),ttls:i(t,U),autopurgeTimers:i(t,W),sizes:i(t,Q),keyMap:i(t,C),keyList:i(t,F),valList:i(t,f),next:i(t,N),prev:i(t,q),get head(){return i(t,D)},get tail(){return i(t,P)},free:i(t,X),isBackgroundFetch:e=>{var n;return d(n=t,h,A).call(n,e)},backgroundFetch:(e,n,s,o)=>{var a;return d(a=t,h,Me).call(a,e,n,s,o)},moveToTail:e=>{var n;return d(n=t,h,Fe).call(n,e)},indexes:e=>{var n;return d(n=t,h,ae).call(n,e)},rindexes:e=>{var n;return d(n=t,h,re).call(n,e)},isStale:e=>{var n;return i(n=t,V).call(n,e)}}}get max(){return i(this,Y)}get maxSize(){return i(this,z)}get calculatedSize(){return i(this,H)}get size(){return i(this,E)}get fetchMethod(){return i(this,ye)}get memoMethod(){return i(this,ge)}get dispose(){return i(this,B)}get onInsert(){return i(this,he)}get disposeAfter(){return i(this,K)}getRemainingTTL(t){return i(this,C).has(t)?1/0:0}*entries(){for(let t of d(this,h,ae).call(this))i(this,f)[t]!==void 0&&i(this,F)[t]!==void 0&&!d(this,h,A).call(this,i(this,f)[t])&&(yield [i(this,F)[t],i(this,f)[t]]);}*rentries(){for(let t of d(this,h,re).call(this))i(this,f)[t]!==void 0&&i(this,F)[t]!==void 0&&!d(this,h,A).call(this,i(this,f)[t])&&(yield [i(this,F)[t],i(this,f)[t]]);}*keys(){for(let t of d(this,h,ae).call(this)){let e=i(this,F)[t];e!==void 0&&!d(this,h,A).call(this,i(this,f)[t])&&(yield e);}}*rkeys(){for(let t of d(this,h,re).call(this)){let e=i(this,F)[t];e!==void 0&&!d(this,h,A).call(this,i(this,f)[t])&&(yield e);}}*values(){for(let t of d(this,h,ae).call(this))i(this,f)[t]!==void 0&&!d(this,h,A).call(this,i(this,f)[t])&&(yield i(this,f)[t]);}*rvalues(){for(let t of d(this,h,re).call(this))i(this,f)[t]!==void 0&&!d(this,h,A).call(this,i(this,f)[t])&&(yield i(this,f)[t]);}[(Ot=Symbol.iterator,St=Symbol.toStringTag,Ot)](){return this.entries()}find(t,e={}){for(let n of d(this,h,ae).call(this)){let s=i(this,f)[n],o=d(this,h,A).call(this,s)?s.__staleWhileFetching:s;if(o!==void 0&&t(o,i(this,F)[n],this))return this.get(i(this,F)[n],e)}}forEach(t,e=this){for(let n of d(this,h,ae).call(this)){let s=i(this,f)[n],o=d(this,h,A).call(this,s)?s.__staleWhileFetching:s;o!==void 0&&t.call(e,o,i(this,F)[n],this);}}rforEach(t,e=this){for(let n of d(this,h,re).call(this)){let s=i(this,f)[n],o=d(this,h,A).call(this,s)?s.__staleWhileFetching:s;o!==void 0&&t.call(e,o,i(this,F)[n],this);}}purgeStale(){let t=false;for(let e of d(this,h,re).call(this,{allowStale:true}))i(this,V).call(this,e)&&(d(this,h,oe).call(this,i(this,F)[e],"expire"),t=true);return t}info(t){let e=i(this,C).get(t);if(e===void 0)return;let n=i(this,f)[e],s=d(this,h,A).call(this,n)?n.__staleWhileFetching:n;if(s===void 0)return;let o={value:s};if(i(this,U)&&i(this,Z)){let a=i(this,U)[e],l=i(this,Z)[e];if(a&&l){let u=a-(i(this,$).now()-l);o.ttl=u,o.start=Date.now();}}return i(this,Q)&&(o.size=i(this,Q)[e]),o}dump(){let t=[];for(let e of d(this,h,ae).call(this,{allowStale:true})){let n=i(this,F)[e],s=i(this,f)[e],o=d(this,h,A).call(this,s)?s.__staleWhileFetching:s;if(o===void 0||n===void 0)continue;let a={value:o};if(i(this,U)&&i(this,Z)){a.ttl=i(this,U)[e];let l=i(this,$).now()-i(this,Z)[e];a.start=Math.floor(Date.now()-l);}i(this,Q)&&(a.size=i(this,Q)[e]),t.unshift([n,a]);}return t}load(t){this.clear();for(let[e,n]of t){if(n.start){let s=Date.now()-n.start;n.start=i(this,$).now()-s;}this.set(e,n.value,n);}}set(t,e,n={}){var M,I,ee,S;if(e===void 0)return this.delete(t),this;let{ttl:s=this.ttl,start:o,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:l=this.sizeCalculation,status:u}=n,{noUpdateTTL:g=this.noUpdateTTL}=n,w=i(this,Oe).call(this,t,e,n.size||0,l);if(this.maxEntrySize&&w>this.maxEntrySize)return u&&(u.set="miss",u.maxEntrySizeExceeded=true),d(this,h,oe).call(this,t,"set"),this;let b=i(this,E)===0?void 0:i(this,C).get(t);if(b===void 0)b=i(this,E)===0?i(this,P):i(this,X).length!==0?i(this,X).pop():i(this,E)===i(this,Y)?d(this,h,De).call(this,false):i(this,E),i(this,F)[b]=t,i(this,f)[b]=e,i(this,C).set(t,b),i(this,N)[i(this,P)]=b,i(this,q)[b]=i(this,P),c(this,P,b),xe(this,E)._++,i(this,be).call(this,b,w,u),u&&(u.set="add"),g=false,i(this,ve)&&((M=i(this,he))==null||M.call(this,e,t,"add"));else {d(this,h,Fe).call(this,b);let T=i(this,f)[b];if(e!==T){if(i(this,le)&&d(this,h,A).call(this,T)){T.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:y}=T;y!==void 0&&!a&&(i(this,J)&&((I=i(this,B))==null||I.call(this,y,t,"set")),i(this,G)&&i(this,x)?.push([y,t,"set"]));}else a||(i(this,J)&&((ee=i(this,B))==null||ee.call(this,T,t,"set")),i(this,G)&&i(this,x)?.push([T,t,"set"]));if(i(this,de).call(this,b),i(this,be).call(this,b,w,u),i(this,f)[b]=e,u){u.set="replace";let y=T&&d(this,h,A).call(this,T)?T.__staleWhileFetching:T;y!==void 0&&(u.oldValue=y);}}else u&&(u.set="update");i(this,ve)&&this.onInsert?.(e,t,e===T?"update":"replace");}if(s!==0&&!i(this,U)&&d(this,h,qe).call(this),i(this,U)&&(g||i(this,Se).call(this,b,s,o),u&&i(this,ie).call(this,u,b)),!a&&i(this,G)&&i(this,x)){let T=i(this,x),y;for(;y=T?.shift();)(S=i(this,K))==null||S.call(this,...y);}return this}pop(){var t;try{for(;i(this,E);){let e=i(this,f)[i(this,D)];if(d(this,h,De).call(this,!0),d(this,h,A).call(this,e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(i(this,G)&&i(this,x)){let e=i(this,x),n;for(;n=e?.shift();)(t=i(this,K))==null||t.call(this,...n);}}}has(t,e={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:s}=e,o=i(this,C).get(t);if(o!==void 0){let a=i(this,f)[o];if(d(this,h,A).call(this,a)&&a.__staleWhileFetching===void 0)return false;if(i(this,V).call(this,o))s&&(s.has="stale",i(this,ie).call(this,s,o));else return n&&i(this,ue).call(this,o),s&&(s.has="hit",i(this,ie).call(this,s,o)),true}else s&&(s.has="miss");return false}peek(t,e={}){let{allowStale:n=this.allowStale}=e,s=i(this,C).get(t);if(s===void 0||!n&&i(this,V).call(this,s))return;let o=i(this,f)[s];return d(this,h,A).call(this,o)?o.__staleWhileFetching:o}async fetch(t,e={}){let{allowStale:n=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:l=this.noDisposeOnSet,size:u=0,sizeCalculation:g=this.sizeCalculation,noUpdateTTL:w=this.noUpdateTTL,noDeleteOnFetchRejection:b=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:M=this.allowStaleOnFetchRejection,ignoreFetchAbort:I=this.ignoreFetchAbort,allowStaleOnFetchAbort:ee=this.allowStaleOnFetchAbort,context:S,forceRefresh:T=false,status:y,signal:k}=e;if(!i(this,le))return y&&(y.fetch="get"),this.get(t,{allowStale:n,updateAgeOnGet:s,noDeleteOnStaleGet:o,status:y});let L={allowStale:n,updateAgeOnGet:s,noDeleteOnStaleGet:o,ttl:a,noDisposeOnSet:l,size:u,sizeCalculation:g,noUpdateTTL:w,noDeleteOnFetchRejection:b,allowStaleOnFetchRejection:M,allowStaleOnFetchAbort:ee,ignoreFetchAbort:I,status:y,signal:k},R=i(this,C).get(t);if(R===void 0){y&&(y.fetch="miss");let O=d(this,h,Me).call(this,t,R,L,S);return O.__returned=O}else {let O=i(this,f)[R];if(d(this,h,A).call(this,O)){let me=n&&O.__staleWhileFetching!==void 0;return y&&(y.fetch="inflight",me&&(y.returnedStale=true)),me?O.__staleWhileFetching:O.__returned=O}let Ae=i(this,V).call(this,R);if(!T&&!Ae)return y&&(y.fetch="hit"),d(this,h,Fe).call(this,R),s&&i(this,ue).call(this,R),y&&i(this,ie).call(this,y,R),O;let ce=d(this,h,Me).call(this,t,R,L,S),pe=ce.__staleWhileFetching!==void 0&&n;return y&&(y.fetch=Ae?"stale":"refresh",pe&&Ae&&(y.returnedStale=true)),pe?ce.__staleWhileFetching:ce.__returned=ce}}async forceFetch(t,e={}){let n=await this.fetch(t,e);if(n===void 0)throw new Error("fetch() returned undefined");return n}memo(t,e={}){let n=i(this,ge);if(!n)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:o,...a}=e,l=this.get(t,a);if(!o&&l!==void 0)return l;let u=n(t,l,{options:a,context:s});return this.set(t,u,a),u}get(t,e={}){let{allowStale:n=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:a}=e,l=i(this,C).get(t);if(l!==void 0){let u=i(this,f)[l],g=d(this,h,A).call(this,u);return a&&i(this,ie).call(this,a,l),i(this,V).call(this,l)?(a&&(a.get="stale"),g?(a&&n&&u.__staleWhileFetching!==void 0&&(a.returnedStale=true),n?u.__staleWhileFetching:void 0):(o||d(this,h,oe).call(this,t,"expire"),a&&n&&(a.returnedStale=true),n?u:void 0)):(a&&(a.get="hit"),g?u.__staleWhileFetching:(d(this,h,Fe).call(this,l),s&&i(this,ue).call(this,l),u))}else a&&(a.get="miss");}delete(t){return d(this,h,oe).call(this,t,"delete")}clear(){return d(this,h,Ve).call(this,"delete")}},Y=new WeakMap,z=new WeakMap,B=new WeakMap,he=new WeakMap,K=new WeakMap,ye=new WeakMap,ge=new WeakMap,$=new WeakMap,E=new WeakMap,H=new WeakMap,C=new WeakMap,F=new WeakMap,f=new WeakMap,N=new WeakMap,q=new WeakMap,D=new WeakMap,P=new WeakMap,X=new WeakMap,x=new WeakMap,Q=new WeakMap,Z=new WeakMap,U=new WeakMap,W=new WeakMap,J=new WeakMap,le=new WeakMap,G=new WeakMap,ve=new WeakMap,h=new WeakSet,qe=function(){let t=new Ie(i(this,Y)),e=new Ie(i(this,Y));c(this,U,t),c(this,Z,e);let n=this.ttlAutopurge?new Array(i(this,Y)):void 0;c(this,W,n),c(this,Se,(l,u,g=i(this,$).now())=>{e[l]=u!==0?g:0,t[l]=u,s(l,u);}),c(this,ue,l=>{e[l]=t[l]!==0?i(this,$).now():0,s(l,t[l]);});let s=this.ttlAutopurge?(l,u)=>{if(n?.[l]&&(clearTimeout(n[l]),n[l]=void 0),u&&u!==0&&n){let g=setTimeout(()=>{i(this,V).call(this,l)&&d(this,h,oe).call(this,i(this,F)[l],"expire");},u+1);g.unref&&g.unref(),n[l]=g;}}:()=>{};c(this,ie,(l,u)=>{if(t[u]){let g=t[u],w=e[u];if(!g||!w)return;l.ttl=g,l.start=w,l.now=o||a();let b=l.now-w;l.remainingTTL=g-b;}});let o=0,a=()=>{let l=i(this,$).now();if(this.ttlResolution>0){o=l;let u=setTimeout(()=>o=0,this.ttlResolution);u.unref&&u.unref();}return l};this.getRemainingTTL=l=>{let u=i(this,C).get(l);if(u===void 0)return 0;let g=t[u],w=e[u];if(!g||!w)return 1/0;let b=(o||a())-w;return g-b},c(this,V,l=>{let u=e[l],g=t[l];return !!g&&!!u&&(o||a())-u>g});},ue=new WeakMap,ie=new WeakMap,Se=new WeakMap,V=new WeakMap,xt=function(){let t=new Ie(i(this,Y));c(this,H,0),c(this,Q,t),c(this,de,e=>{c(this,H,i(this,H)-t[e]),t[e]=0;}),c(this,Oe,(e,n,s,o)=>{if(d(this,h,A).call(this,n))return 0;if(!se(s))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(s=o(n,e),!se(s))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 s}),c(this,be,(e,n,s)=>{if(t[e]=n,i(this,z)){let o=i(this,z)-t[e];for(;i(this,H)>o;)d(this,h,De).call(this,true);}c(this,H,i(this,H)+t[e]),s&&(s.entrySize=n,s.totalCalculatedSize=i(this,H));});},de=new WeakMap,be=new WeakMap,Oe=new WeakMap,ae=function*({allowStale:t=this.allowStale}={}){if(i(this,E))for(let e=i(this,P);!(!d(this,h,Ue).call(this,e)||((t||!i(this,V).call(this,e))&&(yield e),e===i(this,D)));)e=i(this,q)[e];},re=function*({allowStale:t=this.allowStale}={}){if(i(this,E))for(let e=i(this,D);!(!d(this,h,Ue).call(this,e)||((t||!i(this,V).call(this,e))&&(yield e),e===i(this,P)));)e=i(this,N)[e];},Ue=function(t){return t!==void 0&&i(this,C).get(i(this,F)[t])===t},De=function(t){var o;let e=i(this,D),n=i(this,F)[e],s=i(this,f)[e];return i(this,le)&&d(this,h,A).call(this,s)?s.__abortController.abort(new Error("evicted")):(i(this,J)||i(this,G))&&(i(this,J)&&((o=i(this,B))==null||o.call(this,s,n,"evict")),i(this,G)&&i(this,x)?.push([s,n,"evict"])),i(this,de).call(this,e),i(this,W)?.[e]&&(clearTimeout(i(this,W)[e]),i(this,W)[e]=void 0),t&&(i(this,F)[e]=void 0,i(this,f)[e]=void 0,i(this,X).push(e)),i(this,E)===1?(c(this,D,c(this,P,0)),i(this,X).length=0):c(this,D,i(this,N)[e]),i(this,C).delete(n),xe(this,E)._--,e},Me=function(t,e,n,s){let o=e===void 0?void 0:i(this,f)[e];if(d(this,h,A).call(this,o))return o;let a=new ke,{signal:l}=n;l?.addEventListener("abort",()=>a.abort(l.reason),{signal:a.signal});let u={signal:a.signal,options:n,context:s},g=(S,T=false)=>{let{aborted:y}=a.signal,k=n.ignoreFetchAbort&&S!==void 0,L=n.ignoreFetchAbort||!!(n.allowStaleOnFetchAbort&&S!==void 0);if(n.status&&(y&&!T?(n.status.fetchAborted=true,n.status.fetchError=a.signal.reason,k&&(n.status.fetchAbortIgnored=true)):n.status.fetchResolved=true),y&&!k&&!T)return b(a.signal.reason,L);let R=I,O=i(this,f)[e];return (O===I||k&&T&&O===void 0)&&(S===void 0?R.__staleWhileFetching!==void 0?i(this,f)[e]=R.__staleWhileFetching:d(this,h,oe).call(this,t,"fetch"):(n.status&&(n.status.fetchUpdated=true),this.set(t,S,u.options))),S},w=S=>(n.status&&(n.status.fetchRejected=true,n.status.fetchError=S),b(S,false)),b=(S,T)=>{let{aborted:y}=a.signal,k=y&&n.allowStaleOnFetchAbort,L=k||n.allowStaleOnFetchRejection,R=L||n.noDeleteOnFetchRejection,O=I;if(i(this,f)[e]===I&&(!R||!T&&O.__staleWhileFetching===void 0?d(this,h,oe).call(this,t,"fetch"):k||(i(this,f)[e]=O.__staleWhileFetching)),L)return n.status&&O.__staleWhileFetching!==void 0&&(n.status.returnedStale=true),O.__staleWhileFetching;if(O.__returned===O)throw S},M=(S,T)=>{var k;let y=(k=i(this,ye))==null?void 0:k.call(this,t,o,u);y&&y instanceof Promise&&y.then(L=>S(L===void 0?void 0:L),T),a.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(S(void 0),n.allowStaleOnFetchAbort&&(S=L=>g(L,true)));});};n.status&&(n.status.fetchDispatched=true);let I=new Promise(M).then(g,w),ee=Object.assign(I,{__abortController:a,__staleWhileFetching:o,__returned:void 0});return e===void 0?(this.set(t,ee,{...u.options,status:void 0}),e=i(this,C).get(t)):i(this,f)[e]=ee,ee},A=function(t){if(!i(this,le))return false;let e=t;return !!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof ke},We=function(t,e){i(this,q)[e]=t,i(this,N)[t]=e;},Fe=function(t){t!==i(this,P)&&(t===i(this,D)?c(this,D,i(this,N)[t]):d(this,h,We).call(this,i(this,q)[t],i(this,N)[t]),d(this,h,We).call(this,i(this,P),t),c(this,P,t));},oe=function(t,e){var s,o;let n=false;if(i(this,E)!==0){let a=i(this,C).get(t);if(a!==void 0)if(i(this,W)?.[a]&&(clearTimeout(i(this,W)?.[a]),i(this,W)[a]=void 0),n=true,i(this,E)===1)d(this,h,Ve).call(this,e);else {i(this,de).call(this,a);let l=i(this,f)[a];if(d(this,h,A).call(this,l)?l.__abortController.abort(new Error("deleted")):(i(this,J)||i(this,G))&&(i(this,J)&&((s=i(this,B))==null||s.call(this,l,t,e)),i(this,G)&&i(this,x)?.push([l,t,e])),i(this,C).delete(t),i(this,F)[a]=void 0,i(this,f)[a]=void 0,a===i(this,P))c(this,P,i(this,q)[a]);else if(a===i(this,D))c(this,D,i(this,N)[a]);else {let u=i(this,q)[a];i(this,N)[u]=i(this,N)[a];let g=i(this,N)[a];i(this,q)[g]=i(this,q)[a];}xe(this,E)._--,i(this,X).push(a);}}if(i(this,G)&&i(this,x)?.length){let a=i(this,x),l;for(;l=a?.shift();)(o=i(this,K))==null||o.call(this,...l);}return n},Ve=function(t){var e,n;for(let s of d(this,h,re).call(this,{allowStale:true})){let o=i(this,f)[s];if(d(this,h,A).call(this,o))o.__abortController.abort(new Error("deleted"));else {let a=i(this,F)[s];i(this,J)&&((e=i(this,B))==null||e.call(this,o,a,t)),i(this,G)&&i(this,x)?.push([o,a,t]);}}if(i(this,C).clear(),i(this,f).fill(void 0),i(this,F).fill(void 0),i(this,U)&&i(this,Z)){i(this,U).fill(0),i(this,Z).fill(0);for(let s of i(this,W)??[])s!==void 0&&clearTimeout(s);i(this,W)?.fill(void 0);}if(i(this,Q)&&i(this,Q).fill(0),c(this,D,0),c(this,P,0),i(this,X).length=0,c(this,H,0),c(this,E,0),i(this,G)&&i(this,x)){let s=i(this,x),o;for(;o=s?.shift();)(n=i(this,K))==null||n.call(this,...o);}},we);var _e=class{constructor(t){m(this,"cache");m(this,"map",new Map);this.cache=new Pt({max:t.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(t){let e=this.map.delete(t);return e&&this.cache.delete(t),e}get forEach(){return this.map.forEach}get(t){let e=this.cache.get(t);return e||this.map.get(t)}has(t){return this.map.has(t)}set(t,e){return this.map.set(t,e),this.cache.set(t,e),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var Ye;(o=>(o.mediaInstances=new Map,o.channels=new Map,o.transients=new Set,o.systemPausedAliases=new Set,o.bufferRegistry=new _e({cacheSize:10})))(Ye||(Ye={}));var p=Ye;var _;(s=>(s.log=(o,...a)=>console.log(`[Pixi\u2019VN] ${o}`,...a),s.warn=(o,...a)=>console.warn(`[Pixi\u2019VN] ${o}`,...a),s.error=(o,...a)=>console.error(`[Pixi\u2019VN] ${o}`,...a),s.info=(o,...a)=>console.info(`[Pixi\u2019VN] ${o}`,...a)))(_||(_={}));function Re(r){return r.reduce((t,e)=>{switch(e.filterType){case "ReverbFilter":t.push(new j.Reverb({decay:e.decay,preDelay:e.preDelay,wet:e.wet}).toDestination());break;case "FeedbackDelayFilter":t.push(new j.FeedbackDelay({feedback:e.feedback,delayTime:e.delayTime,wet:e.wet}).toDestination());break;case "BitCrusherFilter":t.push(new j.BitCrusher({bits:e.bits}).toDestination());break;case "CompressorFilter":t.push(new j.Compressor({attack:e.attack,knee:e.knee,ratio:e.ratio,release:e.release,threshold:e.threshold}).toDestination());break;case "DelayFilter":t.push(new j.Delay({delayTime:e.delayTime,maxDelay:e.maxDelay}).toDestination());break;case "DistortionFilter":t.push(new j.Distortion({distortion:e.distortion,oversample:e.oversample,wet:e.wet}).toDestination());break;case "FeedbackCombFilterFilter":t.push(new j.FeedbackCombFilter({delayTime:e.delayTime,resonance:e.resonance}).toDestination());break;case "FreeverbFilter":t.push(new j.Freeverb({roomSize:e.roomSize,dampening:e.dampening,wet:e.wet}).toDestination());break;case "GateFilter":t.push(new j.Gate({threshold:e.threshold,smoothing:e.smoothing}).toDestination());break;case "GreaterThanFilter":t.push(new j.GreaterThan({value:e.value,convert:e.convert,maxValue:e.maxValue,minValue:e.minValue,units:e.units}).toDestination());break;case "GreaterThanZeroFilter":t.push(new j.GreaterThanZero);break;case "LimiterFilter":t.push(new j.Limiter({threshold:e.threshold}).toDestination());break;case "MidSideCompressorFilter":t.push(new j.MidSideCompressor({mid:e.mid,side:e.side}).toDestination());break;case "MultibandCompressorFilter":t.push(new j.MultibandCompressor({lowFrequency:e.lowFrequency,highFrequency:e.highFrequency,low:e.low,mid:e.mid,high:e.high}).toDestination());break;case "Panner3DFilter":t.push(new j.Panner3D({positionX:e.positionX,positionY:e.positionY,positionZ:e.positionZ,orientationX:e.orientationX,orientationY:e.orientationY,orientationZ:e.orientationZ,coneInnerAngle:e.coneInnerAngle,coneOuterAngle:e.coneOuterAngle,coneOuterGain:e.coneOuterGain,distanceModel:e.distanceModel,maxDistance:e.maxDistance,refDistance:e.refDistance,rolloffFactor:e.rolloffFactor,panningModel:e.panningModel}).toDestination());break;case "PhaserFilter":t.push(new j.Phaser({frequency:e.frequency,octaves:e.octaves,baseFrequency:e.baseFrequency,wet:e.wet,Q:e.Q,stages:e.stages}).toDestination());break;case "StereoWidenerFilter":t.push(new j.StereoWidener({width:e.width,wet:e.wet}).toDestination());break;case "PingPongDelayFilter":t.push(new j.PingPongDelay({wet:e.wet,delayTime:e.delayTime,feedback:e.feedback,maxDelay:e.maxDelay}).toDestination());break;case "AutoFilterFilter":t.push(new j.AutoFilter({frequency:e.frequency,depth:e.depth,baseFrequency:e.baseFrequency,octaves:e.octaves,filter:e.filter,wet:e.wet,type:e.type}).toDestination());break;case "BiquadFilterFilter":t.push(new j.BiquadFilter({frequency:e.frequency,detune:e.detune,Q:e.Q,type:e.type,gain:e.gain}).toDestination());break;case "OnePoleFilterFilter":t.push(new j.OnePoleFilter({type:e.type}).toDestination());break;case "CustomFilter":t.push(new j.Filter({frequency:e.frequency,Q:e.Q,type:e.type,detune:e.detune,gain:e.gain,rolloff:e.rolloff}).toDestination());break;case "ChorusFilter":t.push(new j.Chorus({frequency:e.frequency,delayTime:e.delayTime,depth:e.depth,type:e.type,spread:e.spread,feedback:e.feedback,wet:e.wet}).toDestination());break;case "TremoloFilter":t.push(new j.Tremolo({frequency:e.frequency,type:e.type,depth:e.depth,spread:e.spread,wet:e.wet}).toDestination());break;case "VibratoFilter":t.push(new j.Vibrato({maxDelay:e.maxDelay,frequency:e.frequency,depth:e.depth,type:e.type,wet:e.wet}).toDestination());break;case "AutoPannerFilter":t.push(new j.AutoPanner({frequency:e.frequency,type:e.type,depth:e.depth,channelCount:e.channelCount,wet:e.wet}).toDestination());break}return t},[])}function Dt(r){if(r)return Array.from(r).reduce((t,e)=>(e instanceof j.Reverb?t.push({filterType:"ReverbFilter",wet:e.wet.value,decay:j.Time(e.decay).toSeconds(),preDelay:j.Time(e.preDelay).toSeconds()}):e instanceof j.PingPongDelay?t.push({filterType:"PingPongDelayFilter",wet:e.wet.value,delayTime:e.delayTime.value,feedback:e.feedback.value}):e instanceof j.FeedbackDelay?t.push({filterType:"FeedbackDelayFilter",feedback:e.feedback.value,delayTime:e.delayTime.value,wet:e.wet.value}):e instanceof j.BitCrusher?t.push({filterType:"BitCrusherFilter",bits:e.bits.value,wet:e.wet.value}):e instanceof j.Compressor?t.push({filterType:"CompressorFilter",attack:e.attack.value,knee:e.knee.value,ratio:e.ratio.value,release:e.release.value,threshold:e.threshold.value}):e instanceof j.Delay?t.push({filterType:"DelayFilter",delayTime:e.delayTime.value,maxDelay:e.maxDelay}):e instanceof j.Distortion?t.push({filterType:"DistortionFilter",distortion:e.distortion,oversample:e.oversample,wet:e.wet.value}):e instanceof j.FeedbackCombFilter?t.push({filterType:"FeedbackCombFilterFilter",delayTime:e.delayTime.value,resonance:e.resonance.value}):e instanceof j.Freeverb?t.push({filterType:"FreeverbFilter",roomSize:e.roomSize.value,dampening:e.dampening,wet:e.wet.value}):e instanceof j.Gate?t.push({filterType:"GateFilter",threshold:e.threshold,smoothing:e.smoothing}):e instanceof j.GreaterThan?t.push({filterType:"GreaterThanFilter",value:e.comparator.value,convert:e.convert,maxValue:e.maxValue,minValue:e.minValue}):e instanceof j.GreaterThanZero?t.push({filterType:"GreaterThanZeroFilter"}):e instanceof j.Limiter?t.push({filterType:"LimiterFilter",threshold:e.threshold.value}):e instanceof j.MidSideCompressor?t.push({filterType:"MidSideCompressorFilter",mid:{attack:e.mid.attack.value,knee:e.mid.knee.value,ratio:e.mid.ratio.value,release:e.mid.release.value,threshold:e.mid.threshold.value},side:{attack:e.side.attack.value,knee:e.side.knee.value,ratio:e.side.ratio.value,release:e.side.release.value,threshold:e.side.threshold.value}}):e instanceof j.MultibandCompressor?t.push({filterType:"MultibandCompressorFilter",lowFrequency:e.lowFrequency.value,highFrequency:e.highFrequency.value,low:{attack:e.low.attack.value,knee:e.low.knee.value,ratio:e.low.ratio.value,release:e.low.release.value,threshold:e.low.threshold.value},mid:{attack:e.mid.attack.value,knee:e.mid.knee.value,ratio:e.mid.ratio.value,release:e.mid.release.value,threshold:e.mid.threshold.value},high:{attack:e.high.attack.value,knee:e.high.knee.value,ratio:e.high.ratio.value,release:e.high.release.value,threshold:e.high.threshold.value}}):e instanceof j.Panner3D?t.push({filterType:"Panner3DFilter",positionX:e.positionX.value,positionY:e.positionY.value,positionZ:e.positionZ.value,orientationX:e.orientationX.value,orientationY:e.orientationY.value,orientationZ:e.orientationZ.value,coneInnerAngle:e.coneInnerAngle,coneOuterAngle:e.coneOuterAngle,coneOuterGain:e.coneOuterGain,distanceModel:e.distanceModel,maxDistance:e.maxDistance,refDistance:e.refDistance,rolloffFactor:e.rolloffFactor,panningModel:e.panningModel}):e instanceof j.Phaser?t.push({filterType:"PhaserFilter",frequency:e.frequency.value,octaves:e.octaves,baseFrequency:e.baseFrequency,wet:e.wet.value,Q:e.Q.value}):e instanceof j.StereoWidener?t.push({filterType:"StereoWidenerFilter",width:e.width.value,wet:e.wet.value}):e instanceof j.AutoFilter?t.push({filterType:"AutoFilterFilter",type:e.type,frequency:e.frequency.value,depth:e.depth.value,baseFrequency:e.baseFrequency,octaves:e.octaves,filter:{Q:e.filter.Q.value,type:e.filter.type,rolloff:e.filter.rolloff},wet:e.wet.value}):e instanceof j.Chorus?t.push({filterType:"ChorusFilter",type:e.type,frequency:e.frequency.value,delayTime:e.delayTime,depth:e.depth,spread:e.spread,feedback:e.feedback.value,wet:e.wet.value}):e instanceof j.Tremolo?t.push({filterType:"TremoloFilter",type:e.type,frequency:e.frequency.value,depth:e.depth.value,spread:e.spread,wet:e.wet.value}):e instanceof j.Vibrato?t.push({filterType:"VibratoFilter",type:e.type,frequency:e.frequency.value,depth:e.depth.value,wet:e.wet.value}):e instanceof j.AutoPanner?t.push({filterType:"AutoPannerFilter",type:e.type,frequency:e.frequency.value,depth:e.depth.value,channelCount:e.channelCount,wet:e.wet.value}):e instanceof j.BiquadFilter?t.push({filterType:"BiquadFilterFilter",type:e.type,frequency:e.frequency.value,detune:e.detune.value,Q:e.Q.value,gain:e.gain.value}):e instanceof j.OnePoleFilter?t.push({filterType:"OnePoleFilterFilter",type:e.type}):e instanceof j.Filter?t.push({filterType:"CustomFilter",type:e.type,frequency:e.frequency.value,Q:e.Q.value,detune:e.detune.value,gain:e.gain.value,rolloff:e.rolloff}):_.warn(`Unsupported filter type for serialisation: ${e?.constructor?.name??e}, please report this to the developers if you encounter it.`),t),[])}function gt(r){return r instanceof j.Reverb||r instanceof j.FeedbackDelay||r instanceof j.PingPongDelay||r instanceof j.BitCrusher||r instanceof j.Compressor||r instanceof j.Delay||r instanceof j.Distortion||r instanceof j.FeedbackCombFilter||r instanceof j.Freeverb||r instanceof j.Gate||r instanceof j.GreaterThan||r instanceof j.GreaterThanZero||r instanceof j.Limiter||r instanceof j.MidSideCompressor||r instanceof j.MultibandCompressor||r instanceof j.Panner3D||r instanceof j.Phaser||r instanceof j.StereoWidener||r instanceof j.AutoFilter||r instanceof j.Chorus||r instanceof j.Vibrato||r instanceof j.Tremolo||r instanceof j.AutoPanner||r instanceof j.BiquadFilter||r instanceof j.OnePoleFilter||r instanceof j.Filter}function ne(r){return r<=0?-1/0:20*Math.log10(r)}function Te(r){return r<=-1/0?0:10**(r/20)}async function Ne(r){if(p.bufferRegistry.has(r))return;let t=r;try{let e=kt__default.default.Assets.resolver.resolve(r);e?.src&&(t=e.src);}catch{}try{let e=await j.ToneAudioBuffer.load(t),n=new j.ToneAudioBuffer(e);p.bufferRegistry.set(r,n);}catch(e){_.warn(`Failed to load audio buffer for "${r}" (url: "${t}"): ${e instanceof Error?e.message:e}`),p.bufferRegistry.set(r,new j.ToneAudioBuffer);}}var Ce=class extends j.Player{constructor(e,n,s,o,a={},l){super(a);m(this,"alias",e);m(this,"channelAlias",n);m(this,"soundAlias",s);m(this,"stepCounter",o);m(this,"delay",l);m(this,"options");m(this,"filters",new Set);m(this,"pausedAt");m(this,"playStartTime",j.now());this.options=a;}get memory(){let e=this.pausedAt?this.pausedAt-this.playStartTime:j.now()-this.playStartTime,n=this.paused;return n&&p.systemPausedAliases.has(this.alias)&&(n=false),{...this.options,fadeIn:this.fadeIn,loop:this.loop,loopEnd:this.loopEnd,loopStart:this.loopStart,mute:this.mute,playbackRate:this.playbackRate,reverse:this.reverse,volume:Te(this.volume.value),autostart:!this.paused,elapsed:e,paused:n,delay:this.delay}}set memory(e){this.paused=e.paused,this.loop!==(e.loop||false)&&(this.loop=e.loop||false),this.volume.value!==ne(e.volume??1)&&(this.volume.value=ne(e.volume??1)),this.mute!==(e.mute||false)&&(this.mute=e.mute||false),this.playbackRate!==(e.playbackRate??1)&&(this.playbackRate=e.playbackRate??1),this.reverse!==(e.reverse||false)&&(this.reverse=e.reverse||false),this.fadeIn!==(e.fadeIn||0)&&(this.fadeIn=e.fadeIn||0),this.loopStart!==(e.loopStart||0)&&(this.loopStart=e.loopStart||0),this.loopEnd!==(e.loopEnd||0)&&(this.loopEnd=e.loopEnd||0);}get paused(){return typeof this.pausedAt=="number"}set paused(e){let n=this.state;if(e)this.pausedAt=j.now(),n==="started"&&super.stop();else {let s;typeof this.pausedAt=="number"&&(s=this.pausedAt-this.playStartTime,this.pausedAt=void 0),n==="stopped"&&(this.delay?super.start(`+${this.delay}`,s):super.start(void 0,s));}}get muted(){return this.mute}set muted(e){this.mute=e;}get speed(){return this.playbackRate}set speed(e){this.playbackRate=e;}stop(e){return p.mediaInstances.delete(this.alias),super.stop(e)}chain(...e){return e.forEach(n=>{gt(n)&&(n.toDestination(),this.filters.add(n));}),super.chain(...e)}disconnect(e){return gt(e)&&(e.disconnect(),this.filters.delete(e)),super.disconnect(e)}};var Ee=class{constructor(t,e={}){m(this,"alias",t);m(this,"toneChannel");m(this,"background");this.background=e.background??false,this.toneChannel=new j.Channel({volume:ne(e.volume??1),mute:e.muted??false,pan:e.pan??0}).toDestination(),e.filters&&this.toneChannel.chain(...e.filters);}get volume(){return Te(this.toneChannel.volume.value)}set volume(t){this.toneChannel.volume.value=ne(t);}get volumeParam(){return this.toneChannel.volume}get pan(){return this.toneChannel.pan.value}set pan(t){this.toneChannel.pan.value=t;}get panParam(){return this.toneChannel.pan}get muted(){return this.toneChannel.mute}set muted(t){this.toneChannel.mute=t;}pauseAll(){for(let t of p.mediaInstances.values())t.channelAlias===this.alias&&!t.paused&&(t.paused=true);return this}resumeAll(){for(let t of p.mediaInstances.values())t.channelAlias===this.alias&&t.paused&&(t.paused=false);return this}chain(...t){return this.toneChannel.chain(...t),this}_createPlayer(t,e,n={}){let s=p.bufferRegistry.get(e);if(!s)throw new core.PixiError("unregistered_asset",`Sound buffer for alias "${e}" is not loaded. Call sound.load() first.`);let{delay:o,elapsed:a,filters:l=[],muted:u,autostart:g=true,speed:w,volume:b,...M}=n;u!==void 0&&(_.warn(`MediaInstance "${t}" is being created with muted=${u}. This will override the channel's muted state (${this.muted}).`),M.mute=u),w!==void 0&&(_.warn(`MediaInstance "${t}" is being created with speed=${w}. This will override the default playback speed of 1.`),M.playbackRate=w);let I=new Ce(t,this.alias,e,core.GameUnifier.stepCounter,{...M,volume:b!==void 0?ne(b):void 0,url:s},o).chain(...l,this.toneChannel);return g&&(o?I.start(`+${o}`,a):I.start(void 0,a)),I}async play(t,e,n){let s,o;if(typeof e=="string"?(s=t,o=e):(s=t,o=t,n=e),p.mediaInstances.has(s)){let l=p.mediaInstances.get(s);l&&(l.stop(),n={...l.memory,...n,filters:[...l.filters,...n?.filters||[]]});}await Ne(o);let a=this._createPlayer(s,o,n);return p.mediaInstances.set(s,a),a}toggleMuteAll(){return this.muted=!this.muted,this.muted}get mediaInstances(){return Array.from(p.mediaInstances.values()).reduce((t,e)=>(e.channelAlias===this.alias&&t.push(e),t),[])}stopAll(){let t=[];for(let[e,n]of p.mediaInstances.entries())n.channelAlias===this.alias&&(n.stop(),t.push(e));return t.forEach(e=>{p.mediaInstances.delete(e);}),this}};function Mt(r){try{if(typeof r>"u")return r;let t=JSON.stringify(r);return JSON.parse(t)}catch(t){throw _.error("Error creating exportable element",r,t),new core.PixiError("not_json_serializable","Error creating exportable element")}}var Pe=class{constructor(){m(this,"_speedAll",1);m(this,"_defaultChannelAlias",At);}get volumeAll(){return Te(j__namespace.getDestination().volume.value)}set volumeAll(t){j__namespace.getDestination().volume.value=ne(t);}get speedAll(){return this._speedAll}set speedAll(t){this._speedAll=t;for(let e of p.mediaInstances.values())e.speed=t;}get defaultChannelAlias(){return this._defaultChannelAlias}set defaultChannelAlias(t){this._defaultChannelAlias=t;}add(t,e){if(!p.bufferRegistry.has(t)){let n=new j__namespace.ToneAudioBuffer(e);p.bufferRegistry.set(t,n);}}pauseAll(){for(let t of p.mediaInstances.values())t.paused||(t.paused=true);return this}resumeAll(){for(let t of p.mediaInstances.values())t.paused&&(t.paused=false);return this}get muted(){return j__namespace.getDestination().mute}toggleMuteAll(){let t=!j__namespace.getDestination().mute;return j__namespace.getDestination().mute=t,t}muteAll(){return j__namespace.getDestination().mute=true,this}unmuteAll(){return j__namespace.getDestination().mute=false,this}stopAll(){for(let t of p.mediaInstances.values())t.stop();return p.mediaInstances.clear(),this}pauseUnsavedAll(t){for(let[e,n]of p.mediaInstances.entries())t&&n.channelAlias!==t||n.paused||(n.paused=true,p.systemPausedAliases.add(e));if(!t){for(let e of p.transients)e.stop();p.transients.clear();}return this}resumeUnsavedAll(t){let e=[];for(let n of p.systemPausedAliases){let s=p.mediaInstances.get(n);if(!s){e.push(n);continue}t&&s.channelAlias!==t||(s.paused=false,e.push(n));}for(let n of e)p.systemPausedAliases.delete(n);return this}stopTransientAll(){for(let t of p.transients)t.stop();return p.transients.clear(),this}async play(t,e,n){let s,o;typeof e=="string"?(s=t,o=e):(s=t,o=t,n=e),p.bufferRegistry.has(o)||await this.load(o);let{channel:a=this.defaultChannelAlias,...l}=n??{};return await this.findChannel(a).play(s,o,l)}async playTransient(t,e){p.bufferRegistry.has(t)||await this.load(t);let n=p.bufferRegistry.get(t);if(!n)throw new core.PixiError("unregistered_asset",`Sound buffer for alias "${t}" is not loaded. Call sound.load() first.`);let{autostart:s=true,...o}=e??{},a=new j__namespace.Player({...o,url:n}).toDestination();return s&&a.start(),p.transients.add(a),a.onstop=()=>{a.dispose(),p.transients.delete(a);},a}find(t){return p.mediaInstances.get(t)}stop(t){let e=this.find(t);e?(e.stop(),p.mediaInstances.delete(t)):_.warn(`No media instance found with alias ${t} to stop.`);}pause(t){let e=this.find(t);if(!e){_.warn(`No media instance found with alias ${t} to pause.`);return}return e.paused=true,e}resume(t){let e=this.find(t);if(!e){_.warn(`No media instance found with alias ${t} to resume.`);return}return e.paused=false,e}duration(t){return p.bufferRegistry.get(t)?.duration??0}async load(...t){let e=t.map(Ne);await Promise.all(e);}backgroundLoad(...t){return this.load(...t).catch(e=>{_.error("Error background-loading sound",e);})}backgroundLoadBundle(t){let e=kt__default.default.Assets.backgroundLoadBundle(t);return e.then(async()=>{try{let n=await kt__default.default.Assets.loadBundle(t),s=[];for(let o in n)p.bufferRegistry.has(o)||s.push(this.load(o));await Promise.all(s);}catch(n){_.error("Error loading sound bundle",n);}}).catch(n=>{_.error("Error background-loading sound bundle",n);}),e}clear(){this.stopAll();}addChannel(t,e={}){if(typeof t!="string"){t.forEach(s=>{let o={...e,filters:e.filters?[...e.filters]:e.filters};this.addChannel(s,o);});return}if(p.channels.has(t)){_.warn(`Channel with alias ${t} already exists.`);return}let n=new Ee(t,e);return p.channels.set(t,n),n}findChannel(t){let e=p.channels.get(t);return e||this.addChannel(t)}get channels(){return Array.from(p.channels.values())}export(){let t=Array.from(p.mediaInstances.entries()).reduce((e,[n,s])=>(e[n]={channelAlias:s.channelAlias,soundAlias:s.soundAlias,stepCounter:s.stepCounter,paused:s.paused,options:{...s.memory,filters:Dt(s.filters)}},e),{});return {mediaInstances:Mt(t)}}async restore(t){try{if(Object.hasOwn(t,"soundsPlaying")){let e=t.soundsPlaying;if(e){let n=Object.keys(e).map(async s=>{await this.load(s),await this.play(s);});await Promise.all(n);}}if(Object.hasOwn(t,"mediaInstances")){let e=t.mediaInstances;if(e){let n=new Set,s=Object.values(e).map(async({soundAlias:a,channelAlias:l})=>(n.add(l),await this.load(a)));await Promise.all(s),this.channels.forEach(a=>{(!a.background||!n.has(a.alias))&&a.stopAll();});let o=Object.keys(e).map(async a=>{let l=e[a],u=this.findChannel(l.channelAlias),g=l.options.paused??l.paused??!1;if(u.background)if(l.stepCounter===core.GameUnifier.stepCounter||!this.find(a)){let w=await u.play(a,l.soundAlias,{...l.options,autostart:!g,filters:Re(l.options.filters||[]),delay:l.options.delay});w.paused=g;}else {let w=p.mediaInstances.get(a);if(!w){_.warn(`No media instance found with alias ${a} while restoring background state.`);return}w.memory={...l.options,paused:g},[...w.filters].forEach(M=>{w.disconnect(M),M.dispose();}),w.chain(...Re(l.options.filters||[]));}else {let w=await u.play(a,l.soundAlias,{...l.options,autostart:!g,filters:Re(l.options.filters||[]),delay:l.options.delay});w.paused=g;}});await Promise.all(o);}}}catch(e){_.error("Error importing data",e);}}};var wt=new Pe;core.GameUnifier.addOnPreContinue(async()=>{try{p.channels.forEach(r=>{r.background||r.stopAll();});}catch{}});if(typeof document<"u"){let r=false;document.addEventListener("visibilitychange",()=>{document.hidden?wt.muted||(wt.muteAll(),r=true):r&&(wt.unmuteAll(),r=false);});}exports.SoundRegistry=p;exports.sound=wt;
1
+ 'use strict';var core=require('@drincs/pixi-vn/core'),kt=require('@drincs/pixi-vn/pixi.js'),B=require('tone');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}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 kt__default=/*#__PURE__*/_interopDefault(kt);var B__namespace=/*#__PURE__*/_interopNamespace(B);var Rt=Object.defineProperty;var Tt=o=>{throw TypeError(o)};var Nt=(o,t,e)=>t in o?Rt(o,t,{enumerable:true,configurable:true,writable:true,value:e}):o[t]=e;var m=(o,t,e)=>Nt(o,typeof t!="symbol"?t+"":t,e),ze=(o,t,e)=>t.has(o)||Tt("Cannot "+e);var i=(o,t,e)=>(ze(o,t,"read from private field"),e?e.call(o):t.get(o)),v=(o,t,e)=>t.has(o)?Tt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(o):t.set(o,e),c=(o,t,e,n)=>(ze(o,t,"write to private field"),t.set(o,e),e),d=(o,t,e)=>(ze(o,t,"access private method"),e);var De=(o,t,e,n)=>({set _(s){c(o,t,s);},get _(){return i(o,t,n)}});var At="general";var Gt=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,_t=new Set,qe=typeof process=="object"&&process?process:{},Ct=(o,t,e,n)=>{typeof qe.emitWarning=="function"?qe.emitWarning(o,t,e,n):console.error(`[${e}] ${t}: ${o}`);},Re=globalThis.AbortController,St=globalThis.AbortSignal;if(typeof Re>"u"){St=class{constructor(){m(this,"onabort");m(this,"_onabort",[]);m(this,"reason");m(this,"aborted",false);}addEventListener(e,n){this._onabort.push(n);}},Re=class{constructor(){m(this,"signal",new St);t();}abort(e){if(!this.signal.aborted){this.signal.reason=e,this.signal.aborted=true;for(let n of this.signal._onabort)n(e);this.signal.onabort?.(e);}}};let o=qe.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{o&&(o=false,Ct("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",t));};}var Lt=o=>!_t.has(o);var se=o=>o&&o===Math.floor(o)&&o>0&&isFinite(o),Et=o=>se(o)?o<=Math.pow(2,8)?Uint8Array:o<=Math.pow(2,16)?Uint16Array:o<=Math.pow(2,32)?Uint32Array:o<=Number.MAX_SAFE_INTEGER?Ie:null:null,Ie=class extends Array{constructor(o){super(o),this.fill(0);}},te,fe,zt=(te=class{constructor(t,e){m(this,"heap");m(this,"length");if(!i(te,fe))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0;}static create(t){let e=Et(t);if(!e)return [];c(te,fe,true);let n=new te(t,e);return c(te,fe,false),n}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}},fe=new WeakMap,v(te,fe,false),te),Ft,Ot,j,q,K,he,$,ye,ge,H,E,X,C,S,f,N,U,I,P,Q,x,Z,J,W,V,ee,le,G,ve,h,Ue,ue,ie,Fe,Y,xt,de,be,Oe,ae,re,We,Me,ke,A,Ve,Se,oe,Ye,we,Pt=(we=class{constructor(t){v(this,h);v(this,j);v(this,q);v(this,K);v(this,he);v(this,$);v(this,ye);v(this,ge);v(this,H);m(this,"ttl");m(this,"ttlResolution");m(this,"ttlAutopurge");m(this,"updateAgeOnGet");m(this,"updateAgeOnHas");m(this,"allowStale");m(this,"noDisposeOnSet");m(this,"noUpdateTTL");m(this,"maxEntrySize");m(this,"sizeCalculation");m(this,"noDeleteOnFetchRejection");m(this,"noDeleteOnStaleGet");m(this,"allowStaleOnFetchAbort");m(this,"allowStaleOnFetchRejection");m(this,"ignoreFetchAbort");v(this,E);v(this,X);v(this,C);v(this,S);v(this,f);v(this,N);v(this,U);v(this,I);v(this,P);v(this,Q);v(this,x);v(this,Z);v(this,J);v(this,W);v(this,V);v(this,ee);v(this,le);v(this,G);v(this,ve);v(this,ue,()=>{});v(this,ie,()=>{});v(this,Fe,()=>{});v(this,Y,()=>false);v(this,de,t=>{});v(this,be,(t,e,n)=>{});v(this,Oe,(t,e,n,s)=>{if(n||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});m(this,Ft,"LRUCache");let{max:e=0,ttl:n,ttlResolution:s=1,ttlAutopurge:r,updateAgeOnGet:a,updateAgeOnHas:l,allowStale:u,dispose:g,onInsert:w,disposeAfter:b,noDisposeOnSet:M,noUpdateTTL:D,maxSize:z=0,maxEntrySize:F=0,sizeCalculation:T,fetchMethod:y,memoMethod:k,noDeleteOnFetchRejection:L,noDeleteOnStaleGet:R,allowStaleOnFetchRejection:O,allowStaleOnFetchAbort:Ae,ignoreFetchAbort:ce,perf:pe}=t;if(pe!==void 0&&typeof pe?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(c(this,H,pe??Gt),e!==0&&!se(e))throw new TypeError("max option must be a nonnegative integer");let me=e?Et(e):Array;if(!me)throw new Error("invalid max value: "+e);if(c(this,j,e),c(this,q,z),this.maxEntrySize=F||i(this,q),this.sizeCalculation=T,this.sizeCalculation){if(!i(this,q)&&!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(k!==void 0&&typeof k!="function")throw new TypeError("memoMethod must be a function if defined");if(c(this,ge,k),y!==void 0&&typeof y!="function")throw new TypeError("fetchMethod must be a function if specified");if(c(this,ye,y),c(this,le,!!y),c(this,C,new Map),c(this,S,new Array(e).fill(void 0)),c(this,f,new Array(e).fill(void 0)),c(this,N,new me(e)),c(this,U,new me(e)),c(this,I,0),c(this,P,0),c(this,Q,zt.create(e)),c(this,E,0),c(this,X,0),typeof g=="function"&&c(this,K,g),typeof w=="function"&&c(this,he,w),typeof b=="function"?(c(this,$,b),c(this,x,[])):(c(this,$,void 0),c(this,x,void 0)),c(this,ee,!!i(this,K)),c(this,ve,!!i(this,he)),c(this,G,!!i(this,$)),this.noDisposeOnSet=!!M,this.noUpdateTTL=!!D,this.noDeleteOnFetchRejection=!!L,this.allowStaleOnFetchRejection=!!O,this.allowStaleOnFetchAbort=!!Ae,this.ignoreFetchAbort=!!ce,this.maxEntrySize!==0){if(i(this,q)!==0&&!se(i(this,q)))throw new TypeError("maxSize must be a positive integer if specified");if(!se(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");d(this,h,xt).call(this);}if(this.allowStale=!!u,this.noDeleteOnStaleGet=!!R,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!l,this.ttlResolution=se(s)||s===0?s:1,this.ttlAutopurge=!!r,this.ttl=n||0,this.ttl){if(!se(this.ttl))throw new TypeError("ttl must be a positive integer if specified");d(this,h,Ue).call(this);}if(i(this,j)===0&&this.ttl===0&&i(this,q)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!i(this,j)&&!i(this,q)){let Le="LRU_CACHE_UNBOUNDED";Lt(Le)&&(_t.add(Le),Ct("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Le,we));}}get perf(){return i(this,H)}static unsafeExposeInternals(t){return {starts:i(t,J),ttls:i(t,W),autopurgeTimers:i(t,V),sizes:i(t,Z),keyMap:i(t,C),keyList:i(t,S),valList:i(t,f),next:i(t,N),prev:i(t,U),get head(){return i(t,I)},get tail(){return i(t,P)},free:i(t,Q),isBackgroundFetch:e=>{var n;return d(n=t,h,A).call(n,e)},backgroundFetch:(e,n,s,r)=>{var a;return d(a=t,h,ke).call(a,e,n,s,r)},moveToTail:e=>{var n;return d(n=t,h,Se).call(n,e)},indexes:e=>{var n;return d(n=t,h,ae).call(n,e)},rindexes:e=>{var n;return d(n=t,h,re).call(n,e)},isStale:e=>{var n;return i(n=t,Y).call(n,e)}}}get max(){return i(this,j)}get maxSize(){return i(this,q)}get calculatedSize(){return i(this,X)}get size(){return i(this,E)}get fetchMethod(){return i(this,ye)}get memoMethod(){return i(this,ge)}get dispose(){return i(this,K)}get onInsert(){return i(this,he)}get disposeAfter(){return i(this,$)}getRemainingTTL(t){return i(this,C).has(t)?1/0:0}*entries(){for(let t of d(this,h,ae).call(this))i(this,f)[t]!==void 0&&i(this,S)[t]!==void 0&&!d(this,h,A).call(this,i(this,f)[t])&&(yield [i(this,S)[t],i(this,f)[t]]);}*rentries(){for(let t of d(this,h,re).call(this))i(this,f)[t]!==void 0&&i(this,S)[t]!==void 0&&!d(this,h,A).call(this,i(this,f)[t])&&(yield [i(this,S)[t],i(this,f)[t]]);}*keys(){for(let t of d(this,h,ae).call(this)){let e=i(this,S)[t];e!==void 0&&!d(this,h,A).call(this,i(this,f)[t])&&(yield e);}}*rkeys(){for(let t of d(this,h,re).call(this)){let e=i(this,S)[t];e!==void 0&&!d(this,h,A).call(this,i(this,f)[t])&&(yield e);}}*values(){for(let t of d(this,h,ae).call(this))i(this,f)[t]!==void 0&&!d(this,h,A).call(this,i(this,f)[t])&&(yield i(this,f)[t]);}*rvalues(){for(let t of d(this,h,re).call(this))i(this,f)[t]!==void 0&&!d(this,h,A).call(this,i(this,f)[t])&&(yield i(this,f)[t]);}[(Ot=Symbol.iterator,Ft=Symbol.toStringTag,Ot)](){return this.entries()}find(t,e={}){for(let n of d(this,h,ae).call(this)){let s=i(this,f)[n],r=d(this,h,A).call(this,s)?s.__staleWhileFetching:s;if(r!==void 0&&t(r,i(this,S)[n],this))return this.get(i(this,S)[n],e)}}forEach(t,e=this){for(let n of d(this,h,ae).call(this)){let s=i(this,f)[n],r=d(this,h,A).call(this,s)?s.__staleWhileFetching:s;r!==void 0&&t.call(e,r,i(this,S)[n],this);}}rforEach(t,e=this){for(let n of d(this,h,re).call(this)){let s=i(this,f)[n],r=d(this,h,A).call(this,s)?s.__staleWhileFetching:s;r!==void 0&&t.call(e,r,i(this,S)[n],this);}}purgeStale(){let t=false;for(let e of d(this,h,re).call(this,{allowStale:true}))i(this,Y).call(this,e)&&(d(this,h,oe).call(this,i(this,S)[e],"expire"),t=true);return t}info(t){let e=i(this,C).get(t);if(e===void 0)return;let n=i(this,f)[e],s=d(this,h,A).call(this,n)?n.__staleWhileFetching:n;if(s===void 0)return;let r={value:s};if(i(this,W)&&i(this,J)){let a=i(this,W)[e],l=i(this,J)[e];if(a&&l){let u=a-(i(this,H).now()-l);r.ttl=u,r.start=Date.now();}}return i(this,Z)&&(r.size=i(this,Z)[e]),r}dump(){let t=[];for(let e of d(this,h,ae).call(this,{allowStale:true})){let n=i(this,S)[e],s=i(this,f)[e],r=d(this,h,A).call(this,s)?s.__staleWhileFetching:s;if(r===void 0||n===void 0)continue;let a={value:r};if(i(this,W)&&i(this,J)){a.ttl=i(this,W)[e];let l=i(this,H).now()-i(this,J)[e];a.start=Math.floor(Date.now()-l);}i(this,Z)&&(a.size=i(this,Z)[e]),t.unshift([n,a]);}return t}load(t){this.clear();for(let[e,n]of t){if(n.start){let s=Date.now()-n.start;n.start=i(this,H).now()-s;}this.set(e,n.value,n);}}set(t,e,n={}){var M,D,z,F;if(e===void 0)return this.delete(t),this;let{ttl:s=this.ttl,start:r,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:l=this.sizeCalculation,status:u}=n,{noUpdateTTL:g=this.noUpdateTTL}=n,w=i(this,Oe).call(this,t,e,n.size||0,l);if(this.maxEntrySize&&w>this.maxEntrySize)return u&&(u.set="miss",u.maxEntrySizeExceeded=true),d(this,h,oe).call(this,t,"set"),this;let b=i(this,E)===0?void 0:i(this,C).get(t);if(b===void 0)b=i(this,E)===0?i(this,P):i(this,Q).length!==0?i(this,Q).pop():i(this,E)===i(this,j)?d(this,h,Me).call(this,false):i(this,E),i(this,S)[b]=t,i(this,f)[b]=e,i(this,C).set(t,b),i(this,N)[i(this,P)]=b,i(this,U)[b]=i(this,P),c(this,P,b),De(this,E)._++,i(this,be).call(this,b,w,u),u&&(u.set="add"),g=false,i(this,ve)&&((M=i(this,he))==null||M.call(this,e,t,"add"));else {d(this,h,Se).call(this,b);let T=i(this,f)[b];if(e!==T){if(i(this,le)&&d(this,h,A).call(this,T)){T.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:y}=T;y!==void 0&&!a&&(i(this,ee)&&((D=i(this,K))==null||D.call(this,y,t,"set")),i(this,G)&&i(this,x)?.push([y,t,"set"]));}else a||(i(this,ee)&&((z=i(this,K))==null||z.call(this,T,t,"set")),i(this,G)&&i(this,x)?.push([T,t,"set"]));if(i(this,de).call(this,b),i(this,be).call(this,b,w,u),i(this,f)[b]=e,u){u.set="replace";let y=T&&d(this,h,A).call(this,T)?T.__staleWhileFetching:T;y!==void 0&&(u.oldValue=y);}}else u&&(u.set="update");i(this,ve)&&this.onInsert?.(e,t,e===T?"update":"replace");}if(s!==0&&!i(this,W)&&d(this,h,Ue).call(this),i(this,W)&&(g||i(this,Fe).call(this,b,s,r),u&&i(this,ie).call(this,u,b)),!a&&i(this,G)&&i(this,x)){let T=i(this,x),y;for(;y=T?.shift();)(F=i(this,$))==null||F.call(this,...y);}return this}pop(){var t;try{for(;i(this,E);){let e=i(this,f)[i(this,I)];if(d(this,h,Me).call(this,!0),d(this,h,A).call(this,e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(i(this,G)&&i(this,x)){let e=i(this,x),n;for(;n=e?.shift();)(t=i(this,$))==null||t.call(this,...n);}}}has(t,e={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:s}=e,r=i(this,C).get(t);if(r!==void 0){let a=i(this,f)[r];if(d(this,h,A).call(this,a)&&a.__staleWhileFetching===void 0)return false;if(i(this,Y).call(this,r))s&&(s.has="stale",i(this,ie).call(this,s,r));else return n&&i(this,ue).call(this,r),s&&(s.has="hit",i(this,ie).call(this,s,r)),true}else s&&(s.has="miss");return false}peek(t,e={}){let{allowStale:n=this.allowStale}=e,s=i(this,C).get(t);if(s===void 0||!n&&i(this,Y).call(this,s))return;let r=i(this,f)[s];return d(this,h,A).call(this,r)?r.__staleWhileFetching:r}async fetch(t,e={}){let{allowStale:n=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:l=this.noDisposeOnSet,size:u=0,sizeCalculation:g=this.sizeCalculation,noUpdateTTL:w=this.noUpdateTTL,noDeleteOnFetchRejection:b=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:M=this.allowStaleOnFetchRejection,ignoreFetchAbort:D=this.ignoreFetchAbort,allowStaleOnFetchAbort:z=this.allowStaleOnFetchAbort,context:F,forceRefresh:T=false,status:y,signal:k}=e;if(!i(this,le))return y&&(y.fetch="get"),this.get(t,{allowStale:n,updateAgeOnGet:s,noDeleteOnStaleGet:r,status:y});let L={allowStale:n,updateAgeOnGet:s,noDeleteOnStaleGet:r,ttl:a,noDisposeOnSet:l,size:u,sizeCalculation:g,noUpdateTTL:w,noDeleteOnFetchRejection:b,allowStaleOnFetchRejection:M,allowStaleOnFetchAbort:z,ignoreFetchAbort:D,status:y,signal:k},R=i(this,C).get(t);if(R===void 0){y&&(y.fetch="miss");let O=d(this,h,ke).call(this,t,R,L,F);return O.__returned=O}else {let O=i(this,f)[R];if(d(this,h,A).call(this,O)){let me=n&&O.__staleWhileFetching!==void 0;return y&&(y.fetch="inflight",me&&(y.returnedStale=true)),me?O.__staleWhileFetching:O.__returned=O}let Ae=i(this,Y).call(this,R);if(!T&&!Ae)return y&&(y.fetch="hit"),d(this,h,Se).call(this,R),s&&i(this,ue).call(this,R),y&&i(this,ie).call(this,y,R),O;let ce=d(this,h,ke).call(this,t,R,L,F),pe=ce.__staleWhileFetching!==void 0&&n;return y&&(y.fetch=Ae?"stale":"refresh",pe&&Ae&&(y.returnedStale=true)),pe?ce.__staleWhileFetching:ce.__returned=ce}}async forceFetch(t,e={}){let n=await this.fetch(t,e);if(n===void 0)throw new Error("fetch() returned undefined");return n}memo(t,e={}){let n=i(this,ge);if(!n)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:r,...a}=e,l=this.get(t,a);if(!r&&l!==void 0)return l;let u=n(t,l,{options:a,context:s});return this.set(t,u,a),u}get(t,e={}){let{allowStale:n=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:a}=e,l=i(this,C).get(t);if(l!==void 0){let u=i(this,f)[l],g=d(this,h,A).call(this,u);return a&&i(this,ie).call(this,a,l),i(this,Y).call(this,l)?(a&&(a.get="stale"),g?(a&&n&&u.__staleWhileFetching!==void 0&&(a.returnedStale=true),n?u.__staleWhileFetching:void 0):(r||d(this,h,oe).call(this,t,"expire"),a&&n&&(a.returnedStale=true),n?u:void 0)):(a&&(a.get="hit"),g?u.__staleWhileFetching:(d(this,h,Se).call(this,l),s&&i(this,ue).call(this,l),u))}else a&&(a.get="miss");}delete(t){return d(this,h,oe).call(this,t,"delete")}clear(){return d(this,h,Ye).call(this,"delete")}},j=new WeakMap,q=new WeakMap,K=new WeakMap,he=new WeakMap,$=new WeakMap,ye=new WeakMap,ge=new WeakMap,H=new WeakMap,E=new WeakMap,X=new WeakMap,C=new WeakMap,S=new WeakMap,f=new WeakMap,N=new WeakMap,U=new WeakMap,I=new WeakMap,P=new WeakMap,Q=new WeakMap,x=new WeakMap,Z=new WeakMap,J=new WeakMap,W=new WeakMap,V=new WeakMap,ee=new WeakMap,le=new WeakMap,G=new WeakMap,ve=new WeakMap,h=new WeakSet,Ue=function(){let t=new Ie(i(this,j)),e=new Ie(i(this,j));c(this,W,t),c(this,J,e);let n=this.ttlAutopurge?new Array(i(this,j)):void 0;c(this,V,n),c(this,Fe,(l,u,g=i(this,H).now())=>{e[l]=u!==0?g:0,t[l]=u,s(l,u);}),c(this,ue,l=>{e[l]=t[l]!==0?i(this,H).now():0,s(l,t[l]);});let s=this.ttlAutopurge?(l,u)=>{if(n?.[l]&&(clearTimeout(n[l]),n[l]=void 0),u&&u!==0&&n){let g=setTimeout(()=>{i(this,Y).call(this,l)&&d(this,h,oe).call(this,i(this,S)[l],"expire");},u+1);g.unref&&g.unref(),n[l]=g;}}:()=>{};c(this,ie,(l,u)=>{if(t[u]){let g=t[u],w=e[u];if(!g||!w)return;l.ttl=g,l.start=w,l.now=r||a();let b=l.now-w;l.remainingTTL=g-b;}});let r=0,a=()=>{let l=i(this,H).now();if(this.ttlResolution>0){r=l;let u=setTimeout(()=>r=0,this.ttlResolution);u.unref&&u.unref();}return l};this.getRemainingTTL=l=>{let u=i(this,C).get(l);if(u===void 0)return 0;let g=t[u],w=e[u];if(!g||!w)return 1/0;let b=(r||a())-w;return g-b},c(this,Y,l=>{let u=e[l],g=t[l];return !!g&&!!u&&(r||a())-u>g});},ue=new WeakMap,ie=new WeakMap,Fe=new WeakMap,Y=new WeakMap,xt=function(){let t=new Ie(i(this,j));c(this,X,0),c(this,Z,t),c(this,de,e=>{c(this,X,i(this,X)-t[e]),t[e]=0;}),c(this,Oe,(e,n,s,r)=>{if(d(this,h,A).call(this,n))return 0;if(!se(s))if(r){if(typeof r!="function")throw new TypeError("sizeCalculation must be a function");if(s=r(n,e),!se(s))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 s}),c(this,be,(e,n,s)=>{if(t[e]=n,i(this,q)){let r=i(this,q)-t[e];for(;i(this,X)>r;)d(this,h,Me).call(this,true);}c(this,X,i(this,X)+t[e]),s&&(s.entrySize=n,s.totalCalculatedSize=i(this,X));});},de=new WeakMap,be=new WeakMap,Oe=new WeakMap,ae=function*({allowStale:t=this.allowStale}={}){if(i(this,E))for(let e=i(this,P);!(!d(this,h,We).call(this,e)||((t||!i(this,Y).call(this,e))&&(yield e),e===i(this,I)));)e=i(this,U)[e];},re=function*({allowStale:t=this.allowStale}={}){if(i(this,E))for(let e=i(this,I);!(!d(this,h,We).call(this,e)||((t||!i(this,Y).call(this,e))&&(yield e),e===i(this,P)));)e=i(this,N)[e];},We=function(t){return t!==void 0&&i(this,C).get(i(this,S)[t])===t},Me=function(t){var r;let e=i(this,I),n=i(this,S)[e],s=i(this,f)[e];return i(this,le)&&d(this,h,A).call(this,s)?s.__abortController.abort(new Error("evicted")):(i(this,ee)||i(this,G))&&(i(this,ee)&&((r=i(this,K))==null||r.call(this,s,n,"evict")),i(this,G)&&i(this,x)?.push([s,n,"evict"])),i(this,de).call(this,e),i(this,V)?.[e]&&(clearTimeout(i(this,V)[e]),i(this,V)[e]=void 0),t&&(i(this,S)[e]=void 0,i(this,f)[e]=void 0,i(this,Q).push(e)),i(this,E)===1?(c(this,I,c(this,P,0)),i(this,Q).length=0):c(this,I,i(this,N)[e]),i(this,C).delete(n),De(this,E)._--,e},ke=function(t,e,n,s){let r=e===void 0?void 0:i(this,f)[e];if(d(this,h,A).call(this,r))return r;let a=new Re,{signal:l}=n;l?.addEventListener("abort",()=>a.abort(l.reason),{signal:a.signal});let u={signal:a.signal,options:n,context:s},g=(F,T=false)=>{let{aborted:y}=a.signal,k=n.ignoreFetchAbort&&F!==void 0,L=n.ignoreFetchAbort||!!(n.allowStaleOnFetchAbort&&F!==void 0);if(n.status&&(y&&!T?(n.status.fetchAborted=true,n.status.fetchError=a.signal.reason,k&&(n.status.fetchAbortIgnored=true)):n.status.fetchResolved=true),y&&!k&&!T)return b(a.signal.reason,L);let R=D,O=i(this,f)[e];return (O===D||k&&T&&O===void 0)&&(F===void 0?R.__staleWhileFetching!==void 0?i(this,f)[e]=R.__staleWhileFetching:d(this,h,oe).call(this,t,"fetch"):(n.status&&(n.status.fetchUpdated=true),this.set(t,F,u.options))),F},w=F=>(n.status&&(n.status.fetchRejected=true,n.status.fetchError=F),b(F,false)),b=(F,T)=>{let{aborted:y}=a.signal,k=y&&n.allowStaleOnFetchAbort,L=k||n.allowStaleOnFetchRejection,R=L||n.noDeleteOnFetchRejection,O=D;if(i(this,f)[e]===D&&(!R||!T&&O.__staleWhileFetching===void 0?d(this,h,oe).call(this,t,"fetch"):k||(i(this,f)[e]=O.__staleWhileFetching)),L)return n.status&&O.__staleWhileFetching!==void 0&&(n.status.returnedStale=true),O.__staleWhileFetching;if(O.__returned===O)throw F},M=(F,T)=>{var k;let y=(k=i(this,ye))==null?void 0:k.call(this,t,r,u);y&&y instanceof Promise&&y.then(L=>F(L===void 0?void 0:L),T),a.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(F(void 0),n.allowStaleOnFetchAbort&&(F=L=>g(L,true)));});};n.status&&(n.status.fetchDispatched=true);let D=new Promise(M).then(g,w),z=Object.assign(D,{__abortController:a,__staleWhileFetching:r,__returned:void 0});return e===void 0?(this.set(t,z,{...u.options,status:void 0}),e=i(this,C).get(t)):i(this,f)[e]=z,z},A=function(t){if(!i(this,le))return false;let e=t;return !!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof Re},Ve=function(t,e){i(this,U)[e]=t,i(this,N)[t]=e;},Se=function(t){t!==i(this,P)&&(t===i(this,I)?c(this,I,i(this,N)[t]):d(this,h,Ve).call(this,i(this,U)[t],i(this,N)[t]),d(this,h,Ve).call(this,i(this,P),t),c(this,P,t));},oe=function(t,e){var s,r;let n=false;if(i(this,E)!==0){let a=i(this,C).get(t);if(a!==void 0)if(i(this,V)?.[a]&&(clearTimeout(i(this,V)?.[a]),i(this,V)[a]=void 0),n=true,i(this,E)===1)d(this,h,Ye).call(this,e);else {i(this,de).call(this,a);let l=i(this,f)[a];if(d(this,h,A).call(this,l)?l.__abortController.abort(new Error("deleted")):(i(this,ee)||i(this,G))&&(i(this,ee)&&((s=i(this,K))==null||s.call(this,l,t,e)),i(this,G)&&i(this,x)?.push([l,t,e])),i(this,C).delete(t),i(this,S)[a]=void 0,i(this,f)[a]=void 0,a===i(this,P))c(this,P,i(this,U)[a]);else if(a===i(this,I))c(this,I,i(this,N)[a]);else {let u=i(this,U)[a];i(this,N)[u]=i(this,N)[a];let g=i(this,N)[a];i(this,U)[g]=i(this,U)[a];}De(this,E)._--,i(this,Q).push(a);}}if(i(this,G)&&i(this,x)?.length){let a=i(this,x),l;for(;l=a?.shift();)(r=i(this,$))==null||r.call(this,...l);}return n},Ye=function(t){var e,n;for(let s of d(this,h,re).call(this,{allowStale:true})){let r=i(this,f)[s];if(d(this,h,A).call(this,r))r.__abortController.abort(new Error("deleted"));else {let a=i(this,S)[s];i(this,ee)&&((e=i(this,K))==null||e.call(this,r,a,t)),i(this,G)&&i(this,x)?.push([r,a,t]);}}if(i(this,C).clear(),i(this,f).fill(void 0),i(this,S).fill(void 0),i(this,W)&&i(this,J)){i(this,W).fill(0),i(this,J).fill(0);for(let s of i(this,V)??[])s!==void 0&&clearTimeout(s);i(this,V)?.fill(void 0);}if(i(this,Z)&&i(this,Z).fill(0),c(this,I,0),c(this,P,0),i(this,Q).length=0,c(this,X,0),c(this,E,0),i(this,G)&&i(this,x)){let s=i(this,x),r;for(;r=s?.shift();)(n=i(this,$))==null||n.call(this,...r);}},we);var _e=class{constructor(t){m(this,"cache");m(this,"map",new Map);this.cache=new Pt({max:t.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){this.cache.clear(),this.map.clear();}delete(t){let e=this.map.delete(t);return e&&this.cache.delete(t),e}get forEach(){return this.map.forEach}get(t){let e=this.cache.get(t);return e||this.map.get(t)}has(t){return this.map.has(t)}set(t,e){return this.map.set(t,e),this.cache.set(t,e),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var je;(r=>(r.mediaInstances=new Map,r.channels=new Map,r.transients=new Set,r.systemPausedAliases=new Set,r.bufferRegistry=new _e({cacheSize:10})))(je||(je={}));var p=je;var _;(s=>(s.log=(r,...a)=>console.log(`[Pixi\u2019VN] ${r}`,...a),s.warn=(r,...a)=>console.warn(`[Pixi\u2019VN] ${r}`,...a),s.error=(r,...a)=>console.error(`[Pixi\u2019VN] ${r}`,...a),s.info=(r,...a)=>console.info(`[Pixi\u2019VN] ${r}`,...a)))(_||(_={}));function Ne(o){return o.reduce((t,e)=>{switch(e.filterType){case "ReverbFilter":t.push(new B.Reverb({decay:e.decay,preDelay:e.preDelay,wet:e.wet}).toDestination());break;case "FeedbackDelayFilter":t.push(new B.FeedbackDelay({feedback:e.feedback,delayTime:e.delayTime,wet:e.wet}).toDestination());break;case "BitCrusherFilter":t.push(new B.BitCrusher({bits:e.bits}).toDestination());break;case "CompressorFilter":t.push(new B.Compressor({attack:e.attack,knee:e.knee,ratio:e.ratio,release:e.release,threshold:e.threshold}).toDestination());break;case "DelayFilter":t.push(new B.Delay({delayTime:e.delayTime,maxDelay:e.maxDelay}).toDestination());break;case "DistortionFilter":t.push(new B.Distortion({distortion:e.distortion,oversample:e.oversample,wet:e.wet}).toDestination());break;case "FeedbackCombFilterFilter":t.push(new B.FeedbackCombFilter({delayTime:e.delayTime,resonance:e.resonance}).toDestination());break;case "FreeverbFilter":t.push(new B.Freeverb({roomSize:e.roomSize,dampening:e.dampening,wet:e.wet}).toDestination());break;case "GateFilter":t.push(new B.Gate({threshold:e.threshold,smoothing:e.smoothing}).toDestination());break;case "GreaterThanFilter":t.push(new B.GreaterThan({value:e.value,convert:e.convert,maxValue:e.maxValue,minValue:e.minValue,units:e.units}).toDestination());break;case "GreaterThanZeroFilter":t.push(new B.GreaterThanZero);break;case "LimiterFilter":t.push(new B.Limiter({threshold:e.threshold}).toDestination());break;case "MidSideCompressorFilter":t.push(new B.MidSideCompressor({mid:e.mid,side:e.side}).toDestination());break;case "MultibandCompressorFilter":t.push(new B.MultibandCompressor({lowFrequency:e.lowFrequency,highFrequency:e.highFrequency,low:e.low,mid:e.mid,high:e.high}).toDestination());break;case "Panner3DFilter":t.push(new B.Panner3D({positionX:e.positionX,positionY:e.positionY,positionZ:e.positionZ,orientationX:e.orientationX,orientationY:e.orientationY,orientationZ:e.orientationZ,coneInnerAngle:e.coneInnerAngle,coneOuterAngle:e.coneOuterAngle,coneOuterGain:e.coneOuterGain,distanceModel:e.distanceModel,maxDistance:e.maxDistance,refDistance:e.refDistance,rolloffFactor:e.rolloffFactor,panningModel:e.panningModel}).toDestination());break;case "PhaserFilter":t.push(new B.Phaser({frequency:e.frequency,octaves:e.octaves,baseFrequency:e.baseFrequency,wet:e.wet,Q:e.Q,stages:e.stages}).toDestination());break;case "StereoWidenerFilter":t.push(new B.StereoWidener({width:e.width,wet:e.wet}).toDestination());break;case "PingPongDelayFilter":t.push(new B.PingPongDelay({wet:e.wet,delayTime:e.delayTime,feedback:e.feedback,maxDelay:e.maxDelay}).toDestination());break;case "AutoFilterFilter":t.push(new B.AutoFilter({frequency:e.frequency,depth:e.depth,baseFrequency:e.baseFrequency,octaves:e.octaves,filter:e.filter,wet:e.wet,type:e.type}).toDestination());break;case "BiquadFilterFilter":t.push(new B.BiquadFilter({frequency:e.frequency,detune:e.detune,Q:e.Q,type:e.type,gain:e.gain}).toDestination());break;case "OnePoleFilterFilter":t.push(new B.OnePoleFilter({type:e.type}).toDestination());break;case "CustomFilter":t.push(new B.Filter({frequency:e.frequency,Q:e.Q,type:e.type,detune:e.detune,gain:e.gain,rolloff:e.rolloff}).toDestination());break;case "ChorusFilter":t.push(new B.Chorus({frequency:e.frequency,delayTime:e.delayTime,depth:e.depth,type:e.type,spread:e.spread,feedback:e.feedback,wet:e.wet}).toDestination());break;case "TremoloFilter":t.push(new B.Tremolo({frequency:e.frequency,type:e.type,depth:e.depth,spread:e.spread,wet:e.wet}).toDestination());break;case "VibratoFilter":t.push(new B.Vibrato({maxDelay:e.maxDelay,frequency:e.frequency,depth:e.depth,type:e.type,wet:e.wet}).toDestination());break;case "AutoPannerFilter":t.push(new B.AutoPanner({frequency:e.frequency,type:e.type,depth:e.depth,channelCount:e.channelCount,wet:e.wet}).toDestination());break}return t},[])}function It(o){if(o)return Array.from(o).reduce((t,e)=>(e instanceof B.Reverb?t.push({filterType:"ReverbFilter",wet:e.wet.value,decay:B.Time(e.decay).toSeconds(),preDelay:B.Time(e.preDelay).toSeconds()}):e instanceof B.PingPongDelay?t.push({filterType:"PingPongDelayFilter",wet:e.wet.value,delayTime:e.delayTime.value,feedback:e.feedback.value}):e instanceof B.FeedbackDelay?t.push({filterType:"FeedbackDelayFilter",feedback:e.feedback.value,delayTime:e.delayTime.value,wet:e.wet.value}):e instanceof B.BitCrusher?t.push({filterType:"BitCrusherFilter",bits:e.bits.value,wet:e.wet.value}):e instanceof B.Compressor?t.push({filterType:"CompressorFilter",attack:e.attack.value,knee:e.knee.value,ratio:e.ratio.value,release:e.release.value,threshold:e.threshold.value}):e instanceof B.Delay?t.push({filterType:"DelayFilter",delayTime:e.delayTime.value,maxDelay:e.maxDelay}):e instanceof B.Distortion?t.push({filterType:"DistortionFilter",distortion:e.distortion,oversample:e.oversample,wet:e.wet.value}):e instanceof B.FeedbackCombFilter?t.push({filterType:"FeedbackCombFilterFilter",delayTime:e.delayTime.value,resonance:e.resonance.value}):e instanceof B.Freeverb?t.push({filterType:"FreeverbFilter",roomSize:e.roomSize.value,dampening:e.dampening,wet:e.wet.value}):e instanceof B.Gate?t.push({filterType:"GateFilter",threshold:e.threshold,smoothing:e.smoothing}):e instanceof B.GreaterThan?t.push({filterType:"GreaterThanFilter",value:e.comparator.value,convert:e.convert,maxValue:e.maxValue,minValue:e.minValue}):e instanceof B.GreaterThanZero?t.push({filterType:"GreaterThanZeroFilter"}):e instanceof B.Limiter?t.push({filterType:"LimiterFilter",threshold:e.threshold.value}):e instanceof B.MidSideCompressor?t.push({filterType:"MidSideCompressorFilter",mid:{attack:e.mid.attack.value,knee:e.mid.knee.value,ratio:e.mid.ratio.value,release:e.mid.release.value,threshold:e.mid.threshold.value},side:{attack:e.side.attack.value,knee:e.side.knee.value,ratio:e.side.ratio.value,release:e.side.release.value,threshold:e.side.threshold.value}}):e instanceof B.MultibandCompressor?t.push({filterType:"MultibandCompressorFilter",lowFrequency:e.lowFrequency.value,highFrequency:e.highFrequency.value,low:{attack:e.low.attack.value,knee:e.low.knee.value,ratio:e.low.ratio.value,release:e.low.release.value,threshold:e.low.threshold.value},mid:{attack:e.mid.attack.value,knee:e.mid.knee.value,ratio:e.mid.ratio.value,release:e.mid.release.value,threshold:e.mid.threshold.value},high:{attack:e.high.attack.value,knee:e.high.knee.value,ratio:e.high.ratio.value,release:e.high.release.value,threshold:e.high.threshold.value}}):e instanceof B.Panner3D?t.push({filterType:"Panner3DFilter",positionX:e.positionX.value,positionY:e.positionY.value,positionZ:e.positionZ.value,orientationX:e.orientationX.value,orientationY:e.orientationY.value,orientationZ:e.orientationZ.value,coneInnerAngle:e.coneInnerAngle,coneOuterAngle:e.coneOuterAngle,coneOuterGain:e.coneOuterGain,distanceModel:e.distanceModel,maxDistance:e.maxDistance,refDistance:e.refDistance,rolloffFactor:e.rolloffFactor,panningModel:e.panningModel}):e instanceof B.Phaser?t.push({filterType:"PhaserFilter",frequency:e.frequency.value,octaves:e.octaves,baseFrequency:e.baseFrequency,wet:e.wet.value,Q:e.Q.value}):e instanceof B.StereoWidener?t.push({filterType:"StereoWidenerFilter",width:e.width.value,wet:e.wet.value}):e instanceof B.AutoFilter?t.push({filterType:"AutoFilterFilter",type:e.type,frequency:e.frequency.value,depth:e.depth.value,baseFrequency:e.baseFrequency,octaves:e.octaves,filter:{Q:e.filter.Q.value,type:e.filter.type,rolloff:e.filter.rolloff},wet:e.wet.value}):e instanceof B.Chorus?t.push({filterType:"ChorusFilter",type:e.type,frequency:e.frequency.value,delayTime:e.delayTime,depth:e.depth,spread:e.spread,feedback:e.feedback.value,wet:e.wet.value}):e instanceof B.Tremolo?t.push({filterType:"TremoloFilter",type:e.type,frequency:e.frequency.value,depth:e.depth.value,spread:e.spread,wet:e.wet.value}):e instanceof B.Vibrato?t.push({filterType:"VibratoFilter",type:e.type,frequency:e.frequency.value,depth:e.depth.value,wet:e.wet.value}):e instanceof B.AutoPanner?t.push({filterType:"AutoPannerFilter",type:e.type,frequency:e.frequency.value,depth:e.depth.value,channelCount:e.channelCount,wet:e.wet.value}):e instanceof B.BiquadFilter?t.push({filterType:"BiquadFilterFilter",type:e.type,frequency:e.frequency.value,detune:e.detune.value,Q:e.Q.value,gain:e.gain.value}):e instanceof B.OnePoleFilter?t.push({filterType:"OnePoleFilterFilter",type:e.type}):e instanceof B.Filter?t.push({filterType:"CustomFilter",type:e.type,frequency:e.frequency.value,Q:e.Q.value,detune:e.detune.value,gain:e.gain.value,rolloff:e.rolloff}):_.warn(`Unsupported filter type for serialisation: ${e?.constructor?.name??e}, please report this to the developers if you encounter it.`),t),[])}function vt(o){return o instanceof B.Reverb||o instanceof B.FeedbackDelay||o instanceof B.PingPongDelay||o instanceof B.BitCrusher||o instanceof B.Compressor||o instanceof B.Delay||o instanceof B.Distortion||o instanceof B.FeedbackCombFilter||o instanceof B.Freeverb||o instanceof B.Gate||o instanceof B.GreaterThan||o instanceof B.GreaterThanZero||o instanceof B.Limiter||o instanceof B.MidSideCompressor||o instanceof B.MultibandCompressor||o instanceof B.Panner3D||o instanceof B.Phaser||o instanceof B.StereoWidener||o instanceof B.AutoFilter||o instanceof B.Chorus||o instanceof B.Vibrato||o instanceof B.Tremolo||o instanceof B.AutoPanner||o instanceof B.BiquadFilter||o instanceof B.OnePoleFilter||o instanceof B.Filter}function ne(o){return o<=0?-1/0:20*Math.log10(o)}function Te(o){return o<=-1/0?0:10**(o/20)}async function Ge(o){if(p.bufferRegistry.has(o))return;let t=o;try{let e=kt__default.default.Assets.resolver.resolve(o);e?.src&&(t=e.src);}catch{}try{let e=await B.ToneAudioBuffer.load(t),n=new B.ToneAudioBuffer(e);p.bufferRegistry.set(o,n);}catch(e){_.warn(`Failed to load audio buffer for "${o}" (url: "${t}"): ${e instanceof Error?e.message:e}`),p.bufferRegistry.set(o,new B.ToneAudioBuffer);}}var Ee=class extends B.Player{constructor(e,n,s,r,a={},l){super(a);m(this,"alias",e);m(this,"channelAlias",n);m(this,"soundAlias",s);m(this,"stepCounter",r);m(this,"delay",l);m(this,"options");m(this,"filters",new Set);m(this,"pausedAt");m(this,"playStartTime",B.now());this.options=a,this.playStartTime=B.now()+(l??0);}get memory(){let e=Math.max(0,this.pausedAt?this.pausedAt-this.playStartTime:B.now()-this.playStartTime),n=this.paused;return n&&p.systemPausedAliases.has(this.alias)&&(n=false),{...this.options,fadeIn:this.fadeIn,loop:this.loop,loopEnd:this.loopEnd,loopStart:this.loopStart,mute:this.mute,playbackRate:this.playbackRate,reverse:this.reverse,volume:Te(this.volume.value),autostart:!this.paused,elapsed:e,paused:n,delay:this.delay}}set memory(e){this.paused=e.paused,this.loop!==(e.loop||false)&&(this.loop=e.loop||false),this.volume.value!==ne(e.volume??1)&&(this.volume.value=ne(e.volume??1)),this.mute!==(e.mute||false)&&(this.mute=e.mute||false),this.playbackRate!==(e.playbackRate??1)&&(this.playbackRate=e.playbackRate??1),this.reverse!==(e.reverse||false)&&(this.reverse=e.reverse||false),this.fadeIn!==(e.fadeIn||0)&&(this.fadeIn=e.fadeIn||0),this.loopStart!==(e.loopStart||0)&&(this.loopStart=e.loopStart||0),this.loopEnd!==(e.loopEnd||0)&&(this.loopEnd=e.loopEnd||0);}get paused(){return typeof this.pausedAt=="number"}set paused(e){let n=this.state;if(e)this.pausedAt=B.now(),n==="started"&&super.stop();else {let s;typeof this.pausedAt=="number"&&(s=this.pausedAt-this.playStartTime,this.pausedAt=void 0),n==="stopped"&&(this.delay?this.start(`+${this.delay}`,s):this.start(void 0,s));}}get muted(){return this.mute}set muted(e){this.mute=e;}get speed(){return this.playbackRate}set speed(e){this.playbackRate=e;}stop(e){return p.mediaInstances.delete(this.alias),super.stop(e)}start(e,n,s){let r=B.now(),a=r;if(typeof e=="number")a=e;else if(typeof e=="string"&&e.startsWith("+")){let u=Number(e.slice(1));Number.isNaN(u)||(a=r+u);}let l=typeof n=="number"?n:0;return this.playStartTime=a-l,super.start(e,n,s)}chain(...e){return e.forEach(n=>{vt(n)&&(n.toDestination(),this.filters.add(n));}),super.chain(...e)}disconnect(e){return vt(e)&&(e.disconnect(),this.filters.delete(e)),super.disconnect(e)}};var Pe=class{constructor(t,e={}){m(this,"alias",t);m(this,"toneChannel");m(this,"background");this.background=e.background??false,this.toneChannel=new B.Channel({volume:ne(e.volume??1),mute:e.muted??false,pan:e.pan??0}).toDestination(),e.filters&&this.toneChannel.chain(...e.filters);}get volume(){return Te(this.toneChannel.volume.value)}set volume(t){this.toneChannel.volume.value=ne(t);}get volumeParam(){return this.toneChannel.volume}get pan(){return this.toneChannel.pan.value}set pan(t){this.toneChannel.pan.value=t;}get panParam(){return this.toneChannel.pan}get muted(){return this.toneChannel.mute}set muted(t){this.toneChannel.mute=t;}pauseAll(){for(let t of p.mediaInstances.values())t.channelAlias===this.alias&&!t.paused&&(t.paused=true);return this}resumeAll(){for(let t of p.mediaInstances.values())t.channelAlias===this.alias&&t.paused&&(t.paused=false);return this}chain(...t){return this.toneChannel.chain(...t),this}_createPlayer(t,e,n={}){let s=p.bufferRegistry.get(e);if(!s)throw new core.PixiError("unregistered_asset",`Sound buffer for alias "${e}" is not loaded. Call sound.load() first.`);let{delay:r,elapsed:a,filters:l=[],muted:u,autostart:g=true,speed:w,volume:b,...M}=n;u!==void 0&&(_.warn(`MediaInstance "${t}" is being created with muted=${u}. This will override the channel's muted state (${this.muted}).`),M.mute=u),w!==void 0&&(_.warn(`MediaInstance "${t}" is being created with speed=${w}. This will override the default playback speed of 1.`),M.playbackRate=w);let D=new Ee(t,this.alias,e,core.GameUnifier.stepCounter,{...M,volume:b!==void 0?ne(b):void 0,url:s},r).chain(...l,this.toneChannel),z=a!==void 0?Math.max(0,a):void 0;return g&&(r?D.start(`+${r}`,z):D.start(void 0,z)),D}async play(t,e,n){let s,r;if(typeof e=="string"?(s=t,r=e):(s=t,r=t,n=e),p.mediaInstances.has(s)){let l=p.mediaInstances.get(s);l&&(l.stop(),n={...l.memory,...n,filters:[...l.filters,...n?.filters||[]]});}await Ge(r);let a=this._createPlayer(s,r,n);return p.mediaInstances.set(s,a),a}toggleMuteAll(){return this.muted=!this.muted,this.muted}get mediaInstances(){return Array.from(p.mediaInstances.values()).reduce((t,e)=>(e.channelAlias===this.alias&&t.push(e),t),[])}stopAll(){let t=[];for(let[e,n]of p.mediaInstances.entries())n.channelAlias===this.alias&&(n.stop(),t.push(e));return t.forEach(e=>{p.mediaInstances.delete(e);}),this}};function Mt(o){try{if(typeof o>"u")return o;let t=JSON.stringify(o);return JSON.parse(t)}catch(t){throw _.error("Error creating exportable element",o,t),new core.PixiError("not_json_serializable","Error creating exportable element")}}var xe=class{constructor(){m(this,"_speedAll",1);m(this,"_defaultChannelAlias",At);}get volumeAll(){return Te(B__namespace.getDestination().volume.value)}set volumeAll(t){B__namespace.getDestination().volume.value=ne(t);}get speedAll(){return this._speedAll}set speedAll(t){this._speedAll=t;for(let e of p.mediaInstances.values())e.speed=t;}get defaultChannelAlias(){return this._defaultChannelAlias}set defaultChannelAlias(t){this._defaultChannelAlias=t;}add(t,e){if(!p.bufferRegistry.has(t)){let n=new B__namespace.ToneAudioBuffer(e);p.bufferRegistry.set(t,n);}}pauseAll(){for(let t of p.mediaInstances.values())t.paused||(t.paused=true);return this}resumeAll(){for(let t of p.mediaInstances.values())t.paused&&(t.paused=false);return this}get muted(){return B__namespace.getDestination().mute}toggleMuteAll(){let t=!B__namespace.getDestination().mute;return B__namespace.getDestination().mute=t,t}muteAll(){return B__namespace.getDestination().mute=true,this}unmuteAll(){return B__namespace.getDestination().mute=false,this}stopAll(){for(let t of p.mediaInstances.values())t.stop();return p.mediaInstances.clear(),this}pauseUnsavedAll(t){for(let[e,n]of p.mediaInstances.entries())t&&n.channelAlias!==t||n.paused||(n.paused=true,p.systemPausedAliases.add(e));if(!t){for(let e of p.transients)e.stop();p.transients.clear();}return this}resumeUnsavedAll(t){let e=[];for(let n of p.systemPausedAliases){let s=p.mediaInstances.get(n);if(!s){e.push(n);continue}t&&s.channelAlias!==t||(s.paused=false,e.push(n));}for(let n of e)p.systemPausedAliases.delete(n);return this}stopTransientAll(){for(let t of p.transients)t.stop();return p.transients.clear(),this}async play(t,e,n){let s,r;typeof e=="string"?(s=t,r=e):(s=t,r=t,n=e),p.bufferRegistry.has(r)||await this.load(r);let{channel:a=this.defaultChannelAlias,...l}=n??{};return await this.findChannel(a).play(s,r,l)}async playTransient(t,e){p.bufferRegistry.has(t)||await this.load(t);let n=p.bufferRegistry.get(t);if(!n)throw new core.PixiError("unregistered_asset",`Sound buffer for alias "${t}" is not loaded. Call sound.load() first.`);let{autostart:s=true,...r}=e??{},a=new B__namespace.Player({...r,url:n}).toDestination();return s&&a.start(),p.transients.add(a),a.onstop=()=>{a.dispose(),p.transients.delete(a);},a}find(t){return p.mediaInstances.get(t)}stop(t){let e=this.find(t);e?(e.stop(),p.mediaInstances.delete(t)):_.warn(`No media instance found with alias ${t} to stop.`);}pause(t){let e=this.find(t);if(!e){_.warn(`No media instance found with alias ${t} to pause.`);return}return e.paused=true,e}resume(t){let e=this.find(t);if(!e){_.warn(`No media instance found with alias ${t} to resume.`);return}return e.paused=false,e}duration(t){return p.bufferRegistry.get(t)?.duration??0}async load(...t){let e=t.map(Ge);await Promise.all(e);}backgroundLoad(...t){return this.load(...t).catch(e=>{_.error("Error background-loading sound",e);})}backgroundLoadBundle(t){let e=kt__default.default.Assets.backgroundLoadBundle(t);return e.then(async()=>{try{let n=await kt__default.default.Assets.loadBundle(t),s=[];for(let r in n)p.bufferRegistry.has(r)||s.push(this.load(r));await Promise.all(s);}catch(n){_.error("Error loading sound bundle",n);}}).catch(n=>{_.error("Error background-loading sound bundle",n);}),e}clear(){this.stopAll();}addChannel(t,e={}){if(typeof t!="string"){t.forEach(s=>{let r={...e,filters:e.filters?[...e.filters]:e.filters};this.addChannel(s,r);});return}if(p.channels.has(t)){_.warn(`Channel with alias ${t} already exists.`);return}let n=new Pe(t,e);return p.channels.set(t,n),n}findChannel(t){let e=p.channels.get(t);return e||this.addChannel(t)}get channels(){return Array.from(p.channels.values())}export(){let t=Array.from(p.mediaInstances.entries()).reduce((e,[n,s])=>(e[n]={channelAlias:s.channelAlias,soundAlias:s.soundAlias,stepCounter:s.stepCounter,paused:s.paused,options:{...s.memory,filters:It(s.filters)}},e),{});return {mediaInstances:Mt(t)}}async restore(t){try{if(Object.hasOwn(t,"soundsPlaying")){let e=t.soundsPlaying;if(e){let n=Object.keys(e).map(async s=>{await this.load(s),await this.play(s);});await Promise.all(n);}}if(Object.hasOwn(t,"mediaInstances")){let e=t.mediaInstances;if(e){let n=new Set,s=Object.values(e).map(async({soundAlias:a,channelAlias:l})=>(n.add(l),await this.load(a)));await Promise.all(s),this.channels.forEach(a=>{(!a.background||!n.has(a.alias))&&a.stopAll();});let r=Object.keys(e).map(async a=>{let l=e[a],u=this.findChannel(l.channelAlias),g=l.options.paused??l.paused??!1;if(u.background)if(l.stepCounter===core.GameUnifier.stepCounter||!this.find(a)){let w=await u.play(a,l.soundAlias,{...l.options,autostart:!g,filters:Ne(l.options.filters||[]),delay:l.options.delay});w.paused=g;}else {let w=p.mediaInstances.get(a);if(!w){_.warn(`No media instance found with alias ${a} while restoring background state.`);return}w.memory={...l.options,paused:g},[...w.filters].forEach(M=>{w.disconnect(M),M.dispose();}),w.chain(...Ne(l.options.filters||[]));}else {let w=await u.play(a,l.soundAlias,{...l.options,autostart:!g,filters:Ne(l.options.filters||[]),delay:l.options.delay});w.paused=g;}});await Promise.all(r);}}}catch(e){_.error("Error importing data",e);}}};var wt=new xe;core.GameUnifier.addOnPreContinue(async()=>{try{p.channels.forEach(o=>{o.background||o.stopAll();});}catch{}});if(typeof document<"u"){let o=false;document.addEventListener("visibilitychange",()=>{document.hidden?wt.muted||(wt.muteAll(),o=true):o&&(wt.unmuteAll(),o=false);});}exports.SoundRegistry=p;exports.sound=wt;
package/dist/sound.d.cts CHANGED
@@ -435,7 +435,10 @@ interface SoundManagerInterface {
435
435
  restore(data: object): Promise<void>;
436
436
  }
437
437
 
438
- type Time = Parameters<Player["stop"]>[0];
438
+ type StopTime = Parameters<Player["stop"]>[0];
439
+ type StartTime = Parameters<Player["start"]>[0];
440
+ type StartOffset = Parameters<Player["start"]>[1];
441
+ type StartDuration = Parameters<Player["start"]>[2];
439
442
  declare class MediaInstance extends Player implements MediaInterface {
440
443
  readonly alias: string;
441
444
  readonly channelAlias: string;
@@ -466,7 +469,8 @@ declare class MediaInstance extends Player implements MediaInterface {
466
469
  set muted(value: boolean);
467
470
  get speed(): number;
468
471
  set speed(value: number);
469
- stop(time?: Time): this;
472
+ stop(time?: StopTime): this;
473
+ start(time?: StartTime, offset?: StartOffset, duration?: StartDuration): this;
470
474
  chain(...nodes: ToneAudioNode[]): this;
471
475
  disconnect(node: ToneAudioNode): this;
472
476
  }
package/dist/sound.d.ts CHANGED
@@ -435,7 +435,10 @@ interface SoundManagerInterface {
435
435
  restore(data: object): Promise<void>;
436
436
  }
437
437
 
438
- type Time = Parameters<Player["stop"]>[0];
438
+ type StopTime = Parameters<Player["stop"]>[0];
439
+ type StartTime = Parameters<Player["start"]>[0];
440
+ type StartOffset = Parameters<Player["start"]>[1];
441
+ type StartDuration = Parameters<Player["start"]>[2];
439
442
  declare class MediaInstance extends Player implements MediaInterface {
440
443
  readonly alias: string;
441
444
  readonly channelAlias: string;
@@ -466,7 +469,8 @@ declare class MediaInstance extends Player implements MediaInterface {
466
469
  set muted(value: boolean);
467
470
  get speed(): number;
468
471
  set speed(value: number);
469
- stop(time?: Time): this;
472
+ stop(time?: StopTime): this;
473
+ start(time?: StartTime, offset?: StartOffset, duration?: StartDuration): this;
470
474
  chain(...nodes: ToneAudioNode[]): this;
471
475
  disconnect(node: ToneAudioNode): this;
472
476
  }
package/dist/sound.mjs CHANGED
@@ -1 +1 @@
1
- import {i as i$1}from'./chunk-IWAXXFXE.mjs';import {e,d,f,g as g$1}from'./chunk-6HI66YQL.mjs';import {GameUnifier,PixiError}from'@drincs/pixi-vn/core';import se from'@drincs/pixi-vn/pixi.js';import*as c from'tone';import {ToneAudioBuffer,Channel,Reverb,Time,PingPongDelay,FeedbackDelay,BitCrusher,Compressor,Delay,Distortion,FeedbackCombFilter,Freeverb,Gate,GreaterThan,GreaterThanZero,Limiter,MidSideCompressor,MultibandCompressor,Panner3D,Phaser,StereoWidener,AutoFilter,Chorus,Tremolo,Vibrato,AutoPanner,BiquadFilter,OnePoleFilter,Filter,Player,now}from'tone';var C;(o=>(o.mediaInstances=new Map,o.channels=new Map,o.transients=new Set,o.systemPausedAliases=new Set,o.bufferRegistry=new e({cacheSize:10})))(C||(C={}));var i=C;function w(a){return a.reduce((t,e)=>{switch(e.filterType){case "ReverbFilter":t.push(new Reverb({decay:e.decay,preDelay:e.preDelay,wet:e.wet}).toDestination());break;case "FeedbackDelayFilter":t.push(new FeedbackDelay({feedback:e.feedback,delayTime:e.delayTime,wet:e.wet}).toDestination());break;case "BitCrusherFilter":t.push(new BitCrusher({bits:e.bits}).toDestination());break;case "CompressorFilter":t.push(new Compressor({attack:e.attack,knee:e.knee,ratio:e.ratio,release:e.release,threshold:e.threshold}).toDestination());break;case "DelayFilter":t.push(new Delay({delayTime:e.delayTime,maxDelay:e.maxDelay}).toDestination());break;case "DistortionFilter":t.push(new Distortion({distortion:e.distortion,oversample:e.oversample,wet:e.wet}).toDestination());break;case "FeedbackCombFilterFilter":t.push(new FeedbackCombFilter({delayTime:e.delayTime,resonance:e.resonance}).toDestination());break;case "FreeverbFilter":t.push(new Freeverb({roomSize:e.roomSize,dampening:e.dampening,wet:e.wet}).toDestination());break;case "GateFilter":t.push(new Gate({threshold:e.threshold,smoothing:e.smoothing}).toDestination());break;case "GreaterThanFilter":t.push(new GreaterThan({value:e.value,convert:e.convert,maxValue:e.maxValue,minValue:e.minValue,units:e.units}).toDestination());break;case "GreaterThanZeroFilter":t.push(new GreaterThanZero);break;case "LimiterFilter":t.push(new Limiter({threshold:e.threshold}).toDestination());break;case "MidSideCompressorFilter":t.push(new MidSideCompressor({mid:e.mid,side:e.side}).toDestination());break;case "MultibandCompressorFilter":t.push(new MultibandCompressor({lowFrequency:e.lowFrequency,highFrequency:e.highFrequency,low:e.low,mid:e.mid,high:e.high}).toDestination());break;case "Panner3DFilter":t.push(new Panner3D({positionX:e.positionX,positionY:e.positionY,positionZ:e.positionZ,orientationX:e.orientationX,orientationY:e.orientationY,orientationZ:e.orientationZ,coneInnerAngle:e.coneInnerAngle,coneOuterAngle:e.coneOuterAngle,coneOuterGain:e.coneOuterGain,distanceModel:e.distanceModel,maxDistance:e.maxDistance,refDistance:e.refDistance,rolloffFactor:e.rolloffFactor,panningModel:e.panningModel}).toDestination());break;case "PhaserFilter":t.push(new Phaser({frequency:e.frequency,octaves:e.octaves,baseFrequency:e.baseFrequency,wet:e.wet,Q:e.Q,stages:e.stages}).toDestination());break;case "StereoWidenerFilter":t.push(new StereoWidener({width:e.width,wet:e.wet}).toDestination());break;case "PingPongDelayFilter":t.push(new PingPongDelay({wet:e.wet,delayTime:e.delayTime,feedback:e.feedback,maxDelay:e.maxDelay}).toDestination());break;case "AutoFilterFilter":t.push(new AutoFilter({frequency:e.frequency,depth:e.depth,baseFrequency:e.baseFrequency,octaves:e.octaves,filter:e.filter,wet:e.wet,type:e.type}).toDestination());break;case "BiquadFilterFilter":t.push(new BiquadFilter({frequency:e.frequency,detune:e.detune,Q:e.Q,type:e.type,gain:e.gain}).toDestination());break;case "OnePoleFilterFilter":t.push(new OnePoleFilter({type:e.type}).toDestination());break;case "CustomFilter":t.push(new Filter({frequency:e.frequency,Q:e.Q,type:e.type,detune:e.detune,gain:e.gain,rolloff:e.rolloff}).toDestination());break;case "ChorusFilter":t.push(new Chorus({frequency:e.frequency,delayTime:e.delayTime,depth:e.depth,type:e.type,spread:e.spread,feedback:e.feedback,wet:e.wet}).toDestination());break;case "TremoloFilter":t.push(new Tremolo({frequency:e.frequency,type:e.type,depth:e.depth,spread:e.spread,wet:e.wet}).toDestination());break;case "VibratoFilter":t.push(new Vibrato({maxDelay:e.maxDelay,frequency:e.frequency,depth:e.depth,type:e.type,wet:e.wet}).toDestination());break;case "AutoPannerFilter":t.push(new AutoPanner({frequency:e.frequency,type:e.type,depth:e.depth,channelCount:e.channelCount,wet:e.wet}).toDestination());break}return t},[])}function oe(a){if(a)return Array.from(a).reduce((t,e)=>(e instanceof Reverb?t.push({filterType:"ReverbFilter",wet:e.wet.value,decay:Time(e.decay).toSeconds(),preDelay:Time(e.preDelay).toSeconds()}):e instanceof PingPongDelay?t.push({filterType:"PingPongDelayFilter",wet:e.wet.value,delayTime:e.delayTime.value,feedback:e.feedback.value}):e instanceof FeedbackDelay?t.push({filterType:"FeedbackDelayFilter",feedback:e.feedback.value,delayTime:e.delayTime.value,wet:e.wet.value}):e instanceof BitCrusher?t.push({filterType:"BitCrusherFilter",bits:e.bits.value,wet:e.wet.value}):e instanceof Compressor?t.push({filterType:"CompressorFilter",attack:e.attack.value,knee:e.knee.value,ratio:e.ratio.value,release:e.release.value,threshold:e.threshold.value}):e instanceof Delay?t.push({filterType:"DelayFilter",delayTime:e.delayTime.value,maxDelay:e.maxDelay}):e instanceof Distortion?t.push({filterType:"DistortionFilter",distortion:e.distortion,oversample:e.oversample,wet:e.wet.value}):e instanceof FeedbackCombFilter?t.push({filterType:"FeedbackCombFilterFilter",delayTime:e.delayTime.value,resonance:e.resonance.value}):e instanceof Freeverb?t.push({filterType:"FreeverbFilter",roomSize:e.roomSize.value,dampening:e.dampening,wet:e.wet.value}):e instanceof Gate?t.push({filterType:"GateFilter",threshold:e.threshold,smoothing:e.smoothing}):e instanceof GreaterThan?t.push({filterType:"GreaterThanFilter",value:e.comparator.value,convert:e.convert,maxValue:e.maxValue,minValue:e.minValue}):e instanceof GreaterThanZero?t.push({filterType:"GreaterThanZeroFilter"}):e instanceof Limiter?t.push({filterType:"LimiterFilter",threshold:e.threshold.value}):e instanceof MidSideCompressor?t.push({filterType:"MidSideCompressorFilter",mid:{attack:e.mid.attack.value,knee:e.mid.knee.value,ratio:e.mid.ratio.value,release:e.mid.release.value,threshold:e.mid.threshold.value},side:{attack:e.side.attack.value,knee:e.side.knee.value,ratio:e.side.ratio.value,release:e.side.release.value,threshold:e.side.threshold.value}}):e instanceof MultibandCompressor?t.push({filterType:"MultibandCompressorFilter",lowFrequency:e.lowFrequency.value,highFrequency:e.highFrequency.value,low:{attack:e.low.attack.value,knee:e.low.knee.value,ratio:e.low.ratio.value,release:e.low.release.value,threshold:e.low.threshold.value},mid:{attack:e.mid.attack.value,knee:e.mid.knee.value,ratio:e.mid.ratio.value,release:e.mid.release.value,threshold:e.mid.threshold.value},high:{attack:e.high.attack.value,knee:e.high.knee.value,ratio:e.high.ratio.value,release:e.high.release.value,threshold:e.high.threshold.value}}):e instanceof Panner3D?t.push({filterType:"Panner3DFilter",positionX:e.positionX.value,positionY:e.positionY.value,positionZ:e.positionZ.value,orientationX:e.orientationX.value,orientationY:e.orientationY.value,orientationZ:e.orientationZ.value,coneInnerAngle:e.coneInnerAngle,coneOuterAngle:e.coneOuterAngle,coneOuterGain:e.coneOuterGain,distanceModel:e.distanceModel,maxDistance:e.maxDistance,refDistance:e.refDistance,rolloffFactor:e.rolloffFactor,panningModel:e.panningModel}):e instanceof Phaser?t.push({filterType:"PhaserFilter",frequency:e.frequency.value,octaves:e.octaves,baseFrequency:e.baseFrequency,wet:e.wet.value,Q:e.Q.value}):e instanceof StereoWidener?t.push({filterType:"StereoWidenerFilter",width:e.width.value,wet:e.wet.value}):e instanceof AutoFilter?t.push({filterType:"AutoFilterFilter",type:e.type,frequency:e.frequency.value,depth:e.depth.value,baseFrequency:e.baseFrequency,octaves:e.octaves,filter:{Q:e.filter.Q.value,type:e.filter.type,rolloff:e.filter.rolloff},wet:e.wet.value}):e instanceof Chorus?t.push({filterType:"ChorusFilter",type:e.type,frequency:e.frequency.value,delayTime:e.delayTime,depth:e.depth,spread:e.spread,feedback:e.feedback.value,wet:e.wet.value}):e instanceof Tremolo?t.push({filterType:"TremoloFilter",type:e.type,frequency:e.frequency.value,depth:e.depth.value,spread:e.spread,wet:e.wet.value}):e instanceof Vibrato?t.push({filterType:"VibratoFilter",type:e.type,frequency:e.frequency.value,depth:e.depth.value,wet:e.wet.value}):e instanceof AutoPanner?t.push({filterType:"AutoPannerFilter",type:e.type,frequency:e.frequency.value,depth:e.depth.value,channelCount:e.channelCount,wet:e.wet.value}):e instanceof BiquadFilter?t.push({filterType:"BiquadFilterFilter",type:e.type,frequency:e.frequency.value,detune:e.detune.value,Q:e.Q.value,gain:e.gain.value}):e instanceof OnePoleFilter?t.push({filterType:"OnePoleFilterFilter",type:e.type}):e instanceof Filter?t.push({filterType:"CustomFilter",type:e.type,frequency:e.frequency.value,Q:e.Q.value,detune:e.detune.value,gain:e.gain.value,rolloff:e.rolloff}):f.warn(`Unsupported filter type for serialisation: ${e?.constructor?.name??e}, please report this to the developers if you encounter it.`),t),[])}function J(a){return a instanceof Reverb||a instanceof FeedbackDelay||a instanceof PingPongDelay||a instanceof BitCrusher||a instanceof Compressor||a instanceof Delay||a instanceof Distortion||a instanceof FeedbackCombFilter||a instanceof Freeverb||a instanceof Gate||a instanceof GreaterThan||a instanceof GreaterThanZero||a instanceof Limiter||a instanceof MidSideCompressor||a instanceof MultibandCompressor||a instanceof Panner3D||a instanceof Phaser||a instanceof StereoWidener||a instanceof AutoFilter||a instanceof Chorus||a instanceof Vibrato||a instanceof Tremolo||a instanceof AutoPanner||a instanceof BiquadFilter||a instanceof OnePoleFilter||a instanceof Filter}function m(a){return a<=0?-1/0:20*Math.log10(a)}function g(a){return a<=-1/0?0:10**(a/20)}async function T(a){if(i.bufferRegistry.has(a))return;let t=a;try{let e=se.Assets.resolver.resolve(a);e?.src&&(t=e.src);}catch{}try{let e=await ToneAudioBuffer.load(t),n=new ToneAudioBuffer(e);i.bufferRegistry.set(a,n);}catch(e){f.warn(`Failed to load audio buffer for "${a}" (url: "${t}"): ${e instanceof Error?e.message:e}`),i.bufferRegistry.set(a,new ToneAudioBuffer);}}var b=class extends Player{constructor(e,n,r,o,s={},l){super(s);d(this,"alias",e);d(this,"channelAlias",n);d(this,"soundAlias",r);d(this,"stepCounter",o);d(this,"delay",l);d(this,"options");d(this,"filters",new Set);d(this,"pausedAt");d(this,"playStartTime",now());this.options=s;}get memory(){let e=this.pausedAt?this.pausedAt-this.playStartTime:now()-this.playStartTime,n=this.paused;return n&&i.systemPausedAliases.has(this.alias)&&(n=false),{...this.options,fadeIn:this.fadeIn,loop:this.loop,loopEnd:this.loopEnd,loopStart:this.loopStart,mute:this.mute,playbackRate:this.playbackRate,reverse:this.reverse,volume:g(this.volume.value),autostart:!this.paused,elapsed:e,paused:n,delay:this.delay}}set memory(e){this.paused=e.paused,this.loop!==(e.loop||false)&&(this.loop=e.loop||false),this.volume.value!==m(e.volume??1)&&(this.volume.value=m(e.volume??1)),this.mute!==(e.mute||false)&&(this.mute=e.mute||false),this.playbackRate!==(e.playbackRate??1)&&(this.playbackRate=e.playbackRate??1),this.reverse!==(e.reverse||false)&&(this.reverse=e.reverse||false),this.fadeIn!==(e.fadeIn||0)&&(this.fadeIn=e.fadeIn||0),this.loopStart!==(e.loopStart||0)&&(this.loopStart=e.loopStart||0),this.loopEnd!==(e.loopEnd||0)&&(this.loopEnd=e.loopEnd||0);}get paused(){return typeof this.pausedAt=="number"}set paused(e){let n=this.state;if(e)this.pausedAt=now(),n==="started"&&super.stop();else {let r;typeof this.pausedAt=="number"&&(r=this.pausedAt-this.playStartTime,this.pausedAt=void 0),n==="stopped"&&(this.delay?super.start(`+${this.delay}`,r):super.start(void 0,r));}}get muted(){return this.mute}set muted(e){this.mute=e;}get speed(){return this.playbackRate}set speed(e){this.playbackRate=e;}stop(e){return i.mediaInstances.delete(this.alias),super.stop(e)}chain(...e){return e.forEach(n=>{J(n)&&(n.toDestination(),this.filters.add(n));}),super.chain(...e)}disconnect(e){return J(e)&&(e.disconnect(),this.filters.delete(e)),super.disconnect(e)}};var v=class{constructor(t,e={}){d(this,"alias",t);d(this,"toneChannel");d(this,"background");this.background=e.background??false,this.toneChannel=new Channel({volume:m(e.volume??1),mute:e.muted??false,pan:e.pan??0}).toDestination(),e.filters&&this.toneChannel.chain(...e.filters);}get volume(){return g(this.toneChannel.volume.value)}set volume(t){this.toneChannel.volume.value=m(t);}get volumeParam(){return this.toneChannel.volume}get pan(){return this.toneChannel.pan.value}set pan(t){this.toneChannel.pan.value=t;}get panParam(){return this.toneChannel.pan}get muted(){return this.toneChannel.mute}set muted(t){this.toneChannel.mute=t;}pauseAll(){for(let t of i.mediaInstances.values())t.channelAlias===this.alias&&!t.paused&&(t.paused=true);return this}resumeAll(){for(let t of i.mediaInstances.values())t.channelAlias===this.alias&&t.paused&&(t.paused=false);return this}chain(...t){return this.toneChannel.chain(...t),this}_createPlayer(t,e,n={}){let r=i.bufferRegistry.get(e);if(!r)throw new PixiError("unregistered_asset",`Sound buffer for alias "${e}" is not loaded. Call sound.load() first.`);let{delay:o,elapsed:s,filters:l=[],muted:h,autostart:y=true,speed:p,volume:P,...f$1}=n;h!==void 0&&(f.warn(`MediaInstance "${t}" is being created with muted=${h}. This will override the channel's muted state (${this.muted}).`),f$1.mute=h),p!==void 0&&(f.warn(`MediaInstance "${t}" is being created with speed=${p}. This will override the default playback speed of 1.`),f$1.playbackRate=p);let A=new b(t,this.alias,e,GameUnifier.stepCounter,{...f$1,volume:P!==void 0?m(P):void 0,url:r},o).chain(...l,this.toneChannel);return y&&(o?A.start(`+${o}`,s):A.start(void 0,s)),A}async play(t,e,n){let r,o;if(typeof e=="string"?(r=t,o=e):(r=t,o=t,n=e),i.mediaInstances.has(r)){let l=i.mediaInstances.get(r);l&&(l.stop(),n={...l.memory,...n,filters:[...l.filters,...n?.filters||[]]});}await T(o);let s=this._createPlayer(r,o,n);return i.mediaInstances.set(r,s),s}toggleMuteAll(){return this.muted=!this.muted,this.muted}get mediaInstances(){return Array.from(i.mediaInstances.values()).reduce((t,e)=>(e.channelAlias===this.alias&&t.push(e),t),[])}stopAll(){let t=[];for(let[e,n]of i.mediaInstances.entries())n.channelAlias===this.alias&&(n.stop(),t.push(e));return t.forEach(e=>{i.mediaInstances.delete(e);}),this}};var F=class{constructor(){d(this,"_speedAll",1);d(this,"_defaultChannelAlias",i$1);}get volumeAll(){return g(c.getDestination().volume.value)}set volumeAll(t){c.getDestination().volume.value=m(t);}get speedAll(){return this._speedAll}set speedAll(t){this._speedAll=t;for(let e of i.mediaInstances.values())e.speed=t;}get defaultChannelAlias(){return this._defaultChannelAlias}set defaultChannelAlias(t){this._defaultChannelAlias=t;}add(t,e){if(!i.bufferRegistry.has(t)){let n=new c.ToneAudioBuffer(e);i.bufferRegistry.set(t,n);}}pauseAll(){for(let t of i.mediaInstances.values())t.paused||(t.paused=true);return this}resumeAll(){for(let t of i.mediaInstances.values())t.paused&&(t.paused=false);return this}get muted(){return c.getDestination().mute}toggleMuteAll(){let t=!c.getDestination().mute;return c.getDestination().mute=t,t}muteAll(){return c.getDestination().mute=true,this}unmuteAll(){return c.getDestination().mute=false,this}stopAll(){for(let t of i.mediaInstances.values())t.stop();return i.mediaInstances.clear(),this}pauseUnsavedAll(t){for(let[e,n]of i.mediaInstances.entries())t&&n.channelAlias!==t||n.paused||(n.paused=true,i.systemPausedAliases.add(e));if(!t){for(let e of i.transients)e.stop();i.transients.clear();}return this}resumeUnsavedAll(t){let e=[];for(let n of i.systemPausedAliases){let r=i.mediaInstances.get(n);if(!r){e.push(n);continue}t&&r.channelAlias!==t||(r.paused=false,e.push(n));}for(let n of e)i.systemPausedAliases.delete(n);return this}stopTransientAll(){for(let t of i.transients)t.stop();return i.transients.clear(),this}async play(t,e,n){let r,o;typeof e=="string"?(r=t,o=e):(r=t,o=t,n=e),i.bufferRegistry.has(o)||await this.load(o);let{channel:s=this.defaultChannelAlias,...l}=n??{};return await this.findChannel(s).play(r,o,l)}async playTransient(t,e){i.bufferRegistry.has(t)||await this.load(t);let n=i.bufferRegistry.get(t);if(!n)throw new PixiError("unregistered_asset",`Sound buffer for alias "${t}" is not loaded. Call sound.load() first.`);let{autostart:r=true,...o}=e??{},s=new c.Player({...o,url:n}).toDestination();return r&&s.start(),i.transients.add(s),s.onstop=()=>{s.dispose(),i.transients.delete(s);},s}find(t){return i.mediaInstances.get(t)}stop(t){let e=this.find(t);e?(e.stop(),i.mediaInstances.delete(t)):f.warn(`No media instance found with alias ${t} to stop.`);}pause(t){let e=this.find(t);if(!e){f.warn(`No media instance found with alias ${t} to pause.`);return}return e.paused=true,e}resume(t){let e=this.find(t);if(!e){f.warn(`No media instance found with alias ${t} to resume.`);return}return e.paused=false,e}duration(t){return i.bufferRegistry.get(t)?.duration??0}async load(...t){let e=t.map(T);await Promise.all(e);}backgroundLoad(...t){return this.load(...t).catch(e=>{f.error("Error background-loading sound",e);})}backgroundLoadBundle(t){let e=se.Assets.backgroundLoadBundle(t);return e.then(async()=>{try{let n=await se.Assets.loadBundle(t),r=[];for(let o in n)i.bufferRegistry.has(o)||r.push(this.load(o));await Promise.all(r);}catch(n){f.error("Error loading sound bundle",n);}}).catch(n=>{f.error("Error background-loading sound bundle",n);}),e}clear(){this.stopAll();}addChannel(t,e={}){if(typeof t!="string"){t.forEach(r=>{let o={...e,filters:e.filters?[...e.filters]:e.filters};this.addChannel(r,o);});return}if(i.channels.has(t)){f.warn(`Channel with alias ${t} already exists.`);return}let n=new v(t,e);return i.channels.set(t,n),n}findChannel(t){let e=i.channels.get(t);return e||this.addChannel(t)}get channels(){return Array.from(i.channels.values())}export(){let t=Array.from(i.mediaInstances.entries()).reduce((e,[n,r])=>(e[n]={channelAlias:r.channelAlias,soundAlias:r.soundAlias,stepCounter:r.stepCounter,paused:r.paused,options:{...r.memory,filters:oe(r.filters)}},e),{});return {mediaInstances:g$1(t)}}async restore(t){try{if(Object.hasOwn(t,"soundsPlaying")){let e=t.soundsPlaying;if(e){let n=Object.keys(e).map(async r=>{await this.load(r),await this.play(r);});await Promise.all(n);}}if(Object.hasOwn(t,"mediaInstances")){let e=t.mediaInstances;if(e){let n=new Set,r=Object.values(e).map(async({soundAlias:s,channelAlias:l})=>(n.add(l),await this.load(s)));await Promise.all(r),this.channels.forEach(s=>{(!s.background||!n.has(s.alias))&&s.stopAll();});let o=Object.keys(e).map(async s=>{let l=e[s],h=this.findChannel(l.channelAlias),y=l.options.paused??l.paused??!1;if(h.background)if(l.stepCounter===GameUnifier.stepCounter||!this.find(s)){let p=await h.play(s,l.soundAlias,{...l.options,autostart:!y,filters:w(l.options.filters||[]),delay:l.options.delay});p.paused=y;}else {let p=i.mediaInstances.get(s);if(!p){f.warn(`No media instance found with alias ${s} while restoring background state.`);return}p.memory={...l.options,paused:y},[...p.filters].forEach(f=>{p.disconnect(f),f.dispose();}),p.chain(...w(l.options.filters||[]));}else {let p=await h.play(s,l.soundAlias,{...l.options,autostart:!y,filters:w(l.options.filters||[]),delay:l.options.delay});p.paused=y;}});await Promise.all(o);}}}catch(e){f.error("Error importing data",e);}}};var te=new F;GameUnifier.addOnPreContinue(async()=>{try{i.channels.forEach(a=>{a.background||a.stopAll();});}catch{}});if(typeof document<"u"){let a=false;document.addEventListener("visibilitychange",()=>{document.hidden?te.muted||(te.muteAll(),a=true):a&&(te.unmuteAll(),a=false);});}export{i as SoundRegistry,te as sound};
1
+ import {i as i$1}from'./chunk-IWAXXFXE.mjs';import {e,d,f,g as g$1}from'./chunk-Z4GZCINS.mjs';import {GameUnifier,PixiError}from'@drincs/pixi-vn/core';import le from'@drincs/pixi-vn/pixi.js';import*as c from'tone';import {ToneAudioBuffer,Channel,Reverb,Time,PingPongDelay,FeedbackDelay,BitCrusher,Compressor,Delay,Distortion,FeedbackCombFilter,Freeverb,Gate,GreaterThan,GreaterThanZero,Limiter,MidSideCompressor,MultibandCompressor,Panner3D,Phaser,StereoWidener,AutoFilter,Chorus,Tremolo,Vibrato,AutoPanner,BiquadFilter,OnePoleFilter,Filter,Player,now}from'tone';var C;(s=>(s.mediaInstances=new Map,s.channels=new Map,s.transients=new Set,s.systemPausedAliases=new Set,s.bufferRegistry=new e({cacheSize:10})))(C||(C={}));var i=C;function T(a){return a.reduce((t,e)=>{switch(e.filterType){case "ReverbFilter":t.push(new Reverb({decay:e.decay,preDelay:e.preDelay,wet:e.wet}).toDestination());break;case "FeedbackDelayFilter":t.push(new FeedbackDelay({feedback:e.feedback,delayTime:e.delayTime,wet:e.wet}).toDestination());break;case "BitCrusherFilter":t.push(new BitCrusher({bits:e.bits}).toDestination());break;case "CompressorFilter":t.push(new Compressor({attack:e.attack,knee:e.knee,ratio:e.ratio,release:e.release,threshold:e.threshold}).toDestination());break;case "DelayFilter":t.push(new Delay({delayTime:e.delayTime,maxDelay:e.maxDelay}).toDestination());break;case "DistortionFilter":t.push(new Distortion({distortion:e.distortion,oversample:e.oversample,wet:e.wet}).toDestination());break;case "FeedbackCombFilterFilter":t.push(new FeedbackCombFilter({delayTime:e.delayTime,resonance:e.resonance}).toDestination());break;case "FreeverbFilter":t.push(new Freeverb({roomSize:e.roomSize,dampening:e.dampening,wet:e.wet}).toDestination());break;case "GateFilter":t.push(new Gate({threshold:e.threshold,smoothing:e.smoothing}).toDestination());break;case "GreaterThanFilter":t.push(new GreaterThan({value:e.value,convert:e.convert,maxValue:e.maxValue,minValue:e.minValue,units:e.units}).toDestination());break;case "GreaterThanZeroFilter":t.push(new GreaterThanZero);break;case "LimiterFilter":t.push(new Limiter({threshold:e.threshold}).toDestination());break;case "MidSideCompressorFilter":t.push(new MidSideCompressor({mid:e.mid,side:e.side}).toDestination());break;case "MultibandCompressorFilter":t.push(new MultibandCompressor({lowFrequency:e.lowFrequency,highFrequency:e.highFrequency,low:e.low,mid:e.mid,high:e.high}).toDestination());break;case "Panner3DFilter":t.push(new Panner3D({positionX:e.positionX,positionY:e.positionY,positionZ:e.positionZ,orientationX:e.orientationX,orientationY:e.orientationY,orientationZ:e.orientationZ,coneInnerAngle:e.coneInnerAngle,coneOuterAngle:e.coneOuterAngle,coneOuterGain:e.coneOuterGain,distanceModel:e.distanceModel,maxDistance:e.maxDistance,refDistance:e.refDistance,rolloffFactor:e.rolloffFactor,panningModel:e.panningModel}).toDestination());break;case "PhaserFilter":t.push(new Phaser({frequency:e.frequency,octaves:e.octaves,baseFrequency:e.baseFrequency,wet:e.wet,Q:e.Q,stages:e.stages}).toDestination());break;case "StereoWidenerFilter":t.push(new StereoWidener({width:e.width,wet:e.wet}).toDestination());break;case "PingPongDelayFilter":t.push(new PingPongDelay({wet:e.wet,delayTime:e.delayTime,feedback:e.feedback,maxDelay:e.maxDelay}).toDestination());break;case "AutoFilterFilter":t.push(new AutoFilter({frequency:e.frequency,depth:e.depth,baseFrequency:e.baseFrequency,octaves:e.octaves,filter:e.filter,wet:e.wet,type:e.type}).toDestination());break;case "BiquadFilterFilter":t.push(new BiquadFilter({frequency:e.frequency,detune:e.detune,Q:e.Q,type:e.type,gain:e.gain}).toDestination());break;case "OnePoleFilterFilter":t.push(new OnePoleFilter({type:e.type}).toDestination());break;case "CustomFilter":t.push(new Filter({frequency:e.frequency,Q:e.Q,type:e.type,detune:e.detune,gain:e.gain,rolloff:e.rolloff}).toDestination());break;case "ChorusFilter":t.push(new Chorus({frequency:e.frequency,delayTime:e.delayTime,depth:e.depth,type:e.type,spread:e.spread,feedback:e.feedback,wet:e.wet}).toDestination());break;case "TremoloFilter":t.push(new Tremolo({frequency:e.frequency,type:e.type,depth:e.depth,spread:e.spread,wet:e.wet}).toDestination());break;case "VibratoFilter":t.push(new Vibrato({maxDelay:e.maxDelay,frequency:e.frequency,depth:e.depth,type:e.type,wet:e.wet}).toDestination());break;case "AutoPannerFilter":t.push(new AutoPanner({frequency:e.frequency,type:e.type,depth:e.depth,channelCount:e.channelCount,wet:e.wet}).toDestination());break}return t},[])}function se(a){if(a)return Array.from(a).reduce((t,e)=>(e instanceof Reverb?t.push({filterType:"ReverbFilter",wet:e.wet.value,decay:Time(e.decay).toSeconds(),preDelay:Time(e.preDelay).toSeconds()}):e instanceof PingPongDelay?t.push({filterType:"PingPongDelayFilter",wet:e.wet.value,delayTime:e.delayTime.value,feedback:e.feedback.value}):e instanceof FeedbackDelay?t.push({filterType:"FeedbackDelayFilter",feedback:e.feedback.value,delayTime:e.delayTime.value,wet:e.wet.value}):e instanceof BitCrusher?t.push({filterType:"BitCrusherFilter",bits:e.bits.value,wet:e.wet.value}):e instanceof Compressor?t.push({filterType:"CompressorFilter",attack:e.attack.value,knee:e.knee.value,ratio:e.ratio.value,release:e.release.value,threshold:e.threshold.value}):e instanceof Delay?t.push({filterType:"DelayFilter",delayTime:e.delayTime.value,maxDelay:e.maxDelay}):e instanceof Distortion?t.push({filterType:"DistortionFilter",distortion:e.distortion,oversample:e.oversample,wet:e.wet.value}):e instanceof FeedbackCombFilter?t.push({filterType:"FeedbackCombFilterFilter",delayTime:e.delayTime.value,resonance:e.resonance.value}):e instanceof Freeverb?t.push({filterType:"FreeverbFilter",roomSize:e.roomSize.value,dampening:e.dampening,wet:e.wet.value}):e instanceof Gate?t.push({filterType:"GateFilter",threshold:e.threshold,smoothing:e.smoothing}):e instanceof GreaterThan?t.push({filterType:"GreaterThanFilter",value:e.comparator.value,convert:e.convert,maxValue:e.maxValue,minValue:e.minValue}):e instanceof GreaterThanZero?t.push({filterType:"GreaterThanZeroFilter"}):e instanceof Limiter?t.push({filterType:"LimiterFilter",threshold:e.threshold.value}):e instanceof MidSideCompressor?t.push({filterType:"MidSideCompressorFilter",mid:{attack:e.mid.attack.value,knee:e.mid.knee.value,ratio:e.mid.ratio.value,release:e.mid.release.value,threshold:e.mid.threshold.value},side:{attack:e.side.attack.value,knee:e.side.knee.value,ratio:e.side.ratio.value,release:e.side.release.value,threshold:e.side.threshold.value}}):e instanceof MultibandCompressor?t.push({filterType:"MultibandCompressorFilter",lowFrequency:e.lowFrequency.value,highFrequency:e.highFrequency.value,low:{attack:e.low.attack.value,knee:e.low.knee.value,ratio:e.low.ratio.value,release:e.low.release.value,threshold:e.low.threshold.value},mid:{attack:e.mid.attack.value,knee:e.mid.knee.value,ratio:e.mid.ratio.value,release:e.mid.release.value,threshold:e.mid.threshold.value},high:{attack:e.high.attack.value,knee:e.high.knee.value,ratio:e.high.ratio.value,release:e.high.release.value,threshold:e.high.threshold.value}}):e instanceof Panner3D?t.push({filterType:"Panner3DFilter",positionX:e.positionX.value,positionY:e.positionY.value,positionZ:e.positionZ.value,orientationX:e.orientationX.value,orientationY:e.orientationY.value,orientationZ:e.orientationZ.value,coneInnerAngle:e.coneInnerAngle,coneOuterAngle:e.coneOuterAngle,coneOuterGain:e.coneOuterGain,distanceModel:e.distanceModel,maxDistance:e.maxDistance,refDistance:e.refDistance,rolloffFactor:e.rolloffFactor,panningModel:e.panningModel}):e instanceof Phaser?t.push({filterType:"PhaserFilter",frequency:e.frequency.value,octaves:e.octaves,baseFrequency:e.baseFrequency,wet:e.wet.value,Q:e.Q.value}):e instanceof StereoWidener?t.push({filterType:"StereoWidenerFilter",width:e.width.value,wet:e.wet.value}):e instanceof AutoFilter?t.push({filterType:"AutoFilterFilter",type:e.type,frequency:e.frequency.value,depth:e.depth.value,baseFrequency:e.baseFrequency,octaves:e.octaves,filter:{Q:e.filter.Q.value,type:e.filter.type,rolloff:e.filter.rolloff},wet:e.wet.value}):e instanceof Chorus?t.push({filterType:"ChorusFilter",type:e.type,frequency:e.frequency.value,delayTime:e.delayTime,depth:e.depth,spread:e.spread,feedback:e.feedback.value,wet:e.wet.value}):e instanceof Tremolo?t.push({filterType:"TremoloFilter",type:e.type,frequency:e.frequency.value,depth:e.depth.value,spread:e.spread,wet:e.wet.value}):e instanceof Vibrato?t.push({filterType:"VibratoFilter",type:e.type,frequency:e.frequency.value,depth:e.depth.value,wet:e.wet.value}):e instanceof AutoPanner?t.push({filterType:"AutoPannerFilter",type:e.type,frequency:e.frequency.value,depth:e.depth.value,channelCount:e.channelCount,wet:e.wet.value}):e instanceof BiquadFilter?t.push({filterType:"BiquadFilterFilter",type:e.type,frequency:e.frequency.value,detune:e.detune.value,Q:e.Q.value,gain:e.gain.value}):e instanceof OnePoleFilter?t.push({filterType:"OnePoleFilterFilter",type:e.type}):e instanceof Filter?t.push({filterType:"CustomFilter",type:e.type,frequency:e.frequency.value,Q:e.Q.value,detune:e.detune.value,gain:e.gain.value,rolloff:e.rolloff}):f.warn(`Unsupported filter type for serialisation: ${e?.constructor?.name??e}, please report this to the developers if you encounter it.`),t),[])}function K(a){return a instanceof Reverb||a instanceof FeedbackDelay||a instanceof PingPongDelay||a instanceof BitCrusher||a instanceof Compressor||a instanceof Delay||a instanceof Distortion||a instanceof FeedbackCombFilter||a instanceof Freeverb||a instanceof Gate||a instanceof GreaterThan||a instanceof GreaterThanZero||a instanceof Limiter||a instanceof MidSideCompressor||a instanceof MultibandCompressor||a instanceof Panner3D||a instanceof Phaser||a instanceof StereoWidener||a instanceof AutoFilter||a instanceof Chorus||a instanceof Vibrato||a instanceof Tremolo||a instanceof AutoPanner||a instanceof BiquadFilter||a instanceof OnePoleFilter||a instanceof Filter}function h(a){return a<=0?-1/0:20*Math.log10(a)}function g(a){return a<=-1/0?0:10**(a/20)}async function P(a){if(i.bufferRegistry.has(a))return;let t=a;try{let e=le.Assets.resolver.resolve(a);e?.src&&(t=e.src);}catch{}try{let e=await ToneAudioBuffer.load(t),n=new ToneAudioBuffer(e);i.bufferRegistry.set(a,n);}catch(e){f.warn(`Failed to load audio buffer for "${a}" (url: "${t}"): ${e instanceof Error?e.message:e}`),i.bufferRegistry.set(a,new ToneAudioBuffer);}}var v=class extends Player{constructor(e,n,r,s,o={},l){super(o);d(this,"alias",e);d(this,"channelAlias",n);d(this,"soundAlias",r);d(this,"stepCounter",s);d(this,"delay",l);d(this,"options");d(this,"filters",new Set);d(this,"pausedAt");d(this,"playStartTime",now());this.options=o,this.playStartTime=now()+(l??0);}get memory(){let e=Math.max(0,this.pausedAt?this.pausedAt-this.playStartTime:now()-this.playStartTime),n=this.paused;return n&&i.systemPausedAliases.has(this.alias)&&(n=false),{...this.options,fadeIn:this.fadeIn,loop:this.loop,loopEnd:this.loopEnd,loopStart:this.loopStart,mute:this.mute,playbackRate:this.playbackRate,reverse:this.reverse,volume:g(this.volume.value),autostart:!this.paused,elapsed:e,paused:n,delay:this.delay}}set memory(e){this.paused=e.paused,this.loop!==(e.loop||false)&&(this.loop=e.loop||false),this.volume.value!==h(e.volume??1)&&(this.volume.value=h(e.volume??1)),this.mute!==(e.mute||false)&&(this.mute=e.mute||false),this.playbackRate!==(e.playbackRate??1)&&(this.playbackRate=e.playbackRate??1),this.reverse!==(e.reverse||false)&&(this.reverse=e.reverse||false),this.fadeIn!==(e.fadeIn||0)&&(this.fadeIn=e.fadeIn||0),this.loopStart!==(e.loopStart||0)&&(this.loopStart=e.loopStart||0),this.loopEnd!==(e.loopEnd||0)&&(this.loopEnd=e.loopEnd||0);}get paused(){return typeof this.pausedAt=="number"}set paused(e){let n=this.state;if(e)this.pausedAt=now(),n==="started"&&super.stop();else {let r;typeof this.pausedAt=="number"&&(r=this.pausedAt-this.playStartTime,this.pausedAt=void 0),n==="stopped"&&(this.delay?this.start(`+${this.delay}`,r):this.start(void 0,r));}}get muted(){return this.mute}set muted(e){this.mute=e;}get speed(){return this.playbackRate}set speed(e){this.playbackRate=e;}stop(e){return i.mediaInstances.delete(this.alias),super.stop(e)}start(e,n,r){let s=now(),o=s;if(typeof e=="number")o=e;else if(typeof e=="string"&&e.startsWith("+")){let m=Number(e.slice(1));Number.isNaN(m)||(o=s+m);}let l=typeof n=="number"?n:0;return this.playStartTime=o-l,super.start(e,n,r)}chain(...e){return e.forEach(n=>{K(n)&&(n.toDestination(),this.filters.add(n));}),super.chain(...e)}disconnect(e){return K(e)&&(e.disconnect(),this.filters.delete(e)),super.disconnect(e)}};var F=class{constructor(t,e={}){d(this,"alias",t);d(this,"toneChannel");d(this,"background");this.background=e.background??false,this.toneChannel=new Channel({volume:h(e.volume??1),mute:e.muted??false,pan:e.pan??0}).toDestination(),e.filters&&this.toneChannel.chain(...e.filters);}get volume(){return g(this.toneChannel.volume.value)}set volume(t){this.toneChannel.volume.value=h(t);}get volumeParam(){return this.toneChannel.volume}get pan(){return this.toneChannel.pan.value}set pan(t){this.toneChannel.pan.value=t;}get panParam(){return this.toneChannel.pan}get muted(){return this.toneChannel.mute}set muted(t){this.toneChannel.mute=t;}pauseAll(){for(let t of i.mediaInstances.values())t.channelAlias===this.alias&&!t.paused&&(t.paused=true);return this}resumeAll(){for(let t of i.mediaInstances.values())t.channelAlias===this.alias&&t.paused&&(t.paused=false);return this}chain(...t){return this.toneChannel.chain(...t),this}_createPlayer(t,e,n={}){let r=i.bufferRegistry.get(e);if(!r)throw new PixiError("unregistered_asset",`Sound buffer for alias "${e}" is not loaded. Call sound.load() first.`);let{delay:s,elapsed:o,filters:l=[],muted:m,autostart:y=true,speed:p,volume:A,...f$1}=n;m!==void 0&&(f.warn(`MediaInstance "${t}" is being created with muted=${m}. This will override the channel's muted state (${this.muted}).`),f$1.mute=m),p!==void 0&&(f.warn(`MediaInstance "${t}" is being created with speed=${p}. This will override the default playback speed of 1.`),f$1.playbackRate=p);let O=new v(t,this.alias,e,GameUnifier.stepCounter,{...f$1,volume:A!==void 0?h(A):void 0,url:r},s).chain(...l,this.toneChannel),ne=o!==void 0?Math.max(0,o):void 0;return y&&(s?O.start(`+${s}`,ne):O.start(void 0,ne)),O}async play(t,e,n){let r,s;if(typeof e=="string"?(r=t,s=e):(r=t,s=t,n=e),i.mediaInstances.has(r)){let l=i.mediaInstances.get(r);l&&(l.stop(),n={...l.memory,...n,filters:[...l.filters,...n?.filters||[]]});}await P(s);let o=this._createPlayer(r,s,n);return i.mediaInstances.set(r,o),o}toggleMuteAll(){return this.muted=!this.muted,this.muted}get mediaInstances(){return Array.from(i.mediaInstances.values()).reduce((t,e)=>(e.channelAlias===this.alias&&t.push(e),t),[])}stopAll(){let t=[];for(let[e,n]of i.mediaInstances.entries())n.channelAlias===this.alias&&(n.stop(),t.push(e));return t.forEach(e=>{i.mediaInstances.delete(e);}),this}};var w=class{constructor(){d(this,"_speedAll",1);d(this,"_defaultChannelAlias",i$1);}get volumeAll(){return g(c.getDestination().volume.value)}set volumeAll(t){c.getDestination().volume.value=h(t);}get speedAll(){return this._speedAll}set speedAll(t){this._speedAll=t;for(let e of i.mediaInstances.values())e.speed=t;}get defaultChannelAlias(){return this._defaultChannelAlias}set defaultChannelAlias(t){this._defaultChannelAlias=t;}add(t,e){if(!i.bufferRegistry.has(t)){let n=new c.ToneAudioBuffer(e);i.bufferRegistry.set(t,n);}}pauseAll(){for(let t of i.mediaInstances.values())t.paused||(t.paused=true);return this}resumeAll(){for(let t of i.mediaInstances.values())t.paused&&(t.paused=false);return this}get muted(){return c.getDestination().mute}toggleMuteAll(){let t=!c.getDestination().mute;return c.getDestination().mute=t,t}muteAll(){return c.getDestination().mute=true,this}unmuteAll(){return c.getDestination().mute=false,this}stopAll(){for(let t of i.mediaInstances.values())t.stop();return i.mediaInstances.clear(),this}pauseUnsavedAll(t){for(let[e,n]of i.mediaInstances.entries())t&&n.channelAlias!==t||n.paused||(n.paused=true,i.systemPausedAliases.add(e));if(!t){for(let e of i.transients)e.stop();i.transients.clear();}return this}resumeUnsavedAll(t){let e=[];for(let n of i.systemPausedAliases){let r=i.mediaInstances.get(n);if(!r){e.push(n);continue}t&&r.channelAlias!==t||(r.paused=false,e.push(n));}for(let n of e)i.systemPausedAliases.delete(n);return this}stopTransientAll(){for(let t of i.transients)t.stop();return i.transients.clear(),this}async play(t,e,n){let r,s;typeof e=="string"?(r=t,s=e):(r=t,s=t,n=e),i.bufferRegistry.has(s)||await this.load(s);let{channel:o=this.defaultChannelAlias,...l}=n??{};return await this.findChannel(o).play(r,s,l)}async playTransient(t,e){i.bufferRegistry.has(t)||await this.load(t);let n=i.bufferRegistry.get(t);if(!n)throw new PixiError("unregistered_asset",`Sound buffer for alias "${t}" is not loaded. Call sound.load() first.`);let{autostart:r=true,...s}=e??{},o=new c.Player({...s,url:n}).toDestination();return r&&o.start(),i.transients.add(o),o.onstop=()=>{o.dispose(),i.transients.delete(o);},o}find(t){return i.mediaInstances.get(t)}stop(t){let e=this.find(t);e?(e.stop(),i.mediaInstances.delete(t)):f.warn(`No media instance found with alias ${t} to stop.`);}pause(t){let e=this.find(t);if(!e){f.warn(`No media instance found with alias ${t} to pause.`);return}return e.paused=true,e}resume(t){let e=this.find(t);if(!e){f.warn(`No media instance found with alias ${t} to resume.`);return}return e.paused=false,e}duration(t){return i.bufferRegistry.get(t)?.duration??0}async load(...t){let e=t.map(P);await Promise.all(e);}backgroundLoad(...t){return this.load(...t).catch(e=>{f.error("Error background-loading sound",e);})}backgroundLoadBundle(t){let e=le.Assets.backgroundLoadBundle(t);return e.then(async()=>{try{let n=await le.Assets.loadBundle(t),r=[];for(let s in n)i.bufferRegistry.has(s)||r.push(this.load(s));await Promise.all(r);}catch(n){f.error("Error loading sound bundle",n);}}).catch(n=>{f.error("Error background-loading sound bundle",n);}),e}clear(){this.stopAll();}addChannel(t,e={}){if(typeof t!="string"){t.forEach(r=>{let s={...e,filters:e.filters?[...e.filters]:e.filters};this.addChannel(r,s);});return}if(i.channels.has(t)){f.warn(`Channel with alias ${t} already exists.`);return}let n=new F(t,e);return i.channels.set(t,n),n}findChannel(t){let e=i.channels.get(t);return e||this.addChannel(t)}get channels(){return Array.from(i.channels.values())}export(){let t=Array.from(i.mediaInstances.entries()).reduce((e,[n,r])=>(e[n]={channelAlias:r.channelAlias,soundAlias:r.soundAlias,stepCounter:r.stepCounter,paused:r.paused,options:{...r.memory,filters:se(r.filters)}},e),{});return {mediaInstances:g$1(t)}}async restore(t){try{if(Object.hasOwn(t,"soundsPlaying")){let e=t.soundsPlaying;if(e){let n=Object.keys(e).map(async r=>{await this.load(r),await this.play(r);});await Promise.all(n);}}if(Object.hasOwn(t,"mediaInstances")){let e=t.mediaInstances;if(e){let n=new Set,r=Object.values(e).map(async({soundAlias:o,channelAlias:l})=>(n.add(l),await this.load(o)));await Promise.all(r),this.channels.forEach(o=>{(!o.background||!n.has(o.alias))&&o.stopAll();});let s=Object.keys(e).map(async o=>{let l=e[o],m=this.findChannel(l.channelAlias),y=l.options.paused??l.paused??!1;if(m.background)if(l.stepCounter===GameUnifier.stepCounter||!this.find(o)){let p=await m.play(o,l.soundAlias,{...l.options,autostart:!y,filters:T(l.options.filters||[]),delay:l.options.delay});p.paused=y;}else {let p=i.mediaInstances.get(o);if(!p){f.warn(`No media instance found with alias ${o} while restoring background state.`);return}p.memory={...l.options,paused:y},[...p.filters].forEach(f=>{p.disconnect(f),f.dispose();}),p.chain(...T(l.options.filters||[]));}else {let p=await m.play(o,l.soundAlias,{...l.options,autostart:!y,filters:T(l.options.filters||[]),delay:l.options.delay});p.paused=y;}});await Promise.all(s);}}}catch(e){f.error("Error importing data",e);}}};var te=new w;GameUnifier.addOnPreContinue(async()=>{try{i.channels.forEach(a=>{a.background||a.stopAll();});}catch{}});if(typeof document<"u"){let a=false;document.addEventListener("visibilitychange",()=>{document.hidden?te.muted||(te.muteAll(),a=true):a&&(te.unmuteAll(),a=false);});}export{i as SoundRegistry,te as sound};
package/dist/storage.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var core=require('@drincs/pixi-vn/core');var te=Object.defineProperty;var jt=u=>{throw TypeError(u)};var ee=(u,e,i)=>e in u?te(u,e,{enumerable:true,configurable:true,writable:true,value:i}):u[e]=i;var E=(u,e,i)=>ee(u,typeof e!="symbol"?e+"":e,i),Ut=(u,e,i)=>e.has(u)||jt("Cannot "+i);var t=(u,e,i)=>(Ut(u,e,"read from private field"),i?i.call(u):e.get(u)),d=(u,e,i)=>e.has(u)?jt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(u):e.set(u,i),f=(u,e,i,s)=>(Ut(u,e,"write to private field"),e.set(u,i),i),l=(u,e,i)=>(Ut(u,e,"access private method"),i);var It=(u,e,i,s)=>({set _(r){f(u,e,r);},get _(){return t(u,e,s)}});var st="storage",ht="temp",H="narration",Nt="flags",j={CURRENT_DIALOGUE_MEMORY_KEY:"dialogue",LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY:"dialogue:step_counter",CURRENT_MENU_OPTIONS_MEMORY_KEY:"choice:options",LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY:"choice:step_counter",CURRENT_INPUT_VALUE_MEMORY_KEY:"input:value",LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY:"input:step_counter",CURRENT_INPUT_INFO_MEMORY_KEY:"input:info",CHARACTER_CATEGORY_KEY:"character",ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY:"___glue___",OPENED_LABELS_COUNTER_KEY:"label:opened",ALL_CHOICES_MADE_KEY:"choices:made",CURRENT_STEP_TIMES_COUNTER_KEY:"label:history",LAST_STEP_GLUED:"glue:last_step"};var ct;(r=>(r.log=(a,...o)=>console.log(`[Pixi\u2019VN] ${a}`,...o),r.warn=(a,...o)=>console.warn(`[Pixi\u2019VN] ${a}`,...o),r.error=(a,...o)=>console.error(`[Pixi\u2019VN] ${a}`,...o),r.info=(a,...o)=>console.info(`[Pixi\u2019VN] ${a}`,...o)))(ct||(ct={}));function Ot(u){try{if(typeof u>"u")return u;let e=JSON.stringify(u);return JSON.parse(e)}catch(e){throw ct.error("Error creating exportable element",u,e),new core.PixiError("not_json_serializable","Error creating exportable element")}}var se=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Xt=new Set,zt=typeof process=="object"&&process?process:{},Jt=(u,e,i,s)=>{typeof zt.emitWarning=="function"?zt.emitWarning(u,e,i,s):console.error(`[${i}] ${e}: ${u}`);},Gt=globalThis.AbortController,$t=globalThis.AbortSignal;if(typeof Gt>"u"){$t=class{constructor(){E(this,"onabort");E(this,"_onabort",[]);E(this,"reason");E(this,"aborted",false);}addEventListener(i,s){this._onabort.push(s);}},Gt=class{constructor(){E(this,"signal",new $t);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 u=zt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{u&&(u=false,Jt("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 re=u=>!Xt.has(u);var rt=u=>u&&u===Math.floor(u)&&u>0&&isFinite(u),qt=u=>rt(u)?u<=Math.pow(2,8)?Uint8Array:u<=Math.pow(2,16)?Uint16Array:u<=Math.pow(2,32)?Uint32Array:u<=Number.MAX_SAFE_INTEGER?Ft:null:null,Ft=class extends Array{constructor(u){super(u),this.fill(0);}},et,St,oe=(et=class{constructor(e,i){E(this,"heap");E(this,"length");if(!t(et,St))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}static create(e){let i=qt(e);if(!i)return [];f(et,St,true);let s=new et(e,i);return f(et,St,false),s}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},St=new WeakMap,d(et,St,false),et),kt,Bt,$,z,k,ut,B,mt,Et,X,D,J,R,w,p,V,Y,C,N,q,F,Q,Z,P,K,tt,lt,L,Tt,n,Yt,ft,it,xt,W,Zt,pt,bt,Rt,ot,at,Pt,Ct,Mt,O,Kt,wt,nt,Wt,yt,Qt=(yt=class{constructor(e){d(this,n);d(this,$);d(this,z);d(this,k);d(this,ut);d(this,B);d(this,mt);d(this,Et);d(this,X);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");d(this,D);d(this,J);d(this,R);d(this,w);d(this,p);d(this,V);d(this,Y);d(this,C);d(this,N);d(this,q);d(this,F);d(this,Q);d(this,Z);d(this,P);d(this,K);d(this,tt);d(this,lt);d(this,L);d(this,Tt);d(this,ft,()=>{});d(this,it,()=>{});d(this,xt,()=>{});d(this,W,()=>false);d(this,pt,e=>{});d(this,bt,(e,i,s)=>{});d(this,Rt,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});E(this,kt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:a,updateAgeOnGet:o,updateAgeOnHas:h,allowStale:c,dispose:m,onInsert:I,disposeAfter:_,noDisposeOnSet:y,noUpdateTTL:b,maxSize:T=0,maxEntrySize:A=0,sizeCalculation:v,fetchMethod:g,memoMethod:M,noDeleteOnFetchRejection:U,noDeleteOnStaleGet:G,allowStaleOnFetchRejection:x,allowStaleOnFetchAbort:vt,ignoreFetchAbort:_t,perf:gt}=e;if(gt!==void 0&&typeof gt?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(f(this,X,gt??se),i!==0&&!rt(i))throw new TypeError("max option must be a nonnegative integer");let dt=i?qt(i):Array;if(!dt)throw new Error("invalid max value: "+i);if(f(this,$,i),f(this,z,T),this.maxEntrySize=A||t(this,z),this.sizeCalculation=v,this.sizeCalculation){if(!t(this,z)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(M!==void 0&&typeof M!="function")throw new TypeError("memoMethod must be a function if defined");if(f(this,Et,M),g!==void 0&&typeof g!="function")throw new TypeError("fetchMethod must be a function if specified");if(f(this,mt,g),f(this,lt,!!g),f(this,R,new Map),f(this,w,new Array(i).fill(void 0)),f(this,p,new Array(i).fill(void 0)),f(this,V,new dt(i)),f(this,Y,new dt(i)),f(this,C,0),f(this,N,0),f(this,q,oe.create(i)),f(this,D,0),f(this,J,0),typeof m=="function"&&f(this,k,m),typeof I=="function"&&f(this,ut,I),typeof _=="function"?(f(this,B,_),f(this,F,[])):(f(this,B,void 0),f(this,F,void 0)),f(this,tt,!!t(this,k)),f(this,Tt,!!t(this,ut)),f(this,L,!!t(this,B)),this.noDisposeOnSet=!!y,this.noUpdateTTL=!!b,this.noDeleteOnFetchRejection=!!U,this.allowStaleOnFetchRejection=!!x,this.allowStaleOnFetchAbort=!!vt,this.ignoreFetchAbort=!!_t,this.maxEntrySize!==0){if(t(this,z)!==0&&!rt(t(this,z)))throw new TypeError("maxSize must be a positive integer if specified");if(!rt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");l(this,n,Zt).call(this);}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!G,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!h,this.ttlResolution=rt(r)||r===0?r:1,this.ttlAutopurge=!!a,this.ttl=s||0,this.ttl){if(!rt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");l(this,n,Yt).call(this);}if(t(this,$)===0&&this.ttl===0&&t(this,z)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,$)&&!t(this,z)){let Lt="LRU_CACHE_UNBOUNDED";re(Lt)&&(Xt.add(Lt),Jt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Lt,yt));}}get perf(){return t(this,X)}static unsafeExposeInternals(e){return {starts:t(e,Z),ttls:t(e,P),autopurgeTimers:t(e,K),sizes:t(e,Q),keyMap:t(e,R),keyList:t(e,w),valList:t(e,p),next:t(e,V),prev:t(e,Y),get head(){return t(e,C)},get tail(){return t(e,N)},free:t(e,q),isBackgroundFetch:i=>{var s;return l(s=e,n,O).call(s,i)},backgroundFetch:(i,s,r,a)=>{var o;return l(o=e,n,Mt).call(o,i,s,r,a)},moveToTail:i=>{var s;return l(s=e,n,wt).call(s,i)},indexes:i=>{var s;return l(s=e,n,ot).call(s,i)},rindexes:i=>{var s;return l(s=e,n,at).call(s,i)},isStale:i=>{var s;return t(s=e,W).call(s,i)}}}get max(){return t(this,$)}get maxSize(){return t(this,z)}get calculatedSize(){return t(this,J)}get size(){return t(this,D)}get fetchMethod(){return t(this,mt)}get memoMethod(){return t(this,Et)}get dispose(){return t(this,k)}get onInsert(){return t(this,ut)}get disposeAfter(){return t(this,B)}getRemainingTTL(e){return t(this,R).has(e)?1/0:0}*entries(){for(let e of l(this,n,ot).call(this))t(this,p)[e]!==void 0&&t(this,w)[e]!==void 0&&!l(this,n,O).call(this,t(this,p)[e])&&(yield [t(this,w)[e],t(this,p)[e]]);}*rentries(){for(let e of l(this,n,at).call(this))t(this,p)[e]!==void 0&&t(this,w)[e]!==void 0&&!l(this,n,O).call(this,t(this,p)[e])&&(yield [t(this,w)[e],t(this,p)[e]]);}*keys(){for(let e of l(this,n,ot).call(this)){let i=t(this,w)[e];i!==void 0&&!l(this,n,O).call(this,t(this,p)[e])&&(yield i);}}*rkeys(){for(let e of l(this,n,at).call(this)){let i=t(this,w)[e];i!==void 0&&!l(this,n,O).call(this,t(this,p)[e])&&(yield i);}}*values(){for(let e of l(this,n,ot).call(this))t(this,p)[e]!==void 0&&!l(this,n,O).call(this,t(this,p)[e])&&(yield t(this,p)[e]);}*rvalues(){for(let e of l(this,n,at).call(this))t(this,p)[e]!==void 0&&!l(this,n,O).call(this,t(this,p)[e])&&(yield t(this,p)[e]);}[(Bt=Symbol.iterator,kt=Symbol.toStringTag,Bt)](){return this.entries()}find(e,i={}){for(let s of l(this,n,ot).call(this)){let r=t(this,p)[s],a=l(this,n,O).call(this,r)?r.__staleWhileFetching:r;if(a!==void 0&&e(a,t(this,w)[s],this))return this.get(t(this,w)[s],i)}}forEach(e,i=this){for(let s of l(this,n,ot).call(this)){let r=t(this,p)[s],a=l(this,n,O).call(this,r)?r.__staleWhileFetching:r;a!==void 0&&e.call(i,a,t(this,w)[s],this);}}rforEach(e,i=this){for(let s of l(this,n,at).call(this)){let r=t(this,p)[s],a=l(this,n,O).call(this,r)?r.__staleWhileFetching:r;a!==void 0&&e.call(i,a,t(this,w)[s],this);}}purgeStale(){let e=false;for(let i of l(this,n,at).call(this,{allowStale:true}))t(this,W).call(this,i)&&(l(this,n,nt).call(this,t(this,w)[i],"expire"),e=true);return e}info(e){let i=t(this,R).get(e);if(i===void 0)return;let s=t(this,p)[i],r=l(this,n,O).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let a={value:r};if(t(this,P)&&t(this,Z)){let o=t(this,P)[i],h=t(this,Z)[i];if(o&&h){let c=o-(t(this,X).now()-h);a.ttl=c,a.start=Date.now();}}return t(this,Q)&&(a.size=t(this,Q)[i]),a}dump(){let e=[];for(let i of l(this,n,ot).call(this,{allowStale:true})){let s=t(this,w)[i],r=t(this,p)[i],a=l(this,n,O).call(this,r)?r.__staleWhileFetching:r;if(a===void 0||s===void 0)continue;let o={value:a};if(t(this,P)&&t(this,Z)){o.ttl=t(this,P)[i];let h=t(this,X).now()-t(this,Z)[i];o.start=Math.floor(Date.now()-h);}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 y,b,T,A;if(i===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:a,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:h=this.sizeCalculation,status:c}=s,{noUpdateTTL:m=this.noUpdateTTL}=s,I=t(this,Rt).call(this,e,i,s.size||0,h);if(this.maxEntrySize&&I>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=true),l(this,n,nt).call(this,e,"set"),this;let _=t(this,D)===0?void 0:t(this,R).get(e);if(_===void 0)_=t(this,D)===0?t(this,N):t(this,q).length!==0?t(this,q).pop():t(this,D)===t(this,$)?l(this,n,Ct).call(this,false):t(this,D),t(this,w)[_]=e,t(this,p)[_]=i,t(this,R).set(e,_),t(this,V)[t(this,N)]=_,t(this,Y)[_]=t(this,N),f(this,N,_),It(this,D)._++,t(this,bt).call(this,_,I,c),c&&(c.set="add"),m=false,t(this,Tt)&&((y=t(this,ut))==null||y.call(this,i,e,"add"));else {l(this,n,wt).call(this,_);let v=t(this,p)[_];if(i!==v){if(t(this,lt)&&l(this,n,O).call(this,v)){v.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:g}=v;g!==void 0&&!o&&(t(this,tt)&&((b=t(this,k))==null||b.call(this,g,e,"set")),t(this,L)&&t(this,F)?.push([g,e,"set"]));}else o||(t(this,tt)&&((T=t(this,k))==null||T.call(this,v,e,"set")),t(this,L)&&t(this,F)?.push([v,e,"set"]));if(t(this,pt).call(this,_),t(this,bt).call(this,_,I,c),t(this,p)[_]=i,c){c.set="replace";let g=v&&l(this,n,O).call(this,v)?v.__staleWhileFetching:v;g!==void 0&&(c.oldValue=g);}}else c&&(c.set="update");t(this,Tt)&&this.onInsert?.(i,e,i===v?"update":"replace");}if(r!==0&&!t(this,P)&&l(this,n,Yt).call(this),t(this,P)&&(m||t(this,xt).call(this,_,r,a),c&&t(this,it).call(this,c,_)),!o&&t(this,L)&&t(this,F)){let v=t(this,F),g;for(;g=v?.shift();)(A=t(this,B))==null||A.call(this,...g);}return this}pop(){var e;try{for(;t(this,D);){let i=t(this,p)[t(this,C)];if(l(this,n,Ct).call(this,!0),l(this,n,O).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(t(this,L)&&t(this,F)){let i=t(this,F),s;for(;s=i?.shift();)(e=t(this,B))==null||e.call(this,...s);}}}has(e,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,a=t(this,R).get(e);if(a!==void 0){let o=t(this,p)[a];if(l(this,n,O).call(this,o)&&o.__staleWhileFetching===void 0)return false;if(t(this,W).call(this,a))r&&(r.has="stale",t(this,it).call(this,r,a));else return s&&t(this,ft).call(this,a),r&&(r.has="hit",t(this,it).call(this,r,a)),true}else r&&(r.has="miss");return false}peek(e,i={}){let{allowStale:s=this.allowStale}=i,r=t(this,R).get(e);if(r===void 0||!s&&t(this,W).call(this,r))return;let a=t(this,p)[r];return l(this,n,O).call(this,a)?a.__staleWhileFetching:a}async fetch(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:h=this.noDisposeOnSet,size:c=0,sizeCalculation:m=this.sizeCalculation,noUpdateTTL:I=this.noUpdateTTL,noDeleteOnFetchRejection:_=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:y=this.allowStaleOnFetchRejection,ignoreFetchAbort:b=this.ignoreFetchAbort,allowStaleOnFetchAbort:T=this.allowStaleOnFetchAbort,context:A,forceRefresh:v=false,status:g,signal:M}=i;if(!t(this,lt))return g&&(g.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:a,status:g});let U={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:a,ttl:o,noDisposeOnSet:h,size:c,sizeCalculation:m,noUpdateTTL:I,noDeleteOnFetchRejection:_,allowStaleOnFetchRejection:y,allowStaleOnFetchAbort:T,ignoreFetchAbort:b,status:g,signal:M},G=t(this,R).get(e);if(G===void 0){g&&(g.fetch="miss");let x=l(this,n,Mt).call(this,e,G,U,A);return x.__returned=x}else {let x=t(this,p)[G];if(l(this,n,O).call(this,x)){let dt=s&&x.__staleWhileFetching!==void 0;return g&&(g.fetch="inflight",dt&&(g.returnedStale=true)),dt?x.__staleWhileFetching:x.__returned=x}let vt=t(this,W).call(this,G);if(!v&&!vt)return g&&(g.fetch="hit"),l(this,n,wt).call(this,G),r&&t(this,ft).call(this,G),g&&t(this,it).call(this,g,G),x;let _t=l(this,n,Mt).call(this,e,G,U,A),gt=_t.__staleWhileFetching!==void 0&&s;return g&&(g.fetch=vt?"stale":"refresh",gt&&vt&&(g.returnedStale=true)),gt?_t.__staleWhileFetching:_t.__returned=_t}}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:a,...o}=i,h=this.get(e,o);if(!a&&h!==void 0)return h;let c=s(e,h,{options:o,context:r});return this.set(e,c,o),c}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,status:o}=i,h=t(this,R).get(e);if(h!==void 0){let c=t(this,p)[h],m=l(this,n,O).call(this,c);return o&&t(this,it).call(this,o,h),t(this,W).call(this,h)?(o&&(o.get="stale"),m?(o&&s&&c.__staleWhileFetching!==void 0&&(o.returnedStale=true),s?c.__staleWhileFetching:void 0):(a||l(this,n,nt).call(this,e,"expire"),o&&s&&(o.returnedStale=true),s?c:void 0)):(o&&(o.get="hit"),m?c.__staleWhileFetching:(l(this,n,wt).call(this,h),r&&t(this,ft).call(this,h),c))}else o&&(o.get="miss");}delete(e){return l(this,n,nt).call(this,e,"delete")}clear(){return l(this,n,Wt).call(this,"delete")}},$=new WeakMap,z=new WeakMap,k=new WeakMap,ut=new WeakMap,B=new WeakMap,mt=new WeakMap,Et=new WeakMap,X=new WeakMap,D=new WeakMap,J=new WeakMap,R=new WeakMap,w=new WeakMap,p=new WeakMap,V=new WeakMap,Y=new WeakMap,C=new WeakMap,N=new WeakMap,q=new WeakMap,F=new WeakMap,Q=new WeakMap,Z=new WeakMap,P=new WeakMap,K=new WeakMap,tt=new WeakMap,lt=new WeakMap,L=new WeakMap,Tt=new WeakMap,n=new WeakSet,Yt=function(){let e=new Ft(t(this,$)),i=new Ft(t(this,$));f(this,P,e),f(this,Z,i);let s=this.ttlAutopurge?new Array(t(this,$)):void 0;f(this,K,s),f(this,xt,(h,c,m=t(this,X).now())=>{i[h]=c!==0?m:0,e[h]=c,r(h,c);}),f(this,ft,h=>{i[h]=e[h]!==0?t(this,X).now():0,r(h,e[h]);});let r=this.ttlAutopurge?(h,c)=>{if(s?.[h]&&(clearTimeout(s[h]),s[h]=void 0),c&&c!==0&&s){let m=setTimeout(()=>{t(this,W).call(this,h)&&l(this,n,nt).call(this,t(this,w)[h],"expire");},c+1);m.unref&&m.unref(),s[h]=m;}}:()=>{};f(this,it,(h,c)=>{if(e[c]){let m=e[c],I=i[c];if(!m||!I)return;h.ttl=m,h.start=I,h.now=a||o();let _=h.now-I;h.remainingTTL=m-_;}});let a=0,o=()=>{let h=t(this,X).now();if(this.ttlResolution>0){a=h;let c=setTimeout(()=>a=0,this.ttlResolution);c.unref&&c.unref();}return h};this.getRemainingTTL=h=>{let c=t(this,R).get(h);if(c===void 0)return 0;let m=e[c],I=i[c];if(!m||!I)return 1/0;let _=(a||o())-I;return m-_},f(this,W,h=>{let c=i[h],m=e[h];return !!m&&!!c&&(a||o())-c>m});},ft=new WeakMap,it=new WeakMap,xt=new WeakMap,W=new WeakMap,Zt=function(){let e=new Ft(t(this,$));f(this,J,0),f(this,Q,e),f(this,pt,i=>{f(this,J,t(this,J)-e[i]),e[i]=0;}),f(this,Rt,(i,s,r,a)=>{if(l(this,n,O).call(this,s))return 0;if(!rt(r))if(a){if(typeof a!="function")throw new TypeError("sizeCalculation must be a function");if(r=a(s,i),!rt(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}),f(this,bt,(i,s,r)=>{if(e[i]=s,t(this,z)){let a=t(this,z)-e[i];for(;t(this,J)>a;)l(this,n,Ct).call(this,true);}f(this,J,t(this,J)+e[i]),r&&(r.entrySize=s,r.totalCalculatedSize=t(this,J));});},pt=new WeakMap,bt=new WeakMap,Rt=new WeakMap,ot=function*({allowStale:e=this.allowStale}={}){if(t(this,D))for(let i=t(this,N);!(!l(this,n,Pt).call(this,i)||((e||!t(this,W).call(this,i))&&(yield i),i===t(this,C)));)i=t(this,Y)[i];},at=function*({allowStale:e=this.allowStale}={}){if(t(this,D))for(let i=t(this,C);!(!l(this,n,Pt).call(this,i)||((e||!t(this,W).call(this,i))&&(yield i),i===t(this,N)));)i=t(this,V)[i];},Pt=function(e){return e!==void 0&&t(this,R).get(t(this,w)[e])===e},Ct=function(e){var a;let i=t(this,C),s=t(this,w)[i],r=t(this,p)[i];return t(this,lt)&&l(this,n,O).call(this,r)?r.__abortController.abort(new Error("evicted")):(t(this,tt)||t(this,L))&&(t(this,tt)&&((a=t(this,k))==null||a.call(this,r,s,"evict")),t(this,L)&&t(this,F)?.push([r,s,"evict"])),t(this,pt).call(this,i),t(this,K)?.[i]&&(clearTimeout(t(this,K)[i]),t(this,K)[i]=void 0),e&&(t(this,w)[i]=void 0,t(this,p)[i]=void 0,t(this,q).push(i)),t(this,D)===1?(f(this,C,f(this,N,0)),t(this,q).length=0):f(this,C,t(this,V)[i]),t(this,R).delete(s),It(this,D)._--,i},Mt=function(e,i,s,r){let a=i===void 0?void 0:t(this,p)[i];if(l(this,n,O).call(this,a))return a;let o=new Gt,{signal:h}=s;h?.addEventListener("abort",()=>o.abort(h.reason),{signal:o.signal});let c={signal:o.signal,options:s,context:r},m=(A,v=false)=>{let{aborted:g}=o.signal,M=s.ignoreFetchAbort&&A!==void 0,U=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&A!==void 0);if(s.status&&(g&&!v?(s.status.fetchAborted=true,s.status.fetchError=o.signal.reason,M&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),g&&!M&&!v)return _(o.signal.reason,U);let G=b,x=t(this,p)[i];return (x===b||M&&v&&x===void 0)&&(A===void 0?G.__staleWhileFetching!==void 0?t(this,p)[i]=G.__staleWhileFetching:l(this,n,nt).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,A,c.options))),A},I=A=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=A),_(A,false)),_=(A,v)=>{let{aborted:g}=o.signal,M=g&&s.allowStaleOnFetchAbort,U=M||s.allowStaleOnFetchRejection,G=U||s.noDeleteOnFetchRejection,x=b;if(t(this,p)[i]===b&&(!G||!v&&x.__staleWhileFetching===void 0?l(this,n,nt).call(this,e,"fetch"):M||(t(this,p)[i]=x.__staleWhileFetching)),U)return s.status&&x.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),x.__staleWhileFetching;if(x.__returned===x)throw A},y=(A,v)=>{var M;let g=(M=t(this,mt))==null?void 0:M.call(this,e,a,c);g&&g instanceof Promise&&g.then(U=>A(U===void 0?void 0:U),v),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(A(void 0),s.allowStaleOnFetchAbort&&(A=U=>m(U,true)));});};s.status&&(s.status.fetchDispatched=true);let b=new Promise(y).then(m,I),T=Object.assign(b,{__abortController:o,__staleWhileFetching:a,__returned:void 0});return i===void 0?(this.set(e,T,{...c.options,status:void 0}),i=t(this,R).get(e)):t(this,p)[i]=T,T},O=function(e){if(!t(this,lt))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Gt},Kt=function(e,i){t(this,Y)[i]=e,t(this,V)[e]=i;},wt=function(e){e!==t(this,N)&&(e===t(this,C)?f(this,C,t(this,V)[e]):l(this,n,Kt).call(this,t(this,Y)[e],t(this,V)[e]),l(this,n,Kt).call(this,t(this,N),e),f(this,N,e));},nt=function(e,i){var r,a;let s=false;if(t(this,D)!==0){let o=t(this,R).get(e);if(o!==void 0)if(t(this,K)?.[o]&&(clearTimeout(t(this,K)?.[o]),t(this,K)[o]=void 0),s=true,t(this,D)===1)l(this,n,Wt).call(this,i);else {t(this,pt).call(this,o);let h=t(this,p)[o];if(l(this,n,O).call(this,h)?h.__abortController.abort(new Error("deleted")):(t(this,tt)||t(this,L))&&(t(this,tt)&&((r=t(this,k))==null||r.call(this,h,e,i)),t(this,L)&&t(this,F)?.push([h,e,i])),t(this,R).delete(e),t(this,w)[o]=void 0,t(this,p)[o]=void 0,o===t(this,N))f(this,N,t(this,Y)[o]);else if(o===t(this,C))f(this,C,t(this,V)[o]);else {let c=t(this,Y)[o];t(this,V)[c]=t(this,V)[o];let m=t(this,V)[o];t(this,Y)[m]=t(this,Y)[o];}It(this,D)._--,t(this,q).push(o);}}if(t(this,L)&&t(this,F)?.length){let o=t(this,F),h;for(;h=o?.shift();)(a=t(this,B))==null||a.call(this,...h);}return s},Wt=function(e){var i,s;for(let r of l(this,n,at).call(this,{allowStale:true})){let a=t(this,p)[r];if(l(this,n,O).call(this,a))a.__abortController.abort(new Error("deleted"));else {let o=t(this,w)[r];t(this,tt)&&((i=t(this,k))==null||i.call(this,a,o,e)),t(this,L)&&t(this,F)?.push([a,o,e]);}}if(t(this,R).clear(),t(this,p).fill(void 0),t(this,w).fill(void 0),t(this,P)&&t(this,Z)){t(this,P).fill(0),t(this,Z).fill(0);for(let r of t(this,K)??[])r!==void 0&&clearTimeout(r);t(this,K)?.fill(void 0);}if(t(this,Q)&&t(this,Q).fill(0),f(this,C,0),f(this,N,0),t(this,q).length=0,f(this,J,0),f(this,D,0),t(this,L)&&t(this,F)){let r=t(this,F),a;for(;a=r?.shift();)(s=t(this,B))==null||s.call(this,...a);}},yt);var At=class{constructor(e){E(this,"cache");E(this,"map",new Map);this.cache=new Qt({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 Ht;(_=>{_.storage=new At({cacheSize:50}),_.defaultStorage=new At({cacheSize:10}),_.tempStorageDeadlines=new Map;let s;function r(y){_.tempStorageDeadlines.forEach((b,T)=>{b>y&&(_.storage.delete(`${ht}:${T}`),s?.onClearOldTempVariable?.(T),_.tempStorageDeadlines.delete(T));});}_.clearOldTempVariables=r;function a(y){s=y;}_.setExternalStoreHandler=a;function o(y,b,T){T==null?_.storage.delete(`${y}:${b}`):_.storage.set(`${y}:${b}`,T),s?.onSetVariable?.(b,T);}_.setVariable=o;function h(y,b){let T=_.storage.get(`${y}:${b}`);return Ot(T)}_.getVariable=h;function c(y,b){_.storage.delete(`${y}:${b}`),s?.onRemoveVariable?.(b);}_.removeVariable=c;function m(y,b){let T=_.storage.get(Nt)||[];if(b)T.includes(y)||T.push(y);else {let A=T.indexOf(y);A>-1&&T.splice(A,1);}_.storage.set(Nt,T);}_.setFlag=m;function I(y){return (_.storage.get(Nt)||[]).includes(y)}_.getFlag=I;})(Ht||(Ht={}));var S=Ht;var Dt=class{get base(){return S.storage.map}get cache(){return S.storage.cache}get tempStorageDeadlines(){return S.tempStorageDeadlines}set default(e){Object.entries(e).forEach(([i,s])=>{S.defaultStorage.map.set(i,s);});}set(e,i){return S.setVariable(st,e,i)}get(e){let i=S.getVariable(ht,e);return i===void 0&&(i=S.getVariable(st,e)),i===void 0&&(i=Ot(S.defaultStorage.get(e))),i}remove(e){return this.removeTempVariable(e),S.removeVariable(st,e)}setTempVariable(e,i){if(i==null){this.removeTempVariable(e);return}else S.setVariable(ht,e,i),this.tempStorageDeadlines.has(e)||this.tempStorageDeadlines.set(e,core.GameUnifier.openedLabels);}removeTempVariable(e){S.removeVariable(ht,e),this.tempStorageDeadlines.has(e)&&this.tempStorageDeadlines.delete(e);}setFlag(e,i){return S.setFlag(e,i)}getFlag(e){return S.getFlag(e)}setStorageHandler(e){S.setExternalStoreHandler(e);}clear(){this.base.clear(),this.cache.clear(),this.tempStorageDeadlines.clear();}export(){let e=[];[...this.base.keys()].forEach(s=>{e.push({key:s,value:this.base.get(s)});});let i=[];return [...S.tempStorageDeadlines.keys()].forEach(s=>{i.push({key:s,value:this.tempStorageDeadlines.get(s)});}),Ot({main:e,tempDeadlines:i})}restore(e){this.clear();try{e?(e.base?.forEach(i=>{switch(i.key){case "___current_dialogue_memory___":S.setVariable(H,j.CURRENT_DIALOGUE_MEMORY_KEY,i.value);break;case "___last_dialogue_added_in_step_memory___":S.setVariable(H,j.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY,i.value);break;case "___current_menu_options_memory___":S.setVariable(H,j.CURRENT_MENU_OPTIONS_MEMORY_KEY,i.value);break;case "___last_menu_options_added_in_step_memory___":S.setVariable(H,j.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY,i.value);break;case "_input_value_":S.setVariable(H,j.CURRENT_INPUT_VALUE_MEMORY_KEY,i.value);break;case "___last_input_added_in_step_memory___":S.setVariable(H,j.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY,i.value);break;case "___current_input_info_memory___":S.setVariable(H,j.CURRENT_INPUT_INFO_MEMORY_KEY,i.value);break;case "___opened_labels_counter___":S.setVariable(H,j.OPENED_LABELS_COUNTER_KEY,i.value);break;case "___all_choices_made___":S.setVariable(H,j.ALL_CHOICES_MADE_KEY,i.value);break;case "___current_step_times_counter___":S.setVariable(H,j.CURRENT_STEP_TIMES_COUNTER_KEY,i.value);break;case "___last_step_glued___":S.setVariable(H,j.LAST_STEP_GLUED,i.value);break;default:S.setVariable(st,i.key,i.value);}}),e.temp?.forEach(i=>{S.setVariable(ht,i.key,i.value);}),e.flags?.forEach(i=>{S.setFlag(i,!0);}),e.main?.forEach(i=>{this.base.set(i.key,i.value);}),e.tempDeadlines?.forEach(i=>{this.tempStorageDeadlines.set(i.key,i.value);})):ct.warn("No storage data found");}catch(i){ct.error("Error importing data",i);}}};var Vt=class{constructor(e,i){E(this,"id");E(this,"categoryId");this.categoryId=e,this.id=i,this.migrateOldStorage();}migrateOldStorage(e=this.categoryId){let i=S.getVariable(st,e);i&&(Object.entries(i).forEach(([s,r])=>{typeof r=="object"&&r!==null&&Object.entries(r).forEach(([a,o])=>{S.setVariable(this.categoryId,`${s}:${a}`,o);});}),S.removeVariable(st,e));}setStorageProperty(e,i){S.setVariable(this.categoryId,`${this.id}:${e}`,i);}getStorageProperty(e,i=this.id){return S.getVariable(this.categoryId,`${i}:${e}`)}};var Ve=new Dt;exports.StorageManagerStatic=S;exports.StoredClassModel=Vt;exports.storage=Ve;
1
+ 'use strict';var core=require('@drincs/pixi-vn/core');var te=Object.defineProperty;var jt=u=>{throw TypeError(u)};var ee=(u,e,i)=>e in u?te(u,e,{enumerable:true,configurable:true,writable:true,value:i}):u[e]=i;var E=(u,e,i)=>ee(u,typeof e!="symbol"?e+"":e,i),Ut=(u,e,i)=>e.has(u)||jt("Cannot "+i);var t=(u,e,i)=>(Ut(u,e,"read from private field"),i?i.call(u):e.get(u)),d=(u,e,i)=>e.has(u)?jt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(u):e.set(u,i),f=(u,e,i,s)=>(Ut(u,e,"write to private field"),e.set(u,i),i),l=(u,e,i)=>(Ut(u,e,"access private method"),i);var It=(u,e,i,s)=>({set _(r){f(u,e,r);},get _(){return t(u,e,s)}});var st="storage",ht="temp",H="narration",Nt="flags",j={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=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Xt=new Set,zt=typeof process=="object"&&process?process:{},Jt=(u,e,i,s)=>{typeof zt.emitWarning=="function"?zt.emitWarning(u,e,i,s):console.error(`[${i}] ${e}: ${u}`);},Gt=globalThis.AbortController,$t=globalThis.AbortSignal;if(typeof Gt>"u"){$t=class{constructor(){E(this,"onabort");E(this,"_onabort",[]);E(this,"reason");E(this,"aborted",false);}addEventListener(i,s){this._onabort.push(s);}},Gt=class{constructor(){E(this,"signal",new $t);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 u=zt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{u&&(u=false,Jt("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 se=u=>!Xt.has(u);var rt=u=>u&&u===Math.floor(u)&&u>0&&isFinite(u),qt=u=>rt(u)?u<=Math.pow(2,8)?Uint8Array:u<=Math.pow(2,16)?Uint16Array:u<=Math.pow(2,32)?Uint32Array:u<=Number.MAX_SAFE_INTEGER?Ft:null:null,Ft=class extends Array{constructor(u){super(u),this.fill(0);}},et,St,re=(et=class{constructor(e,i){E(this,"heap");E(this,"length");if(!t(et,St))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}static create(e){let i=qt(e);if(!i)return [];f(et,St,true);let s=new et(e,i);return f(et,St,false),s}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},St=new WeakMap,d(et,St,false),et),kt,Bt,$,z,k,ct,B,mt,Et,X,D,J,R,v,p,V,Y,C,N,q,F,Q,Z,P,K,tt,lt,L,Tt,n,Yt,ut,it,vt,W,Zt,ft,bt,xt,at,ot,Pt,Ct,Mt,w,Kt,wt,nt,Wt,At,Qt=(At=class{constructor(e){d(this,n);d(this,$);d(this,z);d(this,k);d(this,ct);d(this,B);d(this,mt);d(this,Et);d(this,X);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");d(this,D);d(this,J);d(this,R);d(this,v);d(this,p);d(this,V);d(this,Y);d(this,C);d(this,N);d(this,q);d(this,F);d(this,Q);d(this,Z);d(this,P);d(this,K);d(this,tt);d(this,lt);d(this,L);d(this,Tt);d(this,ut,()=>{});d(this,it,()=>{});d(this,vt,()=>{});d(this,W,()=>false);d(this,ft,e=>{});d(this,bt,(e,i,s)=>{});d(this,xt,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});E(this,kt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:o,updateAgeOnGet:a,updateAgeOnHas:h,allowStale:c,dispose:m,onInsert:I,disposeAfter:g,noDisposeOnSet:A,noUpdateTTL:b,maxSize:T=0,maxEntrySize:y=0,sizeCalculation:O,fetchMethod:_,memoMethod:M,noDeleteOnFetchRejection:U,noDeleteOnStaleGet:G,allowStaleOnFetchRejection:x,allowStaleOnFetchAbort:Ot,ignoreFetchAbort:gt,perf:_t}=e;if(_t!==void 0&&typeof _t?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(f(this,X,_t??ie),i!==0&&!rt(i))throw new TypeError("max option must be a nonnegative integer");let dt=i?qt(i):Array;if(!dt)throw new Error("invalid max value: "+i);if(f(this,$,i),f(this,z,T),this.maxEntrySize=y||t(this,z),this.sizeCalculation=O,this.sizeCalculation){if(!t(this,z)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(M!==void 0&&typeof M!="function")throw new TypeError("memoMethod must be a function if defined");if(f(this,Et,M),_!==void 0&&typeof _!="function")throw new TypeError("fetchMethod must be a function if specified");if(f(this,mt,_),f(this,lt,!!_),f(this,R,new Map),f(this,v,new Array(i).fill(void 0)),f(this,p,new Array(i).fill(void 0)),f(this,V,new dt(i)),f(this,Y,new dt(i)),f(this,C,0),f(this,N,0),f(this,q,re.create(i)),f(this,D,0),f(this,J,0),typeof m=="function"&&f(this,k,m),typeof I=="function"&&f(this,ct,I),typeof g=="function"?(f(this,B,g),f(this,F,[])):(f(this,B,void 0),f(this,F,void 0)),f(this,tt,!!t(this,k)),f(this,Tt,!!t(this,ct)),f(this,L,!!t(this,B)),this.noDisposeOnSet=!!A,this.noUpdateTTL=!!b,this.noDeleteOnFetchRejection=!!U,this.allowStaleOnFetchRejection=!!x,this.allowStaleOnFetchAbort=!!Ot,this.ignoreFetchAbort=!!gt,this.maxEntrySize!==0){if(t(this,z)!==0&&!rt(t(this,z)))throw new TypeError("maxSize must be a positive integer if specified");if(!rt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");l(this,n,Zt).call(this);}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!G,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!h,this.ttlResolution=rt(r)||r===0?r:1,this.ttlAutopurge=!!o,this.ttl=s||0,this.ttl){if(!rt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");l(this,n,Yt).call(this);}if(t(this,$)===0&&this.ttl===0&&t(this,z)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,$)&&!t(this,z)){let Lt="LRU_CACHE_UNBOUNDED";se(Lt)&&(Xt.add(Lt),Jt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Lt,At));}}get perf(){return t(this,X)}static unsafeExposeInternals(e){return {starts:t(e,Z),ttls:t(e,P),autopurgeTimers:t(e,K),sizes:t(e,Q),keyMap:t(e,R),keyList:t(e,v),valList:t(e,p),next:t(e,V),prev:t(e,Y),get head(){return t(e,C)},get tail(){return t(e,N)},free:t(e,q),isBackgroundFetch:i=>{var s;return l(s=e,n,w).call(s,i)},backgroundFetch:(i,s,r,o)=>{var a;return l(a=e,n,Mt).call(a,i,s,r,o)},moveToTail:i=>{var s;return l(s=e,n,wt).call(s,i)},indexes:i=>{var s;return l(s=e,n,at).call(s,i)},rindexes:i=>{var s;return l(s=e,n,ot).call(s,i)},isStale:i=>{var s;return t(s=e,W).call(s,i)}}}get max(){return t(this,$)}get maxSize(){return t(this,z)}get calculatedSize(){return t(this,J)}get size(){return t(this,D)}get fetchMethod(){return t(this,mt)}get memoMethod(){return t(this,Et)}get dispose(){return t(this,k)}get onInsert(){return t(this,ct)}get disposeAfter(){return t(this,B)}getRemainingTTL(e){return t(this,R).has(e)?1/0:0}*entries(){for(let e of l(this,n,at).call(this))t(this,p)[e]!==void 0&&t(this,v)[e]!==void 0&&!l(this,n,w).call(this,t(this,p)[e])&&(yield [t(this,v)[e],t(this,p)[e]]);}*rentries(){for(let e of l(this,n,ot).call(this))t(this,p)[e]!==void 0&&t(this,v)[e]!==void 0&&!l(this,n,w).call(this,t(this,p)[e])&&(yield [t(this,v)[e],t(this,p)[e]]);}*keys(){for(let e of l(this,n,at).call(this)){let i=t(this,v)[e];i!==void 0&&!l(this,n,w).call(this,t(this,p)[e])&&(yield i);}}*rkeys(){for(let e of l(this,n,ot).call(this)){let i=t(this,v)[e];i!==void 0&&!l(this,n,w).call(this,t(this,p)[e])&&(yield i);}}*values(){for(let e of l(this,n,at).call(this))t(this,p)[e]!==void 0&&!l(this,n,w).call(this,t(this,p)[e])&&(yield t(this,p)[e]);}*rvalues(){for(let e of l(this,n,ot).call(this))t(this,p)[e]!==void 0&&!l(this,n,w).call(this,t(this,p)[e])&&(yield t(this,p)[e]);}[(Bt=Symbol.iterator,kt=Symbol.toStringTag,Bt)](){return this.entries()}find(e,i={}){for(let s of l(this,n,at).call(this)){let r=t(this,p)[s],o=l(this,n,w).call(this,r)?r.__staleWhileFetching:r;if(o!==void 0&&e(o,t(this,v)[s],this))return this.get(t(this,v)[s],i)}}forEach(e,i=this){for(let s of l(this,n,at).call(this)){let r=t(this,p)[s],o=l(this,n,w).call(this,r)?r.__staleWhileFetching:r;o!==void 0&&e.call(i,o,t(this,v)[s],this);}}rforEach(e,i=this){for(let s of l(this,n,ot).call(this)){let r=t(this,p)[s],o=l(this,n,w).call(this,r)?r.__staleWhileFetching:r;o!==void 0&&e.call(i,o,t(this,v)[s],this);}}purgeStale(){let e=false;for(let i of l(this,n,ot).call(this,{allowStale:true}))t(this,W).call(this,i)&&(l(this,n,nt).call(this,t(this,v)[i],"expire"),e=true);return e}info(e){let i=t(this,R).get(e);if(i===void 0)return;let s=t(this,p)[i],r=l(this,n,w).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let o={value:r};if(t(this,P)&&t(this,Z)){let a=t(this,P)[i],h=t(this,Z)[i];if(a&&h){let c=a-(t(this,X).now()-h);o.ttl=c,o.start=Date.now();}}return t(this,Q)&&(o.size=t(this,Q)[i]),o}dump(){let e=[];for(let i of l(this,n,at).call(this,{allowStale:true})){let s=t(this,v)[i],r=t(this,p)[i],o=l(this,n,w).call(this,r)?r.__staleWhileFetching:r;if(o===void 0||s===void 0)continue;let a={value:o};if(t(this,P)&&t(this,Z)){a.ttl=t(this,P)[i];let h=t(this,X).now()-t(this,Z)[i];a.start=Math.floor(Date.now()-h);}t(this,Q)&&(a.size=t(this,Q)[i]),e.unshift([s,a]);}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 A,b,T,y;if(i===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:o,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:h=this.sizeCalculation,status:c}=s,{noUpdateTTL:m=this.noUpdateTTL}=s,I=t(this,xt).call(this,e,i,s.size||0,h);if(this.maxEntrySize&&I>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=true),l(this,n,nt).call(this,e,"set"),this;let g=t(this,D)===0?void 0:t(this,R).get(e);if(g===void 0)g=t(this,D)===0?t(this,N):t(this,q).length!==0?t(this,q).pop():t(this,D)===t(this,$)?l(this,n,Ct).call(this,false):t(this,D),t(this,v)[g]=e,t(this,p)[g]=i,t(this,R).set(e,g),t(this,V)[t(this,N)]=g,t(this,Y)[g]=t(this,N),f(this,N,g),It(this,D)._++,t(this,bt).call(this,g,I,c),c&&(c.set="add"),m=false,t(this,Tt)&&((A=t(this,ct))==null||A.call(this,i,e,"add"));else {l(this,n,wt).call(this,g);let O=t(this,p)[g];if(i!==O){if(t(this,lt)&&l(this,n,w).call(this,O)){O.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:_}=O;_!==void 0&&!a&&(t(this,tt)&&((b=t(this,k))==null||b.call(this,_,e,"set")),t(this,L)&&t(this,F)?.push([_,e,"set"]));}else a||(t(this,tt)&&((T=t(this,k))==null||T.call(this,O,e,"set")),t(this,L)&&t(this,F)?.push([O,e,"set"]));if(t(this,ft).call(this,g),t(this,bt).call(this,g,I,c),t(this,p)[g]=i,c){c.set="replace";let _=O&&l(this,n,w).call(this,O)?O.__staleWhileFetching:O;_!==void 0&&(c.oldValue=_);}}else c&&(c.set="update");t(this,Tt)&&this.onInsert?.(i,e,i===O?"update":"replace");}if(r!==0&&!t(this,P)&&l(this,n,Yt).call(this),t(this,P)&&(m||t(this,vt).call(this,g,r,o),c&&t(this,it).call(this,c,g)),!a&&t(this,L)&&t(this,F)){let O=t(this,F),_;for(;_=O?.shift();)(y=t(this,B))==null||y.call(this,..._);}return this}pop(){var e;try{for(;t(this,D);){let i=t(this,p)[t(this,C)];if(l(this,n,Ct).call(this,!0),l(this,n,w).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(t(this,L)&&t(this,F)){let i=t(this,F),s;for(;s=i?.shift();)(e=t(this,B))==null||e.call(this,...s);}}}has(e,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,o=t(this,R).get(e);if(o!==void 0){let a=t(this,p)[o];if(l(this,n,w).call(this,a)&&a.__staleWhileFetching===void 0)return false;if(t(this,W).call(this,o))r&&(r.has="stale",t(this,it).call(this,r,o));else return s&&t(this,ut).call(this,o),r&&(r.has="hit",t(this,it).call(this,r,o)),true}else r&&(r.has="miss");return false}peek(e,i={}){let{allowStale:s=this.allowStale}=i,r=t(this,R).get(e);if(r===void 0||!s&&t(this,W).call(this,r))return;let o=t(this,p)[r];return l(this,n,w).call(this,o)?o.__staleWhileFetching:o}async fetch(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:h=this.noDisposeOnSet,size:c=0,sizeCalculation:m=this.sizeCalculation,noUpdateTTL:I=this.noUpdateTTL,noDeleteOnFetchRejection:g=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:A=this.allowStaleOnFetchRejection,ignoreFetchAbort:b=this.ignoreFetchAbort,allowStaleOnFetchAbort:T=this.allowStaleOnFetchAbort,context:y,forceRefresh:O=false,status:_,signal:M}=i;if(!t(this,lt))return _&&(_.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:o,status:_});let U={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:o,ttl:a,noDisposeOnSet:h,size:c,sizeCalculation:m,noUpdateTTL:I,noDeleteOnFetchRejection:g,allowStaleOnFetchRejection:A,allowStaleOnFetchAbort:T,ignoreFetchAbort:b,status:_,signal:M},G=t(this,R).get(e);if(G===void 0){_&&(_.fetch="miss");let x=l(this,n,Mt).call(this,e,G,U,y);return x.__returned=x}else {let x=t(this,p)[G];if(l(this,n,w).call(this,x)){let dt=s&&x.__staleWhileFetching!==void 0;return _&&(_.fetch="inflight",dt&&(_.returnedStale=true)),dt?x.__staleWhileFetching:x.__returned=x}let Ot=t(this,W).call(this,G);if(!O&&!Ot)return _&&(_.fetch="hit"),l(this,n,wt).call(this,G),r&&t(this,ut).call(this,G),_&&t(this,it).call(this,_,G),x;let gt=l(this,n,Mt).call(this,e,G,U,y),_t=gt.__staleWhileFetching!==void 0&&s;return _&&(_.fetch=Ot?"stale":"refresh",_t&&Ot&&(_.returnedStale=true)),_t?gt.__staleWhileFetching:gt.__returned=gt}}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:o,...a}=i,h=this.get(e,a);if(!o&&h!==void 0)return h;let c=s(e,h,{options:a,context:r});return this.set(e,c,a),c}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:a}=i,h=t(this,R).get(e);if(h!==void 0){let c=t(this,p)[h],m=l(this,n,w).call(this,c);return a&&t(this,it).call(this,a,h),t(this,W).call(this,h)?(a&&(a.get="stale"),m?(a&&s&&c.__staleWhileFetching!==void 0&&(a.returnedStale=true),s?c.__staleWhileFetching:void 0):(o||l(this,n,nt).call(this,e,"expire"),a&&s&&(a.returnedStale=true),s?c:void 0)):(a&&(a.get="hit"),m?c.__staleWhileFetching:(l(this,n,wt).call(this,h),r&&t(this,ut).call(this,h),c))}else a&&(a.get="miss");}delete(e){return l(this,n,nt).call(this,e,"delete")}clear(){return l(this,n,Wt).call(this,"delete")}},$=new WeakMap,z=new WeakMap,k=new WeakMap,ct=new WeakMap,B=new WeakMap,mt=new WeakMap,Et=new WeakMap,X=new WeakMap,D=new WeakMap,J=new WeakMap,R=new WeakMap,v=new WeakMap,p=new WeakMap,V=new WeakMap,Y=new WeakMap,C=new WeakMap,N=new WeakMap,q=new WeakMap,F=new WeakMap,Q=new WeakMap,Z=new WeakMap,P=new WeakMap,K=new WeakMap,tt=new WeakMap,lt=new WeakMap,L=new WeakMap,Tt=new WeakMap,n=new WeakSet,Yt=function(){let e=new Ft(t(this,$)),i=new Ft(t(this,$));f(this,P,e),f(this,Z,i);let s=this.ttlAutopurge?new Array(t(this,$)):void 0;f(this,K,s),f(this,vt,(h,c,m=t(this,X).now())=>{i[h]=c!==0?m:0,e[h]=c,r(h,c);}),f(this,ut,h=>{i[h]=e[h]!==0?t(this,X).now():0,r(h,e[h]);});let r=this.ttlAutopurge?(h,c)=>{if(s?.[h]&&(clearTimeout(s[h]),s[h]=void 0),c&&c!==0&&s){let m=setTimeout(()=>{t(this,W).call(this,h)&&l(this,n,nt).call(this,t(this,v)[h],"expire");},c+1);m.unref&&m.unref(),s[h]=m;}}:()=>{};f(this,it,(h,c)=>{if(e[c]){let m=e[c],I=i[c];if(!m||!I)return;h.ttl=m,h.start=I,h.now=o||a();let g=h.now-I;h.remainingTTL=m-g;}});let o=0,a=()=>{let h=t(this,X).now();if(this.ttlResolution>0){o=h;let c=setTimeout(()=>o=0,this.ttlResolution);c.unref&&c.unref();}return h};this.getRemainingTTL=h=>{let c=t(this,R).get(h);if(c===void 0)return 0;let m=e[c],I=i[c];if(!m||!I)return 1/0;let g=(o||a())-I;return m-g},f(this,W,h=>{let c=i[h],m=e[h];return !!m&&!!c&&(o||a())-c>m});},ut=new WeakMap,it=new WeakMap,vt=new WeakMap,W=new WeakMap,Zt=function(){let e=new Ft(t(this,$));f(this,J,0),f(this,Q,e),f(this,ft,i=>{f(this,J,t(this,J)-e[i]),e[i]=0;}),f(this,xt,(i,s,r,o)=>{if(l(this,n,w).call(this,s))return 0;if(!rt(r))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(r=o(s,i),!rt(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}),f(this,bt,(i,s,r)=>{if(e[i]=s,t(this,z)){let o=t(this,z)-e[i];for(;t(this,J)>o;)l(this,n,Ct).call(this,true);}f(this,J,t(this,J)+e[i]),r&&(r.entrySize=s,r.totalCalculatedSize=t(this,J));});},ft=new WeakMap,bt=new WeakMap,xt=new WeakMap,at=function*({allowStale:e=this.allowStale}={}){if(t(this,D))for(let i=t(this,N);!(!l(this,n,Pt).call(this,i)||((e||!t(this,W).call(this,i))&&(yield i),i===t(this,C)));)i=t(this,Y)[i];},ot=function*({allowStale:e=this.allowStale}={}){if(t(this,D))for(let i=t(this,C);!(!l(this,n,Pt).call(this,i)||((e||!t(this,W).call(this,i))&&(yield i),i===t(this,N)));)i=t(this,V)[i];},Pt=function(e){return e!==void 0&&t(this,R).get(t(this,v)[e])===e},Ct=function(e){var o;let i=t(this,C),s=t(this,v)[i],r=t(this,p)[i];return t(this,lt)&&l(this,n,w).call(this,r)?r.__abortController.abort(new Error("evicted")):(t(this,tt)||t(this,L))&&(t(this,tt)&&((o=t(this,k))==null||o.call(this,r,s,"evict")),t(this,L)&&t(this,F)?.push([r,s,"evict"])),t(this,ft).call(this,i),t(this,K)?.[i]&&(clearTimeout(t(this,K)[i]),t(this,K)[i]=void 0),e&&(t(this,v)[i]=void 0,t(this,p)[i]=void 0,t(this,q).push(i)),t(this,D)===1?(f(this,C,f(this,N,0)),t(this,q).length=0):f(this,C,t(this,V)[i]),t(this,R).delete(s),It(this,D)._--,i},Mt=function(e,i,s,r){let o=i===void 0?void 0:t(this,p)[i];if(l(this,n,w).call(this,o))return o;let a=new Gt,{signal:h}=s;h?.addEventListener("abort",()=>a.abort(h.reason),{signal:a.signal});let c={signal:a.signal,options:s,context:r},m=(y,O=false)=>{let{aborted:_}=a.signal,M=s.ignoreFetchAbort&&y!==void 0,U=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&y!==void 0);if(s.status&&(_&&!O?(s.status.fetchAborted=true,s.status.fetchError=a.signal.reason,M&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),_&&!M&&!O)return g(a.signal.reason,U);let G=b,x=t(this,p)[i];return (x===b||M&&O&&x===void 0)&&(y===void 0?G.__staleWhileFetching!==void 0?t(this,p)[i]=G.__staleWhileFetching:l(this,n,nt).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,y,c.options))),y},I=y=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=y),g(y,false)),g=(y,O)=>{let{aborted:_}=a.signal,M=_&&s.allowStaleOnFetchAbort,U=M||s.allowStaleOnFetchRejection,G=U||s.noDeleteOnFetchRejection,x=b;if(t(this,p)[i]===b&&(!G||!O&&x.__staleWhileFetching===void 0?l(this,n,nt).call(this,e,"fetch"):M||(t(this,p)[i]=x.__staleWhileFetching)),U)return s.status&&x.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),x.__staleWhileFetching;if(x.__returned===x)throw y},A=(y,O)=>{var M;let _=(M=t(this,mt))==null?void 0:M.call(this,e,o,c);_&&_ instanceof Promise&&_.then(U=>y(U===void 0?void 0:U),O),a.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(y(void 0),s.allowStaleOnFetchAbort&&(y=U=>m(U,true)));});};s.status&&(s.status.fetchDispatched=true);let b=new Promise(A).then(m,I),T=Object.assign(b,{__abortController:a,__staleWhileFetching:o,__returned:void 0});return i===void 0?(this.set(e,T,{...c.options,status:void 0}),i=t(this,R).get(e)):t(this,p)[i]=T,T},w=function(e){if(!t(this,lt))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Gt},Kt=function(e,i){t(this,Y)[i]=e,t(this,V)[e]=i;},wt=function(e){e!==t(this,N)&&(e===t(this,C)?f(this,C,t(this,V)[e]):l(this,n,Kt).call(this,t(this,Y)[e],t(this,V)[e]),l(this,n,Kt).call(this,t(this,N),e),f(this,N,e));},nt=function(e,i){var r,o;let s=false;if(t(this,D)!==0){let a=t(this,R).get(e);if(a!==void 0)if(t(this,K)?.[a]&&(clearTimeout(t(this,K)?.[a]),t(this,K)[a]=void 0),s=true,t(this,D)===1)l(this,n,Wt).call(this,i);else {t(this,ft).call(this,a);let h=t(this,p)[a];if(l(this,n,w).call(this,h)?h.__abortController.abort(new Error("deleted")):(t(this,tt)||t(this,L))&&(t(this,tt)&&((r=t(this,k))==null||r.call(this,h,e,i)),t(this,L)&&t(this,F)?.push([h,e,i])),t(this,R).delete(e),t(this,v)[a]=void 0,t(this,p)[a]=void 0,a===t(this,N))f(this,N,t(this,Y)[a]);else if(a===t(this,C))f(this,C,t(this,V)[a]);else {let c=t(this,Y)[a];t(this,V)[c]=t(this,V)[a];let m=t(this,V)[a];t(this,Y)[m]=t(this,Y)[a];}It(this,D)._--,t(this,q).push(a);}}if(t(this,L)&&t(this,F)?.length){let a=t(this,F),h;for(;h=a?.shift();)(o=t(this,B))==null||o.call(this,...h);}return s},Wt=function(e){var i,s;for(let r of l(this,n,ot).call(this,{allowStale:true})){let o=t(this,p)[r];if(l(this,n,w).call(this,o))o.__abortController.abort(new Error("deleted"));else {let a=t(this,v)[r];t(this,tt)&&((i=t(this,k))==null||i.call(this,o,a,e)),t(this,L)&&t(this,F)?.push([o,a,e]);}}if(t(this,R).clear(),t(this,p).fill(void 0),t(this,v).fill(void 0),t(this,P)&&t(this,Z)){t(this,P).fill(0),t(this,Z).fill(0);for(let r of t(this,K)??[])r!==void 0&&clearTimeout(r);t(this,K)?.fill(void 0);}if(t(this,Q)&&t(this,Q).fill(0),f(this,C,0),f(this,N,0),t(this,q).length=0,f(this,J,0),f(this,D,0),t(this,L)&&t(this,F)){let r=t(this,F),o;for(;o=r?.shift();)(s=t(this,B))==null||s.call(this,...o);}},At);var yt=class{constructor(e){E(this,"cache");E(this,"map",new Map);this.cache=new Qt({max:e.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){this.cache.clear(),this.map.clear();}delete(e){let i=this.map.delete(e);return i&&this.cache.delete(e),i}get forEach(){return this.map.forEach}get(e){let i=this.cache.get(e);return i||this.map.get(e)}has(e){return this.map.has(e)}set(e,i){return this.map.set(e,i),this.cache.set(e,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var pt;(r=>(r.log=(o,...a)=>console.log(`[Pixi\u2019VN] ${o}`,...a),r.warn=(o,...a)=>console.warn(`[Pixi\u2019VN] ${o}`,...a),r.error=(o,...a)=>console.error(`[Pixi\u2019VN] ${o}`,...a),r.info=(o,...a)=>console.info(`[Pixi\u2019VN] ${o}`,...a)))(pt||(pt={}));function Rt(u){try{if(typeof u>"u")return u;let e=JSON.stringify(u);return JSON.parse(e)}catch(e){throw pt.error("Error creating exportable element",u,e),new core.PixiError("not_json_serializable","Error creating exportable element")}}var Ht;(g=>{g.storage=new yt({cacheSize:50}),g.defaultStorage=new yt({cacheSize:10}),g.tempStorageDeadlines=new Map;let s;function r(A){g.tempStorageDeadlines.forEach((b,T)=>{b>A&&(g.storage.delete(`${ht}:${T}`),s?.onClearOldTempVariable?.(T),g.tempStorageDeadlines.delete(T));});}g.clearOldTempVariables=r;function o(A){s=A;}g.setExternalStoreHandler=o;function a(A,b,T){T==null?g.storage.delete(`${A}:${b}`):g.storage.set(`${A}:${b}`,T),s?.onSetVariable?.(b,T);}g.setVariable=a;function h(A,b){let T=g.storage.get(`${A}:${b}`);return Rt(T)}g.getVariable=h;function c(A,b){g.storage.delete(`${A}:${b}`),s?.onRemoveVariable?.(b);}g.removeVariable=c;function m(A,b){let T=g.storage.get(Nt)||[];if(b)T.includes(A)||T.push(A);else {let y=T.indexOf(A);y>-1&&T.splice(y,1);}g.storage.set(Nt,T);}g.setFlag=m;function I(A){return (g.storage.get(Nt)||[]).includes(A)}g.getFlag=I;})(Ht||(Ht={}));var S=Ht;var Dt=class{get base(){return S.storage.map}get cache(){return S.storage.cache}get tempStorageDeadlines(){return S.tempStorageDeadlines}set default(e){Object.entries(e).forEach(([i,s])=>{S.defaultStorage.map.set(i,s);});}set(e,i){return S.setVariable(st,e,i)}get(e){let i=S.getVariable(ht,e);return i===void 0&&(i=S.getVariable(st,e)),i===void 0&&(i=Rt(S.defaultStorage.get(e))),i}remove(e){return this.removeTempVariable(e),S.removeVariable(st,e)}setTempVariable(e,i){if(i==null){this.removeTempVariable(e);return}else S.setVariable(ht,e,i),this.tempStorageDeadlines.has(e)||this.tempStorageDeadlines.set(e,core.GameUnifier.openedLabels);}removeTempVariable(e){S.removeVariable(ht,e),this.tempStorageDeadlines.has(e)&&this.tempStorageDeadlines.delete(e);}setFlag(e,i){return S.setFlag(e,i)}getFlag(e){return S.getFlag(e)}setStorageHandler(e){S.setExternalStoreHandler(e);}clear(){this.base.clear(),this.cache.clear(),this.tempStorageDeadlines.clear();}export(){let e=[];[...this.base.keys()].forEach(s=>{e.push({key:s,value:this.base.get(s)});});let i=[];return [...S.tempStorageDeadlines.keys()].forEach(s=>{i.push({key:s,value:this.tempStorageDeadlines.get(s)});}),Rt({main:e,tempDeadlines:i})}restore(e){this.clear();try{e?(e.base?.forEach(i=>{switch(i.key){case "___current_dialogue_memory___":S.setVariable(H,j.CURRENT_DIALOGUE_MEMORY_KEY,i.value);break;case "___last_dialogue_added_in_step_memory___":S.setVariable(H,j.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY,i.value);break;case "___current_menu_options_memory___":S.setVariable(H,j.CURRENT_MENU_OPTIONS_MEMORY_KEY,i.value);break;case "___last_menu_options_added_in_step_memory___":S.setVariable(H,j.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY,i.value);break;case "_input_value_":S.setVariable(H,j.CURRENT_INPUT_VALUE_MEMORY_KEY,i.value);break;case "___last_input_added_in_step_memory___":S.setVariable(H,j.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY,i.value);break;case "___current_input_info_memory___":S.setVariable(H,j.CURRENT_INPUT_INFO_MEMORY_KEY,i.value);break;case "___opened_labels_counter___":S.setVariable(H,j.OPENED_LABELS_COUNTER_KEY,i.value);break;case "___all_choices_made___":S.setVariable(H,j.ALL_CHOICES_MADE_KEY,i.value);break;case "___current_step_times_counter___":S.setVariable(H,j.CURRENT_STEP_TIMES_COUNTER_KEY,i.value);break;case "___last_step_glued___":S.setVariable(H,j.LAST_STEP_GLUED,i.value);break;default:S.setVariable(st,i.key,i.value);}}),e.temp?.forEach(i=>{S.setVariable(ht,i.key,i.value);}),e.flags?.forEach(i=>{S.setFlag(i,!0);}),e.main?.forEach(i=>{this.base.set(i.key,i.value);}),e.tempDeadlines?.forEach(i=>{this.tempStorageDeadlines.set(i.key,i.value);})):pt.warn("No storage data found");}catch(i){pt.error("Error importing data",i);}}};var Vt=class{constructor(e,i){E(this,"id");E(this,"categoryId");this.categoryId=e,this.id=i,this.migrateOldStorage();}migrateOldStorage(e=this.categoryId){let i=S.getVariable(st,e);i&&(Object.entries(i).forEach(([s,r])=>{typeof r=="object"&&r!==null&&Object.entries(r).forEach(([o,a])=>{S.setVariable(this.categoryId,`${s}:${o}`,a);});}),S.removeVariable(st,e));}setStorageProperty(e,i){S.setVariable(this.categoryId,`${this.id}:${e}`,i);}getStorageProperty(e,i=this.id){return S.getVariable(this.categoryId,`${i}:${e}`)}};var Ve=new Dt;exports.StorageRegistry=S;exports.StoredClassModel=Vt;exports.storage=Ve;
@@ -1,22 +1,22 @@
1
1
  import { LRUCache } from 'lru-cache';
2
- import { a as StorageElementType } from './StorageElementType-DkJ394kq.cjs';
3
- export { S as StorageObjectType } from './StorageElementType-DkJ394kq.cjs';
4
- export { S as StoredClassModel } from './StoredClassModel-LtyakzOw.cjs';
2
+ import { S as StorageElementType } from './StorageElementType-C7ETezlL.cjs';
3
+ export { a as StorageObjectType } from './StorageElementType-C7ETezlL.cjs';
4
+ export { S as StoredClassModel } from './StoredClassModel-C9mQxPg-.cjs';
5
5
  import { C as CachedMap } from './CachedMap-DZLvJAnA.cjs';
6
6
 
7
7
  interface StorageExternalStoreHandler {
8
8
  /**
9
- * Triggered when {@link StorageManagerStatic.setVariable} is called.
9
+ * Triggered when {@link StorageRegistry.setVariable} is called.
10
10
  * The key is provided without any storage prefix.
11
11
  */
12
12
  onSetVariable?: (key: string, value: StorageElementType) => void;
13
13
  /**
14
- * Triggered when a temp variable is removed by {@link StorageManagerStatic.clearOldTempVariables}.
14
+ * Triggered when a temp variable is removed by {@link StorageRegistry.clearOldTempVariables}.
15
15
  * The key is provided without any storage prefix.
16
16
  */
17
17
  onClearOldTempVariable?: (key: string) => void;
18
18
  /**
19
- * Triggered when {@link StorageManagerStatic.removeVariable} is called.
19
+ * Triggered when {@link StorageRegistry.removeVariable} is called.
20
20
  * The key is provided without any storage prefix.
21
21
  */
22
22
  onRemoveVariable?: (key: string) => void;
@@ -171,7 +171,11 @@ interface StorageManagerInterface {
171
171
  restore(data: StorageGameState): void;
172
172
  }
173
173
 
174
- declare namespace StorageManagerStatic {
174
+ /**
175
+ * StorageRegistry is a singleton namespace that holds global state for the storage system.
176
+ * **DO NOT** import this module directly; use `storage`.
177
+ */
178
+ declare namespace StorageRegistry {
175
179
  const storage: CachedMap<string, any>;
176
180
  const defaultStorage: CachedMap<string, any>;
177
181
  const tempStorageDeadlines: Map<string, number>;
@@ -186,4 +190,4 @@ declare namespace StorageManagerStatic {
186
190
 
187
191
  declare const storage: StorageManagerInterface;
188
192
 
189
- export { StorageElementType, type StorageExternalStoreHandler, type StorageGameState, type StorageManagerInterface, StorageManagerStatic, storage };
193
+ export { StorageElementType, type StorageExternalStoreHandler, type StorageGameState, type StorageManagerInterface, StorageRegistry, storage };