@drincs/pixi-vn-json 1.13.0 → 1.13.1

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.
@@ -277,13 +277,14 @@ interface PixiVNJsonArithmeticOperationsArithmetic {
277
277
  * Operator of the arithmetic operation:
278
278
  * - `"*"` multiplication
279
279
  * - `"/"` division
280
- * - `"+"` addition
281
- * - `"-"` subtraction
280
+ * - `"+"` addition (concatenation for strings and arrays)
281
+ * - `"-"` subtraction (removal of elements for arrays)
282
282
  * - `"%"` modulo
283
283
  * - `"POW"` exponentiation
284
284
  * - `"RANDOM"` random integer between leftValue and rightValue (inclusive)
285
+ * - `"INTERSECTION"` intersection of two arrays (only elements present in both arrays are included in the result)
285
286
  */
286
- operator: "*" | "/" | "+" | "-" | "%" | "POW" | "RANDOM";
287
+ operator: "*" | "/" | "+" | "-" | "%" | "POW" | "RANDOM" | "INTERSECTION";
287
288
  }
288
289
  /**
289
290
  * Unary arithmetic operation applied to a single value (e.g. INT, FLOOR, FLOAT).
@@ -346,7 +347,7 @@ type PixiVNJsonUnionCondition = PixiVNJsonUnionConditionAndOr | PixiVNJsonUnionC
346
347
  * - `"<="` less than or equal
347
348
  * - `">"` greater than
348
349
  * - `">="` greater than or equal
349
- * - `"CONTAINS"` checks whether the left string/array contains the right value
350
+ * - `"CONTAINS"` checks whether the left string/array contains the right value, if left and right are arrays, checks if all items in right are included in left
350
351
  */
351
352
  type PixiVNJsonComparationOperatorsType = "==" | "!=" | "<" | "<=" | ">" | ">=" | "CONTAINS";
352
353
  /**
@@ -388,6 +389,13 @@ interface PixiVNJsonIfElse<Then> {
388
389
  type: "ifelse";
389
390
  /**
390
391
  * The list of conditions to be checked.
392
+ *
393
+ * if is a {@link StorageElementType} or a {@link PixiVNJsonValueGet}:
394
+ * - if is a array or object, the condition is true if not empty
395
+ * - if is a string, the condition is true if not empty
396
+ * - if is a number, the condition is true if not zero
397
+ * - if is a boolean, the condition is true if true
398
+ * - if is null or undefined, the condition is false
391
399
  */
392
400
  condition: PixiVNJsonConditions;
393
401
  /**
@@ -277,13 +277,14 @@ interface PixiVNJsonArithmeticOperationsArithmetic {
277
277
  * Operator of the arithmetic operation:
278
278
  * - `"*"` multiplication
279
279
  * - `"/"` division
280
- * - `"+"` addition
281
- * - `"-"` subtraction
280
+ * - `"+"` addition (concatenation for strings and arrays)
281
+ * - `"-"` subtraction (removal of elements for arrays)
282
282
  * - `"%"` modulo
283
283
  * - `"POW"` exponentiation
284
284
  * - `"RANDOM"` random integer between leftValue and rightValue (inclusive)
285
+ * - `"INTERSECTION"` intersection of two arrays (only elements present in both arrays are included in the result)
285
286
  */
286
- operator: "*" | "/" | "+" | "-" | "%" | "POW" | "RANDOM";
287
+ operator: "*" | "/" | "+" | "-" | "%" | "POW" | "RANDOM" | "INTERSECTION";
287
288
  }
288
289
  /**
289
290
  * Unary arithmetic operation applied to a single value (e.g. INT, FLOOR, FLOAT).
@@ -346,7 +347,7 @@ type PixiVNJsonUnionCondition = PixiVNJsonUnionConditionAndOr | PixiVNJsonUnionC
346
347
  * - `"<="` less than or equal
347
348
  * - `">"` greater than
348
349
  * - `">="` greater than or equal
349
- * - `"CONTAINS"` checks whether the left string/array contains the right value
350
+ * - `"CONTAINS"` checks whether the left string/array contains the right value, if left and right are arrays, checks if all items in right are included in left
350
351
  */
351
352
  type PixiVNJsonComparationOperatorsType = "==" | "!=" | "<" | "<=" | ">" | ">=" | "CONTAINS";
352
353
  /**
@@ -388,6 +389,13 @@ interface PixiVNJsonIfElse<Then> {
388
389
  type: "ifelse";
389
390
  /**
390
391
  * The list of conditions to be checked.
392
+ *
393
+ * if is a {@link StorageElementType} or a {@link PixiVNJsonValueGet}:
394
+ * - if is a array or object, the condition is true if not empty
395
+ * - if is a string, the condition is true if not empty
396
+ * - if is a number, the condition is true if not zero
397
+ * - if is a boolean, the condition is true if true
398
+ * - if is null or undefined, the condition is false
391
399
  */
392
400
  condition: PixiVNJsonConditions;
393
401
  /**
@@ -277,13 +277,14 @@ interface PixiVNJsonArithmeticOperationsArithmetic {
277
277
  * Operator of the arithmetic operation:
278
278
  * - `"*"` multiplication
279
279
  * - `"/"` division
280
- * - `"+"` addition
281
- * - `"-"` subtraction
280
+ * - `"+"` addition (concatenation for strings and arrays)
281
+ * - `"-"` subtraction (removal of elements for arrays)
282
282
  * - `"%"` modulo
283
283
  * - `"POW"` exponentiation
284
284
  * - `"RANDOM"` random integer between leftValue and rightValue (inclusive)
285
+ * - `"INTERSECTION"` intersection of two arrays (only elements present in both arrays are included in the result)
285
286
  */
286
- operator: "*" | "/" | "+" | "-" | "%" | "POW" | "RANDOM";
287
+ operator: "*" | "/" | "+" | "-" | "%" | "POW" | "RANDOM" | "INTERSECTION";
287
288
  }
288
289
  /**
289
290
  * Unary arithmetic operation applied to a single value (e.g. INT, FLOOR, FLOAT).
@@ -346,7 +347,7 @@ type PixiVNJsonUnionCondition = PixiVNJsonUnionConditionAndOr | PixiVNJsonUnionC
346
347
  * - `"<="` less than or equal
347
348
  * - `">"` greater than
348
349
  * - `">="` greater than or equal
349
- * - `"CONTAINS"` checks whether the left string/array contains the right value
350
+ * - `"CONTAINS"` checks whether the left string/array contains the right value, if left and right are arrays, checks if all items in right are included in left
350
351
  */
351
352
  type PixiVNJsonComparationOperatorsType = "==" | "!=" | "<" | "<=" | ">" | ">=" | "CONTAINS";
352
353
  /**
@@ -388,6 +389,13 @@ interface PixiVNJsonIfElse<Then> {
388
389
  type: "ifelse";
389
390
  /**
390
391
  * The list of conditions to be checked.
392
+ *
393
+ * if is a {@link StorageElementType} or a {@link PixiVNJsonValueGet}:
394
+ * - if is a array or object, the condition is true if not empty
395
+ * - if is a string, the condition is true if not empty
396
+ * - if is a number, the condition is true if not zero
397
+ * - if is a boolean, the condition is true if true
398
+ * - if is null or undefined, the condition is false
391
399
  */
392
400
  condition: PixiVNJsonConditions;
393
401
  /**
@@ -277,13 +277,14 @@ interface PixiVNJsonArithmeticOperationsArithmetic {
277
277
  * Operator of the arithmetic operation:
278
278
  * - `"*"` multiplication
279
279
  * - `"/"` division
280
- * - `"+"` addition
281
- * - `"-"` subtraction
280
+ * - `"+"` addition (concatenation for strings and arrays)
281
+ * - `"-"` subtraction (removal of elements for arrays)
282
282
  * - `"%"` modulo
283
283
  * - `"POW"` exponentiation
284
284
  * - `"RANDOM"` random integer between leftValue and rightValue (inclusive)
285
+ * - `"INTERSECTION"` intersection of two arrays (only elements present in both arrays are included in the result)
285
286
  */
286
- operator: "*" | "/" | "+" | "-" | "%" | "POW" | "RANDOM";
287
+ operator: "*" | "/" | "+" | "-" | "%" | "POW" | "RANDOM" | "INTERSECTION";
287
288
  }
288
289
  /**
289
290
  * Unary arithmetic operation applied to a single value (e.g. INT, FLOOR, FLOAT).
@@ -346,7 +347,7 @@ type PixiVNJsonUnionCondition = PixiVNJsonUnionConditionAndOr | PixiVNJsonUnionC
346
347
  * - `"<="` less than or equal
347
348
  * - `">"` greater than
348
349
  * - `">="` greater than or equal
349
- * - `"CONTAINS"` checks whether the left string/array contains the right value
350
+ * - `"CONTAINS"` checks whether the left string/array contains the right value, if left and right are arrays, checks if all items in right are included in left
350
351
  */
351
352
  type PixiVNJsonComparationOperatorsType = "==" | "!=" | "<" | "<=" | ">" | ">=" | "CONTAINS";
352
353
  /**
@@ -388,6 +389,13 @@ interface PixiVNJsonIfElse<Then> {
388
389
  type: "ifelse";
389
390
  /**
390
391
  * The list of conditions to be checked.
392
+ *
393
+ * if is a {@link StorageElementType} or a {@link PixiVNJsonValueGet}:
394
+ * - if is a array or object, the condition is true if not empty
395
+ * - if is a string, the condition is true if not empty
396
+ * - if is a number, the condition is true if not zero
397
+ * - if is a boolean, the condition is true if true
398
+ * - if is null or undefined, the condition is false
391
399
  */
392
400
  condition: PixiVNJsonConditions;
