@drincs/pixi-vn 1.9.1 → 1.9.3
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 +11 -11
- package/dist/canvas.mjs +1 -1
- package/dist/characters.cjs +1 -1
- package/dist/characters.mjs +1 -1
- package/dist/{chunk-6GLWL3NH.mjs → chunk-7P46CLKX.mjs} +1 -1
- package/dist/chunk-AWU37VV6.mjs +1 -0
- package/dist/chunk-QOBPVPCY.mjs +1 -0
- package/dist/chunk-U5BSF6X3.mjs +1 -0
- package/dist/chunk-YBA63R27.mjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.cts +4 -4
- package/dist/core.d.ts +4 -4
- package/dist/core.mjs +1 -1
- package/dist/history.cjs +1 -1
- package/dist/history.d.cts +2 -2
- package/dist/history.d.ts +2 -2
- package/dist/history.mjs +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +164 -116
- package/dist/index.d.ts +164 -116
- package/dist/index.mjs +2 -2
- package/dist/narration.cjs +1 -1
- package/dist/narration.d.cts +2 -1
- package/dist/narration.d.ts +2 -1
- package/dist/narration.mjs +1 -1
- package/dist/sound.mjs +1 -1
- package/dist/storage.cjs +1 -1
- package/dist/storage.d.cts +1 -1
- package/dist/storage.d.ts +1 -1
- package/dist/storage.mjs +1 -1
- package/dist/vite.cjs +6 -4
- package/dist/vite.d.cts +64 -0
- package/dist/vite.d.ts +64 -0
- package/dist/vite.mjs +6 -4
- package/dist/worker.cjs +1 -0
- package/dist/worker.d.cts +153 -0
- package/dist/worker.d.ts +153 -0
- package/dist/worker.mjs +1 -0
- package/package.json +7 -1
- package/dist/chunk-HD353M4B.mjs +0 -1
- package/dist/chunk-HQQ5WH6C.mjs +0 -1
- package/dist/chunk-I7DOUH5V.mjs +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
+
import * as historyUtils from '@drincs/pixi-vn/history';
|
|
2
|
+
export * from '@drincs/pixi-vn/history';
|
|
3
|
+
import * as narrationUtils from '@drincs/pixi-vn/narration';
|
|
4
|
+
import { NarrationGameState } from '@drincs/pixi-vn/narration';
|
|
5
|
+
export * from '@drincs/pixi-vn/narration';
|
|
6
|
+
import * as storageUtils from '@drincs/pixi-vn/storage';
|
|
7
|
+
export * from '@drincs/pixi-vn/storage';
|
|
1
8
|
import * as canvasUtils from '@drincs/pixi-vn/canvas';
|
|
2
9
|
export * from '@drincs/pixi-vn/canvas';
|
|
3
10
|
import * as characterUtils from '@drincs/pixi-vn/characters';
|
|
4
11
|
export * from '@drincs/pixi-vn/characters';
|
|
5
12
|
import { OnErrorHandler, GameUnifier } from '@drincs/pixi-vn/core';
|
|
6
13
|
export * from '@drincs/pixi-vn/core';
|
|
7
|
-
import * as historyUtils from '@drincs/pixi-vn/history';
|
|
8
|
-
export * from '@drincs/pixi-vn/history';
|
|
9
|
-
import * as narrationUtils from '@drincs/pixi-vn/narration';
|
|
10
|
-
import { NarrationGameState } from '@drincs/pixi-vn/narration';
|
|
11
|
-
export * from '@drincs/pixi-vn/narration';
|
|
12
14
|
import { ApplicationOptions } from '@drincs/pixi-vn/pixi.js';
|
|
13
15
|
export { AllFederatedEventMap, ApplicationOptions, AssetSrc, AssetsBundle, AssetsManifest, FederatedEvent, LoadParserName, ResolvedAsset, ResolvedSrc, UnresolvedAsset } from '@drincs/pixi-vn/pixi.js';
|
|
14
16
|
import * as soundUtils from '@drincs/pixi-vn/sound';
|
|
15
17
|
export * from '@drincs/pixi-vn/sound';
|
|
16
|
-
|
|
17
|
-
export * from '@drincs/pixi-vn/storage';
|
|
18
|
+
export * from '@drincs/pixi-vn/worker';
|
|
18
19
|
export { C as CachedMap } from './CachedMap-DZLvJAnA.js';
|
|
19
20
|
import { e as CanvasGameState } from './ContainerMemory-BpDgacyr.js';
|
|
20
21
|
import { H as HistoryGameState } from './HistoryGameState-C8ATx9K6.js';
|
|
@@ -29,7 +30,111 @@ import 'microdiff';
|
|
|
29
30
|
import 'tone';
|
|
30
31
|
import './StorageElementType-C7ETezlL.js';
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
/**
|
|
34
|
+
* One error captured by {@link createGameTesting}'s `enable` while testing is active, via
|
|
35
|
+
* `Game.addOnError`.
|
|
36
|
+
*/
|
|
37
|
+
interface GameTestingErrorEntry {
|
|
38
|
+
error: unknown;
|
|
39
|
+
timestamp: number;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* A read-only snapshot of everything a test session typically needs to decide its next
|
|
43
|
+
* action, gathered from {@link narrationUtils.narration} and {@link historyUtils.stepHistory}
|
|
44
|
+
* in a single call instead of reading several properties one by one.
|
|
45
|
+
*/
|
|
46
|
+
interface GameTestingState {
|
|
47
|
+
dialogue: narrationUtils.DialogueInterface | undefined;
|
|
48
|
+
dialogueGlue: boolean;
|
|
49
|
+
choices: narrationUtils.StoredIndexedChoiceInterface[] | undefined;
|
|
50
|
+
input: {
|
|
51
|
+
isRequired: boolean;
|
|
52
|
+
type: string | undefined;
|
|
53
|
+
value: storageUtils.StorageElementType;
|
|
54
|
+
};
|
|
55
|
+
canContinue: boolean;
|
|
56
|
+
canGoBack: boolean;
|
|
57
|
+
labelsOpened: narrationUtils.OpenedLabel[];
|
|
58
|
+
currentLabelId: string | undefined;
|
|
59
|
+
stepCounter: number;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The object attached to `window` (and returned) by `enable`. Every action method
|
|
63
|
+
* merges the most recent props passed to `setProps` with any `extraProps` given here,
|
|
64
|
+
* then delegates to the matching narration/history call — so calling these behaves exactly
|
|
65
|
+
* like a real player action (the same `navigate`/`t`/`toast`/etc. the real UI uses).
|
|
66
|
+
*
|
|
67
|
+
* `narration`, `storage`, `stepHistory` and `Game` are also exposed directly for anything not
|
|
68
|
+
* covered by the action methods (e.g. `storage.set(...)`, `Game.exportGameState()`).
|
|
69
|
+
*/
|
|
70
|
+
interface GameTestingAPI<TGame, T extends {} = {}> {
|
|
71
|
+
readonly Game: TGame;
|
|
72
|
+
readonly narration: narrationUtils.NarrationManagerInterface;
|
|
73
|
+
readonly storage: storageUtils.StorageManagerInterface;
|
|
74
|
+
readonly stepHistory: historyUtils.HistoryManagerInterface;
|
|
75
|
+
/**
|
|
76
|
+
* The most recent props passed to `setProps` — whatever your app's `StepLabelProps`
|
|
77
|
+
* augmentation defines (e.g. `navigate`, `toast`). Useful to drive the app's UI directly
|
|
78
|
+
* during a test session — e.g. `pixiVN.props.navigate("/settings")` — not just narration,
|
|
79
|
+
* for full control over what's on screen.
|
|
80
|
+
*/
|
|
81
|
+
readonly props: narrationUtils.StepLabelPropsType<T>;
|
|
82
|
+
/** `Game.start` using the live props plus any `extraProps`. */
|
|
83
|
+
start(label: narrationUtils.LabelAbstract<any, T> | narrationUtils.LabelIdType, extraProps?: Partial<T>): Promise<narrationUtils.StepLabelResultType>;
|
|
84
|
+
/** {@link narrationUtils.NarrationManagerInterface.continue} using the live props plus any `extraProps`. */
|
|
85
|
+
continue(extraProps?: Partial<T>, options?: {
|
|
86
|
+
steps?: number;
|
|
87
|
+
runNow?: boolean;
|
|
88
|
+
}): Promise<narrationUtils.StepLabelResultType>;
|
|
89
|
+
/** {@link narrationUtils.NarrationManagerInterface.call} using the live props plus any `extraProps`. */
|
|
90
|
+
call(label: narrationUtils.LabelAbstract<any, T> | narrationUtils.LabelIdType, extraProps?: Partial<T>): Promise<narrationUtils.StepLabelResultType>;
|
|
91
|
+
/** {@link narrationUtils.NarrationManagerInterface.jump} using the live props plus any `extraProps`. */
|
|
92
|
+
jump(label: narrationUtils.LabelAbstract<any, T> | narrationUtils.LabelIdType, extraProps?: Partial<T>): Promise<narrationUtils.StepLabelResultType>;
|
|
93
|
+
/**
|
|
94
|
+
* Selects the currently open choice with this `choiceIndex` (as seen in
|
|
95
|
+
* `getState().choices`), using the live props plus any `extraProps`.
|
|
96
|
+
* @throws when no open choice has that index.
|
|
97
|
+
*/
|
|
98
|
+
selectChoice(choiceIndex: number, extraProps?: Partial<T>): Promise<narrationUtils.StepLabelResultType>;
|
|
99
|
+
/** Resolves a pending `narration.input.request(...)` with `value`, exactly like the player typing an answer and confirming. */
|
|
100
|
+
setInput(value: storageUtils.StorageElementType): void;
|
|
101
|
+
/** {@link historyUtils.HistoryManagerInterface.back} using the live props plus any `extraProps`. */
|
|
102
|
+
goBack(extraProps?: Partial<T>, options?: {
|
|
103
|
+
steps?: number;
|
|
104
|
+
}): Promise<narrationUtils.StepLabelResultType>;
|
|
105
|
+
/** {@link narrationUtils.NarrationLabelsInterface.closeCurrent} */
|
|
106
|
+
closeCurrentLabel(): void;
|
|
107
|
+
/** {@link narrationUtils.NarrationLabelsInterface.closeAll}. **Can end the game.** */
|
|
108
|
+
closeAllLabels(): void;
|
|
109
|
+
/** A snapshot of dialogue/choices/input/canContinue/canGoBack/labels — see {@link GameTestingState}. */
|
|
110
|
+
getState(): GameTestingState;
|
|
111
|
+
/** Errors caught via `Game.addOnError` since `enable()` was called (or since the last {@link clearErrors}). */
|
|
112
|
+
readonly errors: GameTestingErrorEntry[];
|
|
113
|
+
clearErrors(): void;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Per-action overrides an app can register via `setActions` so `Game.testing`'s
|
|
117
|
+
* window-exposed actions run the app's own narration functions — with whatever UI-only side
|
|
118
|
+
* effects they add (loading state, blocking while a menu is open, refreshing cached interface
|
|
119
|
+
* data, ...) — instead of calling {@link narrationUtils.narration} / {@link
|
|
120
|
+
* historyUtils.stepHistory} directly. Any action left undefined keeps the default behavior.
|
|
121
|
+
*
|
|
122
|
+
* `continue`/`back` take no arguments: the `extraProps`/`options` a caller passes to the
|
|
123
|
+
* corresponding {@link GameTestingAPI} method are ignored when an override is registered,
|
|
124
|
+
* since the override already has its own way to gather props (and typically doesn't support
|
|
125
|
+
* stepped/replay options). `selectChoice` receives the resolved choice item instead of the
|
|
126
|
+
* raw `choiceIndex`, since looking it up is already handled before the override runs.
|
|
127
|
+
*/
|
|
128
|
+
interface GameTestingActions<T extends {} = {}> {
|
|
129
|
+
continue?: () => Promise<void>;
|
|
130
|
+
back?: () => Promise<void>;
|
|
131
|
+
selectChoice?: (item: narrationUtils.StoredIndexedChoiceInterface) => Promise<void>;
|
|
132
|
+
start?: (label: narrationUtils.LabelAbstract<any, T> | narrationUtils.LabelIdType, props?: T) => Promise<void>;
|
|
133
|
+
jump?: (label: narrationUtils.LabelAbstract<any, T> | narrationUtils.LabelIdType, props?: T) => Promise<narrationUtils.StepLabelResultType>;
|
|
134
|
+
call?: (label: narrationUtils.LabelAbstract<any, T> | narrationUtils.LabelIdType, props?: T) => Promise<narrationUtils.StepLabelResultType>;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
var version = "1.9.3";
|
|
33
138
|
|
|
34
139
|
/**
|
|
35
140
|
* Is a special alias to indicate the game layer.
|
|
@@ -204,7 +309,7 @@ declare namespace Game {
|
|
|
204
309
|
* Get all the game data. It can be used to save the game.
|
|
205
310
|
* @returns The game data
|
|
206
311
|
*/
|
|
207
|
-
function exportGameState(): GameState
|
|
312
|
+
function exportGameState(): Promise<GameState>;
|
|
208
313
|
/**
|
|
209
314
|
* Load the save data
|
|
210
315
|
* @param data The save data object to restore the game state from.
|
|
@@ -364,6 +469,42 @@ declare namespace Game {
|
|
|
364
469
|
*/
|
|
365
470
|
function addOnPreContinue(handler: () => Promise<void> | void): void;
|
|
366
471
|
function removeOnPreContinue(handler: () => Promise<void> | void): void;
|
|
472
|
+
/**
|
|
473
|
+
* Optional integration point for offloading Pixi'VN's own heavy, pure computations (state
|
|
474
|
+
* diffing/restoring/cloning for `stepHistory.back()`/`add()`/`export()`) to a Worker the game
|
|
475
|
+
* project provides. Pixi'VN never creates a Worker itself, decides on its own which eligible
|
|
476
|
+
* work actually goes through it, and falls back to computing the same thing synchronously
|
|
477
|
+
* on the main thread whenever none is registered - so projects that can't or don't want to
|
|
478
|
+
* use Workers (SSR, certain embeds, ...) are unaffected either way.
|
|
479
|
+
*
|
|
480
|
+
* The game project stays in control of the actual `new Worker(...)` call (bundler-specific
|
|
481
|
+
* URL/`type: "module"` handling, CSP, lifecycle) and only needs to point that worker's
|
|
482
|
+
* message handling at `handleGameWorkerMessage` from `@drincs/pixi-vn/worker`:
|
|
483
|
+
*
|
|
484
|
+
* ```ts
|
|
485
|
+
* // main thread
|
|
486
|
+
* import { Game } from "@drincs/pixi-vn";
|
|
487
|
+
* const worker = new Worker(new URL("./game-worker.ts", import.meta.url), { type: "module" });
|
|
488
|
+
* Game.worker.register(worker);
|
|
489
|
+
*
|
|
490
|
+
* // game-worker.ts
|
|
491
|
+
* import { handleGameWorkerMessage } from "@drincs/pixi-vn/worker";
|
|
492
|
+
* self.onmessage = async (event) => {
|
|
493
|
+
* const response = await handleGameWorkerMessage(event.data);
|
|
494
|
+
* if (response) self.postMessage(response);
|
|
495
|
+
* };
|
|
496
|
+
* ```
|
|
497
|
+
*
|
|
498
|
+
* A third-party library built on top of Pixi'VN (one with `@drincs/pixi-vn` as a peer
|
|
499
|
+
* dependency) can share this same worker for its own heavy, pure computations instead of
|
|
500
|
+
* needing one of its own - see `registerGameWorkerHandler` (worker side) and
|
|
501
|
+
* `GameWorkerManager.custom` (main-thread side), both from `@drincs/pixi-vn/worker`.
|
|
502
|
+
*/
|
|
503
|
+
const worker: {
|
|
504
|
+
register: (worker: Worker) => void;
|
|
505
|
+
unregister: () => void;
|
|
506
|
+
readonly isAvailable: boolean;
|
|
507
|
+
};
|
|
367
508
|
/**
|
|
368
509
|
* Lets an AI agent (or any external script/browser console) drive and inspect a running game
|
|
369
510
|
* through `window`, without needing to know the app's own UI wiring. Not enabled by default —
|
|
@@ -374,116 +515,23 @@ declare namespace Game {
|
|
|
374
515
|
* action — call it unconditionally from wherever your app builds those props (e.g. at the end
|
|
375
516
|
* of a `useGameProps()`-style hook), since every action needs up-to-date props whether or not
|
|
376
517
|
* testing happens to be enabled right now.
|
|
518
|
+
* - `setActions(actions)` is optional: if the app wraps `narration`/`stepHistory` in its own
|
|
519
|
+
* functions to handle UI-only concerns (a loading indicator, blocking while a menu is open,
|
|
520
|
+
* refreshing cached interface data, ...), it can register those functions so `continue()`,
|
|
521
|
+
* `goBack()`, `selectChoice()`, `start()`, `jump()` and `call()` drive the game through them
|
|
522
|
+
* instead of calling `narration`/`stepHistory` directly — same as a real player action would.
|
|
377
523
|
* See the `pixi-vn-testing` skill for the full guide (activation patterns, the complete command
|
|
378
524
|
* surface, and cookbook snippets for a browser-driven test session).
|
|
379
525
|
*/
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
interface GameTestingErrorEntry {
|
|
385
|
-
error: unknown;
|
|
386
|
-
timestamp: number;
|
|
387
|
-
}
|
|
388
|
-
/**
|
|
389
|
-
* A read-only snapshot of everything a test session typically needs to decide its next
|
|
390
|
-
* action, gathered from {@link narrationUtils.narration} and {@link historyUtils.stepHistory}
|
|
391
|
-
* in a single call instead of reading several properties one by one.
|
|
392
|
-
*/
|
|
393
|
-
interface GameTestingState {
|
|
394
|
-
dialogue: narrationUtils.DialogueInterface | undefined;
|
|
395
|
-
dialogueGlue: boolean;
|
|
396
|
-
choices: narrationUtils.StoredIndexedChoiceInterface[] | undefined;
|
|
397
|
-
input: {
|
|
398
|
-
isRequired: boolean;
|
|
399
|
-
type: string | undefined;
|
|
400
|
-
value: storageUtils.StorageElementType;
|
|
401
|
-
};
|
|
402
|
-
canContinue: boolean;
|
|
403
|
-
canGoBack: boolean;
|
|
404
|
-
labelsOpened: narrationUtils.OpenedLabel[];
|
|
405
|
-
currentLabelId: string | undefined;
|
|
406
|
-
stepCounter: number;
|
|
407
|
-
}
|
|
408
|
-
/**
|
|
409
|
-
* The object attached to `window` (and returned) by {@link enable}. Every action method
|
|
410
|
-
* merges the most recent props passed to {@link setProps} with any `extraProps` given here,
|
|
411
|
-
* then delegates to the matching narration/history call — so calling these behaves exactly
|
|
412
|
-
* like a real player action (the same `navigate`/`t`/`toast`/etc. the real UI uses).
|
|
413
|
-
*
|
|
414
|
-
* `narration`, `storage`, `stepHistory` and `Game` are also exposed directly for anything not
|
|
415
|
-
* covered by the action methods (e.g. `storage.set(...)`, `Game.exportGameState()`).
|
|
416
|
-
*/
|
|
417
|
-
interface GameTestingAPI<T extends {} = {}> {
|
|
418
|
-
readonly Game: typeof Game;
|
|
419
|
-
readonly narration: narrationUtils.NarrationManagerInterface;
|
|
420
|
-
readonly storage: storageUtils.StorageManagerInterface;
|
|
421
|
-
readonly stepHistory: historyUtils.HistoryManagerInterface;
|
|
422
|
-
/**
|
|
423
|
-
* The most recent props passed to {@link setProps} — whatever your app's `StepLabelProps`
|
|
424
|
-
* augmentation defines (e.g. `navigate`, `toast`). Useful to drive the app's UI directly
|
|
425
|
-
* during a test session — e.g. `pixiVN.props.navigate("/settings")` — not just narration,
|
|
426
|
-
* for full control over what's on screen.
|
|
427
|
-
*/
|
|
428
|
-
readonly props: narrationUtils.StepLabelPropsType<T>;
|
|
429
|
-
/** {@link Game.start} using the live props plus any `extraProps`. */
|
|
430
|
-
start(label: narrationUtils.LabelAbstract<any, T> | narrationUtils.LabelIdType, extraProps?: Partial<T>): Promise<narrationUtils.StepLabelResultType>;
|
|
431
|
-
/** {@link narrationUtils.NarrationManagerInterface.continue} using the live props plus any `extraProps`. */
|
|
432
|
-
continue(extraProps?: Partial<T>, options?: {
|
|
433
|
-
steps?: number;
|
|
434
|
-
runNow?: boolean;
|
|
435
|
-
}): Promise<narrationUtils.StepLabelResultType>;
|
|
436
|
-
/** {@link narrationUtils.NarrationManagerInterface.call} using the live props plus any `extraProps`. */
|
|
437
|
-
call(label: narrationUtils.LabelAbstract<any, T> | narrationUtils.LabelIdType, extraProps?: Partial<T>): Promise<narrationUtils.StepLabelResultType>;
|
|
438
|
-
/** {@link narrationUtils.NarrationManagerInterface.jump} using the live props plus any `extraProps`. */
|
|
439
|
-
jump(label: narrationUtils.LabelAbstract<any, T> | narrationUtils.LabelIdType, extraProps?: Partial<T>): Promise<narrationUtils.StepLabelResultType>;
|
|
440
|
-
/**
|
|
441
|
-
* Selects the currently open choice with this `choiceIndex` (as seen in
|
|
442
|
-
* `getState().choices`), using the live props plus any `extraProps`.
|
|
443
|
-
* @throws when no open choice has that index.
|
|
444
|
-
*/
|
|
445
|
-
selectChoice(choiceIndex: number, extraProps?: Partial<T>): Promise<narrationUtils.StepLabelResultType>;
|
|
446
|
-
/** Resolves a pending `narration.input.request(...)` with `value`, exactly like the player typing an answer and confirming. */
|
|
447
|
-
setInput(value: storageUtils.StorageElementType): void;
|
|
448
|
-
/** {@link historyUtils.HistoryManagerInterface.back} using the live props plus any `extraProps`. */
|
|
449
|
-
goBack(extraProps?: Partial<T>, options?: {
|
|
450
|
-
steps?: number;
|
|
451
|
-
}): Promise<narrationUtils.StepLabelResultType>;
|
|
452
|
-
/** {@link narrationUtils.NarrationLabelsInterface.closeCurrent} */
|
|
453
|
-
closeCurrentLabel(): void;
|
|
454
|
-
/** {@link narrationUtils.NarrationLabelsInterface.closeAll}. **Can end the game.** */
|
|
455
|
-
closeAllLabels(): void;
|
|
456
|
-
/** A snapshot of dialogue/choices/input/canContinue/canGoBack/labels — see {@link GameTestingState}. */
|
|
457
|
-
getState(): GameTestingState;
|
|
458
|
-
/** Errors caught via {@link Game.addOnError} since `enable()` was called (or since the last {@link clearErrors}). */
|
|
459
|
-
readonly errors: GameTestingErrorEntry[];
|
|
460
|
-
clearErrors(): void;
|
|
461
|
-
}
|
|
462
|
-
/**
|
|
463
|
-
* Updates the live props every {@link GameTestingAPI} action merges `extraProps` on top of.
|
|
464
|
-
* Call this unconditionally from wherever your app builds its `StepLabelProps` (e.g. the end
|
|
465
|
-
* of a `useGameProps()`-style hook that already runs throughout the app) — it's a cheap
|
|
466
|
-
* assignment, safe to call whether or not testing is currently {@link enable}d.
|
|
467
|
-
* @param props The app's current `StepLabelProps` (the same object your UI passes to
|
|
468
|
-
* `narration.continue`/`Game.start`).
|
|
469
|
-
*/
|
|
470
|
-
function setProps<T extends {} = {}>(props: narrationUtils.StepLabelPropsType<T>): void;
|
|
471
|
-
/**
|
|
472
|
-
* Enables the testing API: builds it, attaches it to `window[windowKey]` (default
|
|
473
|
-
* `"pixiVN"`), and returns it. Calling this again replaces the previous session.
|
|
474
|
-
* @param options.windowKey The property name to attach the API under on `window`. @default "pixiVN"
|
|
475
|
-
*/
|
|
476
|
-
function enable<T extends {} = {}>(options?: {
|
|
526
|
+
const testing: {
|
|
527
|
+
setProps: <T extends {} = {}>(props: narrationUtils.StepLabelPropsType<T>) => void;
|
|
528
|
+
setActions: <T extends {} = {}>(actions: GameTestingActions<T>) => void;
|
|
529
|
+
enable: <T extends {} = {}>(options?: {
|
|
477
530
|
windowKey?: string;
|
|
478
|
-
})
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
*/
|
|
483
|
-
function disable(): void;
|
|
484
|
-
/** Whether a testing session is currently active. */
|
|
485
|
-
function isEnabled(): boolean;
|
|
486
|
-
}
|
|
531
|
+
} | undefined) => GameTestingAPI<typeof Game, T>;
|
|
532
|
+
disable: () => void;
|
|
533
|
+
isEnabled: () => boolean;
|
|
534
|
+
};
|
|
487
535
|
}
|
|
488
536
|
declare const _default: {
|
|
489
537
|
canvas: canvasUtils.CanvasManagerInterface;
|
|
@@ -502,4 +550,4 @@ declare const _default: {
|
|
|
502
550
|
PIXIVN_VERSION: string;
|
|
503
551
|
};
|
|
504
552
|
|
|
505
|
-
export { CANVAS_APP_GAME_LAYER_ALIAS, Game, type GameState, type GameStepStateData, version as PIXIVN_VERSION, SYSTEM_RESERVED_STORAGE_KEYS, createExportableElement, _default as default };
|
|
553
|
+
export { CANVAS_APP_GAME_LAYER_ALIAS, Game, type GameState, type GameStepStateData, type GameTestingAPI, type GameTestingActions, type GameTestingErrorEntry, type GameTestingState, version as PIXIVN_VERSION, SYSTEM_RESERVED_STORAGE_KEYS, createExportableElement, _default as default };
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {f,b,g,e,d,h,i}from'./chunk-K7JIC2F2.mjs';import*as V from'@drincs/pixi-vn/canvas';export*from'@drincs/pixi-vn/canvas';import*as Qt from'@drincs/pixi-vn/characters';export*from'@drincs/pixi-vn/characters';import {PixiError,GameUnifier}from'@drincs/pixi-vn/core';export*from'@drincs/pixi-vn/core';import*as H from'@drincs/pixi-vn/history';export*from'@drincs/pixi-vn/history';import*as m from'@drincs/pixi-vn/narration';export*from'@drincs/pixi-vn/narration';import*as mt from'@drincs/pixi-vn/sound';export*from'@drincs/pixi-vn/sound';import*as z from'@drincs/pixi-vn/storage';export*from'@drincs/pixi-vn/storage';import {motion}from'@drincs/pixi-vn/motion';var ye=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,ne=new Set,Ht=typeof process=="object"&&process?process:{},oe=(_,e,i,s)=>{typeof Ht.emitWarning=="function"?Ht.emitWarning(_,e,i,s):console.error(`[${i}] ${e}: ${_}`);},jt=globalThis.AbortController,ie=globalThis.AbortSignal;if(typeof jt>"u"){ie=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,s){this._onabort.push(s);}},jt=class{constructor(){e();}signal=new ie;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let _=Ht.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{_&&(_=false,oe("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",e));};}var Se=_=>!ne.has(_);var dt=_=>_&&_===Math.floor(_)&&_>0&&isFinite(_),ae=_=>dt(_)?_<=Math.pow(2,8)?Uint8Array:_<=Math.pow(2,16)?Uint16Array:_<=Math.pow(2,32)?Uint32Array:_<=Number.MAX_SAFE_INTEGER?Dt:null:null,Dt=class extends Array{constructor(_){super(_),this.fill(0);}},at,xt,be=(at=class{heap;length;static create(e){let i=ae(e);if(!i)return [];g(at,xt,true);let s=new at(e,i);return g(at,xt,false),s}constructor(e$1,i){if(!e(at,xt))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e$1),this.length=0;}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},xt=new WeakMap,f(at,xt,false),at),se,re,X,W,Z,vt,tt,Et,Ut,et,R,it,L,T,u,F,Y,j,I,st,D,rt,nt,q,B,ot,gt,M,Tt,a,kt,yt,ht,Rt,$,he,St,At,Pt,pt,ut,Kt,Nt,Gt,U,Wt,Lt,ft,Yt,Ot,le=(Ot=class{constructor(e$1){f(this,a);f(this,X);f(this,W);f(this,Z);f(this,vt);f(this,tt);f(this,Et);f(this,Ut);f(this,et);d(this,"ttl");d(this,"ttlResolution");d(this,"ttlAutopurge");d(this,"updateAgeOnGet");d(this,"updateAgeOnHas");d(this,"allowStale");d(this,"noDisposeOnSet");d(this,"noUpdateTTL");d(this,"maxEntrySize");d(this,"sizeCalculation");d(this,"noDeleteOnFetchRejection");d(this,"noDeleteOnStaleGet");d(this,"allowStaleOnFetchAbort");d(this,"allowStaleOnFetchRejection");d(this,"ignoreFetchAbort");f(this,R);f(this,it);f(this,L);f(this,T);f(this,u);f(this,F);f(this,Y);f(this,j);f(this,I);f(this,st);f(this,D);f(this,rt);f(this,nt);f(this,q);f(this,B);f(this,ot);f(this,gt);f(this,M);f(this,Tt);f(this,yt,()=>{});f(this,ht,()=>{});f(this,Rt,()=>{});f(this,$,()=>false);f(this,St,e=>{});f(this,At,(e,i,s)=>{});f(this,Pt,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});d(this,se,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:o,updateAgeOnGet:n,updateAgeOnHas:l,allowStale:d$1,dispose:y,onInsert:P,disposeAfter:S,noDisposeOnSet:lt,noUpdateTTL:k,maxSize:J=0,maxEntrySize:A=0,sizeCalculation:x,fetchMethod:f$1,memoMethod:O,noDeleteOnFetchRejection:c,noDeleteOnStaleGet:b,allowStaleOnFetchRejection:w,allowStaleOnFetchAbort:g$1,ignoreFetchAbort:E,perf:N}=e$1;if(N!==void 0&&typeof N?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(g(this,et,N??ye),i!==0&&!dt(i))throw new TypeError("max option must be a nonnegative integer");let K=i?ae(i):Array;if(!K)throw new Error("invalid max value: "+i);if(g(this,X,i),g(this,W,J),this.maxEntrySize=A||e(this,W),this.sizeCalculation=x,this.sizeCalculation){if(!e(this,W)&&!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(O!==void 0&&typeof O!="function")throw new TypeError("memoMethod must be a function if defined");if(g(this,Ut,O),f$1!==void 0&&typeof f$1!="function")throw new TypeError("fetchMethod must be a function if specified");if(g(this,Et,f$1),g(this,gt,!!f$1),g(this,L,new Map),g(this,T,new Array(i).fill(void 0)),g(this,u,new Array(i).fill(void 0)),g(this,F,new K(i)),g(this,Y,new K(i)),g(this,j,0),g(this,I,0),g(this,st,be.create(i)),g(this,R,0),g(this,it,0),typeof y=="function"&&g(this,Z,y),typeof P=="function"&&g(this,vt,P),typeof S=="function"?(g(this,tt,S),g(this,D,[])):(g(this,tt,void 0),g(this,D,void 0)),g(this,ot,!!e(this,Z)),g(this,Tt,!!e(this,vt)),g(this,M,!!e(this,tt)),this.noDisposeOnSet=!!lt,this.noUpdateTTL=!!k,this.noDeleteOnFetchRejection=!!c,this.allowStaleOnFetchRejection=!!w,this.allowStaleOnFetchAbort=!!g$1,this.ignoreFetchAbort=!!E,this.maxEntrySize!==0){if(e(this,W)!==0&&!dt(e(this,W)))throw new TypeError("maxSize must be a positive integer if specified");if(!dt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");h(this,a,he).call(this);}if(this.allowStale=!!d$1,this.noDeleteOnStaleGet=!!b,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!l,this.ttlResolution=dt(r)||r===0?r:1,this.ttlAutopurge=!!o,this.ttl=s||0,this.ttl){if(!dt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");h(this,a,kt).call(this);}if(e(this,X)===0&&this.ttl===0&&e(this,W)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!e(this,X)&&!e(this,W)){let _t="LRU_CACHE_UNBOUNDED";Se(_t)&&(ne.add(_t),oe("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",_t,Ot));}}get perf(){return e(this,et)}static unsafeExposeInternals(e$1){return {starts:e(e$1,nt),ttls:e(e$1,q),autopurgeTimers:e(e$1,B),sizes:e(e$1,rt),keyMap:e(e$1,L),keyList:e(e$1,T),valList:e(e$1,u),next:e(e$1,F),prev:e(e$1,Y),get head(){return e(e$1,j)},get tail(){return e(e$1,I)},free:e(e$1,st),isBackgroundFetch:i=>{var s;return h(s=e$1,a,U).call(s,i)},backgroundFetch:(i,s,r,o)=>{var n;return h(n=e$1,a,Gt).call(n,i,s,r,o)},moveToTail:i=>{var s;return h(s=e$1,a,Lt).call(s,i)},indexes:i=>{var s;return h(s=e$1,a,pt).call(s,i)},rindexes:i=>{var s;return h(s=e$1,a,ut).call(s,i)},isStale:i=>{var s;return e(s=e$1,$).call(s,i)}}}get max(){return e(this,X)}get maxSize(){return e(this,W)}get calculatedSize(){return e(this,it)}get size(){return e(this,R)}get fetchMethod(){return e(this,Et)}get memoMethod(){return e(this,Ut)}get dispose(){return e(this,Z)}get onInsert(){return e(this,vt)}get disposeAfter(){return e(this,tt)}getRemainingTTL(e$1){return e(this,L).has(e$1)?1/0:0}*entries(){for(let e$1 of h(this,a,pt).call(this))e(this,u)[e$1]!==void 0&&e(this,T)[e$1]!==void 0&&!h(this,a,U).call(this,e(this,u)[e$1])&&(yield [e(this,T)[e$1],e(this,u)[e$1]]);}*rentries(){for(let e$1 of h(this,a,ut).call(this))e(this,u)[e$1]!==void 0&&e(this,T)[e$1]!==void 0&&!h(this,a,U).call(this,e(this,u)[e$1])&&(yield [e(this,T)[e$1],e(this,u)[e$1]]);}*keys(){for(let e$1 of h(this,a,pt).call(this)){let i=e(this,T)[e$1];i!==void 0&&!h(this,a,U).call(this,e(this,u)[e$1])&&(yield i);}}*rkeys(){for(let e$1 of h(this,a,ut).call(this)){let i=e(this,T)[e$1];i!==void 0&&!h(this,a,U).call(this,e(this,u)[e$1])&&(yield i);}}*values(){for(let e$1 of h(this,a,pt).call(this))e(this,u)[e$1]!==void 0&&!h(this,a,U).call(this,e(this,u)[e$1])&&(yield e(this,u)[e$1]);}*rvalues(){for(let e$1 of h(this,a,ut).call(this))e(this,u)[e$1]!==void 0&&!h(this,a,U).call(this,e(this,u)[e$1])&&(yield e(this,u)[e$1]);}[(re=Symbol.iterator,se=Symbol.toStringTag,re)](){return this.entries()}find(e$1,i={}){for(let s of h(this,a,pt).call(this)){let r=e(this,u)[s],o=h(this,a,U).call(this,r)?r.__staleWhileFetching:r;if(o!==void 0&&e$1(o,e(this,T)[s],this))return this.get(e(this,T)[s],i)}}forEach(e$1,i=this){for(let s of h(this,a,pt).call(this)){let r=e(this,u)[s],o=h(this,a,U).call(this,r)?r.__staleWhileFetching:r;o!==void 0&&e$1.call(i,o,e(this,T)[s],this);}}rforEach(e$1,i=this){for(let s of h(this,a,ut).call(this)){let r=e(this,u)[s],o=h(this,a,U).call(this,r)?r.__staleWhileFetching:r;o!==void 0&&e$1.call(i,o,e(this,T)[s],this);}}purgeStale(){let e$1=false;for(let i of h(this,a,ut).call(this,{allowStale:true}))e(this,$).call(this,i)&&(h(this,a,ft).call(this,e(this,T)[i],"expire"),e$1=true);return e$1}info(e$1){let i=e(this,L).get(e$1);if(i===void 0)return;let s=e(this,u)[i],r=h(this,a,U).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let o={value:r};if(e(this,q)&&e(this,nt)){let n=e(this,q)[i],l=e(this,nt)[i];if(n&&l){let d=n-(e(this,et).now()-l);o.ttl=d,o.start=Date.now();}}return e(this,rt)&&(o.size=e(this,rt)[i]),o}dump(){let e$1=[];for(let i of h(this,a,pt).call(this,{allowStale:true})){let s=e(this,T)[i],r=e(this,u)[i],o=h(this,a,U).call(this,r)?r.__staleWhileFetching:r;if(o===void 0||s===void 0)continue;let n={value:o};if(e(this,q)&&e(this,nt)){n.ttl=e(this,q)[i];let l=e(this,et).now()-e(this,nt)[i];n.start=Math.floor(Date.now()-l);}e(this,rt)&&(n.size=e(this,rt)[i]),e$1.unshift([s,n]);}return e$1}load(e$1){this.clear();for(let[i,s]of e$1){if(s.start){let r=Date.now()-s.start;s.start=e(this,et).now()-r;}this.set(i,s.value,s);}}set(e$1,i$1,s={}){var lt,k,J,A;if(i$1===void 0)return this.delete(e$1),this;let{ttl:r=this.ttl,start:o,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:l=this.sizeCalculation,status:d}=s,{noUpdateTTL:y=this.noUpdateTTL}=s,P=e(this,Pt).call(this,e$1,i$1,s.size||0,l);if(this.maxEntrySize&&P>this.maxEntrySize)return d&&(d.set="miss",d.maxEntrySizeExceeded=true),h(this,a,ft).call(this,e$1,"set"),this;let S=e(this,R)===0?void 0:e(this,L).get(e$1);if(S===void 0)S=e(this,R)===0?e(this,I):e(this,st).length!==0?e(this,st).pop():e(this,R)===e(this,X)?h(this,a,Nt).call(this,false):e(this,R),e(this,T)[S]=e$1,e(this,u)[S]=i$1,e(this,L).set(e$1,S),e(this,F)[e(this,I)]=S,e(this,Y)[S]=e(this,I),g(this,I,S),i(this,R)._++,e(this,At).call(this,S,P,d),d&&(d.set="add"),y=false,e(this,Tt)&&((lt=e(this,vt))==null||lt.call(this,i$1,e$1,"add"));else {h(this,a,Lt).call(this,S);let x=e(this,u)[S];if(i$1!==x){if(e(this,gt)&&h(this,a,U).call(this,x)){x.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:f}=x;f!==void 0&&!n&&(e(this,ot)&&((k=e(this,Z))==null||k.call(this,f,e$1,"set")),e(this,M)&&e(this,D)?.push([f,e$1,"set"]));}else n||(e(this,ot)&&((J=e(this,Z))==null||J.call(this,x,e$1,"set")),e(this,M)&&e(this,D)?.push([x,e$1,"set"]));if(e(this,St).call(this,S),e(this,At).call(this,S,P,d),e(this,u)[S]=i$1,d){d.set="replace";let f=x&&h(this,a,U).call(this,x)?x.__staleWhileFetching:x;f!==void 0&&(d.oldValue=f);}}else d&&(d.set="update");e(this,Tt)&&this.onInsert?.(i$1,e$1,i$1===x?"update":"replace");}if(r!==0&&!e(this,q)&&h(this,a,kt).call(this),e(this,q)&&(y||e(this,Rt).call(this,S,r,o),d&&e(this,ht).call(this,d,S)),!n&&e(this,M)&&e(this,D)){let x=e(this,D),f;for(;f=x?.shift();)(A=e(this,tt))==null||A.call(this,...f);}return this}pop(){var e$1;try{for(;e(this,R);){let i=e(this,u)[e(this,j)];if(h(this,a,Nt).call(this,!0),h(this,a,U).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(e(this,M)&&e(this,D)){let i=e(this,D),s;for(;s=i?.shift();)(e$1=e(this,tt))==null||e$1.call(this,...s);}}}has(e$1,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,o=e(this,L).get(e$1);if(o!==void 0){let n=e(this,u)[o];if(h(this,a,U).call(this,n)&&n.__staleWhileFetching===void 0)return false;if(e(this,$).call(this,o))r&&(r.has="stale",e(this,ht).call(this,r,o));else return s&&e(this,yt).call(this,o),r&&(r.has="hit",e(this,ht).call(this,r,o)),true}else r&&(r.has="miss");return false}peek(e$1,i={}){let{allowStale:s=this.allowStale}=i,r=e(this,L).get(e$1);if(r===void 0||!s&&e(this,$).call(this,r))return;let o=e(this,u)[r];return h(this,a,U).call(this,o)?o.__staleWhileFetching:o}async fetch(e$1,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:l=this.noDisposeOnSet,size:d=0,sizeCalculation:y=this.sizeCalculation,noUpdateTTL:P=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:lt=this.allowStaleOnFetchRejection,ignoreFetchAbort:k=this.ignoreFetchAbort,allowStaleOnFetchAbort:J=this.allowStaleOnFetchAbort,context:A,forceRefresh:x=false,status:f,signal:O}=i;if(!e(this,gt))return f&&(f.fetch="get"),this.get(e$1,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:o,status:f});let c={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:o,ttl:n,noDisposeOnSet:l,size:d,sizeCalculation:y,noUpdateTTL:P,noDeleteOnFetchRejection:S,allowStaleOnFetchRejection:lt,allowStaleOnFetchAbort:J,ignoreFetchAbort:k,status:f,signal:O},b=e(this,L).get(e$1);if(b===void 0){f&&(f.fetch="miss");let w=h(this,a,Gt).call(this,e$1,b,c,A);return w.__returned=w}else {let w=e(this,u)[b];if(h(this,a,U).call(this,w)){let K=s&&w.__staleWhileFetching!==void 0;return f&&(f.fetch="inflight",K&&(f.returnedStale=true)),K?w.__staleWhileFetching:w.__returned=w}let g=e(this,$).call(this,b);if(!x&&!g)return f&&(f.fetch="hit"),h(this,a,Lt).call(this,b),r&&e(this,yt).call(this,b),f&&e(this,ht).call(this,f,b),w;let E=h(this,a,Gt).call(this,e$1,b,c,A),N=E.__staleWhileFetching!==void 0&&s;return f&&(f.fetch=g?"stale":"refresh",N&&g&&(f.returnedStale=true)),N?E.__staleWhileFetching:E.__returned=E}}async forceFetch(e,i={}){let s=await this.fetch(e,i);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(e$1,i={}){let s=e(this,Ut);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:o,...n}=i,l=this.get(e$1,n);if(!o&&l!==void 0)return l;let d=s(e$1,l,{options:n,context:r});return this.set(e$1,d,n),d}get(e$1,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:n}=i,l=e(this,L).get(e$1);if(l!==void 0){let d=e(this,u)[l],y=h(this,a,U).call(this,d);return n&&e(this,ht).call(this,n,l),e(this,$).call(this,l)?(n&&(n.get="stale"),y?(n&&s&&d.__staleWhileFetching!==void 0&&(n.returnedStale=true),s?d.__staleWhileFetching:void 0):(o||h(this,a,ft).call(this,e$1,"expire"),n&&s&&(n.returnedStale=true),s?d:void 0)):(n&&(n.get="hit"),y?d.__staleWhileFetching:(h(this,a,Lt).call(this,l),r&&e(this,yt).call(this,l),d))}else n&&(n.get="miss");}delete(e){return h(this,a,ft).call(this,e,"delete")}clear(){return h(this,a,Yt).call(this,"delete")}},X=new WeakMap,W=new WeakMap,Z=new WeakMap,vt=new WeakMap,tt=new WeakMap,Et=new WeakMap,Ut=new WeakMap,et=new WeakMap,R=new WeakMap,it=new WeakMap,L=new WeakMap,T=new WeakMap,u=new WeakMap,F=new WeakMap,Y=new WeakMap,j=new WeakMap,I=new WeakMap,st=new WeakMap,D=new WeakMap,rt=new WeakMap,nt=new WeakMap,q=new WeakMap,B=new WeakMap,ot=new WeakMap,gt=new WeakMap,M=new WeakMap,Tt=new WeakMap,a=new WeakSet,kt=function(){let e$1=new Dt(e(this,X)),i=new Dt(e(this,X));g(this,q,e$1),g(this,nt,i);let s=this.ttlAutopurge?new Array(e(this,X)):void 0;g(this,B,s),g(this,Rt,(l,d,y=e(this,et).now())=>{i[l]=d!==0?y:0,e$1[l]=d,r(l,d);}),g(this,yt,l=>{i[l]=e$1[l]!==0?e(this,et).now():0,r(l,e$1[l]);});let r=this.ttlAutopurge?(l,d)=>{if(s?.[l]&&(clearTimeout(s[l]),s[l]=void 0),d&&d!==0&&s){let y=setTimeout(()=>{e(this,$).call(this,l)&&h(this,a,ft).call(this,e(this,T)[l],"expire");},d+1);y.unref&&y.unref(),s[l]=y;}}:()=>{};g(this,ht,(l,d)=>{if(e$1[d]){let y=e$1[d],P=i[d];if(!y||!P)return;l.ttl=y,l.start=P,l.now=o||n();let S=l.now-P;l.remainingTTL=y-S;}});let o=0,n=()=>{let l=e(this,et).now();if(this.ttlResolution>0){o=l;let d=setTimeout(()=>o=0,this.ttlResolution);d.unref&&d.unref();}return l};this.getRemainingTTL=l=>{let d=e(this,L).get(l);if(d===void 0)return 0;let y=e$1[d],P=i[d];if(!y||!P)return 1/0;let S=(o||n())-P;return y-S},g(this,$,l=>{let d=i[l],y=e$1[l];return !!y&&!!d&&(o||n())-d>y});},yt=new WeakMap,ht=new WeakMap,Rt=new WeakMap,$=new WeakMap,he=function(){let e$1=new Dt(e(this,X));g(this,it,0),g(this,rt,e$1),g(this,St,i=>{g(this,it,e(this,it)-e$1[i]),e$1[i]=0;}),g(this,Pt,(i,s,r,o)=>{if(h(this,a,U).call(this,s))return 0;if(!dt(r))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(r=o(s,i),!dt(r))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 r}),g(this,At,(i,s,r)=>{if(e$1[i]=s,e(this,W)){let o=e(this,W)-e$1[i];for(;e(this,it)>o;)h(this,a,Nt).call(this,true);}g(this,it,e(this,it)+e$1[i]),r&&(r.entrySize=s,r.totalCalculatedSize=e(this,it));});},St=new WeakMap,At=new WeakMap,Pt=new WeakMap,pt=function*({allowStale:e$1=this.allowStale}={}){if(e(this,R))for(let i=e(this,I);!(!h(this,a,Kt).call(this,i)||((e$1||!e(this,$).call(this,i))&&(yield i),i===e(this,j)));)i=e(this,Y)[i];},ut=function*({allowStale:e$1=this.allowStale}={}){if(e(this,R))for(let i=e(this,j);!(!h(this,a,Kt).call(this,i)||((e$1||!e(this,$).call(this,i))&&(yield i),i===e(this,I)));)i=e(this,F)[i];},Kt=function(e$1){return e$1!==void 0&&e(this,L).get(e(this,T)[e$1])===e$1},Nt=function(e$1){var o;let i$1=e(this,j),s=e(this,T)[i$1],r=e(this,u)[i$1];return e(this,gt)&&h(this,a,U).call(this,r)?r.__abortController.abort(new Error("evicted")):(e(this,ot)||e(this,M))&&(e(this,ot)&&((o=e(this,Z))==null||o.call(this,r,s,"evict")),e(this,M)&&e(this,D)?.push([r,s,"evict"])),e(this,St).call(this,i$1),e(this,B)?.[i$1]&&(clearTimeout(e(this,B)[i$1]),e(this,B)[i$1]=void 0),e$1&&(e(this,T)[i$1]=void 0,e(this,u)[i$1]=void 0,e(this,st).push(i$1)),e(this,R)===1?(g(this,j,g(this,I,0)),e(this,st).length=0):g(this,j,e(this,F)[i$1]),e(this,L).delete(s),i(this,R)._--,i$1},Gt=function(e$1,i,s,r){let o=i===void 0?void 0:e(this,u)[i];if(h(this,a,U).call(this,o))return o;let n=new jt,{signal:l}=s;l?.addEventListener("abort",()=>n.abort(l.reason),{signal:n.signal});let d={signal:n.signal,options:s,context:r},y=(A,x=false)=>{let{aborted:f}=n.signal,O=s.ignoreFetchAbort&&A!==void 0,c=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&A!==void 0);if(s.status&&(f&&!x?(s.status.fetchAborted=true,s.status.fetchError=n.signal.reason,O&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),f&&!O&&!x)return S(n.signal.reason,c);let b=k,w=e(this,u)[i];return (w===k||O&&x&&w===void 0)&&(A===void 0?b.__staleWhileFetching!==void 0?e(this,u)[i]=b.__staleWhileFetching:h(this,a,ft).call(this,e$1,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e$1,A,d.options))),A},P=A=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=A),S(A,false)),S=(A,x)=>{let{aborted:f}=n.signal,O=f&&s.allowStaleOnFetchAbort,c=O||s.allowStaleOnFetchRejection,b=c||s.noDeleteOnFetchRejection,w=k;if(e(this,u)[i]===k&&(!b||!x&&w.__staleWhileFetching===void 0?h(this,a,ft).call(this,e$1,"fetch"):O||(e(this,u)[i]=w.__staleWhileFetching)),c)return s.status&&w.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),w.__staleWhileFetching;if(w.__returned===w)throw A},lt=(A,x)=>{var O;let f=(O=e(this,Et))==null?void 0:O.call(this,e$1,o,d);f&&f instanceof Promise&&f.then(c=>A(c===void 0?void 0:c),x),n.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(A(void 0),s.allowStaleOnFetchAbort&&(A=c=>y(c,true)));});};s.status&&(s.status.fetchDispatched=true);let k=new Promise(lt).then(y,P),J=Object.assign(k,{__abortController:n,__staleWhileFetching:o,__returned:void 0});return i===void 0?(this.set(e$1,J,{...d.options,status:void 0}),i=e(this,L).get(e$1)):e(this,u)[i]=J,J},U=function(e$1){if(!e(this,gt))return false;let i=e$1;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof jt},Wt=function(e$1,i){e(this,Y)[i]=e$1,e(this,F)[e$1]=i;},Lt=function(e$1){e$1!==e(this,I)&&(e$1===e(this,j)?g(this,j,e(this,F)[e$1]):h(this,a,Wt).call(this,e(this,Y)[e$1],e(this,F)[e$1]),h(this,a,Wt).call(this,e(this,I),e$1),g(this,I,e$1));},ft=function(e$1,i$1){var r,o;let s=false;if(e(this,R)!==0){let n=e(this,L).get(e$1);if(n!==void 0)if(e(this,B)?.[n]&&(clearTimeout(e(this,B)?.[n]),e(this,B)[n]=void 0),s=true,e(this,R)===1)h(this,a,Yt).call(this,i$1);else {e(this,St).call(this,n);let l=e(this,u)[n];if(h(this,a,U).call(this,l)?l.__abortController.abort(new Error("deleted")):(e(this,ot)||e(this,M))&&(e(this,ot)&&((r=e(this,Z))==null||r.call(this,l,e$1,i$1)),e(this,M)&&e(this,D)?.push([l,e$1,i$1])),e(this,L).delete(e$1),e(this,T)[n]=void 0,e(this,u)[n]=void 0,n===e(this,I))g(this,I,e(this,Y)[n]);else if(n===e(this,j))g(this,j,e(this,F)[n]);else {let d=e(this,Y)[n];e(this,F)[d]=e(this,F)[n];let y=e(this,F)[n];e(this,Y)[y]=e(this,Y)[n];}i(this,R)._--,e(this,st).push(n);}}if(e(this,M)&&e(this,D)?.length){let n=e(this,D),l;for(;l=n?.shift();)(o=e(this,tt))==null||o.call(this,...l);}return s},Yt=function(e$1){var i,s;for(let r of h(this,a,ut).call(this,{allowStale:true})){let o=e(this,u)[r];if(h(this,a,U).call(this,o))o.__abortController.abort(new Error("deleted"));else {let n=e(this,T)[r];e(this,ot)&&((i=e(this,Z))==null||i.call(this,o,n,e$1)),e(this,M)&&e(this,D)?.push([o,n,e$1]);}}if(e(this,L).clear(),e(this,u).fill(void 0),e(this,T).fill(void 0),e(this,q)&&e(this,nt)){e(this,q).fill(0),e(this,nt).fill(0);for(let r of e(this,B)??[])r!==void 0&&clearTimeout(r);e(this,B)?.fill(void 0);}if(e(this,rt)&&e(this,rt).fill(0),g(this,j,0),g(this,I,0),e(this,st).length=0,g(this,it,0),g(this,R,0),e(this,M)&&e(this,D)){let r=e(this,D),o;for(;o=r?.shift();)(s=e(this,tt))==null||s.call(this,...o);}},Ot);var Ft=class{cache;map=new Map;constructor(e){this.cache=new le({max:e.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(e){let i=this.map.delete(e);return i&&this.cache.delete(e),i}get forEach(){return this.map.forEach}get(e){let i=this.cache.get(e);return i||this.map.get(e)}has(e){return this.map.has(e)}set(e,i){return this.map.set(e,i),this.cache.set(e,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var Ct="1.9.1";var qt={version:Ct};var Bt="__game_layer__";var we={CURRENT_DIALOGUE_MEMORY_KEY:"dialogue",LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY:"dialogue:step_counter",CURRENT_MENU_OPTIONS_MEMORY_KEY:"choice:options",LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY:"choice:step_counter",CURRENT_INPUT_VALUE_MEMORY_KEY:"input:value",LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY:"input:step_counter",CURRENT_INPUT_INFO_MEMORY_KEY:"input:info",CHARACTER_CATEGORY_KEY:"character",ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY:"___glue___",OPENED_LABELS_COUNTER_KEY:"label:opened",ALL_CHOICES_MADE_KEY:"choices:made",CURRENT_STEP_TIMES_COUNTER_KEY:"label:history",LAST_STEP_GLUED:"glue:last_step"};var de={};var $t={};b($t,{createExportableElement:()=>pe});var bt;(r=>(r.log=(o,...n)=>console.log(`[Pixi\u2019VN] ${o}`,...n),r.warn=(o,...n)=>console.warn(`[Pixi\u2019VN] ${o}`,...n),r.error=(o,...n)=>console.error(`[Pixi\u2019VN] ${o}`,...n),r.info=(o,...n)=>console.info(`[Pixi\u2019VN] ${o}`,...n)))(bt||={});function pe(_){try{if(typeof _>"u")return _;let e=JSON.stringify(_);return JSON.parse(e)}catch(e){throw bt.error("Error creating exportable element",_,e),new PixiError("not_json_serializable","Error creating exportable element")}}var Ee=typeof window<"u"&&typeof document<"u",ue=[" _______ _ _ _ ____ ____ ____ _____ ","|_ __ \\ (_) (_) | | |_ _| |_ _||_ \\|_ _|"," | |__) |__ _ __ __ \\_| \\ \\ / / | \\ | | "," | ___/[ | [ \\ [ ][ | \\ \\ / / | |\\ \\| | "," _| |_ | | > ' < | | \\ ' / _| |_\\ |_ ",`|_____| [___][__]\`\\_][___] \\_/ |_____|\\____| v${qt.version}`],fe=31,Ue="background:#2f90da;color:#fff;font-weight:bold;",Te="background:#c832bb;color:#fff;font-weight:bold;",Ae="background:transparent;font-weight:bold;",Xt=` v${qt.version}`;function ge(){if(!Ee)return;let _=[],e=[];for(let i=0;i<ue.length;i++){let s=ue[i],r=s.endsWith(Xt),o=r?s.slice(0,-Xt.length):s,n=o.slice(0,fe),l=o.slice(fe),d=r?"%c%s%c%s%c%s":"%c%s%c%s";_.push(d),e.push(Ue,n,Te,l),r&&e.push(Ae,Xt);}console.info(_.join(`
|
|
2
|
-
`),...e);}function
|
|
1
|
+
import {f,b,g,e,d,h,i}from'./chunk-K7JIC2F2.mjs';import*as H from'@drincs/pixi-vn/canvas';export*from'@drincs/pixi-vn/canvas';import*as $t from'@drincs/pixi-vn/characters';export*from'@drincs/pixi-vn/characters';import {PixiError,GameUnifier}from'@drincs/pixi-vn/core';export*from'@drincs/pixi-vn/core';import*as nt from'@drincs/pixi-vn/history';export*from'@drincs/pixi-vn/history';import*as O from'@drincs/pixi-vn/narration';export*from'@drincs/pixi-vn/narration';import*as _t from'@drincs/pixi-vn/sound';export*from'@drincs/pixi-vn/sound';import*as W from'@drincs/pixi-vn/storage';export*from'@drincs/pixi-vn/storage';import {GameWorkerManager}from'@drincs/pixi-vn/worker';export*from'@drincs/pixi-vn/worker';import {motion}from'@drincs/pixi-vn/motion';var fe=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Zt=new Set,Ft=typeof process=="object"&&process?process:{},te=(g,e,i,s)=>{typeof Ft.emitWarning=="function"?Ft.emitWarning(g,e,i,s):console.error(`[${i}] ${e}: ${g}`);},Dt=globalThis.AbortController,Xt=globalThis.AbortSignal;if(typeof Dt>"u"){Xt=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,s){this._onabort.push(s);}},Dt=class{constructor(){e();}signal=new Xt;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let g=Ft.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{g&&(g=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",e));};}var me=g=>!Zt.has(g);var dt=g=>g&&g===Math.floor(g)&&g>0&&isFinite(g),ee=g=>dt(g)?g<=Math.pow(2,8)?Uint8Array:g<=Math.pow(2,16)?Uint16Array:g<=Math.pow(2,32)?Uint32Array:g<=Number.MAX_SAFE_INTEGER?It:null:null,It=class extends Array{constructor(g){super(g),this.fill(0);}},at,St,ge=(at=class{heap;length;static create(e){let i=ee(e);if(!i)return [];g(at,St,true);let s=new at(e,i);return g(at,St,false),s}constructor(e$1,i){if(!e(at,St))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e$1),this.length=0;}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},St=new WeakMap,f(at,St,false),at),Jt,Qt,X,K,J,vt,Q,Tt,wt,Z,I,tt,R,x,m,z,Y,M,C,et,G,it,st,q,B,rt,mt,k,xt,a,Mt,yt,ht,Ot,$,se,bt,Et,Lt,pt,ut,zt,Ct,Gt,w,kt,At,ft,Vt,Ut,ie=(Ut=class{constructor(e$1){f(this,a);f(this,X);f(this,K);f(this,J);f(this,vt);f(this,Q);f(this,Tt);f(this,wt);f(this,Z);d(this,"ttl");d(this,"ttlResolution");d(this,"ttlAutopurge");d(this,"updateAgeOnGet");d(this,"updateAgeOnHas");d(this,"allowStale");d(this,"noDisposeOnSet");d(this,"noUpdateTTL");d(this,"maxEntrySize");d(this,"sizeCalculation");d(this,"noDeleteOnFetchRejection");d(this,"noDeleteOnStaleGet");d(this,"allowStaleOnFetchAbort");d(this,"allowStaleOnFetchRejection");d(this,"ignoreFetchAbort");f(this,I);f(this,tt);f(this,R);f(this,x);f(this,m);f(this,z);f(this,Y);f(this,M);f(this,C);f(this,et);f(this,G);f(this,it);f(this,st);f(this,q);f(this,B);f(this,rt);f(this,mt);f(this,k);f(this,xt);f(this,yt,()=>{});f(this,ht,()=>{});f(this,Ot,()=>{});f(this,$,()=>false);f(this,bt,e=>{});f(this,Et,(e,i,s)=>{});f(this,Lt,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});d(this,Jt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:o,updateAgeOnGet:n,updateAgeOnHas:l,allowStale:c,dispose:y,onInsert:U,disposeAfter:S,noDisposeOnSet:N,noUpdateTTL:D,maxSize:V=0,maxEntrySize:u=0,sizeCalculation:_,fetchMethod:f$1,memoMethod:L,noDeleteOnFetchRejection:A,noDeleteOnStaleGet:d$1,allowStaleOnFetchRejection:T,allowStaleOnFetchAbort:ot,ignoreFetchAbort:v,perf:E}=e$1;if(E!==void 0&&typeof E?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(g(this,Z,E??fe),i!==0&&!dt(i))throw new TypeError("max option must be a nonnegative integer");let F=i?ee(i):Array;if(!F)throw new Error("invalid max value: "+i);if(g(this,X,i),g(this,K,V),this.maxEntrySize=u||e(this,K),this.sizeCalculation=_,this.sizeCalculation){if(!e(this,K)&&!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(L!==void 0&&typeof L!="function")throw new TypeError("memoMethod must be a function if defined");if(g(this,wt,L),f$1!==void 0&&typeof f$1!="function")throw new TypeError("fetchMethod must be a function if specified");if(g(this,Tt,f$1),g(this,mt,!!f$1),g(this,R,new Map),g(this,x,new Array(i).fill(void 0)),g(this,m,new Array(i).fill(void 0)),g(this,z,new F(i)),g(this,Y,new F(i)),g(this,M,0),g(this,C,0),g(this,et,ge.create(i)),g(this,I,0),g(this,tt,0),typeof y=="function"&&g(this,J,y),typeof U=="function"&&g(this,vt,U),typeof S=="function"?(g(this,Q,S),g(this,G,[])):(g(this,Q,void 0),g(this,G,void 0)),g(this,rt,!!e(this,J)),g(this,xt,!!e(this,vt)),g(this,k,!!e(this,Q)),this.noDisposeOnSet=!!N,this.noUpdateTTL=!!D,this.noDeleteOnFetchRejection=!!A,this.allowStaleOnFetchRejection=!!T,this.allowStaleOnFetchAbort=!!ot,this.ignoreFetchAbort=!!v,this.maxEntrySize!==0){if(e(this,K)!==0&&!dt(e(this,K)))throw new TypeError("maxSize must be a positive integer if specified");if(!dt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");h(this,a,se).call(this);}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!d$1,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!l,this.ttlResolution=dt(r)||r===0?r:1,this.ttlAutopurge=!!o,this.ttl=s||0,this.ttl){if(!dt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");h(this,a,Mt).call(this);}if(e(this,X)===0&&this.ttl===0&&e(this,K)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!e(this,X)&&!e(this,K)){let lt="LRU_CACHE_UNBOUNDED";me(lt)&&(Zt.add(lt),te("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",lt,Ut));}}get perf(){return e(this,Z)}static unsafeExposeInternals(e$1){return {starts:e(e$1,st),ttls:e(e$1,q),autopurgeTimers:e(e$1,B),sizes:e(e$1,it),keyMap:e(e$1,R),keyList:e(e$1,x),valList:e(e$1,m),next:e(e$1,z),prev:e(e$1,Y),get head(){return e(e$1,M)},get tail(){return e(e$1,C)},free:e(e$1,et),isBackgroundFetch:i=>{var s;return h(s=e$1,a,w).call(s,i)},backgroundFetch:(i,s,r,o)=>{var n;return h(n=e$1,a,Gt).call(n,i,s,r,o)},moveToTail:i=>{var s;return h(s=e$1,a,At).call(s,i)},indexes:i=>{var s;return h(s=e$1,a,pt).call(s,i)},rindexes:i=>{var s;return h(s=e$1,a,ut).call(s,i)},isStale:i=>{var s;return e(s=e$1,$).call(s,i)}}}get max(){return e(this,X)}get maxSize(){return e(this,K)}get calculatedSize(){return e(this,tt)}get size(){return e(this,I)}get fetchMethod(){return e(this,Tt)}get memoMethod(){return e(this,wt)}get dispose(){return e(this,J)}get onInsert(){return e(this,vt)}get disposeAfter(){return e(this,Q)}getRemainingTTL(e$1){return e(this,R).has(e$1)?1/0:0}*entries(){for(let e$1 of h(this,a,pt).call(this))e(this,m)[e$1]!==void 0&&e(this,x)[e$1]!==void 0&&!h(this,a,w).call(this,e(this,m)[e$1])&&(yield [e(this,x)[e$1],e(this,m)[e$1]]);}*rentries(){for(let e$1 of h(this,a,ut).call(this))e(this,m)[e$1]!==void 0&&e(this,x)[e$1]!==void 0&&!h(this,a,w).call(this,e(this,m)[e$1])&&(yield [e(this,x)[e$1],e(this,m)[e$1]]);}*keys(){for(let e$1 of h(this,a,pt).call(this)){let i=e(this,x)[e$1];i!==void 0&&!h(this,a,w).call(this,e(this,m)[e$1])&&(yield i);}}*rkeys(){for(let e$1 of h(this,a,ut).call(this)){let i=e(this,x)[e$1];i!==void 0&&!h(this,a,w).call(this,e(this,m)[e$1])&&(yield i);}}*values(){for(let e$1 of h(this,a,pt).call(this))e(this,m)[e$1]!==void 0&&!h(this,a,w).call(this,e(this,m)[e$1])&&(yield e(this,m)[e$1]);}*rvalues(){for(let e$1 of h(this,a,ut).call(this))e(this,m)[e$1]!==void 0&&!h(this,a,w).call(this,e(this,m)[e$1])&&(yield e(this,m)[e$1]);}[(Qt=Symbol.iterator,Jt=Symbol.toStringTag,Qt)](){return this.entries()}find(e$1,i={}){for(let s of h(this,a,pt).call(this)){let r=e(this,m)[s],o=h(this,a,w).call(this,r)?r.__staleWhileFetching:r;if(o!==void 0&&e$1(o,e(this,x)[s],this))return this.get(e(this,x)[s],i)}}forEach(e$1,i=this){for(let s of h(this,a,pt).call(this)){let r=e(this,m)[s],o=h(this,a,w).call(this,r)?r.__staleWhileFetching:r;o!==void 0&&e$1.call(i,o,e(this,x)[s],this);}}rforEach(e$1,i=this){for(let s of h(this,a,ut).call(this)){let r=e(this,m)[s],o=h(this,a,w).call(this,r)?r.__staleWhileFetching:r;o!==void 0&&e$1.call(i,o,e(this,x)[s],this);}}purgeStale(){let e$1=false;for(let i of h(this,a,ut).call(this,{allowStale:true}))e(this,$).call(this,i)&&(h(this,a,ft).call(this,e(this,x)[i],"expire"),e$1=true);return e$1}info(e$1){let i=e(this,R).get(e$1);if(i===void 0)return;let s=e(this,m)[i],r=h(this,a,w).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let o={value:r};if(e(this,q)&&e(this,st)){let n=e(this,q)[i],l=e(this,st)[i];if(n&&l){let c=n-(e(this,Z).now()-l);o.ttl=c,o.start=Date.now();}}return e(this,it)&&(o.size=e(this,it)[i]),o}dump(){let e$1=[];for(let i of h(this,a,pt).call(this,{allowStale:true})){let s=e(this,x)[i],r=e(this,m)[i],o=h(this,a,w).call(this,r)?r.__staleWhileFetching:r;if(o===void 0||s===void 0)continue;let n={value:o};if(e(this,q)&&e(this,st)){n.ttl=e(this,q)[i];let l=e(this,Z).now()-e(this,st)[i];n.start=Math.floor(Date.now()-l);}e(this,it)&&(n.size=e(this,it)[i]),e$1.unshift([s,n]);}return e$1}load(e$1){this.clear();for(let[i,s]of e$1){if(s.start){let r=Date.now()-s.start;s.start=e(this,Z).now()-r;}this.set(i,s.value,s);}}set(e$1,i$1,s={}){var N,D,V,u;if(i$1===void 0)return this.delete(e$1),this;let{ttl:r=this.ttl,start:o,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:l=this.sizeCalculation,status:c}=s,{noUpdateTTL:y=this.noUpdateTTL}=s,U=e(this,Lt).call(this,e$1,i$1,s.size||0,l);if(this.maxEntrySize&&U>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=true),h(this,a,ft).call(this,e$1,"set"),this;let S=e(this,I)===0?void 0:e(this,R).get(e$1);if(S===void 0)S=e(this,I)===0?e(this,C):e(this,et).length!==0?e(this,et).pop():e(this,I)===e(this,X)?h(this,a,Ct).call(this,false):e(this,I),e(this,x)[S]=e$1,e(this,m)[S]=i$1,e(this,R).set(e$1,S),e(this,z)[e(this,C)]=S,e(this,Y)[S]=e(this,C),g(this,C,S),i(this,I)._++,e(this,Et).call(this,S,U,c),c&&(c.set="add"),y=false,e(this,xt)&&((N=e(this,vt))==null||N.call(this,i$1,e$1,"add"));else {h(this,a,At).call(this,S);let _=e(this,m)[S];if(i$1!==_){if(e(this,mt)&&h(this,a,w).call(this,_)){_.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:f}=_;f!==void 0&&!n&&(e(this,rt)&&((D=e(this,J))==null||D.call(this,f,e$1,"set")),e(this,k)&&e(this,G)?.push([f,e$1,"set"]));}else n||(e(this,rt)&&((V=e(this,J))==null||V.call(this,_,e$1,"set")),e(this,k)&&e(this,G)?.push([_,e$1,"set"]));if(e(this,bt).call(this,S),e(this,Et).call(this,S,U,c),e(this,m)[S]=i$1,c){c.set="replace";let f=_&&h(this,a,w).call(this,_)?_.__staleWhileFetching:_;f!==void 0&&(c.oldValue=f);}}else c&&(c.set="update");e(this,xt)&&this.onInsert?.(i$1,e$1,i$1===_?"update":"replace");}if(r!==0&&!e(this,q)&&h(this,a,Mt).call(this),e(this,q)&&(y||e(this,Ot).call(this,S,r,o),c&&e(this,ht).call(this,c,S)),!n&&e(this,k)&&e(this,G)){let _=e(this,G),f;for(;f=_?.shift();)(u=e(this,Q))==null||u.call(this,...f);}return this}pop(){var e$1;try{for(;e(this,I);){let i=e(this,m)[e(this,M)];if(h(this,a,Ct).call(this,!0),h(this,a,w).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(e(this,k)&&e(this,G)){let i=e(this,G),s;for(;s=i?.shift();)(e$1=e(this,Q))==null||e$1.call(this,...s);}}}has(e$1,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,o=e(this,R).get(e$1);if(o!==void 0){let n=e(this,m)[o];if(h(this,a,w).call(this,n)&&n.__staleWhileFetching===void 0)return false;if(e(this,$).call(this,o))r&&(r.has="stale",e(this,ht).call(this,r,o));else return s&&e(this,yt).call(this,o),r&&(r.has="hit",e(this,ht).call(this,r,o)),true}else r&&(r.has="miss");return false}peek(e$1,i={}){let{allowStale:s=this.allowStale}=i,r=e(this,R).get(e$1);if(r===void 0||!s&&e(this,$).call(this,r))return;let o=e(this,m)[r];return h(this,a,w).call(this,o)?o.__staleWhileFetching:o}async fetch(e$1,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:l=this.noDisposeOnSet,size:c=0,sizeCalculation:y=this.sizeCalculation,noUpdateTTL:U=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:N=this.allowStaleOnFetchRejection,ignoreFetchAbort:D=this.ignoreFetchAbort,allowStaleOnFetchAbort:V=this.allowStaleOnFetchAbort,context:u,forceRefresh:_=false,status:f,signal:L}=i;if(!e(this,mt))return f&&(f.fetch="get"),this.get(e$1,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:o,status:f});let A={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:o,ttl:n,noDisposeOnSet:l,size:c,sizeCalculation:y,noUpdateTTL:U,noDeleteOnFetchRejection:S,allowStaleOnFetchRejection:N,allowStaleOnFetchAbort:V,ignoreFetchAbort:D,status:f,signal:L},d=e(this,R).get(e$1);if(d===void 0){f&&(f.fetch="miss");let T=h(this,a,Gt).call(this,e$1,d,A,u);return T.__returned=T}else {let T=e(this,m)[d];if(h(this,a,w).call(this,T)){let F=s&&T.__staleWhileFetching!==void 0;return f&&(f.fetch="inflight",F&&(f.returnedStale=true)),F?T.__staleWhileFetching:T.__returned=T}let ot=e(this,$).call(this,d);if(!_&&!ot)return f&&(f.fetch="hit"),h(this,a,At).call(this,d),r&&e(this,yt).call(this,d),f&&e(this,ht).call(this,f,d),T;let v=h(this,a,Gt).call(this,e$1,d,A,u),E=v.__staleWhileFetching!==void 0&&s;return f&&(f.fetch=ot?"stale":"refresh",E&&ot&&(f.returnedStale=true)),E?v.__staleWhileFetching:v.__returned=v}}async forceFetch(e,i={}){let s=await this.fetch(e,i);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(e$1,i={}){let s=e(this,wt);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:o,...n}=i,l=this.get(e$1,n);if(!o&&l!==void 0)return l;let c=s(e$1,l,{options:n,context:r});return this.set(e$1,c,n),c}get(e$1,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:n}=i,l=e(this,R).get(e$1);if(l!==void 0){let c=e(this,m)[l],y=h(this,a,w).call(this,c);return n&&e(this,ht).call(this,n,l),e(this,$).call(this,l)?(n&&(n.get="stale"),y?(n&&s&&c.__staleWhileFetching!==void 0&&(n.returnedStale=true),s?c.__staleWhileFetching:void 0):(o||h(this,a,ft).call(this,e$1,"expire"),n&&s&&(n.returnedStale=true),s?c:void 0)):(n&&(n.get="hit"),y?c.__staleWhileFetching:(h(this,a,At).call(this,l),r&&e(this,yt).call(this,l),c))}else n&&(n.get="miss");}delete(e){return h(this,a,ft).call(this,e,"delete")}clear(){return h(this,a,Vt).call(this,"delete")}},X=new WeakMap,K=new WeakMap,J=new WeakMap,vt=new WeakMap,Q=new WeakMap,Tt=new WeakMap,wt=new WeakMap,Z=new WeakMap,I=new WeakMap,tt=new WeakMap,R=new WeakMap,x=new WeakMap,m=new WeakMap,z=new WeakMap,Y=new WeakMap,M=new WeakMap,C=new WeakMap,et=new WeakMap,G=new WeakMap,it=new WeakMap,st=new WeakMap,q=new WeakMap,B=new WeakMap,rt=new WeakMap,mt=new WeakMap,k=new WeakMap,xt=new WeakMap,a=new WeakSet,Mt=function(){let e$1=new It(e(this,X)),i=new It(e(this,X));g(this,q,e$1),g(this,st,i);let s=this.ttlAutopurge?new Array(e(this,X)):void 0;g(this,B,s),g(this,Ot,(l,c,y=e(this,Z).now())=>{i[l]=c!==0?y:0,e$1[l]=c,r(l,c);}),g(this,yt,l=>{i[l]=e$1[l]!==0?e(this,Z).now():0,r(l,e$1[l]);});let r=this.ttlAutopurge?(l,c)=>{if(s?.[l]&&(clearTimeout(s[l]),s[l]=void 0),c&&c!==0&&s){let y=setTimeout(()=>{e(this,$).call(this,l)&&h(this,a,ft).call(this,e(this,x)[l],"expire");},c+1);y.unref&&y.unref(),s[l]=y;}}:()=>{};g(this,ht,(l,c)=>{if(e$1[c]){let y=e$1[c],U=i[c];if(!y||!U)return;l.ttl=y,l.start=U,l.now=o||n();let S=l.now-U;l.remainingTTL=y-S;}});let o=0,n=()=>{let l=e(this,Z).now();if(this.ttlResolution>0){o=l;let c=setTimeout(()=>o=0,this.ttlResolution);c.unref&&c.unref();}return l};this.getRemainingTTL=l=>{let c=e(this,R).get(l);if(c===void 0)return 0;let y=e$1[c],U=i[c];if(!y||!U)return 1/0;let S=(o||n())-U;return y-S},g(this,$,l=>{let c=i[l],y=e$1[l];return !!y&&!!c&&(o||n())-c>y});},yt=new WeakMap,ht=new WeakMap,Ot=new WeakMap,$=new WeakMap,se=function(){let e$1=new It(e(this,X));g(this,tt,0),g(this,it,e$1),g(this,bt,i=>{g(this,tt,e(this,tt)-e$1[i]),e$1[i]=0;}),g(this,Lt,(i,s,r,o)=>{if(h(this,a,w).call(this,s))return 0;if(!dt(r))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(r=o(s,i),!dt(r))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 r}),g(this,Et,(i,s,r)=>{if(e$1[i]=s,e(this,K)){let o=e(this,K)-e$1[i];for(;e(this,tt)>o;)h(this,a,Ct).call(this,true);}g(this,tt,e(this,tt)+e$1[i]),r&&(r.entrySize=s,r.totalCalculatedSize=e(this,tt));});},bt=new WeakMap,Et=new WeakMap,Lt=new WeakMap,pt=function*({allowStale:e$1=this.allowStale}={}){if(e(this,I))for(let i=e(this,C);!(!h(this,a,zt).call(this,i)||((e$1||!e(this,$).call(this,i))&&(yield i),i===e(this,M)));)i=e(this,Y)[i];},ut=function*({allowStale:e$1=this.allowStale}={}){if(e(this,I))for(let i=e(this,M);!(!h(this,a,zt).call(this,i)||((e$1||!e(this,$).call(this,i))&&(yield i),i===e(this,C)));)i=e(this,z)[i];},zt=function(e$1){return e$1!==void 0&&e(this,R).get(e(this,x)[e$1])===e$1},Ct=function(e$1){var o;let i$1=e(this,M),s=e(this,x)[i$1],r=e(this,m)[i$1];return e(this,mt)&&h(this,a,w).call(this,r)?r.__abortController.abort(new Error("evicted")):(e(this,rt)||e(this,k))&&(e(this,rt)&&((o=e(this,J))==null||o.call(this,r,s,"evict")),e(this,k)&&e(this,G)?.push([r,s,"evict"])),e(this,bt).call(this,i$1),e(this,B)?.[i$1]&&(clearTimeout(e(this,B)[i$1]),e(this,B)[i$1]=void 0),e$1&&(e(this,x)[i$1]=void 0,e(this,m)[i$1]=void 0,e(this,et).push(i$1)),e(this,I)===1?(g(this,M,g(this,C,0)),e(this,et).length=0):g(this,M,e(this,z)[i$1]),e(this,R).delete(s),i(this,I)._--,i$1},Gt=function(e$1,i,s,r){let o=i===void 0?void 0:e(this,m)[i];if(h(this,a,w).call(this,o))return o;let n=new Dt,{signal:l}=s;l?.addEventListener("abort",()=>n.abort(l.reason),{signal:n.signal});let c={signal:n.signal,options:s,context:r},y=(u,_=false)=>{let{aborted:f}=n.signal,L=s.ignoreFetchAbort&&u!==void 0,A=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&u!==void 0);if(s.status&&(f&&!_?(s.status.fetchAborted=true,s.status.fetchError=n.signal.reason,L&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),f&&!L&&!_)return S(n.signal.reason,A);let d=D,T=e(this,m)[i];return (T===D||L&&_&&T===void 0)&&(u===void 0?d.__staleWhileFetching!==void 0?e(this,m)[i]=d.__staleWhileFetching:h(this,a,ft).call(this,e$1,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e$1,u,c.options))),u},U=u=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=u),S(u,false)),S=(u,_)=>{let{aborted:f}=n.signal,L=f&&s.allowStaleOnFetchAbort,A=L||s.allowStaleOnFetchRejection,d=A||s.noDeleteOnFetchRejection,T=D;if(e(this,m)[i]===D&&(!d||!_&&T.__staleWhileFetching===void 0?h(this,a,ft).call(this,e$1,"fetch"):L||(e(this,m)[i]=T.__staleWhileFetching)),A)return s.status&&T.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),T.__staleWhileFetching;if(T.__returned===T)throw u},N=(u,_)=>{var L;let f=(L=e(this,Tt))==null?void 0:L.call(this,e$1,o,c);f&&f instanceof Promise&&f.then(A=>u(A===void 0?void 0:A),_),n.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(u(void 0),s.allowStaleOnFetchAbort&&(u=A=>y(A,true)));});};s.status&&(s.status.fetchDispatched=true);let D=new Promise(N).then(y,U),V=Object.assign(D,{__abortController:n,__staleWhileFetching:o,__returned:void 0});return i===void 0?(this.set(e$1,V,{...c.options,status:void 0}),i=e(this,R).get(e$1)):e(this,m)[i]=V,V},w=function(e$1){if(!e(this,mt))return false;let i=e$1;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Dt},kt=function(e$1,i){e(this,Y)[i]=e$1,e(this,z)[e$1]=i;},At=function(e$1){e$1!==e(this,C)&&(e$1===e(this,M)?g(this,M,e(this,z)[e$1]):h(this,a,kt).call(this,e(this,Y)[e$1],e(this,z)[e$1]),h(this,a,kt).call(this,e(this,C),e$1),g(this,C,e$1));},ft=function(e$1,i$1){var r,o;let s=false;if(e(this,I)!==0){let n=e(this,R).get(e$1);if(n!==void 0)if(e(this,B)?.[n]&&(clearTimeout(e(this,B)?.[n]),e(this,B)[n]=void 0),s=true,e(this,I)===1)h(this,a,Vt).call(this,i$1);else {e(this,bt).call(this,n);let l=e(this,m)[n];if(h(this,a,w).call(this,l)?l.__abortController.abort(new Error("deleted")):(e(this,rt)||e(this,k))&&(e(this,rt)&&((r=e(this,J))==null||r.call(this,l,e$1,i$1)),e(this,k)&&e(this,G)?.push([l,e$1,i$1])),e(this,R).delete(e$1),e(this,x)[n]=void 0,e(this,m)[n]=void 0,n===e(this,C))g(this,C,e(this,Y)[n]);else if(n===e(this,M))g(this,M,e(this,z)[n]);else {let c=e(this,Y)[n];e(this,z)[c]=e(this,z)[n];let y=e(this,z)[n];e(this,Y)[y]=e(this,Y)[n];}i(this,I)._--,e(this,et).push(n);}}if(e(this,k)&&e(this,G)?.length){let n=e(this,G),l;for(;l=n?.shift();)(o=e(this,Q))==null||o.call(this,...l);}return s},Vt=function(e$1){var i,s;for(let r of h(this,a,ut).call(this,{allowStale:true})){let o=e(this,m)[r];if(h(this,a,w).call(this,o))o.__abortController.abort(new Error("deleted"));else {let n=e(this,x)[r];e(this,rt)&&((i=e(this,J))==null||i.call(this,o,n,e$1)),e(this,k)&&e(this,G)?.push([o,n,e$1]);}}if(e(this,R).clear(),e(this,m).fill(void 0),e(this,x).fill(void 0),e(this,q)&&e(this,st)){e(this,q).fill(0),e(this,st).fill(0);for(let r of e(this,B)??[])r!==void 0&&clearTimeout(r);e(this,B)?.fill(void 0);}if(e(this,it)&&e(this,it).fill(0),g(this,M,0),g(this,C,0),e(this,et).length=0,g(this,tt,0),g(this,I,0),e(this,k)&&e(this,G)){let r=e(this,G),o;for(;o=r?.shift();)(s=e(this,Q))==null||s.call(this,...o);}},Ut);var jt=class{cache;map=new Map;constructor(e){this.cache=new ie({max:e.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(e){let i=this.map.delete(e);return i&&this.cache.delete(e),i}get forEach(){return this.map.forEach}get(e){let i=this.cache.get(e);return i||this.map.get(e)}has(e){return this.map.has(e)}set(e,i){return this.map.set(e,i),this.cache.set(e,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var Rt="1.9.3";var Ht={version:Rt};var Wt="__game_layer__";var _e={CURRENT_DIALOGUE_MEMORY_KEY:"dialogue",LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY:"dialogue:step_counter",CURRENT_MENU_OPTIONS_MEMORY_KEY:"choice:options",LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY:"choice:step_counter",CURRENT_INPUT_VALUE_MEMORY_KEY:"input:value",LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY:"input:step_counter",CURRENT_INPUT_INFO_MEMORY_KEY:"input:info",CHARACTER_CATEGORY_KEY:"character",ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY:"___glue___",OPENED_LABELS_COUNTER_KEY:"label:opened",ALL_CHOICES_MADE_KEY:"choices:made",CURRENT_STEP_TIMES_COUNTER_KEY:"label:history",LAST_STEP_GLUED:"glue:last_step"};var ne={};var Kt={};b(Kt,{createExportableElement:()=>oe});var gt;(r=>(r.log=(o,...n)=>console.log(`[Pixi\u2019VN] ${o}`,...n),r.warn=(o,...n)=>console.warn(`[Pixi\u2019VN] ${o}`,...n),r.error=(o,...n)=>console.error(`[Pixi\u2019VN] ${o}`,...n),r.info=(o,...n)=>console.info(`[Pixi\u2019VN] ${o}`,...n)))(gt||={});function oe(g){try{if(typeof g>"u")return g;let e=JSON.stringify(g);return JSON.parse(e)}catch(e){throw gt.error("Error creating exportable element",g,e),new PixiError("not_json_serializable","Error creating exportable element")}}function le(g){let e,i={},s={};function r(y){i=y;}function o(y){s=y;}function n(y){e&&l();let U=y?.windowKey??"pixiVN",S=[],N=u=>({...i,...u}),D={Game:g,narration:O.narration,storage:W.storage,stepHistory:nt.stepHistory,get props(){return i},start:(u,_)=>s.start?s.start(u,_):g.start(u,N(_)),continue:(u,_)=>s.continue?s.continue():O.narration.continue(N(u),_),call:(u,_)=>s.call?s.call(u,_):O.narration.call(u,N(_)),jump:(u,_)=>s.jump?s.jump(u,_):O.narration.jump(u,N(_)),selectChoice:(u,_)=>{let f=O.narration.choices.list?.find(L=>L.choiceIndex===u);if(!f){let L=O.narration.choices.list?.map(A=>A.choiceIndex).join(", ")??"none (no choice menu is open)";throw new Error(`Game.testing: no open choice with index ${u}. Available: ${L}`)}return s.selectChoice?s.selectChoice(f):O.narration.choices.select(f,N(_))},setInput:u=>{O.narration.input.value=u;},goBack:(u,_)=>s.back?s.back():nt.stepHistory.back(N(u),_),closeCurrentLabel:()=>O.narration.labels.closeCurrent(),closeAllLabels:()=>O.narration.labels.closeAll(),getState:()=>({dialogue:O.narration.dialogue,dialogueGlue:O.narration.dialogGlue,choices:O.narration.choices.list,input:{isRequired:O.narration.input.isRequired,type:O.narration.input.type,value:O.narration.input.value},canContinue:O.narration.canContinue,canGoBack:nt.stepHistory.canGoBack,labelsOpened:O.narration.labels.opened,currentLabelId:O.narration.labels.current?.id,stepCounter:O.narration.stepCounter}),get errors(){return S.slice()},clearErrors:()=>{S.length=0;}},V=u=>{S.push({error:u,timestamp:Date.now()});};return g.addOnError(V),typeof window<"u"?window[U]=D:gt.warn('Game.testing.enable(): "window" is not defined, so the API was not attached globally (it was still returned).'),e={api:D,windowKey:U,errorHandler:V},D}function l(){e&&(g.removeOnError(e.errorHandler),typeof window<"u"&&window[e.windowKey]===e.api&&delete window[e.windowKey],e=void 0);}function c(){return e!==void 0}return {setProps:r,setActions:o,enable:n,disable:l,isEnabled:c}}var ye=typeof window<"u"&&typeof document<"u",he=[" _______ _ _ _ ____ ____ ____ _____ ","|_ __ \\ (_) (_) | | |_ _| |_ _||_ \\|_ _|"," | |__) |__ _ __ __ \\_| \\ \\ / / | \\ | | "," | ___/[ | [ \\ [ ][ | \\ \\ / / | |\\ \\| | "," _| |_ | | > ' < | | \\ ' / _| |_\\ |_ ",`|_____| [___][__]\`\\_][___] \\_/ |_____|\\____| v${Ht.version}`],ce=31,be="background:#2f90da;color:#fff;font-weight:bold;",Se="background:#c832bb;color:#fff;font-weight:bold;",Te="background:transparent;font-weight:bold;",Yt=` v${Ht.version}`;function de(){if(!ye)return;let g=[],e=[];for(let i=0;i<he.length;i++){let s=he[i],r=s.endsWith(Yt),o=r?s.slice(0,-Yt.length):s,n=o.slice(0,ce),l=o.slice(ce),c=r?"%c%s%c%s%c%s":"%c%s%c%s";g.push(c),e.push(be,n,Se,l),r&&e.push(Te,Yt);}console.info(g.join(`
|
|
2
|
+
`),...e);}function qt(){let g=window.location.pathname+window.location.hash;return g.includes("#")&&(g=g.split("#")[1]),g}de();var pe;(A=>{async function g(d,T,ot){if(GameUnifier.init({navigate:T?.navigate,getCurrentGameStepState:async()=>{let v=H.canvas.isInitialized?H.canvas.export():{};return {path:qt(),storage:await W.storage.export(),canvas:v,sound:_t.sound.export(),labelIndex:O.NarrationManagerStatic.currentLabelStepIndex||0,openedLabels:O.narration.openedLabels}},restoreGameStepState:async(v,E)=>{nt.HistoryManagerStatic._originalStepData=v,O.NarrationManagerStatic.openedLabels=v.openedLabels,W.storage.restore(v.storage);try{H.canvas.isInitialized&&await H.canvas.restore(v.canvas),await _t.sound.restore(v.sound);}catch(F){gt.error("Error restoring game step state:",F);}await E(v.path);},getStepCounter:()=>O.narration.stepCounter,setStepCounter:v=>{O.NarrationManagerStatic._stepCounter=v;},getOpenedLabels:()=>O.narration.openedLabels.length,addHistoryItem:(v,E)=>nt.stepHistory.add(v,E),getCharacter:v=>$t.RegisteredCharacters.get(v),processNavigationRequests:(v,E)=>{let F=v,lt=Promise.resolve();return v>0?(F--,lt=O.narration.continue(E)):v<0&&(F=0,lt=nt.stepHistory.back(E,{steps:v*-1})),{newValue:F,result:lt}},animate:(v,E,F,lt)=>motion.animate(v,E,F,lt),getVariable:(v,E)=>W.StorageRegistry.getVariable(v,E),setVariable:(v,E,F)=>W.StorageRegistry.setVariable(v,E,F),removeVariable:(v,E)=>W.StorageRegistry.removeVariable(v,E),getFlag:v=>W.storage.flags.get(v),setFlag:(v,E)=>W.storage.flags.set(v,E),onLabelClosing:v=>W.StorageRegistry.clearOldTempVariables(v)}),!d||!T){gt.warn("The canvas element or options are not defined. The canvas will not be initialized.");return}return await H.canvas.init(d,T,ot)}A.init=g;function e(){W.storage.clear(),H.canvas.isInitialized&&H.canvas.clear(),_t.sound.clear(),O.narration.clear(),nt.stepHistory.clear();}A.clear=e;async function i(){let d=H.canvas.isInitialized?H.canvas.export():{};return {pixivn_version:Rt,stepData:O.narration.export(),storageData:await W.storage.export(),canvasData:d,soundData:_t.sound.export(),historyData:await nt.stepHistory.export(),path:qt()}}A.exportGameState=i;async function s(d){nt.stepHistory.restore(d.historyData);let T=nt.stepHistory.lastKey;if(typeof T=="number"){let ot=nt.stepHistory.stepsInfoMap.get(T)||null;await O.narration.restore(d.stepData,ot);}W.storage.restore(d.storageData);try{H.canvas.isInitialized&&await H.canvas.restore(d.canvasData),await _t.sound.restore(d.soundData);}catch{}await GameUnifier.navigate(d.path);}A.restoreGameState=s;async function r(d,T){return A.clear(),await O.narration.call(d,T)}A.start=r;function o(d){return JSON.parse(d)}A.jsonToGameState=o;function n(d){GameUnifier.onEnd=d;}A.onEnd=n;function l(d){return GameUnifier.addOnError(d)}A.addOnError=l;function c(d){return GameUnifier.removeOnError(d)}A.removeOnError=c;function y(d){O.NarrationManagerStatic.onStepStart=d;}A.onStepStart=y;function U(d){O.NarrationManagerStatic.onLoadingLabel=d;}A.onLoadingLabel=U;function S(d){O.NarrationManagerStatic.onStepEnd=d;}A.onStepEnd=S;function N(d){O.NarrationManagerStatic.onLabelStarting=d;}A.onLabelStarting=N;function D(d){O.NarrationManagerStatic.onLabelClosing=d;}A.onLabelClosing=D;function V(d){GameUnifier.navigate=d;}A.onNavigate=V;function u(d){return GameUnifier.addOnPreContinue(d)}A.addOnPreContinue=u;function _(d){return GameUnifier.removeOnPreContinue(d)}A.removeOnPreContinue=_,A.worker={register:d=>GameWorkerManager.register(d),unregister:()=>GameWorkerManager.unregister(),get isAvailable(){return GameWorkerManager.isAvailable}},A.testing=le(A);})(pe||={});var ei={characterUtils:$t,canvasUtils:H,narrationUtils:O,soundUtils:_t,CANVAS_APP_GAME_LAYER_ALIAS:Wt,PIXIVN_VERSION:Rt,...Kt,...ne,canvas:H.canvas,narration:O.narration,sound:_t.sound,storage:W.storage,history:nt.stepHistory,Game:pe,GameUnifier:GameUnifier};export{Wt as CANVAS_APP_GAME_LAYER_ALIAS,jt as CachedMap,pe as Game,Rt as PIXIVN_VERSION,_e as SYSTEM_RESERVED_STORAGE_KEYS,oe as createExportableElement,ei as default};
|