@drincs/pixi-vn 1.2.9 → 1.2.10

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.
@@ -1,2 +1,2 @@
1
- 'use strict';var ce=Object.create;var re=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var me=Object.getOwnPropertyNames;var ge=Object.getPrototypeOf,ye=Object.prototype.hasOwnProperty;var be=(l,e)=>()=>(e||l((e={exports:{}}).exports,e),e.exports);var Se=(l,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of me(e))!ye.call(l,r)&&r!==t&&re(l,r,{get:()=>e[r],enumerable:!(i=pe(e,r))||i.enumerable});return l};var ve=(l,e,t)=>(t=l!=null?ce(ge(l)):{},Se(re(t,"default",{value:l,enumerable:true}),l));var se=be((X,ne)=>{(function(l,e){var t=e(l);if(typeof define=="function"&&define.amd)define("DeepDiff",function(){return t});else if(typeof X=="object"||typeof navigator=="object"&&navigator.product.match(/ReactNative/i))ne.exports=t;else {var i=l.DeepDiff;t.noConflict=function(){return l.DeepDiff===t&&(l.DeepDiff=i),t},l.DeepDiff=t;}})(X,function(l){var e=["N","E","A","D"];function t(o,a){o.super_=a,o.prototype=Object.create(a.prototype,{constructor:{value:o,enumerable:false,writable:true,configurable:true}});}function i(o,a){Object.defineProperty(this,"kind",{value:o,enumerable:true}),a&&a.length&&Object.defineProperty(this,"path",{value:a,enumerable:true});}function r(o,a,n){r.super_.call(this,"E",o),Object.defineProperty(this,"lhs",{value:a,enumerable:true}),Object.defineProperty(this,"rhs",{value:n,enumerable:true});}t(r,i);function s(o,a){s.super_.call(this,"N",o),Object.defineProperty(this,"rhs",{value:a,enumerable:true});}t(s,i);function h(o,a){h.super_.call(this,"D",o),Object.defineProperty(this,"lhs",{value:a,enumerable:true});}t(h,i);function c(o,a,n){c.super_.call(this,"A",o),Object.defineProperty(this,"index",{value:a,enumerable:true}),Object.defineProperty(this,"item",{value:n,enumerable:true});}t(c,i);function d(o,a,n){var f=o.slice((a)+1||o.length);return o.length=a<0?o.length+a:a,o.push.apply(o,f),o}function g(o){var a=typeof o;return a!=="object"?a:o===Math?"math":o===null?"null":Array.isArray(o)?"array":Object.prototype.toString.call(o)==="[object Date]"?"date":typeof o.toString=="function"&&/^\/.*\//.test(o.toString())?"regexp":"object"}function _(o){var a=0;if(o.length===0)return a;for(var n=0;n<o.length;n++){var f=o.charCodeAt(n);a=(a<<5)-a+f,a=a&a;}return a}function m(o){var a=0,n=g(o);if(n==="array"){o.forEach(function(R){a+=m(R);});var f="[type: array, hash: "+a+"]";return a+_(f)}if(n==="object"){for(var u in o)if(o.hasOwnProperty(u)){var w="[ type: object, key: "+u+", value hash: "+m(o[u])+"]";a+=_(w);}return a}var y="[ type: "+n+" ; value: "+o+"]";return a+_(y)}function v(o,a,n,f,u,w,y,R){n=n||[],u=u||[],y=y||[];var A=u.slice(0);if(typeof w<"u"&&w!==null){if(f){if(typeof f=="function"&&f(A,w))return;if(typeof f=="object"){if(f.prefilter&&f.prefilter(A,w))return;if(f.normalize){var $=f.normalize(A,w,o,a);$&&(o=$[0],a=$[1]);}}}A.push(w);}g(o)==="regexp"&&g(a)==="regexp"&&(o=o.toString(),a=a.toString());var Y=typeof o,de=typeof a,D,P,z,j,ee=Y!=="undefined"||y&&y.length>0&&y[y.length-1].lhs&&Object.getOwnPropertyDescriptor(y[y.length-1].lhs,w),te=de!=="undefined"||y&&y.length>0&&y[y.length-1].rhs&&Object.getOwnPropertyDescriptor(y[y.length-1].rhs,w);if(!ee&&te)n.push(new s(A,a));else if(!te&&ee)n.push(new h(A,o));else if(g(o)!==g(a))n.push(new r(A,o,a));else if(g(o)==="date"&&o-a!==0)n.push(new r(A,o,a));else if(Y==="object"&&o!==null&&a!==null){for(D=y.length-1;D>-1;--D)if(y[D].lhs===o){j=true;break}if(j)o!==a&&n.push(new r(A,o,a));else {if(y.push({lhs:o,rhs:a}),Array.isArray(o)){for(R&&(o.sort(function(J,q){return m(J)-m(q)}),a.sort(function(J,q){return m(J)-m(q)})),D=a.length-1,P=o.length-1;D>P;)n.push(new c(A,D,new s(void 0,a[D--])));for(;P>D;)n.push(new c(A,P,new h(void 0,o[P--])));for(;D>=0;--D)v(o[D],a[D],n,f,A,D,y,R);}else {var ie=Object.keys(o),U=Object.keys(a);for(D=0;D<ie.length;++D)z=ie[D],j=U.indexOf(z),j>=0?(v(o[z],a[z],n,f,A,z,y,R),U[j]=null):v(o[z],void 0,n,f,A,z,y,R);for(D=0;D<U.length;++D)z=U[D],z&&v(void 0,a[z],n,f,A,z,y,R);}y.length=y.length-1;}}else o!==a&&(Y==="number"&&isNaN(o)&&isNaN(a)||n.push(new r(A,o,a)));}function G(o,a,n,f,u){var w=[];if(v(o,a,w,f,null,null,null,u),n)for(var y=0;y<w.length;++y)n(w[y]);return w}function N(o,a,n,f,u,w,y){return v(o,a,n,f,u,w,y,true)}function E(o,a,n,f){var u=f?function(y){y&&f.push(y);}:void 0,w=G(o,a,u,n);return f||(w.length?w:void 0)}function T(o,a,n,f){var u=f?function(y){y&&f.push(y);}:void 0,w=G(o,a,u,n,true);return f||(w.length?w:void 0)}function S(o,a,n){if(n.path&&n.path.length){var f=o[a],u,w=n.path.length-1;for(u=0;u<w;u++)f=f[n.path[u]];switch(n.kind){case "A":S(f[n.path[u]],n.index,n.item);break;case "D":delete f[n.path[u]];break;case "E":case "N":f[n.path[u]]=n.rhs;break}}else switch(n.kind){case "A":S(o[a],n.index,n.item);break;case "D":o=d(o,a);break;case "E":case "N":o[a]=n.rhs;break}return o}function H(o,a,n){if(typeof n>"u"&&a&&~e.indexOf(a.kind)&&(n=a),o&&n&&n.kind){for(var f=o,u=-1,w=n.path?n.path.length-1:0;++u<w;)typeof f[n.path[u]]>"u"&&(f[n.path[u]]=typeof n.path[u+1]<"u"&&typeof n.path[u+1]=="number"?[]:{}),f=f[n.path[u]];switch(n.kind){case "A":n.path&&typeof f[n.path[u]]>"u"&&(f[n.path[u]]=[]),S(n.path?f[n.path[u]]:f,n.index,n.item);break;case "D":delete f[n.path[u]];break;case "E":case "N":f[n.path[u]]=n.rhs;break}}}function C(o,a,n){if(n.path&&n.path.length){var f=o[a],u,w=n.path.length-1;for(u=0;u<w;u++)f=f[n.path[u]];switch(n.kind){case "A":C(f[n.path[u]],n.index,n.item);break;case "D":f[n.path[u]]=n.lhs;break;case "E":f[n.path[u]]=n.lhs;break;case "N":delete f[n.path[u]];break}}else switch(n.kind){case "A":C(o[a],n.index,n.item);break;case "D":o[a]=n.lhs;break;case "E":o[a]=n.lhs;break;case "N":o=d(o,a);break}return o}function x(o,a,n){if(o&&a&&n&&n.kind){var f=o,u,w;for(w=n.path.length-1,u=0;u<w;u++)typeof f[n.path[u]]>"u"&&(f[n.path[u]]={}),f=f[n.path[u]];switch(n.kind){case "A":C(f[n.path[u]],n.index,n.item);break;case "D":f[n.path[u]]=n.lhs;break;case "E":f[n.path[u]]=n.lhs;break;case "N":delete f[n.path[u]];break}}}function O(o,a,n){if(o&&a){var f=function(u){(!n||n(o,a,u))&&H(o,a,u);};G(o,a,f);}}return Object.defineProperties(E,{diff:{value:E,enumerable:true},orderIndependentDiff:{value:T,enumerable:true},observableDiff:{value:G,enumerable:true},orderIndependentObservableDiff:{value:N,enumerable:true},orderIndepHash:{value:m,enumerable:true},applyDiff:{value:O,enumerable:true},applyChange:{value:H,enumerable:true},revertChange:{value:x,enumerable:true},isConflict:{value:function(){return typeof $conflict<"u"},enumerable:true}}),E.DeepDiff=E,l&&(l.DeepDiff=E),E});});var ue=ve(se());var b;(r=>(r.log=(s,...h)=>console.log(`[Pixi\u2019VN] ${s}`,...h),r.warn=(s,...h)=>console.warn(`[Pixi\u2019VN] ${s}`,...h),r.error=(s,...h)=>console.error(`[Pixi\u2019VN] ${s}`,...h),r.info=(s,...h)=>console.info(`[Pixi\u2019VN] ${s}`,...h)))(b||={});var I=class l{static init(e){l._getStepCounter=e.getStepCounter,l._setStepCounter=e.setStepCounter,l._getCurrentGameStepState=e.getCurrentGameStepState,l._restoreGameStepState=e.restoreGameStepState,l._getOpenedLabels=e.getOpenedLabels,e.onGoNextEnd&&(l._onGoNextEnd=e.onGoNextEnd),l._getVariable=e.getVariable,l._setVariable=e.setVariable,l._removeVariable=e.removeVariable,l._getFlag=e.getFlag,l._setFlag=e.setFlag,e.onLabelClosing&&(l._onLabelClosing=e.onLabelClosing),l._addHistoryItem=e.addHistoryItem,l._getCurrentStepsRunningNumber=e.getCurrentStepsRunningNumber,l._getCharacter=e.getCharacter;}static _getStepCounter=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static _setStepCounter=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get stepCounter(){return l._getStepCounter()}static set stepCounter(e){l._setStepCounter(e);}static _getCurrentGameStepState=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get currentGameStepState(){return l._getCurrentGameStepState()}static _restoreGameStepState=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get restoreGameStepState(){return l._restoreGameStepState}static _getOpenedLabels=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get openedLabels(){return l._getOpenedLabels()}static _onGoNextEnd=async()=>{};static get onGoNextEnd(){return l._onGoNextEnd}static _getVariable=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get getVariable(){return l._getVariable}static _setVariable=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get setVariable(){return l._setVariable}static _removeVariable=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get removeVariable(){return l._removeVariable}static _getFlag=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get getFlag(){return l._getFlag}static _setFlag=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get setFlag(){return l._setFlag}static _onLabelClosing=()=>{};static get onLabelClosing(){return l._onLabelClosing}static _addHistoryItem=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get addHistoryItem(){return l._addHistoryItem}static _getCurrentStepsRunningNumber=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get currentStepsRunningNumber(){return l._getCurrentStepsRunningNumber()}static _getCharacter=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get getCharacter(){return l._getCharacter}static onEnd;static onError};function M(l){try{if(typeof l>"u")return l;let e=JSON.stringify(l);return JSON.parse(e)}catch(e){throw b.error("Error creating exportable element",l,e),new Error("[Pixi\u2019VN] Error creating exportable element")}}function oe(l,e){let t=M(l);return e.length>1&&"type"in e[0]&&(e=e.reverse()),e.forEach(i=>{"type"in i?we(t,i):_e(t,i);}),t}function we(l,e){let t=l;e.path&&e.path.length>0?e.path.forEach((i,r)=>{if(e.path&&r===e.path.length-1)switch(e.type){case "CHANGE":case "REMOVE":t[i]=e.oldValue;break;case "CREATE":Array.isArray(t)&&typeof i=="number"?t.splice(i,1):delete t[i];break}else t=t[i];}):b.warn("No path found, skipping diff",e);}function _e(l,e){let t=l;e.path&&e.path.length>0?e.path.forEach((i,r)=>{if(e.path&&r===e.path.length-1){if(e.kind==="E"||e.kind==="D")t[i]=e.lhs;else if(e.kind==="N")Number.isInteger(i)?Array.isArray(t)&&t.splice(i,1):typeof i=="string"&&delete t[i];else if(e.kind==="A"){let s=e.index;e.item.kind==="N"?t[i].splice(s,1):e.item.kind==="E"||e.item.kind==="D"?t[i][s]=e.item.lhs:e.item.kind==="A"?b.warn("Nested array found, skipping diff",e):b.warn("No array found, skipping diff",e);}}else t=t[i];}):b.warn("No path found, skipping diff",e);}var k=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,le=new Set,Q=typeof process=="object"&&process?process:{},he=(l,e,t,i)=>{typeof Q.emitWarning=="function"?Q.emitWarning(l,e,t,i):console.error(`[${t}] ${e}: ${l}`);},K=globalThis.AbortController,ae=globalThis.AbortSignal;if(typeof K>"u"){ae=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,r){this._onabort.push(r);}},K=class{constructor(){e();}signal=new ae;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let r of this.signal._onabort)r(i);this.signal.onabort?.(i);}}};let l=Q.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{l&&(l=false,he("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 Ee=l=>!le.has(l),F=l=>l&&l===Math.floor(l)&&l>0&&isFinite(l),fe=l=>F(l)?l<=Math.pow(2,8)?Uint8Array:l<=Math.pow(2,16)?Uint16Array:l<=Math.pow(2,32)?Uint32Array:l<=Number.MAX_SAFE_INTEGER?V:null:null,V=class extends Array{constructor(e){super(e),this.fill(0);}},Z=class l{heap;length;static#l=false;static create(e){let t=fe(e);if(!t)return [];l.#l=true;let i=new l(e,t);return l.#l=false,i}constructor(e,t){if(!l.#l)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0;}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},B=class l{#l;#u;#m;#x;#g;#T;#z;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#n;#y;#r;#i;#e;#h;#d;#a;#s;#b;#o;#S;#v;#c;#w;#H;#f;#M;static unsafeExposeInternals(e){return {starts:e.#v,ttls:e.#c,sizes:e.#S,keyMap:e.#r,keyList:e.#i,valList:e.#e,next:e.#h,prev:e.#d,get head(){return e.#a},get tail(){return e.#s},free:e.#b,isBackgroundFetch:t=>e.#t(t),backgroundFetch:(t,i,r,s)=>e.#F(t,i,r,s),moveToTail:t=>e.#C(t),indexes:t=>e.#_(t),rindexes:t=>e.#E(t),isStale:t=>e.#p(t)}}get max(){return this.#l}get maxSize(){return this.#u}get calculatedSize(){return this.#y}get size(){return this.#n}get fetchMethod(){return this.#T}get memoMethod(){return this.#z}get dispose(){return this.#m}get onInsert(){return this.#x}get disposeAfter(){return this.#g}constructor(e){let{max:t=0,ttl:i,ttlResolution:r=1,ttlAutopurge:s,updateAgeOnGet:h,updateAgeOnHas:c,allowStale:d,dispose:g,onInsert:_,disposeAfter:m,noDisposeOnSet:v,noUpdateTTL:G,maxSize:N=0,maxEntrySize:E=0,sizeCalculation:T,fetchMethod:S,memoMethod:H,noDeleteOnFetchRejection:C,noDeleteOnStaleGet:x,allowStaleOnFetchRejection:O,allowStaleOnFetchAbort:o,ignoreFetchAbort:a}=e;if(t!==0&&!F(t))throw new TypeError("max option must be a nonnegative integer");let n=t?fe(t):Array;if(!n)throw new Error("invalid max value: "+t);if(this.#l=t,this.#u=N,this.maxEntrySize=E||this.#u,this.sizeCalculation=T,this.sizeCalculation){if(!this.#u&&!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(H!==void 0&&typeof H!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#z=H,S!==void 0&&typeof S!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#T=S,this.#H=!!S,this.#r=new Map,this.#i=new Array(t).fill(void 0),this.#e=new Array(t).fill(void 0),this.#h=new n(t),this.#d=new n(t),this.#a=0,this.#s=0,this.#b=Z.create(t),this.#n=0,this.#y=0,typeof g=="function"&&(this.#m=g),typeof _=="function"&&(this.#x=_),typeof m=="function"?(this.#g=m,this.#o=[]):(this.#g=void 0,this.#o=void 0),this.#w=!!this.#m,this.#M=!!this.#x,this.#f=!!this.#g,this.noDisposeOnSet=!!v,this.noUpdateTTL=!!G,this.noDeleteOnFetchRejection=!!C,this.allowStaleOnFetchRejection=!!O,this.allowStaleOnFetchAbort=!!o,this.ignoreFetchAbort=!!a,this.maxEntrySize!==0){if(this.#u!==0&&!F(this.#u))throw new TypeError("maxSize must be a positive integer if specified");if(!F(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#W();}if(this.allowStale=!!d,this.noDeleteOnStaleGet=!!x,this.updateAgeOnGet=!!h,this.updateAgeOnHas=!!c,this.ttlResolution=F(r)||r===0?r:1,this.ttlAutopurge=!!s,this.ttl=i||0,this.ttl){if(!F(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#L();}if(this.#l===0&&this.ttl===0&&this.#u===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#l&&!this.#u){let f="LRU_CACHE_UNBOUNDED";Ee(f)&&(le.add(f),he("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",f,l));}}getRemainingTTL(e){return this.#r.has(e)?1/0:0}#L(){let e=new V(this.#l),t=new V(this.#l);this.#c=e,this.#v=t,this.#R=(s,h,c=k.now())=>{if(t[s]=h!==0?c:0,e[s]=h,h!==0&&this.ttlAutopurge){let d=setTimeout(()=>{this.#p(s)&&this.#G(this.#i[s],"expire");},h+1);d.unref&&d.unref();}},this.#A=s=>{t[s]=e[s]!==0?k.now():0;},this.#D=(s,h)=>{if(e[h]){let c=e[h],d=t[h];if(!c||!d)return;s.ttl=c,s.start=d,s.now=i||r();let g=s.now-d;s.remainingTTL=c-g;}};let i=0,r=()=>{let s=k.now();if(this.ttlResolution>0){i=s;let h=setTimeout(()=>i=0,this.ttlResolution);h.unref&&h.unref();}return s};this.getRemainingTTL=s=>{let h=this.#r.get(s);if(h===void 0)return 0;let c=e[h],d=t[h];if(!c||!d)return 1/0;let g=(i||r())-d;return c-g},this.#p=s=>{let h=t[s],c=e[s];return !!c&&!!h&&(i||r())-h>c};}#A=()=>{};#D=()=>{};#R=()=>{};#p=()=>false;#W(){let e=new V(this.#l);this.#y=0,this.#S=e,this.#O=t=>{this.#y-=e[t],e[t]=0;},this.#k=(t,i,r,s)=>{if(this.#t(i))return 0;if(!F(r))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(r=s(i,t),!F(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},this.#N=(t,i,r)=>{if(e[t]=i,this.#u){let s=this.#u-e[t];for(;this.#y>s;)this.#I(true);}this.#y+=e[t],r&&(r.entrySize=i,r.totalCalculatedSize=this.#y);};}#O=e=>{};#N=(e,t,i)=>{};#k=(e,t,i,r)=>{if(i||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#_({allowStale:e=this.allowStale}={}){if(this.#n)for(let t=this.#s;!(!this.#V(t)||((e||!this.#p(t))&&(yield t),t===this.#a));)t=this.#d[t];}*#E({allowStale:e=this.allowStale}={}){if(this.#n)for(let t=this.#a;!(!this.#V(t)||((e||!this.#p(t))&&(yield t),t===this.#s));)t=this.#h[t];}#V(e){return e!==void 0&&this.#r.get(this.#i[e])===e}*entries(){for(let e of this.#_())this.#e[e]!==void 0&&this.#i[e]!==void 0&&!this.#t(this.#e[e])&&(yield [this.#i[e],this.#e[e]]);}*rentries(){for(let e of this.#E())this.#e[e]!==void 0&&this.#i[e]!==void 0&&!this.#t(this.#e[e])&&(yield [this.#i[e],this.#e[e]]);}*keys(){for(let e of this.#_()){let t=this.#i[e];t!==void 0&&!this.#t(this.#e[e])&&(yield t);}}*rkeys(){for(let e of this.#E()){let t=this.#i[e];t!==void 0&&!this.#t(this.#e[e])&&(yield t);}}*values(){for(let e of this.#_())this.#e[e]!==void 0&&!this.#t(this.#e[e])&&(yield this.#e[e]);}*rvalues(){for(let e of this.#E())this.#e[e]!==void 0&&!this.#t(this.#e[e])&&(yield this.#e[e]);}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let i of this.#_()){let r=this.#e[i],s=this.#t(r)?r.__staleWhileFetching:r;if(s!==void 0&&e(s,this.#i[i],this))return this.get(this.#i[i],t)}}forEach(e,t=this){for(let i of this.#_()){let r=this.#e[i],s=this.#t(r)?r.__staleWhileFetching:r;s!==void 0&&e.call(t,s,this.#i[i],this);}}rforEach(e,t=this){for(let i of this.#E()){let r=this.#e[i],s=this.#t(r)?r.__staleWhileFetching:r;s!==void 0&&e.call(t,s,this.#i[i],this);}}purgeStale(){let e=false;for(let t of this.#E({allowStale:true}))this.#p(t)&&(this.#G(this.#i[t],"expire"),e=true);return e}info(e){let t=this.#r.get(e);if(t===void 0)return;let i=this.#e[t],r=this.#t(i)?i.__staleWhileFetching:i;if(r===void 0)return;let s={value:r};if(this.#c&&this.#v){let h=this.#c[t],c=this.#v[t];if(h&&c){let d=h-(k.now()-c);s.ttl=d,s.start=Date.now();}}return this.#S&&(s.size=this.#S[t]),s}dump(){let e=[];for(let t of this.#_({allowStale:true})){let i=this.#i[t],r=this.#e[t],s=this.#t(r)?r.__staleWhileFetching:r;if(s===void 0||i===void 0)continue;let h={value:s};if(this.#c&&this.#v){h.ttl=this.#c[t];let c=k.now()-this.#v[t];h.start=Math.floor(Date.now()-c);}this.#S&&(h.size=this.#S[t]),e.unshift([i,h]);}return e}load(e){this.clear();for(let[t,i]of e){if(i.start){let r=Date.now()-i.start;i.start=k.now()-r;}this.set(t,i.value,i);}}set(e,t,i={}){if(t===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:s,noDisposeOnSet:h=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:d}=i,{noUpdateTTL:g=this.noUpdateTTL}=i,_=this.#k(e,t,i.size||0,c);if(this.maxEntrySize&&_>this.maxEntrySize)return d&&(d.set="miss",d.maxEntrySizeExceeded=true),this.#G(e,"set"),this;let m=this.#n===0?void 0:this.#r.get(e);if(m===void 0)m=this.#n===0?this.#s:this.#b.length!==0?this.#b.pop():this.#n===this.#l?this.#I(false):this.#n,this.#i[m]=e,this.#e[m]=t,this.#r.set(e,m),this.#h[this.#s]=m,this.#d[m]=this.#s,this.#s=m,this.#n++,this.#N(m,_,d),d&&(d.set="add"),g=false,this.#M&&this.#x?.(t,e,"add");else {this.#C(m);let v=this.#e[m];if(t!==v){if(this.#H&&this.#t(v)){v.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:G}=v;G!==void 0&&!h&&(this.#w&&this.#m?.(G,e,"set"),this.#f&&this.#o?.push([G,e,"set"]));}else h||(this.#w&&this.#m?.(v,e,"set"),this.#f&&this.#o?.push([v,e,"set"]));if(this.#O(m),this.#N(m,_,d),this.#e[m]=t,d){d.set="replace";let G=v&&this.#t(v)?v.__staleWhileFetching:v;G!==void 0&&(d.oldValue=G);}}else d&&(d.set="update");this.#M&&this.onInsert?.(t,e,t===v?"update":"replace");}if(r!==0&&!this.#c&&this.#L(),this.#c&&(g||this.#R(m,r,s),d&&this.#D(d,m)),!h&&this.#f&&this.#o){let v=this.#o,G;for(;G=v?.shift();)this.#g?.(...G);}return this}pop(){try{for(;this.#n;){let e=this.#e[this.#a];if(this.#I(!0),this.#t(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#f&&this.#o){let e=this.#o,t;for(;t=e?.shift();)this.#g?.(...t);}}}#I(e){let t=this.#a,i=this.#i[t],r=this.#e[t];return this.#H&&this.#t(r)?r.__abortController.abort(new Error("evicted")):(this.#w||this.#f)&&(this.#w&&this.#m?.(r,i,"evict"),this.#f&&this.#o?.push([r,i,"evict"])),this.#O(t),e&&(this.#i[t]=void 0,this.#e[t]=void 0,this.#b.push(t)),this.#n===1?(this.#a=this.#s=0,this.#b.length=0):this.#a=this.#h[t],this.#r.delete(i),this.#n--,t}has(e,t={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:r}=t,s=this.#r.get(e);if(s!==void 0){let h=this.#e[s];if(this.#t(h)&&h.__staleWhileFetching===void 0)return false;if(this.#p(s))r&&(r.has="stale",this.#D(r,s));else return i&&this.#A(s),r&&(r.has="hit",this.#D(r,s)),true}else r&&(r.has="miss");return false}peek(e,t={}){let{allowStale:i=this.allowStale}=t,r=this.#r.get(e);if(r===void 0||!i&&this.#p(r))return;let s=this.#e[r];return this.#t(s)?s.__staleWhileFetching:s}#F(e,t,i,r){let s=t===void 0?void 0:this.#e[t];if(this.#t(s))return s;let h=new K,{signal:c}=i;c?.addEventListener("abort",()=>h.abort(c.reason),{signal:h.signal});let d={signal:h.signal,options:i,context:r},g=(E,T=false)=>{let{aborted:S}=h.signal,H=i.ignoreFetchAbort&&E!==void 0;if(i.status&&(S&&!T?(i.status.fetchAborted=true,i.status.fetchError=h.signal.reason,H&&(i.status.fetchAbortIgnored=true)):i.status.fetchResolved=true),S&&!H&&!T)return m(h.signal.reason);let C=G;return this.#e[t]===G&&(E===void 0?C.__staleWhileFetching?this.#e[t]=C.__staleWhileFetching:this.#G(e,"fetch"):(i.status&&(i.status.fetchUpdated=true),this.set(e,E,d.options))),E},_=E=>(i.status&&(i.status.fetchRejected=true,i.status.fetchError=E),m(E)),m=E=>{let{aborted:T}=h.signal,S=T&&i.allowStaleOnFetchAbort,H=S||i.allowStaleOnFetchRejection,C=H||i.noDeleteOnFetchRejection,x=G;if(this.#e[t]===G&&(!C||x.__staleWhileFetching===void 0?this.#G(e,"fetch"):S||(this.#e[t]=x.__staleWhileFetching)),H)return i.status&&x.__staleWhileFetching!==void 0&&(i.status.returnedStale=true),x.__staleWhileFetching;if(x.__returned===x)throw E},v=(E,T)=>{let S=this.#T?.(e,s,d);S&&S instanceof Promise&&S.then(H=>E(H===void 0?void 0:H),T),h.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(E(void 0),i.allowStaleOnFetchAbort&&(E=H=>g(H,true)));});};i.status&&(i.status.fetchDispatched=true);let G=new Promise(v).then(g,_),N=Object.assign(G,{__abortController:h,__staleWhileFetching:s,__returned:void 0});return t===void 0?(this.set(e,N,{...d.options,status:void 0}),t=this.#r.get(e)):this.#e[t]=N,N}#t(e){if(!this.#H)return false;let t=e;return !!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof K}async fetch(e,t={}){let{allowStale:i=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:h=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:d=0,sizeCalculation:g=this.sizeCalculation,noUpdateTTL:_=this.noUpdateTTL,noDeleteOnFetchRejection:m=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:v=this.allowStaleOnFetchRejection,ignoreFetchAbort:G=this.ignoreFetchAbort,allowStaleOnFetchAbort:N=this.allowStaleOnFetchAbort,context:E,forceRefresh:T=false,status:S,signal:H}=t;if(!this.#H)return S&&(S.fetch="get"),this.get(e,{allowStale:i,updateAgeOnGet:r,noDeleteOnStaleGet:s,status:S});let C={allowStale:i,updateAgeOnGet:r,noDeleteOnStaleGet:s,ttl:h,noDisposeOnSet:c,size:d,sizeCalculation:g,noUpdateTTL:_,noDeleteOnFetchRejection:m,allowStaleOnFetchRejection:v,allowStaleOnFetchAbort:N,ignoreFetchAbort:G,status:S,signal:H},x=this.#r.get(e);if(x===void 0){S&&(S.fetch="miss");let O=this.#F(e,x,C,E);return O.__returned=O}else {let O=this.#e[x];if(this.#t(O)){let u=i&&O.__staleWhileFetching!==void 0;return S&&(S.fetch="inflight",u&&(S.returnedStale=true)),u?O.__staleWhileFetching:O.__returned=O}let o=this.#p(x);if(!T&&!o)return S&&(S.fetch="hit"),this.#C(x),r&&this.#A(x),S&&this.#D(S,x),O;let a=this.#F(e,x,C,E),f=a.__staleWhileFetching!==void 0&&i;return S&&(S.fetch=o?"stale":"refresh",f&&o&&(S.returnedStale=true)),f?a.__staleWhileFetching:a.__returned=a}}async forceFetch(e,t={}){let i=await this.fetch(e,t);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(e,t={}){let i=this.#z;if(!i)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:s,...h}=t,c=this.get(e,h);if(!s&&c!==void 0)return c;let d=i(e,c,{options:h,context:r});return this.set(e,d,h),d}get(e,t={}){let{allowStale:i=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:h}=t,c=this.#r.get(e);if(c!==void 0){let d=this.#e[c],g=this.#t(d);return h&&this.#D(h,c),this.#p(c)?(h&&(h.get="stale"),g?(h&&i&&d.__staleWhileFetching!==void 0&&(h.returnedStale=true),i?d.__staleWhileFetching:void 0):(s||this.#G(e,"expire"),h&&i&&(h.returnedStale=true),i?d:void 0)):(h&&(h.get="hit"),g?d.__staleWhileFetching:(this.#C(c),r&&this.#A(c),d))}else h&&(h.get="miss");}#P(e,t){this.#d[t]=e,this.#h[e]=t;}#C(e){e!==this.#s&&(e===this.#a?this.#a=this.#h[e]:this.#P(this.#d[e],this.#h[e]),this.#P(this.#s,e),this.#s=e);}delete(e){return this.#G(e,"delete")}#G(e,t){let i=false;if(this.#n!==0){let r=this.#r.get(e);if(r!==void 0)if(i=true,this.#n===1)this.#j(t);else {this.#O(r);let s=this.#e[r];if(this.#t(s)?s.__abortController.abort(new Error("deleted")):(this.#w||this.#f)&&(this.#w&&this.#m?.(s,e,t),this.#f&&this.#o?.push([s,e,t])),this.#r.delete(e),this.#i[r]=void 0,this.#e[r]=void 0,r===this.#s)this.#s=this.#d[r];else if(r===this.#a)this.#a=this.#h[r];else {let h=this.#d[r];this.#h[h]=this.#h[r];let c=this.#h[r];this.#d[c]=this.#d[r];}this.#n--,this.#b.push(r);}}if(this.#f&&this.#o?.length){let r=this.#o,s;for(;s=r?.shift();)this.#g?.(...s);}return i}clear(){return this.#j("delete")}#j(e){for(let t of this.#E({allowStale:true})){let i=this.#e[t];if(this.#t(i))i.__abortController.abort(new Error("deleted"));else {let r=this.#i[t];this.#w&&this.#m?.(i,r,e),this.#f&&this.#o?.push([i,r,e]);}}if(this.#r.clear(),this.#e.fill(void 0),this.#i.fill(void 0),this.#c&&this.#v&&(this.#c.fill(0),this.#v.fill(0)),this.#S&&this.#S.fill(0),this.#a=0,this.#s=0,this.#b.length=0,this.#y=0,this.#n=0,this.#f&&this.#o){let t=this.#o,i;for(;i=t?.shift();)this.#g?.(...i);}}};var L=class{cache;map=new Map;constructor(e){this.cache=new B({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 t=this.map.delete(e);return t&&this.cache.delete(e),t}get forEach(){return this.map.forEach}get(e){let t=this.cache.get(e);return t||this.map.get(e)}has(e){return this.map.has(e)}set(e,t){return this.map.set(e,t),this.cache.set(e,t),this}get size(){return this.map.size}get entries(){return this.map.entries}keys(){return this.map.keys()}get values(){return this.map.values}};var p=class l{static _diffHistory=new L({cacheSize:5});static _stepsInfoHistory=new L({cacheSize:5});static _narrationHistory=new L({cacheSize:50});static stepLimitSaved=20;static goBackRunning=false;static _originalStepData=void 0;static get originalStepData(){return l._originalStepData?M(l._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){l._originalStepData=M(e);}};var W=class{get stepsInfoMap(){return p._stepsInfoHistory}get diffMap(){return p._diffHistory}get narrationMap(){return p._narrationHistory}get size(){return p._stepsInfoHistory.size}get lastKey(){return this.size===0?null:Math.max(...Array.from(this.keys()))}keys(){return p._stepsInfoHistory.keys()}get(e){let t=p._narrationHistory.get(e);if(!(t&&Object.keys(t).length===1&&t.stepIndex!==void 0))return t}delete(e){p._stepsInfoHistory.delete(e),p._diffHistory.delete(e),p._narrationHistory.delete(e);}internalRestoreOldGameState(e,t){if(e<=0||this.size==0)return t;let i=this.lastKey;if(typeof i!="number")return b.error("You can't go back, there is no step to go back"),t;let r=p._diffHistory.get(i);if(r)try{let s=oe(t,r);return I.stepCounter=i,this.delete(i),this.internalRestoreOldGameState(e-1,s)}catch(s){return b.error("Error applying diff",s),t}else return b.error("You can't go back, there is no step to go back"),t}async goBack(e,t=1){if(t<=0){b.warn("The parameter steps must be greater than 0");return}if(p._diffHistory.size<1){b.warn("You can't go back, there is no step to go back");return}if(p.goBackRunning){b.warn("Go back is already running");return}p.goBackRunning=true;try{let i=M(this.internalRestoreOldGameState(t,p.originalStepData));i?await I.restoreGameStepState(i,e):b.error("Error going back"),p.goBackRunning=!1;}catch(i){b.error("Error going back",i),p.goBackRunning=false;}}add(e,t={}){let i=p.originalStepData,{ignoreSameStep:r}=t,s=I.currentGameStepState;if(!r&&this.isSameStep(i,s))return;let h=this.lastKey;(async()=>{try{let d,g;if(typeof h=="number"&&(d=p._stepsInfoHistory.get(h),g=p._narrationHistory.get(h)),p._stepsInfoHistory.set(e.index,e),e.index!==0){let v=(0,ue.diff)(i,s);v?p._diffHistory.set(e.index,v):b.warn("It was not possible to create the difference between the two steps");}let _={},m=this.itemMapper({step:e},_);if(p._narrationHistory.set(e.index,m),d&&g&&typeof h=="number"){let v=this.itemMapper({..._,step:d},{});p._narrationHistory.set(h,v);}}catch(d){b.error("Error adding history step",d);}})(),p.originalStepData=s;}itemMapper(e,t){let{step:i,choiceIndexMade:r,inputValue:s,removeDialogue:h}=e,c=i.dialogue||i.dialoge;t&&i.isGlued&&(t.removeDialogue=true),h&&(c=void 0);let d=i.choices;if(t&&i.currentLabel&&i.choiceIndexMade!==void 0&&(t.choiceIndexMade=i.choiceIndexMade),i.inputValue&&t&&(t.inputValue=i.inputValue),c||d||s){let g=d?.map((_,m)=>{let v=false;return _.oneTime&&i.alreadyMadeChoices&&i.alreadyMadeChoices.includes(m)&&(v=true),{text:_.text,type:_.type,isResponse:false,hidden:v}});if(g){if(g.every(_=>_.hidden)){let _=g.find(m=>m.hidden===false);_&&(_.hidden=false);}r!==void 0&&(g[r].isResponse=true);}return {dialogue:c?{...c,character:c.character?I.getCharacter(c.character)||c.character:void 0}:void 0,playerMadeChoice:typeof r=="number",choices:g,stepIndex:i.index,inputValue:s}}return {stepIndex:i.index}}get narrativeHistory(){let e=[];return Array.from(this.keys()).sort((i,r)=>i-r).forEach(i=>{let r=this.get(i);r&&e.push(r);}),e}get currentLabelHistory(){let e=[],t=Array.from(this.keys()).sort((g,_)=>_-g);if(t.length===0)return e;let i=t[0];if(typeof i!="number")return e;let r=p._stepsInfoHistory.get(i);if(!r)return e;let s=r.currentLabel,h=r.index,c=r.labelStepIndex||-1,d=r.openedLabelsNumber||-1;return t.every(g=>{let _=this.get(g);if(_){let m=p._stepsInfoHistory.get(g);if(!m||!(m.currentLabel===s&&m.index<=h&&(m.labelStepIndex||-1)<=c&&(m.openedLabelsNumber||-1)===d))return false;e.push(_);}return h=g,true}),e.reverse()}removeNarrativeHistory(e){if(e){let t=Array.from(this.keys()).sort((i,r)=>i-r);t=t.slice(0,e),t.forEach(i=>{p._narrationHistory.delete(i),p._stepsInfoHistory.delete(i),p._diffHistory.delete(i);});}else p._stepsInfoHistory.clear(),p._diffHistory.clear(),p._narrationHistory.clear();}get canGoBack(){let e=this.lastKey;return typeof e!="number"?false:p._diffHistory.has(e)}blockGoBack(){I.currentStepsRunningNumber===0&&p._diffHistory.clear();}isSameStep(e,t){if(e.openedLabels.length===t.openedLabels.length)try{let i=JSON.stringify(e.openedLabels),r=JSON.stringify(t.openedLabels);if(i===r&&e.path===t.path&&e.labelIndex===t.labelIndex)return !0}catch(i){return b.error("Error comparing opened labels",i),true}return false}clear(){p._stepsInfoHistory.clear(),p._diffHistory.clear(),p._narrationHistory.clear(),p._originalStepData=void 0;}get stepLimitSaved(){return p.stepLimitSaved}set stepLimitSaved(e){p.stepLimitSaved=e;}export(){let e=Array.from(this.keys()).sort((i,r)=>i-r);e.length>this.stepLimitSaved&&(e=e.slice(e.length-this.stepLimitSaved));let t=[];return e.forEach(i=>{let r=p._stepsInfoHistory.get(i);if(r){let s=p._diffHistory.get(i);t.push({...r,diff:s});}}),{stepsHistory:M(t),originalStepData:M(p._originalStepData)}}restoreNarrativeHistory(){let e=Array.from(this.keys()).sort((i,r)=>i-r),t={};e.forEach(i=>{let r=p._stepsInfoHistory.get(i);if(r){let s={...t};t={};let h=this.itemMapper({step:r,choiceIndexMade:s.choiceIndexMade,inputValue:s.inputValue,removeDialogue:s.removeDialogue},t);h&&p._narrationHistory.set(i,h);}});}async restore(e){this.clear();try{e.hasOwnProperty("stepsHistory")?(e.stepsHistory.forEach(i=>{i.diff&&p._diffHistory.set(i.index,i.diff);let r={...i,diff:void 0};p._stepsInfoHistory.set(i.index,r);}),this.restoreNarrativeHistory()):b.warn("Could not import stepsHistory data, so will be ignored"),e.hasOwnProperty("originalStepData")?p._originalStepData=e.originalStepData:b.warn("Could not import originalStepData data, so will be ignored");}catch(t){b.error("Error importing data",t);}}};var Ze=new W;
1
+ 'use strict';var ce=Object.create;var re=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var me=Object.getOwnPropertyNames;var ge=Object.getPrototypeOf,ye=Object.prototype.hasOwnProperty;var be=(l,e)=>()=>(e||l((e={exports:{}}).exports,e),e.exports);var Se=(l,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of me(e))!ye.call(l,r)&&r!==t&&re(l,r,{get:()=>e[r],enumerable:!(i=pe(e,r))||i.enumerable});return l};var ve=(l,e,t)=>(t=l!=null?ce(ge(l)):{},Se(re(t,"default",{value:l,enumerable:true}),l));var se=be((X,ne)=>{(function(l,e){var t=e(l);if(typeof define=="function"&&define.amd)define("DeepDiff",function(){return t});else if(typeof X=="object"||typeof navigator=="object"&&navigator.product.match(/ReactNative/i))ne.exports=t;else {var i=l.DeepDiff;t.noConflict=function(){return l.DeepDiff===t&&(l.DeepDiff=i),t},l.DeepDiff=t;}})(X,function(l){var e=["N","E","A","D"];function t(o,a){o.super_=a,o.prototype=Object.create(a.prototype,{constructor:{value:o,enumerable:false,writable:true,configurable:true}});}function i(o,a){Object.defineProperty(this,"kind",{value:o,enumerable:true}),a&&a.length&&Object.defineProperty(this,"path",{value:a,enumerable:true});}function r(o,a,n){r.super_.call(this,"E",o),Object.defineProperty(this,"lhs",{value:a,enumerable:true}),Object.defineProperty(this,"rhs",{value:n,enumerable:true});}t(r,i);function s(o,a){s.super_.call(this,"N",o),Object.defineProperty(this,"rhs",{value:a,enumerable:true});}t(s,i);function h(o,a){h.super_.call(this,"D",o),Object.defineProperty(this,"lhs",{value:a,enumerable:true});}t(h,i);function c(o,a,n){c.super_.call(this,"A",o),Object.defineProperty(this,"index",{value:a,enumerable:true}),Object.defineProperty(this,"item",{value:n,enumerable:true});}t(c,i);function d(o,a,n){var f=o.slice((a)+1||o.length);return o.length=a<0?o.length+a:a,o.push.apply(o,f),o}function g(o){var a=typeof o;return a!=="object"?a:o===Math?"math":o===null?"null":Array.isArray(o)?"array":Object.prototype.toString.call(o)==="[object Date]"?"date":typeof o.toString=="function"&&/^\/.*\//.test(o.toString())?"regexp":"object"}function _(o){var a=0;if(o.length===0)return a;for(var n=0;n<o.length;n++){var f=o.charCodeAt(n);a=(a<<5)-a+f,a=a&a;}return a}function m(o){var a=0,n=g(o);if(n==="array"){o.forEach(function(R){a+=m(R);});var f="[type: array, hash: "+a+"]";return a+_(f)}if(n==="object"){for(var u in o)if(o.hasOwnProperty(u)){var w="[ type: object, key: "+u+", value hash: "+m(o[u])+"]";a+=_(w);}return a}var y="[ type: "+n+" ; value: "+o+"]";return a+_(y)}function v(o,a,n,f,u,w,y,R){n=n||[],u=u||[],y=y||[];var A=u.slice(0);if(typeof w<"u"&&w!==null){if(f){if(typeof f=="function"&&f(A,w))return;if(typeof f=="object"){if(f.prefilter&&f.prefilter(A,w))return;if(f.normalize){var $=f.normalize(A,w,o,a);$&&(o=$[0],a=$[1]);}}}A.push(w);}g(o)==="regexp"&&g(a)==="regexp"&&(o=o.toString(),a=a.toString());var Y=typeof o,de=typeof a,D,P,z,j,ee=Y!=="undefined"||y&&y.length>0&&y[y.length-1].lhs&&Object.getOwnPropertyDescriptor(y[y.length-1].lhs,w),te=de!=="undefined"||y&&y.length>0&&y[y.length-1].rhs&&Object.getOwnPropertyDescriptor(y[y.length-1].rhs,w);if(!ee&&te)n.push(new s(A,a));else if(!te&&ee)n.push(new h(A,o));else if(g(o)!==g(a))n.push(new r(A,o,a));else if(g(o)==="date"&&o-a!==0)n.push(new r(A,o,a));else if(Y==="object"&&o!==null&&a!==null){for(D=y.length-1;D>-1;--D)if(y[D].lhs===o){j=true;break}if(j)o!==a&&n.push(new r(A,o,a));else {if(y.push({lhs:o,rhs:a}),Array.isArray(o)){for(R&&(o.sort(function(J,q){return m(J)-m(q)}),a.sort(function(J,q){return m(J)-m(q)})),D=a.length-1,P=o.length-1;D>P;)n.push(new c(A,D,new s(void 0,a[D--])));for(;P>D;)n.push(new c(A,P,new h(void 0,o[P--])));for(;D>=0;--D)v(o[D],a[D],n,f,A,D,y,R);}else {var ie=Object.keys(o),U=Object.keys(a);for(D=0;D<ie.length;++D)z=ie[D],j=U.indexOf(z),j>=0?(v(o[z],a[z],n,f,A,z,y,R),U[j]=null):v(o[z],void 0,n,f,A,z,y,R);for(D=0;D<U.length;++D)z=U[D],z&&v(void 0,a[z],n,f,A,z,y,R);}y.length=y.length-1;}}else o!==a&&(Y==="number"&&isNaN(o)&&isNaN(a)||n.push(new r(A,o,a)));}function G(o,a,n,f,u){var w=[];if(v(o,a,w,f,null,null,null,u),n)for(var y=0;y<w.length;++y)n(w[y]);return w}function N(o,a,n,f,u,w,y){return v(o,a,n,f,u,w,y,true)}function E(o,a,n,f){var u=f?function(y){y&&f.push(y);}:void 0,w=G(o,a,u,n);return f||(w.length?w:void 0)}function T(o,a,n,f){var u=f?function(y){y&&f.push(y);}:void 0,w=G(o,a,u,n,true);return f||(w.length?w:void 0)}function S(o,a,n){if(n.path&&n.path.length){var f=o[a],u,w=n.path.length-1;for(u=0;u<w;u++)f=f[n.path[u]];switch(n.kind){case "A":S(f[n.path[u]],n.index,n.item);break;case "D":delete f[n.path[u]];break;case "E":case "N":f[n.path[u]]=n.rhs;break}}else switch(n.kind){case "A":S(o[a],n.index,n.item);break;case "D":o=d(o,a);break;case "E":case "N":o[a]=n.rhs;break}return o}function H(o,a,n){if(typeof n>"u"&&a&&~e.indexOf(a.kind)&&(n=a),o&&n&&n.kind){for(var f=o,u=-1,w=n.path?n.path.length-1:0;++u<w;)typeof f[n.path[u]]>"u"&&(f[n.path[u]]=typeof n.path[u+1]<"u"&&typeof n.path[u+1]=="number"?[]:{}),f=f[n.path[u]];switch(n.kind){case "A":n.path&&typeof f[n.path[u]]>"u"&&(f[n.path[u]]=[]),S(n.path?f[n.path[u]]:f,n.index,n.item);break;case "D":delete f[n.path[u]];break;case "E":case "N":f[n.path[u]]=n.rhs;break}}}function C(o,a,n){if(n.path&&n.path.length){var f=o[a],u,w=n.path.length-1;for(u=0;u<w;u++)f=f[n.path[u]];switch(n.kind){case "A":C(f[n.path[u]],n.index,n.item);break;case "D":f[n.path[u]]=n.lhs;break;case "E":f[n.path[u]]=n.lhs;break;case "N":delete f[n.path[u]];break}}else switch(n.kind){case "A":C(o[a],n.index,n.item);break;case "D":o[a]=n.lhs;break;case "E":o[a]=n.lhs;break;case "N":o=d(o,a);break}return o}function x(o,a,n){if(o&&a&&n&&n.kind){var f=o,u,w;for(w=n.path.length-1,u=0;u<w;u++)typeof f[n.path[u]]>"u"&&(f[n.path[u]]={}),f=f[n.path[u]];switch(n.kind){case "A":C(f[n.path[u]],n.index,n.item);break;case "D":f[n.path[u]]=n.lhs;break;case "E":f[n.path[u]]=n.lhs;break;case "N":delete f[n.path[u]];break}}}function O(o,a,n){if(o&&a){var f=function(u){(!n||n(o,a,u))&&H(o,a,u);};G(o,a,f);}}return Object.defineProperties(E,{diff:{value:E,enumerable:true},orderIndependentDiff:{value:T,enumerable:true},observableDiff:{value:G,enumerable:true},orderIndependentObservableDiff:{value:N,enumerable:true},orderIndepHash:{value:m,enumerable:true},applyDiff:{value:O,enumerable:true},applyChange:{value:H,enumerable:true},revertChange:{value:x,enumerable:true},isConflict:{value:function(){return typeof $conflict<"u"},enumerable:true}}),E.DeepDiff=E,l&&(l.DeepDiff=E),E});});var ue=ve(se());var b;(r=>(r.log=(s,...h)=>console.log(`[Pixi\u2019VN] ${s}`,...h),r.warn=(s,...h)=>console.warn(`[Pixi\u2019VN] ${s}`,...h),r.error=(s,...h)=>console.error(`[Pixi\u2019VN] ${s}`,...h),r.info=(s,...h)=>console.info(`[Pixi\u2019VN] ${s}`,...h)))(b||={});var I=class l{static init(e){l._getStepCounter=e.getStepCounter,l._setStepCounter=e.setStepCounter,l._getCurrentGameStepState=e.getCurrentGameStepState,l._restoreGameStepState=e.restoreGameStepState,l._getOpenedLabels=e.getOpenedLabels,e.onGoNextEnd&&(l._onGoNextEnd=e.onGoNextEnd),l._getVariable=e.getVariable,l._setVariable=e.setVariable,l._removeVariable=e.removeVariable,l._getFlag=e.getFlag,l._setFlag=e.setFlag,e.onLabelClosing&&(l._onLabelClosing=e.onLabelClosing),l._addHistoryItem=e.addHistoryItem,l._getCurrentStepsRunningNumber=e.getCurrentStepsRunningNumber,l._getCharacter=e.getCharacter;}static _getStepCounter=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static _setStepCounter=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get stepCounter(){return l._getStepCounter()}static set stepCounter(e){l._setStepCounter(e);}static _getCurrentGameStepState=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get currentGameStepState(){return l._getCurrentGameStepState()}static _restoreGameStepState=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get restoreGameStepState(){return l._restoreGameStepState}static _getOpenedLabels=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get openedLabels(){return l._getOpenedLabels()}static _onGoNextEnd=async()=>{};static get onGoNextEnd(){return l._onGoNextEnd}static _getVariable=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get getVariable(){return l._getVariable}static _setVariable=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get setVariable(){return l._setVariable}static _removeVariable=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get removeVariable(){return l._removeVariable}static _getFlag=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get getFlag(){return l._getFlag}static _setFlag=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get setFlag(){return l._setFlag}static _onLabelClosing=()=>{};static get onLabelClosing(){return l._onLabelClosing}static _addHistoryItem=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get addHistoryItem(){return l._addHistoryItem}static _getCurrentStepsRunningNumber=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get currentStepsRunningNumber(){return l._getCurrentStepsRunningNumber()}static _getCharacter=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get getCharacter(){return l._getCharacter}static onEnd;static onError};function M(l){try{if(typeof l>"u")return l;let e=JSON.stringify(l);return JSON.parse(e)}catch(e){throw b.error("Error creating exportable element",l,e),new Error("[Pixi\u2019VN] Error creating exportable element")}}function oe(l,e){let t=M(l);return e.length>1&&"type"in e[0]&&(e=e.reverse()),e.forEach(i=>{"type"in i?we(t,i):_e(t,i);}),t}function we(l,e){let t=l;e.path&&e.path.length>0?e.path.forEach((i,r)=>{if(e.path&&r===e.path.length-1)switch(e.type){case "CHANGE":case "REMOVE":t[i]=e.oldValue;break;case "CREATE":Array.isArray(t)&&typeof i=="number"?t.splice(i,1):delete t[i];break}else t=t[i];}):b.warn("No path found, skipping diff",e);}function _e(l,e){let t=l;e.path&&e.path.length>0?e.path.forEach((i,r)=>{if(e.path&&r===e.path.length-1){if(e.kind==="E"||e.kind==="D")t[i]=e.lhs;else if(e.kind==="N")Number.isInteger(i)?Array.isArray(t)&&t.splice(i,1):typeof i=="string"&&delete t[i];else if(e.kind==="A"){let s=e.index;e.item.kind==="N"?t[i].splice(s,1):e.item.kind==="E"||e.item.kind==="D"?t[i][s]=e.item.lhs:e.item.kind==="A"?b.warn("Nested array found, skipping diff",e):b.warn("No array found, skipping diff",e);}}else t=t[i];}):b.warn("No path found, skipping diff",e);}var k=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,le=new Set,Q=typeof process=="object"&&process?process:{},he=(l,e,t,i)=>{typeof Q.emitWarning=="function"?Q.emitWarning(l,e,t,i):console.error(`[${t}] ${e}: ${l}`);},K=globalThis.AbortController,ae=globalThis.AbortSignal;if(typeof K>"u"){ae=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,r){this._onabort.push(r);}},K=class{constructor(){e();}signal=new ae;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let r of this.signal._onabort)r(i);this.signal.onabort?.(i);}}};let l=Q.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{l&&(l=false,he("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 Ee=l=>!le.has(l),F=l=>l&&l===Math.floor(l)&&l>0&&isFinite(l),fe=l=>F(l)?l<=Math.pow(2,8)?Uint8Array:l<=Math.pow(2,16)?Uint16Array:l<=Math.pow(2,32)?Uint32Array:l<=Number.MAX_SAFE_INTEGER?V:null:null,V=class extends Array{constructor(e){super(e),this.fill(0);}},Z=class l{heap;length;static#l=false;static create(e){let t=fe(e);if(!t)return [];l.#l=true;let i=new l(e,t);return l.#l=false,i}constructor(e,t){if(!l.#l)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0;}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},B=class l{#l;#u;#m;#x;#g;#T;#z;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#n;#y;#r;#i;#e;#h;#d;#a;#s;#b;#o;#S;#v;#c;#w;#H;#f;#M;static unsafeExposeInternals(e){return {starts:e.#v,ttls:e.#c,sizes:e.#S,keyMap:e.#r,keyList:e.#i,valList:e.#e,next:e.#h,prev:e.#d,get head(){return e.#a},get tail(){return e.#s},free:e.#b,isBackgroundFetch:t=>e.#t(t),backgroundFetch:(t,i,r,s)=>e.#F(t,i,r,s),moveToTail:t=>e.#C(t),indexes:t=>e.#_(t),rindexes:t=>e.#E(t),isStale:t=>e.#p(t)}}get max(){return this.#l}get maxSize(){return this.#u}get calculatedSize(){return this.#y}get size(){return this.#n}get fetchMethod(){return this.#T}get memoMethod(){return this.#z}get dispose(){return this.#m}get onInsert(){return this.#x}get disposeAfter(){return this.#g}constructor(e){let{max:t=0,ttl:i,ttlResolution:r=1,ttlAutopurge:s,updateAgeOnGet:h,updateAgeOnHas:c,allowStale:d,dispose:g,onInsert:_,disposeAfter:m,noDisposeOnSet:v,noUpdateTTL:G,maxSize:N=0,maxEntrySize:E=0,sizeCalculation:T,fetchMethod:S,memoMethod:H,noDeleteOnFetchRejection:C,noDeleteOnStaleGet:x,allowStaleOnFetchRejection:O,allowStaleOnFetchAbort:o,ignoreFetchAbort:a}=e;if(t!==0&&!F(t))throw new TypeError("max option must be a nonnegative integer");let n=t?fe(t):Array;if(!n)throw new Error("invalid max value: "+t);if(this.#l=t,this.#u=N,this.maxEntrySize=E||this.#u,this.sizeCalculation=T,this.sizeCalculation){if(!this.#u&&!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(H!==void 0&&typeof H!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#z=H,S!==void 0&&typeof S!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#T=S,this.#H=!!S,this.#r=new Map,this.#i=new Array(t).fill(void 0),this.#e=new Array(t).fill(void 0),this.#h=new n(t),this.#d=new n(t),this.#a=0,this.#s=0,this.#b=Z.create(t),this.#n=0,this.#y=0,typeof g=="function"&&(this.#m=g),typeof _=="function"&&(this.#x=_),typeof m=="function"?(this.#g=m,this.#o=[]):(this.#g=void 0,this.#o=void 0),this.#w=!!this.#m,this.#M=!!this.#x,this.#f=!!this.#g,this.noDisposeOnSet=!!v,this.noUpdateTTL=!!G,this.noDeleteOnFetchRejection=!!C,this.allowStaleOnFetchRejection=!!O,this.allowStaleOnFetchAbort=!!o,this.ignoreFetchAbort=!!a,this.maxEntrySize!==0){if(this.#u!==0&&!F(this.#u))throw new TypeError("maxSize must be a positive integer if specified");if(!F(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#W();}if(this.allowStale=!!d,this.noDeleteOnStaleGet=!!x,this.updateAgeOnGet=!!h,this.updateAgeOnHas=!!c,this.ttlResolution=F(r)||r===0?r:1,this.ttlAutopurge=!!s,this.ttl=i||0,this.ttl){if(!F(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#L();}if(this.#l===0&&this.ttl===0&&this.#u===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#l&&!this.#u){let f="LRU_CACHE_UNBOUNDED";Ee(f)&&(le.add(f),he("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",f,l));}}getRemainingTTL(e){return this.#r.has(e)?1/0:0}#L(){let e=new V(this.#l),t=new V(this.#l);this.#c=e,this.#v=t,this.#R=(s,h,c=k.now())=>{if(t[s]=h!==0?c:0,e[s]=h,h!==0&&this.ttlAutopurge){let d=setTimeout(()=>{this.#p(s)&&this.#G(this.#i[s],"expire");},h+1);d.unref&&d.unref();}},this.#A=s=>{t[s]=e[s]!==0?k.now():0;},this.#D=(s,h)=>{if(e[h]){let c=e[h],d=t[h];if(!c||!d)return;s.ttl=c,s.start=d,s.now=i||r();let g=s.now-d;s.remainingTTL=c-g;}};let i=0,r=()=>{let s=k.now();if(this.ttlResolution>0){i=s;let h=setTimeout(()=>i=0,this.ttlResolution);h.unref&&h.unref();}return s};this.getRemainingTTL=s=>{let h=this.#r.get(s);if(h===void 0)return 0;let c=e[h],d=t[h];if(!c||!d)return 1/0;let g=(i||r())-d;return c-g},this.#p=s=>{let h=t[s],c=e[s];return !!c&&!!h&&(i||r())-h>c};}#A=()=>{};#D=()=>{};#R=()=>{};#p=()=>false;#W(){let e=new V(this.#l);this.#y=0,this.#S=e,this.#O=t=>{this.#y-=e[t],e[t]=0;},this.#k=(t,i,r,s)=>{if(this.#t(i))return 0;if(!F(r))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(r=s(i,t),!F(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},this.#N=(t,i,r)=>{if(e[t]=i,this.#u){let s=this.#u-e[t];for(;this.#y>s;)this.#I(true);}this.#y+=e[t],r&&(r.entrySize=i,r.totalCalculatedSize=this.#y);};}#O=e=>{};#N=(e,t,i)=>{};#k=(e,t,i,r)=>{if(i||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#_({allowStale:e=this.allowStale}={}){if(this.#n)for(let t=this.#s;!(!this.#V(t)||((e||!this.#p(t))&&(yield t),t===this.#a));)t=this.#d[t];}*#E({allowStale:e=this.allowStale}={}){if(this.#n)for(let t=this.#a;!(!this.#V(t)||((e||!this.#p(t))&&(yield t),t===this.#s));)t=this.#h[t];}#V(e){return e!==void 0&&this.#r.get(this.#i[e])===e}*entries(){for(let e of this.#_())this.#e[e]!==void 0&&this.#i[e]!==void 0&&!this.#t(this.#e[e])&&(yield [this.#i[e],this.#e[e]]);}*rentries(){for(let e of this.#E())this.#e[e]!==void 0&&this.#i[e]!==void 0&&!this.#t(this.#e[e])&&(yield [this.#i[e],this.#e[e]]);}*keys(){for(let e of this.#_()){let t=this.#i[e];t!==void 0&&!this.#t(this.#e[e])&&(yield t);}}*rkeys(){for(let e of this.#E()){let t=this.#i[e];t!==void 0&&!this.#t(this.#e[e])&&(yield t);}}*values(){for(let e of this.#_())this.#e[e]!==void 0&&!this.#t(this.#e[e])&&(yield this.#e[e]);}*rvalues(){for(let e of this.#E())this.#e[e]!==void 0&&!this.#t(this.#e[e])&&(yield this.#e[e]);}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let i of this.#_()){let r=this.#e[i],s=this.#t(r)?r.__staleWhileFetching:r;if(s!==void 0&&e(s,this.#i[i],this))return this.get(this.#i[i],t)}}forEach(e,t=this){for(let i of this.#_()){let r=this.#e[i],s=this.#t(r)?r.__staleWhileFetching:r;s!==void 0&&e.call(t,s,this.#i[i],this);}}rforEach(e,t=this){for(let i of this.#E()){let r=this.#e[i],s=this.#t(r)?r.__staleWhileFetching:r;s!==void 0&&e.call(t,s,this.#i[i],this);}}purgeStale(){let e=false;for(let t of this.#E({allowStale:true}))this.#p(t)&&(this.#G(this.#i[t],"expire"),e=true);return e}info(e){let t=this.#r.get(e);if(t===void 0)return;let i=this.#e[t],r=this.#t(i)?i.__staleWhileFetching:i;if(r===void 0)return;let s={value:r};if(this.#c&&this.#v){let h=this.#c[t],c=this.#v[t];if(h&&c){let d=h-(k.now()-c);s.ttl=d,s.start=Date.now();}}return this.#S&&(s.size=this.#S[t]),s}dump(){let e=[];for(let t of this.#_({allowStale:true})){let i=this.#i[t],r=this.#e[t],s=this.#t(r)?r.__staleWhileFetching:r;if(s===void 0||i===void 0)continue;let h={value:s};if(this.#c&&this.#v){h.ttl=this.#c[t];let c=k.now()-this.#v[t];h.start=Math.floor(Date.now()-c);}this.#S&&(h.size=this.#S[t]),e.unshift([i,h]);}return e}load(e){this.clear();for(let[t,i]of e){if(i.start){let r=Date.now()-i.start;i.start=k.now()-r;}this.set(t,i.value,i);}}set(e,t,i={}){if(t===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:s,noDisposeOnSet:h=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:d}=i,{noUpdateTTL:g=this.noUpdateTTL}=i,_=this.#k(e,t,i.size||0,c);if(this.maxEntrySize&&_>this.maxEntrySize)return d&&(d.set="miss",d.maxEntrySizeExceeded=true),this.#G(e,"set"),this;let m=this.#n===0?void 0:this.#r.get(e);if(m===void 0)m=this.#n===0?this.#s:this.#b.length!==0?this.#b.pop():this.#n===this.#l?this.#I(false):this.#n,this.#i[m]=e,this.#e[m]=t,this.#r.set(e,m),this.#h[this.#s]=m,this.#d[m]=this.#s,this.#s=m,this.#n++,this.#N(m,_,d),d&&(d.set="add"),g=false,this.#M&&this.#x?.(t,e,"add");else {this.#C(m);let v=this.#e[m];if(t!==v){if(this.#H&&this.#t(v)){v.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:G}=v;G!==void 0&&!h&&(this.#w&&this.#m?.(G,e,"set"),this.#f&&this.#o?.push([G,e,"set"]));}else h||(this.#w&&this.#m?.(v,e,"set"),this.#f&&this.#o?.push([v,e,"set"]));if(this.#O(m),this.#N(m,_,d),this.#e[m]=t,d){d.set="replace";let G=v&&this.#t(v)?v.__staleWhileFetching:v;G!==void 0&&(d.oldValue=G);}}else d&&(d.set="update");this.#M&&this.onInsert?.(t,e,t===v?"update":"replace");}if(r!==0&&!this.#c&&this.#L(),this.#c&&(g||this.#R(m,r,s),d&&this.#D(d,m)),!h&&this.#f&&this.#o){let v=this.#o,G;for(;G=v?.shift();)this.#g?.(...G);}return this}pop(){try{for(;this.#n;){let e=this.#e[this.#a];if(this.#I(!0),this.#t(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#f&&this.#o){let e=this.#o,t;for(;t=e?.shift();)this.#g?.(...t);}}}#I(e){let t=this.#a,i=this.#i[t],r=this.#e[t];return this.#H&&this.#t(r)?r.__abortController.abort(new Error("evicted")):(this.#w||this.#f)&&(this.#w&&this.#m?.(r,i,"evict"),this.#f&&this.#o?.push([r,i,"evict"])),this.#O(t),e&&(this.#i[t]=void 0,this.#e[t]=void 0,this.#b.push(t)),this.#n===1?(this.#a=this.#s=0,this.#b.length=0):this.#a=this.#h[t],this.#r.delete(i),this.#n--,t}has(e,t={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:r}=t,s=this.#r.get(e);if(s!==void 0){let h=this.#e[s];if(this.#t(h)&&h.__staleWhileFetching===void 0)return false;if(this.#p(s))r&&(r.has="stale",this.#D(r,s));else return i&&this.#A(s),r&&(r.has="hit",this.#D(r,s)),true}else r&&(r.has="miss");return false}peek(e,t={}){let{allowStale:i=this.allowStale}=t,r=this.#r.get(e);if(r===void 0||!i&&this.#p(r))return;let s=this.#e[r];return this.#t(s)?s.__staleWhileFetching:s}#F(e,t,i,r){let s=t===void 0?void 0:this.#e[t];if(this.#t(s))return s;let h=new K,{signal:c}=i;c?.addEventListener("abort",()=>h.abort(c.reason),{signal:h.signal});let d={signal:h.signal,options:i,context:r},g=(E,T=false)=>{let{aborted:S}=h.signal,H=i.ignoreFetchAbort&&E!==void 0;if(i.status&&(S&&!T?(i.status.fetchAborted=true,i.status.fetchError=h.signal.reason,H&&(i.status.fetchAbortIgnored=true)):i.status.fetchResolved=true),S&&!H&&!T)return m(h.signal.reason);let C=G;return this.#e[t]===G&&(E===void 0?C.__staleWhileFetching?this.#e[t]=C.__staleWhileFetching:this.#G(e,"fetch"):(i.status&&(i.status.fetchUpdated=true),this.set(e,E,d.options))),E},_=E=>(i.status&&(i.status.fetchRejected=true,i.status.fetchError=E),m(E)),m=E=>{let{aborted:T}=h.signal,S=T&&i.allowStaleOnFetchAbort,H=S||i.allowStaleOnFetchRejection,C=H||i.noDeleteOnFetchRejection,x=G;if(this.#e[t]===G&&(!C||x.__staleWhileFetching===void 0?this.#G(e,"fetch"):S||(this.#e[t]=x.__staleWhileFetching)),H)return i.status&&x.__staleWhileFetching!==void 0&&(i.status.returnedStale=true),x.__staleWhileFetching;if(x.__returned===x)throw E},v=(E,T)=>{let S=this.#T?.(e,s,d);S&&S instanceof Promise&&S.then(H=>E(H===void 0?void 0:H),T),h.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(E(void 0),i.allowStaleOnFetchAbort&&(E=H=>g(H,true)));});};i.status&&(i.status.fetchDispatched=true);let G=new Promise(v).then(g,_),N=Object.assign(G,{__abortController:h,__staleWhileFetching:s,__returned:void 0});return t===void 0?(this.set(e,N,{...d.options,status:void 0}),t=this.#r.get(e)):this.#e[t]=N,N}#t(e){if(!this.#H)return false;let t=e;return !!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof K}async fetch(e,t={}){let{allowStale:i=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:h=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:d=0,sizeCalculation:g=this.sizeCalculation,noUpdateTTL:_=this.noUpdateTTL,noDeleteOnFetchRejection:m=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:v=this.allowStaleOnFetchRejection,ignoreFetchAbort:G=this.ignoreFetchAbort,allowStaleOnFetchAbort:N=this.allowStaleOnFetchAbort,context:E,forceRefresh:T=false,status:S,signal:H}=t;if(!this.#H)return S&&(S.fetch="get"),this.get(e,{allowStale:i,updateAgeOnGet:r,noDeleteOnStaleGet:s,status:S});let C={allowStale:i,updateAgeOnGet:r,noDeleteOnStaleGet:s,ttl:h,noDisposeOnSet:c,size:d,sizeCalculation:g,noUpdateTTL:_,noDeleteOnFetchRejection:m,allowStaleOnFetchRejection:v,allowStaleOnFetchAbort:N,ignoreFetchAbort:G,status:S,signal:H},x=this.#r.get(e);if(x===void 0){S&&(S.fetch="miss");let O=this.#F(e,x,C,E);return O.__returned=O}else {let O=this.#e[x];if(this.#t(O)){let u=i&&O.__staleWhileFetching!==void 0;return S&&(S.fetch="inflight",u&&(S.returnedStale=true)),u?O.__staleWhileFetching:O.__returned=O}let o=this.#p(x);if(!T&&!o)return S&&(S.fetch="hit"),this.#C(x),r&&this.#A(x),S&&this.#D(S,x),O;let a=this.#F(e,x,C,E),f=a.__staleWhileFetching!==void 0&&i;return S&&(S.fetch=o?"stale":"refresh",f&&o&&(S.returnedStale=true)),f?a.__staleWhileFetching:a.__returned=a}}async forceFetch(e,t={}){let i=await this.fetch(e,t);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(e,t={}){let i=this.#z;if(!i)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:s,...h}=t,c=this.get(e,h);if(!s&&c!==void 0)return c;let d=i(e,c,{options:h,context:r});return this.set(e,d,h),d}get(e,t={}){let{allowStale:i=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:h}=t,c=this.#r.get(e);if(c!==void 0){let d=this.#e[c],g=this.#t(d);return h&&this.#D(h,c),this.#p(c)?(h&&(h.get="stale"),g?(h&&i&&d.__staleWhileFetching!==void 0&&(h.returnedStale=true),i?d.__staleWhileFetching:void 0):(s||this.#G(e,"expire"),h&&i&&(h.returnedStale=true),i?d:void 0)):(h&&(h.get="hit"),g?d.__staleWhileFetching:(this.#C(c),r&&this.#A(c),d))}else h&&(h.get="miss");}#P(e,t){this.#d[t]=e,this.#h[e]=t;}#C(e){e!==this.#s&&(e===this.#a?this.#a=this.#h[e]:this.#P(this.#d[e],this.#h[e]),this.#P(this.#s,e),this.#s=e);}delete(e){return this.#G(e,"delete")}#G(e,t){let i=false;if(this.#n!==0){let r=this.#r.get(e);if(r!==void 0)if(i=true,this.#n===1)this.#j(t);else {this.#O(r);let s=this.#e[r];if(this.#t(s)?s.__abortController.abort(new Error("deleted")):(this.#w||this.#f)&&(this.#w&&this.#m?.(s,e,t),this.#f&&this.#o?.push([s,e,t])),this.#r.delete(e),this.#i[r]=void 0,this.#e[r]=void 0,r===this.#s)this.#s=this.#d[r];else if(r===this.#a)this.#a=this.#h[r];else {let h=this.#d[r];this.#h[h]=this.#h[r];let c=this.#h[r];this.#d[c]=this.#d[r];}this.#n--,this.#b.push(r);}}if(this.#f&&this.#o?.length){let r=this.#o,s;for(;s=r?.shift();)this.#g?.(...s);}return i}clear(){return this.#j("delete")}#j(e){for(let t of this.#E({allowStale:true})){let i=this.#e[t];if(this.#t(i))i.__abortController.abort(new Error("deleted"));else {let r=this.#i[t];this.#w&&this.#m?.(i,r,e),this.#f&&this.#o?.push([i,r,e]);}}if(this.#r.clear(),this.#e.fill(void 0),this.#i.fill(void 0),this.#c&&this.#v&&(this.#c.fill(0),this.#v.fill(0)),this.#S&&this.#S.fill(0),this.#a=0,this.#s=0,this.#b.length=0,this.#y=0,this.#n=0,this.#f&&this.#o){let t=this.#o,i;for(;i=t?.shift();)this.#g?.(...i);}}};var L=class{cache;map=new Map;constructor(e){this.cache=new B({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 t=this.map.delete(e);return t&&this.cache.delete(e),t}get forEach(){return this.map.forEach}get(e){let t=this.cache.get(e);return t||this.map.get(e)}has(e){return this.map.has(e)}set(e,t){return this.map.set(e,t),this.cache.set(e,t),this}get size(){return this.map.size}get entries(){return this.map.entries}keys(){return this.map.keys()}get values(){return this.map.values}};var p=class l{static _diffHistory=new L({cacheSize:5});static _stepsInfoHistory=new L({cacheSize:5});static _narrationHistory=new L({cacheSize:50});static stepLimitSaved=20;static goBackRunning=false;static _originalStepData=void 0;static get originalStepData(){return l._originalStepData?M(l._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){l._originalStepData=M(e);}};var W=class{get stepsInfoMap(){return p._stepsInfoHistory}get diffMap(){return p._diffHistory}get narrationMap(){return p._narrationHistory}get size(){return p._stepsInfoHistory.size}get lastKey(){return this.size===0?null:Math.max(...Array.from(this.keys()))}keys(){return p._stepsInfoHistory.keys()}get(e){let t=p._narrationHistory.get(e);if(!(t&&Object.keys(t).length===1&&t.stepIndex!==void 0))return t}delete(e){p._stepsInfoHistory.delete(e),p._diffHistory.delete(e),p._narrationHistory.delete(e);}internalRestoreOldGameState(e,t){if(e<=0||this.size==0)return t;let i=this.lastKey;if(typeof i!="number")return b.error("You can't go back, there is no step to go back"),t;let r=p._diffHistory.get(i);if(r)try{let s=oe(t,r);return I.stepCounter=i,this.delete(i),this.internalRestoreOldGameState(e-1,s)}catch(s){return b.error("Error applying diff",s),t}else return b.error("You can't go back, there is no step to go back"),t}async goBack(e,t=1){if(t<=0){b.warn("The parameter steps must be greater than 0");return}if(p._diffHistory.size<1){b.warn("You can't go back, there is no step to go back");return}if(p.goBackRunning){b.warn("Go back is already running");return}p.goBackRunning=true;try{let i=M(this.internalRestoreOldGameState(t,p.originalStepData));i?await I.restoreGameStepState(i,e):b.error("Error going back"),p.goBackRunning=!1;}catch(i){b.error("Error going back",i),p.goBackRunning=false;}}add(e,t={}){let i=p.originalStepData,{ignoreSameStep:r}=t,s=I.currentGameStepState;if(!r&&this.isSameStep(i,s))return;let h=this.lastKey;(async()=>{try{let d,g;if(typeof h=="number"&&(d=p._stepsInfoHistory.get(h),g=p._narrationHistory.get(h)),p._stepsInfoHistory.set(e.index,e),e.index!==0){let v=(0,ue.diff)(i,s);v?p._diffHistory.set(e.index,v):b.warn("It was not possible to create the difference between the two steps");}let _={},m=this.itemMapper({step:e},_);if(p._narrationHistory.set(e.index,m),d&&g&&typeof h=="number"){let v=this.itemMapper({..._,step:d},{});p._narrationHistory.set(h,v);}}catch(d){b.error("Error adding history step",d);}})(),p.originalStepData=s;}itemMapper(e,t){let{step:i,choiceIndexMade:r,inputValue:s,removeDialogue:h}=e,c=i.dialogue||i.dialoge;t&&i.isGlued&&(t.removeDialogue=true),h&&(c=void 0);let d=i.choices;if(t&&i.currentLabel&&i.choiceIndexMade!==void 0&&(t.choiceIndexMade=i.choiceIndexMade),i.inputValue&&t&&(t.inputValue=i.inputValue),c||d||s){let g=d?.map((_,m)=>{let v=false;return _.oneTime&&i.alreadyMadeChoices&&i.alreadyMadeChoices.includes(m)&&(v=true),{text:_.text,type:_.type,isResponse:false,hidden:v}});if(g){if(g.every(_=>_.hidden)){let _=g.find(m=>m.hidden===false);_&&(_.hidden=false);}r!==void 0&&(g[r].isResponse=true);}return {dialogue:c?{...c,character:c.character?I.getCharacter(c.character)||c.character:void 0}:void 0,playerMadeChoice:typeof r=="number",choices:g,stepIndex:i.index,inputValue:s}}return {stepIndex:i.index}}get narrativeHistory(){let e=[];return Array.from(this.keys()).sort((i,r)=>i-r).forEach(i=>{let r=this.get(i);r&&e.push(r);}),e}get currentLabelHistory(){let e=[],t=Array.from(this.keys()).sort((g,_)=>_-g);if(t.length===0)return e;let i=t[0];if(typeof i!="number")return e;let r=p._stepsInfoHistory.get(i);if(!r)return e;let s=r.currentLabel,h=r.index,c=r.labelStepIndex||-1,d=r.openedLabelsNumber||-1;return t.every(g=>{let _=this.get(g);if(_){let m=p._stepsInfoHistory.get(g);if(!m||!(m.currentLabel===s&&m.index<=h&&(m.labelStepIndex||-1)<=c&&(m.openedLabelsNumber||-1)===d))return true;if(e.push(_),m.labelStepIndex===0)return false}return h=g,true}),e.reverse()}removeNarrativeHistory(e){if(e){let t=Array.from(this.keys()).sort((i,r)=>i-r);t=t.slice(0,e),t.forEach(i=>{p._narrationHistory.delete(i),p._stepsInfoHistory.delete(i),p._diffHistory.delete(i);});}else p._stepsInfoHistory.clear(),p._diffHistory.clear(),p._narrationHistory.clear();}get canGoBack(){let e=this.lastKey;return typeof e!="number"?false:p._diffHistory.has(e)}blockGoBack(){I.currentStepsRunningNumber===0&&p._diffHistory.clear();}isSameStep(e,t){if(e.openedLabels.length===t.openedLabels.length)try{let i=JSON.stringify(e.openedLabels),r=JSON.stringify(t.openedLabels);if(i===r&&e.path===t.path&&e.labelIndex===t.labelIndex)return !0}catch(i){return b.error("Error comparing opened labels",i),true}return false}clear(){p._stepsInfoHistory.clear(),p._diffHistory.clear(),p._narrationHistory.clear(),p._originalStepData=void 0;}get stepLimitSaved(){return p.stepLimitSaved}set stepLimitSaved(e){p.stepLimitSaved=e;}export(){let e=Array.from(this.keys()).sort((i,r)=>i-r);e.length>this.stepLimitSaved&&(e=e.slice(e.length-this.stepLimitSaved));let t=[];return e.forEach(i=>{let r=p._stepsInfoHistory.get(i);if(r){let s=p._diffHistory.get(i);t.push({...r,diff:s});}}),{stepsHistory:M(t),originalStepData:M(p._originalStepData)}}restoreNarrativeHistory(){let e=Array.from(this.keys()).sort((i,r)=>i-r),t={};e.forEach(i=>{let r=p._stepsInfoHistory.get(i);if(r){let s={...t};t={};let h=this.itemMapper({step:r,choiceIndexMade:s.choiceIndexMade,inputValue:s.inputValue,removeDialogue:s.removeDialogue},t);h&&p._narrationHistory.set(i,h);}});}async restore(e){this.clear();try{e.hasOwnProperty("stepsHistory")?(e.stepsHistory.forEach(i=>{i.diff&&p._diffHistory.set(i.index,i.diff);let r={...i,diff:void 0};p._stepsInfoHistory.set(i.index,r);}),this.restoreNarrativeHistory()):b.warn("Could not import stepsHistory data, so will be ignored"),e.hasOwnProperty("originalStepData")?p._originalStepData=e.originalStepData:b.warn("Could not import originalStepData data, so will be ignored");}catch(t){b.error("Error importing data",t);}}};var Ze=new W;
2
2
  exports.HistoryManagerStatic=p;exports.stepHistory=Ze;
@@ -1,2 +1,2 @@
1
- var ce=Object.create;var re=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var me=Object.getOwnPropertyNames;var ge=Object.getPrototypeOf,ye=Object.prototype.hasOwnProperty;var be=(l,e)=>()=>(e||l((e={exports:{}}).exports,e),e.exports);var Se=(l,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of me(e))!ye.call(l,r)&&r!==t&&re(l,r,{get:()=>e[r],enumerable:!(i=pe(e,r))||i.enumerable});return l};var ve=(l,e,t)=>(t=l!=null?ce(ge(l)):{},Se(re(t,"default",{value:l,enumerable:true}),l));var se=be((X,ne)=>{(function(l,e){var t=e(l);if(typeof define=="function"&&define.amd)define("DeepDiff",function(){return t});else if(typeof X=="object"||typeof navigator=="object"&&navigator.product.match(/ReactNative/i))ne.exports=t;else {var i=l.DeepDiff;t.noConflict=function(){return l.DeepDiff===t&&(l.DeepDiff=i),t},l.DeepDiff=t;}})(X,function(l){var e=["N","E","A","D"];function t(o,a){o.super_=a,o.prototype=Object.create(a.prototype,{constructor:{value:o,enumerable:false,writable:true,configurable:true}});}function i(o,a){Object.defineProperty(this,"kind",{value:o,enumerable:true}),a&&a.length&&Object.defineProperty(this,"path",{value:a,enumerable:true});}function r(o,a,n){r.super_.call(this,"E",o),Object.defineProperty(this,"lhs",{value:a,enumerable:true}),Object.defineProperty(this,"rhs",{value:n,enumerable:true});}t(r,i);function s(o,a){s.super_.call(this,"N",o),Object.defineProperty(this,"rhs",{value:a,enumerable:true});}t(s,i);function h(o,a){h.super_.call(this,"D",o),Object.defineProperty(this,"lhs",{value:a,enumerable:true});}t(h,i);function c(o,a,n){c.super_.call(this,"A",o),Object.defineProperty(this,"index",{value:a,enumerable:true}),Object.defineProperty(this,"item",{value:n,enumerable:true});}t(c,i);function d(o,a,n){var f=o.slice((a)+1||o.length);return o.length=a<0?o.length+a:a,o.push.apply(o,f),o}function g(o){var a=typeof o;return a!=="object"?a:o===Math?"math":o===null?"null":Array.isArray(o)?"array":Object.prototype.toString.call(o)==="[object Date]"?"date":typeof o.toString=="function"&&/^\/.*\//.test(o.toString())?"regexp":"object"}function _(o){var a=0;if(o.length===0)return a;for(var n=0;n<o.length;n++){var f=o.charCodeAt(n);a=(a<<5)-a+f,a=a&a;}return a}function m(o){var a=0,n=g(o);if(n==="array"){o.forEach(function(R){a+=m(R);});var f="[type: array, hash: "+a+"]";return a+_(f)}if(n==="object"){for(var u in o)if(o.hasOwnProperty(u)){var w="[ type: object, key: "+u+", value hash: "+m(o[u])+"]";a+=_(w);}return a}var y="[ type: "+n+" ; value: "+o+"]";return a+_(y)}function v(o,a,n,f,u,w,y,R){n=n||[],u=u||[],y=y||[];var A=u.slice(0);if(typeof w<"u"&&w!==null){if(f){if(typeof f=="function"&&f(A,w))return;if(typeof f=="object"){if(f.prefilter&&f.prefilter(A,w))return;if(f.normalize){var $=f.normalize(A,w,o,a);$&&(o=$[0],a=$[1]);}}}A.push(w);}g(o)==="regexp"&&g(a)==="regexp"&&(o=o.toString(),a=a.toString());var Y=typeof o,de=typeof a,D,P,z,j,ee=Y!=="undefined"||y&&y.length>0&&y[y.length-1].lhs&&Object.getOwnPropertyDescriptor(y[y.length-1].lhs,w),te=de!=="undefined"||y&&y.length>0&&y[y.length-1].rhs&&Object.getOwnPropertyDescriptor(y[y.length-1].rhs,w);if(!ee&&te)n.push(new s(A,a));else if(!te&&ee)n.push(new h(A,o));else if(g(o)!==g(a))n.push(new r(A,o,a));else if(g(o)==="date"&&o-a!==0)n.push(new r(A,o,a));else if(Y==="object"&&o!==null&&a!==null){for(D=y.length-1;D>-1;--D)if(y[D].lhs===o){j=true;break}if(j)o!==a&&n.push(new r(A,o,a));else {if(y.push({lhs:o,rhs:a}),Array.isArray(o)){for(R&&(o.sort(function(J,q){return m(J)-m(q)}),a.sort(function(J,q){return m(J)-m(q)})),D=a.length-1,P=o.length-1;D>P;)n.push(new c(A,D,new s(void 0,a[D--])));for(;P>D;)n.push(new c(A,P,new h(void 0,o[P--])));for(;D>=0;--D)v(o[D],a[D],n,f,A,D,y,R);}else {var ie=Object.keys(o),U=Object.keys(a);for(D=0;D<ie.length;++D)z=ie[D],j=U.indexOf(z),j>=0?(v(o[z],a[z],n,f,A,z,y,R),U[j]=null):v(o[z],void 0,n,f,A,z,y,R);for(D=0;D<U.length;++D)z=U[D],z&&v(void 0,a[z],n,f,A,z,y,R);}y.length=y.length-1;}}else o!==a&&(Y==="number"&&isNaN(o)&&isNaN(a)||n.push(new r(A,o,a)));}function G(o,a,n,f,u){var w=[];if(v(o,a,w,f,null,null,null,u),n)for(var y=0;y<w.length;++y)n(w[y]);return w}function N(o,a,n,f,u,w,y){return v(o,a,n,f,u,w,y,true)}function E(o,a,n,f){var u=f?function(y){y&&f.push(y);}:void 0,w=G(o,a,u,n);return f||(w.length?w:void 0)}function T(o,a,n,f){var u=f?function(y){y&&f.push(y);}:void 0,w=G(o,a,u,n,true);return f||(w.length?w:void 0)}function S(o,a,n){if(n.path&&n.path.length){var f=o[a],u,w=n.path.length-1;for(u=0;u<w;u++)f=f[n.path[u]];switch(n.kind){case "A":S(f[n.path[u]],n.index,n.item);break;case "D":delete f[n.path[u]];break;case "E":case "N":f[n.path[u]]=n.rhs;break}}else switch(n.kind){case "A":S(o[a],n.index,n.item);break;case "D":o=d(o,a);break;case "E":case "N":o[a]=n.rhs;break}return o}function H(o,a,n){if(typeof n>"u"&&a&&~e.indexOf(a.kind)&&(n=a),o&&n&&n.kind){for(var f=o,u=-1,w=n.path?n.path.length-1:0;++u<w;)typeof f[n.path[u]]>"u"&&(f[n.path[u]]=typeof n.path[u+1]<"u"&&typeof n.path[u+1]=="number"?[]:{}),f=f[n.path[u]];switch(n.kind){case "A":n.path&&typeof f[n.path[u]]>"u"&&(f[n.path[u]]=[]),S(n.path?f[n.path[u]]:f,n.index,n.item);break;case "D":delete f[n.path[u]];break;case "E":case "N":f[n.path[u]]=n.rhs;break}}}function C(o,a,n){if(n.path&&n.path.length){var f=o[a],u,w=n.path.length-1;for(u=0;u<w;u++)f=f[n.path[u]];switch(n.kind){case "A":C(f[n.path[u]],n.index,n.item);break;case "D":f[n.path[u]]=n.lhs;break;case "E":f[n.path[u]]=n.lhs;break;case "N":delete f[n.path[u]];break}}else switch(n.kind){case "A":C(o[a],n.index,n.item);break;case "D":o[a]=n.lhs;break;case "E":o[a]=n.lhs;break;case "N":o=d(o,a);break}return o}function x(o,a,n){if(o&&a&&n&&n.kind){var f=o,u,w;for(w=n.path.length-1,u=0;u<w;u++)typeof f[n.path[u]]>"u"&&(f[n.path[u]]={}),f=f[n.path[u]];switch(n.kind){case "A":C(f[n.path[u]],n.index,n.item);break;case "D":f[n.path[u]]=n.lhs;break;case "E":f[n.path[u]]=n.lhs;break;case "N":delete f[n.path[u]];break}}}function O(o,a,n){if(o&&a){var f=function(u){(!n||n(o,a,u))&&H(o,a,u);};G(o,a,f);}}return Object.defineProperties(E,{diff:{value:E,enumerable:true},orderIndependentDiff:{value:T,enumerable:true},observableDiff:{value:G,enumerable:true},orderIndependentObservableDiff:{value:N,enumerable:true},orderIndepHash:{value:m,enumerable:true},applyDiff:{value:O,enumerable:true},applyChange:{value:H,enumerable:true},revertChange:{value:x,enumerable:true},isConflict:{value:function(){return typeof $conflict<"u"},enumerable:true}}),E.DeepDiff=E,l&&(l.DeepDiff=E),E});});var ue=ve(se());var b;(r=>(r.log=(s,...h)=>console.log(`[Pixi\u2019VN] ${s}`,...h),r.warn=(s,...h)=>console.warn(`[Pixi\u2019VN] ${s}`,...h),r.error=(s,...h)=>console.error(`[Pixi\u2019VN] ${s}`,...h),r.info=(s,...h)=>console.info(`[Pixi\u2019VN] ${s}`,...h)))(b||={});var I=class l{static init(e){l._getStepCounter=e.getStepCounter,l._setStepCounter=e.setStepCounter,l._getCurrentGameStepState=e.getCurrentGameStepState,l._restoreGameStepState=e.restoreGameStepState,l._getOpenedLabels=e.getOpenedLabels,e.onGoNextEnd&&(l._onGoNextEnd=e.onGoNextEnd),l._getVariable=e.getVariable,l._setVariable=e.setVariable,l._removeVariable=e.removeVariable,l._getFlag=e.getFlag,l._setFlag=e.setFlag,e.onLabelClosing&&(l._onLabelClosing=e.onLabelClosing),l._addHistoryItem=e.addHistoryItem,l._getCurrentStepsRunningNumber=e.getCurrentStepsRunningNumber,l._getCharacter=e.getCharacter;}static _getStepCounter=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static _setStepCounter=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get stepCounter(){return l._getStepCounter()}static set stepCounter(e){l._setStepCounter(e);}static _getCurrentGameStepState=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get currentGameStepState(){return l._getCurrentGameStepState()}static _restoreGameStepState=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get restoreGameStepState(){return l._restoreGameStepState}static _getOpenedLabels=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get openedLabels(){return l._getOpenedLabels()}static _onGoNextEnd=async()=>{};static get onGoNextEnd(){return l._onGoNextEnd}static _getVariable=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get getVariable(){return l._getVariable}static _setVariable=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get setVariable(){return l._setVariable}static _removeVariable=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get removeVariable(){return l._removeVariable}static _getFlag=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get getFlag(){return l._getFlag}static _setFlag=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get setFlag(){return l._setFlag}static _onLabelClosing=()=>{};static get onLabelClosing(){return l._onLabelClosing}static _addHistoryItem=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get addHistoryItem(){return l._addHistoryItem}static _getCurrentStepsRunningNumber=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get currentStepsRunningNumber(){return l._getCurrentStepsRunningNumber()}static _getCharacter=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get getCharacter(){return l._getCharacter}static onEnd;static onError};function M(l){try{if(typeof l>"u")return l;let e=JSON.stringify(l);return JSON.parse(e)}catch(e){throw b.error("Error creating exportable element",l,e),new Error("[Pixi\u2019VN] Error creating exportable element")}}function oe(l,e){let t=M(l);return e.length>1&&"type"in e[0]&&(e=e.reverse()),e.forEach(i=>{"type"in i?we(t,i):_e(t,i);}),t}function we(l,e){let t=l;e.path&&e.path.length>0?e.path.forEach((i,r)=>{if(e.path&&r===e.path.length-1)switch(e.type){case "CHANGE":case "REMOVE":t[i]=e.oldValue;break;case "CREATE":Array.isArray(t)&&typeof i=="number"?t.splice(i,1):delete t[i];break}else t=t[i];}):b.warn("No path found, skipping diff",e);}function _e(l,e){let t=l;e.path&&e.path.length>0?e.path.forEach((i,r)=>{if(e.path&&r===e.path.length-1){if(e.kind==="E"||e.kind==="D")t[i]=e.lhs;else if(e.kind==="N")Number.isInteger(i)?Array.isArray(t)&&t.splice(i,1):typeof i=="string"&&delete t[i];else if(e.kind==="A"){let s=e.index;e.item.kind==="N"?t[i].splice(s,1):e.item.kind==="E"||e.item.kind==="D"?t[i][s]=e.item.lhs:e.item.kind==="A"?b.warn("Nested array found, skipping diff",e):b.warn("No array found, skipping diff",e);}}else t=t[i];}):b.warn("No path found, skipping diff",e);}var k=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,le=new Set,Q=typeof process=="object"&&process?process:{},he=(l,e,t,i)=>{typeof Q.emitWarning=="function"?Q.emitWarning(l,e,t,i):console.error(`[${t}] ${e}: ${l}`);},K=globalThis.AbortController,ae=globalThis.AbortSignal;if(typeof K>"u"){ae=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,r){this._onabort.push(r);}},K=class{constructor(){e();}signal=new ae;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let r of this.signal._onabort)r(i);this.signal.onabort?.(i);}}};let l=Q.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{l&&(l=false,he("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 Ee=l=>!le.has(l),F=l=>l&&l===Math.floor(l)&&l>0&&isFinite(l),fe=l=>F(l)?l<=Math.pow(2,8)?Uint8Array:l<=Math.pow(2,16)?Uint16Array:l<=Math.pow(2,32)?Uint32Array:l<=Number.MAX_SAFE_INTEGER?V:null:null,V=class extends Array{constructor(e){super(e),this.fill(0);}},Z=class l{heap;length;static#l=false;static create(e){let t=fe(e);if(!t)return [];l.#l=true;let i=new l(e,t);return l.#l=false,i}constructor(e,t){if(!l.#l)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0;}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},B=class l{#l;#u;#m;#x;#g;#T;#z;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#n;#y;#r;#i;#e;#h;#d;#a;#s;#b;#o;#S;#v;#c;#w;#H;#f;#M;static unsafeExposeInternals(e){return {starts:e.#v,ttls:e.#c,sizes:e.#S,keyMap:e.#r,keyList:e.#i,valList:e.#e,next:e.#h,prev:e.#d,get head(){return e.#a},get tail(){return e.#s},free:e.#b,isBackgroundFetch:t=>e.#t(t),backgroundFetch:(t,i,r,s)=>e.#F(t,i,r,s),moveToTail:t=>e.#C(t),indexes:t=>e.#_(t),rindexes:t=>e.#E(t),isStale:t=>e.#p(t)}}get max(){return this.#l}get maxSize(){return this.#u}get calculatedSize(){return this.#y}get size(){return this.#n}get fetchMethod(){return this.#T}get memoMethod(){return this.#z}get dispose(){return this.#m}get onInsert(){return this.#x}get disposeAfter(){return this.#g}constructor(e){let{max:t=0,ttl:i,ttlResolution:r=1,ttlAutopurge:s,updateAgeOnGet:h,updateAgeOnHas:c,allowStale:d,dispose:g,onInsert:_,disposeAfter:m,noDisposeOnSet:v,noUpdateTTL:G,maxSize:N=0,maxEntrySize:E=0,sizeCalculation:T,fetchMethod:S,memoMethod:H,noDeleteOnFetchRejection:C,noDeleteOnStaleGet:x,allowStaleOnFetchRejection:O,allowStaleOnFetchAbort:o,ignoreFetchAbort:a}=e;if(t!==0&&!F(t))throw new TypeError("max option must be a nonnegative integer");let n=t?fe(t):Array;if(!n)throw new Error("invalid max value: "+t);if(this.#l=t,this.#u=N,this.maxEntrySize=E||this.#u,this.sizeCalculation=T,this.sizeCalculation){if(!this.#u&&!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(H!==void 0&&typeof H!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#z=H,S!==void 0&&typeof S!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#T=S,this.#H=!!S,this.#r=new Map,this.#i=new Array(t).fill(void 0),this.#e=new Array(t).fill(void 0),this.#h=new n(t),this.#d=new n(t),this.#a=0,this.#s=0,this.#b=Z.create(t),this.#n=0,this.#y=0,typeof g=="function"&&(this.#m=g),typeof _=="function"&&(this.#x=_),typeof m=="function"?(this.#g=m,this.#o=[]):(this.#g=void 0,this.#o=void 0),this.#w=!!this.#m,this.#M=!!this.#x,this.#f=!!this.#g,this.noDisposeOnSet=!!v,this.noUpdateTTL=!!G,this.noDeleteOnFetchRejection=!!C,this.allowStaleOnFetchRejection=!!O,this.allowStaleOnFetchAbort=!!o,this.ignoreFetchAbort=!!a,this.maxEntrySize!==0){if(this.#u!==0&&!F(this.#u))throw new TypeError("maxSize must be a positive integer if specified");if(!F(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#W();}if(this.allowStale=!!d,this.noDeleteOnStaleGet=!!x,this.updateAgeOnGet=!!h,this.updateAgeOnHas=!!c,this.ttlResolution=F(r)||r===0?r:1,this.ttlAutopurge=!!s,this.ttl=i||0,this.ttl){if(!F(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#L();}if(this.#l===0&&this.ttl===0&&this.#u===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#l&&!this.#u){let f="LRU_CACHE_UNBOUNDED";Ee(f)&&(le.add(f),he("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",f,l));}}getRemainingTTL(e){return this.#r.has(e)?1/0:0}#L(){let e=new V(this.#l),t=new V(this.#l);this.#c=e,this.#v=t,this.#R=(s,h,c=k.now())=>{if(t[s]=h!==0?c:0,e[s]=h,h!==0&&this.ttlAutopurge){let d=setTimeout(()=>{this.#p(s)&&this.#G(this.#i[s],"expire");},h+1);d.unref&&d.unref();}},this.#A=s=>{t[s]=e[s]!==0?k.now():0;},this.#D=(s,h)=>{if(e[h]){let c=e[h],d=t[h];if(!c||!d)return;s.ttl=c,s.start=d,s.now=i||r();let g=s.now-d;s.remainingTTL=c-g;}};let i=0,r=()=>{let s=k.now();if(this.ttlResolution>0){i=s;let h=setTimeout(()=>i=0,this.ttlResolution);h.unref&&h.unref();}return s};this.getRemainingTTL=s=>{let h=this.#r.get(s);if(h===void 0)return 0;let c=e[h],d=t[h];if(!c||!d)return 1/0;let g=(i||r())-d;return c-g},this.#p=s=>{let h=t[s],c=e[s];return !!c&&!!h&&(i||r())-h>c};}#A=()=>{};#D=()=>{};#R=()=>{};#p=()=>false;#W(){let e=new V(this.#l);this.#y=0,this.#S=e,this.#O=t=>{this.#y-=e[t],e[t]=0;},this.#k=(t,i,r,s)=>{if(this.#t(i))return 0;if(!F(r))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(r=s(i,t),!F(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},this.#N=(t,i,r)=>{if(e[t]=i,this.#u){let s=this.#u-e[t];for(;this.#y>s;)this.#I(true);}this.#y+=e[t],r&&(r.entrySize=i,r.totalCalculatedSize=this.#y);};}#O=e=>{};#N=(e,t,i)=>{};#k=(e,t,i,r)=>{if(i||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#_({allowStale:e=this.allowStale}={}){if(this.#n)for(let t=this.#s;!(!this.#V(t)||((e||!this.#p(t))&&(yield t),t===this.#a));)t=this.#d[t];}*#E({allowStale:e=this.allowStale}={}){if(this.#n)for(let t=this.#a;!(!this.#V(t)||((e||!this.#p(t))&&(yield t),t===this.#s));)t=this.#h[t];}#V(e){return e!==void 0&&this.#r.get(this.#i[e])===e}*entries(){for(let e of this.#_())this.#e[e]!==void 0&&this.#i[e]!==void 0&&!this.#t(this.#e[e])&&(yield [this.#i[e],this.#e[e]]);}*rentries(){for(let e of this.#E())this.#e[e]!==void 0&&this.#i[e]!==void 0&&!this.#t(this.#e[e])&&(yield [this.#i[e],this.#e[e]]);}*keys(){for(let e of this.#_()){let t=this.#i[e];t!==void 0&&!this.#t(this.#e[e])&&(yield t);}}*rkeys(){for(let e of this.#E()){let t=this.#i[e];t!==void 0&&!this.#t(this.#e[e])&&(yield t);}}*values(){for(let e of this.#_())this.#e[e]!==void 0&&!this.#t(this.#e[e])&&(yield this.#e[e]);}*rvalues(){for(let e of this.#E())this.#e[e]!==void 0&&!this.#t(this.#e[e])&&(yield this.#e[e]);}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let i of this.#_()){let r=this.#e[i],s=this.#t(r)?r.__staleWhileFetching:r;if(s!==void 0&&e(s,this.#i[i],this))return this.get(this.#i[i],t)}}forEach(e,t=this){for(let i of this.#_()){let r=this.#e[i],s=this.#t(r)?r.__staleWhileFetching:r;s!==void 0&&e.call(t,s,this.#i[i],this);}}rforEach(e,t=this){for(let i of this.#E()){let r=this.#e[i],s=this.#t(r)?r.__staleWhileFetching:r;s!==void 0&&e.call(t,s,this.#i[i],this);}}purgeStale(){let e=false;for(let t of this.#E({allowStale:true}))this.#p(t)&&(this.#G(this.#i[t],"expire"),e=true);return e}info(e){let t=this.#r.get(e);if(t===void 0)return;let i=this.#e[t],r=this.#t(i)?i.__staleWhileFetching:i;if(r===void 0)return;let s={value:r};if(this.#c&&this.#v){let h=this.#c[t],c=this.#v[t];if(h&&c){let d=h-(k.now()-c);s.ttl=d,s.start=Date.now();}}return this.#S&&(s.size=this.#S[t]),s}dump(){let e=[];for(let t of this.#_({allowStale:true})){let i=this.#i[t],r=this.#e[t],s=this.#t(r)?r.__staleWhileFetching:r;if(s===void 0||i===void 0)continue;let h={value:s};if(this.#c&&this.#v){h.ttl=this.#c[t];let c=k.now()-this.#v[t];h.start=Math.floor(Date.now()-c);}this.#S&&(h.size=this.#S[t]),e.unshift([i,h]);}return e}load(e){this.clear();for(let[t,i]of e){if(i.start){let r=Date.now()-i.start;i.start=k.now()-r;}this.set(t,i.value,i);}}set(e,t,i={}){if(t===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:s,noDisposeOnSet:h=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:d}=i,{noUpdateTTL:g=this.noUpdateTTL}=i,_=this.#k(e,t,i.size||0,c);if(this.maxEntrySize&&_>this.maxEntrySize)return d&&(d.set="miss",d.maxEntrySizeExceeded=true),this.#G(e,"set"),this;let m=this.#n===0?void 0:this.#r.get(e);if(m===void 0)m=this.#n===0?this.#s:this.#b.length!==0?this.#b.pop():this.#n===this.#l?this.#I(false):this.#n,this.#i[m]=e,this.#e[m]=t,this.#r.set(e,m),this.#h[this.#s]=m,this.#d[m]=this.#s,this.#s=m,this.#n++,this.#N(m,_,d),d&&(d.set="add"),g=false,this.#M&&this.#x?.(t,e,"add");else {this.#C(m);let v=this.#e[m];if(t!==v){if(this.#H&&this.#t(v)){v.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:G}=v;G!==void 0&&!h&&(this.#w&&this.#m?.(G,e,"set"),this.#f&&this.#o?.push([G,e,"set"]));}else h||(this.#w&&this.#m?.(v,e,"set"),this.#f&&this.#o?.push([v,e,"set"]));if(this.#O(m),this.#N(m,_,d),this.#e[m]=t,d){d.set="replace";let G=v&&this.#t(v)?v.__staleWhileFetching:v;G!==void 0&&(d.oldValue=G);}}else d&&(d.set="update");this.#M&&this.onInsert?.(t,e,t===v?"update":"replace");}if(r!==0&&!this.#c&&this.#L(),this.#c&&(g||this.#R(m,r,s),d&&this.#D(d,m)),!h&&this.#f&&this.#o){let v=this.#o,G;for(;G=v?.shift();)this.#g?.(...G);}return this}pop(){try{for(;this.#n;){let e=this.#e[this.#a];if(this.#I(!0),this.#t(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#f&&this.#o){let e=this.#o,t;for(;t=e?.shift();)this.#g?.(...t);}}}#I(e){let t=this.#a,i=this.#i[t],r=this.#e[t];return this.#H&&this.#t(r)?r.__abortController.abort(new Error("evicted")):(this.#w||this.#f)&&(this.#w&&this.#m?.(r,i,"evict"),this.#f&&this.#o?.push([r,i,"evict"])),this.#O(t),e&&(this.#i[t]=void 0,this.#e[t]=void 0,this.#b.push(t)),this.#n===1?(this.#a=this.#s=0,this.#b.length=0):this.#a=this.#h[t],this.#r.delete(i),this.#n--,t}has(e,t={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:r}=t,s=this.#r.get(e);if(s!==void 0){let h=this.#e[s];if(this.#t(h)&&h.__staleWhileFetching===void 0)return false;if(this.#p(s))r&&(r.has="stale",this.#D(r,s));else return i&&this.#A(s),r&&(r.has="hit",this.#D(r,s)),true}else r&&(r.has="miss");return false}peek(e,t={}){let{allowStale:i=this.allowStale}=t,r=this.#r.get(e);if(r===void 0||!i&&this.#p(r))return;let s=this.#e[r];return this.#t(s)?s.__staleWhileFetching:s}#F(e,t,i,r){let s=t===void 0?void 0:this.#e[t];if(this.#t(s))return s;let h=new K,{signal:c}=i;c?.addEventListener("abort",()=>h.abort(c.reason),{signal:h.signal});let d={signal:h.signal,options:i,context:r},g=(E,T=false)=>{let{aborted:S}=h.signal,H=i.ignoreFetchAbort&&E!==void 0;if(i.status&&(S&&!T?(i.status.fetchAborted=true,i.status.fetchError=h.signal.reason,H&&(i.status.fetchAbortIgnored=true)):i.status.fetchResolved=true),S&&!H&&!T)return m(h.signal.reason);let C=G;return this.#e[t]===G&&(E===void 0?C.__staleWhileFetching?this.#e[t]=C.__staleWhileFetching:this.#G(e,"fetch"):(i.status&&(i.status.fetchUpdated=true),this.set(e,E,d.options))),E},_=E=>(i.status&&(i.status.fetchRejected=true,i.status.fetchError=E),m(E)),m=E=>{let{aborted:T}=h.signal,S=T&&i.allowStaleOnFetchAbort,H=S||i.allowStaleOnFetchRejection,C=H||i.noDeleteOnFetchRejection,x=G;if(this.#e[t]===G&&(!C||x.__staleWhileFetching===void 0?this.#G(e,"fetch"):S||(this.#e[t]=x.__staleWhileFetching)),H)return i.status&&x.__staleWhileFetching!==void 0&&(i.status.returnedStale=true),x.__staleWhileFetching;if(x.__returned===x)throw E},v=(E,T)=>{let S=this.#T?.(e,s,d);S&&S instanceof Promise&&S.then(H=>E(H===void 0?void 0:H),T),h.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(E(void 0),i.allowStaleOnFetchAbort&&(E=H=>g(H,true)));});};i.status&&(i.status.fetchDispatched=true);let G=new Promise(v).then(g,_),N=Object.assign(G,{__abortController:h,__staleWhileFetching:s,__returned:void 0});return t===void 0?(this.set(e,N,{...d.options,status:void 0}),t=this.#r.get(e)):this.#e[t]=N,N}#t(e){if(!this.#H)return false;let t=e;return !!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof K}async fetch(e,t={}){let{allowStale:i=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:h=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:d=0,sizeCalculation:g=this.sizeCalculation,noUpdateTTL:_=this.noUpdateTTL,noDeleteOnFetchRejection:m=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:v=this.allowStaleOnFetchRejection,ignoreFetchAbort:G=this.ignoreFetchAbort,allowStaleOnFetchAbort:N=this.allowStaleOnFetchAbort,context:E,forceRefresh:T=false,status:S,signal:H}=t;if(!this.#H)return S&&(S.fetch="get"),this.get(e,{allowStale:i,updateAgeOnGet:r,noDeleteOnStaleGet:s,status:S});let C={allowStale:i,updateAgeOnGet:r,noDeleteOnStaleGet:s,ttl:h,noDisposeOnSet:c,size:d,sizeCalculation:g,noUpdateTTL:_,noDeleteOnFetchRejection:m,allowStaleOnFetchRejection:v,allowStaleOnFetchAbort:N,ignoreFetchAbort:G,status:S,signal:H},x=this.#r.get(e);if(x===void 0){S&&(S.fetch="miss");let O=this.#F(e,x,C,E);return O.__returned=O}else {let O=this.#e[x];if(this.#t(O)){let u=i&&O.__staleWhileFetching!==void 0;return S&&(S.fetch="inflight",u&&(S.returnedStale=true)),u?O.__staleWhileFetching:O.__returned=O}let o=this.#p(x);if(!T&&!o)return S&&(S.fetch="hit"),this.#C(x),r&&this.#A(x),S&&this.#D(S,x),O;let a=this.#F(e,x,C,E),f=a.__staleWhileFetching!==void 0&&i;return S&&(S.fetch=o?"stale":"refresh",f&&o&&(S.returnedStale=true)),f?a.__staleWhileFetching:a.__returned=a}}async forceFetch(e,t={}){let i=await this.fetch(e,t);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(e,t={}){let i=this.#z;if(!i)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:s,...h}=t,c=this.get(e,h);if(!s&&c!==void 0)return c;let d=i(e,c,{options:h,context:r});return this.set(e,d,h),d}get(e,t={}){let{allowStale:i=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:h}=t,c=this.#r.get(e);if(c!==void 0){let d=this.#e[c],g=this.#t(d);return h&&this.#D(h,c),this.#p(c)?(h&&(h.get="stale"),g?(h&&i&&d.__staleWhileFetching!==void 0&&(h.returnedStale=true),i?d.__staleWhileFetching:void 0):(s||this.#G(e,"expire"),h&&i&&(h.returnedStale=true),i?d:void 0)):(h&&(h.get="hit"),g?d.__staleWhileFetching:(this.#C(c),r&&this.#A(c),d))}else h&&(h.get="miss");}#P(e,t){this.#d[t]=e,this.#h[e]=t;}#C(e){e!==this.#s&&(e===this.#a?this.#a=this.#h[e]:this.#P(this.#d[e],this.#h[e]),this.#P(this.#s,e),this.#s=e);}delete(e){return this.#G(e,"delete")}#G(e,t){let i=false;if(this.#n!==0){let r=this.#r.get(e);if(r!==void 0)if(i=true,this.#n===1)this.#j(t);else {this.#O(r);let s=this.#e[r];if(this.#t(s)?s.__abortController.abort(new Error("deleted")):(this.#w||this.#f)&&(this.#w&&this.#m?.(s,e,t),this.#f&&this.#o?.push([s,e,t])),this.#r.delete(e),this.#i[r]=void 0,this.#e[r]=void 0,r===this.#s)this.#s=this.#d[r];else if(r===this.#a)this.#a=this.#h[r];else {let h=this.#d[r];this.#h[h]=this.#h[r];let c=this.#h[r];this.#d[c]=this.#d[r];}this.#n--,this.#b.push(r);}}if(this.#f&&this.#o?.length){let r=this.#o,s;for(;s=r?.shift();)this.#g?.(...s);}return i}clear(){return this.#j("delete")}#j(e){for(let t of this.#E({allowStale:true})){let i=this.#e[t];if(this.#t(i))i.__abortController.abort(new Error("deleted"));else {let r=this.#i[t];this.#w&&this.#m?.(i,r,e),this.#f&&this.#o?.push([i,r,e]);}}if(this.#r.clear(),this.#e.fill(void 0),this.#i.fill(void 0),this.#c&&this.#v&&(this.#c.fill(0),this.#v.fill(0)),this.#S&&this.#S.fill(0),this.#a=0,this.#s=0,this.#b.length=0,this.#y=0,this.#n=0,this.#f&&this.#o){let t=this.#o,i;for(;i=t?.shift();)this.#g?.(...i);}}};var L=class{cache;map=new Map;constructor(e){this.cache=new B({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 t=this.map.delete(e);return t&&this.cache.delete(e),t}get forEach(){return this.map.forEach}get(e){let t=this.cache.get(e);return t||this.map.get(e)}has(e){return this.map.has(e)}set(e,t){return this.map.set(e,t),this.cache.set(e,t),this}get size(){return this.map.size}get entries(){return this.map.entries}keys(){return this.map.keys()}get values(){return this.map.values}};var p=class l{static _diffHistory=new L({cacheSize:5});static _stepsInfoHistory=new L({cacheSize:5});static _narrationHistory=new L({cacheSize:50});static stepLimitSaved=20;static goBackRunning=false;static _originalStepData=void 0;static get originalStepData(){return l._originalStepData?M(l._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){l._originalStepData=M(e);}};var W=class{get stepsInfoMap(){return p._stepsInfoHistory}get diffMap(){return p._diffHistory}get narrationMap(){return p._narrationHistory}get size(){return p._stepsInfoHistory.size}get lastKey(){return this.size===0?null:Math.max(...Array.from(this.keys()))}keys(){return p._stepsInfoHistory.keys()}get(e){let t=p._narrationHistory.get(e);if(!(t&&Object.keys(t).length===1&&t.stepIndex!==void 0))return t}delete(e){p._stepsInfoHistory.delete(e),p._diffHistory.delete(e),p._narrationHistory.delete(e);}internalRestoreOldGameState(e,t){if(e<=0||this.size==0)return t;let i=this.lastKey;if(typeof i!="number")return b.error("You can't go back, there is no step to go back"),t;let r=p._diffHistory.get(i);if(r)try{let s=oe(t,r);return I.stepCounter=i,this.delete(i),this.internalRestoreOldGameState(e-1,s)}catch(s){return b.error("Error applying diff",s),t}else return b.error("You can't go back, there is no step to go back"),t}async goBack(e,t=1){if(t<=0){b.warn("The parameter steps must be greater than 0");return}if(p._diffHistory.size<1){b.warn("You can't go back, there is no step to go back");return}if(p.goBackRunning){b.warn("Go back is already running");return}p.goBackRunning=true;try{let i=M(this.internalRestoreOldGameState(t,p.originalStepData));i?await I.restoreGameStepState(i,e):b.error("Error going back"),p.goBackRunning=!1;}catch(i){b.error("Error going back",i),p.goBackRunning=false;}}add(e,t={}){let i=p.originalStepData,{ignoreSameStep:r}=t,s=I.currentGameStepState;if(!r&&this.isSameStep(i,s))return;let h=this.lastKey;(async()=>{try{let d,g;if(typeof h=="number"&&(d=p._stepsInfoHistory.get(h),g=p._narrationHistory.get(h)),p._stepsInfoHistory.set(e.index,e),e.index!==0){let v=(0,ue.diff)(i,s);v?p._diffHistory.set(e.index,v):b.warn("It was not possible to create the difference between the two steps");}let _={},m=this.itemMapper({step:e},_);if(p._narrationHistory.set(e.index,m),d&&g&&typeof h=="number"){let v=this.itemMapper({..._,step:d},{});p._narrationHistory.set(h,v);}}catch(d){b.error("Error adding history step",d);}})(),p.originalStepData=s;}itemMapper(e,t){let{step:i,choiceIndexMade:r,inputValue:s,removeDialogue:h}=e,c=i.dialogue||i.dialoge;t&&i.isGlued&&(t.removeDialogue=true),h&&(c=void 0);let d=i.choices;if(t&&i.currentLabel&&i.choiceIndexMade!==void 0&&(t.choiceIndexMade=i.choiceIndexMade),i.inputValue&&t&&(t.inputValue=i.inputValue),c||d||s){let g=d?.map((_,m)=>{let v=false;return _.oneTime&&i.alreadyMadeChoices&&i.alreadyMadeChoices.includes(m)&&(v=true),{text:_.text,type:_.type,isResponse:false,hidden:v}});if(g){if(g.every(_=>_.hidden)){let _=g.find(m=>m.hidden===false);_&&(_.hidden=false);}r!==void 0&&(g[r].isResponse=true);}return {dialogue:c?{...c,character:c.character?I.getCharacter(c.character)||c.character:void 0}:void 0,playerMadeChoice:typeof r=="number",choices:g,stepIndex:i.index,inputValue:s}}return {stepIndex:i.index}}get narrativeHistory(){let e=[];return Array.from(this.keys()).sort((i,r)=>i-r).forEach(i=>{let r=this.get(i);r&&e.push(r);}),e}get currentLabelHistory(){let e=[],t=Array.from(this.keys()).sort((g,_)=>_-g);if(t.length===0)return e;let i=t[0];if(typeof i!="number")return e;let r=p._stepsInfoHistory.get(i);if(!r)return e;let s=r.currentLabel,h=r.index,c=r.labelStepIndex||-1,d=r.openedLabelsNumber||-1;return t.every(g=>{let _=this.get(g);if(_){let m=p._stepsInfoHistory.get(g);if(!m||!(m.currentLabel===s&&m.index<=h&&(m.labelStepIndex||-1)<=c&&(m.openedLabelsNumber||-1)===d))return false;e.push(_);}return h=g,true}),e.reverse()}removeNarrativeHistory(e){if(e){let t=Array.from(this.keys()).sort((i,r)=>i-r);t=t.slice(0,e),t.forEach(i=>{p._narrationHistory.delete(i),p._stepsInfoHistory.delete(i),p._diffHistory.delete(i);});}else p._stepsInfoHistory.clear(),p._diffHistory.clear(),p._narrationHistory.clear();}get canGoBack(){let e=this.lastKey;return typeof e!="number"?false:p._diffHistory.has(e)}blockGoBack(){I.currentStepsRunningNumber===0&&p._diffHistory.clear();}isSameStep(e,t){if(e.openedLabels.length===t.openedLabels.length)try{let i=JSON.stringify(e.openedLabels),r=JSON.stringify(t.openedLabels);if(i===r&&e.path===t.path&&e.labelIndex===t.labelIndex)return !0}catch(i){return b.error("Error comparing opened labels",i),true}return false}clear(){p._stepsInfoHistory.clear(),p._diffHistory.clear(),p._narrationHistory.clear(),p._originalStepData=void 0;}get stepLimitSaved(){return p.stepLimitSaved}set stepLimitSaved(e){p.stepLimitSaved=e;}export(){let e=Array.from(this.keys()).sort((i,r)=>i-r);e.length>this.stepLimitSaved&&(e=e.slice(e.length-this.stepLimitSaved));let t=[];return e.forEach(i=>{let r=p._stepsInfoHistory.get(i);if(r){let s=p._diffHistory.get(i);t.push({...r,diff:s});}}),{stepsHistory:M(t),originalStepData:M(p._originalStepData)}}restoreNarrativeHistory(){let e=Array.from(this.keys()).sort((i,r)=>i-r),t={};e.forEach(i=>{let r=p._stepsInfoHistory.get(i);if(r){let s={...t};t={};let h=this.itemMapper({step:r,choiceIndexMade:s.choiceIndexMade,inputValue:s.inputValue,removeDialogue:s.removeDialogue},t);h&&p._narrationHistory.set(i,h);}});}async restore(e){this.clear();try{e.hasOwnProperty("stepsHistory")?(e.stepsHistory.forEach(i=>{i.diff&&p._diffHistory.set(i.index,i.diff);let r={...i,diff:void 0};p._stepsInfoHistory.set(i.index,r);}),this.restoreNarrativeHistory()):b.warn("Could not import stepsHistory data, so will be ignored"),e.hasOwnProperty("originalStepData")?p._originalStepData=e.originalStepData:b.warn("Could not import originalStepData data, so will be ignored");}catch(t){b.error("Error importing data",t);}}};var Ze=new W;
1
+ var ce=Object.create;var re=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var me=Object.getOwnPropertyNames;var ge=Object.getPrototypeOf,ye=Object.prototype.hasOwnProperty;var be=(l,e)=>()=>(e||l((e={exports:{}}).exports,e),e.exports);var Se=(l,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of me(e))!ye.call(l,r)&&r!==t&&re(l,r,{get:()=>e[r],enumerable:!(i=pe(e,r))||i.enumerable});return l};var ve=(l,e,t)=>(t=l!=null?ce(ge(l)):{},Se(re(t,"default",{value:l,enumerable:true}),l));var se=be((X,ne)=>{(function(l,e){var t=e(l);if(typeof define=="function"&&define.amd)define("DeepDiff",function(){return t});else if(typeof X=="object"||typeof navigator=="object"&&navigator.product.match(/ReactNative/i))ne.exports=t;else {var i=l.DeepDiff;t.noConflict=function(){return l.DeepDiff===t&&(l.DeepDiff=i),t},l.DeepDiff=t;}})(X,function(l){var e=["N","E","A","D"];function t(o,a){o.super_=a,o.prototype=Object.create(a.prototype,{constructor:{value:o,enumerable:false,writable:true,configurable:true}});}function i(o,a){Object.defineProperty(this,"kind",{value:o,enumerable:true}),a&&a.length&&Object.defineProperty(this,"path",{value:a,enumerable:true});}function r(o,a,n){r.super_.call(this,"E",o),Object.defineProperty(this,"lhs",{value:a,enumerable:true}),Object.defineProperty(this,"rhs",{value:n,enumerable:true});}t(r,i);function s(o,a){s.super_.call(this,"N",o),Object.defineProperty(this,"rhs",{value:a,enumerable:true});}t(s,i);function h(o,a){h.super_.call(this,"D",o),Object.defineProperty(this,"lhs",{value:a,enumerable:true});}t(h,i);function c(o,a,n){c.super_.call(this,"A",o),Object.defineProperty(this,"index",{value:a,enumerable:true}),Object.defineProperty(this,"item",{value:n,enumerable:true});}t(c,i);function d(o,a,n){var f=o.slice((a)+1||o.length);return o.length=a<0?o.length+a:a,o.push.apply(o,f),o}function g(o){var a=typeof o;return a!=="object"?a:o===Math?"math":o===null?"null":Array.isArray(o)?"array":Object.prototype.toString.call(o)==="[object Date]"?"date":typeof o.toString=="function"&&/^\/.*\//.test(o.toString())?"regexp":"object"}function _(o){var a=0;if(o.length===0)return a;for(var n=0;n<o.length;n++){var f=o.charCodeAt(n);a=(a<<5)-a+f,a=a&a;}return a}function m(o){var a=0,n=g(o);if(n==="array"){o.forEach(function(R){a+=m(R);});var f="[type: array, hash: "+a+"]";return a+_(f)}if(n==="object"){for(var u in o)if(o.hasOwnProperty(u)){var w="[ type: object, key: "+u+", value hash: "+m(o[u])+"]";a+=_(w);}return a}var y="[ type: "+n+" ; value: "+o+"]";return a+_(y)}function v(o,a,n,f,u,w,y,R){n=n||[],u=u||[],y=y||[];var A=u.slice(0);if(typeof w<"u"&&w!==null){if(f){if(typeof f=="function"&&f(A,w))return;if(typeof f=="object"){if(f.prefilter&&f.prefilter(A,w))return;if(f.normalize){var $=f.normalize(A,w,o,a);$&&(o=$[0],a=$[1]);}}}A.push(w);}g(o)==="regexp"&&g(a)==="regexp"&&(o=o.toString(),a=a.toString());var Y=typeof o,de=typeof a,D,P,z,j,ee=Y!=="undefined"||y&&y.length>0&&y[y.length-1].lhs&&Object.getOwnPropertyDescriptor(y[y.length-1].lhs,w),te=de!=="undefined"||y&&y.length>0&&y[y.length-1].rhs&&Object.getOwnPropertyDescriptor(y[y.length-1].rhs,w);if(!ee&&te)n.push(new s(A,a));else if(!te&&ee)n.push(new h(A,o));else if(g(o)!==g(a))n.push(new r(A,o,a));else if(g(o)==="date"&&o-a!==0)n.push(new r(A,o,a));else if(Y==="object"&&o!==null&&a!==null){for(D=y.length-1;D>-1;--D)if(y[D].lhs===o){j=true;break}if(j)o!==a&&n.push(new r(A,o,a));else {if(y.push({lhs:o,rhs:a}),Array.isArray(o)){for(R&&(o.sort(function(J,q){return m(J)-m(q)}),a.sort(function(J,q){return m(J)-m(q)})),D=a.length-1,P=o.length-1;D>P;)n.push(new c(A,D,new s(void 0,a[D--])));for(;P>D;)n.push(new c(A,P,new h(void 0,o[P--])));for(;D>=0;--D)v(o[D],a[D],n,f,A,D,y,R);}else {var ie=Object.keys(o),U=Object.keys(a);for(D=0;D<ie.length;++D)z=ie[D],j=U.indexOf(z),j>=0?(v(o[z],a[z],n,f,A,z,y,R),U[j]=null):v(o[z],void 0,n,f,A,z,y,R);for(D=0;D<U.length;++D)z=U[D],z&&v(void 0,a[z],n,f,A,z,y,R);}y.length=y.length-1;}}else o!==a&&(Y==="number"&&isNaN(o)&&isNaN(a)||n.push(new r(A,o,a)));}function G(o,a,n,f,u){var w=[];if(v(o,a,w,f,null,null,null,u),n)for(var y=0;y<w.length;++y)n(w[y]);return w}function N(o,a,n,f,u,w,y){return v(o,a,n,f,u,w,y,true)}function E(o,a,n,f){var u=f?function(y){y&&f.push(y);}:void 0,w=G(o,a,u,n);return f||(w.length?w:void 0)}function T(o,a,n,f){var u=f?function(y){y&&f.push(y);}:void 0,w=G(o,a,u,n,true);return f||(w.length?w:void 0)}function S(o,a,n){if(n.path&&n.path.length){var f=o[a],u,w=n.path.length-1;for(u=0;u<w;u++)f=f[n.path[u]];switch(n.kind){case "A":S(f[n.path[u]],n.index,n.item);break;case "D":delete f[n.path[u]];break;case "E":case "N":f[n.path[u]]=n.rhs;break}}else switch(n.kind){case "A":S(o[a],n.index,n.item);break;case "D":o=d(o,a);break;case "E":case "N":o[a]=n.rhs;break}return o}function H(o,a,n){if(typeof n>"u"&&a&&~e.indexOf(a.kind)&&(n=a),o&&n&&n.kind){for(var f=o,u=-1,w=n.path?n.path.length-1:0;++u<w;)typeof f[n.path[u]]>"u"&&(f[n.path[u]]=typeof n.path[u+1]<"u"&&typeof n.path[u+1]=="number"?[]:{}),f=f[n.path[u]];switch(n.kind){case "A":n.path&&typeof f[n.path[u]]>"u"&&(f[n.path[u]]=[]),S(n.path?f[n.path[u]]:f,n.index,n.item);break;case "D":delete f[n.path[u]];break;case "E":case "N":f[n.path[u]]=n.rhs;break}}}function C(o,a,n){if(n.path&&n.path.length){var f=o[a],u,w=n.path.length-1;for(u=0;u<w;u++)f=f[n.path[u]];switch(n.kind){case "A":C(f[n.path[u]],n.index,n.item);break;case "D":f[n.path[u]]=n.lhs;break;case "E":f[n.path[u]]=n.lhs;break;case "N":delete f[n.path[u]];break}}else switch(n.kind){case "A":C(o[a],n.index,n.item);break;case "D":o[a]=n.lhs;break;case "E":o[a]=n.lhs;break;case "N":o=d(o,a);break}return o}function x(o,a,n){if(o&&a&&n&&n.kind){var f=o,u,w;for(w=n.path.length-1,u=0;u<w;u++)typeof f[n.path[u]]>"u"&&(f[n.path[u]]={}),f=f[n.path[u]];switch(n.kind){case "A":C(f[n.path[u]],n.index,n.item);break;case "D":f[n.path[u]]=n.lhs;break;case "E":f[n.path[u]]=n.lhs;break;case "N":delete f[n.path[u]];break}}}function O(o,a,n){if(o&&a){var f=function(u){(!n||n(o,a,u))&&H(o,a,u);};G(o,a,f);}}return Object.defineProperties(E,{diff:{value:E,enumerable:true},orderIndependentDiff:{value:T,enumerable:true},observableDiff:{value:G,enumerable:true},orderIndependentObservableDiff:{value:N,enumerable:true},orderIndepHash:{value:m,enumerable:true},applyDiff:{value:O,enumerable:true},applyChange:{value:H,enumerable:true},revertChange:{value:x,enumerable:true},isConflict:{value:function(){return typeof $conflict<"u"},enumerable:true}}),E.DeepDiff=E,l&&(l.DeepDiff=E),E});});var ue=ve(se());var b;(r=>(r.log=(s,...h)=>console.log(`[Pixi\u2019VN] ${s}`,...h),r.warn=(s,...h)=>console.warn(`[Pixi\u2019VN] ${s}`,...h),r.error=(s,...h)=>console.error(`[Pixi\u2019VN] ${s}`,...h),r.info=(s,...h)=>console.info(`[Pixi\u2019VN] ${s}`,...h)))(b||={});var I=class l{static init(e){l._getStepCounter=e.getStepCounter,l._setStepCounter=e.setStepCounter,l._getCurrentGameStepState=e.getCurrentGameStepState,l._restoreGameStepState=e.restoreGameStepState,l._getOpenedLabels=e.getOpenedLabels,e.onGoNextEnd&&(l._onGoNextEnd=e.onGoNextEnd),l._getVariable=e.getVariable,l._setVariable=e.setVariable,l._removeVariable=e.removeVariable,l._getFlag=e.getFlag,l._setFlag=e.setFlag,e.onLabelClosing&&(l._onLabelClosing=e.onLabelClosing),l._addHistoryItem=e.addHistoryItem,l._getCurrentStepsRunningNumber=e.getCurrentStepsRunningNumber,l._getCharacter=e.getCharacter;}static _getStepCounter=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static _setStepCounter=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get stepCounter(){return l._getStepCounter()}static set stepCounter(e){l._setStepCounter(e);}static _getCurrentGameStepState=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get currentGameStepState(){return l._getCurrentGameStepState()}static _restoreGameStepState=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get restoreGameStepState(){return l._restoreGameStepState}static _getOpenedLabels=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get openedLabels(){return l._getOpenedLabels()}static _onGoNextEnd=async()=>{};static get onGoNextEnd(){return l._onGoNextEnd}static _getVariable=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get getVariable(){return l._getVariable}static _setVariable=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get setVariable(){return l._setVariable}static _removeVariable=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get removeVariable(){return l._removeVariable}static _getFlag=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get getFlag(){return l._getFlag}static _setFlag=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get setFlag(){return l._setFlag}static _onLabelClosing=()=>{};static get onLabelClosing(){return l._onLabelClosing}static _addHistoryItem=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get addHistoryItem(){return l._addHistoryItem}static _getCurrentStepsRunningNumber=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")};static get currentStepsRunningNumber(){return l._getCurrentStepsRunningNumber()}static _getCharacter=()=>{throw b.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get getCharacter(){return l._getCharacter}static onEnd;static onError};function M(l){try{if(typeof l>"u")return l;let e=JSON.stringify(l);return JSON.parse(e)}catch(e){throw b.error("Error creating exportable element",l,e),new Error("[Pixi\u2019VN] Error creating exportable element")}}function oe(l,e){let t=M(l);return e.length>1&&"type"in e[0]&&(e=e.reverse()),e.forEach(i=>{"type"in i?we(t,i):_e(t,i);}),t}function we(l,e){let t=l;e.path&&e.path.length>0?e.path.forEach((i,r)=>{if(e.path&&r===e.path.length-1)switch(e.type){case "CHANGE":case "REMOVE":t[i]=e.oldValue;break;case "CREATE":Array.isArray(t)&&typeof i=="number"?t.splice(i,1):delete t[i];break}else t=t[i];}):b.warn("No path found, skipping diff",e);}function _e(l,e){let t=l;e.path&&e.path.length>0?e.path.forEach((i,r)=>{if(e.path&&r===e.path.length-1){if(e.kind==="E"||e.kind==="D")t[i]=e.lhs;else if(e.kind==="N")Number.isInteger(i)?Array.isArray(t)&&t.splice(i,1):typeof i=="string"&&delete t[i];else if(e.kind==="A"){let s=e.index;e.item.kind==="N"?t[i].splice(s,1):e.item.kind==="E"||e.item.kind==="D"?t[i][s]=e.item.lhs:e.item.kind==="A"?b.warn("Nested array found, skipping diff",e):b.warn("No array found, skipping diff",e);}}else t=t[i];}):b.warn("No path found, skipping diff",e);}var k=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,le=new Set,Q=typeof process=="object"&&process?process:{},he=(l,e,t,i)=>{typeof Q.emitWarning=="function"?Q.emitWarning(l,e,t,i):console.error(`[${t}] ${e}: ${l}`);},K=globalThis.AbortController,ae=globalThis.AbortSignal;if(typeof K>"u"){ae=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,r){this._onabort.push(r);}},K=class{constructor(){e();}signal=new ae;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let r of this.signal._onabort)r(i);this.signal.onabort?.(i);}}};let l=Q.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{l&&(l=false,he("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 Ee=l=>!le.has(l),F=l=>l&&l===Math.floor(l)&&l>0&&isFinite(l),fe=l=>F(l)?l<=Math.pow(2,8)?Uint8Array:l<=Math.pow(2,16)?Uint16Array:l<=Math.pow(2,32)?Uint32Array:l<=Number.MAX_SAFE_INTEGER?V:null:null,V=class extends Array{constructor(e){super(e),this.fill(0);}},Z=class l{heap;length;static#l=false;static create(e){let t=fe(e);if(!t)return [];l.#l=true;let i=new l(e,t);return l.#l=false,i}constructor(e,t){if(!l.#l)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0;}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},B=class l{#l;#u;#m;#x;#g;#T;#z;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#n;#y;#r;#i;#e;#h;#d;#a;#s;#b;#o;#S;#v;#c;#w;#H;#f;#M;static unsafeExposeInternals(e){return {starts:e.#v,ttls:e.#c,sizes:e.#S,keyMap:e.#r,keyList:e.#i,valList:e.#e,next:e.#h,prev:e.#d,get head(){return e.#a},get tail(){return e.#s},free:e.#b,isBackgroundFetch:t=>e.#t(t),backgroundFetch:(t,i,r,s)=>e.#F(t,i,r,s),moveToTail:t=>e.#C(t),indexes:t=>e.#_(t),rindexes:t=>e.#E(t),isStale:t=>e.#p(t)}}get max(){return this.#l}get maxSize(){return this.#u}get calculatedSize(){return this.#y}get size(){return this.#n}get fetchMethod(){return this.#T}get memoMethod(){return this.#z}get dispose(){return this.#m}get onInsert(){return this.#x}get disposeAfter(){return this.#g}constructor(e){let{max:t=0,ttl:i,ttlResolution:r=1,ttlAutopurge:s,updateAgeOnGet:h,updateAgeOnHas:c,allowStale:d,dispose:g,onInsert:_,disposeAfter:m,noDisposeOnSet:v,noUpdateTTL:G,maxSize:N=0,maxEntrySize:E=0,sizeCalculation:T,fetchMethod:S,memoMethod:H,noDeleteOnFetchRejection:C,noDeleteOnStaleGet:x,allowStaleOnFetchRejection:O,allowStaleOnFetchAbort:o,ignoreFetchAbort:a}=e;if(t!==0&&!F(t))throw new TypeError("max option must be a nonnegative integer");let n=t?fe(t):Array;if(!n)throw new Error("invalid max value: "+t);if(this.#l=t,this.#u=N,this.maxEntrySize=E||this.#u,this.sizeCalculation=T,this.sizeCalculation){if(!this.#u&&!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(H!==void 0&&typeof H!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#z=H,S!==void 0&&typeof S!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#T=S,this.#H=!!S,this.#r=new Map,this.#i=new Array(t).fill(void 0),this.#e=new Array(t).fill(void 0),this.#h=new n(t),this.#d=new n(t),this.#a=0,this.#s=0,this.#b=Z.create(t),this.#n=0,this.#y=0,typeof g=="function"&&(this.#m=g),typeof _=="function"&&(this.#x=_),typeof m=="function"?(this.#g=m,this.#o=[]):(this.#g=void 0,this.#o=void 0),this.#w=!!this.#m,this.#M=!!this.#x,this.#f=!!this.#g,this.noDisposeOnSet=!!v,this.noUpdateTTL=!!G,this.noDeleteOnFetchRejection=!!C,this.allowStaleOnFetchRejection=!!O,this.allowStaleOnFetchAbort=!!o,this.ignoreFetchAbort=!!a,this.maxEntrySize!==0){if(this.#u!==0&&!F(this.#u))throw new TypeError("maxSize must be a positive integer if specified");if(!F(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#W();}if(this.allowStale=!!d,this.noDeleteOnStaleGet=!!x,this.updateAgeOnGet=!!h,this.updateAgeOnHas=!!c,this.ttlResolution=F(r)||r===0?r:1,this.ttlAutopurge=!!s,this.ttl=i||0,this.ttl){if(!F(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#L();}if(this.#l===0&&this.ttl===0&&this.#u===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#l&&!this.#u){let f="LRU_CACHE_UNBOUNDED";Ee(f)&&(le.add(f),he("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",f,l));}}getRemainingTTL(e){return this.#r.has(e)?1/0:0}#L(){let e=new V(this.#l),t=new V(this.#l);this.#c=e,this.#v=t,this.#R=(s,h,c=k.now())=>{if(t[s]=h!==0?c:0,e[s]=h,h!==0&&this.ttlAutopurge){let d=setTimeout(()=>{this.#p(s)&&this.#G(this.#i[s],"expire");},h+1);d.unref&&d.unref();}},this.#A=s=>{t[s]=e[s]!==0?k.now():0;},this.#D=(s,h)=>{if(e[h]){let c=e[h],d=t[h];if(!c||!d)return;s.ttl=c,s.start=d,s.now=i||r();let g=s.now-d;s.remainingTTL=c-g;}};let i=0,r=()=>{let s=k.now();if(this.ttlResolution>0){i=s;let h=setTimeout(()=>i=0,this.ttlResolution);h.unref&&h.unref();}return s};this.getRemainingTTL=s=>{let h=this.#r.get(s);if(h===void 0)return 0;let c=e[h],d=t[h];if(!c||!d)return 1/0;let g=(i||r())-d;return c-g},this.#p=s=>{let h=t[s],c=e[s];return !!c&&!!h&&(i||r())-h>c};}#A=()=>{};#D=()=>{};#R=()=>{};#p=()=>false;#W(){let e=new V(this.#l);this.#y=0,this.#S=e,this.#O=t=>{this.#y-=e[t],e[t]=0;},this.#k=(t,i,r,s)=>{if(this.#t(i))return 0;if(!F(r))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(r=s(i,t),!F(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},this.#N=(t,i,r)=>{if(e[t]=i,this.#u){let s=this.#u-e[t];for(;this.#y>s;)this.#I(true);}this.#y+=e[t],r&&(r.entrySize=i,r.totalCalculatedSize=this.#y);};}#O=e=>{};#N=(e,t,i)=>{};#k=(e,t,i,r)=>{if(i||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#_({allowStale:e=this.allowStale}={}){if(this.#n)for(let t=this.#s;!(!this.#V(t)||((e||!this.#p(t))&&(yield t),t===this.#a));)t=this.#d[t];}*#E({allowStale:e=this.allowStale}={}){if(this.#n)for(let t=this.#a;!(!this.#V(t)||((e||!this.#p(t))&&(yield t),t===this.#s));)t=this.#h[t];}#V(e){return e!==void 0&&this.#r.get(this.#i[e])===e}*entries(){for(let e of this.#_())this.#e[e]!==void 0&&this.#i[e]!==void 0&&!this.#t(this.#e[e])&&(yield [this.#i[e],this.#e[e]]);}*rentries(){for(let e of this.#E())this.#e[e]!==void 0&&this.#i[e]!==void 0&&!this.#t(this.#e[e])&&(yield [this.#i[e],this.#e[e]]);}*keys(){for(let e of this.#_()){let t=this.#i[e];t!==void 0&&!this.#t(this.#e[e])&&(yield t);}}*rkeys(){for(let e of this.#E()){let t=this.#i[e];t!==void 0&&!this.#t(this.#e[e])&&(yield t);}}*values(){for(let e of this.#_())this.#e[e]!==void 0&&!this.#t(this.#e[e])&&(yield this.#e[e]);}*rvalues(){for(let e of this.#E())this.#e[e]!==void 0&&!this.#t(this.#e[e])&&(yield this.#e[e]);}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let i of this.#_()){let r=this.#e[i],s=this.#t(r)?r.__staleWhileFetching:r;if(s!==void 0&&e(s,this.#i[i],this))return this.get(this.#i[i],t)}}forEach(e,t=this){for(let i of this.#_()){let r=this.#e[i],s=this.#t(r)?r.__staleWhileFetching:r;s!==void 0&&e.call(t,s,this.#i[i],this);}}rforEach(e,t=this){for(let i of this.#E()){let r=this.#e[i],s=this.#t(r)?r.__staleWhileFetching:r;s!==void 0&&e.call(t,s,this.#i[i],this);}}purgeStale(){let e=false;for(let t of this.#E({allowStale:true}))this.#p(t)&&(this.#G(this.#i[t],"expire"),e=true);return e}info(e){let t=this.#r.get(e);if(t===void 0)return;let i=this.#e[t],r=this.#t(i)?i.__staleWhileFetching:i;if(r===void 0)return;let s={value:r};if(this.#c&&this.#v){let h=this.#c[t],c=this.#v[t];if(h&&c){let d=h-(k.now()-c);s.ttl=d,s.start=Date.now();}}return this.#S&&(s.size=this.#S[t]),s}dump(){let e=[];for(let t of this.#_({allowStale:true})){let i=this.#i[t],r=this.#e[t],s=this.#t(r)?r.__staleWhileFetching:r;if(s===void 0||i===void 0)continue;let h={value:s};if(this.#c&&this.#v){h.ttl=this.#c[t];let c=k.now()-this.#v[t];h.start=Math.floor(Date.now()-c);}this.#S&&(h.size=this.#S[t]),e.unshift([i,h]);}return e}load(e){this.clear();for(let[t,i]of e){if(i.start){let r=Date.now()-i.start;i.start=k.now()-r;}this.set(t,i.value,i);}}set(e,t,i={}){if(t===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:s,noDisposeOnSet:h=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:d}=i,{noUpdateTTL:g=this.noUpdateTTL}=i,_=this.#k(e,t,i.size||0,c);if(this.maxEntrySize&&_>this.maxEntrySize)return d&&(d.set="miss",d.maxEntrySizeExceeded=true),this.#G(e,"set"),this;let m=this.#n===0?void 0:this.#r.get(e);if(m===void 0)m=this.#n===0?this.#s:this.#b.length!==0?this.#b.pop():this.#n===this.#l?this.#I(false):this.#n,this.#i[m]=e,this.#e[m]=t,this.#r.set(e,m),this.#h[this.#s]=m,this.#d[m]=this.#s,this.#s=m,this.#n++,this.#N(m,_,d),d&&(d.set="add"),g=false,this.#M&&this.#x?.(t,e,"add");else {this.#C(m);let v=this.#e[m];if(t!==v){if(this.#H&&this.#t(v)){v.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:G}=v;G!==void 0&&!h&&(this.#w&&this.#m?.(G,e,"set"),this.#f&&this.#o?.push([G,e,"set"]));}else h||(this.#w&&this.#m?.(v,e,"set"),this.#f&&this.#o?.push([v,e,"set"]));if(this.#O(m),this.#N(m,_,d),this.#e[m]=t,d){d.set="replace";let G=v&&this.#t(v)?v.__staleWhileFetching:v;G!==void 0&&(d.oldValue=G);}}else d&&(d.set="update");this.#M&&this.onInsert?.(t,e,t===v?"update":"replace");}if(r!==0&&!this.#c&&this.#L(),this.#c&&(g||this.#R(m,r,s),d&&this.#D(d,m)),!h&&this.#f&&this.#o){let v=this.#o,G;for(;G=v?.shift();)this.#g?.(...G);}return this}pop(){try{for(;this.#n;){let e=this.#e[this.#a];if(this.#I(!0),this.#t(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#f&&this.#o){let e=this.#o,t;for(;t=e?.shift();)this.#g?.(...t);}}}#I(e){let t=this.#a,i=this.#i[t],r=this.#e[t];return this.#H&&this.#t(r)?r.__abortController.abort(new Error("evicted")):(this.#w||this.#f)&&(this.#w&&this.#m?.(r,i,"evict"),this.#f&&this.#o?.push([r,i,"evict"])),this.#O(t),e&&(this.#i[t]=void 0,this.#e[t]=void 0,this.#b.push(t)),this.#n===1?(this.#a=this.#s=0,this.#b.length=0):this.#a=this.#h[t],this.#r.delete(i),this.#n--,t}has(e,t={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:r}=t,s=this.#r.get(e);if(s!==void 0){let h=this.#e[s];if(this.#t(h)&&h.__staleWhileFetching===void 0)return false;if(this.#p(s))r&&(r.has="stale",this.#D(r,s));else return i&&this.#A(s),r&&(r.has="hit",this.#D(r,s)),true}else r&&(r.has="miss");return false}peek(e,t={}){let{allowStale:i=this.allowStale}=t,r=this.#r.get(e);if(r===void 0||!i&&this.#p(r))return;let s=this.#e[r];return this.#t(s)?s.__staleWhileFetching:s}#F(e,t,i,r){let s=t===void 0?void 0:this.#e[t];if(this.#t(s))return s;let h=new K,{signal:c}=i;c?.addEventListener("abort",()=>h.abort(c.reason),{signal:h.signal});let d={signal:h.signal,options:i,context:r},g=(E,T=false)=>{let{aborted:S}=h.signal,H=i.ignoreFetchAbort&&E!==void 0;if(i.status&&(S&&!T?(i.status.fetchAborted=true,i.status.fetchError=h.signal.reason,H&&(i.status.fetchAbortIgnored=true)):i.status.fetchResolved=true),S&&!H&&!T)return m(h.signal.reason);let C=G;return this.#e[t]===G&&(E===void 0?C.__staleWhileFetching?this.#e[t]=C.__staleWhileFetching:this.#G(e,"fetch"):(i.status&&(i.status.fetchUpdated=true),this.set(e,E,d.options))),E},_=E=>(i.status&&(i.status.fetchRejected=true,i.status.fetchError=E),m(E)),m=E=>{let{aborted:T}=h.signal,S=T&&i.allowStaleOnFetchAbort,H=S||i.allowStaleOnFetchRejection,C=H||i.noDeleteOnFetchRejection,x=G;if(this.#e[t]===G&&(!C||x.__staleWhileFetching===void 0?this.#G(e,"fetch"):S||(this.#e[t]=x.__staleWhileFetching)),H)return i.status&&x.__staleWhileFetching!==void 0&&(i.status.returnedStale=true),x.__staleWhileFetching;if(x.__returned===x)throw E},v=(E,T)=>{let S=this.#T?.(e,s,d);S&&S instanceof Promise&&S.then(H=>E(H===void 0?void 0:H),T),h.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(E(void 0),i.allowStaleOnFetchAbort&&(E=H=>g(H,true)));});};i.status&&(i.status.fetchDispatched=true);let G=new Promise(v).then(g,_),N=Object.assign(G,{__abortController:h,__staleWhileFetching:s,__returned:void 0});return t===void 0?(this.set(e,N,{...d.options,status:void 0}),t=this.#r.get(e)):this.#e[t]=N,N}#t(e){if(!this.#H)return false;let t=e;return !!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof K}async fetch(e,t={}){let{allowStale:i=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:h=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:d=0,sizeCalculation:g=this.sizeCalculation,noUpdateTTL:_=this.noUpdateTTL,noDeleteOnFetchRejection:m=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:v=this.allowStaleOnFetchRejection,ignoreFetchAbort:G=this.ignoreFetchAbort,allowStaleOnFetchAbort:N=this.allowStaleOnFetchAbort,context:E,forceRefresh:T=false,status:S,signal:H}=t;if(!this.#H)return S&&(S.fetch="get"),this.get(e,{allowStale:i,updateAgeOnGet:r,noDeleteOnStaleGet:s,status:S});let C={allowStale:i,updateAgeOnGet:r,noDeleteOnStaleGet:s,ttl:h,noDisposeOnSet:c,size:d,sizeCalculation:g,noUpdateTTL:_,noDeleteOnFetchRejection:m,allowStaleOnFetchRejection:v,allowStaleOnFetchAbort:N,ignoreFetchAbort:G,status:S,signal:H},x=this.#r.get(e);if(x===void 0){S&&(S.fetch="miss");let O=this.#F(e,x,C,E);return O.__returned=O}else {let O=this.#e[x];if(this.#t(O)){let u=i&&O.__staleWhileFetching!==void 0;return S&&(S.fetch="inflight",u&&(S.returnedStale=true)),u?O.__staleWhileFetching:O.__returned=O}let o=this.#p(x);if(!T&&!o)return S&&(S.fetch="hit"),this.#C(x),r&&this.#A(x),S&&this.#D(S,x),O;let a=this.#F(e,x,C,E),f=a.__staleWhileFetching!==void 0&&i;return S&&(S.fetch=o?"stale":"refresh",f&&o&&(S.returnedStale=true)),f?a.__staleWhileFetching:a.__returned=a}}async forceFetch(e,t={}){let i=await this.fetch(e,t);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(e,t={}){let i=this.#z;if(!i)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:s,...h}=t,c=this.get(e,h);if(!s&&c!==void 0)return c;let d=i(e,c,{options:h,context:r});return this.set(e,d,h),d}get(e,t={}){let{allowStale:i=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:h}=t,c=this.#r.get(e);if(c!==void 0){let d=this.#e[c],g=this.#t(d);return h&&this.#D(h,c),this.#p(c)?(h&&(h.get="stale"),g?(h&&i&&d.__staleWhileFetching!==void 0&&(h.returnedStale=true),i?d.__staleWhileFetching:void 0):(s||this.#G(e,"expire"),h&&i&&(h.returnedStale=true),i?d:void 0)):(h&&(h.get="hit"),g?d.__staleWhileFetching:(this.#C(c),r&&this.#A(c),d))}else h&&(h.get="miss");}#P(e,t){this.#d[t]=e,this.#h[e]=t;}#C(e){e!==this.#s&&(e===this.#a?this.#a=this.#h[e]:this.#P(this.#d[e],this.#h[e]),this.#P(this.#s,e),this.#s=e);}delete(e){return this.#G(e,"delete")}#G(e,t){let i=false;if(this.#n!==0){let r=this.#r.get(e);if(r!==void 0)if(i=true,this.#n===1)this.#j(t);else {this.#O(r);let s=this.#e[r];if(this.#t(s)?s.__abortController.abort(new Error("deleted")):(this.#w||this.#f)&&(this.#w&&this.#m?.(s,e,t),this.#f&&this.#o?.push([s,e,t])),this.#r.delete(e),this.#i[r]=void 0,this.#e[r]=void 0,r===this.#s)this.#s=this.#d[r];else if(r===this.#a)this.#a=this.#h[r];else {let h=this.#d[r];this.#h[h]=this.#h[r];let c=this.#h[r];this.#d[c]=this.#d[r];}this.#n--,this.#b.push(r);}}if(this.#f&&this.#o?.length){let r=this.#o,s;for(;s=r?.shift();)this.#g?.(...s);}return i}clear(){return this.#j("delete")}#j(e){for(let t of this.#E({allowStale:true})){let i=this.#e[t];if(this.#t(i))i.__abortController.abort(new Error("deleted"));else {let r=this.#i[t];this.#w&&this.#m?.(i,r,e),this.#f&&this.#o?.push([i,r,e]);}}if(this.#r.clear(),this.#e.fill(void 0),this.#i.fill(void 0),this.#c&&this.#v&&(this.#c.fill(0),this.#v.fill(0)),this.#S&&this.#S.fill(0),this.#a=0,this.#s=0,this.#b.length=0,this.#y=0,this.#n=0,this.#f&&this.#o){let t=this.#o,i;for(;i=t?.shift();)this.#g?.(...i);}}};var L=class{cache;map=new Map;constructor(e){this.cache=new B({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 t=this.map.delete(e);return t&&this.cache.delete(e),t}get forEach(){return this.map.forEach}get(e){let t=this.cache.get(e);return t||this.map.get(e)}has(e){return this.map.has(e)}set(e,t){return this.map.set(e,t),this.cache.set(e,t),this}get size(){return this.map.size}get entries(){return this.map.entries}keys(){return this.map.keys()}get values(){return this.map.values}};var p=class l{static _diffHistory=new L({cacheSize:5});static _stepsInfoHistory=new L({cacheSize:5});static _narrationHistory=new L({cacheSize:50});static stepLimitSaved=20;static goBackRunning=false;static _originalStepData=void 0;static get originalStepData(){return l._originalStepData?M(l._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){l._originalStepData=M(e);}};var W=class{get stepsInfoMap(){return p._stepsInfoHistory}get diffMap(){return p._diffHistory}get narrationMap(){return p._narrationHistory}get size(){return p._stepsInfoHistory.size}get lastKey(){return this.size===0?null:Math.max(...Array.from(this.keys()))}keys(){return p._stepsInfoHistory.keys()}get(e){let t=p._narrationHistory.get(e);if(!(t&&Object.keys(t).length===1&&t.stepIndex!==void 0))return t}delete(e){p._stepsInfoHistory.delete(e),p._diffHistory.delete(e),p._narrationHistory.delete(e);}internalRestoreOldGameState(e,t){if(e<=0||this.size==0)return t;let i=this.lastKey;if(typeof i!="number")return b.error("You can't go back, there is no step to go back"),t;let r=p._diffHistory.get(i);if(r)try{let s=oe(t,r);return I.stepCounter=i,this.delete(i),this.internalRestoreOldGameState(e-1,s)}catch(s){return b.error("Error applying diff",s),t}else return b.error("You can't go back, there is no step to go back"),t}async goBack(e,t=1){if(t<=0){b.warn("The parameter steps must be greater than 0");return}if(p._diffHistory.size<1){b.warn("You can't go back, there is no step to go back");return}if(p.goBackRunning){b.warn("Go back is already running");return}p.goBackRunning=true;try{let i=M(this.internalRestoreOldGameState(t,p.originalStepData));i?await I.restoreGameStepState(i,e):b.error("Error going back"),p.goBackRunning=!1;}catch(i){b.error("Error going back",i),p.goBackRunning=false;}}add(e,t={}){let i=p.originalStepData,{ignoreSameStep:r}=t,s=I.currentGameStepState;if(!r&&this.isSameStep(i,s))return;let h=this.lastKey;(async()=>{try{let d,g;if(typeof h=="number"&&(d=p._stepsInfoHistory.get(h),g=p._narrationHistory.get(h)),p._stepsInfoHistory.set(e.index,e),e.index!==0){let v=(0,ue.diff)(i,s);v?p._diffHistory.set(e.index,v):b.warn("It was not possible to create the difference between the two steps");}let _={},m=this.itemMapper({step:e},_);if(p._narrationHistory.set(e.index,m),d&&g&&typeof h=="number"){let v=this.itemMapper({..._,step:d},{});p._narrationHistory.set(h,v);}}catch(d){b.error("Error adding history step",d);}})(),p.originalStepData=s;}itemMapper(e,t){let{step:i,choiceIndexMade:r,inputValue:s,removeDialogue:h}=e,c=i.dialogue||i.dialoge;t&&i.isGlued&&(t.removeDialogue=true),h&&(c=void 0);let d=i.choices;if(t&&i.currentLabel&&i.choiceIndexMade!==void 0&&(t.choiceIndexMade=i.choiceIndexMade),i.inputValue&&t&&(t.inputValue=i.inputValue),c||d||s){let g=d?.map((_,m)=>{let v=false;return _.oneTime&&i.alreadyMadeChoices&&i.alreadyMadeChoices.includes(m)&&(v=true),{text:_.text,type:_.type,isResponse:false,hidden:v}});if(g){if(g.every(_=>_.hidden)){let _=g.find(m=>m.hidden===false);_&&(_.hidden=false);}r!==void 0&&(g[r].isResponse=true);}return {dialogue:c?{...c,character:c.character?I.getCharacter(c.character)||c.character:void 0}:void 0,playerMadeChoice:typeof r=="number",choices:g,stepIndex:i.index,inputValue:s}}return {stepIndex:i.index}}get narrativeHistory(){let e=[];return Array.from(this.keys()).sort((i,r)=>i-r).forEach(i=>{let r=this.get(i);r&&e.push(r);}),e}get currentLabelHistory(){let e=[],t=Array.from(this.keys()).sort((g,_)=>_-g);if(t.length===0)return e;let i=t[0];if(typeof i!="number")return e;let r=p._stepsInfoHistory.get(i);if(!r)return e;let s=r.currentLabel,h=r.index,c=r.labelStepIndex||-1,d=r.openedLabelsNumber||-1;return t.every(g=>{let _=this.get(g);if(_){let m=p._stepsInfoHistory.get(g);if(!m||!(m.currentLabel===s&&m.index<=h&&(m.labelStepIndex||-1)<=c&&(m.openedLabelsNumber||-1)===d))return true;if(e.push(_),m.labelStepIndex===0)return false}return h=g,true}),e.reverse()}removeNarrativeHistory(e){if(e){let t=Array.from(this.keys()).sort((i,r)=>i-r);t=t.slice(0,e),t.forEach(i=>{p._narrationHistory.delete(i),p._stepsInfoHistory.delete(i),p._diffHistory.delete(i);});}else p._stepsInfoHistory.clear(),p._diffHistory.clear(),p._narrationHistory.clear();}get canGoBack(){let e=this.lastKey;return typeof e!="number"?false:p._diffHistory.has(e)}blockGoBack(){I.currentStepsRunningNumber===0&&p._diffHistory.clear();}isSameStep(e,t){if(e.openedLabels.length===t.openedLabels.length)try{let i=JSON.stringify(e.openedLabels),r=JSON.stringify(t.openedLabels);if(i===r&&e.path===t.path&&e.labelIndex===t.labelIndex)return !0}catch(i){return b.error("Error comparing opened labels",i),true}return false}clear(){p._stepsInfoHistory.clear(),p._diffHistory.clear(),p._narrationHistory.clear(),p._originalStepData=void 0;}get stepLimitSaved(){return p.stepLimitSaved}set stepLimitSaved(e){p.stepLimitSaved=e;}export(){let e=Array.from(this.keys()).sort((i,r)=>i-r);e.length>this.stepLimitSaved&&(e=e.slice(e.length-this.stepLimitSaved));let t=[];return e.forEach(i=>{let r=p._stepsInfoHistory.get(i);if(r){let s=p._diffHistory.get(i);t.push({...r,diff:s});}}),{stepsHistory:M(t),originalStepData:M(p._originalStepData)}}restoreNarrativeHistory(){let e=Array.from(this.keys()).sort((i,r)=>i-r),t={};e.forEach(i=>{let r=p._stepsInfoHistory.get(i);if(r){let s={...t};t={};let h=this.itemMapper({step:r,choiceIndexMade:s.choiceIndexMade,inputValue:s.inputValue,removeDialogue:s.removeDialogue},t);h&&p._narrationHistory.set(i,h);}});}async restore(e){this.clear();try{e.hasOwnProperty("stepsHistory")?(e.stepsHistory.forEach(i=>{i.diff&&p._diffHistory.set(i.index,i.diff);let r={...i,diff:void 0};p._stepsInfoHistory.set(i.index,r);}),this.restoreNarrativeHistory()):b.warn("Could not import stepsHistory data, so will be ignored"),e.hasOwnProperty("originalStepData")?p._originalStepData=e.originalStepData:b.warn("Could not import originalStepData data, so will be ignored");}catch(t){b.error("Error importing data",t);}}};var Ze=new W;
2
2
  export{p as HistoryManagerStatic,Ze as stepHistory};