@drincs/pixi-vn-json 1.16.1 → 1.16.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- 'use strict';var s={version:"1.16.1"};var r="___param___",o=`https://pixi-vn.com/schemas/${s.version}/schema.json`,n=["==","!=","<","<=",">",">=","CONTAINS"];
1
+ 'use strict';var s={version:"1.16.2"};var r="___param___",o=`https://pixi-vn.com/schemas/${s.version}/schema.json`,n=["==","!=","<","<=",">",">=","CONTAINS"];
2
2
  exports.PIXIVNJSON_PARAM_ID=r;exports.PIXIVNJSON_SCHEMA_URL=o;exports.PixiVNJsonComparationOperators=n;
@@ -1,2 +1,2 @@
1
- var s={version:"1.16.1"};var r="___param___",o=`https://pixi-vn.com/schemas/${s.version}/schema.json`,n=["==","!=","<","<=",">",">=","CONTAINS"];
1
+ var s={version:"1.16.2"};var r="___param___",o=`https://pixi-vn.com/schemas/${s.version}/schema.json`,n=["==","!=","<","<=",">",">=","CONTAINS"];
2
2
  export{r as PIXIVNJSON_PARAM_ID,o as PIXIVNJSON_SCHEMA_URL,n as PixiVNJsonComparationOperators};
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';var actions=require('@drincs/pixi-vn-json/actions'),core=require('@drincs/pixi-vn-json/core'),interpreter=require('@drincs/pixi-vn-json/interpreter'),translator=require('@drincs/pixi-vn-json/translator');var t={version:"1.16.1"};var e="___param___",i=`https://pixi-vn.com/schemas/${t.version}/schema.json`,r=["==","!=","<","<=",">",">=","CONTAINS"];function I(){core.JsonUnifier.init({animateOperation:actions.animateOperation,animatedSpriteOperation:actions.animatedSpriteOperation,canvasElementOperation:actions.canvasElementOperation,canvasOperation:actions.canvasOperation,effectOperation:actions.effectOperation,imageContainerOperation:actions.imageContainerOperation,imageOperation:actions.imageOperation,textOperation:actions.textOperation,narrationOperation:actions.narrationOperation,loadAssets:actions.loadAssets,soundOperation:actions.soundOperation,videoOperation:actions.videoOperation,setStorageValue:actions.setStorageValue,setInitialStorageValue:actions.setInitialStorageValue,getLogichValue:actions.VariableGetter.getLogichValue,getConditionalStep:actions.getConditionalStep});}
1
+ 'use strict';var actions=require('@drincs/pixi-vn-json/actions'),core=require('@drincs/pixi-vn-json/core'),interpreter=require('@drincs/pixi-vn-json/interpreter'),translator=require('@drincs/pixi-vn-json/translator');var t={version:"1.16.2"};var e="___param___",i=`https://pixi-vn.com/schemas/${t.version}/schema.json`,r=["==","!=","<","<=",">",">=","CONTAINS"];function I(){core.JsonUnifier.init({animateOperation:actions.animateOperation,animatedSpriteOperation:actions.animatedSpriteOperation,canvasElementOperation:actions.canvasElementOperation,canvasOperation:actions.canvasOperation,effectOperation:actions.effectOperation,imageContainerOperation:actions.imageContainerOperation,imageOperation:actions.imageOperation,textOperation:actions.textOperation,narrationOperation:actions.narrationOperation,loadAssets:actions.loadAssets,soundOperation:actions.soundOperation,videoOperation:actions.videoOperation,setStorageValue:actions.setStorageValue,setInitialStorageValue:actions.setInitialStorageValue,getLogichValue:actions.VariableGetter.getLogichValue,getConditionalStep:actions.getConditionalStep});}
2
2
  Object.defineProperty(exports,"VariableGetter",{enumerable:true,get:function(){return actions.VariableGetter}});exports.PIXIVNJSON_PARAM_ID=e;exports.PIXIVNJSON_SCHEMA_URL=i;exports.PixiVNJsonComparationOperators=r;exports.init=I;Object.keys(interpreter).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return interpreter[k]}})});Object.keys(translator).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return translator[k]}})});
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import {getConditionalStep,VariableGetter,setInitialStorageValue,setStorageValue,videoOperation,soundOperation,loadAssets,narrationOperation,textOperation,imageOperation,imageContainerOperation,effectOperation,canvasOperation,canvasElementOperation,animatedSpriteOperation,animateOperation}from'@drincs/pixi-vn-json/actions';export{VariableGetter}from'@drincs/pixi-vn-json/actions';import {JsonUnifier}from'@drincs/pixi-vn-json/core';export*from'@drincs/pixi-vn-json/interpreter';export*from'@drincs/pixi-vn-json/translator';var t={version:"1.16.1"};var e="___param___",i=`https://pixi-vn.com/schemas/${t.version}/schema.json`,r=["==","!=","<","<=",">",">=","CONTAINS"];function I(){JsonUnifier.init({animateOperation:animateOperation,animatedSpriteOperation:animatedSpriteOperation,canvasElementOperation:canvasElementOperation,canvasOperation:canvasOperation,effectOperation:effectOperation,imageContainerOperation:imageContainerOperation,imageOperation:imageOperation,textOperation:textOperation,narrationOperation:narrationOperation,loadAssets:loadAssets,soundOperation:soundOperation,videoOperation:videoOperation,setStorageValue:setStorageValue,setInitialStorageValue:setInitialStorageValue,getLogichValue:VariableGetter.getLogichValue,getConditionalStep:getConditionalStep});}
1
+ import {getConditionalStep,VariableGetter,setInitialStorageValue,setStorageValue,videoOperation,soundOperation,loadAssets,narrationOperation,textOperation,imageOperation,imageContainerOperation,effectOperation,canvasOperation,canvasElementOperation,animatedSpriteOperation,animateOperation}from'@drincs/pixi-vn-json/actions';export{VariableGetter}from'@drincs/pixi-vn-json/actions';import {JsonUnifier}from'@drincs/pixi-vn-json/core';export*from'@drincs/pixi-vn-json/interpreter';export*from'@drincs/pixi-vn-json/translator';var t={version:"1.16.2"};var e="___param___",i=`https://pixi-vn.com/schemas/${t.version}/schema.json`,r=["==","!=","<","<=",">",">=","CONTAINS"];function I(){JsonUnifier.init({animateOperation:animateOperation,animatedSpriteOperation:animatedSpriteOperation,canvasElementOperation:canvasElementOperation,canvasOperation:canvasOperation,effectOperation:effectOperation,imageContainerOperation:imageContainerOperation,imageOperation:imageOperation,textOperation:textOperation,narrationOperation:narrationOperation,loadAssets:loadAssets,soundOperation:soundOperation,videoOperation:videoOperation,setStorageValue:setStorageValue,setInitialStorageValue:setInitialStorageValue,getLogichValue:VariableGetter.getLogichValue,getConditionalStep:getConditionalStep});}
2
2
  export{e as PIXIVNJSON_PARAM_ID,i as PIXIVNJSON_SCHEMA_URL,r as PixiVNJsonComparationOperators,I as init};
