@drincs/pixi-vn 1.3.13 → 1.3.15

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.
Files changed (83) hide show
  1. package/dist/{classes/index.d.cts → CachedMap-DZLvJAnA.d.cts} +1 -1
  2. package/dist/{classes/index.d.ts → CachedMap-DZLvJAnA.d.ts} +1 -1
  3. package/dist/{OpenedLabel-DxlOwJKw.d.ts → HistoryChoiceMenuOption-BjnxDyK5.d.cts} +47 -2
  4. package/dist/{OpenedLabel-Dgkgemkv.d.cts → HistoryChoiceMenuOption-ZdrL_kYX.d.ts} +47 -2
  5. package/dist/{StorageElementType-DTGcnkzF.d.ts → StorageElementType-dAIVJeiw.d.cts} +1 -1
  6. package/dist/{StorageElementType-DTGcnkzF.d.cts → StorageElementType-dAIVJeiw.d.ts} +1 -1
  7. package/dist/history.cjs +1 -0
  8. package/dist/{history/index.d.ts → history.d.cts} +14 -8
  9. package/dist/{history/index.d.cts → history.d.ts} +14 -8
  10. package/dist/history.mjs +1 -0
  11. package/dist/index.cjs +143 -143
  12. package/dist/index.d.cts +3076 -216
  13. package/dist/index.d.ts +3076 -216
  14. package/dist/index.mjs +143 -143
  15. package/dist/narration.cjs +2 -0
  16. package/dist/{index-_rD16ks5.d.ts → narration.d.cts} +27 -44
  17. package/dist/{index-Bl9hiHQR.d.cts → narration.d.ts} +27 -44
  18. package/dist/narration.mjs +2 -0
  19. package/dist/storage.cjs +1 -0
  20. package/dist/{storage/index.d.ts → storage.d.cts} +75 -6
  21. package/dist/{storage/index.d.cts → storage.d.ts} +75 -6
  22. package/dist/storage.mjs +1 -0
  23. package/dist/unifier.cjs +1 -0
  24. package/dist/unifier.d.cts +230 -0
  25. package/dist/unifier.d.ts +230 -0
  26. package/dist/unifier.mjs +1 -0
  27. package/package.json +29 -2
  28. package/dist/ContainerMemory-CrY9QSo2.d.cts +0 -106
  29. package/dist/ContainerMemory-DrijxCcD.d.ts +0 -106
  30. package/dist/HistoryChoiceMenuOption-Kj_P28ke.d.ts +0 -49
  31. package/dist/HistoryChoiceMenuOption-unaLLfKR.d.cts +0 -49
  32. package/dist/HistoryGameState-i_gx3rGM.d.ts +0 -12
  33. package/dist/HistoryGameState-qeIMl_DH.d.cts +0 -12
  34. package/dist/NarrationGameState-CqDh48n_.d.ts +0 -24
  35. package/dist/NarrationGameState-Cu-OYzph.d.cts +0 -24
  36. package/dist/SoundGameState-BG_iPwjt.d.cts +0 -85
  37. package/dist/SoundGameState-BG_iPwjt.d.ts +0 -85
  38. package/dist/StorageGameState-B2kz-u_2.d.cts +0 -19
  39. package/dist/StorageGameState-Cnfj75sk.d.ts +0 -19
  40. package/dist/StoredClassModel-CjdhvNgB.d.cts +0 -56
  41. package/dist/StoredClassModel-CjdhvNgB.d.ts +0 -56
  42. package/dist/TickersSequence-Cf1Vcu22.d.cts +0 -133
  43. package/dist/TickersSequence-Cf1Vcu22.d.ts +0 -133
  44. package/dist/canvas/index.cjs +0 -3316
  45. package/dist/canvas/index.d.cts +0 -8
  46. package/dist/canvas/index.d.ts +0 -8
  47. package/dist/canvas/index.mjs +0 -3316
  48. package/dist/canvas/tickers/index.cjs +0 -3316
  49. package/dist/canvas/tickers/index.d.cts +0 -467
  50. package/dist/canvas/tickers/index.d.ts +0 -467
  51. package/dist/canvas/tickers/index.mjs +0 -3316
  52. package/dist/character/index.cjs +0 -572
  53. package/dist/character/index.d.cts +0 -3
  54. package/dist/character/index.d.ts +0 -3
  55. package/dist/character/index.mjs +0 -572
  56. package/dist/classes/index.cjs +0 -1
  57. package/dist/classes/index.mjs +0 -1
  58. package/dist/history/index.cjs +0 -1
  59. package/dist/history/index.mjs +0 -1
  60. package/dist/index-B4F3XaWz.d.cts +0 -1767
  61. package/dist/index-Cax-mGq_.d.cts +0 -216
  62. package/dist/index-Cvdua0o-.d.ts +0 -216
  63. package/dist/index-Czfdktw9.d.ts +0 -93
  64. package/dist/index-DZ1shoNp.d.cts +0 -93
  65. package/dist/index-DvpfJ2VQ.d.ts +0 -1767
  66. package/dist/interfaces/index.cjs +0 -1
  67. package/dist/interfaces/index.d.cts +0 -55
  68. package/dist/interfaces/index.d.ts +0 -55
  69. package/dist/interfaces/index.mjs +0 -0
  70. package/dist/narration/index.cjs +0 -573
  71. package/dist/narration/index.d.cts +0 -8
  72. package/dist/narration/index.d.ts +0 -8
  73. package/dist/narration/index.mjs +0 -573
  74. package/dist/sound/index.cjs +0 -572
  75. package/dist/sound/index.d.cts +0 -3
  76. package/dist/sound/index.d.ts +0 -3
  77. package/dist/sound/index.mjs +0 -572
  78. package/dist/storage/index.cjs +0 -1
  79. package/dist/storage/index.mjs +0 -1
  80. package/dist/utils/index.cjs +0 -1
  81. package/dist/utils/index.d.cts +0 -8
  82. package/dist/utils/index.d.ts +0 -8
  83. package/dist/utils/index.mjs +0 -1
@@ -1,9 +1,23 @@
1
1
  import { LRUCache } from 'lru-cache';
2
- import { S as StorageElementType } from '../StorageElementType-DTGcnkzF.cjs';
3
- export { a as StorageObjectType } from '../StorageElementType-DTGcnkzF.cjs';
4
- import { S as StorageGameState, a as StorageGameStateItem } from '../StorageGameState-B2kz-u_2.cjs';
5
- export { S as StoredClassModel } from '../StoredClassModel-CjdhvNgB.cjs';
6
- import { CachedMap } from '../classes/index.cjs';
2
+ import { a as StorageElementType } from './StorageElementType-dAIVJeiw.js';
3
+ export { S as StorageObjectType } from './StorageElementType-dAIVJeiw.js';
4
+ import { C as CachedMap } from './CachedMap-DZLvJAnA.js';
5
+
6
+ interface StorageGameStateItem<T = StorageElementType> {
7
+ key: string;
8
+ value: T;
9
+ }
10
+ /**
11
+ * Interface exported storage data
12
+ */
13
+ type StorageGameState = {
14
+ base: StorageGameStateItem[];
15
+ temp: StorageGameStateItem[];
16
+ tempDeadlines: StorageGameStateItem<number>[];
17
+ flags: string[];
18
+ } | StorageGameStateItem[] | {
19
+ [key: string]: StorageElementType;
20
+ };
7
21
 
