@drincs/pixi-vn-ink 1.1.5 → 1.1.6

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.
@@ -0,0 +1 @@
1
+ 'use strict';var _="/__pixi-vn-ink/hashtag-commands",I="/__pixi-vn-ink/text-replaces",n="/__pixi-vn-ink/info";exports.INK_DEV_API_HASHTAG_COMMANDS=_;exports.INK_DEV_API_INFO=n;exports.INK_DEV_API_TEXT_REPLACES=I;
@@ -0,0 +1,119 @@
1
+ import { c as InkValidationInfo } from './types-CbD_iwdO.cjs';
2
+ export { InkHashtagCommandInfo } from '@drincs/pixi-vn-ink/parser';
3
+ import 'inkjs/engine/Error';
4
+
5
+ /**
6
+ * Dev-server endpoint that exposes and accepts the list of registered
7
+ * {@link HashtagCommands} handlers as {@link InkHashtagCommandInfo} objects.
8
+ *
9
+ * - `GET /__pixi-vn-ink/hashtag-commands` – returns the stored `InkHashtagCommandInfo[]` as JSON.
10
+ * - `POST /__pixi-vn-ink/hashtag-commands` – replaces the stored list with the JSON body
11
+ * (`InkHashtagCommandInfo[]`). Called automatically by {@link setupInkHmrListener} on
12
+ * startup and after each HMR update.
13
+ * - `InkHashtagCommandInfo.validation` serializes the original validation rule:
14
+ * - `{ type: "regexp", source, flags }`
15
+ * - `{ type: "zod", schema }` (JSON Schema generated from Zod)
16
+ * - `{ type: "literal", value }`
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * // VS Code extension reading the registered handlers
21
+ * const res = await fetch("http://localhost:5173/__pixi-vn-ink/hashtag-commands");
22
+ * const commands: InkHashtagCommandInfo[] = await res.json();
23
+ * ```
24
+ */
25
+ declare const INK_DEV_API_HASHTAG_COMMANDS = "/__pixi-vn-ink/hashtag-commands";
26
+ /**
27
+ * Dev-server endpoint that exposes and accepts the list of registered
28
+ * {@link TextReplaces} handlers as {@link InkTextReplaceInfo} objects.
29
+ *
30
+ * - `GET /__pixi-vn-ink/text-replaces` – returns the stored `InkTextReplaceInfo[]` as JSON.
31
+ * - `POST /__pixi-vn-ink/text-replaces` – replaces the stored list with the JSON body
32
+ * (`InkTextReplaceInfo[]`). Called automatically by {@link setupInkHmrListener} on
33
+ * startup and after each HMR update.
34
+ * - `InkTextReplaceInfo.validation` serializes the original validation rule:
35
+ * - `{ type: "regexp", source, flags }`
36
+ * - `{ type: "zod", schema }` (JSON Schema generated from Zod)
37
+ * - `{ type: "literal", value }` for string modes like `"all"` / `"characterId"`
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * // VS Code extension reading the registered text-replace handlers
42
+ * const res = await fetch("http://localhost:5173/__pixi-vn-ink/text-replaces");
43
+ * const replaces: InkTextReplaceInfo[] = await res.json();
44
+ * ```
45
+ */
46
+ declare const INK_DEV_API_TEXT_REPLACES = "/__pixi-vn-ink/text-replaces";
47
+ /**
48
+ * Dev-server endpoint that exposes static information about this library instance, as an
49
+ * {@link InkLibraryInfo} object.
50
+ *
51
+ * - `GET /__pixi-vn-ink/info` – returns `{ version, schemaUrl }`, where `version` is this
52
+ * `@drincs/pixi-vn-ink` package's own version and `schemaUrl` is the `PIXIVNJSON_SCHEMA_URL`
53
+ * (from `@drincs/pixi-vn-json/constants`) embedded as `$schema` in every exported `PixiVNJson`
54
+ * document.
55
+ * - Read-only: unlike {@link INK_DEV_API_HASHTAG_COMMANDS} / {@link INK_DEV_API_TEXT_REPLACES},
56
+ * there is no `POST` — both values are static per plugin instance and don't depend on
57
+ * SSR-loading the user's content, so there's nothing for {@link setupInkHmrListener} to push.
58
+ *
59
+ * @example
60
+ * ```ts
61
+ * // VS Code extension reading the library version / schema URL
62
+ * const res = await fetch("http://localhost:5173/__pixi-vn-ink/info");
63
+ * const { version, schemaUrl }: InkLibraryInfo = await res.json();
64
+ * ```
65
+ */
66
+ declare const INK_DEV_API_INFO = "/__pixi-vn-ink/info";
67
+
68
+ /**
69
+ * Serializable representation of a registered {@link TextReplaces} handler,
70
+ * as exposed by the pixi-vn-ink Vite dev-server API.
71
+ *
72
+ * Instances of this type are returned by
73
+ * `GET /__pixi-vn-ink/text-replaces`
74
+ * and accepted by
75
+ * `POST /__pixi-vn-ink/text-replaces`.
76
+ *
77
+ * @see https://pixi-vn.com/ink#vite-plugin
78
+ */
79
+ interface InkTextReplaceInfo {
80
+ /**
81
+ * Unique name that identifies the handler.
82
+ * Matches {@link ReplaceHandlerOptions.name}.
83
+ */
84
+ name: string;
85
+ /**
86
+ * Human-readable description of what the handler does.
87
+ * Matches {@link ReplaceHandlerOptions.description}.
88
+ */
89
+ description?: string;
90
+ /**
91
+ * Serializable form of {@link ReplaceHandlerOptions.validation}.
92
+ */
93
+ validation: InkValidationInfo;
94
+ /**
95
+ * When the handler runs relative to the translation step.
96
+ * Matches {@link ReplaceHandlerOptions.type}.
97
+ * @default "before-translation"
98
+ */
99
+ type?: "before-translation" | "after-translation";
100
+ }
101
+ /**
102
+ * Static information about a running `@drincs/pixi-vn-ink` instance, as returned by
103
+ * `GET /__pixi-vn-ink/info`.
104
+ *
105
+ * @see https://pixi-vn.com/ink#vite-plugin
106
+ */
107
+ interface InkLibraryInfo {
108
+ /**
109
+ * This `@drincs/pixi-vn-ink` package's own version (from its `package.json`).
110
+ */
111
+ version: string;
112
+ /**
113
+ * The JSON Schema URL (`PIXIVNJSON_SCHEMA_URL` from `@drincs/pixi-vn-json/constants`)
114
+ * embedded as `$schema` in every exported `PixiVNJson` document.
115
+ */
116
+ schemaUrl: string;
117
+ }
118
+
119
+ export { INK_DEV_API_HASHTAG_COMMANDS, INK_DEV_API_INFO, INK_DEV_API_TEXT_REPLACES, type InkLibraryInfo, type InkTextReplaceInfo };
@@ -0,0 +1,119 @@
1
+ import { c as InkValidationInfo } from './types-CbD_iwdO.js';
2
+ export { InkHashtagCommandInfo } from '@drincs/pixi-vn-ink/parser';
3
+ import 'inkjs/engine/Error';
4
+
5
+ /**
6
+ * Dev-server endpoint that exposes and accepts the list of registered
7
+ * {@link HashtagCommands} handlers as {@link InkHashtagCommandInfo} objects.
8
+ *
9
+ * - `GET /__pixi-vn-ink/hashtag-commands` – returns the stored `InkHashtagCommandInfo[]` as JSON.
10
+ * - `POST /__pixi-vn-ink/hashtag-commands` – replaces the stored list with the JSON body
11
+ * (`InkHashtagCommandInfo[]`). Called automatically by {@link setupInkHmrListener} on
12
+ * startup and after each HMR update.
13
+ * - `InkHashtagCommandInfo.validation` serializes the original validation rule:
14
+ * - `{ type: "regexp", source, flags }`
15
+ * - `{ type: "zod", schema }` (JSON Schema generated from Zod)
16
+ * - `{ type: "literal", value }`
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * // VS Code extension reading the registered handlers
21
+ * const res = await fetch("http://localhost:5173/__pixi-vn-ink/hashtag-commands");
22
+ * const commands: InkHashtagCommandInfo[] = await res.json();
23
+ * ```
24
+ */
25
+ declare const INK_DEV_API_HASHTAG_COMMANDS = "/__pixi-vn-ink/hashtag-commands";
26
+ /**
27
+ * Dev-server endpoint that exposes and accepts the list of registered
28
+ * {@link TextReplaces} handlers as {@link InkTextReplaceInfo} objects.
29
+ *
30
+ * - `GET /__pixi-vn-ink/text-replaces` – returns the stored `InkTextReplaceInfo[]` as JSON.
31
+ * - `POST /__pixi-vn-ink/text-replaces` – replaces the stored list with the JSON body
32
+ * (`InkTextReplaceInfo[]`). Called automatically by {@link setupInkHmrListener} on
33
+ * startup and after each HMR update.
34
+ * - `InkTextReplaceInfo.validation` serializes the original validation rule:
35
+ * - `{ type: "regexp", source, flags }`
36
+ * - `{ type: "zod", schema }` (JSON Schema generated from Zod)
37
+ * - `{ type: "literal", value }` for string modes like `"all"` / `"characterId"`
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * // VS Code extension reading the registered text-replace handlers
42
+ * const res = await fetch("http://localhost:5173/__pixi-vn-ink/text-replaces");
43
+ * const replaces: InkTextReplaceInfo[] = await res.json();
44
+ * ```
45
+ */
46
+ declare const INK_DEV_API_TEXT_REPLACES = "/__pixi-vn-ink/text-replaces";
47
+ /**
48
+ * Dev-server endpoint that exposes static information about this library instance, as an
49
+ * {@link InkLibraryInfo} object.
50
+ *
51
+ * - `GET /__pixi-vn-ink/info` – returns `{ version, schemaUrl }`, where `version` is this
52
+ * `@drincs/pixi-vn-ink` package's own version and `schemaUrl` is the `PIXIVNJSON_SCHEMA_URL`
53
+ * (from `@drincs/pixi-vn-json/constants`) embedded as `$schema` in every exported `PixiVNJson`
54
+ * document.
55
+ * - Read-only: unlike {@link INK_DEV_API_HASHTAG_COMMANDS} / {@link INK_DEV_API_TEXT_REPLACES},
56
+ * there is no `POST` — both values are static per plugin instance and don't depend on
57
+ * SSR-loading the user's content, so there's nothing for {@link setupInkHmrListener} to push.
58
+ *
59
+ * @example
60
+ * ```ts
61
+ * // VS Code extension reading the library version / schema URL
62
+ * const res = await fetch("http://localhost:5173/__pixi-vn-ink/info");
63
+ * const { version, schemaUrl }: InkLibraryInfo = await res.json();
64
+ * ```
65
+ */
66
+ declare const INK_DEV_API_INFO = "/__pixi-vn-ink/info";
67
+
68
+ /**
69
+ * Serializable representation of a registered {@link TextReplaces} handler,
70
+ * as exposed by the pixi-vn-ink Vite dev-server API.
71
+ *
72
+ * Instances of this type are returned by
73
+ * `GET /__pixi-vn-ink/text-replaces`
74
+ * and accepted by
75
+ * `POST /__pixi-vn-ink/text-replaces`.
76
+ *
77
+ * @see https://pixi-vn.com/ink#vite-plugin
78
+ */
79
+ interface InkTextReplaceInfo {
80
+ /**
81
+ * Unique name that identifies the handler.
82
+ * Matches {@link ReplaceHandlerOptions.name}.
83
+ */
84
+ name: string;
85
+ /**
86
+ * Human-readable description of what the handler does.
87
+ * Matches {@link ReplaceHandlerOptions.description}.
88
+ */
89
+ description?: string;
90
+ /**
91
+ * Serializable form of {@link ReplaceHandlerOptions.validation}.
92
+ */
93
+ validation: InkValidationInfo;
94
+ /**
95
+ * When the handler runs relative to the translation step.
96
+ * Matches {@link ReplaceHandlerOptions.type}.
97
+ * @default "before-translation"
98
+ */
99
+ type?: "before-translation" | "after-translation";
100
+ }
101
+ /**
102
+ * Static information about a running `@drincs/pixi-vn-ink` instance, as returned by
103
+ * `GET /__pixi-vn-ink/info`.
104
+ *
105
+ * @see https://pixi-vn.com/ink#vite-plugin
106
+ */
107
+ interface InkLibraryInfo {
108
+ /**
109
+ * This `@drincs/pixi-vn-ink` package's own version (from its `package.json`).
110
+ */
111
+ version: string;
112
+ /**
113
+ * The JSON Schema URL (`PIXIVNJSON_SCHEMA_URL` from `@drincs/pixi-vn-json/constants`)
114
+ * embedded as `$schema` in every exported `PixiVNJson` document.
115
+ */
116
+ schemaUrl: string;
117
+ }
118
+
119
+ export { INK_DEV_API_HASHTAG_COMMANDS, INK_DEV_API_INFO, INK_DEV_API_TEXT_REPLACES, type InkLibraryInfo, type InkTextReplaceInfo };
@@ -0,0 +1 @@
1
+ var _="/__pixi-vn-ink/hashtag-commands",I="/__pixi-vn-ink/text-replaces",n="/__pixi-vn-ink/info";export{_ as INK_DEV_API_HASHTAG_COMMANDS,n as INK_DEV_API_INFO,I as INK_DEV_API_TEXT_REPLACES};
package/dist/vite.cjs CHANGED
@@ -92,7 +92,7 @@ LIST ${d} = ${m}
92
92
 
93
93
  `;return p.textSource=d.concat(p.textSource),p.initialVarsToRemove.push(f),h()}}return c.forEach(b=>{let f=b.message.match(/Function call to '(\w+)' requires (\d+) arguments, but got (\d+)/);f?.[1]&&(b.message=`The function '${f[1]}' have optional arguments, but in ink all arguments must be required. Please make sure to provide all the required arguments for the function call.`);}),{issues:c}}return {issues:c}}u.getErrors=e;function t(c,h){return ip(c).filter(({tokens:p})=>!h.some(({validation:g})=>np(p,g)))}u.getUnknownHashtagCommands=t;function n(c,h){let p=new Set;for(let b of c.matchAll(Vy))b[1]&&p.add(b[1]);let g=new Set(h),C=new Set,y=c.split(/\r?\n/),A=[];for(let b=0;b<y.length;b++){let f=(y[b]??"").replace(/\/\/.*$/,"");for(let d of f.matchAll(/->[ \t]+(\w[\w.]*)/g)){let m=d[1];if(!m)continue;let v=m.split(".")[0]??m;Ly.has(v)||p.has(v)||g.has(m)||g.has(m.replaceAll(".",By))||g.has(v)||C.has(m)||(C.add(m),A.push({line:b+1,target:m}));}}return A}u.getUnknownDivertTargets=n;function r(c){return new sp__default.default({strict:false,allErrors:true}).compile(c)}u.getSchemaValidator=r;function a(c,h){let p=typeof h=="function"?h:r(h);return p(c)?[]:Uy(p.errors??[],c,p.schema)}u.validateAgainstJsonSchema=a;function s(c,h){let p=new Set(h),g=[],C=c.length;for(let y=c.length-1;y>=0;y--)p.has(c[y])&&(g.push({key:c[y],sectionTokens:c.slice(y+1,C)}),C=y);return g.reverse()}u.extractKeyedSections=s;function o(c,h){let p=s(c,Object.keys(h)),g=[];for(let{key:C,sectionTokens:y}of p){let A;try{A=_t.convertListStringToObj(y);}catch(f){g.push({key:C,instancePath:"(root)",element:C,message:`could not parse "${C}" section into key/value pairs: ${f instanceof Error?f.message:String(f)}`});continue}let b=a(A,h[C]);g.push(...b.map(f=>({...f,key:C})));}return g}u.validateKeyedJsonSchemas=o;function l(c,h){let p=[];for(let g of ip(c)){let C=h.find(({validation:A})=>np(g.tokens,A));if(!C?.keySchemas)continue;let y=o(g.tokens,C.keySchemas);p.push(...y.map(A=>({...A,line:g.line,command:g.command})));}return p}u.getHashtagKeySchemaIssues=l;})(ot||={});var vu=Cn(Zt());function cp(i){if(!i||i.length===0)return;let e=new Set;for(let t of i){let n=typeof t=="string"?t:t?.id;typeof n=="string"&&n.length>0&&e.add(n);}return e.size>0?e:void 0}function Bi(i,e={}){let t={labelToRemove:[],initialVarsToRemove:[],functions:e.functions||[],enums:e.enums||{},textSource:i},{json:n,issues:r}=ot.compile(i,t);if(r.forEach(({message:s,type:o})=>{o===vu.ErrorType.Error?X.error(`Ink compilation error: ${s}`):o===vu.ErrorType.Warning?X.warn(`Ink compilation warning: ${s}`):X.info(`Ink compilation info: ${s}`);}),!n){X.error("No JSON generated from ink file");return}let a;try{a=Yn.parse(n);}catch{X.error("Error parsing ink file");return}return t.enums=a.listDefs||{},za.inkToJson(a,{...t,characterIds:cp(e.characters)})}var Le;(i=>(i.log=(e,...t)=>console.log(`[Pixi\u2019VN Json] ${e}`,...t),i.warn=(e,...t)=>console.warn(`[Pixi\u2019VN Json] ${e}`,...t),i.error=(e,...t)=>console.error(`[Pixi\u2019VN Json] ${e}`,...t),i.info=(e,...t)=>console.info(`[Pixi\u2019VN Json] ${e}`,...t)))(Le||={});var K=class Q{static init(e){e.loadAssets&&(Q._loadAssets=e.loadAssets),e.soundOperation&&(Q._soundOperation=e.soundOperation),e.imageOperation&&(Q._imageOperation=e.imageOperation),e.videoOperation&&(Q._videoOperation=e.videoOperation),e.imageContainerOperation&&(Q._imageContainerOperation=e.imageContainerOperation),e.textOperation&&(Q._textOperation=e.textOperation),e.canvasElementOperation&&(Q._canvasElementOperation=e.canvasElementOperation),e.setStorageValue&&(Q._setStorageValue=e.setStorageValue),e.setInitialStorageValue&&(Q._setInitialStorageValue=e.setInitialStorageValue),e.narrationOperation&&(Q._narrationOperation=e.narrationOperation),e.effectOperation&&(Q._effectOperation=e.effectOperation),e.animateOperation&&(Q._animateOperation=e.animateOperation),e.canvasOperation&&(Q._canvasOperation=e.canvasOperation),e.getLogichValue&&(Q._getLogichValue=e.getLogichValue),e.getConditionalStep&&(Q._getConditionalStep=e.getConditionalStep);}static _loadAssets=()=>{};static get loadAssets(){return Q._loadAssets}static _soundOperation=()=>{throw Le.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get soundOperation(){return Q._soundOperation}static _imageOperation=()=>{throw Le.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get imageOperation(){return Q._imageOperation}static _videoOperation=()=>{throw Le.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get videoOperation(){return Q._videoOperation}static _imageContainerOperation=()=>{throw Le.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get imageContainerOperation(){return Q._imageContainerOperation}static _textOperation=()=>{throw Le.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get textOperation(){return Q._textOperation}static _canvasElementOperation=()=>{throw Le.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get canvasElementOperation(){return Q._canvasElementOperation}static _setStorageValue=()=>{throw Le.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get setStorageValue(){return Q._setStorageValue}static _setInitialStorageValue=()=>{throw Le.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get setInitialStorageValue(){return Q._setInitialStorageValue}static _narrationOperation=()=>{throw Le.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get narrationOperation(){return Q._narrationOperation}static _effectOperation=()=>{throw Le.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get effectOperation(){return Q._effectOperation}static _animateOperation=()=>{throw Le.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get animateOperation(){return Q._animateOperation}static _canvasOperation=()=>{throw Le.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get canvasOperation(){return Q._canvasOperation}static _getLogichValue=()=>{throw Le.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get getLogichValue(){return Q._getLogichValue}static _getConditionalStep=()=>{throw Le.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get getConditionalStep(){return Q._getConditionalStep}};var dn;(i=>{i.options={replaceRegex:/\[([^\]]+)\]/};let e=[];function t(u,c){e.unshift({fn:u,opts:c});}i.add=t;function n(u){let c=e.findIndex(h=>h.fn===u);c!==-1&&e.splice(c,1);}i.remove=n;function r(){return e.map(u=>u.opts)}i.info=r;function a(u,c){let h=e.filter(p=>(p.opts.type??"after-translation")===c.type);for(let p of h)u=l(u,p.fn,p.opts.validation);return u}i.replace=a;function s(u){let c=e.filter(h=>h.opts.i18nInterpolation);for(let h of c)u=o(u,h.fn,h.opts);return u}i.runI18nPreStep=s;function o(u,c,h){let{validation:p}=h,g=new RegExp(i.options.replaceRegex.source,"g"),C=[...u.matchAll(g)],y=new Set,A=[];for(let b of C)y.has(b[1])||(y.add(b[1]),A.push(b[1]));for(let b of A){if(p==="characterId"){if(!characters.RegisteredCharacters.has(b))continue}else if(p!=="all"){if(p instanceof RegExp){if(!p.test(b))continue}else if(p instanceof zod.ZodType&&!p.safeParse(b).success)continue}c(b)!==void 0&&(u.includes(`{{[${b}]}}`)||(u=u.replaceAll(`[${b}]`,`{{[${b}]}}`)));}return u}function l(u,c,h){let p=new RegExp(i.options.replaceRegex.source,"g"),g=[...u.matchAll(p)],C=new Set,y=[];for(let A of g)C.has(A[1])||(C.add(A[1]),y.push(A[1]));for(let A of y){if(h==="characterId"){if(!characters.RegisteredCharacters.has(A))continue}else if(h!=="all"){if(h instanceof RegExp){if(!h.test(A))continue}else if(h instanceof zod.ZodType&&!h.safeParse(A).success)continue}let b=c(A);b!==void 0&&(u=u.replaceAll(`[${A}]`,b));}return u}})(dn||={});function zy(i,e={}){let t="";return i.values.forEach(n=>{if(typeof n=="string")t+=n;else {let r=K.getLogichValue(n,e);t+=`${r}`;}}),t}var dp;(i=>{let e=l=>l;function t(l){return Array.isArray(l)?l.map(u=>n(`${u}`)):n(`${l}`)}i.t=t;function n(l){let u=l;return i.beforeToTranslate&&(u=(0, i.beforeToTranslate)(u)),u=dn.replace(u,{type:"before-translation"}),u=e(u),i.afterToTranslate&&(u=(0, i.afterToTranslate)(u)),u=dn.replace(u,{type:"after-translation"}),u}i.translate=n;function r(l){e=l;}i.setTranslate=r;function a(l,u,c){let{defaultValue:h="empty_string"}=c;typeof u=="string"&&(u=[u]),Array.isArray(u)&&u.forEach(p=>{let g=p;if(i.beforeToTranslate&&(g=(0, i.beforeToTranslate)(g)),h==="empty_string")l[g]===void 0&&(l[g]="");else if(h==="copy_key"){let C=p;i.beforeToTranslate&&(C=(0, i.beforeToTranslate)(C));let y=dn.runI18nPreStep(C);y=dn.replace(y,{type:"before-translation"}),l[g]=y;}});}function s(l,u=[]){if(typeof l=="object"&&l&&"type"in l)if(l.type==="ifelse")l.then&&s(l.then,u),l.else&&s(l.else,u);else if(l.type==="stepswitch"){if(l.elements)if(Array.isArray(l.elements))l.elements.forEach(c=>{s(c,u);});else if(l.elements.type==="ifelse"){let c=[];s(l.elements,c),c.forEach(h=>{u.push(...h);});}else if(l.elements.type==="stepswitch"){let c=[];s(l.elements,c),c.forEach(h=>{u.push(...h);});}else s(l.elements,u);}else l.type==="resulttocombine"?(l.firstItem&&s(l.firstItem,u),l.secondConditionalItem&&l.secondConditionalItem.forEach(c=>{s(c,u);})):u.push(l);else l&&u.push(l);return u}async function o(l,u={},c={}){let{defaultValue:h="copy_key",operationStringConvert:p}=c,g=l.map(async C=>{if(C.choices){let y=[];Array.isArray(C.choices)?y=[C.choices]:y=s(C.choices),y.forEach(A=>{A.forEach(b=>{if("type"in b){let f=[];b.type==="ifelse"||b.type==="stepswitch"?s(b,f):f=[b],f.map(d=>s(d.text)).forEach(d=>{Array.isArray(d)&&d.forEach(m=>{Array.isArray(m)?m.forEach(v=>{typeof v=="string"?a(u,v,{defaultValue:h}):s(v).forEach(E=>{Array.isArray(E)?E.forEach(_=>{typeof _=="string"&&a(u,_,{defaultValue:h});}):typeof E=="string"&&a(u,E,{defaultValue:h});});}):typeof m=="string"&&a(u,m,{defaultValue:h});});});}});});}if(C.dialogue){let y=[];Array.isArray(C.dialogue)?y=[C.dialogue]:y=s(C.dialogue),y.forEach(A=>{if(typeof A=="string")a(u,A,{defaultValue:h});else if("text"in A){let b=s(A.text);typeof b=="string"&&(b=[b]),b.forEach(f=>{typeof f=="string"?a(u,f,{defaultValue:h}):s(f).forEach(d=>{typeof d=="string"?a(u,d,{defaultValue:h}):Array.isArray(d)&&d.forEach(m=>{typeof m=="string"?a(u,m,{defaultValue:h}):s(m).forEach(v=>{typeof v=="string"&&a(u,v,{defaultValue:h});});});});});}});}if(C.operations)for(let y of C.operations){if(y.type==="operationtoconvert"&&p){let A=zy(y),b=await p(A,C,{});if(!b)return;y=b;}y.type==="text"&&y.operationType==="show"&&a(u,y.text,{defaultValue:h});}C.conditionalStep&&s(C.conditionalStep).forEach(y=>{Array.isArray(y)?o(y,u,c):o([y],u,c);});});return await Promise.all(g),u}i.generateJsonTranslation=o;})(dp||={});var Wi=dp;var de;(i=>(i.log=(e,...t)=>console.log(`[Pixi\u2019VN Json] ${e}`,...t),i.warn=(e,...t)=>console.warn(`[Pixi\u2019VN Json] ${e}`,...t),i.error=(e,...t)=>console.error(`[Pixi\u2019VN Json] ${e}`,...t),i.info=(e,...t)=>console.info(`[Pixi\u2019VN Json] ${e}`,...t)))(de||={});var Xy="___param___",Yy=class Z{static init(e){e.loadAssets&&(Z._loadAssets=e.loadAssets),e.soundOperation&&(Z._soundOperation=e.soundOperation),e.imageOperation&&(Z._imageOperation=e.imageOperation),e.videoOperation&&(Z._videoOperation=e.videoOperation),e.imageContainerOperation&&(Z._imageContainerOperation=e.imageContainerOperation),e.textOperation&&(Z._textOperation=e.textOperation),e.canvasElementOperation&&(Z._canvasElementOperation=e.canvasElementOperation),e.setStorageValue&&(Z._setStorageValue=e.setStorageValue),e.setInitialStorageValue&&(Z._setInitialStorageValue=e.setInitialStorageValue),e.narrationOperation&&(Z._narrationOperation=e.narrationOperation),e.effectOperation&&(Z._effectOperation=e.effectOperation),e.animateOperation&&(Z._animateOperation=e.animateOperation),e.canvasOperation&&(Z._canvasOperation=e.canvasOperation),e.getLogichValue&&(Z._getLogichValue=e.getLogichValue),e.getConditionalStep&&(Z._getConditionalStep=e.getConditionalStep);}static _loadAssets=()=>{};static get loadAssets(){return Z._loadAssets}static _soundOperation=()=>{throw de.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get soundOperation(){return Z._soundOperation}static _imageOperation=()=>{throw de.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get imageOperation(){return Z._imageOperation}static _videoOperation=()=>{throw de.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get videoOperation(){return Z._videoOperation}static _imageContainerOperation=()=>{throw de.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get imageContainerOperation(){return Z._imageContainerOperation}static _textOperation=()=>{throw de.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get textOperation(){return Z._textOperation}static _canvasElementOperation=()=>{throw de.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get canvasElementOperation(){return Z._canvasElementOperation}static _setStorageValue=()=>{throw de.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get setStorageValue(){return Z._setStorageValue}static _setInitialStorageValue=()=>{throw de.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get setInitialStorageValue(){return Z._setInitialStorageValue}static _narrationOperation=()=>{throw de.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get narrationOperation(){return Z._narrationOperation}static _effectOperation=()=>{throw de.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get effectOperation(){return Z._effectOperation}static _animateOperation=()=>{throw de.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get animateOperation(){return Z._animateOperation}static _canvasOperation=()=>{throw de.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get canvasOperation(){return Z._canvasOperation}static _getLogichValue=()=>{throw de.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get getLogichValue(){return Z._getLogichValue}static _getConditionalStep=()=>{throw de.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get getConditionalStep(){return Z._getConditionalStep}};function Qy(i,e){if(e&&typeof e=="object"&&typeof i.functionName=="string"&&i.functionName in e){let t=e[i.functionName];if(typeof t=="function"){let n=i.args.map(r=>Yy.getLogichValue(r,e));return t(...n)}else de.warn(`getLogichValue function ${i.functionName} not found in props`);}}function fp(i,e={}){let t=gp(i,e);if(t&&typeof t=="object"&&"type"in t)switch(t.type){case "value":return ev(t,e);case "arithmetic":case "arithmeticsingle":return Zy(t,e);case "compare":case "union":return tv(t,e);case "function":return Qy(t,e)}return t}function Zy(i,e){let t=K.getLogichValue(i.leftValue,e);switch(i.type){case "arithmetic":{let n=K.getLogichValue(i.rightValue,e);switch(i.operator){case "*":return t*n;case "/":return t/n;case "+":return typeof t=="string"||typeof n=="string"?`${t}${n}`:Array.isArray(t)&&Array.isArray(n)?[...t,...n]:Array.isArray(t)?[...t,n]:Array.isArray(n)?[t,...n]:t+n;case "-":if(Array.isArray(t)&&Array.isArray(n))return t.filter(r=>!n.includes(r));if(Array.isArray(t))return t.filter(r=>r!==n);if(Array.isArray(n)){de.warn("getValueFromArithmeticOperations cannot subtract array from non-array");return}return t-n;case "%":return t%n;case "POW":return t**n;case "RANDOM":return narration.narration.getRandomNumber(t,n);case "INTERSECTION":if(Array.isArray(t)&&Array.isArray(n))return t.filter(r=>n.includes(r));de.warn("getValueFromArithmeticOperations cannot intersect non-array values");return;default:de.warn("getValueFromArithmeticOperations unknown operator",i);return}}case "arithmeticsingle":switch(i.operator){case "INT":return Number(t);case "FLOOR":return Math.floor(t)}break}}function ev(i,e){if(i&&typeof i=="object"&&"type"in i&&i.type==="value"&&i.storageOperationType==="get")switch(i.storageType){case "storage":case "tempstorage":return i.key==="_input_value_"?narration.narration.inputValue:storage.storage.get(i.key);case "flagStorage":return storage.storage.getFlag(i.key);case "label":return narration.narration.getTimesLabelOpened(i.label);case "choice":return narration.narration.getTimesChoiceMade(i.index);case "logic":return K.getLogichValue(i.operation,e);case "params":{let t=storage.storage.get(`${Xy}${narration.narration.openedLabels.length-1}`)||[];if(t&&t.length>i.key)return t[i.key];de.warn("getValue params not found");return}}return i}function tv(i,e){if(!i)return false;if(typeof i!="object"||!("type"in i))return !!i;switch(i.type){case "compare":{let t=K.getLogichValue(i.leftValue,e),n=K.getLogichValue(i.rightValue,e);switch(i.operator){case "==":return Array.isArray(t)&&Array.isArray(n)?t.length===n.length&&t.every(r=>n.includes(r)):t===n;case "!=":return Array.isArray(t)&&Array.isArray(n)?t.length!==n.length||!t.every(r=>n.includes(r)):t!==n;case "<":return typeof t=="string"&&typeof n=="string"?t.localeCompare(n)<0:Array.isArray(t)&&Array.isArray(n)?t.length<n.length:t<n;case "<=":return typeof t=="string"&&typeof n=="string"?t.localeCompare(n)<=0:Array.isArray(t)&&Array.isArray(n)?t.length<=n.length:t<=n;case ">":return typeof t=="string"&&typeof n=="string"?t.localeCompare(n)>0:Array.isArray(t)&&Array.isArray(n)?t.length>n.length:t>n;case ">=":return typeof t=="string"&&typeof n=="string"?t.localeCompare(n)>=0:Array.isArray(t)&&Array.isArray(n)?t.length>=n.length:t>=n;case "CONTAINS":return Array.isArray(t)&&Array.isArray(n)?n.every(r=>t.includes(r)):Array.isArray(t)?t.includes(n):t.toString().includes(n.toString())}break}case "value":{let t=K.getLogichValue(i,e);return Array.isArray(t)?t.length>0:t&&typeof t=="object"?Object.keys(t).length>0:!!t}case "union":return nv(i,e)}return !!i}function nv(i,e){if(i.unionType==="not"){let n=fp(i.condition,e);return Array.isArray(n)?n.length===0:n&&typeof n=="object"?Object.keys(n).length===0:!n}let t=n=>K.getLogichValue(n,e)||false;return i.unionType==="and"?i.conditions.every(t):i.conditions.some(t)}function iv(i,e){return Math.floor(Math.random()*(e-i+1)+i)}function gp(i,e={}){if(Array.isArray(i)||!i)return i;if(i&&typeof i=="object"&&"type"in i)switch(i.type){case "resulttocombine":return rv(i,e);case "ifelse":return K.getLogichValue(i.condition,e)?K.getLogichValue(i.then,e):K.getLogichValue(i.else,e);case "stepswitch":{let t=K.getLogichValue(i.elements,e)||[];if(t.length===0){de.error("getValueFromConditionalStatements elements.length === 0");return}switch(i.choiceType){case "random":{let n=iv(0,t.length-1);return K.getLogichValue(t[n],e)}case "loop":{let n=narration.NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return n>t.length-1?(n=n%t.length,K.getLogichValue(t[n],e)):K.getLogichValue(t[n],e)}case "sequential":{let n,r=narration.NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return i.end==="lastItem"&&(n=K.getLogichValue(t[t.length-1],e)),r>t.length-1?n:K.getLogichValue(t[r],e)}case "sequentialrandom":{let n=narration.NarrationManagerStatic.getRandomNumber(0,t.length-1,{nestedId:i.nestedId,onceOnly:true});if(n===void 0&&i.end==="lastItem"){let r=narration.NarrationManagerStatic.getCurrentStepTimesCounterData(i.nestedId);if(!r?.usedRandomNumbers){de.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let a=r.usedRandomNumbers[`0-${t.length-1}`];return K.getLogichValue(t[a[a.length-1]],e)}if(n===void 0){de.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return K.getLogichValue(t[n],e)}}}}return i}function Eu(i,e={}){if(i.conditionalStep){let t=pixiVn.createExportableElement(K.getLogichValue(i.conditionalStep,e));if(t?.glueEnabled===void 0&&delete t?.glueEnabled,t?.goNextStep===void 0&&delete t?.goNextStep,t?.end===void 0&&delete t?.end,t?.choices===void 0&&delete t?.choices,t?.dialogue===void 0&&delete t?.dialogue,t?.labelToOpen===void 0&&delete t?.labelToOpen,t?.operations===void 0&&delete t?.operations,t){let n={...i,conditionalStep:void 0,...t};return Eu(n,e)}else narration.narration.dialogGlue&&(narration.narration.dialogGlue=false);}return i}function rv(i,e){let t=i.firstItem,n=(i.secondConditionalItem??[]).flatMap(a=>Array.isArray(a)?a.map(s=>K.getLogichValue(s,e)):[K.getLogichValue(a,e)]),r=t?[t,...n]:n;if(r.length===0){de.warn("combinateResult toCheck.length === 0");return}if(typeof r[0]=="string")return Wi.t(r);if(typeof r[0]=="object"){let a=r,s,o=false,l=a.map((f,d)=>{f=Eu(f,e);let m=K.getLogichValue(f.dialogue,e)||"";return d===0?(s=K.getLogichValue(f.glueEnabled,e)||false,m):(typeof m=="object"&&"text"in m&&(m=`${m.character}: ${m.text}`),s===false&&o&&(m=`