393
401
  /**
package/dist/actions.cjs CHANGED
@@ -1,3 +1,3 @@
1
- 'use strict';var core=require('@drincs/pixi-vn-json/core'),canvas=require('@drincs/pixi-vn/canvas'),translator=require('@drincs/pixi-vn-json/translator'),narration=require('@drincs/pixi-vn/narration'),sound=require('@drincs/pixi-vn/sound'),pixiVn=require('@drincs/pixi-vn'),storage=require('@drincs/pixi-vn/storage');var q=Object.defineProperty;var W=(e,i,t)=>i in e?q(e,i,{enumerable:true,configurable:true,writable:true,value:t}):e[i]=t;var d=(e,i,t)=>W(e,typeof i!="symbol"?i+"":i,t);async function Te(e){let i=core.JsonUnifier.getLogichValue(e,{});if(i)switch(i.type){case "assets":switch(i.operationType){case "load":await canvas.Assets.load(i.aliases);break;case "lazyload":canvas.Assets.backgroundLoad(i.aliases);break}break;case "bundle":switch(i.operationType){case "load":await canvas.Assets.loadBundle(i.aliases);break;case "lazyload":canvas.Assets.backgroundLoadBundle(i.aliases);break}break}}var o;(l=>(l.log=(r,...u)=>console.log(`[Pixi\u2019VN Json] ${r}`,...u),l.warn=(r,...u)=>console.warn(`[Pixi\u2019VN Json] ${r}`,...u),l.error=(r,...u)=>console.error(`[Pixi\u2019VN Json] ${r}`,...u),l.info=(r,...u)=>console.info(`[Pixi\u2019VN Json] ${r}`,...u)))(o||(o={}));async function v(e,i,t){switch(t.type){case "fade":await canvas.showWithFade(i.alias,e,t.props,t.priority);break;case "dissolve":await canvas.showWithDissolve(i.alias,e,t.props,t.priority);break;case "movein":case "moveout":await canvas.moveIn(i.alias,e,t.props,t.priority);break;case "zoomin":case "zoomout":await canvas.zoomIn(i.alias,e,t.props,t.priority);break;case "pushin":case "pushout":await canvas.pushIn(i.alias,e,t.props,t.priority);break}}function N(e){if(e.transition)switch(e.transition.type){case "fade":canvas.removeWithFade(e.alias,e.transition.props,e.transition.priority);break;case "dissolve":canvas.removeWithDissolve(e.alias,e.transition.props,e.transition.priority);break;case "movein":case "moveout":canvas.moveOut(e.alias,e.transition.props,e.transition.priority);break;case "zoomin":case "zoomout":canvas.zoomOut(e.alias,e.transition.props,e.transition.priority);break;case "pushin":case "pushout":canvas.pushOut(e.alias,e.transition.props,e.transition.priority);break}else canvas.canvas.remove(e.alias);}async function Ie(e){switch(e.operationType){case "show":if(e.transition){let i=new canvas.ImageSprite(e.props,e.url||e.alias);await v(i,e,e.transition);}else await canvas.showImage(e.alias,e.url,e.props);break;case "edit":{let i=canvas.canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):o.error(`Image with alias ${e.alias} not found.`);break}case "remove":N(e);break}}async function Ee(e){switch(e.operationType){case "show":if(e.transition){let i=new canvas.VideoSprite(e.props,e.url||e.alias);await v(i,e,e.transition);}else await canvas.showVideo(e.alias,e.url,e.props);break;case "edit":{let i=canvas.canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):o.error(`Video with alias ${e.alias} not found.`);break}case "remove":N(e);break;case "pause":case "resume":{let i=canvas.canvas.find(e.alias);i?i.paused=e.operationType==="pause":o.error(`Video with alias ${e.alias} not found.`);break}}}async function Ae(e){switch(e.operationType){case "show":if(e.transition){let i=new canvas.ImageContainer(e.props,e.urls);await v(i,e,e.transition);}else await canvas.showImageContainer(e.alias,e.urls,e.props);break;case "edit":{let i=canvas.canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):o.error(`ImageContainer with alias ${e.alias} not found.`);break}case "remove":N(e);break}}async function Re(e){switch(e.operationType){case "show":if(e.props=e.props||{},e.props.text=translator.translator.t(e.text),e.transition){let i=new canvas.Text(e.props);await v(i,e,e.transition);}else canvas.showText(e.alias,e.text,e.props);break;case "edit":{let i=canvas.canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):o.error(`Text with alias ${e.alias} not found.`);break}case "remove":N(e);break}}async function ze(e){switch(e.operationType){case "edit":try{let i=canvas.canvas.find(e.alias);i?e.props&&i.setMemory({...i.memory,...e.props}):o.error(`Canvas Element with alias ${e.alias} not found.`);}catch(i){o.error(`There was an error while trying to edit the canvas element with alias ${e.alias}.`,i);}break;case "remove":N(e);break}}async function Me(e){e.type==="shake"&&await canvas.shakeEffect(e.alias,e.props,e.priority);}function _e(e){switch(e.type){case "animate":canvas.canvas.animate(e.alias,e.keyframes,e.options,e.priority);break;case "animate-sequence":canvas.canvas.animate(e.alias,e.sequence,e.options,e.priority);break}}function De(e){switch(e.type){case "input":narration.narration.requestInput({type:e.valueType},e.defaultValue);break;case "dialogue":narration.narration.dialogue=void 0;break}}function We(e){switch(e.operationType){case "play":e.url?sound.sound.play(e.alias,e.url,e.props):sound.sound.play(e.alias,e.props);break;case "stop":switch(e.type){case "sound":sound.sound.stop(e.alias);break;case "all":sound.sound.stopAll();break}break;case "pause":switch(e.type){case "sound":sound.sound.pause(e.alias);break;case "channel":sound.sound.findChannel(e.alias).pauseAll();break;case "all":sound.sound.pauseAll();break}break;case "resume":switch(e.type){case "sound":sound.sound.resume(e.alias);break;case "channel":sound.sound.findChannel(e.alias).resumeAll();break;case "all":sound.sound.resumeAll();break}break;case "edit":Object.entries(e.props).forEach(([i,t])=>{let a=sound.sound.find(e.alias);a&&(i==="volume"?a.volume.value=t:a.paused=t);});break}}var J="___param___";var n=class n{static init(i){i.loadAssets&&(n._loadAssets=i.loadAssets),i.soundOperation&&(n._soundOperation=i.soundOperation),i.imageOperation&&(n._imageOperation=i.imageOperation),i.videoOperation&&(n._videoOperation=i.videoOperation),i.imageContainerOperation&&(n._imageContainerOperation=i.imageContainerOperation),i.textOperation&&(n._textOperation=i.textOperation),i.canvasElementOperation&&(n._canvasElementOperation=i.canvasElementOperation),i.setStorageValue&&(n._setStorageValue=i.setStorageValue),i.setInitialStorageValue&&(n._setInitialStorageValue=i.setInitialStorageValue),i.narrationOperation&&(n._narrationOperation=i.narrationOperation),i.effectOperation&&(n._effectOperation=i.effectOperation),i.animateOperation&&(n._animateOperation=i.animateOperation),i.getLogichValue&&(n._getLogichValue=i.getLogichValue),i.getConditionalStep&&(n._getConditionalStep=i.getConditionalStep);}static get loadAssets(){return n._loadAssets}static get soundOperation(){return n._soundOperation}static get imageOperation(){return n._imageOperation}static get videoOperation(){return n._videoOperation}static get imageContainerOperation(){return n._imageContainerOperation}static get textOperation(){return n._textOperation}static get canvasElementOperation(){return n._canvasElementOperation}static get setStorageValue(){return n._setStorageValue}static get setInitialStorageValue(){return n._setInitialStorageValue}static get narrationOperation(){return n._narrationOperation}static get effectOperation(){return n._effectOperation}static get animateOperation(){return n._animateOperation}static get getLogichValue(){return n._getLogichValue}static get getConditionalStep(){return n._getConditionalStep}};d(n,"_loadAssets",()=>{}),d(n,"_soundOperation",()=>{throw o.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.")}),d(n,"_imageOperation",()=>{throw o.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.")}),d(n,"_videoOperation",()=>{throw o.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.")}),d(n,"_imageContainerOperation",()=>{throw o.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.")}),d(n,"_textOperation",()=>{throw o.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.")}),d(n,"_canvasElementOperation",()=>{throw o.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.")}),d(n,"_setStorageValue",()=>{throw o.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.")}),d(n,"_setInitialStorageValue",()=>{throw o.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.")}),d(n,"_narrationOperation",()=>{throw o.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.")}),d(n,"_effectOperation",()=>{throw o.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.")}),d(n,"_animateOperation",()=>{throw o.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.")}),d(n,"_getLogichValue",()=>{throw o.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.")}),d(n,"_getConditionalStep",()=>{throw o.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.")});var f=n;function R(e,i){if(i&&typeof i=="object"&&typeof e.functionName=="string"&&e.functionName in i){let t=i[e.functionName];if(typeof t=="function"){let a=e.args.map(l=>f.getLogichValue(l,i));return t(...a)}else o.warn(`getLogichValue function ${e.functionName} not found in props`);}}function z(e,i){let t=core.JsonUnifier.getLogichValue(e,i);return t&&typeof t=="object"&&"type"in t?core.JsonUnifier.getLogichValue(t,i):t}function xi(e,i={}){let t=z(e.value,i);switch(e.storageType){case "flagStorage":storage.storage.setFlag(e.key,e.value);break;case "storage":storage.storage.set(e.key,t);break;case "tempstorage":storage.storage.setTempVariable(e.key,t);break;case "params":{let a=storage.storage.get(`${J}${narration.narration.openedLabels.length-1}`)||[];a.length>e.key&&(a[e.key]=t),storage.storage.setTempVariable(`${J}${narration.narration.openedLabels.length-1}`,a);break}}}function Vi(e,i={}){let t=z(e.value,i);switch(e.storageType){case "storage":case "tempstorage":storage.storage.default={[e.key]:t};break}}function Ve(e,i={}){let t=ye(e,i);if(t&&typeof t=="object"&&"type"in t)switch(t.type){case "value":return Pe(t,i);case "arithmetic":case "arithmeticsingle":return ge(t,i);case "compare":case "valueCondition":case "union":return he(t,i);case "function":return R(t,i)}return t}function ge(e,i){let t=core.JsonUnifier.getLogichValue(e.leftValue,i);switch(e.type){case "arithmetic":{let a=core.JsonUnifier.getLogichValue(e.rightValue,i);switch(e.operator){case "*":return t*a;case "/":return t/a;case "+":return t+a;case "-":return t-a;case "%":return t%a;case "POW":return t**a;case "RANDOM":return narration.narration.getRandomNumber(t,a)}}case "arithmeticsingle":switch(e.operator){case "INT":return Number(t);case "FLOOR":return Math.floor(t);}break}}function Pe(e,i){if(e&&typeof e=="object"&&"type"in e&&e.type==="value"&&e.storageOperationType==="get")switch(e.storageType){case "storage":case "tempstorage":return e.key==="_input_value_"?narration.narration.inputValue:storage.storage.get(e.key);case "flagStorage":return storage.storage.getFlag(e.key);case "label":return narration.narration.getTimesLabelOpened(e.label);case "choice":return narration.narration.getTimesChoiceMade(e.index);case "logic":return core.JsonUnifier.getLogichValue(e.operation,i);case "params":{let t=storage.storage.get(`${J}${narration.narration.openedLabels.length-1}`)||[];if(t&&t.length>e.key)return t[e.key];o.warn("getValue params not found");return}}return e}function he(e,i){if(!e)return false;if(typeof e!="object"||!("type"in e))return !!e;switch(e.type){case "compare":{let t=core.JsonUnifier.getLogichValue(e.leftValue,i),a=core.JsonUnifier.getLogichValue(e.rightValue,i);switch(e.operator){case "==":return t===a;case "!=":return t!==a;case "<":return t<a;case "<=":return t<=a;case ">":return t>a;case ">=":return t>=a;case "CONTAINS":return t.toString().includes(a.toString())}break}case "valueCondition":return !!core.JsonUnifier.getLogichValue(e.value,i);case "union":return fe(e,i)}return !!e}function fe(e,i){if(e.unionType==="not")return !Ve(e.condition,i);let t=a=>core.JsonUnifier.getLogichValue(a,i)||false;return e.unionType==="and"?e.conditions.every(t):e.conditions.some(t)}function Ne(e,i){return Math.floor(Math.random()*(i-e+1)+e)}function ye(e,i={}){if(Array.isArray(e)||!e)return e;if(e&&typeof e=="object"&&"type"in e)switch(e.type){case "resulttocombine":return ve(e,i);case "ifelse":return core.JsonUnifier.getLogichValue(e.condition,i)?core.JsonUnifier.getLogichValue(e.then,i):core.JsonUnifier.getLogichValue(e.else,i);case "stepswitch":{let t=core.JsonUnifier.getLogichValue(e.elements,i)||[];if(t.length===0){o.error("getValueFromConditionalStatements elements.length === 0");return}switch(e.choiceType){case "random":{let a=Ne(0,t.length-1);return core.JsonUnifier.getLogichValue(t[a],i)}case "loop":{let a=narration.NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return a>t.length-1?(a=a%t.length,core.JsonUnifier.getLogichValue(t[a],i)):core.JsonUnifier.getLogichValue(t[a],i)}case "sequential":{let a,l=narration.NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return e.end==="lastItem"&&(a=core.JsonUnifier.getLogichValue(t[t.length-1],i)),l>t.length-1?a:core.JsonUnifier.getLogichValue(t[l],i)}case "sequentialrandom":{let a=narration.NarrationManagerStatic.getRandomNumber(0,t.length-1,{nestedId:e.nestedId,onceOnly:true});if(a===void 0&&e.end==="lastItem"){let l=narration.NarrationManagerStatic.getCurrentStepTimesCounterData(e.nestedId);if(!l?.usedRandomNumbers){o.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let r=l.usedRandomNumbers[`0-${t.length-1}`];return core.JsonUnifier.getLogichValue(t[r[r.length-1]],i)}if(a===void 0){o.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return core.JsonUnifier.getLogichValue(t[a],i)}}}}return e}function M(e,i={}){if(e.conditionalStep){let t=pixiVn.createExportableElement(core.JsonUnifier.getLogichValue(e.conditionalStep,i));if(t?.glueEnabled===void 0&&delete t?.glueEnabled,t?.goNextStep===void 0&&delete t?.goNextStep,t?.end===void 0&&delete t?.end,t?.choices===void 0&&delete t?.choices,t?.dialogue===void 0&&delete t?.dialogue,t?.labelToOpen===void 0&&delete t?.labelToOpen,t?.operations===void 0&&delete t?.operations,t){let a={...e,conditionalStep:void 0,...t};return M(a,i)}else narration.narration.dialogGlue&&(narration.narration.dialogGlue=false);}return e}function ve(e,i){let t=e.firstItem,a=(e.secondConditionalItem??[]).flatMap(r=>Array.isArray(r)?r.map(u=>core.JsonUnifier.getLogichValue(u,i)):[core.JsonUnifier.getLogichValue(r,i)]),l=t?[t,...a]:a;if(l.length===0){o.warn("combinateResult toCheck.length === 0");return}if(typeof l[0]=="string")return translator.translator.t(l);if(typeof l[0]=="object"){let r=l,u,C=false,O=r.map((c,h)=>{c=M(c,i);let p=core.JsonUnifier.getLogichValue(c.dialogue,i)||"";return h===0?(u=core.JsonUnifier.getLogichValue(c.glueEnabled,i)||false,p):(typeof p=="object"&&"text"in p&&(p=`${p.character}: ${p.text}`),u===false&&C&&(p=`
1
+ 'use strict';var core=require('@drincs/pixi-vn-json/core'),canvas=require('@drincs/pixi-vn/canvas'),translator=require('@drincs/pixi-vn-json/translator'),narration=require('@drincs/pixi-vn/narration'),sound=require('@drincs/pixi-vn/sound'),pixiVn=require('@drincs/pixi-vn'),storage=require('@drincs/pixi-vn/storage');var q=Object.defineProperty;var W=(e,t,i)=>t in e?q(e,t,{enumerable:true,configurable:true,writable:true,value:i}):e[t]=i;var u=(e,t,i)=>W(e,typeof t!="symbol"?t+"":t,i);async function Te(e){let t=core.JsonUnifier.getLogichValue(e,{});if(t)switch(t.type){case "assets":switch(t.operationType){case "load":await canvas.Assets.load(t.aliases);break;case "lazyload":canvas.Assets.backgroundLoad(t.aliases);break}break;case "bundle":switch(t.operationType){case "load":await canvas.Assets.loadBundle(t.aliases);break;case "lazyload":canvas.Assets.backgroundLoadBundle(t.aliases);break}break}}var o;(s=>(s.log=(c,...p)=>console.log(`[Pixi\u2019VN Json] ${c}`,...p),s.warn=(c,...p)=>console.warn(`[Pixi\u2019VN Json] ${c}`,...p),s.error=(c,...p)=>console.error(`[Pixi\u2019VN Json] ${c}`,...p),s.info=(c,...p)=>console.info(`[Pixi\u2019VN Json] ${c}`,...p)))(o||(o={}));async function v(e,t,i){switch(i.type){case "fade":await canvas.showWithFade(t.alias,e,i.props,i.priority);break;case "dissolve":await canvas.showWithDissolve(t.alias,e,i.props,i.priority);break;case "movein":case "moveout":await canvas.moveIn(t.alias,e,i.props,i.priority);break;case "zoomin":case "zoomout":await canvas.zoomIn(t.alias,e,i.props,i.priority);break;case "pushin":case "pushout":await canvas.pushIn(t.alias,e,i.props,i.priority);break}}function P(e){if(e.transition)switch(e.transition.type){case "fade":canvas.removeWithFade(e.alias,e.transition.props,e.transition.priority);break;case "dissolve":canvas.removeWithDissolve(e.alias,e.transition.props,e.transition.priority);break;case "movein":case "moveout":canvas.moveOut(e.alias,e.transition.props,e.transition.priority);break;case "zoomin":case "zoomout":canvas.zoomOut(e.alias,e.transition.props,e.transition.priority);break;case "pushin":case "pushout":canvas.pushOut(e.alias,e.transition.props,e.transition.priority);break}else canvas.canvas.remove(e.alias);}async function Le(e){switch(e.operationType){case "show":if(e.transition){let t=new canvas.ImageSprite(e.props,e.url||e.alias);await v(t,e,e.transition);}else await canvas.showImage(e.alias,e.url,e.props);break;case "edit":{let t=canvas.canvas.find(e.alias);t?e.props&&await t.setMemory({...t.memory,...e.props}):o.error(`Image with alias ${e.alias} not found.`);break}case "remove":P(e);break}}async function Ie(e){switch(e.operationType){case "show":if(e.transition){let t=new canvas.VideoSprite(e.props,e.url||e.alias);await v(t,e,e.transition);}else await canvas.showVideo(e.alias,e.url,e.props);break;case "edit":{let t=canvas.canvas.find(e.alias);t?e.props&&await t.setMemory({...t.memory,...e.props}):o.error(`Video with alias ${e.alias} not found.`);break}case "remove":P(e);break;case "pause":case "resume":{let t=canvas.canvas.find(e.alias);t?t.paused=e.operationType==="pause":o.error(`Video with alias ${e.alias} not found.`);break}}}async function Ee(e){switch(e.operationType){case "show":if(e.transition){let t=new canvas.ImageContainer(e.props,e.urls);await v(t,e,e.transition);}else await canvas.showImageContainer(e.alias,e.urls,e.props);break;case "edit":{let t=canvas.canvas.find(e.alias);t?e.props&&await t.setMemory({...t.memory,...e.props}):o.error(`ImageContainer with alias ${e.alias} not found.`);break}case "remove":P(e);break}}async function Re(e){switch(e.operationType){case "show":if(e.props=e.props||{},e.props.text=translator.translator.t(e.text),e.transition){let t=new canvas.Text(e.props);await v(t,e,e.transition);}else canvas.showText(e.alias,e.text,e.props);break;case "edit":{let t=canvas.canvas.find(e.alias);t?e.props&&await t.setMemory({...t.memory,...e.props}):o.error(`Text with alias ${e.alias} not found.`);break}case "remove":P(e);break}}async function ze(e){switch(e.operationType){case "edit":try{let t=canvas.canvas.find(e.alias);t?e.props&&t.setMemory({...t.memory,...e.props}):o.error(`Canvas Element with alias ${e.alias} not found.`);}catch(t){o.error(`There was an error while trying to edit the canvas element with alias ${e.alias}.`,t);}break;case "remove":P(e);break}}async function Me(e){e.type==="shake"&&await canvas.shakeEffect(e.alias,e.props,e.priority);}function _e(e){switch(e.type){case "animate":canvas.canvas.animate(e.alias,e.keyframes,e.options,e.priority);break;case "animate-sequence":canvas.canvas.animate(e.alias,e.sequence,e.options,e.priority);break}}function De(e){switch(e.type){case "input":narration.narration.requestInput({type:e.valueType},e.defaultValue);break;case "dialogue":narration.narration.dialogue=void 0;break}}function We(e){switch(e.operationType){case "play":e.url?sound.sound.play(e.alias,e.url,e.props):sound.sound.play(e.alias,e.props);break;case "stop":switch(e.type){case "sound":sound.sound.stop(e.alias);break;case "all":sound.sound.stopAll();break}break;case "pause":switch(e.type){case "sound":sound.sound.pause(e.alias);break;case "channel":sound.sound.findChannel(e.alias).pauseAll();break;case "all":sound.sound.pauseAll();break}break;case "resume":switch(e.type){case "sound":sound.sound.resume(e.alias);break;case "channel":sound.sound.findChannel(e.alias).resumeAll();break;case "all":sound.sound.resumeAll();break}break;case "edit":Object.entries(e.props).forEach(([t,i])=>{let a=sound.sound.find(e.alias);a&&(t==="volume"?a.volume.value=i:a.paused=i);});break}}var J="___param___";var n=class n{static init(t){t.loadAssets&&(n._loadAssets=t.loadAssets),t.soundOperation&&(n._soundOperation=t.soundOperation),t.imageOperation&&(n._imageOperation=t.imageOperation),t.videoOperation&&(n._videoOperation=t.videoOperation),t.imageContainerOperation&&(n._imageContainerOperation=t.imageContainerOperation),t.textOperation&&(n._textOperation=t.textOperation),t.canvasElementOperation&&(n._canvasElementOperation=t.canvasElementOperation),t.setStorageValue&&(n._setStorageValue=t.setStorageValue),t.setInitialStorageValue&&(n._setInitialStorageValue=t.setInitialStorageValue),t.narrationOperation&&(n._narrationOperation=t.narrationOperation),t.effectOperation&&(n._effectOperation=t.effectOperation),t.animateOperation&&(n._animateOperation=t.animateOperation),t.getLogichValue&&(n._getLogichValue=t.getLogichValue),t.getConditionalStep&&(n._getConditionalStep=t.getConditionalStep);}static get loadAssets(){return n._loadAssets}static get soundOperation(){return n._soundOperation}static get imageOperation(){return n._imageOperation}static get videoOperation(){return n._videoOperation}static get imageContainerOperation(){return n._imageContainerOperation}static get textOperation(){return n._textOperation}static get canvasElementOperation(){return n._canvasElementOperation}static get setStorageValue(){return n._setStorageValue}static get setInitialStorageValue(){return n._setInitialStorageValue}static get narrationOperation(){return n._narrationOperation}static get effectOperation(){return n._effectOperation}static get animateOperation(){return n._animateOperation}static get getLogichValue(){return n._getLogichValue}static get getConditionalStep(){return n._getConditionalStep}};u(n,"_loadAssets",()=>{}),u(n,"_soundOperation",()=>{throw o.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.")}),u(n,"_imageOperation",()=>{throw o.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.")}),u(n,"_videoOperation",()=>{throw o.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.")}),u(n,"_imageContainerOperation",()=>{throw o.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.")}),u(n,"_textOperation",()=>{throw o.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.")}),u(n,"_canvasElementOperation",()=>{throw o.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.")}),u(n,"_setStorageValue",()=>{throw o.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.")}),u(n,"_setInitialStorageValue",()=>{throw o.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.")}),u(n,"_narrationOperation",()=>{throw o.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.")}),u(n,"_effectOperation",()=>{throw o.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.")}),u(n,"_animateOperation",()=>{throw o.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.")}),u(n,"_getLogichValue",()=>{throw o.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.")}),u(n,"_getConditionalStep",()=>{throw o.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.")});var h=n;function R(e,t){if(t&&typeof t=="object"&&typeof e.functionName=="string"&&e.functionName in t){let i=t[e.functionName];if(typeof i=="function"){let a=e.args.map(s=>h.getLogichValue(s,t));return i(...a)}else o.warn(`getLogichValue function ${e.functionName} not found in props`);}}function z(e,t){let i=core.JsonUnifier.getLogichValue(e,t);return i&&typeof i=="object"&&"type"in i?core.JsonUnifier.getLogichValue(i,t):i}function gi(e,t={}){let i=z(e.value,t);switch(e.storageType){case "flagStorage":storage.storage.setFlag(e.key,e.value);break;case "storage":storage.storage.set(e.key,i);break;case "tempstorage":storage.storage.setTempVariable(e.key,i);break;case "params":{let a=storage.storage.get(`${J}${narration.narration.openedLabels.length-1}`)||[];a.length>e.key&&(a[e.key]=i),storage.storage.setTempVariable(`${J}${narration.narration.openedLabels.length-1}`,a);break}}}function xi(e,t={}){let i=z(e.value,t);switch(e.storageType){case "storage":case "tempstorage":storage.storage.default={[e.key]:i};break}}function xe(e,t={}){let i=Ne(e,t);if(i&&typeof i=="object"&&"type"in i)switch(i.type){case "value":return fe(i,t);case "arithmetic":case "arithmeticsingle":return Ve(i,t);case "compare":case "union":return ye(i,t);case "function":return R(i,t)}return i}function Ve(e,t){let i=core.JsonUnifier.getLogichValue(e.leftValue,t);switch(e.type){case "arithmetic":{let a=core.JsonUnifier.getLogichValue(e.rightValue,t);switch(e.operator){case "*":return i*a;case "/":return i/a;case "+":return typeof i=="string"||typeof a=="string"?`${i}${a}`:Array.isArray(i)&&Array.isArray(a)?[...i,...a]:Array.isArray(i)?[...i,a]:Array.isArray(a)?[i,...a]:i+a;case "-":if(Array.isArray(i)&&Array.isArray(a))return i.filter(s=>!a.includes(s));if(Array.isArray(i))return i.filter(s=>s!==a);if(Array.isArray(a)){o.warn("getValueFromArithmeticOperations cannot subtract array from non-array");return}return i-a;case "%":return i%a;case "POW":return i**a;case "RANDOM":return narration.narration.getRandomNumber(i,a);case "INTERSECTION":if(Array.isArray(i)&&Array.isArray(a))return i.filter(s=>a.includes(s));o.warn("getValueFromArithmeticOperations cannot intersect non-array values");return;default:o.warn("getValueFromArithmeticOperations unknown operator",e);return}}case "arithmeticsingle":switch(e.operator){case "INT":return Number(i);case "FLOOR":return Math.floor(i);}break}}function fe(e,t){if(e&&typeof e=="object"&&"type"in e&&e.type==="value"&&e.storageOperationType==="get")switch(e.storageType){case "storage":case "tempstorage":return e.key==="_input_value_"?narration.narration.inputValue:storage.storage.get(e.key);case "flagStorage":return storage.storage.getFlag(e.key);case "label":return narration.narration.getTimesLabelOpened(e.label);case "choice":return narration.narration.getTimesChoiceMade(e.index);case "logic":return core.JsonUnifier.getLogichValue(e.operation,t);case "params":{let i=storage.storage.get(`${J}${narration.narration.openedLabels.length-1}`)||[];if(i&&i.length>e.key)return i[e.key];o.warn("getValue params not found");return}}return e}function ye(e,t){if(!e)return false;if(typeof e!="object"||!("type"in e))return !!e;switch(e.type){case "compare":{let i=core.JsonUnifier.getLogichValue(e.leftValue,t),a=core.JsonUnifier.getLogichValue(e.rightValue,t);switch(e.operator){case "==":return Array.isArray(i)&&Array.isArray(a)?i.length===a.length&&i.every(s=>a.includes(s)):i===a;case "!=":return Array.isArray(i)&&Array.isArray(a)?i.length!==a.length||!i.every(s=>a.includes(s)):i!==a;case "<":return typeof i=="string"&&typeof a=="string"?i.localeCompare(a)<0:Array.isArray(i)&&Array.isArray(a)?i.length<a.length:i<a;case "<=":return typeof i=="string"&&typeof a=="string"?i.localeCompare(a)<=0:Array.isArray(i)&&Array.isArray(a)?i.length<=a.length:i<=a;case ">":return typeof i=="string"&&typeof a=="string"?i.localeCompare(a)>0:Array.isArray(i)&&Array.isArray(a)?i.length>a.length:i>a;case ">=":return typeof i=="string"&&typeof a=="string"?i.localeCompare(a)>=0:Array.isArray(i)&&Array.isArray(a)?i.length>=a.length:i>=a;case "CONTAINS":return Array.isArray(i)&&Array.isArray(a)?a.every(s=>i.includes(s)):Array.isArray(i)?i.includes(a):i.toString().includes(a.toString())}break}case "value":{let i=core.JsonUnifier.getLogichValue(e,t);return Array.isArray(i)?i.length>0:i&&typeof i=="object"?Object.keys(i).length>0:!!i}case "union":return he(e,t)}return !!e}function he(e,t){if(e.unionType==="not"){let a=xe(e.condition,t);return Array.isArray(a)?a.length===0:a&&typeof a=="object"?Object.keys(a).length===0:!a}let i=a=>core.JsonUnifier.getLogichValue(a,t)||false;return e.unionType==="and"?e.conditions.every(i):e.conditions.some(i)}function Pe(e,t){return Math.floor(Math.random()*(t-e+1)+e)}function Ne(e,t={}){if(Array.isArray(e)||!e)return e;if(e&&typeof e=="object"&&"type"in e)switch(e.type){case "resulttocombine":return ve(e,t);case "ifelse":return core.JsonUnifier.getLogichValue(e.condition,t)?core.JsonUnifier.getLogichValue(e.then,t):core.JsonUnifier.getLogichValue(e.else,t);case "stepswitch":{let i=core.JsonUnifier.getLogichValue(e.elements,t)||[];if(i.length===0){o.error("getValueFromConditionalStatements elements.length === 0");return}switch(e.choiceType){case "random":{let a=Pe(0,i.length-1);return core.JsonUnifier.getLogichValue(i[a],t)}case "loop":{let a=narration.NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return a>i.length-1?(a=a%i.length,core.JsonUnifier.getLogichValue(i[a],t)):core.JsonUnifier.getLogichValue(i[a],t)}case "sequential":{let a,s=narration.NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return e.end==="lastItem"&&(a=core.JsonUnifier.getLogichValue(i[i.length-1],t)),s>i.length-1?a:core.JsonUnifier.getLogichValue(i[s],t)}case "sequentialrandom":{let a=narration.NarrationManagerStatic.getRandomNumber(0,i.length-1,{nestedId:e.nestedId,onceOnly:true});if(a===void 0&&e.end==="lastItem"){let s=narration.NarrationManagerStatic.getCurrentStepTimesCounterData(e.nestedId);if(!s?.usedRandomNumbers){o.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let c=s.usedRandomNumbers[`0-${i.length-1}`];return core.JsonUnifier.getLogichValue(i[c[c.length-1]],t)}if(a===void 0){o.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return core.JsonUnifier.getLogichValue(i[a],t)}}}}return e}function M(e,t={}){if(e.conditionalStep){let i=pixiVn.createExportableElement(core.JsonUnifier.getLogichValue(e.conditionalStep,t));if(i?.glueEnabled===void 0&&delete i?.glueEnabled,i?.goNextStep===void 0&&delete i?.goNextStep,i?.end===void 0&&delete i?.end,i?.choices===void 0&&delete i?.choices,i?.dialogue===void 0&&delete i?.dialogue,i?.labelToOpen===void 0&&delete i?.labelToOpen,i?.operations===void 0&&delete i?.operations,i){let a={...e,conditionalStep:void 0,...i};return M(a,t)}else narration.narration.dialogGlue&&(narration.narration.dialogGlue=false);}return e}function ve(e,t){let i=e.firstItem,a=(e.secondConditionalItem??[]).flatMap(c=>Array.isArray(c)?c.map(p=>core.JsonUnifier.getLogichValue(p,t)):[core.JsonUnifier.getLogichValue(c,t)]),s=i?[i,...a]:a;if(s.length===0){o.warn("combinateResult toCheck.length === 0");return}if(typeof s[0]=="string")return translator.translator.t(s);if(typeof s[0]=="object"){let c=s,p,C=false,O=c.map((l,y)=>{l=M(l,t);let d=core.JsonUnifier.getLogichValue(l.dialogue,t)||"";return y===0?(p=core.JsonUnifier.getLogichValue(l.glueEnabled,t)||false,d):(typeof d=="object"&&"text"in d&&(d=`${d.character}: ${d.text}`),p===false&&C&&(d=`
2
2
 
3
- ${p}`),p&&(C=true),u=core.JsonUnifier.getLogichValue(c.glueEnabled,i)||false,p)}),b=core.JsonUnifier.getLogichValue(O[0],i),k=typeof b=="object"&&"character"in b?b.character:void 0,L=O.flatMap(c=>{let h;c&&typeof c=="object"&&"text"in c?h=c.text:h=c;let p;return Array.isArray(h)?p=h.map(D=>{let F=core.JsonUnifier.getLogichValue(D,i);return translator.translator.t(`${F}`)}):p=core.JsonUnifier.getLogichValue(h,i)||"",translator.translator.t(p)}),_=r.find(c=>c.end),$=r.find(c=>c.choices),j=false,I=false;r.length>0&&(r[0].glueEnabled&&r[0].goNextStep&&r[0].dialogue===void 0&&(narration.narration.dialogGlue=true),j=r[r.length-1].glueEnabled,I=r.reverse().find(c=>!(c.operations&&(!c.dialogue||!c.choices)))?.goNextStep);let G=r.find(c=>c.labelToOpen),w=[];return r.forEach(c=>{c.operations&&(w=[...w,...c.operations]);}),{dialogue:k?{character:k,text:L}:L,end:_?.end,choices:$?.choices,glueEnabled:j,goNextStep:I,labelToOpen:G?.labelToOpen,operations:w}}}exports.animateOperation=_e;exports.canvasElementOperation=ze;exports.effectOperation=Me;exports.getConditionalStep=M;exports.getLogichValue=Ve;exports.getValueFromConditionalStatements=ye;exports.imageContainerOperation=Ae;exports.imageOperation=Ie;exports.loadAssets=Te;exports.narrationOperation=De;exports.setInitialStorageValue=Vi;exports.setStorageValue=xi;exports.soundOperation=We;exports.textOperation=Re;exports.videoOperation=Ee;
3
+ ${d}`),d&&(C=true),p=core.JsonUnifier.getLogichValue(l.glueEnabled,t)||false,d)}),S=core.JsonUnifier.getLogichValue(O[0],t),A=typeof S=="object"&&"character"in S?S.character:void 0,k=O.flatMap(l=>{let y;l&&typeof l=="object"&&"text"in l?y=l.text:y=l;let d;return Array.isArray(y)?d=y.map(D=>{let F=core.JsonUnifier.getLogichValue(D,t);return translator.translator.t(`${F}`)}):d=core.JsonUnifier.getLogichValue(y,t)||"",translator.translator.t(d)}),_=c.find(l=>l.end),$=c.find(l=>l.choices),j=false,L=false;c.length>0&&(c[0].glueEnabled&&c[0].goNextStep&&c[0].dialogue===void 0&&(narration.narration.dialogGlue=true),j=c[c.length-1].glueEnabled,L=c.reverse().find(l=>!(l.operations&&(!l.dialogue||!l.choices)))?.goNextStep);let G=c.find(l=>l.labelToOpen),b=[];return c.forEach(l=>{l.operations&&(b=[...b,...l.operations]);}),{dialogue:A?{character:A,text:k}:k,end:_?.end,choices:$?.choices,glueEnabled:j,goNextStep:L,labelToOpen:G?.labelToOpen,operations:b}}}exports.animateOperation=_e;exports.canvasElementOperation=ze;exports.effectOperation=Me;exports.getConditionalStep=M;exports.getLogichValue=xe;exports.getValueFromConditionalStatements=Ne;exports.imageContainerOperation=Ee;exports.imageOperation=Le;exports.loadAssets=Te;exports.narrationOperation=De;exports.setInitialStorageValue=xi;exports.setStorageValue=gi;exports.soundOperation=We;exports.textOperation=Re;exports.videoOperation=Ie;
@@ -1,4 +1,4 @@
1
- import { c as PixiVNJsonOperation, b as PixiVNJsonIfElse, d as PixiVNJsonOperationString, e as PixiVNJsonCanvasAnimate, f as PixiVNJsonUnknownEdit, g as PixiVNJsonCanvasRemove, h as PixiVNJsonCanvasEffect, i as PixiVNJsonCanvasImageContainerShow, j as PixiVNJsonImageContainerEdit, k as PixiVNJsonCanvasImageVideoShow, l as PixiVNJsonImageEdit, m as PixiVNJsonCanvasTextShow, n as PixiVNJsonTextEdit, o as PixiVNJsonVideoEdit, p as PixiVNJsonVideoPauseResume, q as PixiVNJsonNarration, r as PixiVNJsonSound, P as PixiVNJsonLabelStep, s as PixiVNJsonValueGet, t as PixiVNJsonArithmeticOperations, u as PixiVNJsonConditions, v as PixiVNJsonFunction, w as PixiVNJsonConditionalStatements, x as PixiVNJsonConditionalResultToCombine, y as PixiVNJsonOnlyStorageSet, a as PixiVNJsonValueSet } from './PixiVNJsonLabelStep-DgN7qF7j.cjs';
1
+ import { c as PixiVNJsonOperation, b as PixiVNJsonIfElse, d as PixiVNJsonOperationString, e as PixiVNJsonCanvasAnimate, f as PixiVNJsonUnknownEdit, g as PixiVNJsonCanvasRemove, h as PixiVNJsonCanvasEffect, i as PixiVNJsonCanvasImageContainerShow, j as PixiVNJsonImageContainerEdit, k as PixiVNJsonCanvasImageVideoShow, l as PixiVNJsonImageEdit, m as PixiVNJsonCanvasTextShow, n as PixiVNJsonTextEdit, o as PixiVNJsonVideoEdit, p as PixiVNJsonVideoPauseResume, q as PixiVNJsonNarration, r as PixiVNJsonSound, P as PixiVNJsonLabelStep, s as PixiVNJsonValueGet, t as PixiVNJsonArithmeticOperations, u as PixiVNJsonConditions, v as PixiVNJsonFunction, w as PixiVNJsonConditionalStatements, x as PixiVNJsonConditionalResultToCombine, y as PixiVNJsonOnlyStorageSet, a as PixiVNJsonValueSet } from './PixiVNJsonLabelStep-C-9WKwTo.cjs';
2
2
  import { ImageSpriteMemory, VideoSpriteMemory, ContainerMemory, ContainerChild } from '@drincs/pixi-vn/canvas';
3
3
  import { StepLabelPropsType } from '@drincs/pixi-vn/narration';
4
4
  import { StorageElementType } from '@drincs/pixi-vn/storage';
package/dist/actions.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { c as PixiVNJsonOperation, b as PixiVNJsonIfElse, d as PixiVNJsonOperationString, e as PixiVNJsonCanvasAnimate, f as PixiVNJsonUnknownEdit, g as PixiVNJsonCanvasRemove, h as PixiVNJsonCanvasEffect, i as PixiVNJsonCanvasImageContainerShow, j as PixiVNJsonImageContainerEdit, k as PixiVNJsonCanvasImageVideoShow, l as PixiVNJsonImageEdit, m as PixiVNJsonCanvasTextShow, n as PixiVNJsonTextEdit, o as PixiVNJsonVideoEdit, p as PixiVNJsonVideoPauseResume, q as PixiVNJsonNarration, r as PixiVNJsonSound, P as PixiVNJsonLabelStep, s as PixiVNJsonValueGet, t as PixiVNJsonArithmeticOperations, u as PixiVNJsonConditions, v as PixiVNJsonFunction, w as PixiVNJsonConditionalStatements, x as PixiVNJsonConditionalResultToCombine, y as PixiVNJsonOnlyStorageSet, a as PixiVNJsonValueSet } from './PixiVNJsonLabelStep-DgN7qF7j.js';
1
+ import { c as PixiVNJsonOperation, b as PixiVNJsonIfElse, d as PixiVNJsonOperationString, e as PixiVNJsonCanvasAnimate, f as PixiVNJsonUnknownEdit, g as PixiVNJsonCanvasRemove, h as PixiVNJsonCanvasEffect, i as PixiVNJsonCanvasImageContainerShow, j as PixiVNJsonImageContainerEdit, k as PixiVNJsonCanvasImageVideoShow, l as PixiVNJsonImageEdit, m as PixiVNJsonCanvasTextShow, n as PixiVNJsonTextEdit, o as PixiVNJsonVideoEdit, p as PixiVNJsonVideoPauseResume, q as PixiVNJsonNarration, r as PixiVNJsonSound, P as PixiVNJsonLabelStep, s as PixiVNJsonValueGet, t as PixiVNJsonArithmeticOperations, u as PixiVNJsonConditions, v as PixiVNJsonFunction, w as PixiVNJsonConditionalStatements, x as PixiVNJsonConditionalResultToCombine, y as PixiVNJsonOnlyStorageSet, a as PixiVNJsonValueSet } from './PixiVNJsonLabelStep-C-9WKwTo.js';
2
2
  import { ImageSpriteMemory, VideoSpriteMemory, ContainerMemory, ContainerChild } from '@drincs/pixi-vn/canvas';
3
3
  import { StepLabelPropsType } from '@drincs/pixi-vn/narration';
4
4
  import { StorageElementType } from '@drincs/pixi-vn/storage';
package/dist/actions.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import {JsonUnifier}from'@drincs/pixi-vn-json/core';import {Assets,canvas,ImageSprite,showImage,VideoSprite,showVideo,ImageContainer,showImageContainer,Text,showText,shakeEffect,pushOut,zoomOut,moveOut,removeWithDissolve,removeWithFade,pushIn,zoomIn,moveIn,showWithDissolve,showWithFade}from'@drincs/pixi-vn/canvas';import {translator}from'@drincs/pixi-vn-json/translator';import {narration,NarrationManagerStatic}from'@drincs/pixi-vn/narration';import {sound}from'@drincs/pixi-vn/sound';import {PixiError,createExportableElement}from'@drincs/pixi-vn';import {storage}from'@drincs/pixi-vn/storage';var q=Object.defineProperty;var W=(e,i,t)=>i in e?q(e,i,{enumerable:true,configurable:true,writable:true,value:t}):e[i]=t;var d=(e,i,t)=>W(e,typeof i!="symbol"?i+"":i,t);async function Te(e){let i=JsonUnifier.getLogichValue(e,{});if(i)switch(i.type){case "assets":switch(i.operationType){case "load":await Assets.load(i.aliases);break;case "lazyload":Assets.backgroundLoad(i.aliases);break}break;case "bundle":switch(i.operationType){case "load":await Assets.loadBundle(i.aliases);break;case "lazyload":Assets.backgroundLoadBundle(i.aliases);break}break}}var o;(l=>(l.log=(r,...u)=>console.log(`[Pixi\u2019VN Json] ${r}`,...u),l.warn=(r,...u)=>console.warn(`[Pixi\u2019VN Json] ${r}`,...u),l.error=(r,...u)=>console.error(`[Pixi\u2019VN Json] ${r}`,...u),l.info=(r,...u)=>console.info(`[Pixi\u2019VN Json] ${r}`,...u)))(o||(o={}));async function v(e,i,t){switch(t.type){case "fade":await showWithFade(i.alias,e,t.props,t.priority);break;case "dissolve":await showWithDissolve(i.alias,e,t.props,t.priority);break;case "movein":case "moveout":await moveIn(i.alias,e,t.props,t.priority);break;case "zoomin":case "zoomout":await zoomIn(i.alias,e,t.props,t.priority);break;case "pushin":case "pushout":await pushIn(i.alias,e,t.props,t.priority);break}}function N(e){if(e.transition)switch(e.transition.type){case "fade":removeWithFade(e.alias,e.transition.props,e.transition.priority);break;case "dissolve":removeWithDissolve(e.alias,e.transition.props,e.transition.priority);break;case "movein":case "moveout":moveOut(e.alias,e.transition.props,e.transition.priority);break;case "zoomin":case "zoomout":zoomOut(e.alias,e.transition.props,e.transition.priority);break;case "pushin":case "pushout":pushOut(e.alias,e.transition.props,e.transition.priority);break}else canvas.remove(e.alias);}async function Ie(e){switch(e.operationType){case "show":if(e.transition){let i=new ImageSprite(e.props,e.url||e.alias);await v(i,e,e.transition);}else await showImage(e.alias,e.url,e.props);break;case "edit":{let i=canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):o.error(`Image with alias ${e.alias} not found.`);break}case "remove":N(e);break}}async function Ee(e){switch(e.operationType){case "show":if(e.transition){let i=new VideoSprite(e.props,e.url||e.alias);await v(i,e,e.transition);}else await showVideo(e.alias,e.url,e.props);break;case "edit":{let i=canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):o.error(`Video with alias ${e.alias} not found.`);break}case "remove":N(e);break;case "pause":case "resume":{let i=canvas.find(e.alias);i?i.paused=e.operationType==="pause":o.error(`Video with alias ${e.alias} not found.`);break}}}async function Ae(e){switch(e.operationType){case "show":if(e.transition){let i=new ImageContainer(e.props,e.urls);await v(i,e,e.transition);}else await showImageContainer(e.alias,e.urls,e.props);break;case "edit":{let i=canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):o.error(`ImageContainer with alias ${e.alias} not found.`);break}case "remove":N(e);break}}async function Re(e){switch(e.operationType){case "show":if(e.props=e.props||{},e.props.text=translator.t(e.text),e.transition){let i=new Text(e.props);await v(i,e,e.transition);}else showText(e.alias,e.text,e.props);break;case "edit":{let i=canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):o.error(`Text with alias ${e.alias} not found.`);break}case "remove":N(e);break}}async function ze(e){switch(e.operationType){case "edit":try{let i=canvas.find(e.alias);i?e.props&&i.setMemory({...i.memory,...e.props}):o.error(`Canvas Element with alias ${e.alias} not found.`);}catch(i){o.error(`There was an error while trying to edit the canvas element with alias ${e.alias}.`,i);}break;case "remove":N(e);break}}async function Me(e){e.type==="shake"&&await shakeEffect(e.alias,e.props,e.priority);}function _e(e){switch(e.type){case "animate":canvas.animate(e.alias,e.keyframes,e.options,e.priority);break;case "animate-sequence":canvas.animate(e.alias,e.sequence,e.options,e.priority);break}}function De(e){switch(e.type){case "input":narration.requestInput({type:e.valueType},e.defaultValue);break;case "dialogue":narration.dialogue=void 0;break}}function We(e){switch(e.operationType){case "play":e.url?sound.play(e.alias,e.url,e.props):sound.play(e.alias,e.props);break;case "stop":switch(e.type){case "sound":sound.stop(e.alias);break;case "all":sound.stopAll();break}break;case "pause":switch(e.type){case "sound":sound.pause(e.alias);break;case "channel":sound.findChannel(e.alias).pauseAll();break;case "all":sound.pauseAll();break}break;case "resume":switch(e.type){case "sound":sound.resume(e.alias);break;case "channel":sound.findChannel(e.alias).resumeAll();break;case "all":sound.resumeAll();break}break;case "edit":Object.entries(e.props).forEach(([i,t])=>{let a=sound.find(e.alias);a&&(i==="volume"?a.volume.value=t:a.paused=t);});break}}var J="___param___";var n=class n{static init(i){i.loadAssets&&(n._loadAssets=i.loadAssets),i.soundOperation&&(n._soundOperation=i.soundOperation),i.imageOperation&&(n._imageOperation=i.imageOperation),i.videoOperation&&(n._videoOperation=i.videoOperation),i.imageContainerOperation&&(n._imageContainerOperation=i.imageContainerOperation),i.textOperation&&(n._textOperation=i.textOperation),i.canvasElementOperation&&(n._canvasElementOperation=i.canvasElementOperation),i.setStorageValue&&(n._setStorageValue=i.setStorageValue),i.setInitialStorageValue&&(n._setInitialStorageValue=i.setInitialStorageValue),i.narrationOperation&&(n._narrationOperation=i.narrationOperation),i.effectOperation&&(n._effectOperation=i.effectOperation),i.animateOperation&&(n._animateOperation=i.animateOperation),i.getLogichValue&&(n._getLogichValue=i.getLogichValue),i.getConditionalStep&&(n._getConditionalStep=i.getConditionalStep);}static get loadAssets(){return n._loadAssets}static get soundOperation(){return n._soundOperation}static get imageOperation(){return n._imageOperation}static get videoOperation(){return n._videoOperation}static get imageContainerOperation(){return n._imageContainerOperation}static get textOperation(){return n._textOperation}static get canvasElementOperation(){return n._canvasElementOperation}static get setStorageValue(){return n._setStorageValue}static get setInitialStorageValue(){return n._setInitialStorageValue}static get narrationOperation(){return n._narrationOperation}static get effectOperation(){return n._effectOperation}static get animateOperation(){return n._animateOperation}static get getLogichValue(){return n._getLogichValue}static get getConditionalStep(){return n._getConditionalStep}};d(n,"_loadAssets",()=>{}),d(n,"_soundOperation",()=>{throw o.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.")}),d(n,"_imageOperation",()=>{throw o.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.")}),d(n,"_videoOperation",()=>{throw o.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.")}),d(n,"_imageContainerOperation",()=>{throw o.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.")}),d(n,"_textOperation",()=>{throw o.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.")}),d(n,"_canvasElementOperation",()=>{throw o.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.")}),d(n,"_setStorageValue",()=>{throw o.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.")}),d(n,"_setInitialStorageValue",()=>{throw o.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.")}),d(n,"_narrationOperation",()=>{throw o.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.")}),d(n,"_effectOperation",()=>{throw o.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.")}),d(n,"_animateOperation",()=>{throw o.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.")}),d(n,"_getLogichValue",()=>{throw o.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.")}),d(n,"_getConditionalStep",()=>{throw o.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.")});var f=n;function R(e,i){if(i&&typeof i=="object"&&typeof e.functionName=="string"&&e.functionName in i){let t=i[e.functionName];if(typeof t=="function"){let a=e.args.map(l=>f.getLogichValue(l,i));return t(...a)}else o.warn(`getLogichValue function ${e.functionName} not found in props`);}}function z(e,i){let t=JsonUnifier.getLogichValue(e,i);return t&&typeof t=="object"&&"type"in t?JsonUnifier.getLogichValue(t,i):t}function xi(e,i={}){let t=z(e.value,i);switch(e.storageType){case "flagStorage":storage.setFlag(e.key,e.value);break;case "storage":storage.set(e.key,t);break;case "tempstorage":storage.setTempVariable(e.key,t);break;case "params":{let a=storage.get(`${J}${narration.openedLabels.length-1}`)||[];a.length>e.key&&(a[e.key]=t),storage.setTempVariable(`${J}${narration.openedLabels.length-1}`,a);break}}}function Vi(e,i={}){let t=z(e.value,i);switch(e.storageType){case "storage":case "tempstorage":storage.default={[e.key]:t};break}}function Ve(e,i={}){let t=ye(e,i);if(t&&typeof t=="object"&&"type"in t)switch(t.type){case "value":return Pe(t,i);case "arithmetic":case "arithmeticsingle":return ge(t,i);case "compare":case "valueCondition":case "union":return he(t,i);case "function":return R(t,i)}return t}function ge(e,i){let t=JsonUnifier.getLogichValue(e.leftValue,i);switch(e.type){case "arithmetic":{let a=JsonUnifier.getLogichValue(e.rightValue,i);switch(e.operator){case "*":return t*a;case "/":return t/a;case "+":return t+a;case "-":return t-a;case "%":return t%a;case "POW":return t**a;case "RANDOM":return narration.getRandomNumber(t,a)}}case "arithmeticsingle":switch(e.operator){case "INT":return Number(t);case "FLOOR":return Math.floor(t);}break}}function Pe(e,i){if(e&&typeof e=="object"&&"type"in e&&e.type==="value"&&e.storageOperationType==="get")switch(e.storageType){case "storage":case "tempstorage":return e.key==="_input_value_"?narration.inputValue:storage.get(e.key);case "flagStorage":return storage.getFlag(e.key);case "label":return narration.getTimesLabelOpened(e.label);case "choice":return narration.getTimesChoiceMade(e.index);case "logic":return JsonUnifier.getLogichValue(e.operation,i);case "params":{let t=storage.get(`${J}${narration.openedLabels.length-1}`)||[];if(t&&t.length>e.key)return t[e.key];o.warn("getValue params not found");return}}return e}function he(e,i){if(!e)return false;if(typeof e!="object"||!("type"in e))return !!e;switch(e.type){case "compare":{let t=JsonUnifier.getLogichValue(e.leftValue,i),a=JsonUnifier.getLogichValue(e.rightValue,i);switch(e.operator){case "==":return t===a;case "!=":return t!==a;case "<":return t<a;case "<=":return t<=a;case ">":return t>a;case ">=":return t>=a;case "CONTAINS":return t.toString().includes(a.toString())}break}case "valueCondition":return !!JsonUnifier.getLogichValue(e.value,i);case "union":return fe(e,i)}return !!e}function fe(e,i){if(e.unionType==="not")return !Ve(e.condition,i);let t=a=>JsonUnifier.getLogichValue(a,i)||false;return e.unionType==="and"?e.conditions.every(t):e.conditions.some(t)}function Ne(e,i){return Math.floor(Math.random()*(i-e+1)+e)}function ye(e,i={}){if(Array.isArray(e)||!e)return e;if(e&&typeof e=="object"&&"type"in e)switch(e.type){case "resulttocombine":return ve(e,i);case "ifelse":return JsonUnifier.getLogichValue(e.condition,i)?JsonUnifier.getLogichValue(e.then,i):JsonUnifier.getLogichValue(e.else,i);case "stepswitch":{let t=JsonUnifier.getLogichValue(e.elements,i)||[];if(t.length===0){o.error("getValueFromConditionalStatements elements.length === 0");return}switch(e.choiceType){case "random":{let a=Ne(0,t.length-1);return JsonUnifier.getLogichValue(t[a],i)}case "loop":{let a=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return a>t.length-1?(a=a%t.length,JsonUnifier.getLogichValue(t[a],i)):JsonUnifier.getLogichValue(t[a],i)}case "sequential":{let a,l=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return e.end==="lastItem"&&(a=JsonUnifier.getLogichValue(t[t.length-1],i)),l>t.length-1?a:JsonUnifier.getLogichValue(t[l],i)}case "sequentialrandom":{let a=NarrationManagerStatic.getRandomNumber(0,t.length-1,{nestedId:e.nestedId,onceOnly:true});if(a===void 0&&e.end==="lastItem"){let l=NarrationManagerStatic.getCurrentStepTimesCounterData(e.nestedId);if(!l?.usedRandomNumbers){o.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let r=l.usedRandomNumbers[`0-${t.length-1}`];return JsonUnifier.getLogichValue(t[r[r.length-1]],i)}if(a===void 0){o.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return JsonUnifier.getLogichValue(t[a],i)}}}}return e}function M(e,i={}){if(e.conditionalStep){let t=createExportableElement(JsonUnifier.getLogichValue(e.conditionalStep,i));if(t?.glueEnabled===void 0&&delete t?.glueEnabled,t?.goNextStep===void 0&&delete t?.goNextStep,t?.end===void 0&&delete t?.end,t?.choices===void 0&&delete t?.choices,t?.dialogue===void 0&&delete t?.dialogue,t?.labelToOpen===void 0&&delete t?.labelToOpen,t?.operations===void 0&&delete t?.operations,t){let a={...e,conditionalStep:void 0,...t};return M(a,i)}else narration.dialogGlue&&(narration.dialogGlue=false);}return e}function ve(e,i){let t=e.firstItem,a=(e.secondConditionalItem??[]).flatMap(r=>Array.isArray(r)?r.map(u=>JsonUnifier.getLogichValue(u,i)):[JsonUnifier.getLogichValue(r,i)]),l=t?[t,...a]:a;if(l.length===0){o.warn("combinateResult toCheck.length === 0");return}if(typeof l[0]=="string")return translator.t(l);if(typeof l[0]=="object"){let r=l,u,C=false,O=r.map((c,h)=>{c=M(c,i);let p=JsonUnifier.getLogichValue(c.dialogue,i)||"";return h===0?(u=JsonUnifier.getLogichValue(c.glueEnabled,i)||false,p):(typeof p=="object"&&"text"in p&&(p=`${p.character}: ${p.text}`),u===false&&C&&(p=`
1
+ import {JsonUnifier}from'@drincs/pixi-vn-json/core';import {Assets,canvas,ImageSprite,showImage,VideoSprite,showVideo,ImageContainer,showImageContainer,Text,showText,shakeEffect,pushOut,zoomOut,moveOut,removeWithDissolve,removeWithFade,pushIn,zoomIn,moveIn,showWithDissolve,showWithFade}from'@drincs/pixi-vn/canvas';import {translator}from'@drincs/pixi-vn-json/translator';import {narration,NarrationManagerStatic}from'@drincs/pixi-vn/narration';import {sound}from'@drincs/pixi-vn/sound';import {PixiError,createExportableElement}from'@drincs/pixi-vn';import {storage}from'@drincs/pixi-vn/storage';var q=Object.defineProperty;var W=(e,t,i)=>t in e?q(e,t,{enumerable:true,configurable:true,writable:true,value:i}):e[t]=i;var u=(e,t,i)=>W(e,typeof t!="symbol"?t+"":t,i);async function Te(e){let t=JsonUnifier.getLogichValue(e,{});if(t)switch(t.type){case "assets":switch(t.operationType){case "load":await Assets.load(t.aliases);break;case "lazyload":Assets.backgroundLoad(t.aliases);break}break;case "bundle":switch(t.operationType){case "load":await Assets.loadBundle(t.aliases);break;case "lazyload":Assets.backgroundLoadBundle(t.aliases);break}break}}var o;(s=>(s.log=(c,...p)=>console.log(`[Pixi\u2019VN Json] ${c}`,...p),s.warn=(c,...p)=>console.warn(`[Pixi\u2019VN Json] ${c}`,...p),s.error=(c,...p)=>console.error(`[Pixi\u2019VN Json] ${c}`,...p),s.info=(c,...p)=>console.info(`[Pixi\u2019VN Json] ${c}`,...p)))(o||(o={}));async function v(e,t,i){switch(i.type){case "fade":await showWithFade(t.alias,e,i.props,i.priority);break;case "dissolve":await showWithDissolve(t.alias,e,i.props,i.priority);break;case "movein":case "moveout":await moveIn(t.alias,e,i.props,i.priority);break;case "zoomin":case "zoomout":await zoomIn(t.alias,e,i.props,i.priority);break;case "pushin":case "pushout":await pushIn(t.alias,e,i.props,i.priority);break}}function P(e){if(e.transition)switch(e.transition.type){case "fade":removeWithFade(e.alias,e.transition.props,e.transition.priority);break;case "dissolve":removeWithDissolve(e.alias,e.transition.props,e.transition.priority);break;case "movein":case "moveout":moveOut(e.alias,e.transition.props,e.transition.priority);break;case "zoomin":case "zoomout":zoomOut(e.alias,e.transition.props,e.transition.priority);break;case "pushin":case "pushout":pushOut(e.alias,e.transition.props,e.transition.priority);break}else canvas.remove(e.alias);}async function Le(e){switch(e.operationType){case "show":if(e.transition){let t=new ImageSprite(e.props,e.url||e.alias);await v(t,e,e.transition);}else await showImage(e.alias,e.url,e.props);break;case "edit":{let t=canvas.find(e.alias);t?e.props&&await t.setMemory({...t.memory,...e.props}):o.error(`Image with alias ${e.alias} not found.`);break}case "remove":P(e);break}}async function Ie(e){switch(e.operationType){case "show":if(e.transition){let t=new VideoSprite(e.props,e.url||e.alias);await v(t,e,e.transition);}else await showVideo(e.alias,e.url,e.props);break;case "edit":{let t=canvas.find(e.alias);t?e.props&&await t.setMemory({...t.memory,...e.props}):o.error(`Video with alias ${e.alias} not found.`);break}case "remove":P(e);break;case "pause":case "resume":{let t=canvas.find(e.alias);t?t.paused=e.operationType==="pause":o.error(`Video with alias ${e.alias} not found.`);break}}}async function Ee(e){switch(e.operationType){case "show":if(e.transition){let t=new ImageContainer(e.props,e.urls);await v(t,e,e.transition);}else await showImageContainer(e.alias,e.urls,e.props);break;case "edit":{let t=canvas.find(e.alias);t?e.props&&await t.setMemory({...t.memory,...e.props}):o.error(`ImageContainer with alias ${e.alias} not found.`);break}case "remove":P(e);break}}async function Re(e){switch(e.operationType){case "show":if(e.props=e.props||{},e.props.text=translator.t(e.text),e.transition){let t=new Text(e.props);await v(t,e,e.transition);}else showText(e.alias,e.text,e.props);break;case "edit":{let t=canvas.find(e.alias);t?e.props&&await t.setMemory({...t.memory,...e.props}):o.error(`Text with alias ${e.alias} not found.`);break}case "remove":P(e);break}}async function ze(e){switch(e.operationType){case "edit":try{let t=canvas.find(e.alias);t?e.props&&t.setMemory({...t.memory,...e.props}):o.error(`Canvas Element with alias ${e.alias} not found.`);}catch(t){o.error(`There was an error while trying to edit the canvas element with alias ${e.alias}.`,t);}break;case "remove":P(e);break}}async function Me(e){e.type==="shake"&&await shakeEffect(e.alias,e.props,e.priority);}function _e(e){switch(e.type){case "animate":canvas.animate(e.alias,e.keyframes,e.options,e.priority);break;case "animate-sequence":canvas.animate(e.alias,e.sequence,e.options,e.priority);break}}function De(e){switch(e.type){case "input":narration.requestInput({type:e.valueType},e.defaultValue);break;case "dialogue":narration.dialogue=void 0;break}}function We(e){switch(e.operationType){case "play":e.url?sound.play(e.alias,e.url,e.props):sound.play(e.alias,e.props);break;case "stop":switch(e.type){case "sound":sound.stop(e.alias);break;case "all":sound.stopAll();break}break;case "pause":switch(e.type){case "sound":sound.pause(e.alias);break;case "channel":sound.findChannel(e.alias).pauseAll();break;case "all":sound.pauseAll();break}break;case "resume":switch(e.type){case "sound":sound.resume(e.alias);break;case "channel":sound.findChannel(e.alias).resumeAll();break;case "all":sound.resumeAll();break}break;case "edit":Object.entries(e.props).forEach(([t,i])=>{let a=sound.find(e.alias);a&&(t==="volume"?a.volume.value=i:a.paused=i);});break}}var J="___param___";var n=class n{static init(t){t.loadAssets&&(n._loadAssets=t.loadAssets),t.soundOperation&&(n._soundOperation=t.soundOperation),t.imageOperation&&(n._imageOperation=t.imageOperation),t.videoOperation&&(n._videoOperation=t.videoOperation),t.imageContainerOperation&&(n._imageContainerOperation=t.imageContainerOperation),t.textOperation&&(n._textOperation=t.textOperation),t.canvasElementOperation&&(n._canvasElementOperation=t.canvasElementOperation),t.setStorageValue&&(n._setStorageValue=t.setStorageValue),t.setInitialStorageValue&&(n._setInitialStorageValue=t.setInitialStorageValue),t.narrationOperation&&(n._narrationOperation=t.narrationOperation),t.effectOperation&&(n._effectOperation=t.effectOperation),t.animateOperation&&(n._animateOperation=t.animateOperation),t.getLogichValue&&(n._getLogichValue=t.getLogichValue),t.getConditionalStep&&(n._getConditionalStep=t.getConditionalStep);}static get loadAssets(){return n._loadAssets}static get soundOperation(){return n._soundOperation}static get imageOperation(){return n._imageOperation}static get videoOperation(){return n._videoOperation}static get imageContainerOperation(){return n._imageContainerOperation}static get textOperation(){return n._textOperation}static get canvasElementOperation(){return n._canvasElementOperation}static get setStorageValue(){return n._setStorageValue}static get setInitialStorageValue(){return n._setInitialStorageValue}static get narrationOperation(){return n._narrationOperation}static get effectOperation(){return n._effectOperation}static get animateOperation(){return n._animateOperation}static get getLogichValue(){return n._getLogichValue}static get getConditionalStep(){return n._getConditionalStep}};u(n,"_loadAssets",()=>{}),u(n,"_soundOperation",()=>{throw o.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.")}),u(n,"_imageOperation",()=>{throw o.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.")}),u(n,"_videoOperation",()=>{throw o.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.")}),u(n,"_imageContainerOperation",()=>{throw o.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.")}),u(n,"_textOperation",()=>{throw o.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.")}),u(n,"_canvasElementOperation",()=>{throw o.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.")}),u(n,"_setStorageValue",()=>{throw o.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.")}),u(n,"_setInitialStorageValue",()=>{throw o.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.")}),u(n,"_narrationOperation",()=>{throw o.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.")}),u(n,"_effectOperation",()=>{throw o.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.")}),u(n,"_animateOperation",()=>{throw o.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.")}),u(n,"_getLogichValue",()=>{throw o.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.")}),u(n,"_getConditionalStep",()=>{throw o.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.")});var h=n;function R(e,t){if(t&&typeof t=="object"&&typeof e.functionName=="string"&&e.functionName in t){let i=t[e.functionName];if(typeof i=="function"){let a=e.args.map(s=>h.getLogichValue(s,t));return i(...a)}else o.warn(`getLogichValue function ${e.functionName} not found in props`);}}function z(e,t){let i=JsonUnifier.getLogichValue(e,t);return i&&typeof i=="object"&&"type"in i?JsonUnifier.getLogichValue(i,t):i}function gi(e,t={}){let i=z(e.value,t);switch(e.storageType){case "flagStorage":storage.setFlag(e.key,e.value);break;case "storage":storage.set(e.key,i);break;case "tempstorage":storage.setTempVariable(e.key,i);break;case "params":{let a=storage.get(`${J}${narration.openedLabels.length-1}`)||[];a.length>e.key&&(a[e.key]=i),storage.setTempVariable(`${J}${narration.openedLabels.length-1}`,a);break}}}function xi(e,t={}){let i=z(e.value,t);switch(e.storageType){case "storage":case "tempstorage":storage.default={[e.key]:i};break}}function xe(e,t={}){let i=Ne(e,t);if(i&&typeof i=="object"&&"type"in i)switch(i.type){case "value":return fe(i,t);case "arithmetic":case "arithmeticsingle":return Ve(i,t);case "compare":case "union":return ye(i,t);case "function":return R(i,t)}return i}function Ve(e,t){let i=JsonUnifier.getLogichValue(e.leftValue,t);switch(e.type){case "arithmetic":{let a=JsonUnifier.getLogichValue(e.rightValue,t);switch(e.operator){case "*":return i*a;case "/":return i/a;case "+":return typeof i=="string"||typeof a=="string"?`${i}${a}`:Array.isArray(i)&&Array.isArray(a)?[...i,...a]:Array.isArray(i)?[...i,a]:Array.isArray(a)?[i,...a]:i+a;case "-":if(Array.isArray(i)&&Array.isArray(a))return i.filter(s=>!a.includes(s));if(Array.isArray(i))return i.filter(s=>s!==a);if(Array.isArray(a)){o.warn("getValueFromArithmeticOperations cannot subtract array from non-array");return}return i-a;case "%":return i%a;case "POW":return i**a;case "RANDOM":return narration.getRandomNumber(i,a);case "INTERSECTION":if(Array.isArray(i)&&Array.isArray(a))return i.filter(s=>a.includes(s));o.warn("getValueFromArithmeticOperations cannot intersect non-array values");return;default:o.warn("getValueFromArithmeticOperations unknown operator",e);return}}case "arithmeticsingle":switch(e.operator){case "INT":return Number(i);case "FLOOR":return Math.floor(i);}break}}function fe(e,t){if(e&&typeof e=="object"&&"type"in e&&e.type==="value"&&e.storageOperationType==="get")switch(e.storageType){case "storage":case "tempstorage":return e.key==="_input_value_"?narration.inputValue:storage.get(e.key);case "flagStorage":return storage.getFlag(e.key);case "label":return narration.getTimesLabelOpened(e.label);case "choice":return narration.getTimesChoiceMade(e.index);case "logic":return JsonUnifier.getLogichValue(e.operation,t);case "params":{let i=storage.get(`${J}${narration.openedLabels.length-1}`)||[];if(i&&i.length>e.key)return i[e.key];o.warn("getValue params not found");return}}return e}function ye(e,t){if(!e)return false;if(typeof e!="object"||!("type"in e))return !!e;switch(e.type){case "compare":{let i=JsonUnifier.getLogichValue(e.leftValue,t),a=JsonUnifier.getLogichValue(e.rightValue,t);switch(e.operator){case "==":return Array.isArray(i)&&Array.isArray(a)?i.length===a.length&&i.every(s=>a.includes(s)):i===a;case "!=":return Array.isArray(i)&&Array.isArray(a)?i.length!==a.length||!i.every(s=>a.includes(s)):i!==a;case "<":return typeof i=="string"&&typeof a=="string"?i.localeCompare(a)<0:Array.isArray(i)&&Array.isArray(a)?i.length<a.length:i<a;case "<=":return typeof i=="string"&&typeof a=="string"?i.localeCompare(a)<=0:Array.isArray(i)&&Array.isArray(a)?i.length<=a.length:i<=a;case ">":return typeof i=="string"&&typeof a=="string"?i.localeCompare(a)>0:Array.isArray(i)&&Array.isArray(a)?i.length>a.length:i>a;case ">=":return typeof i=="string"&&typeof a=="string"?i.localeCompare(a)>=0:Array.isArray(i)&&Array.isArray(a)?i.length>=a.length:i>=a;case "CONTAINS":return Array.isArray(i)&&Array.isArray(a)?a.every(s=>i.includes(s)):Array.isArray(i)?i.includes(a):i.toString().includes(a.toString())}break}case "value":{let i=JsonUnifier.getLogichValue(e,t);return Array.isArray(i)?i.length>0:i&&typeof i=="object"?Object.keys(i).length>0:!!i}case "union":return he(e,t)}return !!e}function he(e,t){if(e.unionType==="not"){let a=xe(e.condition,t);return Array.isArray(a)?a.length===0:a&&typeof a=="object"?Object.keys(a).length===0:!a}let i=a=>JsonUnifier.getLogichValue(a,t)||false;return e.unionType==="and"?e.conditions.every(i):e.conditions.some(i)}function Pe(e,t){return Math.floor(Math.random()*(t-e+1)+e)}function Ne(e,t={}){if(Array.isArray(e)||!e)return e;if(e&&typeof e=="object"&&"type"in e)switch(e.type){case "resulttocombine":return ve(e,t);case "ifelse":return JsonUnifier.getLogichValue(e.condition,t)?JsonUnifier.getLogichValue(e.then,t):JsonUnifier.getLogichValue(e.else,t);case "stepswitch":{let i=JsonUnifier.getLogichValue(e.elements,t)||[];if(i.length===0){o.error("getValueFromConditionalStatements elements.length === 0");return}switch(e.choiceType){case "random":{let a=Pe(0,i.length-1);return JsonUnifier.getLogichValue(i[a],t)}case "loop":{let a=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return a>i.length-1?(a=a%i.length,JsonUnifier.getLogichValue(i[a],t)):JsonUnifier.getLogichValue(i[a],t)}case "sequential":{let a,s=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return e.end==="lastItem"&&(a=JsonUnifier.getLogichValue(i[i.length-1],t)),s>i.length-1?a:JsonUnifier.getLogichValue(i[s],t)}case "sequentialrandom":{let a=NarrationManagerStatic.getRandomNumber(0,i.length-1,{nestedId:e.nestedId,onceOnly:true});if(a===void 0&&e.end==="lastItem"){let s=NarrationManagerStatic.getCurrentStepTimesCounterData(e.nestedId);if(!s?.usedRandomNumbers){o.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let c=s.usedRandomNumbers[`0-${i.length-1}`];return JsonUnifier.getLogichValue(i[c[c.length-1]],t)}if(a===void 0){o.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return JsonUnifier.getLogichValue(i[a],t)}}}}return e}function M(e,t={}){if(e.conditionalStep){let i=createExportableElement(JsonUnifier.getLogichValue(e.conditionalStep,t));if(i?.glueEnabled===void 0&&delete i?.glueEnabled,i?.goNextStep===void 0&&delete i?.goNextStep,i?.end===void 0&&delete i?.end,i?.choices===void 0&&delete i?.choices,i?.dialogue===void 0&&delete i?.dialogue,i?.labelToOpen===void 0&&delete i?.labelToOpen,i?.operations===void 0&&delete i?.operations,i){let a={...e,conditionalStep:void 0,...i};return M(a,t)}else narration.dialogGlue&&(narration.dialogGlue=false);}return e}function ve(e,t){let i=e.firstItem,a=(e.secondConditionalItem??[]).flatMap(c=>Array.isArray(c)?c.map(p=>JsonUnifier.getLogichValue(p,t)):[JsonUnifier.getLogichValue(c,t)]),s=i?[i,...a]:a;if(s.length===0){o.warn("combinateResult toCheck.length === 0");return}if(typeof s[0]=="string")return translator.t(s);if(typeof s[0]=="object"){let c=s,p,C=false,O=c.map((l,y)=>{l=M(l,t);let d=JsonUnifier.getLogichValue(l.dialogue,t)||"";return y===0?(p=JsonUnifier.getLogichValue(l.glueEnabled,t)||false,d):(typeof d=="object"&&"text"in d&&(d=`${d.character}: ${d.text}`),p===false&&C&&(d=`
2
2
 
3
- ${p}`),p&&(C=true),u=JsonUnifier.getLogichValue(c.glueEnabled,i)||false,p)}),b=JsonUnifier.getLogichValue(O[0],i),k=typeof b=="object"&&"character"in b?b.character:void 0,L=O.flatMap(c=>{let h;c&&typeof c=="object"&&"text"in c?h=c.text:h=c;let p;return Array.isArray(h)?p=h.map(D=>{let F=JsonUnifier.getLogichValue(D,i);return translator.t(`${F}`)}):p=JsonUnifier.getLogichValue(h,i)||"",translator.t(p)}),_=r.find(c=>c.end),$=r.find(c=>c.choices),j=false,I=false;r.length>0&&(r[0].glueEnabled&&r[0].goNextStep&&r[0].dialogue===void 0&&(narration.dialogGlue=true),j=r[r.length-1].glueEnabled,I=r.reverse().find(c=>!(c.operations&&(!c.dialogue||!c.choices)))?.goNextStep);let G=r.find(c=>c.labelToOpen),w=[];return r.forEach(c=>{c.operations&&(w=[...w,...c.operations]);}),{dialogue:k?{character:k,text:L}:L,end:_?.end,choices:$?.choices,glueEnabled:j,goNextStep:I,labelToOpen:G?.labelToOpen,operations:w}}}export{_e as animateOperation,ze as canvasElementOperation,Me as effectOperation,M as getConditionalStep,Ve as getLogichValue,ye as getValueFromConditionalStatements,Ae as imageContainerOperation,Ie as imageOperation,Te as loadAssets,De as narrationOperation,Vi as setInitialStorageValue,xi as setStorageValue,We as soundOperation,Re as textOperation,Ee as videoOperation};
3
+ ${d}`),d&&(C=true),p=JsonUnifier.getLogichValue(l.glueEnabled,t)||false,d)}),S=JsonUnifier.getLogichValue(O[0],t),A=typeof S=="object"&&"character"in S?S.character:void 0,k=O.flatMap(l=>{let y;l&&typeof l=="object"&&"text"in l?y=l.text:y=l;let d;return Array.isArray(y)?d=y.map(D=>{let F=JsonUnifier.getLogichValue(D,t);return translator.t(`${F}`)}):d=JsonUnifier.getLogichValue(y,t)||"",translator.t(d)}),_=c.find(l=>l.end),$=c.find(l=>l.choices),j=false,L=false;c.length>0&&(c[0].glueEnabled&&c[0].goNextStep&&c[0].dialogue===void 0&&(narration.dialogGlue=true),j=c[c.length-1].glueEnabled,L=c.reverse().find(l=>!(l.operations&&(!l.dialogue||!l.choices)))?.goNextStep);let G=c.find(l=>l.labelToOpen),b=[];return c.forEach(l=>{l.operations&&(b=[...b,...l.operations]);}),{dialogue:A?{character:A,text:k}:k,end:_?.end,choices:$?.choices,glueEnabled:j,goNextStep:L,labelToOpen:G?.labelToOpen,operations:b}}}export{_e as animateOperation,ze as canvasElementOperation,Me as effectOperation,M as getConditionalStep,xe as getLogichValue,Ne as getValueFromConditionalStatements,Ee as imageContainerOperation,Le as imageOperation,Te as loadAssets,De as narrationOperation,xi as setInitialStorageValue,gi as setStorageValue,We as soundOperation,Re as textOperation,Ie as videoOperation};
package/dist/core.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ImageSpriteMemory, VideoSpriteMemory, ContainerMemory, ContainerChild, StepLabelPropsType, StorageElementType } from '@drincs/pixi-vn';
2
- import { P as PixiVNJsonOperation, a as PixiVNJsonIfElse, b as PixiVNJsonOperationString, c as PixiVNJsonSound, d as PixiVNJsonCanvasImageVideoShow, e as PixiVNJsonImageEdit, f as PixiVNJsonCanvasRemove, g as PixiVNJsonVideoEdit, h as PixiVNJsonVideoPauseResume, i as PixiVNJsonCanvasImageContainerShow, j as PixiVNJsonImageContainerEdit, k as PixiVNJsonCanvasTextShow, l as PixiVNJsonTextEdit, m as PixiVNJsonUnknownEdit, n as PixiVNJsonValueSet, o as PixiVNJsonOnlyStorageSet, p as PixiVNJsonNarration, q as PixiVNJsonCanvasEffect, r as PixiVNJsonCanvasAnimate, s as PixiVNJsonValueGet, t as PixiVNJsonArithmeticOperations, u as PixiVNJsonConditions, v as PixiVNJsonConditionalStatements, w as PixiVNJsonLabelStep } from './PixiVNJsonLabelStep-dVwPLFMT.cjs';
2
+ import { P as PixiVNJsonOperation, a as PixiVNJsonIfElse, b as PixiVNJsonOperationString, c as PixiVNJsonSound, d as PixiVNJsonCanvasImageVideoShow, e as PixiVNJsonImageEdit, f as PixiVNJsonCanvasRemove, g as PixiVNJsonVideoEdit, h as PixiVNJsonVideoPauseResume, i as PixiVNJsonCanvasImageContainerShow, j as PixiVNJsonImageContainerEdit, k as PixiVNJsonCanvasTextShow, l as PixiVNJsonTextEdit, m as PixiVNJsonUnknownEdit, n as PixiVNJsonValueSet, o as PixiVNJsonOnlyStorageSet, p as PixiVNJsonNarration, q as PixiVNJsonCanvasEffect, r as PixiVNJsonCanvasAnimate, s as PixiVNJsonValueGet, t as PixiVNJsonArithmeticOperations, u as PixiVNJsonConditions, v as PixiVNJsonConditionalStatements, w as PixiVNJsonLabelStep } from './PixiVNJsonLabelStep-DQx6TBvZ.cjs';
3
3
  import '@drincs/pixi-vn/motion';
4
4
  import 'pixi.js';
5
5
 
package/dist/core.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ImageSpriteMemory, VideoSpriteMemory, ContainerMemory, ContainerChild, StepLabelPropsType, StorageElementType } from '@drincs/pixi-vn';
2
- import { P as PixiVNJsonOperation, a as PixiVNJsonIfElse, b as PixiVNJsonOperationString, c as PixiVNJsonSound, d as PixiVNJsonCanvasImageVideoShow, e as PixiVNJsonImageEdit, f as PixiVNJsonCanvasRemove, g as PixiVNJsonVideoEdit, h as PixiVNJsonVideoPauseResume, i as PixiVNJsonCanvasImageContainerShow, j as PixiVNJsonImageContainerEdit, k as PixiVNJsonCanvasTextShow, l as PixiVNJsonTextEdit, m as PixiVNJsonUnknownEdit, n as PixiVNJsonValueSet, o as PixiVNJsonOnlyStorageSet, p as PixiVNJsonNarration, q as PixiVNJsonCanvasEffect, r as PixiVNJsonCanvasAnimate, s as PixiVNJsonValueGet, t as PixiVNJsonArithmeticOperations, u as PixiVNJsonConditions, v as PixiVNJsonConditionalStatements, w as PixiVNJsonLabelStep } from './PixiVNJsonLabelStep-dVwPLFMT.js';
2
+ import { P as PixiVNJsonOperation, a as PixiVNJsonIfElse, b as PixiVNJsonOperationString, c as PixiVNJsonSound, d as PixiVNJsonCanvasImageVideoShow, e as PixiVNJsonImageEdit, f as PixiVNJsonCanvasRemove, g as PixiVNJsonVideoEdit, h as PixiVNJsonVideoPauseResume, i as PixiVNJsonCanvasImageContainerShow, j as PixiVNJsonImageContainerEdit, k as PixiVNJsonCanvasTextShow, l as PixiVNJsonTextEdit, m as PixiVNJsonUnknownEdit, n as PixiVNJsonValueSet, o as PixiVNJsonOnlyStorageSet, p as PixiVNJsonNarration, q as PixiVNJsonCanvasEffect, r as PixiVNJsonCanvasAnimate, s as PixiVNJsonValueGet, t as PixiVNJsonArithmeticOperations, u as PixiVNJsonConditions, v as PixiVNJsonConditionalStatements, w as PixiVNJsonLabelStep } from './PixiVNJsonLabelStep-DQx6TBvZ.js';
3
3
  import '@drincs/pixi-vn/motion';
4
4
  import 'pixi.js';
5
5
 
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');exports.VariableGetter=void 0;(A=>{let e=new Set;function L(i){e.add(i);}A.add=L;function J(){e.clear();}A.clear=J;function w(i,o={}){let n=r=>actions.getLogichValue(r,o)??void 0,a=actions.getValueFromConditionalStatements(i,o);if(e.size===0)return n(a);let s=n;for(let r of e){let d=s;s=c=>r(c,d)??void 0;}return s(a)}A.getLogichValue=w;})(exports.VariableGetter||(exports.VariableGetter={}));var p={version:"1.13.0"};var f="___param___",x=`https://pixi-vn.web.app/schemas/${p.version}/schema.json`,h=["==","!=","<","<=",">",">=","CONTAINS"];function X(){core.JsonUnifier.init({animateOperation:actions.animateOperation,canvasElementOperation:actions.canvasElementOperation,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:exports.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');exports.VariableGetter=void 0;(A=>{let e=new Set;function L(i){e.add(i);}A.add=L;function J(){e.clear();}A.clear=J;function w(i,o={}){let n=r=>actions.getLogichValue(r,o)??void 0,a=actions.getValueFromConditionalStatements(i,o);if(e.size===0)return n(a);let s=n;for(let r of e){let d=s;s=c=>r(c,d)??void 0;}return s(a)}A.getLogichValue=w;})(exports.VariableGetter||(exports.VariableGetter={}));var p={version:"1.13.1"};var f="___param___",x=`https://pixi-vn.web.app/schemas/${p.version}/schema.json`,h=["==","!=","<","<=",">",">=","CONTAINS"];function X(){core.JsonUnifier.init({animateOperation:actions.animateOperation,canvasElementOperation:actions.canvasElementOperation,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:exports.VariableGetter.getLogichValue,getConditionalStep:actions.getConditionalStep});}
2
2
  exports.PIXIVNJSON_PARAM_ID=f;exports.PIXIVNJSON_SCHEMA_URL=x;exports.PixiVNJsonComparationOperators=h;exports.init=X;Object.keys(core).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return core[k]}})});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.d.cts CHANGED
@@ -312,13 +312,14 @@ interface PixiVNJsonArithmeticOperationsArithmetic {
312
312
  * Operator of the arithmetic operation:
313
313
  * - `"*"` multiplication
314
314
  * - `"/"` division
315
- * - `"+"` addition
316
- * - `"-"` subtraction
315
+ * - `"+"` addition (concatenation for strings and arrays)
316
+ * - `"-"` subtraction (removal of elements for arrays)
317
317
  * - `"%"` modulo
318
318
  * - `"POW"` exponentiation
319
319
  * - `"RANDOM"` random integer between leftValue and rightValue (inclusive)
320
+ * - `"INTERSECTION"` intersection of two arrays (only elements present in both arrays are included in the result)
320
321
  */
