@drincs/pixi-vn-ink 0.9.13 → 0.9.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-PAM5OWE4.mjs → chunk-BRCTEC4A.mjs} +1 -1
- package/dist/{chunk-7VVH5MSQ.mjs → chunk-NG6ODEEE.mjs} +27 -25
- package/dist/index.cjs +27 -25
- package/dist/index.mjs +1 -1
- package/dist/vite-listener.cjs +27 -25
- package/dist/vite-listener.mjs +1 -1
- package/dist/vite.cjs +23 -21
- package/dist/vite.mjs +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a,c,b,e,d,f}from'./chunk-7VVH5MSQ.mjs';import {RegisteredLabels,narration,LabelAbstract,NarrationManagerStatic}from'@drincs/pixi-vn/narration';import {storage,SYSTEM_RESERVED_STORAGE_KEYS}from'@drincs/pixi-vn/storage';import {canvas,VideoSprite,showVideo,ZoomTicker,RotateTicker,MoveTicker,FadeAlphaTicker,sound,Assets,narration as narration$1,ImageSprite,showImage,ImageContainer,showImageContainer,shakeEffect,pushOut,zoomOut,moveOut,removeWithDissolve,removeWithFade,pushIn,zoomIn,moveIn,showWithDissolve,showWithFade}from'@drincs/pixi-vn';import {RegisteredCharacters}from'@drincs/pixi-vn/characters';var st=Object.defineProperty,lt=(t,e,i)=>e in t?st(t,e,{enumerable:true,configurable:true,writable:true,value:i}):t[e]=i,ue=(t,e,i)=>lt(t,typeof e!="symbol"?e+"":e,i),te=class P{static t(e){return Array.isArray(e)?e.map(i=>P.translate(`${i}`)):P.translate(`${e}`)}static set beforeToTranslate(e){P._beforeToTranslate=e;}static set translate(e){P._translate=e;}static get translate(){return e=>{let i=e;return P._beforeToTranslate&&(i=P._beforeToTranslate(i)),i=P._translate(i),P._afterToTranslate&&(i=P._afterToTranslate(i)),i}}static set afterToTranslate(e){P._afterToTranslate=e;}static addKey(e,i,r){let n=r.defaultValue||"empty_string";typeof i=="string"&&(i=[i]),Array.isArray(i)&&i.forEach(o=>{e[o]===void 0&&(n==="empty_string"?e[o]="":n==="copy_key"&&(P._beforeToTranslate?e[o]=P._beforeToTranslate(o):e[o]=o));});}static getConditionalsThenElse(e,i=[]){if(typeof e=="object"&&e&&"type"in e)if(e.type==="ifelse")e.then&&P.getConditionalsThenElse(e.then,i),e.else&&P.getConditionalsThenElse(e.else,i);else if(e.type==="stepswitch"){if(e.elements)if(Array.isArray(e.elements))e.elements.forEach(r=>{P.getConditionalsThenElse(r,i);});else if(e.elements.type==="ifelse"){let r=[];P.getConditionalsThenElse(e.elements,r),r.forEach(n=>{i.push(...n);});}else if(e.elements.type==="stepswitch"){let r=[];P.getConditionalsThenElse(e.elements,r),r.forEach(n=>{i.push(...n);});}else P.getConditionalsThenElse(e.elements,i);}else e.type==="resulttocombine"?(e.firstItem&&P.getConditionalsThenElse(e.firstItem,i),e.secondConditionalItem&&e.secondConditionalItem.forEach(r=>{P.getConditionalsThenElse(r,i);})):i.push(e);else e&&i.push(e);return i}static generateJsonTranslation(e,i={},r={}){let{defaultValue:n="copy_key"}=r;return e.forEach(o=>{if(o.choices){let p=[];Array.isArray(o.choices)?p=[o.choices]:p=P.getConditionalsThenElse(o.choices),p.forEach(g=>g.forEach(c=>{if("type"in c){let l=[];c.type==="ifelse"||c.type==="stepswitch"?P.getConditionalsThenElse(c,l):l=[c],l.map(s=>P.getConditionalsThenElse(s.text)).forEach(s=>{Array.isArray(s)&&s.forEach(d=>{Array.isArray(d)?d.forEach(f=>{typeof f=="string"?P.addKey(i,f,{defaultValue:n}):P.getConditionalsThenElse(f).forEach(y=>{Array.isArray(y)?y.forEach(T=>{typeof T=="string"&&P.addKey(i,T,{defaultValue:n});}):typeof y=="string"&&P.addKey(i,y,{defaultValue:n});});}):typeof d=="string"&&P.addKey(i,d,{defaultValue:n});});});}}));}if(o.dialogue){let p=[];Array.isArray(o.dialogue)?p=[o.dialogue]:p=P.getConditionalsThenElse(o.dialogue),p.forEach(g=>{if(typeof g=="string")P.addKey(i,g,{defaultValue:n});else if("text"in g){let c=P.getConditionalsThenElse(g.text);typeof c=="string"&&(c=[c]),c.forEach(l=>{typeof l=="string"?P.addKey(i,l,{defaultValue:n}):P.getConditionalsThenElse(l).forEach(s=>{typeof s=="string"?P.addKey(i,s,{defaultValue:n}):Array.isArray(s)&&s.forEach(d=>{typeof d=="string"?P.addKey(i,d,{defaultValue:n}):P.getConditionalsThenElse(d).forEach(f=>{typeof f=="string"&&P.addKey(i,f,{defaultValue:n});});});});});}});}o.conditionalStep&&P.getConditionalsThenElse(o.conditionalStep).forEach(p=>{Array.isArray(p)?P.generateJsonTranslation(p,i,r):P.generateJsonTranslation([p],i,r);});}),i}};ue(te,"_beforeToTranslate"),ue(te,"_translate",t=>t),ue(te,"_afterToTranslate");var pt=te,J=pt;var ct=Object.defineProperty,ut=(t,e,i)=>e in t?ct(t,e,{enumerable:true,configurable:true,writable:true,value:i}):t[e]=i,_=(t,e,i)=>ut(t,typeof e!="symbol"?e+"":e,i),k;(t=>(t.log=(e,...i)=>console.log(`[Pixi\u2019VN Json] ${e}`,...i),t.warn=(e,...i)=>console.warn(`[Pixi\u2019VN Json] ${e}`,...i),t.error=(e,...i)=>console.error(`[Pixi\u2019VN Json] ${e}`,...i),t.info=(e,...i)=>console.info(`[Pixi\u2019VN Json] ${e}`,...i)))(k||(k={}));var L=class w{static init(e){w._loadAssets=e.loadAssets,w._soundOperation=e.soundOperation,w._imageOperation=e.imageOperation,w._videoOperation=e.videoOperation,w._imageContainerOperation=e.imageContainerOperation,w._canvasElementOperation=e.canvasElementOperation,w._setStorageValue=e.setStorageValue,w._narrationOperation=e.narrationOperation,w._tickerOperation=e.tickerOperation,w._effectOperation=e.effectOperation,w._animateOperation=e.animateOperation,w._getLogichValue=e.getLogichValue,w._getConditionalStep=e.getConditionalStep;}static get loadAssets(){return w._loadAssets}static get soundOperation(){return w._soundOperation}static get imageOperation(){return w._imageOperation}static get videoOperation(){return w._videoOperation}static get imageContainerOperation(){return w._imageContainerOperation}static get canvasElementOperation(){return w._canvasElementOperation}static get setStorageValue(){return w._setStorageValue}static get narrationOperation(){return w._narrationOperation}static get tickerOperation(){return w._tickerOperation}static get effectOperation(){return w._effectOperation}static get animateOperation(){return w._animateOperation}static get getLogichValue(){return w._getLogichValue}static get getConditionalStep(){return w._getConditionalStep}};_(L,"_loadAssets",()=>{throw k.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),_(L,"_soundOperation",()=>{throw k.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),_(L,"_imageOperation",()=>{throw k.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),_(L,"_videoOperation",()=>{throw k.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),_(L,"_imageContainerOperation",()=>{throw k.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),_(L,"_canvasElementOperation",()=>{throw k.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),_(L,"_setStorageValue",()=>{throw k.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),_(L,"_narrationOperation",()=>{throw k.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),_(L,"_tickerOperation",()=>{throw k.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),_(L,"_effectOperation",()=>{throw k.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),_(L,"_animateOperation",()=>{throw k.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),_(L,"_getLogichValue",()=>{throw k.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),_(L,"_getConditionalStep",()=>{throw k.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")});var A=L;var dt=Object.create,ge=Object.defineProperty,ht=Object.getOwnPropertyDescriptor,yt=Object.getOwnPropertyNames,mt=Object.getPrototypeOf,Tt=Object.prototype.hasOwnProperty,bt=(t,e,i)=>e in t?ge(t,e,{enumerable:true,configurable:true,writable:true,value:i}):t[e]=i,Le=(t=>typeof a<"u"?a:typeof Proxy<"u"?new Proxy(t,{get:(e,i)=>(typeof a<"u"?a:e)[i]}):t)(function(t){if(typeof a<"u")return a.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')}),je=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),xt=(t,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of yt(e))!Tt.call(t,n)&&n!==i&&ge(t,n,{get:()=>e[n],enumerable:!(r=ht(e,n))||r.enumerable});return t},vt=(t,e,i)=>(i=t!=null?dt(mt(t)):{},xt(ge(i,"default",{value:t,enumerable:true}),t)),fe=(t,e,i)=>bt(t,typeof e!="symbol"?e+"":e,i),St=je((t,e)=>{(function(i,r){typeof t=="object"?e.exports=t=r():typeof define=="function"&&define.amd?define([],r):i.CryptoJS=r();})(t,function(){var i=i||(function(r,n){var o;if(typeof window<"u"&&window.crypto&&(o=window.crypto),typeof self<"u"&&self.crypto&&(o=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(o=globalThis.crypto),!o&&typeof window<"u"&&window.msCrypto&&(o=window.msCrypto),!o&&typeof global<"u"&&global.crypto&&(o=global.crypto),!o&&typeof Le=="function")try{o=Le("crypto");}catch{}var p=function(){if(o){if(typeof o.getRandomValues=="function")try{return o.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof o.randomBytes=="function")try{return o.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},g=Object.create||(function(){function u(){}return function(a){var x;return u.prototype=a,x=new u,u.prototype=null,x}})(),c={},l=c.lib={},s=l.Base=(function(){return {extend:function(u){var a=g(this);return u&&a.mixIn(u),(!a.hasOwnProperty("init")||this.init===a.init)&&(a.init=function(){a.$super.init.apply(this,arguments);}),a.init.prototype=a,a.$super=this,a},create:function(){var u=this.extend();return u.init.apply(u,arguments),u},init:function(){},mixIn:function(u){for(var a in u)u.hasOwnProperty(a)&&(this[a]=u[a]);u.hasOwnProperty("toString")&&(this.toString=u.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),d=l.WordArray=s.extend({init:function(u,a){u=this.words=u||[],a!=n?this.sigBytes=a:this.sigBytes=u.length*4;},toString:function(u){return (u||y).stringify(this)},concat:function(u){var a=this.words,x=u.words,h=this.sigBytes,v=u.sigBytes;if(this.clamp(),h%4)for(var N=0;N<v;N++){var pe=x[N>>>2]>>>24-N%4*8&255;a[h+N>>>2]|=pe<<24-(h+N)%4*8;}else for(var I=0;I<v;I+=4)a[h+I>>>2]=x[I>>>2];return this.sigBytes+=v,this},clamp:function(){var u=this.words,a=this.sigBytes;u[a>>>2]&=4294967295<<32-a%4*8,u.length=r.ceil(a/4);},clone:function(){var u=s.clone.call(this);return u.words=this.words.slice(0),u},random:function(u){for(var a=[],x=0;x<u;x+=4)a.push(p());return new d.init(a,u)}}),f=c.enc={},y=f.Hex={stringify:function(u){for(var a=u.words,x=u.sigBytes,h=[],v=0;v<x;v++){var N=a[v>>>2]>>>24-v%4*8&255;h.push((N>>>4).toString(16)),h.push((N&15).toString(16));}return h.join("")},parse:function(u){for(var a=u.length,x=[],h=0;h<a;h+=2)x[h>>>3]|=parseInt(u.substr(h,2),16)<<24-h%8*4;return new d.init(x,a/2)}},T=f.Latin1={stringify:function(u){for(var a=u.words,x=u.sigBytes,h=[],v=0;v<x;v++){var N=a[v>>>2]>>>24-v%4*8&255;h.push(String.fromCharCode(N));}return h.join("")},parse:function(u){for(var a=u.length,x=[],h=0;h<a;h++)x[h>>>2]|=(u.charCodeAt(h)&255)<<24-h%4*8;return new d.init(x,a)}},b=f.Utf8={stringify:function(u){try{return decodeURIComponent(escape(T.stringify(u)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(u){return T.parse(unescape(encodeURIComponent(u)))}},m=l.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new d.init,this._nDataBytes=0;},_append:function(u){typeof u=="string"&&(u=b.parse(u)),this._data.concat(u),this._nDataBytes+=u.sigBytes;},_process:function(u){var a,x=this._data,h=x.words,v=x.sigBytes,N=this.blockSize,pe=N*4,I=v/pe;u?I=r.ceil(I):I=r.max((I|0)-this._minBufferSize,0);var ee=I*N,Ne=r.min(ee*4,v);if(ee){for(var ce=0;ce<ee;ce+=N)this._doProcessBlock(h,ce);a=h.splice(0,ee),x.sigBytes-=Ne;}return new d.init(a,Ne)},clone:function(){var u=s.clone.call(this);return u._data=this._data.clone(),u},_minBufferSize:0});l.Hasher=m.extend({cfg:s.extend(),init:function(u){this.cfg=this.cfg.extend(u),this.reset();},reset:function(){m.reset.call(this),this._doReset();},update:function(u){return this._append(u),this._process(),this},finalize:function(u){u&&this._append(u);var a=this._doFinalize();return a},blockSize:16,_createHelper:function(u){return function(a,x){return new u.init(x).finalize(a)}},_createHmacHelper:function(u){return function(a,x){return new V.HMAC.init(u,x).finalize(a)}}});var V=c.algo={};return c})(Math);return i});}),Pt=je((t,e)=>{(function(i,r){typeof t=="object"?e.exports=t=r(St()):typeof define=="function"&&define.amd?define(["./core"],r):r(i.CryptoJS);})(t,function(i){return (function(){var r=i,n=r.lib,o=n.WordArray,p=n.Hasher,g=r.algo,c=[],l=g.SHA1=p.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(s,d){for(var f=this._hash.words,y=f[0],T=f[1],b=f[2],m=f[3],V=f[4],u=0;u<80;u++){if(u<16)c[u]=s[d+u]|0;else {var a=c[u-3]^c[u-8]^c[u-14]^c[u-16];c[u]=a<<1|a>>>31;}var x=(y<<5|y>>>27)+V+c[u];u<20?x+=(T&b|~T&m)+1518500249:u<40?x+=(T^b^m)+1859775393:u<60?x+=(T&b|T&m|b&m)-1894007588:x+=(T^b^m)-899497514,V=m,m=b,b=T<<30|T>>>2,T=y,y=x;}f[0]=f[0]+y|0,f[1]=f[1]+T|0,f[2]=f[2]+b|0,f[3]=f[3]+m|0,f[4]=f[4]+V|0;},_doFinalize:function(){var s=this._data,d=s.words,f=this._nDataBytes*8,y=s.sigBytes*8;return d[y>>>5]|=128<<24-y%32,d[(y+64>>>9<<4)+14]=Math.floor(f/4294967296),d[(y+64>>>9<<4)+15]=f,s.sigBytes=d.length*4,this._process(),this._hash},clone:function(){var s=p.clone.call(this);return s._hash=this._hash.clone(),s}});r.SHA1=p._createHelper(l),r.HmacSHA1=p._createHmacHelper(l);})(),i.SHA1});}),G;(t=>(t.log=(e,...i)=>console.log(`[Pixi\u2019VN Json] ${e}`,...i),t.warn=(e,...i)=>console.warn(`[Pixi\u2019VN Json] ${e}`,...i),t.error=(e,...i)=>console.error(`[Pixi\u2019VN Json] ${e}`,...i),t.info=(e,...i)=>console.info(`[Pixi\u2019VN Json] ${e}`,...i)))(G||(G={}));async function de(t,e={}){let{operationStringConvert:i,skipEmptyDialogs:r}=e;if(!Array.isArray(t))if(typeof t=="object"||typeof t=="string")t=[t];else {G.error("Error parsing imported Pixi'VN JSON: data is not an object");return}let n=t.map(async p=>{if(typeof p=="string")try{p=JSON.parse(p);}catch(g){G.error("Error parsing imported Pixi'VN JSON",g),p={};}return p}),o=(await Promise.all(n)).map(async p=>{let g=[];if(p.initialOperations){let c={};[...storage.storage.keys()].forEach((l,s)=>{c[l]=storage.storage.get(l);}),storage.startingStorage=c;}if(p.labels){let c=p.labels;for(let l in c)try{let s=c[l],d=new Ot(l,s,void 0,e);RegisteredLabels.add(d);}catch(s){G.error(`Error creating JSON label ${l}`,s);}}return Promise.all(g)});await Promise.all(o);}var Vt=vt(Pt()),_e="___param___";function At(t){try{if(typeof t>"u")return t;let e=JSON.stringify(t);return JSON.parse(e)}catch(e){throw G.error("Error creating exportable element",t,e),new Error("[Pixi\u2019VN] Error creating exportable element")}}async function De(t,e){let i=A.getLogichValue(t);if(i)switch(i.type){case "sound":A.soundOperation(i);break;case "assets":case "bundle":await A.loadAssets(i);break;case "image":await A.imageOperation(i);break;case "video":await A.videoOperation(i);break;case "imagecontainer":await A.imageContainerOperation(i);break;case "canvaselement":await A.canvasElementOperation(i);break;case "value":A.setStorageValue(i);break;case "operationtoconvert":if(e){let r="";i.values.forEach(o=>{if(typeof o=="string")r+=o;else {let p=A.getLogichValue(o);r+=`${p}`;}});let n=await e(r);n&&await De(n,e);}break;case "input":case "dialogue":A.narrationOperation(i);break;case "fade":case "move":case "rotate":case "zoom":A.tickerOperation(i);break;case "shake":await A.effectOperation(i);break;case "animate":case "animate-sequence":A.animateOperation(i);break}}var Ot=class extends LabelAbstract{constructor(t,e,i,r={}){i||(i={}),i.onLoadingLabel=async()=>{for(let n of e){let o;if(typeof n=="function"?o=n():o=n,o=A.getConditionalStep(o),o.operations){let p=o.operations.map(g=>A.loadAssets(g));await Promise.all(p);}}},super(t,i),fe(this,"_steps"),fe(this,"operationStringConvert"),fe(this,"skipEmptyDialogs",false),this._steps=e,this.operationStringConvert=r.operationStringConvert,this.skipEmptyDialogs=r.skipEmptyDialogs||false;}get steps(){return this._steps.map(t=>this.stepConverter(t))}get stepCount(){return this._steps.length}getStepById(t){if(t<0||t>=this._steps.length)return;let e=this._steps[t];return this.stepConverter(e)}getStepSha(t){if(t<0||t>=this.steps.length)return;let e=this._steps[t];return (0, Vt.default)(e.toString().toLocaleLowerCase()).toString()}getDialogueText(t){let e="";if(Array.isArray(t)){let i=[];t.forEach(r=>{if(typeof r=="string")i.push(r);else if(r&&typeof r=="object"){let n=A.getLogichValue(r);n?(n&&!Array.isArray(n)&&typeof n=="object"&&(n=A.getLogichValue(n)||""),Array.isArray(n)?i=i.concat(n):i.push(`${n}`)):i.push(`${r}`);}}),e=i;}else {let i=A.getLogichValue(t)||"";i&&!Array.isArray(i)&&typeof i=="object"&&(i=A.getLogichValue(i)||""),e=i;}return `${e}`}getDialogue(t){if(t==null)return;let e=A.getLogichValue(t);return e==null?"":typeof e=="object"&&"character"in e&&"text"in e?{character:e.character,text:J.t(this.getDialogueText(e.text))}:J.t(this.getDialogueText(e))}getChoices(t){return A.getLogichValue(t)?.map(e=>A.getLogichValue(e)).filter(e=>e!==void 0)}stepConverter(t){return async e=>{let i=typeof t=="function"?t():t;i=At(i),i=A.getConditionalStep(i);let r=this.operationStringConvert?f=>this.operationStringConvert(f,i,e):void 0,{operations:n=[]}=i;for(let f of n)await De(f,r);let{labelToOpen:o=[]}=i,p=this.getChoices(i.choices),g=A.getLogichValue(i.glueEnabled),c=this.getDialogue(i.dialogue),l=[];Array.isArray(o)||(o=[o]),o.forEach(f=>{let y=A.getLogichValue(f);y&&l.push(y);});let s=A.getLogichValue(i.goNextStep),d=A.getLogichValue(i.end);if(p){let f=p.map(y=>{let T="";if(Array.isArray(y.text)){let b=[];y.text.forEach(m=>{if(typeof m=="string")b.push(J.t(m));else if(m&&typeof m=="object"){let V=A.getLogichValue(m);V&&!Array.isArray(V)&&typeof V=="object"&&(V=A.getLogichValue(V)||""),V&&(Array.isArray(V)?b=b.concat(J.t(V)):b.push(J.t(V)));}}),T=b;}else typeof y.text=="string"&&(T=J.t(y.text));return {label:y.label,text:T,props:y.props,type:y.type,oneTime:y.oneTime,onlyHaveNoChoice:y.onlyHaveNoChoice,autoSelect:y.autoSelect}});narration.choiceMenuOptions=f;}else narration.choiceMenuOptions=void 0;c!==void 0&&(narration.dialogue=c,this.skipEmptyDialogs&&typeof c=="string"&&(c===""||RegExp(/^\s+$/).test(c))&&(s=true)),g?storage.setFlag(SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,true):g===false&&storage.setFlag(SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,false);for(let f of l){let y=f.label;typeof y=="object"&&(y=A.getLogichValue(y)||"");let T=f.params?.map(b=>A.getLogichValue(b));e={...e,...f.props},f.type==="jump"?(narration.openedLabels.length>0&&narration.closeCurrentLabel(),storage.setTempVariable(`${_e}${narration.openedLabels.length}`,T),await narration.callLabel(y,e)):(storage.setTempVariable(`${_e}${narration.openedLabels.length}`,T),await narration.callLabel(y,e));}d==="game_end"?(narration.closeAllLabels(),await narration.goNext(e,{runNow:true})):d==="label_end"&&narration.closeCurrentLabel(),s&&await narration.goNext(e,{runNow:true});}}};var ye="___param___";async function Yt(t){let e=A.getLogichValue(t);if(e)switch(e.type){case "assets":switch(e.operationType){case "load":await Assets.load(e.aliases);break;case "lazyload":Assets.backgroundLoad(e.aliases);break}break;case "bundle":switch(e.operationType){case "load":await Assets.loadBundle(e.aliases);break;case "lazyload":Assets.backgroundLoadBundle(e.aliases);break}break}}var R;(t=>(t.log=(e,...i)=>console.log(`[Pixi\u2019VN Json] ${e}`,...i),t.warn=(e,...i)=>console.warn(`[Pixi\u2019VN Json] ${e}`,...i),t.error=(e,...i)=>console.error(`[Pixi\u2019VN Json] ${e}`,...i),t.info=(e,...i)=>console.info(`[Pixi\u2019VN Json] ${e}`,...i)))(R||(R={}));async function me(t,e,i){switch(i.type){case "fade":await showWithFade(e.alias,t,i.props,i.priority);break;case "dissolve":await showWithDissolve(e.alias,t,i.props,i.priority);break;case "movein":case "moveout":await moveIn(e.alias,t,i.props,i.priority);break;case "zoomin":case "zoomout":await zoomIn(e.alias,t,i.props,i.priority);break;case "pushin":case "pushout":await pushIn(e.alias,t,i.props,i.priority);break}}function re(t){if(t.transition)switch(t.transition.type){case "fade":removeWithFade(t.alias,t.transition.props,t.transition.priority);break;case "dissolve":removeWithDissolve(t.alias,t.transition.props,t.transition.priority);break;case "movein":case "moveout":moveOut(t.alias,t.transition.props,t.transition.priority);break;case "zoomin":case "zoomout":zoomOut(t.alias,t.transition.props,t.transition.priority);break;case "pushin":case "pushout":pushOut(t.alias,t.transition.props,t.transition.priority);break}else canvas.remove(t.alias);}async function qt(t){switch(t.operationType){case "show":if(t.transition){let i=new ImageSprite(t.props,t.url||t.alias);await me(i,t,t.transition);}else await showImage(t.alias,t.url,t.props);break;case "edit":let e=canvas.find(t.alias);e?t.props&&await e.setMemory({...e.memory,...t.props}):R.error(`Image with alias ${t.alias} not found.`);break;case "remove":re(t);break}}async function Qt(t){switch(t.operationType){case "show":if(t.transition){let n=new VideoSprite(t.props,t.url||t.alias);await me(n,t,t.transition);}else await showVideo(t.alias,t.url,t.props);break;case "edit":let e=canvas.find(t.alias);e?t.props&&await e.setMemory({...e.memory,...t.props}):R.error(`Video with alias ${t.alias} not found.`);break;case "remove":re(t);break;case "pause":let i=canvas.find(t.alias);i?i.paused=true:R.error(`Video with alias ${t.alias} not found.`);break;case "resume":let r=canvas.find(t.alias);r?r.paused=false:R.error(`Video with alias ${t.alias} not found.`);break}}async function Xt(t){switch(t.operationType){case "show":if(t.transition){let i=new ImageContainer(t.props,t.urls);await me(i,t,t.transition);}else await showImageContainer(t.alias,t.urls,t.props);break;case "edit":let e=canvas.find(t.alias);e?t.props&&await e.setMemory({...e.memory,...t.props}):R.error(`ImageContainer with alias ${t.alias} not found.`);break;case "remove":re(t);break}}async function Kt(t){switch(t.operationType){case "edit":try{let e=canvas.find(t.alias);e?t.props&&(e.memory={...e.memory,...t.props}):R.error(`Canvas Element with alias ${t.alias} not found.`);}catch(e){R.error(`There was an error while trying to edit the canvas element with alias ${t.alias}.`,e);}break;case "remove":re(t);break}}function Zt(t){switch(t.type){case "fade":let e=new FadeAlphaTicker(t.props,t.duration,t.priority);canvas.addTicker(t.alias,e);break;case "move":let i=new MoveTicker(t.props,t.duration,t.priority);canvas.addTicker(t.alias,i);break;case "rotate":let r=new RotateTicker(t.props,t.duration,t.priority);canvas.addTicker(t.alias,r);break;case "zoom":let n=new ZoomTicker(t.props,t.duration,t.priority);canvas.addTicker(t.alias,n);break}}async function ei(t){switch(t.type){case "shake":await shakeEffect(t.alias,t.props,t.priority);break}}function ti(t){switch(t.type){case "animate":canvas.animate(t.alias,t.keyframes,t.options,t.priority);break;case "animate-sequence":canvas.animate(t.alias,t.sequence,t.options,t.priority);break}}function ii(t){switch(t.type){case "input":narration$1.requestInput({type:t.valueType},t.defaultValue);break;case "dialogue":narration$1.dialogue=void 0;break}}function ni(t){switch(t.operationType){case "play":sound.play(t.alias,t.props);break;case "stop":sound.stop(t.alias);break;case "pause":sound.pause(t.alias);break;case "resume":sound.resume(t.alias);break;case "volume":sound.volume(t.alias,t.value);break}}function ri(t){try{if(typeof t>"u")return t;let e=JSON.stringify(t);return JSON.parse(e)}catch(e){throw R.error("Error creating exportable element",t,e),new Error("[Pixi\u2019VN] Error creating exportable element")}}function oi(t){let e=E(t.value),i;switch(e&&typeof e=="object"&&"type"in e?i=E(e):i=e,t.storageType){case "flagStorage":storage.setFlag(t.key,t.value);break;case "storage":storage.setVariable(t.key,i);break;case "tempstorage":storage.setTempVariable(t.key,i);break;case "params":let r=storage.getVariable(`${ye}${narration.openedLabels.length-1}`)||[];r&&r.length-1>=t.key&&(r[t.key]=i),storage.setTempVariable(`${ye}${narration.openedLabels.length-1}`,r);break}}function E(t){let e=ui(t);if(e&&typeof e=="object"&&"type"in e)switch(e.type){case "value":return si(e);case "arithmetic":case "arithmeticsingle":return ai(e);case "compare":case "valueCondition":case "union":return li(e)}return e}function ai(t){let e=E(t.leftValue);switch(t.type){case "arithmetic":let i=E(t.rightValue);switch(t.operator){case "*":return e*i;case "/":return e/i;case "+":return e+i;case "-":return e-i;case "%":return e%i;case "POW":return Math.pow(e,i);case "RANDOM":return narration.getRandomNumber(e,i)}case "arithmeticsingle":switch(t.operator){case "INT":return parseInt(e);case "FLOOR":return Math.floor(e);case "FLOAT":return parseFloat(e)}break}}function si(t){if(t&&typeof t=="object"&&"type"in t&&t.type==="value"&&t.storageOperationType==="get")switch(t.storageType){case "storage":case "tempstorage":return storage.getVariable(t.key);case "flagStorage":return storage.getFlag(t.key);case "label":return narration.getTimesLabelOpened(t.label);case "choice":return narration.getTimesChoiceMade(t.index);case "logic":return E(t.operation);case "params":let e=storage.getVariable(`${ye}${narration.openedLabels.length-1}`)||[];if(e&&e.length>t.key)return e[t.key];R.warn("getValue params not found");return}return t}function li(t){if(!t)return false;if(typeof t!="object"||!("type"in t))return !!t;switch(t.type){case "compare":let e=E(t.leftValue),i=E(t.rightValue);switch(t.operator){case "==":return e===i;case "!=":return e!==i;case "<":return e<i;case "<=":return e<=i;case ">":return e>i;case ">=":return e>=i;case "CONTAINS":return e.toString().includes(i.toString())}break;case "valueCondition":return !!E(t.value);case "union":return pi(t)}return !!t}function pi(t){if(t.unionType==="not")return !E(t.condition);let e=t.unionType==="and";for(let i=0;i<t.conditions.length;i++)if(e=E(t.conditions[i])||false,t.unionType==="and"){if(!e)return false}else if(e)return true;return e}function ci(t,e){return Math.floor(Math.random()*(e-t+1)+t)}function ui(t){if(Array.isArray(t)||!t)return t;if(t&&typeof t=="object"&&"type"in t)switch(t.type){case "resulttocombine":return fi(t);case "ifelse":return E(t.condition)?E(t.then):E(t.else);case "stepswitch":let e=E(t.elements)||[];if(e.length===0){R.error("getValueFromConditionalStatements elements.length === 0");return}switch(t.choiceType){case "random":let i=ci(0,e.length-1);return E(e[i]);case "loop":let r=NarrationManagerStatic.getCurrentStepTimesCounter(t.nestedId)-1;return r>e.length-1&&(r=r%e.length),E(e[r]);case "sequential":let n,o=NarrationManagerStatic.getCurrentStepTimesCounter(t.nestedId)-1;return t.end=="lastItem"&&(n=E(e[e.length-1])),o>e.length-1?n:E(e[o]);case "sequentialrandom":let p=NarrationManagerStatic.getRandomNumber(0,e.length-1,{nestedId:t.nestedId,onceOnly:true});if(p==null&&t.end=="lastItem"){let g=NarrationManagerStatic.getCurrentStepTimesCounterData(t.nestedId);if(!g||!g?.usedRandomNumbers){R.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let c=g.usedRandomNumbers[`0-${e.length-1}`];return E(e[c[c.length-1]])}if(p==null){R.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return E(e[p])}}return t}function Te(t){if(t.conditionalStep){let e=ri(E(t.conditionalStep));if(e?.glueEnabled===void 0&&delete e?.glueEnabled,e?.goNextStep===void 0&&delete e?.goNextStep,e?.end===void 0&&delete e?.end,e?.choices===void 0&&delete e?.choices,e?.dialogue===void 0&&delete e?.dialogue,e?.labelToOpen===void 0&&delete e?.labelToOpen,e?.operations===void 0&&delete e?.operations,e){let i={...t,conditionalStep:void 0,...e};return Te(i)}else storage.getFlag(SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)&&storage.setFlag(SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,false);}return t}function fi(t){let e=t.firstItem,i=[];t.secondConditionalItem?.forEach(n=>{if(Array.isArray(n))n.forEach(o=>{let p=E(o);i.push(p);});else {let o=E(n);i.push(o);}});let r=e?[e,...i]:i;if(r.length===0){R.warn("combinateResult toCheck.length === 0");return}if(typeof r[0]=="string")return J.t(r);if(typeof r[0]=="object"){let n=r,o,p=n.map((m,V)=>{m=Te(m);let u=E(m.dialogue)||"";return V===0?(o=E(m.glueEnabled)||false,u):(typeof u=="object"&&"text"in u&&(u=u.character+": "+u.text),o===false&&(u=`
|
|
1
|
+
import {a,c,b,e,d,f}from'./chunk-NG6ODEEE.mjs';import {RegisteredLabels,narration,LabelAbstract,NarrationManagerStatic}from'@drincs/pixi-vn/narration';import {storage,SYSTEM_RESERVED_STORAGE_KEYS}from'@drincs/pixi-vn/storage';import {canvas,VideoSprite,showVideo,ZoomTicker,RotateTicker,MoveTicker,FadeAlphaTicker,sound,Assets,narration as narration$1,ImageSprite,showImage,ImageContainer,showImageContainer,shakeEffect,pushOut,zoomOut,moveOut,removeWithDissolve,removeWithFade,pushIn,zoomIn,moveIn,showWithDissolve,showWithFade}from'@drincs/pixi-vn';import {RegisteredCharacters}from'@drincs/pixi-vn/characters';var st=Object.defineProperty,lt=(t,e,i)=>e in t?st(t,e,{enumerable:true,configurable:true,writable:true,value:i}):t[e]=i,ue=(t,e,i)=>lt(t,typeof e!="symbol"?e+"":e,i),te=class P{static t(e){return Array.isArray(e)?e.map(i=>P.translate(`${i}`)):P.translate(`${e}`)}static set beforeToTranslate(e){P._beforeToTranslate=e;}static set translate(e){P._translate=e;}static get translate(){return e=>{let i=e;return P._beforeToTranslate&&(i=P._beforeToTranslate(i)),i=P._translate(i),P._afterToTranslate&&(i=P._afterToTranslate(i)),i}}static set afterToTranslate(e){P._afterToTranslate=e;}static addKey(e,i,r){let n=r.defaultValue||"empty_string";typeof i=="string"&&(i=[i]),Array.isArray(i)&&i.forEach(o=>{e[o]===void 0&&(n==="empty_string"?e[o]="":n==="copy_key"&&(P._beforeToTranslate?e[o]=P._beforeToTranslate(o):e[o]=o));});}static getConditionalsThenElse(e,i=[]){if(typeof e=="object"&&e&&"type"in e)if(e.type==="ifelse")e.then&&P.getConditionalsThenElse(e.then,i),e.else&&P.getConditionalsThenElse(e.else,i);else if(e.type==="stepswitch"){if(e.elements)if(Array.isArray(e.elements))e.elements.forEach(r=>{P.getConditionalsThenElse(r,i);});else if(e.elements.type==="ifelse"){let r=[];P.getConditionalsThenElse(e.elements,r),r.forEach(n=>{i.push(...n);});}else if(e.elements.type==="stepswitch"){let r=[];P.getConditionalsThenElse(e.elements,r),r.forEach(n=>{i.push(...n);});}else P.getConditionalsThenElse(e.elements,i);}else e.type==="resulttocombine"?(e.firstItem&&P.getConditionalsThenElse(e.firstItem,i),e.secondConditionalItem&&e.secondConditionalItem.forEach(r=>{P.getConditionalsThenElse(r,i);})):i.push(e);else e&&i.push(e);return i}static generateJsonTranslation(e,i={},r={}){let{defaultValue:n="copy_key"}=r;return e.forEach(o=>{if(o.choices){let p=[];Array.isArray(o.choices)?p=[o.choices]:p=P.getConditionalsThenElse(o.choices),p.forEach(g=>g.forEach(c=>{if("type"in c){let l=[];c.type==="ifelse"||c.type==="stepswitch"?P.getConditionalsThenElse(c,l):l=[c],l.map(s=>P.getConditionalsThenElse(s.text)).forEach(s=>{Array.isArray(s)&&s.forEach(d=>{Array.isArray(d)?d.forEach(f=>{typeof f=="string"?P.addKey(i,f,{defaultValue:n}):P.getConditionalsThenElse(f).forEach(y=>{Array.isArray(y)?y.forEach(T=>{typeof T=="string"&&P.addKey(i,T,{defaultValue:n});}):typeof y=="string"&&P.addKey(i,y,{defaultValue:n});});}):typeof d=="string"&&P.addKey(i,d,{defaultValue:n});});});}}));}if(o.dialogue){let p=[];Array.isArray(o.dialogue)?p=[o.dialogue]:p=P.getConditionalsThenElse(o.dialogue),p.forEach(g=>{if(typeof g=="string")P.addKey(i,g,{defaultValue:n});else if("text"in g){let c=P.getConditionalsThenElse(g.text);typeof c=="string"&&(c=[c]),c.forEach(l=>{typeof l=="string"?P.addKey(i,l,{defaultValue:n}):P.getConditionalsThenElse(l).forEach(s=>{typeof s=="string"?P.addKey(i,s,{defaultValue:n}):Array.isArray(s)&&s.forEach(d=>{typeof d=="string"?P.addKey(i,d,{defaultValue:n}):P.getConditionalsThenElse(d).forEach(f=>{typeof f=="string"&&P.addKey(i,f,{defaultValue:n});});});});});}});}o.conditionalStep&&P.getConditionalsThenElse(o.conditionalStep).forEach(p=>{Array.isArray(p)?P.generateJsonTranslation(p,i,r):P.generateJsonTranslation([p],i,r);});}),i}};ue(te,"_beforeToTranslate"),ue(te,"_translate",t=>t),ue(te,"_afterToTranslate");var pt=te,J=pt;var ct=Object.defineProperty,ut=(t,e,i)=>e in t?ct(t,e,{enumerable:true,configurable:true,writable:true,value:i}):t[e]=i,_=(t,e,i)=>ut(t,typeof e!="symbol"?e+"":e,i),k;(t=>(t.log=(e,...i)=>console.log(`[Pixi\u2019VN Json] ${e}`,...i),t.warn=(e,...i)=>console.warn(`[Pixi\u2019VN Json] ${e}`,...i),t.error=(e,...i)=>console.error(`[Pixi\u2019VN Json] ${e}`,...i),t.info=(e,...i)=>console.info(`[Pixi\u2019VN Json] ${e}`,...i)))(k||(k={}));var L=class w{static init(e){w._loadAssets=e.loadAssets,w._soundOperation=e.soundOperation,w._imageOperation=e.imageOperation,w._videoOperation=e.videoOperation,w._imageContainerOperation=e.imageContainerOperation,w._canvasElementOperation=e.canvasElementOperation,w._setStorageValue=e.setStorageValue,w._narrationOperation=e.narrationOperation,w._tickerOperation=e.tickerOperation,w._effectOperation=e.effectOperation,w._animateOperation=e.animateOperation,w._getLogichValue=e.getLogichValue,w._getConditionalStep=e.getConditionalStep;}static get loadAssets(){return w._loadAssets}static get soundOperation(){return w._soundOperation}static get imageOperation(){return w._imageOperation}static get videoOperation(){return w._videoOperation}static get imageContainerOperation(){return w._imageContainerOperation}static get canvasElementOperation(){return w._canvasElementOperation}static get setStorageValue(){return w._setStorageValue}static get narrationOperation(){return w._narrationOperation}static get tickerOperation(){return w._tickerOperation}static get effectOperation(){return w._effectOperation}static get animateOperation(){return w._animateOperation}static get getLogichValue(){return w._getLogichValue}static get getConditionalStep(){return w._getConditionalStep}};_(L,"_loadAssets",()=>{throw k.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),_(L,"_soundOperation",()=>{throw k.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),_(L,"_imageOperation",()=>{throw k.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),_(L,"_videoOperation",()=>{throw k.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),_(L,"_imageContainerOperation",()=>{throw k.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),_(L,"_canvasElementOperation",()=>{throw k.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),_(L,"_setStorageValue",()=>{throw k.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),_(L,"_narrationOperation",()=>{throw k.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),_(L,"_tickerOperation",()=>{throw k.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),_(L,"_effectOperation",()=>{throw k.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),_(L,"_animateOperation",()=>{throw k.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),_(L,"_getLogichValue",()=>{throw k.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),_(L,"_getConditionalStep",()=>{throw k.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new Error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")});var A=L;var dt=Object.create,ge=Object.defineProperty,ht=Object.getOwnPropertyDescriptor,yt=Object.getOwnPropertyNames,mt=Object.getPrototypeOf,Tt=Object.prototype.hasOwnProperty,bt=(t,e,i)=>e in t?ge(t,e,{enumerable:true,configurable:true,writable:true,value:i}):t[e]=i,Le=(t=>typeof a<"u"?a:typeof Proxy<"u"?new Proxy(t,{get:(e,i)=>(typeof a<"u"?a:e)[i]}):t)(function(t){if(typeof a<"u")return a.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')}),je=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),xt=(t,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of yt(e))!Tt.call(t,n)&&n!==i&&ge(t,n,{get:()=>e[n],enumerable:!(r=ht(e,n))||r.enumerable});return t},vt=(t,e,i)=>(i=t!=null?dt(mt(t)):{},xt(ge(i,"default",{value:t,enumerable:true}),t)),fe=(t,e,i)=>bt(t,typeof e!="symbol"?e+"":e,i),St=je((t,e)=>{(function(i,r){typeof t=="object"?e.exports=t=r():typeof define=="function"&&define.amd?define([],r):i.CryptoJS=r();})(t,function(){var i=i||(function(r,n){var o;if(typeof window<"u"&&window.crypto&&(o=window.crypto),typeof self<"u"&&self.crypto&&(o=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(o=globalThis.crypto),!o&&typeof window<"u"&&window.msCrypto&&(o=window.msCrypto),!o&&typeof global<"u"&&global.crypto&&(o=global.crypto),!o&&typeof Le=="function")try{o=Le("crypto");}catch{}var p=function(){if(o){if(typeof o.getRandomValues=="function")try{return o.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof o.randomBytes=="function")try{return o.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},g=Object.create||(function(){function u(){}return function(a){var x;return u.prototype=a,x=new u,u.prototype=null,x}})(),c={},l=c.lib={},s=l.Base=(function(){return {extend:function(u){var a=g(this);return u&&a.mixIn(u),(!a.hasOwnProperty("init")||this.init===a.init)&&(a.init=function(){a.$super.init.apply(this,arguments);}),a.init.prototype=a,a.$super=this,a},create:function(){var u=this.extend();return u.init.apply(u,arguments),u},init:function(){},mixIn:function(u){for(var a in u)u.hasOwnProperty(a)&&(this[a]=u[a]);u.hasOwnProperty("toString")&&(this.toString=u.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),d=l.WordArray=s.extend({init:function(u,a){u=this.words=u||[],a!=n?this.sigBytes=a:this.sigBytes=u.length*4;},toString:function(u){return (u||y).stringify(this)},concat:function(u){var a=this.words,x=u.words,h=this.sigBytes,v=u.sigBytes;if(this.clamp(),h%4)for(var N=0;N<v;N++){var pe=x[N>>>2]>>>24-N%4*8&255;a[h+N>>>2]|=pe<<24-(h+N)%4*8;}else for(var I=0;I<v;I+=4)a[h+I>>>2]=x[I>>>2];return this.sigBytes+=v,this},clamp:function(){var u=this.words,a=this.sigBytes;u[a>>>2]&=4294967295<<32-a%4*8,u.length=r.ceil(a/4);},clone:function(){var u=s.clone.call(this);return u.words=this.words.slice(0),u},random:function(u){for(var a=[],x=0;x<u;x+=4)a.push(p());return new d.init(a,u)}}),f=c.enc={},y=f.Hex={stringify:function(u){for(var a=u.words,x=u.sigBytes,h=[],v=0;v<x;v++){var N=a[v>>>2]>>>24-v%4*8&255;h.push((N>>>4).toString(16)),h.push((N&15).toString(16));}return h.join("")},parse:function(u){for(var a=u.length,x=[],h=0;h<a;h+=2)x[h>>>3]|=parseInt(u.substr(h,2),16)<<24-h%8*4;return new d.init(x,a/2)}},T=f.Latin1={stringify:function(u){for(var a=u.words,x=u.sigBytes,h=[],v=0;v<x;v++){var N=a[v>>>2]>>>24-v%4*8&255;h.push(String.fromCharCode(N));}return h.join("")},parse:function(u){for(var a=u.length,x=[],h=0;h<a;h++)x[h>>>2]|=(u.charCodeAt(h)&255)<<24-h%4*8;return new d.init(x,a)}},b=f.Utf8={stringify:function(u){try{return decodeURIComponent(escape(T.stringify(u)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(u){return T.parse(unescape(encodeURIComponent(u)))}},m=l.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new d.init,this._nDataBytes=0;},_append:function(u){typeof u=="string"&&(u=b.parse(u)),this._data.concat(u),this._nDataBytes+=u.sigBytes;},_process:function(u){var a,x=this._data,h=x.words,v=x.sigBytes,N=this.blockSize,pe=N*4,I=v/pe;u?I=r.ceil(I):I=r.max((I|0)-this._minBufferSize,0);var ee=I*N,Ne=r.min(ee*4,v);if(ee){for(var ce=0;ce<ee;ce+=N)this._doProcessBlock(h,ce);a=h.splice(0,ee),x.sigBytes-=Ne;}return new d.init(a,Ne)},clone:function(){var u=s.clone.call(this);return u._data=this._data.clone(),u},_minBufferSize:0});l.Hasher=m.extend({cfg:s.extend(),init:function(u){this.cfg=this.cfg.extend(u),this.reset();},reset:function(){m.reset.call(this),this._doReset();},update:function(u){return this._append(u),this._process(),this},finalize:function(u){u&&this._append(u);var a=this._doFinalize();return a},blockSize:16,_createHelper:function(u){return function(a,x){return new u.init(x).finalize(a)}},_createHmacHelper:function(u){return function(a,x){return new V.HMAC.init(u,x).finalize(a)}}});var V=c.algo={};return c})(Math);return i});}),Pt=je((t,e)=>{(function(i,r){typeof t=="object"?e.exports=t=r(St()):typeof define=="function"&&define.amd?define(["./core"],r):r(i.CryptoJS);})(t,function(i){return (function(){var r=i,n=r.lib,o=n.WordArray,p=n.Hasher,g=r.algo,c=[],l=g.SHA1=p.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(s,d){for(var f=this._hash.words,y=f[0],T=f[1],b=f[2],m=f[3],V=f[4],u=0;u<80;u++){if(u<16)c[u]=s[d+u]|0;else {var a=c[u-3]^c[u-8]^c[u-14]^c[u-16];c[u]=a<<1|a>>>31;}var x=(y<<5|y>>>27)+V+c[u];u<20?x+=(T&b|~T&m)+1518500249:u<40?x+=(T^b^m)+1859775393:u<60?x+=(T&b|T&m|b&m)-1894007588:x+=(T^b^m)-899497514,V=m,m=b,b=T<<30|T>>>2,T=y,y=x;}f[0]=f[0]+y|0,f[1]=f[1]+T|0,f[2]=f[2]+b|0,f[3]=f[3]+m|0,f[4]=f[4]+V|0;},_doFinalize:function(){var s=this._data,d=s.words,f=this._nDataBytes*8,y=s.sigBytes*8;return d[y>>>5]|=128<<24-y%32,d[(y+64>>>9<<4)+14]=Math.floor(f/4294967296),d[(y+64>>>9<<4)+15]=f,s.sigBytes=d.length*4,this._process(),this._hash},clone:function(){var s=p.clone.call(this);return s._hash=this._hash.clone(),s}});r.SHA1=p._createHelper(l),r.HmacSHA1=p._createHmacHelper(l);})(),i.SHA1});}),G;(t=>(t.log=(e,...i)=>console.log(`[Pixi\u2019VN Json] ${e}`,...i),t.warn=(e,...i)=>console.warn(`[Pixi\u2019VN Json] ${e}`,...i),t.error=(e,...i)=>console.error(`[Pixi\u2019VN Json] ${e}`,...i),t.info=(e,...i)=>console.info(`[Pixi\u2019VN Json] ${e}`,...i)))(G||(G={}));async function de(t,e={}){let{operationStringConvert:i,skipEmptyDialogs:r}=e;if(!Array.isArray(t))if(typeof t=="object"||typeof t=="string")t=[t];else {G.error("Error parsing imported Pixi'VN JSON: data is not an object");return}let n=t.map(async p=>{if(typeof p=="string")try{p=JSON.parse(p);}catch(g){G.error("Error parsing imported Pixi'VN JSON",g),p={};}return p}),o=(await Promise.all(n)).map(async p=>{let g=[];if(p.initialOperations){let c={};[...storage.storage.keys()].forEach((l,s)=>{c[l]=storage.storage.get(l);}),storage.startingStorage=c;}if(p.labels){let c=p.labels;for(let l in c)try{let s=c[l],d=new Ot(l,s,void 0,e);RegisteredLabels.add(d);}catch(s){G.error(`Error creating JSON label ${l}`,s);}}return Promise.all(g)});await Promise.all(o);}var Vt=vt(Pt()),_e="___param___";function At(t){try{if(typeof t>"u")return t;let e=JSON.stringify(t);return JSON.parse(e)}catch(e){throw G.error("Error creating exportable element",t,e),new Error("[Pixi\u2019VN] Error creating exportable element")}}async function De(t,e){let i=A.getLogichValue(t);if(i)switch(i.type){case "sound":A.soundOperation(i);break;case "assets":case "bundle":await A.loadAssets(i);break;case "image":await A.imageOperation(i);break;case "video":await A.videoOperation(i);break;case "imagecontainer":await A.imageContainerOperation(i);break;case "canvaselement":await A.canvasElementOperation(i);break;case "value":A.setStorageValue(i);break;case "operationtoconvert":if(e){let r="";i.values.forEach(o=>{if(typeof o=="string")r+=o;else {let p=A.getLogichValue(o);r+=`${p}`;}});let n=await e(r);n&&await De(n,e);}break;case "input":case "dialogue":A.narrationOperation(i);break;case "fade":case "move":case "rotate":case "zoom":A.tickerOperation(i);break;case "shake":await A.effectOperation(i);break;case "animate":case "animate-sequence":A.animateOperation(i);break}}var Ot=class extends LabelAbstract{constructor(t,e,i,r={}){i||(i={}),i.onLoadingLabel=async()=>{for(let n of e){let o;if(typeof n=="function"?o=n():o=n,o=A.getConditionalStep(o),o.operations){let p=o.operations.map(g=>A.loadAssets(g));await Promise.all(p);}}},super(t,i),fe(this,"_steps"),fe(this,"operationStringConvert"),fe(this,"skipEmptyDialogs",false),this._steps=e,this.operationStringConvert=r.operationStringConvert,this.skipEmptyDialogs=r.skipEmptyDialogs||false;}get steps(){return this._steps.map(t=>this.stepConverter(t))}get stepCount(){return this._steps.length}getStepById(t){if(t<0||t>=this._steps.length)return;let e=this._steps[t];return this.stepConverter(e)}getStepSha(t){if(t<0||t>=this.steps.length)return;let e=this._steps[t];return (0, Vt.default)(e.toString().toLocaleLowerCase()).toString()}getDialogueText(t){let e="";if(Array.isArray(t)){let i=[];t.forEach(r=>{if(typeof r=="string")i.push(r);else if(r&&typeof r=="object"){let n=A.getLogichValue(r);n?(n&&!Array.isArray(n)&&typeof n=="object"&&(n=A.getLogichValue(n)||""),Array.isArray(n)?i=i.concat(n):i.push(`${n}`)):i.push(`${r}`);}}),e=i;}else {let i=A.getLogichValue(t)||"";i&&!Array.isArray(i)&&typeof i=="object"&&(i=A.getLogichValue(i)||""),e=i;}return `${e}`}getDialogue(t){if(t==null)return;let e=A.getLogichValue(t);return e==null?"":typeof e=="object"&&"character"in e&&"text"in e?{character:e.character,text:J.t(this.getDialogueText(e.text))}:J.t(this.getDialogueText(e))}getChoices(t){return A.getLogichValue(t)?.map(e=>A.getLogichValue(e)).filter(e=>e!==void 0)}stepConverter(t){return async e=>{let i=typeof t=="function"?t():t;i=At(i),i=A.getConditionalStep(i);let r=this.operationStringConvert?f=>this.operationStringConvert(f,i,e):void 0,{operations:n=[]}=i;for(let f of n)await De(f,r);let{labelToOpen:o=[]}=i,p=this.getChoices(i.choices),g=A.getLogichValue(i.glueEnabled),c=this.getDialogue(i.dialogue),l=[];Array.isArray(o)||(o=[o]),o.forEach(f=>{let y=A.getLogichValue(f);y&&l.push(y);});let s=A.getLogichValue(i.goNextStep),d=A.getLogichValue(i.end);if(p){let f=p.map(y=>{let T="";if(Array.isArray(y.text)){let b=[];y.text.forEach(m=>{if(typeof m=="string")b.push(J.t(m));else if(m&&typeof m=="object"){let V=A.getLogichValue(m);V&&!Array.isArray(V)&&typeof V=="object"&&(V=A.getLogichValue(V)||""),V&&(Array.isArray(V)?b=b.concat(J.t(V)):b.push(J.t(V)));}}),T=b;}else typeof y.text=="string"&&(T=J.t(y.text));return {label:y.label,text:T,props:y.props,type:y.type,oneTime:y.oneTime,onlyHaveNoChoice:y.onlyHaveNoChoice,autoSelect:y.autoSelect}});narration.choiceMenuOptions=f;}else narration.choiceMenuOptions=void 0;c!==void 0&&(narration.dialogue=c,this.skipEmptyDialogs&&typeof c=="string"&&(c===""||RegExp(/^\s+$/).test(c))&&(s=true)),g?storage.setFlag(SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,true):g===false&&storage.setFlag(SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,false);for(let f of l){let y=f.label;typeof y=="object"&&(y=A.getLogichValue(y)||"");let T=f.params?.map(b=>A.getLogichValue(b));e={...e,...f.props},f.type==="jump"?(narration.openedLabels.length>0&&narration.closeCurrentLabel(),storage.setTempVariable(`${_e}${narration.openedLabels.length}`,T),await narration.callLabel(y,e)):(storage.setTempVariable(`${_e}${narration.openedLabels.length}`,T),await narration.callLabel(y,e));}d==="game_end"?(narration.closeAllLabels(),await narration.goNext(e,{runNow:true})):d==="label_end"&&narration.closeCurrentLabel(),s&&await narration.goNext(e,{runNow:true});}}};var ye="___param___";async function Yt(t){let e=A.getLogichValue(t);if(e)switch(e.type){case "assets":switch(e.operationType){case "load":await Assets.load(e.aliases);break;case "lazyload":Assets.backgroundLoad(e.aliases);break}break;case "bundle":switch(e.operationType){case "load":await Assets.loadBundle(e.aliases);break;case "lazyload":Assets.backgroundLoadBundle(e.aliases);break}break}}var R;(t=>(t.log=(e,...i)=>console.log(`[Pixi\u2019VN Json] ${e}`,...i),t.warn=(e,...i)=>console.warn(`[Pixi\u2019VN Json] ${e}`,...i),t.error=(e,...i)=>console.error(`[Pixi\u2019VN Json] ${e}`,...i),t.info=(e,...i)=>console.info(`[Pixi\u2019VN Json] ${e}`,...i)))(R||(R={}));async function me(t,e,i){switch(i.type){case "fade":await showWithFade(e.alias,t,i.props,i.priority);break;case "dissolve":await showWithDissolve(e.alias,t,i.props,i.priority);break;case "movein":case "moveout":await moveIn(e.alias,t,i.props,i.priority);break;case "zoomin":case "zoomout":await zoomIn(e.alias,t,i.props,i.priority);break;case "pushin":case "pushout":await pushIn(e.alias,t,i.props,i.priority);break}}function re(t){if(t.transition)switch(t.transition.type){case "fade":removeWithFade(t.alias,t.transition.props,t.transition.priority);break;case "dissolve":removeWithDissolve(t.alias,t.transition.props,t.transition.priority);break;case "movein":case "moveout":moveOut(t.alias,t.transition.props,t.transition.priority);break;case "zoomin":case "zoomout":zoomOut(t.alias,t.transition.props,t.transition.priority);break;case "pushin":case "pushout":pushOut(t.alias,t.transition.props,t.transition.priority);break}else canvas.remove(t.alias);}async function qt(t){switch(t.operationType){case "show":if(t.transition){let i=new ImageSprite(t.props,t.url||t.alias);await me(i,t,t.transition);}else await showImage(t.alias,t.url,t.props);break;case "edit":let e=canvas.find(t.alias);e?t.props&&await e.setMemory({...e.memory,...t.props}):R.error(`Image with alias ${t.alias} not found.`);break;case "remove":re(t);break}}async function Qt(t){switch(t.operationType){case "show":if(t.transition){let n=new VideoSprite(t.props,t.url||t.alias);await me(n,t,t.transition);}else await showVideo(t.alias,t.url,t.props);break;case "edit":let e=canvas.find(t.alias);e?t.props&&await e.setMemory({...e.memory,...t.props}):R.error(`Video with alias ${t.alias} not found.`);break;case "remove":re(t);break;case "pause":let i=canvas.find(t.alias);i?i.paused=true:R.error(`Video with alias ${t.alias} not found.`);break;case "resume":let r=canvas.find(t.alias);r?r.paused=false:R.error(`Video with alias ${t.alias} not found.`);break}}async function Xt(t){switch(t.operationType){case "show":if(t.transition){let i=new ImageContainer(t.props,t.urls);await me(i,t,t.transition);}else await showImageContainer(t.alias,t.urls,t.props);break;case "edit":let e=canvas.find(t.alias);e?t.props&&await e.setMemory({...e.memory,...t.props}):R.error(`ImageContainer with alias ${t.alias} not found.`);break;case "remove":re(t);break}}async function Kt(t){switch(t.operationType){case "edit":try{let e=canvas.find(t.alias);e?t.props&&(e.memory={...e.memory,...t.props}):R.error(`Canvas Element with alias ${t.alias} not found.`);}catch(e){R.error(`There was an error while trying to edit the canvas element with alias ${t.alias}.`,e);}break;case "remove":re(t);break}}function Zt(t){switch(t.type){case "fade":let e=new FadeAlphaTicker(t.props,t.duration,t.priority);canvas.addTicker(t.alias,e);break;case "move":let i=new MoveTicker(t.props,t.duration,t.priority);canvas.addTicker(t.alias,i);break;case "rotate":let r=new RotateTicker(t.props,t.duration,t.priority);canvas.addTicker(t.alias,r);break;case "zoom":let n=new ZoomTicker(t.props,t.duration,t.priority);canvas.addTicker(t.alias,n);break}}async function ei(t){switch(t.type){case "shake":await shakeEffect(t.alias,t.props,t.priority);break}}function ti(t){switch(t.type){case "animate":canvas.animate(t.alias,t.keyframes,t.options,t.priority);break;case "animate-sequence":canvas.animate(t.alias,t.sequence,t.options,t.priority);break}}function ii(t){switch(t.type){case "input":narration$1.requestInput({type:t.valueType},t.defaultValue);break;case "dialogue":narration$1.dialogue=void 0;break}}function ni(t){switch(t.operationType){case "play":sound.play(t.alias,t.props);break;case "stop":sound.stop(t.alias);break;case "pause":sound.pause(t.alias);break;case "resume":sound.resume(t.alias);break;case "volume":sound.volume(t.alias,t.value);break}}function ri(t){try{if(typeof t>"u")return t;let e=JSON.stringify(t);return JSON.parse(e)}catch(e){throw R.error("Error creating exportable element",t,e),new Error("[Pixi\u2019VN] Error creating exportable element")}}function oi(t){let e=E(t.value),i;switch(e&&typeof e=="object"&&"type"in e?i=E(e):i=e,t.storageType){case "flagStorage":storage.setFlag(t.key,t.value);break;case "storage":storage.setVariable(t.key,i);break;case "tempstorage":storage.setTempVariable(t.key,i);break;case "params":let r=storage.getVariable(`${ye}${narration.openedLabels.length-1}`)||[];r&&r.length-1>=t.key&&(r[t.key]=i),storage.setTempVariable(`${ye}${narration.openedLabels.length-1}`,r);break}}function E(t){let e=ui(t);if(e&&typeof e=="object"&&"type"in e)switch(e.type){case "value":return si(e);case "arithmetic":case "arithmeticsingle":return ai(e);case "compare":case "valueCondition":case "union":return li(e)}return e}function ai(t){let e=E(t.leftValue);switch(t.type){case "arithmetic":let i=E(t.rightValue);switch(t.operator){case "*":return e*i;case "/":return e/i;case "+":return e+i;case "-":return e-i;case "%":return e%i;case "POW":return Math.pow(e,i);case "RANDOM":return narration.getRandomNumber(e,i)}case "arithmeticsingle":switch(t.operator){case "INT":return parseInt(e);case "FLOOR":return Math.floor(e);case "FLOAT":return parseFloat(e)}break}}function si(t){if(t&&typeof t=="object"&&"type"in t&&t.type==="value"&&t.storageOperationType==="get")switch(t.storageType){case "storage":case "tempstorage":return storage.getVariable(t.key);case "flagStorage":return storage.getFlag(t.key);case "label":return narration.getTimesLabelOpened(t.label);case "choice":return narration.getTimesChoiceMade(t.index);case "logic":return E(t.operation);case "params":let e=storage.getVariable(`${ye}${narration.openedLabels.length-1}`)||[];if(e&&e.length>t.key)return e[t.key];R.warn("getValue params not found");return}return t}function li(t){if(!t)return false;if(typeof t!="object"||!("type"in t))return !!t;switch(t.type){case "compare":let e=E(t.leftValue),i=E(t.rightValue);switch(t.operator){case "==":return e===i;case "!=":return e!==i;case "<":return e<i;case "<=":return e<=i;case ">":return e>i;case ">=":return e>=i;case "CONTAINS":return e.toString().includes(i.toString())}break;case "valueCondition":return !!E(t.value);case "union":return pi(t)}return !!t}function pi(t){if(t.unionType==="not")return !E(t.condition);let e=t.unionType==="and";for(let i=0;i<t.conditions.length;i++)if(e=E(t.conditions[i])||false,t.unionType==="and"){if(!e)return false}else if(e)return true;return e}function ci(t,e){return Math.floor(Math.random()*(e-t+1)+t)}function ui(t){if(Array.isArray(t)||!t)return t;if(t&&typeof t=="object"&&"type"in t)switch(t.type){case "resulttocombine":return fi(t);case "ifelse":return E(t.condition)?E(t.then):E(t.else);case "stepswitch":let e=E(t.elements)||[];if(e.length===0){R.error("getValueFromConditionalStatements elements.length === 0");return}switch(t.choiceType){case "random":let i=ci(0,e.length-1);return E(e[i]);case "loop":let r=NarrationManagerStatic.getCurrentStepTimesCounter(t.nestedId)-1;return r>e.length-1&&(r=r%e.length),E(e[r]);case "sequential":let n,o=NarrationManagerStatic.getCurrentStepTimesCounter(t.nestedId)-1;return t.end=="lastItem"&&(n=E(e[e.length-1])),o>e.length-1?n:E(e[o]);case "sequentialrandom":let p=NarrationManagerStatic.getRandomNumber(0,e.length-1,{nestedId:t.nestedId,onceOnly:true});if(p==null&&t.end=="lastItem"){let g=NarrationManagerStatic.getCurrentStepTimesCounterData(t.nestedId);if(!g||!g?.usedRandomNumbers){R.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let c=g.usedRandomNumbers[`0-${e.length-1}`];return E(e[c[c.length-1]])}if(p==null){R.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return E(e[p])}}return t}function Te(t){if(t.conditionalStep){let e=ri(E(t.conditionalStep));if(e?.glueEnabled===void 0&&delete e?.glueEnabled,e?.goNextStep===void 0&&delete e?.goNextStep,e?.end===void 0&&delete e?.end,e?.choices===void 0&&delete e?.choices,e?.dialogue===void 0&&delete e?.dialogue,e?.labelToOpen===void 0&&delete e?.labelToOpen,e?.operations===void 0&&delete e?.operations,e){let i={...t,conditionalStep:void 0,...e};return Te(i)}else storage.getFlag(SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)&&storage.setFlag(SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,false);}return t}function fi(t){let e=t.firstItem,i=[];t.secondConditionalItem?.forEach(n=>{if(Array.isArray(n))n.forEach(o=>{let p=E(o);i.push(p);});else {let o=E(n);i.push(o);}});let r=e?[e,...i]:i;if(r.length===0){R.warn("combinateResult toCheck.length === 0");return}if(typeof r[0]=="string")return J.t(r);if(typeof r[0]=="object"){let n=r,o,p=n.map((m,V)=>{m=Te(m);let u=E(m.dialogue)||"";return V===0?(o=E(m.glueEnabled)||false,u):(typeof u=="object"&&"text"in u&&(u=u.character+": "+u.text),o===false&&(u=`
|
|
2
2
|
|
|
3
3
|
`+u),o=E(m.glueEnabled)||false,u)}),g=E(p[0]),c=typeof g=="object"&&"character"in g?g.character:void 0,l=p.flatMap(m=>{let V;m&&typeof m=="object"&&"text"in m?V=m.text:V=m;let u;return Array.isArray(V)?u=V.map(a=>{let x=E(a);return J.t(`${x}`)}):u=E(V)||"",J.t(u)}),s=n.find(m=>m.end),d=n.find(m=>m.choices),f=false,y=false;n.length>0&&(n[0].glueEnabled&&n[0].goNextStep&&n[0].dialogue===void 0&&storage.setFlag(SYSTEM_RESERVED_STORAGE_KEYS.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,true),f=n[n.length-1].glueEnabled,y=n.reverse().find(m=>!(m.operations&&(!m.dialogue||!m.choices)))?.goNextStep);let T=n.find(m=>m.labelToOpen),b=[];return n.forEach(m=>{m.operations&&b.forEach(V=>{b.push(V);});}),{dialogue:c?{character:c,text:l}:l,end:s?.end,choices:d?.choices,glueEnabled:f,goNextStep:y,labelToOpen:T?.labelToOpen,operations:b}}}function be(){A.init({animateOperation:ti,canvasElementOperation:Kt,effectOperation:ei,imageContainerOperation:Xt,imageOperation:qt,narrationOperation:ii,loadAssets:Yt,soundOperation:ni,tickerOperation:Zt,videoOperation:Qt,setStorageValue:oi,getLogichValue:E,getConditionalStep:Te});}var Ie="\xA7SPACE\xA7",$e="\xA7DOUBLE_QUOTES\xA7",Be="\xA7QUOTES\xA7",He="SPECIAL_\xA7QUOTES\xA7",ze="\xA7CURLY_BRACKETS1\xA7",Me="\xA7CURLY_BRACKETS2\xA7",gi=["add","play","pause","resume","remove","volume"],S=class S{static runCustomHashtagScript(e,i){return S._customHashtagScript(e,i,S.convertListStringToObj)}static set customHashtagScript(e){S._customHashtagScript=e;}static async generateOrRunOperationFromHashtagScript(e,i,r){try{e=e.replaceAll('\\"',$e),e=e.replaceAll("\\'",Be),e=e.replaceAll("\\`",He),e=e.replaceAll("\\{",ze),e=e.replaceAll("\\}",Me),e=e.replaceAll("{"," { "),e=e.replaceAll("}"," } "),e=e.replaceAll(ze,"{"),e=e.replaceAll(Me,"}");let n=[],o,p="";for(let s=0;s<e.length;s++){let d=e[s];d==='"'||d==="'"||d==="`"?o===void 0?(n.push(p),p="",o=d,p+=d):o===d?(o=void 0,p+=d,n.push(p),p=""):p+=d:p+=d;}p!==""&&n.push(p),n.forEach((s,d)=>{d%2===1&&(n[d]=s.replaceAll(" ",Ie));}),e=n.join(""),n=e.split(" ").filter(s=>s!==""),n=n.map(s=>s.replaceAll(Ie," ").replaceAll($e,'"').replaceAll(Be,"'").replaceAll(He,"`"));let g=S.runCustomHashtagScript(n,r);if(g===!0)return;if(typeof g=="string")return g.startsWith("#")&&(g=g.substring(1)),S.generateOrRunOperationFromHashtagScript(g,i,r);let c=n.length>1?S.removeExtraDoubleQuotes(n[1]):"",l=n.length>0?S.removeExtraDoubleQuotes(n[0]):"";switch(c){case "image":case "imagecontainer":case "canvaselement":case "video":return c==="video"&&(l==="pause"||l==="resume")?{type:"video",operationType:l,alias:S.removeExtraDoubleQuotes(n[2])}:S.getCanvasOperationFromComment(n,c);case "sound":return S.getSoundOperationFromComment(n);case "input":if(l==="request"){let s={type:"input",operationType:"request"};if(n.length>2)try{let d=n.slice(2),f=S.convertListStringToObj(d);"type"in f&&typeof f.type=="string"&&(s.valueType=f.type),"default"in f&&(s.defaultValue=f.default);}catch{}return s}break;case "assets":case "bundle":switch(l){case "load":case "lazyload":return {type:c,operationType:l,aliases:n.slice(2)}}break;default:if(c)switch(l){case "call":case "jump":i.labelToOpen={label:c,type:l},i.goNextStep=void 0;return;case "fade":case "move":case "rotate":case "zoom":case "shake":let s={};if(n.length>2)try{s=S.convertListStringToObj(n.slice(2));}catch{}if(l=="move"&&"x"in s&&"y"in s&&(s.destination={x:s.x,y:s.y,type:"pixel"},delete s.x,delete s.y),l=="move"&&"xAlign"in s&&"yAlign"in s&&(s.destination={x:s.xAlign,y:s.yAlign,type:"align"},delete s.xAlign,delete s.yAlign),l=="move"&&"xPercentage"in s&&"yPercentage"in s&&(s.destination={x:s.xPercentage,y:s.yPercentage,type:"percentage"},delete s.xPercentage,delete s.yPercentage),l=="move"&&!("destination"in s)){d.error("The move operation don't have a destination or destination is not valid",s);return}return {alias:c,type:l,props:s};case "animate":let f={},y={};if(n.length>2){let b=n.slice(2),m=[];if(b.includes("options")){let V=b.indexOf("options");m=b.slice(V+1),b=b.slice(0,V);}try{f=S.convertListStringToObj(b);}catch{}if(m.length>0)try{y=S.convertListStringToObj(m);}catch{}}return {alias:c,type:l,keyframes:f,options:y}}else switch(l){case "pause":return "dialogue"in i&&delete i.dialogue,"goNextStep"in i&&delete i.goNextStep,{type:"dialogue",operationType:"clean"};case "continue":i.goNextStep=!0,i.glueEnabled=!1;return}}}catch(n){throw d.error("Error parsing ink hashtag-script",e),n}d.error("The operation is not valid",e);}static getCanvasOperationFromComment(e,i){let r=S.removeExtraDoubleQuotes(e[0]),n=S.removeExtraDoubleQuotes(e[2]),o=S.convertListStringToPropList(e.slice(3));switch(r){case "show":switch(i){case "image":case "video":return S.getImageOperationFromComment(i,n,o);case "imagecontainer":return S.getContainerOperationFromComment(i,n,o);case "canvaselement":default:d.error("This show operation is not valid for this type of element",i);}case "edit":return {type:i,operationType:"edit",alias:n,props:S.convertPropListStringToObj(o)};case "remove":let g={type:i,operationType:"remove",alias:n};if(o.length>1&&o[0]==="with"){let c=e[e.indexOf("with")+1],l=e.slice(e.indexOf("with")+2),s=S.getTransition(c,l);s!==void 0&&(g.transition=s);}return g;default:d.error("The operation type is not valid",r);}}static getImageOperationFromComment(e,i,r){let n,o;r.length%2===0?(n=i,o=r):(n=S.removeExtraDoubleQuotes(r[0]),o=S.convertListStringToPropList(r.slice(1)));let p={type:e,operationType:"show",alias:i,url:n};return S.setShowProps(p,o)}static getContainerOperationFromComment(e,i,r){let n=[],o=r.findIndex(l=>l.startsWith("[")),p=r.findIndex(l=>l.endsWith("]"));if(o===-1||p===-1){d.error("Show imagecontainer must have a list of image ulrs",r);return}if(n=r.slice(o,p+1),n.length<2){d.error("Show imagecontainer must have a list of image ulrs",r);return}n[0]==="["?n.shift():n[0]=n[0].substring(1),n[n.length-1]==="]"?n.pop():n[n.length-1]=n[n.length-1].substring(0,n[n.length-1].length-1);let g={type:e,operationType:"show",alias:i,urls:n.map(l=>S.removeExtraDoubleQuotes(l))},c=S.convertListStringToPropList(r.slice(p+1));return S.setShowProps(g,c)}static getSoundOperationFromComment(e){let i=S.removeExtraDoubleQuotes(e[0]);if(!gi.includes(i))return;let r=S.removeExtraDoubleQuotes(e[2]);switch(i){case "play":let n={type:"sound",operationType:"play",alias:r};if(e.length>3){let l=S.getSoundPlayOptions(e.slice(3));l!==void 0&&(n.props=l);}return n;case "pause":case "resume":return {type:"sound",operationType:i,alias:r};case "stop":case "remove":return {type:"sound",operationType:"stop",alias:r};case "volume":let g=parseFloat(e[3]);return {type:"sound",operationType:"volume",alias:r,value:g}}}static setShowProps(e,i){if(i.length>0){if(i.includes("with")&&i.length>i.indexOf("with")+1){let r=i[i.indexOf("with")+1],n=i.slice(i.indexOf("with")+2);i=i.slice(0,i.indexOf("with"));let o=S.getTransition(r,n);o!==void 0&&(e.transition=o);}if(i.length>0){let r=S.convertListStringToObj(i);e.props=r;}}return e}static getTransition(e,i){switch(e){case "dissolve":case "fade":case "movein":case "moveout":case "zoomin":case "zoomout":case "pushin":case "pushout":break;default:return}let r={type:e};if(i.length>0)try{let n=S.convertPropListStringToObj(i);r.props=n;}catch{}return r}static getSoundOption(e){try{return S.convertListStringToObj(e)}catch{return}}static getSoundPlayOptions(e){try{return S.convertListStringToObj(e)}catch{return}}static convertListStringToObj(e){let i=S.convertListStringToPropList(e);return S.convertPropListStringToObj(i)}static convertListStringToPropList(e){let i=[],r=0,n="";for(let o=0;o<e.length;o++){let p=e[o];p.startsWith("{")?(r++,n+=p):p.endsWith("}")&&r>0?(r--,n+=p,r===0&&(i.push(n),n="")):r>0?n+=p:i.push(p);}return i}static convertPropListStringToObj(e){if(e.length===0)return {};if(e.length%2!==0)throw d.error("The props list must have a pair number of elements",e),new Error("The props list must have a pair number of elements");let i="{";e.forEach((r,n)=>{if(n%2===0)i+=`"${r}": `;else {switch(r){case "null":case "undefined":case "true":case "false":i+=`${r}`;break;default:S.containExtraDoubleQuotes(r)?(r=S.removeExtraDoubleQuotes(r),i+=`"${r}"`):r.startsWith("{")&&r.endsWith("}")?i+=`${r}`:r.startsWith('"')&&r.endsWith('"')?i+=`${r}`:isNaN(parseFloat(r))?i+=`"${r}"`:i+=`${r}`;}n<e.length-1&&(i+=", ");}}),i+="}";try{return JSON.parse(i)}catch(r){throw d.error("Error parsing ink json",i),r}}static removeExtraDoubleQuotes(e){return e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'")||e.startsWith("`")&&e.endsWith("`")?e.substring(1,e.length-1):e}static containExtraDoubleQuotes(e){return !!(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'")||e.startsWith("`")&&e.endsWith("`"))}};c(S,"_customHashtagScript",e=>false);var B=S;function di(t){B.customHashtagScript=t;}var we=b(e(),1);var oe="global decl",H="___external_value___";function Z(t,e){if(t.endsWith(".s"))return;if(new RegExp(/.*\.[0-9]+\..*$/).test(t)&&(t=t.split(".").filter(n=>!n.match(/^[0-9]+$/)).join("."),!t.startsWith(".")))return t.replaceAll(".","_|_");if(!new RegExp(/^\.\^.*$/).test(t)&&t.includes("g-")){let r=t.split("g-");return xe(e)+"_|_"+"g-"+r[r.length-1]}let i=0;for(;new RegExp(/^\.\^.*$/).test(t);)i++,t=t.substring(2);if(i=i-1,new RegExp(/^\..*$/).test(t)&&e){let r=t.substring(1);return xe(e,i)+"_|_"+r.replaceAll(".","_|_")}return t.replaceAll(".","_|_")||xe(e,i).replaceAll(".","_|_")}function xe(t,e=0){let i=t.split("_|_");for(;i.length>1&&e>0;)i.pop()?.includes("g-")&&e--,e--;return i.join("_|_")}var We="\xA7DOUBLE_SLASH_CONVERTOR\xA7";function $(t){return t.startsWith("^")&&(t=t.substring(1)),t=t.replaceAll("\\\\",We),t=t.replaceAll("\\n",`
|
|
4
4
|
`),t=t.replaceAll("\\t"," "),t=t.replaceAll(" "," "),t=t.replaceAll(We,"\\\\"),t}var Ge=["+","-","/","*","%","_","==",">","<",">=","<=","!=","!","&&","||","MIN","MAX"],Ue=["+","-","/","*","%","POW","RANDOM"],Ye=["INT","FLOOR","FLOAT"],qe=["==",">","<",">=","<=","!=","CONTAINS"];function Y(t,e,i){t=t.map(n=>{if(typeof n=="string"){if(n==="rnd")return "RANDOM";if(n==="?")return "CONTAINS"}return n});let r=[];return t.forEach(n=>{if(typeof n=="object"&&"CNT?"in n)if(new RegExp(/.*\.[0-9]\..*/).test(n["CNT?"])){let o=n["CNT?"].split("."),p=o.pop(),g=o.pop();if(g===void 0||p===void 0){d.error("Error parsing ink file: Conditional statement is not valid",t);return}let c=parseInt(g),l=o.join(".");if(l.includes("^.")){let d=l.split("."),f=d[d.length-1].replaceAll(".","_|_");d.pop(),l=d.join(".")+"."+f,p.includes("c-")&&(l=l+"_|_"+p);}else l=l.replaceAll(".","_|_");let s=Z(l,e);if(!s)return;r.push({type:"compare",leftValue:Qe(s),operator:">=",rightValue:{type:"value",value:c}});}else {let o=Z(n["CNT?"],e);if(!o)return;r.push(Qe(o));}else if(typeof n=="object"&&"VAR?"in n)r.push(q(n["VAR?"],i));else if(n==="&&"||n==="||"){if(r.length>=2){let o={type:"union",unionType:n==="&&"?"and":"or",conditions:[r[r.length-2],r[r.length-1]]};r.pop(),r.pop(),r.push(o);}}else if(n==="!")if(r.length===0)d.error("Error parsing ink file: Conditional statement is not valid",t);else {let o={type:"union",unionType:"not",condition:r[r.length-1]};r[r.length-1]=o;}else if(n&&typeof n=="string"&&qe.includes(n))if(r.length<2)d.error("Error parsing ink file: Conditional statement is not valid",t);else {let o={type:"compare",operator:n,rightValue:r[r.length-1],leftValue:r[r.length-2]};r.pop(),r.pop(),r.push(o);}else if(n&&typeof n=="string"&&Ue.includes(n))if(r.length<2)d.error("Error parsing ink file: Conditional statement is not valid",t);else {let o={type:"arithmetic",operator:n,rightValue:r[r.length-1],leftValue:r[r.length-2]};r.pop(),r.pop(),r.push(o);}else if(n&&typeof n=="string"&&Ye.includes(n)){let o={type:"arithmeticsingle",operator:n,leftValue:r[r.length-1]};r.pop(),r.push(o);}else n&&typeof n=="string"?n.startsWith("^")&&r.push($(n)):typeof n=="object"&&"^->"in n?n["^->"].includes("$r")||r.push(n["^->"]):r.push(n);}),r}function Qe(t){return {type:"value",storageType:"label",storageOperationType:"get",label:t}}function Xe(t,e,i){return Y(t,e,i)}function q(t,e,i="storage"){let r=e.indexOf(t);return r>=0?{type:"value",storageType:"params",storageOperationType:"get",key:r}:{type:"value",storageOperationType:"get",storageType:i,key:t}}function ve(t,e,i,r="storage"){let n=e.indexOf(t);return n>=0?{type:"value",storageType:"params",storageOperationType:"set",key:n,value:i}:{type:"value",storageOperationType:"set",storageType:r,key:t,value:i}}function Se(t,e){return e||t.includes("_|_")?"call":"jump"}function ae(t,e){e&&(typeof e=="string"?e.startsWith("^")&&t.push($(e)):typeof e=="object"&&"type"in e&&e.type!=="value"&&t.push(e));}function Pe(t,e,i,r,n={}){let{isNewLine:o=true,isHashtagScript:p=false,isThreads:g=false}=n;return yi(t,e,i,r,{isNewLine:o,isHashtagScript:p,isThreads:g})}function yi(t,e,i,r,n){if(!e)return;let{isNewLine:o,isHashtagScript:p=false,isThreads:g}=n;if(p)Array.isArray(e)&&e.length>0&&t.push({operations:[{type:"operationtoconvert",values:e}],goNextStep:true});else if(typeof e=="string"&&e.startsWith("^")||e&&typeof e=="object"&&"type"in e&&e.type=="value"&&e.storageOperationType==="get"){if(!o&&t.length>0){let c=t[t.length-1];!c.glueEnabled&&!c.operations&&(c.glueEnabled=true,c.labelToOpen||(c.goNextStep=true)),t[t.length-1]=c;}typeof e=="string"?t.push(mi($(e))):t.push({dialogue:e});}else if(typeof e=="string"){if(e==="end")t.push({end:"game_end"});else if(e==="done")t.push({end:"label_end",goNextStep:true});else if(e=="<>")if(t.length>0){let c=t[t.length-1];c.glueEnabled=true,c.labelToOpen||(c.goNextStep=true),t[t.length-1]=c;}else t.push({glueEnabled:true,goNextStep:false});}else if(typeof e=="object"){if("type"in e&&e.type!=="value"){if(!o&&t.length>0){let c=t[t.length-1];!c.glueEnabled&&!c.operations&&(c.glueEnabled=true,c.labelToOpen||(c.goNextStep=true)),t[t.length-1]=c;}t.push({conditionalStep:e});}else if("->"in e){let c=o?void 0:true;if(!o&&t.length>0){let l=t[t.length-1];l.labelToOpen||(l.goNextStep=true),t[t.length-1]=l;}if(e.params&&e.params.length===0&&(e.params=void 0),e.var)t.push({labelToOpen:{label:q(e["->"],r),type:g?"call":"jump",params:e.params},glueEnabled:c});else {let l=Z(e["->"],i);if(!l)return;t.push({labelToOpen:{label:l,type:Se(l,g),params:e.params},glueEnabled:c});}}"type"in e&&e.type=="value"&&e.storageOperationType==="set"&&(typeof e.value=="string"&&e.value.startsWith("^")&&(e.value=$(e.value)),t.push({goNextStep:true,operations:[e]}));}}function mi(t){let e;if(t.includes(": ")){let i=t.split(": "),r=i[0],n=i.slice(1).join(": ");RegisteredCharacters.get(r)&&(e=r,t=n);}return e?{dialogue:{character:e,text:t}}:{dialogue:t}}function Ve(t,e,i,r=true,n=false){return Ti(t,e,i,r,n)}function Ti(t,e,i,r,n=false){e&&(typeof e=="string"&&e.startsWith("^")||e&&typeof e=="object"&&"type"in e&&e.type=="value"&&e.storageOperationType==="get"?typeof e=="string"?t.push($(e)):t.push(e):typeof e=="object"&&"type"in e&&t.push(e));}function se(t,e,i){if(t.length===0){d.error("Error parsing ink file: Arithmetic statement is not valid",t);return}let r=Y(t,e,i);if(r.length===1){let n=r[0];return n&&typeof n=="object"&&"type"in n?{type:"value",storageType:"logic",storageOperationType:"get",operation:n}:n}}function Q(t,e,i,r="",n,o,p=void 0){let g=[],c="sequential",l=false,s=true;t.forEach(y=>{y==="%"&&(c="loop"),y==="seq"&&(c="random"),y==="MIN"&&(l=true);});let d=t[t.length-1];return Object.keys(d).forEach(y=>{let T=d[y];if(Array.isArray(T)&&T.length>3){T=T.slice(1,T.length-2);let b=[];z(T,r,n,b,e,e,i,X,p,true,o),b.length===1?g.push(b[0]):g.push({type:"resulttocombine",combine:"cross",secondConditionalItem:b});}else Array.isArray(T)&&T.length===3&&(s=false);}),c==="sequential"?{type:"stepswitch",elements:g,choiceType:c,end:s?"lastItem":void 0,nestedId:p}:l&&c==="random"?{type:"stepswitch",elements:g,choiceType:"sequentialrandom",end:s?"lastItem":void 0,nestedId:p}:{type:"stepswitch",elements:g,choiceType:c}}function Ae(t="",e=""){let i=Array.isArray(t)?t:[t],r=Array.isArray(e)?e:[e];return [...new Set([...i,...r])]}function X(t,e,i,r,n){if(t.length>0){let o={};Ke(t,o,n);for(let[p,g]of Object.entries(o)){let c=i+"_|_"+p,l={text:g.text.length===1?g.text[0]:g.text,label:c,props:{},type:Se(c,false),oneTime:g.onetime};g.text.length===0&&(l.onlyHaveNoChoice=true,l.autoSelect=true),l.oneTime===false&&delete l.oneTime;let s=Oe(l,g.conditions,n,i)||l,d$1=e[e.length-1];if(typeof d$1=="object"&&d$1&&"type"in d$1&&(d$1={conditionalStep:d$1}),e.length>0&&typeof d$1=="object"&&d$1&&"choices"in d$1&&d$1.choices){let f=d$1.choices;f&&Array.isArray(f)?f.push(s):d.error("Unhandled case: choices is PixiVNJsonConditionalStatements<PixiVNJsonChoices> | undefined",g,f),d$1.choices=f.sort((y,T)=>{try{let b=y.label.split("."),m=b[b.length-1].replaceAll(".","_|_"),V=T.label.split("."),u=V[V.length-1].replaceAll(".","_|_");if(m.includes("c-")&&u.includes("c-")){let a=m.split("c-")[1],x=parseInt(a),h=u.split("c-")[1],v=parseInt(h);return x-v}}catch{}return 0});}else e.push({choices:[s]});g.preDialog&&(r.preDialog[c]={...g.preDialog});}}}function Ke(t,e,i,r){let n=[],o="",p="",g=false,c=[];for(let l=0;l<t.length;l++){let s=t[l];if(typeof s=="string")s.startsWith("^")?n.push($(s)):Ge.includes(s)&&c.push(s);else if(Array.isArray(s)&&s.includes("visit")){let d=Q(s,ae,(f,y,T)=>{},r,{preDialog:{}},i);n.push(d);}else if(s&&typeof s=="object")if("*"in s&&typeof s["*"]&&typeof s["*"]=="string")s["*"].includes("c")&&(o="c"+s["*"].split("c")[1],s.flg&16&&(g=true));else if("s"in s&&s.s instanceof Array){let d=Ze(s.s),f=s.s.includes("<>");d&&(r&&e[r]?(e[r].preDialog={text:d,glue:f},e[r].text=Ae(d,e[r].text)):(n.push(d),p=d));}else "CNT?"in s&&c.push(s);else c.push(s);if(o){e[o]?e[o].text=Ae(n,e[o].text):e[o]={text:n,onetime:g,conditions:c},p&&(e[o].preDialog={text:p,glue:false});let d=t.slice(l+1);Ke(d,e,i,o);return}}}function Ze(t){for(let e of t)if(typeof e=="string"){if(e.startsWith("^"))return $(e)}else if(e instanceof Array){let i=Ze(e);if(i)return i}}function Oe(t,e,i,r,n){if(e.length===0)return;let o=Y(e,r,i);if(o.length===1){let p={type:"ifelse",condition:o[0],then:t,else:n};return p.else||delete p.else,p}else if(o.length>1){let p={type:"ifelse",condition:{type:"union",unionType:"and",conditions:o},then:t,else:n};return p.else||delete p.else,p}}function et(t,e,i,r,n,o,p=void 0){if(t.length===0){d.error("Error parsing ink file: Conditional statement is not valid",t);return}let g=[],c=[];if(t.forEach(d=>{Array.isArray(d)?c.push(d):typeof d=="string"&&d==="du"?n.du?g.push(n.du):n.du=g[g.length-1]:(typeof d!="string"||d!=="/ev")&&g.push(d);}),c.length===0){d.error("Error parsing ink file: Conditional statement is not valid",c);return}let l=Ee(c[0],e,i,r+"_|_"+"then",n,o,`${p||""}then`),s;return c.length===2?s=Ee(c[1],e,i,r+"_|_"+"else",n,o,`${p||""}else`):c.length>2&&(c.shift(),c.push("nop"),c=[{b:c}],s=Ee(c,e,i,r+"_|_"+"else",n,o,`${p||""}else`)),n.du=void 0,Oe(l,g,o,r,s)}function Ee(t,e,i,r,n,o,p=void 0){let g=[];for(let l of t)typeof l=="object"&&"b"in l&&(l.b=l.b.filter(s=>s!==null&&!(typeof s=="object"&&"->"in s&&new RegExp(/.*\.[0-9]/).test(s["->"]))),z(l.b,r,n,g,e,e,i,X,p,true,o));return g.length===1?g[0]:{type:"resulttocombine",combine:"cross",secondConditionalItem:g}}function z(t,e,i,r=[],n,o,p,g,c=void 0,l=true,s=[]){let d$1=false,f=[],y=false,T=false,b=false,m=[],V=[];if(i.preDialog[e]&&(l=false,n(r,"^"+i.preDialog[e].text,e,s,{isNewLine:l,isHashtagScript:T,isThreads:b}),i.preDialog[e].glue&&n(r,"<>",e,s,{isNewLine:l,isHashtagScript:T,isThreads:b}),delete i.preDialog[e]),t.includes("visit")){let a=Q(t,o,p,e,i,s,c);a&&(!l&&r.length>0&&n(r,"<>",e,s,{isNewLine:l,isHashtagScript:T,isThreads:b}),n(r,a,e,s,{isNewLine:l,isHashtagScript:T,isThreads:b}));return}let u=t[0];if(u&&typeof u=="object"&&"temp="in u){for(;t[0]&&typeof t[0]=="object"&&"temp="in t[0];)s.push(t[0]["temp="]),t.shift();s=s.reverse();}if(t.forEach((a,x)=>{if(T){if(typeof a=="string"&&a=="/#"){let h=[];z(V,e,i,h,Ve,Ve,p,g,c,l),n(r,h,e,s,{isNewLine:l,isHashtagScript:T,isThreads:b}),T=false,V=[];}else V.push(a);return}else if(d$1)if(Array.isArray(a))f.push(a);else if(a&&typeof a=="object")if("CNT?"in a)x>0&&t[x-1]=="ev"?(y=true,m.push(a)):y?m.push(a):(f.push(a),l=false);else if("VAR="in a||"temp="in a){let h=ve("VAR="in a?a["VAR="]:a["temp="],s,t[x-1],"VAR="in a?"storage":"tempstorage");if(h.value&&typeof h.value=="string"&&h.value=="/str"&&(h.value=t[x-2]),h.value&&typeof h.value=="object"&&"^->"in h.value&&(h.value=h.value["^->"]),f.length>1){let v=se(f,e,s);f=[],v&&typeof v=="object"&&"type"in v&&v.type=="value"&&"storageType"in v&&v.storageType=="logic"&&(h.value=v.operation);}(typeof h.key!="string"||!h.key.includes("$r"))&&(n(r,h,e,s,{isNewLine:l,isHashtagScript:T,isThreads:b}),l=true);}else "VAR?"in a?f.push(a):"^->"in a&&(a["^->"].includes("$r")||f.push(a));else if(typeof a=="string"&&a=="/ev")y&&m.push(a),d$1=false,f.push(a);else if(typeof a=="string"&&a=="out"){if(f.length>0){let h=f[f.length-1];if(h&&typeof h=="object"&&"VAR?"in h){f.pop();let v=q(h["VAR?"],s,"storage");n(r,v,e,s,{isNewLine:l,isHashtagScript:T,isThreads:b});}else {let v=[];for(;f.length>0&&f[f.length-1]!="/ev";)v.push(f.pop());v=v.reverse();let N=se(v,e,s);f=[],N&&typeof N=="object"&&"type"in N&&N.type=="value"&&"storageType"in N&&N.storageType=="logic"?n(r,{storageOperationType:"get",storageType:"logic",operation:N.operation,type:"value"},e,s,{isNewLine:l,isHashtagScript:T,isThreads:b}):(n(r,"<>",e,s,{isNewLine:l,isHashtagScript:T,isThreads:b}),N=`^${N}`,n(r,N,e,s,{isNewLine:l,isHashtagScript:T,isThreads:b}));}l=false;}}else f.push(a);else if(typeof a=="string")if(a.startsWith("^"))n(r,a,e,s,{isNewLine:l,isHashtagScript:T,isThreads:b}),l=false;else if(a=="ev")d$1=true;else if(a==`
|