@@ -1 +1 @@
1
- 'use strict';var pixiVn=require('@drincs/pixi-vn'),core=require('@drincs/pixi-vn-json/core'),translator=require('@drincs/pixi-vn-json/translator'),narration=require('@drincs/pixi-vn/narration'),storage=require('@drincs/pixi-vn/storage');var Z=Object.create;var $=Object.defineProperty;var ee=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var te=Object.getPrototypeOf,ne=Object.prototype.hasOwnProperty;var k=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,o)=>(typeof require<"u"?require:e)[o]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var M=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var oe=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of ie(e))!ne.call(t,s)&&s!==o&&$(t,s,{get:()=>e[s],enumerable:!(n=ee(e,s))||n.enumerable});return t};var re=(t,e,o)=>(o=t!=null?Z(te(t)):{},oe($(o,"default",{value:t,enumerable:true}),t));var F=M((T,G)=>{(function(t,e){typeof T=="object"?G.exports=T=e():typeof define=="function"&&define.amd?define([],e):t.CryptoJS=e();})(T,function(){var t=t||(function(e,o){var n;if(typeof window<"u"&&window.crypto&&(n=window.crypto),typeof self<"u"&&self.crypto&&(n=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(n=globalThis.crypto),!n&&typeof window<"u"&&window.msCrypto&&(n=window.msCrypto),!n&&typeof global<"u"&&global.crypto&&(n=global.crypto),!n&&typeof k=="function")try{n=k("crypto");}catch{}var s=function(){if(n){if(typeof n.getRandomValues=="function")try{return n.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof n.randomBytes=="function")try{return n.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},p=Object.create||(function(){function i(){}return function(a){var c;return i.prototype=a,c=new i,i.prototype=null,c}})(),r={},x=r.lib={},f=x.Base=(function(){return {extend:function(i){var a=p(this);return i&&a.mixIn(i),(!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 i=this.extend();return i.init.apply(i,arguments),i},init:function(){},mixIn:function(i){for(var a in i)i.hasOwnProperty(a)&&(this[a]=i[a]);i.hasOwnProperty("toString")&&(this.toString=i.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),h=x.WordArray=f.extend({init:function(i,a){i=this.words=i||[],a!=o?this.sigBytes=a:this.sigBytes=i.length*4;},toString:function(i){return (i||J).stringify(this)},concat:function(i){var a=this.words,c=i.words,d=this.sigBytes,y=i.sigBytes;if(this.clamp(),d%4)for(var S=0;S<y;S++){var I=c[S>>>2]>>>24-S%4*8&255;a[d+S>>>2]|=I<<24-(d+S)%4*8;}else for(var C=0;C<y;C+=4)a[d+C>>>2]=c[C>>>2];return this.sigBytes+=y,this},clamp:function(){var i=this.words,a=this.sigBytes;i[a>>>2]&=4294967295<<32-a%4*8,i.length=e.ceil(a/4);},clone:function(){var i=f.clone.call(this);return i.words=this.words.slice(0),i},random:function(i){for(var a=[],c=0;c<i;c+=4)a.push(s());return new h.init(a,i)}}),u=r.enc={},J=u.Hex={stringify:function(i){for(var a=i.words,c=i.sigBytes,d=[],y=0;y<c;y++){var S=a[y>>>2]>>>24-y%4*8&255;d.push((S>>>4).toString(16)),d.push((S&15).toString(16));}return d.join("")},parse:function(i){for(var a=i.length,c=[],d=0;d<a;d+=2)c[d>>>3]|=parseInt(i.substr(d,2),16)<<24-d%8*4;return new h.init(c,a/2)}},V=u.Latin1={stringify:function(i){for(var a=i.words,c=i.sigBytes,d=[],y=0;y<c;y++){var S=a[y>>>2]>>>24-y%4*8&255;d.push(String.fromCharCode(S));}return d.join("")},parse:function(i){for(var a=i.length,c=[],d=0;d<a;d++)c[d>>>2]|=(i.charCodeAt(d)&255)<<24-d%4*8;return new h.init(c,a)}},g=u.Utf8={stringify:function(i){try{return decodeURIComponent(escape(V.stringify(i)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(i){return V.parse(unescape(encodeURIComponent(i)))}},l=x.BufferedBlockAlgorithm=f.extend({reset:function(){this._data=new h.init,this._nDataBytes=0;},_append:function(i){typeof i=="string"&&(i=g.parse(i)),this._data.concat(i),this._nDataBytes+=i.sigBytes;},_process:function(i){var a,c=this._data,d=c.words,y=c.sigBytes,S=this.blockSize,I=S*4,C=y/I;i?C=e.ceil(C):C=e.max((C|0)-this._minBufferSize,0);var _=C*S,H=e.min(_*4,y);if(_){for(var z=0;z<_;z+=S)this._doProcessBlock(d,z);a=d.splice(0,_),c.sigBytes-=H;}return new h.init(a,H)},clone:function(){var i=f.clone.call(this);return i._data=this._data.clone(),i},_minBufferSize:0});x.Hasher=l.extend({cfg:f.extend(),init:function(i){this.cfg=this.cfg.extend(i),this.reset();},reset:function(){l.reset.call(this),this._doReset();},update:function(i){return this._append(i),this._process(),this},finalize:function(i){i&&this._append(i);var a=this._doFinalize();return a},blockSize:512/32,_createHelper:function(i){return function(a,c){return new i.init(c).finalize(a)}},_createHmacHelper:function(i){return function(a,c){return new P.HMAC.init(i,c).finalize(a)}}});var P=r.algo={};return r})(Math);return t});});var K=M((E,X)=>{(function(t,e){typeof E=="object"?X.exports=E=e(F()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS);})(E,function(t){return (function(){var e=t,o=e.lib,n=o.WordArray,s=o.Hasher,p=e.algo,r=[],x=p.SHA1=s.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(f,h){for(var u=this._hash.words,J=u[0],V=u[1],g=u[2],l=u[3],w=u[4],P=0;P<80;P++){if(P<16)r[P]=f[h+P]|0;else {var i=r[P-3]^r[P-8]^r[P-14]^r[P-16];r[P]=i<<1|i>>>31;}var a=(J<<5|J>>>27)+w+r[P];P<20?a+=(V&g|~V&l)+1518500249:P<40?a+=(V^g^l)+1859775393:P<60?a+=(V&g|V&l|g&l)-1894007588:a+=(V^g^l)-899497514,w=l,l=g,g=V<<30|V>>>2,V=J,J=a;}u[0]=u[0]+J|0,u[1]=u[1]+V|0,u[2]=u[2]+g|0,u[3]=u[3]+l|0,u[4]=u[4]+w|0;},_doFinalize:function(){var f=this._data,h=f.words,u=this._nDataBytes*8,J=f.sigBytes*8;return h[J>>>5]|=128<<24-J%32,h[(J+64>>>9<<4)+14]=Math.floor(u/4294967296),h[(J+64>>>9<<4)+15]=u,f.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var f=s.clone.call(this);return f._hash=this._hash.clone(),f}});e.SHA1=s._createHelper(x),e.HmacSHA1=s._createHmacHelper(x);})(),t.SHA1});});var B="___param___";var m;(s=>(s.log=(p,...r)=>console.log(`[Pixi\u2019VN Json] ${p}`,...r),s.warn=(p,...r)=>console.warn(`[Pixi\u2019VN Json] ${p}`,...r),s.error=(p,...r)=>console.error(`[Pixi\u2019VN Json] ${p}`,...r),s.info=(p,...r)=>console.info(`[Pixi\u2019VN Json] ${p}`,...r)))(m||={});var j=class t{static init(e){e.loadAssets&&(t._loadAssets=e.loadAssets),e.soundOperation&&(t._soundOperation=e.soundOperation),e.imageOperation&&(t._imageOperation=e.imageOperation),e.videoOperation&&(t._videoOperation=e.videoOperation),e.animatedSpriteOperation&&(t._animatedSpriteOperation=e.animatedSpriteOperation),e.imageContainerOperation&&(t._imageContainerOperation=e.imageContainerOperation),e.textOperation&&(t._textOperation=e.textOperation),e.canvasElementOperation&&(t._canvasElementOperation=e.canvasElementOperation),e.setStorageValue&&(t._setStorageValue=e.setStorageValue),e.setInitialStorageValue&&(t._setInitialStorageValue=e.setInitialStorageValue),e.narrationOperation&&(t._narrationOperation=e.narrationOperation),e.effectOperation&&(t._effectOperation=e.effectOperation),e.animateOperation&&(t._animateOperation=e.animateOperation),e.canvasOperation&&(t._canvasOperation=e.canvasOperation),e.getLogichValue&&(t._getLogichValue=e.getLogichValue),e.getConditionalStep&&(t._getConditionalStep=e.getConditionalStep);}static _loadAssets=()=>{};static get loadAssets(){return t._loadAssets}static _soundOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get soundOperation(){return t._soundOperation}static _imageOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get imageOperation(){return t._imageOperation}static _videoOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get videoOperation(){return t._videoOperation}static _animatedSpriteOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get animatedSpriteOperation(){return t._animatedSpriteOperation}static _imageContainerOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get imageContainerOperation(){return t._imageContainerOperation}static _textOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get textOperation(){return t._textOperation}static _canvasElementOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get canvasElementOperation(){return t._canvasElementOperation}static _setStorageValue=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get setStorageValue(){return t._setStorageValue}static _setInitialStorageValue=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get setInitialStorageValue(){return t._setInitialStorageValue}static _narrationOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get narrationOperation(){return t._narrationOperation}static _effectOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get effectOperation(){return t._effectOperation}static _animateOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get animateOperation(){return t._animateOperation}static _canvasOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get canvasOperation(){return t._canvasOperation}static _getLogichValue=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get getLogichValue(){return t._getLogichValue}static _getConditionalStep=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get getConditionalStep(){return t._getConditionalStep}};function q(t,e){if(e&&typeof e=="object"&&typeof t.functionName=="string"&&t.functionName in e){let o=e[t.functionName];if(typeof o=="function"){let n=t.args.map(s=>j.getLogichValue(s,e));return o(...n)}else m.warn(`getLogichValue function ${t.functionName} not found in props`);}}function W(t,e={}){let o="";return t.values.forEach(n=>{if(typeof n=="string")o+=n;else {let s=core.JsonUnifier.getLogichValue(n,e);o+=`${s}`;}}),o}async function R(t,e,o){let n=core.JsonUnifier.getLogichValue(t,e);if(n)switch(n.type){case "sound":core.JsonUnifier.soundOperation(n);break;case "assets":case "bundle":await core.JsonUnifier.loadAssets(n);break;case "image":await core.JsonUnifier.imageOperation(n);break;case "video":await core.JsonUnifier.videoOperation(n);break;case "asprite":await core.JsonUnifier.animatedSpriteOperation(n);break;case "imagecontainer":await core.JsonUnifier.imageContainerOperation(n);break;case "text":await core.JsonUnifier.textOperation(n);break;case "canvaselement":await core.JsonUnifier.canvasElementOperation(n);break;case "canvas":core.JsonUnifier.canvasOperation(n);break;case "value":core.JsonUnifier.setStorageValue(n,e);break;case "operationtoconvert":if(o){let s=W(n,e),p=await o(s);p&&await R(p,e,o);}break;case "input":case "dialogue":core.JsonUnifier.narrationOperation(n);break;case "shake":await core.JsonUnifier.effectOperation(n);break;case "animate":case "animate-sequence":core.JsonUnifier.animateOperation(n);break;case "function":await q(n,e);break}}function D(t){let e=core.JsonUnifier.getLogichValue(t,{});e&&e.type==="value"&&e.storageOperationType==="set"&&(e.storageType==="storage"||e.storageType==="tempstorage")&&core.JsonUnifier.setInitialStorageValue(e);}var Y=re(K());var A=class extends narration.LabelAbstract{constructor(e,o,n,s={}){n||(n={}),n.onLoadingLabel=async()=>{for(let p of o){let r;if(typeof p=="function"?r=p():r=p,r=core.JsonUnifier.getConditionalStep(r),r.operations)try{let x=r.operations.map(f=>core.JsonUnifier.loadAssets(f));await Promise.all(x);}catch(x){m.error("The operation in the onLoadingLabel function of the label has an error:",x);}}},super(e,n),this._steps=o,this.operationStringConvert=s.operationStringConvert,this.skipEmptyDialogs=s.skipEmptyDialogs||false;}_steps;get steps(){return this._steps.map(e=>this.stepConverter(e))}get stepCount(){return this._steps.length}getStepById(e){if(e<0||e>=this._steps.length)return;let o=this._steps[e];return this.stepConverter(o)}operationStringConvert;skipEmptyDialogs=false;getStepSha(e){if(e<0||e>=this.steps.length)return;let o=this._steps[e];return (0, Y.default)(o.toString().toLocaleLowerCase()).toString()}getDialogueText(e,o){let n="";if(Array.isArray(e)){let s=[];e.forEach(p=>{if(typeof p=="string")s.push(p);else if(p&&typeof p=="object"){let r=core.JsonUnifier.getLogichValue(p,o);r?(r&&!Array.isArray(r)&&typeof r=="object"&&(r=core.JsonUnifier.getLogichValue(r,o)||""),Array.isArray(r)?s=s.map(x=>`${x}`).concat(r):s.push(`${r}`)):s.push(`${p}`);}else s.push(`${p}`);}),n=s;}else {let s=core.JsonUnifier.getLogichValue(e,o);s&&!Array.isArray(s)&&typeof s=="object"&&(s=core.JsonUnifier.getLogichValue(s,o)),s&&Array.isArray(s)?n=s.map(p=>`${p}`):n=`${s}`;}return n}getDialogue(e,o){if(e==null)return;let n=core.JsonUnifier.getLogichValue(e,o);return n==null?`${n}`:typeof n=="object"&&"character"in n&&"text"in n?{character:n.character,text:translator.translator.t(this.getDialogueText(n.text,o))}:translator.translator.t(this.getDialogueText(n,o))}getChoices(e,o){return core.JsonUnifier.getLogichValue(e,o)?.map(p=>core.JsonUnifier.getLogichValue(p,o)).filter(p=>p!==void 0)}stepConverter(e){return async o=>{let n=typeof e=="function"?e():e;n=pixiVn.createExportableElement(n),n=core.JsonUnifier.getConditionalStep(n,o);let s=this.operationStringConvert?g=>this.operationStringConvert(g,n,o):void 0,{operations:p=[]}=n;for(let g of p)await R(g,o,s);let{labelToOpen:r=[]}=n,x=this.getChoices(n.choices,o),f=core.JsonUnifier.getLogichValue(n.glueEnabled,o),h=this.getDialogue(n.dialogue,o),u=[];Array.isArray(r)||(r=[r]),r.forEach(g=>{let l=core.JsonUnifier.getLogichValue(g,o);l&&u.push(l);});let J=core.JsonUnifier.getLogichValue(n.goNextStep,o),V=core.JsonUnifier.getLogichValue(n.end,o);if(x){let g=x.map(l=>{let w="";if(Array.isArray(l.text)){let i=[];l.text.forEach(a=>{if(typeof a=="string")i.push(translator.translator.t(a));else if(a&&typeof a=="object"){let c=core.JsonUnifier.getLogichValue(a,o);c&&!Array.isArray(c)&&typeof c=="object"&&(c=core.JsonUnifier.getLogichValue(c,o)||""),c&&(Array.isArray(c)?i=i.concat(translator.translator.t(c)):i.push(translator.translator.t(c)));}}),w=i;}else typeof l.text=="string"&&(w=translator.translator.t(l.text));return {label:l.label,text:w,props:l.props,type:l.type,oneTime:l.oneTime,onlyHaveNoChoice:l.onlyHaveNoChoice,autoSelect:l.autoSelect}});narration.narration.choices=g;}else narration.narration.choices=void 0;h!==void 0&&(narration.narration.dialogue=h,this.skipEmptyDialogs&&typeof h=="string"&&(h===""||RegExp(/^\s+$/).test(h))&&(J=true)),f?narration.narration.dialogGlue=true:f===false&&(narration.narration.dialogGlue=false);for(let g of u){let l=g.label;typeof l=="object"&&(l=core.JsonUnifier.getLogichValue(l,o)||"");let w=g.params?.map(P=>core.JsonUnifier.getLogichValue(P,o));o={...o,...g.props},g.type==="jump"?(narration.narration.labels.opened.length>0&&narration.narration.labels.closeCurrent(),storage.storage.temp.set(`${B}${narration.narration.labels.opened.length}`,w),await narration.narration.call(l,o)):(storage.storage.temp.set(`${B}${narration.narration.labels.opened.length}`,w),await narration.narration.call(l,o));}V==="game_end"?(narration.narration.labels.closeAll(),await narration.narration.continue(o,{runNow:true})):V==="label_end"&&narration.narration.labels.closeCurrent(),J&&await narration.narration.continue(o,{runNow:true});}}};async function de(t,e={}){if(!Array.isArray(t))if(typeof t=="object"||typeof t=="string")t=[t];else {m.error("Error parsing imported Pixi'VN JSON: data is not an object");return}let o=t.map(p=>{if(typeof p=="string")try{return JSON.parse(p)}catch(r){return m.error("Error parsing imported Pixi'VN JSON",r),{}}return p}),n=o.map(async p=>{if(p.initialOperations)for(let r of p.initialOperations)r.type==="value"&&(typeof r.value!="object"||!r.value||!("type"in r.value))&&D(r);return Promise.resolve()});await Promise.all(n);let s=o.map(async p=>{if(p.initialOperations)for(let r of p.initialOperations)(r.type!=="value"||r.type==="value"&&typeof r.value=="object"&&r.value&&"type"in r.value)&&D(r);if(p.labels){let r=p.labels;for(let x in r)try{let f=r[x],h=new A(x,f,void 0,e);narration.RegisteredLabels.add(h);}catch(f){m.error(`Error creating JSON label ${x}`,f);}}return Promise.resolve()});await Promise.all(s);}exports.LabelJson=A;exports.importPixiVNJson=de;
1
+ 'use strict';var pixiVn=require('@drincs/pixi-vn'),core=require('@drincs/pixi-vn-json/core'),translator=require('@drincs/pixi-vn-json/translator'),narration=require('@drincs/pixi-vn/narration'),storage=require('@drincs/pixi-vn/storage');var Z=Object.create;var $=Object.defineProperty;var ee=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var te=Object.getPrototypeOf,ne=Object.prototype.hasOwnProperty;var k=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,o)=>(typeof require<"u"?require:e)[o]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var M=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var oe=(n,e,o,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of ie(e))!ne.call(n,s)&&s!==o&&$(n,s,{get:()=>e[s],enumerable:!(t=ee(e,s))||t.enumerable});return n};var re=(n,e,o)=>(o=n!=null?Z(te(n)):{},oe($(o,"default",{value:n,enumerable:true}),n));var F=M((T,G)=>{(function(n,e){typeof T=="object"?G.exports=T=e():typeof define=="function"&&define.amd?define([],e):n.CryptoJS=e();})(T,function(){var n=n||(function(e,o){var t;if(typeof window<"u"&&window.crypto&&(t=window.crypto),typeof self<"u"&&self.crypto&&(t=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(t=globalThis.crypto),!t&&typeof window<"u"&&window.msCrypto&&(t=window.msCrypto),!t&&typeof global<"u"&&global.crypto&&(t=global.crypto),!t&&typeof k=="function")try{t=k("crypto");}catch{}var s=function(){if(t){if(typeof t.getRandomValues=="function")try{return t.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof t.randomBytes=="function")try{return t.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},p=Object.create||(function(){function i(){}return function(a){var c;return i.prototype=a,c=new i,i.prototype=null,c}})(),r={},x=r.lib={},f=x.Base=(function(){return {extend:function(i){var a=p(this);return i&&a.mixIn(i),(!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 i=this.extend();return i.init.apply(i,arguments),i},init:function(){},mixIn:function(i){for(var a in i)i.hasOwnProperty(a)&&(this[a]=i[a]);i.hasOwnProperty("toString")&&(this.toString=i.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),h=x.WordArray=f.extend({init:function(i,a){i=this.words=i||[],a!=o?this.sigBytes=a:this.sigBytes=i.length*4;},toString:function(i){return (i||J).stringify(this)},concat:function(i){var a=this.words,c=i.words,d=this.sigBytes,y=i.sigBytes;if(this.clamp(),d%4)for(var S=0;S<y;S++){var I=c[S>>>2]>>>24-S%4*8&255;a[d+S>>>2]|=I<<24-(d+S)%4*8;}else for(var C=0;C<y;C+=4)a[d+C>>>2]=c[C>>>2];return this.sigBytes+=y,this},clamp:function(){var i=this.words,a=this.sigBytes;i[a>>>2]&=4294967295<<32-a%4*8,i.length=e.ceil(a/4);},clone:function(){var i=f.clone.call(this);return i.words=this.words.slice(0),i},random:function(i){for(var a=[],c=0;c<i;c+=4)a.push(s());return new h.init(a,i)}}),u=r.enc={},J=u.Hex={stringify:function(i){for(var a=i.words,c=i.sigBytes,d=[],y=0;y<c;y++){var S=a[y>>>2]>>>24-y%4*8&255;d.push((S>>>4).toString(16)),d.push((S&15).toString(16));}return d.join("")},parse:function(i){for(var a=i.length,c=[],d=0;d<a;d+=2)c[d>>>3]|=parseInt(i.substr(d,2),16)<<24-d%8*4;return new h.init(c,a/2)}},V=u.Latin1={stringify:function(i){for(var a=i.words,c=i.sigBytes,d=[],y=0;y<c;y++){var S=a[y>>>2]>>>24-y%4*8&255;d.push(String.fromCharCode(S));}return d.join("")},parse:function(i){for(var a=i.length,c=[],d=0;d<a;d++)c[d>>>2]|=(i.charCodeAt(d)&255)<<24-d%4*8;return new h.init(c,a)}},g=u.Utf8={stringify:function(i){try{return decodeURIComponent(escape(V.stringify(i)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(i){return V.parse(unescape(encodeURIComponent(i)))}},l=x.BufferedBlockAlgorithm=f.extend({reset:function(){this._data=new h.init,this._nDataBytes=0;},_append:function(i){typeof i=="string"&&(i=g.parse(i)),this._data.concat(i),this._nDataBytes+=i.sigBytes;},_process:function(i){var a,c=this._data,d=c.words,y=c.sigBytes,S=this.blockSize,I=S*4,C=y/I;i?C=e.ceil(C):C=e.max((C|0)-this._minBufferSize,0);var _=C*S,H=e.min(_*4,y);if(_){for(var z=0;z<_;z+=S)this._doProcessBlock(d,z);a=d.splice(0,_),c.sigBytes-=H;}return new h.init(a,H)},clone:function(){var i=f.clone.call(this);return i._data=this._data.clone(),i},_minBufferSize:0});x.Hasher=l.extend({cfg:f.extend(),init:function(i){this.cfg=this.cfg.extend(i),this.reset();},reset:function(){l.reset.call(this),this._doReset();},update:function(i){return this._append(i),this._process(),this},finalize:function(i){i&&this._append(i);var a=this._doFinalize();return a},blockSize:512/32,_createHelper:function(i){return function(a,c){return new i.init(c).finalize(a)}},_createHmacHelper:function(i){return function(a,c){return new P.HMAC.init(i,c).finalize(a)}}});var P=r.algo={};return r})(Math);return n});});var K=M((E,X)=>{(function(n,e){typeof E=="object"?X.exports=E=e(F()):typeof define=="function"&&define.amd?define(["./core"],e):e(n.CryptoJS);})(E,function(n){return (function(){var e=n,o=e.lib,t=o.WordArray,s=o.Hasher,p=e.algo,r=[],x=p.SHA1=s.extend({_doReset:function(){this._hash=new t.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(f,h){for(var u=this._hash.words,J=u[0],V=u[1],g=u[2],l=u[3],w=u[4],P=0;P<80;P++){if(P<16)r[P]=f[h+P]|0;else {var i=r[P-3]^r[P-8]^r[P-14]^r[P-16];r[P]=i<<1|i>>>31;}var a=(J<<5|J>>>27)+w+r[P];P<20?a+=(V&g|~V&l)+1518500249:P<40?a+=(V^g^l)+1859775393:P<60?a+=(V&g|V&l|g&l)-1894007588:a+=(V^g^l)-899497514,w=l,l=g,g=V<<30|V>>>2,V=J,J=a;}u[0]=u[0]+J|0,u[1]=u[1]+V|0,u[2]=u[2]+g|0,u[3]=u[3]+l|0,u[4]=u[4]+w|0;},_doFinalize:function(){var f=this._data,h=f.words,u=this._nDataBytes*8,J=f.sigBytes*8;return h[J>>>5]|=128<<24-J%32,h[(J+64>>>9<<4)+14]=Math.floor(u/4294967296),h[(J+64>>>9<<4)+15]=u,f.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var f=s.clone.call(this);return f._hash=this._hash.clone(),f}});e.SHA1=s._createHelper(x),e.HmacSHA1=s._createHmacHelper(x);})(),n.SHA1});});var B="___param___";var m;(s=>(s.log=(p,...r)=>console.log(`[Pixi\u2019VN Json] ${p}`,...r),s.warn=(p,...r)=>console.warn(`[Pixi\u2019VN Json] ${p}`,...r),s.error=(p,...r)=>console.error(`[Pixi\u2019VN Json] ${p}`,...r),s.info=(p,...r)=>console.info(`[Pixi\u2019VN Json] ${p}`,...r)))(m||={});var j=class n{static init(e){e.loadAssets&&(n._loadAssets=e.loadAssets),e.soundOperation&&(n._soundOperation=e.soundOperation),e.imageOperation&&(n._imageOperation=e.imageOperation),e.videoOperation&&(n._videoOperation=e.videoOperation),e.animatedSpriteOperation&&(n._animatedSpriteOperation=e.animatedSpriteOperation),e.imageContainerOperation&&(n._imageContainerOperation=e.imageContainerOperation),e.textOperation&&(n._textOperation=e.textOperation),e.canvasElementOperation&&(n._canvasElementOperation=e.canvasElementOperation),e.setStorageValue&&(n._setStorageValue=e.setStorageValue),e.setInitialStorageValue&&(n._setInitialStorageValue=e.setInitialStorageValue),e.narrationOperation&&(n._narrationOperation=e.narrationOperation),e.effectOperation&&(n._effectOperation=e.effectOperation),e.animateOperation&&(n._animateOperation=e.animateOperation),e.canvasOperation&&(n._canvasOperation=e.canvasOperation),e.getLogichValue&&(n._getLogichValue=e.getLogichValue),e.getConditionalStep&&(n._getConditionalStep=e.getConditionalStep);}static _loadAssets=()=>{};static get loadAssets(){return n._loadAssets}static _soundOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get soundOperation(){return n._soundOperation}static _imageOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get imageOperation(){return n._imageOperation}static _videoOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get videoOperation(){return n._videoOperation}static _animatedSpriteOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get animatedSpriteOperation(){return n._animatedSpriteOperation}static _imageContainerOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get imageContainerOperation(){return n._imageContainerOperation}static _textOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get textOperation(){return n._textOperation}static _canvasElementOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get canvasElementOperation(){return n._canvasElementOperation}static _setStorageValue=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get setStorageValue(){return n._setStorageValue}static _setInitialStorageValue=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get setInitialStorageValue(){return n._setInitialStorageValue}static _narrationOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get narrationOperation(){return n._narrationOperation}static _effectOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get effectOperation(){return n._effectOperation}static _animateOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get animateOperation(){return n._animateOperation}static _canvasOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get canvasOperation(){return n._canvasOperation}static _getLogichValue=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get getLogichValue(){return n._getLogichValue}static _getConditionalStep=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get getConditionalStep(){return n._getConditionalStep}};function q(n,e){if(e&&typeof e=="object"&&typeof n.functionName=="string"&&n.functionName in e){let o=e[n.functionName];if(typeof o=="function"){let t=n.args.map(s=>j.getLogichValue(s,e));return o(...t)}else m.warn(`getLogichValue function ${n.functionName} not found in props`);}}function W(n,e={}){let o="";return n.values.forEach(t=>{if(typeof t=="string")o+=t;else {let s=core.JsonUnifier.getLogichValue(t,e);o+=`${s}`;}}),o}async function R(n,e,o){let t=core.JsonUnifier.getLogichValue(n,e);if(t)switch(t.type){case "sound":core.JsonUnifier.soundOperation(t);break;case "assets":case "bundle":await core.JsonUnifier.loadAssets(t);break;case "image":await core.JsonUnifier.imageOperation(t);break;case "video":await core.JsonUnifier.videoOperation(t);break;case "asprite":await core.JsonUnifier.animatedSpriteOperation(t);break;case "imagecontainer":await core.JsonUnifier.imageContainerOperation(t);break;case "text":await core.JsonUnifier.textOperation(t);break;case "canvaselement":await core.JsonUnifier.canvasElementOperation(t);break;case "canvas":core.JsonUnifier.canvasOperation(t);break;case "value":core.JsonUnifier.setStorageValue(t,e);break;case "operationtoconvert":if(o){let s=W(t,e),p=await o(s);p&&await R(p,e,o);}break;case "input":case "dialogue":core.JsonUnifier.narrationOperation(t);break;case "shake":await core.JsonUnifier.effectOperation(t);break;case "animate":case "animate-sequence":core.JsonUnifier.animateOperation(t);break;case "function":await q(t,e);break}}function D(n){let e=core.JsonUnifier.getLogichValue(n,{});e&&e.type==="value"&&e.storageOperationType==="set"&&(e.storageType==="storage"||e.storageType==="tempstorage")&&core.JsonUnifier.setInitialStorageValue(e);}var Y=re(K());var A=class extends narration.LabelAbstract{constructor(e,o,t,s={}){t||(t={}),t.onLoadingLabel=async()=>{for(let p of o){let r;if(typeof p=="function"?r=p():r=p,r=core.JsonUnifier.getConditionalStep(r),r.operations)try{let x=r.operations.map(f=>core.JsonUnifier.loadAssets(f));await Promise.all(x);}catch(x){m.error("The operation in the onLoadingLabel function of the label has an error:",x);}}},super(e,t),this._steps=o,this.operationStringConvert=s.operationStringConvert,this.skipEmptyDialogs=s.skipEmptyDialogs||false;}_steps;get steps(){return this._steps.map(e=>this.stepConverter(e))}get stepCount(){return this._steps.length}getStepById(e){if(e<0||e>=this._steps.length)return;let o=this._steps[e];return this.stepConverter(o)}operationStringConvert;skipEmptyDialogs=false;getStepSha(e){if(e<0||e>=this._steps.length)return;let o=this._steps[e],t=typeof o=="function"?o.toString():JSON.stringify(o);return (0, Y.default)(t).toString()}getDialogueText(e,o){let t="";if(Array.isArray(e)){let s=[];e.forEach(p=>{if(typeof p=="string")s.push(p);else if(p&&typeof p=="object"){let r=core.JsonUnifier.getLogichValue(p,o);r?(r&&!Array.isArray(r)&&typeof r=="object"&&(r=core.JsonUnifier.getLogichValue(r,o)||""),Array.isArray(r)?s=s.map(x=>`${x}`).concat(r):s.push(`${r}`)):s.push(`${p}`);}else s.push(`${p}`);}),t=s;}else {let s=core.JsonUnifier.getLogichValue(e,o);s&&!Array.isArray(s)&&typeof s=="object"&&(s=core.JsonUnifier.getLogichValue(s,o)),s&&Array.isArray(s)?t=s.map(p=>`${p}`):t=`${s}`;}return t}getDialogue(e,o){if(e==null)return;let t=core.JsonUnifier.getLogichValue(e,o);return t==null?`${t}`:typeof t=="object"&&"character"in t&&"text"in t?{character:t.character,text:translator.translator.t(this.getDialogueText(t.text,o))}:translator.translator.t(this.getDialogueText(t,o))}getChoices(e,o){return core.JsonUnifier.getLogichValue(e,o)?.map(p=>core.JsonUnifier.getLogichValue(p,o)).filter(p=>p!==void 0)}stepConverter(e){return async o=>{let t=typeof e=="function"?e():e;t=pixiVn.createExportableElement(t),t=core.JsonUnifier.getConditionalStep(t,o);let s=this.operationStringConvert?g=>this.operationStringConvert(g,t,o):void 0,{operations:p=[]}=t;for(let g of p)await R(g,o,s);let{labelToOpen:r=[]}=t,x=this.getChoices(t.choices,o),f=core.JsonUnifier.getLogichValue(t.glueEnabled,o),h=this.getDialogue(t.dialogue,o),u=[];Array.isArray(r)||(r=[r]),r.forEach(g=>{let l=core.JsonUnifier.getLogichValue(g,o);l&&u.push(l);});let J=core.JsonUnifier.getLogichValue(t.goNextStep,o),V=core.JsonUnifier.getLogichValue(t.end,o);if(x){let g=x.map(l=>{let w="";if(Array.isArray(l.text)){let i=[];l.text.forEach(a=>{if(typeof a=="string")i.push(translator.translator.t(a));else if(a&&typeof a=="object"){let c=core.JsonUnifier.getLogichValue(a,o);c&&!Array.isArray(c)&&typeof c=="object"&&(c=core.JsonUnifier.getLogichValue(c,o)||""),c&&(Array.isArray(c)?i=i.concat(translator.translator.t(c)):i.push(translator.translator.t(c)));}}),w=i;}else typeof l.text=="string"&&(w=translator.translator.t(l.text));return {label:l.label,text:w,props:l.props,type:l.type,oneTime:l.oneTime,onlyHaveNoChoice:l.onlyHaveNoChoice,autoSelect:l.autoSelect}});narration.narration.choices=g;}else narration.narration.choices=void 0;h!==void 0&&(narration.narration.dialogue=h,this.skipEmptyDialogs&&typeof h=="string"&&(h===""||RegExp(/^\s+$/).test(h))&&(J=true)),f?narration.narration.dialogGlue=true:f===false&&(narration.narration.dialogGlue=false);for(let g of u){let l=g.label;typeof l=="object"&&(l=core.JsonUnifier.getLogichValue(l,o)||"");let w=g.params?.map(P=>core.JsonUnifier.getLogichValue(P,o));o={...o,...g.props},g.type==="jump"?(narration.narration.labels.opened.length>0&&narration.narration.labels.closeCurrent(),storage.storage.temp.set(`${B}${narration.narration.labels.opened.length}`,w),await narration.narration.call(l,o)):(storage.storage.temp.set(`${B}${narration.narration.labels.opened.length}`,w),await narration.narration.call(l,o));}V==="game_end"?(narration.narration.labels.closeAll(),await narration.narration.continue(o,{runNow:true})):V==="label_end"&&narration.narration.labels.closeCurrent(),J&&await narration.narration.continue(o,{runNow:true});}}};async function de(n,e={}){if(!Array.isArray(n))if(typeof n=="object"||typeof n=="string")n=[n];else {m.error("Error parsing imported Pixi'VN JSON: data is not an object");return}let o=n.map(p=>{if(typeof p=="string")try{return JSON.parse(p)}catch(r){return m.error("Error parsing imported Pixi'VN JSON",r),{}}return p}),t=o.map(async p=>{if(p.initialOperations)for(let r of p.initialOperations)r.type==="value"&&(typeof r.value!="object"||!r.value||!("type"in r.value))&&D(r);return Promise.resolve()});await Promise.all(t);let s=o.map(async p=>{if(p.initialOperations)for(let r of p.initialOperations)(r.type!=="value"||r.type==="value"&&typeof r.value=="object"&&r.value&&"type"in r.value)&&D(r);if(p.labels){let r=p.labels;for(let x in r)try{let f=r[x],h=new A(x,f,void 0,e);narration.RegisteredLabels.add(h);}catch(f){m.error(`Error creating JSON label ${x}`,f);}}return Promise.resolve()});await Promise.all(s);}exports.LabelJson=A;exports.importPixiVNJson=de;
@@ -41,8 +41,9 @@ declare class LabelJson<T extends {} = object> extends LabelAbstract<LabelJson<T
41
41
  private operationStringConvert?;
42
42
  private skipEmptyDialogs;
43
43
  /**
44
- * Returns the SHA-1 hash of the raw step at the given index.
45
- * Can be used to detect step changes across label reloads.
44
+ * Returns the SHA-1 hash of the raw step at the given index: its JSON for a plain step, its
45
+ * source code for a step factory function. Pixi'VN uses it to detect step changes when a save
46
+ * is loaded after a game update.
46
47
  *
47
48
  * @param index - Zero-based index of the step.
48
49
  * @returns The hex SHA-1 string, or `undefined` if the index is out of range.
@@ -41,8 +41,9 @@ declare class LabelJson<T extends {} = object> extends LabelAbstract<LabelJson<T
41
41
  private operationStringConvert?;
42
42
  private skipEmptyDialogs;
43
43
  /**
44
- * Returns the SHA-1 hash of the raw step at the given index.
45
- * Can be used to detect step changes across label reloads.
44
+ * Returns the SHA-1 hash of the raw step at the given index: its JSON for a plain step, its
45
+ * source code for a step factory function. Pixi'VN uses it to detect step changes when a save
46
+ * is loaded after a game update.
46
47
  *
47
48
  * @param index - Zero-based index of the step.
48
49
  * @returns The hex SHA-1 string, or `undefined` if the index is out of range.
@@ -1 +1 @@
1
- import {createExportableElement,PixiError}from'@drincs/pixi-vn';import {JsonUnifier}from'@drincs/pixi-vn-json/core';import {translator}from'@drincs/pixi-vn-json/translator';import {LabelAbstract,narration,RegisteredLabels}from'@drincs/pixi-vn/narration';import {storage}from'@drincs/pixi-vn/storage';var Z=Object.create;var $=Object.defineProperty;var ee=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var te=Object.getPrototypeOf,ne=Object.prototype.hasOwnProperty;var k=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,o)=>(typeof require<"u"?require:e)[o]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var M=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var oe=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of ie(e))!ne.call(t,s)&&s!==o&&$(t,s,{get:()=>e[s],enumerable:!(n=ee(e,s))||n.enumerable});return t};var re=(t,e,o)=>(o=t!=null?Z(te(t)):{},oe($(o,"default",{value:t,enumerable:true}),t));var F=M((T,G)=>{(function(t,e){typeof T=="object"?G.exports=T=e():typeof define=="function"&&define.amd?define([],e):t.CryptoJS=e();})(T,function(){var t=t||(function(e,o){var n;if(typeof window<"u"&&window.crypto&&(n=window.crypto),typeof self<"u"&&self.crypto&&(n=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(n=globalThis.crypto),!n&&typeof window<"u"&&window.msCrypto&&(n=window.msCrypto),!n&&typeof global<"u"&&global.crypto&&(n=global.crypto),!n&&typeof k=="function")try{n=k("crypto");}catch{}var s=function(){if(n){if(typeof n.getRandomValues=="function")try{return n.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof n.randomBytes=="function")try{return n.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},p=Object.create||(function(){function i(){}return function(a){var c;return i.prototype=a,c=new i,i.prototype=null,c}})(),r={},x=r.lib={},f=x.Base=(function(){return {extend:function(i){var a=p(this);return i&&a.mixIn(i),(!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 i=this.extend();return i.init.apply(i,arguments),i},init:function(){},mixIn:function(i){for(var a in i)i.hasOwnProperty(a)&&(this[a]=i[a]);i.hasOwnProperty("toString")&&(this.toString=i.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),h=x.WordArray=f.extend({init:function(i,a){i=this.words=i||[],a!=o?this.sigBytes=a:this.sigBytes=i.length*4;},toString:function(i){return (i||J).stringify(this)},concat:function(i){var a=this.words,c=i.words,d=this.sigBytes,y=i.sigBytes;if(this.clamp(),d%4)for(var S=0;S<y;S++){var I=c[S>>>2]>>>24-S%4*8&255;a[d+S>>>2]|=I<<24-(d+S)%4*8;}else for(var C=0;C<y;C+=4)a[d+C>>>2]=c[C>>>2];return this.sigBytes+=y,this},clamp:function(){var i=this.words,a=this.sigBytes;i[a>>>2]&=4294967295<<32-a%4*8,i.length=e.ceil(a/4);},clone:function(){var i=f.clone.call(this);return i.words=this.words.slice(0),i},random:function(i){for(var a=[],c=0;c<i;c+=4)a.push(s());return new h.init(a,i)}}),u=r.enc={},J=u.Hex={stringify:function(i){for(var a=i.words,c=i.sigBytes,d=[],y=0;y<c;y++){var S=a[y>>>2]>>>24-y%4*8&255;d.push((S>>>4).toString(16)),d.push((S&15).toString(16));}return d.join("")},parse:function(i){for(var a=i.length,c=[],d=0;d<a;d+=2)c[d>>>3]|=parseInt(i.substr(d,2),16)<<24-d%8*4;return new h.init(c,a/2)}},V=u.Latin1={stringify:function(i){for(var a=i.words,c=i.sigBytes,d=[],y=0;y<c;y++){var S=a[y>>>2]>>>24-y%4*8&255;d.push(String.fromCharCode(S));}return d.join("")},parse:function(i){for(var a=i.length,c=[],d=0;d<a;d++)c[d>>>2]|=(i.charCodeAt(d)&255)<<24-d%4*8;return new h.init(c,a)}},g=u.Utf8={stringify:function(i){try{return decodeURIComponent(escape(V.stringify(i)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(i){return V.parse(unescape(encodeURIComponent(i)))}},l=x.BufferedBlockAlgorithm=f.extend({reset:function(){this._data=new h.init,this._nDataBytes=0;},_append:function(i){typeof i=="string"&&(i=g.parse(i)),this._data.concat(i),this._nDataBytes+=i.sigBytes;},_process:function(i){var a,c=this._data,d=c.words,y=c.sigBytes,S=this.blockSize,I=S*4,C=y/I;i?C=e.ceil(C):C=e.max((C|0)-this._minBufferSize,0);var _=C*S,H=e.min(_*4,y);if(_){for(var z=0;z<_;z+=S)this._doProcessBlock(d,z);a=d.splice(0,_),c.sigBytes-=H;}return new h.init(a,H)},clone:function(){var i=f.clone.call(this);return i._data=this._data.clone(),i},_minBufferSize:0});x.Hasher=l.extend({cfg:f.extend(),init:function(i){this.cfg=this.cfg.extend(i),this.reset();},reset:function(){l.reset.call(this),this._doReset();},update:function(i){return this._append(i),this._process(),this},finalize:function(i){i&&this._append(i);var a=this._doFinalize();return a},blockSize:512/32,_createHelper:function(i){return function(a,c){return new i.init(c).finalize(a)}},_createHmacHelper:function(i){return function(a,c){return new P.HMAC.init(i,c).finalize(a)}}});var P=r.algo={};return r})(Math);return t});});var K=M((E,X)=>{(function(t,e){typeof E=="object"?X.exports=E=e(F()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS);})(E,function(t){return (function(){var e=t,o=e.lib,n=o.WordArray,s=o.Hasher,p=e.algo,r=[],x=p.SHA1=s.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(f,h){for(var u=this._hash.words,J=u[0],V=u[1],g=u[2],l=u[3],w=u[4],P=0;P<80;P++){if(P<16)r[P]=f[h+P]|0;else {var i=r[P-3]^r[P-8]^r[P-14]^r[P-16];r[P]=i<<1|i>>>31;}var a=(J<<5|J>>>27)+w+r[P];P<20?a+=(V&g|~V&l)+1518500249:P<40?a+=(V^g^l)+1859775393:P<60?a+=(V&g|V&l|g&l)-1894007588:a+=(V^g^l)-899497514,w=l,l=g,g=V<<30|V>>>2,V=J,J=a;}u[0]=u[0]+J|0,u[1]=u[1]+V|0,u[2]=u[2]+g|0,u[3]=u[3]+l|0,u[4]=u[4]+w|0;},_doFinalize:function(){var f=this._data,h=f.words,u=this._nDataBytes*8,J=f.sigBytes*8;return h[J>>>5]|=128<<24-J%32,h[(J+64>>>9<<4)+14]=Math.floor(u/4294967296),h[(J+64>>>9<<4)+15]=u,f.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var f=s.clone.call(this);return f._hash=this._hash.clone(),f}});e.SHA1=s._createHelper(x),e.HmacSHA1=s._createHmacHelper(x);})(),t.SHA1});});var B="___param___";var m;(s=>(s.log=(p,...r)=>console.log(`[Pixi\u2019VN Json] ${p}`,...r),s.warn=(p,...r)=>console.warn(`[Pixi\u2019VN Json] ${p}`,...r),s.error=(p,...r)=>console.error(`[Pixi\u2019VN Json] ${p}`,...r),s.info=(p,...r)=>console.info(`[Pixi\u2019VN Json] ${p}`,...r)))(m||={});var j=class t{static init(e){e.loadAssets&&(t._loadAssets=e.loadAssets),e.soundOperation&&(t._soundOperation=e.soundOperation),e.imageOperation&&(t._imageOperation=e.imageOperation),e.videoOperation&&(t._videoOperation=e.videoOperation),e.animatedSpriteOperation&&(t._animatedSpriteOperation=e.animatedSpriteOperation),e.imageContainerOperation&&(t._imageContainerOperation=e.imageContainerOperation),e.textOperation&&(t._textOperation=e.textOperation),e.canvasElementOperation&&(t._canvasElementOperation=e.canvasElementOperation),e.setStorageValue&&(t._setStorageValue=e.setStorageValue),e.setInitialStorageValue&&(t._setInitialStorageValue=e.setInitialStorageValue),e.narrationOperation&&(t._narrationOperation=e.narrationOperation),e.effectOperation&&(t._effectOperation=e.effectOperation),e.animateOperation&&(t._animateOperation=e.animateOperation),e.canvasOperation&&(t._canvasOperation=e.canvasOperation),e.getLogichValue&&(t._getLogichValue=e.getLogichValue),e.getConditionalStep&&(t._getConditionalStep=e.getConditionalStep);}static _loadAssets=()=>{};static get loadAssets(){return t._loadAssets}static _soundOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get soundOperation(){return t._soundOperation}static _imageOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get imageOperation(){return t._imageOperation}static _videoOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get videoOperation(){return t._videoOperation}static _animatedSpriteOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get animatedSpriteOperation(){return t._animatedSpriteOperation}static _imageContainerOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get imageContainerOperation(){return t._imageContainerOperation}static _textOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get textOperation(){return t._textOperation}static _canvasElementOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get canvasElementOperation(){return t._canvasElementOperation}static _setStorageValue=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get setStorageValue(){return t._setStorageValue}static _setInitialStorageValue=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get setInitialStorageValue(){return t._setInitialStorageValue}static _narrationOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get narrationOperation(){return t._narrationOperation}static _effectOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get effectOperation(){return t._effectOperation}static _animateOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get animateOperation(){return t._animateOperation}static _canvasOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get canvasOperation(){return t._canvasOperation}static _getLogichValue=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get getLogichValue(){return t._getLogichValue}static _getConditionalStep=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get getConditionalStep(){return t._getConditionalStep}};function q(t,e){if(e&&typeof e=="object"&&typeof t.functionName=="string"&&t.functionName in e){let o=e[t.functionName];if(typeof o=="function"){let n=t.args.map(s=>j.getLogichValue(s,e));return o(...n)}else m.warn(`getLogichValue function ${t.functionName} not found in props`);}}function W(t,e={}){let o="";return t.values.forEach(n=>{if(typeof n=="string")o+=n;else {let s=JsonUnifier.getLogichValue(n,e);o+=`${s}`;}}),o}async function R(t,e,o){let n=JsonUnifier.getLogichValue(t,e);if(n)switch(n.type){case "sound":JsonUnifier.soundOperation(n);break;case "assets":case "bundle":await JsonUnifier.loadAssets(n);break;case "image":await JsonUnifier.imageOperation(n);break;case "video":await JsonUnifier.videoOperation(n);break;case "asprite":await JsonUnifier.animatedSpriteOperation(n);break;case "imagecontainer":await JsonUnifier.imageContainerOperation(n);break;case "text":await JsonUnifier.textOperation(n);break;case "canvaselement":await JsonUnifier.canvasElementOperation(n);break;case "canvas":JsonUnifier.canvasOperation(n);break;case "value":JsonUnifier.setStorageValue(n,e);break;case "operationtoconvert":if(o){let s=W(n,e),p=await o(s);p&&await R(p,e,o);}break;case "input":case "dialogue":JsonUnifier.narrationOperation(n);break;case "shake":await JsonUnifier.effectOperation(n);break;case "animate":case "animate-sequence":JsonUnifier.animateOperation(n);break;case "function":await q(n,e);break}}function D(t){let e=JsonUnifier.getLogichValue(t,{});e&&e.type==="value"&&e.storageOperationType==="set"&&(e.storageType==="storage"||e.storageType==="tempstorage")&&JsonUnifier.setInitialStorageValue(e);}var Y=re(K());var A=class extends LabelAbstract{constructor(e,o,n,s={}){n||(n={}),n.onLoadingLabel=async()=>{for(let p of o){let r;if(typeof p=="function"?r=p():r=p,r=JsonUnifier.getConditionalStep(r),r.operations)try{let x=r.operations.map(f=>JsonUnifier.loadAssets(f));await Promise.all(x);}catch(x){m.error("The operation in the onLoadingLabel function of the label has an error:",x);}}},super(e,n),this._steps=o,this.operationStringConvert=s.operationStringConvert,this.skipEmptyDialogs=s.skipEmptyDialogs||false;}_steps;get steps(){return this._steps.map(e=>this.stepConverter(e))}get stepCount(){return this._steps.length}getStepById(e){if(e<0||e>=this._steps.length)return;let o=this._steps[e];return this.stepConverter(o)}operationStringConvert;skipEmptyDialogs=false;getStepSha(e){if(e<0||e>=this.steps.length)return;let o=this._steps[e];return (0, Y.default)(o.toString().toLocaleLowerCase()).toString()}getDialogueText(e,o){let n="";if(Array.isArray(e)){let s=[];e.forEach(p=>{if(typeof p=="string")s.push(p);else if(p&&typeof p=="object"){let r=JsonUnifier.getLogichValue(p,o);r?(r&&!Array.isArray(r)&&typeof r=="object"&&(r=JsonUnifier.getLogichValue(r,o)||""),Array.isArray(r)?s=s.map(x=>`${x}`).concat(r):s.push(`${r}`)):s.push(`${p}`);}else s.push(`${p}`);}),n=s;}else {let s=JsonUnifier.getLogichValue(e,o);s&&!Array.isArray(s)&&typeof s=="object"&&(s=JsonUnifier.getLogichValue(s,o)),s&&Array.isArray(s)?n=s.map(p=>`${p}`):n=`${s}`;}return n}getDialogue(e,o){if(e==null)return;let n=JsonUnifier.getLogichValue(e,o);return n==null?`${n}`:typeof n=="object"&&"character"in n&&"text"in n?{character:n.character,text:translator.t(this.getDialogueText(n.text,o))}:translator.t(this.getDialogueText(n,o))}getChoices(e,o){return JsonUnifier.getLogichValue(e,o)?.map(p=>JsonUnifier.getLogichValue(p,o)).filter(p=>p!==void 0)}stepConverter(e){return async o=>{let n=typeof e=="function"?e():e;n=createExportableElement(n),n=JsonUnifier.getConditionalStep(n,o);let s=this.operationStringConvert?g=>this.operationStringConvert(g,n,o):void 0,{operations:p=[]}=n;for(let g of p)await R(g,o,s);let{labelToOpen:r=[]}=n,x=this.getChoices(n.choices,o),f=JsonUnifier.getLogichValue(n.glueEnabled,o),h=this.getDialogue(n.dialogue,o),u=[];Array.isArray(r)||(r=[r]),r.forEach(g=>{let l=JsonUnifier.getLogichValue(g,o);l&&u.push(l);});let J=JsonUnifier.getLogichValue(n.goNextStep,o),V=JsonUnifier.getLogichValue(n.end,o);if(x){let g=x.map(l=>{let w="";if(Array.isArray(l.text)){let i=[];l.text.forEach(a=>{if(typeof a=="string")i.push(translator.t(a));else if(a&&typeof a=="object"){let c=JsonUnifier.getLogichValue(a,o);c&&!Array.isArray(c)&&typeof c=="object"&&(c=JsonUnifier.getLogichValue(c,o)||""),c&&(Array.isArray(c)?i=i.concat(translator.t(c)):i.push(translator.t(c)));}}),w=i;}else typeof l.text=="string"&&(w=translator.t(l.text));return {label:l.label,text:w,props:l.props,type:l.type,oneTime:l.oneTime,onlyHaveNoChoice:l.onlyHaveNoChoice,autoSelect:l.autoSelect}});narration.choices=g;}else narration.choices=void 0;h!==void 0&&(narration.dialogue=h,this.skipEmptyDialogs&&typeof h=="string"&&(h===""||RegExp(/^\s+$/).test(h))&&(J=true)),f?narration.dialogGlue=true:f===false&&(narration.dialogGlue=false);for(let g of u){let l=g.label;typeof l=="object"&&(l=JsonUnifier.getLogichValue(l,o)||"");let w=g.params?.map(P=>JsonUnifier.getLogichValue(P,o));o={...o,...g.props},g.type==="jump"?(narration.labels.opened.length>0&&narration.labels.closeCurrent(),storage.temp.set(`${B}${narration.labels.opened.length}`,w),await narration.call(l,o)):(storage.temp.set(`${B}${narration.labels.opened.length}`,w),await narration.call(l,o));}V==="game_end"?(narration.labels.closeAll(),await narration.continue(o,{runNow:true})):V==="label_end"&&narration.labels.closeCurrent(),J&&await narration.continue(o,{runNow:true});}}};async function de(t,e={}){if(!Array.isArray(t))if(typeof t=="object"||typeof t=="string")t=[t];else {m.error("Error parsing imported Pixi'VN JSON: data is not an object");return}let o=t.map(p=>{if(typeof p=="string")try{return JSON.parse(p)}catch(r){return m.error("Error parsing imported Pixi'VN JSON",r),{}}return p}),n=o.map(async p=>{if(p.initialOperations)for(let r of p.initialOperations)r.type==="value"&&(typeof r.value!="object"||!r.value||!("type"in r.value))&&D(r);return Promise.resolve()});await Promise.all(n);let s=o.map(async p=>{if(p.initialOperations)for(let r of p.initialOperations)(r.type!=="value"||r.type==="value"&&typeof r.value=="object"&&r.value&&"type"in r.value)&&D(r);if(p.labels){let r=p.labels;for(let x in r)try{let f=r[x],h=new A(x,f,void 0,e);RegisteredLabels.add(h);}catch(f){m.error(`Error creating JSON label ${x}`,f);}}return Promise.resolve()});await Promise.all(s);}export{A as LabelJson,de as importPixiVNJson};
1
+ import {createExportableElement,PixiError}from'@drincs/pixi-vn';import {JsonUnifier}from'@drincs/pixi-vn-json/core';import {translator}from'@drincs/pixi-vn-json/translator';import {LabelAbstract,narration,RegisteredLabels}from'@drincs/pixi-vn/narration';import {storage}from'@drincs/pixi-vn/storage';var Z=Object.create;var $=Object.defineProperty;var ee=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var te=Object.getPrototypeOf,ne=Object.prototype.hasOwnProperty;var k=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,o)=>(typeof require<"u"?require:e)[o]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var M=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var oe=(n,e,o,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of ie(e))!ne.call(n,s)&&s!==o&&$(n,s,{get:()=>e[s],enumerable:!(t=ee(e,s))||t.enumerable});return n};var re=(n,e,o)=>(o=n!=null?Z(te(n)):{},oe($(o,"default",{value:n,enumerable:true}),n));var F=M((T,G)=>{(function(n,e){typeof T=="object"?G.exports=T=e():typeof define=="function"&&define.amd?define([],e):n.CryptoJS=e();})(T,function(){var n=n||(function(e,o){var t;if(typeof window<"u"&&window.crypto&&(t=window.crypto),typeof self<"u"&&self.crypto&&(t=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(t=globalThis.crypto),!t&&typeof window<"u"&&window.msCrypto&&(t=window.msCrypto),!t&&typeof global<"u"&&global.crypto&&(t=global.crypto),!t&&typeof k=="function")try{t=k("crypto");}catch{}var s=function(){if(t){if(typeof t.getRandomValues=="function")try{return t.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof t.randomBytes=="function")try{return t.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},p=Object.create||(function(){function i(){}return function(a){var c;return i.prototype=a,c=new i,i.prototype=null,c}})(),r={},x=r.lib={},f=x.Base=(function(){return {extend:function(i){var a=p(this);return i&&a.mixIn(i),(!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 i=this.extend();return i.init.apply(i,arguments),i},init:function(){},mixIn:function(i){for(var a in i)i.hasOwnProperty(a)&&(this[a]=i[a]);i.hasOwnProperty("toString")&&(this.toString=i.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),h=x.WordArray=f.extend({init:function(i,a){i=this.words=i||[],a!=o?this.sigBytes=a:this.sigBytes=i.length*4;},toString:function(i){return (i||J).stringify(this)},concat:function(i){var a=this.words,c=i.words,d=this.sigBytes,y=i.sigBytes;if(this.clamp(),d%4)for(var S=0;S<y;S++){var I=c[S>>>2]>>>24-S%4*8&255;a[d+S>>>2]|=I<<24-(d+S)%4*8;}else for(var C=0;C<y;C+=4)a[d+C>>>2]=c[C>>>2];return this.sigBytes+=y,this},clamp:function(){var i=this.words,a=this.sigBytes;i[a>>>2]&=4294967295<<32-a%4*8,i.length=e.ceil(a/4);},clone:function(){var i=f.clone.call(this);return i.words=this.words.slice(0),i},random:function(i){for(var a=[],c=0;c<i;c+=4)a.push(s());return new h.init(a,i)}}),u=r.enc={},J=u.Hex={stringify:function(i){for(var a=i.words,c=i.sigBytes,d=[],y=0;y<c;y++){var S=a[y>>>2]>>>24-y%4*8&255;d.push((S>>>4).toString(16)),d.push((S&15).toString(16));}return d.join("")},parse:function(i){for(var a=i.length,c=[],d=0;d<a;d+=2)c[d>>>3]|=parseInt(i.substr(d,2),16)<<24-d%8*4;return new h.init(c,a/2)}},V=u.Latin1={stringify:function(i){for(var a=i.words,c=i.sigBytes,d=[],y=0;y<c;y++){var S=a[y>>>2]>>>24-y%4*8&255;d.push(String.fromCharCode(S));}return d.join("")},parse:function(i){for(var a=i.length,c=[],d=0;d<a;d++)c[d>>>2]|=(i.charCodeAt(d)&255)<<24-d%4*8;return new h.init(c,a)}},g=u.Utf8={stringify:function(i){try{return decodeURIComponent(escape(V.stringify(i)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(i){return V.parse(unescape(encodeURIComponent(i)))}},l=x.BufferedBlockAlgorithm=f.extend({reset:function(){this._data=new h.init,this._nDataBytes=0;},_append:function(i){typeof i=="string"&&(i=g.parse(i)),this._data.concat(i),this._nDataBytes+=i.sigBytes;},_process:function(i){var a,c=this._data,d=c.words,y=c.sigBytes,S=this.blockSize,I=S*4,C=y/I;i?C=e.ceil(C):C=e.max((C|0)-this._minBufferSize,0);var _=C*S,H=e.min(_*4,y);if(_){for(var z=0;z<_;z+=S)this._doProcessBlock(d,z);a=d.splice(0,_),c.sigBytes-=H;}return new h.init(a,H)},clone:function(){var i=f.clone.call(this);return i._data=this._data.clone(),i},_minBufferSize:0});x.Hasher=l.extend({cfg:f.extend(),init:function(i){this.cfg=this.cfg.extend(i),this.reset();},reset:function(){l.reset.call(this),this._doReset();},update:function(i){return this._append(i),this._process(),this},finalize:function(i){i&&this._append(i);var a=this._doFinalize();return a},blockSize:512/32,_createHelper:function(i){return function(a,c){return new i.init(c).finalize(a)}},_createHmacHelper:function(i){return function(a,c){return new P.HMAC.init(i,c).finalize(a)}}});var P=r.algo={};return r})(Math);return n});});var K=M((E,X)=>{(function(n,e){typeof E=="object"?X.exports=E=e(F()):typeof define=="function"&&define.amd?define(["./core"],e):e(n.CryptoJS);})(E,function(n){return (function(){var e=n,o=e.lib,t=o.WordArray,s=o.Hasher,p=e.algo,r=[],x=p.SHA1=s.extend({_doReset:function(){this._hash=new t.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(f,h){for(var u=this._hash.words,J=u[0],V=u[1],g=u[2],l=u[3],w=u[4],P=0;P<80;P++){if(P<16)r[P]=f[h+P]|0;else {var i=r[P-3]^r[P-8]^r[P-14]^r[P-16];r[P]=i<<1|i>>>31;}var a=(J<<5|J>>>27)+w+r[P];P<20?a+=(V&g|~V&l)+1518500249:P<40?a+=(V^g^l)+1859775393:P<60?a+=(V&g|V&l|g&l)-1894007588:a+=(V^g^l)-899497514,w=l,l=g,g=V<<30|V>>>2,V=J,J=a;}u[0]=u[0]+J|0,u[1]=u[1]+V|0,u[2]=u[2]+g|0,u[3]=u[3]+l|0,u[4]=u[4]+w|0;},_doFinalize:function(){var f=this._data,h=f.words,u=this._nDataBytes*8,J=f.sigBytes*8;return h[J>>>5]|=128<<24-J%32,h[(J+64>>>9<<4)+14]=Math.floor(u/4294967296),h[(J+64>>>9<<4)+15]=u,f.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var f=s.clone.call(this);return f._hash=this._hash.clone(),f}});e.SHA1=s._createHelper(x),e.HmacSHA1=s._createHmacHelper(x);})(),n.SHA1});});var B="___param___";var m;(s=>(s.log=(p,...r)=>console.log(`[Pixi\u2019VN Json] ${p}`,...r),s.warn=(p,...r)=>console.warn(`[Pixi\u2019VN Json] ${p}`,...r),s.error=(p,...r)=>console.error(`[Pixi\u2019VN Json] ${p}`,...r),s.info=(p,...r)=>console.info(`[Pixi\u2019VN Json] ${p}`,...r)))(m||={});var j=class n{static init(e){e.loadAssets&&(n._loadAssets=e.loadAssets),e.soundOperation&&(n._soundOperation=e.soundOperation),e.imageOperation&&(n._imageOperation=e.imageOperation),e.videoOperation&&(n._videoOperation=e.videoOperation),e.animatedSpriteOperation&&(n._animatedSpriteOperation=e.animatedSpriteOperation),e.imageContainerOperation&&(n._imageContainerOperation=e.imageContainerOperation),e.textOperation&&(n._textOperation=e.textOperation),e.canvasElementOperation&&(n._canvasElementOperation=e.canvasElementOperation),e.setStorageValue&&(n._setStorageValue=e.setStorageValue),e.setInitialStorageValue&&(n._setInitialStorageValue=e.setInitialStorageValue),e.narrationOperation&&(n._narrationOperation=e.narrationOperation),e.effectOperation&&(n._effectOperation=e.effectOperation),e.animateOperation&&(n._animateOperation=e.animateOperation),e.canvasOperation&&(n._canvasOperation=e.canvasOperation),e.getLogichValue&&(n._getLogichValue=e.getLogichValue),e.getConditionalStep&&(n._getConditionalStep=e.getConditionalStep);}static _loadAssets=()=>{};static get loadAssets(){return n._loadAssets}static _soundOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get soundOperation(){return n._soundOperation}static _imageOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get imageOperation(){return n._imageOperation}static _videoOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get videoOperation(){return n._videoOperation}static _animatedSpriteOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get animatedSpriteOperation(){return n._animatedSpriteOperation}static _imageContainerOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get imageContainerOperation(){return n._imageContainerOperation}static _textOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get textOperation(){return n._textOperation}static _canvasElementOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get canvasElementOperation(){return n._canvasElementOperation}static _setStorageValue=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get setStorageValue(){return n._setStorageValue}static _setInitialStorageValue=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get setInitialStorageValue(){return n._setInitialStorageValue}static _narrationOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get narrationOperation(){return n._narrationOperation}static _effectOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get effectOperation(){return n._effectOperation}static _animateOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get animateOperation(){return n._animateOperation}static _canvasOperation=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get canvasOperation(){return n._canvasOperation}static _getLogichValue=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get getLogichValue(){return n._getLogichValue}static _getConditionalStep=()=>{throw m.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get getConditionalStep(){return n._getConditionalStep}};function q(n,e){if(e&&typeof e=="object"&&typeof n.functionName=="string"&&n.functionName in e){let o=e[n.functionName];if(typeof o=="function"){let t=n.args.map(s=>j.getLogichValue(s,e));return o(...t)}else m.warn(`getLogichValue function ${n.functionName} not found in props`);}}function W(n,e={}){let o="";return n.values.forEach(t=>{if(typeof t=="string")o+=t;else {let s=JsonUnifier.getLogichValue(t,e);o+=`${s}`;}}),o}async function R(n,e,o){let t=JsonUnifier.getLogichValue(n,e);if(t)switch(t.type){case "sound":JsonUnifier.soundOperation(t);break;case "assets":case "bundle":await JsonUnifier.loadAssets(t);break;case "image":await JsonUnifier.imageOperation(t);break;case "video":await JsonUnifier.videoOperation(t);break;case "asprite":await JsonUnifier.animatedSpriteOperation(t);break;case "imagecontainer":await JsonUnifier.imageContainerOperation(t);break;case "text":await JsonUnifier.textOperation(t);break;case "canvaselement":await JsonUnifier.canvasElementOperation(t);break;case "canvas":JsonUnifier.canvasOperation(t);break;case "value":JsonUnifier.setStorageValue(t,e);break;case "operationtoconvert":if(o){let s=W(t,e),p=await o(s);p&&await R(p,e,o);}break;case "input":case "dialogue":JsonUnifier.narrationOperation(t);break;case "shake":await JsonUnifier.effectOperation(t);break;case "animate":case "animate-sequence":JsonUnifier.animateOperation(t);break;case "function":await q(t,e);break}}function D(n){let e=JsonUnifier.getLogichValue(n,{});e&&e.type==="value"&&e.storageOperationType==="set"&&(e.storageType==="storage"||e.storageType==="tempstorage")&&JsonUnifier.setInitialStorageValue(e);}var Y=re(K());var A=class extends LabelAbstract{constructor(e,o,t,s={}){t||(t={}),t.onLoadingLabel=async()=>{for(let p of o){let r;if(typeof p=="function"?r=p():r=p,r=JsonUnifier.getConditionalStep(r),r.operations)try{let x=r.operations.map(f=>JsonUnifier.loadAssets(f));await Promise.all(x);}catch(x){m.error("The operation in the onLoadingLabel function of the label has an error:",x);}}},super(e,t),this._steps=o,this.operationStringConvert=s.operationStringConvert,this.skipEmptyDialogs=s.skipEmptyDialogs||false;}_steps;get steps(){return this._steps.map(e=>this.stepConverter(e))}get stepCount(){return this._steps.length}getStepById(e){if(e<0||e>=this._steps.length)return;let o=this._steps[e];return this.stepConverter(o)}operationStringConvert;skipEmptyDialogs=false;getStepSha(e){if(e<0||e>=this._steps.length)return;let o=this._steps[e],t=typeof o=="function"?o.toString():JSON.stringify(o);return (0, Y.default)(t).toString()}getDialogueText(e,o){let t="";if(Array.isArray(e)){let s=[];e.forEach(p=>{if(typeof p=="string")s.push(p);else if(p&&typeof p=="object"){let r=JsonUnifier.getLogichValue(p,o);r?(r&&!Array.isArray(r)&&typeof r=="object"&&(r=JsonUnifier.getLogichValue(r,o)||""),Array.isArray(r)?s=s.map(x=>`${x}`).concat(r):s.push(`${r}`)):s.push(`${p}`);}else s.push(`${p}`);}),t=s;}else {let s=JsonUnifier.getLogichValue(e,o);s&&!Array.isArray(s)&&typeof s=="object"&&(s=JsonUnifier.getLogichValue(s,o)),s&&Array.isArray(s)?t=s.map(p=>`${p}`):t=`${s}`;}return t}getDialogue(e,o){if(e==null)return;let t=JsonUnifier.getLogichValue(e,o);return t==null?`${t}`:typeof t=="object"&&"character"in t&&"text"in t?{character:t.character,text:translator.t(this.getDialogueText(t.text,o))}:translator.t(this.getDialogueText(t,o))}getChoices(e,o){return JsonUnifier.getLogichValue(e,o)?.map(p=>JsonUnifier.getLogichValue(p,o)).filter(p=>p!==void 0)}stepConverter(e){return async o=>{let t=typeof e=="function"?e():e;t=createExportableElement(t),t=JsonUnifier.getConditionalStep(t,o);let s=this.operationStringConvert?g=>this.operationStringConvert(g,t,o):void 0,{operations:p=[]}=t;for(let g of p)await R(g,o,s);let{labelToOpen:r=[]}=t,x=this.getChoices(t.choices,o),f=JsonUnifier.getLogichValue(t.glueEnabled,o),h=this.getDialogue(t.dialogue,o),u=[];Array.isArray(r)||(r=[r]),r.forEach(g=>{let l=JsonUnifier.getLogichValue(g,o);l&&u.push(l);});let J=JsonUnifier.getLogichValue(t.goNextStep,o),V=JsonUnifier.getLogichValue(t.end,o);if(x){let g=x.map(l=>{let w="";if(Array.isArray(l.text)){let i=[];l.text.forEach(a=>{if(typeof a=="string")i.push(translator.t(a));else if(a&&typeof a=="object"){let c=JsonUnifier.getLogichValue(a,o);c&&!Array.isArray(c)&&typeof c=="object"&&(c=JsonUnifier.getLogichValue(c,o)||""),c&&(Array.isArray(c)?i=i.concat(translator.t(c)):i.push(translator.t(c)));}}),w=i;}else typeof l.text=="string"&&(w=translator.t(l.text));return {label:l.label,text:w,props:l.props,type:l.type,oneTime:l.oneTime,onlyHaveNoChoice:l.onlyHaveNoChoice,autoSelect:l.autoSelect}});narration.choices=g;}else narration.choices=void 0;h!==void 0&&(narration.dialogue=h,this.skipEmptyDialogs&&typeof h=="string"&&(h===""||RegExp(/^\s+$/).test(h))&&(J=true)),f?narration.dialogGlue=true:f===false&&(narration.dialogGlue=false);for(let g of u){let l=g.label;typeof l=="object"&&(l=JsonUnifier.getLogichValue(l,o)||"");let w=g.params?.map(P=>JsonUnifier.getLogichValue(P,o));o={...o,...g.props},g.type==="jump"?(narration.labels.opened.length>0&&narration.labels.closeCurrent(),storage.temp.set(`${B}${narration.labels.opened.length}`,w),await narration.call(l,o)):(storage.temp.set(`${B}${narration.labels.opened.length}`,w),await narration.call(l,o));}V==="game_end"?(narration.labels.closeAll(),await narration.continue(o,{runNow:true})):V==="label_end"&&narration.labels.closeCurrent(),J&&await narration.continue(o,{runNow:true});}}};async function de(n,e={}){if(!Array.isArray(n))if(typeof n=="object"||typeof n=="string")n=[n];else {m.error("Error parsing imported Pixi'VN JSON: data is not an object");return}let o=n.map(p=>{if(typeof p=="string")try{return JSON.parse(p)}catch(r){return m.error("Error parsing imported Pixi'VN JSON",r),{}}return p}),t=o.map(async p=>{if(p.initialOperations)for(let r of p.initialOperations)r.type==="value"&&(typeof r.value!="object"||!r.value||!("type"in r.value))&&D(r);return Promise.resolve()});await Promise.all(t);let s=o.map(async p=>{if(p.initialOperations)for(let r of p.initialOperations)(r.type!=="value"||r.type==="value"&&typeof r.value=="object"&&r.value&&"type"in r.value)&&D(r);if(p.labels){let r=p.labels;for(let x in r)try{let f=r[x],h=new A(x,f,void 0,e);RegisteredLabels.add(h);}catch(f){m.error(`Error creating JSON label ${x}`,f);}}return Promise.resolve()});await Promise.all(s);}export{A as LabelJson,de as importPixiVNJson};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drincs/pixi-vn-json",
3
- "version": "1.16.1",
3
+ "version": "1.16.2",
4
4
  "type": "module",
5
5
  "description": "Pixi'VN can be integrated with JSON files to create a visual novel.",
6
6
  "main": "./dist/index.cjs",