94
94
 
95
- ${m}`),m&&(o=true),s=K.getLogichValue(f.glueEnabled,e)||false,m)}),u=K.getLogichValue(l[0],e),c=typeof u=="object"&&"character"in u?u.character:void 0,h=l.flatMap(f=>{let d;f&&typeof f=="object"&&"text"in f?d=f.text:d=f;let m;return Array.isArray(d)?m=d.map(v=>{let E=K.getLogichValue(v,e);return Wi.t(`${E}`)}):m=K.getLogichValue(d,e)||"",Wi.t(m)}),p=a.find(f=>f.end),g=a.find(f=>f.choices),C=false,y=false;a.length>0&&(a[0].glueEnabled&&a[0].goNextStep&&a[0].dialogue===void 0&&(narration.narration.dialogGlue=true),C=a[a.length-1].glueEnabled,y=a.reverse().find(f=>!(f.operations&&(!f.dialogue||!f.choices)))?.goNextStep);let A=a.find(f=>f.labelToOpen),b=[];return a.forEach(f=>{f.operations&&(b=[...b,...f.operations]);}),{dialogue:c?{character:c,text:h}:h,end:p?.end,choices:g?.choices,glueEnabled:C,goNextStep:y,labelToOpen:A?.labelToOpen,operations:b}}}var bu;(i=>{let e=new Set;function t(a){e.add(a);}i.add=t;function n(){e.clear();}i.clear=n;function r(a,s={}){let o=c=>fp(c,s)??void 0,l=gp(a,s);if(e.size===0)return o(l);let u=o;for(let c of e){let h=u;u=p=>c(p,h)??void 0;}return u(l)}i.getLogichValue=r;})(bu||={});var sv=Object.create,Cp=Object.defineProperty,av=Object.getOwnPropertyDescriptor,ov=Object.getOwnPropertyNames,lv=Object.getPrototypeOf,uv=Object.prototype.hasOwnProperty,mp=(i=>typeof zt<"u"?zt:typeof Proxy<"u"?new Proxy(i,{get:(e,t)=>(typeof zt<"u"?zt:e)[t]}):i)(function(i){if(typeof zt<"u")return zt.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')}),yp=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),cv=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of ov(e))!uv.call(i,r)&&r!==t&&Cp(i,r,{get:()=>e[r],enumerable:!(n=av(e,r))||n.enumerable});return i},hv=(i,e,t)=>(t=i!=null?sv(lv(i)):{},cv(Cp(t,"default",{value:i,enumerable:true}),i)),pv=yp((i,e)=>{(function(t,n){typeof i=="object"?e.exports=i=n():typeof define=="function"&&define.amd?define([],n):t.CryptoJS=n();})(i,function(){var t=t||(function(n,r){var a;if(typeof window<"u"&&window.crypto&&(a=window.crypto),typeof self<"u"&&self.crypto&&(a=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(a=globalThis.crypto),!a&&typeof window<"u"&&window.msCrypto&&(a=window.msCrypto),!a&&typeof global<"u"&&global.crypto&&(a=global.crypto),!a&&typeof mp=="function")try{a=mp("crypto");}catch{}var s=function(){if(a){if(typeof a.getRandomValues=="function")try{return a.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof a.randomBytes=="function")try{return a.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||(function(){function f(){}return function(d){var m;return f.prototype=d,m=new f,f.prototype=null,m}})(),l={},u=l.lib={},c=u.Base=(function(){return {extend:function(f){var d=o(this);return f&&d.mixIn(f),(!d.hasOwnProperty("init")||this.init===d.init)&&(d.init=function(){d.$super.init.apply(this,arguments);}),d.init.prototype=d,d.$super=this,d},create:function(){var f=this.extend();return f.init.apply(f,arguments),f},init:function(){},mixIn:function(f){for(var d in f)f.hasOwnProperty(d)&&(this[d]=f[d]);f.hasOwnProperty("toString")&&(this.toString=f.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),h=u.WordArray=c.extend({init:function(f,d){f=this.words=f||[],d!=r?this.sigBytes=d:this.sigBytes=f.length*4;},toString:function(f){return (f||g).stringify(this)},concat:function(f){var d=this.words,m=f.words,v=this.sigBytes,E=f.sigBytes;if(this.clamp(),v%4)for(var _=0;_<E;_++){var T=m[_>>>2]>>>24-_%4*8&255;d[v+_>>>2]|=T<<24-(v+_)%4*8;}else for(var x=0;x<E;x+=4)d[v+x>>>2]=m[x>>>2];return this.sigBytes+=E,this},clamp:function(){var f=this.words,d=this.sigBytes;f[d>>>2]&=4294967295<<32-d%4*8,f.length=n.ceil(d/4);},clone:function(){var f=c.clone.call(this);return f.words=this.words.slice(0),f},random:function(f){for(var d=[],m=0;m<f;m+=4)d.push(s());return new h.init(d,f)}}),p=l.enc={},g=p.Hex={stringify:function(f){for(var d=f.words,m=f.sigBytes,v=[],E=0;E<m;E++){var _=d[E>>>2]>>>24-E%4*8&255;v.push((_>>>4).toString(16)),v.push((_&15).toString(16));}return v.join("")},parse:function(f){for(var d=f.length,m=[],v=0;v<d;v+=2)m[v>>>3]|=parseInt(f.substr(v,2),16)<<24-v%8*4;return new h.init(m,d/2)}},C=p.Latin1={stringify:function(f){for(var d=f.words,m=f.sigBytes,v=[],E=0;E<m;E++){var _=d[E>>>2]>>>24-E%4*8&255;v.push(String.fromCharCode(_));}return v.join("")},parse:function(f){for(var d=f.length,m=[],v=0;v<d;v++)m[v>>>2]|=(f.charCodeAt(v)&255)<<24-v%4*8;return new h.init(m,d)}},y=p.Utf8={stringify:function(f){try{return decodeURIComponent(escape(C.stringify(f)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(f){return C.parse(unescape(encodeURIComponent(f)))}},A=u.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new h.init,this._nDataBytes=0;},_append:function(f){typeof f=="string"&&(f=y.parse(f)),this._data.concat(f),this._nDataBytes+=f.sigBytes;},_process:function(f){var d,m=this._data,v=m.words,E=m.sigBytes,_=this.blockSize,T=_*4,x=E/T;f?x=n.ceil(x):x=n.max((x|0)-this._minBufferSize,0);var S=x*_,I=n.min(S*4,E);if(S){for(var R=0;R<S;R+=_)this._doProcessBlock(v,R);d=v.splice(0,S),m.sigBytes-=I;}return new h.init(d,I)},clone:function(){var f=c.clone.call(this);return f._data=this._data.clone(),f},_minBufferSize:0});u.Hasher=A.extend({cfg:c.extend(),init:function(f){this.cfg=this.cfg.extend(f),this.reset();},reset:function(){A.reset.call(this),this._doReset();},update:function(f){return this._append(f),this._process(),this},finalize:function(f){f&&this._append(f);var d=this._doFinalize();return d},blockSize:16,_createHelper:function(f){return function(d,m){return new f.init(m).finalize(d)}},_createHmacHelper:function(f){return function(d,m){return new b.HMAC.init(f,m).finalize(d)}}});var b=l.algo={};return l})(Math);return t});}),dv=yp((i,e)=>{(function(t,n){typeof i=="object"?e.exports=i=n(pv()):typeof define=="function"&&define.amd?define(["./core"],n):n(t.CryptoJS);})(i,function(t){return (function(){var n=t,r=n.lib,a=r.WordArray,s=r.Hasher,o=n.algo,l=[],u=o.SHA1=s.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(c,h){for(var p=this._hash.words,g=p[0],C=p[1],y=p[2],A=p[3],b=p[4],f=0;f<80;f++){if(f<16)l[f]=c[h+f]|0;else {var d=l[f-3]^l[f-8]^l[f-14]^l[f-16];l[f]=d<<1|d>>>31;}var m=(g<<5|g>>>27)+b+l[f];f<20?m+=(C&y|~C&A)+1518500249:f<40?m+=(C^y^A)+1859775393:f<60?m+=(C&y|C&A|y&A)-1894007588:m+=(C^y^A)-899497514,b=A,A=y,y=C<<30|C>>>2,C=g,g=m;}p[0]=p[0]+g|0,p[1]=p[1]+C|0,p[2]=p[2]+y|0,p[3]=p[3]+A|0,p[4]=p[4]+b|0;},_doFinalize:function(){var c=this._data,h=c.words,p=this._nDataBytes*8,g=c.sigBytes*8;return h[g>>>5]|=128<<24-g%32,h[(g+64>>>9<<4)+14]=Math.floor(p/4294967296),h[(g+64>>>9<<4)+15]=p,c.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var c=s.clone.call(this);return c._hash=this._hash.clone(),c}});n.SHA1=s._createHelper(u),n.HmacSHA1=s._createHmacHelper(u);})(),t.SHA1});});var fv;(i=>(i.log=(e,...t)=>console.log(`[Pixi\u2019VN Json] ${e}`,...t),i.warn=(e,...t)=>console.warn(`[Pixi\u2019VN Json] ${e}`,...t),i.error=(e,...t)=>console.error(`[Pixi\u2019VN Json] ${e}`,...t),i.info=(e,...t)=>console.info(`[Pixi\u2019VN Json] ${e}`,...t)))(fv||={});hv(dv());var Mu=Cn(Zt()),gn=Cn(Ep());var bp=module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('vite.cjs', document.baseURI).href)));function Dv(i){let e=ee.normalize(i);return e.length>1&&e[e.length-1]===ee.sep&&(e=e.substring(0,e.length-1)),e}var wv=/[\\/]/g;function Dp(i,e){return i.replace(wv,e)}var _v=/^[a-z]:[\\/]$/i;function Ov(i){return i==="/"||_v.test(i)}function xu(i,e){let{resolvePaths:t,normalizePath:n,pathSeparator:r}=e,a=process.platform==="win32"&&i.includes("/")||i.startsWith(".");if(t&&(i=ee.resolve(i)),(n||a)&&(i=Dv(i)),i===".")return "";let s=i[i.length-1]!==r;return Dp(s?i+r:i,r)}function wp(i,e){return e+i}function Pv(i,e){return function(t,n){return n.startsWith(i)?n.slice(i.length)+t:Dp(ee.relative(i,n),e.pathSeparator)+e.pathSeparator+t}}function Tv(i){return i}function Fv(i,e,t){return e+i+t}function Nv(i,e){let{relativePaths:t,includeBasePath:n}=e;return t&&i?Pv(i,e):n?wp:Tv}function Iv(i){return function(e,t){t.push(e.substring(i.length)||".");}}function kv(i){return function(e,t,n){let r=e.substring(i.length)||".";n.every(a=>a(r,true))&&t.push(r);}}var Rv=(i,e)=>{e.push(i||".");},Vv=(i,e,t)=>{let n=i||".";t.every(r=>r(n,true))&&e.push(n);},Lv=()=>{};function Bv(i,e){let{includeDirs:t,filters:n,relativePaths:r}=e;return t?r?n&&n.length?kv(i):Iv(i):n&&n.length?Vv:Rv:Lv}var Wv=(i,e,t,n)=>{n.every(r=>r(i,false))&&t.files++;},jv=(i,e,t,n)=>{n.every(r=>r(i,false))&&e.push(i);},qv=(i,e,t,n)=>{t.files++;},Mv=(i,e)=>{e.push(i);},$v=()=>{};function Gv(i){let{excludeFiles:e,filters:t,onlyCounts:n}=i;return e?$v:t&&t.length?n?Wv:jv:n?qv:Mv}var Hv=i=>i,Jv=()=>[""].slice(0,0);function Uv(i){return i.group?Jv:Hv}var zv=(i,e,t)=>{i.push({directory:e,files:t,dir:e});},Kv=()=>{};function Xv(i){return i.group?zv:Kv}var Yv=function(i,e,t){let{queue:n,fs:r,options:{suppressErrors:a}}=e;n.enqueue(),r.realpath(i,(s,o)=>{if(s)return n.dequeue(a?null:s,e);r.stat(o,(l,u)=>{if(l)return n.dequeue(a?null:l,e);if(u.isDirectory()&&_p(i,o,e))return n.dequeue(null,e);t(u,o),n.dequeue(null,e);});});},Qv=function(i,e,t){let{queue:n,fs:r,options:{suppressErrors:a}}=e;n.enqueue();try{let s=r.realpathSync(i),o=r.statSync(s);if(o.isDirectory()&&_p(i,s,e))return;t(o,s);}catch(s){if(!a)throw s}};function Zv(i,e){return !i.resolveSymlinks||i.excludeSymlinks?null:e?Qv:Yv}function _p(i,e,t){if(t.options.useRealPaths)return e0(e,t);let n=ee.dirname(i),r=1;for(;n!==t.root&&r<2;){let a=t.symlinks.get(n);!!a&&(a===e||a.startsWith(e)||e.startsWith(a))?r++:n=ee.dirname(n);}return t.symlinks.set(i,e),r>1}function e0(i,e){return e.visited.includes(i+e.options.pathSeparator)}var t0=i=>i.counts,n0=i=>i.groups,i0=i=>i.paths,r0=i=>i.paths.slice(0,i.options.maxFiles),s0=(i,e,t)=>(Oa(e,t,i.counts,i.options.suppressErrors),null),a0=(i,e,t)=>(Oa(e,t,i.paths,i.options.suppressErrors),null),o0=(i,e,t)=>(Oa(e,t,i.paths.slice(0,i.options.maxFiles),i.options.suppressErrors),null),l0=(i,e,t)=>(Oa(e,t,i.groups,i.options.suppressErrors),null);function Oa(i,e,t,n){e(i&&!n?i:null,t);}function u0(i,e){let{onlyCounts:t,group:n,maxFiles:r}=i;return t?e?t0:s0:n?e?n0:l0:r?e?r0:o0:e?i0:a0}var Op={withFileTypes:true},c0=(i,e,t,n,r)=>{if(i.queue.enqueue(),n<0)return i.queue.dequeue(null,i);let{fs:a}=i;i.visited.push(e),i.counts.directories++,a.readdir(e||".",Op,(s,o=[])=>{r(o,t,n),i.queue.dequeue(i.options.suppressErrors?null:s,i);});},h0=(i,e,t,n,r)=>{let{fs:a}=i;if(n<0)return;i.visited.push(e),i.counts.directories++;let s=[];try{s=a.readdirSync(e||".",Op);}catch(o){if(!i.options.suppressErrors)throw o}r(s,t,n);};function p0(i){return i?h0:c0}var d0=class{count=0;constructor(i){this.onQueueEmpty=i;}enqueue(){return this.count++,this.count}dequeue(i,e){this.onQueueEmpty&&(--this.count<=0||i)&&(this.onQueueEmpty(i,e),i&&(e.controller.abort(),this.onQueueEmpty=void 0));}},f0=class{_files=0;_directories=0;set files(i){this._files=i;}get files(){return this._files}set directories(i){this._directories=i;}get directories(){return this._directories}get dirs(){return this._directories}},g0=class{aborted=false;abort(){this.aborted=true;}},Pp=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(i,e,t){this.isSynchronous=!t,this.callbackInvoker=u0(e,this.isSynchronous),this.root=xu(i,e),this.state={root:Ov(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new f0,options:e,queue:new d0((n,r)=>this.callbackInvoker(r,n,t)),symlinks:new Map,visited:[""].slice(0,0),controller:new g0,fs:e.fs||xv__namespace},this.joinPath=Nv(this.root,e),this.pushDirectory=Bv(this.root,e),this.pushFile=Gv(e),this.getArray=Uv(e),this.groupFiles=Xv(e),this.resolveSymlink=Zv(e,this.isSynchronous),this.walkDirectory=p0(this.isSynchronous);}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(i,e,t)=>{let{paths:n,options:{filters:r,resolveSymlinks:a,excludeSymlinks:s,exclude:o,maxFiles:l,signal:u,useRealPaths:c,pathSeparator:h},controller:p}=this.state;if(p.aborted||u&&u.aborted||l&&n.length>l)return;let g=this.getArray(this.state.paths);for(let C=0;C<i.length;++C){let y=i[C];if(y.isFile()||y.isSymbolicLink()&&!a&&!s){let A=this.joinPath(y.name,e);this.pushFile(A,g,this.state.counts,r);}else if(y.isDirectory()){let A=Fv(y.name,e,this.state.options.pathSeparator);if(o&&o(y.name,A))continue;this.pushDirectory(A,n,r),this.walkDirectory(this.state,A,A,t-1,this.walk);}else if(this.resolveSymlink&&y.isSymbolicLink()){let A=wp(y.name,e);this.resolveSymlink(A,this.state,(b,f)=>{if(b.isDirectory()){if(f=xu(f,this.state.options),o&&o(y.name,c?f:A+h))return;this.walkDirectory(this.state,f,c?f:A+h,t-1,this.walk);}else {f=c?f:A;let d=ee.basename(f),m=xu(ee.dirname(f),this.state.options);f=this.joinPath(d,m),this.pushFile(f,g,this.state.counts,r);}});}}this.groupFiles(this.state.groups,e,g);}};function m0(i,e){return new Promise((t,n)=>{Tp(i,e,(r,a)=>{if(r)return n(r);t(a);});})}function Tp(i,e,t){new Pp(i,e,t).start();}function C0(i,e){return new Pp(i,e).start()}var Ap=class{constructor(i,e){this.root=i,this.options=e;}withPromise(){return m0(this.root,this.options)}withCallback(i){Tp(this.root,this.options,i);}sync(){return C0(this.root,this.options)}},Fp=null;try{bp.resolve("picomatch"),Fp=bp("picomatch");}catch{}var Np=class{globCache={};options={maxDepth:1/0,suppressErrors:true,pathSeparator:ee.sep,filters:[]};globFunction;constructor(i){this.options={...this.options,...i},this.globFunction=this.options.globFunction;}group(){return this.options.group=true,this}withPathSeparator(i){return this.options.pathSeparator=i,this}withBasePath(){return this.options.includeBasePath=true,this}withRelativePaths(){return this.options.relativePaths=true,this}withDirs(){return this.options.includeDirs=true,this}withMaxDepth(i){return this.options.maxDepth=i,this}withMaxFiles(i){return this.options.maxFiles=i,this}withFullPaths(){return this.options.resolvePaths=true,this.options.includeBasePath=true,this}withErrors(){return this.options.suppressErrors=false,this}withSymlinks({resolvePaths:i=true}={}){return this.options.resolveSymlinks=true,this.options.useRealPaths=i,this.withFullPaths()}withAbortSignal(i){return this.options.signal=i,this}normalize(){return this.options.normalizePath=true,this}filter(i){return this.options.filters.push(i),this}onlyDirs(){return this.options.excludeFiles=true,this.options.includeDirs=true,this}exclude(i){return this.options.exclude=i,this}onlyCounts(){return this.options.onlyCounts=true,this}crawl(i){return new Ap(i||".",this.options)}withGlobFunction(i){return this.globFunction=i,this}crawlWithOptions(i,e){return this.options={...this.options,...e},new Ap(i||".",this.options)}glob(...i){return this.globFunction?this.globWithOptions(i):this.globWithOptions(i,{dot:true})}globWithOptions(i,...e){let t=this.globFunction||Fp;if(!t)throw new Error("Please specify a glob function to use glob matching.");var n=this.globCache[i.join("\0")];return n||(n=t(i,...e),this.globCache[i.join("\0")]=n),this.options.filters.push(r=>n(r)),this}};var Jn=Cn(nd()),lS=Array.isArray,ad=/\\/g,uS=/^[A-Za-z]:$/,od=process.platform==="win32",cS=/^(\/?\.\.)+$/;function hS(i,e={}){let t=i.length,n=Array(t),r=Array(t),a,s;for(a=0;a<t;a++){let o=ld(i[a]);n[a]=o;let l=o.length,u=Array(l);for(s=0;s<l;s++)u[s]=(0, Jn.default)(o[s],e);r[a]=u;}return o=>{let l=o.split("/");if(l[0]===".."&&cS.test(o))return true;for(a=0;a<t;a++){let u=n[a],c=r[a],h=l.length,p=Math.min(h,u.length);for(s=0;s<p;){let g=u[s];if(g.includes("/"))return true;if(!c[s](l[s]))break;if(!e.noglobstar&&g==="**")return true;s++;}if(s===h)return true}return false}}var pS=/^[A-Z]:\/$/i,dS=od?i=>pS.test(i):i=>i==="/";function id(i,e,t){if(i===e||e.startsWith(`${i}/`)){if(t){let r=i.length+ +!dS(i);return (a,s)=>a.slice(r,s?-1:void 0)||"."}let n=e.slice(i.length+1);return n?(r,a)=>{if(r===".")return n;let s=`${n}/${r}`;return a?s.slice(0,-1):s}:(r,a)=>a&&r!=="."?r.slice(0,-1):r}return t?n=>ee.posix.relative(i,n)||".":n=>ee.posix.relative(i,`${e}/${n}`)||"."}function fS(i,e){if(e.startsWith(`${i}/`)){let t=e.slice(i.length+1);return n=>`${t}/${n}`}return t=>{let n=ee.posix.relative(i,`${e}/${t}`);return t[t.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function rd(i){return i.replace(uS,e=>`${e}/`)}var gS={parts:true};function ld(i){var e;let t=Jn.default.scan(i,gS);return !((e=t.parts)===null||e===void 0)&&e.length?t.parts:[i]}var mS=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,CS=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,yS=i=>i.replace(mS,"\\$&"),vS=i=>i.replace(CS,"\\$&"),SS=od?vS:yS;function ES(i,e){let t=Jn.default.scan(i);return t.isGlob||t.negated}function Gi(...i){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...i);}function ud(i){return typeof i=="string"?[i]:i??[]}var bS=/^(\/?\.\.)+/,AS=/\\(?=[()[\]{}!*+?@|])/g;function Lu(i,e,t,n){var r;let a=e.cwd,s=i;i[i.length-1]==="/"&&(s=i.slice(0,-1)),s[s.length-1]!=="*"&&e.expandDirectories&&(s+="/**");let o=SS(a);s=ee.isAbsolute(s.replace(AS,""))?ee.posix.relative(o,s):ee.posix.normalize(s);let l=(r=bS.exec(s))===null||r===void 0?void 0:r[0],u=ld(s);if(l){let h=(l.length+1)/3,p=0,g=o.split("/");for(;p<h&&u[p+h]===g[g.length+p-h];)s=s.slice(0,(h-p-1)*3)+s.slice((h-p)*3+u[p+h].length+1)||".",p++;let C=ee.posix.join(a,l.slice(p*3));C[0]!=="."&&t.root.length>C.length&&(t.root=rd(C),t.depthOffset=-h+p);}if(!n&&t.depthOffset>=0){var c;(c=t.commonPath)!==null&&c!==void 0||(t.commonPath=u);let h=[],p=Math.min(t.commonPath.length,u.length);for(let g=0;g<p;g++){let C=u[g];if(C==="**"&&!u[g+1]){h.pop();break}if(g===u.length-1||C!==t.commonPath[g]||ES(C))break;h.push(C);}t.depthOffset=h.length,t.commonPath=h,t.root=rd(h.length>0?ee.posix.join(a,...h):a);}return s}function xS(i,e,t){let n=[],r=[];for(let a of i.ignore)a&&(a[0]!=="!"||a[1]==="(")&&r.push(Lu(a,i,t,true));for(let a of e)a&&(a[0]!=="!"||a[1]==="("?n.push(Lu(a,i,t,false)):(a[1]!=="!"||a[2]==="(")&&r.push(Lu(a.slice(1),i,t,true)));return {match:n,ignore:r}}function DS(i,e){let t=i.cwd,n={root:t,depthOffset:0},r=xS(i,e,n);i.debug&&Gi("internal processing patterns:",r);let{absolute:a,caseSensitiveMatch:s,debug:o,dot:l,followSymbolicLinks:u,onlyDirectories:c}=i,h=n.root.replace(ad,""),p={dot:l,nobrace:i.braceExpansion===false,nocase:!s,noextglob:i.extglob===false,noglobstar:i.globstar===false,posix:true},g=(0, Jn.default)(r.match,p),C=(0, Jn.default)(r.ignore,p),y=hS(r.match,p),A=id(t,h,a),b=a?A:id(t,h,true),f=(v,E)=>{let _=b(E,true);return _!=="."&&!y(_)||C(_)},d;i.deep!==void 0&&(d=Math.round(i.deep-n.depthOffset));let m=new Np({filters:[o?(v,E)=>{let _=A(v,E),T=g(_)&&!C(_);return T&&Gi(`matched ${_}`),T}:(v,E)=>{let _=A(v,E);return g(_)&&!C(_)}],exclude:o?(v,E)=>{let _=f(v,E);return Gi(`${_?"skipped":"crawling"} ${E}`),_}:f,fs:i.fs,pathSeparator:"/",relativePaths:!a,resolvePaths:a,includeBasePath:a,resolveSymlinks:u,excludeSymlinks:!u,excludeFiles:c,includeDirs:c||!i.onlyFiles,maxDepth:d,signal:i.signal}).crawl(h);return i.debug&&Gi("internal properties:",{...n,root:h}),[m,t!==h&&!a&&fS(t,h)]}function wS(i,e){if(e)for(let t=i.length-1;t>=0;t--)i[t]=e(i[t]);return i}var sd={caseSensitiveMatch:true,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:true,followSymbolicLinks:true,onlyFiles:true};function _S(i){let e=Object.assign({},i);for(let t in sd)e[t]===void 0&&Object.assign(e,{[t]:sd[t]});return e.cwd=(e.cwd instanceof URL?url.fileURLToPath(e.cwd):ee.resolve(e.cwd||process.cwd())).replace(ad,"/"),e.ignore=ud(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||xv.readdir,readdirSync:e.fs.readdirSync||xv.readdirSync,realpath:e.fs.realpath||xv.realpath,realpathSync:e.fs.realpathSync||xv.realpathSync,stat:e.fs.stat||xv.stat,statSync:e.fs.statSync||xv.statSync}),e.debug&&Gi("globbing with options:",e),e}function OS(i,e={}){var t;if(i&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=lS(i)||typeof i=="string",r=ud((t=n?i:i.patterns)!==null&&t!==void 0?t:"**/*"),a=_S(n?e:i);return r.length>0?DS(a,r):[]}async function Ta(i,e){let[t,n]=OS(i,e);return t?wS(await t.withPromise(),n):[]}var cd="1.1.5";var Nt=gn.default.cyan("(pixi-vn-ink)"),yd="virtual:pixi-vn-ink",Bu=`\0${yd}`,FS="manifest.json",vd=/\[(name|ext|extname|file|path|dir)\]/g,hd="ink";function pd(i){if(typeof i=="string")return {type:"literal",value:i};if(i instanceof RegExp)return {type:"regexp",source:i.source,flags:i.flags};try{return {type:"zod",schema:zod.toJSONSchema(i)}}catch{return {type:"literal",value:""}}}function Ut(i){return i.replaceAll("\\","/")}function Fa(i){let e=Ut(i.trim());if(!e)throw new Error("vitePluginInk option `inkGlob` must not be empty.");let t=e.replace(/^\.?\//,"");if(!t||t.startsWith("../"))throw new Error("vitePluginInk option `inkGlob` must be rooted in Vite `root` and cannot escape it.");return t}function dd(i,e){let t=Ut(e).split("/"),n=[];for(let r of t)if(!(r==="."||r==="")){if(/[*!?[\]{}()]/.test(r))break;n.push(r);}return ee__default.default.resolve(i,...n)}function fd(i,e){if(!e)return;let t=e.trim();if(!t)throw new Error("vitePluginInk option `inkJsonOutputPattern` must not be empty.");return ee__default.default.isAbsolute(t)?ee__default.default.normalize(t):ee__default.default.resolve(i,t)}function gd(i,e,t){if(!t)return ee__default.default.join(e,FS);let n=t.trim();if(!n)throw new Error("vitePluginInk option `inkJsonManifestPath` must not be empty.");return ee__default.default.isAbsolute(n)?ee__default.default.normalize(n):ee__default.default.resolve(i,n)}function md(i){let e=i.search(vd);if(e===-1)return ee__default.default.dirname(i);let t=i.slice(0,e).replace(/[\\/]+$/g,"");if(!t)throw new Error("vitePluginInk option `inkJsonOutputPattern` must start with a static directory before placeholders.");return ee__default.default.normalize(t)}function Un(i,e){let t=ee__default.default.relative(i,e);return !t.startsWith("..")&&!ee__default.default.isAbsolute(t)}function NS(i,e,t,n){let r=Ut(ee__default.default.relative(t,n)),a=ee__default.default.posix.parse(r),s=Ut(ee__default.default.relative(e,n)),o=ee__default.default.posix.dirname(s),l=ee__default.default.posix.dirname(r),u={name:a.name,ext:a.ext.startsWith(".")?a.ext.slice(1):a.ext,extname:a.ext,file:r,path:l==="."?"":`${l}/`,dir:o==="."?"":`${o}/`},c=Ut(i).replace(vd,(h,p)=>u[p]??"");return ee__default.default.normalize(c)}function IS(i,e,t){return Un(t,i)?`/${Ut(ee__default.default.relative(t,i))}`:Un(e,i)?Ut(ee__default.default.relative(e,i)):Ut(i)}function Wu(i,e,t){let n=ot.getUnknownHashtagCommands(i,e);n.forEach(({command:r,line:a})=>{t(`Unknown hashtag command "# ${r}": no registered handler matched this command.`,a);}),n.length>0&&t(`Hashtag command metadata is available via ${zn}.`);}function ju(i,e,t){ot.getHashtagKeySchemaIssues(i,e).forEach(({command:r,line:a,key:s,element:o,message:l})=>{t(`Hashtag command "# ${r}": "${s}" section ${o} - ${l}`,a);});}function qu(i,e,t){if(e.length===0)return;ot.getUnknownDivertTargets(i,e).forEach(({target:r,line:a})=>{t(`Divert target "${r}" not found in any known label source.`,a);});}async function kS(i,e,t){let n=e.get(i);return n||(n=(async()=>{try{let r=await fetch(i);if(!r.ok)throw new Error(`HTTP ${r.status} ${r.statusText}`);let a=await r.json();return ot.getSchemaValidator(a)}catch(r){t(`Could not load/compile JSON schema from "${i}" (${r instanceof Error?r.message:String(r)}). Skipping schema validation.`);return}})(),e.set(i,n)),n}function RS(i,e){let t=`# ${i}`;if(!e)return gn.default.gray(t);let n=new RegExp(`\\b${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`,"g"),r="",a=0;for(let s of t.matchAll(n)){let o=s.index??a;r+=gn.default.gray(t.slice(a,o)),r+=gn.default.yellow(s[0]),a=o+s[0].length;}return r+=gn.default.gray(t.slice(a)),r}async function VS(i,e,t,n){let r=i.$schema;if(!r)return;let a=await kS(r,t,n);if(!a)return;let s=ot.validateAgainstJsonSchema(i,a);for(let o of s){let l=o.origin?` \u2014 from ink source:
95
+ ${m}`),m&&(o=true),s=K.getLogichValue(f.glueEnabled,e)||false,m)}),u=K.getLogichValue(l[0],e),c=typeof u=="object"&&"character"in u?u.character:void 0,h=l.flatMap(f=>{let d;f&&typeof f=="object"&&"text"in f?d=f.text:d=f;let m;return Array.isArray(d)?m=d.map(v=>{let E=K.getLogichValue(v,e);return Wi.t(`${E}`)}):m=K.getLogichValue(d,e)||"",Wi.t(m)}),p=a.find(f=>f.end),g=a.find(f=>f.choices),C=false,y=false;a.length>0&&(a[0].glueEnabled&&a[0].goNextStep&&a[0].dialogue===void 0&&(narration.narration.dialogGlue=true),C=a[a.length-1].glueEnabled,y=a.reverse().find(f=>!(f.operations&&(!f.dialogue||!f.choices)))?.goNextStep);let A=a.find(f=>f.labelToOpen),b=[];return a.forEach(f=>{f.operations&&(b=[...b,...f.operations]);}),{dialogue:c?{character:c,text:h}:h,end:p?.end,choices:g?.choices,glueEnabled:C,goNextStep:y,labelToOpen:A?.labelToOpen,operations:b}}}var bu;(i=>{let e=new Set;function t(a){e.add(a);}i.add=t;function n(){e.clear();}i.clear=n;function r(a,s={}){let o=c=>fp(c,s)??void 0,l=gp(a,s);if(e.size===0)return o(l);let u=o;for(let c of e){let h=u;u=p=>c(p,h)??void 0;}return u(l)}i.getLogichValue=r;})(bu||={});var sv=Object.create,Cp=Object.defineProperty,av=Object.getOwnPropertyDescriptor,ov=Object.getOwnPropertyNames,lv=Object.getPrototypeOf,uv=Object.prototype.hasOwnProperty,mp=(i=>typeof zt<"u"?zt:typeof Proxy<"u"?new Proxy(i,{get:(e,t)=>(typeof zt<"u"?zt:e)[t]}):i)(function(i){if(typeof zt<"u")return zt.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')}),yp=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),cv=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of ov(e))!uv.call(i,r)&&r!==t&&Cp(i,r,{get:()=>e[r],enumerable:!(n=av(e,r))||n.enumerable});return i},hv=(i,e,t)=>(t=i!=null?sv(lv(i)):{},cv(Cp(t,"default",{value:i,enumerable:true}),i)),pv=yp((i,e)=>{(function(t,n){typeof i=="object"?e.exports=i=n():typeof define=="function"&&define.amd?define([],n):t.CryptoJS=n();})(i,function(){var t=t||(function(n,r){var a;if(typeof window<"u"&&window.crypto&&(a=window.crypto),typeof self<"u"&&self.crypto&&(a=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(a=globalThis.crypto),!a&&typeof window<"u"&&window.msCrypto&&(a=window.msCrypto),!a&&typeof global<"u"&&global.crypto&&(a=global.crypto),!a&&typeof mp=="function")try{a=mp("crypto");}catch{}var s=function(){if(a){if(typeof a.getRandomValues=="function")try{return a.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof a.randomBytes=="function")try{return a.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||(function(){function f(){}return function(d){var m;return f.prototype=d,m=new f,f.prototype=null,m}})(),l={},u=l.lib={},c=u.Base=(function(){return {extend:function(f){var d=o(this);return f&&d.mixIn(f),(!d.hasOwnProperty("init")||this.init===d.init)&&(d.init=function(){d.$super.init.apply(this,arguments);}),d.init.prototype=d,d.$super=this,d},create:function(){var f=this.extend();return f.init.apply(f,arguments),f},init:function(){},mixIn:function(f){for(var d in f)f.hasOwnProperty(d)&&(this[d]=f[d]);f.hasOwnProperty("toString")&&(this.toString=f.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),h=u.WordArray=c.extend({init:function(f,d){f=this.words=f||[],d!=r?this.sigBytes=d:this.sigBytes=f.length*4;},toString:function(f){return (f||g).stringify(this)},concat:function(f){var d=this.words,m=f.words,v=this.sigBytes,E=f.sigBytes;if(this.clamp(),v%4)for(var _=0;_<E;_++){var T=m[_>>>2]>>>24-_%4*8&255;d[v+_>>>2]|=T<<24-(v+_)%4*8;}else for(var x=0;x<E;x+=4)d[v+x>>>2]=m[x>>>2];return this.sigBytes+=E,this},clamp:function(){var f=this.words,d=this.sigBytes;f[d>>>2]&=4294967295<<32-d%4*8,f.length=n.ceil(d/4);},clone:function(){var f=c.clone.call(this);return f.words=this.words.slice(0),f},random:function(f){for(var d=[],m=0;m<f;m+=4)d.push(s());return new h.init(d,f)}}),p=l.enc={},g=p.Hex={stringify:function(f){for(var d=f.words,m=f.sigBytes,v=[],E=0;E<m;E++){var _=d[E>>>2]>>>24-E%4*8&255;v.push((_>>>4).toString(16)),v.push((_&15).toString(16));}return v.join("")},parse:function(f){for(var d=f.length,m=[],v=0;v<d;v+=2)m[v>>>3]|=parseInt(f.substr(v,2),16)<<24-v%8*4;return new h.init(m,d/2)}},C=p.Latin1={stringify:function(f){for(var d=f.words,m=f.sigBytes,v=[],E=0;E<m;E++){var _=d[E>>>2]>>>24-E%4*8&255;v.push(String.fromCharCode(_));}return v.join("")},parse:function(f){for(var d=f.length,m=[],v=0;v<d;v++)m[v>>>2]|=(f.charCodeAt(v)&255)<<24-v%4*8;return new h.init(m,d)}},y=p.Utf8={stringify:function(f){try{return decodeURIComponent(escape(C.stringify(f)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(f){return C.parse(unescape(encodeURIComponent(f)))}},A=u.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new h.init,this._nDataBytes=0;},_append:function(f){typeof f=="string"&&(f=y.parse(f)),this._data.concat(f),this._nDataBytes+=f.sigBytes;},_process:function(f){var d,m=this._data,v=m.words,E=m.sigBytes,_=this.blockSize,T=_*4,x=E/T;f?x=n.ceil(x):x=n.max((x|0)-this._minBufferSize,0);var S=x*_,I=n.min(S*4,E);if(S){for(var R=0;R<S;R+=_)this._doProcessBlock(v,R);d=v.splice(0,S),m.sigBytes-=I;}return new h.init(d,I)},clone:function(){var f=c.clone.call(this);return f._data=this._data.clone(),f},_minBufferSize:0});u.Hasher=A.extend({cfg:c.extend(),init:function(f){this.cfg=this.cfg.extend(f),this.reset();},reset:function(){A.reset.call(this),this._doReset();},update:function(f){return this._append(f),this._process(),this},finalize:function(f){f&&this._append(f);var d=this._doFinalize();return d},blockSize:16,_createHelper:function(f){return function(d,m){return new f.init(m).finalize(d)}},_createHmacHelper:function(f){return function(d,m){return new b.HMAC.init(f,m).finalize(d)}}});var b=l.algo={};return l})(Math);return t});}),dv=yp((i,e)=>{(function(t,n){typeof i=="object"?e.exports=i=n(pv()):typeof define=="function"&&define.amd?define(["./core"],n):n(t.CryptoJS);})(i,function(t){return (function(){var n=t,r=n.lib,a=r.WordArray,s=r.Hasher,o=n.algo,l=[],u=o.SHA1=s.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(c,h){for(var p=this._hash.words,g=p[0],C=p[1],y=p[2],A=p[3],b=p[4],f=0;f<80;f++){if(f<16)l[f]=c[h+f]|0;else {var d=l[f-3]^l[f-8]^l[f-14]^l[f-16];l[f]=d<<1|d>>>31;}var m=(g<<5|g>>>27)+b+l[f];f<20?m+=(C&y|~C&A)+1518500249:f<40?m+=(C^y^A)+1859775393:f<60?m+=(C&y|C&A|y&A)-1894007588:m+=(C^y^A)-899497514,b=A,A=y,y=C<<30|C>>>2,C=g,g=m;}p[0]=p[0]+g|0,p[1]=p[1]+C|0,p[2]=p[2]+y|0,p[3]=p[3]+A|0,p[4]=p[4]+b|0;},_doFinalize:function(){var c=this._data,h=c.words,p=this._nDataBytes*8,g=c.sigBytes*8;return h[g>>>5]|=128<<24-g%32,h[(g+64>>>9<<4)+14]=Math.floor(p/4294967296),h[(g+64>>>9<<4)+15]=p,c.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var c=s.clone.call(this);return c._hash=this._hash.clone(),c}});n.SHA1=s._createHelper(u),n.HmacSHA1=s._createHmacHelper(u);})(),t.SHA1});});var fv;(i=>(i.log=(e,...t)=>console.log(`[Pixi\u2019VN Json] ${e}`,...t),i.warn=(e,...t)=>console.warn(`[Pixi\u2019VN Json] ${e}`,...t),i.error=(e,...t)=>console.error(`[Pixi\u2019VN Json] ${e}`,...t),i.info=(e,...t)=>console.info(`[Pixi\u2019VN Json] ${e}`,...t)))(fv||={});hv(dv());var Mu=Cn(Zt()),gn=Cn(Ep());var bp=module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('vite.cjs', document.baseURI).href)));function Dv(i){let e=ee.normalize(i);return e.length>1&&e[e.length-1]===ee.sep&&(e=e.substring(0,e.length-1)),e}var wv=/[\\/]/g;function Dp(i,e){return i.replace(wv,e)}var _v=/^[a-z]:[\\/]$/i;function Ov(i){return i==="/"||_v.test(i)}function xu(i,e){let{resolvePaths:t,normalizePath:n,pathSeparator:r}=e,a=process.platform==="win32"&&i.includes("/")||i.startsWith(".");if(t&&(i=ee.resolve(i)),(n||a)&&(i=Dv(i)),i===".")return "";let s=i[i.length-1]!==r;return Dp(s?i+r:i,r)}function wp(i,e){return e+i}function Pv(i,e){return function(t,n){return n.startsWith(i)?n.slice(i.length)+t:Dp(ee.relative(i,n),e.pathSeparator)+e.pathSeparator+t}}function Tv(i){return i}function Fv(i,e,t){return e+i+t}function Nv(i,e){let{relativePaths:t,includeBasePath:n}=e;return t&&i?Pv(i,e):n?wp:Tv}function Iv(i){return function(e,t){t.push(e.substring(i.length)||".");}}function kv(i){return function(e,t,n){let r=e.substring(i.length)||".";n.every(a=>a(r,true))&&t.push(r);}}var Rv=(i,e)=>{e.push(i||".");},Vv=(i,e,t)=>{let n=i||".";t.every(r=>r(n,true))&&e.push(n);},Lv=()=>{};function Bv(i,e){let{includeDirs:t,filters:n,relativePaths:r}=e;return t?r?n&&n.length?kv(i):Iv(i):n&&n.length?Vv:Rv:Lv}var Wv=(i,e,t,n)=>{n.every(r=>r(i,false))&&t.files++;},jv=(i,e,t,n)=>{n.every(r=>r(i,false))&&e.push(i);},qv=(i,e,t,n)=>{t.files++;},Mv=(i,e)=>{e.push(i);},$v=()=>{};function Gv(i){let{excludeFiles:e,filters:t,onlyCounts:n}=i;return e?$v:t&&t.length?n?Wv:jv:n?qv:Mv}var Hv=i=>i,Jv=()=>[""].slice(0,0);function Uv(i){return i.group?Jv:Hv}var zv=(i,e,t)=>{i.push({directory:e,files:t,dir:e});},Kv=()=>{};function Xv(i){return i.group?zv:Kv}var Yv=function(i,e,t){let{queue:n,fs:r,options:{suppressErrors:a}}=e;n.enqueue(),r.realpath(i,(s,o)=>{if(s)return n.dequeue(a?null:s,e);r.stat(o,(l,u)=>{if(l)return n.dequeue(a?null:l,e);if(u.isDirectory()&&_p(i,o,e))return n.dequeue(null,e);t(u,o),n.dequeue(null,e);});});},Qv=function(i,e,t){let{queue:n,fs:r,options:{suppressErrors:a}}=e;n.enqueue();try{let s=r.realpathSync(i),o=r.statSync(s);if(o.isDirectory()&&_p(i,s,e))return;t(o,s);}catch(s){if(!a)throw s}};function Zv(i,e){return !i.resolveSymlinks||i.excludeSymlinks?null:e?Qv:Yv}function _p(i,e,t){if(t.options.useRealPaths)return e0(e,t);let n=ee.dirname(i),r=1;for(;n!==t.root&&r<2;){let a=t.symlinks.get(n);!!a&&(a===e||a.startsWith(e)||e.startsWith(a))?r++:n=ee.dirname(n);}return t.symlinks.set(i,e),r>1}function e0(i,e){return e.visited.includes(i+e.options.pathSeparator)}var t0=i=>i.counts,n0=i=>i.groups,i0=i=>i.paths,r0=i=>i.paths.slice(0,i.options.maxFiles),s0=(i,e,t)=>(Oa(e,t,i.counts,i.options.suppressErrors),null),a0=(i,e,t)=>(Oa(e,t,i.paths,i.options.suppressErrors),null),o0=(i,e,t)=>(Oa(e,t,i.paths.slice(0,i.options.maxFiles),i.options.suppressErrors),null),l0=(i,e,t)=>(Oa(e,t,i.groups,i.options.suppressErrors),null);function Oa(i,e,t,n){e(i&&!n?i:null,t);}function u0(i,e){let{onlyCounts:t,group:n,maxFiles:r}=i;return t?e?t0:s0:n?e?n0:l0:r?e?r0:o0:e?i0:a0}var Op={withFileTypes:true},c0=(i,e,t,n,r)=>{if(i.queue.enqueue(),n<0)return i.queue.dequeue(null,i);let{fs:a}=i;i.visited.push(e),i.counts.directories++,a.readdir(e||".",Op,(s,o=[])=>{r(o,t,n),i.queue.dequeue(i.options.suppressErrors?null:s,i);});},h0=(i,e,t,n,r)=>{let{fs:a}=i;if(n<0)return;i.visited.push(e),i.counts.directories++;let s=[];try{s=a.readdirSync(e||".",Op);}catch(o){if(!i.options.suppressErrors)throw o}r(s,t,n);};function p0(i){return i?h0:c0}var d0=class{count=0;constructor(i){this.onQueueEmpty=i;}enqueue(){return this.count++,this.count}dequeue(i,e){this.onQueueEmpty&&(--this.count<=0||i)&&(this.onQueueEmpty(i,e),i&&(e.controller.abort(),this.onQueueEmpty=void 0));}},f0=class{_files=0;_directories=0;set files(i){this._files=i;}get files(){return this._files}set directories(i){this._directories=i;}get directories(){return this._directories}get dirs(){return this._directories}},g0=class{aborted=false;abort(){this.aborted=true;}},Pp=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(i,e,t){this.isSynchronous=!t,this.callbackInvoker=u0(e,this.isSynchronous),this.root=xu(i,e),this.state={root:Ov(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new f0,options:e,queue:new d0((n,r)=>this.callbackInvoker(r,n,t)),symlinks:new Map,visited:[""].slice(0,0),controller:new g0,fs:e.fs||xv__namespace},this.joinPath=Nv(this.root,e),this.pushDirectory=Bv(this.root,e),this.pushFile=Gv(e),this.getArray=Uv(e),this.groupFiles=Xv(e),this.resolveSymlink=Zv(e,this.isSynchronous),this.walkDirectory=p0(this.isSynchronous);}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(i,e,t)=>{let{paths:n,options:{filters:r,resolveSymlinks:a,excludeSymlinks:s,exclude:o,maxFiles:l,signal:u,useRealPaths:c,pathSeparator:h},controller:p}=this.state;if(p.aborted||u&&u.aborted||l&&n.length>l)return;let g=this.getArray(this.state.paths);for(let C=0;C<i.length;++C){let y=i[C];if(y.isFile()||y.isSymbolicLink()&&!a&&!s){let A=this.joinPath(y.name,e);this.pushFile(A,g,this.state.counts,r);}else if(y.isDirectory()){let A=Fv(y.name,e,this.state.options.pathSeparator);if(o&&o(y.name,A))continue;this.pushDirectory(A,n,r),this.walkDirectory(this.state,A,A,t-1,this.walk);}else if(this.resolveSymlink&&y.isSymbolicLink()){let A=wp(y.name,e);this.resolveSymlink(A,this.state,(b,f)=>{if(b.isDirectory()){if(f=xu(f,this.state.options),o&&o(y.name,c?f:A+h))return;this.walkDirectory(this.state,f,c?f:A+h,t-1,this.walk);}else {f=c?f:A;let d=ee.basename(f),m=xu(ee.dirname(f),this.state.options);f=this.joinPath(d,m),this.pushFile(f,g,this.state.counts,r);}});}}this.groupFiles(this.state.groups,e,g);}};function m0(i,e){return new Promise((t,n)=>{Tp(i,e,(r,a)=>{if(r)return n(r);t(a);});})}function Tp(i,e,t){new Pp(i,e,t).start();}function C0(i,e){return new Pp(i,e).start()}var Ap=class{constructor(i,e){this.root=i,this.options=e;}withPromise(){return m0(this.root,this.options)}withCallback(i){Tp(this.root,this.options,i);}sync(){return C0(this.root,this.options)}},Fp=null;try{bp.resolve("picomatch"),Fp=bp("picomatch");}catch{}var Np=class{globCache={};options={maxDepth:1/0,suppressErrors:true,pathSeparator:ee.sep,filters:[]};globFunction;constructor(i){this.options={...this.options,...i},this.globFunction=this.options.globFunction;}group(){return this.options.group=true,this}withPathSeparator(i){return this.options.pathSeparator=i,this}withBasePath(){return this.options.includeBasePath=true,this}withRelativePaths(){return this.options.relativePaths=true,this}withDirs(){return this.options.includeDirs=true,this}withMaxDepth(i){return this.options.maxDepth=i,this}withMaxFiles(i){return this.options.maxFiles=i,this}withFullPaths(){return this.options.resolvePaths=true,this.options.includeBasePath=true,this}withErrors(){return this.options.suppressErrors=false,this}withSymlinks({resolvePaths:i=true}={}){return this.options.resolveSymlinks=true,this.options.useRealPaths=i,this.withFullPaths()}withAbortSignal(i){return this.options.signal=i,this}normalize(){return this.options.normalizePath=true,this}filter(i){return this.options.filters.push(i),this}onlyDirs(){return this.options.excludeFiles=true,this.options.includeDirs=true,this}exclude(i){return this.options.exclude=i,this}onlyCounts(){return this.options.onlyCounts=true,this}crawl(i){return new Ap(i||".",this.options)}withGlobFunction(i){return this.globFunction=i,this}crawlWithOptions(i,e){return this.options={...this.options,...e},new Ap(i||".",this.options)}glob(...i){return this.globFunction?this.globWithOptions(i):this.globWithOptions(i,{dot:true})}globWithOptions(i,...e){let t=this.globFunction||Fp;if(!t)throw new Error("Please specify a glob function to use glob matching.");var n=this.globCache[i.join("\0")];return n||(n=t(i,...e),this.globCache[i.join("\0")]=n),this.options.filters.push(r=>n(r)),this}};var Jn=Cn(nd()),lS=Array.isArray,ad=/\\/g,uS=/^[A-Za-z]:$/,od=process.platform==="win32",cS=/^(\/?\.\.)+$/;function hS(i,e={}){let t=i.length,n=Array(t),r=Array(t),a,s;for(a=0;a<t;a++){let o=ld(i[a]);n[a]=o;let l=o.length,u=Array(l);for(s=0;s<l;s++)u[s]=(0, Jn.default)(o[s],e);r[a]=u;}return o=>{let l=o.split("/");if(l[0]===".."&&cS.test(o))return true;for(a=0;a<t;a++){let u=n[a],c=r[a],h=l.length,p=Math.min(h,u.length);for(s=0;s<p;){let g=u[s];if(g.includes("/"))return true;if(!c[s](l[s]))break;if(!e.noglobstar&&g==="**")return true;s++;}if(s===h)return true}return false}}var pS=/^[A-Z]:\/$/i,dS=od?i=>pS.test(i):i=>i==="/";function id(i,e,t){if(i===e||e.startsWith(`${i}/`)){if(t){let r=i.length+ +!dS(i);return (a,s)=>a.slice(r,s?-1:void 0)||"."}let n=e.slice(i.length+1);return n?(r,a)=>{if(r===".")return n;let s=`${n}/${r}`;return a?s.slice(0,-1):s}:(r,a)=>a&&r!=="."?r.slice(0,-1):r}return t?n=>ee.posix.relative(i,n)||".":n=>ee.posix.relative(i,`${e}/${n}`)||"."}function fS(i,e){if(e.startsWith(`${i}/`)){let t=e.slice(i.length+1);return n=>`${t}/${n}`}return t=>{let n=ee.posix.relative(i,`${e}/${t}`);return t[t.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function rd(i){return i.replace(uS,e=>`${e}/`)}var gS={parts:true};function ld(i){var e;let t=Jn.default.scan(i,gS);return !((e=t.parts)===null||e===void 0)&&e.length?t.parts:[i]}var mS=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,CS=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,yS=i=>i.replace(mS,"\\$&"),vS=i=>i.replace(CS,"\\$&"),SS=od?vS:yS;function ES(i,e){let t=Jn.default.scan(i);return t.isGlob||t.negated}function Gi(...i){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...i);}function ud(i){return typeof i=="string"?[i]:i??[]}var bS=/^(\/?\.\.)+/,AS=/\\(?=[()[\]{}!*+?@|])/g;function Lu(i,e,t,n){var r;let a=e.cwd,s=i;i[i.length-1]==="/"&&(s=i.slice(0,-1)),s[s.length-1]!=="*"&&e.expandDirectories&&(s+="/**");let o=SS(a);s=ee.isAbsolute(s.replace(AS,""))?ee.posix.relative(o,s):ee.posix.normalize(s);let l=(r=bS.exec(s))===null||r===void 0?void 0:r[0],u=ld(s);if(l){let h=(l.length+1)/3,p=0,g=o.split("/");for(;p<h&&u[p+h]===g[g.length+p-h];)s=s.slice(0,(h-p-1)*3)+s.slice((h-p)*3+u[p+h].length+1)||".",p++;let C=ee.posix.join(a,l.slice(p*3));C[0]!=="."&&t.root.length>C.length&&(t.root=rd(C),t.depthOffset=-h+p);}if(!n&&t.depthOffset>=0){var c;(c=t.commonPath)!==null&&c!==void 0||(t.commonPath=u);let h=[],p=Math.min(t.commonPath.length,u.length);for(let g=0;g<p;g++){let C=u[g];if(C==="**"&&!u[g+1]){h.pop();break}if(g===u.length-1||C!==t.commonPath[g]||ES(C))break;h.push(C);}t.depthOffset=h.length,t.commonPath=h,t.root=rd(h.length>0?ee.posix.join(a,...h):a);}return s}function xS(i,e,t){let n=[],r=[];for(let a of i.ignore)a&&(a[0]!=="!"||a[1]==="(")&&r.push(Lu(a,i,t,true));for(let a of e)a&&(a[0]!=="!"||a[1]==="("?n.push(Lu(a,i,t,false)):(a[1]!=="!"||a[2]==="(")&&r.push(Lu(a.slice(1),i,t,true)));return {match:n,ignore:r}}function DS(i,e){let t=i.cwd,n={root:t,depthOffset:0},r=xS(i,e,n);i.debug&&Gi("internal processing patterns:",r);let{absolute:a,caseSensitiveMatch:s,debug:o,dot:l,followSymbolicLinks:u,onlyDirectories:c}=i,h=n.root.replace(ad,""),p={dot:l,nobrace:i.braceExpansion===false,nocase:!s,noextglob:i.extglob===false,noglobstar:i.globstar===false,posix:true},g=(0, Jn.default)(r.match,p),C=(0, Jn.default)(r.ignore,p),y=hS(r.match,p),A=id(t,h,a),b=a?A:id(t,h,true),f=(v,E)=>{let _=b(E,true);return _!=="."&&!y(_)||C(_)},d;i.deep!==void 0&&(d=Math.round(i.deep-n.depthOffset));let m=new Np({filters:[o?(v,E)=>{let _=A(v,E),T=g(_)&&!C(_);return T&&Gi(`matched ${_}`),T}:(v,E)=>{let _=A(v,E);return g(_)&&!C(_)}],exclude:o?(v,E)=>{let _=f(v,E);return Gi(`${_?"skipped":"crawling"} ${E}`),_}:f,fs:i.fs,pathSeparator:"/",relativePaths:!a,resolvePaths:a,includeBasePath:a,resolveSymlinks:u,excludeSymlinks:!u,excludeFiles:c,includeDirs:c||!i.onlyFiles,maxDepth:d,signal:i.signal}).crawl(h);return i.debug&&Gi("internal properties:",{...n,root:h}),[m,t!==h&&!a&&fS(t,h)]}function wS(i,e){if(e)for(let t=i.length-1;t>=0;t--)i[t]=e(i[t]);return i}var sd={caseSensitiveMatch:true,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:true,followSymbolicLinks:true,onlyFiles:true};function _S(i){let e=Object.assign({},i);for(let t in sd)e[t]===void 0&&Object.assign(e,{[t]:sd[t]});return e.cwd=(e.cwd instanceof URL?url.fileURLToPath(e.cwd):ee.resolve(e.cwd||process.cwd())).replace(ad,"/"),e.ignore=ud(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||xv.readdir,readdirSync:e.fs.readdirSync||xv.readdirSync,realpath:e.fs.realpath||xv.realpath,realpathSync:e.fs.realpathSync||xv.realpathSync,stat:e.fs.stat||xv.stat,statSync:e.fs.statSync||xv.statSync}),e.debug&&Gi("globbing with options:",e),e}function OS(i,e={}){var t;if(i&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=lS(i)||typeof i=="string",r=ud((t=n?i:i.patterns)!==null&&t!==void 0?t:"**/*"),a=_S(n?e:i);return r.length>0?DS(a,r):[]}async function Ta(i,e){let[t,n]=OS(i,e);return t?wS(await t.withPromise(),n):[]}var cd="1.1.6";var Nt=gn.default.cyan("(pixi-vn-ink)"),yd="virtual:pixi-vn-ink",Bu=`\0${yd}`,FS="manifest.json",vd=/\[(name|ext|extname|file|path|dir)\]/g,hd="ink";function pd(i){if(typeof i=="string")return {type:"literal",value:i};if(i instanceof RegExp)return {type:"regexp",source:i.source,flags:i.flags};try{return {type:"zod",schema:zod.toJSONSchema(i)}}catch{return {type:"literal",value:""}}}function Ut(i){return i.replaceAll("\\","/")}function Fa(i){let e=Ut(i.trim());if(!e)throw new Error("vitePluginInk option `inkGlob` must not be empty.");let t=e.replace(/^\.?\//,"");if(!t||t.startsWith("../"))throw new Error("vitePluginInk option `inkGlob` must be rooted in Vite `root` and cannot escape it.");return t}function dd(i,e){let t=Ut(e).split("/"),n=[];for(let r of t)if(!(r==="."||r==="")){if(/[*!?[\]{}()]/.test(r))break;n.push(r);}return ee__default.default.resolve(i,...n)}function fd(i,e){if(!e)return;let t=e.trim();if(!t)throw new Error("vitePluginInk option `inkJsonOutputPattern` must not be empty.");return ee__default.default.isAbsolute(t)?ee__default.default.normalize(t):ee__default.default.resolve(i,t)}function gd(i,e,t){if(!t)return ee__default.default.join(e,FS);let n=t.trim();if(!n)throw new Error("vitePluginInk option `inkJsonManifestPath` must not be empty.");return ee__default.default.isAbsolute(n)?ee__default.default.normalize(n):ee__default.default.resolve(i,n)}function md(i){let e=i.search(vd);if(e===-1)return ee__default.default.dirname(i);let t=i.slice(0,e).replace(/[\\/]+$/g,"");if(!t)throw new Error("vitePluginInk option `inkJsonOutputPattern` must start with a static directory before placeholders.");return ee__default.default.normalize(t)}function Un(i,e){let t=ee__default.default.relative(i,e);return !t.startsWith("..")&&!ee__default.default.isAbsolute(t)}function NS(i,e,t,n){let r=Ut(ee__default.default.relative(t,n)),a=ee__default.default.posix.parse(r),s=Ut(ee__default.default.relative(e,n)),o=ee__default.default.posix.dirname(s),l=ee__default.default.posix.dirname(r),u={name:a.name,ext:a.ext.startsWith(".")?a.ext.slice(1):a.ext,extname:a.ext,file:r,path:l==="."?"":`${l}/`,dir:o==="."?"":`${o}/`},c=Ut(i).replace(vd,(h,p)=>u[p]??"");return ee__default.default.normalize(c)}function IS(i,e,t){return Un(t,i)?`/${Ut(ee__default.default.relative(t,i))}`:Un(e,i)?Ut(ee__default.default.relative(e,i)):Ut(i)}function Wu(i,e,t){let n=ot.getUnknownHashtagCommands(i,e);n.forEach(({command:r,line:a})=>{t(`Unknown hashtag command "# ${r}": no registered handler matched this command.`,a);}),n.length>0&&t(`Hashtag command metadata is available via ${zn}.`);}function ju(i,e,t){ot.getHashtagKeySchemaIssues(i,e).forEach(({command:r,line:a,key:s,element:o,message:l})=>{t(`Hashtag command "# ${r}": "${s}" section ${o} - ${l}`,a);});}function qu(i,e,t){if(e.length===0)return;ot.getUnknownDivertTargets(i,e).forEach(({target:r,line:a})=>{t(`Divert target "${r}" not found in any known label source.`,a);});}async function kS(i,e,t){let n=e.get(i);return n||(n=(async()=>{try{let r=await fetch(i);if(!r.ok)throw new Error(`HTTP ${r.status} ${r.statusText}`);let a=await r.json();return ot.getSchemaValidator(a)}catch(r){t(`Could not load/compile JSON schema from "${i}" (${r instanceof Error?r.message:String(r)}). Skipping schema validation.`);return}})(),e.set(i,n)),n}function RS(i,e){let t=`# ${i}`;if(!e)return gn.default.gray(t);let n=new RegExp(`\\b${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`,"g"),r="",a=0;for(let s of t.matchAll(n)){let o=s.index??a;r+=gn.default.gray(t.slice(a,o)),r+=gn.default.yellow(s[0]),a=o+s[0].length;}return r+=gn.default.gray(t.slice(a)),r}async function VS(i,e,t,n){let r=i.$schema;if(!r)return;let a=await kS(r,t,n);if(!a)return;let s=ot.validateAgainstJsonSchema(i,a);for(let o of s){let l=o.origin?` \u2014 from ink source:
96
96
  ${RS(o.origin,o.element)}`:"";n(`${e}: ${o.element} - ${o.message}${l}`);}}function Cd(i){return new Promise((e,t)=>{let n="";i.on("data",r=>{n+=r.toString();}),i.on("end",()=>e(n)),i.on("error",t);})}function Sd(i){let{inkGlob:e,inkJsonOutputPattern:t,inkJsonManifestPath:n,characters:r}=i??{},a=!!t,s,o=[],l=[],u,c,h,p=[],g,C,y,A=new Map,b=async()=>{let x=_t.info(),S=dn.info();o=x.map(({name:I,description:R,validation:k,keySchemas:D})=>({name:I,description:R,validation:pd(k),keySchemas:D})),l=S.map(({name:I,description:R,validation:k,type:D})=>({name:I,description:R,validation:pd(k),type:D}));},f=x=>x?.find(S=>S.name==="vite-plugin-pixi-vn"),d=x=>{let S=x?.find(I=>I.name==="vite-plugin-nqtr");return [f(x)?.api?.contentLoaded,S?.api?.contentLoaded].filter(I=>!!I)},m=async x=>{let S=x?.api;if(!S)return;let I=p,R=JSON.stringify(I);if(R!==g)try{if(I.length===0&&S.clearExternalLabels)await S.clearExternalLabels(hd);else if(S.setExternalLabels)await S.setExternalLabels(hd,I);else return;g=R;}catch(k){let D=k instanceof Error?k:new Error(String(k));s?.logger.error(`${Nt} Failed to sync Ink labels with vite-plugin-pixi-vn.`,{error:D,timestamp:true});}},v=x=>{if(!a||!c)return false;let S=ee__default.default.resolve(x);return h&&S===h?true:Un(c,S)},E=()=>{y!==void 0&&clearTimeout(y),y=setTimeout(()=>{y=void 0,T().then(async()=>{await m(f(C?.config.plugins));let x=C?.moduleGraph.getModuleById(Bu);x&&C?.moduleGraph.invalidateModule(x),C?.ws.send({type:"custom",event:"ink-updated",data:{inkJson:a?u??[]:void 0}});}).catch(x=>{let S=x instanceof Error?x:new Error(String(x));s?.logger.error(`${Nt} Failed to re-export Ink JSON files after characters update.`,{error:S,timestamp:true});});},150);},_=async()=>{if(!s||!e)return [];let x=Fa(e),S=await Ta(x,{absolute:true,cwd:s.root,onlyFiles:true}),I=[];for(let R of S)try{let k=await At__default.default.readFile(R,"utf-8"),D=Bi(k,{characters:r??[]});D&&I.push(...Object.keys(D.labels??{}));}catch{}return Array.from(new Set(I)).sort((R,k)=>R.localeCompare(k))},T=async()=>{if(!s||!e){u=void 0,p=[];return}let x=fd(s.root,t);if(!x){u=void 0,p=[],c=void 0,h=void 0;return}let S=Fa(e),I=md(x);c=ee__default.default.resolve(I);let R=dd(s.root,S);if(!Un(s.root,R))throw new Error("vitePluginInk option `inkGlob` must be rooted in Vite `root` and cannot escape it.");let k=await Ta(S,{absolute:true,cwd:s.root,onlyFiles:true}),D=[],w=[],oe=new Set,L=f(s.plugins)?.api?.characters??[],H=[...r??[],...L];await At__default.default.mkdir(I,{recursive:true});let Be=new Map;for(let ie of k){let Xe=await At__default.default.readFile(ie,"utf-8");Be.set(ie,Xe);let F;try{F=Bi(Xe,{characters:H});}catch(N){let $=N instanceof Error?N:new Error(String(N));s.logger.error(`${Nt} Failed to convert "${ie}" to JSON.`,{error:$,timestamp:true});continue}let j=NS(x,s.root,R,ie);if(!Un(I,j)){s.logger.error(`${Nt} Output path "${j}" escapes managed directory "${I}".`,{timestamp:true});continue}if(oe.add(j),!F){await At__default.default.rm(j,{force:true});continue}w.push(F),await At__default.default.mkdir(ee__default.default.dirname(j),{recursive:true}),await At__default.default.writeFile(j,`${JSON.stringify(F,null,2)}