321
- operator: "*" | "/" | "+" | "-" | "%" | "POW" | "RANDOM";
322
+ operator: "*" | "/" | "+" | "-" | "%" | "POW" | "RANDOM" | "INTERSECTION";
322
323
  }
323
324
  /**
324
325
  * Unary arithmetic operation applied to a single value (e.g. INT, FLOOR, FLOAT).
@@ -381,7 +382,7 @@ type PixiVNJsonUnionCondition = PixiVNJsonUnionConditionAndOr | PixiVNJsonUnionC
381
382
  * - `"<="` less than or equal
382
383
  * - `">"` greater than
383
384
  * - `">="` greater than or equal
384
- * - `"CONTAINS"` checks whether the left string/array contains the right value
385
+ * - `"CONTAINS"` checks whether the left string/array contains the right value, if left and right are arrays, checks if all items in right are included in left
385
386
  */
386
387
  type PixiVNJsonComparationOperatorsType = "==" | "!=" | "<" | "<=" | ">" | ">=" | "CONTAINS";
387
388
  /**
@@ -423,6 +424,13 @@ interface PixiVNJsonIfElse<Then> {
423
424
  type: "ifelse";
424
425
  /**
425
426
  * The list of conditions to be checked.
427
+ *
428
+ * if is a {@link StorageElementType} or a {@link PixiVNJsonValueGet}:
429
+ * - if is a array or object, the condition is true if not empty
430
+ * - if is a string, the condition is true if not empty
431
+ * - if is a number, the condition is true if not zero
432
+ * - if is a boolean, the condition is true if true
433
+ * - if is null or undefined, the condition is false
426
434
  */
