@drincs/pixi-vn 1.3.21 → 1.3.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas.cjs +1 -1
- package/dist/canvas.mjs +1 -1
- package/dist/characters.cjs +1 -1
- package/dist/characters.mjs +1 -1
- package/dist/chunk-RXNJBYVP.mjs +1 -0
- package/dist/{chunk-ROWTJPTX.mjs → chunk-VWR64CHT.mjs} +1 -1
- package/dist/history.cjs +1 -1
- package/dist/history.d.cts +6 -2
- package/dist/history.d.ts +6 -2
- package/dist/history.mjs +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +2 -2
- package/dist/narration.cjs +2 -2
- package/dist/narration.d.cts +28 -11
- package/dist/narration.d.ts +28 -11
- package/dist/narration.mjs +2 -2
- package/dist/pixi.js.cjs +143 -126
- package/dist/pixi.js.mjs +160 -143
- package/dist/storage.cjs +1 -1
- package/dist/storage.mjs +1 -1
- package/dist/unifier.d.cts +4 -4
- package/dist/unifier.d.ts +4 -4
- package/package.json +6 -6
- package/dist/chunk-JYY377ML.mjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a}from'./chunk-
|
|
1
|
+
import {a}from'./chunk-RXNJBYVP.mjs';import {d,k,j}from'./chunk-GNJIUFU2.mjs';import {GameUnifier}from'@drincs/pixi-vn/unifier';var o=class o{constructor(){}static clearOldTempVariables(e){o.tempStorageDeadlines.forEach((t,a)=>{t>e&&(o.tempStorage.delete(a),o.tempStorageDeadlines.delete(a),o.storage.cache.delete(a));});}static setVariable(e,t){let a=o.tempStorage.has(e);t==null?(o.storage.map.delete(e),!a&&o.storage.cache.delete(e)):(o.storage.map.set(e,t),!a&&o.storage.cache.set(e,t));}static getVariable(e){let t=o.storage.cache.get(e);return t===void 0&&(t=o.tempStorage.get(e)),t===void 0&&(t=o.storage.map.get(e)),k(t)}static removeVariable(e){o.storage.delete(e);}static setFlag(e,t){if(t)this.flags.includes(e)||this.flags.push(e);else {let a=this.flags.indexOf(e);a>-1&&this.flags.splice(a,1);}}static getFlag(e){return this.flags.includes(e)}};d(o,"storage",new a({cacheSize:20})),d(o,"startingStorage",[]),d(o,"flags",Array()),d(o,"tempStorage",new Map),d(o,"tempStorageDeadlines",new Map);var r=o;var n=class{get storage(){return r.storage.map}get cache(){return r.storage.cache}get flags(){return r.flags}get tempStorage(){return r.tempStorage}get tempStorageDeadlines(){return r.tempStorageDeadlines}set startingStorage(e){let t=GameUnifier.stepCounter===0;Object.entries(e).forEach(([a,s])=>{r.startingStorage.push({key:a,value:s}),t&&r.storage.set(a,s);});}set(e,t){return r.setVariable(e,t)}setVariable(e,t){return this.set(e,t)}get(e){return r.getVariable(e)}getVariable(e){return this.get(e)}removeVariable(e){return r.removeVariable(e)}setTempVariable(e,t){if(t==null){this.removeTempVariable(e);return}else r.tempStorage.set(e,t),r.storage.cache.set(e,t),r.tempStorageDeadlines.has(e)||r.tempStorageDeadlines.set(e,GameUnifier.openedLabels);}removeTempVariable(e){r.tempStorage.has(e)&&(r.tempStorage.delete(e),r.tempStorageDeadlines.delete(e),r.storage.cache.delete(e));}setFlag(e,t){return r.setFlag(e,t)}getFlag(e){return r.getFlag(e)}clear(){this.storage.clear(),this.cache.clear(),r.flags=[],r.tempStorage.clear(),r.tempStorageDeadlines.clear(),r.startingStorage.forEach(({key:e,value:t})=>{this.storage.set(e,t);});}export(){let e=[];[...this.storage.keys()].forEach(s=>{e.push({key:s,value:this.storage.get(s)});});let t=[];[...r.tempStorage.keys()].forEach(s=>{t.push({key:s,value:r.tempStorage.get(s)});});let a=[];return [...r.tempStorageDeadlines.keys()].forEach(s=>{a.push({key:s,value:r.tempStorageDeadlines.get(s)});}),k({base:e,temp:t,tempDeadlines:a,flags:r.flags})}restore(e){this.clear();try{e?(Array.isArray(e)&&e.forEach(t=>{if(t.key==="___temp_storage___"){let a=t.value;Object.entries(a).forEach(([s,g])=>{r.tempStorage.set(s,g);});}else if(t.key==="___temp_storage_deadlines___"){let a=t.value;Object.entries(a).forEach(([s,g])=>{r.tempStorageDeadlines.set(s,g);});}else t.key==="___flags___"?t.value.forEach(s=>{r.flags.push(s);}):this.storage.set(t.key,t.value);}),"base"in e&&"temp"in e&&"tempDeadlines"in e?(e.base?.forEach(t=>{this.storage.set(t.key,t.value);}),e.temp?.forEach(t=>{r.tempStorage.set(t.key,t.value);}),e.tempDeadlines?.forEach(t=>{r.tempStorageDeadlines.set(t.key,t.value);})):Object.entries(e).forEach(([t,a])=>{t==="___temp_storage___"?Object.entries(a).forEach(([s,g])=>{r.tempStorage.set(s,g);}):t==="___temp_storage_deadlines___"?Object.entries(a).forEach(([s,g])=>{r.tempStorageDeadlines.set(s,g);}):t==="___flags___"?a.forEach(s=>{r.flags.push(s);}):this.storage.set(t,a);})):j.warn("No storage data found");}catch(t){j.error("Error importing data",t);}}};var p=class{constructor(e,t){d(this,"_id");d(this,"categoryId");this.categoryId=e,this._id=t;}get id(){return this._id}setStorageProperty(e,t){let a=r.getVariable(this.categoryId);a||(a={}),a.hasOwnProperty(this.id)||(a[this.id]={}),t==null?a[this.id].hasOwnProperty(e)&&delete a[this.id][e]:a[this.id]={...a[this.id],[e]:t},Object.keys(a[this.id]).length===0&&delete a[this.id],r.setVariable(this.categoryId,a);}getStorageProperty(e,t=this.id){let a=r.getVariable(this.categoryId);if(a&&a.hasOwnProperty(t)&&a[t].hasOwnProperty(e))return a[t][e]}};var v=new n;export{r as a,p as b,v as c};
|
package/dist/history.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var unifier=require('@drincs/pixi-vn/unifier');var Xt=Object.defineProperty;var jt=f=>{throw TypeError(f)};var Qt=(f,t,e)=>t in f?Xt(f,t,{enumerable:true,configurable:true,writable:true,value:e}):f[t]=e;var w=(f,t,e)=>Qt(f,typeof t!="symbol"?t+"":t,e),Nt=(f,t,e)=>t.has(f)||jt("Cannot "+e);var i=(f,t,e)=>(Nt(f,t,"read from private field"),e?e.call(f):t.get(f)),b=(f,t,e)=>t.has(f)?jt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(f):t.set(f,e),d=(f,t,e,s)=>(Nt(f,t,"write to private field"),t.set(f,e),e),c=(f,t,e)=>(Nt(f,t,"access private method"),e);var vt=(f,t,e,s)=>({set _(r){d(f,t,r);},get _(){return i(f,t,s)}});var Zt={Date:true,RegExp:true,String:true,Number:true};function Ot(f,t,e={cyclesFix:true},s=[]){let r=[],n=Array.isArray(f);for(let l in f){let h=f[l],y=n?+l:l;if(!(l in t)){r.push({type:"REMOVE",path:[y],oldValue:f[l]});continue}let m=t[l],S=typeof h=="object"&&typeof m=="object"&&Array.isArray(h)===Array.isArray(m);h&&m&&S&&!Zt[Object.getPrototypeOf(h)?.constructor?.name]&&(!e.cyclesFix||!s.includes(h))?r.push.apply(r,Ot(h,m,e,e.cyclesFix?s.concat([h]):[]).map(_=>(_.path.unshift(y),_))):h!==m&&!(Number.isNaN(h)&&Number.isNaN(m))&&!(S&&(isNaN(h)?h+""==m+"":+h==+m))&&r.push({path:[y],type:"CHANGE",value:m,oldValue:h});}let o=Array.isArray(t);for(let l in t)l in f||r.push({type:"CREATE",path:[o?+l:l],value:t[l]});return r}var x;(r=>(r.log=(n,...o)=>console.log(`[Pixi\u2019VN] ${n}`,...o),r.warn=(n,...o)=>console.warn(`[Pixi\u2019VN] ${n}`,...o),r.error=(n,...o)=>console.error(`[Pixi\u2019VN] ${n}`,...o),r.info=(n,...o)=>console.info(`[Pixi\u2019VN] ${n}`,...o)))(x||(x={}));function Z(f){try{if(typeof f>"u")return f;let t=JSON.stringify(f);return JSON.parse(t)}catch(t){throw x.error("Error creating exportable element",f,t),new Error("[Pixi\u2019VN] Error creating exportable element")}}function Ut(f,t){let e=Z(f);return t.length>1&&"type"in t[0]&&(t=t.reverse()),t.forEach(s=>{"type"in s?te(e,s):ee(e,s);}),e}function te(f,t){let e=f;t.path&&t.path.length>0?t.path.forEach((s,r)=>{if(t.path&&r===t.path.length-1)switch(t.type){case "CHANGE":case "REMOVE":e[s]=t.oldValue;break;case "CREATE":Array.isArray(e)&&typeof s=="number"?e.splice(s,1):delete e[s];break}else e=e[s];}):x.warn("No path found, skipping diff",t);}function ee(f,t){let e=f;t.path&&t.path.length>0?t.path.forEach((s,r)=>{if(t.path&&r===t.path.length-1){if(t.kind==="E"||t.kind==="D")e[s]=t.lhs;else if(t.kind==="N")Number.isInteger(s)?Array.isArray(e)&&e.splice(s,1):typeof s=="string"&&delete e[s];else if(t.kind==="A"){let n=t.index;t.item.kind==="N"?e[s].splice(n,1):t.item.kind==="E"||t.item.kind==="D"?e[s][n]=t.item.lhs:t.item.kind==="A"?x.warn("Nested array found, skipping diff",t):x.warn("No array found, skipping diff",t);}}else e=e[s];}):x.warn("No path found, skipping diff",t);}var dt=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,$t=new Set,Rt=typeof process=="object"&&process?process:{},Yt=(f,t,e,s)=>{typeof Rt.emitWarning=="function"?Rt.emitWarning(f,t,e,s):console.error(`[${e}] ${t}: ${f}`);},zt=globalThis.AbortController,Pt=globalThis.AbortSignal;if(typeof zt>"u"){Pt=class{constructor(){w(this,"onabort");w(this,"_onabort",[]);w(this,"reason");w(this,"aborted",false);}addEventListener(s,r){this._onabort.push(r);}},zt=class{constructor(){w(this,"signal",new Pt);t();}abort(s){if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=true;for(let r of this.signal._onabort)r(s);this.signal.onabort?.(s);}}};let f=Rt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{f&&(f=false,Yt("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 ie=f=>!$t.has(f),et=f=>f&&f===Math.floor(f)&&f>0&&isFinite(f),Jt=f=>et(f)?f<=Math.pow(2,8)?Uint8Array:f<=Math.pow(2,16)?Uint16Array:f<=Math.pow(2,32)?Uint32Array:f<=Number.MAX_SAFE_INTEGER?pt:null:null,pt=class extends Array{constructor(t){super(t),this.fill(0);}},gt,at=class at{constructor(t,e){w(this,"heap");w(this,"length");if(!i(at,gt))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0;}static create(t){let e=Jt(t);if(!e)return [];d(at,gt,true);let s=new at(t,e);return d(at,gt,false),s}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}};gt=new WeakMap,b(at,gt,false);var kt=at,Kt,Bt,U,M,P,ht,K,yt,mt,O,B,v,E,p,I,G,C,D,$,F,Y,J,L,q,nt,N,St,a,Mt,lt,tt,Et,W,qt,ft,bt,Ht,it,st,Gt,Dt,Ft,A,Lt,At,rt,Wt,Vt=class Vt{constructor(t){b(this,a);b(this,U);b(this,M);b(this,P);b(this,ht);b(this,K);b(this,yt);b(this,mt);w(this,"ttl");w(this,"ttlResolution");w(this,"ttlAutopurge");w(this,"updateAgeOnGet");w(this,"updateAgeOnHas");w(this,"allowStale");w(this,"noDisposeOnSet");w(this,"noUpdateTTL");w(this,"maxEntrySize");w(this,"sizeCalculation");w(this,"noDeleteOnFetchRejection");w(this,"noDeleteOnStaleGet");w(this,"allowStaleOnFetchAbort");w(this,"allowStaleOnFetchRejection");w(this,"ignoreFetchAbort");b(this,O);b(this,B);b(this,v);b(this,E);b(this,p);b(this,I);b(this,G);b(this,C);b(this,D);b(this,$);b(this,F);b(this,Y);b(this,J);b(this,L);b(this,q);b(this,nt);b(this,N);b(this,St);b(this,lt,()=>{});b(this,tt,()=>{});b(this,Et,()=>{});b(this,W,()=>false);b(this,ft,t=>{});b(this,bt,(t,e,s)=>{});b(this,Ht,(t,e,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});w(this,Kt,"LRUCache");let{max:e=0,ttl:s,ttlResolution:r=1,ttlAutopurge:n,updateAgeOnGet:o,updateAgeOnHas:l,allowStale:h,dispose:y,onInsert:m,disposeAfter:S,noDisposeOnSet:_,noUpdateTTL:V,maxSize:Q=0,maxEntrySize:T=0,sizeCalculation:H,fetchMethod:g,memoMethod:R,noDeleteOnFetchRejection:k,noDeleteOnStaleGet:z,allowStaleOnFetchRejection:j,allowStaleOnFetchAbort:_t,ignoreFetchAbort:ct}=t;if(e!==0&&!et(e))throw new TypeError("max option must be a nonnegative integer");let Tt=e?Jt(e):Array;if(!Tt)throw new Error("invalid max value: "+e);if(d(this,U,e),d(this,M,Q),this.maxEntrySize=T||i(this,M),this.sizeCalculation=H,this.sizeCalculation){if(!i(this,M)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(R!==void 0&&typeof R!="function")throw new TypeError("memoMethod must be a function if defined");if(d(this,mt,R),g!==void 0&&typeof g!="function")throw new TypeError("fetchMethod must be a function if specified");if(d(this,yt,g),d(this,nt,!!g),d(this,v,new Map),d(this,E,new Array(e).fill(void 0)),d(this,p,new Array(e).fill(void 0)),d(this,I,new Tt(e)),d(this,G,new Tt(e)),d(this,C,0),d(this,D,0),d(this,$,kt.create(e)),d(this,O,0),d(this,B,0),typeof y=="function"&&d(this,P,y),typeof m=="function"&&d(this,ht,m),typeof S=="function"?(d(this,K,S),d(this,F,[])):(d(this,K,void 0),d(this,F,void 0)),d(this,q,!!i(this,P)),d(this,St,!!i(this,ht)),d(this,N,!!i(this,K)),this.noDisposeOnSet=!!_,this.noUpdateTTL=!!V,this.noDeleteOnFetchRejection=!!k,this.allowStaleOnFetchRejection=!!j,this.allowStaleOnFetchAbort=!!_t,this.ignoreFetchAbort=!!ct,this.maxEntrySize!==0){if(i(this,M)!==0&&!et(i(this,M)))throw new TypeError("maxSize must be a positive integer if specified");if(!et(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");c(this,a,qt).call(this);}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!z,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!l,this.ttlResolution=et(r)||r===0?r:1,this.ttlAutopurge=!!n,this.ttl=s||0,this.ttl){if(!et(this.ttl))throw new TypeError("ttl must be a positive integer if specified");c(this,a,Mt).call(this);}if(i(this,U)===0&&this.ttl===0&&i(this,M)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!i(this,U)&&!i(this,M)){let ut="LRU_CACHE_UNBOUNDED";ie(ut)&&($t.add(ut),Yt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",ut,Vt));}}static unsafeExposeInternals(t){return {starts:i(t,J),ttls:i(t,L),sizes:i(t,Y),keyMap:i(t,v),keyList:i(t,E),valList:i(t,p),next:i(t,I),prev:i(t,G),get head(){return i(t,C)},get tail(){return i(t,D)},free:i(t,$),isBackgroundFetch:e=>{var s;return c(s=t,a,A).call(s,e)},backgroundFetch:(e,s,r,n)=>{var o;return c(o=t,a,Ft).call(o,e,s,r,n)},moveToTail:e=>{var s;return c(s=t,a,At).call(s,e)},indexes:e=>{var s;return c(s=t,a,it).call(s,e)},rindexes:e=>{var s;return c(s=t,a,st).call(s,e)},isStale:e=>{var s;return i(s=t,W).call(s,e)}}}get max(){return i(this,U)}get maxSize(){return i(this,M)}get calculatedSize(){return i(this,B)}get size(){return i(this,O)}get fetchMethod(){return i(this,yt)}get memoMethod(){return i(this,mt)}get dispose(){return i(this,P)}get onInsert(){return i(this,ht)}get disposeAfter(){return i(this,K)}getRemainingTTL(t){return i(this,v).has(t)?1/0:0}*entries(){for(let t of c(this,a,it).call(this))i(this,p)[t]!==void 0&&i(this,E)[t]!==void 0&&!c(this,a,A).call(this,i(this,p)[t])&&(yield [i(this,E)[t],i(this,p)[t]]);}*rentries(){for(let t of c(this,a,st).call(this))i(this,p)[t]!==void 0&&i(this,E)[t]!==void 0&&!c(this,a,A).call(this,i(this,p)[t])&&(yield [i(this,E)[t],i(this,p)[t]]);}*keys(){for(let t of c(this,a,it).call(this)){let e=i(this,E)[t];e!==void 0&&!c(this,a,A).call(this,i(this,p)[t])&&(yield e);}}*rkeys(){for(let t of c(this,a,st).call(this)){let e=i(this,E)[t];e!==void 0&&!c(this,a,A).call(this,i(this,p)[t])&&(yield e);}}*values(){for(let t of c(this,a,it).call(this))i(this,p)[t]!==void 0&&!c(this,a,A).call(this,i(this,p)[t])&&(yield i(this,p)[t]);}*rvalues(){for(let t of c(this,a,st).call(this))i(this,p)[t]!==void 0&&!c(this,a,A).call(this,i(this,p)[t])&&(yield i(this,p)[t]);}[(Bt=Symbol.iterator,Kt=Symbol.toStringTag,Bt)](){return this.entries()}find(t,e={}){for(let s of c(this,a,it).call(this)){let r=i(this,p)[s],n=c(this,a,A).call(this,r)?r.__staleWhileFetching:r;if(n!==void 0&&t(n,i(this,E)[s],this))return this.get(i(this,E)[s],e)}}forEach(t,e=this){for(let s of c(this,a,it).call(this)){let r=i(this,p)[s],n=c(this,a,A).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&t.call(e,n,i(this,E)[s],this);}}rforEach(t,e=this){for(let s of c(this,a,st).call(this)){let r=i(this,p)[s],n=c(this,a,A).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&t.call(e,n,i(this,E)[s],this);}}purgeStale(){let t=false;for(let e of c(this,a,st).call(this,{allowStale:true}))i(this,W).call(this,e)&&(c(this,a,rt).call(this,i(this,E)[e],"expire"),t=true);return t}info(t){let e=i(this,v).get(t);if(e===void 0)return;let s=i(this,p)[e],r=c(this,a,A).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let n={value:r};if(i(this,L)&&i(this,J)){let o=i(this,L)[e],l=i(this,J)[e];if(o&&l){let h=o-(dt.now()-l);n.ttl=h,n.start=Date.now();}}return i(this,Y)&&(n.size=i(this,Y)[e]),n}dump(){let t=[];for(let e of c(this,a,it).call(this,{allowStale:true})){let s=i(this,E)[e],r=i(this,p)[e],n=c(this,a,A).call(this,r)?r.__staleWhileFetching:r;if(n===void 0||s===void 0)continue;let o={value:n};if(i(this,L)&&i(this,J)){o.ttl=i(this,L)[e];let l=dt.now()-i(this,J)[e];o.start=Math.floor(Date.now()-l);}i(this,Y)&&(o.size=i(this,Y)[e]),t.unshift([s,o]);}return t}load(t){this.clear();for(let[e,s]of t){if(s.start){let r=Date.now()-s.start;s.start=dt.now()-r;}this.set(e,s.value,s);}}set(t,e,s={}){var _,V,Q,T;if(e===void 0)return this.delete(t),this;let{ttl:r=this.ttl,start:n,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:l=this.sizeCalculation,status:h}=s,{noUpdateTTL:y=this.noUpdateTTL}=s,m=i(this,Ht).call(this,t,e,s.size||0,l);if(this.maxEntrySize&&m>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=true),c(this,a,rt).call(this,t,"set"),this;let S=i(this,O)===0?void 0:i(this,v).get(t);if(S===void 0)S=i(this,O)===0?i(this,D):i(this,$).length!==0?i(this,$).pop():i(this,O)===i(this,U)?c(this,a,Dt).call(this,false):i(this,O),i(this,E)[S]=t,i(this,p)[S]=e,i(this,v).set(t,S),i(this,I)[i(this,D)]=S,i(this,G)[S]=i(this,D),d(this,D,S),vt(this,O)._++,i(this,bt).call(this,S,m,h),h&&(h.set="add"),y=false,i(this,St)&&((_=i(this,ht))==null||_.call(this,e,t,"add"));else {c(this,a,At).call(this,S);let H=i(this,p)[S];if(e!==H){if(i(this,nt)&&c(this,a,A).call(this,H)){H.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:g}=H;g!==void 0&&!o&&(i(this,q)&&((V=i(this,P))==null||V.call(this,g,t,"set")),i(this,N)&&i(this,F)?.push([g,t,"set"]));}else o||(i(this,q)&&((Q=i(this,P))==null||Q.call(this,H,t,"set")),i(this,N)&&i(this,F)?.push([H,t,"set"]));if(i(this,ft).call(this,S),i(this,bt).call(this,S,m,h),i(this,p)[S]=e,h){h.set="replace";let g=H&&c(this,a,A).call(this,H)?H.__staleWhileFetching:H;g!==void 0&&(h.oldValue=g);}}else h&&(h.set="update");i(this,St)&&this.onInsert?.(e,t,e===H?"update":"replace");}if(r!==0&&!i(this,L)&&c(this,a,Mt).call(this),i(this,L)&&(y||i(this,Et).call(this,S,r,n),h&&i(this,tt).call(this,h,S)),!o&&i(this,N)&&i(this,F)){let H=i(this,F),g;for(;g=H?.shift();)(T=i(this,K))==null||T.call(this,...g);}return this}pop(){var t;try{for(;i(this,O);){let e=i(this,p)[i(this,C)];if(c(this,a,Dt).call(this,!0),c(this,a,A).call(this,e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(i(this,N)&&i(this,F)){let e=i(this,F),s;for(;s=e?.shift();)(t=i(this,K))==null||t.call(this,...s);}}}has(t,e={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=e,n=i(this,v).get(t);if(n!==void 0){let o=i(this,p)[n];if(c(this,a,A).call(this,o)&&o.__staleWhileFetching===void 0)return false;if(i(this,W).call(this,n))r&&(r.has="stale",i(this,tt).call(this,r,n));else return s&&i(this,lt).call(this,n),r&&(r.has="hit",i(this,tt).call(this,r,n)),true}else r&&(r.has="miss");return false}peek(t,e={}){let{allowStale:s=this.allowStale}=e,r=i(this,v).get(t);if(r===void 0||!s&&i(this,W).call(this,r))return;let n=i(this,p)[r];return c(this,a,A).call(this,n)?n.__staleWhileFetching:n}async fetch(t,e={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:l=this.noDisposeOnSet,size:h=0,sizeCalculation:y=this.sizeCalculation,noUpdateTTL:m=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:_=this.allowStaleOnFetchRejection,ignoreFetchAbort:V=this.ignoreFetchAbort,allowStaleOnFetchAbort:Q=this.allowStaleOnFetchAbort,context:T,forceRefresh:H=false,status:g,signal:R}=e;if(!i(this,nt))return g&&(g.fetch="get"),this.get(t,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,status:g});let k={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:l,size:h,sizeCalculation:y,noUpdateTTL:m,noDeleteOnFetchRejection:S,allowStaleOnFetchRejection:_,allowStaleOnFetchAbort:Q,ignoreFetchAbort:V,status:g,signal:R},z=i(this,v).get(t);if(z===void 0){g&&(g.fetch="miss");let j=c(this,a,Ft).call(this,t,z,k,T);return j.__returned=j}else {let j=i(this,p)[z];if(c(this,a,A).call(this,j)){let It=s&&j.__staleWhileFetching!==void 0;return g&&(g.fetch="inflight",It&&(g.returnedStale=true)),It?j.__staleWhileFetching:j.__returned=j}let _t=i(this,W).call(this,z);if(!H&&!_t)return g&&(g.fetch="hit"),c(this,a,At).call(this,z),r&&i(this,lt).call(this,z),g&&i(this,tt).call(this,g,z),j;let ct=c(this,a,Ft).call(this,t,z,k,T),ut=ct.__staleWhileFetching!==void 0&&s;return g&&(g.fetch=_t?"stale":"refresh",ut&&_t&&(g.returnedStale=true)),ut?ct.__staleWhileFetching:ct.__returned=ct}}async forceFetch(t,e={}){let s=await this.fetch(t,e);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(t,e={}){let s=i(this,mt);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:n,...o}=e,l=this.get(t,o);if(!n&&l!==void 0)return l;let h=s(t,l,{options:o,context:r});return this.set(t,h,o),h}get(t,e={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:o}=e,l=i(this,v).get(t);if(l!==void 0){let h=i(this,p)[l],y=c(this,a,A).call(this,h);return o&&i(this,tt).call(this,o,l),i(this,W).call(this,l)?(o&&(o.get="stale"),y?(o&&s&&h.__staleWhileFetching!==void 0&&(o.returnedStale=true),s?h.__staleWhileFetching:void 0):(n||c(this,a,rt).call(this,t,"expire"),o&&s&&(o.returnedStale=true),s?h:void 0)):(o&&(o.get="hit"),y?h.__staleWhileFetching:(c(this,a,At).call(this,l),r&&i(this,lt).call(this,l),h))}else o&&(o.get="miss");}delete(t){return c(this,a,rt).call(this,t,"delete")}clear(){return c(this,a,Wt).call(this,"delete")}};U=new WeakMap,M=new WeakMap,P=new WeakMap,ht=new WeakMap,K=new WeakMap,yt=new WeakMap,mt=new WeakMap,O=new WeakMap,B=new WeakMap,v=new WeakMap,E=new WeakMap,p=new WeakMap,I=new WeakMap,G=new WeakMap,C=new WeakMap,D=new WeakMap,$=new WeakMap,F=new WeakMap,Y=new WeakMap,J=new WeakMap,L=new WeakMap,q=new WeakMap,nt=new WeakMap,N=new WeakMap,St=new WeakMap,a=new WeakSet,Mt=function(){let t=new pt(i(this,U)),e=new pt(i(this,U));d(this,L,t),d(this,J,e),d(this,Et,(n,o,l=dt.now())=>{if(e[n]=o!==0?l:0,t[n]=o,o!==0&&this.ttlAutopurge){let h=setTimeout(()=>{i(this,W).call(this,n)&&c(this,a,rt).call(this,i(this,E)[n],"expire");},o+1);h.unref&&h.unref();}}),d(this,lt,n=>{e[n]=t[n]!==0?dt.now():0;}),d(this,tt,(n,o)=>{if(t[o]){let l=t[o],h=e[o];if(!l||!h)return;n.ttl=l,n.start=h,n.now=s||r();let y=n.now-h;n.remainingTTL=l-y;}});let s=0,r=()=>{let n=dt.now();if(this.ttlResolution>0){s=n;let o=setTimeout(()=>s=0,this.ttlResolution);o.unref&&o.unref();}return n};this.getRemainingTTL=n=>{let o=i(this,v).get(n);if(o===void 0)return 0;let l=t[o],h=e[o];if(!l||!h)return 1/0;let y=(s||r())-h;return l-y},d(this,W,n=>{let o=e[n],l=t[n];return !!l&&!!o&&(s||r())-o>l});},lt=new WeakMap,tt=new WeakMap,Et=new WeakMap,W=new WeakMap,qt=function(){let t=new pt(i(this,U));d(this,B,0),d(this,Y,t),d(this,ft,e=>{d(this,B,i(this,B)-t[e]),t[e]=0;}),d(this,Ht,(e,s,r,n)=>{if(c(this,a,A).call(this,s))return 0;if(!et(r))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(r=n(s,e),!et(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}),d(this,bt,(e,s,r)=>{if(t[e]=s,i(this,M)){let n=i(this,M)-t[e];for(;i(this,B)>n;)c(this,a,Dt).call(this,true);}d(this,B,i(this,B)+t[e]),r&&(r.entrySize=s,r.totalCalculatedSize=i(this,B));});},ft=new WeakMap,bt=new WeakMap,Ht=new WeakMap,it=function*({allowStale:t=this.allowStale}={}){if(i(this,O))for(let e=i(this,D);!(!c(this,a,Gt).call(this,e)||((t||!i(this,W).call(this,e))&&(yield e),e===i(this,C)));)e=i(this,G)[e];},st=function*({allowStale:t=this.allowStale}={}){if(i(this,O))for(let e=i(this,C);!(!c(this,a,Gt).call(this,e)||((t||!i(this,W).call(this,e))&&(yield e),e===i(this,D)));)e=i(this,I)[e];},Gt=function(t){return t!==void 0&&i(this,v).get(i(this,E)[t])===t},Dt=function(t){var n;let e=i(this,C),s=i(this,E)[e],r=i(this,p)[e];return i(this,nt)&&c(this,a,A).call(this,r)?r.__abortController.abort(new Error("evicted")):(i(this,q)||i(this,N))&&(i(this,q)&&((n=i(this,P))==null||n.call(this,r,s,"evict")),i(this,N)&&i(this,F)?.push([r,s,"evict"])),i(this,ft).call(this,e),t&&(i(this,E)[e]=void 0,i(this,p)[e]=void 0,i(this,$).push(e)),i(this,O)===1?(d(this,C,d(this,D,0)),i(this,$).length=0):d(this,C,i(this,I)[e]),i(this,v).delete(s),vt(this,O)._--,e},Ft=function(t,e,s,r){let n=e===void 0?void 0:i(this,p)[e];if(c(this,a,A).call(this,n))return n;let o=new zt,{signal:l}=s;l?.addEventListener("abort",()=>o.abort(l.reason),{signal:o.signal});let h={signal:o.signal,options:s,context:r},y=(T,H=false)=>{let{aborted:g}=o.signal,R=s.ignoreFetchAbort&&T!==void 0;if(s.status&&(g&&!H?(s.status.fetchAborted=true,s.status.fetchError=o.signal.reason,R&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),g&&!R&&!H)return S(o.signal.reason);let k=V;return i(this,p)[e]===V&&(T===void 0?k.__staleWhileFetching?i(this,p)[e]=k.__staleWhileFetching:c(this,a,rt).call(this,t,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(t,T,h.options))),T},m=T=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=T),S(T)),S=T=>{let{aborted:H}=o.signal,g=H&&s.allowStaleOnFetchAbort,R=g||s.allowStaleOnFetchRejection,k=R||s.noDeleteOnFetchRejection,z=V;if(i(this,p)[e]===V&&(!k||z.__staleWhileFetching===void 0?c(this,a,rt).call(this,t,"fetch"):g||(i(this,p)[e]=z.__staleWhileFetching)),R)return s.status&&z.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),z.__staleWhileFetching;if(z.__returned===z)throw T},_=(T,H)=>{var R;let g=(R=i(this,yt))==null?void 0:R.call(this,t,n,h);g&&g instanceof Promise&&g.then(k=>T(k===void 0?void 0:k),H),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(T(void 0),s.allowStaleOnFetchAbort&&(T=k=>y(k,true)));});};s.status&&(s.status.fetchDispatched=true);let V=new Promise(_).then(y,m),Q=Object.assign(V,{__abortController:o,__staleWhileFetching:n,__returned:void 0});return e===void 0?(this.set(t,Q,{...h.options,status:void 0}),e=i(this,v).get(t)):i(this,p)[e]=Q,Q},A=function(t){if(!i(this,nt))return false;let e=t;return !!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof zt},Lt=function(t,e){i(this,G)[e]=t,i(this,I)[t]=e;},At=function(t){t!==i(this,D)&&(t===i(this,C)?d(this,C,i(this,I)[t]):c(this,a,Lt).call(this,i(this,G)[t],i(this,I)[t]),c(this,a,Lt).call(this,i(this,D),t),d(this,D,t));},rt=function(t,e){var r,n;let s=false;if(i(this,O)!==0){let o=i(this,v).get(t);if(o!==void 0)if(s=true,i(this,O)===1)c(this,a,Wt).call(this,e);else {i(this,ft).call(this,o);let l=i(this,p)[o];if(c(this,a,A).call(this,l)?l.__abortController.abort(new Error("deleted")):(i(this,q)||i(this,N))&&(i(this,q)&&((r=i(this,P))==null||r.call(this,l,t,e)),i(this,N)&&i(this,F)?.push([l,t,e])),i(this,v).delete(t),i(this,E)[o]=void 0,i(this,p)[o]=void 0,o===i(this,D))d(this,D,i(this,G)[o]);else if(o===i(this,C))d(this,C,i(this,I)[o]);else {let h=i(this,G)[o];i(this,I)[h]=i(this,I)[o];let y=i(this,I)[o];i(this,G)[y]=i(this,G)[o];}vt(this,O)._--,i(this,$).push(o);}}if(i(this,N)&&i(this,F)?.length){let o=i(this,F),l;for(;l=o?.shift();)(n=i(this,K))==null||n.call(this,...l);}return s},Wt=function(t){var e,s;for(let r of c(this,a,st).call(this,{allowStale:true})){let n=i(this,p)[r];if(c(this,a,A).call(this,n))n.__abortController.abort(new Error("deleted"));else {let o=i(this,E)[r];i(this,q)&&((e=i(this,P))==null||e.call(this,n,o,t)),i(this,N)&&i(this,F)?.push([n,o,t]);}}if(i(this,v).clear(),i(this,p).fill(void 0),i(this,E).fill(void 0),i(this,L)&&i(this,J)&&(i(this,L).fill(0),i(this,J).fill(0)),i(this,Y)&&i(this,Y).fill(0),d(this,C,0),d(this,D,0),i(this,$).length=0,d(this,B,0),d(this,O,0),i(this,N)&&i(this,F)){let r=i(this,F),n;for(;n=r?.shift();)(s=i(this,K))==null||s.call(this,...n);}};var Ct=Vt;var ot=class{constructor(t){w(this,"cache");w(this,"map",new Map);this.cache=new Ct({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 X=class X{static get originalStepData(){return X._originalStepData?Z(X._originalStepData):{path:"",storage:{},canvas:{elementAliasesOrder:[],elements:{},stage:{},tickers:{},tickersSteps:{},tickersOnPause:{},tickersToCompleteOnStepEnd:{tikersIds:[],stepAlias:[]}},sound:{soundAliasesOrder:[],soundsPlaying:{},playInStepIndex:{},filters:void 0},labelIndex:-1,openedLabels:[]}}static set originalStepData(t){X._originalStepData=Z(t);}};w(X,"_diffHistory",new ot({cacheSize:5})),w(X,"_stepsInfoHistory",new ot({cacheSize:5})),w(X,"_narrationHistory",new ot({cacheSize:50})),w(X,"stepLimitSaved",20),w(X,"goBackRunning",false),w(X,"_originalStepData");var u=X;var xt=class{get stepsInfoMap(){return u._stepsInfoHistory}get diffMap(){return u._diffHistory}get narrationMap(){return u._narrationHistory}get size(){return u._stepsInfoHistory.size}get lastKey(){return this.size===0?null:Math.max(...Array.from(this.keys()))}keys(){return u._stepsInfoHistory.keys()}get(t){let e=u._narrationHistory.get(t);if(!(e&&Object.keys(e).length===1&&e.stepIndex!==void 0))return e}delete(t){u._stepsInfoHistory.delete(t),u._diffHistory.delete(t),u._narrationHistory.delete(t);}internalRestoreOldGameState(t,e){if(t<=0||this.size==0)return e;let s=this.lastKey;if(typeof s!="number")return x.error("You can't go back, there is no step to go back"),e;let r=u._diffHistory.get(s);if(r)try{let n=Ut(e,r);return unifier.GameUnifier.stepCounter=s,this.delete(s),this.internalRestoreOldGameState(t-1,n)}catch(n){return x.error("Error applying diff",n),e}else return x.error("You can't go back, there is no step to go back"),e}async goBack(t,e=1){if(e<=0){x.warn("The parameter steps must be greater than 0");return}if(u._diffHistory.size<1){x.warn("You can't go back, there is no step to go back");return}if(u.goBackRunning){x.warn("Go back is already running");return}u.goBackRunning=true;try{let s=Z(this.internalRestoreOldGameState(e,u.originalStepData));if(s){await unifier.GameUnifier.restoreGameStepState(s,t);let r=unifier.GameUnifier.stepCounter-1,n=u._narrationHistory.get(r);if(n&&Object.keys(n).length===1&&n.stepIndex!==void 0){let o=u._stepsInfoHistory.get(r);if(o){let l=this.itemMapper({step:o});u._narrationHistory.set(o.index,l);}}}else x.error("Error going back");u.originalStepData=s,u.goBackRunning=!1;}catch(s){x.error("Error going back",s),u.goBackRunning=false;}}add(t,e={}){let s=u.originalStepData,{ignoreSameStep:r}=e,n=unifier.GameUnifier.currentGameStepState;if(!r&&this.isSameStep(s,n))return;let o=this.lastKey;(async()=>{try{let h,y;if(typeof o=="number"&&(h=u._stepsInfoHistory.get(o),y=u._narrationHistory.get(o)),u._stepsInfoHistory.set(t.index,t),t.index!==0){let _=Ot(s,n);_?u._diffHistory.set(t.index,_):x.warn("It was not possible to create the difference between the two steps");}let m={},S=this.itemMapper({step:t},m);if(u._narrationHistory.set(t.index,S),h&&y&&typeof o=="number"){let _=this.itemMapper({...m,step:h},{});u._narrationHistory.set(o,_);}}catch(h){x.error("Error adding history step",h);}})(),u.originalStepData=n;}itemMapper(t,e){let{step:s,choiceIndexMade:r,inputValue:n,removeDialogue:o}=t,l=s.dialogue||s.dialoge;e&&s.isGlued&&(e.removeDialogue=true),o&&(l=void 0);let h=s.choices;if(e&&s.currentLabel&&s.choiceIndexMade!==void 0&&(e.choiceIndexMade=s.choiceIndexMade),s.inputValue&&e&&(e.inputValue=s.inputValue),l||h||n){let y=h?.map((m,S)=>{let _=false;return m.oneTime&&s.alreadyMadeChoices&&s.alreadyMadeChoices.includes(S)&&(_=true),{text:m.text,type:m.type,isResponse:false,hidden:_}});if(y){if(y.every(m=>m.hidden)){let m=y.find(S=>S.hidden===false);m&&(m.hidden=false);}r!==void 0&&(y[r].isResponse=true);}return {dialogue:l?{...l,character:l.character?unifier.GameUnifier.getCharacter(l.character)||l.character:void 0}:void 0,playerMadeChoice:typeof r=="number",choices:y,stepIndex:s.index,inputValue:n}}return {stepIndex:s.index}}get narrativeHistory(){let t=[];return Array.from(this.keys()).sort((s,r)=>s-r).forEach(s=>{let r=this.get(s);r&&t.push(r);}),t}get currentLabelHistory(){let t=[],e=Array.from(this.keys()).sort((h,y)=>y-h);if(e.length===0)return t;let s=e[0];if(typeof s!="number")return t;let r=u._stepsInfoHistory.get(s);if(!r)return t;let n=r.openedLabels;if(!n||!Array.isArray(n)||n.length===0)return t;let o=n[0].currentStepIndex,l=n[0].label;return e.every((h,y)=>{let m=this.get(h);if(m){if(y===0)return t.push(m),true;let S=u._stepsInfoHistory.get(h);if(!S)return true;let _=S.openedLabels;if(!_||!Array.isArray(_)||_.length===0||_[0].label!==l||_[0].currentStepIndex>=o)return false;o=_[0].currentStepIndex,t.push(m);}return true}),t.reverse()}removeNarrativeHistory(t){if(t){let e=Array.from(this.keys()).sort((s,r)=>s-r);e=e.slice(0,t),e.forEach(s=>{u._narrationHistory.delete(s),u._stepsInfoHistory.delete(s),u._diffHistory.delete(s);});}else u._stepsInfoHistory.clear(),u._diffHistory.clear(),u._narrationHistory.clear();}get canGoBack(){let t=this.lastKey;return typeof t!="number"?false:u._diffHistory.has(t)}blockGoBack(){unifier.GameUnifier.currentStepsRunningNumber===0&&u._diffHistory.clear();}isSameStep(t,e){if(t.openedLabels.length===e.openedLabels.length)try{let s=JSON.stringify(t.openedLabels),r=JSON.stringify(e.openedLabels);if(s===r&&t.path===e.path&&t.labelIndex===e.labelIndex)return !0}catch(s){return x.error("Error comparing opened labels",s),true}return false}clear(){u._stepsInfoHistory.clear(),u._diffHistory.clear(),u._narrationHistory.clear(),u._originalStepData=void 0;}get stepLimitSaved(){return u.stepLimitSaved}set stepLimitSaved(t){u.stepLimitSaved=t;}export(){let t=Array.from(this.keys()).sort((s,r)=>s-r);t.length>this.stepLimitSaved&&(t=t.slice(t.length-this.stepLimitSaved));let e=[];return t.forEach(s=>{let r=u._stepsInfoHistory.get(s);if(r){let n=u._diffHistory.get(s);e.push({...r,diff:n});}}),{stepsHistory:Z(e),originalStepData:Z(u._originalStepData)}}restoreNarrativeHistory(){let t=Array.from(this.keys()).sort((s,r)=>s-r),e={};t.forEach(s=>{let r=u._stepsInfoHistory.get(s);if(r){let n={...e};e={};let o=this.itemMapper({step:r,choiceIndexMade:n.choiceIndexMade,inputValue:n.inputValue,removeDialogue:n.removeDialogue},e);o&&u._narrationHistory.set(s,o);}});}async restore(t){this.clear();try{t.hasOwnProperty("stepsHistory")?(t.stepsHistory.forEach(s=>{s.diff&&u._diffHistory.set(s.index,s.diff);let r={...s,diff:void 0};u._stepsInfoHistory.set(s.index,r);}),this.restoreNarrativeHistory()):x.warn("Could not import stepsHistory data, so will be ignored"),t.hasOwnProperty("originalStepData")?u._originalStepData=t.originalStepData:x.warn("Could not import originalStepData data, so will be ignored");}catch(e){x.error("Error importing data",e);}}};var Re=new xt;exports.HistoryManagerStatic=u;exports.stepHistory=Re;
|
|
1
|
+
'use strict';var unifier=require('@drincs/pixi-vn/unifier');var Xt=Object.defineProperty;var jt=f=>{throw TypeError(f)};var Qt=(f,t,i)=>t in f?Xt(f,t,{enumerable:true,configurable:true,writable:true,value:i}):f[t]=i;var w=(f,t,i)=>Qt(f,typeof t!="symbol"?t+"":t,i),Nt=(f,t,i)=>t.has(f)||jt("Cannot "+i);var e=(f,t,i)=>(Nt(f,t,"read from private field"),i?i.call(f):t.get(f)),b=(f,t,i)=>t.has(f)?jt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(f):t.set(f,i),d=(f,t,i,s)=>(Nt(f,t,"write to private field"),t.set(f,i),i),c=(f,t,i)=>(Nt(f,t,"access private method"),i);var Ot=(f,t,i,s)=>({set _(r){d(f,t,r);},get _(){return e(f,t,s)}});var Zt={Date:true,RegExp:true,String:true,Number:true};function Dt(f,t,i={cyclesFix:true},s=[]){let r=[],n=Array.isArray(f);for(let l in f){let h=f[l],y=n?+l:l;if(!(l in t)){r.push({type:"REMOVE",path:[y],oldValue:f[l]});continue}let m=t[l],S=typeof h=="object"&&typeof m=="object"&&Array.isArray(h)===Array.isArray(m);h&&m&&S&&!Zt[Object.getPrototypeOf(h)?.constructor?.name]&&(!i.cyclesFix||!s.includes(h))?r.push.apply(r,Dt(h,m,i,i.cyclesFix?s.concat([h]):[]).map(_=>(_.path.unshift(y),_))):h!==m&&!(Number.isNaN(h)&&Number.isNaN(m))&&!(S&&(isNaN(h)?h+""==m+"":+h==+m))&&r.push({path:[y],type:"CHANGE",value:m,oldValue:h});}let o=Array.isArray(t);for(let l in t)l in f||r.push({type:"CREATE",path:[o?+l:l],value:t[l]});return r}var x;(r=>(r.log=(n,...o)=>console.log(`[Pixi\u2019VN] ${n}`,...o),r.warn=(n,...o)=>console.warn(`[Pixi\u2019VN] ${n}`,...o),r.error=(n,...o)=>console.error(`[Pixi\u2019VN] ${n}`,...o),r.info=(n,...o)=>console.info(`[Pixi\u2019VN] ${n}`,...o)))(x||(x={}));function tt(f){try{if(typeof f>"u")return f;let t=JSON.stringify(f);return JSON.parse(t)}catch(t){throw x.error("Error creating exportable element",f,t),new Error("[Pixi\u2019VN] Error creating exportable element")}}function Pt(f,t){let i=tt(f);return t.length>1&&"type"in t[0]&&(t=t.reverse()),t.forEach(s=>{"type"in s?te(i,s):ee(i,s);}),i}function te(f,t){let i=f;t.path&&t.path.length>0?t.path.forEach((s,r)=>{if(t.path&&r===t.path.length-1)switch(t.type){case "CHANGE":case "REMOVE":i[s]=t.oldValue;break;case "CREATE":Array.isArray(i)&&typeof s=="number"?i.splice(s,1):delete i[s];break}else i=i[s];}):x.warn("No path found, skipping diff",t);}function ee(f,t){let i=f;t.path&&t.path.length>0?t.path.forEach((s,r)=>{if(t.path&&r===t.path.length-1){if(t.kind==="E"||t.kind==="D")i[s]=t.lhs;else if(t.kind==="N")Number.isInteger(s)?Array.isArray(i)&&i.splice(s,1):typeof s=="string"&&delete i[s];else if(t.kind==="A"){let n=t.index;t.item.kind==="N"?i[s].splice(n,1):t.item.kind==="E"||t.item.kind==="D"?i[s][n]=t.item.lhs:t.item.kind==="A"?x.warn("Nested array found, skipping diff",t):x.warn("No array found, skipping diff",t);}}else i=i[s];}):x.warn("No path found, skipping diff",t);}var ie=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,$t=new Set,kt=typeof process=="object"&&process?process:{},Yt=(f,t,i,s)=>{typeof kt.emitWarning=="function"?kt.emitWarning(f,t,i,s):console.error(`[${i}] ${t}: ${f}`);},Ct=globalThis.AbortController,Ut=globalThis.AbortSignal;if(typeof Ct>"u"){Ut=class{constructor(){w(this,"onabort");w(this,"_onabort",[]);w(this,"reason");w(this,"aborted",false);}addEventListener(s,r){this._onabort.push(r);}},Ct=class{constructor(){w(this,"signal",new Ut);t();}abort(s){if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=true;for(let r of this.signal._onabort)r(s);this.signal.onabort?.(s);}}};let f=kt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{f&&(f=false,Yt("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 se=f=>!$t.has(f),it=f=>f&&f===Math.floor(f)&&f>0&&isFinite(f),Jt=f=>it(f)?f<=Math.pow(2,8)?Uint8Array:f<=Math.pow(2,16)?Uint16Array:f<=Math.pow(2,32)?Uint32Array:f<=Number.MAX_SAFE_INTEGER?gt:null:null,gt=class extends Array{constructor(t){super(t),this.fill(0);}},yt,ht=class ht{constructor(t,i){w(this,"heap");w(this,"length");if(!e(ht,yt))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(t),this.length=0;}static create(t){let i=Jt(t);if(!i)return [];d(ht,yt,true);let s=new ht(t,i);return d(ht,yt,false),s}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}};yt=new WeakMap,b(ht,yt,false);var Rt=ht,Kt,Bt,P,M,U,lt,K,mt,St,B,O,$,v,E,p,I,G,C,D,Y,F,J,q,L,X,ot,N,bt,a,Mt,ft,et,Ht,W,qt,ct,wt,xt,st,rt,Gt,Ft,zt,A,Lt,Et,nt,Wt,Vt=class Vt{constructor(t){b(this,a);b(this,P);b(this,M);b(this,U);b(this,lt);b(this,K);b(this,mt);b(this,St);b(this,B);w(this,"ttl");w(this,"ttlResolution");w(this,"ttlAutopurge");w(this,"updateAgeOnGet");w(this,"updateAgeOnHas");w(this,"allowStale");w(this,"noDisposeOnSet");w(this,"noUpdateTTL");w(this,"maxEntrySize");w(this,"sizeCalculation");w(this,"noDeleteOnFetchRejection");w(this,"noDeleteOnStaleGet");w(this,"allowStaleOnFetchAbort");w(this,"allowStaleOnFetchRejection");w(this,"ignoreFetchAbort");b(this,O);b(this,$);b(this,v);b(this,E);b(this,p);b(this,I);b(this,G);b(this,C);b(this,D);b(this,Y);b(this,F);b(this,J);b(this,q);b(this,L);b(this,X);b(this,ot);b(this,N);b(this,bt);b(this,ft,()=>{});b(this,et,()=>{});b(this,Ht,()=>{});b(this,W,()=>false);b(this,ct,t=>{});b(this,wt,(t,i,s)=>{});b(this,xt,(t,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});w(this,Kt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:n,updateAgeOnGet:o,updateAgeOnHas:l,allowStale:h,dispose:y,onInsert:m,disposeAfter:S,noDisposeOnSet:_,noUpdateTTL:V,maxSize:Z=0,maxEntrySize:T=0,sizeCalculation:H,fetchMethod:g,memoMethod:k,noDeleteOnFetchRejection:R,noDeleteOnStaleGet:z,allowStaleOnFetchRejection:j,allowStaleOnFetchAbort:At,ignoreFetchAbort:ut,perf:vt}=t;if(vt!==void 0&&typeof vt?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(d(this,B,vt??ie),i!==0&&!it(i))throw new TypeError("max option must be a nonnegative integer");let dt=i?Jt(i):Array;if(!dt)throw new Error("invalid max value: "+i);if(d(this,P,i),d(this,M,Z),this.maxEntrySize=T||e(this,M),this.sizeCalculation=H,this.sizeCalculation){if(!e(this,M)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(k!==void 0&&typeof k!="function")throw new TypeError("memoMethod must be a function if defined");if(d(this,St,k),g!==void 0&&typeof g!="function")throw new TypeError("fetchMethod must be a function if specified");if(d(this,mt,g),d(this,ot,!!g),d(this,v,new Map),d(this,E,new Array(i).fill(void 0)),d(this,p,new Array(i).fill(void 0)),d(this,I,new dt(i)),d(this,G,new dt(i)),d(this,C,0),d(this,D,0),d(this,Y,Rt.create(i)),d(this,O,0),d(this,$,0),typeof y=="function"&&d(this,U,y),typeof m=="function"&&d(this,lt,m),typeof S=="function"?(d(this,K,S),d(this,F,[])):(d(this,K,void 0),d(this,F,void 0)),d(this,X,!!e(this,U)),d(this,bt,!!e(this,lt)),d(this,N,!!e(this,K)),this.noDisposeOnSet=!!_,this.noUpdateTTL=!!V,this.noDeleteOnFetchRejection=!!R,this.allowStaleOnFetchRejection=!!j,this.allowStaleOnFetchAbort=!!At,this.ignoreFetchAbort=!!ut,this.maxEntrySize!==0){if(e(this,M)!==0&&!it(e(this,M)))throw new TypeError("maxSize must be a positive integer if specified");if(!it(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");c(this,a,qt).call(this);}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!z,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!l,this.ttlResolution=it(r)||r===0?r:1,this.ttlAutopurge=!!n,this.ttl=s||0,this.ttl){if(!it(this.ttl))throw new TypeError("ttl must be a positive integer if specified");c(this,a,Mt).call(this);}if(e(this,P)===0&&this.ttl===0&&e(this,M)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!e(this,P)&&!e(this,M)){let pt="LRU_CACHE_UNBOUNDED";se(pt)&&($t.add(pt),Yt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",pt,Vt));}}get perf(){return e(this,B)}static unsafeExposeInternals(t){return {starts:e(t,q),ttls:e(t,L),sizes:e(t,J),keyMap:e(t,v),keyList:e(t,E),valList:e(t,p),next:e(t,I),prev:e(t,G),get head(){return e(t,C)},get tail(){return e(t,D)},free:e(t,Y),isBackgroundFetch:i=>{var s;return c(s=t,a,A).call(s,i)},backgroundFetch:(i,s,r,n)=>{var o;return c(o=t,a,zt).call(o,i,s,r,n)},moveToTail:i=>{var s;return c(s=t,a,Et).call(s,i)},indexes:i=>{var s;return c(s=t,a,st).call(s,i)},rindexes:i=>{var s;return c(s=t,a,rt).call(s,i)},isStale:i=>{var s;return e(s=t,W).call(s,i)}}}get max(){return e(this,P)}get maxSize(){return e(this,M)}get calculatedSize(){return e(this,$)}get size(){return e(this,O)}get fetchMethod(){return e(this,mt)}get memoMethod(){return e(this,St)}get dispose(){return e(this,U)}get onInsert(){return e(this,lt)}get disposeAfter(){return e(this,K)}getRemainingTTL(t){return e(this,v).has(t)?1/0:0}*entries(){for(let t of c(this,a,st).call(this))e(this,p)[t]!==void 0&&e(this,E)[t]!==void 0&&!c(this,a,A).call(this,e(this,p)[t])&&(yield [e(this,E)[t],e(this,p)[t]]);}*rentries(){for(let t of c(this,a,rt).call(this))e(this,p)[t]!==void 0&&e(this,E)[t]!==void 0&&!c(this,a,A).call(this,e(this,p)[t])&&(yield [e(this,E)[t],e(this,p)[t]]);}*keys(){for(let t of c(this,a,st).call(this)){let i=e(this,E)[t];i!==void 0&&!c(this,a,A).call(this,e(this,p)[t])&&(yield i);}}*rkeys(){for(let t of c(this,a,rt).call(this)){let i=e(this,E)[t];i!==void 0&&!c(this,a,A).call(this,e(this,p)[t])&&(yield i);}}*values(){for(let t of c(this,a,st).call(this))e(this,p)[t]!==void 0&&!c(this,a,A).call(this,e(this,p)[t])&&(yield e(this,p)[t]);}*rvalues(){for(let t of c(this,a,rt).call(this))e(this,p)[t]!==void 0&&!c(this,a,A).call(this,e(this,p)[t])&&(yield e(this,p)[t]);}[(Bt=Symbol.iterator,Kt=Symbol.toStringTag,Bt)](){return this.entries()}find(t,i={}){for(let s of c(this,a,st).call(this)){let r=e(this,p)[s],n=c(this,a,A).call(this,r)?r.__staleWhileFetching:r;if(n!==void 0&&t(n,e(this,E)[s],this))return this.get(e(this,E)[s],i)}}forEach(t,i=this){for(let s of c(this,a,st).call(this)){let r=e(this,p)[s],n=c(this,a,A).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&t.call(i,n,e(this,E)[s],this);}}rforEach(t,i=this){for(let s of c(this,a,rt).call(this)){let r=e(this,p)[s],n=c(this,a,A).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&t.call(i,n,e(this,E)[s],this);}}purgeStale(){let t=false;for(let i of c(this,a,rt).call(this,{allowStale:true}))e(this,W).call(this,i)&&(c(this,a,nt).call(this,e(this,E)[i],"expire"),t=true);return t}info(t){let i=e(this,v).get(t);if(i===void 0)return;let s=e(this,p)[i],r=c(this,a,A).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let n={value:r};if(e(this,L)&&e(this,q)){let o=e(this,L)[i],l=e(this,q)[i];if(o&&l){let h=o-(e(this,B).now()-l);n.ttl=h,n.start=Date.now();}}return e(this,J)&&(n.size=e(this,J)[i]),n}dump(){let t=[];for(let i of c(this,a,st).call(this,{allowStale:true})){let s=e(this,E)[i],r=e(this,p)[i],n=c(this,a,A).call(this,r)?r.__staleWhileFetching:r;if(n===void 0||s===void 0)continue;let o={value:n};if(e(this,L)&&e(this,q)){o.ttl=e(this,L)[i];let l=e(this,B).now()-e(this,q)[i];o.start=Math.floor(Date.now()-l);}e(this,J)&&(o.size=e(this,J)[i]),t.unshift([s,o]);}return t}load(t){this.clear();for(let[i,s]of t){if(s.start){let r=Date.now()-s.start;s.start=e(this,B).now()-r;}this.set(i,s.value,s);}}set(t,i,s={}){var _,V,Z,T;if(i===void 0)return this.delete(t),this;let{ttl:r=this.ttl,start:n,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:l=this.sizeCalculation,status:h}=s,{noUpdateTTL:y=this.noUpdateTTL}=s,m=e(this,xt).call(this,t,i,s.size||0,l);if(this.maxEntrySize&&m>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=true),c(this,a,nt).call(this,t,"set"),this;let S=e(this,O)===0?void 0:e(this,v).get(t);if(S===void 0)S=e(this,O)===0?e(this,D):e(this,Y).length!==0?e(this,Y).pop():e(this,O)===e(this,P)?c(this,a,Ft).call(this,false):e(this,O),e(this,E)[S]=t,e(this,p)[S]=i,e(this,v).set(t,S),e(this,I)[e(this,D)]=S,e(this,G)[S]=e(this,D),d(this,D,S),Ot(this,O)._++,e(this,wt).call(this,S,m,h),h&&(h.set="add"),y=false,e(this,bt)&&((_=e(this,lt))==null||_.call(this,i,t,"add"));else {c(this,a,Et).call(this,S);let H=e(this,p)[S];if(i!==H){if(e(this,ot)&&c(this,a,A).call(this,H)){H.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:g}=H;g!==void 0&&!o&&(e(this,X)&&((V=e(this,U))==null||V.call(this,g,t,"set")),e(this,N)&&e(this,F)?.push([g,t,"set"]));}else o||(e(this,X)&&((Z=e(this,U))==null||Z.call(this,H,t,"set")),e(this,N)&&e(this,F)?.push([H,t,"set"]));if(e(this,ct).call(this,S),e(this,wt).call(this,S,m,h),e(this,p)[S]=i,h){h.set="replace";let g=H&&c(this,a,A).call(this,H)?H.__staleWhileFetching:H;g!==void 0&&(h.oldValue=g);}}else h&&(h.set="update");e(this,bt)&&this.onInsert?.(i,t,i===H?"update":"replace");}if(r!==0&&!e(this,L)&&c(this,a,Mt).call(this),e(this,L)&&(y||e(this,Ht).call(this,S,r,n),h&&e(this,et).call(this,h,S)),!o&&e(this,N)&&e(this,F)){let H=e(this,F),g;for(;g=H?.shift();)(T=e(this,K))==null||T.call(this,...g);}return this}pop(){var t;try{for(;e(this,O);){let i=e(this,p)[e(this,C)];if(c(this,a,Ft).call(this,!0),c(this,a,A).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(e(this,N)&&e(this,F)){let i=e(this,F),s;for(;s=i?.shift();)(t=e(this,K))==null||t.call(this,...s);}}}has(t,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,n=e(this,v).get(t);if(n!==void 0){let o=e(this,p)[n];if(c(this,a,A).call(this,o)&&o.__staleWhileFetching===void 0)return false;if(e(this,W).call(this,n))r&&(r.has="stale",e(this,et).call(this,r,n));else return s&&e(this,ft).call(this,n),r&&(r.has="hit",e(this,et).call(this,r,n)),true}else r&&(r.has="miss");return false}peek(t,i={}){let{allowStale:s=this.allowStale}=i,r=e(this,v).get(t);if(r===void 0||!s&&e(this,W).call(this,r))return;let n=e(this,p)[r];return c(this,a,A).call(this,n)?n.__staleWhileFetching:n}async fetch(t,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:l=this.noDisposeOnSet,size:h=0,sizeCalculation:y=this.sizeCalculation,noUpdateTTL:m=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:_=this.allowStaleOnFetchRejection,ignoreFetchAbort:V=this.ignoreFetchAbort,allowStaleOnFetchAbort:Z=this.allowStaleOnFetchAbort,context:T,forceRefresh:H=false,status:g,signal:k}=i;if(!e(this,ot))return g&&(g.fetch="get"),this.get(t,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,status:g});let R={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:l,size:h,sizeCalculation:y,noUpdateTTL:m,noDeleteOnFetchRejection:S,allowStaleOnFetchRejection:_,allowStaleOnFetchAbort:Z,ignoreFetchAbort:V,status:g,signal:k},z=e(this,v).get(t);if(z===void 0){g&&(g.fetch="miss");let j=c(this,a,zt).call(this,t,z,R,T);return j.__returned=j}else {let j=e(this,p)[z];if(c(this,a,A).call(this,j)){let pt=s&&j.__staleWhileFetching!==void 0;return g&&(g.fetch="inflight",pt&&(g.returnedStale=true)),pt?j.__staleWhileFetching:j.__returned=j}let At=e(this,W).call(this,z);if(!H&&!At)return g&&(g.fetch="hit"),c(this,a,Et).call(this,z),r&&e(this,ft).call(this,z),g&&e(this,et).call(this,g,z),j;let ut=c(this,a,zt).call(this,t,z,R,T),dt=ut.__staleWhileFetching!==void 0&&s;return g&&(g.fetch=At?"stale":"refresh",dt&&At&&(g.returnedStale=true)),dt?ut.__staleWhileFetching:ut.__returned=ut}}async forceFetch(t,i={}){let s=await this.fetch(t,i);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(t,i={}){let s=e(this,St);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:n,...o}=i,l=this.get(t,o);if(!n&&l!==void 0)return l;let h=s(t,l,{options:o,context:r});return this.set(t,h,o),h}get(t,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:o}=i,l=e(this,v).get(t);if(l!==void 0){let h=e(this,p)[l],y=c(this,a,A).call(this,h);return o&&e(this,et).call(this,o,l),e(this,W).call(this,l)?(o&&(o.get="stale"),y?(o&&s&&h.__staleWhileFetching!==void 0&&(o.returnedStale=true),s?h.__staleWhileFetching:void 0):(n||c(this,a,nt).call(this,t,"expire"),o&&s&&(o.returnedStale=true),s?h:void 0)):(o&&(o.get="hit"),y?h.__staleWhileFetching:(c(this,a,Et).call(this,l),r&&e(this,ft).call(this,l),h))}else o&&(o.get="miss");}delete(t){return c(this,a,nt).call(this,t,"delete")}clear(){return c(this,a,Wt).call(this,"delete")}};P=new WeakMap,M=new WeakMap,U=new WeakMap,lt=new WeakMap,K=new WeakMap,mt=new WeakMap,St=new WeakMap,B=new WeakMap,O=new WeakMap,$=new WeakMap,v=new WeakMap,E=new WeakMap,p=new WeakMap,I=new WeakMap,G=new WeakMap,C=new WeakMap,D=new WeakMap,Y=new WeakMap,F=new WeakMap,J=new WeakMap,q=new WeakMap,L=new WeakMap,X=new WeakMap,ot=new WeakMap,N=new WeakMap,bt=new WeakMap,a=new WeakSet,Mt=function(){let t=new gt(e(this,P)),i=new gt(e(this,P));d(this,L,t),d(this,q,i),d(this,Ht,(n,o,l=e(this,B).now())=>{if(i[n]=o!==0?l:0,t[n]=o,o!==0&&this.ttlAutopurge){let h=setTimeout(()=>{e(this,W).call(this,n)&&c(this,a,nt).call(this,e(this,E)[n],"expire");},o+1);h.unref&&h.unref();}}),d(this,ft,n=>{i[n]=t[n]!==0?e(this,B).now():0;}),d(this,et,(n,o)=>{if(t[o]){let l=t[o],h=i[o];if(!l||!h)return;n.ttl=l,n.start=h,n.now=s||r();let y=n.now-h;n.remainingTTL=l-y;}});let s=0,r=()=>{let n=e(this,B).now();if(this.ttlResolution>0){s=n;let o=setTimeout(()=>s=0,this.ttlResolution);o.unref&&o.unref();}return n};this.getRemainingTTL=n=>{let o=e(this,v).get(n);if(o===void 0)return 0;let l=t[o],h=i[o];if(!l||!h)return 1/0;let y=(s||r())-h;return l-y},d(this,W,n=>{let o=i[n],l=t[n];return !!l&&!!o&&(s||r())-o>l});},ft=new WeakMap,et=new WeakMap,Ht=new WeakMap,W=new WeakMap,qt=function(){let t=new gt(e(this,P));d(this,$,0),d(this,J,t),d(this,ct,i=>{d(this,$,e(this,$)-t[i]),t[i]=0;}),d(this,xt,(i,s,r,n)=>{if(c(this,a,A).call(this,s))return 0;if(!it(r))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(r=n(s,i),!it(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}),d(this,wt,(i,s,r)=>{if(t[i]=s,e(this,M)){let n=e(this,M)-t[i];for(;e(this,$)>n;)c(this,a,Ft).call(this,true);}d(this,$,e(this,$)+t[i]),r&&(r.entrySize=s,r.totalCalculatedSize=e(this,$));});},ct=new WeakMap,wt=new WeakMap,xt=new WeakMap,st=function*({allowStale:t=this.allowStale}={}){if(e(this,O))for(let i=e(this,D);!(!c(this,a,Gt).call(this,i)||((t||!e(this,W).call(this,i))&&(yield i),i===e(this,C)));)i=e(this,G)[i];},rt=function*({allowStale:t=this.allowStale}={}){if(e(this,O))for(let i=e(this,C);!(!c(this,a,Gt).call(this,i)||((t||!e(this,W).call(this,i))&&(yield i),i===e(this,D)));)i=e(this,I)[i];},Gt=function(t){return t!==void 0&&e(this,v).get(e(this,E)[t])===t},Ft=function(t){var n;let i=e(this,C),s=e(this,E)[i],r=e(this,p)[i];return e(this,ot)&&c(this,a,A).call(this,r)?r.__abortController.abort(new Error("evicted")):(e(this,X)||e(this,N))&&(e(this,X)&&((n=e(this,U))==null||n.call(this,r,s,"evict")),e(this,N)&&e(this,F)?.push([r,s,"evict"])),e(this,ct).call(this,i),t&&(e(this,E)[i]=void 0,e(this,p)[i]=void 0,e(this,Y).push(i)),e(this,O)===1?(d(this,C,d(this,D,0)),e(this,Y).length=0):d(this,C,e(this,I)[i]),e(this,v).delete(s),Ot(this,O)._--,i},zt=function(t,i,s,r){let n=i===void 0?void 0:e(this,p)[i];if(c(this,a,A).call(this,n))return n;let o=new Ct,{signal:l}=s;l?.addEventListener("abort",()=>o.abort(l.reason),{signal:o.signal});let h={signal:o.signal,options:s,context:r},y=(T,H=false)=>{let{aborted:g}=o.signal,k=s.ignoreFetchAbort&&T!==void 0;if(s.status&&(g&&!H?(s.status.fetchAborted=true,s.status.fetchError=o.signal.reason,k&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),g&&!k&&!H)return S(o.signal.reason);let R=V;return e(this,p)[i]===V&&(T===void 0?R.__staleWhileFetching!==void 0?e(this,p)[i]=R.__staleWhileFetching:c(this,a,nt).call(this,t,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(t,T,h.options))),T},m=T=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=T),S(T)),S=T=>{let{aborted:H}=o.signal,g=H&&s.allowStaleOnFetchAbort,k=g||s.allowStaleOnFetchRejection,R=k||s.noDeleteOnFetchRejection,z=V;if(e(this,p)[i]===V&&(!R||z.__staleWhileFetching===void 0?c(this,a,nt).call(this,t,"fetch"):g||(e(this,p)[i]=z.__staleWhileFetching)),k)return s.status&&z.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),z.__staleWhileFetching;if(z.__returned===z)throw T},_=(T,H)=>{var k;let g=(k=e(this,mt))==null?void 0:k.call(this,t,n,h);g&&g instanceof Promise&&g.then(R=>T(R===void 0?void 0:R),H),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(T(void 0),s.allowStaleOnFetchAbort&&(T=R=>y(R,true)));});};s.status&&(s.status.fetchDispatched=true);let V=new Promise(_).then(y,m),Z=Object.assign(V,{__abortController:o,__staleWhileFetching:n,__returned:void 0});return i===void 0?(this.set(t,Z,{...h.options,status:void 0}),i=e(this,v).get(t)):e(this,p)[i]=Z,Z},A=function(t){if(!e(this,ot))return false;let i=t;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Ct},Lt=function(t,i){e(this,G)[i]=t,e(this,I)[t]=i;},Et=function(t){t!==e(this,D)&&(t===e(this,C)?d(this,C,e(this,I)[t]):c(this,a,Lt).call(this,e(this,G)[t],e(this,I)[t]),c(this,a,Lt).call(this,e(this,D),t),d(this,D,t));},nt=function(t,i){var r,n;let s=false;if(e(this,O)!==0){let o=e(this,v).get(t);if(o!==void 0)if(s=true,e(this,O)===1)c(this,a,Wt).call(this,i);else {e(this,ct).call(this,o);let l=e(this,p)[o];if(c(this,a,A).call(this,l)?l.__abortController.abort(new Error("deleted")):(e(this,X)||e(this,N))&&(e(this,X)&&((r=e(this,U))==null||r.call(this,l,t,i)),e(this,N)&&e(this,F)?.push([l,t,i])),e(this,v).delete(t),e(this,E)[o]=void 0,e(this,p)[o]=void 0,o===e(this,D))d(this,D,e(this,G)[o]);else if(o===e(this,C))d(this,C,e(this,I)[o]);else {let h=e(this,G)[o];e(this,I)[h]=e(this,I)[o];let y=e(this,I)[o];e(this,G)[y]=e(this,G)[o];}Ot(this,O)._--,e(this,Y).push(o);}}if(e(this,N)&&e(this,F)?.length){let o=e(this,F),l;for(;l=o?.shift();)(n=e(this,K))==null||n.call(this,...l);}return s},Wt=function(t){var i,s;for(let r of c(this,a,rt).call(this,{allowStale:true})){let n=e(this,p)[r];if(c(this,a,A).call(this,n))n.__abortController.abort(new Error("deleted"));else {let o=e(this,E)[r];e(this,X)&&((i=e(this,U))==null||i.call(this,n,o,t)),e(this,N)&&e(this,F)?.push([n,o,t]);}}if(e(this,v).clear(),e(this,p).fill(void 0),e(this,E).fill(void 0),e(this,L)&&e(this,q)&&(e(this,L).fill(0),e(this,q).fill(0)),e(this,J)&&e(this,J).fill(0),d(this,C,0),d(this,D,0),e(this,Y).length=0,d(this,$,0),d(this,O,0),e(this,N)&&e(this,F)){let r=e(this,F),n;for(;n=r?.shift();)(s=e(this,K))==null||s.call(this,...n);}};var It=Vt;var at=class{constructor(t){w(this,"cache");w(this,"map",new Map);this.cache=new It({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 i=this.map.delete(t);return i&&this.cache.delete(t),i}get forEach(){return this.map.forEach}get(t){let i=this.cache.get(t);return i||this.map.get(t)}has(t){return this.map.has(t)}set(t,i){return this.map.set(t,i),this.cache.set(t,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var Q=class Q{static get originalStepData(){return Q._originalStepData?tt(Q._originalStepData):{path:"",storage:{},canvas:{elementAliasesOrder:[],elements:{},stage:{},tickers:{},tickersSteps:{},tickersOnPause:{},tickersToCompleteOnStepEnd:{tikersIds:[],stepAlias:[]}},sound:{soundAliasesOrder:[],soundsPlaying:{},playInStepIndex:{},filters:void 0},labelIndex:-1,openedLabels:[]}}static set originalStepData(t){Q._originalStepData=tt(t);}};w(Q,"_diffHistory",new at({cacheSize:5})),w(Q,"_stepsInfoHistory",new at({cacheSize:5})),w(Q,"_narrationHistory",new at({cacheSize:50})),w(Q,"stepLimitSaved",20),w(Q,"goBackRunning",false),w(Q,"_originalStepData");var u=Q;var Tt=class{get stepsInfoMap(){return u._stepsInfoHistory}get diffMap(){return u._diffHistory}get narrationMap(){return u._narrationHistory}get size(){return u._stepsInfoHistory.size}get lastKey(){return this.size===0?null:Math.max(...Array.from(this.keys()))}keys(){return u._stepsInfoHistory.keys()}get(t){let i=u._narrationHistory.get(t);if(!(i&&Object.keys(i).length===1&&i.stepIndex!==void 0))return i}delete(t){u._stepsInfoHistory.delete(t),u._diffHistory.delete(t),u._narrationHistory.delete(t);}internalRestoreOldGameState(t,i){if(t<=0||this.size==0)return i;let s=this.lastKey;if(typeof s!="number")return x.error("You can't go back, there is no step to go back"),i;let r=u._diffHistory.get(s);if(r)try{let n=Pt(i,r);return unifier.GameUnifier.stepCounter=s,this.delete(s),this.internalRestoreOldGameState(t-1,n)}catch(n){return x.error("Error applying diff",n),i}else return x.error("You can't go back, there is no step to go back"),i}async goBack(t,i=1){return await this.back(t,i)}async back(t,i=1){if(i<=0){x.warn("The parameter steps must be greater than 0");return}if(u._diffHistory.size<1){x.warn("You can't go back, there is no step to go back");return}if(u.goBackRunning){x.warn("Go back is already running");return}u.goBackRunning=true;try{let s=tt(this.internalRestoreOldGameState(i,u.originalStepData));if(s){await unifier.GameUnifier.restoreGameStepState(s,t);let r=unifier.GameUnifier.stepCounter-1,n=u._narrationHistory.get(r);if(n&&Object.keys(n).length===1&&n.stepIndex!==void 0){let o=u._stepsInfoHistory.get(r);if(o){let l=this.itemMapper({step:o});u._narrationHistory.set(o.index,l);}}}else x.error("Error going back");u.originalStepData=s,u.goBackRunning=!1;}catch(s){x.error("Error going back",s),u.goBackRunning=false;}}add(t,i={}){let s=u.originalStepData,{ignoreSameStep:r}=i,n=unifier.GameUnifier.currentGameStepState;if(!r&&this.isSameStep(s,n))return;let o=this.lastKey;(async()=>{try{let h,y;if(typeof o=="number"&&(h=u._stepsInfoHistory.get(o),y=u._narrationHistory.get(o)),u._stepsInfoHistory.set(t.index,t),t.index!==0){let _=Dt(s,n);_?u._diffHistory.set(t.index,_):x.warn("It was not possible to create the difference between the two steps");}let m={},S=this.itemMapper({step:t},m);if(u._narrationHistory.set(t.index,S),h&&y&&typeof o=="number"){let _=this.itemMapper({...m,step:h},{});u._narrationHistory.set(o,_);}}catch(h){x.error("Error adding history step",h);}})(),u.originalStepData=n;}itemMapper(t,i){let{step:s,choiceIndexMade:r,inputValue:n,removeDialogue:o}=t,l=s.dialogue||s.dialoge;i&&s.isGlued&&(i.removeDialogue=true),o&&(l=void 0);let h=s.choices;if(i&&s.currentLabel&&s.choiceIndexMade!==void 0&&(i.choiceIndexMade=s.choiceIndexMade),s.inputValue&&i&&(i.inputValue=s.inputValue),l||h||n){let y=h?.map((m,S)=>{let _=false;return m.oneTime&&s.alreadyMadeChoices&&s.alreadyMadeChoices.includes(S)&&(_=true),{text:m.text,type:m.type,isResponse:false,hidden:_}});if(y){if(y.every(m=>m.hidden)){let m=y.find(S=>S.hidden===false);m&&(m.hidden=false);}r!==void 0&&(y[r].isResponse=true);}return {dialogue:l?{...l,character:l.character?unifier.GameUnifier.getCharacter(l.character)||l.character:void 0}:void 0,playerMadeChoice:typeof r=="number",choices:y,stepIndex:s.index,inputValue:n}}return {stepIndex:s.index}}get narrativeHistory(){let t=[];return Array.from(this.keys()).sort((s,r)=>s-r).forEach(s=>{let r=this.get(s);r&&t.push(r);}),t}get currentLabelHistory(){let t=[],i=Array.from(this.keys()).sort((h,y)=>y-h);if(i.length===0)return t;let s=i[0];if(typeof s!="number")return t;let r=u._stepsInfoHistory.get(s);if(!r)return t;let n=r.openedLabels;if(!n||!Array.isArray(n)||n.length===0)return t;let o=n[0].currentStepIndex,l=n[0].label;return i.every((h,y)=>{let m=this.get(h);if(m){if(y===0)return t.push(m),true;let S=u._stepsInfoHistory.get(h);if(!S)return true;let _=S.openedLabels;if(!_||!Array.isArray(_)||_.length===0||_[0].label!==l||_[0].currentStepIndex>=o)return false;o=_[0].currentStepIndex,t.push(m);}return true}),t.reverse()}removeNarrativeHistory(t){if(t){let i=Array.from(this.keys()).sort((s,r)=>s-r);i=i.slice(0,t),i.forEach(s=>{u._narrationHistory.delete(s),u._stepsInfoHistory.delete(s),u._diffHistory.delete(s);});}else u._stepsInfoHistory.clear(),u._diffHistory.clear(),u._narrationHistory.clear();}get canGoBack(){let t=this.lastKey;return typeof t!="number"?false:u._diffHistory.has(t)}blockGoBack(){unifier.GameUnifier.currentStepsRunningNumber===0&&u._diffHistory.clear();}isSameStep(t,i){if(t.openedLabels.length===i.openedLabels.length)try{let s=JSON.stringify(t.openedLabels),r=JSON.stringify(i.openedLabels);if(s===r&&t.path===i.path&&t.labelIndex===i.labelIndex)return !0}catch(s){return x.error("Error comparing opened labels",s),true}return false}clear(){u._stepsInfoHistory.clear(),u._diffHistory.clear(),u._narrationHistory.clear(),u._originalStepData=void 0;}get stepLimitSaved(){return u.stepLimitSaved}set stepLimitSaved(t){u.stepLimitSaved=t;}export(){let t=Array.from(this.keys()).sort((s,r)=>s-r);t.length>this.stepLimitSaved&&(t=t.slice(t.length-this.stepLimitSaved));let i=[];return t.forEach(s=>{let r=u._stepsInfoHistory.get(s);if(r){let n=u._diffHistory.get(s);i.push({...r,diff:n});}}),{stepsHistory:tt(i),originalStepData:tt(u._originalStepData)}}restoreNarrativeHistory(){let t=Array.from(this.keys()).sort((s,r)=>s-r),i={};t.forEach(s=>{let r=u._stepsInfoHistory.get(s);if(r){let n={...i};i={};let o=this.itemMapper({step:r,choiceIndexMade:n.choiceIndexMade,inputValue:n.inputValue,removeDialogue:n.removeDialogue},i);o&&u._narrationHistory.set(s,o);}});}async restore(t){this.clear();try{t.hasOwnProperty("stepsHistory")?(t.stepsHistory.forEach(s=>{s.diff&&u._diffHistory.set(s.index,s.diff);let r={...s,diff:void 0};u._stepsInfoHistory.set(s.index,r);}),this.restoreNarrativeHistory()):x.warn("Could not import stepsHistory data, so will be ignored"),t.hasOwnProperty("originalStepData")?u._originalStepData=t.originalStepData:x.warn("Could not import originalStepData data, so will be ignored");}catch(i){x.error("Error importing data",i);}}};var Me=new Tt;exports.HistoryManagerStatic=u;exports.stepHistory=Me;
|
package/dist/history.d.cts
CHANGED
|
@@ -50,11 +50,15 @@ interface HistoryManagerInterface {
|
|
|
50
50
|
* @example
|
|
51
51
|
* ```typescript
|
|
52
52
|
* export function goBack(navigate: (path: string) => void | Promise<void>, afterBack?: () => void) {
|
|
53
|
-
*
|
|
53
|
+
* stepHistory.back(navigate)
|
|
54
54
|
* afterBack && afterBack()
|
|
55
55
|
* }
|
|
56
56
|
* ```
|
|
57
57
|
*/
|
|
58
|
+
back(navigate: (path: string) => void | Promise<void>, steps?: number): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* @deprecated use {@link back} instead.
|
|
61
|
+
*/
|
|
58
62
|
goBack(navigate: (path: string) => void | Promise<void>, steps?: number): Promise<void>;
|
|
59
63
|
/**
|
|
60
64
|
* Block the go back function.
|
|
@@ -137,7 +141,7 @@ interface HistoryManagerInterface {
|
|
|
137
141
|
}
|
|
138
142
|
|
|
139
143
|
declare class HistoryManagerStatic {
|
|
140
|
-
static _diffHistory: CachedMap<number, deepDiff.Diff<GameStepState, GameStepState>[]
|
|
144
|
+
static _diffHistory: CachedMap<number, Difference[] | deepDiff.Diff<GameStepState, GameStepState>[]>;
|
|
141
145
|
static _stepsInfoHistory: CachedMap<number, Omit<HistoryStep, "diff">>;
|
|
142
146
|
static _narrationHistory: CachedMap<number, NarrationHistory>;
|
|
143
147
|
static stepLimitSaved: number;
|
package/dist/history.d.ts
CHANGED
|
@@ -50,11 +50,15 @@ interface HistoryManagerInterface {
|
|
|
50
50
|
* @example
|
|
51
51
|
* ```typescript
|
|
52
52
|
* export function goBack(navigate: (path: string) => void | Promise<void>, afterBack?: () => void) {
|
|
53
|
-
*
|
|
53
|
+
* stepHistory.back(navigate)
|
|
54
54
|
* afterBack && afterBack()
|
|
55
55
|
* }
|
|
56
56
|
* ```
|
|
57
57
|
*/
|
|
58
|
+
back(navigate: (path: string) => void | Promise<void>, steps?: number): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* @deprecated use {@link back} instead.
|
|
61
|
+
*/
|
|
58
62
|
goBack(navigate: (path: string) => void | Promise<void>, steps?: number): Promise<void>;
|
|
59
63
|
/**
|
|
60
64
|
* Block the go back function.
|
|
@@ -137,7 +141,7 @@ interface HistoryManagerInterface {
|
|
|
137
141
|
}
|
|
138
142
|
|
|
139
143
|
declare class HistoryManagerStatic {
|
|
140
|
-
static _diffHistory: CachedMap<number, deepDiff.Diff<GameStepState, GameStepState>[]
|
|
144
|
+
static _diffHistory: CachedMap<number, Difference[] | deepDiff.Diff<GameStepState, GameStepState>[]>;
|
|
141
145
|
static _stepsInfoHistory: CachedMap<number, Omit<HistoryStep, "diff">>;
|
|
142
146
|
static _narrationHistory: CachedMap<number, NarrationHistory>;
|
|
143
147
|
static stepLimitSaved: number;
|
package/dist/history.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import'./chunk-XSN6P5JL.mjs';import {a}from'./chunk-
|
|
1
|
+
import'./chunk-XSN6P5JL.mjs';import {a}from'./chunk-RXNJBYVP.mjs';import {d,k as k$1,j}from'./chunk-GNJIUFU2.mjs';import {GameUnifier}from'@drincs/pixi-vn/unifier';var D={Date:true,RegExp:true,String:true,Number:true};function x(y,e,r={cyclesFix:true},t=[]){let a=[],n=Array.isArray(y);for(let l in y){let o=y[l],u=n?+l:l;if(!(l in e)){a.push({type:"REMOVE",path:[u],oldValue:y[l]});continue}let s=e[l],d=typeof o=="object"&&typeof s=="object"&&Array.isArray(o)===Array.isArray(s);o&&s&&d&&!D[Object.getPrototypeOf(o)?.constructor?.name]&&(!r.cyclesFix||!t.includes(o))?a.push.apply(a,x(o,s,r,r.cyclesFix?t.concat([o]):[]).map(c=>(c.path.unshift(u),c))):o!==s&&!(Number.isNaN(o)&&Number.isNaN(s))&&!(d&&(isNaN(o)?o+""==s+"":+o==+s))&&a.push({path:[u],type:"CHANGE",value:s,oldValue:o});}let f=Array.isArray(e);for(let l in e)l in y||a.push({type:"CREATE",path:[f?+l:l],value:e[l]});return a}function k(y,e){let r=k$1(y);return e.length>1&&"type"in e[0]&&(e=e.reverse()),e.forEach(t=>{"type"in t?I(r,t):E(r,t);}),r}function I(y,e){let r=y;e.path&&e.path.length>0?e.path.forEach((t,a)=>{if(e.path&&a===e.path.length-1)switch(e.type){case "CHANGE":case "REMOVE":r[t]=e.oldValue;break;case "CREATE":Array.isArray(r)&&typeof t=="number"?r.splice(t,1):delete r[t];break}else r=r[t];}):j.warn("No path found, skipping diff",e);}function E(y,e){let r=y;e.path&&e.path.length>0?e.path.forEach((t,a)=>{if(e.path&&a===e.path.length-1){if(e.kind==="E"||e.kind==="D")r[t]=e.lhs;else if(e.kind==="N")Number.isInteger(t)?Array.isArray(r)&&r.splice(t,1):typeof t=="string"&&delete r[t];else if(e.kind==="A"){let n=e.index;e.item.kind==="N"?r[t].splice(n,1):e.item.kind==="E"||e.item.kind==="D"?r[t][n]=e.item.lhs:e.item.kind==="A"?j.warn("Nested array found, skipping diff",e):j.warn("No array found, skipping diff",e);}}else r=r[t];}):j.warn("No path found, skipping diff",e);}var m=class m{static get originalStepData(){return m._originalStepData?k$1(m._originalStepData):{path:"",storage:{},canvas:{elementAliasesOrder:[],elements:{},stage:{},tickers:{},tickersSteps:{},tickersOnPause:{},tickersToCompleteOnStepEnd:{tikersIds:[],stepAlias:[]}},sound:{soundAliasesOrder:[],soundsPlaying:{},playInStepIndex:{},filters:void 0},labelIndex:-1,openedLabels:[]}}static set originalStepData(e){m._originalStepData=k$1(e);}};d(m,"_diffHistory",new a({cacheSize:5})),d(m,"_stepsInfoHistory",new a({cacheSize:5})),d(m,"_narrationHistory",new a({cacheSize:50})),d(m,"stepLimitSaved",20),d(m,"goBackRunning",false),d(m,"_originalStepData");var i=m;var b=class{get stepsInfoMap(){return i._stepsInfoHistory}get diffMap(){return i._diffHistory}get narrationMap(){return i._narrationHistory}get size(){return i._stepsInfoHistory.size}get lastKey(){return this.size===0?null:Math.max(...Array.from(this.keys()))}keys(){return i._stepsInfoHistory.keys()}get(e){let r=i._narrationHistory.get(e);if(!(r&&Object.keys(r).length===1&&r.stepIndex!==void 0))return r}delete(e){i._stepsInfoHistory.delete(e),i._diffHistory.delete(e),i._narrationHistory.delete(e);}internalRestoreOldGameState(e,r){if(e<=0||this.size==0)return r;let t=this.lastKey;if(typeof t!="number")return j.error("You can't go back, there is no step to go back"),r;let a=i._diffHistory.get(t);if(a)try{let n=k(r,a);return GameUnifier.stepCounter=t,this.delete(t),this.internalRestoreOldGameState(e-1,n)}catch(n){return j.error("Error applying diff",n),r}else return j.error("You can't go back, there is no step to go back"),r}async goBack(e,r=1){return await this.back(e,r)}async back(e,r=1){if(r<=0){j.warn("The parameter steps must be greater than 0");return}if(i._diffHistory.size<1){j.warn("You can't go back, there is no step to go back");return}if(i.goBackRunning){j.warn("Go back is already running");return}i.goBackRunning=true;try{let t=k$1(this.internalRestoreOldGameState(r,i.originalStepData));if(t){await GameUnifier.restoreGameStepState(t,e);let a=GameUnifier.stepCounter-1,n=i._narrationHistory.get(a);if(n&&Object.keys(n).length===1&&n.stepIndex!==void 0){let f=i._stepsInfoHistory.get(a);if(f){let l=this.itemMapper({step:f});i._narrationHistory.set(f.index,l);}}}else j.error("Error going back");i.originalStepData=t,i.goBackRunning=!1;}catch(t){j.error("Error going back",t),i.goBackRunning=false;}}add(e,r={}){let t=i.originalStepData,{ignoreSameStep:a}=r,n=GameUnifier.currentGameStepState;if(!a&&this.isSameStep(t,n))return;let f=this.lastKey;(async()=>{try{let o,u;if(typeof f=="number"&&(o=i._stepsInfoHistory.get(f),u=i._narrationHistory.get(f)),i._stepsInfoHistory.set(e.index,e),e.index!==0){let c=x(t,n);c?i._diffHistory.set(e.index,c):j.warn("It was not possible to create the difference between the two steps");}let s={},d=this.itemMapper({step:e},s);if(i._narrationHistory.set(e.index,d),o&&u&&typeof f=="number"){let c=this.itemMapper({...s,step:o},{});i._narrationHistory.set(f,c);}}catch(o){j.error("Error adding history step",o);}})(),i.originalStepData=n;}itemMapper(e,r){let{step:t,choiceIndexMade:a,inputValue:n,removeDialogue:f}=e,l=t.dialogue||t.dialoge;r&&t.isGlued&&(r.removeDialogue=true),f&&(l=void 0);let o=t.choices;if(r&&t.currentLabel&&t.choiceIndexMade!==void 0&&(r.choiceIndexMade=t.choiceIndexMade),t.inputValue&&r&&(r.inputValue=t.inputValue),l||o||n){let u=o?.map((s,d)=>{let c=false;return s.oneTime&&t.alreadyMadeChoices&&t.alreadyMadeChoices.includes(d)&&(c=true),{text:s.text,type:s.type,isResponse:false,hidden:c}});if(u){if(u.every(s=>s.hidden)){let s=u.find(d=>d.hidden===false);s&&(s.hidden=false);}a!==void 0&&(u[a].isResponse=true);}return {dialogue:l?{...l,character:l.character?GameUnifier.getCharacter(l.character)||l.character:void 0}:void 0,playerMadeChoice:typeof a=="number",choices:u,stepIndex:t.index,inputValue:n}}return {stepIndex:t.index}}get narrativeHistory(){let e=[];return Array.from(this.keys()).sort((t,a)=>t-a).forEach(t=>{let a=this.get(t);a&&e.push(a);}),e}get currentLabelHistory(){let e=[],r=Array.from(this.keys()).sort((o,u)=>u-o);if(r.length===0)return e;let t=r[0];if(typeof t!="number")return e;let a=i._stepsInfoHistory.get(t);if(!a)return e;let n=a.openedLabels;if(!n||!Array.isArray(n)||n.length===0)return e;let f=n[0].currentStepIndex,l=n[0].label;return r.every((o,u)=>{let s=this.get(o);if(s){if(u===0)return e.push(s),true;let d=i._stepsInfoHistory.get(o);if(!d)return true;let c=d.openedLabels;if(!c||!Array.isArray(c)||c.length===0||c[0].label!==l||c[0].currentStepIndex>=f)return false;f=c[0].currentStepIndex,e.push(s);}return true}),e.reverse()}removeNarrativeHistory(e){if(e){let r=Array.from(this.keys()).sort((t,a)=>t-a);r=r.slice(0,e),r.forEach(t=>{i._narrationHistory.delete(t),i._stepsInfoHistory.delete(t),i._diffHistory.delete(t);});}else i._stepsInfoHistory.clear(),i._diffHistory.clear(),i._narrationHistory.clear();}get canGoBack(){let e=this.lastKey;return typeof e!="number"?false:i._diffHistory.has(e)}blockGoBack(){GameUnifier.currentStepsRunningNumber===0&&i._diffHistory.clear();}isSameStep(e,r){if(e.openedLabels.length===r.openedLabels.length)try{let t=JSON.stringify(e.openedLabels),a=JSON.stringify(r.openedLabels);if(t===a&&e.path===r.path&&e.labelIndex===r.labelIndex)return !0}catch(t){return j.error("Error comparing opened labels",t),true}return false}clear(){i._stepsInfoHistory.clear(),i._diffHistory.clear(),i._narrationHistory.clear(),i._originalStepData=void 0;}get stepLimitSaved(){return i.stepLimitSaved}set stepLimitSaved(e){i.stepLimitSaved=e;}export(){let e=Array.from(this.keys()).sort((t,a)=>t-a);e.length>this.stepLimitSaved&&(e=e.slice(e.length-this.stepLimitSaved));let r=[];return e.forEach(t=>{let a=i._stepsInfoHistory.get(t);if(a){let n=i._diffHistory.get(t);r.push({...a,diff:n});}}),{stepsHistory:k$1(r),originalStepData:k$1(i._originalStepData)}}restoreNarrativeHistory(){let e=Array.from(this.keys()).sort((t,a)=>t-a),r={};e.forEach(t=>{let a=i._stepsInfoHistory.get(t);if(a){let n={...r};r={};let f=this.itemMapper({step:a,choiceIndexMade:n.choiceIndexMade,inputValue:n.inputValue,removeDialogue:n.removeDialogue},r);f&&i._narrationHistory.set(t,f);}});}async restore(e){this.clear();try{e.hasOwnProperty("stepsHistory")?(e.stepsHistory.forEach(t=>{t.diff&&i._diffHistory.set(t.index,t.diff);let a={...t,diff:void 0};i._stepsInfoHistory.set(t.index,a);}),this.restoreNarrativeHistory()):j.warn("Could not import stepsHistory data, so will be ignored"),e.hasOwnProperty("originalStepData")?i._originalStepData=e.originalStepData:j.warn("Could not import originalStepData data, so will be ignored");}catch(r){j.error("Error importing data",r);}}};var B=new b;export{i as HistoryManagerStatic,B as stepHistory};
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var I=require('@drincs/pixi-vn/canvas'),Bt=require('@drincs/pixi-vn/characters'),Z=require('@drincs/pixi-vn/history'),D=require('@drincs/pixi-vn/narration'),pixi_js=require('@drincs/pixi-vn/pixi.js'),ot=require('@drincs/pixi-vn/sound'),N=require('@drincs/pixi-vn/storage'),unifier=require('@drincs/pixi-vn/unifier');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 I__namespace=/*#__PURE__*/_interopNamespace(I);var Bt__namespace=/*#__PURE__*/_interopNamespace(Bt);var Z__namespace=/*#__PURE__*/_interopNamespace(Z);var D__namespace=/*#__PURE__*/_interopNamespace(D);var ot__namespace=/*#__PURE__*/_interopNamespace(ot);var N__namespace=/*#__PURE__*/_interopNamespace(N);var Xt=Object.defineProperty;var Jt=l=>{throw TypeError(l)};var he=(l,e,i)=>e in l?Xt(l,e,{enumerable:true,configurable:true,writable:true,value:i}):l[e]=i;var le=(l,e)=>{for(var i in e)Xt(l,i,{get:e[i],enumerable:true});};var S=(l,e,i)=>he(l,typeof e!="symbol"?e+"":e,i),zt=(l,e,i)=>e.has(l)||Jt("Cannot "+i);var t=(l,e,i)=>(zt(l,e,"read from private field"),i?i.call(l):e.get(l)),_=(l,e,i)=>e.has(l)?Jt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(l):e.set(l,i),f=(l,e,i,s)=>(zt(l,e,"write to private field"),e.set(l,i),i),h=(l,e,i)=>(zt(l,e,"access private method"),i);var Ut=(l,e,i,s)=>({set _(o){f(l,e,o);},get _(){return t(l,e,s)}});var dt=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,ee=new Set,Lt=typeof process=="object"&&process?process:{},ie=(l,e,i,s)=>{typeof Lt.emitWarning=="function"?Lt.emitWarning(l,e,i,s):console.error(`[${i}] ${e}: ${l}`);},Ct=globalThis.AbortController,Qt=globalThis.AbortSignal;if(typeof Ct>"u"){Qt=class{constructor(){S(this,"onabort");S(this,"_onabort",[]);S(this,"reason");S(this,"aborted",false);}addEventListener(s,o){this._onabort.push(o);}},Ct=class{constructor(){S(this,"signal",new Qt);e();}abort(s){if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=true;for(let o of this.signal._onabort)o(s);this.signal.onabort?.(s);}}};let l=Lt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{l&&(l=false,ie("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e));};}var ce=l=>!ee.has(l),et=l=>l&&l===Math.floor(l)&&l>0&&isFinite(l),se=l=>et(l)?l<=Math.pow(2,8)?Uint8Array:l<=Math.pow(2,16)?Uint16Array:l<=Math.pow(2,32)?Uint32Array:l<=Number.MAX_SAFE_INTEGER?pt:null:null,pt=class extends Array{constructor(e){super(e),this.fill(0);}},mt,at=class at{constructor(e,i){S(this,"heap");S(this,"length");if(!t(at,mt))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}static create(e){let i=se(e);if(!i)return [];f(at,mt,true);let s=new at(e,i);return f(at,mt,false),s}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}};mt=new WeakMap,_(at,mt,false);var Nt=at,Zt,te,q,P,K,ht,$,gt,_t,E,Y,A,x,p,R,M,F,U,B,T,X,J,V,Q,rt,j,vt,a,Pt,lt,tt,xt,G,ne,ct,yt,wt,it,st,Mt,Tt,Ot,b,Vt,bt,nt,Gt,Wt=class Wt{constructor(e){_(this,a);_(this,q);_(this,P);_(this,K);_(this,ht);_(this,$);_(this,gt);_(this,_t);S(this,"ttl");S(this,"ttlResolution");S(this,"ttlAutopurge");S(this,"updateAgeOnGet");S(this,"updateAgeOnHas");S(this,"allowStale");S(this,"noDisposeOnSet");S(this,"noUpdateTTL");S(this,"maxEntrySize");S(this,"sizeCalculation");S(this,"noDeleteOnFetchRejection");S(this,"noDeleteOnStaleGet");S(this,"allowStaleOnFetchAbort");S(this,"allowStaleOnFetchRejection");S(this,"ignoreFetchAbort");_(this,E);_(this,Y);_(this,A);_(this,x);_(this,p);_(this,R);_(this,M);_(this,F);_(this,U);_(this,B);_(this,T);_(this,X);_(this,J);_(this,V);_(this,Q);_(this,rt);_(this,j);_(this,vt);_(this,lt,()=>{});_(this,tt,()=>{});_(this,xt,()=>{});_(this,G,()=>false);_(this,ct,e=>{});_(this,yt,(e,i,s)=>{});_(this,wt,(e,i,s,o)=>{if(s||o)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});S(this,Zt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:o=1,ttlAutopurge:n,updateAgeOnGet:r,updateAgeOnHas:d,allowStale:u,dispose:w,onInsert:k,disposeAfter:c,noDisposeOnSet:W,noUpdateTTL:O,maxSize:g=0,maxEntrySize:v=0,sizeCalculation:y,fetchMethod:m,memoMethod:z,noDeleteOnFetchRejection:L,noDeleteOnStaleGet:C,allowStaleOnFetchRejection:H,allowStaleOnFetchAbort:St,ignoreFetchAbort:ft}=e;if(i!==0&&!et(i))throw new TypeError("max option must be a nonnegative integer");let Et=i?se(i):Array;if(!Et)throw new Error("invalid max value: "+i);if(f(this,q,i),f(this,P,g),this.maxEntrySize=v||t(this,P),this.sizeCalculation=y,this.sizeCalculation){if(!t(this,P)&&!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(z!==void 0&&typeof z!="function")throw new TypeError("memoMethod must be a function if defined");if(f(this,_t,z),m!==void 0&&typeof m!="function")throw new TypeError("fetchMethod must be a function if specified");if(f(this,gt,m),f(this,rt,!!m),f(this,A,new Map),f(this,x,new Array(i).fill(void 0)),f(this,p,new Array(i).fill(void 0)),f(this,R,new Et(i)),f(this,M,new Et(i)),f(this,F,0),f(this,U,0),f(this,B,Nt.create(i)),f(this,E,0),f(this,Y,0),typeof w=="function"&&f(this,K,w),typeof k=="function"&&f(this,ht,k),typeof c=="function"?(f(this,$,c),f(this,T,[])):(f(this,$,void 0),f(this,T,void 0)),f(this,Q,!!t(this,K)),f(this,vt,!!t(this,ht)),f(this,j,!!t(this,$)),this.noDisposeOnSet=!!W,this.noUpdateTTL=!!O,this.noDeleteOnFetchRejection=!!L,this.allowStaleOnFetchRejection=!!H,this.allowStaleOnFetchAbort=!!St,this.ignoreFetchAbort=!!ft,this.maxEntrySize!==0){if(t(this,P)!==0&&!et(t(this,P)))throw new TypeError("maxSize must be a positive integer if specified");if(!et(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");h(this,a,ne).call(this);}if(this.allowStale=!!u,this.noDeleteOnStaleGet=!!C,this.updateAgeOnGet=!!r,this.updateAgeOnHas=!!d,this.ttlResolution=et(o)||o===0?o:1,this.ttlAutopurge=!!n,this.ttl=s||0,this.ttl){if(!et(this.ttl))throw new TypeError("ttl must be a positive integer if specified");h(this,a,Pt).call(this);}if(t(this,q)===0&&this.ttl===0&&t(this,P)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,q)&&!t(this,P)){let ut="LRU_CACHE_UNBOUNDED";ce(ut)&&(ee.add(ut),ie("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",ut,Wt));}}static unsafeExposeInternals(e){return {starts:t(e,J),ttls:t(e,V),sizes:t(e,X),keyMap:t(e,A),keyList:t(e,x),valList:t(e,p),next:t(e,R),prev:t(e,M),get head(){return t(e,F)},get tail(){return t(e,U)},free:t(e,B),isBackgroundFetch:i=>{var s;return h(s=e,a,b).call(s,i)},backgroundFetch:(i,s,o,n)=>{var r;return h(r=e,a,Ot).call(r,i,s,o,n)},moveToTail:i=>{var s;return h(s=e,a,bt).call(s,i)},indexes:i=>{var s;return h(s=e,a,it).call(s,i)},rindexes:i=>{var s;return h(s=e,a,st).call(s,i)},isStale:i=>{var s;return t(s=e,G).call(s,i)}}}get max(){return t(this,q)}get maxSize(){return t(this,P)}get calculatedSize(){return t(this,Y)}get size(){return t(this,E)}get fetchMethod(){return t(this,gt)}get memoMethod(){return t(this,_t)}get dispose(){return t(this,K)}get onInsert(){return t(this,ht)}get disposeAfter(){return t(this,$)}getRemainingTTL(e){return t(this,A).has(e)?1/0:0}*entries(){for(let e of h(this,a,it).call(this))t(this,p)[e]!==void 0&&t(this,x)[e]!==void 0&&!h(this,a,b).call(this,t(this,p)[e])&&(yield [t(this,x)[e],t(this,p)[e]]);}*rentries(){for(let e of h(this,a,st).call(this))t(this,p)[e]!==void 0&&t(this,x)[e]!==void 0&&!h(this,a,b).call(this,t(this,p)[e])&&(yield [t(this,x)[e],t(this,p)[e]]);}*keys(){for(let e of h(this,a,it).call(this)){let i=t(this,x)[e];i!==void 0&&!h(this,a,b).call(this,t(this,p)[e])&&(yield i);}}*rkeys(){for(let e of h(this,a,st).call(this)){let i=t(this,x)[e];i!==void 0&&!h(this,a,b).call(this,t(this,p)[e])&&(yield i);}}*values(){for(let e of h(this,a,it).call(this))t(this,p)[e]!==void 0&&!h(this,a,b).call(this,t(this,p)[e])&&(yield t(this,p)[e]);}*rvalues(){for(let e of h(this,a,st).call(this))t(this,p)[e]!==void 0&&!h(this,a,b).call(this,t(this,p)[e])&&(yield t(this,p)[e]);}[(te=Symbol.iterator,Zt=Symbol.toStringTag,te)](){return this.entries()}find(e,i={}){for(let s of h(this,a,it).call(this)){let o=t(this,p)[s],n=h(this,a,b).call(this,o)?o.__staleWhileFetching:o;if(n!==void 0&&e(n,t(this,x)[s],this))return this.get(t(this,x)[s],i)}}forEach(e,i=this){for(let s of h(this,a,it).call(this)){let o=t(this,p)[s],n=h(this,a,b).call(this,o)?o.__staleWhileFetching:o;n!==void 0&&e.call(i,n,t(this,x)[s],this);}}rforEach(e,i=this){for(let s of h(this,a,st).call(this)){let o=t(this,p)[s],n=h(this,a,b).call(this,o)?o.__staleWhileFetching:o;n!==void 0&&e.call(i,n,t(this,x)[s],this);}}purgeStale(){let e=false;for(let i of h(this,a,st).call(this,{allowStale:true}))t(this,G).call(this,i)&&(h(this,a,nt).call(this,t(this,x)[i],"expire"),e=true);return e}info(e){let i=t(this,A).get(e);if(i===void 0)return;let s=t(this,p)[i],o=h(this,a,b).call(this,s)?s.__staleWhileFetching:s;if(o===void 0)return;let n={value:o};if(t(this,V)&&t(this,J)){let r=t(this,V)[i],d=t(this,J)[i];if(r&&d){let u=r-(dt.now()-d);n.ttl=u,n.start=Date.now();}}return t(this,X)&&(n.size=t(this,X)[i]),n}dump(){let e=[];for(let i of h(this,a,it).call(this,{allowStale:true})){let s=t(this,x)[i],o=t(this,p)[i],n=h(this,a,b).call(this,o)?o.__staleWhileFetching:o;if(n===void 0||s===void 0)continue;let r={value:n};if(t(this,V)&&t(this,J)){r.ttl=t(this,V)[i];let d=dt.now()-t(this,J)[i];r.start=Math.floor(Date.now()-d);}t(this,X)&&(r.size=t(this,X)[i]),e.unshift([s,r]);}return e}load(e){this.clear();for(let[i,s]of e){if(s.start){let o=Date.now()-s.start;s.start=dt.now()-o;}this.set(i,s.value,s);}}set(e,i,s={}){var W,O,g,v;if(i===void 0)return this.delete(e),this;let{ttl:o=this.ttl,start:n,noDisposeOnSet:r=this.noDisposeOnSet,sizeCalculation:d=this.sizeCalculation,status:u}=s,{noUpdateTTL:w=this.noUpdateTTL}=s,k=t(this,wt).call(this,e,i,s.size||0,d);if(this.maxEntrySize&&k>this.maxEntrySize)return u&&(u.set="miss",u.maxEntrySizeExceeded=true),h(this,a,nt).call(this,e,"set"),this;let c=t(this,E)===0?void 0:t(this,A).get(e);if(c===void 0)c=t(this,E)===0?t(this,U):t(this,B).length!==0?t(this,B).pop():t(this,E)===t(this,q)?h(this,a,Tt).call(this,false):t(this,E),t(this,x)[c]=e,t(this,p)[c]=i,t(this,A).set(e,c),t(this,R)[t(this,U)]=c,t(this,M)[c]=t(this,U),f(this,U,c),Ut(this,E)._++,t(this,yt).call(this,c,k,u),u&&(u.set="add"),w=false,t(this,vt)&&((W=t(this,ht))==null||W.call(this,i,e,"add"));else {h(this,a,bt).call(this,c);let y=t(this,p)[c];if(i!==y){if(t(this,rt)&&h(this,a,b).call(this,y)){y.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:m}=y;m!==void 0&&!r&&(t(this,Q)&&((O=t(this,K))==null||O.call(this,m,e,"set")),t(this,j)&&t(this,T)?.push([m,e,"set"]));}else r||(t(this,Q)&&((g=t(this,K))==null||g.call(this,y,e,"set")),t(this,j)&&t(this,T)?.push([y,e,"set"]));if(t(this,ct).call(this,c),t(this,yt).call(this,c,k,u),t(this,p)[c]=i,u){u.set="replace";let m=y&&h(this,a,b).call(this,y)?y.__staleWhileFetching:y;m!==void 0&&(u.oldValue=m);}}else u&&(u.set="update");t(this,vt)&&this.onInsert?.(i,e,i===y?"update":"replace");}if(o!==0&&!t(this,V)&&h(this,a,Pt).call(this),t(this,V)&&(w||t(this,xt).call(this,c,o,n),u&&t(this,tt).call(this,u,c)),!r&&t(this,j)&&t(this,T)){let y=t(this,T),m;for(;m=y?.shift();)(v=t(this,$))==null||v.call(this,...m);}return this}pop(){var e;try{for(;t(this,E);){let i=t(this,p)[t(this,F)];if(h(this,a,Tt).call(this,!0),h(this,a,b).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(t(this,j)&&t(this,T)){let i=t(this,T),s;for(;s=i?.shift();)(e=t(this,$))==null||e.call(this,...s);}}}has(e,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:o}=i,n=t(this,A).get(e);if(n!==void 0){let r=t(this,p)[n];if(h(this,a,b).call(this,r)&&r.__staleWhileFetching===void 0)return false;if(t(this,G).call(this,n))o&&(o.has="stale",t(this,tt).call(this,o,n));else return s&&t(this,lt).call(this,n),o&&(o.has="hit",t(this,tt).call(this,o,n)),true}else o&&(o.has="miss");return false}peek(e,i={}){let{allowStale:s=this.allowStale}=i,o=t(this,A).get(e);if(o===void 0||!s&&t(this,G).call(this,o))return;let n=t(this,p)[o];return h(this,a,b).call(this,n)?n.__staleWhileFetching:n}async fetch(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:r=this.ttl,noDisposeOnSet:d=this.noDisposeOnSet,size:u=0,sizeCalculation:w=this.sizeCalculation,noUpdateTTL:k=this.noUpdateTTL,noDeleteOnFetchRejection:c=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:W=this.allowStaleOnFetchRejection,ignoreFetchAbort:O=this.ignoreFetchAbort,allowStaleOnFetchAbort:g=this.allowStaleOnFetchAbort,context:v,forceRefresh:y=false,status:m,signal:z}=i;if(!t(this,rt))return m&&(m.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:o,noDeleteOnStaleGet:n,status:m});let L={allowStale:s,updateAgeOnGet:o,noDeleteOnStaleGet:n,ttl:r,noDisposeOnSet:d,size:u,sizeCalculation:w,noUpdateTTL:k,noDeleteOnFetchRejection:c,allowStaleOnFetchRejection:W,allowStaleOnFetchAbort:g,ignoreFetchAbort:O,status:m,signal:z},C=t(this,A).get(e);if(C===void 0){m&&(m.fetch="miss");let H=h(this,a,Ot).call(this,e,C,L,v);return H.__returned=H}else {let H=t(this,p)[C];if(h(this,a,b).call(this,H)){let It=s&&H.__staleWhileFetching!==void 0;return m&&(m.fetch="inflight",It&&(m.returnedStale=true)),It?H.__staleWhileFetching:H.__returned=H}let St=t(this,G).call(this,C);if(!y&&!St)return m&&(m.fetch="hit"),h(this,a,bt).call(this,C),o&&t(this,lt).call(this,C),m&&t(this,tt).call(this,m,C),H;let ft=h(this,a,Ot).call(this,e,C,L,v),ut=ft.__staleWhileFetching!==void 0&&s;return m&&(m.fetch=St?"stale":"refresh",ut&&St&&(m.returnedStale=true)),ut?ft.__staleWhileFetching:ft.__returned=ft}}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,_t);if(!s)throw new Error("no memoMethod provided to constructor");let{context:o,forceRefresh:n,...r}=i,d=this.get(e,r);if(!n&&d!==void 0)return d;let u=s(e,d,{options:r,context:o});return this.set(e,u,r),u}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:r}=i,d=t(this,A).get(e);if(d!==void 0){let u=t(this,p)[d],w=h(this,a,b).call(this,u);return r&&t(this,tt).call(this,r,d),t(this,G).call(this,d)?(r&&(r.get="stale"),w?(r&&s&&u.__staleWhileFetching!==void 0&&(r.returnedStale=true),s?u.__staleWhileFetching:void 0):(n||h(this,a,nt).call(this,e,"expire"),r&&s&&(r.returnedStale=true),s?u:void 0)):(r&&(r.get="hit"),w?u.__staleWhileFetching:(h(this,a,bt).call(this,d),o&&t(this,lt).call(this,d),u))}else r&&(r.get="miss");}delete(e){return h(this,a,nt).call(this,e,"delete")}clear(){return h(this,a,Gt).call(this,"delete")}};q=new WeakMap,P=new WeakMap,K=new WeakMap,ht=new WeakMap,$=new WeakMap,gt=new WeakMap,_t=new WeakMap,E=new WeakMap,Y=new WeakMap,A=new WeakMap,x=new WeakMap,p=new WeakMap,R=new WeakMap,M=new WeakMap,F=new WeakMap,U=new WeakMap,B=new WeakMap,T=new WeakMap,X=new WeakMap,J=new WeakMap,V=new WeakMap,Q=new WeakMap,rt=new WeakMap,j=new WeakMap,vt=new WeakMap,a=new WeakSet,Pt=function(){let e=new pt(t(this,q)),i=new pt(t(this,q));f(this,V,e),f(this,J,i),f(this,xt,(n,r,d=dt.now())=>{if(i[n]=r!==0?d:0,e[n]=r,r!==0&&this.ttlAutopurge){let u=setTimeout(()=>{t(this,G).call(this,n)&&h(this,a,nt).call(this,t(this,x)[n],"expire");},r+1);u.unref&&u.unref();}}),f(this,lt,n=>{i[n]=e[n]!==0?dt.now():0;}),f(this,tt,(n,r)=>{if(e[r]){let d=e[r],u=i[r];if(!d||!u)return;n.ttl=d,n.start=u,n.now=s||o();let w=n.now-u;n.remainingTTL=d-w;}});let s=0,o=()=>{let n=dt.now();if(this.ttlResolution>0){s=n;let r=setTimeout(()=>s=0,this.ttlResolution);r.unref&&r.unref();}return n};this.getRemainingTTL=n=>{let r=t(this,A).get(n);if(r===void 0)return 0;let d=e[r],u=i[r];if(!d||!u)return 1/0;let w=(s||o())-u;return d-w},f(this,G,n=>{let r=i[n],d=e[n];return !!d&&!!r&&(s||o())-r>d});},lt=new WeakMap,tt=new WeakMap,xt=new WeakMap,G=new WeakMap,ne=function(){let e=new pt(t(this,q));f(this,Y,0),f(this,X,e),f(this,ct,i=>{f(this,Y,t(this,Y)-e[i]),e[i]=0;}),f(this,wt,(i,s,o,n)=>{if(h(this,a,b).call(this,s))return 0;if(!et(o))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(o=n(s,i),!et(o))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 o}),f(this,yt,(i,s,o)=>{if(e[i]=s,t(this,P)){let n=t(this,P)-e[i];for(;t(this,Y)>n;)h(this,a,Tt).call(this,true);}f(this,Y,t(this,Y)+e[i]),o&&(o.entrySize=s,o.totalCalculatedSize=t(this,Y));});},ct=new WeakMap,yt=new WeakMap,wt=new WeakMap,it=function*({allowStale:e=this.allowStale}={}){if(t(this,E))for(let i=t(this,U);!(!h(this,a,Mt).call(this,i)||((e||!t(this,G).call(this,i))&&(yield i),i===t(this,F)));)i=t(this,M)[i];},st=function*({allowStale:e=this.allowStale}={}){if(t(this,E))for(let i=t(this,F);!(!h(this,a,Mt).call(this,i)||((e||!t(this,G).call(this,i))&&(yield i),i===t(this,U)));)i=t(this,R)[i];},Mt=function(e){return e!==void 0&&t(this,A).get(t(this,x)[e])===e},Tt=function(e){var n;let i=t(this,F),s=t(this,x)[i],o=t(this,p)[i];return t(this,rt)&&h(this,a,b).call(this,o)?o.__abortController.abort(new Error("evicted")):(t(this,Q)||t(this,j))&&(t(this,Q)&&((n=t(this,K))==null||n.call(this,o,s,"evict")),t(this,j)&&t(this,T)?.push([o,s,"evict"])),t(this,ct).call(this,i),e&&(t(this,x)[i]=void 0,t(this,p)[i]=void 0,t(this,B).push(i)),t(this,E)===1?(f(this,F,f(this,U,0)),t(this,B).length=0):f(this,F,t(this,R)[i]),t(this,A).delete(s),Ut(this,E)._--,i},Ot=function(e,i,s,o){let n=i===void 0?void 0:t(this,p)[i];if(h(this,a,b).call(this,n))return n;let r=new Ct,{signal:d}=s;d?.addEventListener("abort",()=>r.abort(d.reason),{signal:r.signal});let u={signal:r.signal,options:s,context:o},w=(v,y=false)=>{let{aborted:m}=r.signal,z=s.ignoreFetchAbort&&v!==void 0;if(s.status&&(m&&!y?(s.status.fetchAborted=true,s.status.fetchError=r.signal.reason,z&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),m&&!z&&!y)return c(r.signal.reason);let L=O;return t(this,p)[i]===O&&(v===void 0?L.__staleWhileFetching?t(this,p)[i]=L.__staleWhileFetching:h(this,a,nt).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,v,u.options))),v},k=v=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=v),c(v)),c=v=>{let{aborted:y}=r.signal,m=y&&s.allowStaleOnFetchAbort,z=m||s.allowStaleOnFetchRejection,L=z||s.noDeleteOnFetchRejection,C=O;if(t(this,p)[i]===O&&(!L||C.__staleWhileFetching===void 0?h(this,a,nt).call(this,e,"fetch"):m||(t(this,p)[i]=C.__staleWhileFetching)),z)return s.status&&C.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),C.__staleWhileFetching;if(C.__returned===C)throw v},W=(v,y)=>{var z;let m=(z=t(this,gt))==null?void 0:z.call(this,e,n,u);m&&m instanceof Promise&&m.then(L=>v(L===void 0?void 0:L),y),r.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(v(void 0),s.allowStaleOnFetchAbort&&(v=L=>w(L,true)));});};s.status&&(s.status.fetchDispatched=true);let O=new Promise(W).then(w,k),g=Object.assign(O,{__abortController:r,__staleWhileFetching:n,__returned:void 0});return i===void 0?(this.set(e,g,{...u.options,status:void 0}),i=t(this,A).get(e)):t(this,p)[i]=g,g},b=function(e){if(!t(this,rt))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Ct},Vt=function(e,i){t(this,M)[i]=e,t(this,R)[e]=i;},bt=function(e){e!==t(this,U)&&(e===t(this,F)?f(this,F,t(this,R)[e]):h(this,a,Vt).call(this,t(this,M)[e],t(this,R)[e]),h(this,a,Vt).call(this,t(this,U),e),f(this,U,e));},nt=function(e,i){var o,n;let s=false;if(t(this,E)!==0){let r=t(this,A).get(e);if(r!==void 0)if(s=true,t(this,E)===1)h(this,a,Gt).call(this,i);else {t(this,ct).call(this,r);let d=t(this,p)[r];if(h(this,a,b).call(this,d)?d.__abortController.abort(new Error("deleted")):(t(this,Q)||t(this,j))&&(t(this,Q)&&((o=t(this,K))==null||o.call(this,d,e,i)),t(this,j)&&t(this,T)?.push([d,e,i])),t(this,A).delete(e),t(this,x)[r]=void 0,t(this,p)[r]=void 0,r===t(this,U))f(this,U,t(this,M)[r]);else if(r===t(this,F))f(this,F,t(this,R)[r]);else {let u=t(this,M)[r];t(this,R)[u]=t(this,R)[r];let w=t(this,R)[r];t(this,M)[w]=t(this,M)[r];}Ut(this,E)._--,t(this,B).push(r);}}if(t(this,j)&&t(this,T)?.length){let r=t(this,T),d;for(;d=r?.shift();)(n=t(this,$))==null||n.call(this,...d);}return s},Gt=function(e){var i,s;for(let o of h(this,a,st).call(this,{allowStale:true})){let n=t(this,p)[o];if(h(this,a,b).call(this,n))n.__abortController.abort(new Error("deleted"));else {let r=t(this,x)[o];t(this,Q)&&((i=t(this,K))==null||i.call(this,n,r,e)),t(this,j)&&t(this,T)?.push([n,r,e]);}}if(t(this,A).clear(),t(this,p).fill(void 0),t(this,x).fill(void 0),t(this,V)&&t(this,J)&&(t(this,V).fill(0),t(this,J).fill(0)),t(this,X)&&t(this,X).fill(0),f(this,F,0),f(this,U,0),t(this,B).length=0,f(this,Y,0),f(this,E,0),t(this,j)&&t(this,T)){let o=t(this,T),n;for(;n=o?.shift();)(s=t(this,$))==null||s.call(this,...n);}};var Dt=Wt;var Ft=class{constructor(e){S(this,"cache");S(this,"map",new Map);this.cache=new Dt({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 At="1.3.21";var Ht="repeat";function kt(l){return {type:"pause",duration:l}}var qt="__game_layer__";var re={};var Kt={};le(Kt,{createExportableElement:()=>oe});var Rt;(o=>(o.log=(n,...r)=>console.log(`[Pixi\u2019VN] ${n}`,...r),o.warn=(n,...r)=>console.warn(`[Pixi\u2019VN] ${n}`,...r),o.error=(n,...r)=>console.error(`[Pixi\u2019VN] ${n}`,...r),o.info=(n,...r)=>console.info(`[Pixi\u2019VN] ${n}`,...r)))(Rt||(Rt={}));function oe(l){try{if(typeof l>"u")return l;let e=JSON.stringify(l);return JSON.parse(e)}catch(e){throw Rt.error("Error creating exportable element",l,e),new Error("[Pixi\u2019VN] Error creating exportable element")}}function ae(){console.info(`
|
|
1
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var I=require('@drincs/pixi-vn/canvas'),Bt=require('@drincs/pixi-vn/characters'),tt=require('@drincs/pixi-vn/history'),D=require('@drincs/pixi-vn/narration'),pixi_js=require('@drincs/pixi-vn/pixi.js'),at=require('@drincs/pixi-vn/sound'),N=require('@drincs/pixi-vn/storage'),unifier=require('@drincs/pixi-vn/unifier');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 I__namespace=/*#__PURE__*/_interopNamespace(I);var Bt__namespace=/*#__PURE__*/_interopNamespace(Bt);var tt__namespace=/*#__PURE__*/_interopNamespace(tt);var D__namespace=/*#__PURE__*/_interopNamespace(D);var at__namespace=/*#__PURE__*/_interopNamespace(at);var N__namespace=/*#__PURE__*/_interopNamespace(N);var Xt=Object.defineProperty;var Jt=l=>{throw TypeError(l)};var he=(l,e,i)=>e in l?Xt(l,e,{enumerable:true,configurable:true,writable:true,value:i}):l[e]=i;var le=(l,e)=>{for(var i in e)Xt(l,i,{get:e[i],enumerable:true});};var S=(l,e,i)=>he(l,typeof e!="symbol"?e+"":e,i),zt=(l,e,i)=>e.has(l)||Jt("Cannot "+i);var t=(l,e,i)=>(zt(l,e,"read from private field"),i?i.call(l):e.get(l)),_=(l,e,i)=>e.has(l)?Jt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(l):e.set(l,i),c=(l,e,i,s)=>(zt(l,e,"write to private field"),e.set(l,i),i),h=(l,e,i)=>(zt(l,e,"access private method"),i);var Ut=(l,e,i,s)=>({set _(o){c(l,e,o);},get _(){return t(l,e,s)}});var ce=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,ee=new Set,Lt=typeof process=="object"&&process?process:{},ie=(l,e,i,s)=>{typeof Lt.emitWarning=="function"?Lt.emitWarning(l,e,i,s):console.error(`[${i}] ${e}: ${l}`);},Dt=globalThis.AbortController,Qt=globalThis.AbortSignal;if(typeof Dt>"u"){Qt=class{constructor(){S(this,"onabort");S(this,"_onabort",[]);S(this,"reason");S(this,"aborted",false);}addEventListener(s,o){this._onabort.push(o);}},Dt=class{constructor(){S(this,"signal",new Qt);e();}abort(s){if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=true;for(let o of this.signal._onabort)o(s);this.signal.onabort?.(s);}}};let l=Lt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{l&&(l=false,ie("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e));};}var fe=l=>!ee.has(l),it=l=>l&&l===Math.floor(l)&&l>0&&isFinite(l),se=l=>it(l)?l<=Math.pow(2,8)?Uint8Array:l<=Math.pow(2,16)?Uint16Array:l<=Math.pow(2,32)?Uint32Array:l<=Number.MAX_SAFE_INTEGER?mt:null:null,mt=class extends Array{constructor(e){super(e),this.fill(0);}},gt,ht=class ht{constructor(e,i){S(this,"heap");S(this,"length");if(!t(ht,gt))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}static create(e){let i=se(e);if(!i)return [];c(ht,gt,true);let s=new ht(e,i);return c(ht,gt,false),s}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}};gt=new WeakMap,_(ht,gt,false);var Nt=ht,Zt,te,q,P,K,lt,$,_t,vt,Y,E,B,A,x,p,R,M,F,T,X,U,J,Q,V,Z,ot,j,yt,a,Pt,ct,et,wt,G,ne,ft,St,At,st,nt,Mt,Ot,Ct,b,Vt,xt,rt,Gt,Wt=class Wt{constructor(e){_(this,a);_(this,q);_(this,P);_(this,K);_(this,lt);_(this,$);_(this,_t);_(this,vt);_(this,Y);S(this,"ttl");S(this,"ttlResolution");S(this,"ttlAutopurge");S(this,"updateAgeOnGet");S(this,"updateAgeOnHas");S(this,"allowStale");S(this,"noDisposeOnSet");S(this,"noUpdateTTL");S(this,"maxEntrySize");S(this,"sizeCalculation");S(this,"noDeleteOnFetchRejection");S(this,"noDeleteOnStaleGet");S(this,"allowStaleOnFetchAbort");S(this,"allowStaleOnFetchRejection");S(this,"ignoreFetchAbort");_(this,E);_(this,B);_(this,A);_(this,x);_(this,p);_(this,R);_(this,M);_(this,F);_(this,T);_(this,X);_(this,U);_(this,J);_(this,Q);_(this,V);_(this,Z);_(this,ot);_(this,j);_(this,yt);_(this,ct,()=>{});_(this,et,()=>{});_(this,wt,()=>{});_(this,G,()=>false);_(this,ft,e=>{});_(this,St,(e,i,s)=>{});_(this,At,(e,i,s,o)=>{if(s||o)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});S(this,Zt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:o=1,ttlAutopurge:n,updateAgeOnGet:r,updateAgeOnHas:d,allowStale:u,dispose:w,onInsert:k,disposeAfter:f,noDisposeOnSet:W,noUpdateTTL:O,maxSize:g=0,maxEntrySize:v=0,sizeCalculation:y,fetchMethod:m,memoMethod:z,noDeleteOnFetchRejection:L,noDeleteOnStaleGet:C,allowStaleOnFetchRejection:H,allowStaleOnFetchAbort:bt,ignoreFetchAbort:ut,perf:Tt}=e;if(Tt!==void 0&&typeof Tt?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(c(this,Y,Tt??ce),i!==0&&!it(i))throw new TypeError("max option must be a nonnegative integer");let dt=i?se(i):Array;if(!dt)throw new Error("invalid max value: "+i);if(c(this,q,i),c(this,P,g),this.maxEntrySize=v||t(this,P),this.sizeCalculation=y,this.sizeCalculation){if(!t(this,P)&&!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(z!==void 0&&typeof z!="function")throw new TypeError("memoMethod must be a function if defined");if(c(this,vt,z),m!==void 0&&typeof m!="function")throw new TypeError("fetchMethod must be a function if specified");if(c(this,_t,m),c(this,ot,!!m),c(this,A,new Map),c(this,x,new Array(i).fill(void 0)),c(this,p,new Array(i).fill(void 0)),c(this,R,new dt(i)),c(this,M,new dt(i)),c(this,F,0),c(this,T,0),c(this,X,Nt.create(i)),c(this,E,0),c(this,B,0),typeof w=="function"&&c(this,K,w),typeof k=="function"&&c(this,lt,k),typeof f=="function"?(c(this,$,f),c(this,U,[])):(c(this,$,void 0),c(this,U,void 0)),c(this,Z,!!t(this,K)),c(this,yt,!!t(this,lt)),c(this,j,!!t(this,$)),this.noDisposeOnSet=!!W,this.noUpdateTTL=!!O,this.noDeleteOnFetchRejection=!!L,this.allowStaleOnFetchRejection=!!H,this.allowStaleOnFetchAbort=!!bt,this.ignoreFetchAbort=!!ut,this.maxEntrySize!==0){if(t(this,P)!==0&&!it(t(this,P)))throw new TypeError("maxSize must be a positive integer if specified");if(!it(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");h(this,a,ne).call(this);}if(this.allowStale=!!u,this.noDeleteOnStaleGet=!!C,this.updateAgeOnGet=!!r,this.updateAgeOnHas=!!d,this.ttlResolution=it(o)||o===0?o:1,this.ttlAutopurge=!!n,this.ttl=s||0,this.ttl){if(!it(this.ttl))throw new TypeError("ttl must be a positive integer if specified");h(this,a,Pt).call(this);}if(t(this,q)===0&&this.ttl===0&&t(this,P)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,q)&&!t(this,P)){let pt="LRU_CACHE_UNBOUNDED";fe(pt)&&(ee.add(pt),ie("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",pt,Wt));}}get perf(){return t(this,Y)}static unsafeExposeInternals(e){return {starts:t(e,Q),ttls:t(e,V),sizes:t(e,J),keyMap:t(e,A),keyList:t(e,x),valList:t(e,p),next:t(e,R),prev:t(e,M),get head(){return t(e,F)},get tail(){return t(e,T)},free:t(e,X),isBackgroundFetch:i=>{var s;return h(s=e,a,b).call(s,i)},backgroundFetch:(i,s,o,n)=>{var r;return h(r=e,a,Ct).call(r,i,s,o,n)},moveToTail:i=>{var s;return h(s=e,a,xt).call(s,i)},indexes:i=>{var s;return h(s=e,a,st).call(s,i)},rindexes:i=>{var s;return h(s=e,a,nt).call(s,i)},isStale:i=>{var s;return t(s=e,G).call(s,i)}}}get max(){return t(this,q)}get maxSize(){return t(this,P)}get calculatedSize(){return t(this,B)}get size(){return t(this,E)}get fetchMethod(){return t(this,_t)}get memoMethod(){return t(this,vt)}get dispose(){return t(this,K)}get onInsert(){return t(this,lt)}get disposeAfter(){return t(this,$)}getRemainingTTL(e){return t(this,A).has(e)?1/0:0}*entries(){for(let e of h(this,a,st).call(this))t(this,p)[e]!==void 0&&t(this,x)[e]!==void 0&&!h(this,a,b).call(this,t(this,p)[e])&&(yield [t(this,x)[e],t(this,p)[e]]);}*rentries(){for(let e of h(this,a,nt).call(this))t(this,p)[e]!==void 0&&t(this,x)[e]!==void 0&&!h(this,a,b).call(this,t(this,p)[e])&&(yield [t(this,x)[e],t(this,p)[e]]);}*keys(){for(let e of h(this,a,st).call(this)){let i=t(this,x)[e];i!==void 0&&!h(this,a,b).call(this,t(this,p)[e])&&(yield i);}}*rkeys(){for(let e of h(this,a,nt).call(this)){let i=t(this,x)[e];i!==void 0&&!h(this,a,b).call(this,t(this,p)[e])&&(yield i);}}*values(){for(let e of h(this,a,st).call(this))t(this,p)[e]!==void 0&&!h(this,a,b).call(this,t(this,p)[e])&&(yield t(this,p)[e]);}*rvalues(){for(let e of h(this,a,nt).call(this))t(this,p)[e]!==void 0&&!h(this,a,b).call(this,t(this,p)[e])&&(yield t(this,p)[e]);}[(te=Symbol.iterator,Zt=Symbol.toStringTag,te)](){return this.entries()}find(e,i={}){for(let s of h(this,a,st).call(this)){let o=t(this,p)[s],n=h(this,a,b).call(this,o)?o.__staleWhileFetching:o;if(n!==void 0&&e(n,t(this,x)[s],this))return this.get(t(this,x)[s],i)}}forEach(e,i=this){for(let s of h(this,a,st).call(this)){let o=t(this,p)[s],n=h(this,a,b).call(this,o)?o.__staleWhileFetching:o;n!==void 0&&e.call(i,n,t(this,x)[s],this);}}rforEach(e,i=this){for(let s of h(this,a,nt).call(this)){let o=t(this,p)[s],n=h(this,a,b).call(this,o)?o.__staleWhileFetching:o;n!==void 0&&e.call(i,n,t(this,x)[s],this);}}purgeStale(){let e=false;for(let i of h(this,a,nt).call(this,{allowStale:true}))t(this,G).call(this,i)&&(h(this,a,rt).call(this,t(this,x)[i],"expire"),e=true);return e}info(e){let i=t(this,A).get(e);if(i===void 0)return;let s=t(this,p)[i],o=h(this,a,b).call(this,s)?s.__staleWhileFetching:s;if(o===void 0)return;let n={value:o};if(t(this,V)&&t(this,Q)){let r=t(this,V)[i],d=t(this,Q)[i];if(r&&d){let u=r-(t(this,Y).now()-d);n.ttl=u,n.start=Date.now();}}return t(this,J)&&(n.size=t(this,J)[i]),n}dump(){let e=[];for(let i of h(this,a,st).call(this,{allowStale:true})){let s=t(this,x)[i],o=t(this,p)[i],n=h(this,a,b).call(this,o)?o.__staleWhileFetching:o;if(n===void 0||s===void 0)continue;let r={value:n};if(t(this,V)&&t(this,Q)){r.ttl=t(this,V)[i];let d=t(this,Y).now()-t(this,Q)[i];r.start=Math.floor(Date.now()-d);}t(this,J)&&(r.size=t(this,J)[i]),e.unshift([s,r]);}return e}load(e){this.clear();for(let[i,s]of e){if(s.start){let o=Date.now()-s.start;s.start=t(this,Y).now()-o;}this.set(i,s.value,s);}}set(e,i,s={}){var W,O,g,v;if(i===void 0)return this.delete(e),this;let{ttl:o=this.ttl,start:n,noDisposeOnSet:r=this.noDisposeOnSet,sizeCalculation:d=this.sizeCalculation,status:u}=s,{noUpdateTTL:w=this.noUpdateTTL}=s,k=t(this,At).call(this,e,i,s.size||0,d);if(this.maxEntrySize&&k>this.maxEntrySize)return u&&(u.set="miss",u.maxEntrySizeExceeded=true),h(this,a,rt).call(this,e,"set"),this;let f=t(this,E)===0?void 0:t(this,A).get(e);if(f===void 0)f=t(this,E)===0?t(this,T):t(this,X).length!==0?t(this,X).pop():t(this,E)===t(this,q)?h(this,a,Ot).call(this,false):t(this,E),t(this,x)[f]=e,t(this,p)[f]=i,t(this,A).set(e,f),t(this,R)[t(this,T)]=f,t(this,M)[f]=t(this,T),c(this,T,f),Ut(this,E)._++,t(this,St).call(this,f,k,u),u&&(u.set="add"),w=false,t(this,yt)&&((W=t(this,lt))==null||W.call(this,i,e,"add"));else {h(this,a,xt).call(this,f);let y=t(this,p)[f];if(i!==y){if(t(this,ot)&&h(this,a,b).call(this,y)){y.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:m}=y;m!==void 0&&!r&&(t(this,Z)&&((O=t(this,K))==null||O.call(this,m,e,"set")),t(this,j)&&t(this,U)?.push([m,e,"set"]));}else r||(t(this,Z)&&((g=t(this,K))==null||g.call(this,y,e,"set")),t(this,j)&&t(this,U)?.push([y,e,"set"]));if(t(this,ft).call(this,f),t(this,St).call(this,f,k,u),t(this,p)[f]=i,u){u.set="replace";let m=y&&h(this,a,b).call(this,y)?y.__staleWhileFetching:y;m!==void 0&&(u.oldValue=m);}}else u&&(u.set="update");t(this,yt)&&this.onInsert?.(i,e,i===y?"update":"replace");}if(o!==0&&!t(this,V)&&h(this,a,Pt).call(this),t(this,V)&&(w||t(this,wt).call(this,f,o,n),u&&t(this,et).call(this,u,f)),!r&&t(this,j)&&t(this,U)){let y=t(this,U),m;for(;m=y?.shift();)(v=t(this,$))==null||v.call(this,...m);}return this}pop(){var e;try{for(;t(this,E);){let i=t(this,p)[t(this,F)];if(h(this,a,Ot).call(this,!0),h(this,a,b).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(t(this,j)&&t(this,U)){let i=t(this,U),s;for(;s=i?.shift();)(e=t(this,$))==null||e.call(this,...s);}}}has(e,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:o}=i,n=t(this,A).get(e);if(n!==void 0){let r=t(this,p)[n];if(h(this,a,b).call(this,r)&&r.__staleWhileFetching===void 0)return false;if(t(this,G).call(this,n))o&&(o.has="stale",t(this,et).call(this,o,n));else return s&&t(this,ct).call(this,n),o&&(o.has="hit",t(this,et).call(this,o,n)),true}else o&&(o.has="miss");return false}peek(e,i={}){let{allowStale:s=this.allowStale}=i,o=t(this,A).get(e);if(o===void 0||!s&&t(this,G).call(this,o))return;let n=t(this,p)[o];return h(this,a,b).call(this,n)?n.__staleWhileFetching:n}async fetch(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:r=this.ttl,noDisposeOnSet:d=this.noDisposeOnSet,size:u=0,sizeCalculation:w=this.sizeCalculation,noUpdateTTL:k=this.noUpdateTTL,noDeleteOnFetchRejection:f=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:W=this.allowStaleOnFetchRejection,ignoreFetchAbort:O=this.ignoreFetchAbort,allowStaleOnFetchAbort:g=this.allowStaleOnFetchAbort,context:v,forceRefresh:y=false,status:m,signal:z}=i;if(!t(this,ot))return m&&(m.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:o,noDeleteOnStaleGet:n,status:m});let L={allowStale:s,updateAgeOnGet:o,noDeleteOnStaleGet:n,ttl:r,noDisposeOnSet:d,size:u,sizeCalculation:w,noUpdateTTL:k,noDeleteOnFetchRejection:f,allowStaleOnFetchRejection:W,allowStaleOnFetchAbort:g,ignoreFetchAbort:O,status:m,signal:z},C=t(this,A).get(e);if(C===void 0){m&&(m.fetch="miss");let H=h(this,a,Ct).call(this,e,C,L,v);return H.__returned=H}else {let H=t(this,p)[C];if(h(this,a,b).call(this,H)){let pt=s&&H.__staleWhileFetching!==void 0;return m&&(m.fetch="inflight",pt&&(m.returnedStale=true)),pt?H.__staleWhileFetching:H.__returned=H}let bt=t(this,G).call(this,C);if(!y&&!bt)return m&&(m.fetch="hit"),h(this,a,xt).call(this,C),o&&t(this,ct).call(this,C),m&&t(this,et).call(this,m,C),H;let ut=h(this,a,Ct).call(this,e,C,L,v),dt=ut.__staleWhileFetching!==void 0&&s;return m&&(m.fetch=bt?"stale":"refresh",dt&&bt&&(m.returnedStale=true)),dt?ut.__staleWhileFetching:ut.__returned=ut}}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,vt);if(!s)throw new Error("no memoMethod provided to constructor");let{context:o,forceRefresh:n,...r}=i,d=this.get(e,r);if(!n&&d!==void 0)return d;let u=s(e,d,{options:r,context:o});return this.set(e,u,r),u}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:r}=i,d=t(this,A).get(e);if(d!==void 0){let u=t(this,p)[d],w=h(this,a,b).call(this,u);return r&&t(this,et).call(this,r,d),t(this,G).call(this,d)?(r&&(r.get="stale"),w?(r&&s&&u.__staleWhileFetching!==void 0&&(r.returnedStale=true),s?u.__staleWhileFetching:void 0):(n||h(this,a,rt).call(this,e,"expire"),r&&s&&(r.returnedStale=true),s?u:void 0)):(r&&(r.get="hit"),w?u.__staleWhileFetching:(h(this,a,xt).call(this,d),o&&t(this,ct).call(this,d),u))}else r&&(r.get="miss");}delete(e){return h(this,a,rt).call(this,e,"delete")}clear(){return h(this,a,Gt).call(this,"delete")}};q=new WeakMap,P=new WeakMap,K=new WeakMap,lt=new WeakMap,$=new WeakMap,_t=new WeakMap,vt=new WeakMap,Y=new WeakMap,E=new WeakMap,B=new WeakMap,A=new WeakMap,x=new WeakMap,p=new WeakMap,R=new WeakMap,M=new WeakMap,F=new WeakMap,T=new WeakMap,X=new WeakMap,U=new WeakMap,J=new WeakMap,Q=new WeakMap,V=new WeakMap,Z=new WeakMap,ot=new WeakMap,j=new WeakMap,yt=new WeakMap,a=new WeakSet,Pt=function(){let e=new mt(t(this,q)),i=new mt(t(this,q));c(this,V,e),c(this,Q,i),c(this,wt,(n,r,d=t(this,Y).now())=>{if(i[n]=r!==0?d:0,e[n]=r,r!==0&&this.ttlAutopurge){let u=setTimeout(()=>{t(this,G).call(this,n)&&h(this,a,rt).call(this,t(this,x)[n],"expire");},r+1);u.unref&&u.unref();}}),c(this,ct,n=>{i[n]=e[n]!==0?t(this,Y).now():0;}),c(this,et,(n,r)=>{if(e[r]){let d=e[r],u=i[r];if(!d||!u)return;n.ttl=d,n.start=u,n.now=s||o();let w=n.now-u;n.remainingTTL=d-w;}});let s=0,o=()=>{let n=t(this,Y).now();if(this.ttlResolution>0){s=n;let r=setTimeout(()=>s=0,this.ttlResolution);r.unref&&r.unref();}return n};this.getRemainingTTL=n=>{let r=t(this,A).get(n);if(r===void 0)return 0;let d=e[r],u=i[r];if(!d||!u)return 1/0;let w=(s||o())-u;return d-w},c(this,G,n=>{let r=i[n],d=e[n];return !!d&&!!r&&(s||o())-r>d});},ct=new WeakMap,et=new WeakMap,wt=new WeakMap,G=new WeakMap,ne=function(){let e=new mt(t(this,q));c(this,B,0),c(this,J,e),c(this,ft,i=>{c(this,B,t(this,B)-e[i]),e[i]=0;}),c(this,At,(i,s,o,n)=>{if(h(this,a,b).call(this,s))return 0;if(!it(o))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(o=n(s,i),!it(o))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 o}),c(this,St,(i,s,o)=>{if(e[i]=s,t(this,P)){let n=t(this,P)-e[i];for(;t(this,B)>n;)h(this,a,Ot).call(this,true);}c(this,B,t(this,B)+e[i]),o&&(o.entrySize=s,o.totalCalculatedSize=t(this,B));});},ft=new WeakMap,St=new WeakMap,At=new WeakMap,st=function*({allowStale:e=this.allowStale}={}){if(t(this,E))for(let i=t(this,T);!(!h(this,a,Mt).call(this,i)||((e||!t(this,G).call(this,i))&&(yield i),i===t(this,F)));)i=t(this,M)[i];},nt=function*({allowStale:e=this.allowStale}={}){if(t(this,E))for(let i=t(this,F);!(!h(this,a,Mt).call(this,i)||((e||!t(this,G).call(this,i))&&(yield i),i===t(this,T)));)i=t(this,R)[i];},Mt=function(e){return e!==void 0&&t(this,A).get(t(this,x)[e])===e},Ot=function(e){var n;let i=t(this,F),s=t(this,x)[i],o=t(this,p)[i];return t(this,ot)&&h(this,a,b).call(this,o)?o.__abortController.abort(new Error("evicted")):(t(this,Z)||t(this,j))&&(t(this,Z)&&((n=t(this,K))==null||n.call(this,o,s,"evict")),t(this,j)&&t(this,U)?.push([o,s,"evict"])),t(this,ft).call(this,i),e&&(t(this,x)[i]=void 0,t(this,p)[i]=void 0,t(this,X).push(i)),t(this,E)===1?(c(this,F,c(this,T,0)),t(this,X).length=0):c(this,F,t(this,R)[i]),t(this,A).delete(s),Ut(this,E)._--,i},Ct=function(e,i,s,o){let n=i===void 0?void 0:t(this,p)[i];if(h(this,a,b).call(this,n))return n;let r=new Dt,{signal:d}=s;d?.addEventListener("abort",()=>r.abort(d.reason),{signal:r.signal});let u={signal:r.signal,options:s,context:o},w=(v,y=false)=>{let{aborted:m}=r.signal,z=s.ignoreFetchAbort&&v!==void 0;if(s.status&&(m&&!y?(s.status.fetchAborted=true,s.status.fetchError=r.signal.reason,z&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),m&&!z&&!y)return f(r.signal.reason);let L=O;return t(this,p)[i]===O&&(v===void 0?L.__staleWhileFetching!==void 0?t(this,p)[i]=L.__staleWhileFetching:h(this,a,rt).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,v,u.options))),v},k=v=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=v),f(v)),f=v=>{let{aborted:y}=r.signal,m=y&&s.allowStaleOnFetchAbort,z=m||s.allowStaleOnFetchRejection,L=z||s.noDeleteOnFetchRejection,C=O;if(t(this,p)[i]===O&&(!L||C.__staleWhileFetching===void 0?h(this,a,rt).call(this,e,"fetch"):m||(t(this,p)[i]=C.__staleWhileFetching)),z)return s.status&&C.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),C.__staleWhileFetching;if(C.__returned===C)throw v},W=(v,y)=>{var z;let m=(z=t(this,_t))==null?void 0:z.call(this,e,n,u);m&&m instanceof Promise&&m.then(L=>v(L===void 0?void 0:L),y),r.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(v(void 0),s.allowStaleOnFetchAbort&&(v=L=>w(L,true)));});};s.status&&(s.status.fetchDispatched=true);let O=new Promise(W).then(w,k),g=Object.assign(O,{__abortController:r,__staleWhileFetching:n,__returned:void 0});return i===void 0?(this.set(e,g,{...u.options,status:void 0}),i=t(this,A).get(e)):t(this,p)[i]=g,g},b=function(e){if(!t(this,ot))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Dt},Vt=function(e,i){t(this,M)[i]=e,t(this,R)[e]=i;},xt=function(e){e!==t(this,T)&&(e===t(this,F)?c(this,F,t(this,R)[e]):h(this,a,Vt).call(this,t(this,M)[e],t(this,R)[e]),h(this,a,Vt).call(this,t(this,T),e),c(this,T,e));},rt=function(e,i){var o,n;let s=false;if(t(this,E)!==0){let r=t(this,A).get(e);if(r!==void 0)if(s=true,t(this,E)===1)h(this,a,Gt).call(this,i);else {t(this,ft).call(this,r);let d=t(this,p)[r];if(h(this,a,b).call(this,d)?d.__abortController.abort(new Error("deleted")):(t(this,Z)||t(this,j))&&(t(this,Z)&&((o=t(this,K))==null||o.call(this,d,e,i)),t(this,j)&&t(this,U)?.push([d,e,i])),t(this,A).delete(e),t(this,x)[r]=void 0,t(this,p)[r]=void 0,r===t(this,T))c(this,T,t(this,M)[r]);else if(r===t(this,F))c(this,F,t(this,R)[r]);else {let u=t(this,M)[r];t(this,R)[u]=t(this,R)[r];let w=t(this,R)[r];t(this,M)[w]=t(this,M)[r];}Ut(this,E)._--,t(this,X).push(r);}}if(t(this,j)&&t(this,U)?.length){let r=t(this,U),d;for(;d=r?.shift();)(n=t(this,$))==null||n.call(this,...d);}return s},Gt=function(e){var i,s;for(let o of h(this,a,nt).call(this,{allowStale:true})){let n=t(this,p)[o];if(h(this,a,b).call(this,n))n.__abortController.abort(new Error("deleted"));else {let r=t(this,x)[o];t(this,Z)&&((i=t(this,K))==null||i.call(this,n,r,e)),t(this,j)&&t(this,U)?.push([n,r,e]);}}if(t(this,A).clear(),t(this,p).fill(void 0),t(this,x).fill(void 0),t(this,V)&&t(this,Q)&&(t(this,V).fill(0),t(this,Q).fill(0)),t(this,J)&&t(this,J).fill(0),c(this,F,0),c(this,T,0),t(this,X).length=0,c(this,B,0),c(this,E,0),t(this,j)&&t(this,U)){let o=t(this,U),n;for(;n=o?.shift();)(s=t(this,$))==null||s.call(this,...n);}};var Ft=Wt;var Rt=class{constructor(e){S(this,"cache");S(this,"map",new Map);this.cache=new Ft({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 Et="1.3.22";var Ht="repeat";function kt(l){return {type:"pause",duration:l}}var qt="__game_layer__";var re={};var Kt={};le(Kt,{createExportableElement:()=>oe});var jt;(o=>(o.log=(n,...r)=>console.log(`[Pixi\u2019VN] ${n}`,...r),o.warn=(n,...r)=>console.warn(`[Pixi\u2019VN] ${n}`,...r),o.error=(n,...r)=>console.error(`[Pixi\u2019VN] ${n}`,...r),o.info=(n,...r)=>console.info(`[Pixi\u2019VN] ${n}`,...r)))(jt||(jt={}));function oe(l){try{if(typeof l>"u")return l;let e=JSON.stringify(l);return JSON.parse(e)}catch(e){throw jt.error("Error creating exportable element",l,e),new Error("[Pixi\u2019VN] Error creating exportable element")}}function ae(){console.info(`
|
|
2
2
|
_______ _ _ _ ____ ____ ____ _____
|
|
3
3
|
|_ __ \\ (_) (_) | | |_ _| |_ _||_ \\|_ _|
|
|
4
4
|
| |__) |__ _ __ __ \\_| \\ \\ / / | \\ | |
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
_| |_ | | > ' < | | \\ ' / _| |_\\ |_
|
|
7
7
|
|_____| [___][__]\`\\_][___] \\_/ |_____|\\____|
|
|
8
8
|
|
|
9
|
-
`);}function $t(){let l=window.location.pathname+window.location.hash;return l.includes("#")&&(l=l.split("#")[1]),l}exports.Game=void 0;(k=>{async function l(
|
|
9
|
+
`);}function $t(){let l=window.location.pathname+window.location.hash;return l.includes("#")&&(l=l.split("#")[1]),l}exports.Game=void 0;(k=>{async function l(f,W,O){return unifier.GameUnifier.init({getCurrentGameStepState:()=>({path:$t(),storage:N__namespace.storage.export(),canvas:I__namespace.canvas.export(),sound:at__namespace.sound.export(),labelIndex:D__namespace.NarrationManagerStatic.currentLabelStepIndex||0,openedLabels:D__namespace.narration.openedLabels}),restoreGameStepState:async(g,v)=>{tt__namespace.HistoryManagerStatic._originalStepData=g,D__namespace.NarrationManagerStatic.openedLabels=g.openedLabels,N__namespace.storage.restore(g.storage),await I__namespace.canvas.restore(g.canvas),at__namespace.sound.restore(g.sound),v(g.path);},getStepCounter:()=>D__namespace.narration.stepCounter,setStepCounter:g=>{D__namespace.NarrationManagerStatic._stepCounter=g;},getOpenedLabels:()=>D__namespace.narration.openedLabels.length,addHistoryItem:(g,v)=>tt__namespace.stepHistory.add(g,v),getCurrentStepsRunningNumber:()=>D__namespace.NarrationManagerStatic.stepsRunning,getCharacter:g=>Bt__namespace.RegisteredCharacters.get(g),onGoNextEnd:async()=>{let g=I__namespace.CanvasManagerStatic._tickersToCompleteOnStepEnd.tikersIds.map(({id:y})=>I__namespace.canvas.forceCompletionOfTicker(y)),v=I__namespace.CanvasManagerStatic._tickersToCompleteOnStepEnd.stepAlias.map(({alias:y,id:m})=>I__namespace.canvas.forceCompletionOfTicker(m,y));await Promise.all([...g,...v]),I__namespace.CanvasManagerStatic._tickersToCompleteOnStepEnd={tikersIds:[],stepAlias:[]};},getVariable:g=>N__namespace.storage.get(g),setVariable:(g,v)=>N__namespace.storage.set(g,v),removeVariable:g=>N__namespace.storage.removeVariable(g),getFlag:g=>N__namespace.storage.getFlag(g),setFlag:(g,v)=>N__namespace.storage.setFlag(g,v),onLabelClosing:g=>N__namespace.StorageManagerStatic.clearOldTempVariables(g)}),ae(),await I__namespace.canvas.init(f,W,O)}k.init=l;function e(){N__namespace.storage.clear(),I__namespace.canvas.clear(),at__namespace.sound.clear(),D__namespace.narration.clear(),tt__namespace.stepHistory.clear();}k.clear=e;function i(){return {pixivn_version:Et,stepData:D__namespace.narration.export(),storageData:N__namespace.storage.export(),canvasData:I__namespace.canvas.export(),soundData:at__namespace.sound.export(),historyData:tt__namespace.stepHistory.export(),path:$t()}}k.exportGameState=i;async function s(f,W){f.stepData.hasOwnProperty("stepsHistory")&&f.stepData.stepsHistory&&(f.historyData.stepsHistory=f.stepData.stepsHistory),f.stepData.hasOwnProperty("originalStepData")&&f.stepData.originalStepData&&(f.historyData.originalStepData=f.stepData.originalStepData),tt__namespace.stepHistory.restore(f.historyData);let O=tt__namespace.stepHistory.lastKey;if(typeof O=="number"){let g=tt__namespace.stepHistory.stepsInfoMap.get(O)||null;await D__namespace.narration.restore(f.stepData,g);}N__namespace.storage.restore(f.storageData),await I__namespace.canvas.restore(f.canvasData),at__namespace.sound.restore(f.soundData),await W(f.path);}k.restoreGameState=s;function o(f){return JSON.parse(f)}k.jsonToGameState=o;function n(f){unifier.GameUnifier.onEnd=f;}k.onEnd=n;function r(f){unifier.GameUnifier.onError=f;}k.onError=r;function d(f){D__namespace.NarrationManagerStatic.onStepStart=f;}k.onStepStart=d;function u(f){D__namespace.NarrationManagerStatic.onLoadingLabel=f;}k.onLoadingLabel=u;function w(f){D__namespace.NarrationManagerStatic.onStepEnd=f;}k.onStepEnd=w;})(exports.Game||(exports.Game={}));var We={Assets:pixi_js.Assets,Rectangle:pixi_js.Rectangle,characterUtils:Bt__namespace,canvasUtils:I__namespace,narrationUtils:D__namespace,soundUtils:at__namespace,CANVAS_APP_GAME_LAYER_ALIAS:qt,Pause:kt,Repeat:Ht,PIXIVN_VERSION:Et,...Kt,...re,canvas:I__namespace.canvas,narration:D__namespace.narration,sound:at__namespace.sound,storage:N__namespace.storage,history:tt__namespace.stepHistory,Game:exports.Game,GameUnifier:unifier.GameUnifier};Object.defineProperty(exports,"Assets",{enumerable:true,get:function(){return pixi_js.Assets}});Object.defineProperty(exports,"Rectangle",{enumerable:true,get:function(){return pixi_js.Rectangle}});Object.defineProperty(exports,"Texture",{enumerable:true,get:function(){return pixi_js.Texture}});Object.defineProperty(exports,"UPDATE_PRIORITY",{enumerable:true,get:function(){return pixi_js.UPDATE_PRIORITY}});exports.CANVAS_APP_GAME_LAYER_ALIAS=qt;exports.CachedMap=Rt;exports.PIXIVN_VERSION=Et;exports.Pause=kt;exports.Repeat=Ht;exports.createExportableElement=oe;exports.default=We;Object.keys(I).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return I[k]}})});Object.keys(Bt).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return Bt[k]}})});Object.keys(tt).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return tt[k]}})});Object.keys(D).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return D[k]}})});Object.keys(at).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return at[k]}})});Object.keys(N).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return N[k]}})});Object.keys(unifier).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return unifier[k]}})});
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED