@drincs/pixi-vn 1.8.1 → 1.8.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/README.md +3 -47
- package/dist/{HistoryChoiceMenuOption-BP9Tsbyd.d.ts → HistoryChoiceMenuOption-CS41KG13.d.ts} +2 -2
- package/dist/{HistoryChoiceMenuOption-DSSNUXEq.d.cts → HistoryChoiceMenuOption-DdwePsOm.d.cts} +2 -2
- package/dist/{StorageElementType-DkJ394kq.d.cts → StorageElementType-C7ETezlL.d.cts} +1 -1
- package/dist/{StorageElementType-DkJ394kq.d.ts → StorageElementType-C7ETezlL.d.ts} +1 -1
- package/dist/{StoredClassModel-a4pvgJXD.d.ts → StoredClassModel-C9mQxPg-.d.cts} +9 -6
- package/dist/{StoredClassModel-LtyakzOw.d.cts → StoredClassModel-upXPNQTp.d.ts} +9 -6
- package/dist/characters.cjs +1 -1
- package/dist/characters.d.cts +54 -50
- package/dist/characters.d.ts +54 -50
- package/dist/characters.mjs +1 -1
- package/dist/chunk-K7JIC2F2.mjs +1 -0
- package/dist/{chunk-36I5IN5S.mjs → chunk-V34PMA2H.mjs} +1 -1
- package/dist/history.d.cts +2 -2
- package/dist/history.d.ts +2 -2
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +21 -6
- package/dist/index.d.ts +21 -6
- package/dist/index.mjs +2 -2
- package/dist/narration.d.cts +3 -3
- package/dist/narration.d.ts +3 -3
- package/dist/storage.cjs +1 -1
- package/dist/storage.d.cts +3 -3
- package/dist/storage.d.ts +3 -3
- package/dist/storage.mjs +1 -1
- package/dist/vite-listener.cjs +1 -1
- package/dist/vite-listener.d.cts +13 -4
- package/dist/vite-listener.d.ts +13 -4
- package/dist/vite-listener.mjs +1 -1
- package/dist/vite.cjs +1 -1
- package/dist/vite.d.cts +66 -36
- package/dist/vite.d.ts +66 -36
- package/dist/vite.mjs +1 -1
- package/package.json +14 -6
- package/dist/chunk-TTRUPDAB.mjs +0 -1
package/README.md
CHANGED
|
@@ -26,14 +26,9 @@ For a quick start, various [project templates](#project-initialization) are avai
|
|
|
26
26
|
You have the option to use various types of narrative languages (in addition to JavaScript/TypeScript). Currently you can use the following:
|
|
27
27
|
|
|
28
28
|
- [_ink_](https://pixi-vn.web.app/ink/ink)
|
|
29
|
-
- [Ren'Py](https://pixi-vn.web.app/renpy/renpy)
|
|
30
29
|
|
|
31
30
|
Pixi’VN does not provide built-in components to create the game UI. Instead, you should use external JavaScript frameworks to build your UI. This allows you to leverage systems such as React, Vue, etc., to create complex and high-performance **UI screens**.
|
|
32
31
|
|
|
33
|
-
- [React](https://pixi-vn.web.app/start/interface-react)
|
|
34
|
-
- [Vue](https://pixi-vn.web.app/start/interface-vue)
|
|
35
|
-
- [PixiJS](https://pixi-vn.web.app/start/interface-pixijs)
|
|
36
|
-
|
|
37
32
|
## Wiki
|
|
38
33
|
|
|
39
34
|
- [Why Pixi’VN?](https://pixi-vn.web.app/start/why)
|
|
@@ -56,69 +51,31 @@ Before starting, you must have the following tools installed:
|
|
|
56
51
|
- [Visual Studio Code](https://code.visualstudio.com/)
|
|
57
52
|
- [Cursor](https://www.cursor.com/)
|
|
58
53
|
- [VSCodium](https://vscodium.com/)
|
|
59
|
-
- (Recommended) [Git](https://git-scm.com/)
|
|
60
|
-
- A [GitHub account](https://github.com/)
|
|
61
54
|
|
|
62
55
|
## Project Initialization
|
|
63
56
|
|
|
64
57
|
If you want to start from a new project, you can use the following command to initialize a new project with the Pixi’VN templates:
|
|
65
58
|
|
|
66
|
-
```
|
|
67
|
-
# npm
|
|
59
|
+
```npm
|
|
68
60
|
npm create pixi-vn@latest
|
|
69
|
-
|
|
70
|
-
# yarn
|
|
71
|
-
yarn create pixi-vn
|
|
72
|
-
|
|
73
|
-
# pnpm
|
|
74
|
-
pnpm create pixi-vn
|
|
75
|
-
|
|
76
|
-
# bun
|
|
77
|
-
bun create pixi-vn
|
|
78
|
-
|
|
79
|
-
# deno
|
|
80
|
-
deno init --npm pixi-vn
|
|
81
61
|
```
|
|
82
62
|
|
|
83
|
-
You can see the list of available templates and interactive demos
|
|
63
|
+
You can see the list of available templates and interactive demos <DynamicLink href="/start/templates">here</DynamicLink>.
|
|
84
64
|
|
|
85
65
|
After the project is initialized, open the project directory with your text editor (VSCode is recommended) and start developing your project.
|
|
86
66
|
|
|
87
|
-
All templates include a `README.md` file with more information about the project.
|
|
88
|
-
|
|
89
67
|
## Installation
|
|
90
68
|
|
|
91
69
|
To install the Pixi’VN package in an existing JavaScript project, use one of the following commands:
|
|
92
70
|
|
|
93
|
-
```
|
|
94
|
-
# npm
|
|
71
|
+
```npm
|
|
95
72
|
npm install @drincs/pixi-vn
|
|
96
|
-
|
|
97
|
-
# yarn
|
|
98
|
-
yarn add @drincs/pixi-vn
|
|
99
|
-
|
|
100
|
-
# pnpm
|
|
101
|
-
pnpm add @drincs/pixi-vn
|
|
102
|
-
|
|
103
|
-
# bun
|
|
104
|
-
bun add @drincs/pixi-vn
|
|
105
|
-
|
|
106
|
-
# deno
|
|
107
|
-
deno install npm:@drincs/pixi-vn
|
|
108
73
|
```
|
|
109
74
|
|
|
110
75
|
## Initialize
|
|
111
76
|
|
|
112
77
|
Before using the Pixi’VN engine, you must initialize the game. You can do this by calling the `Game.init` method.
|
|
113
78
|
|
|
114
|
-
This function has the following parameters:
|
|
115
|
-
|
|
116
|
-
- `element`: The HTML element to append the canvas to.
|
|
117
|
-
- `options`: Equivalent to the options you can use when initializing a [PixiJS Application](https://pixijs.com/8.x/guides/basics/getting-started#creating-an-application). The following options are mandatory:
|
|
118
|
-
- `width`: The width of the canvas.
|
|
119
|
-
- `height`: The height of the canvas.
|
|
120
|
-
- `devtoolsOptions`: Equivalent to the options you can use when initializing the [PixiJS Devtools](https://pixi-vn.web.app/it/start/canvas#use-pixijs-devtools-with-pixivn).
|
|
121
|
-
|
|
122
79
|
```ts title="src/main.tsx"
|
|
123
80
|
import { Game } from "@drincs/pixi-vn";
|
|
124
81
|
|
|
@@ -178,4 +135,3 @@ body {
|
|
|
178
135
|
overflow: hidden;
|
|
179
136
|
}
|
|
180
137
|
```
|
|
181
|
-
|
package/dist/{HistoryChoiceMenuOption-BP9Tsbyd.d.ts → HistoryChoiceMenuOption-CS41KG13.d.ts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChoiceInterface, StepLabelProps, StepLabelResult, CharacterInterface } from '@drincs/pixi-vn';
|
|
2
2
|
import { Difference } from 'microdiff';
|
|
3
|
-
import {
|
|
3
|
+
import { S as StorageElementType } from './StorageElementType-C7ETezlL.js';
|
|
4
4
|
|
|
5
5
|
type CloseType = "close";
|
|
6
6
|
|
|
@@ -179,4 +179,4 @@ type HistoryChoiceMenuOption = {
|
|
|
179
179
|
hidden: boolean;
|
|
180
180
|
};
|
|
181
181
|
|
|
182
|
-
export type { ChoiceOptionInterface as C, DialogueInterface as D,
|
|
182
|
+
export type { ChoiceOptionInterface as C, DialogueInterface as D, HistoryChoiceMenuOption as H, LabelIdType as L, NarrationHistory as N, OpenedLabel as O, StepLabelPropsType as S, CloseChoiceOptionInterface as a, CloseType as b, HistoryStep as c, LabelRunModeType as d, StepLabelResultType as e, StepLabelType as f, StoredChoiceInterface as g, StoredIndexedChoiceInterface as h };
|
package/dist/{HistoryChoiceMenuOption-DSSNUXEq.d.cts → HistoryChoiceMenuOption-DdwePsOm.d.cts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChoiceInterface, StepLabelProps, StepLabelResult, CharacterInterface } from '@drincs/pixi-vn';
|
|
2
2
|
import { Difference } from 'microdiff';
|
|
3
|
-
import {
|
|
3
|
+
import { S as StorageElementType } from './StorageElementType-C7ETezlL.cjs';
|
|
4
4
|
|
|
5
5
|
type CloseType = "close";
|
|
6
6
|
|
|
@@ -179,4 +179,4 @@ type HistoryChoiceMenuOption = {
|
|
|
179
179
|
hidden: boolean;
|
|
180
180
|
};
|
|
181
181
|
|
|
182
|
-
export type { ChoiceOptionInterface as C, DialogueInterface as D,
|
|
182
|
+
export type { ChoiceOptionInterface as C, DialogueInterface as D, HistoryChoiceMenuOption as H, LabelIdType as L, NarrationHistory as N, OpenedLabel as O, StepLabelPropsType as S, CloseChoiceOptionInterface as a, CloseType as b, HistoryStep as c, LabelRunModeType as d, StepLabelResultType as e, StepLabelType as f, StoredChoiceInterface as g, StoredIndexedChoiceInterface as h };
|
|
@@ -16,4 +16,4 @@ type StorageElementType = StorageElementInternalType | Record<string | number |
|
|
|
16
16
|
*/
|
|
17
17
|
type StorageObjectType = Record<string | number | symbol, StorageElementType>;
|
|
18
18
|
|
|
19
|
-
export type {
|
|
19
|
+
export type { StorageElementType as S, StorageObjectType as a };
|
|
@@ -16,4 +16,4 @@ type StorageElementType = StorageElementInternalType | Record<string | number |
|
|
|
16
16
|
*/
|
|
17
17
|
type StorageObjectType = Record<string | number | symbol, StorageElementType>;
|
|
18
18
|
|
|
19
|
-
export type {
|
|
19
|
+
export type { StorageElementType as S, StorageObjectType as a };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { S as StorageElementType } from './StorageElementType-C7ETezlL.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* StoredClassModel is a abstract class that contains the methods to store a class in the game.
|
|
@@ -11,19 +11,19 @@ import { a as StorageElementType } from './StorageElementType-DkJ394kq.js';
|
|
|
11
11
|
* this.defaultName = props.name
|
|
12
12
|
* this.defaultSurname = props.surname
|
|
13
13
|
* }
|
|
14
|
-
*
|
|
14
|
+
* readonly defaultName: string = ""
|
|
15
15
|
* get name(): string {
|
|
16
16
|
* return this.getStorageProperty<string>("name") || this.defaultName
|
|
17
17
|
* }
|
|
18
18
|
* set name(value: string) {
|
|
19
|
-
* this.setStorageProperty
|
|
19
|
+
* this.setStorageProperty("name", value)
|
|
20
20
|
* }
|
|
21
|
-
*
|
|
21
|
+
* readonly defaultSurname?: string
|
|
22
22
|
* get surname(): string | undefined {
|
|
23
23
|
* return this.getStorageProperty<string>("surname") || this.defaultSurname
|
|
24
24
|
* }
|
|
25
25
|
* set surname(value: string | undefined) {
|
|
26
|
-
* this.setStorageProperty
|
|
26
|
+
* this.setStorageProperty("surname", value)
|
|
27
27
|
* }
|
|
28
28
|
* }
|
|
29
29
|
* ```
|
|
@@ -41,7 +41,10 @@ declare class StoredClassModel {
|
|
|
41
41
|
readonly id: string;
|
|
42
42
|
private categoryId;
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
44
|
+
* Update a property in the storage.
|
|
45
|
+
* @param propertyName The name of the property to set.
|
|
46
|
+
* @param value The value to set. If is undefined, the property will be removed from the storage.
|
|
47
|
+
* @template T The type of the value to set. (Deprecated, it is not necessary to specify the type of the value, it will be inferred from the value)
|
|
45
48
|
*/
|
|
46
49
|
protected setStorageProperty<T>(propertyName: string, value: StorageElementType): void;
|
|
47
50
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { S as StorageElementType } from './StorageElementType-C7ETezlL.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* StoredClassModel is a abstract class that contains the methods to store a class in the game.
|
|
@@ -11,19 +11,19 @@ import { a as StorageElementType } from './StorageElementType-DkJ394kq.cjs';
|
|
|
11
11
|
* this.defaultName = props.name
|
|
12
12
|
* this.defaultSurname = props.surname
|
|
13
13
|
* }
|
|
14
|
-
*
|
|
14
|
+
* readonly defaultName: string = ""
|
|
15
15
|
* get name(): string {
|
|
16
16
|
* return this.getStorageProperty<string>("name") || this.defaultName
|
|
17
17
|
* }
|
|
18
18
|
* set name(value: string) {
|
|
19
|
-
* this.setStorageProperty
|
|
19
|
+
* this.setStorageProperty("name", value)
|
|
20
20
|
* }
|
|
21
|
-
*
|
|
21
|
+
* readonly defaultSurname?: string
|
|
22
22
|
* get surname(): string | undefined {
|
|
23
23
|
* return this.getStorageProperty<string>("surname") || this.defaultSurname
|
|
24
24
|
* }
|
|
25
25
|
* set surname(value: string | undefined) {
|
|
26
|
-
* this.setStorageProperty
|
|
26
|
+
* this.setStorageProperty("surname", value)
|
|
27
27
|
* }
|
|
28
28
|
* }
|
|
29
29
|
* ```
|
|
@@ -41,7 +41,10 @@ declare class StoredClassModel {
|
|
|
41
41
|
readonly id: string;
|
|
42
42
|
private categoryId;
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
44
|
+
* Update a property in the storage.
|
|
45
|
+
* @param propertyName The name of the property to set.
|
|
46
|
+
* @param value The value to set. If is undefined, the property will be removed from the storage.
|
|
47
|
+
* @template T The type of the value to set. (Deprecated, it is not necessary to specify the type of the value, it will be inferred from the value)
|
|
45
48
|
*/
|
|
46
49
|
protected setStorageProperty<T>(propertyName: string, value: StorageElementType): void;
|
|
47
50
|
/**
|
package/dist/characters.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var core=require('@drincs/pixi-vn/core');var se=Object.defineProperty;var Xt=c=>{throw TypeError(c)};var ae=(c,i,e)=>i in c?se(c,i,{enumerable:true,configurable:true,writable:true,value:e}):c[i]=e;var _=(c,i,e)=>ae(c,typeof i!="symbol"?i+"":i,e),Yt=(c,i,e)=>i.has(c)||Xt("Cannot "+e);var t=(c,i,e)=>(Yt(c,i,"read from private field"),e?e.call(c):i.get(c)),m=(c,i,e)=>i.has(c)?Xt("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(c):i.set(c,e),f=(c,i,e,r)=>(Yt(c,i,"write to private field"),i.set(c,e),e),h=(c,i,e)=>(Yt(c,i,"access private method"),e);var Mt=(c,i,e,r)=>({set _(a){f(c,i,a);},get _(){return t(c,i,r)}});var st="storage",ut="temp",Ft="flags",U={CHARACTER_CATEGORY_KEY:"character"};var oe=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Zt=new Set,Kt=typeof process=="object"&&process?process:{},te=(c,i,e,r)=>{typeof Kt.emitWarning=="function"?Kt.emitWarning(c,i,e,r):console.error(`[${e}] ${i}: ${c}`);},Pt=globalThis.AbortController,Jt=globalThis.AbortSignal;if(typeof Pt>"u"){Jt=class{constructor(){_(this,"onabort");_(this,"_onabort",[]);_(this,"reason");_(this,"aborted",false);}addEventListener(e,r){this._onabort.push(r);}},Pt=class{constructor(){_(this,"signal",new Jt);i();}abort(e){if(!this.signal.aborted){this.signal.reason=e,this.signal.aborted=true;for(let r of this.signal._onabort)r(e);this.signal.onabort?.(e);}}};let c=Kt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",i=()=>{c&&(c=false,te("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",i));};}var ne=c=>!Zt.has(c);var at=c=>c&&c===Math.floor(c)&&c>0&&isFinite(c),ee=c=>at(c)?c<=Math.pow(2,8)?Uint8Array:c<=Math.pow(2,16)?Uint16Array:c<=Math.pow(2,32)?Uint32Array:c<=Number.MAX_SAFE_INTEGER?Gt:null:null,Gt=class extends Array{constructor(c){super(c),this.fill(0);}},it,St,le=(it=class{constructor(i,e){_(this,"heap");_(this,"length");if(!t(it,St))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(i),this.length=0;}static create(i){let e=ee(i);if(!e)return [];f(it,St,true);let r=new it(i,e);return f(it,St,false),r}push(i){this.heap[this.length++]=i;}pop(){return this.heap[--this.length]}},St=new WeakMap,m(it,St,false),it),qt,Qt,j,z,k,ft,B,Et,Tt,X,C,J,R,w,g,V,Y,M,D,q,N,Q,Z,K,W,tt,ht,L,bt,n,Wt,gt,rt,Ct,H,re,dt,yt,It,ot,nt,Ht,Vt,Lt,O,$t,Rt,lt,jt,At,ie=(At=class{constructor(i){m(this,n);m(this,j);m(this,z);m(this,k);m(this,ft);m(this,B);m(this,Et);m(this,Tt);m(this,X);_(this,"ttl");_(this,"ttlResolution");_(this,"ttlAutopurge");_(this,"updateAgeOnGet");_(this,"updateAgeOnHas");_(this,"allowStale");_(this,"noDisposeOnSet");_(this,"noUpdateTTL");_(this,"maxEntrySize");_(this,"sizeCalculation");_(this,"noDeleteOnFetchRejection");_(this,"noDeleteOnStaleGet");_(this,"allowStaleOnFetchAbort");_(this,"allowStaleOnFetchRejection");_(this,"ignoreFetchAbort");m(this,C);m(this,J);m(this,R);m(this,w);m(this,g);m(this,V);m(this,Y);m(this,M);m(this,D);m(this,q);m(this,N);m(this,Q);m(this,Z);m(this,K);m(this,W);m(this,tt);m(this,ht);m(this,L);m(this,bt);m(this,gt,()=>{});m(this,rt,()=>{});m(this,Ct,()=>{});m(this,H,()=>false);m(this,dt,i=>{});m(this,yt,(i,e,r)=>{});m(this,It,(i,e,r,a)=>{if(r||a)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});_(this,qt,"LRUCache");let{max:e=0,ttl:r,ttlResolution:a=1,ttlAutopurge:o,updateAgeOnGet:s,updateAgeOnHas:l,allowStale:u,dispose:E,onInsert:I,disposeAfter:d,noDisposeOnSet:y,noUpdateTTL:b,maxSize:T=0,maxEntrySize:A=0,sizeCalculation:v,fetchMethod:p,memoMethod:F,noDeleteOnFetchRejection:P,noDeleteOnStaleGet:G,allowStaleOnFetchRejection:x,allowStaleOnFetchAbort:xt,ignoreFetchAbort:pt,perf:_t}=i;if(_t!==void 0&&typeof _t?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(f(this,X,_t??oe),e!==0&&!at(e))throw new TypeError("max option must be a nonnegative integer");let mt=e?ee(e):Array;if(!mt)throw new Error("invalid max value: "+e);if(f(this,j,e),f(this,z,T),this.maxEntrySize=A||t(this,z),this.sizeCalculation=v,this.sizeCalculation){if(!t(this,z)&&!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(F!==void 0&&typeof F!="function")throw new TypeError("memoMethod must be a function if defined");if(f(this,Tt,F),p!==void 0&&typeof p!="function")throw new TypeError("fetchMethod must be a function if specified");if(f(this,Et,p),f(this,ht,!!p),f(this,R,new Map),f(this,w,new Array(e).fill(void 0)),f(this,g,new Array(e).fill(void 0)),f(this,V,new mt(e)),f(this,Y,new mt(e)),f(this,M,0),f(this,D,0),f(this,q,le.create(e)),f(this,C,0),f(this,J,0),typeof E=="function"&&f(this,k,E),typeof I=="function"&&f(this,ft,I),typeof d=="function"?(f(this,B,d),f(this,N,[])):(f(this,B,void 0),f(this,N,void 0)),f(this,tt,!!t(this,k)),f(this,bt,!!t(this,ft)),f(this,L,!!t(this,B)),this.noDisposeOnSet=!!y,this.noUpdateTTL=!!b,this.noDeleteOnFetchRejection=!!P,this.allowStaleOnFetchRejection=!!x,this.allowStaleOnFetchAbort=!!xt,this.ignoreFetchAbort=!!pt,this.maxEntrySize!==0){if(t(this,z)!==0&&!at(t(this,z)))throw new TypeError("maxSize must be a positive integer if specified");if(!at(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");h(this,n,re).call(this);}if(this.allowStale=!!u,this.noDeleteOnStaleGet=!!G,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!l,this.ttlResolution=at(a)||a===0?a:1,this.ttlAutopurge=!!o,this.ttl=r||0,this.ttl){if(!at(this.ttl))throw new TypeError("ttl must be a positive integer if specified");h(this,n,Wt).call(this);}if(t(this,j)===0&&this.ttl===0&&t(this,z)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,j)&&!t(this,z)){let zt="LRU_CACHE_UNBOUNDED";ne(zt)&&(Zt.add(zt),te("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",zt,At));}}get perf(){return t(this,X)}static unsafeExposeInternals(i){return {starts:t(i,Z),ttls:t(i,K),autopurgeTimers:t(i,W),sizes:t(i,Q),keyMap:t(i,R),keyList:t(i,w),valList:t(i,g),next:t(i,V),prev:t(i,Y),get head(){return t(i,M)},get tail(){return t(i,D)},free:t(i,q),isBackgroundFetch:e=>{var r;return h(r=i,n,O).call(r,e)},backgroundFetch:(e,r,a,o)=>{var s;return h(s=i,n,Lt).call(s,e,r,a,o)},moveToTail:e=>{var r;return h(r=i,n,Rt).call(r,e)},indexes:e=>{var r;return h(r=i,n,ot).call(r,e)},rindexes:e=>{var r;return h(r=i,n,nt).call(r,e)},isStale:e=>{var r;return t(r=i,H).call(r,e)}}}get max(){return t(this,j)}get maxSize(){return t(this,z)}get calculatedSize(){return t(this,J)}get size(){return t(this,C)}get fetchMethod(){return t(this,Et)}get memoMethod(){return t(this,Tt)}get dispose(){return t(this,k)}get onInsert(){return t(this,ft)}get disposeAfter(){return t(this,B)}getRemainingTTL(i){return t(this,R).has(i)?1/0:0}*entries(){for(let i of h(this,n,ot).call(this))t(this,g)[i]!==void 0&&t(this,w)[i]!==void 0&&!h(this,n,O).call(this,t(this,g)[i])&&(yield [t(this,w)[i],t(this,g)[i]]);}*rentries(){for(let i of h(this,n,nt).call(this))t(this,g)[i]!==void 0&&t(this,w)[i]!==void 0&&!h(this,n,O).call(this,t(this,g)[i])&&(yield [t(this,w)[i],t(this,g)[i]]);}*keys(){for(let i of h(this,n,ot).call(this)){let e=t(this,w)[i];e!==void 0&&!h(this,n,O).call(this,t(this,g)[i])&&(yield e);}}*rkeys(){for(let i of h(this,n,nt).call(this)){let e=t(this,w)[i];e!==void 0&&!h(this,n,O).call(this,t(this,g)[i])&&(yield e);}}*values(){for(let i of h(this,n,ot).call(this))t(this,g)[i]!==void 0&&!h(this,n,O).call(this,t(this,g)[i])&&(yield t(this,g)[i]);}*rvalues(){for(let i of h(this,n,nt).call(this))t(this,g)[i]!==void 0&&!h(this,n,O).call(this,t(this,g)[i])&&(yield t(this,g)[i]);}[(Qt=Symbol.iterator,qt=Symbol.toStringTag,Qt)](){return this.entries()}find(i,e={}){for(let r of h(this,n,ot).call(this)){let a=t(this,g)[r],o=h(this,n,O).call(this,a)?a.__staleWhileFetching:a;if(o!==void 0&&i(o,t(this,w)[r],this))return this.get(t(this,w)[r],e)}}forEach(i,e=this){for(let r of h(this,n,ot).call(this)){let a=t(this,g)[r],o=h(this,n,O).call(this,a)?a.__staleWhileFetching:a;o!==void 0&&i.call(e,o,t(this,w)[r],this);}}rforEach(i,e=this){for(let r of h(this,n,nt).call(this)){let a=t(this,g)[r],o=h(this,n,O).call(this,a)?a.__staleWhileFetching:a;o!==void 0&&i.call(e,o,t(this,w)[r],this);}}purgeStale(){let i=false;for(let e of h(this,n,nt).call(this,{allowStale:true}))t(this,H).call(this,e)&&(h(this,n,lt).call(this,t(this,w)[e],"expire"),i=true);return i}info(i){let e=t(this,R).get(i);if(e===void 0)return;let r=t(this,g)[e],a=h(this,n,O).call(this,r)?r.__staleWhileFetching:r;if(a===void 0)return;let o={value:a};if(t(this,K)&&t(this,Z)){let s=t(this,K)[e],l=t(this,Z)[e];if(s&&l){let u=s-(t(this,X).now()-l);o.ttl=u,o.start=Date.now();}}return t(this,Q)&&(o.size=t(this,Q)[e]),o}dump(){let i=[];for(let e of h(this,n,ot).call(this,{allowStale:true})){let r=t(this,w)[e],a=t(this,g)[e],o=h(this,n,O).call(this,a)?a.__staleWhileFetching:a;if(o===void 0||r===void 0)continue;let s={value:o};if(t(this,K)&&t(this,Z)){s.ttl=t(this,K)[e];let l=t(this,X).now()-t(this,Z)[e];s.start=Math.floor(Date.now()-l);}t(this,Q)&&(s.size=t(this,Q)[e]),i.unshift([r,s]);}return i}load(i){this.clear();for(let[e,r]of i){if(r.start){let a=Date.now()-r.start;r.start=t(this,X).now()-a;}this.set(e,r.value,r);}}set(i,e,r={}){var y,b,T,A;if(e===void 0)return this.delete(i),this;let{ttl:a=this.ttl,start:o,noDisposeOnSet:s=this.noDisposeOnSet,sizeCalculation:l=this.sizeCalculation,status:u}=r,{noUpdateTTL:E=this.noUpdateTTL}=r,I=t(this,It).call(this,i,e,r.size||0,l);if(this.maxEntrySize&&I>this.maxEntrySize)return u&&(u.set="miss",u.maxEntrySizeExceeded=true),h(this,n,lt).call(this,i,"set"),this;let d=t(this,C)===0?void 0:t(this,R).get(i);if(d===void 0)d=t(this,C)===0?t(this,D):t(this,q).length!==0?t(this,q).pop():t(this,C)===t(this,j)?h(this,n,Vt).call(this,false):t(this,C),t(this,w)[d]=i,t(this,g)[d]=e,t(this,R).set(i,d),t(this,V)[t(this,D)]=d,t(this,Y)[d]=t(this,D),f(this,D,d),Mt(this,C)._++,t(this,yt).call(this,d,I,u),u&&(u.set="add"),E=false,t(this,bt)&&((y=t(this,ft))==null||y.call(this,e,i,"add"));else {h(this,n,Rt).call(this,d);let v=t(this,g)[d];if(e!==v){if(t(this,ht)&&h(this,n,O).call(this,v)){v.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=v;p!==void 0&&!s&&(t(this,tt)&&((b=t(this,k))==null||b.call(this,p,i,"set")),t(this,L)&&t(this,N)?.push([p,i,"set"]));}else s||(t(this,tt)&&((T=t(this,k))==null||T.call(this,v,i,"set")),t(this,L)&&t(this,N)?.push([v,i,"set"]));if(t(this,dt).call(this,d),t(this,yt).call(this,d,I,u),t(this,g)[d]=e,u){u.set="replace";let p=v&&h(this,n,O).call(this,v)?v.__staleWhileFetching:v;p!==void 0&&(u.oldValue=p);}}else u&&(u.set="update");t(this,bt)&&this.onInsert?.(e,i,e===v?"update":"replace");}if(a!==0&&!t(this,K)&&h(this,n,Wt).call(this),t(this,K)&&(E||t(this,Ct).call(this,d,a,o),u&&t(this,rt).call(this,u,d)),!s&&t(this,L)&&t(this,N)){let v=t(this,N),p;for(;p=v?.shift();)(A=t(this,B))==null||A.call(this,...p);}return this}pop(){var i;try{for(;t(this,C);){let e=t(this,g)[t(this,M)];if(h(this,n,Vt).call(this,!0),h(this,n,O).call(this,e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(t(this,L)&&t(this,N)){let e=t(this,N),r;for(;r=e?.shift();)(i=t(this,B))==null||i.call(this,...r);}}}has(i,e={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:a}=e,o=t(this,R).get(i);if(o!==void 0){let s=t(this,g)[o];if(h(this,n,O).call(this,s)&&s.__staleWhileFetching===void 0)return false;if(t(this,H).call(this,o))a&&(a.has="stale",t(this,rt).call(this,a,o));else return r&&t(this,gt).call(this,o),a&&(a.has="hit",t(this,rt).call(this,a,o)),true}else a&&(a.has="miss");return false}peek(i,e={}){let{allowStale:r=this.allowStale}=e,a=t(this,R).get(i);if(a===void 0||!r&&t(this,H).call(this,a))return;let o=t(this,g)[a];return h(this,n,O).call(this,o)?o.__staleWhileFetching:o}async fetch(i,e={}){let{allowStale:r=this.allowStale,updateAgeOnGet:a=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:s=this.ttl,noDisposeOnSet:l=this.noDisposeOnSet,size:u=0,sizeCalculation:E=this.sizeCalculation,noUpdateTTL:I=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:y=this.allowStaleOnFetchRejection,ignoreFetchAbort:b=this.ignoreFetchAbort,allowStaleOnFetchAbort:T=this.allowStaleOnFetchAbort,context:A,forceRefresh:v=false,status:p,signal:F}=e;if(!t(this,ht))return p&&(p.fetch="get"),this.get(i,{allowStale:r,updateAgeOnGet:a,noDeleteOnStaleGet:o,status:p});let P={allowStale:r,updateAgeOnGet:a,noDeleteOnStaleGet:o,ttl:s,noDisposeOnSet:l,size:u,sizeCalculation:E,noUpdateTTL:I,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:y,allowStaleOnFetchAbort:T,ignoreFetchAbort:b,status:p,signal:F},G=t(this,R).get(i);if(G===void 0){p&&(p.fetch="miss");let x=h(this,n,Lt).call(this,i,G,P,A);return x.__returned=x}else {let x=t(this,g)[G];if(h(this,n,O).call(this,x)){let mt=r&&x.__staleWhileFetching!==void 0;return p&&(p.fetch="inflight",mt&&(p.returnedStale=true)),mt?x.__staleWhileFetching:x.__returned=x}let xt=t(this,H).call(this,G);if(!v&&!xt)return p&&(p.fetch="hit"),h(this,n,Rt).call(this,G),a&&t(this,gt).call(this,G),p&&t(this,rt).call(this,p,G),x;let pt=h(this,n,Lt).call(this,i,G,P,A),_t=pt.__staleWhileFetching!==void 0&&r;return p&&(p.fetch=xt?"stale":"refresh",_t&&xt&&(p.returnedStale=true)),_t?pt.__staleWhileFetching:pt.__returned=pt}}async forceFetch(i,e={}){let r=await this.fetch(i,e);if(r===void 0)throw new Error("fetch() returned undefined");return r}memo(i,e={}){let r=t(this,Tt);if(!r)throw new Error("no memoMethod provided to constructor");let{context:a,forceRefresh:o,...s}=e,l=this.get(i,s);if(!o&&l!==void 0)return l;let u=r(i,l,{options:s,context:a});return this.set(i,u,s),u}get(i,e={}){let{allowStale:r=this.allowStale,updateAgeOnGet:a=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:s}=e,l=t(this,R).get(i);if(l!==void 0){let u=t(this,g)[l],E=h(this,n,O).call(this,u);return s&&t(this,rt).call(this,s,l),t(this,H).call(this,l)?(s&&(s.get="stale"),E?(s&&r&&u.__staleWhileFetching!==void 0&&(s.returnedStale=true),r?u.__staleWhileFetching:void 0):(o||h(this,n,lt).call(this,i,"expire"),s&&r&&(s.returnedStale=true),r?u:void 0)):(s&&(s.get="hit"),E?u.__staleWhileFetching:(h(this,n,Rt).call(this,l),a&&t(this,gt).call(this,l),u))}else s&&(s.get="miss");}delete(i){return h(this,n,lt).call(this,i,"delete")}clear(){return h(this,n,jt).call(this,"delete")}},j=new WeakMap,z=new WeakMap,k=new WeakMap,ft=new WeakMap,B=new WeakMap,Et=new WeakMap,Tt=new WeakMap,X=new WeakMap,C=new WeakMap,J=new WeakMap,R=new WeakMap,w=new WeakMap,g=new WeakMap,V=new WeakMap,Y=new WeakMap,M=new WeakMap,D=new WeakMap,q=new WeakMap,N=new WeakMap,Q=new WeakMap,Z=new WeakMap,K=new WeakMap,W=new WeakMap,tt=new WeakMap,ht=new WeakMap,L=new WeakMap,bt=new WeakMap,n=new WeakSet,Wt=function(){let i=new Gt(t(this,j)),e=new Gt(t(this,j));f(this,K,i),f(this,Z,e);let r=this.ttlAutopurge?new Array(t(this,j)):void 0;f(this,W,r),f(this,Ct,(l,u,E=t(this,X).now())=>{e[l]=u!==0?E:0,i[l]=u,a(l,u);}),f(this,gt,l=>{e[l]=i[l]!==0?t(this,X).now():0,a(l,i[l]);});let a=this.ttlAutopurge?(l,u)=>{if(r?.[l]&&(clearTimeout(r[l]),r[l]=void 0),u&&u!==0&&r){let E=setTimeout(()=>{t(this,H).call(this,l)&&h(this,n,lt).call(this,t(this,w)[l],"expire");},u+1);E.unref&&E.unref(),r[l]=E;}}:()=>{};f(this,rt,(l,u)=>{if(i[u]){let E=i[u],I=e[u];if(!E||!I)return;l.ttl=E,l.start=I,l.now=o||s();let d=l.now-I;l.remainingTTL=E-d;}});let o=0,s=()=>{let l=t(this,X).now();if(this.ttlResolution>0){o=l;let u=setTimeout(()=>o=0,this.ttlResolution);u.unref&&u.unref();}return l};this.getRemainingTTL=l=>{let u=t(this,R).get(l);if(u===void 0)return 0;let E=i[u],I=e[u];if(!E||!I)return 1/0;let d=(o||s())-I;return E-d},f(this,H,l=>{let u=e[l],E=i[l];return !!E&&!!u&&(o||s())-u>E});},gt=new WeakMap,rt=new WeakMap,Ct=new WeakMap,H=new WeakMap,re=function(){let i=new Gt(t(this,j));f(this,J,0),f(this,Q,i),f(this,dt,e=>{f(this,J,t(this,J)-i[e]),i[e]=0;}),f(this,It,(e,r,a,o)=>{if(h(this,n,O).call(this,r))return 0;if(!at(a))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(a=o(r,e),!at(a))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 a}),f(this,yt,(e,r,a)=>{if(i[e]=r,t(this,z)){let o=t(this,z)-i[e];for(;t(this,J)>o;)h(this,n,Vt).call(this,true);}f(this,J,t(this,J)+i[e]),a&&(a.entrySize=r,a.totalCalculatedSize=t(this,J));});},dt=new WeakMap,yt=new WeakMap,It=new WeakMap,ot=function*({allowStale:i=this.allowStale}={}){if(t(this,C))for(let e=t(this,D);!(!h(this,n,Ht).call(this,e)||((i||!t(this,H).call(this,e))&&(yield e),e===t(this,M)));)e=t(this,Y)[e];},nt=function*({allowStale:i=this.allowStale}={}){if(t(this,C))for(let e=t(this,M);!(!h(this,n,Ht).call(this,e)||((i||!t(this,H).call(this,e))&&(yield e),e===t(this,D)));)e=t(this,V)[e];},Ht=function(i){return i!==void 0&&t(this,R).get(t(this,w)[i])===i},Vt=function(i){var o;let e=t(this,M),r=t(this,w)[e],a=t(this,g)[e];return t(this,ht)&&h(this,n,O).call(this,a)?a.__abortController.abort(new Error("evicted")):(t(this,tt)||t(this,L))&&(t(this,tt)&&((o=t(this,k))==null||o.call(this,a,r,"evict")),t(this,L)&&t(this,N)?.push([a,r,"evict"])),t(this,dt).call(this,e),t(this,W)?.[e]&&(clearTimeout(t(this,W)[e]),t(this,W)[e]=void 0),i&&(t(this,w)[e]=void 0,t(this,g)[e]=void 0,t(this,q).push(e)),t(this,C)===1?(f(this,M,f(this,D,0)),t(this,q).length=0):f(this,M,t(this,V)[e]),t(this,R).delete(r),Mt(this,C)._--,e},Lt=function(i,e,r,a){let o=e===void 0?void 0:t(this,g)[e];if(h(this,n,O).call(this,o))return o;let s=new Pt,{signal:l}=r;l?.addEventListener("abort",()=>s.abort(l.reason),{signal:s.signal});let u={signal:s.signal,options:r,context:a},E=(A,v=false)=>{let{aborted:p}=s.signal,F=r.ignoreFetchAbort&&A!==void 0,P=r.ignoreFetchAbort||!!(r.allowStaleOnFetchAbort&&A!==void 0);if(r.status&&(p&&!v?(r.status.fetchAborted=true,r.status.fetchError=s.signal.reason,F&&(r.status.fetchAbortIgnored=true)):r.status.fetchResolved=true),p&&!F&&!v)return d(s.signal.reason,P);let G=b,x=t(this,g)[e];return (x===b||F&&v&&x===void 0)&&(A===void 0?G.__staleWhileFetching!==void 0?t(this,g)[e]=G.__staleWhileFetching:h(this,n,lt).call(this,i,"fetch"):(r.status&&(r.status.fetchUpdated=true),this.set(i,A,u.options))),A},I=A=>(r.status&&(r.status.fetchRejected=true,r.status.fetchError=A),d(A,false)),d=(A,v)=>{let{aborted:p}=s.signal,F=p&&r.allowStaleOnFetchAbort,P=F||r.allowStaleOnFetchRejection,G=P||r.noDeleteOnFetchRejection,x=b;if(t(this,g)[e]===b&&(!G||!v&&x.__staleWhileFetching===void 0?h(this,n,lt).call(this,i,"fetch"):F||(t(this,g)[e]=x.__staleWhileFetching)),P)return r.status&&x.__staleWhileFetching!==void 0&&(r.status.returnedStale=true),x.__staleWhileFetching;if(x.__returned===x)throw A},y=(A,v)=>{var F;let p=(F=t(this,Et))==null?void 0:F.call(this,i,o,u);p&&p instanceof Promise&&p.then(P=>A(P===void 0?void 0:P),v),s.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(A(void 0),r.allowStaleOnFetchAbort&&(A=P=>E(P,true)));});};r.status&&(r.status.fetchDispatched=true);let b=new Promise(y).then(E,I),T=Object.assign(b,{__abortController:s,__staleWhileFetching:o,__returned:void 0});return e===void 0?(this.set(i,T,{...u.options,status:void 0}),e=t(this,R).get(i)):t(this,g)[e]=T,T},O=function(i){if(!t(this,ht))return false;let e=i;return !!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof Pt},$t=function(i,e){t(this,Y)[e]=i,t(this,V)[i]=e;},Rt=function(i){i!==t(this,D)&&(i===t(this,M)?f(this,M,t(this,V)[i]):h(this,n,$t).call(this,t(this,Y)[i],t(this,V)[i]),h(this,n,$t).call(this,t(this,D),i),f(this,D,i));},lt=function(i,e){var a,o;let r=false;if(t(this,C)!==0){let s=t(this,R).get(i);if(s!==void 0)if(t(this,W)?.[s]&&(clearTimeout(t(this,W)?.[s]),t(this,W)[s]=void 0),r=true,t(this,C)===1)h(this,n,jt).call(this,e);else {t(this,dt).call(this,s);let l=t(this,g)[s];if(h(this,n,O).call(this,l)?l.__abortController.abort(new Error("deleted")):(t(this,tt)||t(this,L))&&(t(this,tt)&&((a=t(this,k))==null||a.call(this,l,i,e)),t(this,L)&&t(this,N)?.push([l,i,e])),t(this,R).delete(i),t(this,w)[s]=void 0,t(this,g)[s]=void 0,s===t(this,D))f(this,D,t(this,Y)[s]);else if(s===t(this,M))f(this,M,t(this,V)[s]);else {let u=t(this,Y)[s];t(this,V)[u]=t(this,V)[s];let E=t(this,V)[s];t(this,Y)[E]=t(this,Y)[s];}Mt(this,C)._--,t(this,q).push(s);}}if(t(this,L)&&t(this,N)?.length){let s=t(this,N),l;for(;l=s?.shift();)(o=t(this,B))==null||o.call(this,...l);}return r},jt=function(i){var e,r;for(let a of h(this,n,nt).call(this,{allowStale:true})){let o=t(this,g)[a];if(h(this,n,O).call(this,o))o.__abortController.abort(new Error("deleted"));else {let s=t(this,w)[a];t(this,tt)&&((e=t(this,k))==null||e.call(this,o,s,i)),t(this,L)&&t(this,N)?.push([o,s,i]);}}if(t(this,R).clear(),t(this,g).fill(void 0),t(this,w).fill(void 0),t(this,K)&&t(this,Z)){t(this,K).fill(0),t(this,Z).fill(0);for(let a of t(this,W)??[])a!==void 0&&clearTimeout(a);t(this,W)?.fill(void 0);}if(t(this,Q)&&t(this,Q).fill(0),f(this,M,0),f(this,D,0),t(this,q).length=0,f(this,J,0),f(this,C,0),t(this,L)&&t(this,N)){let a=t(this,N),o;for(;o=a?.shift();)(r=t(this,B))==null||r.call(this,...o);}},At);var ct=class{constructor(i){_(this,"cache");_(this,"map",new Map);this.cache=new ie({max:i.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){this.cache.clear(),this.map.clear();}delete(i){let e=this.map.delete(i);return e&&this.cache.delete(i),e}get forEach(){return this.map.forEach}get(i){let e=this.cache.get(i);return e||this.map.get(i)}has(i){return this.map.has(i)}set(i,e){return this.map.set(i,e),this.cache.set(i,e),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var et;(a=>(a.log=(o,...s)=>console.log(`[Pixi\u2019VN] ${o}`,...s),a.warn=(o,...s)=>console.warn(`[Pixi\u2019VN] ${o}`,...s),a.error=(o,...s)=>console.error(`[Pixi\u2019VN] ${o}`,...s),a.info=(o,...s)=>console.info(`[Pixi\u2019VN] ${o}`,...s)))(et||(et={}));function Dt(c){try{if(typeof c>"u")return c;let i=JSON.stringify(c);return JSON.parse(i)}catch(i){throw et.error("Error creating exportable element",c,i),new core.PixiError("not_json_serializable","Error creating exportable element")}}var kt;(d=>{d.storage=new ct({cacheSize:50}),d.defaultStorage=new ct({cacheSize:10}),d.tempStorageDeadlines=new Map;let r;function a(y){d.tempStorageDeadlines.forEach((b,T)=>{b>y&&(d.storage.delete(`${ut}:${T}`),r?.onClearOldTempVariable?.(T),d.tempStorageDeadlines.delete(T));});}d.clearOldTempVariables=a;function o(y){r=y;}d.setExternalStoreHandler=o;function s(y,b,T){T==null?d.storage.delete(`${y}:${b}`):d.storage.set(`${y}:${b}`,T),r?.onSetVariable?.(b,T);}d.setVariable=s;function l(y,b){let T=d.storage.get(`${y}:${b}`);return Dt(T)}d.getVariable=l;function u(y,b){d.storage.delete(`${y}:${b}`),r?.onRemoveVariable?.(b);}d.removeVariable=u;function E(y,b){let T=d.storage.get(Ft)||[];if(b)T.includes(y)||T.push(y);else {let A=T.indexOf(y);A>-1&&T.splice(A,1);}d.storage.set(Ft,T);}d.setFlag=E;function I(y){return (d.storage.get(Ft)||[]).includes(y)}d.getFlag=I;})(kt||(kt={}));var S=kt;var vt=class{constructor(i,e){_(this,"id");_(this,"categoryId");this.categoryId=i,this.id=e,this.migrateOldStorage();}migrateOldStorage(i=this.categoryId){let e=S.getVariable(st,i);e&&(Object.entries(e).forEach(([r,a])=>{typeof a=="object"&&a!==null&&Object.entries(a).forEach(([o,s])=>{S.setVariable(this.categoryId,`${r}:${o}`,s);});}),S.removeVariable(st,i));}setStorageProperty(i,e){S.setVariable(this.categoryId,`${this.id}:${i}`,e);}getStorageProperty(i,e=this.id){return S.getVariable(this.categoryId,`${e}:${i}`)}};var ue="@",Ot=class extends vt{constructor(e,r=""){super(U.CHARACTER_CATEGORY_KEY,e+(r?ue+r:""));_(this,"sourceId");this.sourceId=e,this.migrateOldStorage("___character___");}getStorageProperty(e){let r=super.getStorageProperty(e);return r===void 0&&(r=super.getStorageProperty(e,this.sourceId)),r}};var Ut=class extends Ot{constructor(e,r){super(typeof e=="string"?e:e.id,typeof e=="string"?"":e.emotion);_(this,"defaultName");_(this,"defaultSurname");_(this,"defaultAge");_(this,"_icon");_(this,"_color");this.defaultName=r.name,this.defaultSurname=r.surname,this.defaultAge=r.age,this._icon=r.icon,this._color=r.color;}get name(){return this.getStorageProperty("name")||this.defaultName||this.id}set name(e){this.setStorageProperty("name",e);}get surname(){return this.getStorageProperty("surname")||this.defaultSurname}set surname(e){this.setStorageProperty("surname",e);}get age(){return this.getStorageProperty("age")||this.defaultAge}set age(e){this.setStorageProperty("age",e);}get icon(){return this._icon}get color(){return this._color}};var wt=new ct({cacheSize:10}),Bt;(o=>{function c(s){try{let l=wt.get(s);if(!l){et.warn(`Character "${s}" not found, did you forget to register it with the RegisteredCharacters.add?`);return}return l}catch(l){et.error(`Error while getting Character "${s}"`,l);return}}o.get=c;function i(s){if(Array.isArray(s)){s.forEach(l=>{i(l);});return}wt.get(s.id)&&et.info(`Character id "${s.id}" already exists, it will be overwritten`),wt.set(s.id,s);}o.add=i;function e(){return Array.from(wt.values())}o.values=e;function r(s){return wt.has(s)}o.has=r;function a(){return Array.from(wt.keys())}o.keys=a;})(Bt||(Bt={}));var fe=Bt;exports.CharacterBaseModel=Ut;exports.CharacterStoredClass=Ot;exports.RegisteredCharacters=fe;
|
|
1
|
+
'use strict';var core=require('@drincs/pixi-vn/core');var se=Object.defineProperty;var Xt=c=>{throw TypeError(c)};var ae=(c,i,e)=>i in c?se(c,i,{enumerable:true,configurable:true,writable:true,value:e}):c[i]=e;var _=(c,i,e)=>ae(c,typeof i!="symbol"?i+"":i,e),Yt=(c,i,e)=>i.has(c)||Xt("Cannot "+e);var t=(c,i,e)=>(Yt(c,i,"read from private field"),e?e.call(c):i.get(c)),m=(c,i,e)=>i.has(c)?Xt("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(c):i.set(c,e),f=(c,i,e,r)=>(Yt(c,i,"write to private field"),i.set(c,e),e),h=(c,i,e)=>(Yt(c,i,"access private method"),e);var Mt=(c,i,e,r)=>({set _(a){f(c,i,a);},get _(){return t(c,i,r)}});var st="storage",ut="temp",Ft="flags",z={CHARACTER_CATEGORY_KEY:"character"};var oe=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Zt=new Set,Kt=typeof process=="object"&&process?process:{},te=(c,i,e,r)=>{typeof Kt.emitWarning=="function"?Kt.emitWarning(c,i,e,r):console.error(`[${e}] ${i}: ${c}`);},Ut=globalThis.AbortController,Jt=globalThis.AbortSignal;if(typeof Ut>"u"){Jt=class{constructor(){_(this,"onabort");_(this,"_onabort",[]);_(this,"reason");_(this,"aborted",false);}addEventListener(e,r){this._onabort.push(r);}},Ut=class{constructor(){_(this,"signal",new Jt);i();}abort(e){if(!this.signal.aborted){this.signal.reason=e,this.signal.aborted=true;for(let r of this.signal._onabort)r(e);this.signal.onabort?.(e);}}};let c=Kt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",i=()=>{c&&(c=false,te("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",i));};}var ne=c=>!Zt.has(c);var at=c=>c&&c===Math.floor(c)&&c>0&&isFinite(c),ee=c=>at(c)?c<=Math.pow(2,8)?Uint8Array:c<=Math.pow(2,16)?Uint16Array:c<=Math.pow(2,32)?Uint32Array:c<=Number.MAX_SAFE_INTEGER?Gt:null:null,Gt=class extends Array{constructor(c){super(c),this.fill(0);}},it,St,le=(it=class{constructor(i,e){_(this,"heap");_(this,"length");if(!t(it,St))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(i),this.length=0;}static create(i){let e=ee(i);if(!e)return [];f(it,St,true);let r=new it(i,e);return f(it,St,false),r}push(i){this.heap[this.length++]=i;}pop(){return this.heap[--this.length]}},St=new WeakMap,m(it,St,false),it),qt,Qt,j,P,k,ft,B,Et,Tt,X,C,J,R,w,g,V,Y,M,D,q,N,Q,Z,K,W,tt,ht,L,yt,n,Wt,gt,rt,Ct,H,re,dt,bt,It,ot,nt,Ht,Vt,Lt,v,$t,Rt,lt,jt,At,ie=(At=class{constructor(i){m(this,n);m(this,j);m(this,P);m(this,k);m(this,ft);m(this,B);m(this,Et);m(this,Tt);m(this,X);_(this,"ttl");_(this,"ttlResolution");_(this,"ttlAutopurge");_(this,"updateAgeOnGet");_(this,"updateAgeOnHas");_(this,"allowStale");_(this,"noDisposeOnSet");_(this,"noUpdateTTL");_(this,"maxEntrySize");_(this,"sizeCalculation");_(this,"noDeleteOnFetchRejection");_(this,"noDeleteOnStaleGet");_(this,"allowStaleOnFetchAbort");_(this,"allowStaleOnFetchRejection");_(this,"ignoreFetchAbort");m(this,C);m(this,J);m(this,R);m(this,w);m(this,g);m(this,V);m(this,Y);m(this,M);m(this,D);m(this,q);m(this,N);m(this,Q);m(this,Z);m(this,K);m(this,W);m(this,tt);m(this,ht);m(this,L);m(this,yt);m(this,gt,()=>{});m(this,rt,()=>{});m(this,Ct,()=>{});m(this,H,()=>false);m(this,dt,i=>{});m(this,bt,(i,e,r)=>{});m(this,It,(i,e,r,a)=>{if(r||a)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});_(this,qt,"LRUCache");let{max:e=0,ttl:r,ttlResolution:a=1,ttlAutopurge:o,updateAgeOnGet:s,updateAgeOnHas:l,allowStale:u,dispose:E,onInsert:I,disposeAfter:d,noDisposeOnSet:b,noUpdateTTL:y,maxSize:T=0,maxEntrySize:A=0,sizeCalculation:O,fetchMethod:p,memoMethod:F,noDeleteOnFetchRejection:U,noDeleteOnStaleGet:G,allowStaleOnFetchRejection:x,allowStaleOnFetchAbort:xt,ignoreFetchAbort:pt,perf:_t}=i;if(_t!==void 0&&typeof _t?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(f(this,X,_t??oe),e!==0&&!at(e))throw new TypeError("max option must be a nonnegative integer");let mt=e?ee(e):Array;if(!mt)throw new Error("invalid max value: "+e);if(f(this,j,e),f(this,P,T),this.maxEntrySize=A||t(this,P),this.sizeCalculation=O,this.sizeCalculation){if(!t(this,P)&&!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(F!==void 0&&typeof F!="function")throw new TypeError("memoMethod must be a function if defined");if(f(this,Tt,F),p!==void 0&&typeof p!="function")throw new TypeError("fetchMethod must be a function if specified");if(f(this,Et,p),f(this,ht,!!p),f(this,R,new Map),f(this,w,new Array(e).fill(void 0)),f(this,g,new Array(e).fill(void 0)),f(this,V,new mt(e)),f(this,Y,new mt(e)),f(this,M,0),f(this,D,0),f(this,q,le.create(e)),f(this,C,0),f(this,J,0),typeof E=="function"&&f(this,k,E),typeof I=="function"&&f(this,ft,I),typeof d=="function"?(f(this,B,d),f(this,N,[])):(f(this,B,void 0),f(this,N,void 0)),f(this,tt,!!t(this,k)),f(this,yt,!!t(this,ft)),f(this,L,!!t(this,B)),this.noDisposeOnSet=!!b,this.noUpdateTTL=!!y,this.noDeleteOnFetchRejection=!!U,this.allowStaleOnFetchRejection=!!x,this.allowStaleOnFetchAbort=!!xt,this.ignoreFetchAbort=!!pt,this.maxEntrySize!==0){if(t(this,P)!==0&&!at(t(this,P)))throw new TypeError("maxSize must be a positive integer if specified");if(!at(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");h(this,n,re).call(this);}if(this.allowStale=!!u,this.noDeleteOnStaleGet=!!G,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!l,this.ttlResolution=at(a)||a===0?a:1,this.ttlAutopurge=!!o,this.ttl=r||0,this.ttl){if(!at(this.ttl))throw new TypeError("ttl must be a positive integer if specified");h(this,n,Wt).call(this);}if(t(this,j)===0&&this.ttl===0&&t(this,P)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,j)&&!t(this,P)){let Pt="LRU_CACHE_UNBOUNDED";ne(Pt)&&(Zt.add(Pt),te("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Pt,At));}}get perf(){return t(this,X)}static unsafeExposeInternals(i){return {starts:t(i,Z),ttls:t(i,K),autopurgeTimers:t(i,W),sizes:t(i,Q),keyMap:t(i,R),keyList:t(i,w),valList:t(i,g),next:t(i,V),prev:t(i,Y),get head(){return t(i,M)},get tail(){return t(i,D)},free:t(i,q),isBackgroundFetch:e=>{var r;return h(r=i,n,v).call(r,e)},backgroundFetch:(e,r,a,o)=>{var s;return h(s=i,n,Lt).call(s,e,r,a,o)},moveToTail:e=>{var r;return h(r=i,n,Rt).call(r,e)},indexes:e=>{var r;return h(r=i,n,ot).call(r,e)},rindexes:e=>{var r;return h(r=i,n,nt).call(r,e)},isStale:e=>{var r;return t(r=i,H).call(r,e)}}}get max(){return t(this,j)}get maxSize(){return t(this,P)}get calculatedSize(){return t(this,J)}get size(){return t(this,C)}get fetchMethod(){return t(this,Et)}get memoMethod(){return t(this,Tt)}get dispose(){return t(this,k)}get onInsert(){return t(this,ft)}get disposeAfter(){return t(this,B)}getRemainingTTL(i){return t(this,R).has(i)?1/0:0}*entries(){for(let i of h(this,n,ot).call(this))t(this,g)[i]!==void 0&&t(this,w)[i]!==void 0&&!h(this,n,v).call(this,t(this,g)[i])&&(yield [t(this,w)[i],t(this,g)[i]]);}*rentries(){for(let i of h(this,n,nt).call(this))t(this,g)[i]!==void 0&&t(this,w)[i]!==void 0&&!h(this,n,v).call(this,t(this,g)[i])&&(yield [t(this,w)[i],t(this,g)[i]]);}*keys(){for(let i of h(this,n,ot).call(this)){let e=t(this,w)[i];e!==void 0&&!h(this,n,v).call(this,t(this,g)[i])&&(yield e);}}*rkeys(){for(let i of h(this,n,nt).call(this)){let e=t(this,w)[i];e!==void 0&&!h(this,n,v).call(this,t(this,g)[i])&&(yield e);}}*values(){for(let i of h(this,n,ot).call(this))t(this,g)[i]!==void 0&&!h(this,n,v).call(this,t(this,g)[i])&&(yield t(this,g)[i]);}*rvalues(){for(let i of h(this,n,nt).call(this))t(this,g)[i]!==void 0&&!h(this,n,v).call(this,t(this,g)[i])&&(yield t(this,g)[i]);}[(Qt=Symbol.iterator,qt=Symbol.toStringTag,Qt)](){return this.entries()}find(i,e={}){for(let r of h(this,n,ot).call(this)){let a=t(this,g)[r],o=h(this,n,v).call(this,a)?a.__staleWhileFetching:a;if(o!==void 0&&i(o,t(this,w)[r],this))return this.get(t(this,w)[r],e)}}forEach(i,e=this){for(let r of h(this,n,ot).call(this)){let a=t(this,g)[r],o=h(this,n,v).call(this,a)?a.__staleWhileFetching:a;o!==void 0&&i.call(e,o,t(this,w)[r],this);}}rforEach(i,e=this){for(let r of h(this,n,nt).call(this)){let a=t(this,g)[r],o=h(this,n,v).call(this,a)?a.__staleWhileFetching:a;o!==void 0&&i.call(e,o,t(this,w)[r],this);}}purgeStale(){let i=false;for(let e of h(this,n,nt).call(this,{allowStale:true}))t(this,H).call(this,e)&&(h(this,n,lt).call(this,t(this,w)[e],"expire"),i=true);return i}info(i){let e=t(this,R).get(i);if(e===void 0)return;let r=t(this,g)[e],a=h(this,n,v).call(this,r)?r.__staleWhileFetching:r;if(a===void 0)return;let o={value:a};if(t(this,K)&&t(this,Z)){let s=t(this,K)[e],l=t(this,Z)[e];if(s&&l){let u=s-(t(this,X).now()-l);o.ttl=u,o.start=Date.now();}}return t(this,Q)&&(o.size=t(this,Q)[e]),o}dump(){let i=[];for(let e of h(this,n,ot).call(this,{allowStale:true})){let r=t(this,w)[e],a=t(this,g)[e],o=h(this,n,v).call(this,a)?a.__staleWhileFetching:a;if(o===void 0||r===void 0)continue;let s={value:o};if(t(this,K)&&t(this,Z)){s.ttl=t(this,K)[e];let l=t(this,X).now()-t(this,Z)[e];s.start=Math.floor(Date.now()-l);}t(this,Q)&&(s.size=t(this,Q)[e]),i.unshift([r,s]);}return i}load(i){this.clear();for(let[e,r]of i){if(r.start){let a=Date.now()-r.start;r.start=t(this,X).now()-a;}this.set(e,r.value,r);}}set(i,e,r={}){var b,y,T,A;if(e===void 0)return this.delete(i),this;let{ttl:a=this.ttl,start:o,noDisposeOnSet:s=this.noDisposeOnSet,sizeCalculation:l=this.sizeCalculation,status:u}=r,{noUpdateTTL:E=this.noUpdateTTL}=r,I=t(this,It).call(this,i,e,r.size||0,l);if(this.maxEntrySize&&I>this.maxEntrySize)return u&&(u.set="miss",u.maxEntrySizeExceeded=true),h(this,n,lt).call(this,i,"set"),this;let d=t(this,C)===0?void 0:t(this,R).get(i);if(d===void 0)d=t(this,C)===0?t(this,D):t(this,q).length!==0?t(this,q).pop():t(this,C)===t(this,j)?h(this,n,Vt).call(this,false):t(this,C),t(this,w)[d]=i,t(this,g)[d]=e,t(this,R).set(i,d),t(this,V)[t(this,D)]=d,t(this,Y)[d]=t(this,D),f(this,D,d),Mt(this,C)._++,t(this,bt).call(this,d,I,u),u&&(u.set="add"),E=false,t(this,yt)&&((b=t(this,ft))==null||b.call(this,e,i,"add"));else {h(this,n,Rt).call(this,d);let O=t(this,g)[d];if(e!==O){if(t(this,ht)&&h(this,n,v).call(this,O)){O.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=O;p!==void 0&&!s&&(t(this,tt)&&((y=t(this,k))==null||y.call(this,p,i,"set")),t(this,L)&&t(this,N)?.push([p,i,"set"]));}else s||(t(this,tt)&&((T=t(this,k))==null||T.call(this,O,i,"set")),t(this,L)&&t(this,N)?.push([O,i,"set"]));if(t(this,dt).call(this,d),t(this,bt).call(this,d,I,u),t(this,g)[d]=e,u){u.set="replace";let p=O&&h(this,n,v).call(this,O)?O.__staleWhileFetching:O;p!==void 0&&(u.oldValue=p);}}else u&&(u.set="update");t(this,yt)&&this.onInsert?.(e,i,e===O?"update":"replace");}if(a!==0&&!t(this,K)&&h(this,n,Wt).call(this),t(this,K)&&(E||t(this,Ct).call(this,d,a,o),u&&t(this,rt).call(this,u,d)),!s&&t(this,L)&&t(this,N)){let O=t(this,N),p;for(;p=O?.shift();)(A=t(this,B))==null||A.call(this,...p);}return this}pop(){var i;try{for(;t(this,C);){let e=t(this,g)[t(this,M)];if(h(this,n,Vt).call(this,!0),h(this,n,v).call(this,e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(t(this,L)&&t(this,N)){let e=t(this,N),r;for(;r=e?.shift();)(i=t(this,B))==null||i.call(this,...r);}}}has(i,e={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:a}=e,o=t(this,R).get(i);if(o!==void 0){let s=t(this,g)[o];if(h(this,n,v).call(this,s)&&s.__staleWhileFetching===void 0)return false;if(t(this,H).call(this,o))a&&(a.has="stale",t(this,rt).call(this,a,o));else return r&&t(this,gt).call(this,o),a&&(a.has="hit",t(this,rt).call(this,a,o)),true}else a&&(a.has="miss");return false}peek(i,e={}){let{allowStale:r=this.allowStale}=e,a=t(this,R).get(i);if(a===void 0||!r&&t(this,H).call(this,a))return;let o=t(this,g)[a];return h(this,n,v).call(this,o)?o.__staleWhileFetching:o}async fetch(i,e={}){let{allowStale:r=this.allowStale,updateAgeOnGet:a=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:s=this.ttl,noDisposeOnSet:l=this.noDisposeOnSet,size:u=0,sizeCalculation:E=this.sizeCalculation,noUpdateTTL:I=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:b=this.allowStaleOnFetchRejection,ignoreFetchAbort:y=this.ignoreFetchAbort,allowStaleOnFetchAbort:T=this.allowStaleOnFetchAbort,context:A,forceRefresh:O=false,status:p,signal:F}=e;if(!t(this,ht))return p&&(p.fetch="get"),this.get(i,{allowStale:r,updateAgeOnGet:a,noDeleteOnStaleGet:o,status:p});let U={allowStale:r,updateAgeOnGet:a,noDeleteOnStaleGet:o,ttl:s,noDisposeOnSet:l,size:u,sizeCalculation:E,noUpdateTTL:I,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:b,allowStaleOnFetchAbort:T,ignoreFetchAbort:y,status:p,signal:F},G=t(this,R).get(i);if(G===void 0){p&&(p.fetch="miss");let x=h(this,n,Lt).call(this,i,G,U,A);return x.__returned=x}else {let x=t(this,g)[G];if(h(this,n,v).call(this,x)){let mt=r&&x.__staleWhileFetching!==void 0;return p&&(p.fetch="inflight",mt&&(p.returnedStale=true)),mt?x.__staleWhileFetching:x.__returned=x}let xt=t(this,H).call(this,G);if(!O&&!xt)return p&&(p.fetch="hit"),h(this,n,Rt).call(this,G),a&&t(this,gt).call(this,G),p&&t(this,rt).call(this,p,G),x;let pt=h(this,n,Lt).call(this,i,G,U,A),_t=pt.__staleWhileFetching!==void 0&&r;return p&&(p.fetch=xt?"stale":"refresh",_t&&xt&&(p.returnedStale=true)),_t?pt.__staleWhileFetching:pt.__returned=pt}}async forceFetch(i,e={}){let r=await this.fetch(i,e);if(r===void 0)throw new Error("fetch() returned undefined");return r}memo(i,e={}){let r=t(this,Tt);if(!r)throw new Error("no memoMethod provided to constructor");let{context:a,forceRefresh:o,...s}=e,l=this.get(i,s);if(!o&&l!==void 0)return l;let u=r(i,l,{options:s,context:a});return this.set(i,u,s),u}get(i,e={}){let{allowStale:r=this.allowStale,updateAgeOnGet:a=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:s}=e,l=t(this,R).get(i);if(l!==void 0){let u=t(this,g)[l],E=h(this,n,v).call(this,u);return s&&t(this,rt).call(this,s,l),t(this,H).call(this,l)?(s&&(s.get="stale"),E?(s&&r&&u.__staleWhileFetching!==void 0&&(s.returnedStale=true),r?u.__staleWhileFetching:void 0):(o||h(this,n,lt).call(this,i,"expire"),s&&r&&(s.returnedStale=true),r?u:void 0)):(s&&(s.get="hit"),E?u.__staleWhileFetching:(h(this,n,Rt).call(this,l),a&&t(this,gt).call(this,l),u))}else s&&(s.get="miss");}delete(i){return h(this,n,lt).call(this,i,"delete")}clear(){return h(this,n,jt).call(this,"delete")}},j=new WeakMap,P=new WeakMap,k=new WeakMap,ft=new WeakMap,B=new WeakMap,Et=new WeakMap,Tt=new WeakMap,X=new WeakMap,C=new WeakMap,J=new WeakMap,R=new WeakMap,w=new WeakMap,g=new WeakMap,V=new WeakMap,Y=new WeakMap,M=new WeakMap,D=new WeakMap,q=new WeakMap,N=new WeakMap,Q=new WeakMap,Z=new WeakMap,K=new WeakMap,W=new WeakMap,tt=new WeakMap,ht=new WeakMap,L=new WeakMap,yt=new WeakMap,n=new WeakSet,Wt=function(){let i=new Gt(t(this,j)),e=new Gt(t(this,j));f(this,K,i),f(this,Z,e);let r=this.ttlAutopurge?new Array(t(this,j)):void 0;f(this,W,r),f(this,Ct,(l,u,E=t(this,X).now())=>{e[l]=u!==0?E:0,i[l]=u,a(l,u);}),f(this,gt,l=>{e[l]=i[l]!==0?t(this,X).now():0,a(l,i[l]);});let a=this.ttlAutopurge?(l,u)=>{if(r?.[l]&&(clearTimeout(r[l]),r[l]=void 0),u&&u!==0&&r){let E=setTimeout(()=>{t(this,H).call(this,l)&&h(this,n,lt).call(this,t(this,w)[l],"expire");},u+1);E.unref&&E.unref(),r[l]=E;}}:()=>{};f(this,rt,(l,u)=>{if(i[u]){let E=i[u],I=e[u];if(!E||!I)return;l.ttl=E,l.start=I,l.now=o||s();let d=l.now-I;l.remainingTTL=E-d;}});let o=0,s=()=>{let l=t(this,X).now();if(this.ttlResolution>0){o=l;let u=setTimeout(()=>o=0,this.ttlResolution);u.unref&&u.unref();}return l};this.getRemainingTTL=l=>{let u=t(this,R).get(l);if(u===void 0)return 0;let E=i[u],I=e[u];if(!E||!I)return 1/0;let d=(o||s())-I;return E-d},f(this,H,l=>{let u=e[l],E=i[l];return !!E&&!!u&&(o||s())-u>E});},gt=new WeakMap,rt=new WeakMap,Ct=new WeakMap,H=new WeakMap,re=function(){let i=new Gt(t(this,j));f(this,J,0),f(this,Q,i),f(this,dt,e=>{f(this,J,t(this,J)-i[e]),i[e]=0;}),f(this,It,(e,r,a,o)=>{if(h(this,n,v).call(this,r))return 0;if(!at(a))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(a=o(r,e),!at(a))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 a}),f(this,bt,(e,r,a)=>{if(i[e]=r,t(this,P)){let o=t(this,P)-i[e];for(;t(this,J)>o;)h(this,n,Vt).call(this,true);}f(this,J,t(this,J)+i[e]),a&&(a.entrySize=r,a.totalCalculatedSize=t(this,J));});},dt=new WeakMap,bt=new WeakMap,It=new WeakMap,ot=function*({allowStale:i=this.allowStale}={}){if(t(this,C))for(let e=t(this,D);!(!h(this,n,Ht).call(this,e)||((i||!t(this,H).call(this,e))&&(yield e),e===t(this,M)));)e=t(this,Y)[e];},nt=function*({allowStale:i=this.allowStale}={}){if(t(this,C))for(let e=t(this,M);!(!h(this,n,Ht).call(this,e)||((i||!t(this,H).call(this,e))&&(yield e),e===t(this,D)));)e=t(this,V)[e];},Ht=function(i){return i!==void 0&&t(this,R).get(t(this,w)[i])===i},Vt=function(i){var o;let e=t(this,M),r=t(this,w)[e],a=t(this,g)[e];return t(this,ht)&&h(this,n,v).call(this,a)?a.__abortController.abort(new Error("evicted")):(t(this,tt)||t(this,L))&&(t(this,tt)&&((o=t(this,k))==null||o.call(this,a,r,"evict")),t(this,L)&&t(this,N)?.push([a,r,"evict"])),t(this,dt).call(this,e),t(this,W)?.[e]&&(clearTimeout(t(this,W)[e]),t(this,W)[e]=void 0),i&&(t(this,w)[e]=void 0,t(this,g)[e]=void 0,t(this,q).push(e)),t(this,C)===1?(f(this,M,f(this,D,0)),t(this,q).length=0):f(this,M,t(this,V)[e]),t(this,R).delete(r),Mt(this,C)._--,e},Lt=function(i,e,r,a){let o=e===void 0?void 0:t(this,g)[e];if(h(this,n,v).call(this,o))return o;let s=new Ut,{signal:l}=r;l?.addEventListener("abort",()=>s.abort(l.reason),{signal:s.signal});let u={signal:s.signal,options:r,context:a},E=(A,O=false)=>{let{aborted:p}=s.signal,F=r.ignoreFetchAbort&&A!==void 0,U=r.ignoreFetchAbort||!!(r.allowStaleOnFetchAbort&&A!==void 0);if(r.status&&(p&&!O?(r.status.fetchAborted=true,r.status.fetchError=s.signal.reason,F&&(r.status.fetchAbortIgnored=true)):r.status.fetchResolved=true),p&&!F&&!O)return d(s.signal.reason,U);let G=y,x=t(this,g)[e];return (x===y||F&&O&&x===void 0)&&(A===void 0?G.__staleWhileFetching!==void 0?t(this,g)[e]=G.__staleWhileFetching:h(this,n,lt).call(this,i,"fetch"):(r.status&&(r.status.fetchUpdated=true),this.set(i,A,u.options))),A},I=A=>(r.status&&(r.status.fetchRejected=true,r.status.fetchError=A),d(A,false)),d=(A,O)=>{let{aborted:p}=s.signal,F=p&&r.allowStaleOnFetchAbort,U=F||r.allowStaleOnFetchRejection,G=U||r.noDeleteOnFetchRejection,x=y;if(t(this,g)[e]===y&&(!G||!O&&x.__staleWhileFetching===void 0?h(this,n,lt).call(this,i,"fetch"):F||(t(this,g)[e]=x.__staleWhileFetching)),U)return r.status&&x.__staleWhileFetching!==void 0&&(r.status.returnedStale=true),x.__staleWhileFetching;if(x.__returned===x)throw A},b=(A,O)=>{var F;let p=(F=t(this,Et))==null?void 0:F.call(this,i,o,u);p&&p instanceof Promise&&p.then(U=>A(U===void 0?void 0:U),O),s.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(A(void 0),r.allowStaleOnFetchAbort&&(A=U=>E(U,true)));});};r.status&&(r.status.fetchDispatched=true);let y=new Promise(b).then(E,I),T=Object.assign(y,{__abortController:s,__staleWhileFetching:o,__returned:void 0});return e===void 0?(this.set(i,T,{...u.options,status:void 0}),e=t(this,R).get(i)):t(this,g)[e]=T,T},v=function(i){if(!t(this,ht))return false;let e=i;return !!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof Ut},$t=function(i,e){t(this,Y)[e]=i,t(this,V)[i]=e;},Rt=function(i){i!==t(this,D)&&(i===t(this,M)?f(this,M,t(this,V)[i]):h(this,n,$t).call(this,t(this,Y)[i],t(this,V)[i]),h(this,n,$t).call(this,t(this,D),i),f(this,D,i));},lt=function(i,e){var a,o;let r=false;if(t(this,C)!==0){let s=t(this,R).get(i);if(s!==void 0)if(t(this,W)?.[s]&&(clearTimeout(t(this,W)?.[s]),t(this,W)[s]=void 0),r=true,t(this,C)===1)h(this,n,jt).call(this,e);else {t(this,dt).call(this,s);let l=t(this,g)[s];if(h(this,n,v).call(this,l)?l.__abortController.abort(new Error("deleted")):(t(this,tt)||t(this,L))&&(t(this,tt)&&((a=t(this,k))==null||a.call(this,l,i,e)),t(this,L)&&t(this,N)?.push([l,i,e])),t(this,R).delete(i),t(this,w)[s]=void 0,t(this,g)[s]=void 0,s===t(this,D))f(this,D,t(this,Y)[s]);else if(s===t(this,M))f(this,M,t(this,V)[s]);else {let u=t(this,Y)[s];t(this,V)[u]=t(this,V)[s];let E=t(this,V)[s];t(this,Y)[E]=t(this,Y)[s];}Mt(this,C)._--,t(this,q).push(s);}}if(t(this,L)&&t(this,N)?.length){let s=t(this,N),l;for(;l=s?.shift();)(o=t(this,B))==null||o.call(this,...l);}return r},jt=function(i){var e,r;for(let a of h(this,n,nt).call(this,{allowStale:true})){let o=t(this,g)[a];if(h(this,n,v).call(this,o))o.__abortController.abort(new Error("deleted"));else {let s=t(this,w)[a];t(this,tt)&&((e=t(this,k))==null||e.call(this,o,s,i)),t(this,L)&&t(this,N)?.push([o,s,i]);}}if(t(this,R).clear(),t(this,g).fill(void 0),t(this,w).fill(void 0),t(this,K)&&t(this,Z)){t(this,K).fill(0),t(this,Z).fill(0);for(let a of t(this,W)??[])a!==void 0&&clearTimeout(a);t(this,W)?.fill(void 0);}if(t(this,Q)&&t(this,Q).fill(0),f(this,M,0),f(this,D,0),t(this,q).length=0,f(this,J,0),f(this,C,0),t(this,L)&&t(this,N)){let a=t(this,N),o;for(;o=a?.shift();)(r=t(this,B))==null||r.call(this,...o);}},At);var ct=class{constructor(i){_(this,"cache");_(this,"map",new Map);this.cache=new ie({max:i.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){this.cache.clear(),this.map.clear();}delete(i){let e=this.map.delete(i);return e&&this.cache.delete(i),e}get forEach(){return this.map.forEach}get(i){let e=this.cache.get(i);return e||this.map.get(i)}has(i){return this.map.has(i)}set(i,e){return this.map.set(i,e),this.cache.set(i,e),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var et;(a=>(a.log=(o,...s)=>console.log(`[Pixi\u2019VN] ${o}`,...s),a.warn=(o,...s)=>console.warn(`[Pixi\u2019VN] ${o}`,...s),a.error=(o,...s)=>console.error(`[Pixi\u2019VN] ${o}`,...s),a.info=(o,...s)=>console.info(`[Pixi\u2019VN] ${o}`,...s)))(et||(et={}));function Dt(c){try{if(typeof c>"u")return c;let i=JSON.stringify(c);return JSON.parse(i)}catch(i){throw et.error("Error creating exportable element",c,i),new core.PixiError("not_json_serializable","Error creating exportable element")}}var kt;(d=>{d.storage=new ct({cacheSize:50}),d.defaultStorage=new ct({cacheSize:10}),d.tempStorageDeadlines=new Map;let r;function a(b){d.tempStorageDeadlines.forEach((y,T)=>{y>b&&(d.storage.delete(`${ut}:${T}`),r?.onClearOldTempVariable?.(T),d.tempStorageDeadlines.delete(T));});}d.clearOldTempVariables=a;function o(b){r=b;}d.setExternalStoreHandler=o;function s(b,y,T){T==null?d.storage.delete(`${b}:${y}`):d.storage.set(`${b}:${y}`,T),r?.onSetVariable?.(y,T);}d.setVariable=s;function l(b,y){let T=d.storage.get(`${b}:${y}`);return Dt(T)}d.getVariable=l;function u(b,y){d.storage.delete(`${b}:${y}`),r?.onRemoveVariable?.(y);}d.removeVariable=u;function E(b,y){let T=d.storage.get(Ft)||[];if(y)T.includes(b)||T.push(b);else {let A=T.indexOf(b);A>-1&&T.splice(A,1);}d.storage.set(Ft,T);}d.setFlag=E;function I(b){return (d.storage.get(Ft)||[]).includes(b)}d.getFlag=I;})(kt||(kt={}));var S=kt;var Ot=class{constructor(i,e){_(this,"id");_(this,"categoryId");this.categoryId=i,this.id=e,this.migrateOldStorage();}migrateOldStorage(i=this.categoryId){let e=S.getVariable(st,i);e&&(Object.entries(e).forEach(([r,a])=>{typeof a=="object"&&a!==null&&Object.entries(a).forEach(([o,s])=>{S.setVariable(this.categoryId,`${r}:${o}`,s);});}),S.removeVariable(st,i));}setStorageProperty(i,e){S.setVariable(this.categoryId,`${this.id}:${i}`,e);}getStorageProperty(i,e=this.id){return S.getVariable(this.categoryId,`${e}:${i}`)}};var ue="@",vt=class extends Ot{constructor(e,r=""){super(z.CHARACTER_CATEGORY_KEY,e+(r?ue+r:""));_(this,"sourceId");this.sourceId=e,this.migrateOldStorage("___character___");}getStorageProperty(e){let r=super.getStorageProperty(e);return r===void 0&&(r=super.getStorageProperty(e,this.sourceId)),r}};var zt=class extends vt{constructor(e,r){super(typeof e=="string"?e:e.id,typeof e=="string"?"":e.emotion);_(this,"defaultName");_(this,"defaultSurname");_(this,"defaultAge");_(this,"icon");_(this,"color");this.defaultName=r.name,this.defaultSurname=r.surname,this.defaultAge=r.age,this.icon=r.icon,this.color=r.color;}get name(){return this.getStorageProperty("name")||this.defaultName||this.id}set name(e){this.setStorageProperty("name",e);}get surname(){return this.getStorageProperty("surname")||this.defaultSurname}set surname(e){this.setStorageProperty("surname",e);}get age(){return this.getStorageProperty("age")||this.defaultAge}set age(e){this.setStorageProperty("age",e);}};var wt=new ct({cacheSize:10}),Bt;(o=>{function c(s){try{let l=wt.get(s);if(!l){et.warn(`Character "${s}" not found, did you forget to register it with the RegisteredCharacters.add?`);return}return l}catch(l){et.error(`Error while getting Character "${s}"`,l);return}}o.get=c;function i(s){if(Array.isArray(s)){s.forEach(l=>{i(l);});return}wt.get(s.id)&&et.info(`Character id "${s.id}" already exists, it will be overwritten`),wt.set(s.id,s);}o.add=i;function e(){return Array.from(wt.values())}o.values=e;function r(s){return wt.has(s)}o.has=r;function a(){return Array.from(wt.keys())}o.keys=a;})(Bt||(Bt={}));var fe=Bt;exports.CharacterBaseModel=zt;exports.CharacterStoredClass=vt;exports.RegisteredCharacters=fe;
|
package/dist/characters.d.cts
CHANGED
|
@@ -1,37 +1,45 @@
|
|
|
1
|
-
import { S as StoredClassModel } from './StoredClassModel-
|
|
1
|
+
import { S as StoredClassModel } from './StoredClassModel-C9mQxPg-.cjs';
|
|
2
2
|
import { CharacterInterface as CharacterInterface$1 } from '@drincs/pixi-vn';
|
|
3
|
-
import './StorageElementType-
|
|
3
|
+
import './StorageElementType-C7ETezlL.cjs';
|
|
4
|
+
|
|
5
|
+
declare class CharacterStoredClass extends StoredClassModel {
|
|
6
|
+
private sourceId;
|
|
7
|
+
constructor(id: string, emotion?: string);
|
|
8
|
+
getStorageProperty<T>(propertyName: string): T | undefined;
|
|
9
|
+
}
|
|
4
10
|
|
|
5
11
|
/**
|
|
6
12
|
* CharacterBaseModelProps is an interface that is used to create a character model.
|
|
7
13
|
*/
|
|
8
14
|
interface CharacterBaseModelProps {
|
|
9
15
|
/**
|
|
10
|
-
* The name
|
|
16
|
+
* The character's name.
|
|
11
17
|
*/
|
|
12
18
|
name?: string;
|
|
13
19
|
/**
|
|
14
|
-
* The surname
|
|
20
|
+
* The character's surname.
|
|
15
21
|
*/
|
|
16
22
|
surname?: string;
|
|
17
23
|
/**
|
|
18
|
-
* The age
|
|
24
|
+
* The character's age.
|
|
19
25
|
*/
|
|
20
26
|
age?: number;
|
|
21
27
|
/**
|
|
22
|
-
* The icon
|
|
28
|
+
* The character's icon image URL.
|
|
23
29
|
*/
|
|
24
30
|
icon?: string;
|
|
25
31
|
/**
|
|
26
|
-
* The color
|
|
32
|
+
* The character's color.
|
|
27
33
|
*/
|
|
28
34
|
color?: string;
|
|
29
35
|
}
|
|
30
36
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
/**
|
|
38
|
+
* CharacterEmotionId is used to identify a character together with an emotion.
|
|
39
|
+
*/
|
|
40
|
+
interface CharacterEmotionId {
|
|
41
|
+
id: string;
|
|
42
|
+
emotion: string;
|
|
35
43
|
}
|
|
36
44
|
|
|
37
45
|
/**
|
|
@@ -39,64 +47,63 @@ declare class CharacterStoredClass extends StoredClassModel {
|
|
|
39
47
|
* You must use the {@link RegisteredCharacters.add} function to save the character in the game.
|
|
40
48
|
* It is raccomended to create your own class Character, read more here: https://pixi-vn.web.app/start/character.html#custom-character
|
|
41
49
|
* @example
|
|
42
|
-
* ```
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
50
|
+
* ```ts
|
|
51
|
+
* import { CharacterBaseModel, RegisteredCharacters } from "@drincs/pixi-vn";
|
|
52
|
+
*
|
|
53
|
+
* export const liam = new CharacterBaseModel("liam", {
|
|
54
|
+
* name: "Liam",
|
|
55
|
+
* surname: "Smith",
|
|
46
56
|
* age: 25,
|
|
47
|
-
* icon: "https://
|
|
48
|
-
* color: "#9e2e12"
|
|
57
|
+
* icon: "https://example.com/liam.png",
|
|
58
|
+
* color: "#9e2e12",
|
|
49
59
|
* });
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
60
|
+
*
|
|
61
|
+
* export const emma = new CharacterBaseModel("emma", {
|
|
62
|
+
* name: "Emma",
|
|
63
|
+
* surname: "Johnson",
|
|
64
|
+
* age: 23,
|
|
65
|
+
* icon: "https://example.com/emma.png",
|
|
66
|
+
* color: "#9e2e12",
|
|
56
67
|
* });
|
|
57
|
-
*
|
|
68
|
+
*
|
|
69
|
+
* RegisteredCharacters.add([liam, emma]);
|
|
58
70
|
* ```
|
|
59
71
|
*/
|
|
60
72
|
declare class CharacterBaseModel extends CharacterStoredClass {
|
|
61
73
|
/**
|
|
62
|
-
* @param id
|
|
74
|
+
* @param id A unique identifier (string). It is used to reference the character in the game (must be unique). If you want to create a character with an "emotion", you can pass an object.
|
|
63
75
|
* @param props The properties of the character.
|
|
64
76
|
*/
|
|
65
|
-
constructor(id: string |
|
|
66
|
-
|
|
67
|
-
emotion: string;
|
|
68
|
-
}, props: CharacterBaseModelProps);
|
|
69
|
-
private defaultName?;
|
|
77
|
+
constructor(id: string | CharacterEmotionId, props: CharacterBaseModelProps);
|
|
78
|
+
readonly defaultName?: string;
|
|
70
79
|
/***
|
|
71
80
|
* The name of the character.
|
|
72
81
|
* If you set undefined, it will return the default name.
|
|
73
82
|
*/
|
|
74
83
|
get name(): string;
|
|
75
84
|
set name(value: string | undefined);
|
|
76
|
-
|
|
85
|
+
readonly defaultSurname?: string;
|
|
77
86
|
/**
|
|
78
87
|
* The surname of the character.
|
|
79
88
|
* If you set undefined, it will return the default surname.
|
|
80
89
|
*/
|
|
81
90
|
get surname(): string | undefined;
|
|
82
91
|
set surname(value: string | undefined);
|
|
83
|
-
|
|
92
|
+
readonly defaultAge?: number | undefined;
|
|
84
93
|
/**
|
|
85
94
|
* The age of the character.
|
|
86
95
|
* If you set undefined, it will return the default age.
|
|
87
96
|
*/
|
|
88
97
|
get age(): number | undefined;
|
|
89
98
|
set age(value: number | undefined);
|
|
90
|
-
private _icon?;
|
|
91
99
|
/**
|
|
92
100
|
* The icon of the character.
|
|
93
101
|
*/
|
|
94
|
-
|
|
95
|
-
private _color?;
|
|
102
|
+
readonly icon?: string;
|
|
96
103
|
/**
|
|
97
104
|
* The color of the character.
|
|
98
105
|
*/
|
|
99
|
-
|
|
106
|
+
readonly color?: string | undefined;
|
|
100
107
|
}
|
|
101
108
|
|
|
102
109
|
declare namespace RegisteredCharacters {
|
|
@@ -167,38 +174,35 @@ declare namespace RegisteredCharacters {
|
|
|
167
174
|
* this.defaultName = props.name
|
|
168
175
|
* this.defaultSurname = props.surname
|
|
169
176
|
* this.defaultAge = props.age
|
|
170
|
-
* this.
|
|
171
|
-
* this.
|
|
177
|
+
* this.icon = props.icon
|
|
178
|
+
* this.color = props.color
|
|
172
179
|
* }
|
|
173
|
-
*
|
|
180
|
+
* readonly defaultName: string = ""
|
|
174
181
|
* get name(): string {
|
|
175
182
|
* return this.getStorageProperty<string>("name") || this.defaultName
|
|
176
183
|
* }
|
|
177
184
|
* set name(value: string | undefined) {
|
|
178
|
-
* this.setStorageProperty
|
|
185
|
+
* this.setStorageProperty("name", value)
|
|
179
186
|
* }
|
|
180
|
-
*
|
|
187
|
+
* readonly defaultSurname?: string
|
|
181
188
|
* get surname(): string | undefined {
|
|
182
189
|
* return this.getStorageProperty<string>("surname") || this.defaultSurname
|
|
183
190
|
* }
|
|
184
191
|
* set surname(value: string | undefined) {
|
|
185
|
-
* this.setStorageProperty
|
|
192
|
+
* this.setStorageProperty("surname", value)
|
|
186
193
|
* }
|
|
187
|
-
*
|
|
194
|
+
* readonly defaultAge?: number | undefined
|
|
188
195
|
* get age(): number | undefined {
|
|
189
196
|
* return this.getStorageProperty<number>("age") || this.defaultAge
|
|
190
197
|
* }
|
|
191
198
|
* set age(value: number | undefined) {
|
|
192
|
-
* this.setStorageProperty
|
|
199
|
+
* this.setStorageProperty("age", value)
|
|
193
200
|
* }
|
|
194
|
-
*
|
|
201
|
+
* readonly icon?: string
|
|
195
202
|
* get icon(): string | undefined {
|
|
196
203
|
* return this._icon
|
|
197
204
|
* }
|
|
198
|
-
*
|
|
199
|
-
* get color(): string | undefined {
|
|
200
|
-
* return this._color
|
|
201
|
-
* }
|
|
205
|
+
* readonly color?: string | undefined
|
|
202
206
|
* }
|
|
203
207
|
* ```
|
|
204
208
|
*/
|
|
@@ -209,4 +213,4 @@ interface CharacterInterface {
|
|
|
209
213
|
id: string;
|
|
210
214
|
}
|
|
211
215
|
|
|
212
|
-
export { CharacterBaseModel, type CharacterInterface, CharacterStoredClass, RegisteredCharacters };
|
|
216
|
+
export { CharacterBaseModel, type CharacterEmotionId, type CharacterInterface, CharacterStoredClass, RegisteredCharacters };
|