@drincs/pixi-vn 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas/CanvasManager.cjs +1 -1
- package/dist/canvas/CanvasManager.js +1 -1
- package/dist/canvas/CanvasManagerStatic.cjs +1 -1
- package/dist/canvas/CanvasManagerStatic.js +1 -1
- package/dist/canvas/components/Container.cjs +1 -1
- package/dist/canvas/components/Container.js +1 -1
- package/dist/canvas/components/ImageContainer.cjs +1 -1
- package/dist/canvas/components/ImageContainer.js +1 -1
- package/dist/canvas/components/ImageSprite.cjs +1 -1
- package/dist/canvas/components/ImageSprite.js +1 -1
- package/dist/canvas/components/Sprite.cjs +1 -1
- package/dist/canvas/components/Sprite.js +1 -1
- package/dist/canvas/components/Text.cjs +1 -1
- package/dist/canvas/components/Text.js +1 -1
- package/dist/canvas/components/VideoSprite.cjs +1 -1
- package/dist/canvas/components/VideoSprite.js +1 -1
- package/dist/canvas/decorators/canvas-element-decorator.cjs +1 -1
- package/dist/canvas/decorators/canvas-element-decorator.js +1 -1
- package/dist/canvas/decorators/event-decorator.cjs +1 -1
- package/dist/canvas/decorators/event-decorator.d.cts +1 -3
- package/dist/canvas/decorators/event-decorator.d.ts +1 -3
- package/dist/canvas/decorators/event-decorator.js +1 -1
- package/dist/canvas/functions/canvas-effect.cjs +1 -1
- package/dist/canvas/functions/canvas-effect.js +1 -1
- package/dist/canvas/functions/canvas-import-utility.cjs +1 -1
- package/dist/canvas/functions/canvas-import-utility.js +1 -1
- package/dist/canvas/functions/canvas-property-utility.cjs +1 -1
- package/dist/canvas/functions/canvas-property-utility.js +1 -1
- package/dist/canvas/functions/canvas-transition.cjs +1 -1
- package/dist/canvas/functions/canvas-transition.js +1 -1
- package/dist/canvas/functions/image-container-utility.cjs +1 -1
- package/dist/canvas/functions/image-container-utility.js +1 -1
- package/dist/canvas/functions/image-utility.cjs +1 -1
- package/dist/canvas/functions/image-utility.js +1 -1
- package/dist/canvas/functions/ticker-utility.cjs +1 -1
- package/dist/canvas/functions/ticker-utility.js +1 -1
- package/dist/canvas/functions/video-utility.cjs +1 -1
- package/dist/canvas/functions/video-utility.js +1 -1
- package/dist/canvas/index.cjs +1 -1
- package/dist/canvas/index.js +1 -1
- package/dist/canvas/tickers/classes/TickerBase.cjs +1 -1
- package/dist/canvas/tickers/classes/TickerBase.js +1 -1
- package/dist/canvas/tickers/components/FadeAlphaTicker.cjs +1 -1
- package/dist/canvas/tickers/components/FadeAlphaTicker.js +1 -1
- package/dist/canvas/tickers/components/MoveTicker.cjs +1 -1
- package/dist/canvas/tickers/components/MoveTicker.js +1 -1
- package/dist/canvas/tickers/components/RotateTicker.cjs +1 -1
- package/dist/canvas/tickers/components/RotateTicker.js +1 -1
- package/dist/canvas/tickers/components/ZoomTicker.cjs +1 -1
- package/dist/canvas/tickers/components/ZoomTicker.js +1 -1
- package/dist/canvas/tickers/decorators/ticker-decorator.cjs +1 -1
- package/dist/canvas/tickers/decorators/ticker-decorator.d.cts +1 -3
- package/dist/canvas/tickers/decorators/ticker-decorator.d.ts +1 -3
- package/dist/canvas/tickers/decorators/ticker-decorator.js +1 -1
- package/dist/canvas/tickers/index.cjs +1 -1
- package/dist/canvas/tickers/index.js +1 -1
- package/dist/character/decorators/character-decorator.cjs +1 -1
- package/dist/character/decorators/character-decorator.d.cts +1 -3
- package/dist/character/decorators/character-decorator.d.ts +1 -3
- package/dist/character/decorators/character-decorator.js +1 -1
- package/dist/character/index.cjs +1 -1
- package/dist/character/index.js +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.d.cts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/history/HistoryManager.cjs +1 -1
- package/dist/history/HistoryManager.d.cts +1 -1
- package/dist/history/HistoryManager.d.ts +1 -1
- package/dist/history/HistoryManager.js +1 -1
- package/dist/history/HistoryManagerStatic.d.cts +1 -1
- package/dist/history/HistoryManagerStatic.d.ts +1 -1
- package/dist/history/index.cjs +1 -1
- package/dist/history/index.d.cts +1 -1
- package/dist/history/index.d.ts +1 -1
- package/dist/history/index.js +1 -1
- package/dist/history/interfaces/HistoryGameState.d.cts +1 -1
- package/dist/history/interfaces/HistoryGameState.d.ts +1 -1
- package/dist/history/interfaces/HistoryManagerInterface.d.cts +1 -1
- package/dist/history/interfaces/HistoryManagerInterface.d.ts +1 -1
- package/dist/{index-Bo5b5ojv.d.cts → index-A4Zf-9mB.d.cts} +4 -4
- package/dist/{index-b75SF7z8.d.ts → index-DwELdyJt.d.ts} +4 -4
- package/dist/index.cjs +101 -101
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +101 -101
- package/dist/interfaces/GameState.d.cts +1 -1
- package/dist/interfaces/GameState.d.ts +1 -1
- package/dist/interfaces/index.d.cts +1 -1
- package/dist/interfaces/index.d.ts +1 -1
- package/dist/narration/NarrationManager.cjs +32 -32
- package/dist/narration/NarrationManager.d.cts +7 -7
- package/dist/narration/NarrationManager.d.ts +7 -7
- package/dist/narration/NarrationManager.js +32 -32
- package/dist/narration/NarrationManagerStatic.cjs +51 -51
- package/dist/narration/NarrationManagerStatic.d.cts +1 -1
- package/dist/narration/NarrationManagerStatic.d.ts +1 -1
- package/dist/narration/NarrationManagerStatic.js +51 -51
- package/dist/narration/classes/ChoiceMenuOption.cjs +1 -1
- package/dist/narration/classes/ChoiceMenuOption.js +1 -1
- package/dist/narration/classes/CloseLabel.cjs +1 -1
- package/dist/narration/classes/CloseLabel.d.cts +1 -1
- package/dist/narration/classes/CloseLabel.d.ts +1 -1
- package/dist/narration/classes/CloseLabel.js +1 -1
- package/dist/narration/classes/Label.cjs +1 -1
- package/dist/narration/classes/Label.js +1 -1
- package/dist/narration/classes/LabelAbstract.cjs +1 -1
- package/dist/narration/classes/LabelAbstract.d.cts +2 -6
- package/dist/narration/classes/LabelAbstract.d.ts +2 -6
- package/dist/narration/classes/LabelAbstract.js +1 -1
- package/dist/narration/decorators/label-decorator.cjs +1 -1
- package/dist/narration/decorators/label-decorator.d.cts +17 -28
- package/dist/narration/decorators/label-decorator.d.ts +17 -28
- package/dist/narration/decorators/label-decorator.js +1 -1
- package/dist/narration/decorators/newLabel.cjs +1 -0
- package/dist/narration/decorators/newLabel.d.cts +18 -0
- package/dist/narration/decorators/newLabel.d.ts +18 -0
- package/dist/narration/decorators/newLabel.js +1 -0
- package/dist/narration/index.cjs +49 -49
- package/dist/narration/index.d.cts +3 -2
- package/dist/narration/index.d.ts +3 -2
- package/dist/narration/index.js +49 -49
- package/dist/narration/interfaces/HistoryStep.d.cts +1 -1
- package/dist/narration/interfaces/HistoryStep.d.ts +1 -1
- package/dist/narration/interfaces/NarrationGameState.d.cts +1 -1
- package/dist/narration/interfaces/NarrationGameState.d.ts +1 -1
- package/dist/narration/interfaces/NarrationManagerInterface.d.cts +7 -7
- package/dist/narration/interfaces/NarrationManagerInterface.d.ts +7 -7
- package/dist/narration/types/ChoiceMenuOptionsType.d.cts +1 -1
- package/dist/narration/types/ChoiceMenuOptionsType.d.ts +1 -1
- package/dist/pixi-devtools/additionalPositionsProperties.cjs +1 -1
- package/dist/pixi-devtools/additionalPositionsProperties.js +1 -1
- package/dist/sound/SoundManager.cjs +48 -48
- package/dist/sound/SoundManager.js +48 -48
- package/dist/sound/index.cjs +48 -48
- package/dist/sound/index.js +48 -48
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var te=Object.create;var B=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var ne=Object.getPrototypeOf,ae=Object.prototype.hasOwnProperty;var oe=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var le=(n,e,a,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let u of ie(e))!ae.call(n,u)&&u!==a&&B(n,u,{get:()=>e[u],enumerable:!(s=re(e,u))||s.enumerable});return n};var se=(n,e,a)=>(a=n!=null?te(ne(n)):{},le(B(a,"default",{value:n,enumerable:true}),n));var q=oe((j,Y)=>{(function(n,e){var a=e(n);if(typeof define=="function"&&define.amd)define("DeepDiff",function(){return a});else if(typeof j=="object"||typeof navigator=="object"&&navigator.product.match(/ReactNative/i))Y.exports=a;else {var s=n.DeepDiff;a.noConflict=function(){return n.DeepDiff===a&&(n.DeepDiff=s),a},n.DeepDiff=a;}})(j,function(n){var e=["N","E","A","D"];function a(r,i){r.super_=i,r.prototype=Object.create(i.prototype,{constructor:{value:r,enumerable:false,writable:true,configurable:true}});}function s(r,i){Object.defineProperty(this,"kind",{value:r,enumerable:true}),i&&i.length&&Object.defineProperty(this,"path",{value:i,enumerable:true});}function u(r,i,t){u.super_.call(this,"E",r),Object.defineProperty(this,"lhs",{value:i,enumerable:true}),Object.defineProperty(this,"rhs",{value:t,enumerable:true});}a(u,s);function y(r,i){y.super_.call(this,"N",r),Object.defineProperty(this,"rhs",{value:i,enumerable:true});}a(y,s);function m(r,i){m.super_.call(this,"D",r),Object.defineProperty(this,"lhs",{value:i,enumerable:true});}a(m,s);function g(r,i,t){g.super_.call(this,"A",r),Object.defineProperty(this,"index",{value:i,enumerable:true}),Object.defineProperty(this,"item",{value:t,enumerable:true});}a(g,s);function w(r,i,t){var o=r.slice((i)+1||r.length);return r.length=i<0?r.length+i:i,r.push.apply(r,o),r}function v(r){var i=typeof r;return i!=="object"?i:r===Math?"math":r===null?"null":Array.isArray(r)?"array":Object.prototype.toString.call(r)==="[object Date]"?"date":typeof r.toString=="function"&&/^\/.*\//.test(r.toString())?"regexp":"object"}function T(r){var i=0;if(r.length===0)return i;for(var t=0;t<r.length;t++){var o=r.charCodeAt(t);i=(i<<5)-i+o,i=i&i;}return i}function H(r){var i=0,t=v(r);if(t==="array"){r.forEach(function(E){i+=H(E);});var o="[type: array, hash: "+i+"]";return i+T(o)}if(t==="object"){for(var l in r)if(r.hasOwnProperty(l)){var d="[ type: object, key: "+l+", value hash: "+H(r[l])+"]";i+=T(d);}return i}var p="[ type: "+t+" ; value: "+r+"]";return i+T(p)}function C(r,i,t,o,l,d,p,E){t=t||[],l=l||[],p=p||[];var S=l.slice(0);if(typeof d<"u"&&d!==null){if(o){if(typeof o=="function"&&o(S,d))return;if(typeof o=="object"){if(o.prefilter&&o.prefilter(S,d))return;if(o.normalize){var I=o.normalize(S,d,r,i);I&&(r=I[0],i=I[1]);}}}S.push(d);}v(r)==="regexp"&&v(i)==="regexp"&&(r=r.toString(),i=i.toString());var V=typeof r,ee=typeof i,h,N,c,O,F=V!=="undefined"||p&&p.length>0&&p[p.length-1].lhs&&Object.getOwnPropertyDescriptor(p[p.length-1].lhs,d),$=ee!=="undefined"||p&&p.length>0&&p[p.length-1].rhs&&Object.getOwnPropertyDescriptor(p[p.length-1].rhs,d);if(!F&&$)t.push(new y(S,i));else if(!$&&F)t.push(new m(S,r));else if(v(r)!==v(i))t.push(new u(S,r,i));else if(v(r)==="date"&&r-i!==0)t.push(new u(S,r,i));else if(V==="object"&&r!==null&&i!==null){for(h=p.length-1;h>-1;--h)if(p[h].lhs===r){O=true;break}if(O)r!==i&&t.push(new u(S,r,i));else {if(p.push({lhs:r,rhs:i}),Array.isArray(r)){for(E&&(r.sort(function(A,P){return H(A)-H(P)}),i.sort(function(A,P){return H(A)-H(P)})),h=i.length-1,N=r.length-1;h>N;)t.push(new g(S,h,new y(void 0,i[h--])));for(;N>h;)t.push(new g(S,N,new m(void 0,r[N--])));for(;h>=0;--h)C(r[h],i[h],t,o,S,h,p,E);}else {var J=Object.keys(r),k=Object.keys(i);for(h=0;h<J.length;++h)c=J[h],O=k.indexOf(c),O>=0?(C(r[c],i[c],t,o,S,c,p,E),k[O]=null):C(r[c],void 0,t,o,S,c,p,E);for(h=0;h<k.length;++h)c=k[h],c&&C(void 0,i[c],t,o,S,c,p,E);}p.length=p.length-1;}}else r!==i&&(V==="number"&&isNaN(r)&&isNaN(i)||t.push(new u(S,r,i)));}function M(r,i,t,o,l){var d=[];if(C(r,i,d,o,null,null,null,l),t)for(var p=0;p<d.length;++p)t(d[p]);return d}function U(r,i,t,o,l,d,p){return C(r,i,t,o,l,d,p,true)}function x(r,i,t,o){var l=o?function(p){p&&o.push(p);}:void 0,d=M(r,i,l,t);return o||(d.length?d:void 0)}function W(r,i,t,o){var l=o?function(p){p&&o.push(p);}:void 0,d=M(r,i,l,t,true);return o||(d.length?d:void 0)}function _(r,i,t){if(t.path&&t.path.length){var o=r[i],l,d=t.path.length-1;for(l=0;l<d;l++)o=o[t.path[l]];switch(t.kind){case "A":_(o[t.path[l]],t.index,t.item);break;case "D":delete o[t.path[l]];break;case "E":case "N":o[t.path[l]]=t.rhs;break}}else switch(t.kind){case "A":_(r[i],t.index,t.item);break;case "D":r=w(r,i);break;case "E":case "N":r[i]=t.rhs;break}return r}function z(r,i,t){if(typeof t>"u"&&i&&~e.indexOf(i.kind)&&(t=i),r&&t&&t.kind){for(var o=r,l=-1,d=t.path?t.path.length-1:0;++l<d;)typeof o[t.path[l]]>"u"&&(o[t.path[l]]=typeof t.path[l+1]<"u"&&typeof t.path[l+1]=="number"?[]:{}),o=o[t.path[l]];switch(t.kind){case "A":t.path&&typeof o[t.path[l]]>"u"&&(o[t.path[l]]=[]),_(t.path?o[t.path[l]]:o,t.index,t.item);break;case "D":delete o[t.path[l]];break;case "E":case "N":o[t.path[l]]=t.rhs;break}}}function L(r,i,t){if(t.path&&t.path.length){var o=r[i],l,d=t.path.length-1;for(l=0;l<d;l++)o=o[t.path[l]];switch(t.kind){case "A":L(o[t.path[l]],t.index,t.item);break;case "D":o[t.path[l]]=t.lhs;break;case "E":o[t.path[l]]=t.lhs;break;case "N":delete o[t.path[l]];break}}else switch(t.kind){case "A":L(r[i],t.index,t.item);break;case "D":r[i]=t.lhs;break;case "E":r[i]=t.lhs;break;case "N":r=w(r,i);break}return r}function X(r,i,t){if(r&&i&&t&&t.kind){var o=r,l,d;for(d=t.path.length-1,l=0;l<d;l++)typeof o[t.path[l]]>"u"&&(o[t.path[l]]={}),o=o[t.path[l]];switch(t.kind){case "A":L(o[t.path[l]],t.index,t.item);break;case "D":o[t.path[l]]=t.lhs;break;case "E":o[t.path[l]]=t.lhs;break;case "N":delete o[t.path[l]];break}}}function Z(r,i,t){if(r&&i){var o=function(l){(!t||t(r,i,l))&&z(r,i,l);};M(r,i,o);}}return Object.defineProperties(x,{diff:{value:x,enumerable:true},orderIndependentDiff:{value:W,enumerable:true},observableDiff:{value:M,enumerable:true},orderIndependentObservableDiff:{value:U,enumerable:true},orderIndepHash:{value:H,enumerable:true},applyDiff:{value:Z,enumerable:true},applyChange:{value:z,enumerable:true},revertChange:{value:X,enumerable:true},isConflict:{value:function(){return typeof $conflict<"u"},enumerable:true}}),x.DeepDiff=x,n&&(n.DeepDiff=x),x});});var Q=se(q());var f;(u=>(u.log=(y,...m)=>console.log(`[Pixi\u2019VN] ${y}`,...m),u.warn=(y,...m)=>console.warn(`[Pixi\u2019VN] ${y}`,...m),u.error=(y,...m)=>console.error(`[Pixi\u2019VN] ${y}`,...m),u.info=(y,...m)=>console.info(`[Pixi\u2019VN] ${y}`,...m)))(f||={});var D=class n{static init(e){n._getStepCounter=e.getStepCounter,n._setStepCounter=e.setStepCounter,n._getCurrentGameStepState=e.getCurrentGameStepState,n._restoreGameStepState=e.restoreGameStepState,n._getOpenedLabels=e.getOpenedLabels,e.onGoNextEnd&&(n._onGoNextEnd=e.onGoNextEnd),n._getVariable=e.getVariable,n._setVariable=e.setVariable,n._removeVariable=e.removeVariable,n._getFlag=e.getFlag,n._setFlag=e.setFlag,e.onLabelClosing&&(n._onLabelClosing=e.onLabelClosing),n._addHistoryItem=e.addHistoryItem,n._getCurrentStepsRunningNumber=e.getCurrentStepsRunningNumber;}static _getStepCounter=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static _setStepCounter=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get stepCounter(){return n._getStepCounter()}static set stepCounter(e){n._setStepCounter(e);}static _getCurrentGameStepState=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get currentGameStepState(){return n._getCurrentGameStepState()}static _restoreGameStepState=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get restoreGameStepState(){return n._restoreGameStepState}static _getOpenedLabels=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get openedLabels(){return n._getOpenedLabels()}static _onGoNextEnd=async()=>{};static get onGoNextEnd(){return n._onGoNextEnd}static _getVariable=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get getVariable(){return n._getVariable}static _setVariable=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get setVariable(){return n._setVariable}static _removeVariable=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get removeVariable(){return n._removeVariable}static _getFlag=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get getFlag(){return n._getFlag}static _setFlag=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get setFlag(){return n._setFlag}static _onLabelClosing=()=>{};static get onLabelClosing(){return n._onLabelClosing}static _addHistoryItem=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get addHistoryItem(){return n._addHistoryItem}static _getCurrentStepsRunningNumber=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get currentStepsRunningNumber(){return n._getCurrentStepsRunningNumber()}};function G(n){try{if(typeof n>"u")return n;let e=JSON.stringify(n);return JSON.parse(e)}catch(e){throw f.error("Error creating exportable element",n,e),new Error("[Pixi\u2019VN] Error creating exportable element")}}function K(n,e){let a=G(n);return e.length>1&&"type"in e[0]&&(e=e.reverse()),e.forEach(s=>{"type"in s?pe(a,s):ue(a,s);}),a}function pe(n,e){let a=n;e.path&&e.path.length>0?e.path.forEach((s,u)=>{if(e.path&&u===e.path.length-1)switch(e.type){case "CHANGE":case "REMOVE":a[s]=e.oldValue;break;case "CREATE":Array.isArray(a)&&typeof s=="number"?a.splice(s,1):delete a[s];break}else a=a[s];}):f.warn("No path found, skipping diff",e);}function ue(n,e){let a=n;e.path&&e.path.length>0?e.path.forEach((s,u)=>{if(e.path&&u===e.path.length-1){if(e.kind==="E"||e.kind==="D")a[s]=e.lhs;else if(e.kind==="N")Number.isInteger(s)?Array.isArray(a)&&a.splice(s,1):typeof s=="string"&&delete a[s];else if(e.kind==="A"){let y=e.index;e.item.kind==="N"?a[s].splice(y,1):e.item.kind==="E"||e.item.kind==="D"?a[s][y]=e.item.lhs:e.item.kind==="A"?f.warn("Nested array found, skipping diff",e):f.warn("No array found, skipping diff",e);}}else a=a[s];}):f.warn("No path found, skipping diff",e);}var b=class n{static _stepsHistory=[];static stepLimitSaved=20;static get lastHistoryStep(){return n._stepsHistory.length>0?n._stepsHistory[n._stepsHistory.length-1]:null}static _originalStepData=void 0;static get originalStepData(){return n._originalStepData?G(n._originalStepData):{path:"",storage:{},canvas:{elementAliasesOrder:[],elements:{},stage:{},tickers:{},tickersSteps:{},tickersOnPause:{},tickersToCompleteOnStepEnd:{tikersIds:[],stepAlias:[]}},sound:{soundAliasesOrder:[],soundsPlaying:{},playInStepIndex:{},filters:void 0},labelIndex:-1,openedLabels:[]}}static set originalStepData(e){n._originalStepData=G(e);}};var R=class{get stepsHistory(){return b._stepsHistory}internalRestoreOldGameState(e,a){if(e<=0||b._stepsHistory.length==0)return a;let s=b.lastHistoryStep;if(s?.diff)try{let u=K(a,s.diff);return D.stepCounter=s.index,b._stepsHistory.pop(),this.internalRestoreOldGameState(e-1,u)}catch(u){return f.error("Error applying diff",u),a}else return f.error("You can't go back, there is no step to go back"),a}async goBack(e,a=1){if(a<=0){f.warn("The parameter steps must be greater than 0");return}if(this.stepsHistory.length<=1){f.warn("You can't go back, there is no step to go back");return}let s=G(this.internalRestoreOldGameState(a,b.originalStepData));s?await D.restoreGameStepState(s,e):f.error("Error going back");}add(e={},a={}){let s=b.originalStepData,{ignoreSameStep:u}=a,y=D.currentGameStepState;if(!u&&this.isSameStep(s,y))return;let m=(0, Q.diff)(s,y);this.stepsHistory.push({...e,diff:m}),b.originalStepData=y;}get narrativeHistory(){let e=[];return this.stepsHistory.forEach(a=>{let s=a.dialoge,u=a.choices,y=a.inputValue;if(e.length>0&&e[e.length-1].choices&&!e[e.length-1].playerMadeChoice&&a.currentLabel){let m=e[e.length-1].choices;if(m){let g=false;a.choiceIndexMade!==void 0&&m.length>a.choiceIndexMade&&(m[a.choiceIndexMade].isResponse=true,g=true),e[e.length-1].playerMadeChoice=g,e[e.length-1].choices=m;}}if(y&&e.length>0&&(e[e.length-1].inputValue=y),s||u){let m=u?.map((g,w)=>{let v=false;return g.oneTime&&a.alreadyMadeChoices&&a.alreadyMadeChoices.includes(w)&&(v=true),{text:g.text,type:g.type,isResponse:false,hidden:v}});if(m&&m.every(g=>g.hidden)){let g=m.find(w=>w.hidden===false);g&&(g.hidden=false);}e.push({dialoge:s,playerMadeChoice:false,choices:m,stepIndex:a.index});}}),e}removeNarrativeHistory(e){e?this.stepsHistory.splice(0,e):b._stepsHistory=[];}get canGoBack(){return b._stepsHistory.length<=1?false:!!b.lastHistoryStep?.diff}blockGoBack(){D.currentStepsRunningNumber===0&&this.stepsHistory.length>1&&(this.stepsHistory[this.stepsHistory.length-1]={...this.stepsHistory[this.stepsHistory.length-1],diff:void 0});}isSameStep(e,a){if(e.openedLabels.length===a.openedLabels.length)try{let s=JSON.stringify(e.openedLabels),u=JSON.stringify(a.openedLabels);if(s===u&&e.path===a.path&&e.labelIndex===a.labelIndex)return !0}catch(s){return f.error("Error comparing opened labels",s),true}return false}clear(){b._stepsHistory=[],b._originalStepData=void 0;}get stepLimitSaved(){return b.stepLimitSaved}set stepLimitSaved(e){b.stepLimitSaved=e;}export(){let e=this.stepsHistory.length-this.stepLimitSaved;return {stepsHistory:this.stepsHistory.map((s,u)=>({diff:e>u?void 0:s.diff,...s})),originalStepData:b._originalStepData}}async restore(e){this.clear();try{e.hasOwnProperty("stepsHistory")?b._stepsHistory=e.stepsHistory:f.warn("Could not import stepsHistory data, so will be ignored"),e.hasOwnProperty("originalStepData")?b._originalStepData=e.originalStepData:f.warn("Could not import originalStepData data, so will be ignored");}catch(a){f.error("Error importing data",a);}}};
|
|
1
|
+
'use strict';var te=Object.create;var B=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var ne=Object.getPrototypeOf,ae=Object.prototype.hasOwnProperty;var oe=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var le=(n,e,a,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let u of ie(e))!ae.call(n,u)&&u!==a&&B(n,u,{get:()=>e[u],enumerable:!(s=re(e,u))||s.enumerable});return n};var se=(n,e,a)=>(a=n!=null?te(ne(n)):{},le(B(a,"default",{value:n,enumerable:true}),n));var q=oe((j,Y)=>{(function(n,e){var a=e(n);if(typeof define=="function"&&define.amd)define("DeepDiff",function(){return a});else if(typeof j=="object"||typeof navigator=="object"&&navigator.product.match(/ReactNative/i))Y.exports=a;else {var s=n.DeepDiff;a.noConflict=function(){return n.DeepDiff===a&&(n.DeepDiff=s),a},n.DeepDiff=a;}})(j,function(n){var e=["N","E","A","D"];function a(r,i){r.super_=i,r.prototype=Object.create(i.prototype,{constructor:{value:r,enumerable:false,writable:true,configurable:true}});}function s(r,i){Object.defineProperty(this,"kind",{value:r,enumerable:true}),i&&i.length&&Object.defineProperty(this,"path",{value:i,enumerable:true});}function u(r,i,t){u.super_.call(this,"E",r),Object.defineProperty(this,"lhs",{value:i,enumerable:true}),Object.defineProperty(this,"rhs",{value:t,enumerable:true});}a(u,s);function y(r,i){y.super_.call(this,"N",r),Object.defineProperty(this,"rhs",{value:i,enumerable:true});}a(y,s);function m(r,i){m.super_.call(this,"D",r),Object.defineProperty(this,"lhs",{value:i,enumerable:true});}a(m,s);function g(r,i,t){g.super_.call(this,"A",r),Object.defineProperty(this,"index",{value:i,enumerable:true}),Object.defineProperty(this,"item",{value:t,enumerable:true});}a(g,s);function w(r,i,t){var o=r.slice((i)+1||r.length);return r.length=i<0?r.length+i:i,r.push.apply(r,o),r}function D(r){var i=typeof r;return i!=="object"?i:r===Math?"math":r===null?"null":Array.isArray(r)?"array":Object.prototype.toString.call(r)==="[object Date]"?"date":typeof r.toString=="function"&&/^\/.*\//.test(r.toString())?"regexp":"object"}function T(r){var i=0;if(r.length===0)return i;for(var t=0;t<r.length;t++){var o=r.charCodeAt(t);i=(i<<5)-i+o,i=i&i;}return i}function H(r){var i=0,t=D(r);if(t==="array"){r.forEach(function(E){i+=H(E);});var o="[type: array, hash: "+i+"]";return i+T(o)}if(t==="object"){for(var l in r)if(r.hasOwnProperty(l)){var d="[ type: object, key: "+l+", value hash: "+H(r[l])+"]";i+=T(d);}return i}var p="[ type: "+t+" ; value: "+r+"]";return i+T(p)}function C(r,i,t,o,l,d,p,E){t=t||[],l=l||[],p=p||[];var S=l.slice(0);if(typeof d<"u"&&d!==null){if(o){if(typeof o=="function"&&o(S,d))return;if(typeof o=="object"){if(o.prefilter&&o.prefilter(S,d))return;if(o.normalize){var I=o.normalize(S,d,r,i);I&&(r=I[0],i=I[1]);}}}S.push(d);}D(r)==="regexp"&&D(i)==="regexp"&&(r=r.toString(),i=i.toString());var V=typeof r,ee=typeof i,h,N,c,O,F=V!=="undefined"||p&&p.length>0&&p[p.length-1].lhs&&Object.getOwnPropertyDescriptor(p[p.length-1].lhs,d),$=ee!=="undefined"||p&&p.length>0&&p[p.length-1].rhs&&Object.getOwnPropertyDescriptor(p[p.length-1].rhs,d);if(!F&&$)t.push(new y(S,i));else if(!$&&F)t.push(new m(S,r));else if(D(r)!==D(i))t.push(new u(S,r,i));else if(D(r)==="date"&&r-i!==0)t.push(new u(S,r,i));else if(V==="object"&&r!==null&&i!==null){for(h=p.length-1;h>-1;--h)if(p[h].lhs===r){O=true;break}if(O)r!==i&&t.push(new u(S,r,i));else {if(p.push({lhs:r,rhs:i}),Array.isArray(r)){for(E&&(r.sort(function(A,P){return H(A)-H(P)}),i.sort(function(A,P){return H(A)-H(P)})),h=i.length-1,N=r.length-1;h>N;)t.push(new g(S,h,new y(void 0,i[h--])));for(;N>h;)t.push(new g(S,N,new m(void 0,r[N--])));for(;h>=0;--h)C(r[h],i[h],t,o,S,h,p,E);}else {var J=Object.keys(r),k=Object.keys(i);for(h=0;h<J.length;++h)c=J[h],O=k.indexOf(c),O>=0?(C(r[c],i[c],t,o,S,c,p,E),k[O]=null):C(r[c],void 0,t,o,S,c,p,E);for(h=0;h<k.length;++h)c=k[h],c&&C(void 0,i[c],t,o,S,c,p,E);}p.length=p.length-1;}}else r!==i&&(V==="number"&&isNaN(r)&&isNaN(i)||t.push(new u(S,r,i)));}function M(r,i,t,o,l){var d=[];if(C(r,i,d,o,null,null,null,l),t)for(var p=0;p<d.length;++p)t(d[p]);return d}function U(r,i,t,o,l,d,p){return C(r,i,t,o,l,d,p,true)}function x(r,i,t,o){var l=o?function(p){p&&o.push(p);}:void 0,d=M(r,i,l,t);return o||(d.length?d:void 0)}function W(r,i,t,o){var l=o?function(p){p&&o.push(p);}:void 0,d=M(r,i,l,t,true);return o||(d.length?d:void 0)}function _(r,i,t){if(t.path&&t.path.length){var o=r[i],l,d=t.path.length-1;for(l=0;l<d;l++)o=o[t.path[l]];switch(t.kind){case "A":_(o[t.path[l]],t.index,t.item);break;case "D":delete o[t.path[l]];break;case "E":case "N":o[t.path[l]]=t.rhs;break}}else switch(t.kind){case "A":_(r[i],t.index,t.item);break;case "D":r=w(r,i);break;case "E":case "N":r[i]=t.rhs;break}return r}function z(r,i,t){if(typeof t>"u"&&i&&~e.indexOf(i.kind)&&(t=i),r&&t&&t.kind){for(var o=r,l=-1,d=t.path?t.path.length-1:0;++l<d;)typeof o[t.path[l]]>"u"&&(o[t.path[l]]=typeof t.path[l+1]<"u"&&typeof t.path[l+1]=="number"?[]:{}),o=o[t.path[l]];switch(t.kind){case "A":t.path&&typeof o[t.path[l]]>"u"&&(o[t.path[l]]=[]),_(t.path?o[t.path[l]]:o,t.index,t.item);break;case "D":delete o[t.path[l]];break;case "E":case "N":o[t.path[l]]=t.rhs;break}}}function L(r,i,t){if(t.path&&t.path.length){var o=r[i],l,d=t.path.length-1;for(l=0;l<d;l++)o=o[t.path[l]];switch(t.kind){case "A":L(o[t.path[l]],t.index,t.item);break;case "D":o[t.path[l]]=t.lhs;break;case "E":o[t.path[l]]=t.lhs;break;case "N":delete o[t.path[l]];break}}else switch(t.kind){case "A":L(r[i],t.index,t.item);break;case "D":r[i]=t.lhs;break;case "E":r[i]=t.lhs;break;case "N":r=w(r,i);break}return r}function X(r,i,t){if(r&&i&&t&&t.kind){var o=r,l,d;for(d=t.path.length-1,l=0;l<d;l++)typeof o[t.path[l]]>"u"&&(o[t.path[l]]={}),o=o[t.path[l]];switch(t.kind){case "A":L(o[t.path[l]],t.index,t.item);break;case "D":o[t.path[l]]=t.lhs;break;case "E":o[t.path[l]]=t.lhs;break;case "N":delete o[t.path[l]];break}}}function Z(r,i,t){if(r&&i){var o=function(l){(!t||t(r,i,l))&&z(r,i,l);};M(r,i,o);}}return Object.defineProperties(x,{diff:{value:x,enumerable:true},orderIndependentDiff:{value:W,enumerable:true},observableDiff:{value:M,enumerable:true},orderIndependentObservableDiff:{value:U,enumerable:true},orderIndepHash:{value:H,enumerable:true},applyDiff:{value:Z,enumerable:true},applyChange:{value:z,enumerable:true},revertChange:{value:X,enumerable:true},isConflict:{value:function(){return typeof $conflict<"u"},enumerable:true}}),x.DeepDiff=x,n&&(n.DeepDiff=x),x});});var Q=se(q());var f;(u=>(u.log=(y,...m)=>console.log(`[Pixi\u2019VN] ${y}`,...m),u.warn=(y,...m)=>console.warn(`[Pixi\u2019VN] ${y}`,...m),u.error=(y,...m)=>console.error(`[Pixi\u2019VN] ${y}`,...m),u.info=(y,...m)=>console.info(`[Pixi\u2019VN] ${y}`,...m)))(f||={});var G=class n{static init(e){n._getStepCounter=e.getStepCounter,n._setStepCounter=e.setStepCounter,n._getCurrentGameStepState=e.getCurrentGameStepState,n._restoreGameStepState=e.restoreGameStepState,n._getOpenedLabels=e.getOpenedLabels,e.onGoNextEnd&&(n._onGoNextEnd=e.onGoNextEnd),n._getVariable=e.getVariable,n._setVariable=e.setVariable,n._removeVariable=e.removeVariable,n._getFlag=e.getFlag,n._setFlag=e.setFlag,e.onLabelClosing&&(n._onLabelClosing=e.onLabelClosing),n._addHistoryItem=e.addHistoryItem,n._getCurrentStepsRunningNumber=e.getCurrentStepsRunningNumber;}static _getStepCounter=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static _setStepCounter=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get stepCounter(){return n._getStepCounter()}static set stepCounter(e){n._setStepCounter(e);}static _getCurrentGameStepState=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get currentGameStepState(){return n._getCurrentGameStepState()}static _restoreGameStepState=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get restoreGameStepState(){return n._restoreGameStepState}static _getOpenedLabels=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get openedLabels(){return n._getOpenedLabels()}static _onGoNextEnd=async()=>{};static get onGoNextEnd(){return n._onGoNextEnd}static _getVariable=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get getVariable(){return n._getVariable}static _setVariable=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get setVariable(){return n._setVariable}static _removeVariable=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get removeVariable(){return n._removeVariable}static _getFlag=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get getFlag(){return n._getFlag}static _setFlag=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get setFlag(){return n._setFlag}static _onLabelClosing=()=>{};static get onLabelClosing(){return n._onLabelClosing}static _addHistoryItem=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get addHistoryItem(){return n._addHistoryItem}static _getCurrentStepsRunningNumber=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get currentStepsRunningNumber(){return n._getCurrentStepsRunningNumber()}};function v(n){try{if(typeof n>"u")return n;let e=JSON.stringify(n);return JSON.parse(e)}catch(e){throw f.error("Error creating exportable element",n,e),new Error("[Pixi\u2019VN] Error creating exportable element")}}function K(n,e){let a=v(n);return e.length>1&&"type"in e[0]&&(e=e.reverse()),e.forEach(s=>{"type"in s?pe(a,s):ue(a,s);}),a}function pe(n,e){let a=n;e.path&&e.path.length>0?e.path.forEach((s,u)=>{if(e.path&&u===e.path.length-1)switch(e.type){case "CHANGE":case "REMOVE":a[s]=e.oldValue;break;case "CREATE":Array.isArray(a)&&typeof s=="number"?a.splice(s,1):delete a[s];break}else a=a[s];}):f.warn("No path found, skipping diff",e);}function ue(n,e){let a=n;e.path&&e.path.length>0?e.path.forEach((s,u)=>{if(e.path&&u===e.path.length-1){if(e.kind==="E"||e.kind==="D")a[s]=e.lhs;else if(e.kind==="N")Number.isInteger(s)?Array.isArray(a)&&a.splice(s,1):typeof s=="string"&&delete a[s];else if(e.kind==="A"){let y=e.index;e.item.kind==="N"?a[s].splice(y,1):e.item.kind==="E"||e.item.kind==="D"?a[s][y]=e.item.lhs:e.item.kind==="A"?f.warn("Nested array found, skipping diff",e):f.warn("No array found, skipping diff",e);}}else a=a[s];}):f.warn("No path found, skipping diff",e);}var b=class n{static _stepsHistory=[];static stepLimitSaved=20;static get lastHistoryStep(){return n._stepsHistory.length>0?n._stepsHistory[n._stepsHistory.length-1]:null}static _originalStepData=void 0;static get originalStepData(){return n._originalStepData?v(n._originalStepData):{path:"",storage:{},canvas:{elementAliasesOrder:[],elements:{},stage:{},tickers:{},tickersSteps:{},tickersOnPause:{},tickersToCompleteOnStepEnd:{tikersIds:[],stepAlias:[]}},sound:{soundAliasesOrder:[],soundsPlaying:{},playInStepIndex:{},filters:void 0},labelIndex:-1,openedLabels:[]}}static set originalStepData(e){n._originalStepData=v(e);}};var R=class{get stepsHistory(){return b._stepsHistory}internalRestoreOldGameState(e,a){if(e<=0||b._stepsHistory.length==0)return a;let s=b.lastHistoryStep;if(s?.diff)try{let u=K(a,s.diff);return G.stepCounter=s.index,b._stepsHistory.pop(),this.internalRestoreOldGameState(e-1,u)}catch(u){return f.error("Error applying diff",u),a}else return f.error("You can't go back, there is no step to go back"),a}async goBack(e,a=1){if(a<=0){f.warn("The parameter steps must be greater than 0");return}if(this.stepsHistory.length<=1){f.warn("You can't go back, there is no step to go back");return}let s=v(this.internalRestoreOldGameState(a,b.originalStepData));s?await G.restoreGameStepState(s,e):f.error("Error going back");}add(e={},a={}){let s=b.originalStepData,{ignoreSameStep:u}=a,y=G.currentGameStepState;if(!u&&this.isSameStep(s,y))return;let m=(0, Q.diff)(s,y);this.stepsHistory.push({...e,diff:m}),b.originalStepData=y;}get narrativeHistory(){let e=[];return this.stepsHistory.forEach(a=>{let s=a.dialoge,u=a.choices,y=a.inputValue;if(e.length>0&&e[e.length-1].choices&&!e[e.length-1].playerMadeChoice&&a.currentLabel){let m=e[e.length-1].choices;if(m){let g=false;a.choiceIndexMade!==void 0&&m.length>a.choiceIndexMade&&(m[a.choiceIndexMade].isResponse=true,g=true),e[e.length-1].playerMadeChoice=g,e[e.length-1].choices=m;}}if(y&&e.length>0&&(e[e.length-1].inputValue=y),s||u){let m=u?.map((g,w)=>{let D=false;return g.oneTime&&a.alreadyMadeChoices&&a.alreadyMadeChoices.includes(w)&&(D=true),{text:g.text,type:g.type,isResponse:false,hidden:D}});if(m&&m.every(g=>g.hidden)){let g=m.find(w=>w.hidden===false);g&&(g.hidden=false);}e.push({dialoge:s,playerMadeChoice:false,choices:m,stepIndex:a.index});}}),e}removeNarrativeHistory(e){e?this.stepsHistory.splice(0,e):b._stepsHistory=[];}get canGoBack(){return b._stepsHistory.length<=1?false:!!b.lastHistoryStep?.diff}blockGoBack(){G.currentStepsRunningNumber===0&&this.stepsHistory.length>1&&(this.stepsHistory[this.stepsHistory.length-1]={...this.stepsHistory[this.stepsHistory.length-1],diff:void 0});}isSameStep(e,a){if(e.openedLabels.length===a.openedLabels.length)try{let s=JSON.stringify(e.openedLabels),u=JSON.stringify(a.openedLabels);if(s===u&&e.path===a.path&&e.labelIndex===a.labelIndex)return !0}catch(s){return f.error("Error comparing opened labels",s),true}return false}clear(){b._stepsHistory=[],b._originalStepData=void 0;}get stepLimitSaved(){return b.stepLimitSaved}set stepLimitSaved(e){b.stepLimitSaved=e;}export(){let e=this.stepsHistory.length-this.stepLimitSaved,a=this.stepsHistory.map((s,u)=>({diff:e>u?void 0:s.diff,...s}));return {stepsHistory:v(a),originalStepData:v(b._originalStepData)}}async restore(e){this.clear();try{e.hasOwnProperty("stepsHistory")?b._stepsHistory=e.stepsHistory:f.warn("Could not import stepsHistory data, so will be ignored"),e.hasOwnProperty("originalStepData")?b._originalStepData=e.originalStepData:f.warn("Could not import originalStepData data, so will be ignored");}catch(a){f.error("Error importing data",a);}}};
|
|
2
2
|
module.exports=R;
|
|
@@ -14,8 +14,8 @@ import '../narration/types/LabelIdType.cjs';
|
|
|
14
14
|
import '../narration/types/LabelRunModeType.cjs';
|
|
15
15
|
import '../narration/classes/Label.cjs';
|
|
16
16
|
import '../narration/classes/LabelAbstract.cjs';
|
|
17
|
-
import '../narration/types/StepLabelType.cjs';
|
|
18
17
|
import '../narration/interfaces/LabelProps.cjs';
|
|
18
|
+
import '../narration/types/StepLabelType.cjs';
|
|
19
19
|
import '../narration/types/HistoryChoiceMenuOption.cjs';
|
|
20
20
|
|
|
21
21
|
/**
|
|
@@ -14,8 +14,8 @@ import '../narration/types/LabelIdType.js';
|
|
|
14
14
|
import '../narration/types/LabelRunModeType.js';
|
|
15
15
|
import '../narration/classes/Label.js';
|
|
16
16
|
import '../narration/classes/LabelAbstract.js';
|
|
17
|
-
import '../narration/types/StepLabelType.js';
|
|
18
17
|
import '../narration/interfaces/LabelProps.js';
|
|
18
|
+
import '../narration/types/StepLabelType.js';
|
|
19
19
|
import '../narration/types/HistoryChoiceMenuOption.js';
|
|
20
20
|
|
|
21
21
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var te=Object.create;var B=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var ne=Object.getPrototypeOf,ae=Object.prototype.hasOwnProperty;var oe=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var le=(n,e,a,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let u of ie(e))!ae.call(n,u)&&u!==a&&B(n,u,{get:()=>e[u],enumerable:!(s=re(e,u))||s.enumerable});return n};var se=(n,e,a)=>(a=n!=null?te(ne(n)):{},le(B(a,"default",{value:n,enumerable:true}),n));var q=oe((j,Y)=>{(function(n,e){var a=e(n);if(typeof define=="function"&&define.amd)define("DeepDiff",function(){return a});else if(typeof j=="object"||typeof navigator=="object"&&navigator.product.match(/ReactNative/i))Y.exports=a;else {var s=n.DeepDiff;a.noConflict=function(){return n.DeepDiff===a&&(n.DeepDiff=s),a},n.DeepDiff=a;}})(j,function(n){var e=["N","E","A","D"];function a(r,i){r.super_=i,r.prototype=Object.create(i.prototype,{constructor:{value:r,enumerable:false,writable:true,configurable:true}});}function s(r,i){Object.defineProperty(this,"kind",{value:r,enumerable:true}),i&&i.length&&Object.defineProperty(this,"path",{value:i,enumerable:true});}function u(r,i,t){u.super_.call(this,"E",r),Object.defineProperty(this,"lhs",{value:i,enumerable:true}),Object.defineProperty(this,"rhs",{value:t,enumerable:true});}a(u,s);function y(r,i){y.super_.call(this,"N",r),Object.defineProperty(this,"rhs",{value:i,enumerable:true});}a(y,s);function m(r,i){m.super_.call(this,"D",r),Object.defineProperty(this,"lhs",{value:i,enumerable:true});}a(m,s);function g(r,i,t){g.super_.call(this,"A",r),Object.defineProperty(this,"index",{value:i,enumerable:true}),Object.defineProperty(this,"item",{value:t,enumerable:true});}a(g,s);function w(r,i,t){var o=r.slice((i)+1||r.length);return r.length=i<0?r.length+i:i,r.push.apply(r,o),r}function v(r){var i=typeof r;return i!=="object"?i:r===Math?"math":r===null?"null":Array.isArray(r)?"array":Object.prototype.toString.call(r)==="[object Date]"?"date":typeof r.toString=="function"&&/^\/.*\//.test(r.toString())?"regexp":"object"}function T(r){var i=0;if(r.length===0)return i;for(var t=0;t<r.length;t++){var o=r.charCodeAt(t);i=(i<<5)-i+o,i=i&i;}return i}function H(r){var i=0,t=v(r);if(t==="array"){r.forEach(function(E){i+=H(E);});var o="[type: array, hash: "+i+"]";return i+T(o)}if(t==="object"){for(var l in r)if(r.hasOwnProperty(l)){var d="[ type: object, key: "+l+", value hash: "+H(r[l])+"]";i+=T(d);}return i}var p="[ type: "+t+" ; value: "+r+"]";return i+T(p)}function C(r,i,t,o,l,d,p,E){t=t||[],l=l||[],p=p||[];var S=l.slice(0);if(typeof d<"u"&&d!==null){if(o){if(typeof o=="function"&&o(S,d))return;if(typeof o=="object"){if(o.prefilter&&o.prefilter(S,d))return;if(o.normalize){var I=o.normalize(S,d,r,i);I&&(r=I[0],i=I[1]);}}}S.push(d);}v(r)==="regexp"&&v(i)==="regexp"&&(r=r.toString(),i=i.toString());var V=typeof r,ee=typeof i,h,N,c,O,F=V!=="undefined"||p&&p.length>0&&p[p.length-1].lhs&&Object.getOwnPropertyDescriptor(p[p.length-1].lhs,d),$=ee!=="undefined"||p&&p.length>0&&p[p.length-1].rhs&&Object.getOwnPropertyDescriptor(p[p.length-1].rhs,d);if(!F&&$)t.push(new y(S,i));else if(!$&&F)t.push(new m(S,r));else if(v(r)!==v(i))t.push(new u(S,r,i));else if(v(r)==="date"&&r-i!==0)t.push(new u(S,r,i));else if(V==="object"&&r!==null&&i!==null){for(h=p.length-1;h>-1;--h)if(p[h].lhs===r){O=true;break}if(O)r!==i&&t.push(new u(S,r,i));else {if(p.push({lhs:r,rhs:i}),Array.isArray(r)){for(E&&(r.sort(function(A,P){return H(A)-H(P)}),i.sort(function(A,P){return H(A)-H(P)})),h=i.length-1,N=r.length-1;h>N;)t.push(new g(S,h,new y(void 0,i[h--])));for(;N>h;)t.push(new g(S,N,new m(void 0,r[N--])));for(;h>=0;--h)C(r[h],i[h],t,o,S,h,p,E);}else {var J=Object.keys(r),k=Object.keys(i);for(h=0;h<J.length;++h)c=J[h],O=k.indexOf(c),O>=0?(C(r[c],i[c],t,o,S,c,p,E),k[O]=null):C(r[c],void 0,t,o,S,c,p,E);for(h=0;h<k.length;++h)c=k[h],c&&C(void 0,i[c],t,o,S,c,p,E);}p.length=p.length-1;}}else r!==i&&(V==="number"&&isNaN(r)&&isNaN(i)||t.push(new u(S,r,i)));}function M(r,i,t,o,l){var d=[];if(C(r,i,d,o,null,null,null,l),t)for(var p=0;p<d.length;++p)t(d[p]);return d}function U(r,i,t,o,l,d,p){return C(r,i,t,o,l,d,p,true)}function x(r,i,t,o){var l=o?function(p){p&&o.push(p);}:void 0,d=M(r,i,l,t);return o||(d.length?d:void 0)}function W(r,i,t,o){var l=o?function(p){p&&o.push(p);}:void 0,d=M(r,i,l,t,true);return o||(d.length?d:void 0)}function _(r,i,t){if(t.path&&t.path.length){var o=r[i],l,d=t.path.length-1;for(l=0;l<d;l++)o=o[t.path[l]];switch(t.kind){case "A":_(o[t.path[l]],t.index,t.item);break;case "D":delete o[t.path[l]];break;case "E":case "N":o[t.path[l]]=t.rhs;break}}else switch(t.kind){case "A":_(r[i],t.index,t.item);break;case "D":r=w(r,i);break;case "E":case "N":r[i]=t.rhs;break}return r}function z(r,i,t){if(typeof t>"u"&&i&&~e.indexOf(i.kind)&&(t=i),r&&t&&t.kind){for(var o=r,l=-1,d=t.path?t.path.length-1:0;++l<d;)typeof o[t.path[l]]>"u"&&(o[t.path[l]]=typeof t.path[l+1]<"u"&&typeof t.path[l+1]=="number"?[]:{}),o=o[t.path[l]];switch(t.kind){case "A":t.path&&typeof o[t.path[l]]>"u"&&(o[t.path[l]]=[]),_(t.path?o[t.path[l]]:o,t.index,t.item);break;case "D":delete o[t.path[l]];break;case "E":case "N":o[t.path[l]]=t.rhs;break}}}function L(r,i,t){if(t.path&&t.path.length){var o=r[i],l,d=t.path.length-1;for(l=0;l<d;l++)o=o[t.path[l]];switch(t.kind){case "A":L(o[t.path[l]],t.index,t.item);break;case "D":o[t.path[l]]=t.lhs;break;case "E":o[t.path[l]]=t.lhs;break;case "N":delete o[t.path[l]];break}}else switch(t.kind){case "A":L(r[i],t.index,t.item);break;case "D":r[i]=t.lhs;break;case "E":r[i]=t.lhs;break;case "N":r=w(r,i);break}return r}function X(r,i,t){if(r&&i&&t&&t.kind){var o=r,l,d;for(d=t.path.length-1,l=0;l<d;l++)typeof o[t.path[l]]>"u"&&(o[t.path[l]]={}),o=o[t.path[l]];switch(t.kind){case "A":L(o[t.path[l]],t.index,t.item);break;case "D":o[t.path[l]]=t.lhs;break;case "E":o[t.path[l]]=t.lhs;break;case "N":delete o[t.path[l]];break}}}function Z(r,i,t){if(r&&i){var o=function(l){(!t||t(r,i,l))&&z(r,i,l);};M(r,i,o);}}return Object.defineProperties(x,{diff:{value:x,enumerable:true},orderIndependentDiff:{value:W,enumerable:true},observableDiff:{value:M,enumerable:true},orderIndependentObservableDiff:{value:U,enumerable:true},orderIndepHash:{value:H,enumerable:true},applyDiff:{value:Z,enumerable:true},applyChange:{value:z,enumerable:true},revertChange:{value:X,enumerable:true},isConflict:{value:function(){return typeof $conflict<"u"},enumerable:true}}),x.DeepDiff=x,n&&(n.DeepDiff=x),x});});var Q=se(q());var f;(u=>(u.log=(y,...m)=>console.log(`[Pixi\u2019VN] ${y}`,...m),u.warn=(y,...m)=>console.warn(`[Pixi\u2019VN] ${y}`,...m),u.error=(y,...m)=>console.error(`[Pixi\u2019VN] ${y}`,...m),u.info=(y,...m)=>console.info(`[Pixi\u2019VN] ${y}`,...m)))(f||={});var D=class n{static init(e){n._getStepCounter=e.getStepCounter,n._setStepCounter=e.setStepCounter,n._getCurrentGameStepState=e.getCurrentGameStepState,n._restoreGameStepState=e.restoreGameStepState,n._getOpenedLabels=e.getOpenedLabels,e.onGoNextEnd&&(n._onGoNextEnd=e.onGoNextEnd),n._getVariable=e.getVariable,n._setVariable=e.setVariable,n._removeVariable=e.removeVariable,n._getFlag=e.getFlag,n._setFlag=e.setFlag,e.onLabelClosing&&(n._onLabelClosing=e.onLabelClosing),n._addHistoryItem=e.addHistoryItem,n._getCurrentStepsRunningNumber=e.getCurrentStepsRunningNumber;}static _getStepCounter=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static _setStepCounter=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get stepCounter(){return n._getStepCounter()}static set stepCounter(e){n._setStepCounter(e);}static _getCurrentGameStepState=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get currentGameStepState(){return n._getCurrentGameStepState()}static _restoreGameStepState=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get restoreGameStepState(){return n._restoreGameStepState}static _getOpenedLabels=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get openedLabels(){return n._getOpenedLabels()}static _onGoNextEnd=async()=>{};static get onGoNextEnd(){return n._onGoNextEnd}static _getVariable=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get getVariable(){return n._getVariable}static _setVariable=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get setVariable(){return n._setVariable}static _removeVariable=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get removeVariable(){return n._removeVariable}static _getFlag=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get getFlag(){return n._getFlag}static _setFlag=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get setFlag(){return n._setFlag}static _onLabelClosing=()=>{};static get onLabelClosing(){return n._onLabelClosing}static _addHistoryItem=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get addHistoryItem(){return n._addHistoryItem}static _getCurrentStepsRunningNumber=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get currentStepsRunningNumber(){return n._getCurrentStepsRunningNumber()}};function G(n){try{if(typeof n>"u")return n;let e=JSON.stringify(n);return JSON.parse(e)}catch(e){throw f.error("Error creating exportable element",n,e),new Error("[Pixi\u2019VN] Error creating exportable element")}}function K(n,e){let a=G(n);return e.length>1&&"type"in e[0]&&(e=e.reverse()),e.forEach(s=>{"type"in s?pe(a,s):ue(a,s);}),a}function pe(n,e){let a=n;e.path&&e.path.length>0?e.path.forEach((s,u)=>{if(e.path&&u===e.path.length-1)switch(e.type){case "CHANGE":case "REMOVE":a[s]=e.oldValue;break;case "CREATE":Array.isArray(a)&&typeof s=="number"?a.splice(s,1):delete a[s];break}else a=a[s];}):f.warn("No path found, skipping diff",e);}function ue(n,e){let a=n;e.path&&e.path.length>0?e.path.forEach((s,u)=>{if(e.path&&u===e.path.length-1){if(e.kind==="E"||e.kind==="D")a[s]=e.lhs;else if(e.kind==="N")Number.isInteger(s)?Array.isArray(a)&&a.splice(s,1):typeof s=="string"&&delete a[s];else if(e.kind==="A"){let y=e.index;e.item.kind==="N"?a[s].splice(y,1):e.item.kind==="E"||e.item.kind==="D"?a[s][y]=e.item.lhs:e.item.kind==="A"?f.warn("Nested array found, skipping diff",e):f.warn("No array found, skipping diff",e);}}else a=a[s];}):f.warn("No path found, skipping diff",e);}var b=class n{static _stepsHistory=[];static stepLimitSaved=20;static get lastHistoryStep(){return n._stepsHistory.length>0?n._stepsHistory[n._stepsHistory.length-1]:null}static _originalStepData=void 0;static get originalStepData(){return n._originalStepData?G(n._originalStepData):{path:"",storage:{},canvas:{elementAliasesOrder:[],elements:{},stage:{},tickers:{},tickersSteps:{},tickersOnPause:{},tickersToCompleteOnStepEnd:{tikersIds:[],stepAlias:[]}},sound:{soundAliasesOrder:[],soundsPlaying:{},playInStepIndex:{},filters:void 0},labelIndex:-1,openedLabels:[]}}static set originalStepData(e){n._originalStepData=G(e);}};var R=class{get stepsHistory(){return b._stepsHistory}internalRestoreOldGameState(e,a){if(e<=0||b._stepsHistory.length==0)return a;let s=b.lastHistoryStep;if(s?.diff)try{let u=K(a,s.diff);return D.stepCounter=s.index,b._stepsHistory.pop(),this.internalRestoreOldGameState(e-1,u)}catch(u){return f.error("Error applying diff",u),a}else return f.error("You can't go back, there is no step to go back"),a}async goBack(e,a=1){if(a<=0){f.warn("The parameter steps must be greater than 0");return}if(this.stepsHistory.length<=1){f.warn("You can't go back, there is no step to go back");return}let s=G(this.internalRestoreOldGameState(a,b.originalStepData));s?await D.restoreGameStepState(s,e):f.error("Error going back");}add(e={},a={}){let s=b.originalStepData,{ignoreSameStep:u}=a,y=D.currentGameStepState;if(!u&&this.isSameStep(s,y))return;let m=(0, Q.diff)(s,y);this.stepsHistory.push({...e,diff:m}),b.originalStepData=y;}get narrativeHistory(){let e=[];return this.stepsHistory.forEach(a=>{let s=a.dialoge,u=a.choices,y=a.inputValue;if(e.length>0&&e[e.length-1].choices&&!e[e.length-1].playerMadeChoice&&a.currentLabel){let m=e[e.length-1].choices;if(m){let g=false;a.choiceIndexMade!==void 0&&m.length>a.choiceIndexMade&&(m[a.choiceIndexMade].isResponse=true,g=true),e[e.length-1].playerMadeChoice=g,e[e.length-1].choices=m;}}if(y&&e.length>0&&(e[e.length-1].inputValue=y),s||u){let m=u?.map((g,w)=>{let v=false;return g.oneTime&&a.alreadyMadeChoices&&a.alreadyMadeChoices.includes(w)&&(v=true),{text:g.text,type:g.type,isResponse:false,hidden:v}});if(m&&m.every(g=>g.hidden)){let g=m.find(w=>w.hidden===false);g&&(g.hidden=false);}e.push({dialoge:s,playerMadeChoice:false,choices:m,stepIndex:a.index});}}),e}removeNarrativeHistory(e){e?this.stepsHistory.splice(0,e):b._stepsHistory=[];}get canGoBack(){return b._stepsHistory.length<=1?false:!!b.lastHistoryStep?.diff}blockGoBack(){D.currentStepsRunningNumber===0&&this.stepsHistory.length>1&&(this.stepsHistory[this.stepsHistory.length-1]={...this.stepsHistory[this.stepsHistory.length-1],diff:void 0});}isSameStep(e,a){if(e.openedLabels.length===a.openedLabels.length)try{let s=JSON.stringify(e.openedLabels),u=JSON.stringify(a.openedLabels);if(s===u&&e.path===a.path&&e.labelIndex===a.labelIndex)return !0}catch(s){return f.error("Error comparing opened labels",s),true}return false}clear(){b._stepsHistory=[],b._originalStepData=void 0;}get stepLimitSaved(){return b.stepLimitSaved}set stepLimitSaved(e){b.stepLimitSaved=e;}export(){let e=this.stepsHistory.length-this.stepLimitSaved;return {stepsHistory:this.stepsHistory.map((s,u)=>({diff:e>u?void 0:s.diff,...s})),originalStepData:b._originalStepData}}async restore(e){this.clear();try{e.hasOwnProperty("stepsHistory")?b._stepsHistory=e.stepsHistory:f.warn("Could not import stepsHistory data, so will be ignored"),e.hasOwnProperty("originalStepData")?b._originalStepData=e.originalStepData:f.warn("Could not import originalStepData data, so will be ignored");}catch(a){f.error("Error importing data",a);}}};
|
|
1
|
+
var te=Object.create;var B=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var ne=Object.getPrototypeOf,ae=Object.prototype.hasOwnProperty;var oe=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var le=(n,e,a,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let u of ie(e))!ae.call(n,u)&&u!==a&&B(n,u,{get:()=>e[u],enumerable:!(s=re(e,u))||s.enumerable});return n};var se=(n,e,a)=>(a=n!=null?te(ne(n)):{},le(B(a,"default",{value:n,enumerable:true}),n));var q=oe((j,Y)=>{(function(n,e){var a=e(n);if(typeof define=="function"&&define.amd)define("DeepDiff",function(){return a});else if(typeof j=="object"||typeof navigator=="object"&&navigator.product.match(/ReactNative/i))Y.exports=a;else {var s=n.DeepDiff;a.noConflict=function(){return n.DeepDiff===a&&(n.DeepDiff=s),a},n.DeepDiff=a;}})(j,function(n){var e=["N","E","A","D"];function a(r,i){r.super_=i,r.prototype=Object.create(i.prototype,{constructor:{value:r,enumerable:false,writable:true,configurable:true}});}function s(r,i){Object.defineProperty(this,"kind",{value:r,enumerable:true}),i&&i.length&&Object.defineProperty(this,"path",{value:i,enumerable:true});}function u(r,i,t){u.super_.call(this,"E",r),Object.defineProperty(this,"lhs",{value:i,enumerable:true}),Object.defineProperty(this,"rhs",{value:t,enumerable:true});}a(u,s);function y(r,i){y.super_.call(this,"N",r),Object.defineProperty(this,"rhs",{value:i,enumerable:true});}a(y,s);function m(r,i){m.super_.call(this,"D",r),Object.defineProperty(this,"lhs",{value:i,enumerable:true});}a(m,s);function g(r,i,t){g.super_.call(this,"A",r),Object.defineProperty(this,"index",{value:i,enumerable:true}),Object.defineProperty(this,"item",{value:t,enumerable:true});}a(g,s);function w(r,i,t){var o=r.slice((i)+1||r.length);return r.length=i<0?r.length+i:i,r.push.apply(r,o),r}function D(r){var i=typeof r;return i!=="object"?i:r===Math?"math":r===null?"null":Array.isArray(r)?"array":Object.prototype.toString.call(r)==="[object Date]"?"date":typeof r.toString=="function"&&/^\/.*\//.test(r.toString())?"regexp":"object"}function T(r){var i=0;if(r.length===0)return i;for(var t=0;t<r.length;t++){var o=r.charCodeAt(t);i=(i<<5)-i+o,i=i&i;}return i}function H(r){var i=0,t=D(r);if(t==="array"){r.forEach(function(E){i+=H(E);});var o="[type: array, hash: "+i+"]";return i+T(o)}if(t==="object"){for(var l in r)if(r.hasOwnProperty(l)){var d="[ type: object, key: "+l+", value hash: "+H(r[l])+"]";i+=T(d);}return i}var p="[ type: "+t+" ; value: "+r+"]";return i+T(p)}function C(r,i,t,o,l,d,p,E){t=t||[],l=l||[],p=p||[];var S=l.slice(0);if(typeof d<"u"&&d!==null){if(o){if(typeof o=="function"&&o(S,d))return;if(typeof o=="object"){if(o.prefilter&&o.prefilter(S,d))return;if(o.normalize){var I=o.normalize(S,d,r,i);I&&(r=I[0],i=I[1]);}}}S.push(d);}D(r)==="regexp"&&D(i)==="regexp"&&(r=r.toString(),i=i.toString());var V=typeof r,ee=typeof i,h,N,c,O,F=V!=="undefined"||p&&p.length>0&&p[p.length-1].lhs&&Object.getOwnPropertyDescriptor(p[p.length-1].lhs,d),$=ee!=="undefined"||p&&p.length>0&&p[p.length-1].rhs&&Object.getOwnPropertyDescriptor(p[p.length-1].rhs,d);if(!F&&$)t.push(new y(S,i));else if(!$&&F)t.push(new m(S,r));else if(D(r)!==D(i))t.push(new u(S,r,i));else if(D(r)==="date"&&r-i!==0)t.push(new u(S,r,i));else if(V==="object"&&r!==null&&i!==null){for(h=p.length-1;h>-1;--h)if(p[h].lhs===r){O=true;break}if(O)r!==i&&t.push(new u(S,r,i));else {if(p.push({lhs:r,rhs:i}),Array.isArray(r)){for(E&&(r.sort(function(A,P){return H(A)-H(P)}),i.sort(function(A,P){return H(A)-H(P)})),h=i.length-1,N=r.length-1;h>N;)t.push(new g(S,h,new y(void 0,i[h--])));for(;N>h;)t.push(new g(S,N,new m(void 0,r[N--])));for(;h>=0;--h)C(r[h],i[h],t,o,S,h,p,E);}else {var J=Object.keys(r),k=Object.keys(i);for(h=0;h<J.length;++h)c=J[h],O=k.indexOf(c),O>=0?(C(r[c],i[c],t,o,S,c,p,E),k[O]=null):C(r[c],void 0,t,o,S,c,p,E);for(h=0;h<k.length;++h)c=k[h],c&&C(void 0,i[c],t,o,S,c,p,E);}p.length=p.length-1;}}else r!==i&&(V==="number"&&isNaN(r)&&isNaN(i)||t.push(new u(S,r,i)));}function M(r,i,t,o,l){var d=[];if(C(r,i,d,o,null,null,null,l),t)for(var p=0;p<d.length;++p)t(d[p]);return d}function U(r,i,t,o,l,d,p){return C(r,i,t,o,l,d,p,true)}function x(r,i,t,o){var l=o?function(p){p&&o.push(p);}:void 0,d=M(r,i,l,t);return o||(d.length?d:void 0)}function W(r,i,t,o){var l=o?function(p){p&&o.push(p);}:void 0,d=M(r,i,l,t,true);return o||(d.length?d:void 0)}function _(r,i,t){if(t.path&&t.path.length){var o=r[i],l,d=t.path.length-1;for(l=0;l<d;l++)o=o[t.path[l]];switch(t.kind){case "A":_(o[t.path[l]],t.index,t.item);break;case "D":delete o[t.path[l]];break;case "E":case "N":o[t.path[l]]=t.rhs;break}}else switch(t.kind){case "A":_(r[i],t.index,t.item);break;case "D":r=w(r,i);break;case "E":case "N":r[i]=t.rhs;break}return r}function z(r,i,t){if(typeof t>"u"&&i&&~e.indexOf(i.kind)&&(t=i),r&&t&&t.kind){for(var o=r,l=-1,d=t.path?t.path.length-1:0;++l<d;)typeof o[t.path[l]]>"u"&&(o[t.path[l]]=typeof t.path[l+1]<"u"&&typeof t.path[l+1]=="number"?[]:{}),o=o[t.path[l]];switch(t.kind){case "A":t.path&&typeof o[t.path[l]]>"u"&&(o[t.path[l]]=[]),_(t.path?o[t.path[l]]:o,t.index,t.item);break;case "D":delete o[t.path[l]];break;case "E":case "N":o[t.path[l]]=t.rhs;break}}}function L(r,i,t){if(t.path&&t.path.length){var o=r[i],l,d=t.path.length-1;for(l=0;l<d;l++)o=o[t.path[l]];switch(t.kind){case "A":L(o[t.path[l]],t.index,t.item);break;case "D":o[t.path[l]]=t.lhs;break;case "E":o[t.path[l]]=t.lhs;break;case "N":delete o[t.path[l]];break}}else switch(t.kind){case "A":L(r[i],t.index,t.item);break;case "D":r[i]=t.lhs;break;case "E":r[i]=t.lhs;break;case "N":r=w(r,i);break}return r}function X(r,i,t){if(r&&i&&t&&t.kind){var o=r,l,d;for(d=t.path.length-1,l=0;l<d;l++)typeof o[t.path[l]]>"u"&&(o[t.path[l]]={}),o=o[t.path[l]];switch(t.kind){case "A":L(o[t.path[l]],t.index,t.item);break;case "D":o[t.path[l]]=t.lhs;break;case "E":o[t.path[l]]=t.lhs;break;case "N":delete o[t.path[l]];break}}}function Z(r,i,t){if(r&&i){var o=function(l){(!t||t(r,i,l))&&z(r,i,l);};M(r,i,o);}}return Object.defineProperties(x,{diff:{value:x,enumerable:true},orderIndependentDiff:{value:W,enumerable:true},observableDiff:{value:M,enumerable:true},orderIndependentObservableDiff:{value:U,enumerable:true},orderIndepHash:{value:H,enumerable:true},applyDiff:{value:Z,enumerable:true},applyChange:{value:z,enumerable:true},revertChange:{value:X,enumerable:true},isConflict:{value:function(){return typeof $conflict<"u"},enumerable:true}}),x.DeepDiff=x,n&&(n.DeepDiff=x),x});});var Q=se(q());var f;(u=>(u.log=(y,...m)=>console.log(`[Pixi\u2019VN] ${y}`,...m),u.warn=(y,...m)=>console.warn(`[Pixi\u2019VN] ${y}`,...m),u.error=(y,...m)=>console.error(`[Pixi\u2019VN] ${y}`,...m),u.info=(y,...m)=>console.info(`[Pixi\u2019VN] ${y}`,...m)))(f||={});var G=class n{static init(e){n._getStepCounter=e.getStepCounter,n._setStepCounter=e.setStepCounter,n._getCurrentGameStepState=e.getCurrentGameStepState,n._restoreGameStepState=e.restoreGameStepState,n._getOpenedLabels=e.getOpenedLabels,e.onGoNextEnd&&(n._onGoNextEnd=e.onGoNextEnd),n._getVariable=e.getVariable,n._setVariable=e.setVariable,n._removeVariable=e.removeVariable,n._getFlag=e.getFlag,n._setFlag=e.setFlag,e.onLabelClosing&&(n._onLabelClosing=e.onLabelClosing),n._addHistoryItem=e.addHistoryItem,n._getCurrentStepsRunningNumber=e.getCurrentStepsRunningNumber;}static _getStepCounter=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static _setStepCounter=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get stepCounter(){return n._getStepCounter()}static set stepCounter(e){n._setStepCounter(e);}static _getCurrentGameStepState=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get currentGameStepState(){return n._getCurrentGameStepState()}static _restoreGameStepState=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get restoreGameStepState(){return n._restoreGameStepState}static _getOpenedLabels=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get openedLabels(){return n._getOpenedLabels()}static _onGoNextEnd=async()=>{};static get onGoNextEnd(){return n._onGoNextEnd}static _getVariable=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get getVariable(){return n._getVariable}static _setVariable=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get setVariable(){return n._setVariable}static _removeVariable=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get removeVariable(){return n._removeVariable}static _getFlag=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get getFlag(){return n._getFlag}static _setFlag=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get setFlag(){return n._setFlag}static _onLabelClosing=()=>{};static get onLabelClosing(){return n._onLabelClosing}static _addHistoryItem=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get addHistoryItem(){return n._addHistoryItem}static _getCurrentStepsRunningNumber=()=>{throw f.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get currentStepsRunningNumber(){return n._getCurrentStepsRunningNumber()}};function v(n){try{if(typeof n>"u")return n;let e=JSON.stringify(n);return JSON.parse(e)}catch(e){throw f.error("Error creating exportable element",n,e),new Error("[Pixi\u2019VN] Error creating exportable element")}}function K(n,e){let a=v(n);return e.length>1&&"type"in e[0]&&(e=e.reverse()),e.forEach(s=>{"type"in s?pe(a,s):ue(a,s);}),a}function pe(n,e){let a=n;e.path&&e.path.length>0?e.path.forEach((s,u)=>{if(e.path&&u===e.path.length-1)switch(e.type){case "CHANGE":case "REMOVE":a[s]=e.oldValue;break;case "CREATE":Array.isArray(a)&&typeof s=="number"?a.splice(s,1):delete a[s];break}else a=a[s];}):f.warn("No path found, skipping diff",e);}function ue(n,e){let a=n;e.path&&e.path.length>0?e.path.forEach((s,u)=>{if(e.path&&u===e.path.length-1){if(e.kind==="E"||e.kind==="D")a[s]=e.lhs;else if(e.kind==="N")Number.isInteger(s)?Array.isArray(a)&&a.splice(s,1):typeof s=="string"&&delete a[s];else if(e.kind==="A"){let y=e.index;e.item.kind==="N"?a[s].splice(y,1):e.item.kind==="E"||e.item.kind==="D"?a[s][y]=e.item.lhs:e.item.kind==="A"?f.warn("Nested array found, skipping diff",e):f.warn("No array found, skipping diff",e);}}else a=a[s];}):f.warn("No path found, skipping diff",e);}var b=class n{static _stepsHistory=[];static stepLimitSaved=20;static get lastHistoryStep(){return n._stepsHistory.length>0?n._stepsHistory[n._stepsHistory.length-1]:null}static _originalStepData=void 0;static get originalStepData(){return n._originalStepData?v(n._originalStepData):{path:"",storage:{},canvas:{elementAliasesOrder:[],elements:{},stage:{},tickers:{},tickersSteps:{},tickersOnPause:{},tickersToCompleteOnStepEnd:{tikersIds:[],stepAlias:[]}},sound:{soundAliasesOrder:[],soundsPlaying:{},playInStepIndex:{},filters:void 0},labelIndex:-1,openedLabels:[]}}static set originalStepData(e){n._originalStepData=v(e);}};var R=class{get stepsHistory(){return b._stepsHistory}internalRestoreOldGameState(e,a){if(e<=0||b._stepsHistory.length==0)return a;let s=b.lastHistoryStep;if(s?.diff)try{let u=K(a,s.diff);return G.stepCounter=s.index,b._stepsHistory.pop(),this.internalRestoreOldGameState(e-1,u)}catch(u){return f.error("Error applying diff",u),a}else return f.error("You can't go back, there is no step to go back"),a}async goBack(e,a=1){if(a<=0){f.warn("The parameter steps must be greater than 0");return}if(this.stepsHistory.length<=1){f.warn("You can't go back, there is no step to go back");return}let s=v(this.internalRestoreOldGameState(a,b.originalStepData));s?await G.restoreGameStepState(s,e):f.error("Error going back");}add(e={},a={}){let s=b.originalStepData,{ignoreSameStep:u}=a,y=G.currentGameStepState;if(!u&&this.isSameStep(s,y))return;let m=(0, Q.diff)(s,y);this.stepsHistory.push({...e,diff:m}),b.originalStepData=y;}get narrativeHistory(){let e=[];return this.stepsHistory.forEach(a=>{let s=a.dialoge,u=a.choices,y=a.inputValue;if(e.length>0&&e[e.length-1].choices&&!e[e.length-1].playerMadeChoice&&a.currentLabel){let m=e[e.length-1].choices;if(m){let g=false;a.choiceIndexMade!==void 0&&m.length>a.choiceIndexMade&&(m[a.choiceIndexMade].isResponse=true,g=true),e[e.length-1].playerMadeChoice=g,e[e.length-1].choices=m;}}if(y&&e.length>0&&(e[e.length-1].inputValue=y),s||u){let m=u?.map((g,w)=>{let D=false;return g.oneTime&&a.alreadyMadeChoices&&a.alreadyMadeChoices.includes(w)&&(D=true),{text:g.text,type:g.type,isResponse:false,hidden:D}});if(m&&m.every(g=>g.hidden)){let g=m.find(w=>w.hidden===false);g&&(g.hidden=false);}e.push({dialoge:s,playerMadeChoice:false,choices:m,stepIndex:a.index});}}),e}removeNarrativeHistory(e){e?this.stepsHistory.splice(0,e):b._stepsHistory=[];}get canGoBack(){return b._stepsHistory.length<=1?false:!!b.lastHistoryStep?.diff}blockGoBack(){G.currentStepsRunningNumber===0&&this.stepsHistory.length>1&&(this.stepsHistory[this.stepsHistory.length-1]={...this.stepsHistory[this.stepsHistory.length-1],diff:void 0});}isSameStep(e,a){if(e.openedLabels.length===a.openedLabels.length)try{let s=JSON.stringify(e.openedLabels),u=JSON.stringify(a.openedLabels);if(s===u&&e.path===a.path&&e.labelIndex===a.labelIndex)return !0}catch(s){return f.error("Error comparing opened labels",s),true}return false}clear(){b._stepsHistory=[],b._originalStepData=void 0;}get stepLimitSaved(){return b.stepLimitSaved}set stepLimitSaved(e){b.stepLimitSaved=e;}export(){let e=this.stepsHistory.length-this.stepLimitSaved,a=this.stepsHistory.map((s,u)=>({diff:e>u?void 0:s.diff,...s}));return {stepsHistory:v(a),originalStepData:v(b._originalStepData)}}async restore(e){this.clear();try{e.hasOwnProperty("stepsHistory")?b._stepsHistory=e.stepsHistory:f.warn("Could not import stepsHistory data, so will be ignored"),e.hasOwnProperty("originalStepData")?b._originalStepData=e.originalStepData:f.warn("Could not import originalStepData data, so will be ignored");}catch(a){f.error("Error importing data",a);}}};
|
|
2
2
|
export{R as default};
|
|
@@ -9,8 +9,8 @@ import '../narration/types/LabelIdType.cjs';
|
|
|
9
9
|
import '../narration/types/LabelRunModeType.cjs';
|
|
10
10
|
import '../narration/classes/Label.cjs';
|
|
11
11
|
import '../narration/classes/LabelAbstract.cjs';
|
|
12
|
-
import '../narration/types/StepLabelType.cjs';
|
|
13
12
|
import '../narration/interfaces/LabelProps.cjs';
|
|
13
|
+
import '../narration/types/StepLabelType.cjs';
|
|
14
14
|
import '../narration/classes/Dialogue.cjs';
|
|
15
15
|
|
|
16
16
|
declare class HistoryManagerStatic {
|
|
@@ -9,8 +9,8 @@ import '../narration/types/LabelIdType.js';
|
|
|
9
9
|
import '../narration/types/LabelRunModeType.js';
|
|
10
10
|
import '../narration/classes/Label.js';
|
|
11
11
|
import '../narration/classes/LabelAbstract.js';
|
|
12
|
-
import '../narration/types/StepLabelType.js';
|
|
13
12
|
import '../narration/interfaces/LabelProps.js';
|
|
13
|
+
import '../narration/types/StepLabelType.js';
|
|
14
14
|
import '../narration/classes/Dialogue.js';
|
|
15
15
|
|
|
16
16
|
declare class HistoryManagerStatic {
|
package/dist/history/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var te=Object.create;var B=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var ne=Object.getPrototypeOf,ae=Object.prototype.hasOwnProperty;var oe=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var se=(n,e,a,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let u of ie(e))!ae.call(n,u)&&u!==a&&B(n,u,{get:()=>e[u],enumerable:!(l=re(e,u))||l.enumerable});return n};var le=(n,e,a)=>(a=n!=null?te(ne(n)):{},se(B(a,"default",{value:n,enumerable:true}),n));var q=oe((R,Y)=>{(function(n,e){var a=e(n);if(typeof define=="function"&&define.amd)define("DeepDiff",function(){return a});else if(typeof R=="object"||typeof navigator=="object"&&navigator.product.match(/ReactNative/i))Y.exports=a;else {var l=n.DeepDiff;a.noConflict=function(){return n.DeepDiff===a&&(n.DeepDiff=l),a},n.DeepDiff=a;}})(R,function(n){var e=["N","E","A","D"];function a(r,i){r.super_=i,r.prototype=Object.create(i.prototype,{constructor:{value:r,enumerable:false,writable:true,configurable:true}});}function l(r,i){Object.defineProperty(this,"kind",{value:r,enumerable:true}),i&&i.length&&Object.defineProperty(this,"path",{value:i,enumerable:true});}function u(r,i,t){u.super_.call(this,"E",r),Object.defineProperty(this,"lhs",{value:i,enumerable:true}),Object.defineProperty(this,"rhs",{value:t,enumerable:true});}a(u,l);function y(r,i){y.super_.call(this,"N",r),Object.defineProperty(this,"rhs",{value:i,enumerable:true});}a(y,l);function m(r,i){m.super_.call(this,"D",r),Object.defineProperty(this,"lhs",{value:i,enumerable:true});}a(m,l);function g(r,i,t){g.super_.call(this,"A",r),Object.defineProperty(this,"index",{value:i,enumerable:true}),Object.defineProperty(this,"item",{value:t,enumerable:true});}a(g,l);function w(r,i,t){var o=r.slice((i)+1||r.length);return r.length=i<0?r.length+i:i,r.push.apply(r,o),r}function v(r){var i=typeof r;return i!=="object"?i:r===Math?"math":r===null?"null":Array.isArray(r)?"array":Object.prototype.toString.call(r)==="[object Date]"?"date":typeof r.toString=="function"&&/^\/.*\//.test(r.toString())?"regexp":"object"}function I(r){var i=0;if(r.length===0)return i;for(var t=0;t<r.length;t++){var o=r.charCodeAt(t);i=(i<<5)-i+o,i=i&i;}return i}function G(r){var i=0,t=v(r);if(t==="array"){r.forEach(function(E){i+=G(E);});var o="[type: array, hash: "+i+"]";return i+I(o)}if(t==="object"){for(var s in r)if(r.hasOwnProperty(s)){var f="[ type: object, key: "+s+", value hash: "+G(r[s])+"]";i+=I(f);}return i}var p="[ type: "+t+" ; value: "+r+"]";return i+I(p)}function x(r,i,t,o,s,f,p,E){t=t||[],s=s||[],p=p||[];var S=s.slice(0);if(typeof f<"u"&&f!==null){if(o){if(typeof o=="function"&&o(S,f))return;if(typeof o=="object"){if(o.prefilter&&o.prefilter(S,f))return;if(o.normalize){var V=o.normalize(S,f,r,i);V&&(r=V[0],i=V[1]);}}}S.push(f);}v(r)==="regexp"&&v(i)==="regexp"&&(r=r.toString(),i=i.toString());var A=typeof r,ee=typeof i,h,N,c,O,F=A!=="undefined"||p&&p.length>0&&p[p.length-1].lhs&&Object.getOwnPropertyDescriptor(p[p.length-1].lhs,f),$=ee!=="undefined"||p&&p.length>0&&p[p.length-1].rhs&&Object.getOwnPropertyDescriptor(p[p.length-1].rhs,f);if(!F&&$)t.push(new y(S,i));else if(!$&&F)t.push(new m(S,r));else if(v(r)!==v(i))t.push(new u(S,r,i));else if(v(r)==="date"&&r-i!==0)t.push(new u(S,r,i));else if(A==="object"&&r!==null&&i!==null){for(h=p.length-1;h>-1;--h)if(p[h].lhs===r){O=true;break}if(O)r!==i&&t.push(new u(S,r,i));else {if(p.push({lhs:r,rhs:i}),Array.isArray(r)){for(E&&(r.sort(function(P,j){return G(P)-G(j)}),i.sort(function(P,j){return G(P)-G(j)})),h=i.length-1,N=r.length-1;h>N;)t.push(new g(S,h,new y(void 0,i[h--])));for(;N>h;)t.push(new g(S,N,new m(void 0,r[N--])));for(;h>=0;--h)x(r[h],i[h],t,o,S,h,p,E);}else {var J=Object.keys(r),T=Object.keys(i);for(h=0;h<J.length;++h)c=J[h],O=T.indexOf(c),O>=0?(x(r[c],i[c],t,o,S,c,p,E),T[O]=null):x(r[c],void 0,t,o,S,c,p,E);for(h=0;h<T.length;++h)c=T[h],c&&x(void 0,i[c],t,o,S,c,p,E);}p.length=p.length-1;}}else r!==i&&(A==="number"&&isNaN(r)&&isNaN(i)||t.push(new u(S,r,i)));}function k(r,i,t,o,s){var f=[];if(x(r,i,f,o,null,null,null,s),t)for(var p=0;p<f.length;++p)t(f[p]);return f}function U(r,i,t,o,s,f,p){return x(r,i,t,o,s,f,p,true)}function C(r,i,t,o){var s=o?function(p){p&&o.push(p);}:void 0,f=k(r,i,s,t);return o||(f.length?f:void 0)}function W(r,i,t,o){var s=o?function(p){p&&o.push(p);}:void 0,f=k(r,i,s,t,true);return o||(f.length?f:void 0)}function _(r,i,t){if(t.path&&t.path.length){var o=r[i],s,f=t.path.length-1;for(s=0;s<f;s++)o=o[t.path[s]];switch(t.kind){case "A":_(o[t.path[s]],t.index,t.item);break;case "D":delete o[t.path[s]];break;case "E":case "N":o[t.path[s]]=t.rhs;break}}else switch(t.kind){case "A":_(r[i],t.index,t.item);break;case "D":r=w(r,i);break;case "E":case "N":r[i]=t.rhs;break}return r}function z(r,i,t){if(typeof t>"u"&&i&&~e.indexOf(i.kind)&&(t=i),r&&t&&t.kind){for(var o=r,s=-1,f=t.path?t.path.length-1:0;++s<f;)typeof o[t.path[s]]>"u"&&(o[t.path[s]]=typeof t.path[s+1]<"u"&&typeof t.path[s+1]=="number"?[]:{}),o=o[t.path[s]];switch(t.kind){case "A":t.path&&typeof o[t.path[s]]>"u"&&(o[t.path[s]]=[]),_(t.path?o[t.path[s]]:o,t.index,t.item);break;case "D":delete o[t.path[s]];break;case "E":case "N":o[t.path[s]]=t.rhs;break}}}function L(r,i,t){if(t.path&&t.path.length){var o=r[i],s,f=t.path.length-1;for(s=0;s<f;s++)o=o[t.path[s]];switch(t.kind){case "A":L(o[t.path[s]],t.index,t.item);break;case "D":o[t.path[s]]=t.lhs;break;case "E":o[t.path[s]]=t.lhs;break;case "N":delete o[t.path[s]];break}}else switch(t.kind){case "A":L(r[i],t.index,t.item);break;case "D":r[i]=t.lhs;break;case "E":r[i]=t.lhs;break;case "N":r=w(r,i);break}return r}function X(r,i,t){if(r&&i&&t&&t.kind){var o=r,s,f;for(f=t.path.length-1,s=0;s<f;s++)typeof o[t.path[s]]>"u"&&(o[t.path[s]]={}),o=o[t.path[s]];switch(t.kind){case "A":L(o[t.path[s]],t.index,t.item);break;case "D":o[t.path[s]]=t.lhs;break;case "E":o[t.path[s]]=t.lhs;break;case "N":delete o[t.path[s]];break}}}function Z(r,i,t){if(r&&i){var o=function(s){(!t||t(r,i,s))&&z(r,i,s);};k(r,i,o);}}return Object.defineProperties(C,{diff:{value:C,enumerable:true},orderIndependentDiff:{value:W,enumerable:true},observableDiff:{value:k,enumerable:true},orderIndependentObservableDiff:{value:U,enumerable:true},orderIndepHash:{value:G,enumerable:true},applyDiff:{value:Z,enumerable:true},applyChange:{value:z,enumerable:true},revertChange:{value:X,enumerable:true},isConflict:{value:function(){return typeof $conflict<"u"},enumerable:true}}),C.DeepDiff=C,n&&(n.DeepDiff=C),C});});var Q=le(q());var d;(u=>(u.log=(y,...m)=>console.log(`[Pixi\u2019VN] ${y}`,...m),u.warn=(y,...m)=>console.warn(`[Pixi\u2019VN] ${y}`,...m),u.error=(y,...m)=>console.error(`[Pixi\u2019VN] ${y}`,...m),u.info=(y,...m)=>console.info(`[Pixi\u2019VN] ${y}`,...m)))(d||={});var D=class n{static init(e){n._getStepCounter=e.getStepCounter,n._setStepCounter=e.setStepCounter,n._getCurrentGameStepState=e.getCurrentGameStepState,n._restoreGameStepState=e.restoreGameStepState,n._getOpenedLabels=e.getOpenedLabels,e.onGoNextEnd&&(n._onGoNextEnd=e.onGoNextEnd),n._getVariable=e.getVariable,n._setVariable=e.setVariable,n._removeVariable=e.removeVariable,n._getFlag=e.getFlag,n._setFlag=e.setFlag,e.onLabelClosing&&(n._onLabelClosing=e.onLabelClosing),n._addHistoryItem=e.addHistoryItem,n._getCurrentStepsRunningNumber=e.getCurrentStepsRunningNumber;}static _getStepCounter=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static _setStepCounter=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get stepCounter(){return n._getStepCounter()}static set stepCounter(e){n._setStepCounter(e);}static _getCurrentGameStepState=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get currentGameStepState(){return n._getCurrentGameStepState()}static _restoreGameStepState=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get restoreGameStepState(){return n._restoreGameStepState}static _getOpenedLabels=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get openedLabels(){return n._getOpenedLabels()}static _onGoNextEnd=async()=>{};static get onGoNextEnd(){return n._onGoNextEnd}static _getVariable=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get getVariable(){return n._getVariable}static _setVariable=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get setVariable(){return n._setVariable}static _removeVariable=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get removeVariable(){return n._removeVariable}static _getFlag=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get getFlag(){return n._getFlag}static _setFlag=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get setFlag(){return n._setFlag}static _onLabelClosing=()=>{};static get onLabelClosing(){return n._onLabelClosing}static _addHistoryItem=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get addHistoryItem(){return n._addHistoryItem}static _getCurrentStepsRunningNumber=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get currentStepsRunningNumber(){return n._getCurrentStepsRunningNumber()}};function H(n){try{if(typeof n>"u")return n;let e=JSON.stringify(n);return JSON.parse(e)}catch(e){throw d.error("Error creating exportable element",n,e),new Error("[Pixi\u2019VN] Error creating exportable element")}}function K(n,e){let a=H(n);return e.length>1&&"type"in e[0]&&(e=e.reverse()),e.forEach(l=>{"type"in l?pe(a,l):ue(a,l);}),a}function pe(n,e){let a=n;e.path&&e.path.length>0?e.path.forEach((l,u)=>{if(e.path&&u===e.path.length-1)switch(e.type){case "CHANGE":case "REMOVE":a[l]=e.oldValue;break;case "CREATE":Array.isArray(a)&&typeof l=="number"?a.splice(l,1):delete a[l];break}else a=a[l];}):d.warn("No path found, skipping diff",e);}function ue(n,e){let a=n;e.path&&e.path.length>0?e.path.forEach((l,u)=>{if(e.path&&u===e.path.length-1){if(e.kind==="E"||e.kind==="D")a[l]=e.lhs;else if(e.kind==="N")Number.isInteger(l)?Array.isArray(a)&&a.splice(l,1):typeof l=="string"&&delete a[l];else if(e.kind==="A"){let y=e.index;e.item.kind==="N"?a[l].splice(y,1):e.item.kind==="E"||e.item.kind==="D"?a[l][y]=e.item.lhs:e.item.kind==="A"?d.warn("Nested array found, skipping diff",e):d.warn("No array found, skipping diff",e);}}else a=a[l];}):d.warn("No path found, skipping diff",e);}var b=class n{static _stepsHistory=[];static stepLimitSaved=20;static get lastHistoryStep(){return n._stepsHistory.length>0?n._stepsHistory[n._stepsHistory.length-1]:null}static _originalStepData=void 0;static get originalStepData(){return n._originalStepData?H(n._originalStepData):{path:"",storage:{},canvas:{elementAliasesOrder:[],elements:{},stage:{},tickers:{},tickersSteps:{},tickersOnPause:{},tickersToCompleteOnStepEnd:{tikersIds:[],stepAlias:[]}},sound:{soundAliasesOrder:[],soundsPlaying:{},playInStepIndex:{},filters:void 0},labelIndex:-1,openedLabels:[]}}static set originalStepData(e){n._originalStepData=H(e);}};var M=class{get stepsHistory(){return b._stepsHistory}internalRestoreOldGameState(e,a){if(e<=0||b._stepsHistory.length==0)return a;let l=b.lastHistoryStep;if(l?.diff)try{let u=K(a,l.diff);return D.stepCounter=l.index,b._stepsHistory.pop(),this.internalRestoreOldGameState(e-1,u)}catch(u){return d.error("Error applying diff",u),a}else return d.error("You can't go back, there is no step to go back"),a}async goBack(e,a=1){if(a<=0){d.warn("The parameter steps must be greater than 0");return}if(this.stepsHistory.length<=1){d.warn("You can't go back, there is no step to go back");return}let l=H(this.internalRestoreOldGameState(a,b.originalStepData));l?await D.restoreGameStepState(l,e):d.error("Error going back");}add(e={},a={}){let l=b.originalStepData,{ignoreSameStep:u}=a,y=D.currentGameStepState;if(!u&&this.isSameStep(l,y))return;let m=(0, Q.diff)(l,y);this.stepsHistory.push({...e,diff:m}),b.originalStepData=y;}get narrativeHistory(){let e=[];return this.stepsHistory.forEach(a=>{let l=a.dialoge,u=a.choices,y=a.inputValue;if(e.length>0&&e[e.length-1].choices&&!e[e.length-1].playerMadeChoice&&a.currentLabel){let m=e[e.length-1].choices;if(m){let g=false;a.choiceIndexMade!==void 0&&m.length>a.choiceIndexMade&&(m[a.choiceIndexMade].isResponse=true,g=true),e[e.length-1].playerMadeChoice=g,e[e.length-1].choices=m;}}if(y&&e.length>0&&(e[e.length-1].inputValue=y),l||u){let m=u?.map((g,w)=>{let v=false;return g.oneTime&&a.alreadyMadeChoices&&a.alreadyMadeChoices.includes(w)&&(v=true),{text:g.text,type:g.type,isResponse:false,hidden:v}});if(m&&m.every(g=>g.hidden)){let g=m.find(w=>w.hidden===false);g&&(g.hidden=false);}e.push({dialoge:l,playerMadeChoice:false,choices:m,stepIndex:a.index});}}),e}removeNarrativeHistory(e){e?this.stepsHistory.splice(0,e):b._stepsHistory=[];}get canGoBack(){return b._stepsHistory.length<=1?false:!!b.lastHistoryStep?.diff}blockGoBack(){D.currentStepsRunningNumber===0&&this.stepsHistory.length>1&&(this.stepsHistory[this.stepsHistory.length-1]={...this.stepsHistory[this.stepsHistory.length-1],diff:void 0});}isSameStep(e,a){if(e.openedLabels.length===a.openedLabels.length)try{let l=JSON.stringify(e.openedLabels),u=JSON.stringify(a.openedLabels);if(l===u&&e.path===a.path&&e.labelIndex===a.labelIndex)return !0}catch(l){return d.error("Error comparing opened labels",l),true}return false}clear(){b._stepsHistory=[],b._originalStepData=void 0;}get stepLimitSaved(){return b.stepLimitSaved}set stepLimitSaved(e){b.stepLimitSaved=e;}export(){let e=this.stepsHistory.length-this.stepLimitSaved;return {stepsHistory:this.stepsHistory.map((l,u)=>({diff:e>u?void 0:l.diff,...l})),originalStepData:b._originalStepData}}async restore(e){this.clear();try{e.hasOwnProperty("stepsHistory")?b._stepsHistory=e.stepsHistory:d.warn("Could not import stepsHistory data, so will be ignored"),e.hasOwnProperty("originalStepData")?b._originalStepData=e.originalStepData:d.warn("Could not import originalStepData data, so will be ignored");}catch(a){d.error("Error importing data",a);}}};var ke=new M;
|
|
1
|
+
'use strict';var te=Object.create;var B=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var ne=Object.getPrototypeOf,ae=Object.prototype.hasOwnProperty;var oe=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var se=(n,e,a,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let u of ie(e))!ae.call(n,u)&&u!==a&&B(n,u,{get:()=>e[u],enumerable:!(l=re(e,u))||l.enumerable});return n};var le=(n,e,a)=>(a=n!=null?te(ne(n)):{},se(B(a,"default",{value:n,enumerable:true}),n));var q=oe((R,Y)=>{(function(n,e){var a=e(n);if(typeof define=="function"&&define.amd)define("DeepDiff",function(){return a});else if(typeof R=="object"||typeof navigator=="object"&&navigator.product.match(/ReactNative/i))Y.exports=a;else {var l=n.DeepDiff;a.noConflict=function(){return n.DeepDiff===a&&(n.DeepDiff=l),a},n.DeepDiff=a;}})(R,function(n){var e=["N","E","A","D"];function a(r,i){r.super_=i,r.prototype=Object.create(i.prototype,{constructor:{value:r,enumerable:false,writable:true,configurable:true}});}function l(r,i){Object.defineProperty(this,"kind",{value:r,enumerable:true}),i&&i.length&&Object.defineProperty(this,"path",{value:i,enumerable:true});}function u(r,i,t){u.super_.call(this,"E",r),Object.defineProperty(this,"lhs",{value:i,enumerable:true}),Object.defineProperty(this,"rhs",{value:t,enumerable:true});}a(u,l);function y(r,i){y.super_.call(this,"N",r),Object.defineProperty(this,"rhs",{value:i,enumerable:true});}a(y,l);function m(r,i){m.super_.call(this,"D",r),Object.defineProperty(this,"lhs",{value:i,enumerable:true});}a(m,l);function g(r,i,t){g.super_.call(this,"A",r),Object.defineProperty(this,"index",{value:i,enumerable:true}),Object.defineProperty(this,"item",{value:t,enumerable:true});}a(g,l);function w(r,i,t){var o=r.slice((i)+1||r.length);return r.length=i<0?r.length+i:i,r.push.apply(r,o),r}function D(r){var i=typeof r;return i!=="object"?i:r===Math?"math":r===null?"null":Array.isArray(r)?"array":Object.prototype.toString.call(r)==="[object Date]"?"date":typeof r.toString=="function"&&/^\/.*\//.test(r.toString())?"regexp":"object"}function I(r){var i=0;if(r.length===0)return i;for(var t=0;t<r.length;t++){var o=r.charCodeAt(t);i=(i<<5)-i+o,i=i&i;}return i}function G(r){var i=0,t=D(r);if(t==="array"){r.forEach(function(E){i+=G(E);});var o="[type: array, hash: "+i+"]";return i+I(o)}if(t==="object"){for(var s in r)if(r.hasOwnProperty(s)){var f="[ type: object, key: "+s+", value hash: "+G(r[s])+"]";i+=I(f);}return i}var p="[ type: "+t+" ; value: "+r+"]";return i+I(p)}function x(r,i,t,o,s,f,p,E){t=t||[],s=s||[],p=p||[];var S=s.slice(0);if(typeof f<"u"&&f!==null){if(o){if(typeof o=="function"&&o(S,f))return;if(typeof o=="object"){if(o.prefilter&&o.prefilter(S,f))return;if(o.normalize){var V=o.normalize(S,f,r,i);V&&(r=V[0],i=V[1]);}}}S.push(f);}D(r)==="regexp"&&D(i)==="regexp"&&(r=r.toString(),i=i.toString());var A=typeof r,ee=typeof i,h,N,c,O,F=A!=="undefined"||p&&p.length>0&&p[p.length-1].lhs&&Object.getOwnPropertyDescriptor(p[p.length-1].lhs,f),$=ee!=="undefined"||p&&p.length>0&&p[p.length-1].rhs&&Object.getOwnPropertyDescriptor(p[p.length-1].rhs,f);if(!F&&$)t.push(new y(S,i));else if(!$&&F)t.push(new m(S,r));else if(D(r)!==D(i))t.push(new u(S,r,i));else if(D(r)==="date"&&r-i!==0)t.push(new u(S,r,i));else if(A==="object"&&r!==null&&i!==null){for(h=p.length-1;h>-1;--h)if(p[h].lhs===r){O=true;break}if(O)r!==i&&t.push(new u(S,r,i));else {if(p.push({lhs:r,rhs:i}),Array.isArray(r)){for(E&&(r.sort(function(P,j){return G(P)-G(j)}),i.sort(function(P,j){return G(P)-G(j)})),h=i.length-1,N=r.length-1;h>N;)t.push(new g(S,h,new y(void 0,i[h--])));for(;N>h;)t.push(new g(S,N,new m(void 0,r[N--])));for(;h>=0;--h)x(r[h],i[h],t,o,S,h,p,E);}else {var J=Object.keys(r),T=Object.keys(i);for(h=0;h<J.length;++h)c=J[h],O=T.indexOf(c),O>=0?(x(r[c],i[c],t,o,S,c,p,E),T[O]=null):x(r[c],void 0,t,o,S,c,p,E);for(h=0;h<T.length;++h)c=T[h],c&&x(void 0,i[c],t,o,S,c,p,E);}p.length=p.length-1;}}else r!==i&&(A==="number"&&isNaN(r)&&isNaN(i)||t.push(new u(S,r,i)));}function k(r,i,t,o,s){var f=[];if(x(r,i,f,o,null,null,null,s),t)for(var p=0;p<f.length;++p)t(f[p]);return f}function U(r,i,t,o,s,f,p){return x(r,i,t,o,s,f,p,true)}function C(r,i,t,o){var s=o?function(p){p&&o.push(p);}:void 0,f=k(r,i,s,t);return o||(f.length?f:void 0)}function W(r,i,t,o){var s=o?function(p){p&&o.push(p);}:void 0,f=k(r,i,s,t,true);return o||(f.length?f:void 0)}function _(r,i,t){if(t.path&&t.path.length){var o=r[i],s,f=t.path.length-1;for(s=0;s<f;s++)o=o[t.path[s]];switch(t.kind){case "A":_(o[t.path[s]],t.index,t.item);break;case "D":delete o[t.path[s]];break;case "E":case "N":o[t.path[s]]=t.rhs;break}}else switch(t.kind){case "A":_(r[i],t.index,t.item);break;case "D":r=w(r,i);break;case "E":case "N":r[i]=t.rhs;break}return r}function z(r,i,t){if(typeof t>"u"&&i&&~e.indexOf(i.kind)&&(t=i),r&&t&&t.kind){for(var o=r,s=-1,f=t.path?t.path.length-1:0;++s<f;)typeof o[t.path[s]]>"u"&&(o[t.path[s]]=typeof t.path[s+1]<"u"&&typeof t.path[s+1]=="number"?[]:{}),o=o[t.path[s]];switch(t.kind){case "A":t.path&&typeof o[t.path[s]]>"u"&&(o[t.path[s]]=[]),_(t.path?o[t.path[s]]:o,t.index,t.item);break;case "D":delete o[t.path[s]];break;case "E":case "N":o[t.path[s]]=t.rhs;break}}}function L(r,i,t){if(t.path&&t.path.length){var o=r[i],s,f=t.path.length-1;for(s=0;s<f;s++)o=o[t.path[s]];switch(t.kind){case "A":L(o[t.path[s]],t.index,t.item);break;case "D":o[t.path[s]]=t.lhs;break;case "E":o[t.path[s]]=t.lhs;break;case "N":delete o[t.path[s]];break}}else switch(t.kind){case "A":L(r[i],t.index,t.item);break;case "D":r[i]=t.lhs;break;case "E":r[i]=t.lhs;break;case "N":r=w(r,i);break}return r}function X(r,i,t){if(r&&i&&t&&t.kind){var o=r,s,f;for(f=t.path.length-1,s=0;s<f;s++)typeof o[t.path[s]]>"u"&&(o[t.path[s]]={}),o=o[t.path[s]];switch(t.kind){case "A":L(o[t.path[s]],t.index,t.item);break;case "D":o[t.path[s]]=t.lhs;break;case "E":o[t.path[s]]=t.lhs;break;case "N":delete o[t.path[s]];break}}}function Z(r,i,t){if(r&&i){var o=function(s){(!t||t(r,i,s))&&z(r,i,s);};k(r,i,o);}}return Object.defineProperties(C,{diff:{value:C,enumerable:true},orderIndependentDiff:{value:W,enumerable:true},observableDiff:{value:k,enumerable:true},orderIndependentObservableDiff:{value:U,enumerable:true},orderIndepHash:{value:G,enumerable:true},applyDiff:{value:Z,enumerable:true},applyChange:{value:z,enumerable:true},revertChange:{value:X,enumerable:true},isConflict:{value:function(){return typeof $conflict<"u"},enumerable:true}}),C.DeepDiff=C,n&&(n.DeepDiff=C),C});});var Q=le(q());var d;(u=>(u.log=(y,...m)=>console.log(`[Pixi\u2019VN] ${y}`,...m),u.warn=(y,...m)=>console.warn(`[Pixi\u2019VN] ${y}`,...m),u.error=(y,...m)=>console.error(`[Pixi\u2019VN] ${y}`,...m),u.info=(y,...m)=>console.info(`[Pixi\u2019VN] ${y}`,...m)))(d||={});var H=class n{static init(e){n._getStepCounter=e.getStepCounter,n._setStepCounter=e.setStepCounter,n._getCurrentGameStepState=e.getCurrentGameStepState,n._restoreGameStepState=e.restoreGameStepState,n._getOpenedLabels=e.getOpenedLabels,e.onGoNextEnd&&(n._onGoNextEnd=e.onGoNextEnd),n._getVariable=e.getVariable,n._setVariable=e.setVariable,n._removeVariable=e.removeVariable,n._getFlag=e.getFlag,n._setFlag=e.setFlag,e.onLabelClosing&&(n._onLabelClosing=e.onLabelClosing),n._addHistoryItem=e.addHistoryItem,n._getCurrentStepsRunningNumber=e.getCurrentStepsRunningNumber;}static _getStepCounter=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static _setStepCounter=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get stepCounter(){return n._getStepCounter()}static set stepCounter(e){n._setStepCounter(e);}static _getCurrentGameStepState=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get currentGameStepState(){return n._getCurrentGameStepState()}static _restoreGameStepState=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get restoreGameStepState(){return n._restoreGameStepState}static _getOpenedLabels=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get openedLabels(){return n._getOpenedLabels()}static _onGoNextEnd=async()=>{};static get onGoNextEnd(){return n._onGoNextEnd}static _getVariable=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get getVariable(){return n._getVariable}static _setVariable=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get setVariable(){return n._setVariable}static _removeVariable=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get removeVariable(){return n._removeVariable}static _getFlag=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get getFlag(){return n._getFlag}static _setFlag=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get setFlag(){return n._setFlag}static _onLabelClosing=()=>{};static get onLabelClosing(){return n._onLabelClosing}static _addHistoryItem=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get addHistoryItem(){return n._addHistoryItem}static _getCurrentStepsRunningNumber=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get currentStepsRunningNumber(){return n._getCurrentStepsRunningNumber()}};function v(n){try{if(typeof n>"u")return n;let e=JSON.stringify(n);return JSON.parse(e)}catch(e){throw d.error("Error creating exportable element",n,e),new Error("[Pixi\u2019VN] Error creating exportable element")}}function K(n,e){let a=v(n);return e.length>1&&"type"in e[0]&&(e=e.reverse()),e.forEach(l=>{"type"in l?pe(a,l):ue(a,l);}),a}function pe(n,e){let a=n;e.path&&e.path.length>0?e.path.forEach((l,u)=>{if(e.path&&u===e.path.length-1)switch(e.type){case "CHANGE":case "REMOVE":a[l]=e.oldValue;break;case "CREATE":Array.isArray(a)&&typeof l=="number"?a.splice(l,1):delete a[l];break}else a=a[l];}):d.warn("No path found, skipping diff",e);}function ue(n,e){let a=n;e.path&&e.path.length>0?e.path.forEach((l,u)=>{if(e.path&&u===e.path.length-1){if(e.kind==="E"||e.kind==="D")a[l]=e.lhs;else if(e.kind==="N")Number.isInteger(l)?Array.isArray(a)&&a.splice(l,1):typeof l=="string"&&delete a[l];else if(e.kind==="A"){let y=e.index;e.item.kind==="N"?a[l].splice(y,1):e.item.kind==="E"||e.item.kind==="D"?a[l][y]=e.item.lhs:e.item.kind==="A"?d.warn("Nested array found, skipping diff",e):d.warn("No array found, skipping diff",e);}}else a=a[l];}):d.warn("No path found, skipping diff",e);}var b=class n{static _stepsHistory=[];static stepLimitSaved=20;static get lastHistoryStep(){return n._stepsHistory.length>0?n._stepsHistory[n._stepsHistory.length-1]:null}static _originalStepData=void 0;static get originalStepData(){return n._originalStepData?v(n._originalStepData):{path:"",storage:{},canvas:{elementAliasesOrder:[],elements:{},stage:{},tickers:{},tickersSteps:{},tickersOnPause:{},tickersToCompleteOnStepEnd:{tikersIds:[],stepAlias:[]}},sound:{soundAliasesOrder:[],soundsPlaying:{},playInStepIndex:{},filters:void 0},labelIndex:-1,openedLabels:[]}}static set originalStepData(e){n._originalStepData=v(e);}};var M=class{get stepsHistory(){return b._stepsHistory}internalRestoreOldGameState(e,a){if(e<=0||b._stepsHistory.length==0)return a;let l=b.lastHistoryStep;if(l?.diff)try{let u=K(a,l.diff);return H.stepCounter=l.index,b._stepsHistory.pop(),this.internalRestoreOldGameState(e-1,u)}catch(u){return d.error("Error applying diff",u),a}else return d.error("You can't go back, there is no step to go back"),a}async goBack(e,a=1){if(a<=0){d.warn("The parameter steps must be greater than 0");return}if(this.stepsHistory.length<=1){d.warn("You can't go back, there is no step to go back");return}let l=v(this.internalRestoreOldGameState(a,b.originalStepData));l?await H.restoreGameStepState(l,e):d.error("Error going back");}add(e={},a={}){let l=b.originalStepData,{ignoreSameStep:u}=a,y=H.currentGameStepState;if(!u&&this.isSameStep(l,y))return;let m=(0, Q.diff)(l,y);this.stepsHistory.push({...e,diff:m}),b.originalStepData=y;}get narrativeHistory(){let e=[];return this.stepsHistory.forEach(a=>{let l=a.dialoge,u=a.choices,y=a.inputValue;if(e.length>0&&e[e.length-1].choices&&!e[e.length-1].playerMadeChoice&&a.currentLabel){let m=e[e.length-1].choices;if(m){let g=false;a.choiceIndexMade!==void 0&&m.length>a.choiceIndexMade&&(m[a.choiceIndexMade].isResponse=true,g=true),e[e.length-1].playerMadeChoice=g,e[e.length-1].choices=m;}}if(y&&e.length>0&&(e[e.length-1].inputValue=y),l||u){let m=u?.map((g,w)=>{let D=false;return g.oneTime&&a.alreadyMadeChoices&&a.alreadyMadeChoices.includes(w)&&(D=true),{text:g.text,type:g.type,isResponse:false,hidden:D}});if(m&&m.every(g=>g.hidden)){let g=m.find(w=>w.hidden===false);g&&(g.hidden=false);}e.push({dialoge:l,playerMadeChoice:false,choices:m,stepIndex:a.index});}}),e}removeNarrativeHistory(e){e?this.stepsHistory.splice(0,e):b._stepsHistory=[];}get canGoBack(){return b._stepsHistory.length<=1?false:!!b.lastHistoryStep?.diff}blockGoBack(){H.currentStepsRunningNumber===0&&this.stepsHistory.length>1&&(this.stepsHistory[this.stepsHistory.length-1]={...this.stepsHistory[this.stepsHistory.length-1],diff:void 0});}isSameStep(e,a){if(e.openedLabels.length===a.openedLabels.length)try{let l=JSON.stringify(e.openedLabels),u=JSON.stringify(a.openedLabels);if(l===u&&e.path===a.path&&e.labelIndex===a.labelIndex)return !0}catch(l){return d.error("Error comparing opened labels",l),true}return false}clear(){b._stepsHistory=[],b._originalStepData=void 0;}get stepLimitSaved(){return b.stepLimitSaved}set stepLimitSaved(e){b.stepLimitSaved=e;}export(){let e=this.stepsHistory.length-this.stepLimitSaved,a=this.stepsHistory.map((l,u)=>({diff:e>u?void 0:l.diff,...l}));return {stepsHistory:v(a),originalStepData:v(b._originalStepData)}}async restore(e){this.clear();try{e.hasOwnProperty("stepsHistory")?b._stepsHistory=e.stepsHistory:d.warn("Could not import stepsHistory data, so will be ignored"),e.hasOwnProperty("originalStepData")?b._originalStepData=e.originalStepData:d.warn("Could not import originalStepData data, so will be ignored");}catch(a){d.error("Error importing data",a);}}};var ke=new M;
|
|
2
2
|
exports.HistoryManagerStatic=b;exports.stepHistory=ke;
|
package/dist/history/index.d.cts
CHANGED
|
@@ -12,8 +12,8 @@ import '../narration/types/LabelIdType.cjs';
|
|
|
12
12
|
import '../narration/types/LabelRunModeType.cjs';
|
|
13
13
|
import '../narration/classes/Label.cjs';
|
|
14
14
|
import '../narration/classes/LabelAbstract.cjs';
|
|
15
|
-
import '../narration/types/StepLabelType.cjs';
|
|
16
15
|
import '../narration/interfaces/LabelProps.cjs';
|
|
16
|
+
import '../narration/types/StepLabelType.cjs';
|
|
17
17
|
import '../narration/classes/Dialogue.cjs';
|
|
18
18
|
import '../narration/interfaces/NarrativeHistory.cjs';
|
|
19
19
|
import '../narration/types/HistoryChoiceMenuOption.cjs';
|
package/dist/history/index.d.ts
CHANGED
|
@@ -12,8 +12,8 @@ import '../narration/types/LabelIdType.js';
|
|
|
12
12
|
import '../narration/types/LabelRunModeType.js';
|
|
13
13
|
import '../narration/classes/Label.js';
|
|
14
14
|
import '../narration/classes/LabelAbstract.js';
|
|
15
|
-
import '../narration/types/StepLabelType.js';
|
|
16
15
|
import '../narration/interfaces/LabelProps.js';
|
|
16
|
+
import '../narration/types/StepLabelType.js';
|
|
17
17
|
import '../narration/classes/Dialogue.js';
|
|
18
18
|
import '../narration/interfaces/NarrativeHistory.js';
|
|
19
19
|
import '../narration/types/HistoryChoiceMenuOption.js';
|
package/dist/history/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var te=Object.create;var B=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var ne=Object.getPrototypeOf,ae=Object.prototype.hasOwnProperty;var oe=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var se=(n,e,a,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let u of ie(e))!ae.call(n,u)&&u!==a&&B(n,u,{get:()=>e[u],enumerable:!(l=re(e,u))||l.enumerable});return n};var le=(n,e,a)=>(a=n!=null?te(ne(n)):{},se(B(a,"default",{value:n,enumerable:true}),n));var q=oe((R,Y)=>{(function(n,e){var a=e(n);if(typeof define=="function"&&define.amd)define("DeepDiff",function(){return a});else if(typeof R=="object"||typeof navigator=="object"&&navigator.product.match(/ReactNative/i))Y.exports=a;else {var l=n.DeepDiff;a.noConflict=function(){return n.DeepDiff===a&&(n.DeepDiff=l),a},n.DeepDiff=a;}})(R,function(n){var e=["N","E","A","D"];function a(r,i){r.super_=i,r.prototype=Object.create(i.prototype,{constructor:{value:r,enumerable:false,writable:true,configurable:true}});}function l(r,i){Object.defineProperty(this,"kind",{value:r,enumerable:true}),i&&i.length&&Object.defineProperty(this,"path",{value:i,enumerable:true});}function u(r,i,t){u.super_.call(this,"E",r),Object.defineProperty(this,"lhs",{value:i,enumerable:true}),Object.defineProperty(this,"rhs",{value:t,enumerable:true});}a(u,l);function y(r,i){y.super_.call(this,"N",r),Object.defineProperty(this,"rhs",{value:i,enumerable:true});}a(y,l);function m(r,i){m.super_.call(this,"D",r),Object.defineProperty(this,"lhs",{value:i,enumerable:true});}a(m,l);function g(r,i,t){g.super_.call(this,"A",r),Object.defineProperty(this,"index",{value:i,enumerable:true}),Object.defineProperty(this,"item",{value:t,enumerable:true});}a(g,l);function w(r,i,t){var o=r.slice((i)+1||r.length);return r.length=i<0?r.length+i:i,r.push.apply(r,o),r}function v(r){var i=typeof r;return i!=="object"?i:r===Math?"math":r===null?"null":Array.isArray(r)?"array":Object.prototype.toString.call(r)==="[object Date]"?"date":typeof r.toString=="function"&&/^\/.*\//.test(r.toString())?"regexp":"object"}function I(r){var i=0;if(r.length===0)return i;for(var t=0;t<r.length;t++){var o=r.charCodeAt(t);i=(i<<5)-i+o,i=i&i;}return i}function G(r){var i=0,t=v(r);if(t==="array"){r.forEach(function(E){i+=G(E);});var o="[type: array, hash: "+i+"]";return i+I(o)}if(t==="object"){for(var s in r)if(r.hasOwnProperty(s)){var f="[ type: object, key: "+s+", value hash: "+G(r[s])+"]";i+=I(f);}return i}var p="[ type: "+t+" ; value: "+r+"]";return i+I(p)}function x(r,i,t,o,s,f,p,E){t=t||[],s=s||[],p=p||[];var S=s.slice(0);if(typeof f<"u"&&f!==null){if(o){if(typeof o=="function"&&o(S,f))return;if(typeof o=="object"){if(o.prefilter&&o.prefilter(S,f))return;if(o.normalize){var V=o.normalize(S,f,r,i);V&&(r=V[0],i=V[1]);}}}S.push(f);}v(r)==="regexp"&&v(i)==="regexp"&&(r=r.toString(),i=i.toString());var A=typeof r,ee=typeof i,h,N,c,O,F=A!=="undefined"||p&&p.length>0&&p[p.length-1].lhs&&Object.getOwnPropertyDescriptor(p[p.length-1].lhs,f),$=ee!=="undefined"||p&&p.length>0&&p[p.length-1].rhs&&Object.getOwnPropertyDescriptor(p[p.length-1].rhs,f);if(!F&&$)t.push(new y(S,i));else if(!$&&F)t.push(new m(S,r));else if(v(r)!==v(i))t.push(new u(S,r,i));else if(v(r)==="date"&&r-i!==0)t.push(new u(S,r,i));else if(A==="object"&&r!==null&&i!==null){for(h=p.length-1;h>-1;--h)if(p[h].lhs===r){O=true;break}if(O)r!==i&&t.push(new u(S,r,i));else {if(p.push({lhs:r,rhs:i}),Array.isArray(r)){for(E&&(r.sort(function(P,j){return G(P)-G(j)}),i.sort(function(P,j){return G(P)-G(j)})),h=i.length-1,N=r.length-1;h>N;)t.push(new g(S,h,new y(void 0,i[h--])));for(;N>h;)t.push(new g(S,N,new m(void 0,r[N--])));for(;h>=0;--h)x(r[h],i[h],t,o,S,h,p,E);}else {var J=Object.keys(r),T=Object.keys(i);for(h=0;h<J.length;++h)c=J[h],O=T.indexOf(c),O>=0?(x(r[c],i[c],t,o,S,c,p,E),T[O]=null):x(r[c],void 0,t,o,S,c,p,E);for(h=0;h<T.length;++h)c=T[h],c&&x(void 0,i[c],t,o,S,c,p,E);}p.length=p.length-1;}}else r!==i&&(A==="number"&&isNaN(r)&&isNaN(i)||t.push(new u(S,r,i)));}function k(r,i,t,o,s){var f=[];if(x(r,i,f,o,null,null,null,s),t)for(var p=0;p<f.length;++p)t(f[p]);return f}function U(r,i,t,o,s,f,p){return x(r,i,t,o,s,f,p,true)}function C(r,i,t,o){var s=o?function(p){p&&o.push(p);}:void 0,f=k(r,i,s,t);return o||(f.length?f:void 0)}function W(r,i,t,o){var s=o?function(p){p&&o.push(p);}:void 0,f=k(r,i,s,t,true);return o||(f.length?f:void 0)}function _(r,i,t){if(t.path&&t.path.length){var o=r[i],s,f=t.path.length-1;for(s=0;s<f;s++)o=o[t.path[s]];switch(t.kind){case "A":_(o[t.path[s]],t.index,t.item);break;case "D":delete o[t.path[s]];break;case "E":case "N":o[t.path[s]]=t.rhs;break}}else switch(t.kind){case "A":_(r[i],t.index,t.item);break;case "D":r=w(r,i);break;case "E":case "N":r[i]=t.rhs;break}return r}function z(r,i,t){if(typeof t>"u"&&i&&~e.indexOf(i.kind)&&(t=i),r&&t&&t.kind){for(var o=r,s=-1,f=t.path?t.path.length-1:0;++s<f;)typeof o[t.path[s]]>"u"&&(o[t.path[s]]=typeof t.path[s+1]<"u"&&typeof t.path[s+1]=="number"?[]:{}),o=o[t.path[s]];switch(t.kind){case "A":t.path&&typeof o[t.path[s]]>"u"&&(o[t.path[s]]=[]),_(t.path?o[t.path[s]]:o,t.index,t.item);break;case "D":delete o[t.path[s]];break;case "E":case "N":o[t.path[s]]=t.rhs;break}}}function L(r,i,t){if(t.path&&t.path.length){var o=r[i],s,f=t.path.length-1;for(s=0;s<f;s++)o=o[t.path[s]];switch(t.kind){case "A":L(o[t.path[s]],t.index,t.item);break;case "D":o[t.path[s]]=t.lhs;break;case "E":o[t.path[s]]=t.lhs;break;case "N":delete o[t.path[s]];break}}else switch(t.kind){case "A":L(r[i],t.index,t.item);break;case "D":r[i]=t.lhs;break;case "E":r[i]=t.lhs;break;case "N":r=w(r,i);break}return r}function X(r,i,t){if(r&&i&&t&&t.kind){var o=r,s,f;for(f=t.path.length-1,s=0;s<f;s++)typeof o[t.path[s]]>"u"&&(o[t.path[s]]={}),o=o[t.path[s]];switch(t.kind){case "A":L(o[t.path[s]],t.index,t.item);break;case "D":o[t.path[s]]=t.lhs;break;case "E":o[t.path[s]]=t.lhs;break;case "N":delete o[t.path[s]];break}}}function Z(r,i,t){if(r&&i){var o=function(s){(!t||t(r,i,s))&&z(r,i,s);};k(r,i,o);}}return Object.defineProperties(C,{diff:{value:C,enumerable:true},orderIndependentDiff:{value:W,enumerable:true},observableDiff:{value:k,enumerable:true},orderIndependentObservableDiff:{value:U,enumerable:true},orderIndepHash:{value:G,enumerable:true},applyDiff:{value:Z,enumerable:true},applyChange:{value:z,enumerable:true},revertChange:{value:X,enumerable:true},isConflict:{value:function(){return typeof $conflict<"u"},enumerable:true}}),C.DeepDiff=C,n&&(n.DeepDiff=C),C});});var Q=le(q());var d;(u=>(u.log=(y,...m)=>console.log(`[Pixi\u2019VN] ${y}`,...m),u.warn=(y,...m)=>console.warn(`[Pixi\u2019VN] ${y}`,...m),u.error=(y,...m)=>console.error(`[Pixi\u2019VN] ${y}`,...m),u.info=(y,...m)=>console.info(`[Pixi\u2019VN] ${y}`,...m)))(d||={});var D=class n{static init(e){n._getStepCounter=e.getStepCounter,n._setStepCounter=e.setStepCounter,n._getCurrentGameStepState=e.getCurrentGameStepState,n._restoreGameStepState=e.restoreGameStepState,n._getOpenedLabels=e.getOpenedLabels,e.onGoNextEnd&&(n._onGoNextEnd=e.onGoNextEnd),n._getVariable=e.getVariable,n._setVariable=e.setVariable,n._removeVariable=e.removeVariable,n._getFlag=e.getFlag,n._setFlag=e.setFlag,e.onLabelClosing&&(n._onLabelClosing=e.onLabelClosing),n._addHistoryItem=e.addHistoryItem,n._getCurrentStepsRunningNumber=e.getCurrentStepsRunningNumber;}static _getStepCounter=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static _setStepCounter=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get stepCounter(){return n._getStepCounter()}static set stepCounter(e){n._setStepCounter(e);}static _getCurrentGameStepState=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get currentGameStepState(){return n._getCurrentGameStepState()}static _restoreGameStepState=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get restoreGameStepState(){return n._restoreGameStepState}static _getOpenedLabels=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get openedLabels(){return n._getOpenedLabels()}static _onGoNextEnd=async()=>{};static get onGoNextEnd(){return n._onGoNextEnd}static _getVariable=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get getVariable(){return n._getVariable}static _setVariable=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get setVariable(){return n._setVariable}static _removeVariable=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get removeVariable(){return n._removeVariable}static _getFlag=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get getFlag(){return n._getFlag}static _setFlag=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get setFlag(){return n._setFlag}static _onLabelClosing=()=>{};static get onLabelClosing(){return n._onLabelClosing}static _addHistoryItem=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get addHistoryItem(){return n._addHistoryItem}static _getCurrentStepsRunningNumber=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get currentStepsRunningNumber(){return n._getCurrentStepsRunningNumber()}};function H(n){try{if(typeof n>"u")return n;let e=JSON.stringify(n);return JSON.parse(e)}catch(e){throw d.error("Error creating exportable element",n,e),new Error("[Pixi\u2019VN] Error creating exportable element")}}function K(n,e){let a=H(n);return e.length>1&&"type"in e[0]&&(e=e.reverse()),e.forEach(l=>{"type"in l?pe(a,l):ue(a,l);}),a}function pe(n,e){let a=n;e.path&&e.path.length>0?e.path.forEach((l,u)=>{if(e.path&&u===e.path.length-1)switch(e.type){case "CHANGE":case "REMOVE":a[l]=e.oldValue;break;case "CREATE":Array.isArray(a)&&typeof l=="number"?a.splice(l,1):delete a[l];break}else a=a[l];}):d.warn("No path found, skipping diff",e);}function ue(n,e){let a=n;e.path&&e.path.length>0?e.path.forEach((l,u)=>{if(e.path&&u===e.path.length-1){if(e.kind==="E"||e.kind==="D")a[l]=e.lhs;else if(e.kind==="N")Number.isInteger(l)?Array.isArray(a)&&a.splice(l,1):typeof l=="string"&&delete a[l];else if(e.kind==="A"){let y=e.index;e.item.kind==="N"?a[l].splice(y,1):e.item.kind==="E"||e.item.kind==="D"?a[l][y]=e.item.lhs:e.item.kind==="A"?d.warn("Nested array found, skipping diff",e):d.warn("No array found, skipping diff",e);}}else a=a[l];}):d.warn("No path found, skipping diff",e);}var b=class n{static _stepsHistory=[];static stepLimitSaved=20;static get lastHistoryStep(){return n._stepsHistory.length>0?n._stepsHistory[n._stepsHistory.length-1]:null}static _originalStepData=void 0;static get originalStepData(){return n._originalStepData?H(n._originalStepData):{path:"",storage:{},canvas:{elementAliasesOrder:[],elements:{},stage:{},tickers:{},tickersSteps:{},tickersOnPause:{},tickersToCompleteOnStepEnd:{tikersIds:[],stepAlias:[]}},sound:{soundAliasesOrder:[],soundsPlaying:{},playInStepIndex:{},filters:void 0},labelIndex:-1,openedLabels:[]}}static set originalStepData(e){n._originalStepData=H(e);}};var M=class{get stepsHistory(){return b._stepsHistory}internalRestoreOldGameState(e,a){if(e<=0||b._stepsHistory.length==0)return a;let l=b.lastHistoryStep;if(l?.diff)try{let u=K(a,l.diff);return D.stepCounter=l.index,b._stepsHistory.pop(),this.internalRestoreOldGameState(e-1,u)}catch(u){return d.error("Error applying diff",u),a}else return d.error("You can't go back, there is no step to go back"),a}async goBack(e,a=1){if(a<=0){d.warn("The parameter steps must be greater than 0");return}if(this.stepsHistory.length<=1){d.warn("You can't go back, there is no step to go back");return}let l=H(this.internalRestoreOldGameState(a,b.originalStepData));l?await D.restoreGameStepState(l,e):d.error("Error going back");}add(e={},a={}){let l=b.originalStepData,{ignoreSameStep:u}=a,y=D.currentGameStepState;if(!u&&this.isSameStep(l,y))return;let m=(0, Q.diff)(l,y);this.stepsHistory.push({...e,diff:m}),b.originalStepData=y;}get narrativeHistory(){let e=[];return this.stepsHistory.forEach(a=>{let l=a.dialoge,u=a.choices,y=a.inputValue;if(e.length>0&&e[e.length-1].choices&&!e[e.length-1].playerMadeChoice&&a.currentLabel){let m=e[e.length-1].choices;if(m){let g=false;a.choiceIndexMade!==void 0&&m.length>a.choiceIndexMade&&(m[a.choiceIndexMade].isResponse=true,g=true),e[e.length-1].playerMadeChoice=g,e[e.length-1].choices=m;}}if(y&&e.length>0&&(e[e.length-1].inputValue=y),l||u){let m=u?.map((g,w)=>{let v=false;return g.oneTime&&a.alreadyMadeChoices&&a.alreadyMadeChoices.includes(w)&&(v=true),{text:g.text,type:g.type,isResponse:false,hidden:v}});if(m&&m.every(g=>g.hidden)){let g=m.find(w=>w.hidden===false);g&&(g.hidden=false);}e.push({dialoge:l,playerMadeChoice:false,choices:m,stepIndex:a.index});}}),e}removeNarrativeHistory(e){e?this.stepsHistory.splice(0,e):b._stepsHistory=[];}get canGoBack(){return b._stepsHistory.length<=1?false:!!b.lastHistoryStep?.diff}blockGoBack(){D.currentStepsRunningNumber===0&&this.stepsHistory.length>1&&(this.stepsHistory[this.stepsHistory.length-1]={...this.stepsHistory[this.stepsHistory.length-1],diff:void 0});}isSameStep(e,a){if(e.openedLabels.length===a.openedLabels.length)try{let l=JSON.stringify(e.openedLabels),u=JSON.stringify(a.openedLabels);if(l===u&&e.path===a.path&&e.labelIndex===a.labelIndex)return !0}catch(l){return d.error("Error comparing opened labels",l),true}return false}clear(){b._stepsHistory=[],b._originalStepData=void 0;}get stepLimitSaved(){return b.stepLimitSaved}set stepLimitSaved(e){b.stepLimitSaved=e;}export(){let e=this.stepsHistory.length-this.stepLimitSaved;return {stepsHistory:this.stepsHistory.map((l,u)=>({diff:e>u?void 0:l.diff,...l})),originalStepData:b._originalStepData}}async restore(e){this.clear();try{e.hasOwnProperty("stepsHistory")?b._stepsHistory=e.stepsHistory:d.warn("Could not import stepsHistory data, so will be ignored"),e.hasOwnProperty("originalStepData")?b._originalStepData=e.originalStepData:d.warn("Could not import originalStepData data, so will be ignored");}catch(a){d.error("Error importing data",a);}}};var ke=new M;
|
|
1
|
+
var te=Object.create;var B=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var ne=Object.getPrototypeOf,ae=Object.prototype.hasOwnProperty;var oe=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var se=(n,e,a,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let u of ie(e))!ae.call(n,u)&&u!==a&&B(n,u,{get:()=>e[u],enumerable:!(l=re(e,u))||l.enumerable});return n};var le=(n,e,a)=>(a=n!=null?te(ne(n)):{},se(B(a,"default",{value:n,enumerable:true}),n));var q=oe((R,Y)=>{(function(n,e){var a=e(n);if(typeof define=="function"&&define.amd)define("DeepDiff",function(){return a});else if(typeof R=="object"||typeof navigator=="object"&&navigator.product.match(/ReactNative/i))Y.exports=a;else {var l=n.DeepDiff;a.noConflict=function(){return n.DeepDiff===a&&(n.DeepDiff=l),a},n.DeepDiff=a;}})(R,function(n){var e=["N","E","A","D"];function a(r,i){r.super_=i,r.prototype=Object.create(i.prototype,{constructor:{value:r,enumerable:false,writable:true,configurable:true}});}function l(r,i){Object.defineProperty(this,"kind",{value:r,enumerable:true}),i&&i.length&&Object.defineProperty(this,"path",{value:i,enumerable:true});}function u(r,i,t){u.super_.call(this,"E",r),Object.defineProperty(this,"lhs",{value:i,enumerable:true}),Object.defineProperty(this,"rhs",{value:t,enumerable:true});}a(u,l);function y(r,i){y.super_.call(this,"N",r),Object.defineProperty(this,"rhs",{value:i,enumerable:true});}a(y,l);function m(r,i){m.super_.call(this,"D",r),Object.defineProperty(this,"lhs",{value:i,enumerable:true});}a(m,l);function g(r,i,t){g.super_.call(this,"A",r),Object.defineProperty(this,"index",{value:i,enumerable:true}),Object.defineProperty(this,"item",{value:t,enumerable:true});}a(g,l);function w(r,i,t){var o=r.slice((i)+1||r.length);return r.length=i<0?r.length+i:i,r.push.apply(r,o),r}function D(r){var i=typeof r;return i!=="object"?i:r===Math?"math":r===null?"null":Array.isArray(r)?"array":Object.prototype.toString.call(r)==="[object Date]"?"date":typeof r.toString=="function"&&/^\/.*\//.test(r.toString())?"regexp":"object"}function I(r){var i=0;if(r.length===0)return i;for(var t=0;t<r.length;t++){var o=r.charCodeAt(t);i=(i<<5)-i+o,i=i&i;}return i}function G(r){var i=0,t=D(r);if(t==="array"){r.forEach(function(E){i+=G(E);});var o="[type: array, hash: "+i+"]";return i+I(o)}if(t==="object"){for(var s in r)if(r.hasOwnProperty(s)){var f="[ type: object, key: "+s+", value hash: "+G(r[s])+"]";i+=I(f);}return i}var p="[ type: "+t+" ; value: "+r+"]";return i+I(p)}function x(r,i,t,o,s,f,p,E){t=t||[],s=s||[],p=p||[];var S=s.slice(0);if(typeof f<"u"&&f!==null){if(o){if(typeof o=="function"&&o(S,f))return;if(typeof o=="object"){if(o.prefilter&&o.prefilter(S,f))return;if(o.normalize){var V=o.normalize(S,f,r,i);V&&(r=V[0],i=V[1]);}}}S.push(f);}D(r)==="regexp"&&D(i)==="regexp"&&(r=r.toString(),i=i.toString());var A=typeof r,ee=typeof i,h,N,c,O,F=A!=="undefined"||p&&p.length>0&&p[p.length-1].lhs&&Object.getOwnPropertyDescriptor(p[p.length-1].lhs,f),$=ee!=="undefined"||p&&p.length>0&&p[p.length-1].rhs&&Object.getOwnPropertyDescriptor(p[p.length-1].rhs,f);if(!F&&$)t.push(new y(S,i));else if(!$&&F)t.push(new m(S,r));else if(D(r)!==D(i))t.push(new u(S,r,i));else if(D(r)==="date"&&r-i!==0)t.push(new u(S,r,i));else if(A==="object"&&r!==null&&i!==null){for(h=p.length-1;h>-1;--h)if(p[h].lhs===r){O=true;break}if(O)r!==i&&t.push(new u(S,r,i));else {if(p.push({lhs:r,rhs:i}),Array.isArray(r)){for(E&&(r.sort(function(P,j){return G(P)-G(j)}),i.sort(function(P,j){return G(P)-G(j)})),h=i.length-1,N=r.length-1;h>N;)t.push(new g(S,h,new y(void 0,i[h--])));for(;N>h;)t.push(new g(S,N,new m(void 0,r[N--])));for(;h>=0;--h)x(r[h],i[h],t,o,S,h,p,E);}else {var J=Object.keys(r),T=Object.keys(i);for(h=0;h<J.length;++h)c=J[h],O=T.indexOf(c),O>=0?(x(r[c],i[c],t,o,S,c,p,E),T[O]=null):x(r[c],void 0,t,o,S,c,p,E);for(h=0;h<T.length;++h)c=T[h],c&&x(void 0,i[c],t,o,S,c,p,E);}p.length=p.length-1;}}else r!==i&&(A==="number"&&isNaN(r)&&isNaN(i)||t.push(new u(S,r,i)));}function k(r,i,t,o,s){var f=[];if(x(r,i,f,o,null,null,null,s),t)for(var p=0;p<f.length;++p)t(f[p]);return f}function U(r,i,t,o,s,f,p){return x(r,i,t,o,s,f,p,true)}function C(r,i,t,o){var s=o?function(p){p&&o.push(p);}:void 0,f=k(r,i,s,t);return o||(f.length?f:void 0)}function W(r,i,t,o){var s=o?function(p){p&&o.push(p);}:void 0,f=k(r,i,s,t,true);return o||(f.length?f:void 0)}function _(r,i,t){if(t.path&&t.path.length){var o=r[i],s,f=t.path.length-1;for(s=0;s<f;s++)o=o[t.path[s]];switch(t.kind){case "A":_(o[t.path[s]],t.index,t.item);break;case "D":delete o[t.path[s]];break;case "E":case "N":o[t.path[s]]=t.rhs;break}}else switch(t.kind){case "A":_(r[i],t.index,t.item);break;case "D":r=w(r,i);break;case "E":case "N":r[i]=t.rhs;break}return r}function z(r,i,t){if(typeof t>"u"&&i&&~e.indexOf(i.kind)&&(t=i),r&&t&&t.kind){for(var o=r,s=-1,f=t.path?t.path.length-1:0;++s<f;)typeof o[t.path[s]]>"u"&&(o[t.path[s]]=typeof t.path[s+1]<"u"&&typeof t.path[s+1]=="number"?[]:{}),o=o[t.path[s]];switch(t.kind){case "A":t.path&&typeof o[t.path[s]]>"u"&&(o[t.path[s]]=[]),_(t.path?o[t.path[s]]:o,t.index,t.item);break;case "D":delete o[t.path[s]];break;case "E":case "N":o[t.path[s]]=t.rhs;break}}}function L(r,i,t){if(t.path&&t.path.length){var o=r[i],s,f=t.path.length-1;for(s=0;s<f;s++)o=o[t.path[s]];switch(t.kind){case "A":L(o[t.path[s]],t.index,t.item);break;case "D":o[t.path[s]]=t.lhs;break;case "E":o[t.path[s]]=t.lhs;break;case "N":delete o[t.path[s]];break}}else switch(t.kind){case "A":L(r[i],t.index,t.item);break;case "D":r[i]=t.lhs;break;case "E":r[i]=t.lhs;break;case "N":r=w(r,i);break}return r}function X(r,i,t){if(r&&i&&t&&t.kind){var o=r,s,f;for(f=t.path.length-1,s=0;s<f;s++)typeof o[t.path[s]]>"u"&&(o[t.path[s]]={}),o=o[t.path[s]];switch(t.kind){case "A":L(o[t.path[s]],t.index,t.item);break;case "D":o[t.path[s]]=t.lhs;break;case "E":o[t.path[s]]=t.lhs;break;case "N":delete o[t.path[s]];break}}}function Z(r,i,t){if(r&&i){var o=function(s){(!t||t(r,i,s))&&z(r,i,s);};k(r,i,o);}}return Object.defineProperties(C,{diff:{value:C,enumerable:true},orderIndependentDiff:{value:W,enumerable:true},observableDiff:{value:k,enumerable:true},orderIndependentObservableDiff:{value:U,enumerable:true},orderIndepHash:{value:G,enumerable:true},applyDiff:{value:Z,enumerable:true},applyChange:{value:z,enumerable:true},revertChange:{value:X,enumerable:true},isConflict:{value:function(){return typeof $conflict<"u"},enumerable:true}}),C.DeepDiff=C,n&&(n.DeepDiff=C),C});});var Q=le(q());var d;(u=>(u.log=(y,...m)=>console.log(`[Pixi\u2019VN] ${y}`,...m),u.warn=(y,...m)=>console.warn(`[Pixi\u2019VN] ${y}`,...m),u.error=(y,...m)=>console.error(`[Pixi\u2019VN] ${y}`,...m),u.info=(y,...m)=>console.info(`[Pixi\u2019VN] ${y}`,...m)))(d||={});var H=class n{static init(e){n._getStepCounter=e.getStepCounter,n._setStepCounter=e.setStepCounter,n._getCurrentGameStepState=e.getCurrentGameStepState,n._restoreGameStepState=e.restoreGameStepState,n._getOpenedLabels=e.getOpenedLabels,e.onGoNextEnd&&(n._onGoNextEnd=e.onGoNextEnd),n._getVariable=e.getVariable,n._setVariable=e.setVariable,n._removeVariable=e.removeVariable,n._getFlag=e.getFlag,n._setFlag=e.setFlag,e.onLabelClosing&&(n._onLabelClosing=e.onLabelClosing),n._addHistoryItem=e.addHistoryItem,n._getCurrentStepsRunningNumber=e.getCurrentStepsRunningNumber;}static _getStepCounter=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static _setStepCounter=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get stepCounter(){return n._getStepCounter()}static set stepCounter(e){n._setStepCounter(e);}static _getCurrentGameStepState=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get currentGameStepState(){return n._getCurrentGameStepState()}static _restoreGameStepState=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get restoreGameStepState(){return n._restoreGameStepState}static _getOpenedLabels=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get openedLabels(){return n._getOpenedLabels()}static _onGoNextEnd=async()=>{};static get onGoNextEnd(){return n._onGoNextEnd}static _getVariable=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get getVariable(){return n._getVariable}static _setVariable=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get setVariable(){return n._setVariable}static _removeVariable=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get removeVariable(){return n._removeVariable}static _getFlag=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get getFlag(){return n._getFlag}static _setFlag=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get setFlag(){return n._setFlag}static _onLabelClosing=()=>{};static get onLabelClosing(){return n._onLabelClosing}static _addHistoryItem=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get addHistoryItem(){return n._addHistoryItem}static _getCurrentStepsRunningNumber=()=>{throw d.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")};static get currentStepsRunningNumber(){return n._getCurrentStepsRunningNumber()}};function v(n){try{if(typeof n>"u")return n;let e=JSON.stringify(n);return JSON.parse(e)}catch(e){throw d.error("Error creating exportable element",n,e),new Error("[Pixi\u2019VN] Error creating exportable element")}}function K(n,e){let a=v(n);return e.length>1&&"type"in e[0]&&(e=e.reverse()),e.forEach(l=>{"type"in l?pe(a,l):ue(a,l);}),a}function pe(n,e){let a=n;e.path&&e.path.length>0?e.path.forEach((l,u)=>{if(e.path&&u===e.path.length-1)switch(e.type){case "CHANGE":case "REMOVE":a[l]=e.oldValue;break;case "CREATE":Array.isArray(a)&&typeof l=="number"?a.splice(l,1):delete a[l];break}else a=a[l];}):d.warn("No path found, skipping diff",e);}function ue(n,e){let a=n;e.path&&e.path.length>0?e.path.forEach((l,u)=>{if(e.path&&u===e.path.length-1){if(e.kind==="E"||e.kind==="D")a[l]=e.lhs;else if(e.kind==="N")Number.isInteger(l)?Array.isArray(a)&&a.splice(l,1):typeof l=="string"&&delete a[l];else if(e.kind==="A"){let y=e.index;e.item.kind==="N"?a[l].splice(y,1):e.item.kind==="E"||e.item.kind==="D"?a[l][y]=e.item.lhs:e.item.kind==="A"?d.warn("Nested array found, skipping diff",e):d.warn("No array found, skipping diff",e);}}else a=a[l];}):d.warn("No path found, skipping diff",e);}var b=class n{static _stepsHistory=[];static stepLimitSaved=20;static get lastHistoryStep(){return n._stepsHistory.length>0?n._stepsHistory[n._stepsHistory.length-1]:null}static _originalStepData=void 0;static get originalStepData(){return n._originalStepData?v(n._originalStepData):{path:"",storage:{},canvas:{elementAliasesOrder:[],elements:{},stage:{},tickers:{},tickersSteps:{},tickersOnPause:{},tickersToCompleteOnStepEnd:{tikersIds:[],stepAlias:[]}},sound:{soundAliasesOrder:[],soundsPlaying:{},playInStepIndex:{},filters:void 0},labelIndex:-1,openedLabels:[]}}static set originalStepData(e){n._originalStepData=v(e);}};var M=class{get stepsHistory(){return b._stepsHistory}internalRestoreOldGameState(e,a){if(e<=0||b._stepsHistory.length==0)return a;let l=b.lastHistoryStep;if(l?.diff)try{let u=K(a,l.diff);return H.stepCounter=l.index,b._stepsHistory.pop(),this.internalRestoreOldGameState(e-1,u)}catch(u){return d.error("Error applying diff",u),a}else return d.error("You can't go back, there is no step to go back"),a}async goBack(e,a=1){if(a<=0){d.warn("The parameter steps must be greater than 0");return}if(this.stepsHistory.length<=1){d.warn("You can't go back, there is no step to go back");return}let l=v(this.internalRestoreOldGameState(a,b.originalStepData));l?await H.restoreGameStepState(l,e):d.error("Error going back");}add(e={},a={}){let l=b.originalStepData,{ignoreSameStep:u}=a,y=H.currentGameStepState;if(!u&&this.isSameStep(l,y))return;let m=(0, Q.diff)(l,y);this.stepsHistory.push({...e,diff:m}),b.originalStepData=y;}get narrativeHistory(){let e=[];return this.stepsHistory.forEach(a=>{let l=a.dialoge,u=a.choices,y=a.inputValue;if(e.length>0&&e[e.length-1].choices&&!e[e.length-1].playerMadeChoice&&a.currentLabel){let m=e[e.length-1].choices;if(m){let g=false;a.choiceIndexMade!==void 0&&m.length>a.choiceIndexMade&&(m[a.choiceIndexMade].isResponse=true,g=true),e[e.length-1].playerMadeChoice=g,e[e.length-1].choices=m;}}if(y&&e.length>0&&(e[e.length-1].inputValue=y),l||u){let m=u?.map((g,w)=>{let D=false;return g.oneTime&&a.alreadyMadeChoices&&a.alreadyMadeChoices.includes(w)&&(D=true),{text:g.text,type:g.type,isResponse:false,hidden:D}});if(m&&m.every(g=>g.hidden)){let g=m.find(w=>w.hidden===false);g&&(g.hidden=false);}e.push({dialoge:l,playerMadeChoice:false,choices:m,stepIndex:a.index});}}),e}removeNarrativeHistory(e){e?this.stepsHistory.splice(0,e):b._stepsHistory=[];}get canGoBack(){return b._stepsHistory.length<=1?false:!!b.lastHistoryStep?.diff}blockGoBack(){H.currentStepsRunningNumber===0&&this.stepsHistory.length>1&&(this.stepsHistory[this.stepsHistory.length-1]={...this.stepsHistory[this.stepsHistory.length-1],diff:void 0});}isSameStep(e,a){if(e.openedLabels.length===a.openedLabels.length)try{let l=JSON.stringify(e.openedLabels),u=JSON.stringify(a.openedLabels);if(l===u&&e.path===a.path&&e.labelIndex===a.labelIndex)return !0}catch(l){return d.error("Error comparing opened labels",l),true}return false}clear(){b._stepsHistory=[],b._originalStepData=void 0;}get stepLimitSaved(){return b.stepLimitSaved}set stepLimitSaved(e){b.stepLimitSaved=e;}export(){let e=this.stepsHistory.length-this.stepLimitSaved,a=this.stepsHistory.map((l,u)=>({diff:e>u?void 0:l.diff,...l}));return {stepsHistory:v(a),originalStepData:v(b._originalStepData)}}async restore(e){this.clear();try{e.hasOwnProperty("stepsHistory")?b._stepsHistory=e.stepsHistory:d.warn("Could not import stepsHistory data, so will be ignored"),e.hasOwnProperty("originalStepData")?b._originalStepData=e.originalStepData:d.warn("Could not import originalStepData data, so will be ignored");}catch(a){d.error("Error importing data",a);}}};var ke=new M;
|
|
2
2
|
export{b as HistoryManagerStatic,ke as stepHistory};
|
|
@@ -9,8 +9,8 @@ import '../../narration/types/LabelIdType.cjs';
|
|
|
9
9
|
import '../../narration/types/LabelRunModeType.cjs';
|
|
10
10
|
import '../../narration/classes/Label.cjs';
|
|
11
11
|
import '../../narration/classes/LabelAbstract.cjs';
|
|
12
|
-
import '../../narration/types/StepLabelType.cjs';
|
|
13
12
|
import '../../narration/interfaces/LabelProps.cjs';
|
|
13
|
+
import '../../narration/types/StepLabelType.cjs';
|
|
14
14
|
import '../../narration/classes/Dialogue.cjs';
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -9,8 +9,8 @@ import '../../narration/types/LabelIdType.js';
|
|
|
9
9
|
import '../../narration/types/LabelRunModeType.js';
|
|
10
10
|
import '../../narration/classes/Label.js';
|
|
11
11
|
import '../../narration/classes/LabelAbstract.js';
|
|
12
|
-
import '../../narration/types/StepLabelType.js';
|
|
13
12
|
import '../../narration/interfaces/LabelProps.js';
|
|
13
|
+
import '../../narration/types/StepLabelType.js';
|
|
14
14
|
import '../../narration/classes/Dialogue.js';
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -12,8 +12,8 @@ import '../../narration/types/LabelIdType.cjs';
|
|
|
12
12
|
import '../../narration/types/LabelRunModeType.cjs';
|
|
13
13
|
import '../../narration/classes/Label.cjs';
|
|
14
14
|
import '../../narration/classes/LabelAbstract.cjs';
|
|
15
|
-
import '../../narration/types/StepLabelType.cjs';
|
|
16
15
|
import '../../narration/interfaces/LabelProps.cjs';
|
|
16
|
+
import '../../narration/types/StepLabelType.cjs';
|
|
17
17
|
import '../../narration/types/HistoryChoiceMenuOption.cjs';
|
|
18
18
|
|
|
19
19
|
interface HistoryManagerInterface {
|
|
@@ -12,8 +12,8 @@ import '../../narration/types/LabelIdType.js';
|
|
|
12
12
|
import '../../narration/types/LabelRunModeType.js';
|
|
13
13
|
import '../../narration/classes/Label.js';
|
|
14
14
|
import '../../narration/classes/LabelAbstract.js';
|
|
15
|
-
import '../../narration/types/StepLabelType.js';
|
|
16
15
|
import '../../narration/interfaces/LabelProps.js';
|
|
16
|
+
import '../../narration/types/StepLabelType.js';
|
|
17
17
|
import '../../narration/types/HistoryChoiceMenuOption.js';
|
|
18
18
|
|
|
19
19
|
interface HistoryManagerInterface {
|
|
@@ -3,7 +3,8 @@ import ChoiceMenuOption, { ChoiceMenuOptionClose } from './narration/classes/Cho
|
|
|
3
3
|
import Dialogue from './narration/classes/Dialogue.cjs';
|
|
4
4
|
import Label from './narration/classes/Label.cjs';
|
|
5
5
|
import LabelAbstract from './narration/classes/LabelAbstract.cjs';
|
|
6
|
-
import
|
|
6
|
+
import RegisteredLabels from './narration/decorators/label-decorator.cjs';
|
|
7
|
+
import newLabel from './narration/decorators/newLabel.cjs';
|
|
7
8
|
import HistoryStep from './narration/interfaces/HistoryStep.cjs';
|
|
8
9
|
import LabelProps from './narration/interfaces/LabelProps.cjs';
|
|
9
10
|
import NarrationManagerInterface from './narration/interfaces/NarrationManagerInterface.cjs';
|
|
@@ -41,17 +42,16 @@ declare const narrationUtils_NarrationManagerInterface: typeof NarrationManagerI
|
|
|
41
42
|
declare const narrationUtils_NarrationManagerStatic: typeof NarrationManagerStatic;
|
|
42
43
|
declare const narrationUtils_NarrativeHistory: typeof NarrativeHistory;
|
|
43
44
|
declare const narrationUtils_OpenedLabel: typeof OpenedLabel;
|
|
45
|
+
declare const narrationUtils_RegisteredLabels: typeof RegisteredLabels;
|
|
44
46
|
declare const narrationUtils_StepLabelProps: typeof StepLabelProps;
|
|
45
47
|
declare const narrationUtils_StepLabelPropsType: typeof StepLabelPropsType;
|
|
46
48
|
declare const narrationUtils_StepLabelResult: typeof StepLabelResult;
|
|
47
49
|
declare const narrationUtils_StepLabelResultType: typeof StepLabelResultType;
|
|
48
50
|
declare const narrationUtils_StepLabelType: typeof StepLabelType;
|
|
49
|
-
declare const narrationUtils_getLabelById: typeof getLabelById;
|
|
50
51
|
declare const narrationUtils_narration: typeof narration;
|
|
51
52
|
declare const narrationUtils_newLabel: typeof newLabel;
|
|
52
|
-
declare const narrationUtils_saveLabel: typeof saveLabel;
|
|
53
53
|
declare namespace narrationUtils {
|
|
54
|
-
export { narrationUtils_ChoiceMenuOption as ChoiceMenuOption, narrationUtils_ChoiceMenuOptionClose as ChoiceMenuOptionClose, narrationUtils_ChoiceMenuOptionsType as ChoiceMenuOptionsType, narrationUtils_Close as Close, narrationUtils_CloseType as CloseType, narrationUtils_Dialogue as Dialogue, Dialogue as DialogueBaseModel, narrationUtils_DialogueType as DialogueType, narrationUtils_HistoryChoiceMenuOption as HistoryChoiceMenuOption, narrationUtils_HistoryStep as HistoryStep, narrationUtils_InputInfo as InputInfo, narrationUtils_Label as Label, narrationUtils_LabelAbstract as LabelAbstract, narrationUtils_LabelProps as LabelProps, narrationUtils_LabelRunModeType as LabelRunModeType, narrationUtils_NarrationGameState as NarrationGameState, narrationUtils_NarrationManagerInterface as NarrationManagerInterface, narrationUtils_NarrationManagerStatic as NarrationManagerStatic, narrationUtils_NarrativeHistory as NarrativeHistory, narrationUtils_OpenedLabel as OpenedLabel, narrationUtils_StepLabelProps as StepLabelProps, narrationUtils_StepLabelPropsType as StepLabelPropsType, narrationUtils_StepLabelResult as StepLabelResult, narrationUtils_StepLabelResultType as StepLabelResultType, narrationUtils_StepLabelType as StepLabelType,
|
|
54
|
+
export { narrationUtils_ChoiceMenuOption as ChoiceMenuOption, narrationUtils_ChoiceMenuOptionClose as ChoiceMenuOptionClose, narrationUtils_ChoiceMenuOptionsType as ChoiceMenuOptionsType, narrationUtils_Close as Close, narrationUtils_CloseType as CloseType, narrationUtils_Dialogue as Dialogue, Dialogue as DialogueBaseModel, narrationUtils_DialogueType as DialogueType, narrationUtils_HistoryChoiceMenuOption as HistoryChoiceMenuOption, narrationUtils_HistoryStep as HistoryStep, narrationUtils_InputInfo as InputInfo, narrationUtils_Label as Label, narrationUtils_LabelAbstract as LabelAbstract, narrationUtils_LabelProps as LabelProps, narrationUtils_LabelRunModeType as LabelRunModeType, narrationUtils_NarrationGameState as NarrationGameState, narrationUtils_NarrationManagerInterface as NarrationManagerInterface, narrationUtils_NarrationManagerStatic as NarrationManagerStatic, narrationUtils_NarrativeHistory as NarrativeHistory, narrationUtils_OpenedLabel as OpenedLabel, narrationUtils_RegisteredLabels as RegisteredLabels, narrationUtils_StepLabelProps as StepLabelProps, narrationUtils_StepLabelPropsType as StepLabelPropsType, narrationUtils_StepLabelResult as StepLabelResult, narrationUtils_StepLabelResultType as StepLabelResultType, narrationUtils_StepLabelType as StepLabelType, narrationUtils_narration as narration, narrationUtils_newLabel as newLabel };
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
export { narration as a, narrationUtils as n };
|
|
@@ -3,7 +3,8 @@ import ChoiceMenuOption, { ChoiceMenuOptionClose } from './narration/classes/Cho
|
|
|
3
3
|
import Dialogue from './narration/classes/Dialogue.js';
|
|
4
4
|
import Label from './narration/classes/Label.js';
|
|
5
5
|
import LabelAbstract from './narration/classes/LabelAbstract.js';
|
|
6
|
-
import
|
|
6
|
+
import RegisteredLabels from './narration/decorators/label-decorator.js';
|
|
7
|
+
import newLabel from './narration/decorators/newLabel.js';
|
|
7
8
|
import HistoryStep from './narration/interfaces/HistoryStep.js';
|
|
8
9
|
import LabelProps from './narration/interfaces/LabelProps.js';
|
|
9
10
|
import NarrationManagerInterface from './narration/interfaces/NarrationManagerInterface.js';
|
|
@@ -41,17 +42,16 @@ declare const narrationUtils_NarrationManagerInterface: typeof NarrationManagerI
|
|
|
41
42
|
declare const narrationUtils_NarrationManagerStatic: typeof NarrationManagerStatic;
|
|
42
43
|
declare const narrationUtils_NarrativeHistory: typeof NarrativeHistory;
|
|
43
44
|
declare const narrationUtils_OpenedLabel: typeof OpenedLabel;
|
|
45
|
+
declare const narrationUtils_RegisteredLabels: typeof RegisteredLabels;
|
|
44
46
|
declare const narrationUtils_StepLabelProps: typeof StepLabelProps;
|
|
45
47
|
declare const narrationUtils_StepLabelPropsType: typeof StepLabelPropsType;
|
|
46
48
|
declare const narrationUtils_StepLabelResult: typeof StepLabelResult;
|
|
47
49
|
declare const narrationUtils_StepLabelResultType: typeof StepLabelResultType;
|
|
48
50
|
declare const narrationUtils_StepLabelType: typeof StepLabelType;
|
|
49
|
-
declare const narrationUtils_getLabelById: typeof getLabelById;
|
|
50
51
|
declare const narrationUtils_narration: typeof narration;
|
|
51
52
|
declare const narrationUtils_newLabel: typeof newLabel;
|
|
52
|
-
declare const narrationUtils_saveLabel: typeof saveLabel;
|
|
53
53
|
declare namespace narrationUtils {
|
|
54
|
-
export { narrationUtils_ChoiceMenuOption as ChoiceMenuOption, narrationUtils_ChoiceMenuOptionClose as ChoiceMenuOptionClose, narrationUtils_ChoiceMenuOptionsType as ChoiceMenuOptionsType, narrationUtils_Close as Close, narrationUtils_CloseType as CloseType, narrationUtils_Dialogue as Dialogue, Dialogue as DialogueBaseModel, narrationUtils_DialogueType as DialogueType, narrationUtils_HistoryChoiceMenuOption as HistoryChoiceMenuOption, narrationUtils_HistoryStep as HistoryStep, narrationUtils_InputInfo as InputInfo, narrationUtils_Label as Label, narrationUtils_LabelAbstract as LabelAbstract, narrationUtils_LabelProps as LabelProps, narrationUtils_LabelRunModeType as LabelRunModeType, narrationUtils_NarrationGameState as NarrationGameState, narrationUtils_NarrationManagerInterface as NarrationManagerInterface, narrationUtils_NarrationManagerStatic as NarrationManagerStatic, narrationUtils_NarrativeHistory as NarrativeHistory, narrationUtils_OpenedLabel as OpenedLabel, narrationUtils_StepLabelProps as StepLabelProps, narrationUtils_StepLabelPropsType as StepLabelPropsType, narrationUtils_StepLabelResult as StepLabelResult, narrationUtils_StepLabelResultType as StepLabelResultType, narrationUtils_StepLabelType as StepLabelType,
|
|
54
|
+
export { narrationUtils_ChoiceMenuOption as ChoiceMenuOption, narrationUtils_ChoiceMenuOptionClose as ChoiceMenuOptionClose, narrationUtils_ChoiceMenuOptionsType as ChoiceMenuOptionsType, narrationUtils_Close as Close, narrationUtils_CloseType as CloseType, narrationUtils_Dialogue as Dialogue, Dialogue as DialogueBaseModel, narrationUtils_DialogueType as DialogueType, narrationUtils_HistoryChoiceMenuOption as HistoryChoiceMenuOption, narrationUtils_HistoryStep as HistoryStep, narrationUtils_InputInfo as InputInfo, narrationUtils_Label as Label, narrationUtils_LabelAbstract as LabelAbstract, narrationUtils_LabelProps as LabelProps, narrationUtils_LabelRunModeType as LabelRunModeType, narrationUtils_NarrationGameState as NarrationGameState, narrationUtils_NarrationManagerInterface as NarrationManagerInterface, narrationUtils_NarrationManagerStatic as NarrationManagerStatic, narrationUtils_NarrativeHistory as NarrativeHistory, narrationUtils_OpenedLabel as OpenedLabel, narrationUtils_RegisteredLabels as RegisteredLabels, narrationUtils_StepLabelProps as StepLabelProps, narrationUtils_StepLabelPropsType as StepLabelPropsType, narrationUtils_StepLabelResult as StepLabelResult, narrationUtils_StepLabelResultType as StepLabelResultType, narrationUtils_StepLabelType as StepLabelType, narrationUtils_narration as narration, narrationUtils_newLabel as newLabel };
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
export { narration as a, narrationUtils as n };
|