8
22
  interface StorageManagerInterface {
9
23
  /**
@@ -96,6 +110,61 @@ interface StorageManagerInterface {
96
110
  restore(data: StorageGameState): void;
97
111
  }
98
112
 
113
+ /**
114
+ * StoredClassModel is a abstract class that contains the methods to store a class in the game.
115
+ * I suggest you extend this class to create your own stored class.
116
+ * @example
117
+ * ```typescript
118
+ * export class CharacterBaseModel extends StoredClassModel implements CharacterBaseModelProps {
119
+ * constructor(id: string, props: CharacterBaseModelProps) {
120
+ * super("___character___", id)
121
+ * this.defaultName = props.name
122
+ * this.defaultSurname = props.surname
123
+ * }
124
+ * private defaultName: string = ""
125
+ * get name(): string {
126
+ * return this.getStorageProperty<string>("name") || this.defaultName
127
+ * }
128
+ * set name(value: string) {
129
+ * this.setStorageProperty<string>("name", value)
130
+ * }
131
+ * private defaultSurname?: string
132
+ * get surname(): string | undefined {
133
+ * return this.getStorageProperty<string>("surname") || this.defaultSurname
134
+ * }
135
+ * set surname(value: string | undefined) {
136
+ * this.setStorageProperty<string>("surname", value)
137
+ * }
138
+ * }
139
+ * ```
140
+ */
141
+ declare class StoredClassModel {
142
+ /**
143
+ * @param categoryId The id of the category. For example if you are storing a character class, you can use "characters" as categoryId. so all instances of the character class will be stored in the "characters" category.
144
+ * @param id The id of instance of the class. This id must be unique for the category.
145
+ */
146
+ constructor(categoryId: string, id: string);
147
+ private _id;
148
+ /**
149
+ * Is id of the stored class. is unique for this class.
150
+ */
151
+ get id(): string;
152
+ private categoryId;
153
+ /**
154
+ * Update a property in the storage.
155
+ * @param propertyName The name of the property to set.
156
+ * @param value The value to set. If is undefined, the property will be removed from the storage.
157
+ */
158
+ protected setStorageProperty<T>(propertyName: string, value: T | undefined): void;
159
+ /**
160
+ * Get a property from the storage.
161
+ * @param propertyName The name of the property to get.
162
+ * @param idToUse The id of the instance to get the property. @default this.id
163
+ * @returns The value of the property. If the property is not found, returns undefined.
164
+ */
165
+ protected getStorageProperty<T>(propertyName: string, idToUse?: string): T | undefined;
166
+ }
167
+
99
168
  declare class StorageManagerStatic {
100
169
  static storage: CachedMap<string, any>;
101
170
  static startingStorage: StorageGameStateItem[];
@@ -113,4 +182,4 @@ declare class StorageManagerStatic {
113
182
 
114
183
  declare const storage: StorageManagerInterface;
115
184
 
116
- export { StorageElementType, StorageGameState, type StorageManagerInterface, StorageManagerStatic, storage };
185
+ export { StorageElementType, type StorageGameState, type StorageManagerInterface, StorageManagerStatic, StoredClassModel, storage };
@@ -0,0 +1 @@
1
+ import {GameUnifier}from'@drincs/pixi-vn/unifier';var Xt=Object.defineProperty;var Ut=l=>{throw TypeError(l)};var Qt=(l,t,i)=>t in l?Xt(l,t,{enumerable:true,configurable:true,writable:true,value:i}):l[t]=i;var m=(l,t,i)=>Qt(l,typeof t!="symbol"?t+"":t,i),Rt=(l,t,i)=>t.has(l)||Ut("Cannot "+i);var e=(l,t,i)=>(Rt(l,t,"read from private field"),i?i.call(l):t.get(l)),S=(l,t,i)=>t.has(l)?Ut("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(l):t.set(l,i),f=(l,t,i,s)=>(Rt(l,t,"write to private field"),t.set(l,i),i),h=(l,t,i)=>(Rt(l,t,"access private method"),i);var Ot=(l,t,i,s)=>({set _(n){f(l,t,n);},get _(){return e(l,t,s)}});var nt;(n=>(n.log=(r,...a)=>console.log(`[Pixi\u2019VN] ${r}`,...a),n.warn=(r,...a)=>console.warn(`[Pixi\u2019VN] ${r}`,...a),n.error=(r,...a)=>console.error(`[Pixi\u2019VN] ${r}`,...a),n.info=(r,...a)=>console.info(`[Pixi\u2019VN] ${r}`,...a)))(nt||(nt={}));function Ft(l){try{if(typeof l>"u")return l;let t=JSON.stringify(l);return JSON.parse(t)}catch(t){throw nt.error("Error creating exportable element",l,t),new Error("[Pixi\u2019VN] Error creating exportable element")}}var ct=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,$t=new Set,Vt=typeof process=="object"&&process?process:{},Bt=(l,t,i,s)=>{typeof Vt.emitWarning=="function"?Vt.emitWarning(l,t,i,s):console.error(`[${i}] ${t}: ${l}`);},zt=globalThis.AbortController,Nt=globalThis.AbortSignal;if(typeof zt>"u"){Nt=class{constructor(){m(this,"onabort");m(this,"_onabort",[]);m(this,"reason");m(this,"aborted",false);}addEventListener(s,n){this._onabort.push(n);}},zt=class{constructor(){m(this,"signal",new Nt);t();}abort(s){if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=true;for(let n of this.signal._onabort)n(s);this.signal.onabort?.(s);}}};let l=Vt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{l&&(l=false,Bt("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t));};}var Zt=l=>!$t.has(l),k=l=>l&&l===Math.floor(l)&&l>0&&isFinite(l),qt=l=>k(l)?l<=Math.pow(2,8)?Uint8Array:l<=Math.pow(2,16)?Uint16Array:l<=Math.pow(2,32)?Uint32Array:l<=Number.MAX_SAFE_INTEGER?ut:null:null,ut=class extends Array{constructor(t){super(t),this.fill(0);}},dt,rt=class rt{constructor(t,i){m(this,"heap");m(this,"length");if(!e(rt,dt))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(t),this.length=0;}static create(t){let i=qt(t);if(!i)return [];f(rt,dt,true);let s=new rt(t,i);return f(rt,dt,false),s}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}};dt=new WeakMap,S(rt,dt,false);var Gt=rt,Ht,Kt,U,G,N,at,H,gt,pt,F,K,T,w,g,I,W,D,v,$,x,B,q,L,J,st,C,mt,o,Wt,ot,Q,_t,M,Jt,ht,St,Et,tt,et,Lt,vt,xt,b,Mt,yt,it,jt,Pt=class Pt{constructor(t){S(this,o);S(this,U);S(this,G);S(this,N);S(this,at);S(this,H);S(this,gt);S(this,pt);m(this,"ttl");m(this,"ttlResolution");m(this,"ttlAutopurge");m(this,"updateAgeOnGet");m(this,"updateAgeOnHas");m(this,"allowStale");m(this,"noDisposeOnSet");m(this,"noUpdateTTL");m(this,"maxEntrySize");m(this,"sizeCalculation");m(this,"noDeleteOnFetchRejection");m(this,"noDeleteOnStaleGet");m(this,"allowStaleOnFetchAbort");m(this,"allowStaleOnFetchRejection");m(this,"ignoreFetchAbort");S(this,F);S(this,K);S(this,T);S(this,w);S(this,g);S(this,I);S(this,W);S(this,D);S(this,v);S(this,$);S(this,x);S(this,B);S(this,q);S(this,L);S(this,J);S(this,st);S(this,C);S(this,mt);S(this,ot,()=>{});S(this,Q,()=>{});S(this,_t,()=>{});S(this,M,()=>false);S(this,ht,t=>{});S(this,St,(t,i,s)=>{});S(this,Et,(t,i,s,n)=>{if(s||n)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});m(this,Ht,"LRUCache");let{max:i=0,ttl:s,ttlResolution:n=1,ttlAutopurge:r,updateAgeOnGet:a,updateAgeOnHas:d,allowStale:c,dispose:O,onInsert:Y,disposeAfter:y,noDisposeOnSet:Z,noUpdateTTL:j,maxSize:X=0,maxEntrySize:E=0,sizeCalculation:_,fetchMethod:p,memoMethod:R,noDeleteOnFetchRejection:V,noDeleteOnStaleGet:z,allowStaleOnFetchRejection:P,allowStaleOnFetchAbort:wt,ignoreFetchAbort:lt}=t;if(i!==0&&!k(i))throw new TypeError("max option must be a nonnegative integer");let At=i?qt(i):Array;if(!At)throw new Error("invalid max value: "+i);if(f(this,U,i),f(this,G,X),this.maxEntrySize=E||e(this,G),this.sizeCalculation=_,this.sizeCalculation){if(!e(this,G)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(R!==void 0&&typeof R!="function")throw new TypeError("memoMethod must be a function if defined");if(f(this,pt,R),p!==void 0&&typeof p!="function")throw new TypeError("fetchMethod must be a function if specified");if(f(this,gt,p),f(this,st,!!p),f(this,T,new Map),f(this,w,new Array(i).fill(void 0)),f(this,g,new Array(i).fill(void 0)),f(this,I,new At(i)),f(this,W,new At(i)),f(this,D,0),f(this,v,0),f(this,$,Gt.create(i)),f(this,F,0),f(this,K,0),typeof O=="function"&&f(this,N,O),typeof Y=="function"&&f(this,at,Y),typeof y=="function"?(f(this,H,y),f(this,x,[])):(f(this,H,void 0),f(this,x,void 0)),f(this,J,!!e(this,N)),f(this,mt,!!e(this,at)),f(this,C,!!e(this,H)),this.noDisposeOnSet=!!Z,this.noUpdateTTL=!!j,this.noDeleteOnFetchRejection=!!V,this.allowStaleOnFetchRejection=!!P,this.allowStaleOnFetchAbort=!!wt,this.ignoreFetchAbort=!!lt,this.maxEntrySize!==0){if(e(this,G)!==0&&!k(e(this,G)))throw new TypeError("maxSize must be a positive integer if specified");if(!k(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");h(this,o,Jt).call(this);}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!z,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!d,this.ttlResolution=k(n)||n===0?n:1,this.ttlAutopurge=!!r,this.ttl=s||0,this.ttl){if(!k(this.ttl))throw new TypeError("ttl must be a positive integer if specified");h(this,o,Wt).call(this);}if(e(this,U)===0&&this.ttl===0&&e(this,G)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!e(this,U)&&!e(this,G)){let ft="LRU_CACHE_UNBOUNDED";Zt(ft)&&($t.add(ft),Bt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",ft,Pt));}}static unsafeExposeInternals(t){return {starts:e(t,q),ttls:e(t,L),sizes:e(t,B),keyMap:e(t,T),keyList:e(t,w),valList:e(t,g),next:e(t,I),prev:e(t,W),get head(){return e(t,D)},get tail(){return e(t,v)},free:e(t,$),isBackgroundFetch:i=>{var s;return h(s=t,o,b).call(s,i)},backgroundFetch:(i,s,n,r)=>{var a;return h(a=t,o,xt).call(a,i,s,n,r)},moveToTail:i=>{var s;return h(s=t,o,yt).call(s,i)},indexes:i=>{var s;return h(s=t,o,tt).call(s,i)},rindexes:i=>{var s;return h(s=t,o,et).call(s,i)},isStale:i=>{var s;return e(s=t,M).call(s,i)}}}get max(){return e(this,U)}get maxSize(){return e(this,G)}get calculatedSize(){return e(this,K)}get size(){return e(this,F)}get fetchMethod(){return e(this,gt)}get memoMethod(){return e(this,pt)}get dispose(){return e(this,N)}get onInsert(){return e(this,at)}get disposeAfter(){return e(this,H)}getRemainingTTL(t){return e(this,T).has(t)?1/0:0}*entries(){for(let t of h(this,o,tt).call(this))e(this,g)[t]!==void 0&&e(this,w)[t]!==void 0&&!h(this,o,b).call(this,e(this,g)[t])&&(yield [e(this,w)[t],e(this,g)[t]]);}*rentries(){for(let t of h(this,o,et).call(this))e(this,g)[t]!==void 0&&e(this,w)[t]!==void 0&&!h(this,o,b).call(this,e(this,g)[t])&&(yield [e(this,w)[t],e(this,g)[t]]);}*keys(){for(let t of h(this,o,tt).call(this)){let i=e(this,w)[t];i!==void 0&&!h(this,o,b).call(this,e(this,g)[t])&&(yield i);}}*rkeys(){for(let t of h(this,o,et).call(this)){let i=e(this,w)[t];i!==void 0&&!h(this,o,b).call(this,e(this,g)[t])&&(yield i);}}*values(){for(let t of h(this,o,tt).call(this))e(this,g)[t]!==void 0&&!h(this,o,b).call(this,e(this,g)[t])&&(yield e(this,g)[t]);}*rvalues(){for(let t of h(this,o,et).call(this))e(this,g)[t]!==void 0&&!h(this,o,b).call(this,e(this,g)[t])&&(yield e(this,g)[t]);}[(Kt=Symbol.iterator,Ht=Symbol.toStringTag,Kt)](){return this.entries()}find(t,i={}){for(let s of h(this,o,tt).call(this)){let n=e(this,g)[s],r=h(this,o,b).call(this,n)?n.__staleWhileFetching:n;if(r!==void 0&&t(r,e(this,w)[s],this))return this.get(e(this,w)[s],i)}}forEach(t,i=this){for(let s of h(this,o,tt).call(this)){let n=e(this,g)[s],r=h(this,o,b).call(this,n)?n.__staleWhileFetching:n;r!==void 0&&t.call(i,r,e(this,w)[s],this);}}rforEach(t,i=this){for(let s of h(this,o,et).call(this)){let n=e(this,g)[s],r=h(this,o,b).call(this,n)?n.__staleWhileFetching:n;r!==void 0&&t.call(i,r,e(this,w)[s],this);}}purgeStale(){let t=false;for(let i of h(this,o,et).call(this,{allowStale:true}))e(this,M).call(this,i)&&(h(this,o,it).call(this,e(this,w)[i],"expire"),t=true);return t}info(t){let i=e(this,T).get(t);if(i===void 0)return;let s=e(this,g)[i],n=h(this,o,b).call(this,s)?s.__staleWhileFetching:s;if(n===void 0)return;let r={value:n};if(e(this,L)&&e(this,q)){let a=e(this,L)[i],d=e(this,q)[i];if(a&&d){let c=a-(ct.now()-d);r.ttl=c,r.start=Date.now();}}return e(this,B)&&(r.size=e(this,B)[i]),r}dump(){let t=[];for(let i of h(this,o,tt).call(this,{allowStale:true})){let s=e(this,w)[i],n=e(this,g)[i],r=h(this,o,b).call(this,n)?n.__staleWhileFetching:n;if(r===void 0||s===void 0)continue;let a={value:r};if(e(this,L)&&e(this,q)){a.ttl=e(this,L)[i];let d=ct.now()-e(this,q)[i];a.start=Math.floor(Date.now()-d);}e(this,B)&&(a.size=e(this,B)[i]),t.unshift([s,a]);}return t}load(t){this.clear();for(let[i,s]of t){if(s.start){let n=Date.now()-s.start;s.start=ct.now()-n;}this.set(i,s.value,s);}}set(t,i,s={}){var Z,j,X,E;if(i===void 0)return this.delete(t),this;let{ttl:n=this.ttl,start:r,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:d=this.sizeCalculation,status:c}=s,{noUpdateTTL:O=this.noUpdateTTL}=s,Y=e(this,Et).call(this,t,i,s.size||0,d);if(this.maxEntrySize&&Y>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=true),h(this,o,it).call(this,t,"set"),this;let y=e(this,F)===0?void 0:e(this,T).get(t);if(y===void 0)y=e(this,F)===0?e(this,v):e(this,$).length!==0?e(this,$).pop():e(this,F)===e(this,U)?h(this,o,vt).call(this,false):e(this,F),e(this,w)[y]=t,e(this,g)[y]=i,e(this,T).set(t,y),e(this,I)[e(this,v)]=y,e(this,W)[y]=e(this,v),f(this,v,y),Ot(this,F)._++,e(this,St).call(this,y,Y,c),c&&(c.set="add"),O=false,e(this,mt)&&((Z=e(this,at))==null||Z.call(this,i,t,"add"));else {h(this,o,yt).call(this,y);let _=e(this,g)[y];if(i!==_){if(e(this,st)&&h(this,o,b).call(this,_)){_.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=_;p!==void 0&&!a&&(e(this,J)&&((j=e(this,N))==null||j.call(this,p,t,"set")),e(this,C)&&e(this,x)?.push([p,t,"set"]));}else a||(e(this,J)&&((X=e(this,N))==null||X.call(this,_,t,"set")),e(this,C)&&e(this,x)?.push([_,t,"set"]));if(e(this,ht).call(this,y),e(this,St).call(this,y,Y,c),e(this,g)[y]=i,c){c.set="replace";let p=_&&h(this,o,b).call(this,_)?_.__staleWhileFetching:_;p!==void 0&&(c.oldValue=p);}}else c&&(c.set="update");e(this,mt)&&this.onInsert?.(i,t,i===_?"update":"replace");}if(n!==0&&!e(this,L)&&h(this,o,Wt).call(this),e(this,L)&&(O||e(this,_t).call(this,y,n,r),c&&e(this,Q).call(this,c,y)),!a&&e(this,C)&&e(this,x)){let _=e(this,x),p;for(;p=_?.shift();)(E=e(this,H))==null||E.call(this,...p);}return this}pop(){var t;try{for(;e(this,F);){let i=e(this,g)[e(this,D)];if(h(this,o,vt).call(this,!0),h(this,o,b).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(e(this,C)&&e(this,x)){let i=e(this,x),s;for(;s=i?.shift();)(t=e(this,H))==null||t.call(this,...s);}}}has(t,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:n}=i,r=e(this,T).get(t);if(r!==void 0){let a=e(this,g)[r];if(h(this,o,b).call(this,a)&&a.__staleWhileFetching===void 0)return false;if(e(this,M).call(this,r))n&&(n.has="stale",e(this,Q).call(this,n,r));else return s&&e(this,ot).call(this,r),n&&(n.has="hit",e(this,Q).call(this,n,r)),true}else n&&(n.has="miss");return false}peek(t,i={}){let{allowStale:s=this.allowStale}=i,n=e(this,T).get(t);if(n===void 0||!s&&e(this,M).call(this,n))return;let r=e(this,g)[n];return h(this,o,b).call(this,r)?r.__staleWhileFetching:r}async fetch(t,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:d=this.noDisposeOnSet,size:c=0,sizeCalculation:O=this.sizeCalculation,noUpdateTTL:Y=this.noUpdateTTL,noDeleteOnFetchRejection:y=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:Z=this.allowStaleOnFetchRejection,ignoreFetchAbort:j=this.ignoreFetchAbort,allowStaleOnFetchAbort:X=this.allowStaleOnFetchAbort,context:E,forceRefresh:_=false,status:p,signal:R}=i;if(!e(this,st))return p&&(p.fetch="get"),this.get(t,{allowStale:s,updateAgeOnGet:n,noDeleteOnStaleGet:r,status:p});let V={allowStale:s,updateAgeOnGet:n,noDeleteOnStaleGet:r,ttl:a,noDisposeOnSet:d,size:c,sizeCalculation:O,noUpdateTTL:Y,noDeleteOnFetchRejection:y,allowStaleOnFetchRejection:Z,allowStaleOnFetchAbort:X,ignoreFetchAbort:j,status:p,signal:R},z=e(this,T).get(t);if(z===void 0){p&&(p.fetch="miss");let P=h(this,o,xt).call(this,t,z,V,E);return P.__returned=P}else {let P=e(this,g)[z];if(h(this,o,b).call(this,P)){let Ct=s&&P.__staleWhileFetching!==void 0;return p&&(p.fetch="inflight",Ct&&(p.returnedStale=true)),Ct?P.__staleWhileFetching:P.__returned=P}let wt=e(this,M).call(this,z);if(!_&&!wt)return p&&(p.fetch="hit"),h(this,o,yt).call(this,z),n&&e(this,ot).call(this,z),p&&e(this,Q).call(this,p,z),P;let lt=h(this,o,xt).call(this,t,z,V,E),ft=lt.__staleWhileFetching!==void 0&&s;return p&&(p.fetch=wt?"stale":"refresh",ft&&wt&&(p.returnedStale=true)),ft?lt.__staleWhileFetching:lt.__returned=lt}}async forceFetch(t,i={}){let s=await this.fetch(t,i);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(t,i={}){let s=e(this,pt);if(!s)throw new Error("no memoMethod provided to constructor");let{context:n,forceRefresh:r,...a}=i,d=this.get(t,a);if(!r&&d!==void 0)return d;let c=s(t,d,{options:a,context:n});return this.set(t,c,a),c}get(t,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:a}=i,d=e(this,T).get(t);if(d!==void 0){let c=e(this,g)[d],O=h(this,o,b).call(this,c);return a&&e(this,Q).call(this,a,d),e(this,M).call(this,d)?(a&&(a.get="stale"),O?(a&&s&&c.__staleWhileFetching!==void 0&&(a.returnedStale=true),s?c.__staleWhileFetching:void 0):(r||h(this,o,it).call(this,t,"expire"),a&&s&&(a.returnedStale=true),s?c:void 0)):(a&&(a.get="hit"),O?c.__staleWhileFetching:(h(this,o,yt).call(this,d),n&&e(this,ot).call(this,d),c))}else a&&(a.get="miss");}delete(t){return h(this,o,it).call(this,t,"delete")}clear(){return h(this,o,jt).call(this,"delete")}};U=new WeakMap,G=new WeakMap,N=new WeakMap,at=new WeakMap,H=new WeakMap,gt=new WeakMap,pt=new WeakMap,F=new WeakMap,K=new WeakMap,T=new WeakMap,w=new WeakMap,g=new WeakMap,I=new WeakMap,W=new WeakMap,D=new WeakMap,v=new WeakMap,$=new WeakMap,x=new WeakMap,B=new WeakMap,q=new WeakMap,L=new WeakMap,J=new WeakMap,st=new WeakMap,C=new WeakMap,mt=new WeakMap,o=new WeakSet,Wt=function(){let t=new ut(e(this,U)),i=new ut(e(this,U));f(this,L,t),f(this,q,i),f(this,_t,(r,a,d=ct.now())=>{if(i[r]=a!==0?d:0,t[r]=a,a!==0&&this.ttlAutopurge){let c=setTimeout(()=>{e(this,M).call(this,r)&&h(this,o,it).call(this,e(this,w)[r],"expire");},a+1);c.unref&&c.unref();}}),f(this,ot,r=>{i[r]=t[r]!==0?ct.now():0;}),f(this,Q,(r,a)=>{if(t[a]){let d=t[a],c=i[a];if(!d||!c)return;r.ttl=d,r.start=c,r.now=s||n();let O=r.now-c;r.remainingTTL=d-O;}});let s=0,n=()=>{let r=ct.now();if(this.ttlResolution>0){s=r;let a=setTimeout(()=>s=0,this.ttlResolution);a.unref&&a.unref();}return r};this.getRemainingTTL=r=>{let a=e(this,T).get(r);if(a===void 0)return 0;let d=t[a],c=i[a];if(!d||!c)return 1/0;let O=(s||n())-c;return d-O},f(this,M,r=>{let a=i[r],d=t[r];return !!d&&!!a&&(s||n())-a>d});},ot=new WeakMap,Q=new WeakMap,_t=new WeakMap,M=new WeakMap,Jt=function(){let t=new ut(e(this,U));f(this,K,0),f(this,B,t),f(this,ht,i=>{f(this,K,e(this,K)-t[i]),t[i]=0;}),f(this,Et,(i,s,n,r)=>{if(h(this,o,b).call(this,s))return 0;if(!k(n))if(r){if(typeof r!="function")throw new TypeError("sizeCalculation must be a function");if(n=r(s,i),!k(n))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return n}),f(this,St,(i,s,n)=>{if(t[i]=s,e(this,G)){let r=e(this,G)-t[i];for(;e(this,K)>r;)h(this,o,vt).call(this,true);}f(this,K,e(this,K)+t[i]),n&&(n.entrySize=s,n.totalCalculatedSize=e(this,K));});},ht=new WeakMap,St=new WeakMap,Et=new WeakMap,tt=function*({allowStale:t=this.allowStale}={}){if(e(this,F))for(let i=e(this,v);!(!h(this,o,Lt).call(this,i)||((t||!e(this,M).call(this,i))&&(yield i),i===e(this,D)));)i=e(this,W)[i];},et=function*({allowStale:t=this.allowStale}={}){if(e(this,F))for(let i=e(this,D);!(!h(this,o,Lt).call(this,i)||((t||!e(this,M).call(this,i))&&(yield i),i===e(this,v)));)i=e(this,I)[i];},Lt=function(t){return t!==void 0&&e(this,T).get(e(this,w)[t])===t},vt=function(t){var r;let i=e(this,D),s=e(this,w)[i],n=e(this,g)[i];return e(this,st)&&h(this,o,b).call(this,n)?n.__abortController.abort(new Error("evicted")):(e(this,J)||e(this,C))&&(e(this,J)&&((r=e(this,N))==null||r.call(this,n,s,"evict")),e(this,C)&&e(this,x)?.push([n,s,"evict"])),e(this,ht).call(this,i),t&&(e(this,w)[i]=void 0,e(this,g)[i]=void 0,e(this,$).push(i)),e(this,F)===1?(f(this,D,f(this,v,0)),e(this,$).length=0):f(this,D,e(this,I)[i]),e(this,T).delete(s),Ot(this,F)._--,i},xt=function(t,i,s,n){let r=i===void 0?void 0:e(this,g)[i];if(h(this,o,b).call(this,r))return r;let a=new zt,{signal:d}=s;d?.addEventListener("abort",()=>a.abort(d.reason),{signal:a.signal});let c={signal:a.signal,options:s,context:n},O=(E,_=false)=>{let{aborted:p}=a.signal,R=s.ignoreFetchAbort&&E!==void 0;if(s.status&&(p&&!_?(s.status.fetchAborted=true,s.status.fetchError=a.signal.reason,R&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),p&&!R&&!_)return y(a.signal.reason);let V=j;return e(this,g)[i]===j&&(E===void 0?V.__staleWhileFetching?e(this,g)[i]=V.__staleWhileFetching:h(this,o,it).call(this,t,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(t,E,c.options))),E},Y=E=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=E),y(E)),y=E=>{let{aborted:_}=a.signal,p=_&&s.allowStaleOnFetchAbort,R=p||s.allowStaleOnFetchRejection,V=R||s.noDeleteOnFetchRejection,z=j;if(e(this,g)[i]===j&&(!V||z.__staleWhileFetching===void 0?h(this,o,it).call(this,t,"fetch"):p||(e(this,g)[i]=z.__staleWhileFetching)),R)return s.status&&z.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),z.__staleWhileFetching;if(z.__returned===z)throw E},Z=(E,_)=>{var R;let p=(R=e(this,gt))==null?void 0:R.call(this,t,r,c);p&&p instanceof Promise&&p.then(V=>E(V===void 0?void 0:V),_),a.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(E(void 0),s.allowStaleOnFetchAbort&&(E=V=>O(V,true)));});};s.status&&(s.status.fetchDispatched=true);let j=new Promise(Z).then(O,Y),X=Object.assign(j,{__abortController:a,__staleWhileFetching:r,__returned:void 0});return i===void 0?(this.set(t,X,{...c.options,status:void 0}),i=e(this,T).get(t)):e(this,g)[i]=X,X},b=function(t){if(!e(this,st))return false;let i=t;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof zt},Mt=function(t,i){e(this,W)[i]=t,e(this,I)[t]=i;},yt=function(t){t!==e(this,v)&&(t===e(this,D)?f(this,D,e(this,I)[t]):h(this,o,Mt).call(this,e(this,W)[t],e(this,I)[t]),h(this,o,Mt).call(this,e(this,v),t),f(this,v,t));},it=function(t,i){var n,r;let s=false;if(e(this,F)!==0){let a=e(this,T).get(t);if(a!==void 0)if(s=true,e(this,F)===1)h(this,o,jt).call(this,i);else {e(this,ht).call(this,a);let d=e(this,g)[a];if(h(this,o,b).call(this,d)?d.__abortController.abort(new Error("deleted")):(e(this,J)||e(this,C))&&(e(this,J)&&((n=e(this,N))==null||n.call(this,d,t,i)),e(this,C)&&e(this,x)?.push([d,t,i])),e(this,T).delete(t),e(this,w)[a]=void 0,e(this,g)[a]=void 0,a===e(this,v))f(this,v,e(this,W)[a]);else if(a===e(this,D))f(this,D,e(this,I)[a]);else {let c=e(this,W)[a];e(this,I)[c]=e(this,I)[a];let O=e(this,I)[a];e(this,W)[O]=e(this,W)[a];}Ot(this,F)._--,e(this,$).push(a);}}if(e(this,C)&&e(this,x)?.length){let a=e(this,x),d;for(;d=a?.shift();)(r=e(this,H))==null||r.call(this,...d);}return s},jt=function(t){var i,s;for(let n of h(this,o,et).call(this,{allowStale:true})){let r=e(this,g)[n];if(h(this,o,b).call(this,r))r.__abortController.abort(new Error("deleted"));else {let a=e(this,w)[n];e(this,J)&&((i=e(this,N))==null||i.call(this,r,a,t)),e(this,C)&&e(this,x)?.push([r,a,t]);}}if(e(this,T).clear(),e(this,g).fill(void 0),e(this,w).fill(void 0),e(this,L)&&e(this,q)&&(e(this,L).fill(0),e(this,q).fill(0)),e(this,B)&&e(this,B).fill(0),f(this,D,0),f(this,v,0),e(this,$).length=0,f(this,K,0),f(this,F,0),e(this,C)&&e(this,x)){let n=e(this,x),r;for(;r=n?.shift();)(s=e(this,H))==null||s.call(this,...r);}};var Dt=Pt;var bt=class{constructor(t){m(this,"cache");m(this,"map",new Map);this.cache=new Dt({max:t.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(t){let i=this.map.delete(t);return i&&this.cache.delete(t),i}get forEach(){return this.map.forEach}get(t){let i=this.cache.get(t);return i||this.map.get(t)}has(t){return this.map.has(t)}set(t,i){return this.map.set(t,i),this.cache.set(t,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var A=class A{constructor(){}static clearOldTempVariables(t){A.tempStorageDeadlines.forEach((i,s)=>{i>t&&(A.tempStorage.delete(s),A.tempStorageDeadlines.delete(s),A.storage.cache.delete(s));});}static setVariable(t,i){let s=A.tempStorage.has(t);i==null?(A.storage.map.delete(t),!s&&A.storage.cache.delete(t)):(A.storage.map.set(t,i),!s&&A.storage.cache.set(t,i));}static getVariable(t){let i=A.storage.cache.get(t);return i===void 0&&(i=A.tempStorage.get(t)),i===void 0&&(i=A.storage.map.get(t)),Ft(i)}static removeVariable(t){A.storage.delete(t);}static setFlag(t,i){if(i)this.flags.includes(t)||this.flags.push(t);else {let s=this.flags.indexOf(t);s>-1&&this.flags.splice(s,1);}}static getFlag(t){return this.flags.includes(t)}};m(A,"storage",new bt({cacheSize:20})),m(A,"startingStorage",[]),m(A,"flags",Array()),m(A,"tempStorage",new Map),m(A,"tempStorageDeadlines",new Map);var u=A;var Tt=class{get storage(){return u.storage.map}get cache(){return u.storage.cache}get flags(){return u.flags}get tempStorage(){return u.tempStorage}get tempStorageDeadlines(){return u.tempStorageDeadlines}set startingStorage(t){let i=[],s=GameUnifier.stepCounter===0;Object.entries(t).forEach(([n,r])=>{i.push({key:n,value:r}),s&&u.storage.set(n,r);}),u.startingStorage=i;}setVariable(t,i){return u.setVariable(t,i)}getVariable(t){return u.getVariable(t)}removeVariable(t){return u.removeVariable(t)}setTempVariable(t,i){if(i==null){this.removeTempVariable(t);return}else u.tempStorage.set(t,i),u.storage.cache.set(t,i),u.tempStorageDeadlines.has(t)||u.tempStorageDeadlines.set(t,GameUnifier.openedLabels);}removeTempVariable(t){u.tempStorage.has(t)&&(u.tempStorage.delete(t),u.tempStorageDeadlines.delete(t),u.storage.cache.delete(t));}setFlag(t,i){return u.setFlag(t,i)}getFlag(t){return u.getFlag(t)}clear(){this.storage.clear(),this.cache.clear(),u.flags=[],u.tempStorage.clear(),u.tempStorageDeadlines.clear(),u.startingStorage.forEach(({key:t,value:i})=>{this.storage.set(t,i);});}export(){let t=[];[...this.storage.keys()].forEach(n=>{t.push({key:n,value:this.storage.get(n)});});let i=[];[...u.tempStorage.keys()].forEach(n=>{i.push({key:n,value:u.tempStorage.get(n)});});let s=[];return [...u.tempStorageDeadlines.keys()].forEach(n=>{s.push({key:n,value:u.tempStorageDeadlines.get(n)});}),Ft({base:t,temp:i,tempDeadlines:s,flags:u.flags})}restore(t){this.clear();try{t?(Array.isArray(t)&&t.forEach(i=>{if(i.key==="___temp_storage___"){let s=i.value;Object.entries(s).forEach(([n,r])=>{u.tempStorage.set(n,r);});}else if(i.key==="___temp_storage_deadlines___"){let s=i.value;Object.entries(s).forEach(([n,r])=>{u.tempStorageDeadlines.set(n,r);});}else i.key==="___flags___"?i.value.forEach(n=>{u.flags.push(n);}):this.storage.set(i.key,i.value);}),"base"in t&&"temp"in t&&"tempDeadlines"in t?(t.base?.forEach(i=>{this.storage.set(i.key,i.value);}),t.temp?.forEach(i=>{u.tempStorage.set(i.key,i.value);}),t.tempDeadlines?.forEach(i=>{u.tempStorageDeadlines.set(i.key,i.value);})):Object.entries(t).forEach(([i,s])=>{i==="___temp_storage___"?Object.entries(s).forEach(([n,r])=>{u.tempStorage.set(n,r);}):i==="___temp_storage_deadlines___"?Object.entries(s).forEach(([n,r])=>{u.tempStorageDeadlines.set(n,r);}):i==="___flags___"?s.forEach(n=>{u.flags.push(n);}):this.storage.set(i,s);})):nt.warn("No storage data found");}catch(i){nt.error("Error importing data",i);}}};var It=class{constructor(t,i){m(this,"_id");m(this,"categoryId");this.categoryId=t,this._id=i;}get id(){return this._id}setStorageProperty(t,i){let s=u.getVariable(this.categoryId);s||(s={}),s.hasOwnProperty(this.id)||(s[this.id]={}),i==null?s[this.id].hasOwnProperty(t)&&delete s[this.id][t]:s[this.id]={...s[this.id],[t]:i},Object.keys(s[this.id]).length===0&&delete s[this.id],u.setVariable(this.categoryId,s);}getStorageProperty(t,i=this.id){let s=u.getVariable(this.categoryId);if(s&&s.hasOwnProperty(i)&&s[i].hasOwnProperty(t))return s[i][t]}};var Fe=new Tt;export{u as StorageManagerStatic,It as StoredClassModel,Fe as storage};
@@ -0,0 +1 @@
1
+ 'use strict';var d=Object.defineProperty;var u=(n,t,m)=>t in n?d(n,t,{enumerable:true,configurable:true,writable:true,value:m}):n[t]=m;var r=(n,t,m)=>u(n,typeof t!="symbol"?t+"":t,m);var i;(l=>(l.log=(a,...o)=>console.log(`[Pixi\u2019VN] ${a}`,...o),l.warn=(a,...o)=>console.warn(`[Pixi\u2019VN] ${a}`,...o),l.error=(a,...o)=>console.error(`[Pixi\u2019VN] ${a}`,...o),l.info=(a,...o)=>console.info(`[Pixi\u2019VN] ${a}`,...o)))(i||(i={}));var e=class e{static init(t){e._getStepCounter=t.getStepCounter,e._setStepCounter=t.setStepCounter,e._getCurrentGameStepState=t.getCurrentGameStepState,e._restoreGameStepState=t.restoreGameStepState,e._getOpenedLabels=t.getOpenedLabels,t.onGoNextEnd&&(e._onGoNextEnd=t.onGoNextEnd),e._getVariable=t.getVariable,e._setVariable=t.setVariable,e._removeVariable=t.removeVariable,e._getFlag=t.getFlag,e._setFlag=t.setFlag,t.onLabelClosing&&(e._onLabelClosing=t.onLabelClosing),e._addHistoryItem=t.addHistoryItem,e._getCurrentStepsRunningNumber=t.getCurrentStepsRunningNumber,e._getCharacter=t.getCharacter;}static get stepCounter(){return e._getStepCounter()}static set stepCounter(t){e._setStepCounter(t);}static get currentGameStepState(){return e._getCurrentGameStepState()}static get restoreGameStepState(){return e._restoreGameStepState}static get openedLabels(){return e._getOpenedLabels()}static get onGoNextEnd(){return e._onGoNextEnd}static get getVariable(){return e._getVariable}static get setVariable(){return e._setVariable}static get removeVariable(){return e._removeVariable}static get getFlag(){return e._getFlag}static get setFlag(){return e._setFlag}static get onLabelClosing(){return e._onLabelClosing}static get addHistoryItem(){return e._addHistoryItem}static get currentStepsRunningNumber(){return e._getCurrentStepsRunningNumber()}static get getCharacter(){return e._getCharacter}};r(e,"_getStepCounter",()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),r(e,"_setStepCounter",()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),r(e,"_getCurrentGameStepState",()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),r(e,"_restoreGameStepState",()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),r(e,"_getOpenedLabels",()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),r(e,"_onGoNextEnd",async()=>{}),r(e,"_getVariable",()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),r(e,"_setVariable",()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),r(e,"_removeVariable",()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),r(e,"_getFlag",()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),r(e,"_setFlag",()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),r(e,"_onLabelClosing",()=>{}),r(e,"_addHistoryItem",()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),r(e,"_getCurrentStepsRunningNumber",()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),r(e,"_getCharacter",()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")}),r(e,"onEnd"),r(e,"onError");var s=e;exports.GameUnifier=s;
@@ -0,0 +1,230 @@
1
+ import { StepLabelProps, StepLabelResult, GameStepState, HistoryInfo, CharacterInterface } from '@drincs/pixi-vn';
2
+
3
+ type StepLabelResultType = StepLabelResult | void;
4
+ type StepLabelPropsType<T extends {} = {}> = StepLabelProps & T;
5
+ /**
6
+ * StepLabel is a function that will be executed as the game continues.
7
+ */
8
+ type StepLabelType<T extends {} = {}> = (props: StepLabelPropsType<T>, info: {
9
+ /**
10
+ * The id of the label.
11
+ */
12
+ labelId: string;
13
+ }) => StepLabelResultType | Promise<StepLabelResultType>;
14
+
15
+ type StorageElementPrimaryType = string | number | boolean | undefined | null | StorageElementPrimaryType[];
16
+ type StorageElementInternalType = StorageElementPrimaryType | Record<string | number | symbol, StorageElementPrimaryType> | StorageElementInternalType[];
17
+ /**
18
+ * StorageElementType are all the types that can be stored in the storage
19
+ */
20
+ type StorageElementType = StorageElementInternalType | Record<string | number | symbol, StorageElementInternalType> | {
21
+ [key: string | number | symbol]: StorageElementType;
22
+ } | StorageObjectType[] | (StorageElementPrimaryType | StorageElementInternalType | StorageElementType)[];
23
+ /**
24
+ * StorageObjectType are all the types that can be stored in the storage
25
+ */
26
+ type StorageObjectType = Record<string | number | symbol, StorageElementType>;
27
+
28
+ declare class GameUnifier {
29
+ static init(options: {
30
+ /**
31
+ * This function returns the current step counter. This counter corresponds to the total number of steps that have been executed so far.
32
+ *
33
+ * If your game engine does not have a history of steps, you can return 0.
34
+ */
35
+ getStepCounter: () => number;
36
+ /**
37
+ * This function sets the current step counter.
38
+ *
39
+ * If your game engine does not have a history of steps, you can not set the step counter.
40
+ */
41
+ setStepCounter: (value: number) => void;
42
+ /**
43
+ * This function returns the current state of the game step.
44
+ *
45
+ * If your game engine does not have a history of steps, you can return an empty object.
46
+ */
47
+ getCurrentGameStepState: () => GameStepState;
48
+ /**
49
+ * This function restores the game step state.
50
+ *
51
+ * If your game engine does not have a history of steps, you can return a resolved promise.
52
+ *
53
+ * @param state The state to restore.
54
+ * @param navigate The function to navigate to the restored path.
55
+ */
56
+ restoreGameStepState: (state: GameStepState, navigate: (path: string) => void | Promise<void>) => Promise<void>;
57
+ /**
58
+ * This function returns the number of opened labels.
59
+ *
60
+ * If your game engine does not have a narration system, you can return 0.
61
+ */
62
+ getOpenedLabels: () => number;
63
+ /**
64
+ * This function is called after the narration.goNext() method is executed.
65
+ * It can be used to force the completion of the ticker in the game engine.
66
+ */
67
+ onGoNextEnd?: () => Promise<void>;
68
+ /**
69
+ * This function returns the value of a variable.
70
+ * @param key The key of the variable.
71
+ * @returns The value of the variable.
72
+ */
73
+ getVariable: <T extends StorageElementType>(key: string) => T | undefined;
74
+ /**
75
+ * This function sets the value of a variable.
76
+ * @param key The key of the variable.
77
+ * @param value The value of the variable.
78
+ */
79
+ setVariable: (key: string, value: StorageElementType) => void;
80
+ /**
81
+ * This function removes a variable.
82
+ * @param key The key of the variable.
83
+ */
84
+ removeVariable: (key: string) => void;
85
+ /**
86
+ * This function returns the value of a flag.
87
+ * @param name The name of the flag.
88
+ */
89
+ getFlag: (name: string) => boolean;
90
+ /**
91
+ * This function sets the value of a flag.
92
+ * @param name The name of the flag.
93
+ * @param value The value of the flag.
94
+ */
95
+ setFlag: (name: string, value: boolean) => void;
96
+ /**
97
+ * This function is called after the narration.goNext() method is executed.
98
+ *
99
+ * It can be used to clear old temporary variables.
100
+ *
101
+ * @param openedLabelsNumber The number of opened labels.
102
+ */
103
+ onLabelClosing?: (openedLabelsNumber: number) => void;
104
+ /**
105
+ * Add a history step to the history.
106
+ *
107
+ * If your game engine does not have a history of steps, you can return a resolved promise.
108
+ *
109
+ * @param historyInfo The history information.
110
+ * @param opstions Options to add the step.
111
+ */
112
+ addHistoryItem(historyInfo?: HistoryInfo, opstions?: {
113
+ /**
114
+ * If true, the step will not be added to the history if the current step is the same as the last step.
115
+ */
116
+ ignoreSameStep?: boolean;
117
+ }): void;
118
+ /**
119
+ * This function returns the number of steps that are currently running.
120
+ */
121
+ getCurrentStepsRunningNumber: () => number;
122
+ /**
123
+ * This function returns the character by its id.
124
+ * @param id The id of the character.
125
+ * @returns The character or undefined if it does not exist.
126
+ */
127
+ getCharacter: (id: string) => CharacterInterface | undefined;
128
+ }): void;
129
+ private static _getStepCounter;
130
+ private static _setStepCounter;
131
+ /**
132
+ * Returns the current step counter. This counter corresponds to the total number of steps that have been executed so far.
133
+ */
134
+ static get stepCounter(): number;
135
+ /**
136
+ * Returns the current state of the game step.
137
+ */
138
+ static set stepCounter(value: number);
139
+ private static _getCurrentGameStepState;
140
+ /**
141
+ * Returns the current state of the game step.
142
+ */
143
+ static get currentGameStepState(): GameStepState;
144
+ private static _restoreGameStepState;
145
+ /**
146
+ * Restores the game step state.
147
+ * @param state The state to restore.
148
+ * @param navigate The function to navigate to the restored path.
149
+ */
150
+ static get restoreGameStepState(): (state: GameStepState, navigate: (path: string) => void | Promise<void>) => Promise<void>;
151
+ private static _getOpenedLabels;
152
+ /**
153
+ * Returns the number of opened labels.
154
+ */
155
+ static get openedLabels(): number;
156
+ private static _onGoNextEnd;
157
+ /**
158
+ * This function is called after the narration.goNext() method is executed.
159
+ * It can be used to force the completion of the ticker in the game engine.
160
+ */
161
+ static get onGoNextEnd(): () => Promise<void>;
162
+ private static _getVariable;
163
+ /**
164
+ * This function returns the value of a variable.
165
+ * @param key The key of the variable.
166
+ * @returns The value of the variable.
167
+ */
168
+ static get getVariable(): <T extends StorageElementType>(key: string) => T | undefined;
169
+ private static _setVariable;
170
+ /**
171
+ * This function sets the value of a variable.
172
+ * @param key The key of the variable.
173
+ * @param value The value of the variable.
174
+ */
175
+ static get setVariable(): (key: string, value: StorageElementType) => void;
176
+ private static _removeVariable;
177
+ /**
178
+ * This function removes a variable.
179
+ * @param key The key of the variable.
180
+ */
181
+ static get removeVariable(): (key: string) => void;
182
+ private static _getFlag;
183
+ /**
184
+ * This function returns the value of a flag.
185
+ * @param name The name of the flag.
186
+ */
187
+ static get getFlag(): (name: string) => boolean;
188
+ private static _setFlag;
189
+ /**
190
+ * This function sets the value of a flag.
191
+ * @param name The name of the flag.
192
+ * @param value The value of the flag.
193
+ */
194
+ static get setFlag(): (name: string, value: boolean) => void;
195
+ private static _onLabelClosing;
196
+ /**
197
+ * This function is called after the narration.goNext() method is executed
198
+ * It can be used to clear old temporary variables.
199
+ * @param openedLabelsNumber The number of opened labels.
200
+ */
201
+ static get onLabelClosing(): (openedLabelsNumber: number) => void;
202
+ private static _addHistoryItem;
203
+ /**
204
+ * Add a history step to the history.
205
+ * @param historyInfo The history information.
206
+ * @param opstions Options to add the step.
207
+ */
208
+ static get addHistoryItem(): (historyInfo?: HistoryInfo, opstions?: {
209
+ /**
210
+ * If true, the step will not be added to the history if the current step is the same as the last step.
211
+ */
212
+ ignoreSameStep?: boolean;
213
+ }) => void;
214
+ private static _getCurrentStepsRunningNumber;
215
+ /**
216
+ * Returns the number of steps that are currently running.
217
+ */
218
+ static get currentStepsRunningNumber(): number;
219
+ private static _getCharacter;
220
+ /**
221
+ * This function returns the character by its id.
222
+ * @param id The id of the character.
223
+ * @returns The character or undefined if it does not exist.
224
+ */
225
+ static get getCharacter(): (id: string) => CharacterInterface | undefined;
226
+ static onEnd?: StepLabelType;
227
+ static onError?: (type: "step", error: any, props: StepLabelPropsType) => void;
228
+ }
229
+
230
+ export { GameUnifier };
@@ -0,0 +1,230 @@
1
+ import { StepLabelProps, StepLabelResult, GameStepState, HistoryInfo, CharacterInterface } from '@drincs/pixi-vn';
2
+
3
+ type StepLabelResultType = StepLabelResult | void;
4
+ type StepLabelPropsType<T extends {} = {}> = StepLabelProps & T;
5
+ /**
6
+ * StepLabel is a function that will be executed as the game continues.
7
+ */
8
+ type StepLabelType<T extends {} = {}> = (props: StepLabelPropsType<T>, info: {
9
+ /**
10
+ * The id of the label.
11
+ */
12
+ labelId: string;
13
+ }) => StepLabelResultType | Promise<StepLabelResultType>;
14
+
15
+ type StorageElementPrimaryType = string | number | boolean | undefined | null | StorageElementPrimaryType[];
16
+ type StorageElementInternalType = StorageElementPrimaryType | Record<string | number | symbol, StorageElementPrimaryType> | StorageElementInternalType[];
17
+ /**
18
+ * StorageElementType are all the types that can be stored in the storage
19
+ */
20
+ type StorageElementType = StorageElementInternalType | Record<string | number | symbol, StorageElementInternalType> | {
21
+ [key: string | number | symbol]: StorageElementType;
22
+ } | StorageObjectType[] | (StorageElementPrimaryType | StorageElementInternalType | StorageElementType)[];
23
+ /**
24
+ * StorageObjectType are all the types that can be stored in the storage
25
+ */
26
+ type StorageObjectType = Record<string | number | symbol, StorageElementType>;
27
+
28
+ declare class GameUnifier {
29
+ static init(options: {
30
+ /**
31
+ * This function returns the current step counter. This counter corresponds to the total number of steps that have been executed so far.
32
+ *
33
+ * If your game engine does not have a history of steps, you can return 0.
34
+ */
35
+ getStepCounter: () => number;
36
+ /**
37
+ * This function sets the current step counter.
38
+ *
39
+ * If your game engine does not have a history of steps, you can not set the step counter.
40
+ */
41
+ setStepCounter: (value: number) => void;
42
+ /**
43
+ * This function returns the current state of the game step.
44
+ *
45
+ * If your game engine does not have a history of steps, you can return an empty object.
46
+ */
47
+ getCurrentGameStepState: () => GameStepState;
48
+ /**
49
+ * This function restores the game step state.
50
+ *
51
+ * If your game engine does not have a history of steps, you can return a resolved promise.
52
+ *
53
+ * @param state The state to restore.
54
+ * @param navigate The function to navigate to the restored path.
55
+ */
56
+ restoreGameStepState: (state: GameStepState, navigate: (path: string) => void | Promise<void>) => Promise<void>;
57
+ /**
58
+ * This function returns the number of opened labels.
59
+ *
60
+ * If your game engine does not have a narration system, you can return 0.
61
+ */
62
+ getOpenedLabels: () => number;
63
+ /**
64
+ * This function is called after the narration.goNext() method is executed.
65
+ * It can be used to force the completion of the ticker in the game engine.
66
+ */
67
+ onGoNextEnd?: () => Promise<void>;
68
+ /**
69
+ * This function returns the value of a variable.
70
+ * @param key The key of the variable.
71
+ * @returns The value of the variable.
72
+ */
73
+ getVariable: <T extends StorageElementType>(key: string) => T | undefined;
74
+ /**
75
+ * This function sets the value of a variable.
76
+ * @param key The key of the variable.
77
+ * @param value The value of the variable.
78
+ */
79
+ setVariable: (key: string, value: StorageElementType) => void;
80
+ /**
81
+ * This function removes a variable.
82
+ * @param key The key of the variable.
83
+ */
84
+ removeVariable: (key: string) => void;
85
+ /**
86
+ * This function returns the value of a flag.
87
+ * @param name The name of the flag.
88
+ */
89
+ getFlag: (name: string) => boolean;
90
+ /**
91
+ * This function sets the value of a flag.
92
+ * @param name The name of the flag.
93
+ * @param value The value of the flag.
94
+ */
95
+ setFlag: (name: string, value: boolean) => void;
96
+ /**
97
+ * This function is called after the narration.goNext() method is executed.
98
+ *
99
+ * It can be used to clear old temporary variables.
100
+ *
101
+ * @param openedLabelsNumber The number of opened labels.
102
+ */
103
+ onLabelClosing?: (openedLabelsNumber: number) => void;
104
+ /**
105
+ * Add a history step to the history.
106
+ *
107
+ * If your game engine does not have a history of steps, you can return a resolved promise.
108
+ *
109
+ * @param historyInfo The history information.
110
+ * @param opstions Options to add the step.
111
+ */
112
+ addHistoryItem(historyInfo?: HistoryInfo, opstions?: {
113
+ /**
114
+ * If true, the step will not be added to the history if the current step is the same as the last step.
115
+ */
116
+ ignoreSameStep?: boolean;
117
+ }): void;
118
+ /**
119
+ * This function returns the number of steps that are currently running.
120
+ */
121
+ getCurrentStepsRunningNumber: () => number;
122
+ /**
123
+ * This function returns the character by its id.
124
+ * @param id The id of the character.
125
+ * @returns The character or undefined if it does not exist.
126
+ */
127
+ getCharacter: (id: string) => CharacterInterface | undefined;
128
+ }): void;
129
+ private static _getStepCounter;
130
+ private static _setStepCounter;
131
+ /**
132
+ * Returns the current step counter. This counter corresponds to the total number of steps that have been executed so far.
133
+ */
134
+ static get stepCounter(): number;
135
+ /**
136
+ * Returns the current state of the game step.
137
+ */
138
+ static set stepCounter(value: number);
139
+ private static _getCurrentGameStepState;
140
+ /**
141
+ * Returns the current state of the game step.
142
+ */
143
+ static get currentGameStepState(): GameStepState;
144
+ private static _restoreGameStepState;
145
+ /**
146
+ * Restores the game step state.
147
+ * @param state The state to restore.
148
+ * @param navigate The function to navigate to the restored path.
149
+ */
150
+ static get restoreGameStepState(): (state: GameStepState, navigate: (path: string) => void | Promise<void>) => Promise<void>;
151
+ private static _getOpenedLabels;
152
+ /**
153
+ * Returns the number of opened labels.
154
+ */
155
+ static get openedLabels(): number;
156
+ private static _onGoNextEnd;
157
+ /**
158
+ * This function is called after the narration.goNext() method is executed.
159
+ * It can be used to force the completion of the ticker in the game engine.
160
+ */
161
+ static get onGoNextEnd(): () => Promise<void>;
162
+ private static _getVariable;
163
+ /**
164
+ * This function returns the value of a variable.
165
+ * @param key The key of the variable.
166
+ * @returns The value of the variable.
167
+ */
168
+ static get getVariable(): <T extends StorageElementType>(key: string) => T | undefined;
169
+ private static _setVariable;
170
+ /**
171
+ * This function sets the value of a variable.
172
+ * @param key The key of the variable.
173
+ * @param value The value of the variable.
174
+ */
175
+ static get setVariable(): (key: string, value: StorageElementType) => void;
176
+ private static _removeVariable;
177
+ /**
178
+ * This function removes a variable.
179
+ * @param key The key of the variable.
180
+ */
181
+ static get removeVariable(): (key: string) => void;
182
+ private static _getFlag;
183
+ /**
184
+ * This function returns the value of a flag.
185
+ * @param name The name of the flag.
186
+ */
187
+ static get getFlag(): (name: string) => boolean;
188
+ private static _setFlag;
189
+ /**
190
+ * This function sets the value of a flag.
191
+ * @param name The name of the flag.
192
+ * @param value The value of the flag.
193
+ */
194
+ static get setFlag(): (name: string, value: boolean) => void;
195
+ private static _onLabelClosing;
196
+ /**
197
+ * This function is called after the narration.goNext() method is executed
198
+ * It can be used to clear old temporary variables.
199
+ * @param openedLabelsNumber The number of opened labels.
200
+ */
201
+ static get onLabelClosing(): (openedLabelsNumber: number) => void;
202
+ private static _addHistoryItem;
203
+ /**
204
+ * Add a history step to the history.
205
+ * @param historyInfo The history information.
206
+ * @param opstions Options to add the step.
207
+ */
208
+ static get addHistoryItem(): (historyInfo?: HistoryInfo, opstions?: {
209
+ /**
210
+ * If true, the step will not be added to the history if the current step is the same as the last step.
211
+ */
212
+ ignoreSameStep?: boolean;
213
+ }) => void;
214
+ private static _getCurrentStepsRunningNumber;
215
+ /**
216
+ * Returns the number of steps that are currently running.
217
+ */
218
+ static get currentStepsRunningNumber(): number;
219
+ private static _getCharacter;
220
+ /**
221
+ * This function returns the character by its id.
222
+ * @param id The id of the character.
223
+ * @returns The character or undefined if it does not exist.
224
+ */
225
+ static get getCharacter(): (id: string) => CharacterInterface | undefined;
226
+ static onEnd?: StepLabelType;
227
+ static onError?: (type: "step", error: any, props: StepLabelPropsType) => void;
228
+ }
229
+
230
+ export { GameUnifier };
@@ -0,0 +1 @@
1
+ var d=Object.defineProperty;var u=(n,t,m)=>t in n?d(n,t,{enumerable:true,configurable:true,writable:true,value:m}):n[t]=m;var r=(n,t,m)=>u(n,typeof t!="symbol"?t+"":t,m);var i;(l=>(l.log=(a,...o)=>console.log(`[Pixi\u2019VN] ${a}`,...o),l.warn=(a,...o)=>console.warn(`[Pixi\u2019VN] ${a}`,...o),l.error=(a,...o)=>console.error(`[Pixi\u2019VN] ${a}`,...o),l.info=(a,...o)=>console.info(`[Pixi\u2019VN] ${a}`,...o)))(i||(i={}));var e=class e{static init(t){e._getStepCounter=t.getStepCounter,e._setStepCounter=t.setStepCounter,e._getCurrentGameStepState=t.getCurrentGameStepState,e._restoreGameStepState=t.restoreGameStepState,e._getOpenedLabels=t.getOpenedLabels,t.onGoNextEnd&&(e._onGoNextEnd=t.onGoNextEnd),e._getVariable=t.getVariable,e._setVariable=t.setVariable,e._removeVariable=t.removeVariable,e._getFlag=t.getFlag,e._setFlag=t.setFlag,t.onLabelClosing&&(e._onLabelClosing=t.onLabelClosing),e._addHistoryItem=t.addHistoryItem,e._getCurrentStepsRunningNumber=t.getCurrentStepsRunningNumber,e._getCharacter=t.getCharacter;}static get stepCounter(){return e._getStepCounter()}static set stepCounter(t){e._setStepCounter(t);}static get currentGameStepState(){return e._getCurrentGameStepState()}static get restoreGameStepState(){return e._restoreGameStepState}static get openedLabels(){return e._getOpenedLabels()}static get onGoNextEnd(){return e._onGoNextEnd}static get getVariable(){return e._getVariable}static get setVariable(){return e._setVariable}static get removeVariable(){return e._removeVariable}static get getFlag(){return e._getFlag}static get setFlag(){return e._setFlag}static get onLabelClosing(){return e._onLabelClosing}static get addHistoryItem(){return e._addHistoryItem}static get currentStepsRunningNumber(){return e._getCurrentStepsRunningNumber()}static get getCharacter(){return e._getCharacter}};r(e,"_getStepCounter",()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),r(e,"_setStepCounter",()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),r(e,"_getCurrentGameStepState",()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),r(e,"_restoreGameStepState",()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),r(e,"_getOpenedLabels",()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),r(e,"_onGoNextEnd",async()=>{}),r(e,"_getVariable",()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),r(e,"_setVariable",()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),r(e,"_removeVariable",()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),r(e,"_getFlag",()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),r(e,"_setFlag",()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),r(e,"_onLabelClosing",()=>{}),r(e,"_addHistoryItem",()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),r(e,"_getCurrentStepsRunningNumber",()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented, you should initialize the Game: Game.init()")}),r(e,"_getCharacter",()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new Error("Method not implemented.")}),r(e,"onEnd"),r(e,"onError");var s=e;export{s as GameUnifier};