427
435
  condition: PixiVNJsonConditions;
428
436
  /**
package/dist/index.d.ts CHANGED
@@ -312,13 +312,14 @@ interface PixiVNJsonArithmeticOperationsArithmetic {
312
312
  * Operator of the arithmetic operation:
313
313
  * - `"*"` multiplication
314
314
  * - `"/"` division
315
- * - `"+"` addition
316
- * - `"-"` subtraction
315
+ * - `"+"` addition (concatenation for strings and arrays)
316
+ * - `"-"` subtraction (removal of elements for arrays)
317
317
  * - `"%"` modulo
318
318
  * - `"POW"` exponentiation
319
319
  * - `"RANDOM"` random integer between leftValue and rightValue (inclusive)
320
+ * - `"INTERSECTION"` intersection of two arrays (only elements present in both arrays are included in the result)
320
321
  */
321
- operator: "*" | "/" | "+" | "-" | "%" | "POW" | "RANDOM";
322
+ operator: "*" | "/" | "+" | "-" | "%" | "POW" | "RANDOM" | "INTERSECTION";
322
323
  }
323
324
  /**
324
325
  * Unary arithmetic operation applied to a single value (e.g. INT, FLOOR, FLOAT).
@@ -381,7 +382,7 @@ type PixiVNJsonUnionCondition = PixiVNJsonUnionConditionAndOr | PixiVNJsonUnionC
381
382
  * - `"<="` less than or equal
382
383
  * - `">"` greater than
383
384
  * - `">="` greater than or equal
384
- * - `"CONTAINS"` checks whether the left string/array contains the right value
385
+ * - `"CONTAINS"` checks whether the left string/array contains the right value, if left and right are arrays, checks if all items in right are included in left
385
386
  */
386
387
  type PixiVNJsonComparationOperatorsType = "==" | "!=" | "<" | "<=" | ">" | ">=" | "CONTAINS";
387
388
  /**
@@ -423,6 +424,13 @@ interface PixiVNJsonIfElse<Then> {
423
424
  type: "ifelse";
424
425
  /**
425
426
  * The list of conditions to be checked.
427
+ *
428
+ * if is a {@link StorageElementType} or a {@link PixiVNJsonValueGet}:
429
+ * - if is a array or object, the condition is true if not empty
430
+ * - if is a string, the condition is true if not empty
431
+ * - if is a number, the condition is true if not zero
432
+ * - if is a boolean, the condition is true if true
433
+ * - if is null or undefined, the condition is false
426
434
  */
427
435
  condition: PixiVNJsonConditions;
428
436
  /**
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import {getValueFromConditionalStatements,getLogichValue,getConditionalStep,setInitialStorageValue,setStorageValue,videoOperation,soundOperation,loadAssets,narrationOperation,textOperation,imageOperation,imageContainerOperation,effectOperation,canvasElementOperation,animateOperation}from'@drincs/pixi-vn-json/actions';import {JsonUnifier}from'@drincs/pixi-vn-json/core';export*from'@drincs/pixi-vn-json/core';export*from'@drincs/pixi-vn-json/interpreter';export*from'@drincs/pixi-vn-json/translator';var t;(A=>{let e=new Set;function L(i){e.add(i);}A.add=L;function J(){e.clear();}A.clear=J;function w(i,o={}){let n=r=>getLogichValue(r,o)??void 0,a=getValueFromConditionalStatements(i,o);if(e.size===0)return n(a);let s=n;for(let r of e){let d=s;s=c=>r(c,d)??void 0;}return s(a)}A.getLogichValue=w;})(t||(t={}));var p={version:"1.13.0"};var f="___param___",x=`https://pixi-vn.web.app/schemas/${p.version}/schema.json`,h=["==","!=","<","<=",">",">=","CONTAINS"];function X(){JsonUnifier.init({animateOperation:animateOperation,canvasElementOperation:canvasElementOperation,effectOperation:effectOperation,imageContainerOperation:imageContainerOperation,imageOperation:imageOperation,textOperation:textOperation,narrationOperation:narrationOperation,loadAssets:loadAssets,soundOperation:soundOperation,videoOperation:videoOperation,setStorageValue:setStorageValue,setInitialStorageValue:setInitialStorageValue,getLogichValue:t.getLogichValue,getConditionalStep:getConditionalStep});}
1
+ import {getValueFromConditionalStatements,getLogichValue,getConditionalStep,setInitialStorageValue,setStorageValue,videoOperation,soundOperation,loadAssets,narrationOperation,textOperation,imageOperation,imageContainerOperation,effectOperation,canvasElementOperation,animateOperation}from'@drincs/pixi-vn-json/actions';import {JsonUnifier}from'@drincs/pixi-vn-json/core';export*from'@drincs/pixi-vn-json/core';export*from'@drincs/pixi-vn-json/interpreter';export*from'@drincs/pixi-vn-json/translator';var t;(A=>{let e=new Set;function L(i){e.add(i);}A.add=L;function J(){e.clear();}A.clear=J;function w(i,o={}){let n=r=>getLogichValue(r,o)??void 0,a=getValueFromConditionalStatements(i,o);if(e.size===0)return n(a);let s=n;for(let r of e){let d=s;s=c=>r(c,d)??void 0;}return s(a)}A.getLogichValue=w;})(t||(t={}));var p={version:"1.13.1"};var f="___param___",x=`https://pixi-vn.web.app/schemas/${p.version}/schema.json`,h=["==","!=","<","<=",">",">=","CONTAINS"];function X(){JsonUnifier.init({animateOperation:animateOperation,canvasElementOperation:canvasElementOperation,effectOperation:effectOperation,imageContainerOperation:imageContainerOperation,imageOperation:imageOperation,textOperation:textOperation,narrationOperation:narrationOperation,loadAssets:loadAssets,soundOperation:soundOperation,videoOperation:videoOperation,setStorageValue:setStorageValue,setInitialStorageValue:setInitialStorageValue,getLogichValue:t.getLogichValue,getConditionalStep:getConditionalStep});}
2
2
  export{f as PIXIVNJSON_PARAM_ID,x as PIXIVNJSON_SCHEMA_URL,h as PixiVNJsonComparationOperators,t as VariableGetter,X 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 te=Object.create;var R=Object.defineProperty;var ie=Object.getOwnPropertyDescriptor;var ne=Object.getOwnPropertyNames;var oe=Object.getPrototypeOf,re=Object.prototype.hasOwnProperty;var ae=(a,e,r)=>e in a?R(a,e,{enumerable:true,configurable:true,writable:true,value:r}):a[e]=r;var D=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var q=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports);var se=(a,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ne(e))!re.call(a,n)&&n!==r&&R(a,n,{get:()=>e[n],enumerable:!(t=ie(e,n))||t.enumerable});return a};var pe=(a,e,r)=>(r=a!=null?te(oe(a)):{},se(R(r,"default",{value:a,enumerable:true}),a));var V=(a,e,r)=>ae(a,typeof e!="symbol"?e+"":e,r);var Q=q((I,K)=>{(function(a,e){typeof I=="object"?K.exports=I=e():typeof define=="function"&&define.amd?define([],e):a.CryptoJS=e();})(I,function(){var a=a||(function(e,r){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 D=="function")try{t=D("crypto");}catch{}var n=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.")},s=Object.create||(function(){function i(){}return function(o){var u;return i.prototype=o,u=new i,i.prototype=null,u}})(),p={},d=p.lib={},g=d.Base=(function(){return {extend:function(i){var o=s(this);return i&&o.mixIn(i),(!o.hasOwnProperty("init")||this.init===o.init)&&(o.init=function(){o.$super.init.apply(this,arguments);}),o.init.prototype=o,o.$super=this,o},create:function(){var i=this.extend();return i.init.apply(i,arguments),i},init:function(){},mixIn:function(i){for(var o in i)i.hasOwnProperty(o)&&(this[o]=i[o]);i.hasOwnProperty("toString")&&(this.toString=i.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),y=d.WordArray=g.extend({init:function(i,o){i=this.words=i||[],o!=r?this.sigBytes=o:this.sigBytes=i.length*4;},toString:function(i){return (i||J).stringify(this)},concat:function(i){var o=this.words,u=i.words,l=this.sigBytes,S=i.sigBytes;if(this.clamp(),l%4)for(var b=0;b<S;b++){var k=u[b>>>2]>>>24-b%4*8&255;o[l+b>>>2]|=k<<24-(l+b)%4*8;}else for(var j=0;j<S;j+=4)o[l+j>>>2]=u[j>>>2];return this.sigBytes+=S,this},clamp:function(){var i=this.words,o=this.sigBytes;i[o>>>2]&=4294967295<<32-o%4*8,i.length=e.ceil(o/4);},clone:function(){var i=g.clone.call(this);return i.words=this.words.slice(0),i},random:function(i){for(var o=[],u=0;u<i;u+=4)o.push(n());return new y.init(o,i)}}),f=p.enc={},J=f.Hex={stringify:function(i){for(var o=i.words,u=i.sigBytes,l=[],S=0;S<u;S++){var b=o[S>>>2]>>>24-S%4*8&255;l.push((b>>>4).toString(16)),l.push((b&15).toString(16));}return l.join("")},parse:function(i){for(var o=i.length,u=[],l=0;l<o;l+=2)u[l>>>3]|=parseInt(i.substr(l,2),16)<<24-l%8*4;return new y.init(u,o/2)}},N=f.Latin1={stringify:function(i){for(var o=i.words,u=i.sigBytes,l=[],S=0;S<u;S++){var b=o[S>>>2]>>>24-S%4*8&255;l.push(String.fromCharCode(b));}return l.join("")},parse:function(i){for(var o=i.length,u=[],l=0;l<o;l++)u[l>>>2]|=(i.charCodeAt(l)&255)<<24-l%4*8;return new y.init(u,o)}},C=f.Utf8={stringify:function(i){try{return decodeURIComponent(escape(N.stringify(i)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(i){return N.parse(unescape(encodeURIComponent(i)))}},m=d.BufferedBlockAlgorithm=g.extend({reset:function(){this._data=new y.init,this._nDataBytes=0;},_append:function(i){typeof i=="string"&&(i=C.parse(i)),this._data.concat(i),this._nDataBytes+=i.sigBytes;},_process:function(i){var o,u=this._data,l=u.words,S=u.sigBytes,b=this.blockSize,k=b*4,j=S/k;i?j=e.ceil(j):j=e.max((j|0)-this._minBufferSize,0);var E=j*b,M=e.min(E*4,S);if(E){for(var z=0;z<E;z+=b)this._doProcessBlock(l,z);o=l.splice(0,E),u.sigBytes-=M;}return new y.init(o,M)},clone:function(){var i=g.clone.call(this);return i._data=this._data.clone(),i},_minBufferSize:0});d.Hasher=m.extend({cfg:g.extend(),init:function(i){this.cfg=this.cfg.extend(i),this.reset();},reset:function(){m.reset.call(this),this._doReset();},update:function(i){return this._append(i),this._process(),this},finalize:function(i){i&&this._append(i);var o=this._doFinalize();return o},blockSize:512/32,_createHelper:function(i){return function(o,u){return new i.init(u).finalize(o)}},_createHmacHelper:function(i){return function(o,u){return new P.HMAC.init(i,u).finalize(o)}}});var P=p.algo={};return p})(Math);return a});});var Z=q((B,Y)=>{(function(a,e){typeof B=="object"?Y.exports=B=e(Q()):typeof define=="function"&&define.amd?define(["./core"],e):e(a.CryptoJS);})(B,function(a){return (function(){var e=a,r=e.lib,t=r.WordArray,n=r.Hasher,s=e.algo,p=[],d=s.SHA1=n.extend({_doReset:function(){this._hash=new t.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(g,y){for(var f=this._hash.words,J=f[0],N=f[1],C=f[2],m=f[3],x=f[4],P=0;P<80;P++){if(P<16)p[P]=g[y+P]|0;else {var i=p[P-3]^p[P-8]^p[P-14]^p[P-16];p[P]=i<<1|i>>>31;}var o=(J<<5|J>>>27)+x+p[P];P<20?o+=(N&C|~N&m)+1518500249:P<40?o+=(N^C^m)+1859775393:P<60?o+=(N&C|N&m|C&m)-1894007588:o+=(N^C^m)-899497514,x=m,m=C,C=N<<30|N>>>2,N=J,J=o;}f[0]=f[0]+J|0,f[1]=f[1]+N|0,f[2]=f[2]+C|0,f[3]=f[3]+m|0,f[4]=f[4]+x|0;},_doFinalize:function(){var g=this._data,y=g.words,f=this._nDataBytes*8,J=g.sigBytes*8;return y[J>>>5]|=128<<24-J%32,y[(J+64>>>9<<4)+14]=Math.floor(f/4294967296),y[(J+64>>>9<<4)+15]=f,g.sigBytes=y.length*4,this._process(),this._hash},clone:function(){var g=n.clone.call(this);return g._hash=this._hash.clone(),g}});e.SHA1=n._createHelper(d),e.HmacSHA1=n._createHmacHelper(d);})(),a.SHA1});});var H="___param___";var h;(n=>(n.log=(s,...p)=>console.log(`[Pixi\u2019VN Json] ${s}`,...p),n.warn=(s,...p)=>console.warn(`[Pixi\u2019VN Json] ${s}`,...p),n.error=(s,...p)=>console.error(`[Pixi\u2019VN Json] ${s}`,...p),n.info=(s,...p)=>console.info(`[Pixi\u2019VN Json] ${s}`,...p)))(h||(h={}));var c=class c{static init(e){e.loadAssets&&(c._loadAssets=e.loadAssets),e.soundOperation&&(c._soundOperation=e.soundOperation),e.imageOperation&&(c._imageOperation=e.imageOperation),e.videoOperation&&(c._videoOperation=e.videoOperation),e.imageContainerOperation&&(c._imageContainerOperation=e.imageContainerOperation),e.textOperation&&(c._textOperation=e.textOperation),e.canvasElementOperation&&(c._canvasElementOperation=e.canvasElementOperation),e.setStorageValue&&(c._setStorageValue=e.setStorageValue),e.setInitialStorageValue&&(c._setInitialStorageValue=e.setInitialStorageValue),e.narrationOperation&&(c._narrationOperation=e.narrationOperation),e.effectOperation&&(c._effectOperation=e.effectOperation),e.animateOperation&&(c._animateOperation=e.animateOperation),e.getLogichValue&&(c._getLogichValue=e.getLogichValue),e.getConditionalStep&&(c._getConditionalStep=e.getConditionalStep);}static get loadAssets(){return c._loadAssets}static get soundOperation(){return c._soundOperation}static get imageOperation(){return c._imageOperation}static get videoOperation(){return c._videoOperation}static get imageContainerOperation(){return c._imageContainerOperation}static get textOperation(){return c._textOperation}static get canvasElementOperation(){return c._canvasElementOperation}static get setStorageValue(){return c._setStorageValue}static get setInitialStorageValue(){return c._setInitialStorageValue}static get narrationOperation(){return c._narrationOperation}static get effectOperation(){return c._effectOperation}static get animateOperation(){return c._animateOperation}static get getLogichValue(){return c._getLogichValue}static get getConditionalStep(){return c._getConditionalStep}};V(c,"_loadAssets",()=>{}),V(c,"_soundOperation",()=>{throw h.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.")}),V(c,"_imageOperation",()=>{throw h.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.")}),V(c,"_videoOperation",()=>{throw h.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.")}),V(c,"_imageContainerOperation",()=>{throw h.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.")}),V(c,"_textOperation",()=>{throw h.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.")}),V(c,"_canvasElementOperation",()=>{throw h.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.")}),V(c,"_setStorageValue",()=>{throw h.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.")}),V(c,"_setInitialStorageValue",()=>{throw h.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.")}),V(c,"_narrationOperation",()=>{throw h.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.")}),V(c,"_effectOperation",()=>{throw h.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.")}),V(c,"_animateOperation",()=>{throw h.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.")}),V(c,"_getLogichValue",()=>{throw h.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.")}),V(c,"_getConditionalStep",()=>{throw h.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.")});var T=c;function G(a,e){if(e&&typeof e=="object"&&typeof a.functionName=="string"&&a.functionName in e){let r=e[a.functionName];if(typeof r=="function"){let t=a.args.map(n=>T.getLogichValue(n,e));return r(...t)}else h.warn(`getLogichValue function ${a.functionName} not found in props`);}}function F(a,e={}){let r="";return a.values.forEach(t=>{if(typeof t=="string")r+=t;else {let n=core.JsonUnifier.getLogichValue(t,e);r+=`${n}`;}}),r}async function $(a,e,r){let t=core.JsonUnifier.getLogichValue(a,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 "imagecontainer":await core.JsonUnifier.imageContainerOperation(t);break;case "text":await core.JsonUnifier.textOperation(t);break;case "canvaselement":await core.JsonUnifier.canvasElementOperation(t);break;case "value":core.JsonUnifier.setStorageValue(t,e);break;case "operationtoconvert":if(r){let n=F(t,e),s=await r(n);s&&await $(s,e,r);}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 G(t,e);break}}function X(a){let e=core.JsonUnifier.getLogichValue(a,{});e&&e.type==="value"&&e.storageOperationType==="set"&&(e.storageType==="storage"||e.storageType==="tempstorage")&&core.JsonUnifier.setInitialStorageValue(e);}var ee=pe(Z());var _=class extends narration.LabelAbstract{constructor(r,t,n,s={}){n||(n={}),n.onLoadingLabel=async()=>{for(let p of t){let d;if(typeof p=="function"?d=p():d=p,d=core.JsonUnifier.getConditionalStep(d),d.operations)try{let g=d.operations.map(y=>core.JsonUnifier.loadAssets(y));await Promise.all(g);}catch(g){h.error("The operation in the onLoadingLabel function of the label has an error:",g);}}};super(r,n);V(this,"_steps");V(this,"operationStringConvert");V(this,"skipEmptyDialogs",false);this._steps=t,this.operationStringConvert=s.operationStringConvert,this.skipEmptyDialogs=s.skipEmptyDialogs||false;}get steps(){return this._steps.map(r=>this.stepConverter(r))}get stepCount(){return this._steps.length}getStepById(r){if(r<0||r>=this._steps.length)return;let t=this._steps[r];return this.stepConverter(t)}getStepSha(r){if(r<0||r>=this.steps.length)return;let t=this._steps[r];return (0, ee.default)(t.toString().toLocaleLowerCase()).toString()}getDialogueText(r,t){let n="";if(Array.isArray(r)){let s=[];r.forEach(p=>{if(typeof p=="string")s.push(p);else if(p&&typeof p=="object"){let d=core.JsonUnifier.getLogichValue(p,t);d?(d&&!Array.isArray(d)&&typeof d=="object"&&(d=core.JsonUnifier.getLogichValue(d,t)||""),Array.isArray(d)?s=s.map(g=>`${g}`).concat(d):s.push(`${d}`)):s.push(`${p}`);}else s.push(`${p}`);}),n=s;}else {let s=core.JsonUnifier.getLogichValue(r,t);s&&!Array.isArray(s)&&typeof s=="object"&&(s=core.JsonUnifier.getLogichValue(s,t)),s&&Array.isArray(s)?n=s.map(p=>`${p}`):n=`${s}`;}return n}getDialogue(r,t){if(r==null)return;let n=core.JsonUnifier.getLogichValue(r,t);return n==null?`${n}`:typeof n=="object"&&"character"in n&&"text"in n?{character:n.character,text:translator.translator.t(this.getDialogueText(n.text,t))}:translator.translator.t(this.getDialogueText(n,t))}getChoices(r,t){return core.JsonUnifier.getLogichValue(r,t)?.map(p=>core.JsonUnifier.getLogichValue(p,t)).filter(p=>p!==void 0)}stepConverter(r){return async t=>{let n=typeof r=="function"?r():r;n=pixiVn.createExportableElement(n),n=core.JsonUnifier.getConditionalStep(n,t);let s=this.operationStringConvert?m=>this.operationStringConvert(m,n,t):void 0,{operations:p=[]}=n;for(let m of p)await $(m,t,s);let{labelToOpen:d=[]}=n,g=this.getChoices(n.choices,t),y=core.JsonUnifier.getLogichValue(n.glueEnabled,t),f=this.getDialogue(n.dialogue,t),J=[];Array.isArray(d)||(d=[d]),d.forEach(m=>{let x=core.JsonUnifier.getLogichValue(m,t);x&&J.push(x);});let N=core.JsonUnifier.getLogichValue(n.goNextStep,t),C=core.JsonUnifier.getLogichValue(n.end,t);if(g){let m=g.map(x=>{let P="";if(Array.isArray(x.text)){let o=[];x.text.forEach(u=>{if(typeof u=="string")o.push(translator.translator.t(u));else if(u&&typeof u=="object"){let l=core.JsonUnifier.getLogichValue(u,t);l&&!Array.isArray(l)&&typeof l=="object"&&(l=core.JsonUnifier.getLogichValue(l,t)||""),l&&(Array.isArray(l)?o=o.concat(translator.translator.t(l)):o.push(translator.translator.t(l)));}}),P=o;}else typeof x.text=="string"&&(P=translator.translator.t(x.text));return {label:x.label,text:P,props:x.props,type:x.type,oneTime:x.oneTime,onlyHaveNoChoice:x.onlyHaveNoChoice,autoSelect:x.autoSelect}});narration.narration.choices=m;}else narration.narration.choices=void 0;f!==void 0&&(narration.narration.dialogue=f,this.skipEmptyDialogs&&typeof f=="string"&&(f===""||RegExp(/^\s+$/).test(f))&&(N=true)),y?narration.narration.dialogGlue=true:y===false&&(narration.narration.dialogGlue=false);for(let m of J){let x=m.label;typeof x=="object"&&(x=core.JsonUnifier.getLogichValue(x,t)||"");let P=m.params?.map(i=>core.JsonUnifier.getLogichValue(i,t));t={...t,...m.props},m.type==="jump"?(narration.narration.openedLabels.length>0&&narration.narration.closeCurrentLabel(),storage.storage.setTempVariable(`${H}${narration.narration.openedLabels.length}`,P),await narration.narration.call(x,t)):(storage.storage.setTempVariable(`${H}${narration.narration.openedLabels.length}`,P),await narration.narration.call(x,t));}C==="game_end"?(narration.narration.closeAllLabels(),await narration.narration.continue(t,{runNow:true})):C==="label_end"&&narration.narration.closeCurrentLabel(),N&&await narration.narration.continue(t,{runNow:true});}}};async function ge(a,e={}){if(!Array.isArray(a))if(typeof a=="object"||typeof a=="string")a=[a];else {h.error("Error parsing imported Pixi'VN JSON: data is not an object");return}let t=a.map(n=>{if(typeof n=="string")try{return JSON.parse(n)}catch(s){return h.error("Error parsing imported Pixi'VN JSON",s),{}}return n}).map(async n=>{if(n.initialOperations)for(let s of n.initialOperations)X(s);if(n.labels){let s=n.labels;for(let p in s)try{let d=s[p],g=new _(p,d,void 0,e);narration.RegisteredLabels.add(g);}catch(d){h.error(`Error creating JSON label ${p}`,d);}}});await Promise.all(t);}exports.LabelJson=_;exports.importPixiVNJson=ge;
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 te=Object.create;var R=Object.defineProperty;var ie=Object.getOwnPropertyDescriptor;var ne=Object.getOwnPropertyNames;var oe=Object.getPrototypeOf,re=Object.prototype.hasOwnProperty;var ae=(s,e,r)=>e in s?R(s,e,{enumerable:true,configurable:true,writable:true,value:r}):s[e]=r;var D=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+s+'" is not supported')});var W=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports);var se=(s,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ne(e))!re.call(s,n)&&n!==r&&R(s,n,{get:()=>e[n],enumerable:!(t=ie(e,n))||t.enumerable});return s};var pe=(s,e,r)=>(r=s!=null?te(oe(s)):{},se(R(r,"default",{value:s,enumerable:true}),s));var V=(s,e,r)=>ae(s,typeof e!="symbol"?e+"":e,r);var Q=W((I,K)=>{(function(s,e){typeof I=="object"?K.exports=I=e():typeof define=="function"&&define.amd?define([],e):s.CryptoJS=e();})(I,function(){var s=s||(function(e,r){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 D=="function")try{t=D("crypto");}catch{}var n=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(o){var u;return i.prototype=o,u=new i,i.prototype=null,u}})(),a={},d=a.lib={},m=d.Base=(function(){return {extend:function(i){var o=p(this);return i&&o.mixIn(i),(!o.hasOwnProperty("init")||this.init===o.init)&&(o.init=function(){o.$super.init.apply(this,arguments);}),o.init.prototype=o,o.$super=this,o},create:function(){var i=this.extend();return i.init.apply(i,arguments),i},init:function(){},mixIn:function(i){for(var o in i)i.hasOwnProperty(o)&&(this[o]=i[o]);i.hasOwnProperty("toString")&&(this.toString=i.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),v=d.WordArray=m.extend({init:function(i,o){i=this.words=i||[],o!=r?this.sigBytes=o:this.sigBytes=i.length*4;},toString:function(i){return (i||J).stringify(this)},concat:function(i){var o=this.words,u=i.words,l=this.sigBytes,S=i.sigBytes;if(this.clamp(),l%4)for(var b=0;b<S;b++){var k=u[b>>>2]>>>24-b%4*8&255;o[l+b>>>2]|=k<<24-(l+b)%4*8;}else for(var j=0;j<S;j+=4)o[l+j>>>2]=u[j>>>2];return this.sigBytes+=S,this},clamp:function(){var i=this.words,o=this.sigBytes;i[o>>>2]&=4294967295<<32-o%4*8,i.length=e.ceil(o/4);},clone:function(){var i=m.clone.call(this);return i.words=this.words.slice(0),i},random:function(i){for(var o=[],u=0;u<i;u+=4)o.push(n());return new v.init(o,i)}}),f=a.enc={},J=f.Hex={stringify:function(i){for(var o=i.words,u=i.sigBytes,l=[],S=0;S<u;S++){var b=o[S>>>2]>>>24-S%4*8&255;l.push((b>>>4).toString(16)),l.push((b&15).toString(16));}return l.join("")},parse:function(i){for(var o=i.length,u=[],l=0;l<o;l+=2)u[l>>>3]|=parseInt(i.substr(l,2),16)<<24-l%8*4;return new v.init(u,o/2)}},N=f.Latin1={stringify:function(i){for(var o=i.words,u=i.sigBytes,l=[],S=0;S<u;S++){var b=o[S>>>2]>>>24-S%4*8&255;l.push(String.fromCharCode(b));}return l.join("")},parse:function(i){for(var o=i.length,u=[],l=0;l<o;l++)u[l>>>2]|=(i.charCodeAt(l)&255)<<24-l%4*8;return new v.init(u,o)}},C=f.Utf8={stringify:function(i){try{return decodeURIComponent(escape(N.stringify(i)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(i){return N.parse(unescape(encodeURIComponent(i)))}},g=d.BufferedBlockAlgorithm=m.extend({reset:function(){this._data=new v.init,this._nDataBytes=0;},_append:function(i){typeof i=="string"&&(i=C.parse(i)),this._data.concat(i),this._nDataBytes+=i.sigBytes;},_process:function(i){var o,u=this._data,l=u.words,S=u.sigBytes,b=this.blockSize,k=b*4,j=S/k;i?j=e.ceil(j):j=e.max((j|0)-this._minBufferSize,0);var E=j*b,q=e.min(E*4,S);if(E){for(var z=0;z<E;z+=b)this._doProcessBlock(l,z);o=l.splice(0,E),u.sigBytes-=q;}return new v.init(o,q)},clone:function(){var i=m.clone.call(this);return i._data=this._data.clone(),i},_minBufferSize:0});d.Hasher=g.extend({cfg:m.extend(),init:function(i){this.cfg=this.cfg.extend(i),this.reset();},reset:function(){g.reset.call(this),this._doReset();},update:function(i){return this._append(i),this._process(),this},finalize:function(i){i&&this._append(i);var o=this._doFinalize();return o},blockSize:512/32,_createHelper:function(i){return function(o,u){return new i.init(u).finalize(o)}},_createHmacHelper:function(i){return function(o,u){return new P.HMAC.init(i,u).finalize(o)}}});var P=a.algo={};return a})(Math);return s});});var Z=W((B,Y)=>{(function(s,e){typeof B=="object"?Y.exports=B=e(Q()):typeof define=="function"&&define.amd?define(["./core"],e):e(s.CryptoJS);})(B,function(s){return (function(){var e=s,r=e.lib,t=r.WordArray,n=r.Hasher,p=e.algo,a=[],d=p.SHA1=n.extend({_doReset:function(){this._hash=new t.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(m,v){for(var f=this._hash.words,J=f[0],N=f[1],C=f[2],g=f[3],x=f[4],P=0;P<80;P++){if(P<16)a[P]=m[v+P]|0;else {var i=a[P-3]^a[P-8]^a[P-14]^a[P-16];a[P]=i<<1|i>>>31;}var o=(J<<5|J>>>27)+x+a[P];P<20?o+=(N&C|~N&g)+1518500249:P<40?o+=(N^C^g)+1859775393:P<60?o+=(N&C|N&g|C&g)-1894007588:o+=(N^C^g)-899497514,x=g,g=C,C=N<<30|N>>>2,N=J,J=o;}f[0]=f[0]+J|0,f[1]=f[1]+N|0,f[2]=f[2]+C|0,f[3]=f[3]+g|0,f[4]=f[4]+x|0;},_doFinalize:function(){var m=this._data,v=m.words,f=this._nDataBytes*8,J=m.sigBytes*8;return v[J>>>5]|=128<<24-J%32,v[(J+64>>>9<<4)+14]=Math.floor(f/4294967296),v[(J+64>>>9<<4)+15]=f,m.sigBytes=v.length*4,this._process(),this._hash},clone:function(){var m=n.clone.call(this);return m._hash=this._hash.clone(),m}});e.SHA1=n._createHelper(d),e.HmacSHA1=n._createHmacHelper(d);})(),s.SHA1});});var H="___param___";var h;(n=>(n.log=(p,...a)=>console.log(`[Pixi\u2019VN Json] ${p}`,...a),n.warn=(p,...a)=>console.warn(`[Pixi\u2019VN Json] ${p}`,...a),n.error=(p,...a)=>console.error(`[Pixi\u2019VN Json] ${p}`,...a),n.info=(p,...a)=>console.info(`[Pixi\u2019VN Json] ${p}`,...a)))(h||(h={}));var c=class c{static init(e){e.loadAssets&&(c._loadAssets=e.loadAssets),e.soundOperation&&(c._soundOperation=e.soundOperation),e.imageOperation&&(c._imageOperation=e.imageOperation),e.videoOperation&&(c._videoOperation=e.videoOperation),e.imageContainerOperation&&(c._imageContainerOperation=e.imageContainerOperation),e.textOperation&&(c._textOperation=e.textOperation),e.canvasElementOperation&&(c._canvasElementOperation=e.canvasElementOperation),e.setStorageValue&&(c._setStorageValue=e.setStorageValue),e.setInitialStorageValue&&(c._setInitialStorageValue=e.setInitialStorageValue),e.narrationOperation&&(c._narrationOperation=e.narrationOperation),e.effectOperation&&(c._effectOperation=e.effectOperation),e.animateOperation&&(c._animateOperation=e.animateOperation),e.getLogichValue&&(c._getLogichValue=e.getLogichValue),e.getConditionalStep&&(c._getConditionalStep=e.getConditionalStep);}static get loadAssets(){return c._loadAssets}static get soundOperation(){return c._soundOperation}static get imageOperation(){return c._imageOperation}static get videoOperation(){return c._videoOperation}static get imageContainerOperation(){return c._imageContainerOperation}static get textOperation(){return c._textOperation}static get canvasElementOperation(){return c._canvasElementOperation}static get setStorageValue(){return c._setStorageValue}static get setInitialStorageValue(){return c._setInitialStorageValue}static get narrationOperation(){return c._narrationOperation}static get effectOperation(){return c._effectOperation}static get animateOperation(){return c._animateOperation}static get getLogichValue(){return c._getLogichValue}static get getConditionalStep(){return c._getConditionalStep}};V(c,"_loadAssets",()=>{}),V(c,"_soundOperation",()=>{throw h.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.")}),V(c,"_imageOperation",()=>{throw h.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.")}),V(c,"_videoOperation",()=>{throw h.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.")}),V(c,"_imageContainerOperation",()=>{throw h.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.")}),V(c,"_textOperation",()=>{throw h.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.")}),V(c,"_canvasElementOperation",()=>{throw h.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.")}),V(c,"_setStorageValue",()=>{throw h.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.")}),V(c,"_setInitialStorageValue",()=>{throw h.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.")}),V(c,"_narrationOperation",()=>{throw h.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.")}),V(c,"_effectOperation",()=>{throw h.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.")}),V(c,"_animateOperation",()=>{throw h.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.")}),V(c,"_getLogichValue",()=>{throw h.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.")}),V(c,"_getConditionalStep",()=>{throw h.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.")});var T=c;function F(s,e){if(e&&typeof e=="object"&&typeof s.functionName=="string"&&s.functionName in e){let r=e[s.functionName];if(typeof r=="function"){let t=s.args.map(n=>T.getLogichValue(n,e));return r(...t)}else h.warn(`getLogichValue function ${s.functionName} not found in props`);}}function X(s,e={}){let r="";return s.values.forEach(t=>{if(typeof t=="string")r+=t;else {let n=core.JsonUnifier.getLogichValue(t,e);r+=`${n}`;}}),r}async function $(s,e,r){let t=core.JsonUnifier.getLogichValue(s,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 "imagecontainer":await core.JsonUnifier.imageContainerOperation(t);break;case "text":await core.JsonUnifier.textOperation(t);break;case "canvaselement":await core.JsonUnifier.canvasElementOperation(t);break;case "value":core.JsonUnifier.setStorageValue(t,e);break;case "operationtoconvert":if(r){let n=X(t,e),p=await r(n);p&&await $(p,e,r);}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 F(t,e);break}}function M(s){let e=core.JsonUnifier.getLogichValue(s,{});e&&e.type==="value"&&e.storageOperationType==="set"&&(e.storageType==="storage"||e.storageType==="tempstorage")&&core.JsonUnifier.setInitialStorageValue(e);}var ee=pe(Z());var _=class extends narration.LabelAbstract{constructor(r,t,n,p={}){n||(n={}),n.onLoadingLabel=async()=>{for(let a of t){let d;if(typeof a=="function"?d=a():d=a,d=core.JsonUnifier.getConditionalStep(d),d.operations)try{let m=d.operations.map(v=>core.JsonUnifier.loadAssets(v));await Promise.all(m);}catch(m){h.error("The operation in the onLoadingLabel function of the label has an error:",m);}}};super(r,n);V(this,"_steps");V(this,"operationStringConvert");V(this,"skipEmptyDialogs",false);this._steps=t,this.operationStringConvert=p.operationStringConvert,this.skipEmptyDialogs=p.skipEmptyDialogs||false;}get steps(){return this._steps.map(r=>this.stepConverter(r))}get stepCount(){return this._steps.length}getStepById(r){if(r<0||r>=this._steps.length)return;let t=this._steps[r];return this.stepConverter(t)}getStepSha(r){if(r<0||r>=this.steps.length)return;let t=this._steps[r];return (0, ee.default)(t.toString().toLocaleLowerCase()).toString()}getDialogueText(r,t){let n="";if(Array.isArray(r)){let p=[];r.forEach(a=>{if(typeof a=="string")p.push(a);else if(a&&typeof a=="object"){let d=core.JsonUnifier.getLogichValue(a,t);d?(d&&!Array.isArray(d)&&typeof d=="object"&&(d=core.JsonUnifier.getLogichValue(d,t)||""),Array.isArray(d)?p=p.map(m=>`${m}`).concat(d):p.push(`${d}`)):p.push(`${a}`);}else p.push(`${a}`);}),n=p;}else {let p=core.JsonUnifier.getLogichValue(r,t);p&&!Array.isArray(p)&&typeof p=="object"&&(p=core.JsonUnifier.getLogichValue(p,t)),p&&Array.isArray(p)?n=p.map(a=>`${a}`):n=`${p}`;}return n}getDialogue(r,t){if(r==null)return;let n=core.JsonUnifier.getLogichValue(r,t);return n==null?`${n}`:typeof n=="object"&&"character"in n&&"text"in n?{character:n.character,text:translator.translator.t(this.getDialogueText(n.text,t))}:translator.translator.t(this.getDialogueText(n,t))}getChoices(r,t){return core.JsonUnifier.getLogichValue(r,t)?.map(a=>core.JsonUnifier.getLogichValue(a,t)).filter(a=>a!==void 0)}stepConverter(r){return async t=>{let n=typeof r=="function"?r():r;n=pixiVn.createExportableElement(n),n=core.JsonUnifier.getConditionalStep(n,t);let p=this.operationStringConvert?g=>this.operationStringConvert(g,n,t):void 0,{operations:a=[]}=n;for(let g of a)await $(g,t,p);let{labelToOpen:d=[]}=n,m=this.getChoices(n.choices,t),v=core.JsonUnifier.getLogichValue(n.glueEnabled,t),f=this.getDialogue(n.dialogue,t),J=[];Array.isArray(d)||(d=[d]),d.forEach(g=>{let x=core.JsonUnifier.getLogichValue(g,t);x&&J.push(x);});let N=core.JsonUnifier.getLogichValue(n.goNextStep,t),C=core.JsonUnifier.getLogichValue(n.end,t);if(m){let g=m.map(x=>{let P="";if(Array.isArray(x.text)){let o=[];x.text.forEach(u=>{if(typeof u=="string")o.push(translator.translator.t(u));else if(u&&typeof u=="object"){let l=core.JsonUnifier.getLogichValue(u,t);l&&!Array.isArray(l)&&typeof l=="object"&&(l=core.JsonUnifier.getLogichValue(l,t)||""),l&&(Array.isArray(l)?o=o.concat(translator.translator.t(l)):o.push(translator.translator.t(l)));}}),P=o;}else typeof x.text=="string"&&(P=translator.translator.t(x.text));return {label:x.label,text:P,props:x.props,type:x.type,oneTime:x.oneTime,onlyHaveNoChoice:x.onlyHaveNoChoice,autoSelect:x.autoSelect}});narration.narration.choices=g;}else narration.narration.choices=void 0;f!==void 0&&(narration.narration.dialogue=f,this.skipEmptyDialogs&&typeof f=="string"&&(f===""||RegExp(/^\s+$/).test(f))&&(N=true)),v?narration.narration.dialogGlue=true:v===false&&(narration.narration.dialogGlue=false);for(let g of J){let x=g.label;typeof x=="object"&&(x=core.JsonUnifier.getLogichValue(x,t)||"");let P=g.params?.map(i=>core.JsonUnifier.getLogichValue(i,t));t={...t,...g.props},g.type==="jump"?(narration.narration.openedLabels.length>0&&narration.narration.closeCurrentLabel(),storage.storage.setTempVariable(`${H}${narration.narration.openedLabels.length}`,P),await narration.narration.call(x,t)):(storage.storage.setTempVariable(`${H}${narration.narration.openedLabels.length}`,P),await narration.narration.call(x,t));}C==="game_end"?(narration.narration.closeAllLabels(),await narration.narration.continue(t,{runNow:true})):C==="label_end"&&narration.narration.closeCurrentLabel(),N&&await narration.narration.continue(t,{runNow:true});}}};async function me(s,e={}){if(!Array.isArray(s))if(typeof s=="object"||typeof s=="string")s=[s];else {h.error("Error parsing imported Pixi'VN JSON: data is not an object");return}let r=s.map(p=>{if(typeof p=="string")try{return JSON.parse(p)}catch(a){return h.error("Error parsing imported Pixi'VN JSON",a),{}}return p}),t=r.map(async p=>{if(p.initialOperations)for(let a of p.initialOperations)a.type==="value"&&(typeof a.value!="object"||!a.value||!("type"in a.value))&&M(a);return Promise.resolve()});await Promise.all(t);let n=r.map(async p=>{if(p.initialOperations)for(let a of p.initialOperations)(a.type!=="value"||a.type==="value"&&typeof a.value=="object"&&a.value&&"type"in a.value)&&M(a);if(p.labels){let a=p.labels;for(let d in a)try{let m=a[d],v=new _(d,m,void 0,e);narration.RegisteredLabels.add(v);}catch(m){h.error(`Error creating JSON label ${d}`,m);}}return Promise.resolve()});await Promise.all(n);}exports.LabelJson=_;exports.importPixiVNJson=me;
@@ -1,4 +1,4 @@
1
- import { P as PixiVNJsonLabelStep, a as PixiVNJsonValueSet, b as PixiVNJsonIfElse, c as PixiVNJsonOperation } from './PixiVNJsonLabelStep-DgN7qF7j.cjs';
1
+ import { P as PixiVNJsonLabelStep, a as PixiVNJsonValueSet, b as PixiVNJsonIfElse, c as PixiVNJsonOperation } from './PixiVNJsonLabelStep-C-9WKwTo.cjs';
2
2
  import { LabelAbstract, LabelProps, StepLabelPropsType, StepLabelType } from '@drincs/pixi-vn/narration';
3
3
  import '@drincs/pixi-vn';
4
4
  import '@drincs/pixi-vn/motion';
@@ -1,4 +1,4 @@
1
- import { P as PixiVNJsonLabelStep, a as PixiVNJsonValueSet, b as PixiVNJsonIfElse, c as PixiVNJsonOperation } from './PixiVNJsonLabelStep-DgN7qF7j.js';
1
+ import { P as PixiVNJsonLabelStep, a as PixiVNJsonValueSet, b as PixiVNJsonIfElse, c as PixiVNJsonOperation } from './PixiVNJsonLabelStep-C-9WKwTo.js';
2
2
  import { LabelAbstract, LabelProps, StepLabelPropsType, StepLabelType } from '@drincs/pixi-vn/narration';
3
3
  import '@drincs/pixi-vn';
4
4
  import '@drincs/pixi-vn/motion';
@@ -1 +1 @@
1
- import {PixiError,createExportableElement}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 te=Object.create;var R=Object.defineProperty;var ie=Object.getOwnPropertyDescriptor;var ne=Object.getOwnPropertyNames;var oe=Object.getPrototypeOf,re=Object.prototype.hasOwnProperty;var ae=(a,e,r)=>e in a?R(a,e,{enumerable:true,configurable:true,writable:true,value:r}):a[e]=r;var D=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var q=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports);var se=(a,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ne(e))!re.call(a,n)&&n!==r&&R(a,n,{get:()=>e[n],enumerable:!(t=ie(e,n))||t.enumerable});return a};var pe=(a,e,r)=>(r=a!=null?te(oe(a)):{},se(R(r,"default",{value:a,enumerable:true}),a));var V=(a,e,r)=>ae(a,typeof e!="symbol"?e+"":e,r);var Q=q((I,K)=>{(function(a,e){typeof I=="object"?K.exports=I=e():typeof define=="function"&&define.amd?define([],e):a.CryptoJS=e();})(I,function(){var a=a||(function(e,r){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 D=="function")try{t=D("crypto");}catch{}var n=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.")},s=Object.create||(function(){function i(){}return function(o){var u;return i.prototype=o,u=new i,i.prototype=null,u}})(),p={},d=p.lib={},g=d.Base=(function(){return {extend:function(i){var o=s(this);return i&&o.mixIn(i),(!o.hasOwnProperty("init")||this.init===o.init)&&(o.init=function(){o.$super.init.apply(this,arguments);}),o.init.prototype=o,o.$super=this,o},create:function(){var i=this.extend();return i.init.apply(i,arguments),i},init:function(){},mixIn:function(i){for(var o in i)i.hasOwnProperty(o)&&(this[o]=i[o]);i.hasOwnProperty("toString")&&(this.toString=i.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),y=d.WordArray=g.extend({init:function(i,o){i=this.words=i||[],o!=r?this.sigBytes=o:this.sigBytes=i.length*4;},toString:function(i){return (i||J).stringify(this)},concat:function(i){var o=this.words,u=i.words,l=this.sigBytes,S=i.sigBytes;if(this.clamp(),l%4)for(var b=0;b<S;b++){var k=u[b>>>2]>>>24-b%4*8&255;o[l+b>>>2]|=k<<24-(l+b)%4*8;}else for(var j=0;j<S;j+=4)o[l+j>>>2]=u[j>>>2];return this.sigBytes+=S,this},clamp:function(){var i=this.words,o=this.sigBytes;i[o>>>2]&=4294967295<<32-o%4*8,i.length=e.ceil(o/4);},clone:function(){var i=g.clone.call(this);return i.words=this.words.slice(0),i},random:function(i){for(var o=[],u=0;u<i;u+=4)o.push(n());return new y.init(o,i)}}),f=p.enc={},J=f.Hex={stringify:function(i){for(var o=i.words,u=i.sigBytes,l=[],S=0;S<u;S++){var b=o[S>>>2]>>>24-S%4*8&255;l.push((b>>>4).toString(16)),l.push((b&15).toString(16));}return l.join("")},parse:function(i){for(var o=i.length,u=[],l=0;l<o;l+=2)u[l>>>3]|=parseInt(i.substr(l,2),16)<<24-l%8*4;return new y.init(u,o/2)}},N=f.Latin1={stringify:function(i){for(var o=i.words,u=i.sigBytes,l=[],S=0;S<u;S++){var b=o[S>>>2]>>>24-S%4*8&255;l.push(String.fromCharCode(b));}return l.join("")},parse:function(i){for(var o=i.length,u=[],l=0;l<o;l++)u[l>>>2]|=(i.charCodeAt(l)&255)<<24-l%4*8;return new y.init(u,o)}},C=f.Utf8={stringify:function(i){try{return decodeURIComponent(escape(N.stringify(i)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(i){return N.parse(unescape(encodeURIComponent(i)))}},m=d.BufferedBlockAlgorithm=g.extend({reset:function(){this._data=new y.init,this._nDataBytes=0;},_append:function(i){typeof i=="string"&&(i=C.parse(i)),this._data.concat(i),this._nDataBytes+=i.sigBytes;},_process:function(i){var o,u=this._data,l=u.words,S=u.sigBytes,b=this.blockSize,k=b*4,j=S/k;i?j=e.ceil(j):j=e.max((j|0)-this._minBufferSize,0);var E=j*b,M=e.min(E*4,S);if(E){for(var z=0;z<E;z+=b)this._doProcessBlock(l,z);o=l.splice(0,E),u.sigBytes-=M;}return new y.init(o,M)},clone:function(){var i=g.clone.call(this);return i._data=this._data.clone(),i},_minBufferSize:0});d.Hasher=m.extend({cfg:g.extend(),init:function(i){this.cfg=this.cfg.extend(i),this.reset();},reset:function(){m.reset.call(this),this._doReset();},update:function(i){return this._append(i),this._process(),this},finalize:function(i){i&&this._append(i);var o=this._doFinalize();return o},blockSize:512/32,_createHelper:function(i){return function(o,u){return new i.init(u).finalize(o)}},_createHmacHelper:function(i){return function(o,u){return new P.HMAC.init(i,u).finalize(o)}}});var P=p.algo={};return p})(Math);return a});});var Z=q((B,Y)=>{(function(a,e){typeof B=="object"?Y.exports=B=e(Q()):typeof define=="function"&&define.amd?define(["./core"],e):e(a.CryptoJS);})(B,function(a){return (function(){var e=a,r=e.lib,t=r.WordArray,n=r.Hasher,s=e.algo,p=[],d=s.SHA1=n.extend({_doReset:function(){this._hash=new t.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(g,y){for(var f=this._hash.words,J=f[0],N=f[1],C=f[2],m=f[3],x=f[4],P=0;P<80;P++){if(P<16)p[P]=g[y+P]|0;else {var i=p[P-3]^p[P-8]^p[P-14]^p[P-16];p[P]=i<<1|i>>>31;}var o=(J<<5|J>>>27)+x+p[P];P<20?o+=(N&C|~N&m)+1518500249:P<40?o+=(N^C^m)+1859775393:P<60?o+=(N&C|N&m|C&m)-1894007588:o+=(N^C^m)-899497514,x=m,m=C,C=N<<30|N>>>2,N=J,J=o;}f[0]=f[0]+J|0,f[1]=f[1]+N|0,f[2]=f[2]+C|0,f[3]=f[3]+m|0,f[4]=f[4]+x|0;},_doFinalize:function(){var g=this._data,y=g.words,f=this._nDataBytes*8,J=g.sigBytes*8;return y[J>>>5]|=128<<24-J%32,y[(J+64>>>9<<4)+14]=Math.floor(f/4294967296),y[(J+64>>>9<<4)+15]=f,g.sigBytes=y.length*4,this._process(),this._hash},clone:function(){var g=n.clone.call(this);return g._hash=this._hash.clone(),g}});e.SHA1=n._createHelper(d),e.HmacSHA1=n._createHmacHelper(d);})(),a.SHA1});});var H="___param___";var h;(n=>(n.log=(s,...p)=>console.log(`[Pixi\u2019VN Json] ${s}`,...p),n.warn=(s,...p)=>console.warn(`[Pixi\u2019VN Json] ${s}`,...p),n.error=(s,...p)=>console.error(`[Pixi\u2019VN Json] ${s}`,...p),n.info=(s,...p)=>console.info(`[Pixi\u2019VN Json] ${s}`,...p)))(h||(h={}));var c=class c{static init(e){e.loadAssets&&(c._loadAssets=e.loadAssets),e.soundOperation&&(c._soundOperation=e.soundOperation),e.imageOperation&&(c._imageOperation=e.imageOperation),e.videoOperation&&(c._videoOperation=e.videoOperation),e.imageContainerOperation&&(c._imageContainerOperation=e.imageContainerOperation),e.textOperation&&(c._textOperation=e.textOperation),e.canvasElementOperation&&(c._canvasElementOperation=e.canvasElementOperation),e.setStorageValue&&(c._setStorageValue=e.setStorageValue),e.setInitialStorageValue&&(c._setInitialStorageValue=e.setInitialStorageValue),e.narrationOperation&&(c._narrationOperation=e.narrationOperation),e.effectOperation&&(c._effectOperation=e.effectOperation),e.animateOperation&&(c._animateOperation=e.animateOperation),e.getLogichValue&&(c._getLogichValue=e.getLogichValue),e.getConditionalStep&&(c._getConditionalStep=e.getConditionalStep);}static get loadAssets(){return c._loadAssets}static get soundOperation(){return c._soundOperation}static get imageOperation(){return c._imageOperation}static get videoOperation(){return c._videoOperation}static get imageContainerOperation(){return c._imageContainerOperation}static get textOperation(){return c._textOperation}static get canvasElementOperation(){return c._canvasElementOperation}static get setStorageValue(){return c._setStorageValue}static get setInitialStorageValue(){return c._setInitialStorageValue}static get narrationOperation(){return c._narrationOperation}static get effectOperation(){return c._effectOperation}static get animateOperation(){return c._animateOperation}static get getLogichValue(){return c._getLogichValue}static get getConditionalStep(){return c._getConditionalStep}};V(c,"_loadAssets",()=>{}),V(c,"_soundOperation",()=>{throw h.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.")}),V(c,"_imageOperation",()=>{throw h.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.")}),V(c,"_videoOperation",()=>{throw h.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.")}),V(c,"_imageContainerOperation",()=>{throw h.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.")}),V(c,"_textOperation",()=>{throw h.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.")}),V(c,"_canvasElementOperation",()=>{throw h.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.")}),V(c,"_setStorageValue",()=>{throw h.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.")}),V(c,"_setInitialStorageValue",()=>{throw h.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.")}),V(c,"_narrationOperation",()=>{throw h.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.")}),V(c,"_effectOperation",()=>{throw h.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.")}),V(c,"_animateOperation",()=>{throw h.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.")}),V(c,"_getLogichValue",()=>{throw h.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.")}),V(c,"_getConditionalStep",()=>{throw h.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.")});var T=c;function G(a,e){if(e&&typeof e=="object"&&typeof a.functionName=="string"&&a.functionName in e){let r=e[a.functionName];if(typeof r=="function"){let t=a.args.map(n=>T.getLogichValue(n,e));return r(...t)}else h.warn(`getLogichValue function ${a.functionName} not found in props`);}}function F(a,e={}){let r="";return a.values.forEach(t=>{if(typeof t=="string")r+=t;else {let n=JsonUnifier.getLogichValue(t,e);r+=`${n}`;}}),r}async function $(a,e,r){let t=JsonUnifier.getLogichValue(a,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 "imagecontainer":await JsonUnifier.imageContainerOperation(t);break;case "text":await JsonUnifier.textOperation(t);break;case "canvaselement":await JsonUnifier.canvasElementOperation(t);break;case "value":JsonUnifier.setStorageValue(t,e);break;case "operationtoconvert":if(r){let n=F(t,e),s=await r(n);s&&await $(s,e,r);}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 G(t,e);break}}function X(a){let e=JsonUnifier.getLogichValue(a,{});e&&e.type==="value"&&e.storageOperationType==="set"&&(e.storageType==="storage"||e.storageType==="tempstorage")&&JsonUnifier.setInitialStorageValue(e);}var ee=pe(Z());var _=class extends LabelAbstract{constructor(r,t,n,s={}){n||(n={}),n.onLoadingLabel=async()=>{for(let p of t){let d;if(typeof p=="function"?d=p():d=p,d=JsonUnifier.getConditionalStep(d),d.operations)try{let g=d.operations.map(y=>JsonUnifier.loadAssets(y));await Promise.all(g);}catch(g){h.error("The operation in the onLoadingLabel function of the label has an error:",g);}}};super(r,n);V(this,"_steps");V(this,"operationStringConvert");V(this,"skipEmptyDialogs",false);this._steps=t,this.operationStringConvert=s.operationStringConvert,this.skipEmptyDialogs=s.skipEmptyDialogs||false;}get steps(){return this._steps.map(r=>this.stepConverter(r))}get stepCount(){return this._steps.length}getStepById(r){if(r<0||r>=this._steps.length)return;let t=this._steps[r];return this.stepConverter(t)}getStepSha(r){if(r<0||r>=this.steps.length)return;let t=this._steps[r];return (0, ee.default)(t.toString().toLocaleLowerCase()).toString()}getDialogueText(r,t){let n="";if(Array.isArray(r)){let s=[];r.forEach(p=>{if(typeof p=="string")s.push(p);else if(p&&typeof p=="object"){let d=JsonUnifier.getLogichValue(p,t);d?(d&&!Array.isArray(d)&&typeof d=="object"&&(d=JsonUnifier.getLogichValue(d,t)||""),Array.isArray(d)?s=s.map(g=>`${g}`).concat(d):s.push(`${d}`)):s.push(`${p}`);}else s.push(`${p}`);}),n=s;}else {let s=JsonUnifier.getLogichValue(r,t);s&&!Array.isArray(s)&&typeof s=="object"&&(s=JsonUnifier.getLogichValue(s,t)),s&&Array.isArray(s)?n=s.map(p=>`${p}`):n=`${s}`;}return n}getDialogue(r,t){if(r==null)return;let n=JsonUnifier.getLogichValue(r,t);return n==null?`${n}`:typeof n=="object"&&"character"in n&&"text"in n?{character:n.character,text:translator.t(this.getDialogueText(n.text,t))}:translator.t(this.getDialogueText(n,t))}getChoices(r,t){return JsonUnifier.getLogichValue(r,t)?.map(p=>JsonUnifier.getLogichValue(p,t)).filter(p=>p!==void 0)}stepConverter(r){return async t=>{let n=typeof r=="function"?r():r;n=createExportableElement(n),n=JsonUnifier.getConditionalStep(n,t);let s=this.operationStringConvert?m=>this.operationStringConvert(m,n,t):void 0,{operations:p=[]}=n;for(let m of p)await $(m,t,s);let{labelToOpen:d=[]}=n,g=this.getChoices(n.choices,t),y=JsonUnifier.getLogichValue(n.glueEnabled,t),f=this.getDialogue(n.dialogue,t),J=[];Array.isArray(d)||(d=[d]),d.forEach(m=>{let x=JsonUnifier.getLogichValue(m,t);x&&J.push(x);});let N=JsonUnifier.getLogichValue(n.goNextStep,t),C=JsonUnifier.getLogichValue(n.end,t);if(g){let m=g.map(x=>{let P="";if(Array.isArray(x.text)){let o=[];x.text.forEach(u=>{if(typeof u=="string")o.push(translator.t(u));else if(u&&typeof u=="object"){let l=JsonUnifier.getLogichValue(u,t);l&&!Array.isArray(l)&&typeof l=="object"&&(l=JsonUnifier.getLogichValue(l,t)||""),l&&(Array.isArray(l)?o=o.concat(translator.t(l)):o.push(translator.t(l)));}}),P=o;}else typeof x.text=="string"&&(P=translator.t(x.text));return {label:x.label,text:P,props:x.props,type:x.type,oneTime:x.oneTime,onlyHaveNoChoice:x.onlyHaveNoChoice,autoSelect:x.autoSelect}});narration.choices=m;}else narration.choices=void 0;f!==void 0&&(narration.dialogue=f,this.skipEmptyDialogs&&typeof f=="string"&&(f===""||RegExp(/^\s+$/).test(f))&&(N=true)),y?narration.dialogGlue=true:y===false&&(narration.dialogGlue=false);for(let m of J){let x=m.label;typeof x=="object"&&(x=JsonUnifier.getLogichValue(x,t)||"");let P=m.params?.map(i=>JsonUnifier.getLogichValue(i,t));t={...t,...m.props},m.type==="jump"?(narration.openedLabels.length>0&&narration.closeCurrentLabel(),storage.setTempVariable(`${H}${narration.openedLabels.length}`,P),await narration.call(x,t)):(storage.setTempVariable(`${H}${narration.openedLabels.length}`,P),await narration.call(x,t));}C==="game_end"?(narration.closeAllLabels(),await narration.continue(t,{runNow:true})):C==="label_end"&&narration.closeCurrentLabel(),N&&await narration.continue(t,{runNow:true});}}};async function ge(a,e={}){if(!Array.isArray(a))if(typeof a=="object"||typeof a=="string")a=[a];else {h.error("Error parsing imported Pixi'VN JSON: data is not an object");return}let t=a.map(n=>{if(typeof n=="string")try{return JSON.parse(n)}catch(s){return h.error("Error parsing imported Pixi'VN JSON",s),{}}return n}).map(async n=>{if(n.initialOperations)for(let s of n.initialOperations)X(s);if(n.labels){let s=n.labels;for(let p in s)try{let d=s[p],g=new _(p,d,void 0,e);RegisteredLabels.add(g);}catch(d){h.error(`Error creating JSON label ${p}`,d);}}});await Promise.all(t);}export{_ as LabelJson,ge as importPixiVNJson};
1
+ import {PixiError,createExportableElement}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 te=Object.create;var R=Object.defineProperty;var ie=Object.getOwnPropertyDescriptor;var ne=Object.getOwnPropertyNames;var oe=Object.getPrototypeOf,re=Object.prototype.hasOwnProperty;var ae=(s,e,r)=>e in s?R(s,e,{enumerable:true,configurable:true,writable:true,value:r}):s[e]=r;var D=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+s+'" is not supported')});var W=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports);var se=(s,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ne(e))!re.call(s,n)&&n!==r&&R(s,n,{get:()=>e[n],enumerable:!(t=ie(e,n))||t.enumerable});return s};var pe=(s,e,r)=>(r=s!=null?te(oe(s)):{},se(R(r,"default",{value:s,enumerable:true}),s));var V=(s,e,r)=>ae(s,typeof e!="symbol"?e+"":e,r);var Q=W((I,K)=>{(function(s,e){typeof I=="object"?K.exports=I=e():typeof define=="function"&&define.amd?define([],e):s.CryptoJS=e();})(I,function(){var s=s||(function(e,r){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 D=="function")try{t=D("crypto");}catch{}var n=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(o){var u;return i.prototype=o,u=new i,i.prototype=null,u}})(),a={},d=a.lib={},m=d.Base=(function(){return {extend:function(i){var o=p(this);return i&&o.mixIn(i),(!o.hasOwnProperty("init")||this.init===o.init)&&(o.init=function(){o.$super.init.apply(this,arguments);}),o.init.prototype=o,o.$super=this,o},create:function(){var i=this.extend();return i.init.apply(i,arguments),i},init:function(){},mixIn:function(i){for(var o in i)i.hasOwnProperty(o)&&(this[o]=i[o]);i.hasOwnProperty("toString")&&(this.toString=i.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),v=d.WordArray=m.extend({init:function(i,o){i=this.words=i||[],o!=r?this.sigBytes=o:this.sigBytes=i.length*4;},toString:function(i){return (i||J).stringify(this)},concat:function(i){var o=this.words,u=i.words,l=this.sigBytes,S=i.sigBytes;if(this.clamp(),l%4)for(var b=0;b<S;b++){var k=u[b>>>2]>>>24-b%4*8&255;o[l+b>>>2]|=k<<24-(l+b)%4*8;}else for(var j=0;j<S;j+=4)o[l+j>>>2]=u[j>>>2];return this.sigBytes+=S,this},clamp:function(){var i=this.words,o=this.sigBytes;i[o>>>2]&=4294967295<<32-o%4*8,i.length=e.ceil(o/4);},clone:function(){var i=m.clone.call(this);return i.words=this.words.slice(0),i},random:function(i){for(var o=[],u=0;u<i;u+=4)o.push(n());return new v.init(o,i)}}),f=a.enc={},J=f.Hex={stringify:function(i){for(var o=i.words,u=i.sigBytes,l=[],S=0;S<u;S++){var b=o[S>>>2]>>>24-S%4*8&255;l.push((b>>>4).toString(16)),l.push((b&15).toString(16));}return l.join("")},parse:function(i){for(var o=i.length,u=[],l=0;l<o;l+=2)u[l>>>3]|=parseInt(i.substr(l,2),16)<<24-l%8*4;return new v.init(u,o/2)}},N=f.Latin1={stringify:function(i){for(var o=i.words,u=i.sigBytes,l=[],S=0;S<u;S++){var b=o[S>>>2]>>>24-S%4*8&255;l.push(String.fromCharCode(b));}return l.join("")},parse:function(i){for(var o=i.length,u=[],l=0;l<o;l++)u[l>>>2]|=(i.charCodeAt(l)&255)<<24-l%4*8;return new v.init(u,o)}},C=f.Utf8={stringify:function(i){try{return decodeURIComponent(escape(N.stringify(i)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(i){return N.parse(unescape(encodeURIComponent(i)))}},g=d.BufferedBlockAlgorithm=m.extend({reset:function(){this._data=new v.init,this._nDataBytes=0;},_append:function(i){typeof i=="string"&&(i=C.parse(i)),this._data.concat(i),this._nDataBytes+=i.sigBytes;},_process:function(i){var o,u=this._data,l=u.words,S=u.sigBytes,b=this.blockSize,k=b*4,j=S/k;i?j=e.ceil(j):j=e.max((j|0)-this._minBufferSize,0);var E=j*b,q=e.min(E*4,S);if(E){for(var z=0;z<E;z+=b)this._doProcessBlock(l,z);o=l.splice(0,E),u.sigBytes-=q;}return new v.init(o,q)},clone:function(){var i=m.clone.call(this);return i._data=this._data.clone(),i},_minBufferSize:0});d.Hasher=g.extend({cfg:m.extend(),init:function(i){this.cfg=this.cfg.extend(i),this.reset();},reset:function(){g.reset.call(this),this._doReset();},update:function(i){return this._append(i),this._process(),this},finalize:function(i){i&&this._append(i);var o=this._doFinalize();return o},blockSize:512/32,_createHelper:function(i){return function(o,u){return new i.init(u).finalize(o)}},_createHmacHelper:function(i){return function(o,u){return new P.HMAC.init(i,u).finalize(o)}}});var P=a.algo={};return a})(Math);return s});});var Z=W((B,Y)=>{(function(s,e){typeof B=="object"?Y.exports=B=e(Q()):typeof define=="function"&&define.amd?define(["./core"],e):e(s.CryptoJS);})(B,function(s){return (function(){var e=s,r=e.lib,t=r.WordArray,n=r.Hasher,p=e.algo,a=[],d=p.SHA1=n.extend({_doReset:function(){this._hash=new t.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(m,v){for(var f=this._hash.words,J=f[0],N=f[1],C=f[2],g=f[3],x=f[4],P=0;P<80;P++){if(P<16)a[P]=m[v+P]|0;else {var i=a[P-3]^a[P-8]^a[P-14]^a[P-16];a[P]=i<<1|i>>>31;}var o=(J<<5|J>>>27)+x+a[P];P<20?o+=(N&C|~N&g)+1518500249:P<40?o+=(N^C^g)+1859775393:P<60?o+=(N&C|N&g|C&g)-1894007588:o+=(N^C^g)-899497514,x=g,g=C,C=N<<30|N>>>2,N=J,J=o;}f[0]=f[0]+J|0,f[1]=f[1]+N|0,f[2]=f[2]+C|0,f[3]=f[3]+g|0,f[4]=f[4]+x|0;},_doFinalize:function(){var m=this._data,v=m.words,f=this._nDataBytes*8,J=m.sigBytes*8;return v[J>>>5]|=128<<24-J%32,v[(J+64>>>9<<4)+14]=Math.floor(f/4294967296),v[(J+64>>>9<<4)+15]=f,m.sigBytes=v.length*4,this._process(),this._hash},clone:function(){var m=n.clone.call(this);return m._hash=this._hash.clone(),m}});e.SHA1=n._createHelper(d),e.HmacSHA1=n._createHmacHelper(d);})(),s.SHA1});});var H="___param___";var h;(n=>(n.log=(p,...a)=>console.log(`[Pixi\u2019VN Json] ${p}`,...a),n.warn=(p,...a)=>console.warn(`[Pixi\u2019VN Json] ${p}`,...a),n.error=(p,...a)=>console.error(`[Pixi\u2019VN Json] ${p}`,...a),n.info=(p,...a)=>console.info(`[Pixi\u2019VN Json] ${p}`,...a)))(h||(h={}));var c=class c{static init(e){e.loadAssets&&(c._loadAssets=e.loadAssets),e.soundOperation&&(c._soundOperation=e.soundOperation),e.imageOperation&&(c._imageOperation=e.imageOperation),e.videoOperation&&(c._videoOperation=e.videoOperation),e.imageContainerOperation&&(c._imageContainerOperation=e.imageContainerOperation),e.textOperation&&(c._textOperation=e.textOperation),e.canvasElementOperation&&(c._canvasElementOperation=e.canvasElementOperation),e.setStorageValue&&(c._setStorageValue=e.setStorageValue),e.setInitialStorageValue&&(c._setInitialStorageValue=e.setInitialStorageValue),e.narrationOperation&&(c._narrationOperation=e.narrationOperation),e.effectOperation&&(c._effectOperation=e.effectOperation),e.animateOperation&&(c._animateOperation=e.animateOperation),e.getLogichValue&&(c._getLogichValue=e.getLogichValue),e.getConditionalStep&&(c._getConditionalStep=e.getConditionalStep);}static get loadAssets(){return c._loadAssets}static get soundOperation(){return c._soundOperation}static get imageOperation(){return c._imageOperation}static get videoOperation(){return c._videoOperation}static get imageContainerOperation(){return c._imageContainerOperation}static get textOperation(){return c._textOperation}static get canvasElementOperation(){return c._canvasElementOperation}static get setStorageValue(){return c._setStorageValue}static get setInitialStorageValue(){return c._setInitialStorageValue}static get narrationOperation(){return c._narrationOperation}static get effectOperation(){return c._effectOperation}static get animateOperation(){return c._animateOperation}static get getLogichValue(){return c._getLogichValue}static get getConditionalStep(){return c._getConditionalStep}};V(c,"_loadAssets",()=>{}),V(c,"_soundOperation",()=>{throw h.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.")}),V(c,"_imageOperation",()=>{throw h.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.")}),V(c,"_videoOperation",()=>{throw h.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.")}),V(c,"_imageContainerOperation",()=>{throw h.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.")}),V(c,"_textOperation",()=>{throw h.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.")}),V(c,"_canvasElementOperation",()=>{throw h.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.")}),V(c,"_setStorageValue",()=>{throw h.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.")}),V(c,"_setInitialStorageValue",()=>{throw h.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.")}),V(c,"_narrationOperation",()=>{throw h.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.")}),V(c,"_effectOperation",()=>{throw h.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.")}),V(c,"_animateOperation",()=>{throw h.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.")}),V(c,"_getLogichValue",()=>{throw h.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.")}),V(c,"_getConditionalStep",()=>{throw h.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.")});var T=c;function F(s,e){if(e&&typeof e=="object"&&typeof s.functionName=="string"&&s.functionName in e){let r=e[s.functionName];if(typeof r=="function"){let t=s.args.map(n=>T.getLogichValue(n,e));return r(...t)}else h.warn(`getLogichValue function ${s.functionName} not found in props`);}}function X(s,e={}){let r="";return s.values.forEach(t=>{if(typeof t=="string")r+=t;else {let n=JsonUnifier.getLogichValue(t,e);r+=`${n}`;}}),r}async function $(s,e,r){let t=JsonUnifier.getLogichValue(s,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 "imagecontainer":await JsonUnifier.imageContainerOperation(t);break;case "text":await JsonUnifier.textOperation(t);break;case "canvaselement":await JsonUnifier.canvasElementOperation(t);break;case "value":JsonUnifier.setStorageValue(t,e);break;case "operationtoconvert":if(r){let n=X(t,e),p=await r(n);p&&await $(p,e,r);}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 F(t,e);break}}function M(s){let e=JsonUnifier.getLogichValue(s,{});e&&e.type==="value"&&e.storageOperationType==="set"&&(e.storageType==="storage"||e.storageType==="tempstorage")&&JsonUnifier.setInitialStorageValue(e);}var ee=pe(Z());var _=class extends LabelAbstract{constructor(r,t,n,p={}){n||(n={}),n.onLoadingLabel=async()=>{for(let a of t){let d;if(typeof a=="function"?d=a():d=a,d=JsonUnifier.getConditionalStep(d),d.operations)try{let m=d.operations.map(v=>JsonUnifier.loadAssets(v));await Promise.all(m);}catch(m){h.error("The operation in the onLoadingLabel function of the label has an error:",m);}}};super(r,n);V(this,"_steps");V(this,"operationStringConvert");V(this,"skipEmptyDialogs",false);this._steps=t,this.operationStringConvert=p.operationStringConvert,this.skipEmptyDialogs=p.skipEmptyDialogs||false;}get steps(){return this._steps.map(r=>this.stepConverter(r))}get stepCount(){return this._steps.length}getStepById(r){if(r<0||r>=this._steps.length)return;let t=this._steps[r];return this.stepConverter(t)}getStepSha(r){if(r<0||r>=this.steps.length)return;let t=this._steps[r];return (0, ee.default)(t.toString().toLocaleLowerCase()).toString()}getDialogueText(r,t){let n="";if(Array.isArray(r)){let p=[];r.forEach(a=>{if(typeof a=="string")p.push(a);else if(a&&typeof a=="object"){let d=JsonUnifier.getLogichValue(a,t);d?(d&&!Array.isArray(d)&&typeof d=="object"&&(d=JsonUnifier.getLogichValue(d,t)||""),Array.isArray(d)?p=p.map(m=>`${m}`).concat(d):p.push(`${d}`)):p.push(`${a}`);}else p.push(`${a}`);}),n=p;}else {let p=JsonUnifier.getLogichValue(r,t);p&&!Array.isArray(p)&&typeof p=="object"&&(p=JsonUnifier.getLogichValue(p,t)),p&&Array.isArray(p)?n=p.map(a=>`${a}`):n=`${p}`;}return n}getDialogue(r,t){if(r==null)return;let n=JsonUnifier.getLogichValue(r,t);return n==null?`${n}`:typeof n=="object"&&"character"in n&&"text"in n?{character:n.character,text:translator.t(this.getDialogueText(n.text,t))}:translator.t(this.getDialogueText(n,t))}getChoices(r,t){return JsonUnifier.getLogichValue(r,t)?.map(a=>JsonUnifier.getLogichValue(a,t)).filter(a=>a!==void 0)}stepConverter(r){return async t=>{let n=typeof r=="function"?r():r;n=createExportableElement(n),n=JsonUnifier.getConditionalStep(n,t);let p=this.operationStringConvert?g=>this.operationStringConvert(g,n,t):void 0,{operations:a=[]}=n;for(let g of a)await $(g,t,p);let{labelToOpen:d=[]}=n,m=this.getChoices(n.choices,t),v=JsonUnifier.getLogichValue(n.glueEnabled,t),f=this.getDialogue(n.dialogue,t),J=[];Array.isArray(d)||(d=[d]),d.forEach(g=>{let x=JsonUnifier.getLogichValue(g,t);x&&J.push(x);});let N=JsonUnifier.getLogichValue(n.goNextStep,t),C=JsonUnifier.getLogichValue(n.end,t);if(m){let g=m.map(x=>{let P="";if(Array.isArray(x.text)){let o=[];x.text.forEach(u=>{if(typeof u=="string")o.push(translator.t(u));else if(u&&typeof u=="object"){let l=JsonUnifier.getLogichValue(u,t);l&&!Array.isArray(l)&&typeof l=="object"&&(l=JsonUnifier.getLogichValue(l,t)||""),l&&(Array.isArray(l)?o=o.concat(translator.t(l)):o.push(translator.t(l)));}}),P=o;}else typeof x.text=="string"&&(P=translator.t(x.text));return {label:x.label,text:P,props:x.props,type:x.type,oneTime:x.oneTime,onlyHaveNoChoice:x.onlyHaveNoChoice,autoSelect:x.autoSelect}});narration.choices=g;}else narration.choices=void 0;f!==void 0&&(narration.dialogue=f,this.skipEmptyDialogs&&typeof f=="string"&&(f===""||RegExp(/^\s+$/).test(f))&&(N=true)),v?narration.dialogGlue=true:v===false&&(narration.dialogGlue=false);for(let g of J){let x=g.label;typeof x=="object"&&(x=JsonUnifier.getLogichValue(x,t)||"");let P=g.params?.map(i=>JsonUnifier.getLogichValue(i,t));t={...t,...g.props},g.type==="jump"?(narration.openedLabels.length>0&&narration.closeCurrentLabel(),storage.setTempVariable(`${H}${narration.openedLabels.length}`,P),await narration.call(x,t)):(storage.setTempVariable(`${H}${narration.openedLabels.length}`,P),await narration.call(x,t));}C==="game_end"?(narration.closeAllLabels(),await narration.continue(t,{runNow:true})):C==="label_end"&&narration.closeCurrentLabel(),N&&await narration.continue(t,{runNow:true});}}};async function me(s,e={}){if(!Array.isArray(s))if(typeof s=="object"||typeof s=="string")s=[s];else {h.error("Error parsing imported Pixi'VN JSON: data is not an object");return}let r=s.map(p=>{if(typeof p=="string")try{return JSON.parse(p)}catch(a){return h.error("Error parsing imported Pixi'VN JSON",a),{}}return p}),t=r.map(async p=>{if(p.initialOperations)for(let a of p.initialOperations)a.type==="value"&&(typeof a.value!="object"||!a.value||!("type"in a.value))&&M(a);return Promise.resolve()});await Promise.all(t);let n=r.map(async p=>{if(p.initialOperations)for(let a of p.initialOperations)(a.type!=="value"||a.type==="value"&&typeof a.value=="object"&&a.value&&"type"in a.value)&&M(a);if(p.labels){let a=p.labels;for(let d in a)try{let m=a[d],v=new _(d,m,void 0,e);RegisteredLabels.add(v);}catch(m){h.error(`Error creating JSON label ${d}`,m);}}return Promise.resolve()});await Promise.all(n);}export{_ as LabelJson,me as importPixiVNJson};
package/dist/schema.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { w as PixiVNJsonLabelStep, n as PixiVNJsonValueSet, a as PixiVNJsonIfElse } from './PixiVNJsonLabelStep-dVwPLFMT.cjs';
2
- export { x as PixiVNJsonAnimateBase, y as PixiVNJsonAnimateSequence, t as PixiVNJsonArithmeticOperations, z as PixiVNJsonArithmeticOperationsArithmetic, A as PixiVNJsonArithmeticOperationsArithmeticSingle, B as PixiVNJsonCanvas, r as PixiVNJsonCanvasAnimate, C as PixiVNJsonCanvasEdit, q as PixiVNJsonCanvasEffect, i as PixiVNJsonCanvasImageContainerShow, d as PixiVNJsonCanvasImageVideoShow, f as PixiVNJsonCanvasRemove, D as PixiVNJsonCanvasShow, k as PixiVNJsonCanvasTextShow, E as PixiVNJsonChoice, F as PixiVNJsonChoiceGet, G as PixiVNJsonChoices, H as PixiVNJsonComparation, I as PixiVNJsonComparationOperatorsType, J as PixiVNJsonConditionalOperation, K as PixiVNJsonConditionalResultToCombine, v as PixiVNJsonConditionalStatements, u as PixiVNJsonConditions, L as PixiVNJsonDialog, M as PixiVNJsonDialogText, N as PixiVNJsonFunction, j as PixiVNJsonImageContainerEdit, e as PixiVNJsonImageEdit, O as PixiVNJsonLabelGet, Q as PixiVNJsonLabelToOpen, R as PixiVNJsonLogicGet, S as PixiVNJsonMediaTransiotions, p as PixiVNJsonNarration, o as PixiVNJsonOnlyStorageSet, P as PixiVNJsonOperation, b as PixiVNJsonOperationString, T as PixiVNJsonParamGet, c as PixiVNJsonSound, U as PixiVNJsonStepSwitch, V as PixiVNJsonStepSwitchElementType, W as PixiVNJsonStepSwitchElementsType, X as PixiVNJsonStorageGet, l as PixiVNJsonTextEdit, Y as PixiVNJsonUnionCondition, m as PixiVNJsonUnknownEdit, s as PixiVNJsonValueGet, g as PixiVNJsonVideoEdit, h as PixiVNJsonVideoPauseResume } from './PixiVNJsonLabelStep-dVwPLFMT.cjs';
1
+ import { w as PixiVNJsonLabelStep, n as PixiVNJsonValueSet, a as PixiVNJsonIfElse } from './PixiVNJsonLabelStep-DQx6TBvZ.cjs';
2
+ export { x as PixiVNJsonAnimateBase, y as PixiVNJsonAnimateSequence, t as PixiVNJsonArithmeticOperations, z as PixiVNJsonArithmeticOperationsArithmetic, A as PixiVNJsonArithmeticOperationsArithmeticSingle, B as PixiVNJsonCanvas, r as PixiVNJsonCanvasAnimate, C as PixiVNJsonCanvasEdit, q as PixiVNJsonCanvasEffect, i as PixiVNJsonCanvasImageContainerShow, d as PixiVNJsonCanvasImageVideoShow, f as PixiVNJsonCanvasRemove, D as PixiVNJsonCanvasShow, k as PixiVNJsonCanvasTextShow, E as PixiVNJsonChoice, F as PixiVNJsonChoiceGet, G as PixiVNJsonChoices, H as PixiVNJsonComparation, I as PixiVNJsonComparationOperatorsType, J as PixiVNJsonConditionalOperation, K as PixiVNJsonConditionalResultToCombine, v as PixiVNJsonConditionalStatements, u as PixiVNJsonConditions, L as PixiVNJsonDialog, M as PixiVNJsonDialogText, N as PixiVNJsonFunction, j as PixiVNJsonImageContainerEdit, e as PixiVNJsonImageEdit, O as PixiVNJsonLabelGet, Q as PixiVNJsonLabelToOpen, R as PixiVNJsonLogicGet, S as PixiVNJsonMediaTransiotions, p as PixiVNJsonNarration, o as PixiVNJsonOnlyStorageSet, P as PixiVNJsonOperation, b as PixiVNJsonOperationString, T as PixiVNJsonParamGet, c as PixiVNJsonSound, U as PixiVNJsonStepSwitch, V as PixiVNJsonStepSwitchElementType, W as PixiVNJsonStepSwitchElementsType, X as PixiVNJsonStorageGet, l as PixiVNJsonTextEdit, Y as PixiVNJsonUnionCondition, m as PixiVNJsonUnknownEdit, s as PixiVNJsonValueGet, g as PixiVNJsonVideoEdit, h as PixiVNJsonVideoPauseResume } from './PixiVNJsonLabelStep-DQx6TBvZ.cjs';
3
3
  import '@drincs/pixi-vn';
4
4
  import '@drincs/pixi-vn/motion';
5
5
  import 'pixi.js';
package/dist/schema.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { w as PixiVNJsonLabelStep, n as PixiVNJsonValueSet, a as PixiVNJsonIfElse } from './PixiVNJsonLabelStep-dVwPLFMT.js';
2
- export { x as PixiVNJsonAnimateBase, y as PixiVNJsonAnimateSequence, t as PixiVNJsonArithmeticOperations, z as PixiVNJsonArithmeticOperationsArithmetic, A as PixiVNJsonArithmeticOperationsArithmeticSingle, B as PixiVNJsonCanvas, r as PixiVNJsonCanvasAnimate, C as PixiVNJsonCanvasEdit, q as PixiVNJsonCanvasEffect, i as PixiVNJsonCanvasImageContainerShow, d as PixiVNJsonCanvasImageVideoShow, f as PixiVNJsonCanvasRemove, D as PixiVNJsonCanvasShow, k as PixiVNJsonCanvasTextShow, E as PixiVNJsonChoice, F as PixiVNJsonChoiceGet, G as PixiVNJsonChoices, H as PixiVNJsonComparation, I as PixiVNJsonComparationOperatorsType, J as PixiVNJsonConditionalOperation, K as PixiVNJsonConditionalResultToCombine, v as PixiVNJsonConditionalStatements, u as PixiVNJsonConditions, L as PixiVNJsonDialog, M as PixiVNJsonDialogText, N as PixiVNJsonFunction, j as PixiVNJsonImageContainerEdit, e as PixiVNJsonImageEdit, O as PixiVNJsonLabelGet, Q as PixiVNJsonLabelToOpen, R as PixiVNJsonLogicGet, S as PixiVNJsonMediaTransiotions, p as PixiVNJsonNarration, o as PixiVNJsonOnlyStorageSet, P as PixiVNJsonOperation, b as PixiVNJsonOperationString, T as PixiVNJsonParamGet, c as PixiVNJsonSound, U as PixiVNJsonStepSwitch, V as PixiVNJsonStepSwitchElementType, W as PixiVNJsonStepSwitchElementsType, X as PixiVNJsonStorageGet, l as PixiVNJsonTextEdit, Y as PixiVNJsonUnionCondition, m as PixiVNJsonUnknownEdit, s as PixiVNJsonValueGet, g as PixiVNJsonVideoEdit, h as PixiVNJsonVideoPauseResume } from './PixiVNJsonLabelStep-dVwPLFMT.js';
1
+ import { w as PixiVNJsonLabelStep, n as PixiVNJsonValueSet, a as PixiVNJsonIfElse } from './PixiVNJsonLabelStep-DQx6TBvZ.js';
2
+ export { x as PixiVNJsonAnimateBase, y as PixiVNJsonAnimateSequence, t as PixiVNJsonArithmeticOperations, z as PixiVNJsonArithmeticOperationsArithmetic, A as PixiVNJsonArithmeticOperationsArithmeticSingle, B as PixiVNJsonCanvas, r as PixiVNJsonCanvasAnimate, C as PixiVNJsonCanvasEdit, q as PixiVNJsonCanvasEffect, i as PixiVNJsonCanvasImageContainerShow, d as PixiVNJsonCanvasImageVideoShow, f as PixiVNJsonCanvasRemove, D as PixiVNJsonCanvasShow, k as PixiVNJsonCanvasTextShow, E as PixiVNJsonChoice, F as PixiVNJsonChoiceGet, G as PixiVNJsonChoices, H as PixiVNJsonComparation, I as PixiVNJsonComparationOperatorsType, J as PixiVNJsonConditionalOperation, K as PixiVNJsonConditionalResultToCombine, v as PixiVNJsonConditionalStatements, u as PixiVNJsonConditions, L as PixiVNJsonDialog, M as PixiVNJsonDialogText, N as PixiVNJsonFunction, j as PixiVNJsonImageContainerEdit, e as PixiVNJsonImageEdit, O as PixiVNJsonLabelGet, Q as PixiVNJsonLabelToOpen, R as PixiVNJsonLogicGet, S as PixiVNJsonMediaTransiotions, p as PixiVNJsonNarration, o as PixiVNJsonOnlyStorageSet, P as PixiVNJsonOperation, b as PixiVNJsonOperationString, T as PixiVNJsonParamGet, c as PixiVNJsonSound, U as PixiVNJsonStepSwitch, V as PixiVNJsonStepSwitchElementType, W as PixiVNJsonStepSwitchElementsType, X as PixiVNJsonStorageGet, l as PixiVNJsonTextEdit, Y as PixiVNJsonUnionCondition, m as PixiVNJsonUnknownEdit, s as PixiVNJsonValueGet, g as PixiVNJsonVideoEdit, h as PixiVNJsonVideoPauseResume } from './PixiVNJsonLabelStep-DQx6TBvZ.js';
3
3
  import '@drincs/pixi-vn';
4
4
  import '@drincs/pixi-vn/motion';
5
5
  import 'pixi.js';
@@ -277,13 +277,14 @@ interface PixiVNJsonArithmeticOperationsArithmetic {
277
277
  * Operator of the arithmetic operation:
278
278
  * - `"*"` multiplication
279
279
  * - `"/"` division
280
- * - `"+"` addition
281
- * - `"-"` subtraction
280
+ * - `"+"` addition (concatenation for strings and arrays)
281
+ * - `"-"` subtraction (removal of elements for arrays)
282
282
  * - `"%"` modulo
283
283
  * - `"POW"` exponentiation
284
284
  * - `"RANDOM"` random integer between leftValue and rightValue (inclusive)
285
+ * - `"INTERSECTION"` intersection of two arrays (only elements present in both arrays are included in the result)
285
286
  */
286
- operator: "*" | "/" | "+" | "-" | "%" | "POW" | "RANDOM";
287
+ operator: "*" | "/" | "+" | "-" | "%" | "POW" | "RANDOM" | "INTERSECTION";
287
288
  }
288
289
  /**
289
290
  * Unary arithmetic operation applied to a single value (e.g. INT, FLOOR, FLOAT).
@@ -346,7 +347,7 @@ type PixiVNJsonUnionCondition = PixiVNJsonUnionConditionAndOr | PixiVNJsonUnionC
346
347
  * - `"<="` less than or equal
347
348
  * - `">"` greater than
348
349
  * - `">="` greater than or equal
349
- * - `"CONTAINS"` checks whether the left string/array contains the right value
350
+ * - `"CONTAINS"` checks whether the left string/array contains the right value, if left and right are arrays, checks if all items in right are included in left
350
351
  */
351
352
  type PixiVNJsonComparationOperatorsType = "==" | "!=" | "<" | "<=" | ">" | ">=" | "CONTAINS";
352
353
  /**
@@ -388,6 +389,13 @@ interface PixiVNJsonIfElse<Then> {
388
389
  type: "ifelse";
389
390
  /**
390
391
  * The list of conditions to be checked.
392
+ *
393
+ * if is a {@link StorageElementType} or a {@link PixiVNJsonValueGet}:
394
+ * - if is a array or object, the condition is true if not empty
395
+ * - if is a string, the condition is true if not empty
396
+ * - if is a number, the condition is true if not zero
397
+ * - if is a boolean, the condition is true if true
398
+ * - if is null or undefined, the condition is false
391
399
  */