97
97
  `,"utf-8"),D.push(IS(j,s.root,s.publicDir)),await VS(F,ie,A,N=>s.logger.warn(`${Nt} ${N}`,{timestamp:true}));}let _e=gd(s.root,I,n);h=ee__default.default.resolve(_e);let lt=await Ta("**/*.json",{absolute:true,cwd:I,onlyFiles:true});for(let ie of lt)ee__default.default.resolve(ie)!==ee__default.default.resolve(_e)&&!oe.has(ie)&&await At__default.default.rm(ie,{force:true});D.sort((ie,Xe)=>ie.localeCompare(Xe)),u=w;let Hi=w.flatMap(ie=>Object.keys(ie.labels??{}));p=Array.from(new Set(Hi)).sort((ie,Xe)=>ie.localeCompare(Xe));let mn=Hi.length,ut=f(s.plugins)?.api?.labels??[],M=[...p,...ut];for(let[ie,Xe]of Be)Wu(Xe,o,(F,j)=>s.logger.warn(`${j!==void 0?`${ie}:${j}`:ie}: ${F}`,{timestamp:true})),ju(Xe,o,(F,j)=>s.logger.warn(`${j!==void 0?`${ie}:${j}`:ie}: ${F}`,{timestamp:true})),qu(Xe,M,(F,j)=>s.logger.warn(`${j!==void 0?`${ie}:${j}`:ie}: ${F}`,{timestamp:true}));s.logger.info(`${Nt} ${gn.default.dim(`${k.length} file(s) exported: ${mn} label(s), ${o.length} hashtag-command(s), ${l.length} text-replace(s)`)}`,{timestamp:true}),await At__default.default.mkdir(ee__default.default.dirname(_e),{recursive:true}),await At__default.default.writeFile(_e,`${JSON.stringify(D,null,2)}
98
98
  `,"utf-8");};return {name:"vite-plugin-ink",enforce:"pre",configResolved(x){s=x,c=void 0,h=void 0;let S=e?Fa(e):void 0;if(S){let I=dd(x.root,S);if(!Un(x.root,I))throw new Error("vitePluginInk option `inkGlob` must be rooted in Vite `root` and cannot escape it.")}if(t&&!e)throw new Error("vitePluginInk option `inkJsonOutputPattern` requires `inkGlob` to be set.");if(t){let I=fd(x.root,t);if(!I)return;let R=md(I);if(c=ee__default.default.resolve(R),h=ee__default.default.resolve(gd(x.root,R,n)),ee__default.default.resolve(R)===ee__default.default.resolve(x.root))throw new Error("vitePluginInk option `inkJsonOutputPattern` must target a directory different from Vite `root`.")}},async buildStart(){let x=f(s?.plugins);p=await _(),await m(x),await Promise.all(d(s?.plugins)),await b(),await T(),await m(x);},configureServer(x){C=x,x.middlewares.use(async(R,k,D)=>{let w=R.url,oe=R.method;if(w===zn){if(oe==="GET"){k.setHeader("Content-Type","application/json"),k.end(JSON.stringify(o));return}if(oe==="POST"){try{let L=await Cd(R);o=JSON.parse(L),k.statusCode=204,k.end();}catch(L){s?.logger.warn(`${Nt} Invalid JSON body for POST ${zn}: ${String(L)}`,{timestamp:true}),k.statusCode=400,k.end();}return}}if(w===Na&&oe==="GET"){k.setHeader("Content-Type","application/json");let L={version:cd,schemaUrl:Yi};k.end(JSON.stringify(L));return}if(w===Ji){if(oe==="GET"){k.setHeader("Content-Type","application/json"),k.end(JSON.stringify(l));return}if(oe==="POST"){try{let L=await Cd(R);l=JSON.parse(L),k.statusCode=204,k.end();}catch(L){s?.logger.warn(`${Nt} Invalid JSON body for POST ${Ji}: ${String(L)}`,{timestamp:true}),k.statusCode=400,k.end();}return}}D();});let S=f(x.config.plugins);Promise.all(d(x.config.plugins)).then(async()=>{await b(),await T(),await m(S);}).catch(R=>{let k=R instanceof Error?R:new Error(String(R));s?.logger.error(`${Nt} Failed to export Ink JSON files during server initialization or restart.`,{error:k,timestamp:true});});let I=S?.api?.onReload;I&&I(()=>{b().then(()=>E());});},resolveId(x){if(x===yd)return Bu},load(x){if(x===Bu){if(!e)return ["export const inkJsons = undefined;","export default [];"].join(`
package/dist/vite.d.cts CHANGED
@@ -1,122 +1,9 @@
1
- import { c as InkValidationInfo } from './types-CbD_iwdO.cjs';
1
+ export { INK_DEV_API_HASHTAG_COMMANDS, INK_DEV_API_INFO, INK_DEV_API_TEXT_REPLACES, InkLibraryInfo, InkTextReplaceInfo } from './dev-api.cjs';
2
2
  import { Plugin } from 'vite';
3
3
  export { InkHashtagCommandInfo } from '@drincs/pixi-vn-ink/parser';
4
+ import './types-CbD_iwdO.cjs';
4
5
  import 'inkjs/engine/Error';
5
6
 
6
- /**
7
- * Dev-server endpoint that exposes and accepts the list of registered
8
- * {@link HashtagCommands} handlers as {@link InkHashtagCommandInfo} objects.
9
- *
10
- * - `GET /__pixi-vn-ink/hashtag-commands` – returns the stored `InkHashtagCommandInfo[]` as JSON.
11
- * - `POST /__pixi-vn-ink/hashtag-commands` – replaces the stored list with the JSON body
12
- * (`InkHashtagCommandInfo[]`). Called automatically by {@link setupInkHmrListener} on
13
- * startup and after each HMR update.
14
- * - `InkHashtagCommandInfo.validation` serializes the original validation rule:
15
- * - `{ type: "regexp", source, flags }`
16
- * - `{ type: "zod", schema }` (JSON Schema generated from Zod)
17
- * - `{ type: "literal", value }`
18
- *
19
- * @example
20
- * ```ts
21
- * // VS Code extension reading the registered handlers
22
- * const res = await fetch("http://localhost:5173/__pixi-vn-ink/hashtag-commands");
23
- * const commands: InkHashtagCommandInfo[] = await res.json();
24
- * ```
25
- */
26
- declare const INK_DEV_API_HASHTAG_COMMANDS = "/__pixi-vn-ink/hashtag-commands";
27
- /**
28
- * Dev-server endpoint that exposes and accepts the list of registered
29
- * {@link TextReplaces} handlers as {@link InkTextReplaceInfo} objects.
30
- *
31
- * - `GET /__pixi-vn-ink/text-replaces` – returns the stored `InkTextReplaceInfo[]` as JSON.
32
- * - `POST /__pixi-vn-ink/text-replaces` – replaces the stored list with the JSON body
33
- * (`InkTextReplaceInfo[]`). Called automatically by {@link setupInkHmrListener} on
34
- * startup and after each HMR update.
35
- * - `InkTextReplaceInfo.validation` serializes the original validation rule:
36
- * - `{ type: "regexp", source, flags }`
37
- * - `{ type: "zod", schema }` (JSON Schema generated from Zod)
38
- * - `{ type: "literal", value }` for string modes like `"all"` / `"characterId"`
39
- *
40
- * @example
41
- * ```ts
42
- * // VS Code extension reading the registered text-replace handlers
43
- * const res = await fetch("http://localhost:5173/__pixi-vn-ink/text-replaces");
44
- * const replaces: InkTextReplaceInfo[] = await res.json();
45
- * ```
46
- */
47
- declare const INK_DEV_API_TEXT_REPLACES = "/__pixi-vn-ink/text-replaces";
48
- /**
49
- * Dev-server endpoint that exposes static information about this library instance, as an
50
- * {@link InkLibraryInfo} object.
51
- *
52
- * - `GET /__pixi-vn-ink/info` – returns `{ version, schemaUrl }`, where `version` is this
53
- * `@drincs/pixi-vn-ink` package's own version and `schemaUrl` is the `PIXIVNJSON_SCHEMA_URL`
54
- * (from `@drincs/pixi-vn-json/constants`) embedded as `$schema` in every exported `PixiVNJson`
55
- * document.
56
- * - Read-only: unlike {@link INK_DEV_API_HASHTAG_COMMANDS} / {@link INK_DEV_API_TEXT_REPLACES},
57
- * there is no `POST` — both values are static per plugin instance and don't depend on
58
- * SSR-loading the user's content, so there's nothing for {@link setupInkHmrListener} to push.
59
- *
60
- * @example
61
- * ```ts
62
- * // VS Code extension reading the library version / schema URL
63
- * const res = await fetch("http://localhost:5173/__pixi-vn-ink/info");
64
- * const { version, schemaUrl }: InkLibraryInfo = await res.json();
65
- * ```
66
- */
67
- declare const INK_DEV_API_INFO = "/__pixi-vn-ink/info";
68
-
69
- /**
70
- * Serializable representation of a registered {@link TextReplaces} handler,
71
- * as exposed by the pixi-vn-ink Vite dev-server API.
72
- *
73
- * Instances of this type are returned by
74
- * `GET /__pixi-vn-ink/text-replaces`
75
- * and accepted by
76
- * `POST /__pixi-vn-ink/text-replaces`.
77
- *
78
- * @see https://pixi-vn.com/ink#vite-plugin
79
- */
80
- interface InkTextReplaceInfo {
81
- /**
82
- * Unique name that identifies the handler.
83
- * Matches {@link ReplaceHandlerOptions.name}.
84
- */
85
- name: string;
86
- /**
87
- * Human-readable description of what the handler does.
88
- * Matches {@link ReplaceHandlerOptions.description}.
89
- */
90
- description?: string;
91
- /**
92
- * Serializable form of {@link ReplaceHandlerOptions.validation}.
93
- */
94
- validation: InkValidationInfo;
95
- /**
96
- * When the handler runs relative to the translation step.
97
- * Matches {@link ReplaceHandlerOptions.type}.
98
- * @default "before-translation"
99
- */
100
- type?: "before-translation" | "after-translation";
101
- }
102
- /**
103
- * Static information about a running `@drincs/pixi-vn-ink` instance, as returned by
104
- * `GET /__pixi-vn-ink/info`.
105
- *
106
- * @see https://pixi-vn.com/ink#vite-plugin
107
- */
108
- interface InkLibraryInfo {
109
- /**
110
- * This `@drincs/pixi-vn-ink` package's own version (from its `package.json`).
111
- */
112
- version: string;
113
- /**
114
- * The JSON Schema URL (`PIXIVNJSON_SCHEMA_URL` from `@drincs/pixi-vn-json/constants`)
115
- * embedded as `$schema` in every exported `PixiVNJson` document.
116
- */
117
- schemaUrl: string;
118
- }
119
-
120
7
  /**
121
8
  * Options for {@link vitePluginInk}.
122
9
  */