392
400
  condition: PixiVNJsonConditions;
393
401
  /**
@@ -277,13 +277,14 @@ interface PixiVNJsonArithmeticOperationsArithmetic {
277
277
  * Operator of the arithmetic operation:
278
278
  * - `"*"` multiplication
279
279
  * - `"/"` division
280
- * - `"+"` addition
281
- * - `"-"` subtraction
280
+ * - `"+"` addition (concatenation for strings and arrays)
281
+ * - `"-"` subtraction (removal of elements for arrays)
282
282
  * - `"%"` modulo
283
283
  * - `"POW"` exponentiation
284
284
  * - `"RANDOM"` random integer between leftValue and rightValue (inclusive)
285
+ * - `"INTERSECTION"` intersection of two arrays (only elements present in both arrays are included in the result)
285
286
  */
286
- operator: "*" | "/" | "+" | "-" | "%" | "POW" | "RANDOM";
287
+ operator: "*" | "/" | "+" | "-" | "%" | "POW" | "RANDOM" | "INTERSECTION";
287
288
  }
288
289
  /**
289
290
  * Unary arithmetic operation applied to a single value (e.g. INT, FLOOR, FLOAT).
@@ -346,7 +347,7 @@ type PixiVNJsonUnionCondition = PixiVNJsonUnionConditionAndOr | PixiVNJsonUnionC
346
347
  * - `"<="` less than or equal
347
348
  * - `">"` greater than
348
349
  * - `">="` greater than or equal
349
- * - `"CONTAINS"` checks whether the left string/array contains the right value
350
+ * - `"CONTAINS"` checks whether the left string/array contains the right value, if left and right are arrays, checks if all items in right are included in left
350
351
  */
351
352
  type PixiVNJsonComparationOperatorsType = "==" | "!=" | "<" | "<=" | ">" | ">=" | "CONTAINS";
352
353
  /**
@@ -388,6 +389,13 @@ interface PixiVNJsonIfElse<Then> {
388
389
  type: "ifelse";
389
390
  /**
390
391
  * The list of conditions to be checked.
392
+ *
393
+ * if is a {@link StorageElementType} or a {@link PixiVNJsonValueGet}:
394
+ * - if is a array or object, the condition is true if not empty
395
+ * - if is a string, the condition is true if not empty
396
+ * - if is a number, the condition is true if not zero
397
+ * - if is a boolean, the condition is true if true
398
+ * - if is null or undefined, the condition is false
391
399
  */
392
400
  condition: PixiVNJsonConditions;
393
401
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drincs/pixi-vn-json",
3
- "version": "1.13.0",
3
+ "version": "1.13.1",
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",