@@ -263,4 +150,4 @@ interface VitePluginInkOptions {
263
150
  */
264
151
  declare function vitePluginInk(options?: VitePluginInkOptions): Plugin;
265
152
 
266
- export { INK_DEV_API_HASHTAG_COMMANDS, INK_DEV_API_INFO, INK_DEV_API_TEXT_REPLACES, type InkLibraryInfo, type InkTextReplaceInfo, type VitePluginInkOptions, vitePluginInk as noHmrInkPlugin, vitePluginInk };
153
+ export { type VitePluginInkOptions, vitePluginInk as noHmrInkPlugin, vitePluginInk };
package/dist/vite.d.ts CHANGED
@@ -1,122 +1,9 @@
1
- import { c as InkValidationInfo } from './types-CbD_iwdO.js';
1
+ export { INK_DEV_API_HASHTAG_COMMANDS, INK_DEV_API_INFO, INK_DEV_API_TEXT_REPLACES, InkLibraryInfo, InkTextReplaceInfo } from './dev-api.js';
2
2
  import { Plugin } from 'vite';
3
3
  export { InkHashtagCommandInfo } from '@drincs/pixi-vn-ink/parser';
4
+ import './types-CbD_iwdO.js';
4
5
  import 'inkjs/engine/Error';
5
6
 
6
- /**
7
- * Dev-server endpoint that exposes and accepts the list of registered
8
- * {@link HashtagCommands} handlers as {@link InkHashtagCommandInfo} objects.
9
- *
10
- * - `GET /__pixi-vn-ink/hashtag-commands` – returns the stored `InkHashtagCommandInfo[]` as JSON.
11
- * - `POST /__pixi-vn-ink/hashtag-commands` – replaces the stored list with the JSON body
12
- * (`InkHashtagCommandInfo[]`). Called automatically by {@link setupInkHmrListener} on
13
- * startup and after each HMR update.
14
- * - `InkHashtagCommandInfo.validation` serializes the original validation rule:
15
- * - `{ type: "regexp", source, flags }`
16
- * - `{ type: "zod", schema }` (JSON Schema generated from Zod)
17
- * - `{ type: "literal", value }`
18
- *
19
- * @example
20
- * ```ts
21
- * // VS Code extension reading the registered handlers
22
- * const res = await fetch("http://localhost:5173/__pixi-vn-ink/hashtag-commands");
23
- * const commands: InkHashtagCommandInfo[] = await res.json();
24
- * ```
25
- */
26
- declare const INK_DEV_API_HASHTAG_COMMANDS = "/__pixi-vn-ink/hashtag-commands";
27
- /**
28
- * Dev-server endpoint that exposes and accepts the list of registered
29
- * {@link TextReplaces} handlers as {@link InkTextReplaceInfo} objects.
30
- *
31
- * - `GET /__pixi-vn-ink/text-replaces` – returns the stored `InkTextReplaceInfo[]` as JSON.
32
- * - `POST /__pixi-vn-ink/text-replaces` – replaces the stored list with the JSON body
33
- * (`InkTextReplaceInfo[]`). Called automatically by {@link setupInkHmrListener} on
34
- * startup and after each HMR update.
35
- * - `InkTextReplaceInfo.validation` serializes the original validation rule:
36
- * - `{ type: "regexp", source, flags }`
37
- * - `{ type: "zod", schema }` (JSON Schema generated from Zod)
38
- * - `{ type: "literal", value }` for string modes like `"all"` / `"characterId"`
39
- *
40
- * @example
41
- * ```ts
42
- * // VS Code extension reading the registered text-replace handlers
43
- * const res = await fetch("http://localhost:5173/__pixi-vn-ink/text-replaces");
44
- * const replaces: InkTextReplaceInfo[] = await res.json();
45
- * ```
46
- */
47
- declare const INK_DEV_API_TEXT_REPLACES = "/__pixi-vn-ink/text-replaces";
48
- /**
49
- * Dev-server endpoint that exposes static information about this library instance, as an
50
- * {@link InkLibraryInfo} object.
51
- *
52
- * - `GET /__pixi-vn-ink/info` – returns `{ version, schemaUrl }`, where `version` is this
53
- * `@drincs/pixi-vn-ink` package's own version and `schemaUrl` is the `PIXIVNJSON_SCHEMA_URL`
54
- * (from `@drincs/pixi-vn-json/constants`) embedded as `$schema` in every exported `PixiVNJson`
55
- * document.
56
- * - Read-only: unlike {@link INK_DEV_API_HASHTAG_COMMANDS} / {@link INK_DEV_API_TEXT_REPLACES},
57
- * there is no `POST` — both values are static per plugin instance and don't depend on
58
- * SSR-loading the user's content, so there's nothing for {@link setupInkHmrListener} to push.
59
- *
60
- * @example
61
- * ```ts
62
- * // VS Code extension reading the library version / schema URL
63
- * const res = await fetch("http://localhost:5173/__pixi-vn-ink/info");
64
- * const { version, schemaUrl }: InkLibraryInfo = await res.json();
65
- * ```
66
- */
67
- declare const INK_DEV_API_INFO = "/__pixi-vn-ink/info";
68
-
69
- /**
70
- * Serializable representation of a registered {@link TextReplaces} handler,
71
- * as exposed by the pixi-vn-ink Vite dev-server API.
72
- *
73
- * Instances of this type are returned by
74
- * `GET /__pixi-vn-ink/text-replaces`
75
- * and accepted by
76
- * `POST /__pixi-vn-ink/text-replaces`.
77
- *
78
- * @see https://pixi-vn.com/ink#vite-plugin
79
- */
80
- interface InkTextReplaceInfo {
81
- /**
82
- * Unique name that identifies the handler.
83
- * Matches {@link ReplaceHandlerOptions.name}.
84
- */
85
- name: string;
86
- /**
87
- * Human-readable description of what the handler does.
88
- * Matches {@link ReplaceHandlerOptions.description}.
89
- */
90
- description?: string;
91
- /**
92
- * Serializable form of {@link ReplaceHandlerOptions.validation}.
93
- */
94
- validation: InkValidationInfo;
95
- /**
96
- * When the handler runs relative to the translation step.
97
- * Matches {@link ReplaceHandlerOptions.type}.
98
- * @default "before-translation"
99
- */
100
- type?: "before-translation" | "after-translation";
101
- }
102
- /**
103
- * Static information about a running `@drincs/pixi-vn-ink` instance, as returned by
104
- * `GET /__pixi-vn-ink/info`.
105
- *
106
- * @see https://pixi-vn.com/ink#vite-plugin
107
- */
108
- interface InkLibraryInfo {
109
- /**
110
- * This `@drincs/pixi-vn-ink` package's own version (from its `package.json`).
111
- */
112
- version: string;
113
- /**
114
- * The JSON Schema URL (`PIXIVNJSON_SCHEMA_URL` from `@drincs/pixi-vn-json/constants`)
115
- * embedded as `$schema` in every exported `PixiVNJson` document.
116
- */
117
- schemaUrl: string;
118
- }
119
-
120
7
  /**
121
8
  * Options for {@link vitePluginInk}.
122
9
  */
@@ -263,4 +150,4 @@ interface VitePluginInkOptions {
263
150
  */
264
151
  declare function vitePluginInk(options?: VitePluginInkOptions): Plugin;
265
152
 
266
- export { INK_DEV_API_HASHTAG_COMMANDS, INK_DEV_API_INFO, INK_DEV_API_TEXT_REPLACES, type InkLibraryInfo, type InkTextReplaceInfo, type VitePluginInkOptions, vitePluginInk as noHmrInkPlugin, vitePluginInk };
153
+ export { type VitePluginInkOptions, vitePluginInk as noHmrInkPlugin, vitePluginInk };
package/dist/vite.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import {a,b,m,n,l,i,c,o}from'./chunk-OUJBCOTD.mjs';import et from'fs/promises';import L,{resolve,posix,sep,isAbsolute,basename,dirname,normalize,relative}from'path';import*as ln from'fs';import {statSync,stat,realpathSync,realpath,readdirSync,readdir}from'fs';import {fileURLToPath}from'url';import {createRequire}from'module';import {toJSONSchema}from'zod';var te=a((Es,Ct)=>{var At=process||{},Yt=At.argv||[],St=At.env||{},en=!(St.NO_COLOR||Yt.includes("--no-color"))&&(!!St.FORCE_COLOR||Yt.includes("--color")||At.platform==="win32"||(At.stdout||{}).isTTY&&St.TERM!=="dumb"||!!St.CI),nn=(t,e,n=t)=>r=>{let s=""+r,o=s.indexOf(e,t.length);return ~o?t+rn(s,e,n,o)+e:t+s+e},rn=(t,e,n,r)=>{let s="",o=0;do s+=t.substring(o,r)+n,o=r+e.length,r=t.indexOf(e,o);while(~r);return s+t.substring(o)},Zt=(t=en)=>{let e=t?nn:()=>String;return {isColorSupported:t,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};Ct.exports=Zt();Ct.exports.createColors=Zt;});var ht=a((Ts,me)=>{var fe="[^\\\\/]",sr="(?=.)",he="[^/]",Lt="(?:\\/|$)",de="(?:^|\\/)",Ot=`\\.{1,2}${Lt}`,ir="(?!\\.)",or=`(?!${de}${Ot})`,ar=`(?!\\.{0,1}${Lt})`,ur=`(?!${Ot})`,cr="[^.\\/]",lr=`${he}*?`,pr="/",ge={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:sr,QMARK:he,END_ANCHOR:Lt,DOTS_SLASH:Ot,NO_DOT:ir,NO_DOTS:or,NO_DOT_SLASH:ar,NO_DOTS_SLASH:ur,QMARK_NO_DOT:cr,STAR:lr,START_ANCHOR:de,SEP:pr},fr={...ge,SLASH_LITERAL:"[\\\\/]",QMARK:fe,STAR:`${fe}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},hr={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};me.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:hr,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return {"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===true?fr:ge}};});var dt=a(K=>{var{REGEX_BACKSLASH:dr,REGEX_REMOVE_BACKSLASH:gr,REGEX_SPECIAL_CHARS:mr,REGEX_SPECIAL_CHARS_GLOBAL:br}=ht();K.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);K.hasRegexChars=t=>mr.test(t);K.isRegexChar=t=>t.length===1&&K.hasRegexChars(t);K.escapeRegex=t=>t.replace(br,"\\$1");K.toPosixSlashes=t=>t.replace(dr,"/");K.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":false};K.removeBackslashes=t=>t.replace(gr,e=>e==="\\"?"":e);K.escapeLast=(t,e,n)=>{let r=t.lastIndexOf(e,n);return r===-1?t:t[r-1]==="\\"?K.escapeLast(t,e,r-1):`${t.slice(0,r)}\\${t.slice(r)}`};K.removePrefix=(t,e={})=>{let n=t;return n.startsWith("./")&&(n=n.slice(2),e.prefix="./"),n};K.wrapOutput=(t,e={},n={})=>{let r=n.contains?"":"^",s=n.contains?"":"$",o=`${r}(?:${t})${s}`;return e.negated===true&&(o=`(?:^(?!${o}).*$)`),o};K.basename=(t,{windows:e}={})=>{let n=t.split(e?/[\\/]/:"/"),r=n[n.length-1];return r===""?n[n.length-2]:r};});var Ee=a((Ds,Re)=>{var be=dt(),{CHAR_ASTERISK:Tt,CHAR_AT:yr,CHAR_BACKWARD_SLASH:gt,CHAR_COMMA:xr,CHAR_DOT:Ht,CHAR_EXCLAMATION_MARK:Dt,CHAR_FORWARD_SLASH:_e,CHAR_LEFT_CURLY_BRACE:Nt,CHAR_LEFT_PARENTHESES:Ft,CHAR_LEFT_SQUARE_BRACKET:Sr,CHAR_PLUS:Ar,CHAR_QUESTION_MARK:ye,CHAR_RIGHT_CURLY_BRACE:_r,CHAR_RIGHT_PARENTHESES:xe,CHAR_RIGHT_SQUARE_BRACKET:Rr}=ht(),Se=t=>t===_e||t===gt,Ae=t=>{t.isPrefix!==true&&(t.depth=t.isGlobstar?1/0:1);},Er=(t,e)=>{let n=e||{},r=t.length-1,s=n.parts===true||n.scanToEnd===true,o=[],a=[],l=[],g=t,b=-1,R=0,x=0,S=false,I=false,A=false,P=false,N=false,J=false,y=false,U=false,j=false,M=false,T=0,O,E,h={value:"",depth:0,isGlob:false},i=()=>b>=r,d=()=>g.charCodeAt(b+1),_=()=>(O=E,g.charCodeAt(++b));for(;b<r;){E=_();let v;if(E===gt){y=h.backslashes=true,E=_(),E===Nt&&(J=true);continue}if(J===true||E===Nt){for(T++;i()!==true&&(E=_());){if(E===gt){y=h.backslashes=true,_();continue}if(E===Nt){T++;continue}if(J!==true&&E===Ht&&(E=_())===Ht){if(S=h.isBrace=true,A=h.isGlob=true,M=true,s===true)continue;break}if(J!==true&&E===xr){if(S=h.isBrace=true,A=h.isGlob=true,M=true,s===true)continue;break}if(E===_r&&(T--,T===0)){J=false,S=h.isBrace=true,M=true;break}}if(s===true)continue;break}if(E===_e){if(o.push(b),a.push(h),h={value:"",depth:0,isGlob:false},M===true)continue;if(O===Ht&&b===R+1){R+=2;continue}x=b+1;continue}if(n.noext!==true&&(E===Ar||E===yr||E===Tt||E===ye||E===Dt)===true&&d()===Ft){if(A=h.isGlob=true,P=h.isExtglob=true,M=true,E===Dt&&b===R&&(j=true),s===true){for(;i()!==true&&(E=_());){if(E===gt){y=h.backslashes=true,E=_();continue}if(E===xe){A=h.isGlob=true,M=true;break}}continue}break}if(E===Tt){if(O===Tt&&(N=h.isGlobstar=true),A=h.isGlob=true,M=true,s===true)continue;break}if(E===ye){if(A=h.isGlob=true,M=true,s===true)continue;break}if(E===Sr){for(;i()!==true&&(v=_());){if(v===gt){y=h.backslashes=true,_();continue}if(v===Rr){I=h.isBracket=true,A=h.isGlob=true,M=true;break}}if(s===true)continue;break}if(n.nonegate!==true&&E===Dt&&b===R){U=h.negated=true,R++;continue}if(n.noparen!==true&&E===Ft){if(A=h.isGlob=true,s===true){for(;i()!==true&&(E=_());){if(E===Ft){y=h.backslashes=true,E=_();continue}if(E===xe){M=true;break}}continue}break}if(A===true){if(M=true,s===true)continue;break}}n.noext===true&&(P=false,A=false);let m=g,u="",c="";R>0&&(u=g.slice(0,R),g=g.slice(R),x-=R),m&&A===true&&x>0?(m=g.slice(0,x),c=g.slice(x)):A===true?(m="",c=g):m=g,m&&m!==""&&m!=="/"&&m!==g&&Se(m.charCodeAt(m.length-1))&&(m=m.slice(0,-1)),n.unescape===true&&(c&&(c=be.removeBackslashes(c)),m&&y===true&&(m=be.removeBackslashes(m)));let F={prefix:u,input:t,start:R,base:m,glob:c,isBrace:S,isBracket:I,isGlob:A,isExtglob:P,isGlobstar:N,negated:U,negatedExtglob:j};if(n.tokens===true&&(F.maxDepth=0,Se(E)||a.push(h),F.tokens=a),n.parts===true||n.tokens===true){let v;for(let C=0;C<o.length;C++){let q=v?v+1:R,V=o[C],Q=t.slice(q,V);n.tokens&&(C===0&&R!==0?(a[C].isPrefix=true,a[C].value=u):a[C].value=Q,Ae(a[C]),F.maxDepth+=a[C].depth),(C!==0||Q!=="")&&l.push(Q),v=V;}if(v&&v+1<t.length){let C=t.slice(v+1);l.push(C),n.tokens&&(a[a.length-1].value=C,Ae(a[a.length-1]),F.maxDepth+=a[a.length-1].depth);}F.slashes=o,F.parts=l;}return F};Re.exports=Er;});var ke=a((Ns,$e)=>{var mt=ht(),X=dt(),{MAX_LENGTH:Rt,POSIX_REGEX_SOURCE:vr,REGEX_NON_SPECIAL_CHARS:wr,REGEX_SPECIAL_CHARS_BACKREF:$r,REPLACEMENTS:ve}=mt,kr=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let n=`[${t.join("-")}]`;try{new RegExp(n);}catch{return t.map(s=>X.escapeRegex(s)).join("..")}return n},ct=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,we=t=>{let e=[],n=0,r=0,s=0,o="",a=false;for(let l of t){if(a===true){o+=l,a=false;continue}if(l==="\\"){o+=l,a=true;continue}if(l==='"'){s=s===1?0:1,o+=l;continue}if(s===0){if(l==="[")n++;else if(l==="]"&&n>0)n--;else if(n===0){if(l==="(")r++;else if(l===")"&&r>0)r--;else if(l==="|"&&r===0){e.push(o),o="";continue}}}o+=l;}return e.push(o),e},Cr=t=>{let e=false;for(let n of t){if(e===true){e=false;continue}if(n==="\\"){e=true;continue}if(/[?*+@!()[\]{}]/.test(n))return false}return true},Mt=t=>{let e=t.trim(),n=true;for(;n===true;)n=false,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),n=true);if(Cr(e))return e.replace(/\\(.)/g,"$1")},Ir=t=>{let e=t.map(Mt).filter(Boolean);for(let n=0;n<e.length;n++)for(let r=n+1;r<e.length;r++){let s=e[n],o=e[r],a=s[0];if(!(!a||s!==a.repeat(s.length)||o!==a.repeat(o.length))&&(s===o||s.startsWith(o)||o.startsWith(s)))return true}return false},Bt=(t,e=true)=>{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let n=0,r=0,s=0,o=false;for(let a=1;a<t.length;a++){let l=t[a];if(o===true){o=false;continue}if(l==="\\"){o=true;continue}if(l==='"'){s=s===1?0:1;continue}if(s!==1){if(l==="["){n++;continue}if(l==="]"&&n>0){n--;continue}if(!(n>0)){if(l==="("){r++;continue}if(l===")"&&(r--,r===0))return e===true&&a!==t.length-1?void 0:{type:t[0],body:t.slice(2,a),end:a}}}}},Pr=t=>`${t.length===1?X.escapeRegex(t[0]):`[${t.map(n=>X.escapeRegex(n)).join("")}]`}*`,Lr=t=>{let e=0,n=[];for(;e<t.length;){let r=Bt(t.slice(e),false);if(!r||r.type!=="*")return;let s=we(r.body).map(a=>a.trim());if(s.length!==1)return;let o=Mt(s[0]);if(!o||o.length!==1)return;n.push(o),e+=r.end+1;}if(!(n.length<1))return n},Or=t=>{let e=0,n=t.trim(),r=Bt(n);for(;r;)e++,n=r.body.trim(),r=Bt(n);return e},Tr=(t,e)=>{if(e.maxExtglobRecursion===false)return {risky:false};let n=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:mt.DEFAULT_MAX_EXTGLOB_RECURSION,r=we(t).map(l=>l.trim());if(r.length>1&&(r.some(l=>l==="")||r.some(l=>/^[*?]+$/.test(l))||Ir(r)))return {risky:true};let s=[],o=false,a=true;for(let l of r){let g=Lr(l);if(g){o=true,s.push(...g);continue}let b=Mt(l);if(b&&b.length===1){s.push(b);continue}if(a=false,Or(l)>n)return {risky:true}}return o?a?{risky:true,safeOutput:Pr([...new Set(s)])}:{risky:true}:{risky:false}},Gt=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=ve[t]||t;let n={...e},r=typeof n.maxLength=="number"?Math.min(Rt,n.maxLength):Rt,s=t.length;if(s>r)throw new SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${r}`);let o={type:"bos",value:"",output:n.prepend||""},a=[o],l=n.capture?"":"?:",g=mt.globChars(n.windows),b=mt.extglobChars(g),{DOT_LITERAL:R,PLUS_LITERAL:x,SLASH_LITERAL:S,ONE_CHAR:I,DOTS_SLASH:A,NO_DOT:P,NO_DOT_SLASH:N,NO_DOTS_SLASH:J,QMARK:y,QMARK_NO_DOT:U,STAR:j,START_ANCHOR:M}=g,T=p=>`(${l}(?:(?!${M}${p.dot?A:R}).)*?)`,O=n.dot?"":P,E=n.dot?y:U,h=n.bash===true?T(n):j;n.capture&&(h=`(${h})`),typeof n.noext=="boolean"&&(n.noextglob=n.noext);let i={input:t,index:-1,start:0,dot:n.dot===true,consumed:"",output:"",prefix:"",backtrack:false,negated:false,brackets:0,braces:0,parens:0,quotes:0,globstar:false,tokens:a};t=X.removePrefix(t,i),s=t.length;let d=[],_=[],m=[],u=o,c,F=()=>i.index===s-1,v=i.peek=(p=1)=>t[i.index+p],C=i.advance=()=>t[++i.index]||"",q=()=>t.slice(i.index+1),V=(p="",w=0)=>{i.consumed+=p,i.index+=w;},Q=p=>{i.output+=p.output!=null?p.output:p.value,V(p.value);},yt=()=>{let p=1;for(;v()==="!"&&(v(2)!=="("||v(3)==="?");)C(),i.start++,p++;return p%2===0?false:(i.negated=true,i.start++,true)},ut=p=>{i[p]++,m.push(p);},Y=p=>{i[p]--,m.pop();},$=p=>{if(u.type==="globstar"){let w=i.braces>0&&(p.type==="comma"||p.type==="brace"),f=p.extglob===true||d.length&&(p.type==="pipe"||p.type==="paren");p.type!=="slash"&&p.type!=="paren"&&!w&&!f&&(i.output=i.output.slice(0,-u.output.length),u.type="star",u.value="*",u.output=h,i.output+=u.output);}if(d.length&&p.type!=="paren"&&(d[d.length-1].inner+=p.value),(p.value||p.output)&&Q(p),u&&u.type==="text"&&p.type==="text"){u.output=(u.output||u.value)+p.value,u.value+=p.value;return}p.prev=u,a.push(p),u=p;},H=(p,w)=>{let f={...b[w],conditions:1,inner:""};f.prev=u,f.parens=i.parens,f.output=i.output,f.startIndex=i.index,f.tokensIndex=a.length;let k=(n.capture?"(":"")+f.open;ut("parens"),$({type:p,value:w,output:i.output?"":I}),$({type:"paren",extglob:true,value:C(),output:k}),d.push(f);},z=p=>{let w=t.slice(p.startIndex,i.index+1),f=t.slice(p.startIndex+2,i.index),k=Tr(f,n);if((p.type==="plus"||p.type==="star")&&k.risky){let D=k.safeOutput?(p.output?"":I)+(n.capture?`(${k.safeOutput})`:k.safeOutput):void 0,Z=a[p.tokensIndex];Z.type="text",Z.value=w,Z.output=D||X.escapeRegex(w);for(let tt=p.tokensIndex+1;tt<a.length;tt++)a[tt].value="",a[tt].output="",delete a[tt].suffix;i.output=p.output+Z.output,i.backtrack=true,$({type:"paren",extglob:true,value:c,output:""}),Y("parens");return}let B=p.close+(n.capture?")":""),W;if(p.type==="negate"){let D=h;if(p.inner&&p.inner.length>1&&p.inner.includes("/")&&(D=T(n)),(D!==h||F()||/^\)+$/.test(q()))&&(B=p.close=`)$))${D}`),p.inner.includes("*")&&(W=q())&&/^\.[^\\/.]+$/.test(W)){let Z=Gt(W,{...e,fastpaths:false}).output;B=p.close=`)${Z})${D})`;}p.prev.type==="bos"&&(i.negatedExtglob=true);}$({type:"paren",extglob:true,value:c,output:B}),Y("parens");};if(n.fastpaths!==false&&!/(^[*!]|[/()[\]{}"])/.test(t)){let p=false,w=t.replace($r,(f,k,B,W,D,Z)=>W==="\\"?(p=true,f):W==="?"?k?k+W+(D?y.repeat(D.length):""):Z===0?E+(D?y.repeat(D.length):""):y.repeat(B.length):W==="."?R.repeat(B.length):W==="*"?k?k+W+(D?h:""):h:k?f:`\\${f}`);return p===true&&(n.unescape===true?w=w.replace(/\\/g,""):w=w.replace(/\\+/g,f=>f.length%2===0?"\\\\":f?"\\":"")),w===t&&n.contains===true?(i.output=t,i):(i.output=X.wrapOutput(w,i,e),i)}for(;!F();){if(c=C(),c==="\0")continue;if(c==="\\"){let f=v();if(f==="/"&&n.bash!==true||f==="."||f===";")continue;if(!f){c+="\\",$({type:"text",value:c});continue}let k=/^\\+/.exec(q()),B=0;if(k&&k[0].length>2&&(B=k[0].length,i.index+=B,B%2!==0&&(c+="\\")),n.unescape===true?c=C():c+=C(),i.brackets===0){$({type:"text",value:c});continue}}if(i.brackets>0&&(c!=="]"||u.value==="["||u.value==="[^")){if(n.posix!==false&&c===":"){let f=u.value.slice(1);if(f.includes("[")&&(u.posix=true,f.includes(":"))){let k=u.value.lastIndexOf("["),B=u.value.slice(0,k),W=u.value.slice(k+2),D=vr[W];if(D){u.value=B+D,i.backtrack=true,C(),!o.output&&a.indexOf(u)===1&&(o.output=I);continue}}}(c==="["&&v()!==":"||c==="-"&&v()==="]")&&(c=`\\${c}`),c==="]"&&(u.value==="["||u.value==="[^")&&(c=`\\${c}`),n.posix===true&&c==="!"&&u.value==="["&&(c="^"),u.value+=c,Q({value:c});continue}if(i.quotes===1&&c!=='"'){c=X.escapeRegex(c),u.value+=c,Q({value:c});continue}if(c==='"'){i.quotes=i.quotes===1?0:1,n.keepQuotes===true&&$({type:"text",value:c});continue}if(c==="("){ut("parens"),$({type:"paren",value:c});continue}if(c===")"){if(i.parens===0&&n.strictBrackets===true)throw new SyntaxError(ct("opening","("));let f=d[d.length-1];if(f&&i.parens===f.parens+1){z(d.pop());continue}$({type:"paren",value:c,output:i.parens?")":"\\)"}),Y("parens");continue}if(c==="["){if(n.nobracket===true||!q().includes("]")){if(n.nobracket!==true&&n.strictBrackets===true)throw new SyntaxError(ct("closing","]"));c=`\\${c}`;}else ut("brackets");$({type:"bracket",value:c});continue}if(c==="]"){if(n.nobracket===true||u&&u.type==="bracket"&&u.value.length===1){$({type:"text",value:c,output:`\\${c}`});continue}if(i.brackets===0){if(n.strictBrackets===true)throw new SyntaxError(ct("opening","["));$({type:"text",value:c,output:`\\${c}`});continue}Y("brackets");let f=u.value.slice(1);if(u.posix!==true&&f[0]==="^"&&!f.includes("/")&&(c=`/${c}`),u.value+=c,Q({value:c}),n.literalBrackets===false||X.hasRegexChars(f))continue;let k=X.escapeRegex(u.value);if(i.output=i.output.slice(0,-u.value.length),n.literalBrackets===true){i.output+=k,u.value=k;continue}u.value=`(${l}${k}|${u.value})`,i.output+=u.value;continue}if(c==="{"&&n.nobrace!==true){ut("braces");let f={type:"brace",value:c,output:"(",outputIndex:i.output.length,tokensIndex:i.tokens.length};_.push(f),$(f);continue}if(c==="}"){let f=_[_.length-1];if(n.nobrace===true||!f){$({type:"text",value:c,output:c});continue}let k=")";if(f.dots===true){let B=a.slice(),W=[];for(let D=B.length-1;D>=0&&(a.pop(),B[D].type!=="brace");D--)B[D].type!=="dots"&&W.unshift(B[D].value);k=kr(W,n),i.backtrack=true;}if(f.comma!==true&&f.dots!==true){let B=i.output.slice(0,f.outputIndex),W=i.tokens.slice(f.tokensIndex);f.value=f.output="\\{",c=k="\\}",i.output=B;for(let D of W)i.output+=D.output||D.value;}$({type:"brace",value:c,output:k}),Y("braces"),_.pop();continue}if(c==="|"){d.length>0&&d[d.length-1].conditions++,$({type:"text",value:c});continue}if(c===","){let f=c,k=_[_.length-1];k&&m[m.length-1]==="braces"&&(k.comma=true,f="|"),$({type:"comma",value:c,output:f});continue}if(c==="/"){if(u.type==="dot"&&i.index===i.start+1){i.start=i.index+1,i.consumed="",i.output="",a.pop(),u=o;continue}$({type:"slash",value:c,output:S});continue}if(c==="."){if(i.braces>0&&u.type==="dot"){u.value==="."&&(u.output=R);let f=_[_.length-1];u.type="dots",u.output+=c,u.value+=c,f.dots=true;continue}if(i.braces+i.parens===0&&u.type!=="bos"&&u.type!=="slash"){$({type:"text",value:c,output:R});continue}$({type:"dot",value:c,output:R});continue}if(c==="?"){if(!(u&&u.value==="(")&&n.noextglob!==true&&v()==="("&&v(2)!=="?"){H("qmark",c);continue}if(u&&u.type==="paren"){let k=v(),B=c;(u.value==="("&&!/[!=<:]/.test(k)||k==="<"&&!/<([!=]|\w+>)/.test(q()))&&(B=`\\${c}`),$({type:"text",value:c,output:B});continue}if(n.dot!==true&&(u.type==="slash"||u.type==="bos")){$({type:"qmark",value:c,output:U});continue}$({type:"qmark",value:c,output:y});continue}if(c==="!"){if(n.noextglob!==true&&v()==="("&&(v(2)!=="?"||!/[!=<:]/.test(v(3)))){H("negate",c);continue}if(n.nonegate!==true&&i.index===0){yt();continue}}if(c==="+"){if(n.noextglob!==true&&v()==="("&&v(2)!=="?"){H("plus",c);continue}if(u&&u.value==="("||n.regex===false){$({type:"plus",value:c,output:x});continue}if(u&&(u.type==="bracket"||u.type==="paren"||u.type==="brace")||i.parens>0){$({type:"plus",value:c});continue}$({type:"plus",value:x});continue}if(c==="@"){if(n.noextglob!==true&&v()==="("&&v(2)!=="?"){$({type:"at",extglob:true,value:c,output:""});continue}$({type:"text",value:c});continue}if(c!=="*"){(c==="$"||c==="^")&&(c=`\\${c}`);let f=wr.exec(q());f&&(c+=f[0],i.index+=f[0].length),$({type:"text",value:c});continue}if(u&&(u.type==="globstar"||u.star===true)){u.type="star",u.star=true,u.value+=c,u.output=h,i.backtrack=true,i.globstar=true,V(c);continue}let p=q();if(n.noextglob!==true&&/^\([^?]/.test(p)){H("star",c);continue}if(u.type==="star"){if(n.noglobstar===true){V(c);continue}let f=u.prev,k=f.prev,B=f.type==="slash"||f.type==="bos",W=k&&(k.type==="star"||k.type==="globstar");if(n.bash===true&&(!B||p[0]&&p[0]!=="/")){$({type:"star",value:c,output:""});continue}let D=i.braces>0&&(f.type==="comma"||f.type==="brace"),Z=d.length&&(f.type==="pipe"||f.type==="paren");if(!B&&f.type!=="paren"&&!D&&!Z){$({type:"star",value:c,output:""});continue}for(;p.slice(0,3)==="/**";){let tt=t[i.index+4];if(tt&&tt!=="/")break;p=p.slice(3),V("/**",3);}if(f.type==="bos"&&F()){u.type="globstar",u.value+=c,u.output=T(n),i.output=u.output,i.globstar=true,V(c);continue}if(f.type==="slash"&&f.prev.type!=="bos"&&!W&&F()){i.output=i.output.slice(0,-(f.output+u.output).length),f.output=`(?:${f.output}`,u.type="globstar",u.output=T(n)+(n.strictSlashes?")":"|$)"),u.value+=c,i.globstar=true,i.output+=f.output+u.output,V(c);continue}if(f.type==="slash"&&f.prev.type!=="bos"&&p[0]==="/"){let tt=p[1]!==void 0?"|$":"";i.output=i.output.slice(0,-(f.output+u.output).length),f.output=`(?:${f.output}`,u.type="globstar",u.output=`${T(n)}${S}|${S}${tt})`,u.value+=c,i.output+=f.output+u.output,i.globstar=true,V(c+C()),$({type:"slash",value:"/",output:""});continue}if(f.type==="bos"&&p[0]==="/"){u.type="globstar",u.value+=c,u.output=`(?:^|${S}|${T(n)}${S})`,i.output=u.output,i.globstar=true,V(c+C()),$({type:"slash",value:"/",output:""});continue}i.output=i.output.slice(0,-u.output.length),u.type="globstar",u.output=T(n),u.value+=c,i.output+=u.output,i.globstar=true,V(c);continue}let w={type:"star",value:c,output:h};if(n.bash===true){w.output=".*?",(u.type==="bos"||u.type==="slash")&&(w.output=O+w.output),$(w);continue}if(u&&(u.type==="bracket"||u.type==="paren")&&n.regex===true){w.output=c,$(w);continue}(i.index===i.start||u.type==="slash"||u.type==="dot")&&(u.type==="dot"?(i.output+=N,u.output+=N):n.dot===true?(i.output+=J,u.output+=J):(i.output+=O,u.output+=O),v()!=="*"&&(i.output+=I,u.output+=I)),$(w);}for(;i.brackets>0;){if(n.strictBrackets===true)throw new SyntaxError(ct("closing","]"));i.output=X.escapeLast(i.output,"["),Y("brackets");}for(;i.parens>0;){if(n.strictBrackets===true)throw new SyntaxError(ct("closing",")"));i.output=X.escapeLast(i.output,"("),Y("parens");}for(;i.braces>0;){if(n.strictBrackets===true)throw new SyntaxError(ct("closing","}"));i.output=X.escapeLast(i.output,"{"),Y("braces");}if(n.strictSlashes!==true&&(u.type==="star"||u.type==="bracket")&&$({type:"maybe_slash",value:"",output:`${S}?`}),i.backtrack===true){i.output="";for(let p of i.tokens)i.output+=p.output!=null?p.output:p.value,p.suffix&&(i.output+=p.suffix);}return i};Gt.fastpaths=(t,e)=>{let n={...e},r=typeof n.maxLength=="number"?Math.min(Rt,n.maxLength):Rt,s=t.length;if(s>r)throw new SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${r}`);t=ve[t]||t;let{DOT_LITERAL:o,SLASH_LITERAL:a,ONE_CHAR:l,DOTS_SLASH:g,NO_DOT:b,NO_DOTS:R,NO_DOTS_SLASH:x,STAR:S,START_ANCHOR:I}=mt.globChars(n.windows),A=n.dot?R:b,P=n.dot?x:b,N=n.capture?"":"?:",J={negated:false,prefix:""},y=n.bash===true?".*?":S;n.capture&&(y=`(${y})`);let U=O=>O.noglobstar===true?y:`(${N}(?:(?!${I}${O.dot?g:o}).)*?)`,j=O=>{switch(O){case "*":return `${A}${l}${y}`;case ".*":return `${o}${l}${y}`;case "*.*":return `${A}${y}${o}${l}${y}`;case "*/*":return `${A}${y}${a}${l}${P}${y}`;case "**":return A+U(n);case "**/*":return `(?:${A}${U(n)}${a})?${P}${l}${y}`;case "**/*.*":return `(?:${A}${U(n)}${a})?${P}${y}${o}${l}${y}`;case "**/.*":return `(?:${A}${U(n)}${a})?${o}${l}${y}`;default:{let E=/^(.*?)\.(\w+)$/.exec(O);if(!E)return;let h=j(E[1]);return h?h+o+E[2]:void 0}}},M=X.removePrefix(t,J),T=j(M);return T&&n.strictSlashes!==true&&(T+=`${a}?`),T};$e.exports=Gt;});var Pe=a((Fs,Ie)=>{var Hr=Ee(),jt=ke(),Ce=dt(),Dr=ht(),Nr=t=>t&&typeof t=="object"&&!Array.isArray(t),G=(t,e,n=false)=>{if(Array.isArray(t)){let R=t.map(S=>G(S,e,n));return S=>{for(let I of R){let A=I(S);if(A)return A}return false}}let r=Nr(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!r)throw new TypeError("Expected pattern to be a non-empty string");let s=e||{},o=s.windows,a=r?G.compileRe(t,e):G.makeRe(t,e,false,true),l=a.state;delete a.state;let g=()=>false;if(s.ignore){let R={...e,ignore:null,onMatch:null,onResult:null};g=G(s.ignore,R,n);}let b=(R,x=false)=>{let{isMatch:S,match:I,output:A}=G.test(R,a,e,{glob:t,posix:o}),P={glob:t,state:l,regex:a,posix:o,input:R,output:A,match:I,isMatch:S};return typeof s.onResult=="function"&&s.onResult(P),S===false?(P.isMatch=false,x?P:false):g(R)?(typeof s.onIgnore=="function"&&s.onIgnore(P),P.isMatch=false,x?P:false):(typeof s.onMatch=="function"&&s.onMatch(P),x?P:true)};return n&&(b.state=l),b};G.test=(t,e,n,{glob:r,posix:s}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return {isMatch:false,output:""};let o=n||{},a=o.format||(s?Ce.toPosixSlashes:null),l=t===r,g=l&&a?a(t):t;return l===false&&(g=a?a(t):t,l=g===r),(l===false||o.capture===true)&&(o.matchBase===true||o.basename===true?l=G.matchBase(t,e,n,s):l=e.exec(g)),{isMatch:!!l,match:l,output:g}};G.matchBase=(t,e,n,r=n&&n.windows)=>(e instanceof RegExp?e:G.makeRe(e,n)).test(Ce.basename(t,{windows:r}));G.isMatch=(t,e,n)=>G(e,n)(t);G.parse=(t,e)=>Array.isArray(t)?t.map(n=>G.parse(n,e)):jt(t,{...e,fastpaths:false});G.scan=(t,e)=>Hr(t,e);G.compileRe=(t,e,n=false,r=false)=>{if(n===true)return t.output;let s=e||{},o=s.contains?"":"^",a=s.contains?"":"$",l=`${o}(?:${t.output})${a}`;t&&t.negated===true&&(l=`^(?!${l}).*$`);let g=G.toRegex(l,e);return r===true&&(g.state=t),g};G.makeRe=(t,e={},n=false,r=false)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let s={negated:false,fastpaths:true};return e.fastpaths!==false&&(t[0]==="."||t[0]==="*")&&(s.output=jt.fastpaths(t,e)),s.output||(s=jt(t,e)),G.compileRe(s,e,n,r)};G.toRegex=(t,e)=>{try{let n=e||{};return new RegExp(t,n.flags||(n.nocase?"i":""))}catch(n){if(e&&e.debug===true)throw n;return /$^/}};G.constants=Dr;Ie.exports=G;});var He=a((Bs,Te)=>{var Le=Pe(),Fr=dt();function Oe(t,e,n=false){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:Fr.isWindows()}),Le(t,e,n)}Object.assign(Oe,Le);Te.exports=Oe;});var ft="/__pixi-vn-ink/hashtag-commands",xt="/__pixi-vn-ink/text-replaces",kt="/__pixi-vn-ink/info";var Kt=b(m(),1),at=b(te(),1);var ee=createRequire(import.meta.url);function pn(t){let e=normalize(t);return e.length>1&&e[e.length-1]===sep&&(e=e.substring(0,e.length-1)),e}var fn=/[\\/]/g;function se(t,e){return t.replace(fn,e)}var hn=/^[a-z]:[\\/]$/i;function dn(t){return t==="/"||hn.test(t)}function It(t,e){let{resolvePaths:n,normalizePath:r,pathSeparator:s}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(n&&(t=resolve(t)),(r||o)&&(t=pn(t)),t===".")return "";let a=t[t.length-1]!==s;return se(a?t+s:t,s)}function ie(t,e){return e+t}function gn(t,e){return function(n,r){return r.startsWith(t)?r.slice(t.length)+n:se(relative(t,r),e.pathSeparator)+e.pathSeparator+n}}function mn(t){return t}function bn(t,e,n){return e+t+n}function yn(t,e){let{relativePaths:n,includeBasePath:r}=e;return n&&t?gn(t,e):r?ie:mn}function xn(t){return function(e,n){n.push(e.substring(t.length)||".");}}function Sn(t){return function(e,n,r){let s=e.substring(t.length)||".";r.every(o=>o(s,true))&&n.push(s);}}var An=(t,e)=>{e.push(t||".");},_n=(t,e,n)=>{let r=t||".";n.every(s=>s(r,true))&&e.push(r);},Rn=()=>{};function En(t,e){let{includeDirs:n,filters:r,relativePaths:s}=e;return n?s?r&&r.length?Sn(t):xn(t):r&&r.length?_n:An:Rn}var vn=(t,e,n,r)=>{r.every(s=>s(t,false))&&n.files++;},wn=(t,e,n,r)=>{r.every(s=>s(t,false))&&e.push(t);},$n=(t,e,n,r)=>{n.files++;},kn=(t,e)=>{e.push(t);},Cn=()=>{};function In(t){let{excludeFiles:e,filters:n,onlyCounts:r}=t;return e?Cn:n&&n.length?r?vn:wn:r?$n:kn}var Pn=t=>t,Ln=()=>[""].slice(0,0);function On(t){return t.group?Ln:Pn}var Tn=(t,e,n)=>{t.push({directory:e,files:n,dir:e});},Hn=()=>{};function Dn(t){return t.group?Tn:Hn}var Nn=function(t,e,n){let{queue:r,fs:s,options:{suppressErrors:o}}=e;r.enqueue(),s.realpath(t,(a,l)=>{if(a)return r.dequeue(o?null:a,e);s.stat(l,(g,b)=>{if(g)return r.dequeue(o?null:g,e);if(b.isDirectory()&&oe(t,l,e))return r.dequeue(null,e);n(b,l),r.dequeue(null,e);});});},Fn=function(t,e,n){let{queue:r,fs:s,options:{suppressErrors:o}}=e;r.enqueue();try{let a=s.realpathSync(t),l=s.statSync(a);if(l.isDirectory()&&oe(t,a,e))return;n(l,a);}catch(a){if(!o)throw a}};function Bn(t,e){return !t.resolveSymlinks||t.excludeSymlinks?null:e?Fn:Nn}function oe(t,e,n){if(n.options.useRealPaths)return Mn(e,n);let r=dirname(t),s=1;for(;r!==n.root&&s<2;){let o=n.symlinks.get(r);!!o&&(o===e||o.startsWith(e)||e.startsWith(o))?s++:r=dirname(r);}return n.symlinks.set(t,e),s>1}function Mn(t,e){return e.visited.includes(t+e.options.pathSeparator)}var Gn=t=>t.counts,jn=t=>t.groups,Wn=t=>t.paths,Jn=t=>t.paths.slice(0,t.options.maxFiles),Un=(t,e,n)=>(_t(e,n,t.counts,t.options.suppressErrors),null),Vn=(t,e,n)=>(_t(e,n,t.paths,t.options.suppressErrors),null),qn=(t,e,n)=>(_t(e,n,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),Kn=(t,e,n)=>(_t(e,n,t.groups,t.options.suppressErrors),null);function _t(t,e,n,r){e(t&&!r?t:null,n);}function Xn(t,e){let{onlyCounts:n,group:r,maxFiles:s}=t;return n?e?Gn:Un:r?e?jn:Kn:s?e?Jn:qn:e?Wn:Vn}var ae={withFileTypes:true},zn=(t,e,n,r,s)=>{if(t.queue.enqueue(),r<0)return t.queue.dequeue(null,t);let{fs:o}=t;t.visited.push(e),t.counts.directories++,o.readdir(e||".",ae,(a,l=[])=>{s(l,n,r),t.queue.dequeue(t.options.suppressErrors?null:a,t);});},Qn=(t,e,n,r,s)=>{let{fs:o}=t;if(r<0)return;t.visited.push(e),t.counts.directories++;let a=[];try{a=o.readdirSync(e||".",ae);}catch(l){if(!t.options.suppressErrors)throw l}s(a,n,r);};function Yn(t){return t?Qn:zn}var Zn=class{count=0;constructor(t){this.onQueueEmpty=t;}enqueue(){return this.count++,this.count}dequeue(t,e){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,e),t&&(e.controller.abort(),this.onQueueEmpty=void 0));}},tr=class{_files=0;_directories=0;set files(t){this._files=t;}get files(){return this._files}set directories(t){this._directories=t;}get directories(){return this._directories}get dirs(){return this._directories}},er=class{aborted=false;abort(){this.aborted=true;}},ue=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,n){this.isSynchronous=!n,this.callbackInvoker=Xn(e,this.isSynchronous),this.root=It(t,e),this.state={root:dn(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new tr,options:e,queue:new Zn((r,s)=>this.callbackInvoker(s,r,n)),symlinks:new Map,visited:[""].slice(0,0),controller:new er,fs:e.fs||ln},this.joinPath=yn(this.root,e),this.pushDirectory=En(this.root,e),this.pushFile=In(e),this.getArray=On(e),this.groupFiles=Dn(e),this.resolveSymlink=Bn(e,this.isSynchronous),this.walkDirectory=Yn(this.isSynchronous);}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,e,n)=>{let{paths:r,options:{filters:s,resolveSymlinks:o,excludeSymlinks:a,exclude:l,maxFiles:g,signal:b,useRealPaths:R,pathSeparator:x},controller:S}=this.state;if(S.aborted||b&&b.aborted||g&&r.length>g)return;let I=this.getArray(this.state.paths);for(let A=0;A<t.length;++A){let P=t[A];if(P.isFile()||P.isSymbolicLink()&&!o&&!a){let N=this.joinPath(P.name,e);this.pushFile(N,I,this.state.counts,s);}else if(P.isDirectory()){let N=bn(P.name,e,this.state.options.pathSeparator);if(l&&l(P.name,N))continue;this.pushDirectory(N,r,s),this.walkDirectory(this.state,N,N,n-1,this.walk);}else if(this.resolveSymlink&&P.isSymbolicLink()){let N=ie(P.name,e);this.resolveSymlink(N,this.state,(J,y)=>{if(J.isDirectory()){if(y=It(y,this.state.options),l&&l(P.name,R?y:N+x))return;this.walkDirectory(this.state,y,R?y:N+x,n-1,this.walk);}else {y=R?y:N;let U=basename(y),j=It(dirname(y),this.state.options);y=this.joinPath(U,j),this.pushFile(y,I,this.state.counts,s);}});}}this.groupFiles(this.state.groups,e,I);}};function nr(t,e){return new Promise((n,r)=>{ce(t,e,(s,o)=>{if(s)return r(s);n(o);});})}function ce(t,e,n){new ue(t,e,n).start();}function rr(t,e){return new ue(t,e).start()}var ne=class{constructor(t,e){this.root=t,this.options=e;}withPromise(){return nr(this.root,this.options)}withCallback(t){ce(this.root,this.options,t);}sync(){return rr(this.root,this.options)}},le=null;try{ee.resolve("picomatch"),le=ee("picomatch");}catch{}var pe=class{globCache={};options={maxDepth:1/0,suppressErrors:true,pathSeparator:sep,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction;}group(){return this.options.group=true,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=true,this}withRelativePaths(){return this.options.relativePaths=true,this}withDirs(){return this.options.includeDirs=true,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=true,this.options.includeBasePath=true,this}withErrors(){return this.options.suppressErrors=false,this}withSymlinks({resolvePaths:t=true}={}){return this.options.resolveSymlinks=true,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=true,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=true,this.options.includeDirs=true,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=true,this}crawl(t){return new ne(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new ne(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:true})}globWithOptions(t,...e){let n=this.globFunction||le;if(!n)throw new Error("Please specify a glob function to use glob matching.");var r=this.globCache[t.join("\0")];return r||(r=n(t,...e),this.globCache[t.join("\0")]=r),this.options.filters.push(s=>r(s)),this}};var lt=b(He(),1),Kr=Array.isArray,Be=/\\/g,Xr=/^[A-Za-z]:$/,Me=process.platform==="win32",zr=/^(\/?\.\.)+$/;function Qr(t,e={}){let n=t.length,r=Array(n),s=Array(n),o,a;for(o=0;o<n;o++){let l=Ge(t[o]);r[o]=l;let g=l.length,b=Array(g);for(a=0;a<g;a++)b[a]=(0, lt.default)(l[a],e);s[o]=b;}return l=>{let g=l.split("/");if(g[0]===".."&&zr.test(l))return true;for(o=0;o<n;o++){let b=r[o],R=s[o],x=g.length,S=Math.min(x,b.length);for(a=0;a<S;){let I=b[a];if(I.includes("/"))return true;if(!R[a](g[a]))break;if(!e.noglobstar&&I==="**")return true;a++;}if(a===x)return true}return false}}var Yr=/^[A-Z]:\/$/i,Zr=Me?t=>Yr.test(t):t=>t==="/";function De(t,e,n){if(t===e||e.startsWith(`${t}/`)){if(n){let s=t.length+ +!Zr(t);return (o,a)=>o.slice(s,a?-1:void 0)||"."}let r=e.slice(t.length+1);return r?(s,o)=>{if(s===".")return r;let a=`${r}/${s}`;return o?a.slice(0,-1):a}:(s,o)=>o&&s!=="."?s.slice(0,-1):s}return n?r=>posix.relative(t,r)||".":r=>posix.relative(t,`${e}/${r}`)||"."}function ts(t,e){if(e.startsWith(`${t}/`)){let n=e.slice(t.length+1);return r=>`${n}/${r}`}return n=>{let r=posix.relative(t,`${e}/${n}`);return n[n.length-1]==="/"&&r!==""?`${r}/`:r||"."}}function Ne(t){return t.replace(Xr,e=>`${e}/`)}var es={parts:true};function Ge(t){var e;let n=lt.default.scan(t,es);return !((e=n.parts)===null||e===void 0)&&e.length?n.parts:[t]}var ns=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,rs=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,ss=t=>t.replace(ns,"\\$&"),is=t=>t.replace(rs,"\\$&"),os=Me?is:ss;function as(t,e){let n=lt.default.scan(t);return n.isGlob||n.negated}function bt(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t);}function je(t){return typeof t=="string"?[t]:t??[]}var us=/^(\/?\.\.)+/,cs=/\\(?=[()[\]{}!*+?@|])/g;function Wt(t,e,n,r){var s;let o=e.cwd,a=t;t[t.length-1]==="/"&&(a=t.slice(0,-1)),a[a.length-1]!=="*"&&e.expandDirectories&&(a+="/**");let l=os(o);a=isAbsolute(a.replace(cs,""))?posix.relative(l,a):posix.normalize(a);let g=(s=us.exec(a))===null||s===void 0?void 0:s[0],b=Ge(a);if(g){let x=(g.length+1)/3,S=0,I=l.split("/");for(;S<x&&b[S+x]===I[I.length+S-x];)a=a.slice(0,(x-S-1)*3)+a.slice((x-S)*3+b[S+x].length+1)||".",S++;let A=posix.join(o,g.slice(S*3));A[0]!=="."&&n.root.length>A.length&&(n.root=Ne(A),n.depthOffset=-x+S);}if(!r&&n.depthOffset>=0){var R;(R=n.commonPath)!==null&&R!==void 0||(n.commonPath=b);let x=[],S=Math.min(n.commonPath.length,b.length);for(let I=0;I<S;I++){let A=b[I];if(A==="**"&&!b[I+1]){x.pop();break}if(I===b.length-1||A!==n.commonPath[I]||as(A))break;x.push(A);}n.depthOffset=x.length,n.commonPath=x,n.root=Ne(x.length>0?posix.join(o,...x):o);}return a}function ls(t,e,n){let r=[],s=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&s.push(Wt(o,t,n,true));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?r.push(Wt(o,t,n,false)):(o[1]!=="!"||o[2]==="(")&&s.push(Wt(o.slice(1),t,n,true)));return {match:r,ignore:s}}function ps(t,e){let n=t.cwd,r={root:n,depthOffset:0},s=ls(t,e,r);t.debug&&bt("internal processing patterns:",s);let{absolute:o,caseSensitiveMatch:a,debug:l,dot:g,followSymbolicLinks:b,onlyDirectories:R}=t,x=r.root.replace(Be,""),S={dot:g,nobrace:t.braceExpansion===false,nocase:!a,noextglob:t.extglob===false,noglobstar:t.globstar===false,posix:true},I=(0, lt.default)(s.match,S),A=(0, lt.default)(s.ignore,S),P=Qr(s.match,S),N=De(n,x,o),J=o?N:De(n,x,true),y=(M,T)=>{let O=J(T,true);return O!=="."&&!P(O)||A(O)},U;t.deep!==void 0&&(U=Math.round(t.deep-r.depthOffset));let j=new pe({filters:[l?(M,T)=>{let O=N(M,T),E=I(O)&&!A(O);return E&&bt(`matched ${O}`),E}:(M,T)=>{let O=N(M,T);return I(O)&&!A(O)}],exclude:l?(M,T)=>{let O=y(M,T);return bt(`${O?"skipped":"crawling"} ${T}`),O}:y,fs:t.fs,pathSeparator:"/",relativePaths:!o,resolvePaths:o,includeBasePath:o,resolveSymlinks:b,excludeSymlinks:!b,excludeFiles:R,includeDirs:R||!t.onlyFiles,maxDepth:U,signal:t.signal}).crawl(x);return t.debug&&bt("internal properties:",{...r,root:x}),[j,n!==x&&!o&&ts(n,x)]}function fs(t,e){if(e)for(let n=t.length-1;n>=0;n--)t[n]=e(t[n]);return t}var Fe={caseSensitiveMatch:true,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:true,followSymbolicLinks:true,onlyFiles:true};function hs(t){let e=Object.assign({},t);for(let n in Fe)e[n]===void 0&&Object.assign(e,{[n]:Fe[n]});return e.cwd=(e.cwd instanceof URL?fileURLToPath(e.cwd):resolve(e.cwd||process.cwd())).replace(Be,"/"),e.ignore=je(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||readdir,readdirSync:e.fs.readdirSync||readdirSync,realpath:e.fs.realpath||realpath,realpathSync:e.fs.realpathSync||realpathSync,stat:e.fs.stat||stat,statSync:e.fs.statSync||statSync}),e.debug&&bt("globbing with options:",e),e}function ds(t,e={}){var n;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let r=Kr(t)||typeof t=="string",s=je((n=r?t:t.patterns)!==null&&n!==void 0?n:"**/*"),o=hs(r?e:t);return s.length>0?ps(o,s):[]}async function Et(t,e){let[n,r]=ds(t,e);return n?fs(await n.withPromise(),r):[]}var We="1.1.5";var nt=at.default.cyan("(pixi-vn-ink)"),Qe="virtual:pixi-vn-ink",Jt=`\0${Qe}`,bs="manifest.json",Ye=/\[(name|ext|extname|file|path|dir)\]/g,Je="ink";function Ue(t){if(typeof t=="string")return {type:"literal",value:t};if(t instanceof RegExp)return {type:"regexp",source:t.source,flags:t.flags};try{return {type:"zod",schema:toJSONSchema(t)}}catch{return {type:"literal",value:""}}}function st(t){return t.replaceAll("\\","/")}function vt(t){let e=st(t.trim());if(!e)throw new Error("vitePluginInk option `inkGlob` must not be empty.");let n=e.replace(/^\.?\//,"");if(!n||n.startsWith("../"))throw new Error("vitePluginInk option `inkGlob` must be rooted in Vite `root` and cannot escape it.");return n}function Ve(t,e){let n=st(e).split("/"),r=[];for(let s of n)if(!(s==="."||s==="")){if(/[*!?[\]{}()]/.test(s))break;r.push(s);}return L.resolve(t,...r)}function qe(t,e){if(!e)return;let n=e.trim();if(!n)throw new Error("vitePluginInk option `inkJsonOutputPattern` must not be empty.");return L.isAbsolute(n)?L.normalize(n):L.resolve(t,n)}function Ke(t,e,n){if(!n)return L.join(e,bs);let r=n.trim();if(!r)throw new Error("vitePluginInk option `inkJsonManifestPath` must not be empty.");return L.isAbsolute(r)?L.normalize(r):L.resolve(t,r)}function Xe(t){let e=t.search(Ye);if(e===-1)return L.dirname(t);let n=t.slice(0,e).replace(/[\\/]+$/g,"");if(!n)throw new Error("vitePluginInk option `inkJsonOutputPattern` must start with a static directory before placeholders.");return L.normalize(n)}function pt(t,e){let n=L.relative(t,e);return !n.startsWith("..")&&!L.isAbsolute(n)}function ys(t,e,n,r){let s=st(L.relative(n,r)),o=L.posix.parse(s),a=st(L.relative(e,r)),l=L.posix.dirname(a),g=L.posix.dirname(s),b={name:o.name,ext:o.ext.startsWith(".")?o.ext.slice(1):o.ext,extname:o.ext,file:s,path:g==="."?"":`${g}/`,dir:l==="."?"":`${l}/`},R=st(t).replace(Ye,(x,S)=>b[S]??"");return L.normalize(R)}function xs(t,e,n){return pt(n,t)?`/${st(L.relative(n,t))}`:pt(e,t)?st(L.relative(e,t)):st(t)}function Ut(t,e,n$1){let r=n.getUnknownHashtagCommands(t,e);r.forEach(({command:s,line:o})=>{n$1(`Unknown hashtag command "# ${s}": no registered handler matched this command.`,o);}),r.length>0&&n$1(`Hashtag command metadata is available via ${ft}.`);}function Vt(t,e,n$1){n.getHashtagKeySchemaIssues(t,e).forEach(({command:s,line:o,key:a,element:l,message:g})=>{n$1(`Hashtag command "# ${s}": "${a}" section ${l} - ${g}`,o);});}function qt(t,e,n$1){if(e.length===0)return;n.getUnknownDivertTargets(t,e).forEach(({target:s,line:o})=>{n$1(`Divert target "${s}" not found in any known label source.`,o);});}async function Ss(t,e,n$1){let r=e.get(t);return r||(r=(async()=>{try{let s=await fetch(t);if(!s.ok)throw new Error(`HTTP ${s.status} ${s.statusText}`);let o=await s.json();return n.getSchemaValidator(o)}catch(s){n$1(`Could not load/compile JSON schema from "${t}" (${s instanceof Error?s.message:String(s)}). Skipping schema validation.`);return}})(),e.set(t,r)),r}function As(t,e){let n=`# ${t}`;if(!e)return at.default.gray(n);let r=new RegExp(`\\b${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`,"g"),s="",o=0;for(let a of n.matchAll(r)){let l=a.index??o;s+=at.default.gray(n.slice(o,l)),s+=at.default.yellow(a[0]),o=l+a[0].length;}return s+=at.default.gray(n.slice(o)),s}async function _s(t,e,n$1,r){let s=t.$schema;if(!s)return;let o=await Ss(s,n$1,r);if(!o)return;let a=n.validateAgainstJsonSchema(t,o);for(let l of a){let g=l.origin?` \u2014 from ink source:
2
- ${As(l.origin,l.element)}`:"";r(`${e}: ${l.element} - ${l.message}${g}`);}}function ze(t){return new Promise((e,n)=>{let r="";t.on("data",s=>{r+=s.toString();}),t.on("end",()=>e(r)),t.on("error",n);})}function Ze(t){let{inkGlob:e,inkJsonOutputPattern:n$1,inkJsonManifestPath:r,characters:s}=t??{},o$1=!!n$1,a,l$1=[],g=[],b,R,x,S=[],I,A,P,N=new Map,J=async()=>{let h=i.info(),i$1=c.info();l$1=h.map(({name:d,description:_,validation:m,keySchemas:u})=>({name:d,description:_,validation:Ue(m),keySchemas:u})),g=i$1.map(({name:d,description:_,validation:m,type:u})=>({name:d,description:_,validation:Ue(m),type:u}));},y=h=>h?.find(i=>i.name==="vite-plugin-pixi-vn"),U=h=>{let i=h?.find(d=>d.name==="vite-plugin-nqtr");return [y(h)?.api?.contentLoaded,i?.api?.contentLoaded].filter(d=>!!d)},j=async h=>{let i=h?.api;if(!i)return;let d=S,_=JSON.stringify(d);if(_!==I)try{if(d.length===0&&i.clearExternalLabels)await i.clearExternalLabels(Je);else if(i.setExternalLabels)await i.setExternalLabels(Je,d);else return;I=_;}catch(m){let u=m instanceof Error?m:new Error(String(m));a?.logger.error(`${nt} Failed to sync Ink labels with vite-plugin-pixi-vn.`,{error:u,timestamp:true});}},M=h=>{if(!o$1||!R)return false;let i=L.resolve(h);return x&&i===x?true:pt(R,i)},T=()=>{P!==void 0&&clearTimeout(P),P=setTimeout(()=>{P=void 0,E().then(async()=>{await j(y(A?.config.plugins));let h=A?.moduleGraph.getModuleById(Jt);h&&A?.moduleGraph.invalidateModule(h),A?.ws.send({type:"custom",event:"ink-updated",data:{inkJson:o$1?b??[]:void 0}});}).catch(h=>{let i=h instanceof Error?h:new Error(String(h));a?.logger.error(`${nt} Failed to re-export Ink JSON files after characters update.`,{error:i,timestamp:true});});},150);},O=async()=>{if(!a||!e)return [];let h=vt(e),i=await Et(h,{absolute:true,cwd:a.root,onlyFiles:true}),d=[];for(let _ of i)try{let m=await et.readFile(_,"utf-8"),u=o(m,{characters:s??[]});u&&d.push(...Object.keys(u.labels??{}));}catch{}return Array.from(new Set(d)).sort((_,m)=>_.localeCompare(m))},E=async()=>{if(!a||!e){b=void 0,S=[];return}let h=qe(a.root,n$1);if(!h){b=void 0,S=[],R=void 0,x=void 0;return}let i=vt(e),d=Xe(h);R=L.resolve(d);let _=Ve(a.root,i);if(!pt(a.root,_))throw new Error("vitePluginInk option `inkGlob` must be rooted in Vite `root` and cannot escape it.");let m=await Et(i,{absolute:true,cwd:a.root,onlyFiles:true}),u=[],c=[],F=new Set,v=y(a.plugins)?.api?.characters??[],C=[...s??[],...v];await et.mkdir(d,{recursive:true});let q=new Map;for(let H of m){let z=await et.readFile(H,"utf-8");q.set(H,z);let p;try{p=o(z,{characters:C});}catch(f){let k=f instanceof Error?f:new Error(String(f));a.logger.error(`${nt} Failed to convert "${H}" to JSON.`,{error:k,timestamp:true});continue}let w=ys(h,a.root,_,H);if(!pt(d,w)){a.logger.error(`${nt} Output path "${w}" escapes managed directory "${d}".`,{timestamp:true});continue}if(F.add(w),!p){await et.rm(w,{force:true});continue}c.push(p),await et.mkdir(L.dirname(w),{recursive:true}),await et.writeFile(w,`${JSON.stringify(p,null,2)}
3
- `,"utf-8"),u.push(xs(w,a.root,a.publicDir)),await _s(p,H,N,f=>a.logger.warn(`${nt} ${f}`,{timestamp:true}));}let V=Ke(a.root,d,r);x=L.resolve(V);let Q=await Et("**/*.json",{absolute:true,cwd:d,onlyFiles:true});for(let H of Q)L.resolve(H)!==L.resolve(V)&&!F.has(H)&&await et.rm(H,{force:true});u.sort((H,z)=>H.localeCompare(z)),b=c;let yt=c.flatMap(H=>Object.keys(H.labels??{}));S=Array.from(new Set(yt)).sort((H,z)=>H.localeCompare(z));let ut=yt.length,Y=y(a.plugins)?.api?.labels??[],$=[...S,...Y];for(let[H,z]of q)Ut(z,l$1,(p,w)=>a.logger.warn(`${w!==void 0?`${H}:${w}`:H}: ${p}`,{timestamp:true})),Vt(z,l$1,(p,w)=>a.logger.warn(`${w!==void 0?`${H}:${w}`:H}: ${p}`,{timestamp:true})),qt(z,$,(p,w)=>a.logger.warn(`${w!==void 0?`${H}:${w}`:H}: ${p}`,{timestamp:true}));a.logger.info(`${nt} ${at.default.dim(`${m.length} file(s) exported: ${ut} label(s), ${l$1.length} hashtag-command(s), ${g.length} text-replace(s)`)}`,{timestamp:true}),await et.mkdir(L.dirname(V),{recursive:true}),await et.writeFile(V,`${JSON.stringify(u,null,2)}
4
- `,"utf-8");};return {name:"vite-plugin-ink",enforce:"pre",configResolved(h){a=h,R=void 0,x=void 0;let i=e?vt(e):void 0;if(i){let d=Ve(h.root,i);if(!pt(h.root,d))throw new Error("vitePluginInk option `inkGlob` must be rooted in Vite `root` and cannot escape it.")}if(n$1&&!e)throw new Error("vitePluginInk option `inkJsonOutputPattern` requires `inkGlob` to be set.");if(n$1){let d=qe(h.root,n$1);if(!d)return;let _=Xe(d);if(R=L.resolve(_),x=L.resolve(Ke(h.root,_,r)),L.resolve(_)===L.resolve(h.root))throw new Error("vitePluginInk option `inkJsonOutputPattern` must target a directory different from Vite `root`.")}},async buildStart(){let h=y(a?.plugins);S=await O(),await j(h),await Promise.all(U(a?.plugins)),await J(),await E(),await j(h);},configureServer(h){A=h,h.middlewares.use(async(_,m,u)=>{let c=_.url,F=_.method;if(c===ft){if(F==="GET"){m.setHeader("Content-Type","application/json"),m.end(JSON.stringify(l$1));return}if(F==="POST"){try{let v=await ze(_);l$1=JSON.parse(v),m.statusCode=204,m.end();}catch(v){a?.logger.warn(`${nt} Invalid JSON body for POST ${ft}: ${String(v)}`,{timestamp:true}),m.statusCode=400,m.end();}return}}if(c===kt&&F==="GET"){m.setHeader("Content-Type","application/json");let v={version:We,schemaUrl:l};m.end(JSON.stringify(v));return}if(c===xt){if(F==="GET"){m.setHeader("Content-Type","application/json"),m.end(JSON.stringify(g));return}if(F==="POST"){try{let v=await ze(_);g=JSON.parse(v),m.statusCode=204,m.end();}catch(v){a?.logger.warn(`${nt} Invalid JSON body for POST ${xt}: ${String(v)}`,{timestamp:true}),m.statusCode=400,m.end();}return}}u();});let i=y(h.config.plugins);Promise.all(U(h.config.plugins)).then(async()=>{await J(),await E(),await j(i);}).catch(_=>{let m=_ instanceof Error?_:new Error(String(_));a?.logger.error(`${nt} Failed to export Ink JSON files during server initialization or restart.`,{error:m,timestamp:true});});let d=i?.api?.onReload;d&&d(()=>{J().then(()=>T());});},resolveId(h){if(h===Qe)return Jt},load(h){if(h===Jt){if(!e)return ["export const inkJsons = undefined;","export default [];"].join(`
5
- `);let i=vt(e);return [`const modules = import.meta.glob(${JSON.stringify(`/${i}`)}, { eager: true, import: 'default' });`,`export const inkJsons = ${JSON.stringify(o$1?b??[]:void 0)};`,"export default Object.values(modules);"].join(`
6
- `)}},hotUpdate:{order:"post",async handler({type:h,file:i,server:d,read:_}){if(i.endsWith(".ink")){if(h!=="delete"){let m=await _(),{issues:u}=n.compile(m),c;u.forEach(({line:v,message:C,type:q})=>{q===Kt.ErrorType.Warning?d.config.logger.warn(`${i}:${v} ${C}`,{timestamp:true}):(d.config.logger.error(`${i}:${v} ${C}`,{timestamp:true}),c=C);}),Ut(m,l$1,(v,C)=>d.config.logger.warn(`${C!==void 0?`${i}:${C}`:i}: ${v}`,{timestamp:true})),Vt(m,l$1,(v,C)=>d.config.logger.warn(`${C!==void 0?`${i}:${C}`:i}: ${v}`,{timestamp:true}));let F=y(d.config.plugins)?.api?.labels??[];qt(m,[...S,...F],(v,C)=>d.config.logger.warn(`${C!==void 0?`${i}:${C}`:i}: ${v}`,{timestamp:true})),await E(),await j(y(d.config.plugins)),c?d.ws.send({type:"error",err:{message:c,stack:i,plugin:"vite-plugin-ink"}}):(d.ws.send({type:"custom",event:"ink-error-cleared",data:{}}),d.ws.send({type:"custom",event:"ink-updated",data:{inkText:m,inkJson:o$1?b??[]:void 0}}));}else await E(),await j(y(d.config.plugins)),d.ws.send({type:"custom",event:"ink-updated",data:{inkJson:o$1?b??[]:void 0}});return []}if(i.endsWith(".json")&&M(i))return await j(y(d.config.plugins)),d.ws.send({type:"custom",event:"ink-updated",data:{inkJson:b??[]}}),[]}},async transform(h,i){if(!i.endsWith(".ink"))return null;let d=await et.readFile(i,"utf-8"),{issues:_}=n.compile(d);_.forEach(({line:u,message:c,type:F})=>{F===Kt.ErrorType.Warning?this.warn(`${i}:${u} ${c}`):this.error(`${i}:${u} ${c}`);}),Ut(d,l$1,(u,c)=>this.warn({message:u,loc:c!==void 0?{line:c,column:0}:void 0})),Vt(d,l$1,(u,c)=>this.warn({message:u,loc:c!==void 0?{line:c,column:0}:void 0}));let m=y(a?.plugins)?.api?.labels??[];return qt(d,[...S,...m],(u,c)=>this.warn({message:u,loc:c!==void 0?{line:c,column:0}:void 0})),{code:`export default ${JSON.stringify(d)};`,map:null}}}}export{ft as INK_DEV_API_HASHTAG_COMMANDS,kt as INK_DEV_API_INFO,xt as INK_DEV_API_TEXT_REPLACES,Ze as noHmrInkPlugin,Ze as vitePluginInk};
1
+ import {a,b,m,n,l,i,c,o}from'./chunk-OUJBCOTD.mjs';import et from'fs/promises';import L,{resolve,posix,sep,isAbsolute,basename,dirname,normalize,relative}from'path';import*as ln from'fs';import {statSync,stat,realpathSync,realpath,readdirSync,readdir}from'fs';import {fileURLToPath}from'url';import {createRequire}from'module';import {toJSONSchema}from'zod';var te=a((Rs,Ct)=>{var vt=process||{},Yt=vt.argv||[],St=vt.env||{},en=!(St.NO_COLOR||Yt.includes("--no-color"))&&(!!St.FORCE_COLOR||Yt.includes("--color")||vt.platform==="win32"||(vt.stdout||{}).isTTY&&St.TERM!=="dumb"||!!St.CI),nn=(t,e,n=t)=>r=>{let s=""+r,o=s.indexOf(e,t.length);return ~o?t+rn(s,e,n,o)+e:t+s+e},rn=(t,e,n,r)=>{let s="",o=0;do s+=t.substring(o,r)+n,o=r+e.length,r=t.indexOf(e,o);while(~r);return s+t.substring(o)},Zt=(t=en)=>{let e=t?nn:()=>String;return {isColorSupported:t,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};Ct.exports=Zt();Ct.exports.createColors=Zt;});var ht=a((Ts,me)=>{var fe="[^\\\\/]",sr="(?=.)",he="[^/]",Lt="(?:\\/|$)",de="(?:^|\\/)",Ot=`\\.{1,2}${Lt}`,ir="(?!\\.)",or=`(?!${de}${Ot})`,ar=`(?!\\.{0,1}${Lt})`,ur=`(?!${Ot})`,cr="[^.\\/]",lr=`${he}*?`,pr="/",ge={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:sr,QMARK:he,END_ANCHOR:Lt,DOTS_SLASH:Ot,NO_DOT:ir,NO_DOTS:or,NO_DOT_SLASH:ar,NO_DOTS_SLASH:ur,QMARK_NO_DOT:cr,STAR:lr,START_ANCHOR:de,SEP:pr},fr={...ge,SLASH_LITERAL:"[\\\\/]",QMARK:fe,STAR:`${fe}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},hr={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};me.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:hr,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return {"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===true?fr:ge}};});var dt=a(K=>{var{REGEX_BACKSLASH:dr,REGEX_REMOVE_BACKSLASH:gr,REGEX_SPECIAL_CHARS:mr,REGEX_SPECIAL_CHARS_GLOBAL:br}=ht();K.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);K.hasRegexChars=t=>mr.test(t);K.isRegexChar=t=>t.length===1&&K.hasRegexChars(t);K.escapeRegex=t=>t.replace(br,"\\$1");K.toPosixSlashes=t=>t.replace(dr,"/");K.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":false};K.removeBackslashes=t=>t.replace(gr,e=>e==="\\"?"":e);K.escapeLast=(t,e,n)=>{let r=t.lastIndexOf(e,n);return r===-1?t:t[r-1]==="\\"?K.escapeLast(t,e,r-1):`${t.slice(0,r)}\\${t.slice(r)}`};K.removePrefix=(t,e={})=>{let n=t;return n.startsWith("./")&&(n=n.slice(2),e.prefix="./"),n};K.wrapOutput=(t,e={},n={})=>{let r=n.contains?"":"^",s=n.contains?"":"$",o=`${r}(?:${t})${s}`;return e.negated===true&&(o=`(?:^(?!${o}).*$)`),o};K.basename=(t,{windows:e}={})=>{let n=t.split(e?/[\\/]/:"/"),r=n[n.length-1];return r===""?n[n.length-2]:r};});var Re=a((Ds,_e)=>{var be=dt(),{CHAR_ASTERISK:Tt,CHAR_AT:yr,CHAR_BACKWARD_SLASH:gt,CHAR_COMMA:xr,CHAR_DOT:Ht,CHAR_EXCLAMATION_MARK:Dt,CHAR_FORWARD_SLASH:Ae,CHAR_LEFT_CURLY_BRACE:Nt,CHAR_LEFT_PARENTHESES:Ft,CHAR_LEFT_SQUARE_BRACKET:Sr,CHAR_PLUS:vr,CHAR_QUESTION_MARK:ye,CHAR_RIGHT_CURLY_BRACE:Ar,CHAR_RIGHT_PARENTHESES:xe,CHAR_RIGHT_SQUARE_BRACKET:_r}=ht(),Se=t=>t===Ae||t===gt,ve=t=>{t.isPrefix!==true&&(t.depth=t.isGlobstar?1/0:1);},Rr=(t,e)=>{let n=e||{},r=t.length-1,s=n.parts===true||n.scanToEnd===true,o=[],a=[],l=[],g=t,b=-1,_=0,x=0,S=false,I=false,v=false,P=false,N=false,J=false,y=false,U=false,j=false,M=false,T=0,O,R,h={value:"",depth:0,isGlob:false},i=()=>b>=r,d=()=>g.charCodeAt(b+1),A=()=>(O=R,g.charCodeAt(++b));for(;b<r;){R=A();let E;if(R===gt){y=h.backslashes=true,R=A(),R===Nt&&(J=true);continue}if(J===true||R===Nt){for(T++;i()!==true&&(R=A());){if(R===gt){y=h.backslashes=true,A();continue}if(R===Nt){T++;continue}if(J!==true&&R===Ht&&(R=A())===Ht){if(S=h.isBrace=true,v=h.isGlob=true,M=true,s===true)continue;break}if(J!==true&&R===xr){if(S=h.isBrace=true,v=h.isGlob=true,M=true,s===true)continue;break}if(R===Ar&&(T--,T===0)){J=false,S=h.isBrace=true,M=true;break}}if(s===true)continue;break}if(R===Ae){if(o.push(b),a.push(h),h={value:"",depth:0,isGlob:false},M===true)continue;if(O===Ht&&b===_+1){_+=2;continue}x=b+1;continue}if(n.noext!==true&&(R===vr||R===yr||R===Tt||R===ye||R===Dt)===true&&d()===Ft){if(v=h.isGlob=true,P=h.isExtglob=true,M=true,R===Dt&&b===_&&(j=true),s===true){for(;i()!==true&&(R=A());){if(R===gt){y=h.backslashes=true,R=A();continue}if(R===xe){v=h.isGlob=true,M=true;break}}continue}break}if(R===Tt){if(O===Tt&&(N=h.isGlobstar=true),v=h.isGlob=true,M=true,s===true)continue;break}if(R===ye){if(v=h.isGlob=true,M=true,s===true)continue;break}if(R===Sr){for(;i()!==true&&(E=A());){if(E===gt){y=h.backslashes=true,A();continue}if(E===_r){I=h.isBracket=true,v=h.isGlob=true,M=true;break}}if(s===true)continue;break}if(n.nonegate!==true&&R===Dt&&b===_){U=h.negated=true,_++;continue}if(n.noparen!==true&&R===Ft){if(v=h.isGlob=true,s===true){for(;i()!==true&&(R=A());){if(R===Ft){y=h.backslashes=true,R=A();continue}if(R===xe){M=true;break}}continue}break}if(v===true){if(M=true,s===true)continue;break}}n.noext===true&&(P=false,v=false);let m=g,u="",c="";_>0&&(u=g.slice(0,_),g=g.slice(_),x-=_),m&&v===true&&x>0?(m=g.slice(0,x),c=g.slice(x)):v===true?(m="",c=g):m=g,m&&m!==""&&m!=="/"&&m!==g&&Se(m.charCodeAt(m.length-1))&&(m=m.slice(0,-1)),n.unescape===true&&(c&&(c=be.removeBackslashes(c)),m&&y===true&&(m=be.removeBackslashes(m)));let F={prefix:u,input:t,start:_,base:m,glob:c,isBrace:S,isBracket:I,isGlob:v,isExtglob:P,isGlobstar:N,negated:U,negatedExtglob:j};if(n.tokens===true&&(F.maxDepth=0,Se(R)||a.push(h),F.tokens=a),n.parts===true||n.tokens===true){let E;for(let C=0;C<o.length;C++){let q=E?E+1:_,V=o[C],Q=t.slice(q,V);n.tokens&&(C===0&&_!==0?(a[C].isPrefix=true,a[C].value=u):a[C].value=Q,ve(a[C]),F.maxDepth+=a[C].depth),(C!==0||Q!=="")&&l.push(Q),E=V;}if(E&&E+1<t.length){let C=t.slice(E+1);l.push(C),n.tokens&&(a[a.length-1].value=C,ve(a[a.length-1]),F.maxDepth+=a[a.length-1].depth);}F.slashes=o,F.parts=l;}return F};_e.exports=Rr;});var ke=a((Ns,$e)=>{var mt=ht(),X=dt(),{MAX_LENGTH:_t,POSIX_REGEX_SOURCE:Er,REGEX_NON_SPECIAL_CHARS:wr,REGEX_SPECIAL_CHARS_BACKREF:$r,REPLACEMENTS:Ee}=mt,kr=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let n=`[${t.join("-")}]`;try{new RegExp(n);}catch{return t.map(s=>X.escapeRegex(s)).join("..")}return n},ct=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,we=t=>{let e=[],n=0,r=0,s=0,o="",a=false;for(let l of t){if(a===true){o+=l,a=false;continue}if(l==="\\"){o+=l,a=true;continue}if(l==='"'){s=s===1?0:1,o+=l;continue}if(s===0){if(l==="[")n++;else if(l==="]"&&n>0)n--;else if(n===0){if(l==="(")r++;else if(l===")"&&r>0)r--;else if(l==="|"&&r===0){e.push(o),o="";continue}}}o+=l;}return e.push(o),e},Cr=t=>{let e=false;for(let n of t){if(e===true){e=false;continue}if(n==="\\"){e=true;continue}if(/[?*+@!()[\]{}]/.test(n))return false}return true},Mt=t=>{let e=t.trim(),n=true;for(;n===true;)n=false,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),n=true);if(Cr(e))return e.replace(/\\(.)/g,"$1")},Ir=t=>{let e=t.map(Mt).filter(Boolean);for(let n=0;n<e.length;n++)for(let r=n+1;r<e.length;r++){let s=e[n],o=e[r],a=s[0];if(!(!a||s!==a.repeat(s.length)||o!==a.repeat(o.length))&&(s===o||s.startsWith(o)||o.startsWith(s)))return true}return false},Bt=(t,e=true)=>{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let n=0,r=0,s=0,o=false;for(let a=1;a<t.length;a++){let l=t[a];if(o===true){o=false;continue}if(l==="\\"){o=true;continue}if(l==='"'){s=s===1?0:1;continue}if(s!==1){if(l==="["){n++;continue}if(l==="]"&&n>0){n--;continue}if(!(n>0)){if(l==="("){r++;continue}if(l===")"&&(r--,r===0))return e===true&&a!==t.length-1?void 0:{type:t[0],body:t.slice(2,a),end:a}}}}},Pr=t=>`${t.length===1?X.escapeRegex(t[0]):`[${t.map(n=>X.escapeRegex(n)).join("")}]`}*`,Lr=t=>{let e=0,n=[];for(;e<t.length;){let r=Bt(t.slice(e),false);if(!r||r.type!=="*")return;let s=we(r.body).map(a=>a.trim());if(s.length!==1)return;let o=Mt(s[0]);if(!o||o.length!==1)return;n.push(o),e+=r.end+1;}if(!(n.length<1))return n},Or=t=>{let e=0,n=t.trim(),r=Bt(n);for(;r;)e++,n=r.body.trim(),r=Bt(n);return e},Tr=(t,e)=>{if(e.maxExtglobRecursion===false)return {risky:false};let n=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:mt.DEFAULT_MAX_EXTGLOB_RECURSION,r=we(t).map(l=>l.trim());if(r.length>1&&(r.some(l=>l==="")||r.some(l=>/^[*?]+$/.test(l))||Ir(r)))return {risky:true};let s=[],o=false,a=true;for(let l of r){let g=Lr(l);if(g){o=true,s.push(...g);continue}let b=Mt(l);if(b&&b.length===1){s.push(b);continue}if(a=false,Or(l)>n)return {risky:true}}return o?a?{risky:true,safeOutput:Pr([...new Set(s)])}:{risky:true}:{risky:false}},Gt=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=Ee[t]||t;let n={...e},r=typeof n.maxLength=="number"?Math.min(_t,n.maxLength):_t,s=t.length;if(s>r)throw new SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${r}`);let o={type:"bos",value:"",output:n.prepend||""},a=[o],l=n.capture?"":"?:",g=mt.globChars(n.windows),b=mt.extglobChars(g),{DOT_LITERAL:_,PLUS_LITERAL:x,SLASH_LITERAL:S,ONE_CHAR:I,DOTS_SLASH:v,NO_DOT:P,NO_DOT_SLASH:N,NO_DOTS_SLASH:J,QMARK:y,QMARK_NO_DOT:U,STAR:j,START_ANCHOR:M}=g,T=p=>`(${l}(?:(?!${M}${p.dot?v:_}).)*?)`,O=n.dot?"":P,R=n.dot?y:U,h=n.bash===true?T(n):j;n.capture&&(h=`(${h})`),typeof n.noext=="boolean"&&(n.noextglob=n.noext);let i={input:t,index:-1,start:0,dot:n.dot===true,consumed:"",output:"",prefix:"",backtrack:false,negated:false,brackets:0,braces:0,parens:0,quotes:0,globstar:false,tokens:a};t=X.removePrefix(t,i),s=t.length;let d=[],A=[],m=[],u=o,c,F=()=>i.index===s-1,E=i.peek=(p=1)=>t[i.index+p],C=i.advance=()=>t[++i.index]||"",q=()=>t.slice(i.index+1),V=(p="",w=0)=>{i.consumed+=p,i.index+=w;},Q=p=>{i.output+=p.output!=null?p.output:p.value,V(p.value);},yt=()=>{let p=1;for(;E()==="!"&&(E(2)!=="("||E(3)==="?");)C(),i.start++,p++;return p%2===0?false:(i.negated=true,i.start++,true)},ut=p=>{i[p]++,m.push(p);},Y=p=>{i[p]--,m.pop();},$=p=>{if(u.type==="globstar"){let w=i.braces>0&&(p.type==="comma"||p.type==="brace"),f=p.extglob===true||d.length&&(p.type==="pipe"||p.type==="paren");p.type!=="slash"&&p.type!=="paren"&&!w&&!f&&(i.output=i.output.slice(0,-u.output.length),u.type="star",u.value="*",u.output=h,i.output+=u.output);}if(d.length&&p.type!=="paren"&&(d[d.length-1].inner+=p.value),(p.value||p.output)&&Q(p),u&&u.type==="text"&&p.type==="text"){u.output=(u.output||u.value)+p.value,u.value+=p.value;return}p.prev=u,a.push(p),u=p;},H=(p,w)=>{let f={...b[w],conditions:1,inner:""};f.prev=u,f.parens=i.parens,f.output=i.output,f.startIndex=i.index,f.tokensIndex=a.length;let k=(n.capture?"(":"")+f.open;ut("parens"),$({type:p,value:w,output:i.output?"":I}),$({type:"paren",extglob:true,value:C(),output:k}),d.push(f);},z=p=>{let w=t.slice(p.startIndex,i.index+1),f=t.slice(p.startIndex+2,i.index),k=Tr(f,n);if((p.type==="plus"||p.type==="star")&&k.risky){let D=k.safeOutput?(p.output?"":I)+(n.capture?`(${k.safeOutput})`:k.safeOutput):void 0,Z=a[p.tokensIndex];Z.type="text",Z.value=w,Z.output=D||X.escapeRegex(w);for(let tt=p.tokensIndex+1;tt<a.length;tt++)a[tt].value="",a[tt].output="",delete a[tt].suffix;i.output=p.output+Z.output,i.backtrack=true,$({type:"paren",extglob:true,value:c,output:""}),Y("parens");return}let B=p.close+(n.capture?")":""),W;if(p.type==="negate"){let D=h;if(p.inner&&p.inner.length>1&&p.inner.includes("/")&&(D=T(n)),(D!==h||F()||/^\)+$/.test(q()))&&(B=p.close=`)$))${D}`),p.inner.includes("*")&&(W=q())&&/^\.[^\\/.]+$/.test(W)){let Z=Gt(W,{...e,fastpaths:false}).output;B=p.close=`)${Z})${D})`;}p.prev.type==="bos"&&(i.negatedExtglob=true);}$({type:"paren",extglob:true,value:c,output:B}),Y("parens");};if(n.fastpaths!==false&&!/(^[*!]|[/()[\]{}"])/.test(t)){let p=false,w=t.replace($r,(f,k,B,W,D,Z)=>W==="\\"?(p=true,f):W==="?"?k?k+W+(D?y.repeat(D.length):""):Z===0?R+(D?y.repeat(D.length):""):y.repeat(B.length):W==="."?_.repeat(B.length):W==="*"?k?k+W+(D?h:""):h:k?f:`\\${f}`);return p===true&&(n.unescape===true?w=w.replace(/\\/g,""):w=w.replace(/\\+/g,f=>f.length%2===0?"\\\\":f?"\\":"")),w===t&&n.contains===true?(i.output=t,i):(i.output=X.wrapOutput(w,i,e),i)}for(;!F();){if(c=C(),c==="\0")continue;if(c==="\\"){let f=E();if(f==="/"&&n.bash!==true||f==="."||f===";")continue;if(!f){c+="\\",$({type:"text",value:c});continue}let k=/^\\+/.exec(q()),B=0;if(k&&k[0].length>2&&(B=k[0].length,i.index+=B,B%2!==0&&(c+="\\")),n.unescape===true?c=C():c+=C(),i.brackets===0){$({type:"text",value:c});continue}}if(i.brackets>0&&(c!=="]"||u.value==="["||u.value==="[^")){if(n.posix!==false&&c===":"){let f=u.value.slice(1);if(f.includes("[")&&(u.posix=true,f.includes(":"))){let k=u.value.lastIndexOf("["),B=u.value.slice(0,k),W=u.value.slice(k+2),D=Er[W];if(D){u.value=B+D,i.backtrack=true,C(),!o.output&&a.indexOf(u)===1&&(o.output=I);continue}}}(c==="["&&E()!==":"||c==="-"&&E()==="]")&&(c=`\\${c}`),c==="]"&&(u.value==="["||u.value==="[^")&&(c=`\\${c}`),n.posix===true&&c==="!"&&u.value==="["&&(c="^"),u.value+=c,Q({value:c});continue}if(i.quotes===1&&c!=='"'){c=X.escapeRegex(c),u.value+=c,Q({value:c});continue}if(c==='"'){i.quotes=i.quotes===1?0:1,n.keepQuotes===true&&$({type:"text",value:c});continue}if(c==="("){ut("parens"),$({type:"paren",value:c});continue}if(c===")"){if(i.parens===0&&n.strictBrackets===true)throw new SyntaxError(ct("opening","("));let f=d[d.length-1];if(f&&i.parens===f.parens+1){z(d.pop());continue}$({type:"paren",value:c,output:i.parens?")":"\\)"}),Y("parens");continue}if(c==="["){if(n.nobracket===true||!q().includes("]")){if(n.nobracket!==true&&n.strictBrackets===true)throw new SyntaxError(ct("closing","]"));c=`\\${c}`;}else ut("brackets");$({type:"bracket",value:c});continue}if(c==="]"){if(n.nobracket===true||u&&u.type==="bracket"&&u.value.length===1){$({type:"text",value:c,output:`\\${c}`});continue}if(i.brackets===0){if(n.strictBrackets===true)throw new SyntaxError(ct("opening","["));$({type:"text",value:c,output:`\\${c}`});continue}Y("brackets");let f=u.value.slice(1);if(u.posix!==true&&f[0]==="^"&&!f.includes("/")&&(c=`/${c}`),u.value+=c,Q({value:c}),n.literalBrackets===false||X.hasRegexChars(f))continue;let k=X.escapeRegex(u.value);if(i.output=i.output.slice(0,-u.value.length),n.literalBrackets===true){i.output+=k,u.value=k;continue}u.value=`(${l}${k}|${u.value})`,i.output+=u.value;continue}if(c==="{"&&n.nobrace!==true){ut("braces");let f={type:"brace",value:c,output:"(",outputIndex:i.output.length,tokensIndex:i.tokens.length};A.push(f),$(f);continue}if(c==="}"){let f=A[A.length-1];if(n.nobrace===true||!f){$({type:"text",value:c,output:c});continue}let k=")";if(f.dots===true){let B=a.slice(),W=[];for(let D=B.length-1;D>=0&&(a.pop(),B[D].type!=="brace");D--)B[D].type!=="dots"&&W.unshift(B[D].value);k=kr(W,n),i.backtrack=true;}if(f.comma!==true&&f.dots!==true){let B=i.output.slice(0,f.outputIndex),W=i.tokens.slice(f.tokensIndex);f.value=f.output="\\{",c=k="\\}",i.output=B;for(let D of W)i.output+=D.output||D.value;}$({type:"brace",value:c,output:k}),Y("braces"),A.pop();continue}if(c==="|"){d.length>0&&d[d.length-1].conditions++,$({type:"text",value:c});continue}if(c===","){let f=c,k=A[A.length-1];k&&m[m.length-1]==="braces"&&(k.comma=true,f="|"),$({type:"comma",value:c,output:f});continue}if(c==="/"){if(u.type==="dot"&&i.index===i.start+1){i.start=i.index+1,i.consumed="",i.output="",a.pop(),u=o;continue}$({type:"slash",value:c,output:S});continue}if(c==="."){if(i.braces>0&&u.type==="dot"){u.value==="."&&(u.output=_);let f=A[A.length-1];u.type="dots",u.output+=c,u.value+=c,f.dots=true;continue}if(i.braces+i.parens===0&&u.type!=="bos"&&u.type!=="slash"){$({type:"text",value:c,output:_});continue}$({type:"dot",value:c,output:_});continue}if(c==="?"){if(!(u&&u.value==="(")&&n.noextglob!==true&&E()==="("&&E(2)!=="?"){H("qmark",c);continue}if(u&&u.type==="paren"){let k=E(),B=c;(u.value==="("&&!/[!=<:]/.test(k)||k==="<"&&!/<([!=]|\w+>)/.test(q()))&&(B=`\\${c}`),$({type:"text",value:c,output:B});continue}if(n.dot!==true&&(u.type==="slash"||u.type==="bos")){$({type:"qmark",value:c,output:U});continue}$({type:"qmark",value:c,output:y});continue}if(c==="!"){if(n.noextglob!==true&&E()==="("&&(E(2)!=="?"||!/[!=<:]/.test(E(3)))){H("negate",c);continue}if(n.nonegate!==true&&i.index===0){yt();continue}}if(c==="+"){if(n.noextglob!==true&&E()==="("&&E(2)!=="?"){H("plus",c);continue}if(u&&u.value==="("||n.regex===false){$({type:"plus",value:c,output:x});continue}if(u&&(u.type==="bracket"||u.type==="paren"||u.type==="brace")||i.parens>0){$({type:"plus",value:c});continue}$({type:"plus",value:x});continue}if(c==="@"){if(n.noextglob!==true&&E()==="("&&E(2)!=="?"){$({type:"at",extglob:true,value:c,output:""});continue}$({type:"text",value:c});continue}if(c!=="*"){(c==="$"||c==="^")&&(c=`\\${c}`);let f=wr.exec(q());f&&(c+=f[0],i.index+=f[0].length),$({type:"text",value:c});continue}if(u&&(u.type==="globstar"||u.star===true)){u.type="star",u.star=true,u.value+=c,u.output=h,i.backtrack=true,i.globstar=true,V(c);continue}let p=q();if(n.noextglob!==true&&/^\([^?]/.test(p)){H("star",c);continue}if(u.type==="star"){if(n.noglobstar===true){V(c);continue}let f=u.prev,k=f.prev,B=f.type==="slash"||f.type==="bos",W=k&&(k.type==="star"||k.type==="globstar");if(n.bash===true&&(!B||p[0]&&p[0]!=="/")){$({type:"star",value:c,output:""});continue}let D=i.braces>0&&(f.type==="comma"||f.type==="brace"),Z=d.length&&(f.type==="pipe"||f.type==="paren");if(!B&&f.type!=="paren"&&!D&&!Z){$({type:"star",value:c,output:""});continue}for(;p.slice(0,3)==="/**";){let tt=t[i.index+4];if(tt&&tt!=="/")break;p=p.slice(3),V("/**",3);}if(f.type==="bos"&&F()){u.type="globstar",u.value+=c,u.output=T(n),i.output=u.output,i.globstar=true,V(c);continue}if(f.type==="slash"&&f.prev.type!=="bos"&&!W&&F()){i.output=i.output.slice(0,-(f.output+u.output).length),f.output=`(?:${f.output}`,u.type="globstar",u.output=T(n)+(n.strictSlashes?")":"|$)"),u.value+=c,i.globstar=true,i.output+=f.output+u.output,V(c);continue}if(f.type==="slash"&&f.prev.type!=="bos"&&p[0]==="/"){let tt=p[1]!==void 0?"|$":"";i.output=i.output.slice(0,-(f.output+u.output).length),f.output=`(?:${f.output}`,u.type="globstar",u.output=`${T(n)}${S}|${S}${tt})`,u.value+=c,i.output+=f.output+u.output,i.globstar=true,V(c+C()),$({type:"slash",value:"/",output:""});continue}if(f.type==="bos"&&p[0]==="/"){u.type="globstar",u.value+=c,u.output=`(?:^|${S}|${T(n)}${S})`,i.output=u.output,i.globstar=true,V(c+C()),$({type:"slash",value:"/",output:""});continue}i.output=i.output.slice(0,-u.output.length),u.type="globstar",u.output=T(n),u.value+=c,i.output+=u.output,i.globstar=true,V(c);continue}let w={type:"star",value:c,output:h};if(n.bash===true){w.output=".*?",(u.type==="bos"||u.type==="slash")&&(w.output=O+w.output),$(w);continue}if(u&&(u.type==="bracket"||u.type==="paren")&&n.regex===true){w.output=c,$(w);continue}(i.index===i.start||u.type==="slash"||u.type==="dot")&&(u.type==="dot"?(i.output+=N,u.output+=N):n.dot===true?(i.output+=J,u.output+=J):(i.output+=O,u.output+=O),E()!=="*"&&(i.output+=I,u.output+=I)),$(w);}for(;i.brackets>0;){if(n.strictBrackets===true)throw new SyntaxError(ct("closing","]"));i.output=X.escapeLast(i.output,"["),Y("brackets");}for(;i.parens>0;){if(n.strictBrackets===true)throw new SyntaxError(ct("closing",")"));i.output=X.escapeLast(i.output,"("),Y("parens");}for(;i.braces>0;){if(n.strictBrackets===true)throw new SyntaxError(ct("closing","}"));i.output=X.escapeLast(i.output,"{"),Y("braces");}if(n.strictSlashes!==true&&(u.type==="star"||u.type==="bracket")&&$({type:"maybe_slash",value:"",output:`${S}?`}),i.backtrack===true){i.output="";for(let p of i.tokens)i.output+=p.output!=null?p.output:p.value,p.suffix&&(i.output+=p.suffix);}return i};Gt.fastpaths=(t,e)=>{let n={...e},r=typeof n.maxLength=="number"?Math.min(_t,n.maxLength):_t,s=t.length;if(s>r)throw new SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${r}`);t=Ee[t]||t;let{DOT_LITERAL:o,SLASH_LITERAL:a,ONE_CHAR:l,DOTS_SLASH:g,NO_DOT:b,NO_DOTS:_,NO_DOTS_SLASH:x,STAR:S,START_ANCHOR:I}=mt.globChars(n.windows),v=n.dot?_:b,P=n.dot?x:b,N=n.capture?"":"?:",J={negated:false,prefix:""},y=n.bash===true?".*?":S;n.capture&&(y=`(${y})`);let U=O=>O.noglobstar===true?y:`(${N}(?:(?!${I}${O.dot?g:o}).)*?)`,j=O=>{switch(O){case "*":return `${v}${l}${y}`;case ".*":return `${o}${l}${y}`;case "*.*":return `${v}${y}${o}${l}${y}`;case "*/*":return `${v}${y}${a}${l}${P}${y}`;case "**":return v+U(n);case "**/*":return `(?:${v}${U(n)}${a})?${P}${l}${y}`;case "**/*.*":return `(?:${v}${U(n)}${a})?${P}${y}${o}${l}${y}`;case "**/.*":return `(?:${v}${U(n)}${a})?${o}${l}${y}`;default:{let R=/^(.*?)\.(\w+)$/.exec(O);if(!R)return;let h=j(R[1]);return h?h+o+R[2]:void 0}}},M=X.removePrefix(t,J),T=j(M);return T&&n.strictSlashes!==true&&(T+=`${a}?`),T};$e.exports=Gt;});var Pe=a((Fs,Ie)=>{var Hr=Re(),jt=ke(),Ce=dt(),Dr=ht(),Nr=t=>t&&typeof t=="object"&&!Array.isArray(t),G=(t,e,n=false)=>{if(Array.isArray(t)){let _=t.map(S=>G(S,e,n));return S=>{for(let I of _){let v=I(S);if(v)return v}return false}}let r=Nr(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!r)throw new TypeError("Expected pattern to be a non-empty string");let s=e||{},o=s.windows,a=r?G.compileRe(t,e):G.makeRe(t,e,false,true),l=a.state;delete a.state;let g=()=>false;if(s.ignore){let _={...e,ignore:null,onMatch:null,onResult:null};g=G(s.ignore,_,n);}let b=(_,x=false)=>{let{isMatch:S,match:I,output:v}=G.test(_,a,e,{glob:t,posix:o}),P={glob:t,state:l,regex:a,posix:o,input:_,output:v,match:I,isMatch:S};return typeof s.onResult=="function"&&s.onResult(P),S===false?(P.isMatch=false,x?P:false):g(_)?(typeof s.onIgnore=="function"&&s.onIgnore(P),P.isMatch=false,x?P:false):(typeof s.onMatch=="function"&&s.onMatch(P),x?P:true)};return n&&(b.state=l),b};G.test=(t,e,n,{glob:r,posix:s}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return {isMatch:false,output:""};let o=n||{},a=o.format||(s?Ce.toPosixSlashes:null),l=t===r,g=l&&a?a(t):t;return l===false&&(g=a?a(t):t,l=g===r),(l===false||o.capture===true)&&(o.matchBase===true||o.basename===true?l=G.matchBase(t,e,n,s):l=e.exec(g)),{isMatch:!!l,match:l,output:g}};G.matchBase=(t,e,n,r=n&&n.windows)=>(e instanceof RegExp?e:G.makeRe(e,n)).test(Ce.basename(t,{windows:r}));G.isMatch=(t,e,n)=>G(e,n)(t);G.parse=(t,e)=>Array.isArray(t)?t.map(n=>G.parse(n,e)):jt(t,{...e,fastpaths:false});G.scan=(t,e)=>Hr(t,e);G.compileRe=(t,e,n=false,r=false)=>{if(n===true)return t.output;let s=e||{},o=s.contains?"":"^",a=s.contains?"":"$",l=`${o}(?:${t.output})${a}`;t&&t.negated===true&&(l=`^(?!${l}).*$`);let g=G.toRegex(l,e);return r===true&&(g.state=t),g};G.makeRe=(t,e={},n=false,r=false)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let s={negated:false,fastpaths:true};return e.fastpaths!==false&&(t[0]==="."||t[0]==="*")&&(s.output=jt.fastpaths(t,e)),s.output||(s=jt(t,e)),G.compileRe(s,e,n,r)};G.toRegex=(t,e)=>{try{let n=e||{};return new RegExp(t,n.flags||(n.nocase?"i":""))}catch(n){if(e&&e.debug===true)throw n;return /$^/}};G.constants=Dr;Ie.exports=G;});var He=a((Bs,Te)=>{var Le=Pe(),Fr=dt();function Oe(t,e,n=false){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:Fr.isWindows()}),Le(t,e,n)}Object.assign(Oe,Le);Te.exports=Oe;});var ft="/__pixi-vn-ink/hashtag-commands",xt="/__pixi-vn-ink/text-replaces",kt="/__pixi-vn-ink/info";var Kt=b(m(),1),at=b(te(),1);var ee=createRequire(import.meta.url);function pn(t){let e=normalize(t);return e.length>1&&e[e.length-1]===sep&&(e=e.substring(0,e.length-1)),e}var fn=/[\\/]/g;function se(t,e){return t.replace(fn,e)}var hn=/^[a-z]:[\\/]$/i;function dn(t){return t==="/"||hn.test(t)}function It(t,e){let{resolvePaths:n,normalizePath:r,pathSeparator:s}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(n&&(t=resolve(t)),(r||o)&&(t=pn(t)),t===".")return "";let a=t[t.length-1]!==s;return se(a?t+s:t,s)}function ie(t,e){return e+t}function gn(t,e){return function(n,r){return r.startsWith(t)?r.slice(t.length)+n:se(relative(t,r),e.pathSeparator)+e.pathSeparator+n}}function mn(t){return t}function bn(t,e,n){return e+t+n}function yn(t,e){let{relativePaths:n,includeBasePath:r}=e;return n&&t?gn(t,e):r?ie:mn}function xn(t){return function(e,n){n.push(e.substring(t.length)||".");}}function Sn(t){return function(e,n,r){let s=e.substring(t.length)||".";r.every(o=>o(s,true))&&n.push(s);}}var vn=(t,e)=>{e.push(t||".");},An=(t,e,n)=>{let r=t||".";n.every(s=>s(r,true))&&e.push(r);},_n=()=>{};function Rn(t,e){let{includeDirs:n,filters:r,relativePaths:s}=e;return n?s?r&&r.length?Sn(t):xn(t):r&&r.length?An:vn:_n}var En=(t,e,n,r)=>{r.every(s=>s(t,false))&&n.files++;},wn=(t,e,n,r)=>{r.every(s=>s(t,false))&&e.push(t);},$n=(t,e,n,r)=>{n.files++;},kn=(t,e)=>{e.push(t);},Cn=()=>{};function In(t){let{excludeFiles:e,filters:n,onlyCounts:r}=t;return e?Cn:n&&n.length?r?En:wn:r?$n:kn}var Pn=t=>t,Ln=()=>[""].slice(0,0);function On(t){return t.group?Ln:Pn}var Tn=(t,e,n)=>{t.push({directory:e,files:n,dir:e});},Hn=()=>{};function Dn(t){return t.group?Tn:Hn}var Nn=function(t,e,n){let{queue:r,fs:s,options:{suppressErrors:o}}=e;r.enqueue(),s.realpath(t,(a,l)=>{if(a)return r.dequeue(o?null:a,e);s.stat(l,(g,b)=>{if(g)return r.dequeue(o?null:g,e);if(b.isDirectory()&&oe(t,l,e))return r.dequeue(null,e);n(b,l),r.dequeue(null,e);});});},Fn=function(t,e,n){let{queue:r,fs:s,options:{suppressErrors:o}}=e;r.enqueue();try{let a=s.realpathSync(t),l=s.statSync(a);if(l.isDirectory()&&oe(t,a,e))return;n(l,a);}catch(a){if(!o)throw a}};function Bn(t,e){return !t.resolveSymlinks||t.excludeSymlinks?null:e?Fn:Nn}function oe(t,e,n){if(n.options.useRealPaths)return Mn(e,n);let r=dirname(t),s=1;for(;r!==n.root&&s<2;){let o=n.symlinks.get(r);!!o&&(o===e||o.startsWith(e)||e.startsWith(o))?s++:r=dirname(r);}return n.symlinks.set(t,e),s>1}function Mn(t,e){return e.visited.includes(t+e.options.pathSeparator)}var Gn=t=>t.counts,jn=t=>t.groups,Wn=t=>t.paths,Jn=t=>t.paths.slice(0,t.options.maxFiles),Un=(t,e,n)=>(At(e,n,t.counts,t.options.suppressErrors),null),Vn=(t,e,n)=>(At(e,n,t.paths,t.options.suppressErrors),null),qn=(t,e,n)=>(At(e,n,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),Kn=(t,e,n)=>(At(e,n,t.groups,t.options.suppressErrors),null);function At(t,e,n,r){e(t&&!r?t:null,n);}function Xn(t,e){let{onlyCounts:n,group:r,maxFiles:s}=t;return n?e?Gn:Un:r?e?jn:Kn:s?e?Jn:qn:e?Wn:Vn}var ae={withFileTypes:true},zn=(t,e,n,r,s)=>{if(t.queue.enqueue(),r<0)return t.queue.dequeue(null,t);let{fs:o}=t;t.visited.push(e),t.counts.directories++,o.readdir(e||".",ae,(a,l=[])=>{s(l,n,r),t.queue.dequeue(t.options.suppressErrors?null:a,t);});},Qn=(t,e,n,r,s)=>{let{fs:o}=t;if(r<0)return;t.visited.push(e),t.counts.directories++;let a=[];try{a=o.readdirSync(e||".",ae);}catch(l){if(!t.options.suppressErrors)throw l}s(a,n,r);};function Yn(t){return t?Qn:zn}var Zn=class{count=0;constructor(t){this.onQueueEmpty=t;}enqueue(){return this.count++,this.count}dequeue(t,e){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,e),t&&(e.controller.abort(),this.onQueueEmpty=void 0));}},tr=class{_files=0;_directories=0;set files(t){this._files=t;}get files(){return this._files}set directories(t){this._directories=t;}get directories(){return this._directories}get dirs(){return this._directories}},er=class{aborted=false;abort(){this.aborted=true;}},ue=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,n){this.isSynchronous=!n,this.callbackInvoker=Xn(e,this.isSynchronous),this.root=It(t,e),this.state={root:dn(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new tr,options:e,queue:new Zn((r,s)=>this.callbackInvoker(s,r,n)),symlinks:new Map,visited:[""].slice(0,0),controller:new er,fs:e.fs||ln},this.joinPath=yn(this.root,e),this.pushDirectory=Rn(this.root,e),this.pushFile=In(e),this.getArray=On(e),this.groupFiles=Dn(e),this.resolveSymlink=Bn(e,this.isSynchronous),this.walkDirectory=Yn(this.isSynchronous);}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,e,n)=>{let{paths:r,options:{filters:s,resolveSymlinks:o,excludeSymlinks:a,exclude:l,maxFiles:g,signal:b,useRealPaths:_,pathSeparator:x},controller:S}=this.state;if(S.aborted||b&&b.aborted||g&&r.length>g)return;let I=this.getArray(this.state.paths);for(let v=0;v<t.length;++v){let P=t[v];if(P.isFile()||P.isSymbolicLink()&&!o&&!a){let N=this.joinPath(P.name,e);this.pushFile(N,I,this.state.counts,s);}else if(P.isDirectory()){let N=bn(P.name,e,this.state.options.pathSeparator);if(l&&l(P.name,N))continue;this.pushDirectory(N,r,s),this.walkDirectory(this.state,N,N,n-1,this.walk);}else if(this.resolveSymlink&&P.isSymbolicLink()){let N=ie(P.name,e);this.resolveSymlink(N,this.state,(J,y)=>{if(J.isDirectory()){if(y=It(y,this.state.options),l&&l(P.name,_?y:N+x))return;this.walkDirectory(this.state,y,_?y:N+x,n-1,this.walk);}else {y=_?y:N;let U=basename(y),j=It(dirname(y),this.state.options);y=this.joinPath(U,j),this.pushFile(y,I,this.state.counts,s);}});}}this.groupFiles(this.state.groups,e,I);}};function nr(t,e){return new Promise((n,r)=>{ce(t,e,(s,o)=>{if(s)return r(s);n(o);});})}function ce(t,e,n){new ue(t,e,n).start();}function rr(t,e){return new ue(t,e).start()}var ne=class{constructor(t,e){this.root=t,this.options=e;}withPromise(){return nr(this.root,this.options)}withCallback(t){ce(this.root,this.options,t);}sync(){return rr(this.root,this.options)}},le=null;try{ee.resolve("picomatch"),le=ee("picomatch");}catch{}var pe=class{globCache={};options={maxDepth:1/0,suppressErrors:true,pathSeparator:sep,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction;}group(){return this.options.group=true,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=true,this}withRelativePaths(){return this.options.relativePaths=true,this}withDirs(){return this.options.includeDirs=true,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=true,this.options.includeBasePath=true,this}withErrors(){return this.options.suppressErrors=false,this}withSymlinks({resolvePaths:t=true}={}){return this.options.resolveSymlinks=true,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=true,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=true,this.options.includeDirs=true,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=true,this}crawl(t){return new ne(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new ne(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:true})}globWithOptions(t,...e){let n=this.globFunction||le;if(!n)throw new Error("Please specify a glob function to use glob matching.");var r=this.globCache[t.join("\0")];return r||(r=n(t,...e),this.globCache[t.join("\0")]=r),this.options.filters.push(s=>r(s)),this}};var lt=b(He(),1),Kr=Array.isArray,Be=/\\/g,Xr=/^[A-Za-z]:$/,Me=process.platform==="win32",zr=/^(\/?\.\.)+$/;function Qr(t,e={}){let n=t.length,r=Array(n),s=Array(n),o,a;for(o=0;o<n;o++){let l=Ge(t[o]);r[o]=l;let g=l.length,b=Array(g);for(a=0;a<g;a++)b[a]=(0, lt.default)(l[a],e);s[o]=b;}return l=>{let g=l.split("/");if(g[0]===".."&&zr.test(l))return true;for(o=0;o<n;o++){let b=r[o],_=s[o],x=g.length,S=Math.min(x,b.length);for(a=0;a<S;){let I=b[a];if(I.includes("/"))return true;if(!_[a](g[a]))break;if(!e.noglobstar&&I==="**")return true;a++;}if(a===x)return true}return false}}var Yr=/^[A-Z]:\/$/i,Zr=Me?t=>Yr.test(t):t=>t==="/";function De(t,e,n){if(t===e||e.startsWith(`${t}/`)){if(n){let s=t.length+ +!Zr(t);return (o,a)=>o.slice(s,a?-1:void 0)||"."}let r=e.slice(t.length+1);return r?(s,o)=>{if(s===".")return r;let a=`${r}/${s}`;return o?a.slice(0,-1):a}:(s,o)=>o&&s!=="."?s.slice(0,-1):s}return n?r=>posix.relative(t,r)||".":r=>posix.relative(t,`${e}/${r}`)||"."}function ts(t,e){if(e.startsWith(`${t}/`)){let n=e.slice(t.length+1);return r=>`${n}/${r}`}return n=>{let r=posix.relative(t,`${e}/${n}`);return n[n.length-1]==="/"&&r!==""?`${r}/`:r||"."}}function Ne(t){return t.replace(Xr,e=>`${e}/`)}var es={parts:true};function Ge(t){var e;let n=lt.default.scan(t,es);return !((e=n.parts)===null||e===void 0)&&e.length?n.parts:[t]}var ns=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,rs=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,ss=t=>t.replace(ns,"\\$&"),is=t=>t.replace(rs,"\\$&"),os=Me?is:ss;function as(t,e){let n=lt.default.scan(t);return n.isGlob||n.negated}function bt(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t);}function je(t){return typeof t=="string"?[t]:t??[]}var us=/^(\/?\.\.)+/,cs=/\\(?=[()[\]{}!*+?@|])/g;function Wt(t,e,n,r){var s;let o=e.cwd,a=t;t[t.length-1]==="/"&&(a=t.slice(0,-1)),a[a.length-1]!=="*"&&e.expandDirectories&&(a+="/**");let l=os(o);a=isAbsolute(a.replace(cs,""))?posix.relative(l,a):posix.normalize(a);let g=(s=us.exec(a))===null||s===void 0?void 0:s[0],b=Ge(a);if(g){let x=(g.length+1)/3,S=0,I=l.split("/");for(;S<x&&b[S+x]===I[I.length+S-x];)a=a.slice(0,(x-S-1)*3)+a.slice((x-S)*3+b[S+x].length+1)||".",S++;let v=posix.join(o,g.slice(S*3));v[0]!=="."&&n.root.length>v.length&&(n.root=Ne(v),n.depthOffset=-x+S);}if(!r&&n.depthOffset>=0){var _;(_=n.commonPath)!==null&&_!==void 0||(n.commonPath=b);let x=[],S=Math.min(n.commonPath.length,b.length);for(let I=0;I<S;I++){let v=b[I];if(v==="**"&&!b[I+1]){x.pop();break}if(I===b.length-1||v!==n.commonPath[I]||as(v))break;x.push(v);}n.depthOffset=x.length,n.commonPath=x,n.root=Ne(x.length>0?posix.join(o,...x):o);}return a}function ls(t,e,n){let r=[],s=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&s.push(Wt(o,t,n,true));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?r.push(Wt(o,t,n,false)):(o[1]!=="!"||o[2]==="(")&&s.push(Wt(o.slice(1),t,n,true)));return {match:r,ignore:s}}function ps(t,e){let n=t.cwd,r={root:n,depthOffset:0},s=ls(t,e,r);t.debug&&bt("internal processing patterns:",s);let{absolute:o,caseSensitiveMatch:a,debug:l,dot:g,followSymbolicLinks:b,onlyDirectories:_}=t,x=r.root.replace(Be,""),S={dot:g,nobrace:t.braceExpansion===false,nocase:!a,noextglob:t.extglob===false,noglobstar:t.globstar===false,posix:true},I=(0, lt.default)(s.match,S),v=(0, lt.default)(s.ignore,S),P=Qr(s.match,S),N=De(n,x,o),J=o?N:De(n,x,true),y=(M,T)=>{let O=J(T,true);return O!=="."&&!P(O)||v(O)},U;t.deep!==void 0&&(U=Math.round(t.deep-r.depthOffset));let j=new pe({filters:[l?(M,T)=>{let O=N(M,T),R=I(O)&&!v(O);return R&&bt(`matched ${O}`),R}:(M,T)=>{let O=N(M,T);return I(O)&&!v(O)}],exclude:l?(M,T)=>{let O=y(M,T);return bt(`${O?"skipped":"crawling"} ${T}`),O}:y,fs:t.fs,pathSeparator:"/",relativePaths:!o,resolvePaths:o,includeBasePath:o,resolveSymlinks:b,excludeSymlinks:!b,excludeFiles:_,includeDirs:_||!t.onlyFiles,maxDepth:U,signal:t.signal}).crawl(x);return t.debug&&bt("internal properties:",{...r,root:x}),[j,n!==x&&!o&&ts(n,x)]}function fs(t,e){if(e)for(let n=t.length-1;n>=0;n--)t[n]=e(t[n]);return t}var Fe={caseSensitiveMatch:true,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:true,followSymbolicLinks:true,onlyFiles:true};function hs(t){let e=Object.assign({},t);for(let n in Fe)e[n]===void 0&&Object.assign(e,{[n]:Fe[n]});return e.cwd=(e.cwd instanceof URL?fileURLToPath(e.cwd):resolve(e.cwd||process.cwd())).replace(Be,"/"),e.ignore=je(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||readdir,readdirSync:e.fs.readdirSync||readdirSync,realpath:e.fs.realpath||realpath,realpathSync:e.fs.realpathSync||realpathSync,stat:e.fs.stat||stat,statSync:e.fs.statSync||statSync}),e.debug&&bt("globbing with options:",e),e}function ds(t,e={}){var n;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let r=Kr(t)||typeof t=="string",s=je((n=r?t:t.patterns)!==null&&n!==void 0?n:"**/*"),o=hs(r?e:t);return s.length>0?ps(o,s):[]}async function Rt(t,e){let[n,r]=ds(t,e);return n?fs(await n.withPromise(),r):[]}var We="1.1.6";var nt=at.default.cyan("(pixi-vn-ink)"),Qe="virtual:pixi-vn-ink",Jt=`\0${Qe}`,bs="manifest.json",Ye=/\[(name|ext|extname|file|path|dir)\]/g,Je="ink";function Ue(t){if(typeof t=="string")return {type:"literal",value:t};if(t instanceof RegExp)return {type:"regexp",source:t.source,flags:t.flags};try{return {type:"zod",schema:toJSONSchema(t)}}catch{return {type:"literal",value:""}}}function st(t){return t.replaceAll("\\","/")}function Et(t){let e=st(t.trim());if(!e)throw new Error("vitePluginInk option `inkGlob` must not be empty.");let n=e.replace(/^\.?\//,"");if(!n||n.startsWith("../"))throw new Error("vitePluginInk option `inkGlob` must be rooted in Vite `root` and cannot escape it.");return n}function Ve(t,e){let n=st(e).split("/"),r=[];for(let s of n)if(!(s==="."||s==="")){if(/[*!?[\]{}()]/.test(s))break;r.push(s);}return L.resolve(t,...r)}function qe(t,e){if(!e)return;let n=e.trim();if(!n)throw new Error("vitePluginInk option `inkJsonOutputPattern` must not be empty.");return L.isAbsolute(n)?L.normalize(n):L.resolve(t,n)}function Ke(t,e,n){if(!n)return L.join(e,bs);let r=n.trim();if(!r)throw new Error("vitePluginInk option `inkJsonManifestPath` must not be empty.");return L.isAbsolute(r)?L.normalize(r):L.resolve(t,r)}function Xe(t){let e=t.search(Ye);if(e===-1)return L.dirname(t);let n=t.slice(0,e).replace(/[\\/]+$/g,"");if(!n)throw new Error("vitePluginInk option `inkJsonOutputPattern` must start with a static directory before placeholders.");return L.normalize(n)}function pt(t,e){let n=L.relative(t,e);return !n.startsWith("..")&&!L.isAbsolute(n)}function ys(t,e,n,r){let s=st(L.relative(n,r)),o=L.posix.parse(s),a=st(L.relative(e,r)),l=L.posix.dirname(a),g=L.posix.dirname(s),b={name:o.name,ext:o.ext.startsWith(".")?o.ext.slice(1):o.ext,extname:o.ext,file:s,path:g==="."?"":`${g}/`,dir:l==="."?"":`${l}/`},_=st(t).replace(Ye,(x,S)=>b[S]??"");return L.normalize(_)}function xs(t,e,n){return pt(n,t)?`/${st(L.relative(n,t))}`:pt(e,t)?st(L.relative(e,t)):st(t)}function Ut(t,e,n$1){let r=n.getUnknownHashtagCommands(t,e);r.forEach(({command:s,line:o})=>{n$1(`Unknown hashtag command "# ${s}": no registered handler matched this command.`,o);}),r.length>0&&n$1(`Hashtag command metadata is available via ${ft}.`);}function Vt(t,e,n$1){n.getHashtagKeySchemaIssues(t,e).forEach(({command:s,line:o,key:a,element:l,message:g})=>{n$1(`Hashtag command "# ${s}": "${a}" section ${l} - ${g}`,o);});}function qt(t,e,n$1){if(e.length===0)return;n.getUnknownDivertTargets(t,e).forEach(({target:s,line:o})=>{n$1(`Divert target "${s}" not found in any known label source.`,o);});}async function Ss(t,e,n$1){let r=e.get(t);return r||(r=(async()=>{try{let s=await fetch(t);if(!s.ok)throw new Error(`HTTP ${s.status} ${s.statusText}`);let o=await s.json();return n.getSchemaValidator(o)}catch(s){n$1(`Could not load/compile JSON schema from "${t}" (${s instanceof Error?s.message:String(s)}). Skipping schema validation.`);return}})(),e.set(t,r)),r}function vs(t,e){let n=`# ${t}`;if(!e)return at.default.gray(n);let r=new RegExp(`\\b${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`,"g"),s="",o=0;for(let a of n.matchAll(r)){let l=a.index??o;s+=at.default.gray(n.slice(o,l)),s+=at.default.yellow(a[0]),o=l+a[0].length;}return s+=at.default.gray(n.slice(o)),s}async function As(t,e,n$1,r){let s=t.$schema;if(!s)return;let o=await Ss(s,n$1,r);if(!o)return;let a=n.validateAgainstJsonSchema(t,o);for(let l of a){let g=l.origin?` \u2014 from ink source:
2
+ ${vs(l.origin,l.element)}`:"";r(`${e}: ${l.element} - ${l.message}${g}`);}}function ze(t){return new Promise((e,n)=>{let r="";t.on("data",s=>{r+=s.toString();}),t.on("end",()=>e(r)),t.on("error",n);})}function Ze(t){let{inkGlob:e,inkJsonOutputPattern:n$1,inkJsonManifestPath:r,characters:s}=t??{},o$1=!!n$1,a,l$1=[],g=[],b,_,x,S=[],I,v,P,N=new Map,J=async()=>{let h=i.info(),i$1=c.info();l$1=h.map(({name:d,description:A,validation:m,keySchemas:u})=>({name:d,description:A,validation:Ue(m),keySchemas:u})),g=i$1.map(({name:d,description:A,validation:m,type:u})=>({name:d,description:A,validation:Ue(m),type:u}));},y=h=>h?.find(i=>i.name==="vite-plugin-pixi-vn"),U=h=>{let i=h?.find(d=>d.name==="vite-plugin-nqtr");return [y(h)?.api?.contentLoaded,i?.api?.contentLoaded].filter(d=>!!d)},j=async h=>{let i=h?.api;if(!i)return;let d=S,A=JSON.stringify(d);if(A!==I)try{if(d.length===0&&i.clearExternalLabels)await i.clearExternalLabels(Je);else if(i.setExternalLabels)await i.setExternalLabels(Je,d);else return;I=A;}catch(m){let u=m instanceof Error?m:new Error(String(m));a?.logger.error(`${nt} Failed to sync Ink labels with vite-plugin-pixi-vn.`,{error:u,timestamp:true});}},M=h=>{if(!o$1||!_)return false;let i=L.resolve(h);return x&&i===x?true:pt(_,i)},T=()=>{P!==void 0&&clearTimeout(P),P=setTimeout(()=>{P=void 0,R().then(async()=>{await j(y(v?.config.plugins));let h=v?.moduleGraph.getModuleById(Jt);h&&v?.moduleGraph.invalidateModule(h),v?.ws.send({type:"custom",event:"ink-updated",data:{inkJson:o$1?b??[]:void 0}});}).catch(h=>{let i=h instanceof Error?h:new Error(String(h));a?.logger.error(`${nt} Failed to re-export Ink JSON files after characters update.`,{error:i,timestamp:true});});},150);},O=async()=>{if(!a||!e)return [];let h=Et(e),i=await Rt(h,{absolute:true,cwd:a.root,onlyFiles:true}),d=[];for(let A of i)try{let m=await et.readFile(A,"utf-8"),u=o(m,{characters:s??[]});u&&d.push(...Object.keys(u.labels??{}));}catch{}return Array.from(new Set(d)).sort((A,m)=>A.localeCompare(m))},R=async()=>{if(!a||!e){b=void 0,S=[];return}let h=qe(a.root,n$1);if(!h){b=void 0,S=[],_=void 0,x=void 0;return}let i=Et(e),d=Xe(h);_=L.resolve(d);let A=Ve(a.root,i);if(!pt(a.root,A))throw new Error("vitePluginInk option `inkGlob` must be rooted in Vite `root` and cannot escape it.");let m=await Rt(i,{absolute:true,cwd:a.root,onlyFiles:true}),u=[],c=[],F=new Set,E=y(a.plugins)?.api?.characters??[],C=[...s??[],...E];await et.mkdir(d,{recursive:true});let q=new Map;for(let H of m){let z=await et.readFile(H,"utf-8");q.set(H,z);let p;try{p=o(z,{characters:C});}catch(f){let k=f instanceof Error?f:new Error(String(f));a.logger.error(`${nt} Failed to convert "${H}" to JSON.`,{error:k,timestamp:true});continue}let w=ys(h,a.root,A,H);if(!pt(d,w)){a.logger.error(`${nt} Output path "${w}" escapes managed directory "${d}".`,{timestamp:true});continue}if(F.add(w),!p){await et.rm(w,{force:true});continue}c.push(p),await et.mkdir(L.dirname(w),{recursive:true}),await et.writeFile(w,`${JSON.stringify(p,null,2)}
3
+ `,"utf-8"),u.push(xs(w,a.root,a.publicDir)),await As(p,H,N,f=>a.logger.warn(`${nt} ${f}`,{timestamp:true}));}let V=Ke(a.root,d,r);x=L.resolve(V);let Q=await Rt("**/*.json",{absolute:true,cwd:d,onlyFiles:true});for(let H of Q)L.resolve(H)!==L.resolve(V)&&!F.has(H)&&await et.rm(H,{force:true});u.sort((H,z)=>H.localeCompare(z)),b=c;let yt=c.flatMap(H=>Object.keys(H.labels??{}));S=Array.from(new Set(yt)).sort((H,z)=>H.localeCompare(z));let ut=yt.length,Y=y(a.plugins)?.api?.labels??[],$=[...S,...Y];for(let[H,z]of q)Ut(z,l$1,(p,w)=>a.logger.warn(`${w!==void 0?`${H}:${w}`:H}: ${p}`,{timestamp:true})),Vt(z,l$1,(p,w)=>a.logger.warn(`${w!==void 0?`${H}:${w}`:H}: ${p}`,{timestamp:true})),qt(z,$,(p,w)=>a.logger.warn(`${w!==void 0?`${H}:${w}`:H}: ${p}`,{timestamp:true}));a.logger.info(`${nt} ${at.default.dim(`${m.length} file(s) exported: ${ut} label(s), ${l$1.length} hashtag-command(s), ${g.length} text-replace(s)`)}`,{timestamp:true}),await et.mkdir(L.dirname(V),{recursive:true}),await et.writeFile(V,`${JSON.stringify(u,null,2)}
4
+ `,"utf-8");};return {name:"vite-plugin-ink",enforce:"pre",configResolved(h){a=h,_=void 0,x=void 0;let i=e?Et(e):void 0;if(i){let d=Ve(h.root,i);if(!pt(h.root,d))throw new Error("vitePluginInk option `inkGlob` must be rooted in Vite `root` and cannot escape it.")}if(n$1&&!e)throw new Error("vitePluginInk option `inkJsonOutputPattern` requires `inkGlob` to be set.");if(n$1){let d=qe(h.root,n$1);if(!d)return;let A=Xe(d);if(_=L.resolve(A),x=L.resolve(Ke(h.root,A,r)),L.resolve(A)===L.resolve(h.root))throw new Error("vitePluginInk option `inkJsonOutputPattern` must target a directory different from Vite `root`.")}},async buildStart(){let h=y(a?.plugins);S=await O(),await j(h),await Promise.all(U(a?.plugins)),await J(),await R(),await j(h);},configureServer(h){v=h,h.middlewares.use(async(A,m,u)=>{let c=A.url,F=A.method;if(c===ft){if(F==="GET"){m.setHeader("Content-Type","application/json"),m.end(JSON.stringify(l$1));return}if(F==="POST"){try{let E=await ze(A);l$1=JSON.parse(E),m.statusCode=204,m.end();}catch(E){a?.logger.warn(`${nt} Invalid JSON body for POST ${ft}: ${String(E)}`,{timestamp:true}),m.statusCode=400,m.end();}return}}if(c===kt&&F==="GET"){m.setHeader("Content-Type","application/json");let E={version:We,schemaUrl:l};m.end(JSON.stringify(E));return}if(c===xt){if(F==="GET"){m.setHeader("Content-Type","application/json"),m.end(JSON.stringify(g));return}if(F==="POST"){try{let E=await ze(A);g=JSON.parse(E),m.statusCode=204,m.end();}catch(E){a?.logger.warn(`${nt} Invalid JSON body for POST ${xt}: ${String(E)}`,{timestamp:true}),m.statusCode=400,m.end();}return}}u();});let i=y(h.config.plugins);Promise.all(U(h.config.plugins)).then(async()=>{await J(),await R(),await j(i);}).catch(A=>{let m=A instanceof Error?A:new Error(String(A));a?.logger.error(`${nt} Failed to export Ink JSON files during server initialization or restart.`,{error:m,timestamp:true});});let d=i?.api?.onReload;d&&d(()=>{J().then(()=>T());});},resolveId(h){if(h===Qe)return Jt},load(h){if(h===Jt){if(!e)return ["export const inkJsons = undefined;","export default [];"].join(`
5
+ `);let i=Et(e);return [`const modules = import.meta.glob(${JSON.stringify(`/${i}`)}, { eager: true, import: 'default' });`,`export const inkJsons = ${JSON.stringify(o$1?b??[]:void 0)};`,"export default Object.values(modules);"].join(`
6
+ `)}},hotUpdate:{order:"post",async handler({type:h,file:i,server:d,read:A}){if(i.endsWith(".ink")){if(h!=="delete"){let m=await A(),{issues:u}=n.compile(m),c;u.forEach(({line:E,message:C,type:q})=>{q===Kt.ErrorType.Warning?d.config.logger.warn(`${i}:${E} ${C}`,{timestamp:true}):(d.config.logger.error(`${i}:${E} ${C}`,{timestamp:true}),c=C);}),Ut(m,l$1,(E,C)=>d.config.logger.warn(`${C!==void 0?`${i}:${C}`:i}: ${E}`,{timestamp:true})),Vt(m,l$1,(E,C)=>d.config.logger.warn(`${C!==void 0?`${i}:${C}`:i}: ${E}`,{timestamp:true}));let F=y(d.config.plugins)?.api?.labels??[];qt(m,[...S,...F],(E,C)=>d.config.logger.warn(`${C!==void 0?`${i}:${C}`:i}: ${E}`,{timestamp:true})),await R(),await j(y(d.config.plugins)),c?d.ws.send({type:"error",err:{message:c,stack:i,plugin:"vite-plugin-ink"}}):(d.ws.send({type:"custom",event:"ink-error-cleared",data:{}}),d.ws.send({type:"custom",event:"ink-updated",data:{inkText:m,inkJson:o$1?b??[]:void 0}}));}else await R(),await j(y(d.config.plugins)),d.ws.send({type:"custom",event:"ink-updated",data:{inkJson:o$1?b??[]:void 0}});return []}if(i.endsWith(".json")&&M(i))return await j(y(d.config.plugins)),d.ws.send({type:"custom",event:"ink-updated",data:{inkJson:b??[]}}),[]}},async transform(h,i){if(!i.endsWith(".ink"))return null;let d=await et.readFile(i,"utf-8"),{issues:A}=n.compile(d);A.forEach(({line:u,message:c,type:F})=>{F===Kt.ErrorType.Warning?this.warn(`${i}:${u} ${c}`):this.error(`${i}:${u} ${c}`);}),Ut(d,l$1,(u,c)=>this.warn({message:u,loc:c!==void 0?{line:c,column:0}:void 0})),Vt(d,l$1,(u,c)=>this.warn({message:u,loc:c!==void 0?{line:c,column:0}:void 0}));let m=y(a?.plugins)?.api?.labels??[];return qt(d,[...S,...m],(u,c)=>this.warn({message:u,loc:c!==void 0?{line:c,column:0}:void 0})),{code:`export default ${JSON.stringify(d)};`,map:null}}}}export{ft as INK_DEV_API_HASHTAG_COMMANDS,kt as INK_DEV_API_INFO,xt as INK_DEV_API_TEXT_REPLACES,Ze as noHmrInkPlugin,Ze as vitePluginInk};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drincs/pixi-vn-ink",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
4
4
  "type": "module",
5
5
  "workspaces": [
6
6
  "playground"
@@ -50,6 +50,12 @@
50
50
  "require": "./dist/converter.cjs",
51
51
  "default": "./dist/converter.mjs"
52
52
  },
53
+ "./dev-api": {
54
+ "types": "./dist/dev-api.d.ts",
55
+ "import": "./dist/dev-api.mjs",
56
+ "require": "./dist/dev-api.cjs",
57
+ "default": "./dist/dev-api.mjs"
58
+ },
53
59
  "./vite": {
54
60
  "types": "./dist/vite.d.ts",
55
61
  "import": "./dist/vite.mjs",
@@ -77,6 +83,9 @@
77
83
  "converter": [
78
84
  "./dist/converter.d.ts"
79
85
  ],
86
+ "dev-api": [
87
+ "./dist/dev-api.d.ts"
88
+ ],
80
89
  "vite": [
81
90
  "./dist/vite.d.ts"
82
91
  ],