@drincs/pixi-vn-ink 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/vite.cjs +13 -13
- package/dist/vite.mjs +3 -3
- package/package.json +1 -1
package/dist/vite.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var zod=require('zod'),characters=require('@drincs/pixi-vn/characters'),pixiVn=require('@drincs/pixi-vn');require('@drincs/pixi-vn/canvas');var narration=require('@drincs/pixi-vn/narration');require('@drincs/pixi-vn/sound');var storage=require('@drincs/pixi-vn/storage'),ln=require('fs/promises'),le=require('path'),KF=require('fs'),url=require('url'),module$1=require('module');var _documentCurrentScript=typeof document!=='undefined'?document.currentScript:null;function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var ln__default=/*#__PURE__*/_interopDefault(ln);var le__default=/*#__PURE__*/_interopDefault(le);var KF__namespace=/*#__PURE__*/_interopNamespace(KF);var Vb=Object.create;var Zp=Object.defineProperty;var jb=Object.getOwnPropertyDescriptor;var Lb=Object.getOwnPropertyNames;var qb=Object.getPrototypeOf,Bb=Object.prototype.hasOwnProperty;var Xn=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var S=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var Mb=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Lb(e))!Bb.call(n,i)&&i!==t&&Zp(n,i,{get:()=>e[i],enumerable:!(r=jb(e,i))||r.enumerable});return n};var An=(n,e,t)=>(t=n!=null?Vb(qb(n)):{},Mb(Zp(t,"default",{value:n,enumerable:true}),n));var ki=S(re=>{Object.defineProperty(re,"__esModule",{value:true});re.regexpCode=re.getEsmExportName=re.getProperty=re.safeStringify=re.stringify=re.strConcat=re.addCodeArg=re.str=re._=re.nil=re._Code=re.Name=re.IDENTIFIER=re._CodeOrName=void 0;var Fi=class{};re._CodeOrName=Fi;re.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var tr=class extends Fi{constructor(e){if(super(),!re.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e;}toString(){return this.str}emptyStr(){return false}get names(){return {[this.str]:1}}};re.Name=tr;var Dt=class extends Fi{constructor(e){super(),this._items=typeof e=="string"?[e]:e;}toString(){return this.str}emptyStr(){if(this._items.length>1)return false;let e=this._items[0];return e===""||e==='""'}get str(){var e;return (e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((t,r)=>`${t}${r}`,"")}get names(){var e;return (e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((t,r)=>(r instanceof tr&&(t[r.str]=(t[r.str]||0)+1),t),{})}};re._Code=Dt;re.nil=new Dt("");function vm(n,...e){let t=[n[0]],r=0;for(;r<e.length;)Gl(t,e[r]),t.push(n[++r]);return new Dt(t)}re._=vm;var Wl=new Dt("+");function Cm(n,...e){let t=[Ii(n[0])],r=0;for(;r<e.length;)t.push(Wl),Gl(t,e[r]),t.push(Wl,Ii(n[++r]));return o_(t),new Dt(t)}re.str=Cm;function Gl(n,e){e instanceof Dt?n.push(...e._items):e instanceof tr?n.push(e):n.push(c_(e));}re.addCodeArg=Gl;function o_(n){let e=1;for(;e<n.length-1;){if(n[e]===Wl){let t=u_(n[e-1],n[e+1]);if(t!==void 0){n.splice(e-1,3,t);continue}n[e++]="+";}e++;}}function u_(n,e){if(e==='""')return n;if(n==='""')return e;if(typeof n=="string")return e instanceof tr||n[n.length-1]!=='"'?void 0:typeof e!="string"?`${n.slice(0,-1)}${e}"`:e[0]==='"'?n.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(n instanceof tr))return `"${n}${e.slice(1)}`}function l_(n,e){return e.emptyStr()?n:n.emptyStr()?e:Cm`${n}${e}`}re.strConcat=l_;function c_(n){return typeof n=="number"||typeof n=="boolean"||n===null?n:Ii(Array.isArray(n)?n.join(","):n)}function h_(n){return new Dt(Ii(n))}re.stringify=h_;function Ii(n){return JSON.stringify(n).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}re.safeStringify=Ii;function d_(n){return typeof n=="string"&&re.IDENTIFIER.test(n)?new Dt(`.${n}`):vm`[${n}]`}re.getProperty=d_;function f_(n){if(typeof n=="string"&&re.IDENTIFIER.test(n))return new Dt(`${n}`);throw new Error(`CodeGen: invalid export name: ${n}, use explicit $id name mapping`)}re.getEsmExportName=f_;function p_(n){return new Dt(n.toString())}re.regexpCode=p_;});var zl=S(ct=>{Object.defineProperty(ct,"__esModule",{value:true});ct.ValueScope=ct.ValueScopeName=ct.Scope=ct.varKinds=ct.UsedValueState=void 0;var lt=ki(),Hl=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value;}},ua;(function(n){n[n.Started=0]="Started",n[n.Completed=1]="Completed";})(ua||(ct.UsedValueState=ua={}));ct.varKinds={const:new lt.Name("const"),let:new lt.Name("let"),var:new lt.Name("var")};var la=class{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t;}toName(e){return e instanceof lt.Name?e:this.name(e)}name(e){return new lt.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return `${e}${t.index++}`}_nameGroup(e){var t,r;if(!((r=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||r===void 0)&&r.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};ct.Scope=la;var ca=class extends lt.Name{constructor(e,t){super(t),this.prefix=e;}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=(0, lt._)`.${new lt.Name(t)}[${r}]`;}};ct.ValueScopeName=ca;var m_=(0, lt._)`\n`,Jl=class extends la{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?m_:lt.nil};}get(){return this._scope}name(e){return new ca(e,this._newName(e))}value(e,t){var r;if(t.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(e),{prefix:a}=i,s=(r=t.key)!==null&&r!==void 0?r:t.ref,o=this._values[a];if(o){let c=o.get(s);if(c)return c}else o=this._values[a]=new Map;o.set(s,i);let u=this._scope[a]||(this._scope[a]=[]),l=u.length;return u[l]=t.ref,i.setValue(t,{property:a,itemIndex:l}),i}getValue(e,t){let r=this._values[e];if(r)return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,r=>{if(r.scopePath===void 0)throw new Error(`CodeGen: name "${r}" has no value`);return (0, lt._)`${e}${r.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},t,r)}_reduceValues(e,t,r={},i){let a=lt.nil;for(let s in e){let o=e[s];if(!o)continue;let u=r[s]=r[s]||new Map;o.forEach(l=>{if(u.has(l))return;u.set(l,ua.Started);let c=t(l);if(c){let h=this.opts.es5?ct.varKinds.var:ct.varKinds.const;a=(0, lt._)`${a}${h} ${l} = ${c};${this.opts._n}`;}else if(c=i?.(l))a=(0, lt._)`${a}${c}${this.opts._n}`;else throw new Hl(l);u.set(l,ua.Completed);});}return a}};ct.ValueScope=Jl;});var M=S(U=>{Object.defineProperty(U,"__esModule",{value:true});U.or=U.and=U.not=U.CodeGen=U.operators=U.varKinds=U.ValueScopeName=U.ValueScope=U.Scope=U.Name=U.regexpCode=U.stringify=U.getProperty=U.nil=U.strConcat=U.str=U._=void 0;var ee=ki(),Lt=zl(),On=ki();Object.defineProperty(U,"_",{enumerable:true,get:function(){return On._}});Object.defineProperty(U,"str",{enumerable:true,get:function(){return On.str}});Object.defineProperty(U,"strConcat",{enumerable:true,get:function(){return On.strConcat}});Object.defineProperty(U,"nil",{enumerable:true,get:function(){return On.nil}});Object.defineProperty(U,"getProperty",{enumerable:true,get:function(){return On.getProperty}});Object.defineProperty(U,"stringify",{enumerable:true,get:function(){return On.stringify}});Object.defineProperty(U,"regexpCode",{enumerable:true,get:function(){return On.regexpCode}});Object.defineProperty(U,"Name",{enumerable:true,get:function(){return On.Name}});var pa=zl();Object.defineProperty(U,"Scope",{enumerable:true,get:function(){return pa.Scope}});Object.defineProperty(U,"ValueScope",{enumerable:true,get:function(){return pa.ValueScope}});Object.defineProperty(U,"ValueScopeName",{enumerable:true,get:function(){return pa.ValueScopeName}});Object.defineProperty(U,"varKinds",{enumerable:true,get:function(){return pa.varKinds}});U.operators={GT:new ee._Code(">"),GTE:new ee._Code(">="),LT:new ee._Code("<"),LTE:new ee._Code("<="),EQ:new ee._Code("==="),NEQ:new ee._Code("!=="),NOT:new ee._Code("!"),OR:new ee._Code("||"),AND:new ee._Code("&&"),ADD:new ee._Code("+")};var mn=class{optimizeNodes(){return this}optimizeNames(e,t){return this}},Ul=class extends mn{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r;}render({es5:e,_n:t}){let r=e?Lt.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return `${r} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=Rr(this.rhs,e,t)),this}get names(){return this.rhs instanceof ee._CodeOrName?this.rhs.names:{}}},ha=class extends mn{constructor(e,t,r){super(),this.lhs=e,this.rhs=t,this.sideEffects=r;}render({_n:e}){return `${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(!(this.lhs instanceof ee.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Rr(this.rhs,e,t),this}get names(){let e=this.lhs instanceof ee.Name?{}:{...this.lhs.names};return fa(e,this.rhs)}},Kl=class extends ha{constructor(e,t,r,i){super(e,r,i),this.op=t;}render({_n:e}){return `${this.lhs} ${this.op}= ${this.rhs};`+e}},Xl=class extends mn{constructor(e){super(),this.label=e,this.names={};}render({_n:e}){return `${this.label}:`+e}},Yl=class extends mn{constructor(e){super(),this.label=e,this.names={};}render({_n:e}){return `break${this.label?` ${this.label}`:""};`+e}},Ql=class extends mn{constructor(e){super(),this.error=e;}render({_n:e}){return `throw ${this.error};`+e}get names(){return this.error.names}},Zl=class extends mn{constructor(e){super(),this.code=e;}render({_n:e}){return `${this.code};`+e}optimizeNodes(){return `${this.code}`?this:void 0}optimizeNames(e,t){return this.code=Rr(this.code,e,t),this}get names(){return this.code instanceof ee._CodeOrName?this.code.names:{}}},Ri=class extends mn{constructor(e=[]){super(),this.nodes=e;}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let r=e[t].optimizeNodes();Array.isArray(r)?e.splice(t,1,...r):r?e[t]=r:e.splice(t,1);}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:r}=this,i=r.length;for(;i--;){let a=r[i];a.optimizeNames(e,t)||(g_(e,a.names),r.splice(i,1));}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>ir(e,t.names),{})}},gn=class extends Ri{render(e){return "{"+e._n+super.render(e)+"}"+e._n}},ec=class extends Ri{},kr=class extends gn{};kr.kind="else";var nr=class n extends gn{constructor(e,t){super(t),this.condition=e;}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===true)return this.nodes;let t=this.else;if(t){let r=t.optimizeNodes();t=this.else=Array.isArray(r)?new kr(r):r;}if(t)return e===false?t instanceof n?t:t.nodes:this.nodes.length?this:new n(bm(e),t instanceof n?[t]:t.nodes);if(!(e===false||!this.nodes.length))return this}optimizeNames(e,t){var r;if(this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(e,t),!!(super.optimizeNames(e,t)||this.else))return this.condition=Rr(this.condition,e,t),this}get names(){let e=super.names;return fa(e,this.condition),this.else&&ir(e,this.else.names),e}};nr.kind="if";var rr=class extends gn{};rr.kind="for";var tc=class extends rr{constructor(e){super(),this.iteration=e;}render(e){return `for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=Rr(this.iteration,e,t),this}get names(){return ir(super.names,this.iteration.names)}},nc=class extends rr{constructor(e,t,r,i){super(),this.varKind=e,this.name=t,this.from=r,this.to=i;}render(e){let t=e.es5?Lt.varKinds.var:this.varKind,{name:r,from:i,to:a}=this;return `for(${t} ${r}=${i}; ${r}<${a}; ${r}++)`+super.render(e)}get names(){let e=fa(super.names,this.from);return fa(e,this.to)}},da=class extends rr{constructor(e,t,r,i){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=i;}render(e){return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=Rr(this.iterable,e,t),this}get names(){return ir(super.names,this.iterable.names)}},$i=class extends gn{constructor(e,t,r){super(),this.name=e,this.args=t,this.async=r;}render(e){return `${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};$i.kind="func";var Vi=class extends Ri{render(e){return "return "+super.render(e)}};Vi.kind="return";var rc=class extends gn{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(t=this.finally)===null||t===void 0||t.optimizeNodes(),this}optimizeNames(e,t){var r,i;return super.optimizeNames(e,t),(r=this.catch)===null||r===void 0||r.optimizeNames(e,t),(i=this.finally)===null||i===void 0||i.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&ir(e,this.catch.names),this.finally&&ir(e,this.finally.names),e}},ji=class extends gn{constructor(e){super(),this.error=e;}render(e){return `catch(${this.error})`+super.render(e)}};ji.kind="catch";var Li=class extends gn{render(e){return "finally"+super.render(e)}};Li.kind="finally";var ic=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
|
|
1
|
+
'use strict';var zod=require('zod'),characters=require('@drincs/pixi-vn/characters'),pixiVn=require('@drincs/pixi-vn');require('@drincs/pixi-vn/canvas');var narration=require('@drincs/pixi-vn/narration');require('@drincs/pixi-vn/sound');var storage=require('@drincs/pixi-vn/storage'),ln=require('fs/promises'),ie=require('path'),KF=require('fs'),url=require('url'),module$1=require('module');var _documentCurrentScript=typeof document!=='undefined'?document.currentScript:null;function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var ln__default=/*#__PURE__*/_interopDefault(ln);var ie__default=/*#__PURE__*/_interopDefault(ie);var KF__namespace=/*#__PURE__*/_interopNamespace(KF);var Vb=Object.create;var Zp=Object.defineProperty;var jb=Object.getOwnPropertyDescriptor;var Lb=Object.getOwnPropertyNames;var qb=Object.getPrototypeOf,Bb=Object.prototype.hasOwnProperty;var Xn=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var S=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var Mb=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Lb(e))!Bb.call(n,i)&&i!==t&&Zp(n,i,{get:()=>e[i],enumerable:!(r=jb(e,i))||r.enumerable});return n};var An=(n,e,t)=>(t=n!=null?Vb(qb(n)):{},Mb(Zp(t,"default",{value:n,enumerable:true}),n));var ki=S(re=>{Object.defineProperty(re,"__esModule",{value:true});re.regexpCode=re.getEsmExportName=re.getProperty=re.safeStringify=re.stringify=re.strConcat=re.addCodeArg=re.str=re._=re.nil=re._Code=re.Name=re.IDENTIFIER=re._CodeOrName=void 0;var Fi=class{};re._CodeOrName=Fi;re.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var tr=class extends Fi{constructor(e){if(super(),!re.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e;}toString(){return this.str}emptyStr(){return false}get names(){return {[this.str]:1}}};re.Name=tr;var Dt=class extends Fi{constructor(e){super(),this._items=typeof e=="string"?[e]:e;}toString(){return this.str}emptyStr(){if(this._items.length>1)return false;let e=this._items[0];return e===""||e==='""'}get str(){var e;return (e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((t,r)=>`${t}${r}`,"")}get names(){var e;return (e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((t,r)=>(r instanceof tr&&(t[r.str]=(t[r.str]||0)+1),t),{})}};re._Code=Dt;re.nil=new Dt("");function vm(n,...e){let t=[n[0]],r=0;for(;r<e.length;)Gl(t,e[r]),t.push(n[++r]);return new Dt(t)}re._=vm;var Wl=new Dt("+");function Cm(n,...e){let t=[Ii(n[0])],r=0;for(;r<e.length;)t.push(Wl),Gl(t,e[r]),t.push(Wl,Ii(n[++r]));return o_(t),new Dt(t)}re.str=Cm;function Gl(n,e){e instanceof Dt?n.push(...e._items):e instanceof tr?n.push(e):n.push(c_(e));}re.addCodeArg=Gl;function o_(n){let e=1;for(;e<n.length-1;){if(n[e]===Wl){let t=u_(n[e-1],n[e+1]);if(t!==void 0){n.splice(e-1,3,t);continue}n[e++]="+";}e++;}}function u_(n,e){if(e==='""')return n;if(n==='""')return e;if(typeof n=="string")return e instanceof tr||n[n.length-1]!=='"'?void 0:typeof e!="string"?`${n.slice(0,-1)}${e}"`:e[0]==='"'?n.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(n instanceof tr))return `"${n}${e.slice(1)}`}function l_(n,e){return e.emptyStr()?n:n.emptyStr()?e:Cm`${n}${e}`}re.strConcat=l_;function c_(n){return typeof n=="number"||typeof n=="boolean"||n===null?n:Ii(Array.isArray(n)?n.join(","):n)}function h_(n){return new Dt(Ii(n))}re.stringify=h_;function Ii(n){return JSON.stringify(n).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}re.safeStringify=Ii;function d_(n){return typeof n=="string"&&re.IDENTIFIER.test(n)?new Dt(`.${n}`):vm`[${n}]`}re.getProperty=d_;function f_(n){if(typeof n=="string"&&re.IDENTIFIER.test(n))return new Dt(`${n}`);throw new Error(`CodeGen: invalid export name: ${n}, use explicit $id name mapping`)}re.getEsmExportName=f_;function p_(n){return new Dt(n.toString())}re.regexpCode=p_;});var zl=S(ct=>{Object.defineProperty(ct,"__esModule",{value:true});ct.ValueScope=ct.ValueScopeName=ct.Scope=ct.varKinds=ct.UsedValueState=void 0;var lt=ki(),Hl=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value;}},ua;(function(n){n[n.Started=0]="Started",n[n.Completed=1]="Completed";})(ua||(ct.UsedValueState=ua={}));ct.varKinds={const:new lt.Name("const"),let:new lt.Name("let"),var:new lt.Name("var")};var la=class{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t;}toName(e){return e instanceof lt.Name?e:this.name(e)}name(e){return new lt.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return `${e}${t.index++}`}_nameGroup(e){var t,r;if(!((r=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||r===void 0)&&r.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};ct.Scope=la;var ca=class extends lt.Name{constructor(e,t){super(t),this.prefix=e;}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=(0, lt._)`.${new lt.Name(t)}[${r}]`;}};ct.ValueScopeName=ca;var m_=(0, lt._)`\n`,Jl=class extends la{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?m_:lt.nil};}get(){return this._scope}name(e){return new ca(e,this._newName(e))}value(e,t){var r;if(t.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(e),{prefix:a}=i,s=(r=t.key)!==null&&r!==void 0?r:t.ref,o=this._values[a];if(o){let c=o.get(s);if(c)return c}else o=this._values[a]=new Map;o.set(s,i);let u=this._scope[a]||(this._scope[a]=[]),l=u.length;return u[l]=t.ref,i.setValue(t,{property:a,itemIndex:l}),i}getValue(e,t){let r=this._values[e];if(r)return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,r=>{if(r.scopePath===void 0)throw new Error(`CodeGen: name "${r}" has no value`);return (0, lt._)`${e}${r.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},t,r)}_reduceValues(e,t,r={},i){let a=lt.nil;for(let s in e){let o=e[s];if(!o)continue;let u=r[s]=r[s]||new Map;o.forEach(l=>{if(u.has(l))return;u.set(l,ua.Started);let c=t(l);if(c){let h=this.opts.es5?ct.varKinds.var:ct.varKinds.const;a=(0, lt._)`${a}${h} ${l} = ${c};${this.opts._n}`;}else if(c=i?.(l))a=(0, lt._)`${a}${c}${this.opts._n}`;else throw new Hl(l);u.set(l,ua.Completed);});}return a}};ct.ValueScope=Jl;});var M=S(U=>{Object.defineProperty(U,"__esModule",{value:true});U.or=U.and=U.not=U.CodeGen=U.operators=U.varKinds=U.ValueScopeName=U.ValueScope=U.Scope=U.Name=U.regexpCode=U.stringify=U.getProperty=U.nil=U.strConcat=U.str=U._=void 0;var ee=ki(),Lt=zl(),On=ki();Object.defineProperty(U,"_",{enumerable:true,get:function(){return On._}});Object.defineProperty(U,"str",{enumerable:true,get:function(){return On.str}});Object.defineProperty(U,"strConcat",{enumerable:true,get:function(){return On.strConcat}});Object.defineProperty(U,"nil",{enumerable:true,get:function(){return On.nil}});Object.defineProperty(U,"getProperty",{enumerable:true,get:function(){return On.getProperty}});Object.defineProperty(U,"stringify",{enumerable:true,get:function(){return On.stringify}});Object.defineProperty(U,"regexpCode",{enumerable:true,get:function(){return On.regexpCode}});Object.defineProperty(U,"Name",{enumerable:true,get:function(){return On.Name}});var pa=zl();Object.defineProperty(U,"Scope",{enumerable:true,get:function(){return pa.Scope}});Object.defineProperty(U,"ValueScope",{enumerable:true,get:function(){return pa.ValueScope}});Object.defineProperty(U,"ValueScopeName",{enumerable:true,get:function(){return pa.ValueScopeName}});Object.defineProperty(U,"varKinds",{enumerable:true,get:function(){return pa.varKinds}});U.operators={GT:new ee._Code(">"),GTE:new ee._Code(">="),LT:new ee._Code("<"),LTE:new ee._Code("<="),EQ:new ee._Code("==="),NEQ:new ee._Code("!=="),NOT:new ee._Code("!"),OR:new ee._Code("||"),AND:new ee._Code("&&"),ADD:new ee._Code("+")};var mn=class{optimizeNodes(){return this}optimizeNames(e,t){return this}},Ul=class extends mn{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r;}render({es5:e,_n:t}){let r=e?Lt.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return `${r} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=Rr(this.rhs,e,t)),this}get names(){return this.rhs instanceof ee._CodeOrName?this.rhs.names:{}}},ha=class extends mn{constructor(e,t,r){super(),this.lhs=e,this.rhs=t,this.sideEffects=r;}render({_n:e}){return `${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(!(this.lhs instanceof ee.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Rr(this.rhs,e,t),this}get names(){let e=this.lhs instanceof ee.Name?{}:{...this.lhs.names};return fa(e,this.rhs)}},Kl=class extends ha{constructor(e,t,r,i){super(e,r,i),this.op=t;}render({_n:e}){return `${this.lhs} ${this.op}= ${this.rhs};`+e}},Xl=class extends mn{constructor(e){super(),this.label=e,this.names={};}render({_n:e}){return `${this.label}:`+e}},Yl=class extends mn{constructor(e){super(),this.label=e,this.names={};}render({_n:e}){return `break${this.label?` ${this.label}`:""};`+e}},Ql=class extends mn{constructor(e){super(),this.error=e;}render({_n:e}){return `throw ${this.error};`+e}get names(){return this.error.names}},Zl=class extends mn{constructor(e){super(),this.code=e;}render({_n:e}){return `${this.code};`+e}optimizeNodes(){return `${this.code}`?this:void 0}optimizeNames(e,t){return this.code=Rr(this.code,e,t),this}get names(){return this.code instanceof ee._CodeOrName?this.code.names:{}}},Ri=class extends mn{constructor(e=[]){super(),this.nodes=e;}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let r=e[t].optimizeNodes();Array.isArray(r)?e.splice(t,1,...r):r?e[t]=r:e.splice(t,1);}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:r}=this,i=r.length;for(;i--;){let a=r[i];a.optimizeNames(e,t)||(g_(e,a.names),r.splice(i,1));}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>ir(e,t.names),{})}},gn=class extends Ri{render(e){return "{"+e._n+super.render(e)+"}"+e._n}},ec=class extends Ri{},kr=class extends gn{};kr.kind="else";var nr=class n extends gn{constructor(e,t){super(t),this.condition=e;}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===true)return this.nodes;let t=this.else;if(t){let r=t.optimizeNodes();t=this.else=Array.isArray(r)?new kr(r):r;}if(t)return e===false?t instanceof n?t:t.nodes:this.nodes.length?this:new n(bm(e),t instanceof n?[t]:t.nodes);if(!(e===false||!this.nodes.length))return this}optimizeNames(e,t){var r;if(this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(e,t),!!(super.optimizeNames(e,t)||this.else))return this.condition=Rr(this.condition,e,t),this}get names(){let e=super.names;return fa(e,this.condition),this.else&&ir(e,this.else.names),e}};nr.kind="if";var rr=class extends gn{};rr.kind="for";var tc=class extends rr{constructor(e){super(),this.iteration=e;}render(e){return `for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=Rr(this.iteration,e,t),this}get names(){return ir(super.names,this.iteration.names)}},nc=class extends rr{constructor(e,t,r,i){super(),this.varKind=e,this.name=t,this.from=r,this.to=i;}render(e){let t=e.es5?Lt.varKinds.var:this.varKind,{name:r,from:i,to:a}=this;return `for(${t} ${r}=${i}; ${r}<${a}; ${r}++)`+super.render(e)}get names(){let e=fa(super.names,this.from);return fa(e,this.to)}},da=class extends rr{constructor(e,t,r,i){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=i;}render(e){return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=Rr(this.iterable,e,t),this}get names(){return ir(super.names,this.iterable.names)}},$i=class extends gn{constructor(e,t,r){super(),this.name=e,this.args=t,this.async=r;}render(e){return `${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};$i.kind="func";var Vi=class extends Ri{render(e){return "return "+super.render(e)}};Vi.kind="return";var rc=class extends gn{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(t=this.finally)===null||t===void 0||t.optimizeNodes(),this}optimizeNames(e,t){var r,i;return super.optimizeNames(e,t),(r=this.catch)===null||r===void 0||r.optimizeNames(e,t),(i=this.finally)===null||i===void 0||i.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&ir(e,this.catch.names),this.finally&&ir(e,this.finally.names),e}},ji=class extends gn{constructor(e){super(),this.error=e;}render(e){return `catch(${this.error})`+super.render(e)}};ji.kind="catch";var Li=class extends gn{render(e){return "finally"+super.render(e)}};Li.kind="finally";var ic=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
|
|
2
2
|
`:""},this._extScope=e,this._scope=new Lt.Scope({parent:e}),this._nodes=[new ec];}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let r=this._extScope.value(e,t);return (this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,i){let a=this._scope.toName(t);return r!==void 0&&i&&(this._constants[a.str]=r),this._leafNode(new Ul(e,a,r)),a}const(e,t,r){return this._def(Lt.varKinds.const,e,t,r)}let(e,t,r){return this._def(Lt.varKinds.let,e,t,r)}var(e,t,r){return this._def(Lt.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new ha(e,t,r))}add(e,t){return this._leafNode(new Kl(e,U.operators.ADD,t))}code(e){return typeof e=="function"?e():e!==ee.nil&&this._leafNode(new Zl(e)),this}object(...e){let t=["{"];for(let[r,i]of e)t.length>1&&t.push(","),t.push(r),(r!==i||this.opts.es5)&&(t.push(":"),(0, ee.addCodeArg)(t,i));return t.push("}"),new ee._Code(t)}if(e,t,r){if(this._blockNode(new nr(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new nr(e))}else(){return this._elseNode(new kr)}endIf(){return this._endBlockNode(nr,kr)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new tc(e),t)}forRange(e,t,r,i,a=this.opts.es5?Lt.varKinds.var:Lt.varKinds.let){let s=this._scope.toName(e);return this._for(new nc(a,s,t,r),()=>i(s))}forOf(e,t,r,i=Lt.varKinds.const){let a=this._scope.toName(e);if(this.opts.es5){let s=t instanceof ee.Name?t:this.var("_arr",t);return this.forRange("_i",0,(0, ee._)`${s}.length`,o=>{this.var(a,(0, ee._)`${s}[${o}]`),r(a);})}return this._for(new da("of",i,a,t),()=>r(a))}forIn(e,t,r,i=this.opts.es5?Lt.varKinds.var:Lt.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0, ee._)`Object.keys(${t})`,r);let a=this._scope.toName(e);return this._for(new da("in",i,a,t),()=>r(a))}endFor(){return this._endBlockNode(rr)}label(e){return this._leafNode(new Xl(e))}break(e){return this._leafNode(new Yl(e))}return(e){let t=new Vi;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Vi)}try(e,t,r){if(!t&&!r)throw new Error('CodeGen: "try" without "catch" and "finally"');let i=new rc;if(this._blockNode(i),this.code(e),t){let a=this.name("e");this._currNode=i.catch=new ji(a),t(a);}return r&&(this._currNode=i.finally=new Li,this.code(r)),this._endBlockNode(ji,Li)}throw(e){return this._leafNode(new Ql(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw new Error("CodeGen: not in self-balancing block");let r=this._nodes.length-t;if(r<0||e!==void 0&&r!==e)throw new Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=ee.nil,r,i){return this._blockNode(new $i(e,t,r)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode($i)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants);}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e);}_endBlockNode(e,t){let r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof nr))throw new Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e;}};U.CodeGen=ic;function ir(n,e){for(let t in e)n[t]=(n[t]||0)+(e[t]||0);return n}function fa(n,e){return e instanceof ee._CodeOrName?ir(n,e.names):n}function Rr(n,e,t){if(n instanceof ee.Name)return r(n);if(!i(n))return n;return new ee._Code(n._items.reduce((a,s)=>(s instanceof ee.Name&&(s=r(s)),s instanceof ee._Code?a.push(...s._items):a.push(s),a),[]));function r(a){let s=t[a.str];return s===void 0||e[a.str]!==1?a:(delete e[a.str],s)}function i(a){return a instanceof ee._Code&&a._items.some(s=>s instanceof ee.Name&&e[s.str]===1&&t[s.str]!==void 0)}}function g_(n,e){for(let t in e)n[t]=(n[t]||0)-(e[t]||0);}function bm(n){return typeof n=="boolean"||typeof n=="number"||n===null?!n:(0, ee._)`!${sc(n)}`}U.not=bm;var y_=_m(U.operators.AND);function v_(...n){return n.reduce(y_)}U.and=v_;var C_=_m(U.operators.OR);function b_(...n){return n.reduce(C_)}U.or=b_;function _m(n){return (e,t)=>e===ee.nil?t:t===ee.nil?e:(0, ee._)`${sc(e)} ${n} ${sc(t)}`}function sc(n){return n instanceof ee.Name?n:(0, ee._)`(${n})`}});var Y=S(X=>{Object.defineProperty(X,"__esModule",{value:true});X.checkStrictMode=X.getErrorPath=X.Type=X.useFunc=X.setEvaluated=X.evaluatedPropsToName=X.mergeEvaluated=X.eachItem=X.unescapeJsonPointer=X.escapeJsonPointer=X.escapeFragment=X.unescapeFragment=X.schemaRefOrVal=X.schemaHasRulesButRef=X.schemaHasRules=X.checkUnknownRules=X.alwaysValidSchema=X.toHash=void 0;var me=M(),__=ki();function S_(n){let e={};for(let t of n)e[t]=true;return e}X.toHash=S_;function E_(n,e){return typeof e=="boolean"?e:Object.keys(e).length===0?true:(wm(n,e),!Am(e,n.self.RULES.all))}X.alwaysValidSchema=E_;function wm(n,e=n.schema){let{opts:t,self:r}=n;if(!t.strictSchema||typeof e=="boolean")return;let i=r.RULES.keywords;for(let a in e)i[a]||Pm(n,`unknown keyword: "${a}"`);}X.checkUnknownRules=wm;function Am(n,e){if(typeof n=="boolean")return !n;for(let t in n)if(e[t])return true;return false}X.schemaHasRules=Am;function w_(n,e){if(typeof n=="boolean")return !n;for(let t in n)if(t!=="$ref"&&e.all[t])return true;return false}X.schemaHasRulesButRef=w_;function A_({topSchemaRef:n,schemaPath:e},t,r,i){if(!i){if(typeof t=="number"||typeof t=="boolean")return t;if(typeof t=="string")return (0, me._)`${t}`}return (0, me._)`${n}${e}${(0, me.getProperty)(r)}`}X.schemaRefOrVal=A_;function D_(n){return Dm(decodeURIComponent(n))}X.unescapeFragment=D_;function x_(n){return encodeURIComponent(oc(n))}X.escapeFragment=x_;function oc(n){return typeof n=="number"?`${n}`:n.replace(/~/g,"~0").replace(/\//g,"~1")}X.escapeJsonPointer=oc;function Dm(n){return n.replace(/~1/g,"/").replace(/~0/g,"~")}X.unescapeJsonPointer=Dm;function P_(n,e){if(Array.isArray(n))for(let t of n)e(t);else e(n);}X.eachItem=P_;function Sm({mergeNames:n,mergeToName:e,mergeValues:t,resultToName:r}){return (i,a,s,o)=>{let u=s===void 0?a:s instanceof me.Name?(a instanceof me.Name?n(i,a,s):e(i,a,s),s):a instanceof me.Name?(e(i,s,a),a):t(a,s);return o===me.Name&&!(u instanceof me.Name)?r(i,u):u}}X.mergeEvaluated={props:Sm({mergeNames:(n,e,t)=>n.if((0, me._)`${t} !== true && ${e} !== undefined`,()=>{n.if((0, me._)`${e} === true`,()=>n.assign(t,true),()=>n.assign(t,(0, me._)`${t} || {}`).code((0, me._)`Object.assign(${t}, ${e})`));}),mergeToName:(n,e,t)=>n.if((0, me._)`${t} !== true`,()=>{e===true?n.assign(t,true):(n.assign(t,(0, me._)`${t} || {}`),uc(n,t,e));}),mergeValues:(n,e)=>n===true?true:{...n,...e},resultToName:xm}),items:Sm({mergeNames:(n,e,t)=>n.if((0, me._)`${t} !== true && ${e} !== undefined`,()=>n.assign(t,(0, me._)`${e} === true ? true : ${t} > ${e} ? ${t} : ${e}`)),mergeToName:(n,e,t)=>n.if((0, me._)`${t} !== true`,()=>n.assign(t,e===true?true:(0, me._)`${t} > ${e} ? ${t} : ${e}`)),mergeValues:(n,e)=>n===true?true:Math.max(n,e),resultToName:(n,e)=>n.var("items",e)})};function xm(n,e){if(e===true)return n.var("props",true);let t=n.var("props",(0, me._)`{}`);return e!==void 0&&uc(n,t,e),t}X.evaluatedPropsToName=xm;function uc(n,e,t){Object.keys(t).forEach(r=>n.assign((0, me._)`${e}${(0, me.getProperty)(r)}`,true));}X.setEvaluated=uc;var Em={};function O_(n,e){return n.scopeValue("func",{ref:e,code:Em[e.code]||(Em[e.code]=new __._Code(e.code))})}X.useFunc=O_;var ac;(function(n){n[n.Num=0]="Num",n[n.Str=1]="Str";})(ac||(X.Type=ac={}));function T_(n,e,t){if(n instanceof me.Name){let r=e===ac.Num;return t?r?(0, me._)`"[" + ${n} + "]"`:(0, me._)`"['" + ${n} + "']"`:r?(0, me._)`"/" + ${n}`:(0, me._)`"/" + ${n}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return t?(0, me.getProperty)(n).toString():"/"+oc(n)}X.getErrorPath=T_;function Pm(n,e,t=n.opts.strictSchema){if(t){if(e=`strict mode: ${e}`,t===true)throw new Error(e);n.self.logger.warn(e);}}X.checkStrictMode=Pm;});var xt=S(lc=>{Object.defineProperty(lc,"__esModule",{value:true});var Ue=M(),N_={data:new Ue.Name("data"),valCxt:new Ue.Name("valCxt"),instancePath:new Ue.Name("instancePath"),parentData:new Ue.Name("parentData"),parentDataProperty:new Ue.Name("parentDataProperty"),rootData:new Ue.Name("rootData"),dynamicAnchors:new Ue.Name("dynamicAnchors"),vErrors:new Ue.Name("vErrors"),errors:new Ue.Name("errors"),this:new Ue.Name("this"),self:new Ue.Name("self"),scope:new Ue.Name("scope"),json:new Ue.Name("json"),jsonPos:new Ue.Name("jsonPos"),jsonLen:new Ue.Name("jsonLen"),jsonPart:new Ue.Name("jsonPart")};lc.default=N_;});var qi=S(Ke=>{Object.defineProperty(Ke,"__esModule",{value:true});Ke.extendErrors=Ke.resetErrorsCount=Ke.reportExtraError=Ke.reportError=Ke.keyword$DataError=Ke.keywordError=void 0;var ne=M(),ma=Y(),it=xt();Ke.keywordError={message:({keyword:n})=>(0, ne.str)`must pass "${n}" keyword validation`};Ke.keyword$DataError={message:({keyword:n,schemaType:e})=>e?(0, ne.str)`"${n}" keyword must be ${e} ($data)`:(0, ne.str)`"${n}" keyword is invalid ($data)`};function F_(n,e=Ke.keywordError,t,r){let{it:i}=n,{gen:a,compositeRule:s,allErrors:o}=i,u=Nm(n,e,t);r??(s||o)?Om(a,u):Tm(i,(0, ne._)`[${u}]`);}Ke.reportError=F_;function I_(n,e=Ke.keywordError,t){let{it:r}=n,{gen:i,compositeRule:a,allErrors:s}=r,o=Nm(n,e,t);Om(i,o),a||s||Tm(r,it.default.vErrors);}Ke.reportExtraError=I_;function k_(n,e){n.assign(it.default.errors,e),n.if((0, ne._)`${it.default.vErrors} !== null`,()=>n.if(e,()=>n.assign((0, ne._)`${it.default.vErrors}.length`,e),()=>n.assign(it.default.vErrors,null)));}Ke.resetErrorsCount=k_;function R_({gen:n,keyword:e,schemaValue:t,data:r,errsCount:i,it:a}){if(i===void 0)throw new Error("ajv implementation error");let s=n.name("err");n.forRange("i",i,it.default.errors,o=>{n.const(s,(0, ne._)`${it.default.vErrors}[${o}]`),n.if((0, ne._)`${s}.instancePath === undefined`,()=>n.assign((0, ne._)`${s}.instancePath`,(0, ne.strConcat)(it.default.instancePath,a.errorPath))),n.assign((0, ne._)`${s}.schemaPath`,(0, ne.str)`${a.errSchemaPath}/${e}`),a.opts.verbose&&(n.assign((0, ne._)`${s}.schema`,t),n.assign((0, ne._)`${s}.data`,r));});}Ke.extendErrors=R_;function Om(n,e){let t=n.const("err",e);n.if((0, ne._)`${it.default.vErrors} === null`,()=>n.assign(it.default.vErrors,(0, ne._)`[${t}]`),(0, ne._)`${it.default.vErrors}.push(${t})`),n.code((0, ne._)`${it.default.errors}++`);}function Tm(n,e){let{gen:t,validateName:r,schemaEnv:i}=n;i.$async?t.throw((0, ne._)`new ${n.ValidationError}(${e})`):(t.assign((0, ne._)`${r}.errors`,e),t.return(false));}var sr={keyword:new ne.Name("keyword"),schemaPath:new ne.Name("schemaPath"),params:new ne.Name("params"),propertyName:new ne.Name("propertyName"),message:new ne.Name("message"),schema:new ne.Name("schema"),parentSchema:new ne.Name("parentSchema")};function Nm(n,e,t){let{createErrors:r}=n.it;return r===false?(0, ne._)`{}`:$_(n,e,t)}function $_(n,e,t={}){let{gen:r,it:i}=n,a=[V_(i,t),j_(n,t)];return L_(n,e,a),r.object(...a)}function V_({errorPath:n},{instancePath:e}){let t=e?(0, ne.str)`${n}${(0, ma.getErrorPath)(e,ma.Type.Str)}`:n;return [it.default.instancePath,(0, ne.strConcat)(it.default.instancePath,t)]}function j_({keyword:n,it:{errSchemaPath:e}},{schemaPath:t,parentSchema:r}){let i=r?e:(0, ne.str)`${e}/${n}`;return t&&(i=(0, ne.str)`${i}${(0, ma.getErrorPath)(t,ma.Type.Str)}`),[sr.schemaPath,i]}function L_(n,{params:e,message:t},r){let{keyword:i,data:a,schemaValue:s,it:o}=n,{opts:u,propertyName:l,topSchemaRef:c,schemaPath:h}=o;r.push([sr.keyword,i],[sr.params,typeof e=="function"?e(n):e||(0, ne._)`{}`]),u.messages&&r.push([sr.message,typeof t=="function"?t(n):t]),u.verbose&&r.push([sr.schema,s],[sr.parentSchema,(0, ne._)`${c}${h}`],[it.default.data,a]),l&&r.push([sr.propertyName,l]);}});var Im=S($r=>{Object.defineProperty($r,"__esModule",{value:true});$r.boolOrEmptySchema=$r.topBoolOrEmptySchema=void 0;var q_=qi(),B_=M(),M_=xt(),W_={message:"boolean schema is false"};function G_(n){let{gen:e,schema:t,validateName:r}=n;t===false?Fm(n,false):typeof t=="object"&&t.$async===true?e.return(M_.default.data):(e.assign((0, B_._)`${r}.errors`,null),e.return(true));}$r.topBoolOrEmptySchema=G_;function H_(n,e){let{gen:t,schema:r}=n;r===false?(t.var(e,false),Fm(n)):t.var(e,true);}$r.boolOrEmptySchema=H_;function Fm(n,e){let{gen:t,data:r}=n,i={gen:t,keyword:"false schema",data:r,schema:false,schemaCode:false,schemaValue:false,params:{},it:n};(0, q_.reportError)(i,W_,void 0,e);}});var cc=S(Vr=>{Object.defineProperty(Vr,"__esModule",{value:true});Vr.getRules=Vr.isJSONType=void 0;var J_=["string","number","integer","boolean","null","object","array"],z_=new Set(J_);function U_(n){return typeof n=="string"&&z_.has(n)}Vr.isJSONType=U_;function K_(){let n={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return {types:{...n,integer:true,boolean:true,null:true},rules:[{rules:[]},n.number,n.string,n.array,n.object],post:{rules:[]},all:{},keywords:{}}}Vr.getRules=K_;});var hc=S(Tn=>{Object.defineProperty(Tn,"__esModule",{value:true});Tn.shouldUseRule=Tn.shouldUseGroup=Tn.schemaHasRulesForType=void 0;function X_({schema:n,self:e},t){let r=e.RULES.types[t];return r&&r!==true&&km(n,r)}Tn.schemaHasRulesForType=X_;function km(n,e){return e.rules.some(t=>Rm(n,t))}Tn.shouldUseGroup=km;function Rm(n,e){var t;return n[e.keyword]!==void 0||((t=e.definition.implements)===null||t===void 0?void 0:t.some(r=>n[r]!==void 0))}Tn.shouldUseRule=Rm;});var Bi=S(Xe=>{Object.defineProperty(Xe,"__esModule",{value:true});Xe.reportTypeError=Xe.checkDataTypes=Xe.checkDataType=Xe.coerceAndCheckDataType=Xe.getJSONTypes=Xe.getSchemaTypes=Xe.DataType=void 0;var Y_=cc(),Q_=hc(),Z_=qi(),G=M(),$m=Y(),jr;(function(n){n[n.Correct=0]="Correct",n[n.Wrong=1]="Wrong";})(jr||(Xe.DataType=jr={}));function eS(n){let e=Vm(n.type);if(e.includes("null")){if(n.nullable===false)throw new Error("type: null contradicts nullable: false")}else {if(!e.length&&n.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');n.nullable===true&&e.push("null");}return e}Xe.getSchemaTypes=eS;function Vm(n){let e=Array.isArray(n)?n:n?[n]:[];if(e.every(Y_.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Xe.getJSONTypes=Vm;function tS(n,e){let{gen:t,data:r,opts:i}=n,a=nS(e,i.coerceTypes),s=e.length>0&&!(a.length===0&&e.length===1&&(0, Q_.schemaHasRulesForType)(n,e[0]));if(s){let o=fc(e,r,i.strictNumbers,jr.Wrong);t.if(o,()=>{a.length?rS(n,e,a):pc(n);});}return s}Xe.coerceAndCheckDataType=tS;var jm=new Set(["string","number","integer","boolean","null"]);function nS(n,e){return e?n.filter(t=>jm.has(t)||e==="array"&&t==="array"):[]}function rS(n,e,t){let{gen:r,data:i,opts:a}=n,s=r.let("dataType",(0, G._)`typeof ${i}`),o=r.let("coerced",(0, G._)`undefined`);a.coerceTypes==="array"&&r.if((0, G._)`${s} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>r.assign(i,(0, G._)`${i}[0]`).assign(s,(0, G._)`typeof ${i}`).if(fc(e,i,a.strictNumbers),()=>r.assign(o,i))),r.if((0, G._)`${o} !== undefined`);for(let l of t)(jm.has(l)||l==="array"&&a.coerceTypes==="array")&&u(l);r.else(),pc(n),r.endIf(),r.if((0, G._)`${o} !== undefined`,()=>{r.assign(i,o),iS(n,o);});function u(l){switch(l){case "string":r.elseIf((0, G._)`${s} == "number" || ${s} == "boolean"`).assign(o,(0, G._)`"" + ${i}`).elseIf((0, G._)`${i} === null`).assign(o,(0, G._)`""`);return;case "number":r.elseIf((0, G._)`${s} == "boolean" || ${i} === null
|
|
3
3
|
|| (${s} == "string" && ${i} && ${i} == +${i})`).assign(o,(0, G._)`+${i}`);return;case "integer":r.elseIf((0, G._)`${s} === "boolean" || ${i} === null
|
|
4
4
|
|| (${s} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(o,(0, G._)`+${i}`);return;case "boolean":r.elseIf((0, G._)`${i} === "false" || ${i} === 0 || ${i} === null`).assign(o,false).elseIf((0, G._)`${i} === "true" || ${i} === 1`).assign(o,true);return;case "null":r.elseIf((0, G._)`${i} === "" || ${i} === 0 || ${i} === false`),r.assign(o,null);return;case "array":r.elseIf((0, G._)`${s} === "string" || ${s} === "number"
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
\r`),this.Process=()=>{let e=this.Interleave(this.Optional(this.CommentsAndNewlines),this.Optional(this.MainInk));return e!==null?e.join(""):""},this.MainInk=()=>this.ParseUntil(this.CommentsAndNewlines,this._commentOrNewlineStartCharacter,null),this.CommentsAndNewlines=()=>{let e=this.Interleave(this.Optional(this.ParseNewline),this.Optional(this.ParseSingleComment));return e!==null?e.join(""):null},this.ParseSingleComment=()=>this.OneOf([this.EndOfLineComment,this.BlockComment]),this.EndOfLineComment=()=>this.ParseString("//")===null?null:(this.ParseUntilCharactersFromCharSet(this._newlineCharacters),""),this.BlockComment=()=>{if(this.ParseString("/*")===null)return null;let e=this.lineIndex,t=this.ParseUntil(this.String("*/"),this._commentBlockEndCharacter,null);return this.endOfInput||this.ParseString("*/"),t!=null?`
|
|
21
21
|
`.repeat(this.lineIndex-e):null};}PreProcessInputString(e){return e}};To.CommentEliminator=Vd;});var Fo=S(No=>{Object.defineProperty(No,"__esModule",{value:true});No.Conditional=void 0;var iO=Re(),Xv=Ze(),sO=Pe(),jd=class extends sO.ParsedObject{constructor(e,t){super(),this.initialCondition=e,this.branches=t,this._reJoinTarget=null,this.GenerateRuntimeObject=()=>{let r=new iO.Container;this.initialCondition&&r.AddContent(this.initialCondition.runtimeObject);for(let i of this.branches){let a=i.runtimeObject;r.AddContent(a);}return this.initialCondition!==null&&this.branches[0].ownExpression!==null&&!this.branches[this.branches.length-1].isElse&&r.AddContent(Xv.ControlCommand.PopEvaluatedValue()),this._reJoinTarget=Xv.ControlCommand.NoOp(),r.AddContent(this._reJoinTarget),r},this.initialCondition&&this.AddContent(this.initialCondition),this.branches!==null&&this.AddContent(this.branches);}get typeName(){return "Conditional"}ResolveReferences(e){let t=this._reJoinTarget.path;for(let r of this.branches){if(!r.returnDivert)throw new Error;r.returnDivert.targetPath=t;}super.ResolveReferences(e);}};No.Conditional=jd;});var Bn=S(Io=>{Object.defineProperty(Io,"__esModule",{value:true});Io.Text=void 0;var aO=Pe(),oO=Te(),Ld=class extends aO.ParsedObject{constructor(e){super(),this.text=e,this.GenerateRuntimeObject=()=>new oO.StringValue(this.text),this.toString=()=>this.text;}get typeName(){return "Text"}};Io.Text=Ld;});var Ro=S(ko=>{Object.defineProperty(ko,"__esModule",{value:true});ko.ConstantDeclaration=void 0;var uO=Pe(),lO=Cn(),qd=class extends uO.ParsedObject{get constantName(){var e;return (e=this.constantIdentifier)===null||e===void 0?void 0:e.name}get expression(){if(!this._expression)throw new Error;return this._expression}constructor(e,t){super(),this._expression=null,this.GenerateRuntimeObject=()=>null,this.constantIdentifier=e,t&&(this._expression=this.AddContent(t));}get typeName(){return "CONST"}ResolveReferences(e){super.ResolveReferences(e),e.CheckForNamingCollisions(this,this.constantIdentifier,lO.SymbolType.Var);}};ko.ConstantDeclaration=qd;});var li=S($o=>{Object.defineProperty($o,"__esModule",{value:true});$o.FlowLevel=void 0;var Yv;(function(n){n[n.Story=0]="Story",n[n.Knot=1]="Knot",n[n.Stitch=2]="Stitch",n[n.WeavePoint=3]="WeavePoint";})(Yv||($o.FlowLevel=Yv={}));});var As=S(Vo=>{Object.defineProperty(Vo,"__esModule",{value:true});Vo.Gather=void 0;var cO=Re(),hO=Pe(),dO=Cn(),Bd=class extends hO.ParsedObject{get name(){var e;return ((e=this.identifier)===null||e===void 0?void 0:e.name)||null}get runtimeContainer(){return this.runtimeObject}constructor(e,t){super(),this.indentationDepth=t,this.GenerateRuntimeObject=()=>{let r=new cO.Container;if(r.name=this.name,this.story.countAllVisits&&(r.visitsShouldBeCounted=true),r.countingAtStartOnly=true,this.content)for(let i of this.content)r.AddContent(i.runtimeObject);return r},this.toString=()=>{var r,i;return `- ${!((r=this.identifier)===null||r===void 0)&&r.name?"("+((i=this.identifier)===null||i===void 0?void 0:i.name)+")":"gather"}`},e&&(this.identifier=e);}get typeName(){return "Gather"}ResolveReferences(e){super.ResolveReferences(e),this.identifier&&(this.identifier.name||"").length>0&&e.CheckForNamingCollisions(this,this.identifier,dO.SymbolType.SubFlowAndWeave);}};Vo.Gather=Bd;});var br=S(Lo=>{Object.defineProperty(Lo,"__esModule",{value:true});Lo.Path=void 0;var jo=fe(),Qv=sn(),ci=li(),fO=_r(),Md=class{get baseTargetLevel(){return this.baseLevelIsAmbiguous?ci.FlowLevel.Story:this._baseTargetLevel}get baseLevelIsAmbiguous(){return !this._baseTargetLevel}get firstComponent(){return this.components==null||!this.components.length?null:this.components[0].name}get numberOfComponents(){return this.components?this.components.length:0}get dotSeparatedComponents(){return this._dotSeparatedComponents==null&&(this._dotSeparatedComponents=(this.components?this.components:[]).map(e=>e.name).filter(jo.filterUndef).join(".")),this._dotSeparatedComponents}constructor(e,t){this._dotSeparatedComponents=null,this.toString=()=>this.components===null||this.components.length===0?this.baseTargetLevel===ci.FlowLevel.WeavePoint?"-> <next gather point>":"<invalid Path>":`-> ${this.dotSeparatedComponents}`,this.ResolveFromContext=r=>{if(this.components==null||this.components.length==0)return null;let i=this.ResolveBaseTarget(r);return i===null?null:this.components.length>1?this.ResolveTailComponents(i):i},this.ResolveBaseTarget=r=>{let i=this.firstComponent,a=r;for(;a;){let s=a===r,o=this.GetChildFromContext(a,i,null,s);if(o)return o;a=a.parent;}return null},this.ResolveTailComponents=r=>{let i=r;if(!this.components)return null;for(let a=1;a<this.components.length;++a){let s=this.components[a].name,o,u=(0, jo.asOrNull)(i,Qv.FlowBase);if(u!==null?o=u.flowLevel+1:o=ci.FlowLevel.WeavePoint,i=this.GetChildFromContext(i,s,o),i===null)break}return i},this.GetChildFromContext=(r,i,a,s=false)=>{let o=a===null,u=(0, jo.asOrNull)(r,fO.Weave);if(i&&u!==null&&(o||a===ci.FlowLevel.WeavePoint))return u.WeavePointNamed(i);let l=(0, jo.asOrNull)(r,Qv.FlowBase);if(i&&l!==null){let c=s||l.flowLevel===ci.FlowLevel.Knot;return l.ContentWithNameAtLevel(i,a,c)}return null},Object.values(ci.FlowLevel).includes(e)?(this._baseTargetLevel=e,this.components=t||[]):Array.isArray(e)?(this._baseTargetLevel=null,this.components=e||[]):(this._baseTargetLevel=null,this.components=[e]);}get typeName(){return "Path"}};Lo.Path=Md;});var Hd=S(qo=>{Object.defineProperty(qo,"__esModule",{value:true});qo.ReturnType=void 0;var pO=Pe(),mO=Re(),Wd=Ze(),gO=yr(),Gd=class extends pO.ParsedObject{constructor(e=null){super(),this.returnedExpression=null,this.GenerateRuntimeObject=()=>{let t=new mO.Container;return this.returnedExpression?t.AddContent(this.returnedExpression.runtimeObject):(t.AddContent(Wd.ControlCommand.EvalStart()),t.AddContent(new gO.Void),t.AddContent(Wd.ControlCommand.EvalEnd())),t.AddContent(Wd.ControlCommand.PopFunction()),t},e&&(this.returnedExpression=this.AddContent(e));}get typeName(){return "ReturnType"}};qo.ReturnType=Gd;});var Ds=S(Bo=>{Object.defineProperty(Bo,"__esModule",{value:true});Bo.ClosestFlowBase=void 0;function yO(n){let e=n.parent;for(;e;){if(e.hasOwnProperty("iamFlowbase")&&e.iamFlowbase())return e;e=e.parent;}return null}Bo.ClosestFlowBase=yO;});var Wo=S(Mo=>{Object.defineProperty(Mo,"__esModule",{value:true});Mo.Identifier=void 0;var Jd=class n{constructor(e){this.debugMetadata=null,this.toString=()=>this.name||"undefined identifer",this.name=e;}get typeName(){return "Identifier"}static Done(){return new n("DONE")}};Mo.Identifier=Jd;});var sn=S(Go=>{Object.defineProperty(Go,"__esModule",{value:true});Go.FlowBase=void 0;var vO=ui(),zd=di(),CO=hi(),an=li(),bO=As(),_O=Pe(),SO=br(),EO=Hd(),wO=Re(),AO=rn(),DO=Ln(),Ud=Cn(),xO=_r(),PO=Ds(),OO=Wo(),Zv=fe(),Kd=class n extends _O.ParsedObject{get hasParameters(){return this.args!==null&&this.args.length>0}get subFlowsByName(){return this._subFlowsByName}get typeName(){return this.isFunction?"Function":String(this.flowLevel)}get name(){var e;return ((e=this.identifier)===null||e===void 0?void 0:e.name)||null}constructor(e,t=null,r=null,i=false,a=false){super(),this.isFunction=i,this._rootWeave=null,this._subFlowsByName=new Map,this._startingSubFlowDivert=null,this._startingSubFlowRuntime=null,this._firstChildFlow=null,this.variableDeclarations=new Map,this.identifier=null,this.args=null,this.iamFlowbase=()=>true,this.SplitWeaveAndSubFlowContent=(s,o)=>{var u,l;let c=[],h=[];this._subFlowsByName=new Map;for(let g of s){let p=(0, Zv.asOrNull)(g,n);p?(this._firstChildFlow===null&&(this._firstChildFlow=p),h.push(g),!((u=p.identifier)===null||u===void 0)&&u.name&&this._subFlowsByName.set((l=p.identifier)===null||l===void 0?void 0:l.name,p)):c.push(g);}o&&c.push(new bO.Gather(null,1),new zd.Divert(new SO.Path(OO.Identifier.Done())));let f=[];return c.length>0&&(this._rootWeave=new xO.Weave(c,0),f.push(this._rootWeave)),h.length>0&&f.push(...h),f},this.ResolveVariableWithName=(s,o)=>{var u;let l={},c=o===null?this:(0, PO.ClosestFlowBase)(o);if(c){if(c.args!==null){for(let h of c.args)if(((u=h.identifier)===null||u===void 0?void 0:u.name)===s)return l.found=true,l.isArgument=true,l.ownerFlow=c,l}if(c!==this.story&&c.variableDeclarations.has(s))return l.found=true,l.ownerFlow=c,l.isTemporary=true,l}return this.story.variableDeclarations.has(s)?(l.found=true,l.ownerFlow=this.story,l.isGlobal=true,l):(l.found=false,l)},this.AddNewVariableDeclaration=s=>{let o=s.variableName;if(this.variableDeclarations.has(o)){let u=this.variableDeclarations.get(o),l="";u.debugMetadata&&(l=` (${u.debugMetadata})`),this.Error(`found declaration variable '${o}' that was already declared${l}`,s,false);return}this.variableDeclarations.set(s.variableName,s);},this.ResolveWeavePointNaming=()=>{this._rootWeave&&this._rootWeave.ResolveWeavePointNaming();for(let[,s]of this._subFlowsByName)s.hasOwnProperty("ResolveWeavePointNaming")&&s.ResolveWeavePointNaming();},this.GenerateRuntimeObject=()=>{var s;let o=null;this.isFunction?this.CheckForDisallowedFunctionFlowControl():(this.flowLevel===an.FlowLevel.Knot||this.flowLevel===an.FlowLevel.Stitch)&&(o=this.Find(EO.ReturnType)(),o!==null&&this.Error(`Return statements can only be used in knots that are declared as functions: == function ${this.identifier} ==`,o));let u=new wO.Container;u.name=(s=this.identifier)===null||s===void 0?void 0:s.name,this.story.countAllVisits&&(u.visitsShouldBeCounted=true),this.GenerateArgumentVariableAssignments(u);let l=0;for(;this.content!==null&&l<this.content.length;){let c=this.content[l];if(c instanceof n){let h=c,f=h.runtimeObject;l===0&&!h.hasParameters&&this.flowLevel===an.FlowLevel.Knot&&(this._startingSubFlowDivert=new AO.Divert,u.AddContent(this._startingSubFlowDivert),this._startingSubFlowRuntime=f);let g=f,p=u.namedContent.get(g.name)||null;if(p){let m=`${this.GetType()} already contains flow named '${g.name}' (at ${p.debugMetadata})`;this.Error(m,h);}u.AddToNamedContentOnly(g);}else c&&u.AddContent(c.runtimeObject);l+=1;}return this.flowLevel!==an.FlowLevel.Story&&!this.isFunction&&this._rootWeave!==null&&o===null&&this._rootWeave.ValidateTermination(this.WarningInTermination),u},this.GenerateArgumentVariableAssignments=s=>{var o;if(!(this.args===null||this.args.length===0))for(let u=this.args.length-1;u>=0;--u){let l=((o=this.args[u].identifier)===null||o===void 0?void 0:o.name)||null,c=new DO.VariableAssignment(l,true);s.AddContent(c);}},this.ContentWithNameAtLevel=(s,o=null,u=false)=>{var l;if((o===this.flowLevel||o===null)&&s===((l=this.identifier)===null||l===void 0?void 0:l.name))return this;if(o===an.FlowLevel.WeavePoint||o===null){let h=null;if(this._rootWeave&&(h=this._rootWeave.WeavePointNamed(s),h))return h;if(o===an.FlowLevel.WeavePoint)return u?this.DeepSearchForAnyLevelContent(s):null}if(o!==null&&o<this.flowLevel)return null;let c=this._subFlowsByName.get(s)||null;return c&&(o===null||o===c.flowLevel)?c:u?this.DeepSearchForAnyLevelContent(s):null},this.DeepSearchForAnyLevelContent=s=>{let o=this.ContentWithNameAtLevel(s,an.FlowLevel.WeavePoint,false);if(o)return o;for(let[,u]of this._subFlowsByName){let l=u.ContentWithNameAtLevel(s,null,true);if(l)return l}return null},this.CheckForDisallowedFunctionFlowControl=()=>{this.flowLevel!==an.FlowLevel.Knot&&this.Error("Functions cannot be stitches - i.e. they should be defined as '== function myFunc ==' rather than internal to another knot.");for(let[u,l]of this._subFlowsByName)this.Error(`Functions may not contain stitches, but saw '${u}' within the function '${this.identifier}'`,l);if(!this._rootWeave)throw new Error;let s=this._rootWeave.FindAll(zd.Divert)();for(let u of s)!u.isFunctionCall&&!(u.parent instanceof CO.DivertTarget)&&this.Error(`Functions may not contain diverts, but saw '${u}'`,u);let o=this._rootWeave.FindAll(vO.Choice)();for(let u of o)this.Error(`Functions may not contain choices, but saw '${u}'`,u);},this.WarningInTermination=s=>{let o="Apparent loose end exists where the flow runs out. Do you need a '-> DONE' statement, choice or divert?";s.parent===this._rootWeave&&this._firstChildFlow&&(o=`${o} Note that if you intend to enter '${this._firstChildFlow.identifier}' next, you need to divert to it explicitly.`);let u=(0, Zv.asOrNull)(s,zd.Divert);u&&u.isTunnel&&(o+=` When final tunnel to '${u.target} ->' returns it won't have anywhere to go.`),this.Warning(o,s);},this.toString=()=>`${this.typeName} '${this.identifier}'`,this.identifier=e,this.args=r,t===null&&(t=[]),this.PreProcessTopLevelObjects(t),t=this.SplitWeaveAndSubFlowContent(t,this.GetType()=="Story"&&!a),this.AddContent(t);}PreProcessTopLevelObjects(e){}ResolveReferences(e){var t,r;if(this._startingSubFlowDivert){if(!this._startingSubFlowRuntime)throw new Error;this._startingSubFlowDivert.targetPath=this._startingSubFlowRuntime.path;}if(super.ResolveReferences(e),this.args!==null){for(let i of this.args)e.CheckForNamingCollisions(this,i.identifier,Ud.SymbolType.Arg,"argument");for(let i=0;i<this.args.length;i+=1)for(let a=i+1;a<this.args.length;a+=1)((t=this.args[i].identifier)===null||t===void 0?void 0:t.name)==((r=this.args[a].identifier)===null||r===void 0?void 0:r.name)&&this.Error(`Multiple arguments with the same name: '${this.args[i].identifier}'`);}if(this.flowLevel!==an.FlowLevel.Story){let i=this.flowLevel===an.FlowLevel.Knot?Ud.SymbolType.Knot:Ud.SymbolType.SubFlowAndWeave;e.CheckForNamingCollisions(this,this.identifier,i);}}};Go.FlowBase=Kd;});var Jo=S(Ho=>{Object.defineProperty(Ho,"__esModule",{value:true});Ho.ContentList=void 0;var TO=Re(),NO=Pe(),FO=Bn(),IO=fe(),Xd=class extends NO.ParsedObject{get runtimeContainer(){return this.runtimeObject}constructor(e,...t){super(),this.dontFlatten=false,this.TrimTrailingWhitespace=()=>{for(let r=this.content.length-1;r>=0;--r){let i=(0, IO.asOrNull)(this.content[r],FO.Text);if(i===null)break;if(i.text=i.text.replace(new RegExp(/[ \t]/g),""),i.text.length===0)this.content.splice(r,1);else break}},this.GenerateRuntimeObject=()=>{let r=new TO.Container;if(this.content!==null)for(let i of this.content){let a=i.runtimeObject;a&&r.AddContent(a);}return this.dontFlatten&&this.story.DontFlattenContainer(r),r},this.toString=()=>`ContentList(${this.content.join(", ")})`,e&&this.AddContent(e),t&&this.AddContent(t);}get typeName(){return "ContentList"}};Ho.ContentList=Xd;});var fi=S(zo=>{Object.defineProperty(zo,"__esModule",{value:true});zo.VariableReference=void 0;var kO=mt(),RO=pt(),Yd=class extends kO.InkObject{get containerForCount(){return this.pathForCount===null?null:this.ResolvePath(this.pathForCount).container}get pathStringForCount(){return this.pathForCount===null?null:this.CompactPathString(this.pathForCount)}set pathStringForCount(e){e===null?this.pathForCount=null:this.pathForCount=new RO.Path(e);}constructor(e=null){super(),this.pathForCount=null,this.name=e;}toString(){return this.name!=null?"var("+this.name+")":"read_count("+this.pathStringForCount+")"}};zo.VariableReference=Yd;});var pi=S(Uo=>{Object.defineProperty(Uo,"__esModule",{value:true});Uo.VariableReference=void 0;var $O=Jo(),VO=Ft(),e0=sn(),jO=br(),LO=fi(),qO=_r(),BO=Wo(),t0=fe(),Qd=class extends VO.Expression{get name(){return this.path.join(".")}get path(){return this.pathIdentifiers.map(e=>e.name).filter(t0.filterUndef)}get identifier(){if(!this.pathIdentifiers||this.pathIdentifiers.length==0)return null;let e=this.path.join(".");return new BO.Identifier(e)}get runtimeVarRef(){return this._runtimeVarRef}constructor(e){super(),this.pathIdentifiers=e,this._runtimeVarRef=null,this.isConstantReference=false,this.isListItemReference=false,this.GenerateIntoContainer=t=>{let r=this.story.constants.get(this.name);if(r){r.GenerateConstantIntoContainer(t),this.isConstantReference=true;return}if(this._runtimeVarRef=new LO.VariableReference(this.name),this.path.length===1||this.path.length===2){let i="",a="";this.path.length===1?i=this.path[0]:(a=this.path[0],i=this.path[1]),this.story.ResolveListItem(a,i,this)&&(this.isListItemReference=true);}t.AddContent(this._runtimeVarRef);},this.toString=()=>`{${this.path.join(".")}}`;}get typeName(){return "ref"}ResolveReferences(e){if(super.ResolveReferences(e),this.isConstantReference||this.isListItemReference)return;let t=new jO.Path(this.pathIdentifiers),r=t.ResolveFromContext(this);if(r){if(!r.containerForCounting)throw new Error;if(r.containerForCounting.visitsShouldBeCounted=true,this._runtimeVarRef===null)return;this._runtimeVarRef.pathForCount=r.runtimePath,this._runtimeVarRef.name=null;let i=(0, t0.asOrNull)(r,e0.FlowBase);i&&i.isFunction&&(this.parent instanceof qO.Weave||this.parent instanceof $O.ContentList||this.parent instanceof e0.FlowBase)&&this.Warning(`'${i.identifier}' being used as read count rather than being called as function. Perhaps you intended to write ${i.identifier}()`);return}if(this.path.length>1){let i=`Could not find target for read count: ${t}`;this.path.length<=2&&(i+=`, or couldn't find list item with the name ${this.path.join(",")}`),this.Error(i);return}e.ResolveVariableWithName(this.name,this).found||this.Error(`Unresolved variable: ${this.name}`,this);}};Uo.VariableReference=Qd;});var xs=S(Qo=>{Object.defineProperty(Qo,"__esModule",{value:true});Qo.FunctionCall=void 0;var on=Ze(),MO=di(),WO=hi(),GO=Ft(),HO=yt(),JO=Te(),Xo=nn(),n0=ho(),zO=br(),UO=Te(),KO=pi(),Ko=fe(),Yo=class n extends GO.Expression{get proxyDivert(){return this._proxyDivert}get name(){return this._proxyDivert.target.firstComponent||""}get args(){return this._proxyDivert.args}get runtimeDivert(){return this._proxyDivert.runtimeDivert}get isChoiceCount(){return this.name==="CHOICE_COUNT"}get isTurns(){return this.name==="TURNS"}get isTurnsSince(){return this.name==="TURNS_SINCE"}get isRandom(){return this.name==="RANDOM"}get isSeedRandom(){return this.name==="SEED_RANDOM"}get isListRange(){return this.name==="LIST_RANGE"}get isListRandom(){return this.name==="LIST_RANDOM"}get isReadCount(){return this.name==="READ_COUNT"}constructor(e,t){super(),this._divertTargetToCount=null,this._variableReferenceToCount=null,this.shouldPopReturnedValue=false,this.GenerateIntoContainer=r=>{let i=this.story.ResolveList(this.name),a=false;if(this.isChoiceCount)this.args.length>0&&this.Error("The CHOICE_COUNT() function shouldn't take any arguments"),r.AddContent(on.ControlCommand.ChoiceCount());else if(this.isTurns)this.args.length>0&&this.Error("The TURNS() function shouldn't take any arguments"),r.AddContent(on.ControlCommand.Turns());else if(this.isTurnsSince||this.isReadCount){let s=(0, Ko.asOrNull)(this.args[0],WO.DivertTarget),o=(0, Ko.asOrNull)(this.args[0],KO.VariableReference);if(this.args.length!==1||s===null&&o===null){this.Error(`The ${this.name}() function should take one argument: a divert target to the target knot, stitch, gather or choice you want to check. e.g. TURNS_SINCE(-> myKnot)`);return}s?(this._divertTargetToCount=s,this.AddContent(this._divertTargetToCount),this._divertTargetToCount.GenerateIntoContainer(r)):o&&(this._variableReferenceToCount=o,this.AddContent(this._variableReferenceToCount),this._variableReferenceToCount.GenerateIntoContainer(r)),this.isTurnsSince?r.AddContent(on.ControlCommand.TurnsSince()):r.AddContent(on.ControlCommand.ReadCount());}else if(this.isRandom){this.args.length!==2&&this.Error("RANDOM should take 2 parameters: a minimum and a maximum integer");for(let s=0;s<this.args.length;s+=1){let o=(0, Ko.asOrNull)(this.args[s],n0.NumberExpression);if(o&&!o.isInt()){let u=s===0?"minimum":"maximum";this.Error(`RANDOM's ${u} parameter should be an integer`);}this.args[s].GenerateIntoContainer(r);}r.AddContent(on.ControlCommand.Random());}else if(this.isSeedRandom){this.args.length!==1&&this.Error("SEED_RANDOM should take 1 parameter - an integer seed");let s=(0, Ko.asOrNull)(this.args[0],n0.NumberExpression);s&&!s.isInt()&&this.Error("SEED_RANDOM's parameter should be an integer seed"),this.args[0].GenerateIntoContainer(r),r.AddContent(on.ControlCommand.SeedRandom());}else if(this.isListRange){this.args.length!==3&&this.Error("LIST_RANGE should take 3 parameters - a list, a min and a max");for(let s=0;s<this.args.length;s+=1)this.args[s].GenerateIntoContainer(r);r.AddContent(on.ControlCommand.ListRange());}else if(this.isListRandom)this.args.length!==1&&this.Error("LIST_RANDOM should take 1 parameter - a list"),this.args[0].GenerateIntoContainer(r),r.AddContent(on.ControlCommand.ListRandom());else if(Xo.NativeFunctionCall.CallExistsWithName(this.name)){let s=Xo.NativeFunctionCall.CallWithName(this.name);if(s.numberOfParameters!==this.args.length){let o=`${n.name} should take ${s.numberOfParameters} parameter`;s.numberOfParameters>1&&(o+="s"),this.Error(o);}for(let o=0;o<this.args.length;o+=1)this.args[o].GenerateIntoContainer(r);r.AddContent(Xo.NativeFunctionCall.CallWithName(this.name));}else if(i!==null)if(this.args.length>1&&this.Error("Can currently only construct a list from one integer (or an empty list from a given list definition)"),this.args.length===1)r.AddContent(new UO.StringValue(this.name)),this.args[0].GenerateIntoContainer(r),r.AddContent(on.ControlCommand.ListFromInt());else {let s=new HO.InkList;s.SetInitialOriginName(this.name),r.AddContent(new JO.ListValue(s));}else r.AddContent(this._proxyDivert.runtimeObject),a=true;a||this.content.splice(this.content.indexOf(this._proxyDivert),1),this.shouldPopReturnedValue&&r.AddContent(on.ControlCommand.PopEvaluatedValue());},this.toString=()=>{let r=this.args.join(", ");return `${this.name}(${r})`},this._proxyDivert=new MO.Divert(new zO.Path(e),t),this._proxyDivert.isFunctionCall=true,this.AddContent(this._proxyDivert);}get typeName(){return "FunctionCall"}ResolveReferences(e){if(super.ResolveReferences(e),!this.content.includes(this._proxyDivert)&&this.args!==null)for(let t of this.args)t.ResolveReferences(e);if(this._divertTargetToCount){let t=this._divertTargetToCount.divert,r=t.runtimeDivert.variableDivertName!=null;if(r){this.Error(`When getting the TURNS_SINCE() of a variable target, remove the '->' - i.e. it should just be TURNS_SINCE(${t.runtimeDivert.variableDivertName})`);return}let i=t.targetContent;if(i===null)r||this.Error(`Failed to find target for TURNS_SINCE: '${t.target}'`);else {if(!i.containerForCounting)throw new Error;i.containerForCounting.turnIndexShouldBeCounted=true;}}else if(this._variableReferenceToCount){let t=this._variableReferenceToCount.runtimeVarRef;if(!t)throw new Error;t.pathForCount!==null&&this.Error(`Should be '${n.name}'(-> '${this._variableReferenceToCount.name}). Usage without the '->' only makes sense for variable targets.`);}}};Qo.FunctionCall=Yo;Yo.IsBuiltIn=n=>Xo.NativeFunctionCall.CallExistsWithName(n)?true:n==="CHOICE_COUNT"||n==="TURNS_SINCE"||n==="TURNS"||n==="RANDOM"||n==="SEED_RANDOM"||n==="LIST_VALUE"||n==="LIST_RANDOM"||n==="READ_COUNT";});var ef=S(Zo=>{Object.defineProperty(Zo,"__esModule",{value:true});Zo.MultipleConditionExpression=void 0;var XO=Ft(),YO=nn(),Zd=class extends XO.Expression{get subExpressions(){return this.content}constructor(e){super(),this.GenerateIntoContainer=t=>{let r=true;for(let i of this.subExpressions)i.GenerateIntoContainer(t),r||t.AddContent(YO.NativeFunctionCall.CallWithName("&&")),r=false;},this.AddContent(e);}get typeName(){return "MultipleConditionExpression"}};Zo.MultipleConditionExpression=Zd;});var hi=S(eu=>{Object.defineProperty(eu,"__esModule",{value:true});eu.DivertTarget=void 0;var QO=wd(),ZO=ui(),eT=Fo(),tT=sf(),nT=Te(),tf=Ft(),rT=sn(),r0=xs(),iT=ef(),i0=pi(),nf=fe(),rf=class n extends tf.Expression{get runtimeDivert(){if(!this._runtimeDivert)throw new Error;return this._runtimeDivert}get runtimeDivertTargetValue(){if(!this._runtimeDivertTargetValue)throw new Error;return this._runtimeDivertTargetValue}constructor(e){super(),this._runtimeDivert=null,this._runtimeDivertTargetValue=null,this.GenerateIntoContainer=t=>{this.divert.GenerateRuntimeObject(),this._runtimeDivert=this.divert.runtimeDivert,this._runtimeDivertTargetValue=new nT.DivertTargetValue,t.AddContent(this.runtimeDivertTargetValue);},this.Equals=t=>{let r=(0, nf.asOrNull)(t,n);if(!r||!this.divert.target||!r.divert.target)return false;let i=this.divert.target.dotSeparatedComponents,a=r.divert.target.dotSeparatedComponents;return i===a},this.divert=this.AddContent(e);}get typeName(){return "DivertTarget"}ResolveReferences(e){if(super.ResolveReferences(e),this.divert.isDone||this.divert.isEnd){this.Error("Can't use -> DONE or -> END as variable divert targets",this);return}let t=this;for(;t&&t instanceof tf.Expression;){let i=false,a=false,s=t.parent;if(s instanceof QO.BinaryExpression){let o=s;o.opName!=="=="&&o.opName!=="!="?i=true:(o.leftExpression instanceof n||o.leftExpression instanceof i0.VariableReference)&&(o.rightExpression instanceof n||o.rightExpression instanceof i0.VariableReference)||(i=true),a=true;}else if(s instanceof r0.FunctionCall){let o=s;!o.isTurnsSince&&!o.isReadCount&&(i=true),a=true;}else (s instanceof tf.Expression||s instanceof iT.MultipleConditionExpression||s instanceof ZO.Choice&&s.condition===t||s instanceof eT.Conditional||s instanceof tT.ConditionalSingleBranch)&&(i=true,a=true);if(i&&this.Error(`Can't use a divert target like that. Did you intend to call '${this.divert.target}' as a function: likeThis(), or check the read count: likeThis, with no arrows?`,this),a)break;t=s;}if(this.runtimeDivert.hasVariableTarget){if(!this.divert.target)throw new Error;this.Error(`Since '${this.divert.target.dotSeparatedComponents}' is a variable, it shouldn't be preceded by '->' here.`);}this.runtimeDivert.targetPath&&(this.runtimeDivertTargetValue.targetPath=this.runtimeDivert.targetPath);let r=this.divert.targetContent;if(r!==null){let i=r.containerForCounting;if(i!==null){let s=(0, nf.asOrNull)(this.parent,r0.FunctionCall);s&&s.isTurnsSince||(i.visitsShouldBeCounted=true),i.turnIndexShouldBeCounted=true;}let a=(0, nf.asOrNull)(r,rT.FlowBase);if(a!=null&&a.args!==null)for(let s of a.args)s.isByReference&&this.Error(`Can't store a divert target to a knot or function that has by-reference arguments ('${a.identifier}' has 'ref ${s.identifier}').`);}}};eu.DivertTarget=rf;});var di=S(tu=>{Object.defineProperty(tu,"__esModule",{value:true});tu.Divert=void 0;var sT=Re(),Ps=Ze(),aT=rn(),af=hi(),of=sn(),oT=xs(),uT=Pe(),s0=br(),lT=pt(),a0=vr(),cT=Te(),o0=pi(),hT=Ds(),Os=fe(),uf=class extends uT.ParsedObject{get runtimeDivert(){if(!this._runtimeDivert)throw new Error;return this._runtimeDivert}set runtimeDivert(e){this._runtimeDivert=e;}get isEnd(){return !!(this.target&&this.target.dotSeparatedComponents==="END")}get isDone(){return !!(this.target&&this.target.dotSeparatedComponents==="DONE")}constructor(e,t){super(),this.args=[],this.target=null,this.targetContent=null,this._runtimeDivert=null,this.isFunctionCall=false,this.isEmpty=false,this.isTunnel=false,this.isThread=false,this.GenerateRuntimeObject=()=>{if(this.isEnd)return Ps.ControlCommand.End();if(this.isDone)return Ps.ControlCommand.Done();this.runtimeDivert=new aT.Divert,this.ResolveTargetContent(),this.CheckArgumentValidity();let r=this.args!==null&&this.args.length>0;if(r||this.isFunctionCall||this.isTunnel||this.isThread){let i=new sT.Container;if(r){this.isFunctionCall||i.AddContent(Ps.ControlCommand.EvalStart());let a=null;this.targetContent&&(a=this.targetContent.args);for(let s=0;s<this.args.length;++s){let o=this.args[s],u=null;if(a&&s<a.length&&(u=a[s]),u&&u.isByReference){let l=(0, Os.asOrNull)(o,o0.VariableReference);if(!l){this.Error(`Expected variable name to pass by reference to 'ref ${u.identifier}' but saw ${o}`);break}let c=new s0.Path(l.pathIdentifiers);if(c.ResolveFromContext(this)){this.Error(`can't pass a read count by reference. '${c.dotSeparatedComponents}' is a knot/stitch/label, but '${this.target.dotSeparatedComponents}' requires the name of a VAR to be passed.`);break}let f=new cT.VariablePointerValue(l.name);i.AddContent(f);}else o.GenerateIntoContainer(i);}this.isFunctionCall||i.AddContent(Ps.ControlCommand.EvalEnd());}return this.isThread?i.AddContent(Ps.ControlCommand.StartThread()):(this.isFunctionCall||this.isTunnel)&&(this.runtimeDivert.pushesToStack=true,this.runtimeDivert.stackPushType=this.isFunctionCall?a0.PushPopType.Function:a0.PushPopType.Tunnel),i.AddContent(this.runtimeDivert),i}return this.runtimeDivert},this.PathAsVariableName=()=>this.target?this.target.firstComponent:null,this.ResolveTargetContent=()=>{if(!(this.isEmpty||this.isEnd)&&this.targetContent===null){let r=this.PathAsVariableName();if(r!==null){let i=(0, Os.asOrNull)((0, hT.ClosestFlowBase)(this),of.FlowBase);if(i){let a=i.ResolveVariableWithName(r,this);if(a.found){if(a.isArgument&&a.ownerFlow&&a.ownerFlow.args){let s=a.ownerFlow.args.find(o=>{var u;return ((u=o.identifier)===null||u===void 0?void 0:u.name)==r});s&&!s.isDivertTarget&&this.Error(`Since '${s.identifier}' is used as a variable divert target (on ${this.debugMetadata}), it should be marked as: -> ${s.identifier}`,a.ownerFlow);}this.runtimeDivert.variableDivertName=r;return}}}if(!this.target)throw new Error;this.targetContent=this.target.ResolveFromContext(this);}},this.CheckArgumentValidity=()=>{if(this.isEmpty)return;let r=0;if(this.args!==null&&this.args.length>0&&(r=this.args.length),this.targetContent===null)return;let i=(0, Os.asOrNull)(this.targetContent,of.FlowBase);if(r===0&&(i===null||!i.hasParameters))return;if(i===null&&r>0){this.Error("target needs to be a knot or stitch in order to pass arguments");return}else if(i!==null&&(i.args===null||!i.args&&r>0)){this.Error(`target (${i.name}) doesn't take parameters`);return}else if(this.parent instanceof af.DivertTarget){r>0&&this.Error("can't store arguments in a divert target variable");return}let a=i.args.length;if(a!==r){let s;r===0?s="but there weren't any passed to it":r<a?s=`but only got ${r}`:s=`but got ${r}`,this.Error(`to '${i.identifier}' requires ${a} arguments, ${s}`);return}for(let s=0;s<a;++s){let o=i.args[s],u=this.args[s];if(o.isDivertTarget){let l=(0, Os.asOrNull)(u,o0.VariableReference);if(!(u instanceof af.DivertTarget)&&l===null)this.Error(`Target '${i.identifier}' expects a divert target for the parameter named -> ${o.identifier} but saw ${u}`,u);else if(l){let c=new s0.Path(l.pathIdentifiers);c.ResolveFromContext(l)&&this.Error(`Passing read count of '${c.dotSeparatedComponents}' instead of a divert target. You probably meant '${c}'`);}}}if(i===null){this.Error("Can't call as a function or with arguments unless it's a knot or stitch");return}},this.CheckExternalArgumentValidity=r=>{let i=this.target?this.target.firstComponent:null,a=r.externals.get(i);if(!a)throw new Error("external not found");let s=a.argumentNames.length,o=0;this.args&&(o=this.args.length),o!==s&&this.Error(`incorrect number of arguments sent to external function '${i}'. Expected ${s} but got ${o}`);},this.toString=()=>{let r="";if(this.target!==null)r+=this.target.toString();else return "-> <empty divert>";return this.isTunnel&&(r+=" ->"),this.isFunctionCall&&(r+=" ()"),r},e&&(this.target=e),t&&(this.args=t,this.AddContent(t));}get typeName(){return "Divert"}ResolveReferences(e){if(this.isEmpty||this.isEnd||this.isDone)return;if(!this.runtimeDivert)throw new Error;this.targetContent&&(this.runtimeDivert.targetPath=this.targetContent.runtimePath),super.ResolveReferences(e);let t=(0, Os.asOrNull)(this.targetContent,of.FlowBase);t&&(!t.isFunction&&this.isFunctionCall?super.Error(`${t.identifier} hasn't been marked as a function, but it's being called as one. Do you need to declare the knot as '== function ${t.identifier} =='?`):t.isFunction&&!this.isFunctionCall&&!(this.parent instanceof af.DivertTarget)&&super.Error(t.identifier+" can't be diverted to. It can only be called as a function since it's been marked as such: '"+t.identifier+"(...)'"));let r=this.targetContent!==null,i=false,a=false;if(this.target){if(this.target.numberOfComponents===1){if(!this.target.firstComponent)throw new Error;if(i=oT.FunctionCall.IsBuiltIn(this.target.firstComponent),a=e.IsExternal(this.target.firstComponent),i||a){this.isFunctionCall||super.Error(`${this.target.firstComponent} must be called as a function: ~ ${this.target.firstComponent}()`),a&&(this.runtimeDivert.isExternal=true,this.args!==null&&(this.runtimeDivert.externalArgs=this.args.length),this.runtimeDivert.pushesToStack=false,this.runtimeDivert.targetPath=new lT.Path(this.target.firstComponent),this.CheckExternalArgumentValidity(e));return}}}else throw new Error;this.runtimeDivert.variableDivertName==null&&!r&&!i&&!a&&this.Error(`target not found: '${this.target}'`);}Error(e,t=null,r=false){if(t!==this&&t){super.Error(e,t);return}this.isFunctionCall?super.Error(`Function call ${e}`,t,r):super.Error(`Divert ${e}`,t,r);}};tu.Divert=uf;});var u0=S(nu=>{Object.defineProperty(nu,"__esModule",{value:true});nu.GatherPointToResolve=void 0;var lf=class{constructor(e,t){this.divert=e,this.targetRuntimeObj=t;}};nu.GatherPointToResolve=lf;});var l0=S(ru=>{Object.defineProperty(ru,"__esModule",{value:true});ru.SequenceDivertToResolve=void 0;var cf=class{constructor(e,t){this.divert=e,this.targetContent=t;}};ru.SequenceDivertToResolve=cf;});var hf=S(iu=>{Object.defineProperty(iu,"__esModule",{value:true});iu.SequenceType=void 0;var c0;(function(n){n[n.Stopping=1]="Stopping",n[n.Cycle=2]="Cycle",n[n.Shuffle=4]="Shuffle",n[n.Once=8]="Once";})(c0||(iu.SequenceType=c0={}));});var pf=S(ou=>{Object.defineProperty(ou,"__esModule",{value:true});ou.Sequence=void 0;var h0=Re(),Wt=Ze(),df=rn(),Ts=Te(),su=nn(),dT=Pe(),fT=l0(),au=hf(),pT=_r(),ff=class extends dT.ParsedObject{constructor(e,t){super(),this.sequenceType=t,this._sequenceDivertsToResolve=[],this.GenerateRuntimeObject=()=>{let r=new h0.Container;r.visitsShouldBeCounted=true,r.countingAtStartOnly=true,this._sequenceDivertsToResolve=[],r.AddContent(Wt.ControlCommand.EvalStart()),r.AddContent(Wt.ControlCommand.VisitIndex());let i=(this.sequenceType&au.SequenceType.Once)>0,a=(this.sequenceType&au.SequenceType.Cycle)>0,s=(this.sequenceType&au.SequenceType.Stopping)>0,o=(this.sequenceType&au.SequenceType.Shuffle)>0,u=this.sequenceElements.length;if(i&&(u+=1),s||i?(r.AddContent(new Ts.IntValue(u-1)),r.AddContent(su.NativeFunctionCall.CallWithName("MIN"))):a&&(r.AddContent(new Ts.IntValue(this.sequenceElements.length)),r.AddContent(su.NativeFunctionCall.CallWithName("%"))),o){let c=Wt.ControlCommand.NoOp();if(i||s){let f=s?this.sequenceElements.length-1:this.sequenceElements.length;r.AddContent(Wt.ControlCommand.Duplicate()),r.AddContent(new Ts.IntValue(f)),r.AddContent(su.NativeFunctionCall.CallWithName("=="));let g=new df.Divert;g.isConditional=true,r.AddContent(g),this.AddDivertToResolve(g,c);}let h=this.sequenceElements.length;s&&(h-=1),r.AddContent(new Ts.IntValue(h)),r.AddContent(Wt.ControlCommand.SequenceShuffleIndex()),(i||s)&&r.AddContent(c);}r.AddContent(Wt.ControlCommand.EvalEnd());let l=Wt.ControlCommand.NoOp();for(let c=0;c<u;c+=1){r.AddContent(Wt.ControlCommand.EvalStart()),r.AddContent(Wt.ControlCommand.Duplicate()),r.AddContent(new Ts.IntValue(c)),r.AddContent(su.NativeFunctionCall.CallWithName("==")),r.AddContent(Wt.ControlCommand.EvalEnd());let h=new df.Divert;h.isConditional=true,r.AddContent(h);let f;c<this.sequenceElements.length?f=this.sequenceElements[c].runtimeObject:f=new h0.Container,f.name=`s${c}`,f.InsertContent(Wt.ControlCommand.PopEvaluatedValue(),0);let g=new df.Divert;f.AddContent(g),r.AddToNamedContentOnly(f),this.AddDivertToResolve(h,f),this.AddDivertToResolve(g,l);}return r.AddContent(l),r},this.AddDivertToResolve=(r,i)=>{this._sequenceDivertsToResolve.push(new fT.SequenceDivertToResolve(r,i));},this.sequenceType=t,this.sequenceElements=[];for(let r of e){let i=r.content,a=null;i===null||i.length===0?a=r:a=new pT.Weave(i),this.sequenceElements.push(a),this.AddContent(a);}}get typeName(){return "Sequence"}ResolveReferences(e){super.ResolveReferences(e);for(let t of this._sequenceDivertsToResolve)t.divert.targetPath=t.targetContent.path;}};ou.Sequence=ff;});var gf=S(uu=>{Object.defineProperty(uu,"__esModule",{value:true});uu.TunnelOnwards=void 0;var mT=Re(),Ns=Ze(),gT=rn(),yT=Te(),vT=Pe(),CT=yr(),bT=fe(),_T=fi(),mf=class extends vT.ParsedObject{constructor(){super(...arguments),this._overrideDivertTarget=null,this._divertAfter=null,this.GenerateRuntimeObject=()=>{let e=new mT.Container;if(e.AddContent(Ns.ControlCommand.EvalStart()),this.divertAfter){let t=this.divertAfter.GenerateRuntimeObject(),r=t;if(r){let a=this.divertAfter.args;if(a!==null&&a.length>0){let s=-1,o=-1;for(let u=0;u<r.content.length;u+=1){let l=r.content[u];l&&(s==-1&&l.commandType===Ns.ControlCommand.CommandType.EvalStart?s=u:l.commandType===Ns.ControlCommand.CommandType.EvalEnd&&(o=u));}for(let u=s+1;u<o;u+=1){let l=r.content[u];l.parent=null,e.AddContent(r.content[u]);}}}let i=(0, bT.asOrNull)(t,gT.Divert);if(i!=null&&i.hasVariableTarget){let a=new _T.VariableReference(i.variableDivertName);e.AddContent(a);}else this._overrideDivertTarget=new yT.DivertTargetValue,e.AddContent(this._overrideDivertTarget);}else e.AddContent(new CT.Void);return e.AddContent(Ns.ControlCommand.EvalEnd()),e.AddContent(Ns.ControlCommand.PopTunnel()),e},this.toString=()=>` -> ${this._divertAfter}`;}get divertAfter(){return this._divertAfter}set divertAfter(e){this._divertAfter=e,this._divertAfter&&this.AddContent(this._divertAfter);}get typeName(){return "TunnelOnwards"}ResolveReferences(e){super.ResolveReferences(e),this.divertAfter&&this.divertAfter.targetContent&&(this._overrideDivertTarget.targetPath=this.divertAfter.targetContent.runtimePath);}};uu.TunnelOnwards=mf;});var Cf=S(lu=>{Object.defineProperty(lu,"__esModule",{value:true});lu.ListDefinition=void 0;var yf=yt(),vf=class{constructor(e,t){this._name=e||"",this._items=null,this._itemNameToValues=t||new Map;}get name(){return this._name}get items(){if(this._items==null){this._items=new Map;for(let[e,t]of this._itemNameToValues){let r=new yf.InkListItem(this.name,e);this._items.set(r.serialized(),t);}}return this._items}ValueForItem(e){if(!e.itemName)return 0;let t=this._itemNameToValues.get(e.itemName);return typeof t<"u"?t:0}ContainsItem(e){return !e.itemName||e.originName!=this.name?false:this._itemNameToValues.has(e.itemName)}ContainsItemWithName(e){return this._itemNameToValues.has(e)}TryGetItemWithValue(e,t){for(let[r,i]of this._itemNameToValues)if(i==e)return t=new yf.InkListItem(this.name,r),{result:t,exists:true};return t=yf.InkListItem.Null,{result:t,exists:false}}TryGetValueForItem(e,t){if(!e.itemName)return {result:0,exists:false};let r=this._itemNameToValues.get(e.itemName);return r?{result:r,exists:true}:{result:0,exists:false}}};lu.ListDefinition=vf;});var hu=S(cu=>{Object.defineProperty(cu,"__esModule",{value:true});cu.ListDefinition=void 0;var ST=yt(),ET=yt(),wT=Cf(),AT=Te(),DT=Pe(),xT=Cn(),bf=class extends DT.ParsedObject{get typeName(){return "ListDefinition"}get runtimeListDefinition(){var e;let t=new Map;for(let r of this.itemDefinitions)t.has(r.name)?this.Error(`List '${this.identifier}' contains duplicate items called '${r.name}'`):t.set(r.name,r.seriesValue);return new wT.ListDefinition(((e=this.identifier)===null||e===void 0?void 0:e.name)||"",t)}constructor(e){super(),this.itemDefinitions=e,this.identifier=null,this.variableAssignment=null,this._elementsByName=null,this.ItemNamed=r=>{if(this._elementsByName===null){this._elementsByName=new Map;for(let a of this.itemDefinitions)this._elementsByName.set(a.name,a);}return this._elementsByName.get(r)||null},this.GenerateRuntimeObject=()=>{var r,i;let a=new ST.InkList;for(let s of this.itemDefinitions)if(s.inInitialList){let o=new ET.InkListItem(((r=this.identifier)===null||r===void 0?void 0:r.name)||null,s.name||null);a.Add(o,s.seriesValue);}return a.SetInitialOriginName(((i=this.identifier)===null||i===void 0?void 0:i.name)||""),new AT.ListValue(a)};let t=1;for(let r of this.itemDefinitions)r.explicitValue!==null&&(t=r.explicitValue),r.seriesValue=t,t+=1;this.AddContent(e);}ResolveReferences(e){super.ResolveReferences(e),e.CheckForNamingCollisions(this,this.identifier,xT.SymbolType.List);}};cu.ListDefinition=bf;});var Sf=S(du=>{Object.defineProperty(du,"__esModule",{value:true});du.VariableAssignment=void 0;var PT=Re(),OT=Ds(),TT=hu(),NT=Pe(),d0=Cn(),FT=Ln(),IT=pi(),kT=fe(),_f=class extends NT.ParsedObject{get variableName(){return this.variableIdentifier.name}get typeName(){return this.isNewTemporaryDeclaration?"temp":this.isGlobalDeclaration?this.listDefinition!==null?"LIST":"VAR":"variable assignment"}get isDeclaration(){return this.isGlobalDeclaration||this.isNewTemporaryDeclaration}constructor({assignedExpression:e,isGlobalDeclaration:t,isTemporaryNewDeclaration:r,listDef:i,variableIdentifier:a}){super(),this._runtimeAssignment=null,this.expression=null,this.listDefinition=null,this.GenerateRuntimeObject=()=>{let s=null;if(this.isGlobalDeclaration?s=this.story:this.isNewTemporaryDeclaration&&(s=(0, OT.ClosestFlowBase)(this)),s&&s.AddNewVariableDeclaration(this),this.isGlobalDeclaration)return null;let o=new PT.Container;return this.expression?o.AddContent(this.expression.runtimeObject):this.listDefinition&&o.AddContent(this.listDefinition.runtimeObject),this._runtimeAssignment=new FT.VariableAssignment(this.variableName,this.isNewTemporaryDeclaration),o.AddContent(this._runtimeAssignment),o},this.toString=()=>`${this.isGlobalDeclaration?"VAR":this.isNewTemporaryDeclaration?"~ temp":""} ${this.variableName}`,this.variableIdentifier=a,this.isGlobalDeclaration=!!t,this.isNewTemporaryDeclaration=!!r,i instanceof TT.ListDefinition?(this.listDefinition=this.AddContent(i),this.listDefinition.variableAssignment=this,this.isGlobalDeclaration=true):e&&(this.expression=this.AddContent(e));}ResolveReferences(e){if(super.ResolveReferences(e),this.isDeclaration&&this.listDefinition===null&&e.CheckForNamingCollisions(this,this.variableIdentifier,this.isGlobalDeclaration?d0.SymbolType.Var:d0.SymbolType.Temp),this.isGlobalDeclaration){let t=(0, kT.asOrNull)(this.expression,IT.VariableReference);t&&!t.isConstantReference&&!t.isListItemReference&&this.Error("global variable assignments cannot refer to other variables, only literal values, constants and list items");}if(!this.isNewTemporaryDeclaration){let t=e.ResolveVariableWithName(this.variableName,this);t.found||(this.variableName in this.story.constants?this.Error(`Can't re-assign to a constant (do you need to use VAR when declaring '${this.variableName}'?)`,this):this.Error(`Variable could not be found to assign to: '${this.variableName}'`,this)),this._runtimeAssignment&&(this._runtimeAssignment.isGlobal=t.isGlobal);}}};du.VariableAssignment=_f;});var _r=S(mu=>{Object.defineProperty(mu,"__esModule",{value:true});mu.Weave=void 0;var f0=Ka(),kt=ui(),fu=Fo(),RT=Ro(),$T=Re(),pu=di(),VT=rn(),jT=hi(),LT=sn(),un=As(),qT=u0(),BT=Pe(),Ef=pf(),MT=Bn(),WT=gf(),GT=Sf(),Rt=fe(),wf=class n extends BT.ParsedObject{get rootContainer(){return this._rootContainer||(this._rootContainer=this.GenerateRuntimeObject()),this._rootContainer}get namedWeavePoints(){return this._namedWeavePoints}get lastParsedSignificantObject(){if(this.content.length===0)return null;let e=null;for(let r=this.content.length-1;r>=0;--r){e=this.content[r];let i=(0, Rt.asOrNull)(e,MT.Text);if(!(i&&i.text===`
|
|
22
22
|
`)&&!this.IsGlobalDeclaration(e))break}let t=(0, Rt.asOrNull)(e,n);return t&&(e=t.lastParsedSignificantObject),e}constructor(e,t=-1){super(),this.previousWeavePoint=null,this.addContentToPreviousWeavePoint=false,this.hasSeenChoiceInSection=false,this.currentContainer=null,this._unnamedGatherCount=0,this._choiceCount=0,this._rootContainer=null,this._namedWeavePoints=new Map,this.looseEnds=[],this.gatherPointsToResolve=[],this.ResolveWeavePointNaming=()=>{var r,i,a;let s=[...this.FindAll(un.Gather)(o=>!(o.name===null||o.name===void 0)),...this.FindAll(kt.Choice)(o=>!(o.name===null||o.name===void 0))];this._namedWeavePoints=new Map;for(let o of s){let u=this.namedWeavePoints.get(((r=o.identifier)===null||r===void 0?void 0:r.name)||"");if(u){let l=u instanceof un.Gather?"gather":"choice",c=u;this.Error(`A ${l} with the same label name '${o.name}' already exists in this context on line ${c.debugMetadata?c.debugMetadata.startLineNumber:"NO DEBUG METADATA AVAILABLE"}`,o);}!((i=o.identifier)===null||i===void 0)&&i.name&&this.namedWeavePoints.set((a=o.identifier)===null||a===void 0?void 0:a.name,o);}},this.ConstructWeaveHierarchyFromIndentation=()=>{let r=0;for(;r<this.content.length;){let i=this.content[r];if(i instanceof kt.Choice||i instanceof un.Gather){let s=i.indentationDepth-1;if(s>this.baseIndentIndex){let o=r;for(;r<this.content.length;){let h=(0, Rt.asOrNull)(this.content[r],kt.Choice)||(0, Rt.asOrNull)(this.content[r],un.Gather);if(h!==null&&h.indentationDepth-1<=this.baseIndentIndex)break;r+=1;}let u=r-o,l=this.content.slice(o,o+u);this.content.splice(o,u);let c=new n(l,s);this.InsertContent(o,c),r=o;}}r+=1;}},this.DetermineBaseIndentationFromContent=r=>{for(let i of r)if(i instanceof kt.Choice||i instanceof un.Gather)return i.indentationDepth-1;return 0},this.GenerateRuntimeObject=()=>{this._rootContainer=new $T.Container,this.currentContainer=this._rootContainer,this.looseEnds=[],this.gatherPointsToResolve=[];for(let r of this.content)if(r instanceof kt.Choice||r instanceof un.Gather)this.AddRuntimeForWeavePoint(r);else if(r instanceof n){let i=r;this.AddRuntimeForNestedWeave(i),this.gatherPointsToResolve.splice(0,0,...i.gatherPointsToResolve);}else this.AddGeneralRuntimeContent(r.runtimeObject);return this.PassLooseEndsToAncestors(),this._rootContainer},this.AddRuntimeForGather=r=>{let i=!this.hasSeenChoiceInSection;this.hasSeenChoiceInSection=false;let a=r.runtimeContainer;if(r.name||(a.name=`g-${this._unnamedGatherCount}`,this._unnamedGatherCount+=1),i){if(!this.currentContainer)throw new Error;this.currentContainer.AddContent(a);}else this.rootContainer.AddToNamedContentOnly(a);for(let s of this.looseEnds){let o=s;if(o instanceof un.Gather&&o.indentationDepth==r.indentationDepth)continue;let u=null;if(o instanceof pu.Divert)u=o.runtimeObject;else {u=new VT.Divert;let l=o;if(!l.runtimeContainer)throw new Error;l.runtimeContainer.AddContent(u);}this.gatherPointsToResolve.push(new qT.GatherPointToResolve(u,a));}this.looseEnds=[],this.currentContainer=a;},this.AddRuntimeForWeavePoint=r=>{if(r instanceof un.Gather)this.AddRuntimeForGather(r);else if(r instanceof kt.Choice){if(!this.currentContainer)throw new Error;this.previousWeavePoint instanceof un.Gather&&this.looseEnds.splice(this.looseEnds.indexOf(this.previousWeavePoint),1);let i=r;if(this.currentContainer.AddContent(i.runtimeObject),!i.innerContentContainer)throw new Error;i.innerContentContainer.name=`c-${this._choiceCount}`,this.currentContainer.AddToNamedContentOnly(i.innerContentContainer),this._choiceCount+=1,this.hasSeenChoiceInSection=true;}this.addContentToPreviousWeavePoint=false,this.WeavePointHasLooseEnd(r)&&(this.looseEnds.push(r),(0, Rt.asOrNull)(r,kt.Choice)&&(this.addContentToPreviousWeavePoint=true)),this.previousWeavePoint=r;},this.AddRuntimeForNestedWeave=r=>{this.AddGeneralRuntimeContent(r.rootContainer),this.previousWeavePoint!==null&&(this.looseEnds.splice(this.looseEnds.indexOf(this.previousWeavePoint),1),this.addContentToPreviousWeavePoint=false);},this.AddGeneralRuntimeContent=r=>{if(r!==null)if(this.addContentToPreviousWeavePoint){if(!this.previousWeavePoint||!this.previousWeavePoint.runtimeContainer)throw new Error;this.previousWeavePoint.runtimeContainer.AddContent(r);}else {if(!this.currentContainer)throw new Error;this.currentContainer.AddContent(r);}},this.PassLooseEndsToAncestors=()=>{if(this.looseEnds.length===0)return;let r=null,i=null,a=false;for(let s=this.parent;s!==null;s=s.parent){let o=(0, Rt.asOrNull)(s,n);o&&(!a&&r===null&&(r=o),a&&i===null&&(i=o)),(s instanceof Ef.Sequence||s instanceof fu.Conditional)&&(a=true);}if(!(r===null&&i===null))for(let s=this.looseEnds.length-1;s>=0;s-=1){let o=this.looseEnds[s],u=false;if(a){if(o instanceof kt.Choice&&r!==null)r.ReceiveLooseEnd(o),u=true;else if(!(o instanceof kt.Choice)){let l=r||i;l!==null&&(l.ReceiveLooseEnd(o),u=true);}}else r?.hasOwnProperty("ReceiveLooseEnd")&&r.ReceiveLooseEnd(o),u=true;u&&this.looseEnds.splice(s,1);}},this.ReceiveLooseEnd=r=>{this.looseEnds.push(r);},this.WeavePointNamed=r=>{if(!this.namedWeavePoints)return null;let i=this.namedWeavePoints.get(r);return i||null},this.IsGlobalDeclaration=r=>{let i=(0, Rt.asOrNull)(r,GT.VariableAssignment);return !!(i&&i.isGlobalDeclaration&&i.isDeclaration||(0, Rt.asOrNull)(r,RT.ConstantDeclaration))},this.ContentThatFollowsWeavePoint=r=>{let i=[],a=r;if(a.content!==null)for(let u of a.content)this.IsGlobalDeclaration(u)||i.push(u);let s=(0, Rt.asOrNull)(a.parent,n);if(s===null)throw new Error("Expected weave point parent to be weave?");let o=s.content.indexOf(a);for(let u=o+1;u<s.content.length;u+=1){let l=s.content[u];if(!this.IsGlobalDeclaration(l)){if(l instanceof kt.Choice||l instanceof un.Gather||l instanceof n)break;i.push(l);}}return i},this.ValidateTermination=r=>{if(this.lastParsedSignificantObject instanceof f0.AuthorWarning)return;if(this.looseEnds!==null&&this.looseEnds.length>0)for(let a of this.looseEnds){let s=this.ContentThatFollowsWeavePoint(a);this.ValidateFlowOfObjectsTerminates(s,a,r);}else {for(let a of this.content)if(a instanceof kt.Choice||a instanceof pu.Divert)return;this.ValidateFlowOfObjectsTerminates(this.content,this,r);}},this.BadNestedTerminationHandler=r=>{let i=null;for(let s=r.parent;s!==null;s=s.parent)if(s instanceof Ef.Sequence||s instanceof fu.Conditional){i=(0, Rt.asOrNull)(s,fu.Conditional);break}let a="Choices nested in conditionals or sequences need to explicitly divert afterwards.";i!==null&&i.FindAll(kt.Choice)().length===1&&(a=`Choices with conditions should be written: '* {condition} choice'. Otherwise, ${a.toLowerCase()}`),this.Error(a,r);},this.ValidateFlowOfObjectsTerminates=(r,i,a)=>{let s=false,o=i;for(let u of r){if(u.Find(pu.Divert)(c=>!c.isThread&&!c.isTunnel&&!c.isFunctionCall&&!(c.parent instanceof jT.DivertTarget))!==null&&(s=true),u.Find(WT.TunnelOnwards)()!=null){s=true;break}o=u;}if(!s){if(o instanceof f0.AuthorWarning)return;a(o);}},this.WeavePointHasLooseEnd=r=>{if(r.content===null)return true;for(let i=r.content.length-1;i>=0;--i){let a=(0, Rt.asOrNull)(r.content[i],pu.Divert);if(a&&!(a.isThread||a.isTunnel||a.isFunctionCall))return false}return true},this.CheckForWeavePointNamingCollisions=()=>{if(!this.namedWeavePoints)return;let r=[];for(let i of this.ancestry){let a=(0, Rt.asOrNull)(i,LT.FlowBase);if(a)r.push(a);else break}for(let[i,a]of this.namedWeavePoints)for(let s of r){let o=s.ContentWithNameAtLevel(i);if(o&&o!==a){let u=`${a.GetType()} '${i}' has the same label name as a ${o.GetType()} (on ${o.debugMetadata})`;this.Error(u,a);}}},t==-1?this.baseIndentIndex=this.DetermineBaseIndentationFromContent(e):this.baseIndentIndex=t,this.AddContent(e),this.ConstructWeaveHierarchyFromIndentation();}get typeName(){return "Weave"}ResolveReferences(e){if(super.ResolveReferences(e),this.looseEnds!==null&&this.looseEnds.length>0){let t=false;for(let r=this.parent;r!==null;r=r.parent)if(r instanceof Ef.Sequence||r instanceof fu.Conditional){t=true;break}t&&this.ValidateTermination(this.BadNestedTerminationHandler);}for(let t of this.gatherPointsToResolve)t.divert.targetPath=t.targetRuntimeObj.path;this.CheckForWeavePointNamingCollisions();}};mu.Weave=wf;});var sf=S(yu=>{Object.defineProperty(yu,"__esModule",{value:true});yu.ConditionalSingleBranch=void 0;var p0=Re(),gu=Ze(),m0=rn(),HT=Pe(),JT=nn(),zT=Te(),UT=Bn(),KT=_r(),XT=fe(),Af=class extends HT.ParsedObject{get ownExpression(){return this._ownExpression}set ownExpression(e){this._ownExpression=e,this._ownExpression&&this.AddContent(this._ownExpression);}constructor(e){super(),this._contentContainer=null,this._conditionalDivert=null,this._ownExpression=null,this._innerWeave=null,this.isTrueBranch=false,this.matchingEquality=false,this.isElse=false,this.isInline=false,this.returnDivert=null,this.GenerateRuntimeObject=()=>{if(this._innerWeave)for(let i of this._innerWeave.content){let a=(0, XT.asOrNull)(i,UT.Text);a&&a.text.startsWith("else:")&&this.Warning("Saw the text 'else:' which is being treated as content. Did you mean '- else:'?",a);}let t=new p0.Container,r=this.matchingEquality&&!this.isElse;if(r&&t.AddContent(gu.ControlCommand.Duplicate()),this._conditionalDivert=new m0.Divert,this._conditionalDivert.isConditional=!this.isElse,!this.isTrueBranch&&!this.isElse){let i=this.ownExpression!==null;i&&t.AddContent(gu.ControlCommand.EvalStart()),this.ownExpression&&this.ownExpression.GenerateIntoContainer(t),this.matchingEquality&&t.AddContent(JT.NativeFunctionCall.CallWithName("==")),i&&t.AddContent(gu.ControlCommand.EvalEnd());}return t.AddContent(this._conditionalDivert),this._contentContainer=this.GenerateRuntimeForContent(),this._contentContainer.name="b",this.isInline||this._contentContainer.InsertContent(new zT.StringValue(`
|
|
23
|
-
`),0),(r||this.isElse&&this.matchingEquality)&&this._contentContainer.InsertContent(gu.ControlCommand.PopEvaluatedValue(),0),t.AddToNamedContentOnly(this._contentContainer),this.returnDivert=new m0.Divert,this._contentContainer.AddContent(this.returnDivert),t},this.GenerateRuntimeForContent=()=>this._innerWeave===null?new p0.Container:this._innerWeave.rootContainer,e&&(this._innerWeave=new KT.Weave(e),this.AddContent(this._innerWeave));}get typeName(){return "ConditionalSingleBranch"}ResolveReferences(e){if(!this._conditionalDivert||!this._contentContainer)throw new Error;this._conditionalDivert.targetPath=this._contentContainer.path,super.ResolveReferences(e);}};yu.ConditionalSingleBranch=Af;});var y0=S(vu=>{Object.defineProperty(vu,"__esModule",{value:true});vu.CustomFlags=void 0;var g0;(function(n){n[n.ParsingString=1]="ParsingString",n[n.TagActive=2]="TagActive";})(g0||(vu.CustomFlags=g0={}));});var v0=S(Cu=>{Object.defineProperty(Cu,"__esModule",{value:true});Cu.DebugMetadata=void 0;var Df=class n{constructor(){this.startLineNumber=0,this.endLineNumber=0,this.startCharacterNumber=0,this.endCharacterNumber=0,this.fileName=null,this.sourceName=null;}Merge(e){let t=new n;return t.fileName=this.fileName,t.sourceName=this.sourceName,this.startLineNumber<e.startLineNumber?(t.startLineNumber=this.startLineNumber,t.startCharacterNumber=this.startCharacterNumber):this.startLineNumber>e.startLineNumber?(t.startLineNumber=e.startLineNumber,t.startCharacterNumber=e.startCharacterNumber):(t.startLineNumber=this.startLineNumber,t.startCharacterNumber=Math.min(this.startCharacterNumber,e.startCharacterNumber)),this.endLineNumber>e.endLineNumber?(t.endLineNumber=this.endLineNumber,t.endCharacterNumber=this.endCharacterNumber):this.endLineNumber<e.endLineNumber?(t.endLineNumber=e.endLineNumber,t.endCharacterNumber=e.endCharacterNumber):(t.endLineNumber=this.endLineNumber,t.endCharacterNumber=Math.max(this.endCharacterNumber,e.endCharacterNumber)),t}toString(){return this.fileName!==null?`line ${this.startLineNumber} of ${this.fileName}"`:"line "+this.startLineNumber}};Cu.DebugMetadata=Df;});var C0=S(bu=>{Object.defineProperty(bu,"__esModule",{value:true});bu.ExternalDeclaration=void 0;var YT=Pe(),xf=class extends YT.ParsedObject{get name(){var e;return ((e=this.identifier)===null||e===void 0?void 0:e.name)||null}constructor(e,t){super(),this.identifier=e,this.argumentNames=t,this.GenerateRuntimeObject=()=>(this.story.AddExternal(this),null);}get typeName(){return "EXTERNAL"}toString(){var e;return `EXTERNAL ${(e=this.identifier)===null||e===void 0?void 0:e.name}`}};bu.ExternalDeclaration=xf;});var b0=S(_u=>{Object.defineProperty(_u,"__esModule",{value:true});_u.FlowDecl=void 0;var Pf=class{constructor(e,t,r){this.name=e,this.args=t,this.isFunction=r;}};_u.FlowDecl=Pf;});var Tf=S(Su=>{Object.defineProperty(Su,"__esModule",{value:true});Su.Wrap=void 0;var QT=Pe(),Of=class extends QT.ParsedObject{constructor(e){super(),this._objToWrap=e,this.GenerateRuntimeObject=()=>this._objToWrap;}};Su.Wrap=Of;});var _0=S(Eu=>{Object.defineProperty(Eu,"__esModule",{value:true});Eu.Glue=void 0;var ZT=Tf(),Nf=class extends ZT.Wrap{constructor(e){super(e);}get typeName(){return "Glue"}};Eu.Glue=Nf;});var Au=S(wu=>{Object.defineProperty(wu,"__esModule",{value:true});wu.Glue=void 0;var e1=mt(),Ff=class extends e1.InkObject{toString(){return "Glue"}};wu.Glue=Ff;});var E0=S(Du=>{Object.defineProperty(Du,"__esModule",{value:true});Du.IncDecExpression=void 0;var t1=Jo(),S0=Ft(),n1=sn(),r1=nn(),i1=Te(),s1=Ln(),a1=fi(),o1=_r(),If=class extends S0.Expression{constructor(e,t,r){super(),this.varIdentifier=e,this._runtimeAssignment=null,this.expression=null,this.GenerateIntoContainer=i=>{var a,s;i.AddContent(new a1.VariableReference(((a=this.varIdentifier)===null||a===void 0?void 0:a.name)||null)),this.expression?this.expression.GenerateIntoContainer(i):i.AddContent(new i1.IntValue(1)),i.AddContent(r1.NativeFunctionCall.CallWithName(this.isInc?"+":"-")),this._runtimeAssignment=new s1.VariableAssignment(((s=this.varIdentifier)===null||s===void 0?void 0:s.name)||null,false),i.AddContent(this._runtimeAssignment);},this.toString=()=>{var i,a;return this.expression?`${(i=this.varIdentifier)===null||i===void 0?void 0:i.name}${this.isInc?" += ":" -= "}${this.expression}`:`${(a=this.varIdentifier)===null||a===void 0?void 0:a.name}`+(this.isInc?"++":"--")},t instanceof S0.Expression?(this.expression=t,this.AddContent(this.expression),this.isInc=!!r):this.isInc=t;}get typeName(){return "IncDecExpression"}ResolveReferences(e){var t;super.ResolveReferences(e);let r=e.ResolveVariableWithName(((t=this.varIdentifier)===null||t===void 0?void 0:t.name)||"",this);if(r.found||this.Error(`variable for ${this.incrementDecrementWord} could not be found: '${this.varIdentifier}' after searching: {this.descriptionOfScope}`),!this._runtimeAssignment)throw new Error;this._runtimeAssignment.isGlobal=r.isGlobal,!(this.parent instanceof o1.Weave)&&!(this.parent instanceof n1.FlowBase)&&!(this.parent instanceof t1.ContentList)&&this.Error(`Can't use ${this.incrementDecrementWord} as sub-expression`);}get incrementDecrementWord(){return this.isInc?"increment":"decrement"}};Du.IncDecExpression=If;});var Rf=S(xu=>{Object.defineProperty(xu,"__esModule",{value:true});xu.IncludedFile=void 0;var u1=Pe(),kf=class extends u1.ParsedObject{constructor(e){super(),this.includedStory=e,this.GenerateRuntimeObject=()=>null;}get typeName(){return "IncludedFile"}};xu.IncludedFile=kf;});var w0=S(Pu=>{Object.defineProperty(Pu,"__esModule",{value:true});Pu.InfixOperator=void 0;var $f=class{constructor(e,t,r){this.type=e,this.precedence=t,this.requireWhitespace=r,this.toString=()=>this.type;}};Pu.InfixOperator=$f;});var jf=S(Ou=>{Object.defineProperty(Ou,"__esModule",{value:true});Ou.Knot=void 0;var l1=sn(),A0=li(),Vf=class extends l1.FlowBase{get flowLevel(){return A0.FlowLevel.Knot}constructor(e,t,r,i){super(e,t,r,i);}get typeName(){return this.isFunction?"Function":"Knot"}ResolveReferences(e){super.ResolveReferences(e);let t=this.story;for(let r in this.subFlowsByName){let i=t.ContentWithNameAtLevel(r,A0.FlowLevel.Knot,false);if(i){let a=this.subFlowsByName.get(r),s=`Stitch '${a?a.name:"NO STITCH FOUND"}' has the same name as a knot (on ${i.debugMetadata})`;this.Error(s,a);}}}};Ou.Knot=Vf;});var D0=S(Tu=>{Object.defineProperty(Tu,"__esModule",{value:true});Tu.List=void 0;var c1=Ft(),h1=yt(),d1=yt(),f1=Te(),Lf=class extends c1.Expression{constructor(e){super(),this.itemIdentifierList=e,this.GenerateIntoContainer=t=>{var r,i;let a=new h1.InkList;if(this.itemIdentifierList!=null)for(let s of this.itemIdentifierList){let o=((r=s?.name)===null||r===void 0?void 0:r.split("."))||[],u=null,l="";o.length>1?(u=o[0],l=o[1]):l=o[0];let c=this.story.ResolveListItem(u,l,this);if(c===null)u===null?this.Error(`Could not find list definition that contains item '${s}'`):this.Error(`Could not find list item ${s}`);else {if(c.parent==null){this.Error(`Could not find list definition for item ${s}`);return}u||(u=((i=c.parent.identifier)===null||i===void 0?void 0:i.name)||null);let h=new d1.InkListItem(u,c.name||null);a.has(h.serialized())?this.Warning(`Duplicate of item '${s}' in list.`):a.Add(h,c.seriesValue);}}t.AddContent(new f1.ListValue(a));};}get typeName(){return "List"}};Tu.List=Lf;});var Bf=S(Nu=>{Object.defineProperty(Nu,"__esModule",{value:true});Nu.ListElementDefinition=void 0;var p1=Pe(),m1=Cn(),qf=class extends p1.ParsedObject{get fullName(){var e;let t=this.parent;if(t===null)throw new Error("Can't get full name without a parent list.");return `${(e=t.identifier)===null||e===void 0?void 0:e.name}.${this.name}`}get typeName(){return "ListElement"}get name(){var e;return ((e=this.indentifier)===null||e===void 0?void 0:e.name)||null}constructor(e,t,r=null){super(),this.indentifier=e,this.inInitialList=t,this.explicitValue=r,this.seriesValue=0,this.parent=null,this.GenerateRuntimeObject=()=>{throw new Error("Not implemented.")},this.toString=()=>this.fullName,this.parent=this.parent;}ResolveReferences(e){super.ResolveReferences(e),e.CheckForNamingCollisions(this,this.indentifier,m1.SymbolType.ListItem);}};Nu.ListElementDefinition=qf;});var Mf=S(Fu=>{Object.defineProperty(Fu,"__esModule",{value:true});Fu.StatementLevel=void 0;var x0;(function(n){n[n.InnerBlock=0]="InnerBlock",n[n.Stitch=1]="Stitch",n[n.Knot=2]="Knot",n[n.Top=3]="Top";})(x0||(Fu.StatementLevel=x0={}));});var Gf=S(Iu=>{Object.defineProperty(Iu,"__esModule",{value:true});Iu.Stitch=void 0;var g1=sn(),y1=li(),Wf=class extends g1.FlowBase{get flowLevel(){return y1.FlowLevel.Stitch}constructor(e,t,r,i){super(e,t,r,i),this.baseToString=this.toString,this.toString=()=>`${this.parent!==null?this.parent+" > ":""}${this.baseToString()}`;}get typeName(){return "Stitch"}};Iu.Stitch=Wf;});var Ru=S(ku=>{Object.defineProperty(ku,"__esModule",{value:true});ku.Tag=void 0;var v1=mt(),Hf=class extends v1.InkObject{constructor(e){super(),this.text=e.toString()||"";}toString(){return "# "+this.text}};ku.Tag=Hf;});var zf=S($u=>{Object.defineProperty($u,"__esModule",{value:true});$u.Choice=void 0;var C1=pt(),b1=Qe(),_1=mt(),Jf=class n extends _1.InkObject{constructor(){super(...arguments),this.text="",this.index=0,this.threadAtGeneration=null,this.sourcePath="",this.targetPath=null,this.isInvisibleDefault=false,this.tags=null,this.originalThreadIndex=0;}get pathStringOnChoice(){return this.targetPath===null?(0, b1.throwNullException)("Choice.targetPath"):this.targetPath.toString()}set pathStringOnChoice(e){this.targetPath=new C1.Path(e);}Clone(){let e=new n;return e.text=this.text,e.sourcePath=this.sourcePath,e.index=this.index,e.targetPath=this.targetPath,e.originalThreadIndex=this.originalThreadIndex,e.isInvisibleDefault=this.isInvisibleDefault,this.threadAtGeneration!==null&&(e.threadAtGeneration=this.threadAtGeneration.Copy()),e}};$u.Choice=Jf;});var Kf=S(Vu=>{Object.defineProperty(Vu,"__esModule",{value:true});Vu.ListDefinitionsOrigin=void 0;var S1=yt(),E1=Te(),w1=Qe(),Uf=class{constructor(e){this._lists=new Map,this._allUnambiguousListValueCache=new Map;for(let t of e){this._lists.set(t.name,t);for(let[r,i]of t.items){let a=S1.InkListItem.fromSerializedKey(r),s=new E1.ListValue(a,i);if(!a.itemName)throw new Error("item.itemName is null or undefined.");this._allUnambiguousListValueCache.set(a.itemName,s),this._allUnambiguousListValueCache.set(a.fullName,s);}}}get lists(){let e=[];for(let[,t]of this._lists)e.push(t);return e}TryListGetDefinition(e,t){if(e===null)return {result:t,exists:false};let r=this._lists.get(e);return r?{result:r,exists:true}:{result:t,exists:false}}FindSingleItemListWithName(e){if(e===null)return (0, w1.throwNullException)("name");let t=this._allUnambiguousListValueCache.get(e);return typeof t<"u"?t:null}};Vu.ListDefinitionsOrigin=Uf;});var gi=S(Bu=>{Object.defineProperty(Bu,"__esModule",{value:true});Bu.JsonSerialisation=void 0;var ju=Re(),Ct=Te(),P0=Au(),ae=Ze(),mi=vr(),O0=rn(),T0=vo(),Xf=fi(),N0=Ln(),Yf=nn(),F0=yr(),I0=Ru(),A1=pt(),k0=zf(),D1=Cf(),x1=Kf(),Lu=yt(),$e=fe(),Sr=Qe(),qu=class n{static JArrayToRuntimeObjList(e,t=false){let r=e.length;t&&r--;let i=[];for(let a=0;a<r;a++){let s=e[a],o=this.JTokenToRuntimeObject(s);if(o===null)return (0, Sr.throwNullException)("runtimeObj");i.push(o);}return i}static WriteDictionaryRuntimeObjs(e,t){e.WriteObjectStart();for(let[r,i]of t)e.WritePropertyStart(r),this.WriteRuntimeObject(e,i),e.WritePropertyEnd();e.WriteObjectEnd();}static WriteListRuntimeObjs(e,t){e.WriteArrayStart();for(let r of t)this.WriteRuntimeObject(e,r);e.WriteArrayEnd();}static WriteIntDictionary(e,t){e.WriteObjectStart();for(let[r,i]of t)e.WriteIntProperty(r,i);e.WriteObjectEnd();}static WriteRuntimeObject(e,t){let r=(0, $e.asOrNull)(t,ju.Container);if(r){this.WriteRuntimeContainer(e,r);return}let i=(0, $e.asOrNull)(t,O0.Divert);if(i){let v="->";i.isExternal?v="x()":i.pushesToStack&&(i.stackPushType==mi.PushPopType.Function?v="f()":i.stackPushType==mi.PushPopType.Tunnel&&(v="->t->"));let w;i.hasVariableTarget?w=i.variableDivertName:w=i.targetPathString,e.WriteObjectStart(),e.WriteProperty(v,w),i.hasVariableTarget&&e.WriteProperty("var",true),i.isConditional&&e.WriteProperty("c",true),i.externalArgs>0&&e.WriteIntProperty("exArgs",i.externalArgs),e.WriteObjectEnd();return}let a=(0, $e.asOrNull)(t,T0.ChoicePoint);if(a){e.WriteObjectStart(),e.WriteProperty("*",a.pathStringOnChoice),e.WriteIntProperty("flg",a.flags),e.WriteObjectEnd();return}let s=(0, $e.asOrNull)(t,Ct.BoolValue);if(s){e.WriteBool(s.value);return}let o=(0, $e.asOrNull)(t,Ct.IntValue);if(o){e.WriteInt(o.value);return}let u=(0, $e.asOrNull)(t,Ct.FloatValue);if(u){e.WriteFloat(u.value);return}let l=(0, $e.asOrNull)(t,Ct.StringValue);if(l){l.isNewline?e.Write(`
|
|
24
|
-
`,false):(e.WriteStringStart(),e.WriteStringInner("^"),e.WriteStringInner(l.value),e.WriteStringEnd());return}let c=(0, $e.asOrNull)(t,Ct.ListValue);if(c){this.WriteInkList(e,c);return}let h=(0, $e.asOrNull)(t,Ct.DivertTargetValue);if(h){if(e.WriteObjectStart(),h.value===null)return (0, Sr.throwNullException)("divTargetVal.value");e.WriteProperty("^->",h.value.componentsString),e.WriteObjectEnd();return}let f=(0, $e.asOrNull)(t,Ct.VariablePointerValue);if(f){e.WriteObjectStart(),e.WriteProperty("^var",f.value),e.WriteIntProperty("ci",f.contextIndex),e.WriteObjectEnd();return}if((0, $e.asOrNull)(t,P0.Glue)){e.Write("<>");return}let p=(0, $e.asOrNull)(t,
|
|
23
|
+
`),0),(r||this.isElse&&this.matchingEquality)&&this._contentContainer.InsertContent(gu.ControlCommand.PopEvaluatedValue(),0),t.AddToNamedContentOnly(this._contentContainer),this.returnDivert=new m0.Divert,this._contentContainer.AddContent(this.returnDivert),t},this.GenerateRuntimeForContent=()=>this._innerWeave===null?new p0.Container:this._innerWeave.rootContainer,e&&(this._innerWeave=new KT.Weave(e),this.AddContent(this._innerWeave));}get typeName(){return "ConditionalSingleBranch"}ResolveReferences(e){if(!this._conditionalDivert||!this._contentContainer)throw new Error;this._conditionalDivert.targetPath=this._contentContainer.path,super.ResolveReferences(e);}};yu.ConditionalSingleBranch=Af;});var y0=S(vu=>{Object.defineProperty(vu,"__esModule",{value:true});vu.CustomFlags=void 0;var g0;(function(n){n[n.ParsingString=1]="ParsingString",n[n.TagActive=2]="TagActive";})(g0||(vu.CustomFlags=g0={}));});var v0=S(Cu=>{Object.defineProperty(Cu,"__esModule",{value:true});Cu.DebugMetadata=void 0;var Df=class n{constructor(){this.startLineNumber=0,this.endLineNumber=0,this.startCharacterNumber=0,this.endCharacterNumber=0,this.fileName=null,this.sourceName=null;}Merge(e){let t=new n;return t.fileName=this.fileName,t.sourceName=this.sourceName,this.startLineNumber<e.startLineNumber?(t.startLineNumber=this.startLineNumber,t.startCharacterNumber=this.startCharacterNumber):this.startLineNumber>e.startLineNumber?(t.startLineNumber=e.startLineNumber,t.startCharacterNumber=e.startCharacterNumber):(t.startLineNumber=this.startLineNumber,t.startCharacterNumber=Math.min(this.startCharacterNumber,e.startCharacterNumber)),this.endLineNumber>e.endLineNumber?(t.endLineNumber=this.endLineNumber,t.endCharacterNumber=this.endCharacterNumber):this.endLineNumber<e.endLineNumber?(t.endLineNumber=e.endLineNumber,t.endCharacterNumber=e.endCharacterNumber):(t.endLineNumber=this.endLineNumber,t.endCharacterNumber=Math.max(this.endCharacterNumber,e.endCharacterNumber)),t}toString(){return this.fileName!==null?`line ${this.startLineNumber} of ${this.fileName}"`:"line "+this.startLineNumber}};Cu.DebugMetadata=Df;});var C0=S(bu=>{Object.defineProperty(bu,"__esModule",{value:true});bu.ExternalDeclaration=void 0;var YT=Pe(),xf=class extends YT.ParsedObject{get name(){var e;return ((e=this.identifier)===null||e===void 0?void 0:e.name)||null}constructor(e,t){super(),this.identifier=e,this.argumentNames=t,this.GenerateRuntimeObject=()=>(this.story.AddExternal(this),null);}get typeName(){return "EXTERNAL"}toString(){var e;return `EXTERNAL ${(e=this.identifier)===null||e===void 0?void 0:e.name}`}};bu.ExternalDeclaration=xf;});var b0=S(_u=>{Object.defineProperty(_u,"__esModule",{value:true});_u.FlowDecl=void 0;var Pf=class{constructor(e,t,r){this.name=e,this.args=t,this.isFunction=r;}};_u.FlowDecl=Pf;});var Tf=S(Su=>{Object.defineProperty(Su,"__esModule",{value:true});Su.Wrap=void 0;var QT=Pe(),Of=class extends QT.ParsedObject{constructor(e){super(),this._objToWrap=e,this.GenerateRuntimeObject=()=>this._objToWrap;}};Su.Wrap=Of;});var _0=S(Eu=>{Object.defineProperty(Eu,"__esModule",{value:true});Eu.Glue=void 0;var ZT=Tf(),Nf=class extends ZT.Wrap{constructor(e){super(e);}get typeName(){return "Glue"}};Eu.Glue=Nf;});var Au=S(wu=>{Object.defineProperty(wu,"__esModule",{value:true});wu.Glue=void 0;var e1=mt(),Ff=class extends e1.InkObject{toString(){return "Glue"}};wu.Glue=Ff;});var E0=S(Du=>{Object.defineProperty(Du,"__esModule",{value:true});Du.IncDecExpression=void 0;var t1=Jo(),S0=Ft(),n1=sn(),r1=nn(),i1=Te(),s1=Ln(),a1=fi(),o1=_r(),If=class extends S0.Expression{constructor(e,t,r){super(),this.varIdentifier=e,this._runtimeAssignment=null,this.expression=null,this.GenerateIntoContainer=i=>{var a,s;i.AddContent(new a1.VariableReference(((a=this.varIdentifier)===null||a===void 0?void 0:a.name)||null)),this.expression?this.expression.GenerateIntoContainer(i):i.AddContent(new i1.IntValue(1)),i.AddContent(r1.NativeFunctionCall.CallWithName(this.isInc?"+":"-")),this._runtimeAssignment=new s1.VariableAssignment(((s=this.varIdentifier)===null||s===void 0?void 0:s.name)||null,false),i.AddContent(this._runtimeAssignment);},this.toString=()=>{var i,a;return this.expression?`${(i=this.varIdentifier)===null||i===void 0?void 0:i.name}${this.isInc?" += ":" -= "}${this.expression}`:`${(a=this.varIdentifier)===null||a===void 0?void 0:a.name}`+(this.isInc?"++":"--")},t instanceof S0.Expression?(this.expression=t,this.AddContent(this.expression),this.isInc=!!r):this.isInc=t;}get typeName(){return "IncDecExpression"}ResolveReferences(e){var t;super.ResolveReferences(e);let r=e.ResolveVariableWithName(((t=this.varIdentifier)===null||t===void 0?void 0:t.name)||"",this);if(r.found||this.Error(`variable for ${this.incrementDecrementWord} could not be found: '${this.varIdentifier}' after searching: {this.descriptionOfScope}`),!this._runtimeAssignment)throw new Error;this._runtimeAssignment.isGlobal=r.isGlobal,!(this.parent instanceof o1.Weave)&&!(this.parent instanceof n1.FlowBase)&&!(this.parent instanceof t1.ContentList)&&this.Error(`Can't use ${this.incrementDecrementWord} as sub-expression`);}get incrementDecrementWord(){return this.isInc?"increment":"decrement"}};Du.IncDecExpression=If;});var Rf=S(xu=>{Object.defineProperty(xu,"__esModule",{value:true});xu.IncludedFile=void 0;var u1=Pe(),kf=class extends u1.ParsedObject{constructor(e){super(),this.includedStory=e,this.GenerateRuntimeObject=()=>null;}get typeName(){return "IncludedFile"}};xu.IncludedFile=kf;});var w0=S(Pu=>{Object.defineProperty(Pu,"__esModule",{value:true});Pu.InfixOperator=void 0;var $f=class{constructor(e,t,r){this.type=e,this.precedence=t,this.requireWhitespace=r,this.toString=()=>this.type;}};Pu.InfixOperator=$f;});var jf=S(Ou=>{Object.defineProperty(Ou,"__esModule",{value:true});Ou.Knot=void 0;var l1=sn(),A0=li(),Vf=class extends l1.FlowBase{get flowLevel(){return A0.FlowLevel.Knot}constructor(e,t,r,i){super(e,t,r,i);}get typeName(){return this.isFunction?"Function":"Knot"}ResolveReferences(e){super.ResolveReferences(e);let t=this.story;for(let r in this.subFlowsByName){let i=t.ContentWithNameAtLevel(r,A0.FlowLevel.Knot,false);if(i){let a=this.subFlowsByName.get(r),s=`Stitch '${a?a.name:"NO STITCH FOUND"}' has the same name as a knot (on ${i.debugMetadata})`;this.Error(s,a);}}}};Ou.Knot=Vf;});var D0=S(Tu=>{Object.defineProperty(Tu,"__esModule",{value:true});Tu.List=void 0;var c1=Ft(),h1=yt(),d1=yt(),f1=Te(),Lf=class extends c1.Expression{constructor(e){super(),this.itemIdentifierList=e,this.GenerateIntoContainer=t=>{var r,i;let a=new h1.InkList;if(this.itemIdentifierList!=null)for(let s of this.itemIdentifierList){let o=((r=s?.name)===null||r===void 0?void 0:r.split("."))||[],u=null,l="";o.length>1?(u=o[0],l=o[1]):l=o[0];let c=this.story.ResolveListItem(u,l,this);if(c===null)u===null?this.Error(`Could not find list definition that contains item '${s}'`):this.Error(`Could not find list item ${s}`);else {if(c.parent==null){this.Error(`Could not find list definition for item ${s}`);return}u||(u=((i=c.parent.identifier)===null||i===void 0?void 0:i.name)||null);let h=new d1.InkListItem(u,c.name||null);a.has(h.serialized())?this.Warning(`Duplicate of item '${s}' in list.`):a.Add(h,c.seriesValue);}}t.AddContent(new f1.ListValue(a));};}get typeName(){return "List"}};Tu.List=Lf;});var Bf=S(Nu=>{Object.defineProperty(Nu,"__esModule",{value:true});Nu.ListElementDefinition=void 0;var p1=Pe(),m1=Cn(),qf=class extends p1.ParsedObject{get fullName(){var e;let t=this.parent;if(t===null)throw new Error("Can't get full name without a parent list.");return `${(e=t.identifier)===null||e===void 0?void 0:e.name}.${this.name}`}get typeName(){return "ListElement"}get name(){var e;return ((e=this.indentifier)===null||e===void 0?void 0:e.name)||null}constructor(e,t,r=null){super(),this.indentifier=e,this.inInitialList=t,this.explicitValue=r,this.seriesValue=0,this.parent=null,this.GenerateRuntimeObject=()=>{throw new Error("Not implemented.")},this.toString=()=>this.fullName,this.parent=this.parent;}ResolveReferences(e){super.ResolveReferences(e),e.CheckForNamingCollisions(this,this.indentifier,m1.SymbolType.ListItem);}};Nu.ListElementDefinition=qf;});var Mf=S(Fu=>{Object.defineProperty(Fu,"__esModule",{value:true});Fu.StatementLevel=void 0;var x0;(function(n){n[n.InnerBlock=0]="InnerBlock",n[n.Stitch=1]="Stitch",n[n.Knot=2]="Knot",n[n.Top=3]="Top";})(x0||(Fu.StatementLevel=x0={}));});var Gf=S(Iu=>{Object.defineProperty(Iu,"__esModule",{value:true});Iu.Stitch=void 0;var g1=sn(),y1=li(),Wf=class extends g1.FlowBase{get flowLevel(){return y1.FlowLevel.Stitch}constructor(e,t,r,i){super(e,t,r,i),this.baseToString=this.toString,this.toString=()=>`${this.parent!==null?this.parent+" > ":""}${this.baseToString()}`;}get typeName(){return "Stitch"}};Iu.Stitch=Wf;});var Ru=S(ku=>{Object.defineProperty(ku,"__esModule",{value:true});ku.Tag=void 0;var v1=mt(),Hf=class extends v1.InkObject{constructor(e){super(),this.text=e.toString()||"";}toString(){return "# "+this.text}};ku.Tag=Hf;});var zf=S($u=>{Object.defineProperty($u,"__esModule",{value:true});$u.Choice=void 0;var C1=pt(),b1=Qe(),_1=mt(),Jf=class n extends _1.InkObject{constructor(){super(...arguments),this.text="",this.index=0,this.threadAtGeneration=null,this.sourcePath="",this.targetPath=null,this.isInvisibleDefault=false,this.tags=null,this.originalThreadIndex=0;}get pathStringOnChoice(){return this.targetPath===null?(0, b1.throwNullException)("Choice.targetPath"):this.targetPath.toString()}set pathStringOnChoice(e){this.targetPath=new C1.Path(e);}Clone(){let e=new n;return e.text=this.text,e.sourcePath=this.sourcePath,e.index=this.index,e.targetPath=this.targetPath,e.originalThreadIndex=this.originalThreadIndex,e.isInvisibleDefault=this.isInvisibleDefault,this.threadAtGeneration!==null&&(e.threadAtGeneration=this.threadAtGeneration.Copy()),e}};$u.Choice=Jf;});var Kf=S(Vu=>{Object.defineProperty(Vu,"__esModule",{value:true});Vu.ListDefinitionsOrigin=void 0;var S1=yt(),E1=Te(),w1=Qe(),Uf=class{constructor(e){this._lists=new Map,this._allUnambiguousListValueCache=new Map;for(let t of e){this._lists.set(t.name,t);for(let[r,i]of t.items){let a=S1.InkListItem.fromSerializedKey(r),s=new E1.ListValue(a,i);if(!a.itemName)throw new Error("item.itemName is null or undefined.");this._allUnambiguousListValueCache.set(a.itemName,s),this._allUnambiguousListValueCache.set(a.fullName,s);}}}get lists(){let e=[];for(let[,t]of this._lists)e.push(t);return e}TryListGetDefinition(e,t){if(e===null)return {result:t,exists:false};let r=this._lists.get(e);return r?{result:r,exists:true}:{result:t,exists:false}}FindSingleItemListWithName(e){if(e===null)return (0, w1.throwNullException)("name");let t=this._allUnambiguousListValueCache.get(e);return typeof t<"u"?t:null}};Vu.ListDefinitionsOrigin=Uf;});var gi=S(Bu=>{Object.defineProperty(Bu,"__esModule",{value:true});Bu.JsonSerialisation=void 0;var ju=Re(),Ct=Te(),P0=Au(),oe=Ze(),mi=vr(),O0=rn(),T0=vo(),Xf=fi(),N0=Ln(),Yf=nn(),F0=yr(),I0=Ru(),A1=pt(),k0=zf(),D1=Cf(),x1=Kf(),Lu=yt(),$e=fe(),Sr=Qe(),qu=class n{static JArrayToRuntimeObjList(e,t=false){let r=e.length;t&&r--;let i=[];for(let a=0;a<r;a++){let s=e[a],o=this.JTokenToRuntimeObject(s);if(o===null)return (0, Sr.throwNullException)("runtimeObj");i.push(o);}return i}static WriteDictionaryRuntimeObjs(e,t){e.WriteObjectStart();for(let[r,i]of t)e.WritePropertyStart(r),this.WriteRuntimeObject(e,i),e.WritePropertyEnd();e.WriteObjectEnd();}static WriteListRuntimeObjs(e,t){e.WriteArrayStart();for(let r of t)this.WriteRuntimeObject(e,r);e.WriteArrayEnd();}static WriteIntDictionary(e,t){e.WriteObjectStart();for(let[r,i]of t)e.WriteIntProperty(r,i);e.WriteObjectEnd();}static WriteRuntimeObject(e,t){let r=(0, $e.asOrNull)(t,ju.Container);if(r){this.WriteRuntimeContainer(e,r);return}let i=(0, $e.asOrNull)(t,O0.Divert);if(i){let v="->";i.isExternal?v="x()":i.pushesToStack&&(i.stackPushType==mi.PushPopType.Function?v="f()":i.stackPushType==mi.PushPopType.Tunnel&&(v="->t->"));let w;i.hasVariableTarget?w=i.variableDivertName:w=i.targetPathString,e.WriteObjectStart(),e.WriteProperty(v,w),i.hasVariableTarget&&e.WriteProperty("var",true),i.isConditional&&e.WriteProperty("c",true),i.externalArgs>0&&e.WriteIntProperty("exArgs",i.externalArgs),e.WriteObjectEnd();return}let a=(0, $e.asOrNull)(t,T0.ChoicePoint);if(a){e.WriteObjectStart(),e.WriteProperty("*",a.pathStringOnChoice),e.WriteIntProperty("flg",a.flags),e.WriteObjectEnd();return}let s=(0, $e.asOrNull)(t,Ct.BoolValue);if(s){e.WriteBool(s.value);return}let o=(0, $e.asOrNull)(t,Ct.IntValue);if(o){e.WriteInt(o.value);return}let u=(0, $e.asOrNull)(t,Ct.FloatValue);if(u){e.WriteFloat(u.value);return}let l=(0, $e.asOrNull)(t,Ct.StringValue);if(l){l.isNewline?e.Write(`
|
|
24
|
+
`,false):(e.WriteStringStart(),e.WriteStringInner("^"),e.WriteStringInner(l.value),e.WriteStringEnd());return}let c=(0, $e.asOrNull)(t,Ct.ListValue);if(c){this.WriteInkList(e,c);return}let h=(0, $e.asOrNull)(t,Ct.DivertTargetValue);if(h){if(e.WriteObjectStart(),h.value===null)return (0, Sr.throwNullException)("divTargetVal.value");e.WriteProperty("^->",h.value.componentsString),e.WriteObjectEnd();return}let f=(0, $e.asOrNull)(t,Ct.VariablePointerValue);if(f){e.WriteObjectStart(),e.WriteProperty("^var",f.value),e.WriteIntProperty("ci",f.contextIndex),e.WriteObjectEnd();return}if((0, $e.asOrNull)(t,P0.Glue)){e.Write("<>");return}let p=(0, $e.asOrNull)(t,oe.ControlCommand);if(p){e.Write(n._controlCommandNames[p.commandType]);return}let m=(0, $e.asOrNull)(t,Yf.NativeFunctionCall);if(m){let v=m.name;v=="^"&&(v="L^"),e.Write(v);return}let C=(0, $e.asOrNull)(t,Xf.VariableReference);if(C){e.WriteObjectStart();let v=C.pathStringForCount;v!=null?e.WriteProperty("CNT?",v):e.WriteProperty("VAR?",C.name),e.WriteObjectEnd();return}let b=(0, $e.asOrNull)(t,N0.VariableAssignment);if(b){e.WriteObjectStart();let v=b.isGlobal?"VAR=":"temp=";e.WriteProperty(v,b.variableName),b.isNewDeclaration||e.WriteProperty("re",true),e.WriteObjectEnd();return}if((0, $e.asOrNull)(t,F0.Void)){e.Write("void");return}let d=(0, $e.asOrNull)(t,I0.Tag);if(d){e.WriteObjectStart(),e.WriteProperty("#",d.text),e.WriteObjectEnd();return}let _=(0, $e.asOrNull)(t,k0.Choice);if(_){this.WriteChoice(e,_);return}throw new Error("Failed to convert runtime object to Json token: "+t)}static JObjectToDictionaryRuntimeObjs(e){let t=new Map;for(let r in e)if(e.hasOwnProperty(r)){let i=this.JTokenToRuntimeObject(e[r]);if(i===null)return (0, Sr.throwNullException)("inkObject");t.set(r,i);}return t}static JObjectToIntDictionary(e){let t=new Map;for(let r in e)e.hasOwnProperty(r)&&t.set(r,parseInt(e[r]));return t}static JTokenToRuntimeObject(e){if(typeof e=="number"&&!isNaN(e)||typeof e=="boolean")return Ct.Value.Create(e);if(typeof e=="string"){let t=e.toString(),r=/^([0-9]+.[0-9]+f)$/.exec(t);if(r)return new Ct.FloatValue(parseFloat(r[0]));let i=t[0];if(i=="^")return new Ct.StringValue(t.substring(1));if(i==`
|
|
25
25
|
`&&t.length==1)return new Ct.StringValue(`
|
|
26
|
-
`);if(t=="<>")return new P0.Glue;for(let a=0;a<n._controlCommandNames.length;++a){let s=n._controlCommandNames[a];if(t==s)return new ae.ControlCommand(a)}if(t=="L^"&&(t="^"),Yf.NativeFunctionCall.CallExistsWithName(t))return Yf.NativeFunctionCall.CallWithName(t);if(t=="->->")return ae.ControlCommand.PopTunnel();if(t=="~ret")return ae.ControlCommand.PopFunction();if(t=="void")return new F0.Void}if(typeof e=="object"&&!Array.isArray(e)){let t=e,r;if(t["^->"])return r=t["^->"],new Ct.DivertTargetValue(new A1.Path(r.toString()));if(t["^var"]){r=t["^var"];let c=new Ct.VariablePointerValue(r.toString());return "ci"in t&&(r=t.ci,c.contextIndex=parseInt(r)),c}let i=false,a=false,s=mi.PushPopType.Function,o=false;if((r=t["->"])?i=true:(r=t["f()"])?(i=true,a=true,s=mi.PushPopType.Function):(r=t["->t->"])?(i=true,a=true,s=mi.PushPopType.Tunnel):(r=t["x()"])&&(i=true,o=true,a=false,s=mi.PushPopType.Function),i){let c=new O0.Divert;c.pushesToStack=a,c.stackPushType=s,c.isExternal=o;let h=r.toString();return (r=t.var)?c.variableDivertName=h:c.targetPathString=h,c.isConditional=!!t.c,o&&(r=t.exArgs)&&(c.externalArgs=parseInt(r)),c}if(r=t["*"]){let c=new T0.ChoicePoint;return c.pathStringOnChoice=r.toString(),(r=t.flg)&&(c.flags=parseInt(r)),c}if(r=t["VAR?"])return new Xf.VariableReference(r.toString());if(r=t["CNT?"]){let c=new Xf.VariableReference;return c.pathStringForCount=r.toString(),c}let u=false,l=false;if((r=t["VAR="])?(u=true,l=true):(r=t["temp="])&&(u=true,l=false),u){let c=r.toString(),h=!t.re,f=new N0.VariableAssignment(c,h);return f.isGlobal=l,f}if(t["#"]!==void 0)return r=t["#"],new I0.Tag(r.toString());if(r=t.list){let c=r,h=new Lu.InkList;if(r=t.origins){let f=r;h.SetInitialOriginNames(f);}for(let f in c)if(c.hasOwnProperty(f)){let g=c[f],p=new Lu.InkListItem(f),m=parseInt(g);h.Add(p,m);}return new Ct.ListValue(h)}if(t.originalChoicePath!=null)return this.JObjectToChoice(t)}if(Array.isArray(e))return this.JArrayToContainer(e);if(e==null)return null;throw new Error("Failed to convert token to runtime object: "+this.toJson(e,["parent"]))}static toJson(e,t,r){return JSON.stringify(e,(i,a)=>t?.some(s=>s===i)?void 0:a,r)}static WriteRuntimeContainer(e,t,r=false){if(e.WriteArrayStart(),t===null)return (0, Sr.throwNullException)("container");for(let u of t.content)this.WriteRuntimeObject(e,u);let i=t.namedOnlyContent,a=t.countFlags,s=t.name!=null&&!r,o=i!=null||a>0||s;if(o&&e.WriteObjectStart(),i!=null)for(let[u,l]of i){let c=u,h=(0, $e.asOrNull)(l,ju.Container);e.WritePropertyStart(c),this.WriteRuntimeContainer(e,h,true),e.WritePropertyEnd();}a>0&&e.WriteIntProperty("#f",a),s&&e.WriteProperty("#n",t.name),o?e.WriteObjectEnd():e.WriteNull(),e.WriteArrayEnd();}static JArrayToContainer(e){let t=new ju.Container;t.content=this.JArrayToRuntimeObjList(e,true);let r=e[e.length-1];if(r!=null){let i=new Map;for(let a in r)if(a=="#f")t.countFlags=parseInt(r[a]);else if(a=="#n")t.name=r[a].toString();else {let s=this.JTokenToRuntimeObject(r[a]),o=(0, $e.asOrNull)(s,ju.Container);o&&(o.name=a),i.set(a,s);}t.namedOnlyContent=i;}return t}static JObjectToChoice(e){let t=new k0.Choice;return t.text=e.text.toString(),t.index=parseInt(e.index),t.sourcePath=e.originalChoicePath.toString(),t.originalThreadIndex=parseInt(e.originalThreadIndex),t.pathStringOnChoice=e.targetPath.toString(),t.tags=this.JArrayToTags(e),t.isInvisibleDefault=!!e.isInvisibleDefault,t}static JArrayToTags(e){return e.tags?e.tags:null}static WriteChoice(e,t){e.WriteObjectStart(),e.WriteProperty("text",t.text),e.WriteIntProperty("index",t.index),e.WriteProperty("originalChoicePath",t.sourcePath),e.WriteIntProperty("originalThreadIndex",t.originalThreadIndex),e.WriteProperty("targetPath",t.pathStringOnChoice),e.WriteProperty("isInvisibleDefault",t.isInvisibleDefault),this.WriteChoiceTags(e,t),e.WriteObjectEnd();}static WriteChoiceTags(e,t){if(t.tags&&t.tags.length>0){e.WritePropertyStart("tags"),e.WriteArrayStart();for(let r of t.tags)e.Write(r);e.WriteArrayEnd(),e.WritePropertyEnd();}}static WriteInkList(e,t){let r=t.value;if(r===null)return (0, Sr.throwNullException)("rawList");e.WriteObjectStart(),e.WritePropertyStart("list"),e.WriteObjectStart();for(let[i,a]of r){let s=Lu.InkListItem.fromSerializedKey(i),o=a;if(s.itemName===null)return (0, Sr.throwNullException)("item.itemName");e.WritePropertyNameStart(),e.WritePropertyNameInner(s.originName?s.originName:"?"),e.WritePropertyNameInner("."),e.WritePropertyNameInner(s.itemName),e.WritePropertyNameEnd(),e.Write(o),e.WritePropertyEnd();}if(e.WriteObjectEnd(),e.WritePropertyEnd(),r.Count==0&&r.originNames!=null&&r.originNames.length>0){e.WritePropertyStart("origins"),e.WriteArrayStart();for(let i of r.originNames)e.Write(i);e.WriteArrayEnd(),e.WritePropertyEnd();}e.WriteObjectEnd();}static ListDefinitionsToJToken(e){let t={};for(let r of e.lists){let i={};for(let[a,s]of r.items){let o=Lu.InkListItem.fromSerializedKey(a);if(o.itemName===null)return (0, Sr.throwNullException)("item.itemName");i[o.itemName]=s;}t[r.name]=i;}return t}static JTokenToListDefinitions(e){let t=e,r=[];for(let i in t)if(t.hasOwnProperty(i)){let a=i.toString(),s=t[i],o=new Map;for(let l in s)if(t.hasOwnProperty(i)){let c=s[l];o.set(l,parseInt(c));}let u=new D1.ListDefinition(a,o);r.push(u);}return new x1.ListDefinitionsOrigin(r)}};Bu.JsonSerialisation=qu;qu._controlCommandNames=(()=>{let n=[];n[ae.ControlCommand.CommandType.EvalStart]="ev",n[ae.ControlCommand.CommandType.EvalOutput]="out",n[ae.ControlCommand.CommandType.EvalEnd]="/ev",n[ae.ControlCommand.CommandType.Duplicate]="du",n[ae.ControlCommand.CommandType.PopEvaluatedValue]="pop",n[ae.ControlCommand.CommandType.PopFunction]="~ret",n[ae.ControlCommand.CommandType.PopTunnel]="->->",n[ae.ControlCommand.CommandType.BeginString]="str",n[ae.ControlCommand.CommandType.EndString]="/str",n[ae.ControlCommand.CommandType.NoOp]="nop",n[ae.ControlCommand.CommandType.ChoiceCount]="choiceCnt",n[ae.ControlCommand.CommandType.Turns]="turn",n[ae.ControlCommand.CommandType.TurnsSince]="turns",n[ae.ControlCommand.CommandType.ReadCount]="readc",n[ae.ControlCommand.CommandType.Random]="rnd",n[ae.ControlCommand.CommandType.SeedRandom]="srnd",n[ae.ControlCommand.CommandType.VisitIndex]="visit",n[ae.ControlCommand.CommandType.SequenceShuffleIndex]="seq",n[ae.ControlCommand.CommandType.StartThread]="thread",n[ae.ControlCommand.CommandType.Done]="done",n[ae.ControlCommand.CommandType.End]="end",n[ae.ControlCommand.CommandType.ListFromInt]="listInt",n[ae.ControlCommand.CommandType.ListRange]="range",n[ae.ControlCommand.CommandType.ListRandom]="lrnd",n[ae.ControlCommand.CommandType.BeginTag]="#",n[ae.ControlCommand.CommandType.EndTag]="/#";for(let e=0;e<ae.ControlCommand.CommandType.TOTAL_VALUES;++e)if(n[e]==null)throw new Error("Control command not accounted for in serialisation");return n})();});var ep=S(ks=>{Object.defineProperty(ks,"__esModule",{value:true});ks.CallStack=void 0;var Qf=vr(),R0=pt(),P1=Rs(),$0=gi(),O1=Te(),T1=mr(),Fs=Es(),N1=cs(),V0=ii(),Zf=Qe(),Is=class n{get elements(){return this.callStack}get depth(){return this.elements.length}get currentElement(){let t=this._threads[this._threads.length-1].callstack;return t[t.length-1]}get currentElementIndex(){return this.callStack.length-1}get currentThread(){return this._threads[this._threads.length-1]}set currentThread(e){N1.Debug.Assert(this._threads.length==1,"Shouldn't be directly setting the current thread when we have a stack of them"),this._threads.length=0,this._threads.push(e);}get canPop(){return this.callStack.length>1}constructor(){if(this._threadCounter=0,this._startOfRoot=Fs.Pointer.Null,arguments[0]instanceof P1.Story){let e=arguments[0];this._startOfRoot=Fs.Pointer.StartOf(e.rootContentContainer),this.Reset();}else {let e=arguments[0];this._threads=[];for(let t of e._threads)this._threads.push(t.Copy());this._threadCounter=e._threadCounter,this._startOfRoot=e._startOfRoot.copy();}}Reset(){this._threads=[],this._threads.push(new n.Thread),this._threads[0].callstack.push(new n.Element(Qf.PushPopType.Tunnel,this._startOfRoot));}SetJsonToken(e,t){this._threads.length=0;let r=e.threads;for(let i of r){let a=i,s=new n.Thread(a,t);this._threads.push(s);}this._threadCounter=parseInt(e.threadCounter),this._startOfRoot=Fs.Pointer.StartOf(t.rootContentContainer);}WriteJson(e){e.WriteObject(t=>{t.WritePropertyStart("threads"),t.WriteArrayStart();for(let r of this._threads)r.WriteJson(t);t.WriteArrayEnd(),t.WritePropertyEnd(),t.WritePropertyStart("threadCounter"),t.WriteInt(this._threadCounter),t.WritePropertyEnd();});}PushThread(){let e=this.currentThread.Copy();this._threadCounter++,e.threadIndex=this._threadCounter,this._threads.push(e);}ForkThread(){let e=this.currentThread.Copy();return this._threadCounter++,e.threadIndex=this._threadCounter,e}PopThread(){if(this.canPopThread)this._threads.splice(this._threads.indexOf(this.currentThread),1);else throw new Error("Can't pop thread")}get canPopThread(){return this._threads.length>1&&!this.elementIsEvaluateFromGame}get elementIsEvaluateFromGame(){return this.currentElement.type==Qf.PushPopType.FunctionEvaluationFromGame}Push(e,t=0,r=0){let i=new n.Element(e,this.currentElement.currentPointer,false);i.evaluationStackHeightWhenPushed=t,i.functionStartInOutputStream=r,this.callStack.push(i);}CanPop(e=null){return this.canPop?e==null?true:this.currentElement.type==e:false}Pop(e=null){if(this.CanPop(e)){this.callStack.pop();return}else throw new Error("Mismatched push/pop in Callstack")}GetTemporaryVariableWithName(e,t=-1){t==-1&&(t=this.currentElementIndex+1);let r=this.callStack[t-1],i=(0, V0.tryGetValueFromMap)(r.temporaryVariables,e,null);return i.exists?i.result:null}SetTemporaryVariable(e,t,r,i=-1){i==-1&&(i=this.currentElementIndex+1);let a=this.callStack[i-1];if(!r&&!a.temporaryVariables.get(e))throw new Error("Could not find temporary variable to set: "+e);let s=(0, V0.tryGetValueFromMap)(a.temporaryVariables,e,null);s.exists&&O1.ListValue.RetainListOriginsForAssignment(s.result,t),a.temporaryVariables.set(e,t);}ContextForVariableNamed(e){return this.currentElement.temporaryVariables.get(e)?this.currentElementIndex+1:0}ThreadWithIndex(e){let t=this._threads.filter(r=>{if(r.threadIndex==e)return r});return t.length>0?t[0]:null}get callStack(){return this.currentThread.callstack}get callStackTrace(){let e=new T1.StringBuilder;for(let t=0;t<this._threads.length;t++){let r=this._threads[t],i=t==this._threads.length-1;e.AppendFormat(`=== THREAD {0}/{1} {2}===
|
|
26
|
+
`);if(t=="<>")return new P0.Glue;for(let a=0;a<n._controlCommandNames.length;++a){let s=n._controlCommandNames[a];if(t==s)return new oe.ControlCommand(a)}if(t=="L^"&&(t="^"),Yf.NativeFunctionCall.CallExistsWithName(t))return Yf.NativeFunctionCall.CallWithName(t);if(t=="->->")return oe.ControlCommand.PopTunnel();if(t=="~ret")return oe.ControlCommand.PopFunction();if(t=="void")return new F0.Void}if(typeof e=="object"&&!Array.isArray(e)){let t=e,r;if(t["^->"])return r=t["^->"],new Ct.DivertTargetValue(new A1.Path(r.toString()));if(t["^var"]){r=t["^var"];let c=new Ct.VariablePointerValue(r.toString());return "ci"in t&&(r=t.ci,c.contextIndex=parseInt(r)),c}let i=false,a=false,s=mi.PushPopType.Function,o=false;if((r=t["->"])?i=true:(r=t["f()"])?(i=true,a=true,s=mi.PushPopType.Function):(r=t["->t->"])?(i=true,a=true,s=mi.PushPopType.Tunnel):(r=t["x()"])&&(i=true,o=true,a=false,s=mi.PushPopType.Function),i){let c=new O0.Divert;c.pushesToStack=a,c.stackPushType=s,c.isExternal=o;let h=r.toString();return (r=t.var)?c.variableDivertName=h:c.targetPathString=h,c.isConditional=!!t.c,o&&(r=t.exArgs)&&(c.externalArgs=parseInt(r)),c}if(r=t["*"]){let c=new T0.ChoicePoint;return c.pathStringOnChoice=r.toString(),(r=t.flg)&&(c.flags=parseInt(r)),c}if(r=t["VAR?"])return new Xf.VariableReference(r.toString());if(r=t["CNT?"]){let c=new Xf.VariableReference;return c.pathStringForCount=r.toString(),c}let u=false,l=false;if((r=t["VAR="])?(u=true,l=true):(r=t["temp="])&&(u=true,l=false),u){let c=r.toString(),h=!t.re,f=new N0.VariableAssignment(c,h);return f.isGlobal=l,f}if(t["#"]!==void 0)return r=t["#"],new I0.Tag(r.toString());if(r=t.list){let c=r,h=new Lu.InkList;if(r=t.origins){let f=r;h.SetInitialOriginNames(f);}for(let f in c)if(c.hasOwnProperty(f)){let g=c[f],p=new Lu.InkListItem(f),m=parseInt(g);h.Add(p,m);}return new Ct.ListValue(h)}if(t.originalChoicePath!=null)return this.JObjectToChoice(t)}if(Array.isArray(e))return this.JArrayToContainer(e);if(e==null)return null;throw new Error("Failed to convert token to runtime object: "+this.toJson(e,["parent"]))}static toJson(e,t,r){return JSON.stringify(e,(i,a)=>t?.some(s=>s===i)?void 0:a,r)}static WriteRuntimeContainer(e,t,r=false){if(e.WriteArrayStart(),t===null)return (0, Sr.throwNullException)("container");for(let u of t.content)this.WriteRuntimeObject(e,u);let i=t.namedOnlyContent,a=t.countFlags,s=t.name!=null&&!r,o=i!=null||a>0||s;if(o&&e.WriteObjectStart(),i!=null)for(let[u,l]of i){let c=u,h=(0, $e.asOrNull)(l,ju.Container);e.WritePropertyStart(c),this.WriteRuntimeContainer(e,h,true),e.WritePropertyEnd();}a>0&&e.WriteIntProperty("#f",a),s&&e.WriteProperty("#n",t.name),o?e.WriteObjectEnd():e.WriteNull(),e.WriteArrayEnd();}static JArrayToContainer(e){let t=new ju.Container;t.content=this.JArrayToRuntimeObjList(e,true);let r=e[e.length-1];if(r!=null){let i=new Map;for(let a in r)if(a=="#f")t.countFlags=parseInt(r[a]);else if(a=="#n")t.name=r[a].toString();else {let s=this.JTokenToRuntimeObject(r[a]),o=(0, $e.asOrNull)(s,ju.Container);o&&(o.name=a),i.set(a,s);}t.namedOnlyContent=i;}return t}static JObjectToChoice(e){let t=new k0.Choice;return t.text=e.text.toString(),t.index=parseInt(e.index),t.sourcePath=e.originalChoicePath.toString(),t.originalThreadIndex=parseInt(e.originalThreadIndex),t.pathStringOnChoice=e.targetPath.toString(),t.tags=this.JArrayToTags(e),t.isInvisibleDefault=!!e.isInvisibleDefault,t}static JArrayToTags(e){return e.tags?e.tags:null}static WriteChoice(e,t){e.WriteObjectStart(),e.WriteProperty("text",t.text),e.WriteIntProperty("index",t.index),e.WriteProperty("originalChoicePath",t.sourcePath),e.WriteIntProperty("originalThreadIndex",t.originalThreadIndex),e.WriteProperty("targetPath",t.pathStringOnChoice),e.WriteProperty("isInvisibleDefault",t.isInvisibleDefault),this.WriteChoiceTags(e,t),e.WriteObjectEnd();}static WriteChoiceTags(e,t){if(t.tags&&t.tags.length>0){e.WritePropertyStart("tags"),e.WriteArrayStart();for(let r of t.tags)e.Write(r);e.WriteArrayEnd(),e.WritePropertyEnd();}}static WriteInkList(e,t){let r=t.value;if(r===null)return (0, Sr.throwNullException)("rawList");e.WriteObjectStart(),e.WritePropertyStart("list"),e.WriteObjectStart();for(let[i,a]of r){let s=Lu.InkListItem.fromSerializedKey(i),o=a;if(s.itemName===null)return (0, Sr.throwNullException)("item.itemName");e.WritePropertyNameStart(),e.WritePropertyNameInner(s.originName?s.originName:"?"),e.WritePropertyNameInner("."),e.WritePropertyNameInner(s.itemName),e.WritePropertyNameEnd(),e.Write(o),e.WritePropertyEnd();}if(e.WriteObjectEnd(),e.WritePropertyEnd(),r.Count==0&&r.originNames!=null&&r.originNames.length>0){e.WritePropertyStart("origins"),e.WriteArrayStart();for(let i of r.originNames)e.Write(i);e.WriteArrayEnd(),e.WritePropertyEnd();}e.WriteObjectEnd();}static ListDefinitionsToJToken(e){let t={};for(let r of e.lists){let i={};for(let[a,s]of r.items){let o=Lu.InkListItem.fromSerializedKey(a);if(o.itemName===null)return (0, Sr.throwNullException)("item.itemName");i[o.itemName]=s;}t[r.name]=i;}return t}static JTokenToListDefinitions(e){let t=e,r=[];for(let i in t)if(t.hasOwnProperty(i)){let a=i.toString(),s=t[i],o=new Map;for(let l in s)if(t.hasOwnProperty(i)){let c=s[l];o.set(l,parseInt(c));}let u=new D1.ListDefinition(a,o);r.push(u);}return new x1.ListDefinitionsOrigin(r)}};Bu.JsonSerialisation=qu;qu._controlCommandNames=(()=>{let n=[];n[oe.ControlCommand.CommandType.EvalStart]="ev",n[oe.ControlCommand.CommandType.EvalOutput]="out",n[oe.ControlCommand.CommandType.EvalEnd]="/ev",n[oe.ControlCommand.CommandType.Duplicate]="du",n[oe.ControlCommand.CommandType.PopEvaluatedValue]="pop",n[oe.ControlCommand.CommandType.PopFunction]="~ret",n[oe.ControlCommand.CommandType.PopTunnel]="->->",n[oe.ControlCommand.CommandType.BeginString]="str",n[oe.ControlCommand.CommandType.EndString]="/str",n[oe.ControlCommand.CommandType.NoOp]="nop",n[oe.ControlCommand.CommandType.ChoiceCount]="choiceCnt",n[oe.ControlCommand.CommandType.Turns]="turn",n[oe.ControlCommand.CommandType.TurnsSince]="turns",n[oe.ControlCommand.CommandType.ReadCount]="readc",n[oe.ControlCommand.CommandType.Random]="rnd",n[oe.ControlCommand.CommandType.SeedRandom]="srnd",n[oe.ControlCommand.CommandType.VisitIndex]="visit",n[oe.ControlCommand.CommandType.SequenceShuffleIndex]="seq",n[oe.ControlCommand.CommandType.StartThread]="thread",n[oe.ControlCommand.CommandType.Done]="done",n[oe.ControlCommand.CommandType.End]="end",n[oe.ControlCommand.CommandType.ListFromInt]="listInt",n[oe.ControlCommand.CommandType.ListRange]="range",n[oe.ControlCommand.CommandType.ListRandom]="lrnd",n[oe.ControlCommand.CommandType.BeginTag]="#",n[oe.ControlCommand.CommandType.EndTag]="/#";for(let e=0;e<oe.ControlCommand.CommandType.TOTAL_VALUES;++e)if(n[e]==null)throw new Error("Control command not accounted for in serialisation");return n})();});var ep=S(ks=>{Object.defineProperty(ks,"__esModule",{value:true});ks.CallStack=void 0;var Qf=vr(),R0=pt(),P1=Rs(),$0=gi(),O1=Te(),T1=mr(),Fs=Es(),N1=cs(),V0=ii(),Zf=Qe(),Is=class n{get elements(){return this.callStack}get depth(){return this.elements.length}get currentElement(){let t=this._threads[this._threads.length-1].callstack;return t[t.length-1]}get currentElementIndex(){return this.callStack.length-1}get currentThread(){return this._threads[this._threads.length-1]}set currentThread(e){N1.Debug.Assert(this._threads.length==1,"Shouldn't be directly setting the current thread when we have a stack of them"),this._threads.length=0,this._threads.push(e);}get canPop(){return this.callStack.length>1}constructor(){if(this._threadCounter=0,this._startOfRoot=Fs.Pointer.Null,arguments[0]instanceof P1.Story){let e=arguments[0];this._startOfRoot=Fs.Pointer.StartOf(e.rootContentContainer),this.Reset();}else {let e=arguments[0];this._threads=[];for(let t of e._threads)this._threads.push(t.Copy());this._threadCounter=e._threadCounter,this._startOfRoot=e._startOfRoot.copy();}}Reset(){this._threads=[],this._threads.push(new n.Thread),this._threads[0].callstack.push(new n.Element(Qf.PushPopType.Tunnel,this._startOfRoot));}SetJsonToken(e,t){this._threads.length=0;let r=e.threads;for(let i of r){let a=i,s=new n.Thread(a,t);this._threads.push(s);}this._threadCounter=parseInt(e.threadCounter),this._startOfRoot=Fs.Pointer.StartOf(t.rootContentContainer);}WriteJson(e){e.WriteObject(t=>{t.WritePropertyStart("threads"),t.WriteArrayStart();for(let r of this._threads)r.WriteJson(t);t.WriteArrayEnd(),t.WritePropertyEnd(),t.WritePropertyStart("threadCounter"),t.WriteInt(this._threadCounter),t.WritePropertyEnd();});}PushThread(){let e=this.currentThread.Copy();this._threadCounter++,e.threadIndex=this._threadCounter,this._threads.push(e);}ForkThread(){let e=this.currentThread.Copy();return this._threadCounter++,e.threadIndex=this._threadCounter,e}PopThread(){if(this.canPopThread)this._threads.splice(this._threads.indexOf(this.currentThread),1);else throw new Error("Can't pop thread")}get canPopThread(){return this._threads.length>1&&!this.elementIsEvaluateFromGame}get elementIsEvaluateFromGame(){return this.currentElement.type==Qf.PushPopType.FunctionEvaluationFromGame}Push(e,t=0,r=0){let i=new n.Element(e,this.currentElement.currentPointer,false);i.evaluationStackHeightWhenPushed=t,i.functionStartInOutputStream=r,this.callStack.push(i);}CanPop(e=null){return this.canPop?e==null?true:this.currentElement.type==e:false}Pop(e=null){if(this.CanPop(e)){this.callStack.pop();return}else throw new Error("Mismatched push/pop in Callstack")}GetTemporaryVariableWithName(e,t=-1){t==-1&&(t=this.currentElementIndex+1);let r=this.callStack[t-1],i=(0, V0.tryGetValueFromMap)(r.temporaryVariables,e,null);return i.exists?i.result:null}SetTemporaryVariable(e,t,r,i=-1){i==-1&&(i=this.currentElementIndex+1);let a=this.callStack[i-1];if(!r&&!a.temporaryVariables.get(e))throw new Error("Could not find temporary variable to set: "+e);let s=(0, V0.tryGetValueFromMap)(a.temporaryVariables,e,null);s.exists&&O1.ListValue.RetainListOriginsForAssignment(s.result,t),a.temporaryVariables.set(e,t);}ContextForVariableNamed(e){return this.currentElement.temporaryVariables.get(e)?this.currentElementIndex+1:0}ThreadWithIndex(e){let t=this._threads.filter(r=>{if(r.threadIndex==e)return r});return t.length>0?t[0]:null}get callStack(){return this.currentThread.callstack}get callStackTrace(){let e=new T1.StringBuilder;for(let t=0;t<this._threads.length;t++){let r=this._threads[t],i=t==this._threads.length-1;e.AppendFormat(`=== THREAD {0}/{1} {2}===
|
|
27
27
|
`,t+1,this._threads.length,i?"(current) ":"");for(let a=0;a<r.callstack.length;a++){r.callstack[a].type==Qf.PushPopType.Function?e.Append(" [FUNCTION] "):e.Append(" [TUNNEL] ");let s=r.callstack[a].currentPointer;if(!s.isNull){if(e.Append("<SOMEWHERE IN "),s.container===null)return (0, Zf.throwNullException)("pointer.container");e.Append(s.container.path.toString()),e.AppendLine(">");}}}return e.toString()}};ks.CallStack=Is;(function(n){class e{constructor(i,a,s=false){this.evaluationStackHeightWhenPushed=0,this.functionStartInOutputStream=0,this.currentPointer=a.copy(),this.inExpressionEvaluation=s,this.temporaryVariables=new Map,this.type=i;}Copy(){let i=new e(this.type,this.currentPointer,this.inExpressionEvaluation);return i.temporaryVariables=new Map(this.temporaryVariables),i.evaluationStackHeightWhenPushed=this.evaluationStackHeightWhenPushed,i.functionStartInOutputStream=this.functionStartInOutputStream,i}}n.Element=e;class t{constructor(){if(this.threadIndex=0,this.previousPointer=Fs.Pointer.Null,this.callstack=[],arguments[0]&&arguments[1]){let i=arguments[0],a=arguments[1];this.threadIndex=parseInt(i.threadIndex);let s=i.callstack;for(let u of s){let l=u,c=parseInt(l.type),h=Fs.Pointer.Null,f,g=l.cPath;if(typeof g<"u"){f=g.toString();let b=a.ContentAtPath(new R0.Path(f));if(h.container=b.container,h.index=parseInt(l.idx),b.obj==null)throw new Error("When loading state, internal story location couldn't be found: "+f+". Has the story changed since this save data was created?");b.approximate&&(h.container!==null?a.Warning("When loading state, exact internal story location couldn't be found: '"+f+"', so it was approximated to '"+h.container.path.toString()+"' to recover. Has the story changed since this save data was created?"):a.Warning("When loading state, exact internal story location couldn't be found: '"+f+"' and it may not be recoverable. Has the story changed since this save data was created?"));}let p=!!l.exp,m=new e(c,h,p),C=l.temp;typeof C<"u"?m.temporaryVariables=$0.JsonSerialisation.JObjectToDictionaryRuntimeObjs(C):m.temporaryVariables.clear(),this.callstack.push(m);}let o=i.previousContentObject;if(typeof o<"u"){let u=new R0.Path(o.toString());this.previousPointer=a.PointerAtPath(u);}}}Copy(){let i=new t;i.threadIndex=this.threadIndex;for(let a of this.callstack)i.callstack.push(a.Copy());return i.previousPointer=this.previousPointer.copy(),i}WriteJson(i){i.WriteObjectStart(),i.WritePropertyStart("callstack"),i.WriteArrayStart();for(let a of this.callstack){if(i.WriteObjectStart(),!a.currentPointer.isNull){if(a.currentPointer.container===null)return (0, Zf.throwNullException)("el.currentPointer.container");i.WriteProperty("cPath",a.currentPointer.container.path.componentsString),i.WriteIntProperty("idx",a.currentPointer.index);}i.WriteProperty("exp",a.inExpressionEvaluation),i.WriteIntProperty("type",a.type),a.temporaryVariables.size>0&&(i.WritePropertyStart("temp"),$0.JsonSerialisation.WriteDictionaryRuntimeObjs(i,a.temporaryVariables),i.WritePropertyEnd()),i.WriteObjectEnd();}if(i.WriteArrayEnd(),i.WritePropertyEnd(),i.WriteIntProperty("threadIndex",this.threadIndex),!this.previousPointer.isNull){let a=this.previousPointer.Resolve();if(a===null)return (0, Zf.throwNullException)("this.previousPointer.Resolve()");i.WriteProperty("previousContentObject",a.path.toString());}i.WriteObjectEnd();}}n.Thread=t;})(Is||(ks.CallStack=Is={}));});var L0=S(Wu=>{Object.defineProperty(Wu,"__esModule",{value:true});Wu.VariablesState=void 0;var ze=Te(),F1=ds(),j0=gi(),et=fe(),$s=ii(),Mn=Qe();function I1(){return class{}}var Mu=class n extends I1(){variableChangedEvent(e,t){for(let r of this.variableChangedEventCallbacks)r(e,t);}StartVariableObservation(){this._batchObservingVariableChanges=true,this._changedVariablesForBatchObs=new Set;}CompleteVariableObservation(){this._batchObservingVariableChanges=false;let e=new Map;if(this._changedVariablesForBatchObs!=null)for(let t of this._changedVariablesForBatchObs){let r=this._globalVariables.get(t);this.variableChangedEvent(t,r);}if(this.patch!=null)for(let t of this.patch.changedVariables){let r=this.patch.TryGetGlobal(t,null);r.exists&&e.set(t,r);}return this._changedVariablesForBatchObs=null,e}NotifyObservers(e){for(let[t,r]of e)this.variableChangedEvent(t,r);}get callStack(){return this._callStack}set callStack(e){this._callStack=e;}$(e,t){if(typeof t>"u"){let r=null;return this.patch!==null&&(r=this.patch.TryGetGlobal(e,null),r.exists)?r.result.valueObject:(r=this._globalVariables.get(e),typeof r>"u"&&(r=this._defaultGlobalVariables.get(e)),typeof r<"u"?r.valueObject:null)}else {if(typeof this._defaultGlobalVariables.get(e)>"u")throw new F1.StoryException("Cannot assign to a variable ("+e+") that hasn't been declared in the story");let r=ze.Value.Create(t);if(r==null)throw t==null?new Error("Cannot pass null to VariableState"):new Error("Invalid value passed to VariableState: "+t.toString());this.SetGlobal(e,r);}}constructor(e,t){super(),this.variableChangedEventCallbacks=[],this.patch=null,this._defaultGlobalVariables=new Map,this._changedVariablesForBatchObs=new Set,this._batchObservingVariableChanges=false,this._globalVariables=new Map,this._callStack=e,this._listDefsOrigin=t;try{return new Proxy(this,{get(i,a){return a in i?i[a]:i.$(a)},set(i,a,s){return a in i?i[a]=s:i.$(a,s),!0},ownKeys(i){return [...new Set([...i._defaultGlobalVariables.keys(),...i._globalVariables.keys()])]},getOwnPropertyDescriptor(i,a){return {enumerable:!0,configurable:!0,value:i.$(a)}}})}catch{}}ApplyPatch(){if(this.patch===null)return (0, Mn.throwNullException)("this.patch");for(let[e,t]of this.patch.globals)this._globalVariables.set(e,t);if(this._changedVariablesForBatchObs!==null)for(let e of this.patch.changedVariables)this._changedVariablesForBatchObs.add(e);this.patch=null;}SetJsonToken(e){this._globalVariables.clear();for(let[t,r]of this._defaultGlobalVariables){let i=e[t];if(typeof i<"u"){let a=j0.JsonSerialisation.JTokenToRuntimeObject(i);if(a===null)return (0, Mn.throwNullException)("tokenInkObject");this._globalVariables.set(t,a);}else this._globalVariables.set(t,r);}}WriteJson(e){e.WriteObjectStart();for(let[t,r]of this._globalVariables){let i=t,a=r;if(n.dontSaveDefaultValues&&this._defaultGlobalVariables.has(i)){let s=this._defaultGlobalVariables.get(i);if(this.RuntimeObjectsEqual(a,s))continue}e.WritePropertyStart(i),j0.JsonSerialisation.WriteRuntimeObject(e,a),e.WritePropertyEnd();}e.WriteObjectEnd();}RuntimeObjectsEqual(e,t){if(e===null)return (0, Mn.throwNullException)("obj1");if(t===null)return (0, Mn.throwNullException)("obj2");if(e.constructor!==t.constructor)return false;let r=(0, et.asOrNull)(e,ze.BoolValue);if(r!==null)return r.value===(0, et.asOrThrows)(t,ze.BoolValue).value;let i=(0, et.asOrNull)(e,ze.IntValue);if(i!==null)return i.value===(0, et.asOrThrows)(t,ze.IntValue).value;let a=(0, et.asOrNull)(e,ze.FloatValue);if(a!==null)return a.value===(0, et.asOrThrows)(t,ze.FloatValue).value;let s=(0, et.asOrNull)(e,ze.Value),o=(0, et.asOrNull)(t,ze.Value);if(s!==null&&o!==null)return (0, et.isEquatable)(s.valueObject)&&(0, et.isEquatable)(o.valueObject)?s.valueObject.Equals(o.valueObject):s.valueObject===o.valueObject;throw new Error("FastRoughDefinitelyEquals: Unsupported runtime object type: "+e.constructor.name)}GetVariableWithName(e,t=-1){let r=this.GetRawVariableWithName(e,t),i=(0, et.asOrNull)(r,ze.VariablePointerValue);return i!==null&&(r=this.ValueAtVariablePointer(i)),r}TryGetDefaultVariableValue(e){let t=(0, $s.tryGetValueFromMap)(this._defaultGlobalVariables,e,null);return t.exists?t.result:null}GlobalVariableExistsWithName(e){return this._globalVariables.has(e)||this._defaultGlobalVariables!==null&&this._defaultGlobalVariables.has(e)}GetRawVariableWithName(e,t){let r=null;if(t==0||t==-1){let i=null;if(this.patch!==null&&(i=this.patch.TryGetGlobal(e,null),i.exists)||(i=(0, $s.tryGetValueFromMap)(this._globalVariables,e,null),i.exists)||this._defaultGlobalVariables!==null&&(i=(0, $s.tryGetValueFromMap)(this._defaultGlobalVariables,e,null),i.exists))return i.result;if(this._listDefsOrigin===null)return (0, Mn.throwNullException)("VariablesState._listDefsOrigin");let a=this._listDefsOrigin.FindSingleItemListWithName(e);if(a)return a}return r=this._callStack.GetTemporaryVariableWithName(e,t),r}ValueAtVariablePointer(e){return this.GetVariableWithName(e.variableName,e.contextIndex)}Assign(e,t){let r=e.variableName;if(r===null)return (0, Mn.throwNullException)("name");let i=-1,a=false;if(e.isNewDeclaration?a=e.isGlobal:a=this.GlobalVariableExistsWithName(r),e.isNewDeclaration){let s=(0, et.asOrNull)(t,ze.VariablePointerValue);s!==null&&(t=this.ResolveVariablePointer(s));}else {let s=null;do s=(0, et.asOrNull)(this.GetRawVariableWithName(r,i),ze.VariablePointerValue),s!=null&&(r=s.variableName,i=s.contextIndex,a=i==0);while(s!=null)}a?this.SetGlobal(r,t):this._callStack.SetTemporaryVariable(r,t,e.isNewDeclaration,i);}SnapshotDefaultGlobals(){this._defaultGlobalVariables=new Map(this._globalVariables);}RetainListOriginsForAssignment(e,t){let r=(0, et.asOrThrows)(e,ze.ListValue),i=(0, et.asOrThrows)(t,ze.ListValue);r.value&&i.value&&i.value.Count==0&&i.value.SetInitialOriginNames(r.value.originNames);}SetGlobal(e,t){let r=null;if(this.patch===null&&(r=(0, $s.tryGetValueFromMap)(this._globalVariables,e,null)),this.patch!==null&&(r=this.patch.TryGetGlobal(e,null),r.exists||(r=(0, $s.tryGetValueFromMap)(this._globalVariables,e,null))),ze.ListValue.RetainListOriginsForAssignment(r.result,t),e===null)return (0, Mn.throwNullException)("variableName");if(this.patch!==null?this.patch.SetGlobal(e,t):this._globalVariables.set(e,t),this.variableChangedEvent!==null&&r!==null&&t!==r.result)if(this._batchObservingVariableChanges){if(this._changedVariablesForBatchObs===null)return (0, Mn.throwNullException)("this._changedVariablesForBatchObs");this.patch!==null?this.patch.AddChangedVariable(e):this._changedVariablesForBatchObs!==null&&this._changedVariablesForBatchObs.add(e);}else this.variableChangedEvent(e,t);}ResolveVariablePointer(e){let t=e.contextIndex;t==-1&&(t=this.GetContextIndexOfVariableNamed(e.variableName));let r=this.GetRawVariableWithName(e.variableName,t),i=(0, et.asOrNull)(r,ze.VariablePointerValue);return i??new ze.VariablePointerValue(e.variableName,t)}GetContextIndexOfVariableNamed(e){return this.GlobalVariableExistsWithName(e)?0:this._callStack.currentElementIndex}ObserveVariableChange(e){this.variableChangedEventCallbacks.push(e);}};Wu.VariablesState=Mu;Mu.dontSaveDefaultValues=true;});var np=S(Gu=>{Object.defineProperty(Gu,"__esModule",{value:true});Gu.PRNG=void 0;var tp=class{constructor(e){this.seed=e%2147483647,this.seed<=0&&(this.seed+=2147483646);}next(){return this.seed=this.seed*48271%2147483647}nextFloat(){return (this.next()-1)/2147483646}};Gu.PRNG=tp;});var q0=S(Hu=>{Object.defineProperty(Hu,"__esModule",{value:true});Hu.StatePatch=void 0;var rp=class{get globals(){return this._globals}get changedVariables(){return this._changedVariables}get visitCounts(){return this._visitCounts}get turnIndices(){return this._turnIndices}constructor(){if(this._changedVariables=new Set,this._visitCounts=new Map,this._turnIndices=new Map,arguments.length===1&&arguments[0]!==null){let e=arguments[0];this._globals=new Map(e._globals),this._changedVariables=new Set(e._changedVariables),this._visitCounts=new Map(e._visitCounts),this._turnIndices=new Map(e._turnIndices);}else this._globals=new Map,this._changedVariables=new Set,this._visitCounts=new Map,this._turnIndices=new Map;}TryGetGlobal(e,t){return e!==null&&this._globals.has(e)?{result:this._globals.get(e),exists:true}:{result:t,exists:false}}SetGlobal(e,t){this._globals.set(e,t);}AddChangedVariable(e){return this._changedVariables.add(e)}TryGetVisitCount(e,t){return this._visitCounts.has(e)?{result:this._visitCounts.get(e),exists:true}:{result:t,exists:false}}SetVisitCount(e,t){this._visitCounts.set(e,t);}SetTurnIndex(e,t){this._turnIndices.set(e,t);}TryGetTurnIndex(e,t){return this._turnIndices.has(e)?{result:this._turnIndices.get(e),exists:true}:{result:t,exists:false}}};Hu.StatePatch=rp;});var ip=S(js=>{Object.defineProperty(js,"__esModule",{value:true});js.SimpleJson=void 0;var Vs=class n{static TextToDictionary(e){return new n.Reader(e).ToDictionary()}static TextToArray(e){return new n.Reader(e).ToArray()}};js.SimpleJson=Vs;(function(n){class e{constructor(i){if(JSON.parse("0",(s,o,u)=>u!=null)){let s=(o,u,l)=>Number.isInteger(u)&&l.source.endsWith(".0")?l.source+"f":u;this._rootObject=JSON.parse(i,s);}else {let s=i.replace(/(,\s*)([0-9]+\.[0]+)([,]*)/g,'$1"$2f"$3');this._rootObject=JSON.parse(s);}}ToDictionary(){return this._rootObject}ToArray(){return this._rootObject}}n.Reader=e;class t{constructor(){this._currentPropertyName=null,this._currentString=null,this._stateStack=[],this._collectionStack=[],this._propertyNameStack=[],this._jsonObject=null;}WriteObject(i){this.WriteObjectStart(),i(this),this.WriteObjectEnd();}WriteObjectStart(){this.StartNewObject(true);let i={};if(this.state===n.Writer.State.Property){this.Assert(this.currentCollection!==null),this.Assert(this.currentPropertyName!==null);let a=this._propertyNameStack.pop();this.currentCollection[a]=i,this._collectionStack.push(i);}else this.state===n.Writer.State.Array?(this.Assert(this.currentCollection!==null),this.currentCollection.push(i),this._collectionStack.push(i)):(this.Assert(this.state===n.Writer.State.None),this._jsonObject=i,this._collectionStack.push(i));this._stateStack.push(new n.Writer.StateElement(n.Writer.State.Object));}WriteObjectEnd(){this.Assert(this.state===n.Writer.State.Object),this._collectionStack.pop(),this._stateStack.pop();}WriteProperty(i,a){if(this.WritePropertyStart(i),arguments[1]instanceof Function){let s=arguments[1];s(this);}else {let s=arguments[1];this.Write(s);}this.WritePropertyEnd();}WriteIntProperty(i,a){this.WritePropertyStart(i),this.WriteInt(a),this.WritePropertyEnd();}WriteFloatProperty(i,a){this.WritePropertyStart(i),this.WriteFloat(a),this.WritePropertyEnd();}WritePropertyStart(i){this.Assert(this.state===n.Writer.State.Object),this._propertyNameStack.push(i),this.IncrementChildCount(),this._stateStack.push(new n.Writer.StateElement(n.Writer.State.Property));}WritePropertyEnd(){this.Assert(this.state===n.Writer.State.Property),this.Assert(this.childCount===1),this._stateStack.pop();}WritePropertyNameStart(){this.Assert(this.state===n.Writer.State.Object),this.IncrementChildCount(),this._currentPropertyName="",this._stateStack.push(new n.Writer.StateElement(n.Writer.State.Property)),this._stateStack.push(new n.Writer.StateElement(n.Writer.State.PropertyName));}WritePropertyNameEnd(){this.Assert(this.state===n.Writer.State.PropertyName),this.Assert(this._currentPropertyName!==null),this._propertyNameStack.push(this._currentPropertyName),this._currentPropertyName=null,this._stateStack.pop();}WritePropertyNameInner(i){this.Assert(this.state===n.Writer.State.PropertyName),this.Assert(this._currentPropertyName!==null),this._currentPropertyName+=i;}WriteArrayStart(){this.StartNewObject(true);let i=[];if(this.state===n.Writer.State.Property){this.Assert(this.currentCollection!==null),this.Assert(this.currentPropertyName!==null);let a=this._propertyNameStack.pop();this.currentCollection[a]=i,this._collectionStack.push(i);}else this.state===n.Writer.State.Array?(this.Assert(this.currentCollection!==null),this.currentCollection.push(i),this._collectionStack.push(i)):(this.Assert(this.state===n.Writer.State.None),this._jsonObject=i,this._collectionStack.push(i));this._stateStack.push(new n.Writer.StateElement(n.Writer.State.Array));}WriteArrayEnd(){this.Assert(this.state===n.Writer.State.Array),this._collectionStack.pop(),this._stateStack.pop();}Write(i,a=true){if(i===null){console.error("Warning: trying to write a null value");return}this.StartNewObject(false),this._addToCurrentObject(i);}WriteBool(i){i!==null&&(this.StartNewObject(false),this._addToCurrentObject(i));}WriteInt(i){i!==null&&(this.StartNewObject(false),this._addToCurrentObject(Math.floor(i)));}WriteFloat(i){i!==null&&(this.StartNewObject(false),i==Number.POSITIVE_INFINITY?this._addToCurrentObject(34e37):i==Number.NEGATIVE_INFINITY?this._addToCurrentObject(-34e37):isNaN(i)?this._addToCurrentObject(0):this._addToCurrentObject(i));}WriteNull(){this.StartNewObject(false),this._addToCurrentObject(null);}WriteStringStart(){this.StartNewObject(false),this._currentString="",this._stateStack.push(new n.Writer.StateElement(n.Writer.State.String));}WriteStringEnd(){this.Assert(this.state==n.Writer.State.String),this._stateStack.pop(),this._addToCurrentObject(this._currentString),this._currentString=null;}WriteStringInner(i,a=true){if(this.Assert(this.state===n.Writer.State.String),i===null){console.error("Warning: trying to write a null string");return}this._currentString+=i;}toString(){return this._jsonObject===null?"":JSON.stringify(this._jsonObject)}StartNewObject(i){i?this.Assert(this.state===n.Writer.State.None||this.state===n.Writer.State.Property||this.state===n.Writer.State.Array):this.Assert(this.state===n.Writer.State.Property||this.state===n.Writer.State.Array),this.state===n.Writer.State.Property&&this.Assert(this.childCount===0),(this.state===n.Writer.State.Array||this.state===n.Writer.State.Property)&&this.IncrementChildCount();}get state(){return this._stateStack.length>0?this._stateStack[this._stateStack.length-1].type:n.Writer.State.None}get childCount(){return this._stateStack.length>0?this._stateStack[this._stateStack.length-1].childCount:0}get currentCollection(){return this._collectionStack.length>0?this._collectionStack[this._collectionStack.length-1]:null}get currentPropertyName(){return this._propertyNameStack.length>0?this._propertyNameStack[this._propertyNameStack.length-1]:null}IncrementChildCount(){this.Assert(this._stateStack.length>0);let i=this._stateStack.pop();i.childCount++,this._stateStack.push(i);}Assert(i){if(!i)throw Error("Assert failed while writing JSON")}_addToCurrentObject(i){this.Assert(this.currentCollection!==null),this.state===n.Writer.State.Array?(this.Assert(Array.isArray(this.currentCollection)),this.currentCollection.push(i)):this.state===n.Writer.State.Property&&(this.Assert(!Array.isArray(this.currentCollection)),this.Assert(this.currentPropertyName!==null),this.currentCollection[this.currentPropertyName]=i,this._propertyNameStack.pop());}}n.Writer=t,(function(r){(function(s){s[s.None=0]="None",s[s.Object=1]="Object",s[s.Array=2]="Array",s[s.Property=3]="Property",s[s.PropertyName=4]="PropertyName",s[s.String=5]="String";})(r.State||(r.State={}));class a{constructor(o){this.type=n.Writer.State.None,this.childCount=0,this.type=o;}}r.StateElement=a;})(t=n.Writer||(n.Writer={}));})(Vs||(js.SimpleJson=Vs={}));});var M0=S(zu=>{Object.defineProperty(zu,"__esModule",{value:true});zu.Flow=void 0;var B0=ep(),Ju=gi(),k1=Qe(),sp=class{constructor(){let e=arguments[0],t=arguments[1];if(this.name=e,this.callStack=new B0.CallStack(t),arguments[2]){let r=arguments[2];this.callStack.SetJsonToken(r.callstack,t),this.outputStream=Ju.JsonSerialisation.JArrayToRuntimeObjList(r.outputStream),this.currentChoices=Ju.JsonSerialisation.JArrayToRuntimeObjList(r.currentChoices);let i=r.choiceThreads;typeof i<"u"&&this.LoadFlowChoiceThreads(i,t);}else this.outputStream=[],this.currentChoices=[];}WriteJson(e){e.WriteObjectStart(),e.WriteProperty("callstack",r=>this.callStack.WriteJson(r)),e.WriteProperty("outputStream",r=>Ju.JsonSerialisation.WriteListRuntimeObjs(r,this.outputStream));let t=false;for(let r of this.currentChoices){if(r.threadAtGeneration===null)return (0, k1.throwNullException)("c.threadAtGeneration");r.originalThreadIndex=r.threadAtGeneration.threadIndex,this.callStack.ThreadWithIndex(r.originalThreadIndex)===null&&(t||(t=true,e.WritePropertyStart("choiceThreads"),e.WriteObjectStart()),e.WritePropertyStart(r.originalThreadIndex),r.threadAtGeneration.WriteJson(e),e.WritePropertyEnd());}t&&(e.WriteObjectEnd(),e.WritePropertyEnd()),e.WriteProperty("currentChoices",r=>{r.WriteArrayStart();for(let i of this.currentChoices)Ju.JsonSerialisation.WriteChoice(r,i);r.WriteArrayEnd();}),e.WriteObjectEnd();}LoadFlowChoiceThreads(e,t){for(let r of this.currentChoices){let i=this.callStack.ThreadWithIndex(r.originalThreadIndex);if(i!==null)r.threadAtGeneration=i.Copy();else {let a=e[`${r.originalThreadIndex}`];r.threadAtGeneration=new B0.CallStack.Thread(a,t);}}}};zu.Flow=sp;});var H0=S(Ku=>{Object.defineProperty(Ku,"__esModule",{value:true});Ku.StoryState=void 0;var R1=ep(),$1=L0(),Me=Te(),Wn=vr(),V1=Ru(),ap=Au(),W0=pt(),at=Ze(),op=mr(),Gn=gi(),j1=np(),L1=yr(),yi=Es(),Ls=ii(),je=fe(),q1=cs(),$t=Qe(),B1=Rs(),M1=q0(),G0=ip(),Uu=M0(),W1=yt(),up=class n{ToJson(e=false){let t=new G0.SimpleJson.Writer;return this.WriteJson(t),t.toString()}toJson(e=false){return this.ToJson(e)}LoadJson(e){let t=G0.SimpleJson.TextToDictionary(e);this.LoadJsonObj(t),this.onDidLoadState!==null&&this.onDidLoadState();}VisitCountAtPathString(e){let t;if(this._patch!==null){let r=this.story.ContentAtPath(new W0.Path(e)).container;if(r===null)throw new Error("Content at path not found: "+e);if(t=this._patch.TryGetVisitCount(r,0),t.exists)return t.result}return t=(0, Ls.tryGetValueFromMap)(this._visitCounts,e,null),t.exists?t.result:0}VisitCountForContainer(e){if(e===null)return (0, $t.throwNullException)("container");if(!e.visitsShouldBeCounted)return this.story.Error("Read count for target ("+e.name+" - on "+e.debugMetadata+") unknown. The story may need to be compiled with countAllVisits flag (-c)."),0;if(this._patch!==null){let i=this._patch.TryGetVisitCount(e,0);if(i.exists)return i.result}let t=e.path.toString(),r=(0, Ls.tryGetValueFromMap)(this._visitCounts,t,null);return r.exists?r.result:0}IncrementVisitCountForContainer(e){if(this._patch!==null){let i=this.VisitCountForContainer(e);i++,this._patch.SetVisitCount(e,i);return}let t=e.path.toString(),r=(0, Ls.tryGetValueFromMap)(this._visitCounts,t,null);r.exists?this._visitCounts.set(t,r.result+1):this._visitCounts.set(t,1);}RecordTurnIndexVisitToContainer(e){if(this._patch!==null){this._patch.SetTurnIndex(e,this.currentTurnIndex);return}let t=e.path.toString();this._turnIndices.set(t,this.currentTurnIndex);}TurnsSinceForContainer(e){if(e.turnIndexShouldBeCounted||this.story.Error("TURNS_SINCE() for target ("+e.name+" - on "+e.debugMetadata+") unknown. The story may need to be compiled with countAllVisits flag (-c)."),this._patch!==null){let i=this._patch.TryGetTurnIndex(e,0);if(i.exists)return this.currentTurnIndex-i.result}let t=e.path.toString(),r=(0, Ls.tryGetValueFromMap)(this._turnIndices,t,0);return r.exists?this.currentTurnIndex-r.result:-1}get callstackDepth(){return this.callStack.depth}get outputStream(){return this._currentFlow.outputStream}get currentChoices(){return this.canContinue?[]:this._currentFlow.currentChoices}get generatedChoices(){return this._currentFlow.currentChoices}get currentErrors(){return this._currentErrors}get currentWarnings(){return this._currentWarnings}get variablesState(){return this._variablesState}set variablesState(e){this._variablesState=e;}get callStack(){return this._currentFlow.callStack}get evaluationStack(){return this._evaluationStack}get currentTurnIndex(){return this._currentTurnIndex}set currentTurnIndex(e){this._currentTurnIndex=e;}get currentPathString(){let e=this.currentPointer;return e.isNull?null:e.path===null?(0, $t.throwNullException)("pointer.path"):e.path.toString()}get previousPathString(){let e=this.previousPointer;return e.isNull?null:e.path===null?(0, $t.throwNullException)("previousPointer.path"):e.path.toString()}get currentPointer(){return this.callStack.currentElement.currentPointer.copy()}set currentPointer(e){this.callStack.currentElement.currentPointer=e.copy();}get previousPointer(){return this.callStack.currentThread.previousPointer.copy()}set previousPointer(e){this.callStack.currentThread.previousPointer=e.copy();}get canContinue(){return !this.currentPointer.isNull&&!this.hasError}get hasError(){return this.currentErrors!=null&&this.currentErrors.length>0}get hasWarning(){return this.currentWarnings!=null&&this.currentWarnings.length>0}get currentText(){if(this._outputStreamTextDirty){let e=new op.StringBuilder,t=false;for(let r of this.outputStream){let i=(0, je.asOrNull)(r,Me.StringValue);if(!t&&i!==null)e.Append(i.value);else {let a=(0, je.asOrNull)(r,at.ControlCommand);a!==null&&(a.commandType==at.ControlCommand.CommandType.BeginTag?t=true:a.commandType==at.ControlCommand.CommandType.EndTag&&(t=false));}}this._currentText=this.CleanOutputWhitespace(e.toString()),this._outputStreamTextDirty=false;}return this._currentText}CleanOutputWhitespace(e){let t=new op.StringBuilder,r=-1,i=0;for(let a=0;a<e.length;a++){let s=e.charAt(a),o=s==" "||s==" ";o&&r==-1&&(r=a),o||(s!=`
|
|
28
28
|
`&&r>0&&r!=i&&t.Append(" "),r=-1),s==`
|
|
29
29
|
`&&(i=a+1),o||t.Append(s);}return t.toString()}get currentTags(){if(this._outputStreamTagsDirty){this._currentTags=[];let e=false,t=new op.StringBuilder;for(let r of this.outputStream){let i=(0, je.asOrNull)(r,at.ControlCommand);if(i!=null){if(i.commandType==at.ControlCommand.CommandType.BeginTag){if(e&&t.Length>0){let a=this.CleanOutputWhitespace(t.toString());this._currentTags.push(a),t.Clear();}e=true;}else if(i.commandType==at.ControlCommand.CommandType.EndTag){if(t.Length>0){let a=this.CleanOutputWhitespace(t.toString());this._currentTags.push(a),t.Clear();}e=false;}}else if(e){let a=(0, je.asOrNull)(r,Me.StringValue);a!==null&&t.Append(a.value);}else {let a=(0, je.asOrNull)(r,V1.Tag);a!=null&&a.text!=null&&a.text.length>0&&this._currentTags.push(a.text);}}if(t.Length>0){let r=this.CleanOutputWhitespace(t.toString());this._currentTags.push(r),t.Clear();}this._outputStreamTagsDirty=false;}return this._currentTags}get currentFlowName(){return this._currentFlow.name}get currentFlowIsDefaultFlow(){return this._currentFlow.name==this.kDefaultFlowName}get aliveFlowNames(){if(this._aliveFlowNamesDirty){if(this._aliveFlowNames=[],this._namedFlows!=null)for(let e of this._namedFlows.keys())e!=this.kDefaultFlowName&&this._aliveFlowNames.push(e);this._aliveFlowNamesDirty=false;}return this._aliveFlowNames}get inExpressionEvaluation(){return this.callStack.currentElement.inExpressionEvaluation}set inExpressionEvaluation(e){this.callStack.currentElement.inExpressionEvaluation=e;}constructor(e){this.kInkSaveStateVersion=10,this.kMinCompatibleLoadVersion=8,this.onDidLoadState=null,this._currentErrors=null,this._currentWarnings=null,this.divertedPointer=yi.Pointer.Null,this._currentTurnIndex=0,this.storySeed=0,this.previousRandom=0,this.didSafeExit=false,this._currentText=null,this._currentTags=null,this._outputStreamTextDirty=true,this._outputStreamTagsDirty=true,this._patch=null,this._aliveFlowNames=null,this._namedFlows=null,this.kDefaultFlowName="DEFAULT_FLOW",this._aliveFlowNamesDirty=true,this.story=e,this._currentFlow=new Uu.Flow(this.kDefaultFlowName,e),this.OutputStreamDirty(),this._aliveFlowNamesDirty=true,this._evaluationStack=[],this._variablesState=new $1.VariablesState(this.callStack,e.listDefinitions),this._visitCounts=new Map,this._turnIndices=new Map,this.currentTurnIndex=-1;let t=new Date().getTime();this.storySeed=new j1.PRNG(t).next()%100,this.previousRandom=0,this.GoToStart();}GoToStart(){this.callStack.currentElement.currentPointer=yi.Pointer.StartOf(this.story.mainContentContainer);}SwitchFlow_Internal(e){if(e===null)throw new Error("Must pass a non-null string to Story.SwitchFlow");if(this._namedFlows===null&&(this._namedFlows=new Map,this._namedFlows.set(this.kDefaultFlowName,this._currentFlow)),e===this._currentFlow.name)return;let t,r=(0, Ls.tryGetValueFromMap)(this._namedFlows,e,null);r.exists?t=r.result:(t=new Uu.Flow(e,this.story),this._namedFlows.set(e,t),this._aliveFlowNamesDirty=true),this._currentFlow=t,this.variablesState.callStack=this._currentFlow.callStack,this.OutputStreamDirty();}SwitchToDefaultFlow_Internal(){this._namedFlows!==null&&this.SwitchFlow_Internal(this.kDefaultFlowName);}RemoveFlow_Internal(e){if(e===null)throw new Error("Must pass a non-null string to Story.DestroyFlow");if(e===this.kDefaultFlowName)throw new Error("Cannot destroy default flow");if(this._currentFlow.name===e&&this.SwitchToDefaultFlow_Internal(),this._namedFlows===null)return (0, $t.throwNullException)("this._namedFlows");this._namedFlows.delete(e),this._aliveFlowNamesDirty=true;}CopyAndStartPatching(e){let t=new n(this.story);if(t._patch=new M1.StatePatch(this._patch),t._currentFlow.name=this._currentFlow.name,t._currentFlow.callStack=new R1.CallStack(this._currentFlow.callStack),t._currentFlow.outputStream.push(...this._currentFlow.outputStream),t.OutputStreamDirty(),e)for(let r of this._currentFlow.currentChoices)t._currentFlow.currentChoices.push(r.Clone());else t._currentFlow.currentChoices.push(...this._currentFlow.currentChoices);if(this._namedFlows!==null){t._namedFlows=new Map;for(let[r,i]of this._namedFlows)t._namedFlows.set(r,i),t._aliveFlowNamesDirty=true;t._namedFlows.set(this._currentFlow.name,t._currentFlow);}return this.hasError&&(t._currentErrors=[],t._currentErrors.push(...this.currentErrors||[])),this.hasWarning&&(t._currentWarnings=[],t._currentWarnings.push(...this.currentWarnings||[])),t.variablesState=this.variablesState,t.variablesState.callStack=t.callStack,t.variablesState.patch=t._patch,t.evaluationStack.push(...this.evaluationStack),this.divertedPointer.isNull||(t.divertedPointer=this.divertedPointer.copy()),t.previousPointer=this.previousPointer.copy(),t._visitCounts=this._visitCounts,t._turnIndices=this._turnIndices,t.currentTurnIndex=this.currentTurnIndex,t.storySeed=this.storySeed,t.previousRandom=this.previousRandom,t.didSafeExit=this.didSafeExit,t}RestoreAfterPatch(){this.variablesState.callStack=this.callStack,this.variablesState.patch=this._patch;}ApplyAnyPatch(){if(this._patch!==null){this.variablesState.ApplyPatch();for(let[e,t]of this._patch.visitCounts)this.ApplyCountChanges(e,t,true);for(let[e,t]of this._patch.turnIndices)this.ApplyCountChanges(e,t,false);this._patch=null;}}ApplyCountChanges(e,t,r){(r?this._visitCounts:this._turnIndices).set(e.path.toString(),t);}WriteJson(e){if(e.WriteObjectStart(),e.WritePropertyStart("flows"),e.WriteObjectStart(),this._namedFlows!==null)for(let[t,r]of this._namedFlows)e.WriteProperty(t,i=>r.WriteJson(i));else e.WriteProperty(this._currentFlow.name,t=>this._currentFlow.WriteJson(t));if(e.WriteObjectEnd(),e.WritePropertyEnd(),e.WriteProperty("currentFlowName",this._currentFlow.name),e.WriteProperty("variablesState",t=>this.variablesState.WriteJson(t)),e.WriteProperty("evalStack",t=>Gn.JsonSerialisation.WriteListRuntimeObjs(t,this.evaluationStack)),!this.divertedPointer.isNull){if(this.divertedPointer.path===null)return (0, $t.throwNullException)("divertedPointer");e.WriteProperty("currentDivertTarget",this.divertedPointer.path.componentsString);}e.WriteProperty("visitCounts",t=>Gn.JsonSerialisation.WriteIntDictionary(t,this._visitCounts)),e.WriteProperty("turnIndices",t=>Gn.JsonSerialisation.WriteIntDictionary(t,this._turnIndices)),e.WriteIntProperty("turnIdx",this.currentTurnIndex),e.WriteIntProperty("storySeed",this.storySeed),e.WriteIntProperty("previousRandom",this.previousRandom),e.WriteIntProperty("inkSaveVersion",this.kInkSaveStateVersion),e.WriteIntProperty("inkFormatVersion",B1.Story.inkVersionCurrent),e.WriteObjectEnd();}LoadJsonObj(e){let t=e,r=t.inkSaveVersion;if(r==null)throw new Error("ink save format incorrect, can't load.");if(parseInt(r)<this.kMinCompatibleLoadVersion)throw new Error("Ink save format isn't compatible with the current version (saw '"+r+"', but minimum is "+this.kMinCompatibleLoadVersion+"), so can't load.");let i=t.flows;if(i!=null){let s=i;Object.keys(s).length===1?this._namedFlows=null:this._namedFlows===null?this._namedFlows=new Map:this._namedFlows.clear();let o=Object.entries(s);for(let[u,l]of o){let c=u,h=l,f=new Uu.Flow(c,this.story,h);if(Object.keys(s).length===1)this._currentFlow=new Uu.Flow(c,this.story,h);else {if(this._namedFlows===null)return (0, $t.throwNullException)("this._namedFlows");this._namedFlows.set(c,f);}}if(this._namedFlows!=null&&this._namedFlows.size>1){let u=t.currentFlowName;this._currentFlow=this._namedFlows.get(u);}}else {this._namedFlows=null,this._currentFlow.name=this.kDefaultFlowName,this._currentFlow.callStack.SetJsonToken(t.callstackThreads,this.story),this._currentFlow.outputStream=Gn.JsonSerialisation.JArrayToRuntimeObjList(t.outputStream),this._currentFlow.currentChoices=Gn.JsonSerialisation.JArrayToRuntimeObjList(t.currentChoices);let s=t.choiceThreads;this._currentFlow.LoadFlowChoiceThreads(s,this.story);}this.OutputStreamDirty(),this._aliveFlowNamesDirty=true,this.variablesState.SetJsonToken(t.variablesState),this.variablesState.callStack=this._currentFlow.callStack,this._evaluationStack=Gn.JsonSerialisation.JArrayToRuntimeObjList(t.evalStack);let a=t.currentDivertTarget;if(a!=null){let s=new W0.Path(a.toString());this.divertedPointer=this.story.PointerAtPath(s);}this._visitCounts=Gn.JsonSerialisation.JObjectToIntDictionary(t.visitCounts),this._turnIndices=Gn.JsonSerialisation.JObjectToIntDictionary(t.turnIndices),this.currentTurnIndex=parseInt(t.turnIdx),this.storySeed=parseInt(t.storySeed),this.previousRandom=parseInt(t.previousRandom);}ResetErrors(){this._currentErrors=null,this._currentWarnings=null;}ResetOutput(e=null){this.outputStream.length=0,e!==null&&this.outputStream.push(...e),this.OutputStreamDirty();}PushToOutputStream(e){let t=(0, je.asOrNull)(e,Me.StringValue);if(t!==null){let r=this.TrySplittingHeadTailWhitespace(t);if(r!==null){for(let i of r)this.PushToOutputStreamIndividual(i);this.OutputStreamDirty();return}}this.PushToOutputStreamIndividual(e),this.OutputStreamDirty();}PopFromOutputStream(e){this.outputStream.splice(this.outputStream.length-e,e),this.OutputStreamDirty();}TrySplittingHeadTailWhitespace(e){let t=e.value;if(t===null)return (0, $t.throwNullException)("single.value");let r=-1,i=-1;for(let c=0;c<t.length;c++){let h=t[c];if(h==`
|
|
@@ -48,7 +48,7 @@ Error:${c}`);}return l!=null&&(u=new n(l,s,this._externalErrorHandler,this._root
|
|
|
48
48
|
`))),this.Expect(this.EndOfLine,"end of line",this.SkipToNextLine),o},this.VariableDeclaration=()=>{if(this.Whitespace(),this.Parse(this.Identifier)!=="VAR")return null;this.Whitespace();let o=this.Expect(this.IdentifierWithMetadata,"variable name");this.Whitespace(),this.Expect(this.String("="),"the '=' for an assignment of a value, e.g. '= 5' (initial values are mandatory)"),this.Whitespace();let l=this.Expect(this.Expression,"initial value for ");return l?(l instanceof Si.NumberExpression||l instanceof Hs.StringExpression||l instanceof vp.DivertTarget||l instanceof bp.VariableReference||l instanceof oC.List||this.Error("initial value for a variable must be a number, constant, list or divert target"),this.Parse(this.ListElementDefinitionSeparator)!==null?this.Error("Unexpected ','. If you're trying to declare a new list, use the LIST keyword, not VAR"):l instanceof Hs.StringExpression&&(l.isSingleString||this.Error("Constant strings cannot contain any logic.")),new Cp.VariableAssignment({assignedExpression:l,isGlobalDeclaration:true,variableIdentifier:o})):null},this.ListDeclaration=()=>{if(this.Whitespace(),this.Parse(this.Identifier)!="LIST")return null;this.Whitespace();let o=this.Expect(this.IdentifierWithMetadata,"list name");this.Whitespace(),this.Expect(this.String("="),"the '=' for an assignment of the list definition"),this.Whitespace();let u=this.Expect(this.ListDefinition,"list item names");return u?(u.identifier=new Js.Identifier(o.name),new Cp.VariableAssignment({variableIdentifier:o,listDef:u})):null},this.ListDefinition=()=>{this.AnyWhitespace();let s=this.SeparatedList(this.ListElementDefinition,this.ListElementDefinitionSeparator);return s===null?null:new TN.ListDefinition(s)},this.ListElementDefinitionSeparator=()=>(this.AnyWhitespace(),this.ParseString(",")===null?null:(this.AnyWhitespace(),",")),this.ListElementDefinition=()=>{let s=this.ParseString("(")!==null,o=s;this.Whitespace();let u=this.Parse(this.IdentifierWithMetadata);if(u===null)return null;this.Whitespace(),s&&this.ParseString(")")!=null&&(o=false,this.Whitespace());let l=null;if(this.ParseString("=")!==null){this.Whitespace();let c=this.Expect(this.ExpressionInt,"value to be assigned to list item");c!==null&&(l=c.value),o&&(this.Whitespace(),this.ParseString(")")!==null&&(o=false));}return o&&this.Error("Expected closing ')'"),new NN.ListElementDefinition(u,s,l)},this.ConstDeclaration=()=>{if(this.Whitespace(),this.Parse(this.Identifier)!=="CONST")return null;this.Whitespace();let o=this.Expect(this.IdentifierWithMetadata,"constant name");this.Whitespace(),this.Expect(this.String("="),"the '=' for an assignment of a value, e.g. '= 5' (initial values are mandatory)"),this.Whitespace();let u=this.Expect(this.Expression,"initial value for ");return u instanceof Si.NumberExpression||u instanceof vp.DivertTarget||u instanceof Hs.StringExpression?u instanceof Hs.StringExpression&&(u.isSingleString||this.Error("Constant strings cannot contain any logic.")):this.Error("initial value for a constant must be a number or divert target"),new _N.ConstantDeclaration(o,u)},this.InlineLogicOrGlueOrStartTag=()=>this.OneOf([this.InlineLogic,this.Glue,this.StartTag]),this.Glue=()=>this.ParseString("<>")!==null?new DN.Glue(new xN.Glue):null,this.InlineLogic=()=>{if(this.ParseString("{")===null)return null;let s=this.parsingStringExpression,o=this.tagActive;this.Whitespace();let u=this.Expect(this.InnerLogic,"some kind of logic, conditional or sequence within braces: { ... }");if(u===null)return this.parsingStringExpression=s,null;this.DisallowIncrement(u);let l=(0, Jn.asOrNull)(u,bt.ContentList);return l||(l=new bt.ContentList(u)),this.Whitespace(),this.Expect(this.String("}"),"closing brace '}' for inline logic"),this.parsingStringExpression=s,o||this.EndTagIfNecessary(l),l},this.InnerLogic=()=>{this.Whitespace();let s=this.ParseObject(this.SequenceTypeAnnotation);if(s!==null){let l=this.Expect(this.InnerSequenceObjects,"sequence elements (for cycle/stoping etc)");return l===null?null:new cC.Sequence(l,s)}let o=this.Parse(this.ConditionExpression);if(o)return this.Expect(()=>this.InnerConditionalContent(o),"conditional content following query");let u=[this.InnerConditionalContent,this.InnerSequence,this.InnerExpression];for(let l of u){let c=this.BeginRule(),h=this.ParseObject(l);if(h)if(this.Peek(this.Spaced(this.String("}")))===null)this.FailRule(c);else return this.SucceedRule(c,h);else this.FailRule(c);}return null},this.InnerExpression=()=>{let s=this.Parse(this.Expression);return s&&(s.outputWhenComplete=true),s},this.IdentifierWithMetadata=()=>{let s=this.Identifier();return s===null?null:new Js.Identifier(s)},this.Identifier=()=>{let s=this.ParseCharactersFromCharSet(this.identifierCharSet);if(s===null)return null;let o=true;for(let u of s)if(!(u>="0"&&u<="9")){o=false;break}return o?null:s},this._sequenceTypeSymbols=new Ge.CharacterSet("!&~$"),this.InnerSequence=()=>{this.Whitespace();let s=We.SequenceType.Stopping,o=this.Parse(this.SequenceTypeAnnotation);o!==null&&(s=o);let u=this.Parse(this.InnerSequenceObjects);return u===null||u.length<=1?null:new cC.Sequence(u,s)},this.SequenceTypeAnnotation=()=>{let s=this.Parse(this.SequenceTypeSymbolAnnotation);if(s===null&&(s=this.Parse(this.SequenceTypeWordAnnotation)),s===null)return null;switch(s){case We.SequenceType.Once:case We.SequenceType.Cycle:case We.SequenceType.Stopping:case We.SequenceType.Shuffle:case We.SequenceType.Shuffle|We.SequenceType.Stopping:case We.SequenceType.Shuffle|We.SequenceType.Once:break;default:return this.Error(`Sequence type combination not supported: ${s}`),We.SequenceType.Stopping}return s},this.SequenceTypeSymbolAnnotation=()=>{this._sequenceTypeSymbols===null&&(this._sequenceTypeSymbols=new Ge.CharacterSet("!&~$ "));let s=0,o=this.ParseCharactersFromCharSet(this._sequenceTypeSymbols);if(o===null)return null;for(let u of o)switch(u){case "!":s|=We.SequenceType.Once;break;case "&":s|=We.SequenceType.Cycle;break;case "~":s|=We.SequenceType.Shuffle;break;case "$":s|=We.SequenceType.Stopping;break}return s===0?null:s},this.SequenceTypeWordAnnotation=()=>{let s=this.Interleave(this.SequenceTypeSingleWord,this.Exclude(this.Whitespace));if(s===null||s.length===0||this.ParseString(":")===null)return null;let o=0;for(let u of s)o|=u;return o},this.SequenceTypeSingleWord=()=>{let s=null,o=this.Parse(this.IdentifierWithMetadata);if(o!==null)switch(o.name){case "once":s=We.SequenceType.Once;break;case "cycle":s=We.SequenceType.Cycle;break;case "shuffle":s=We.SequenceType.Shuffle;break;case "stopping":s=We.SequenceType.Stopping;break}return s===null?null:s},this.InnerSequenceObjects=()=>{let s=this.Parse(this.Newline)!==null,o=null;return s?o=this.Parse(this.InnerMultilineSequenceObjects):o=this.Parse(this.InnerInlineSequenceObjects),o},this.InnerInlineSequenceObjects=()=>{let s=this.Interleave(this.Optional(this.MixedTextAndLogic),this.String("|"),null,false);if(s===null)return null;let o=[],u=false;for(let l of s)if(l==="|")u||o.push(new bt.ContentList),u=false;else {let c=l;c===null?this.Error(`Expected content, but got ${l} (this is an ink compiler bug!)`):o.push(new bt.ContentList(c)),u=true;}return u||o.push(new bt.ContentList),o},this.InnerMultilineSequenceObjects=()=>{this.MultilineWhitespace();let s=this.OneOrMore(this.SingleMultilineSequenceElement);return s===null?null:s},this.SingleMultilineSequenceElement=()=>{if(this.Whitespace(),this.ParseString("->")!==null||this.ParseString("-")===null)return null;this.Whitespace();let s=this.StatementsAtLevel(ot.StatementLevel.InnerBlock);return s===null?this.MultilineWhitespace():s.unshift(new _n.Text(`
|
|
49
49
|
`)),new bt.ContentList(s)},this._statementRulesAtLevel=[],this._statementBreakRulesAtLevel=[],this.StatementsAtLevel=s=>(s===ot.StatementLevel.InnerBlock&&this.Parse(this.GatherDashes)!==null&&this.Error("You can't use a gather (the dashes) within the { curly braces } context. For multi-line sequences and conditions, you should only use one dash."),this.Interleave(this.Optional(this.MultilineWhitespace),()=>this.StatementAtLevel(s),()=>this.StatementsBreakForLevel(s))),this.StatementAtLevel=s=>{let o=this._statementRulesAtLevel[s],u=this.OneOf(o);return s===ot.StatementLevel.Top&&u instanceof lC.ReturnType&&this.Error("should not have return statement outside of a knot"),u},this.StatementsBreakForLevel=s=>{this.Whitespace();let o=this._statementBreakRulesAtLevel[s],u=this.OneOf(o);return u===null?null:u},this.GenerateStatementLevelRules=()=>{let s=Object.values(ot.StatementLevel);this._statementRulesAtLevel="f".repeat(s.length).split("f").map(()=>[]),this._statementBreakRulesAtLevel="f".repeat(s.length).split("f").map(()=>[]);for(let o of s){let u=[],l=[];u.push(this.Line(this.MultiDivert)),o>=ot.StatementLevel.Top&&u.push(this.KnotDefinition),u.push(this.Line(this.Choice)),u.push(this.Line(this.AuthorWarning)),o>ot.StatementLevel.InnerBlock&&u.push(this.Gather),o>=ot.StatementLevel.Knot&&u.push(this.StitchDefinition),u.push(this.Line(this.ListDeclaration)),u.push(this.Line(this.VariableDeclaration)),u.push(this.Line(this.ConstDeclaration)),u.push(this.Line(this.ExternalDeclaration)),u.push(this.Line(this.IncludeStatement)),u.push(this.LogicLine),u.push(this.LineOfMixedTextAndLogic),o<=ot.StatementLevel.Knot&&l.push(this.KnotDeclaration),o<=ot.StatementLevel.Stitch&&l.push(this.StitchDeclaration),o<=ot.StatementLevel.InnerBlock&&(l.push(this.ParseDashNotArrow),l.push(this.String("}"))),this._statementRulesAtLevel[o]=u,this._statementBreakRulesAtLevel[o]=l;}},this.SkipToNextLine=()=>(this.ParseUntilCharactersFromString(`
|
|
50
50
|
\r`),this.ParseNewline(),bn.ParseSuccess),this.Line=s=>()=>{let o=this.ParseObject(s);return o===null?null:(this.Expect(this.EndOfLine,"end of line",this.SkipToNextLine),o)},this.StartTag=()=>{if(this.Whitespace(),this.ParseString("#")===null)return null;this.parsingStringExpression&&this.Error("Tags aren't allowed inside of strings. Please use \\# if you want a hash symbol.");let s=null;if(this.tagActive){let o=new bt.ContentList;o.AddContent(new _i.Tag(false)),o.AddContent(new _i.Tag(true)),s=o;}else s=new _i.Tag(true);return this.tagActive=true,this.Whitespace(),s},this._inlineWhitespaceChars=new Ge.CharacterSet(" "),this.EndOfLine=()=>this.OneOf([this.Newline,this.EndOfFile]),this.Newline=()=>(this.Whitespace(),this.ParseNewline()!==null?bn.ParseSuccess:null),this.EndOfFile=()=>(this.Whitespace(),this.endOfInput?bn.ParseSuccess:null),this.MultilineWhitespace=()=>{let s=this.OneOrMore(this.Newline);return s===null?null:s.length>=1?bn.ParseSuccess:null},this.Whitespace=()=>this.ParseCharactersFromCharSet(this._inlineWhitespaceChars)!==null?bn.ParseSuccess:null,this.Spaced=s=>()=>{this.Whitespace();let o=this.ParseObject(s);return o===null?null:(this.Whitespace(),o)},this.AnyWhitespace=()=>{let s=false;for(;this.OneOf([this.Whitespace,this.MultilineWhitespace])!==null;)s=true;return s?bn.ParseSuccess:null},this.MultiSpaced=s=>()=>{this.AnyWhitespace();let o=this.ParseObject(s);return o===null?null:(this.AnyWhitespace(),o)},this._filename=null,this._externalErrorHandler=null,this._fileHandler=null,this._filename=t,this.RegisterExpressionOperators(),this.GenerateStatementLevelRules(),this.errorHandler=this.OnStringParserError,this._externalErrorHandler=r,a===null?this._fileHandler=new $N.DefaultFileHandler:this._fileHandler=a,i===null){if(this._rootParser=this,this._openFilenames=[],this._filename!==null){let s=this.fileHandler.ResolveInkFilename(this._filename);this._openFilenames.push(s);}}else this._rootParser=i;}PreProcessInputString(e){return new CN.CommentEliminator(e).Process()}get parsingStringExpression(){return this.GetFlag(Number(al.CustomFlags.ParsingString))}set parsingStringExpression(e){this.SetFlag(Number(al.CustomFlags.ParsingString),e);}get tagActive(){return this.GetFlag(Number(al.CustomFlags.TagActive))}set tagActive(e){this.SetFlag(Number(al.CustomFlags.TagActive),e);}get identifierCharSet(){return this._identifierCharSet===null&&((this._identifierCharSet=new Ge.CharacterSet).AddRange("A","Z").AddRange("a","z").AddRange("0","9").Add("_"),this.ExtendIdentifierCharacterRanges(this._identifierCharSet)),this._identifierCharSet}EndTagIfNecessary(e){this.tagActive&&(e!=null&&(e instanceof bt.ContentList?e.AddContent(new _i.Tag(false)):e.push(new _i.Tag(false))),this.tagActive=false);}};ll.InkParser=ve;ve.LatinBasic=Gt.CharacterRange.Define("A","z",new Ge.CharacterSet().AddRange("[","`"));ve.LatinExtendedA=Gt.CharacterRange.Define("\u0100","\u017F");ve.LatinExtendedB=Gt.CharacterRange.Define("\u0180","\u024F");ve.Greek=Gt.CharacterRange.Define("\u0370","\u03FF",new Ge.CharacterSet().AddRange("\u0378","\u0385").AddCharacters("\u0374\u0375\u0378\u0387\u038B\u038D\u03A2"));ve.Cyrillic=Gt.CharacterRange.Define("\u0400","\u04FF",new Ge.CharacterSet().AddRange("\u0482","\u0489"));ve.Armenian=Gt.CharacterRange.Define("\u0530","\u058F",new Ge.CharacterSet().AddCharacters("\u0530").AddRange("\u0557","\u0560").AddRange("\u0588","\u058E"));ve.Hebrew=Gt.CharacterRange.Define("\u0590","\u05FF",new Ge.CharacterSet);ve.Arabic=Gt.CharacterRange.Define("\u0600","\u06FF",new Ge.CharacterSet);ve.Korean=Gt.CharacterRange.Define("\uAC00","\uD7AF",new Ge.CharacterSet);ve.Latin1Supplement=Gt.CharacterRange.Define("\x80","\xFF",new Ge.CharacterSet);ve.Chinese=Gt.CharacterRange.Define("\u4E00","\u9FFF",new Ge.CharacterSet);ve.ListAllCharacterRanges=()=>[ve.LatinBasic,ve.LatinExtendedA,ve.LatinExtendedB,ve.Arabic,ve.Armenian,ve.Cyrillic,ve.Greek,ve.Hebrew,ve.Korean,ve.Latin1Supplement,ve.Chinese];});var pC=S(cl=>{Object.defineProperty(cl,"__esModule",{value:true});cl.GenerateStoryStats=void 0;var VN=ui(),jN=di(),LN=As(),qN=jf(),BN=Gf(),MN=Bn();function WN(n){let e=n.FindAll(MN.Text)(),t=0;for(let u of e){let l=0,c=true;for(let h of u.text)h==" "||h==" "||h==`
|
|
51
|
-
`||h=="\r"?c=true:c&&(l++,c=false);t+=l;}let r=n.FindAll(qN.Knot)(),i=n.FindAll(BN.Stitch)(),a=n.FindAll(VN.Choice)(),s=n.FindAll(LN.Gather)(u=>u.debugMetadata!=null),o=n.FindAll(jN.Divert)();return {words:t,knots:r.length,functions:r.filter(u=>u.isFunction).length,stitches:i.length,gathers:s.length,diverts:o.length-1,choices:a.length}}cl.GenerateStoryStats=WN;});var mC=S(hl=>{Object.defineProperty(hl,"__esModule",{value:true});hl.JsonFileHandler=void 0;var Sp=class{constructor(e){this.fileHierarchy=e,this.ResolveInkFilename=t=>{if(Object.keys(this.fileHierarchy).includes(t))return t;throw new Error(`Cannot locate ${t}. Are you trying a relative import ? This is not yet implemented.`)},this.LoadInkFileContents=t=>{if(Object.keys(this.fileHierarchy).includes(t))return this.fileHierarchy[t];throw new Error(`Cannot open ${t}.`)};}};hl.JsonFileHandler=Sp;});var yC=S(nt=>{Object.defineProperty(nt,"__esModule",{value:true});nt.Compiler=nt.Story=nt.InkList=nt.JsonFileHandler=nt.StatementLevel=nt.InkParser=nt.CompilerOptions=void 0;var GN=sd(),HN=Av(),Ep=pr(),JN=_p(),zN=Te(),UN=fe(),KN=pC(),XN=sd();Object.defineProperty(nt,"CompilerOptions",{enumerable:true,get:function(){return XN.CompilerOptions}});var YN=_p();Object.defineProperty(nt,"InkParser",{enumerable:true,get:function(){return YN.InkParser}});var QN=Mf();Object.defineProperty(nt,"StatementLevel",{enumerable:true,get:function(){return QN.StatementLevel}});var ZN=mC();Object.defineProperty(nt,"JsonFileHandler",{enumerable:true,get:function(){return ZN.JsonFileHandler}});var gC=Rs();Object.defineProperty(nt,"InkList",{enumerable:true,get:function(){return gC.InkList}});Object.defineProperty(nt,"Story",{enumerable:true,get:function(){return gC.Story}});var wp=class{get errors(){return this._errors}get warnings(){return this._warnings}get authorMessages(){return this._authorMessages}get inputString(){return this._inputString}get options(){return this._options}get parsedStory(){if(!this._parsedStory)throw new Error;return this._parsedStory}get runtimeStory(){if(!this._runtimeStory)throw new Error("Compilation failed.");return this._runtimeStory}get parser(){if(!this._parser)throw new Error;return this._parser}get debugSourceRanges(){return this._debugSourceRanges}constructor(e,t=null){this._errors=[],this._warnings=[],this._authorMessages=[],this._parsedStory=null,this._runtimeStory=null,this._parser=null,this._debugSourceRanges=[],this.Compile=()=>(this._parser=new JN.InkParser(this.inputString,this.options.sourceFilename||null,this.OnError,null,this.options.fileHandler),this._parsedStory=this.parser.ParseStory(),this.errors.length===0?(this.parsedStory.countAllVisits=this.options.countAllVisits,this._runtimeStory=this.parsedStory.ExportRuntime(this.OnError)):this._runtimeStory=null,this.runtimeStory),this.RetrieveDebugSourceForLatestContent=()=>{var r;for(let i of this.runtimeStory.state.outputStream){let a=(0, UN.asOrNull)(i,zN.StringValue);if(a!==null){let s=new HN.DebugSourceRange(((r=a.value)===null||r===void 0?void 0:r.length)||0,a.debugMetadata,a.value||"unknown");this.debugSourceRanges.push(s);}}},this.GenerateStats=()=>this._parsedStory===null?null:(0, KN.GenerateStoryStats)(this._parsedStory),this.DebugMetadataForContentAtOffset=r=>{let i=0,a=null;for(let s of this.debugSourceRanges){if(s.debugMetadata!==null&&(a=s.debugMetadata),r>=i&&r<i+s.length)return a;i+=s.length;}return null},this.OnError=(r,i)=>{switch(i){case Ep.ErrorType.Author:this._authorMessages.push(r);break;case Ep.ErrorType.Warning:this._warnings.push(r);break;case Ep.ErrorType.Error:this._errors.push(r);break}this.options.errorHandler!==null&&this.options.errorHandler(r,i);},this._inputString=e,this._options=t||new GN.CompilerOptions;}};nt.Compiler=wp;});var jC=S((TB,kp)=>{var bl=process||{},$C=bl.argv||[],Cl=bl.env||{},BF=!(Cl.NO_COLOR||$C.includes("--no-color"))&&(!!Cl.FORCE_COLOR||$C.includes("--color")||bl.platform==="win32"||(bl.stdout||{}).isTTY&&Cl.TERM!=="dumb"||!!Cl.CI),MF=(n,e,t=n)=>r=>{let i=""+r,a=i.indexOf(e,n.length);return ~a?n+WF(i,e,t,a)+e:n+i+e},WF=(n,e,t,r)=>{let i="",a=0;do i+=n.substring(a,r)+t,a=r+e.length,r=n.indexOf(e,a);while(~r);return i+n.substring(a)},VC=(n=BF)=>{let e=n?MF:()=>String;return {isColorSupported:n,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")}};kp.exports=VC();kp.exports.createColors=VC;});var Xs=S((qB,eb)=>{var XC="[^\\\\/]",WI="(?=.)",YC="[^/]",Vp="(?:\\/|$)",QC="(?:^|\\/)",jp=`\\.{1,2}${Vp}`,GI="(?!\\.)",HI=`(?!${QC}${jp})`,JI=`(?!\\.{0,1}${Vp})`,zI=`(?!${jp})`,UI="[^.\\/]",KI=`${YC}*?`,XI="/",ZC={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:WI,QMARK:YC,END_ANCHOR:Vp,DOTS_SLASH:jp,NO_DOT:GI,NO_DOTS:HI,NO_DOT_SLASH:JI,NO_DOTS_SLASH:zI,QMARK_NO_DOT:UI,STAR:KI,START_ANCHOR:QC,SEP:XI},YI={...ZC,SLASH_LITERAL:"[\\\\/]",QMARK:XC,STAR:`${XC}*?`,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:"\\"},QI={__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"};eb.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:QI,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(n){return {"!":{type:"negate",open:"(?:(?!(?:",close:`))${n.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(n){return n===true?YI:ZC}};});var Ys=S(Et=>{var{REGEX_BACKSLASH:ZI,REGEX_REMOVE_BACKSLASH:ek,REGEX_SPECIAL_CHARS:tk,REGEX_SPECIAL_CHARS_GLOBAL:nk}=Xs();Et.isObject=n=>n!==null&&typeof n=="object"&&!Array.isArray(n);Et.hasRegexChars=n=>tk.test(n);Et.isRegexChar=n=>n.length===1&&Et.hasRegexChars(n);Et.escapeRegex=n=>n.replace(nk,"\\$1");Et.toPosixSlashes=n=>n.replace(ZI,"/");Et.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let n=navigator.platform.toLowerCase();return n==="win32"||n==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":false};Et.removeBackslashes=n=>n.replace(ek,e=>e==="\\"?"":e);Et.escapeLast=(n,e,t)=>{let r=n.lastIndexOf(e,t);return r===-1?n:n[r-1]==="\\"?Et.escapeLast(n,e,r-1):`${n.slice(0,r)}\\${n.slice(r)}`};Et.removePrefix=(n,e={})=>{let t=n;return t.startsWith("./")&&(t=t.slice(2),e.prefix="./"),t};Et.wrapOutput=(n,e={},t={})=>{let r=t.contains?"":"^",i=t.contains?"":"$",a=`${r}(?:${n})${i}`;return e.negated===true&&(a=`(?:^(?!${a}).*$)`),a};Et.basename=(n,{windows:e}={})=>{let t=n.split(e?/[\\/]/:"/"),r=t[t.length-1];return r===""?t[t.length-2]:r};});var ub=S((MB,ob)=>{var tb=Ys(),{CHAR_ASTERISK:Lp,CHAR_AT:rk,CHAR_BACKWARD_SLASH:Ei,CHAR_COMMA:ik,CHAR_DOT:qp,CHAR_EXCLAMATION_MARK:Bp,CHAR_FORWARD_SLASH:ab,CHAR_LEFT_CURLY_BRACE:Mp,CHAR_LEFT_PARENTHESES:Sl,CHAR_LEFT_SQUARE_BRACKET:sk,CHAR_PLUS:ak,CHAR_QUESTION_MARK:nb,CHAR_RIGHT_CURLY_BRACE:ok,CHAR_RIGHT_PARENTHESES:rb,CHAR_RIGHT_SQUARE_BRACKET:uk}=Xs(),ib=n=>n===ab||n===Ei,sb=n=>{n.isPrefix!==true&&(n.depth=n.isGlobstar?1/0:1);},lk=(n,e)=>{let t=e||{},r=n.length-1,i=t.parts===true||t.tokens===true||t.scanToEnd===true,a=[],s=[],o=[],u=n,l=-1,c=0,h=0,f=false,g=false,p=false,m=false,C=false,b=false,y=false,d=false,_=false,v=false,w=0,D,O,P={value:"",depth:0,isGlob:false},E=()=>l>=r,F=()=>u.charCodeAt(l+1),R=()=>(D=O,u.charCodeAt(++l));for(;l<r;){O=R();let j;if(O===Ei){y=P.backslashes=true,O=R(),O===Mp&&(b=true);continue}if(b===true||O===Mp){for(w++;E()!==true&&(O=R());){if(O===Ei){y=P.backslashes=true,R();continue}if(O===Mp){w++;continue}if(b!==true&&O===qp&&(O=R())===qp){if(f=P.isBrace=true,p=P.isGlob=true,v=true,i===true)continue;break}if(b!==true&&O===ik){if(f=P.isBrace=true,p=P.isGlob=true,v=true,i===true)continue;break}if(O===ok&&(w--,w===0)){b=false,f=P.isBrace=true,v=true;break}}if(i===true)continue;break}if(O===ab){if(a.push(l),s.push(P),P={value:"",depth:0,isGlob:false},v===true)continue;if(D===qp&&l===c+1){c+=2;continue}h=l+1;continue}if(t.noext!==true&&(O===ak||O===rk||O===Lp||O===nb||O===Bp)===true&&F()===Sl){if(p=P.isGlob=true,m=P.isExtglob=true,v=true,O===Bp&&l===c&&(_=true),i===true){let Le=0;for(;E()!==true&&(O=R());){if(O===Ei){y=P.backslashes=true,R();continue}if(O===Sl){Le++;continue}if(O===rb&&--Le===0){v=true;break}}continue}break}if(O===Lp){if(D===Lp&&(C=P.isGlobstar=true),p=P.isGlob=true,v=true,i===true)continue;break}if(O===nb){if(p=P.isGlob=true,v=true,i===true)continue;break}if(O===sk){for(;E()!==true&&(j=R());){if(j===Ei){y=P.backslashes=true,R();continue}if(j===uk){g=P.isBracket=true,p=P.isGlob=true,v=true;break}}if(i===true)continue;break}if(t.nonegate!==true&&O===Bp&&l===c){d=P.negated=true,c++;continue}if(t.noparen!==true&&O===Sl){if(p=P.isGlob=true,i===true){let ce=1;for(;E()!==true&&(O=R());){if(O===Ei){y=P.backslashes=true,R();continue}if(O===Sl){ce++;continue}if(O===rb&&--ce===0){v=true;break}}continue}break}if(p===true){if(v=true,i===true)continue;break}}t.noext===true&&(m=false,p=false);let k=u,A="",x="";c>0&&(A=u.slice(0,c),u=u.slice(c),h-=c),k&&p===true&&h>0?(k=u.slice(0,h),x=u.slice(h)):p===true?(k="",x=u):k=u,k&&k!==""&&k!=="/"&&k!==u&&ib(k.charCodeAt(k.length-1))&&(k=k.slice(0,-1)),t.unescape===true&&(x&&(x=tb.removeBackslashes(x)),k&&y===true&&(k=tb.removeBackslashes(k)));let Ce={prefix:A,input:n,start:c,base:k,glob:x,isBrace:f,isBracket:g,isGlob:p,isExtglob:m,isGlobstar:C,negated:d,negatedExtglob:_};if(t.tokens===true&&(Ce.maxDepth=0,ib(O)||s.push(P),Ce.tokens=s),t.parts===true||t.tokens===true){let j;for(let xe=0;xe<a.length;xe++){let En=j!==void 0?j+1:c,wn=a[xe],cn=n.slice(En,wn);t.tokens&&(xe===0&&c!==0?(s[xe].isPrefix=true,s[xe].value=A):s[xe].value=cn,sb(s[xe]),Ce.maxDepth+=s[xe].depth),wn>=c&&(o.push(cn),j=wn);}let ce=j!==void 0?j+1:c,Le=n.slice(ce);o.push(Le),t.tokens&&j&&j+1<n.length&&(s[s.length-1].value=Le,sb(s[s.length-1]),Ce.maxDepth+=s[s.length-1].depth),Ce.slashes=a,Ce.parts=o;}return Ce};ob.exports=lk;});var db=S((WB,hb)=>{var Qs=Xs(),wt=Ys(),{MAX_LENGTH:El,POSIX_REGEX_SOURCE:ck,REGEX_NON_SPECIAL_CHARS:hk,REGEX_SPECIAL_CHARS_BACKREF:dk,REPLACEMENTS:lb}=Qs,fk=(n,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...n,e);n.sort();let t=`[${n.join("-")}]`;try{new RegExp(t);}catch{return n.map(i=>wt.escapeRegex(i)).join("..")}return t},wi=(n,e)=>`Missing ${n}: "${e}" - use "\\\\${e}" to match literal characters`,cb=n=>{let e=[],t=0,r=0,i=0,a="",s=false;for(let o of n){if(s===true){a+=o,s=false;continue}if(o==="\\"){a+=o,s=true;continue}if(o==='"'){i=i===1?0:1,a+=o;continue}if(i===0){if(o==="[")t++;else if(o==="]"&&t>0)t--;else if(t===0){if(o==="(")r++;else if(o===")"&&r>0)r--;else if(o==="|"&&r===0){e.push(a),a="";continue}}}a+=o;}return e.push(a),e},pk=n=>{let e=false;for(let t of n){if(e===true){e=false;continue}if(t==="\\"){e=true;continue}if(/[?*+@!()[\]{}]/.test(t))return false}return true},Gp=n=>{let e=n.trim(),t=true;for(;t===true;)t=false,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),t=true);if(pk(e))return e.replace(/\\(.)/g,"$1")},mk=n=>{let e=n.map(Gp).filter(Boolean);for(let t=0;t<e.length;t++)for(let r=t+1;r<e.length;r++){let i=e[t],a=e[r],s=i[0];if(!(!s||i!==s.repeat(i.length)||a!==s.repeat(a.length))&&(i===a||i.startsWith(a)||a.startsWith(i)))return true}return false},Wp=(n,e=true)=>{if(n[0]!=="+"&&n[0]!=="*"||n[1]!=="(")return;let t=0,r=0,i=0,a=false;for(let s=1;s<n.length;s++){let o=n[s];if(a===true){a=false;continue}if(o==="\\"){a=true;continue}if(o==='"'){i=i===1?0:1;continue}if(i!==1){if(o==="["){t++;continue}if(o==="]"&&t>0){t--;continue}if(!(t>0)){if(o==="("){r++;continue}if(o===")"&&(r--,r===0))return e===true&&s!==n.length-1?void 0:{type:n[0],body:n.slice(2,s),end:s}}}}},gk=n=>`${n.length===1?wt.escapeRegex(n[0]):`[${n.map(t=>wt.escapeRegex(t)).join("")}]`}*`,yk=n=>{let e=0,t=[];for(;e<n.length;){let r=Wp(n.slice(e),false);if(!r||r.type!=="*")return;let i=cb(r.body).map(s=>s.trim());if(i.length!==1)return;let a=Gp(i[0]);if(!a||a.length!==1)return;t.push(a),e+=r.end+1;}if(!(t.length<1))return t},vk=n=>{let e=0,t=n.trim(),r=Wp(t);for(;r;)e++,t=r.body.trim(),r=Wp(t);return e},Ck=(n,e)=>{if(e.maxExtglobRecursion===false)return {risky:false};let t=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:Qs.DEFAULT_MAX_EXTGLOB_RECURSION,r=cb(n).map(o=>o.trim());if(r.length>1&&(r.some(o=>o==="")||r.some(o=>/^[*?]+$/.test(o))||mk(r)))return {risky:true};let i=[],a=false,s=true;for(let o of r){let u=yk(o);if(u){a=true,i.push(...u);continue}let l=Gp(o);if(l&&l.length===1){i.push(l);continue}if(s=false,vk(o)>t)return {risky:true}}return a?s?{risky:true,safeOutput:gk([...new Set(i)])}:{risky:true}:{risky:false}},Hp=(n,e)=>{if(typeof n!="string")throw new TypeError("Expected a string");n=lb[n]||n;let t={...e},r=typeof t.maxLength=="number"?Math.min(El,t.maxLength):El,i=n.length;if(i>r)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${r}`);let a={type:"bos",value:"",output:t.prepend||""},s=[a],o=t.capture?"":"?:",u=Qs.globChars(t.windows),l=Qs.extglobChars(u),{DOT_LITERAL:c,PLUS_LITERAL:h,SLASH_LITERAL:f,ONE_CHAR:g,DOTS_SLASH:p,NO_DOT:m,NO_DOT_SLASH:C,NO_DOTS_SLASH:b,QMARK:y,QMARK_NO_DOT:d,STAR:_,START_ANCHOR:v}=u,w=N=>`(${o}(?:(?!${v}${N.dot?p:c}).)*?)`,D=t.dot?"":m,O=t.dot?y:d,P=t.bash===true?w(t):_;t.capture&&(P=`(${P})`),typeof t.noext=="boolean"&&(t.noextglob=t.noext);let E={input:n,index:-1,start:0,dot:t.dot===true,consumed:"",output:"",prefix:"",backtrack:false,negated:false,brackets:0,braces:0,parens:0,quotes:0,globstar:false,tokens:s};n=wt.removePrefix(n,E),i=n.length;let F=[],R=[],k=[],A=a,x,Ce=()=>E.index===i-1,j=E.peek=(N=1)=>n[E.index+N],ce=E.advance=()=>n[++E.index]||"",Le=()=>n.slice(E.index+1),xe=(N="",W=0)=>{E.consumed+=N,E.index+=W;},En=N=>{E.output+=N.output!=null?N.output:N.value,xe(N.value);},wn=()=>{let N=1;for(;j()==="!"&&(j(2)!=="("||j(3)==="?");)ce(),E.start++,N++;return N%2===0?false:(E.negated=true,E.start++,true)},cn=N=>{E[N]++,k.push(N);},Jt=N=>{E[N]--,k.pop();},J=N=>{if(A.type==="globstar"){let W=E.braces>0&&(N.type==="comma"||N.type==="brace"),I=N.extglob===true||F.length&&(N.type==="pipe"||N.type==="paren");N.type!=="slash"&&N.type!=="paren"&&!W&&!I&&(E.output=E.output.slice(0,-A.output.length),A.type="star",A.value="*",A.output=P,E.output+=A.output);}if(F.length&&N.type!=="paren"&&(F[F.length-1].inner+=N.value),(N.value||N.output)&&En(N),A&&A.type==="text"&&N.type==="text"){A.output=(A.output||A.value)+N.value,A.value+=N.value;return}N.prev=A,s.push(N),A=N;},pe=(N,W)=>{let I={...l[W],conditions:1,inner:""};I.prev=A,I.parens=E.parens,I.output=E.output,I.startIndex=E.index,I.tokensIndex=s.length;let z=(t.capture?"(":"")+I.open;cn("parens"),J({type:N,value:W,output:E.output?"":g}),J({type:"paren",extglob:true,value:ce(),output:z}),F.push(I);},At=N=>{let W=n.slice(N.startIndex,E.index+1),I=n.slice(N.startIndex+2,E.index),z=Ck(I,t);if((N.type==="plus"||N.type==="star")&&z.risky){let ge=z.safeOutput?(N.output?"":g)+(t.capture?`(${z.safeOutput})`:z.safeOutput):void 0,zt=s[N.tokensIndex];zt.type="text",zt.value=W,zt.output=ge||wt.escapeRegex(W);for(let Kn=N.tokensIndex+1;Kn<s.length;Kn++)s[Kn].value="",s[Kn].output="",delete s[Kn].suffix;E.output=N.output+zt.output,E.backtrack=true,J({type:"paren",extglob:true,value:x,output:""}),Jt("parens");return}let be=N.close+(t.capture?")":""),Ve;if(N.type==="negate"){let ge=P;if(N.inner&&N.inner.length>1&&N.inner.includes("/")&&(ge=w(t)),(ge!==P||Ce()||/^\)+$/.test(Le()))&&(be=N.close=`)$))${ge}`),N.inner.includes("*")&&(Ve=Le())&&/^\.[^\\/.]+$/.test(Ve)){let zt=Hp(Ve,{...e,fastpaths:false}).output;be=N.close=`)${zt})${ge})`;}N.prev.type==="bos"&&(E.negatedExtglob=true);}J({type:"paren",extglob:true,value:x,output:be}),Jt("parens");};if(t.fastpaths!==false&&!/(^[*!]|[/()[\]{}"])/.test(n)){let N=false,W=n.replace(dk,(I,z,be,Ve,ge,zt)=>Ve==="\\"?(N=true,I):Ve==="?"?z?z+Ve+(ge?y.repeat(ge.length):""):zt===0?O+(ge?y.repeat(ge.length):""):y.repeat(be.length):Ve==="."?c.repeat(be.length):Ve==="*"?z?z+Ve+(ge?P:""):P:z?I:`\\${I}`);return N===true&&(t.unescape===true?W=W.replace(/\\/g,""):W=W.replace(/\\+/g,I=>I.length%2===0?"\\\\":I?"\\":"")),W===n&&t.contains===true?(E.output=n,E):(E.output=wt.wrapOutput(W,E,e),E)}for(;!Ce();){if(x=ce(),x==="\0")continue;if(x==="\\"){let I=j();if(I==="/"&&t.bash!==true||I==="."||I===";")continue;if(!I){x+="\\",J({type:"text",value:x});continue}let z=/^\\+/.exec(Le()),be=0;if(z&&z[0].length>2&&(be=z[0].length,E.index+=be,be%2!==0&&(x+="\\")),t.unescape===true?x=ce():x+=ce(),E.brackets===0){J({type:"text",value:x});continue}}if(E.brackets>0&&(x!=="]"||A.value==="["||A.value==="[^")){if(t.posix!==false&&x===":"){let I=A.value.slice(1);if(I.includes("[")&&(A.posix=true,I.includes(":"))){let z=A.value.lastIndexOf("["),be=A.value.slice(0,z),Ve=A.value.slice(z+2),ge=ck[Ve];if(ge){A.value=be+ge,E.backtrack=true,ce(),!a.output&&s.indexOf(A)===1&&(a.output=g);continue}}}(x==="["&&j()!==":"||x==="-"&&j()==="]")&&(x=`\\${x}`),x==="]"&&(A.value==="["||A.value==="[^")&&(x=`\\${x}`),t.posix===true&&x==="!"&&A.value==="["&&(x="^"),A.value+=x,En({value:x});continue}if(E.quotes===1&&x!=='"'){x=wt.escapeRegex(x),A.value+=x,En({value:x});continue}if(x==='"'){E.quotes=E.quotes===1?0:1,t.keepQuotes===true&&J({type:"text",value:x});continue}if(x==="("){cn("parens"),J({type:"paren",value:x});continue}if(x===")"){if(E.parens===0&&t.strictBrackets===true)throw new SyntaxError(wi("opening","("));let I=F[F.length-1];if(I&&E.parens===I.parens+1){At(F.pop());continue}J({type:"paren",value:x,output:E.parens?")":"\\)"}),Jt("parens");continue}if(x==="["){if(t.nobracket===true||!Le().includes("]")){if(t.nobracket!==true&&t.strictBrackets===true)throw new SyntaxError(wi("closing","]"));x=`\\${x}`;}else cn("brackets");J({type:"bracket",value:x});continue}if(x==="]"){if(t.nobracket===true||A&&A.type==="bracket"&&A.value.length===1){J({type:"text",value:x,output:`\\${x}`});continue}if(E.brackets===0){if(t.strictBrackets===true)throw new SyntaxError(wi("opening","["));J({type:"text",value:x,output:`\\${x}`});continue}Jt("brackets");let I=A.value.slice(1);if(A.posix!==true&&I[0]==="^"&&!I.includes("/")&&(x=`/${x}`),A.value+=x,En({value:x}),t.literalBrackets===false||wt.hasRegexChars(I))continue;let z=wt.escapeRegex(A.value);if(E.output=E.output.slice(0,-A.value.length),t.literalBrackets===true){E.output+=z,A.value=z;continue}A.value=`(${o}${z}|${A.value})`,E.output+=A.value;continue}if(x==="{"&&t.nobrace!==true){cn("braces");let I={type:"brace",value:x,output:"(",outputIndex:E.output.length,tokensIndex:E.tokens.length};R.push(I),J(I);continue}if(x==="}"){let I=R[R.length-1];if(t.nobrace===true||!I){J({type:"text",value:x,output:x});continue}let z=")";if(I.dots===true){let be=s.slice(),Ve=[];for(let ge=be.length-1;ge>=0&&(s.pop(),be[ge].type!=="brace");ge--)be[ge].type!=="dots"&&Ve.unshift(be[ge].value);z=fk(Ve,t),E.backtrack=true;}if(I.comma!==true&&I.dots!==true){let be=E.output.slice(0,I.outputIndex),Ve=E.tokens.slice(I.tokensIndex);I.value=I.output="\\{",x=z="\\}",E.output=be;for(let ge of Ve)E.output+=ge.output||ge.value;}J({type:"brace",value:x,output:z}),Jt("braces"),R.pop();continue}if(x==="|"){F.length>0&&F[F.length-1].conditions++,J({type:"text",value:x});continue}if(x===","){let I=x,z=R[R.length-1];z&&k[k.length-1]==="braces"&&(z.comma=true,I="|"),J({type:"comma",value:x,output:I});continue}if(x==="/"){if(A.type==="dot"&&E.index===E.start+1){E.start=E.index+1,E.consumed="",E.output="",s.pop(),A=a;continue}J({type:"slash",value:x,output:f});continue}if(x==="."){if(E.braces>0&&A.type==="dot"){A.value==="."&&(A.output=c);let I=R[R.length-1];A.type="dots",A.output+=x,A.value+=x,I.dots=true;continue}if(E.braces+E.parens===0&&A.type!=="bos"&&A.type!=="slash"){J({type:"text",value:x,output:c});continue}J({type:"dot",value:x,output:c});continue}if(x==="?"){if(!(A&&A.value==="(")&&t.noextglob!==true&&j()==="("&&j(2)!=="?"){pe("qmark",x);continue}if(A&&A.type==="paren"){let z=j(),be=x;(A.value==="("&&!/[!=<:]/.test(z)||z==="<"&&!/<([!=]|\w+>)/.test(Le()))&&(be=`\\${x}`),J({type:"text",value:x,output:be});continue}if(t.dot!==true&&(A.type==="slash"||A.type==="bos")){J({type:"qmark",value:x,output:d});continue}J({type:"qmark",value:x,output:y});continue}if(x==="!"){if(t.noextglob!==true&&j()==="("&&(j(2)!=="?"||!/[!=<:]/.test(j(3)))){pe("negate",x);continue}if(t.nonegate!==true&&E.index===0){wn();continue}}if(x==="+"){if(t.noextglob!==true&&j()==="("&&j(2)!=="?"){pe("plus",x);continue}if(A&&A.value==="("||t.regex===false){J({type:"plus",value:x,output:h});continue}if(A&&(A.type==="bracket"||A.type==="paren"||A.type==="brace")||E.parens>0){J({type:"plus",value:x});continue}J({type:"plus",value:h});continue}if(x==="@"){if(t.noextglob!==true&&j()==="("&&j(2)!=="?"){J({type:"at",extglob:true,value:x,output:""});continue}J({type:"text",value:x});continue}if(x!=="*"){(x==="$"||x==="^")&&(x=`\\${x}`);let I=hk.exec(Le());I&&(x+=I[0],E.index+=I[0].length),J({type:"text",value:x});continue}if(A&&(A.type==="globstar"||A.star===true)){A.type="star",A.star=true,A.value+=x,A.output=P,E.backtrack=true,E.globstar=true,xe(x);continue}let N=Le();if(t.noextglob!==true&&/^\([^?]/.test(N)){pe("star",x);continue}if(A.type==="star"){if(t.noglobstar===true){xe(x);continue}let I=A.prev,z=I.prev,be=I.type==="slash"||I.type==="bos",Ve=z&&(z.type==="star"||z.type==="globstar");if(t.bash===true&&(!be||N[0]&&N[0]!=="/")){J({type:"star",value:x,output:""});continue}let ge=E.braces>0&&(I.type==="comma"||I.type==="brace"),zt=F.length&&(I.type==="pipe"||I.type==="paren");if(!be&&I.type!=="paren"&&!ge&&!zt){J({type:"star",value:x,output:""});continue}for(;N.slice(0,3)==="/**";){let Tr=n[E.index+4];if(Tr&&Tr!=="/")break;N=N.slice(3),xe("/**",3);}let Kn=Ce()||E.parens>0&&N===")".repeat(E.parens)&&!F.some(Tr=>Tr.type==="negate");if(I.type==="bos"&&Ce()){A.type="globstar",A.value+=x,A.output=w(t),E.output=A.output,E.globstar=true,xe(x);continue}if(I.type==="slash"&&I.prev.type!=="bos"&&!Ve&&Kn){E.output=E.output.slice(0,-(I.output+A.output).length),I.output=`(?:${I.output}`,A.type="globstar",A.output=w(t)+(t.strictSlashes?")":"|$)"),A.value+=x,E.globstar=true,E.output+=I.output+A.output,xe(x);continue}if(I.type==="slash"&&I.prev.type!=="bos"&&N[0]==="/"){let Tr=N[1]!==void 0?"|$":"";E.output=E.output.slice(0,-(I.output+A.output).length),I.output=`(?:${I.output}`,A.type="globstar",A.output=`${w(t)}${f}|${f}${Tr})`,A.value+=x,E.output+=I.output+A.output,E.globstar=true,xe(x+ce()),J({type:"slash",value:"/",output:""});continue}if(I.type==="bos"&&N[0]==="/"){A.type="globstar",A.value+=x,A.output=`(?:^|${f}|${w(t)}${f})`,E.output=A.output,E.globstar=true,xe(x+ce()),J({type:"slash",value:"/",output:""});continue}E.output=E.output.slice(0,-A.output.length),A.type="globstar",A.output=w(t),A.value+=x,E.output+=A.output,E.globstar=true,xe(x);continue}let W={type:"star",value:x,output:P};if(t.bash===true){W.output=".*?",(A.type==="bos"||A.type==="slash")&&(W.output=D+W.output),J(W);continue}if(A&&(A.type==="bracket"||A.type==="paren")&&t.regex===true){W.output=x,J(W);continue}(E.index===E.start||A.type==="slash"||A.type==="dot")&&(A.type==="dot"?(E.output+=C,A.output+=C):t.dot===true?(E.output+=b,A.output+=b):(E.output+=D,A.output+=D),j()!=="*"&&(E.output+=g,A.output+=g)),J(W);}for(;E.brackets>0;){if(t.strictBrackets===true)throw new SyntaxError(wi("closing","]"));E.output=wt.escapeLast(E.output,"["),Jt("brackets");}for(;E.parens>0;){if(t.strictBrackets===true)throw new SyntaxError(wi("closing",")"));E.output=wt.escapeLast(E.output,"("),Jt("parens");}for(;E.braces>0;){if(t.strictBrackets===true)throw new SyntaxError(wi("closing","}"));E.output=wt.escapeLast(E.output,"{"),Jt("braces");}if(t.strictSlashes!==true&&(A.type==="star"||A.type==="bracket")&&J({type:"maybe_slash",value:"",output:`${f}?`}),E.backtrack===true){E.output="";for(let N of E.tokens)E.output+=N.output!=null?N.output:N.value,N.suffix&&(E.output+=N.suffix);}return E};Hp.fastpaths=(n,e)=>{let t={...e},r=typeof t.maxLength=="number"?Math.min(El,t.maxLength):El,i=n.length;if(i>r)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${r}`);n=lb[n]||n;let{DOT_LITERAL:a,SLASH_LITERAL:s,ONE_CHAR:o,DOTS_SLASH:u,NO_DOT:l,NO_DOTS:c,NO_DOTS_SLASH:h,STAR:f,START_ANCHOR:g}=Qs.globChars(t.windows),p=t.dot?c:l,m=t.dot?h:l,C=t.capture?"":"?:",b={negated:false,prefix:""},y=t.bash===true?".*?":f;t.capture&&(y=`(${y})`);let d=D=>D.noglobstar===true?y:`(${C}(?:(?!${g}${D.dot?u:a}).)*?)`,_=D=>{switch(D){case "*":return `${p}${o}${y}`;case ".*":return `${a}${o}${y}`;case "*.*":return `${p}${y}${a}${o}${y}`;case "*/*":return `${p}${y}${s}${o}${m}${y}`;case "**":return p+d(t);case "**/*":return `(?:${p}${d(t)}${s})?${m}${o}${y}`;case "**/*.*":return `(?:${p}${d(t)}${s})?${m}${y}${a}${o}${y}`;case "**/.*":return `(?:${p}${d(t)}${s})?${a}${o}${y}`;default:{let O=/^(.*?)\.(\w+)$/.exec(D);if(!O)return;let P=_(O[1]);return P?P+a+O[2]:void 0}}},v=wt.removePrefix(n,b),w=_(v);return w&&t.strictSlashes!==true&&(w+=`${s}?`),w};hb.exports=Hp;});var mb=S((GB,pb)=>{var bk=ub(),Jp=db(),fb=Ys(),_k=Xs(),Sk=n=>n&&typeof n=="object"&&!Array.isArray(n),ke=(n,e,t=false)=>{if(Array.isArray(n)){let c=n.map(f=>ke(f,e,t));return f=>{for(let g of c){let p=g(f);if(p)return p}return false}}let r=Sk(n)&&n.tokens&&n.input;if(n===""||typeof n!="string"&&!r)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},a=i.windows,s=r?ke.compileRe(n,e):ke.makeRe(n,e,false,true),o=s.state;delete s.state;let u=()=>false;if(i.ignore){let c={...e,ignore:null,onMatch:null,onResult:null};u=ke(i.ignore,c,t);}let l=(c,h=false)=>{let{isMatch:f,match:g,output:p}=ke.test(c,s,e,{glob:n,posix:a}),m={glob:n,state:o,regex:s,posix:a,input:c,output:p,match:g,isMatch:f};return typeof i.onResult=="function"&&i.onResult(m),f===false?(m.isMatch=false,h?m:false):u(c)?(typeof i.onIgnore=="function"&&i.onIgnore(m),m.isMatch=false,h?m:false):(typeof i.onMatch=="function"&&i.onMatch(m),h?m:true)};return t&&(l.state=o),l};ke.test=(n,e,t,{glob:r,posix:i}={})=>{if(typeof n!="string")throw new TypeError("Expected input to be a string");if(n==="")return {isMatch:false,output:""};let a=t||{},s=a.format||(i?fb.toPosixSlashes:null),o=n===r,u=o&&s?s(n):n;return o===false&&(u=s?s(n):n,o=u===r),(o===false||a.capture===true)&&(a.matchBase===true||a.basename===true?o=ke.matchBase(n,e,t,i):o=e.exec(u)),{isMatch:!!o,match:o,output:u}};ke.matchBase=(n,e,t,r=t&&t.windows)=>(e instanceof RegExp?e:ke.makeRe(e,t)).test(fb.basename(n,{windows:r}));ke.isMatch=(n,e,t)=>ke(e,t)(n);ke.parse=(n,e)=>Array.isArray(n)?n.map(t=>ke.parse(t,e)):Jp(n,{...e,fastpaths:false});ke.scan=(n,e)=>bk(n,e);ke.compileRe=(n,e,t=false,r=false)=>{if(t===true)return n.output;let i=e||{},a=i.contains?"":"^",s=i.contains?"":"$",o=`${a}(?:${n.output})${s}`;n&&n.negated===true&&(o=`^(?!${o}).*$`);let u=ke.toRegex(o,e);return r===true&&(u.state=n),u};ke.makeRe=(n,e={},t=false,r=false)=>{if(!n||typeof n!="string")throw new TypeError("Expected a non-empty string");let i={negated:false,fastpaths:true};return e.fastpaths!==false&&(n[0]==="."||n[0]==="*")&&(i.output=Jp.fastpaths(n,e)),i.output||(i=Jp(n,e)),ke.compileRe(i,e,t,r)};ke.toRegex=(n,e)=>{try{let t=e||{};return new RegExp(n,t.flags||(t.nocase?"i":""))}catch(t){if(e&&e.debug===true)throw t;return /$^/}};ke.constants=_k;pb.exports=ke;});var Cb=S((HB,vb)=>{var gb=mb(),Ek=Ys();function yb(n,e,t=false){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:Ek.isWindows()}),gb(n,e,t)}Object.assign(yb,gb);vb.exports=yb;});var xi="/__pixi-vn-ink/hashtag-commands",ea="/__pixi-vn-ink/text-replaces",Dl="/__pixi-vn-ink/info";var ta="global decl",Yn="___external_value___";var se;(i=>(i.log=(a,...s)=>console.log(`[Pixi\u2019VN Ink] ${a}`,...s),i.warn=(a,...s)=>console.warn(`[Pixi\u2019VN Ink] ${a}`,...s),i.error=(a,...s)=>console.error(`[Pixi\u2019VN Ink] ${a}`,...s),i.info=(a,...s)=>console.info(`[Pixi\u2019VN Ink] ${a}`,...s)))(se||={});var Wb=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,Gb=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,Hb=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,xl={Space_Separator:Wb,ID_Start:Gb,ID_Continue:Hb},Fe={isSpaceSeparator(n){return typeof n=="string"&&xl.Space_Separator.test(n)},isIdStartChar(n){return typeof n=="string"&&(n>="a"&&n<="z"||n>="A"&&n<="Z"||n==="$"||n==="_"||xl.ID_Start.test(n))},isIdContinueChar(n){return typeof n=="string"&&(n>="a"&&n<="z"||n>="A"&&n<="Z"||n>="0"&&n<="9"||n==="$"||n==="_"||n==="\u200C"||n==="\u200D"||xl.ID_Continue.test(n))},isDigit(n){return typeof n=="string"&&/[0-9]/.test(n)},isHexDigit(n){return typeof n=="string"&&/[0-9A-Fa-f]/.test(n)}},Ol,rt,dn,ra,Dn,jt,qe,Fl,Oi,Jb=function(e,t){Ol=String(e),rt="start",dn=[],ra=0,Dn=1,jt=0,qe=void 0,Fl=void 0,Oi=void 0;do qe=zb(),Xb[rt]();while(qe.type!=="eof");return typeof t=="function"?Tl({"":Oi},"",t):Oi};function Tl(n,e,t){let r=n[e];if(r!=null&&typeof r=="object")if(Array.isArray(r))for(let i=0;i<r.length;i++){let a=String(i),s=Tl(r,a,t);s===void 0?delete r[a]:Object.defineProperty(r,a,{value:s,writable:true,enumerable:true,configurable:true});}else for(let i in r){let a=Tl(r,i,t);a===void 0?delete r[i]:Object.defineProperty(r,i,{value:a,writable:true,enumerable:true,configurable:true});}return t.call(n,e,r)}var H,B,Pi,hn,Z;function zb(){for(H="default",B="",Pi=false,hn=1;;){Z=fn();let n=tm[H]();if(n)return n}}function fn(){if(Ol[ra])return String.fromCodePoint(Ol.codePointAt(ra))}function T(){let n=fn();return n===`
|
|
51
|
+
`||h=="\r"?c=true:c&&(l++,c=false);t+=l;}let r=n.FindAll(qN.Knot)(),i=n.FindAll(BN.Stitch)(),a=n.FindAll(VN.Choice)(),s=n.FindAll(LN.Gather)(u=>u.debugMetadata!=null),o=n.FindAll(jN.Divert)();return {words:t,knots:r.length,functions:r.filter(u=>u.isFunction).length,stitches:i.length,gathers:s.length,diverts:o.length-1,choices:a.length}}cl.GenerateStoryStats=WN;});var mC=S(hl=>{Object.defineProperty(hl,"__esModule",{value:true});hl.JsonFileHandler=void 0;var Sp=class{constructor(e){this.fileHierarchy=e,this.ResolveInkFilename=t=>{if(Object.keys(this.fileHierarchy).includes(t))return t;throw new Error(`Cannot locate ${t}. Are you trying a relative import ? This is not yet implemented.`)},this.LoadInkFileContents=t=>{if(Object.keys(this.fileHierarchy).includes(t))return this.fileHierarchy[t];throw new Error(`Cannot open ${t}.`)};}};hl.JsonFileHandler=Sp;});var yC=S(nt=>{Object.defineProperty(nt,"__esModule",{value:true});nt.Compiler=nt.Story=nt.InkList=nt.JsonFileHandler=nt.StatementLevel=nt.InkParser=nt.CompilerOptions=void 0;var GN=sd(),HN=Av(),Ep=pr(),JN=_p(),zN=Te(),UN=fe(),KN=pC(),XN=sd();Object.defineProperty(nt,"CompilerOptions",{enumerable:true,get:function(){return XN.CompilerOptions}});var YN=_p();Object.defineProperty(nt,"InkParser",{enumerable:true,get:function(){return YN.InkParser}});var QN=Mf();Object.defineProperty(nt,"StatementLevel",{enumerable:true,get:function(){return QN.StatementLevel}});var ZN=mC();Object.defineProperty(nt,"JsonFileHandler",{enumerable:true,get:function(){return ZN.JsonFileHandler}});var gC=Rs();Object.defineProperty(nt,"InkList",{enumerable:true,get:function(){return gC.InkList}});Object.defineProperty(nt,"Story",{enumerable:true,get:function(){return gC.Story}});var wp=class{get errors(){return this._errors}get warnings(){return this._warnings}get authorMessages(){return this._authorMessages}get inputString(){return this._inputString}get options(){return this._options}get parsedStory(){if(!this._parsedStory)throw new Error;return this._parsedStory}get runtimeStory(){if(!this._runtimeStory)throw new Error("Compilation failed.");return this._runtimeStory}get parser(){if(!this._parser)throw new Error;return this._parser}get debugSourceRanges(){return this._debugSourceRanges}constructor(e,t=null){this._errors=[],this._warnings=[],this._authorMessages=[],this._parsedStory=null,this._runtimeStory=null,this._parser=null,this._debugSourceRanges=[],this.Compile=()=>(this._parser=new JN.InkParser(this.inputString,this.options.sourceFilename||null,this.OnError,null,this.options.fileHandler),this._parsedStory=this.parser.ParseStory(),this.errors.length===0?(this.parsedStory.countAllVisits=this.options.countAllVisits,this._runtimeStory=this.parsedStory.ExportRuntime(this.OnError)):this._runtimeStory=null,this.runtimeStory),this.RetrieveDebugSourceForLatestContent=()=>{var r;for(let i of this.runtimeStory.state.outputStream){let a=(0, UN.asOrNull)(i,zN.StringValue);if(a!==null){let s=new HN.DebugSourceRange(((r=a.value)===null||r===void 0?void 0:r.length)||0,a.debugMetadata,a.value||"unknown");this.debugSourceRanges.push(s);}}},this.GenerateStats=()=>this._parsedStory===null?null:(0, KN.GenerateStoryStats)(this._parsedStory),this.DebugMetadataForContentAtOffset=r=>{let i=0,a=null;for(let s of this.debugSourceRanges){if(s.debugMetadata!==null&&(a=s.debugMetadata),r>=i&&r<i+s.length)return a;i+=s.length;}return null},this.OnError=(r,i)=>{switch(i){case Ep.ErrorType.Author:this._authorMessages.push(r);break;case Ep.ErrorType.Warning:this._warnings.push(r);break;case Ep.ErrorType.Error:this._errors.push(r);break}this.options.errorHandler!==null&&this.options.errorHandler(r,i);},this._inputString=e,this._options=t||new GN.CompilerOptions;}};nt.Compiler=wp;});var jC=S((TB,kp)=>{var bl=process||{},$C=bl.argv||[],Cl=bl.env||{},BF=!(Cl.NO_COLOR||$C.includes("--no-color"))&&(!!Cl.FORCE_COLOR||$C.includes("--color")||bl.platform==="win32"||(bl.stdout||{}).isTTY&&Cl.TERM!=="dumb"||!!Cl.CI),MF=(n,e,t=n)=>r=>{let i=""+r,a=i.indexOf(e,n.length);return ~a?n+WF(i,e,t,a)+e:n+i+e},WF=(n,e,t,r)=>{let i="",a=0;do i+=n.substring(a,r)+t,a=r+e.length,r=n.indexOf(e,a);while(~r);return i+n.substring(a)},VC=(n=BF)=>{let e=n?MF:()=>String;return {isColorSupported:n,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")}};kp.exports=VC();kp.exports.createColors=VC;});var Xs=S((qB,eb)=>{var XC="[^\\\\/]",WI="(?=.)",YC="[^/]",Vp="(?:\\/|$)",QC="(?:^|\\/)",jp=`\\.{1,2}${Vp}`,GI="(?!\\.)",HI=`(?!${QC}${jp})`,JI=`(?!\\.{0,1}${Vp})`,zI=`(?!${jp})`,UI="[^.\\/]",KI=`${YC}*?`,XI="/",ZC={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:WI,QMARK:YC,END_ANCHOR:Vp,DOTS_SLASH:jp,NO_DOT:GI,NO_DOTS:HI,NO_DOT_SLASH:JI,NO_DOTS_SLASH:zI,QMARK_NO_DOT:UI,STAR:KI,START_ANCHOR:QC,SEP:XI},YI={...ZC,SLASH_LITERAL:"[\\\\/]",QMARK:XC,STAR:`${XC}*?`,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:"\\"},QI={__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"};eb.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:QI,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(n){return {"!":{type:"negate",open:"(?:(?!(?:",close:`))${n.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(n){return n===true?YI:ZC}};});var Ys=S(Et=>{var{REGEX_BACKSLASH:ZI,REGEX_REMOVE_BACKSLASH:ek,REGEX_SPECIAL_CHARS:tk,REGEX_SPECIAL_CHARS_GLOBAL:nk}=Xs();Et.isObject=n=>n!==null&&typeof n=="object"&&!Array.isArray(n);Et.hasRegexChars=n=>tk.test(n);Et.isRegexChar=n=>n.length===1&&Et.hasRegexChars(n);Et.escapeRegex=n=>n.replace(nk,"\\$1");Et.toPosixSlashes=n=>n.replace(ZI,"/");Et.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let n=navigator.platform.toLowerCase();return n==="win32"||n==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":false};Et.removeBackslashes=n=>n.replace(ek,e=>e==="\\"?"":e);Et.escapeLast=(n,e,t)=>{let r=n.lastIndexOf(e,t);return r===-1?n:n[r-1]==="\\"?Et.escapeLast(n,e,r-1):`${n.slice(0,r)}\\${n.slice(r)}`};Et.removePrefix=(n,e={})=>{let t=n;return t.startsWith("./")&&(t=t.slice(2),e.prefix="./"),t};Et.wrapOutput=(n,e={},t={})=>{let r=t.contains?"":"^",i=t.contains?"":"$",a=`${r}(?:${n})${i}`;return e.negated===true&&(a=`(?:^(?!${a}).*$)`),a};Et.basename=(n,{windows:e}={})=>{let t=n.split(e?/[\\/]/:"/"),r=t[t.length-1];return r===""?t[t.length-2]:r};});var ub=S((MB,ob)=>{var tb=Ys(),{CHAR_ASTERISK:Lp,CHAR_AT:rk,CHAR_BACKWARD_SLASH:Ei,CHAR_COMMA:ik,CHAR_DOT:qp,CHAR_EXCLAMATION_MARK:Bp,CHAR_FORWARD_SLASH:ab,CHAR_LEFT_CURLY_BRACE:Mp,CHAR_LEFT_PARENTHESES:Sl,CHAR_LEFT_SQUARE_BRACKET:sk,CHAR_PLUS:ak,CHAR_QUESTION_MARK:nb,CHAR_RIGHT_CURLY_BRACE:ok,CHAR_RIGHT_PARENTHESES:rb,CHAR_RIGHT_SQUARE_BRACKET:uk}=Xs(),ib=n=>n===ab||n===Ei,sb=n=>{n.isPrefix!==true&&(n.depth=n.isGlobstar?1/0:1);},lk=(n,e)=>{let t=e||{},r=n.length-1,i=t.parts===true||t.tokens===true||t.scanToEnd===true,a=[],s=[],o=[],u=n,l=-1,c=0,h=0,f=false,g=false,p=false,m=false,C=false,b=false,y=false,d=false,_=false,v=false,w=0,D,O,P={value:"",depth:0,isGlob:false},E=()=>l>=r,F=()=>u.charCodeAt(l+1),R=()=>(D=O,u.charCodeAt(++l));for(;l<r;){O=R();let j;if(O===Ei){y=P.backslashes=true,O=R(),O===Mp&&(b=true);continue}if(b===true||O===Mp){for(w++;E()!==true&&(O=R());){if(O===Ei){y=P.backslashes=true,R();continue}if(O===Mp){w++;continue}if(b!==true&&O===qp&&(O=R())===qp){if(f=P.isBrace=true,p=P.isGlob=true,v=true,i===true)continue;break}if(b!==true&&O===ik){if(f=P.isBrace=true,p=P.isGlob=true,v=true,i===true)continue;break}if(O===ok&&(w--,w===0)){b=false,f=P.isBrace=true,v=true;break}}if(i===true)continue;break}if(O===ab){if(a.push(l),s.push(P),P={value:"",depth:0,isGlob:false},v===true)continue;if(D===qp&&l===c+1){c+=2;continue}h=l+1;continue}if(t.noext!==true&&(O===ak||O===rk||O===Lp||O===nb||O===Bp)===true&&F()===Sl){if(p=P.isGlob=true,m=P.isExtglob=true,v=true,O===Bp&&l===c&&(_=true),i===true){let Le=0;for(;E()!==true&&(O=R());){if(O===Ei){y=P.backslashes=true,R();continue}if(O===Sl){Le++;continue}if(O===rb&&--Le===0){v=true;break}}continue}break}if(O===Lp){if(D===Lp&&(C=P.isGlobstar=true),p=P.isGlob=true,v=true,i===true)continue;break}if(O===nb){if(p=P.isGlob=true,v=true,i===true)continue;break}if(O===sk){for(;E()!==true&&(j=R());){if(j===Ei){y=P.backslashes=true,R();continue}if(j===uk){g=P.isBracket=true,p=P.isGlob=true,v=true;break}}if(i===true)continue;break}if(t.nonegate!==true&&O===Bp&&l===c){d=P.negated=true,c++;continue}if(t.noparen!==true&&O===Sl){if(p=P.isGlob=true,i===true){let ce=1;for(;E()!==true&&(O=R());){if(O===Ei){y=P.backslashes=true,R();continue}if(O===Sl){ce++;continue}if(O===rb&&--ce===0){v=true;break}}continue}break}if(p===true){if(v=true,i===true)continue;break}}t.noext===true&&(m=false,p=false);let k=u,A="",x="";c>0&&(A=u.slice(0,c),u=u.slice(c),h-=c),k&&p===true&&h>0?(k=u.slice(0,h),x=u.slice(h)):p===true?(k="",x=u):k=u,k&&k!==""&&k!=="/"&&k!==u&&ib(k.charCodeAt(k.length-1))&&(k=k.slice(0,-1)),t.unescape===true&&(x&&(x=tb.removeBackslashes(x)),k&&y===true&&(k=tb.removeBackslashes(k)));let Ce={prefix:A,input:n,start:c,base:k,glob:x,isBrace:f,isBracket:g,isGlob:p,isExtglob:m,isGlobstar:C,negated:d,negatedExtglob:_};if(t.tokens===true&&(Ce.maxDepth=0,ib(O)||s.push(P),Ce.tokens=s),t.parts===true||t.tokens===true){let j;for(let xe=0;xe<a.length;xe++){let En=j!==void 0?j+1:c,wn=a[xe],cn=n.slice(En,wn);t.tokens&&(xe===0&&c!==0?(s[xe].isPrefix=true,s[xe].value=A):s[xe].value=cn,sb(s[xe]),Ce.maxDepth+=s[xe].depth),wn>=c&&(o.push(cn),j=wn);}let ce=j!==void 0?j+1:c,Le=n.slice(ce);o.push(Le),t.tokens&&j&&j+1<n.length&&(s[s.length-1].value=Le,sb(s[s.length-1]),Ce.maxDepth+=s[s.length-1].depth),Ce.slashes=a,Ce.parts=o;}return Ce};ob.exports=lk;});var db=S((WB,hb)=>{var Qs=Xs(),wt=Ys(),{MAX_LENGTH:El,POSIX_REGEX_SOURCE:ck,REGEX_NON_SPECIAL_CHARS:hk,REGEX_SPECIAL_CHARS_BACKREF:dk,REPLACEMENTS:lb}=Qs,fk=(n,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...n,e);n.sort();let t=`[${n.join("-")}]`;try{new RegExp(t);}catch{return n.map(i=>wt.escapeRegex(i)).join("..")}return t},wi=(n,e)=>`Missing ${n}: "${e}" - use "\\\\${e}" to match literal characters`,cb=n=>{let e=[],t=0,r=0,i=0,a="",s=false;for(let o of n){if(s===true){a+=o,s=false;continue}if(o==="\\"){a+=o,s=true;continue}if(o==='"'){i=i===1?0:1,a+=o;continue}if(i===0){if(o==="[")t++;else if(o==="]"&&t>0)t--;else if(t===0){if(o==="(")r++;else if(o===")"&&r>0)r--;else if(o==="|"&&r===0){e.push(a),a="";continue}}}a+=o;}return e.push(a),e},pk=n=>{let e=false;for(let t of n){if(e===true){e=false;continue}if(t==="\\"){e=true;continue}if(/[?*+@!()[\]{}]/.test(t))return false}return true},Gp=n=>{let e=n.trim(),t=true;for(;t===true;)t=false,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),t=true);if(pk(e))return e.replace(/\\(.)/g,"$1")},mk=n=>{let e=n.map(Gp).filter(Boolean);for(let t=0;t<e.length;t++)for(let r=t+1;r<e.length;r++){let i=e[t],a=e[r],s=i[0];if(!(!s||i!==s.repeat(i.length)||a!==s.repeat(a.length))&&(i===a||i.startsWith(a)||a.startsWith(i)))return true}return false},Wp=(n,e=true)=>{if(n[0]!=="+"&&n[0]!=="*"||n[1]!=="(")return;let t=0,r=0,i=0,a=false;for(let s=1;s<n.length;s++){let o=n[s];if(a===true){a=false;continue}if(o==="\\"){a=true;continue}if(o==='"'){i=i===1?0:1;continue}if(i!==1){if(o==="["){t++;continue}if(o==="]"&&t>0){t--;continue}if(!(t>0)){if(o==="("){r++;continue}if(o===")"&&(r--,r===0))return e===true&&s!==n.length-1?void 0:{type:n[0],body:n.slice(2,s),end:s}}}}},gk=n=>`${n.length===1?wt.escapeRegex(n[0]):`[${n.map(t=>wt.escapeRegex(t)).join("")}]`}*`,yk=n=>{let e=0,t=[];for(;e<n.length;){let r=Wp(n.slice(e),false);if(!r||r.type!=="*")return;let i=cb(r.body).map(s=>s.trim());if(i.length!==1)return;let a=Gp(i[0]);if(!a||a.length!==1)return;t.push(a),e+=r.end+1;}if(!(t.length<1))return t},vk=n=>{let e=0,t=n.trim(),r=Wp(t);for(;r;)e++,t=r.body.trim(),r=Wp(t);return e},Ck=(n,e)=>{if(e.maxExtglobRecursion===false)return {risky:false};let t=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:Qs.DEFAULT_MAX_EXTGLOB_RECURSION,r=cb(n).map(o=>o.trim());if(r.length>1&&(r.some(o=>o==="")||r.some(o=>/^[*?]+$/.test(o))||mk(r)))return {risky:true};let i=[],a=false,s=true;for(let o of r){let u=yk(o);if(u){a=true,i.push(...u);continue}let l=Gp(o);if(l&&l.length===1){i.push(l);continue}if(s=false,vk(o)>t)return {risky:true}}return a?s?{risky:true,safeOutput:gk([...new Set(i)])}:{risky:true}:{risky:false}},Hp=(n,e)=>{if(typeof n!="string")throw new TypeError("Expected a string");n=lb[n]||n;let t={...e},r=typeof t.maxLength=="number"?Math.min(El,t.maxLength):El,i=n.length;if(i>r)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${r}`);let a={type:"bos",value:"",output:t.prepend||""},s=[a],o=t.capture?"":"?:",u=Qs.globChars(t.windows),l=Qs.extglobChars(u),{DOT_LITERAL:c,PLUS_LITERAL:h,SLASH_LITERAL:f,ONE_CHAR:g,DOTS_SLASH:p,NO_DOT:m,NO_DOT_SLASH:C,NO_DOTS_SLASH:b,QMARK:y,QMARK_NO_DOT:d,STAR:_,START_ANCHOR:v}=u,w=N=>`(${o}(?:(?!${v}${N.dot?p:c}).)*?)`,D=t.dot?"":m,O=t.dot?y:d,P=t.bash===true?w(t):_;t.capture&&(P=`(${P})`),typeof t.noext=="boolean"&&(t.noextglob=t.noext);let E={input:n,index:-1,start:0,dot:t.dot===true,consumed:"",output:"",prefix:"",backtrack:false,negated:false,brackets:0,braces:0,parens:0,quotes:0,globstar:false,tokens:s};n=wt.removePrefix(n,E),i=n.length;let F=[],R=[],k=[],A=a,x,Ce=()=>E.index===i-1,j=E.peek=(N=1)=>n[E.index+N],ce=E.advance=()=>n[++E.index]||"",Le=()=>n.slice(E.index+1),xe=(N="",W=0)=>{E.consumed+=N,E.index+=W;},En=N=>{E.output+=N.output!=null?N.output:N.value,xe(N.value);},wn=()=>{let N=1;for(;j()==="!"&&(j(2)!=="("||j(3)==="?");)ce(),E.start++,N++;return N%2===0?false:(E.negated=true,E.start++,true)},cn=N=>{E[N]++,k.push(N);},Jt=N=>{E[N]--,k.pop();},J=N=>{if(A.type==="globstar"){let W=E.braces>0&&(N.type==="comma"||N.type==="brace"),I=N.extglob===true||F.length&&(N.type==="pipe"||N.type==="paren");N.type!=="slash"&&N.type!=="paren"&&!W&&!I&&(E.output=E.output.slice(0,-A.output.length),A.type="star",A.value="*",A.output=P,E.output+=A.output);}if(F.length&&N.type!=="paren"&&(F[F.length-1].inner+=N.value),(N.value||N.output)&&En(N),A&&A.type==="text"&&N.type==="text"){A.output=(A.output||A.value)+N.value,A.value+=N.value;return}N.prev=A,s.push(N),A=N;},pe=(N,W)=>{let I={...l[W],conditions:1,inner:""};I.prev=A,I.parens=E.parens,I.output=E.output,I.startIndex=E.index,I.tokensIndex=s.length;let z=(t.capture?"(":"")+I.open;cn("parens"),J({type:N,value:W,output:E.output?"":g}),J({type:"paren",extglob:true,value:ce(),output:z}),F.push(I);},At=N=>{let W=n.slice(N.startIndex,E.index+1),I=n.slice(N.startIndex+2,E.index),z=Ck(I,t);if((N.type==="plus"||N.type==="star")&&z.risky){let ge=z.safeOutput?(N.output?"":g)+(t.capture?`(${z.safeOutput})`:z.safeOutput):void 0,zt=s[N.tokensIndex];zt.type="text",zt.value=W,zt.output=ge||wt.escapeRegex(W);for(let Kn=N.tokensIndex+1;Kn<s.length;Kn++)s[Kn].value="",s[Kn].output="",delete s[Kn].suffix;E.output=N.output+zt.output,E.backtrack=true,J({type:"paren",extglob:true,value:x,output:""}),Jt("parens");return}let be=N.close+(t.capture?")":""),Ve;if(N.type==="negate"){let ge=P;if(N.inner&&N.inner.length>1&&N.inner.includes("/")&&(ge=w(t)),(ge!==P||Ce()||/^\)+$/.test(Le()))&&(be=N.close=`)$))${ge}`),N.inner.includes("*")&&(Ve=Le())&&/^\.[^\\/.]+$/.test(Ve)){let zt=Hp(Ve,{...e,fastpaths:false}).output;be=N.close=`)${zt})${ge})`;}N.prev.type==="bos"&&(E.negatedExtglob=true);}J({type:"paren",extglob:true,value:x,output:be}),Jt("parens");};if(t.fastpaths!==false&&!/(^[*!]|[/()[\]{}"])/.test(n)){let N=false,W=n.replace(dk,(I,z,be,Ve,ge,zt)=>Ve==="\\"?(N=true,I):Ve==="?"?z?z+Ve+(ge?y.repeat(ge.length):""):zt===0?O+(ge?y.repeat(ge.length):""):y.repeat(be.length):Ve==="."?c.repeat(be.length):Ve==="*"?z?z+Ve+(ge?P:""):P:z?I:`\\${I}`);return N===true&&(t.unescape===true?W=W.replace(/\\/g,""):W=W.replace(/\\+/g,I=>I.length%2===0?"\\\\":I?"\\":"")),W===n&&t.contains===true?(E.output=n,E):(E.output=wt.wrapOutput(W,E,e),E)}for(;!Ce();){if(x=ce(),x==="\0")continue;if(x==="\\"){let I=j();if(I==="/"&&t.bash!==true||I==="."||I===";")continue;if(!I){x+="\\",J({type:"text",value:x});continue}let z=/^\\+/.exec(Le()),be=0;if(z&&z[0].length>2&&(be=z[0].length,E.index+=be,be%2!==0&&(x+="\\")),t.unescape===true?x=ce():x+=ce(),E.brackets===0){J({type:"text",value:x});continue}}if(E.brackets>0&&(x!=="]"||A.value==="["||A.value==="[^")){if(t.posix!==false&&x===":"){let I=A.value.slice(1);if(I.includes("[")&&(A.posix=true,I.includes(":"))){let z=A.value.lastIndexOf("["),be=A.value.slice(0,z),Ve=A.value.slice(z+2),ge=ck[Ve];if(ge){A.value=be+ge,E.backtrack=true,ce(),!a.output&&s.indexOf(A)===1&&(a.output=g);continue}}}(x==="["&&j()!==":"||x==="-"&&j()==="]")&&(x=`\\${x}`),x==="]"&&(A.value==="["||A.value==="[^")&&(x=`\\${x}`),t.posix===true&&x==="!"&&A.value==="["&&(x="^"),A.value+=x,En({value:x});continue}if(E.quotes===1&&x!=='"'){x=wt.escapeRegex(x),A.value+=x,En({value:x});continue}if(x==='"'){E.quotes=E.quotes===1?0:1,t.keepQuotes===true&&J({type:"text",value:x});continue}if(x==="("){cn("parens"),J({type:"paren",value:x});continue}if(x===")"){if(E.parens===0&&t.strictBrackets===true)throw new SyntaxError(wi("opening","("));let I=F[F.length-1];if(I&&E.parens===I.parens+1){At(F.pop());continue}J({type:"paren",value:x,output:E.parens?")":"\\)"}),Jt("parens");continue}if(x==="["){if(t.nobracket===true||!Le().includes("]")){if(t.nobracket!==true&&t.strictBrackets===true)throw new SyntaxError(wi("closing","]"));x=`\\${x}`;}else cn("brackets");J({type:"bracket",value:x});continue}if(x==="]"){if(t.nobracket===true||A&&A.type==="bracket"&&A.value.length===1){J({type:"text",value:x,output:`\\${x}`});continue}if(E.brackets===0){if(t.strictBrackets===true)throw new SyntaxError(wi("opening","["));J({type:"text",value:x,output:`\\${x}`});continue}Jt("brackets");let I=A.value.slice(1);if(A.posix!==true&&I[0]==="^"&&!I.includes("/")&&(x=`/${x}`),A.value+=x,En({value:x}),t.literalBrackets===false||wt.hasRegexChars(I))continue;let z=wt.escapeRegex(A.value);if(E.output=E.output.slice(0,-A.value.length),t.literalBrackets===true){E.output+=z,A.value=z;continue}A.value=`(${o}${z}|${A.value})`,E.output+=A.value;continue}if(x==="{"&&t.nobrace!==true){cn("braces");let I={type:"brace",value:x,output:"(",outputIndex:E.output.length,tokensIndex:E.tokens.length};R.push(I),J(I);continue}if(x==="}"){let I=R[R.length-1];if(t.nobrace===true||!I){J({type:"text",value:x,output:x});continue}let z=")";if(I.dots===true){let be=s.slice(),Ve=[];for(let ge=be.length-1;ge>=0&&(s.pop(),be[ge].type!=="brace");ge--)be[ge].type!=="dots"&&Ve.unshift(be[ge].value);z=fk(Ve,t),E.backtrack=true;}if(I.comma!==true&&I.dots!==true){let be=E.output.slice(0,I.outputIndex),Ve=E.tokens.slice(I.tokensIndex);I.value=I.output="\\{",x=z="\\}",E.output=be;for(let ge of Ve)E.output+=ge.output||ge.value;}J({type:"brace",value:x,output:z}),Jt("braces"),R.pop();continue}if(x==="|"){F.length>0&&F[F.length-1].conditions++,J({type:"text",value:x});continue}if(x===","){let I=x,z=R[R.length-1];z&&k[k.length-1]==="braces"&&(z.comma=true,I="|"),J({type:"comma",value:x,output:I});continue}if(x==="/"){if(A.type==="dot"&&E.index===E.start+1){E.start=E.index+1,E.consumed="",E.output="",s.pop(),A=a;continue}J({type:"slash",value:x,output:f});continue}if(x==="."){if(E.braces>0&&A.type==="dot"){A.value==="."&&(A.output=c);let I=R[R.length-1];A.type="dots",A.output+=x,A.value+=x,I.dots=true;continue}if(E.braces+E.parens===0&&A.type!=="bos"&&A.type!=="slash"){J({type:"text",value:x,output:c});continue}J({type:"dot",value:x,output:c});continue}if(x==="?"){if(!(A&&A.value==="(")&&t.noextglob!==true&&j()==="("&&j(2)!=="?"){pe("qmark",x);continue}if(A&&A.type==="paren"){let z=j(),be=x;(A.value==="("&&!/[!=<:]/.test(z)||z==="<"&&!/<([!=]|\w+>)/.test(Le()))&&(be=`\\${x}`),J({type:"text",value:x,output:be});continue}if(t.dot!==true&&(A.type==="slash"||A.type==="bos")){J({type:"qmark",value:x,output:d});continue}J({type:"qmark",value:x,output:y});continue}if(x==="!"){if(t.noextglob!==true&&j()==="("&&(j(2)!=="?"||!/[!=<:]/.test(j(3)))){pe("negate",x);continue}if(t.nonegate!==true&&E.index===0){wn();continue}}if(x==="+"){if(t.noextglob!==true&&j()==="("&&j(2)!=="?"){pe("plus",x);continue}if(A&&A.value==="("||t.regex===false){J({type:"plus",value:x,output:h});continue}if(A&&(A.type==="bracket"||A.type==="paren"||A.type==="brace")||E.parens>0){J({type:"plus",value:x});continue}J({type:"plus",value:h});continue}if(x==="@"){if(t.noextglob!==true&&j()==="("&&j(2)!=="?"){J({type:"at",extglob:true,value:x,output:""});continue}J({type:"text",value:x});continue}if(x!=="*"){(x==="$"||x==="^")&&(x=`\\${x}`);let I=hk.exec(Le());I&&(x+=I[0],E.index+=I[0].length),J({type:"text",value:x});continue}if(A&&(A.type==="globstar"||A.star===true)){A.type="star",A.star=true,A.value+=x,A.output=P,E.backtrack=true,E.globstar=true,xe(x);continue}let N=Le();if(t.noextglob!==true&&/^\([^?]/.test(N)){pe("star",x);continue}if(A.type==="star"){if(t.noglobstar===true){xe(x);continue}let I=A.prev,z=I.prev,be=I.type==="slash"||I.type==="bos",Ve=z&&(z.type==="star"||z.type==="globstar");if(t.bash===true&&(!be||N[0]&&N[0]!=="/")){J({type:"star",value:x,output:""});continue}let ge=E.braces>0&&(I.type==="comma"||I.type==="brace"),zt=F.length&&(I.type==="pipe"||I.type==="paren");if(!be&&I.type!=="paren"&&!ge&&!zt){J({type:"star",value:x,output:""});continue}for(;N.slice(0,3)==="/**";){let Tr=n[E.index+4];if(Tr&&Tr!=="/")break;N=N.slice(3),xe("/**",3);}let Kn=Ce()||E.parens>0&&N===")".repeat(E.parens)&&!F.some(Tr=>Tr.type==="negate");if(I.type==="bos"&&Ce()){A.type="globstar",A.value+=x,A.output=w(t),E.output=A.output,E.globstar=true,xe(x);continue}if(I.type==="slash"&&I.prev.type!=="bos"&&!Ve&&Kn){E.output=E.output.slice(0,-(I.output+A.output).length),I.output=`(?:${I.output}`,A.type="globstar",A.output=w(t)+(t.strictSlashes?")":"|$)"),A.value+=x,E.globstar=true,E.output+=I.output+A.output,xe(x);continue}if(I.type==="slash"&&I.prev.type!=="bos"&&N[0]==="/"){let Tr=N[1]!==void 0?"|$":"";E.output=E.output.slice(0,-(I.output+A.output).length),I.output=`(?:${I.output}`,A.type="globstar",A.output=`${w(t)}${f}|${f}${Tr})`,A.value+=x,E.output+=I.output+A.output,E.globstar=true,xe(x+ce()),J({type:"slash",value:"/",output:""});continue}if(I.type==="bos"&&N[0]==="/"){A.type="globstar",A.value+=x,A.output=`(?:^|${f}|${w(t)}${f})`,E.output=A.output,E.globstar=true,xe(x+ce()),J({type:"slash",value:"/",output:""});continue}E.output=E.output.slice(0,-A.output.length),A.type="globstar",A.output=w(t),A.value+=x,E.output+=A.output,E.globstar=true,xe(x);continue}let W={type:"star",value:x,output:P};if(t.bash===true){W.output=".*?",(A.type==="bos"||A.type==="slash")&&(W.output=D+W.output),J(W);continue}if(A&&(A.type==="bracket"||A.type==="paren")&&t.regex===true){W.output=x,J(W);continue}(E.index===E.start||A.type==="slash"||A.type==="dot")&&(A.type==="dot"?(E.output+=C,A.output+=C):t.dot===true?(E.output+=b,A.output+=b):(E.output+=D,A.output+=D),j()!=="*"&&(E.output+=g,A.output+=g)),J(W);}for(;E.brackets>0;){if(t.strictBrackets===true)throw new SyntaxError(wi("closing","]"));E.output=wt.escapeLast(E.output,"["),Jt("brackets");}for(;E.parens>0;){if(t.strictBrackets===true)throw new SyntaxError(wi("closing",")"));E.output=wt.escapeLast(E.output,"("),Jt("parens");}for(;E.braces>0;){if(t.strictBrackets===true)throw new SyntaxError(wi("closing","}"));E.output=wt.escapeLast(E.output,"{"),Jt("braces");}if(t.strictSlashes!==true&&(A.type==="star"||A.type==="bracket")&&J({type:"maybe_slash",value:"",output:`${f}?`}),E.backtrack===true){E.output="";for(let N of E.tokens)E.output+=N.output!=null?N.output:N.value,N.suffix&&(E.output+=N.suffix);}return E};Hp.fastpaths=(n,e)=>{let t={...e},r=typeof t.maxLength=="number"?Math.min(El,t.maxLength):El,i=n.length;if(i>r)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${r}`);n=lb[n]||n;let{DOT_LITERAL:a,SLASH_LITERAL:s,ONE_CHAR:o,DOTS_SLASH:u,NO_DOT:l,NO_DOTS:c,NO_DOTS_SLASH:h,STAR:f,START_ANCHOR:g}=Qs.globChars(t.windows),p=t.dot?c:l,m=t.dot?h:l,C=t.capture?"":"?:",b={negated:false,prefix:""},y=t.bash===true?".*?":f;t.capture&&(y=`(${y})`);let d=D=>D.noglobstar===true?y:`(${C}(?:(?!${g}${D.dot?u:a}).)*?)`,_=D=>{switch(D){case "*":return `${p}${o}${y}`;case ".*":return `${a}${o}${y}`;case "*.*":return `${p}${y}${a}${o}${y}`;case "*/*":return `${p}${y}${s}${o}${m}${y}`;case "**":return p+d(t);case "**/*":return `(?:${p}${d(t)}${s})?${m}${o}${y}`;case "**/*.*":return `(?:${p}${d(t)}${s})?${m}${y}${a}${o}${y}`;case "**/.*":return `(?:${p}${d(t)}${s})?${a}${o}${y}`;default:{let O=/^(.*?)\.(\w+)$/.exec(D);if(!O)return;let P=_(O[1]);return P?P+a+O[2]:void 0}}},v=wt.removePrefix(n,b),w=_(v);return w&&t.strictSlashes!==true&&(w+=`${s}?`),w};hb.exports=Hp;});var mb=S((GB,pb)=>{var bk=ub(),Jp=db(),fb=Ys(),_k=Xs(),Sk=n=>n&&typeof n=="object"&&!Array.isArray(n),ke=(n,e,t=false)=>{if(Array.isArray(n)){let c=n.map(f=>ke(f,e,t));return f=>{for(let g of c){let p=g(f);if(p)return p}return false}}let r=Sk(n)&&n.tokens&&n.input;if(n===""||typeof n!="string"&&!r)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},a=i.windows,s=r?ke.compileRe(n,e):ke.makeRe(n,e,false,true),o=s.state;delete s.state;let u=()=>false;if(i.ignore){let c={...e,ignore:null,onMatch:null,onResult:null};u=ke(i.ignore,c,t);}let l=(c,h=false)=>{let{isMatch:f,match:g,output:p}=ke.test(c,s,e,{glob:n,posix:a}),m={glob:n,state:o,regex:s,posix:a,input:c,output:p,match:g,isMatch:f};return typeof i.onResult=="function"&&i.onResult(m),f===false?(m.isMatch=false,h?m:false):u(c)?(typeof i.onIgnore=="function"&&i.onIgnore(m),m.isMatch=false,h?m:false):(typeof i.onMatch=="function"&&i.onMatch(m),h?m:true)};return t&&(l.state=o),l};ke.test=(n,e,t,{glob:r,posix:i}={})=>{if(typeof n!="string")throw new TypeError("Expected input to be a string");if(n==="")return {isMatch:false,output:""};let a=t||{},s=a.format||(i?fb.toPosixSlashes:null),o=n===r,u=o&&s?s(n):n;return o===false&&(u=s?s(n):n,o=u===r),(o===false||a.capture===true)&&(a.matchBase===true||a.basename===true?o=ke.matchBase(n,e,t,i):o=e.exec(u)),{isMatch:!!o,match:o,output:u}};ke.matchBase=(n,e,t,r=t&&t.windows)=>(e instanceof RegExp?e:ke.makeRe(e,t)).test(fb.basename(n,{windows:r}));ke.isMatch=(n,e,t)=>ke(e,t)(n);ke.parse=(n,e)=>Array.isArray(n)?n.map(t=>ke.parse(t,e)):Jp(n,{...e,fastpaths:false});ke.scan=(n,e)=>bk(n,e);ke.compileRe=(n,e,t=false,r=false)=>{if(t===true)return n.output;let i=e||{},a=i.contains?"":"^",s=i.contains?"":"$",o=`${a}(?:${n.output})${s}`;n&&n.negated===true&&(o=`^(?!${o}).*$`);let u=ke.toRegex(o,e);return r===true&&(u.state=n),u};ke.makeRe=(n,e={},t=false,r=false)=>{if(!n||typeof n!="string")throw new TypeError("Expected a non-empty string");let i={negated:false,fastpaths:true};return e.fastpaths!==false&&(n[0]==="."||n[0]==="*")&&(i.output=Jp.fastpaths(n,e)),i.output||(i=Jp(n,e)),ke.compileRe(i,e,t,r)};ke.toRegex=(n,e)=>{try{let t=e||{};return new RegExp(n,t.flags||(t.nocase?"i":""))}catch(t){if(e&&e.debug===true)throw t;return /$^/}};ke.constants=_k;pb.exports=ke;});var Cb=S((HB,vb)=>{var gb=mb(),Ek=Ys();function yb(n,e,t=false){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:Ek.isWindows()}),gb(n,e,t)}Object.assign(yb,gb);vb.exports=yb;});var xi="/__pixi-vn-ink/hashtag-commands",ea="/__pixi-vn-ink/text-replaces",Dl="/__pixi-vn-ink/info";var ta="global decl",Yn="___external_value___";var ae;(i=>(i.log=(a,...s)=>console.log(`[Pixi\u2019VN Ink] ${a}`,...s),i.warn=(a,...s)=>console.warn(`[Pixi\u2019VN Ink] ${a}`,...s),i.error=(a,...s)=>console.error(`[Pixi\u2019VN Ink] ${a}`,...s),i.info=(a,...s)=>console.info(`[Pixi\u2019VN Ink] ${a}`,...s)))(ae||={});var Wb=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,Gb=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,Hb=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,xl={Space_Separator:Wb,ID_Start:Gb,ID_Continue:Hb},Fe={isSpaceSeparator(n){return typeof n=="string"&&xl.Space_Separator.test(n)},isIdStartChar(n){return typeof n=="string"&&(n>="a"&&n<="z"||n>="A"&&n<="Z"||n==="$"||n==="_"||xl.ID_Start.test(n))},isIdContinueChar(n){return typeof n=="string"&&(n>="a"&&n<="z"||n>="A"&&n<="Z"||n>="0"&&n<="9"||n==="$"||n==="_"||n==="\u200C"||n==="\u200D"||xl.ID_Continue.test(n))},isDigit(n){return typeof n=="string"&&/[0-9]/.test(n)},isHexDigit(n){return typeof n=="string"&&/[0-9A-Fa-f]/.test(n)}},Ol,rt,dn,ra,Dn,jt,qe,Fl,Oi,Jb=function(e,t){Ol=String(e),rt="start",dn=[],ra=0,Dn=1,jt=0,qe=void 0,Fl=void 0,Oi=void 0;do qe=zb(),Xb[rt]();while(qe.type!=="eof");return typeof t=="function"?Tl({"":Oi},"",t):Oi};function Tl(n,e,t){let r=n[e];if(r!=null&&typeof r=="object")if(Array.isArray(r))for(let i=0;i<r.length;i++){let a=String(i),s=Tl(r,a,t);s===void 0?delete r[a]:Object.defineProperty(r,a,{value:s,writable:true,enumerable:true,configurable:true});}else for(let i in r){let a=Tl(r,i,t);a===void 0?delete r[i]:Object.defineProperty(r,i,{value:a,writable:true,enumerable:true,configurable:true});}return t.call(n,e,r)}var H,B,Pi,hn,Z;function zb(){for(H="default",B="",Pi=false,hn=1;;){Z=fn();let n=tm[H]();if(n)return n}}function fn(){if(Ol[ra])return String.fromCodePoint(Ol.codePointAt(ra))}function T(){let n=fn();return n===`
|
|
52
52
|
`?(Dn++,jt=0):n?jt+=n.length:jt++,n&&(ra+=n.length),n}var tm={default(){switch(Z){case " ":case "\v":case "\f":case " ":case "\xA0":case "\uFEFF":case `
|
|
53
53
|
`:case "\r":case "\u2028":case "\u2029":T();return;case "/":T(),H="comment";return;case void 0:return T(),_e("eof")}if(Fe.isSpaceSeparator(Z)){T();return}return tm[rt]()},comment(){switch(Z){case "*":T(),H="multiLineComment";return;case "/":T(),H="singleLineComment";return}throw Se(T())},multiLineComment(){switch(Z){case "*":T(),H="multiLineCommentAsterisk";return;case void 0:throw Se(T())}T();},multiLineCommentAsterisk(){switch(Z){case "*":T();return;case "/":T(),H="default";return;case void 0:throw Se(T())}T(),H="multiLineComment";},singleLineComment(){switch(Z){case `
|
|
54
54
|
`:case "\r":case "\u2028":case "\u2029":T(),H="default";return;case void 0:return T(),_e("eof")}T();},value(){switch(Z){case "{":case "[":return _e("punctuator",T());case "n":return T(),Qn("ull"),_e("null",null);case "t":return T(),Qn("rue"),_e("boolean",true);case "f":return T(),Qn("alse"),_e("boolean",false);case "-":case "+":T()==="-"&&(hn=-1),H="sign";return;case ".":B=T(),H="decimalPointLeading";return;case "0":B=T(),H="zero";return;case "1":case "2":case "3":case "4":case "5":case "6":case "7":case "8":case "9":B=T(),H="decimalInteger";return;case "I":return T(),Qn("nfinity"),_e("numeric",1/0);case "N":return T(),Qn("aN"),_e("numeric",NaN);case '"':case "'":Pi=T()==='"',B="",H="string";return}throw Se(T())},identifierNameStartEscape(){if(Z!=="u")throw Se(T());T();let n=Nl();switch(n){case "$":case "_":break;default:if(!Fe.isIdStartChar(n))throw em();break}B+=n,H="identifierName";},identifierName(){switch(Z){case "$":case "_":case "\u200C":case "\u200D":B+=T();return;case "\\":T(),H="identifierNameEscape";return}if(Fe.isIdContinueChar(Z)){B+=T();return}return _e("identifier",B)},identifierNameEscape(){if(Z!=="u")throw Se(T());T();let n=Nl();switch(n){case "$":case "_":case "\u200C":case "\u200D":break;default:if(!Fe.isIdContinueChar(n))throw em();break}B+=n,H="identifierName";},sign(){switch(Z){case ".":B=T(),H="decimalPointLeading";return;case "0":B=T(),H="zero";return;case "1":case "2":case "3":case "4":case "5":case "6":case "7":case "8":case "9":B=T(),H="decimalInteger";return;case "I":return T(),Qn("nfinity"),_e("numeric",hn*(1/0));case "N":return T(),Qn("aN"),_e("numeric",NaN)}throw Se(T())},zero(){switch(Z){case ".":B+=T(),H="decimalPoint";return;case "e":case "E":B+=T(),H="decimalExponent";return;case "x":case "X":B+=T(),H="hexadecimal";return}return _e("numeric",hn*0)},decimalInteger(){switch(Z){case ".":B+=T(),H="decimalPoint";return;case "e":case "E":B+=T(),H="decimalExponent";return}if(Fe.isDigit(Z)){B+=T();return}return _e("numeric",hn*Number(B))},decimalPointLeading(){if(Fe.isDigit(Z)){B+=T(),H="decimalFraction";return}throw Se(T())},decimalPoint(){switch(Z){case "e":case "E":B+=T(),H="decimalExponent";return}if(Fe.isDigit(Z)){B+=T(),H="decimalFraction";return}return _e("numeric",hn*Number(B))},decimalFraction(){switch(Z){case "e":case "E":B+=T(),H="decimalExponent";return}if(Fe.isDigit(Z)){B+=T();return}return _e("numeric",hn*Number(B))},decimalExponent(){switch(Z){case "+":case "-":B+=T(),H="decimalExponentSign";return}if(Fe.isDigit(Z)){B+=T(),H="decimalExponentInteger";return}throw Se(T())},decimalExponentSign(){if(Fe.isDigit(Z)){B+=T(),H="decimalExponentInteger";return}throw Se(T())},decimalExponentInteger(){if(Fe.isDigit(Z)){B+=T();return}return _e("numeric",hn*Number(B))},hexadecimal(){if(Fe.isHexDigit(Z)){B+=T(),H="hexadecimalInteger";return}throw Se(T())},hexadecimalInteger(){if(Fe.isHexDigit(Z)){B+=T();return}return _e("numeric",hn*Number(B))},string(){switch(Z){case "\\":T(),B+=Ub();return;case '"':if(Pi)return T(),_e("string",B);B+=T();return;case "'":if(!Pi)return T(),_e("string",B);B+=T();return;case `
|
|
@@ -61,9 +61,9 @@ Error:${c}`);}return l!=null&&(u=new n(l,s,this._externalErrorHandler,this._root
|
|
|
61
61
|
`+C+"}";}}return i.pop(),a=C,d}function g(m){if(m.length===0)return h(m);let C=String.fromCodePoint(m.codePointAt(0));if(!Fe.isIdStartChar(C))return h(m);for(let b=C.length;b<m.length;b++)if(!Fe.isIdContinueChar(String.fromCodePoint(m.codePointAt(b))))return h(m);return m}function p(m){if(i.indexOf(m)>=0)throw TypeError("Converting circular structure to JSON5");i.push(m);let C=a;a=a+u;let b=[];for(let d=0;d<m.length;d++){let _=c(String(d),m);b.push(_!==void 0?_:"null");}let y;if(b.length===0)y="[]";else if(u==="")y="["+b.join(",")+"]";else {let d=`,
|
|
62
62
|
`+a,_=b.join(d);y=`[
|
|
63
63
|
`+a+_+`,
|
|
64
|
-
`+C+"]";}return i.pop(),a=C,y}},Zb={parse:Jb,stringify:Qb},e_=Zb,Ti=e_;var im="\xA7SPACE\xA7",sm="\xA7DOUBLE_QUOTES\xA7",am="\xA7QUOTES\xA7",om="SPECIAL_\xA7QUOTES\xA7",um="\xA7CURLY_BRACKETS1\xA7",t_="\xA7INK_VAR\xA7",lm="\xA7CURLY_BRACKETS2\xA7",pn;(y=>{let n=[],e=[];async function t(d,_){for(let v=0;v<n.length;v++)try{let{validation:w}=n[v].opts;if(w instanceof RegExp){if(!w.test(d.join(" ")))continue}else if(w instanceof zod.ZodType&&!w.safeParse(d).success)continue;let D=await n[v].fn(d,_,h);if(D===!0||typeof D=="string")return D}catch{}return false}function r(d,_={name:"custom-command",validation:/^/}){n.unshift({fn:d,opts:_});}y.add=r;function i(){return [...e.map(d=>d.opts),...n.map(d=>d.opts)]}y.info=i;function a(d,_){e.unshift({fn:d,opts:_});}y.addMapper=a;function s(){n.length=0;}y.clear=s;function o(){e.length=0;}y.clearMappers=o;async function u(d,_,v){try{let w=l(d),D=await t(w,v);return D===!0?void 0:typeof D=="string"?(D.startsWith("#")&&(D=D.substring(1)),await y.run(D,_,v)):c(w,_)}catch(w){throw
|
|
65
|
-
`),n=n.replaceAll("\\t"," "),n=n.replaceAll(" "," "),n=n.replaceAll(fm,"\\\\"),n}var n_={version:"1.14.0"};var sa=`https://pixi-vn.com/schemas/${n_.version}/schema.json`,pm=["==","!=","<","<=",">",">=","CONTAINS"];function xn(n,e,t,r){let{functions:i}=r;n=n.map(s=>{if(typeof s=="string")switch(s){case "rnd":return "RANDOM";case "?":return "CONTAINS"}return s});let a=[];return n.forEach(s=>{if(typeof s=="string")switch(s){case "&&":case "||":if(a.length>=2){let o={type:"union",unionType:s==="&&"?"and":"or",conditions:[a[a.length-2],a[a.length-1]]};a.pop(),a.pop(),a.push(o);}break;case "!":if(a.length===0)se.error("Error parsing ink file: Conditional statement is not valid",n);else {let o={type:"union",unionType:"not",condition:a[a.length-1]};a[a.length-1]=o;}break;case "!?":if(a.length>1){let o={type:"union",unionType:"not",condition:{type:"compare",operator:"CONTAINS",leftValue:a[a.length-2],rightValue:a[a.length-1]}};a.pop(),a.pop(),a.push(o);}else se.error("Error parsing ink file: Conditional statement is not valid",n);break;default:if(pm.includes(s))if(a.length<2)se.error("Error parsing ink file: Conditional statement is not valid",n);else {let o={type:"compare",operator:s,rightValue:a[a.length-1],leftValue:a[a.length-2]};a.pop(),a.pop(),a.push(o);}else if(hm.includes(s))if(a.length<2)se.error("Error parsing ink file: Conditional statement is not valid",n);else {s==="L^"&&(s="INTERSECTION");let o={type:"arithmetic",operator:s,rightValue:a[a.length-1],leftValue:a[a.length-2]};a.pop(),a.pop(),a.push(o);}else if(dm.includes(s)){let o={type:"arithmeticsingle",operator:s,leftValue:a[a.length-1]};a.pop(),a.push(o);}else s.startsWith("^")&&a.push(Ut(s));}else if(typeof s=="object"&&"CNT?"in s)if(new RegExp(/.*\.[0-9]\..*/).test(s["CNT?"])){let o=s["CNT?"].split("."),u=o.pop(),l=o.pop();if(l===void 0||u===void 0){se.error("Error parsing ink file: Conditional statement is not valid",n);return}let c=Number(l),h=o.join(".");if(h.includes("^.")){let g=h.split("."),p=g[g.length-1].replaceAll(".","_|_");g.pop(),h=`${g.join(".")}.${p}`,u.includes("c-")&&(h=h+"_|_"+u);}else h=h.replaceAll(".","_|_");let f=Nr(h,e);if(!f)return;a.push({type:"compare",leftValue:kl(f),operator:">=",rightValue:{type:"value",value:c}});}else {let o=Nr(s["CNT?"],e);if(!o)return;a.push(kl(o));}else if(typeof s=="object"&&"VAR?"in s)a.push(er({key:s["VAR?"],defaultType:"storage"},t));else if(typeof s=="object"&&"f()"in s){let o=s["f()"],u=i.find(c=>c.name===o);if(!u){se.error(`Error parsing ink file: Function ${o} is not defined`,n);return}let l=[];for(let c=0;c<u.args;c++)a.length!==0&&l.push(a.pop());a.push({type:"function",functionName:o,args:l.reverse()});}else if(typeof s=="object"&&"^->"in s)s["^->"].includes("$r")||a.push(s["^->"]);else if(typeof s=="object"&&"list"in s){let o=Object.values(s.list).map(u=>u);a.push(o);}else a.push(s);}),a}function Rl(n,e,t,r){return xn(n,e,t,r)}function er(n,e,t){let{key:r,defaultType:i}=n,a=e.indexOf(r);return a>=0?{type:"value",storageType:"params",storageOperationType:"get",key:a}:{type:"value",storageOperationType:"get",storageType:i,key:r}}function Ni(n,e,t){let{key:r,value:i,defaultType:a,artmeticValue:s}=n,o=e.indexOf(r);if(o>=0)return [{type:"value",storageType:"params",storageOperationType:"set",key:o,value:i}];if(s){if(typeof i=="object"&&"list"in i){let u=Object.values(i.list).map(l=>l);return [{type:"value",storageOperationType:"set",storageType:a,key:r,value:u}]}return [{type:"value",storageOperationType:"set",storageType:a,key:r,value:i}]}else if(typeof i=="object"){if("list"in i&&typeof i.list=="object"){if("origins"in i&&Array.isArray(i.origins)&&i.origins.length>0)return i.origins.reduce(u=>(u.push({type:"value",storageOperationType:"set",storageType:a,key:r,value:Object.values(t.enums[r])}),Object.entries(t.enums[r]).forEach(([l,c])=>{u.push({type:"value",storageOperationType:"set",storageType:a,key:`${r}.${l}`,value:c});}),u),[]);{let u=new Set,l=Object.entries(i.list).reduce((c,[h,f])=>{let[g,p]=h.split(".");return c.push({type:"value",storageOperationType:"set",storageType:a,key:p,value:f}),u.add(g),c},[]);return u.forEach(c=>{l.push({type:"value",storageOperationType:"set",storageType:a,key:c,value:Object.values(t.enums[c])});}),r in t.enums?Object.entries(t.enums[r]).forEach(([c,h])=>{l.push({type:"value",storageOperationType:"set",storageType:a,key:`${r}.${c}`,value:h});}):l.push({type:"value",storageOperationType:"set",storageType:a,key:r,value:Object.values(i.list)}),l}}else if(typeof i=="object"&&"VAR?"in i){if(typeof i["VAR?"]=="string"&&i["VAR?"].includes(".")){let[u,l]=i["VAR?"].split(".");if(u in t.enums&&l in t.enums[u])return [{type:"value",storageOperationType:"set",storageType:a,key:r,value:t.enums[u][l]}]}return [{type:"value",storageOperationType:"set",storageType:a,key:r,value:er({key:i["VAR?"],defaultType:"storage"},e)}]}}return [{type:"value",storageOperationType:"set",storageType:a,key:r,value:i}]}function kl(n){return {type:"value",storageType:"label",storageOperationType:"get",label:n}}function $l(n,e){return e||new RegExp(`${"_|_".replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}c-\\d+$`).test(n)?"call":"jump"}function aa(n,e){if(e){if(typeof e=="string")e.startsWith("^")&&n.push(Ut(e));else if(typeof e=="object"&&"type"in e)switch(e.type){case "value":case "function":console.warn("Warning: trying to add a value or function operation as text. This is likely a mistake, so it will be ignored.");break;default:n.push(e);}}}function Vl(n,e,t,r,i,a={}){let{isNewLine:s=true,isHashtagScript:o=false,isThreads:u=false}=a;return i_(n,e,t,r,i,{isNewLine:s,isHashtagScript:o,isThreads:u})}function i_(n,e,t,r,i,a){if(!e)return;let{isNewLine:s,isHashtagScript:o=false,isThreads:u}=a;if(o){if(Array.isArray(e)&&e.length>0){let l={goNextStep:true},c=[];try{if(e.length===1&&typeof e[0]=="string"){let h=e[0],f=pn.convertTagTolist(h),g=pn.convertOperation(f,l,{silent:!0});g&&(g.$origin=h,c.push(g));}}catch{}c.length===0&&c.push({type:"operationtoconvert",values:e}),n.push({...l,operations:c});}}else if(typeof e=="string"&&e.startsWith("^")||e&&typeof e=="object"&&"type"in e&&e.type==="value"&&e.storageOperationType==="get"){if(!s&&n.length>0){let l=n[n.length-1];!l.glueEnabled&&!l.operations&&!l.labelToOpen&&(l.glueEnabled=true,l.labelToOpen||(l.goNextStep=true)),n[n.length-1]=l;}typeof e=="string"?n.push(s_(Ut(e),r.characterIds)):n.push({dialogue:e});}else if(typeof e=="string"){if(e==="end")n.push({end:"game_end"});else if(e==="done")n.push({end:"label_end",goNextStep:true});else if(e==="<>")if(n.length>0){let l=n[n.length-1];l.glueEnabled=true;let c=l.operations!==void 0&&l.dialogue===void 0;l.labelToOpen||(l.goNextStep=c?true:!s),n[n.length-1]=l;}else n.push({glueEnabled:true,goNextStep:true});}else if(typeof e=="object"){if("type"in e)switch(e.type){case "value":e.storageOperationType==="set"?(typeof e.value=="string"&&e.value.startsWith("^")&&(e.value=Ut(e.value)),n.push({goNextStep:true,operations:[e]})):console.warn("Warning: trying to add a value get operation as step. This is likely a mistake, so it will be ignored.");break;case "function":n.push({goNextStep:true,operations:[e]});break;default:if(!s&&n.length>0){let l=n[n.length-1];!l.glueEnabled&&!l.operations&&(l.glueEnabled=true,l.labelToOpen||(l.goNextStep=true)),n[n.length-1]=l;}n.push({conditionalStep:e});}else if("->"in e){let l=s?void 0:true;if(l&&t.includes("c-")&&n.length>0&&n[n.length-1]?.dialogue===void 0&&(l=void 0),!s&&n.length>0){let c=n[n.length-1];c.labelToOpen||(c.goNextStep=true),n[n.length-1]=c;}if(e.params&&e.params.length===0&&delete e.params,e.var)n.push({labelToOpen:{label:er({key:e["->"],defaultType:"storage"},i),type:u?"call":"jump",params:e.params},glueEnabled:l});else {let c=Nr(e["->"],t);if(!c)return;n.push({labelToOpen:{label:c,type:$l(c,u),params:e.params},glueEnabled:l});}}else if("->t->"in e){let l=s?void 0:true;if(l&&t.includes("c-")&&n.length>0&&n[n.length-1]?.dialogue===void 0&&(l=void 0),!s&&n.length>0){let h=n[n.length-1];h.labelToOpen||(h.goNextStep=true),n[n.length-1]=h;}e.params&&e.params.length===0&&delete e.params;let c=Nr(e["->t->"],t);if(!c)return;n.push({labelToOpen:{label:c,type:"call",params:e.params},glueEnabled:l});}}}function s_(n,e){let t;if(n.includes(": ")){let r=n.split(": "),i=r[0],a=r.slice(1).join(": ");(e?.has(i)||characters.RegisteredCharacters.has(i))&&(t=i,n=a);}return t?{dialogue:{character:t,text:n}}:{dialogue:n}}function jl(n,e,t,r=true,i=false){return a_(n,e,t,r,i)}function a_(n,e,t,r,i=false){e&&(typeof e=="string"&&e.startsWith("^")||e&&typeof e=="object"&&"type"in e&&e.type==="value"&&e.storageOperationType==="get"?typeof e=="string"?n.push(Ut(e)):n.push(e):typeof e=="object"&&"type"in e&&n.push(e));}function oa(n,e,t,r){if(n.length===0){se.error("Error parsing ink file: Arithmetic statement is not valid",n);return}let i=xn(n,e,t,r);if(i.length===1){let a=i[0];return a&&typeof a=="object"&&"type"in a?{type:"value",storageType:"logic",storageOperationType:"get",operation:a}:a}}function Fr(n,e,t,r="",i,a,s=void 0){let o=[],u="sequential",l=false,c=true;n.forEach(g=>{g==="%"&&(u="loop"),g==="seq"&&(u="random"),g==="MIN"&&(l=true);});let h=n[n.length-1];return Object.keys(h).forEach(g=>{let p=h[g];if(Array.isArray(p)&&p.length>3){p=p.slice(1,p.length-2);let m=[];Pn(p,r,i,m,e,e,t,Ir,s,true,a),m.length===1?o.push(m[0]):o.push({type:"resulttocombine",combine:"cross",secondConditionalItem:m});}else Array.isArray(p)&&p.length===3&&(c=false);}),u==="sequential"?{type:"stepswitch",elements:o,choiceType:u,end:c?"lastItem":void 0,nestedId:s}:l&&u==="random"?{type:"stepswitch",elements:o,choiceType:"sequentialrandom",end:c?"lastItem":void 0,nestedId:s}:{type:"stepswitch",elements:o,choiceType:u}}function Pn(n,e,t,r=[],i,a,s,o,u=void 0,l=true,c=[]){let h=false,f=[],g=false,p=false,m=false,C=[],b=[];if(t.preDialog[e]&&(l=false,i(r,`^${t.preDialog[e].text}`,e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m}),t.preDialog[e].glue&&i(r,"<>",e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m}),delete t.preDialog[e]),n.includes("visit")){let d=Fr(n,a,s,e,t,c,u);d&&(!l&&r.length>0&&i(r,"<>",e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m}),i(r,d,e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m}));return}let y=n[0];if(y&&typeof y=="object"&&"temp="in y){for(;n[0]&&typeof n[0]=="object"&&"temp="in n[0];)c.push(n[0]["temp="]),n.shift();c=c.reverse();}if(n.forEach((d,_)=>{if(p){if(typeof d=="string"&&d==="/#"){let v=[];Pn(b,e,t,v,jl,jl,s,o,u,l),i(r,v,e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m}),p=false,b=[];}else b.push(d);return}else if(h)if(Array.isArray(d))f.push(d);else if(d&&typeof d=="object")"CNT?"in d?_>0&&n[_-1]==="ev"?(g=true,C.push(d)):g?C.push(d):(f.push(d),l=false):"VAR="in d||"temp="in d?Ni({key:"VAR="in d?d["VAR="]:d["temp="],value:n[_-1],defaultType:"VAR="in d?"storage":"tempstorage"},c,t).forEach(w=>{if(w.value&&typeof w.value=="string"&&w.value==="/str"&&(w.value=n[_-2]),w.value&&typeof w.value=="object"&&"^->"in w.value&&(w.value=w.value["^->"]),f.length>1){let D=oa(f,e,c,t);f=[],D&&typeof D=="object"&&"type"in D&&D.type==="value"&&"storageType"in D&&D.storageType==="logic"&&(w.value=D.operation);}(typeof w.key!="string"||!w.key.includes("$r"))&&(i(r,w,e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m}),l=true);}):"VAR?"in d?f.push(d):"^->"in d?d["^->"].includes("$r")||f.push(d):("f()"in d||"list"in d&&typeof d.list=="object")&&f.push(d);else switch(d){case "/ev":g&&C.push(d),h=false,f.push(d);break;case "out":if(f.length>0){let v=f[f.length-1];if(v&&typeof v=="object"&&"VAR?"in v){f.pop();let w=er({key:v["VAR?"],defaultType:"storage"},c);i(r,w,e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m});}else {let w=[];for(;f.length>0&&f[f.length-1]!=="/ev";)w.push(f.pop());w=w.reverse();let D=oa(w,e,c,t);f=[],D&&typeof D=="object"&&"type"in D&&D.type==="value"&&"storageType"in D&&D.storageType==="logic"?i(r,{storageOperationType:"get",storageType:"logic",operation:D.operation,type:"value"},e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m}):(i(r,"<>",e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m}),D=`^${D}`,i(r,D,e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m}));}l=false;}break;case "pop":{let v=f[f.length-1];if(v&&typeof v=="object"&&"f()"in v){let w=[];for(;f.length>0&&f[f.length-1]!=="/ev";)w.push(f.pop());w=w.reverse();let D=xn(w,e,c,t);f=[],D.forEach(O=>{O&&typeof O=="object"&&"type"in O&&O.type==="function"?i(r,O,e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m}):se.warn("Unhandled case: value is not a function",O);}),l=false;}else f.push(d);return}default:f.push(d);}else if(typeof d=="string")if(d.startsWith("^"))i(r,d,e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m}),l=false;else if(d==="ev")h=true;else if(d===`
|
|
66
|
-
`)l=true;else if(d==="done"||d==="end")i(r,d,e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m}),l=false;else if(d==="<>")i(r,d,e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m}),l=false;else if(d==="nop"&&g){let v=mm(C,a,s,e,t,c,u);v&&i(r,v,e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m}),g=false,C=[];}else d==="#"?p=true:d==="thread"&&(m=true);else if(Array.isArray(d))if(g)C.push(d);else if(d.length>1&&typeof d[d.length-2]=="object"&&d[d.length-2]&&"c"in d[d.length-2]&&typeof d[d.length-1]=="object"&&d[d.length-1]&&"b"in d[d.length-1]){f.pop();let v=[],w=[];for(;f.length>0&&f[f.length-1]!=="/ev";)v.push(f.pop());C=[...C,...v.reverse()],g=true,w.push(d.pop()),w.push(d.pop()),C=[...C,...d],C.push(w);}else if(d.length>1&&typeof d[d.length-1]=="object"&&d[d.length-1]&&"#n"in d[d.length-1]){let v=d.pop();if(!v){se.error("Error parsing ink file: el is undefined");return}let w=v["#n"];delete v["#n"],d.push(v),i(r,{"->":e?e+"_|_"+w:w},e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m}),s({[w]:d},e,t);}else Pn(d,e,t,r,i,a,s,o,u,l,c);else if(d&&typeof d=="object")if("->"in d&&typeof d["->"]=="string"&&!new RegExp(/^\.\^\.\^\.\d\.s$/).test(d["->"])){let v=[];f.length>0&&(v=Rl(["ev",...f],e,c,t)),d.params=v,i(r,d,e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m}),l=false;}else if("->t->"in d&&typeof d["->t->"]=="string"&&!new RegExp(/^\.\^\.\^\.\d\.s$/).test(d["->t->"])){let v=[];f.length>0&&(v=Rl(["ev",...f],e,c,t)),d.params=v,i(r,d,e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m}),l=false;}else if("*"in d&&typeof d["*"]=="string")d["*"].includes("c")&&(f.push(d),l=false);else if("s"in d&&Array.isArray(d.s))f.push(d),l=false;else if("CNT?"in d)f.push(d),l=false;else if("VAR="in d||"temp="in d){let v="VAR="in d?d["VAR="]:d["temp="],w,D=[];if(v!=="$r"){for(f.pop(),f[f.length-1]==="/ev"&&f.pop();f.length>0&&f[f.length-1]!=="/ev";)D.push(f.pop());D=D.reverse(),w=oa(D,e,c,t),f=[],Ni({key:v,value:w,defaultType:"VAR="in d?"storage":"tempstorage",artmeticValue:true},c,t).forEach(P=>{(P.value!==void 0||P.value!==null)&&i(r,P,e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m});}),l=false;}}else s(d,e,t);}),o(f,r,e,t,c),e.includes("_|_")&&r.length===2){let d=r[0],_=r[1];d&&_&&typeof d=="object"&&"dialogue"in d&&typeof _=="object"&&"labelToOpen"in _&&d.dialogue===" "&&_.labelToOpen&&(r.shift(),delete _.glueEnabled,r[0]=_);}}function ql(n,e,t,r,i,a){if(e.length===0)return;let s=xn(e,r,t,i);if(s.length===1){let o={type:"ifelse",condition:s[0],then:n,else:a};return o.else||delete o.else,o}else if(s.length>1){let o={type:"ifelse",condition:{type:"union",unionType:"and",conditions:s},then:n,else:a};return o.else||delete o.else,o}}function mm(n,e,t,r,i,a,s=void 0){if(n.length===0){se.error("Error parsing ink file: Conditional statement is not valid",n);return}let o=[],u=[];if(n.forEach(h=>{Array.isArray(h)?u.push(h):typeof h=="string"&&h==="du"?i.du?o.push(i.du):i.du=o[o.length-1]:(typeof h!="string"||h!=="/ev")&&o.push(h);}),u.length===0){se.error("Error parsing ink file: Conditional statement is not valid",u);return}let l=Ll(u[0],e,t,`${r}${"_|_"}then`,i,a,`${s||""}then`),c;return u.length===2?c=Ll(u[1],e,t,`${r}${"_|_"}else`,i,a,`${s||""}else`):u.length>2?(u.shift(),u.push("nop"),u=[{b:u}],c=Ll(u,e,t,r,i,a,`${s||""}else`)):c=void 0,i.du=void 0,ql(l,o,a,r,i,c)}function Ll(n,e,t,r,i,a,s=void 0){let o=[];for(let l of n)typeof l=="object"&&"b"in l&&(l.b=l.b.filter(c=>c!==null&&!(typeof c=="object"&&"->"in c&&new RegExp(/.*\.[0-9]/).test(c["->"]))),Pn(l.b,r,i,o,e,e,t,Ir,s,true,a));return o.length===1?o[0]:{type:"resulttocombine",combine:"cross",secondConditionalItem:o}}function Bl(n="",e=""){let t=Array.isArray(n)?n:[n],r=Array.isArray(e)?e:[e];return [...new Set([...t,...r])]}function Ir(n,e,t,r,i){if(n.length>0){let a={};gm(n,a,i,r);for(let[s,o]of Object.entries(a)){let u=t+"_|_"+s,l={text:o.text.length===1?o.text[0]:o.text,label:u,props:{},type:$l(u,false),oneTime:o.onetime};o.text.length===0&&(l.onlyHaveNoChoice=true,l.autoSelect=true),l.oneTime===false&&delete l.oneTime;let c=ql(l,o.conditions,i,t,r)||l,h=e[e.length-1];if(typeof h=="object"&&h&&"type"in h&&(h={conditionalStep:h}),e.length>0&&typeof h=="object"&&h&&"choices"in h&&h.choices){let f=h.choices;f&&Array.isArray(f)?f.push(c):se.error("Unhandled case: choices is PixiVNJsonConditionalStatements<PixiVNJsonChoices> | undefined",o,f),h.choices=f.sort((g,p)=>{try{let m=g.label.split("."),C=m[m.length-1].replaceAll(".","_|_"),b=p.label.split("."),y=b[b.length-1].replaceAll(".","_|_");if(C.includes("c-")&&y.includes("c-")){let d=C.split("c-")[1],_=Number(d),v=y.split("c-")[1],w=Number(v);return _-w}}catch{}return 0});}else e.push({choices:[c]});o.preDialog&&(r.preDialog[u]={...o.preDialog});}}}function gm(n,e,t,r,i){let a=[],s="",o="",u=false,l=[];for(let c=0;c<n.length;c++){let h=n[c];if(typeof h=="string")h.startsWith("^")?a.push(Ut(h)):cm.includes(h)&&l.push(h);else if(Array.isArray(h)&&h.includes("visit")){let f=Fr(h,aa,(g,p,m)=>{},i,r,t);a.push(f);}else if(h&&typeof h=="object")if("*"in h&&typeof h["*"]&&typeof h["*"]=="string")h["*"].includes("c")&&(s=`c${h["*"].split("c")[1]}`,h.flg&16&&(u=true));else if("s"in h&&Array.isArray(h.s)){let f=ym(h.s),g=h.s.includes("<>");f&&(i&&e[i]?(e[i].preDialog={text:f,glue:g},e[i].text=Bl(f,e[i].text)):(a.push(f),o=f));}else ("CNT?"in h||"VAR?"in h)&&l.push(h);else l.push(h);if(s){e[s]?e[s].text=Bl(a,e[s].text):e[s]={text:a,onetime:u,conditions:l},o&&(e[s].preDialog={text:o,glue:false});let f=n.slice(c+1);gm(f,e,t,r,s);return}}}function ym(n){for(let e of n)if(typeof e=="string"){if(e.startsWith("^"))return Ut(e)}else if(Array.isArray(e)){let t=ym(e);if(t)return t}}var Ml;(i=>{function n(a,s={}){let{labelToRemove:o=[],initialVarsToRemove:u=[],enums:l={},functions:c=[],preDialog:h={},characterIds:f}=s,g={$schema:sa};if(g.labels=e(a.root,{labelToRemove:o,initialVarsToRemove:u,enums:l,functions:c,preDialog:h,characterIds:f}),g.labels&&ta in g.labels){let p=g.labels[ta];delete g.labels[ta],p.forEach(m=>{m.operations&&(g.initialOperations=g.initialOperations?[...g.initialOperations,...m.operations]:[...m.operations]);});}if(g.labels&&Yn in g.labels){let p=g.labels[Yn];delete g.labels[Yn],p.forEach(m=>{m.operations&&(g.initialOperations=g.initialOperations?[...g.initialOperations,...m.operations]:[...m.operations]);});}return o.forEach(p=>{g.labels&&p in g.labels&&delete g.labels[p];}),u.forEach(p=>{g.initialOperations&&(g.initialOperations=g.initialOperations.filter(m=>!(m.type==="value"&&m.key===p)));}),g}i.inkToJson=n;function e(a,s){try{let o={};return t(a,o,s),o}catch(o){se.error("Error parsing ink file",o);}}function t(a,s,o){for(let u of a)if(u)if(Array.isArray(u))if(u.includes("visit")){let l=Fr(u,aa,(c,h,f)=>{},"",o,[]);l&&(o.externalSwitch=l);}else t(u,s,o);else typeof u=="object"&&(u&&"VAR="in u&&o.externalSwitch&&(s[Yn]||(s[Yn]=[]),s[Yn].push({operations:Ni({defaultType:"storage",key:u["VAR="],value:o.externalSwitch},[],o)})),r(u,s,"",o));}function r(a,s,o="",u){if(a!==null){for(let[l,c]of Object.entries(a))if(Array.isArray(c)){let h=[],f={},g=(o?o+"_|_":"")+l;Pn(c,g,u,h,Vl,Vl,(p,m,C)=>{r(p,f,m,C);},Ir);for(let[p,m]of Object.entries(f))s[p]=m;h.length>0&&(s[g]=h);}}}})(Ml||={});var Pp=An(Uy()),SC=An(wv()),EC=An(yC()),wC=An(pr()),eF=/(?:^|<>)\s*#\s*([^\r\n]+)/g,tF=/^=+[ \t]+(?:function[ \t]+)?(\w+)/gm,nF=new Set(["DONE","END"]),rF="_|_",vC=new Map;function AC(n,e){let t=JSON.stringify([e,n]),r=vC.get(t);if(r)return r;let i=new RegExp(n,e);return vC.set(t,i),i}function zs(n,e){if(!e||typeof e!="object")return false;let t=e,r=t.anyOf;if(Array.isArray(r))return r.some(s=>zs(n,s));let i=t.oneOf;if(Array.isArray(i))return i.some(s=>zs(n,s));let a=t.allOf;if(Array.isArray(a))return a.every(s=>zs(n,s));if(typeof t.const=="string")return n===t.const;if(Array.isArray(t.enum))return t.enum.some(s=>typeof s=="string"&&s===n);if(t.type!=="string"||typeof t.minLength=="number"&&n.length<t.minLength||typeof t.maxLength=="number"&&n.length>t.maxLength)return false;if(typeof t.pattern=="string")try{if(!AC(t.pattern,"").test(n))return !1}catch{return false}return true}function dl(n,e){if(!e||typeof e!="object")return false;let t=e,r=t.anyOf;if(Array.isArray(r))return r.some(o=>dl(n,o));let i=t.oneOf;if(Array.isArray(i))return i.some(o=>dl(n,o));let a=t.allOf;if(Array.isArray(a))return a.every(o=>dl(n,o));if(t.type!=="array"||typeof t.minItems=="number"&&n.length<t.minItems||typeof t.maxItems=="number"&&n.length>t.maxItems)return false;let s=Array.isArray(t.prefixItems)?t.prefixItems:[];if(n.length<s.length)return false;for(let o=0;o<s.length;o++)if(!zs(n[o],s[o]))return false;return n.length===s.length?true:t.items===false||typeof t.items>"u"?false:t.items===true?true:n.slice(s.length).every(o=>zs(o,t.items))}function Ap(n,e){if(e.type==="regexp")try{let t=AC(e.source,e.flags);return t.lastIndex=0,t.test(n.join(" "))}catch{return false}return e.type==="literal"?n.join(" ")===e.value:dl(n,e.schema)}function fl(n){if(!n||typeof n!="object")return [];let e=n;if(Array.isArray(e.anyOf))return e.anyOf.flatMap(fl);if(Array.isArray(e.oneOf))return e.oneOf.flatMap(fl);if(Array.isArray(e.allOf)){let t={};for(let r of e.allOf)r&&typeof r=="object"&&Object.assign(t,r);return fl(t)}return e.type==="array"&&Array.isArray(e.prefixItems)?[e]:[]}function CC(n,e){if(n===e)return 1;let t=Math.max(n.length,e.length);return t===0?1:Math.max(0,1-DC(n,e)/t)}function iF(n,e){if(e&&typeof e=="object"){let t=e;if(typeof t.const=="string")return {weight:2,matched:n===void 0?0:2*CC(n,t.const)};if(Array.isArray(t.enum))return {weight:2,matched:2*(n===void 0?0:Math.max(0,...t.enum.filter(i=>typeof i=="string").map(i=>CC(n,i))))}}return {weight:1,matched:n===void 0?0:1}}function sF(n,e){let t=Array.isArray(e.prefixItems)?e.prefixItems:[],r=Math.min(t.length,n.length),i=0,a=0,s=false;for(let o=0;o<r;o++){let u=iF(n[o],t[o]);i+=u.weight,a+=u.matched,u.weight>1&&(s=true);}return {score:i===0?0:a/i,hasDiscriminant:s}}var aF=.8,bC=new Map;function oF(n){let e=JSON.stringify(n),t=bC.get(e);if(t)return t;let r=new SC.default({strict:false,allErrors:true}).compile(n);return bC.set(e,r),r}function uF(n){if("items"in n)return n;let e=Array.isArray(n.prefixItems)?n.prefixItems.length:0;return {...n,minItems:e,maxItems:e,items:false}}function lF(n,e){let[t]=yl(n.instancePath);if(t!==void 0&&/^\d+$/.test(t)){let r=Number(t);if(r<e.length)return e[r]}return Op(n)}function cF(n){return n.keyword==="const"?`must be "${n.params.allowedValue}"`:n.keyword==="enum"?`must be one of ${(n.params.allowedValues??[]).map(t=>`"${t}"`).join(", ")}`:n.message??"invalid value"}function Dp(n){let e=n.split(/\r?\n/),t=[];for(let r=0;r<e.length;r++){let i=e[r];for(let a of i.matchAll(eF)){let s=(a[1]??"").trim();if(!s)continue;let o=pn.convertTagTolist(s,{mergeInkVariables:true});o.length!==0&&t.push({line:r+1,command:s,tokens:o});}}return t}function Op(n){return n.keyword==="required"&&typeof n.params?.missingProperty=="string"?n.params.missingProperty:n.keyword==="additionalProperties"&&typeof n.params?.additionalProperty=="string"?n.params.additionalProperty:n.instancePath.split("/").pop()||"(root)"}function DC(n,e){let t=n.length+1,r=e.length+1,i=Array.from({length:t},(a,s)=>[s,...Array(r-1).fill(0)]);for(let a=1;a<r;a++)i[0][a]=a;for(let a=1;a<t;a++)for(let s=1;s<r;s++){let o=n[a-1]===e[s-1]?0:1;i[a][s]=Math.min(i[a-1][s]+1,i[a][s-1]+1,i[a-1][s-1]+o);}return i[t-1][r-1]}function hF(n,e){let t,r=1/0;for(let a of e){let s=DC(n,a);s<r&&(r=s,t=a);}let i=Math.max(1,Math.floor(n.length/3));return r<=i?t:void 0}function dF(n,e){if(n.keyword==="additionalProperties"&&typeof n.params?.additionalProperty=="string"){let t=n.params.additionalProperty,r=e&&hF(t,e),i=r?` (did you mean "${r}"?)`:"";return `has an unrecognised property "${t}"${i}`}return n.message??"invalid value"}function yl(n){return n.split("/").filter(Boolean).map(e=>e.replace(/~1/g,"/").replace(/~0/g,"~"))}function fF(n,e){let t=n,r,i=a=>{a&&typeof a=="object"&&typeof a.$origin=="string"&&(r=a.$origin);};i(t);for(let a of yl(e)){if(t===null||typeof t!="object")break;t=t[a],i(t);}return r}function pF(n,e){let t=yl(e);for(let r=t.length;r>=0;r--){let i=t.slice(0,r),a=n;for(let s of i){if(a===null||typeof a!="object"){a=void 0;break}a=a[s];}if(a&&typeof a=="object"&&!Array.isArray(a)&&typeof a.type=="string")return {path:`/${i.map(o=>o.replace(/~/g,"~0").replace(/\//g,"~1")).join("/")}`,node:a}}}function ml(n,e,t=new Set){if(!n||typeof n!="object")return n;let r=n.$ref;if(typeof r!="string")return n;let i=r.match(/^#\/definitions\/([^/]+)$/);return !i?.[1]||t.has(i[1])||!(i[1]in e)?{}:(t.add(i[1]),ml(e[i[1]],e,t))}function gl(n,e){let t=ml(n,e);if(!t||typeof t!="object")return;let r=t;if(!(r.anyOf||r.oneOf)){if(Array.isArray(r.allOf)){let i={properties:{},required:[]};for(let a of r.allOf){let s=gl(a,e);if(!s)return;Object.assign(i.properties,s.properties),i.required.push(...s.required);}return i}return {properties:r.properties??{},required:r.required??[]}}}function _C(n,e){if(!n||typeof n!="object")return true;let t=n;return "const"in t?t.const===e:Array.isArray(t.enum)?t.enum.includes(e):true}function mF(n,e){let t=n.definitions??{},r=[];for(let[i,a]of Object.entries(t)){let s=gl(a,t);if(!s)continue;let o=s.properties.type;o&&typeof o=="object"&&("const"in o||Array.isArray(o.enum))&&_C(o,e.type)&&_C(s.properties.operationType,e.operationType)&&r.push(i);}return r}function gF(n,e,t){let r=n.definitions??{},i={definitions:r,...r[e]},a=new Pp.default({strict:false,allErrors:true}).compile(i);return a(t)?[]:a.errors??[]}function yF(n,e,t){let r=n.definitions??{},i=ml(r[e],r);for(let a of yl(t)){let o=gl(i,r)?.properties[a];if(o===void 0)return [];i=ml(o,r);}return Object.keys(gl(i,r)?.properties??{})}function pl(n){let e=n.map(o=>o.instancePath),t=o=>e.some(u=>u!==o&&u.startsWith(`${o}/`)),r=n.filter(o=>!t(o.instancePath)),i=new Map;for(let o of r){let u=i.get(o.instancePath)??[];u.push(o),i.set(o.instancePath,u);}let a=[];for(let o of i.values()){let u=o.filter(l=>l.keyword!=="anyOf"&&l.keyword!=="oneOf");a.push(...u.length>0?u:o);}let s=new Set;return a.filter(o=>{let u=`${Op(o)}|${o.message}`;return s.has(u)?false:(s.add(u),true)})}function xp(n,e,t){return n.map(r=>({instancePath:r.instancePath||"(root)",element:Op(r),message:dF(r,t?.(r)),origin:fF(e,r.instancePath)}))}function vF(n,e,t){let r=n.map(c=>c.instancePath),i=c=>r.some(h=>h!==c&&h.startsWith(`${c}/`)),a=n.filter(c=>!i(c.instancePath)),s=t&&typeof t=="object"?t:void 0,o=new Map,u=[];for(let c of a){let h=s?pF(e,c.instancePath):void 0;if(!h){u.push(c);continue}let f=o.get(h.path);f?f.errors.push(c):o.set(h.path,{node:h.node,errors:[c]});}let l=xp(pl(u),e);for(let[c,h]of o){let f=s?mF(s,h.node):[],g=f.length===1?f[0]:void 0;if(!g||!s){l.push(...xp(pl(h.errors),e));continue}let m=pl(gF(s,g,h.node)).map(C=>({...C,instancePath:`${c}${C.instancePath}`}));l.push(...xp(m,e,C=>yF(s,g,C.instancePath.slice(c.length))));}return l}var Ht;(h=>{function n(f,g={labelToRemove:[],initialVarsToRemove:[],functions:[],enums:{}}){let p=[];try{return {json:new EC.Compiler(f,{errorHandler:(y,d)=>{let _=y.replace(/^[A-Z]+: line \d+: ?/,""),v=y.match(/line (\d+)/);p.push({message:_,type:d,line:v?Number(v[1]):-1});},countAllVisits:!0,fileHandler:{ResolveInkFilename:y=>y,LoadInkFileContents:()=>""},pluginNames:[],sourceFilename:null}).Compile().ToJson()||"",issues:p}}catch{let C=false,b={...g,textSource:f};return e(p,()=>{C=true;},b),C?n(b.textSource,g):{issues:p}}}h.compile=n;function e(f,g,p){let{functions:m,initialVarsToRemove:C,labelToRemove:b}=p,y=f.find(d=>d.type===wC.ErrorType.Error);if(y){if(y.message.includes("Divert target not found")){let d=y.message.match(/Divert target not found: '-> (\w+)'/);if(d?.[1]){let _=d[1],v=`
|
|
64
|
+
`+C+"]";}return i.pop(),a=C,y}},Zb={parse:Jb,stringify:Qb},e_=Zb,Ti=e_;var im="\xA7SPACE\xA7",sm="\xA7DOUBLE_QUOTES\xA7",am="\xA7QUOTES\xA7",om="SPECIAL_\xA7QUOTES\xA7",um="\xA7CURLY_BRACKETS1\xA7",t_="\xA7INK_VAR\xA7",lm="\xA7CURLY_BRACKETS2\xA7",pn;(y=>{let n=[],e=[];async function t(d,_){for(let v=0;v<n.length;v++)try{let{validation:w}=n[v].opts;if(w instanceof RegExp){if(!w.test(d.join(" ")))continue}else if(w instanceof zod.ZodType&&!w.safeParse(d).success)continue;let D=await n[v].fn(d,_,h);if(D===!0||typeof D=="string")return D}catch{}return false}function r(d,_={name:"custom-command",validation:/^/}){n.unshift({fn:d,opts:_});}y.add=r;function i(){return [...e.map(d=>d.opts),...n.map(d=>d.opts)]}y.info=i;function a(d,_){e.unshift({fn:d,opts:_});}y.addMapper=a;function s(){n.length=0;}y.clear=s;function o(){e.length=0;}y.clearMappers=o;async function u(d,_,v){try{let w=l(d),D=await t(w,v);return D===!0?void 0:typeof D=="string"?(D.startsWith("#")&&(D=D.substring(1)),await y.run(D,_,v)):c(w,_)}catch(w){throw ae.error("Error parsing ink hashtag-command",d),w}}y.run=u;function l(d,_){if(d=d.replaceAll('\\"',sm),d=d.replaceAll("\\'",am),d=d.replaceAll("\\`",om),d=d.replaceAll("\\{",um),d=d.replaceAll("\\}",lm),_?.mergeInkVariables){let O;do O=d,d=d.replace(/\{[^{}:]*\}/g,t_);while(d!==O)}d=d.replaceAll("{"," { "),d=d.replaceAll("}"," } "),d=d.replaceAll(um,"{"),d=d.replaceAll(lm,"}");let v=[],w,D="";for(let O=0;O<d.length;O++){let P=d[O];P==='"'||P==="'"||P==="`"?w===void 0?(v.push(D),D="",w=P,D+=P):w===P?(w=void 0,D+=P,v.push(D),D=""):D+=P:D+=P;}return D!==""&&v.push(D),v.forEach((O,P)=>{P%2===1&&(v[P]=O.replaceAll(" ",im));}),d=v.join(""),v=d.split(" ").filter(O=>O!==""),v=v.map(O=>O.replaceAll(im," ").replaceAll(sm,'"').replaceAll(am,"'").replaceAll(om,"`")),v=p(v),v=v.flatMap(O=>b(O)),v=v.map(O=>O.startsWith('"')&&O.endsWith('"')||O.startsWith("'")&&O.endsWith("'")||O.startsWith("`")&&O.endsWith("`")?O.slice(1,-1):O),v}y.convertTagTolist=l;function c(d,_,v){for(let w of e){let{validation:D}=w.opts,O=false;if(D instanceof RegExp?O=D.test(d.join(" ")):D instanceof zod.ZodType&&(O=D.safeParse(d).success),O)return w.fn(d,_)}v?.silent||ae.error("The operation is not valid",d);}y.convertOperation=c;function h(d){if(d.length===0)return {};if(d.length%2!==0)throw ae.error("The props list must have a pair number of elements",d),new Error("The props list must have a pair number of elements");let _="{";d.forEach((v,w)=>{if(w%2===0)_+=`"${v}": `;else {switch(v){case "null":case "undefined":case "true":case "false":_+=`${v}`;break;default:g(v)?(v=f(v),_+=`"${v}"`):v.startsWith("{")&&v.endsWith("}")?_+=`${v}`:v.startsWith('"')&&v.endsWith('"')?_+=`${v}`:Number.isNaN(parseFloat(v))?_+=`"${v}"`:_+=`${v}`;}w<d.length-1&&(_+=", ");}}),_+="}";try{return Ti.parse(_)}catch(v){throw ae.error("Error parsing ink json",_),v}}y.convertListStringToObj=h;function f(d){return d.startsWith('"')&&d.endsWith('"')||d.startsWith("'")&&d.endsWith("'")||d.startsWith("`")&&d.endsWith("`")?d.substring(1,d.length-1):d}function g(d){return !!(d.startsWith('"')&&d.endsWith('"')||d.startsWith("'")&&d.endsWith("'")||d.startsWith("`")&&d.endsWith("`"))}function p(d){return m(d).tokens}y.mergeJsonBlocks=p;function m(d){let _=[],v=false;for(let w=0;w<d.length;w++){let D=d[w];if(D!=="{"){_.push(D);continue}let O=C(d,w);if(O===-1){_.push(D);continue}let P=m(d.slice(w+1,O)),E=["{",...P.tokens,"}"],F=E.join(" ");if(!P.hasInvalidMatchedBlock)try{Ti.parse(F),_.push(F),w=O;continue}catch{}v=true,_.push(...E),w=O;}return {tokens:_,hasInvalidMatchedBlock:v}}function C(d,_){let v=0;for(let w=_;w<d.length;w++)if(d[w]==="{")v++;else if(d[w]==="}"&&(v--,v===0))return w;return -1}function b(d){if(d==="["||d==="]")return [d];let _=0,v=d.length,w=[];for(;_<v&&d[_]==="[";)w.push("["),_++;let D=[];for(;v>_&&d[v-1]==="]";)D.unshift("]"),v--;let O=d.slice(_,v);return O===""?[...w,...D]:[...w,O,...D]}})(pn||={});var cm=["+","-","/","*","%","_","==",">","<",">=","<=","!=","!","&&","||","MIN","MAX"],hm=["+","-","/","*","%","POW","RANDOM","L^"],dm=["INT","FLOOR","FLOAT"];function Nr(n,e){if(n.endsWith(".s"))return;if(new RegExp(/.*\.[0-9]+\..*$/).test(n)&&(n=n.split(".").filter(i=>!i.match(/^[0-9]+$/)).join("."),!n.startsWith(".")))return n.replaceAll(".","_|_");if(!new RegExp(/^\.\^.*$/).test(n)&&n.includes("g-")){let r=n.split("g-");return Il(e)+"_|_"+"g-"+r[r.length-1]}let t=0;for(;new RegExp(/^\.\^.*$/).test(n);)t++,n=n.substring(2);if(t=t-1,new RegExp(/^\..*$/).test(n)&&e){let r=n.substring(1);return Il(e,t)+"_|_"+r.replaceAll(".","_|_")}return n.replaceAll(".","_|_")||Il(e,t).replaceAll(".","_|_")}function Il(n,e=0){let t=n.split("_|_");for(;t.length>1&&e>0;)t.pop()?.includes("g-")&&e--,e--;return t.join("_|_")}var fm="\xA7DOUBLE_SLASH_CONVERTOR\xA7";function Ut(n){return n.startsWith("^")&&(n=n.substring(1)),n=n.replaceAll("\\\\",fm),n=n.replaceAll("\\n",`
|
|
65
|
+
`),n=n.replaceAll("\\t"," "),n=n.replaceAll(" "," "),n=n.replaceAll(fm,"\\\\"),n}var n_={version:"1.14.0"};var sa=`https://pixi-vn.com/schemas/${n_.version}/schema.json`,pm=["==","!=","<","<=",">",">=","CONTAINS"];function xn(n,e,t,r){let{functions:i}=r;n=n.map(s=>{if(typeof s=="string")switch(s){case "rnd":return "RANDOM";case "?":return "CONTAINS"}return s});let a=[];return n.forEach(s=>{if(typeof s=="string")switch(s){case "&&":case "||":if(a.length>=2){let o={type:"union",unionType:s==="&&"?"and":"or",conditions:[a[a.length-2],a[a.length-1]]};a.pop(),a.pop(),a.push(o);}break;case "!":if(a.length===0)ae.error("Error parsing ink file: Conditional statement is not valid",n);else {let o={type:"union",unionType:"not",condition:a[a.length-1]};a[a.length-1]=o;}break;case "!?":if(a.length>1){let o={type:"union",unionType:"not",condition:{type:"compare",operator:"CONTAINS",leftValue:a[a.length-2],rightValue:a[a.length-1]}};a.pop(),a.pop(),a.push(o);}else ae.error("Error parsing ink file: Conditional statement is not valid",n);break;default:if(pm.includes(s))if(a.length<2)ae.error("Error parsing ink file: Conditional statement is not valid",n);else {let o={type:"compare",operator:s,rightValue:a[a.length-1],leftValue:a[a.length-2]};a.pop(),a.pop(),a.push(o);}else if(hm.includes(s))if(a.length<2)ae.error("Error parsing ink file: Conditional statement is not valid",n);else {s==="L^"&&(s="INTERSECTION");let o={type:"arithmetic",operator:s,rightValue:a[a.length-1],leftValue:a[a.length-2]};a.pop(),a.pop(),a.push(o);}else if(dm.includes(s)){let o={type:"arithmeticsingle",operator:s,leftValue:a[a.length-1]};a.pop(),a.push(o);}else s.startsWith("^")&&a.push(Ut(s));}else if(typeof s=="object"&&"CNT?"in s)if(new RegExp(/.*\.[0-9]\..*/).test(s["CNT?"])){let o=s["CNT?"].split("."),u=o.pop(),l=o.pop();if(l===void 0||u===void 0){ae.error("Error parsing ink file: Conditional statement is not valid",n);return}let c=Number(l),h=o.join(".");if(h.includes("^.")){let g=h.split("."),p=g[g.length-1].replaceAll(".","_|_");g.pop(),h=`${g.join(".")}.${p}`,u.includes("c-")&&(h=h+"_|_"+u);}else h=h.replaceAll(".","_|_");let f=Nr(h,e);if(!f)return;a.push({type:"compare",leftValue:kl(f),operator:">=",rightValue:{type:"value",value:c}});}else {let o=Nr(s["CNT?"],e);if(!o)return;a.push(kl(o));}else if(typeof s=="object"&&"VAR?"in s)a.push(er({key:s["VAR?"],defaultType:"storage"},t));else if(typeof s=="object"&&"f()"in s){let o=s["f()"],u=i.find(c=>c.name===o);if(!u){ae.error(`Error parsing ink file: Function ${o} is not defined`,n);return}let l=[];for(let c=0;c<u.args;c++)a.length!==0&&l.push(a.pop());a.push({type:"function",functionName:o,args:l.reverse()});}else if(typeof s=="object"&&"^->"in s)s["^->"].includes("$r")||a.push(s["^->"]);else if(typeof s=="object"&&"list"in s){let o=Object.values(s.list).map(u=>u);a.push(o);}else a.push(s);}),a}function Rl(n,e,t,r){return xn(n,e,t,r)}function er(n,e,t){let{key:r,defaultType:i}=n,a=e.indexOf(r);return a>=0?{type:"value",storageType:"params",storageOperationType:"get",key:a}:{type:"value",storageOperationType:"get",storageType:i,key:r}}function Ni(n,e,t){let{key:r,value:i,defaultType:a,artmeticValue:s}=n,o=e.indexOf(r);if(o>=0)return [{type:"value",storageType:"params",storageOperationType:"set",key:o,value:i}];if(s){if(typeof i=="object"&&"list"in i){let u=Object.values(i.list).map(l=>l);return [{type:"value",storageOperationType:"set",storageType:a,key:r,value:u}]}return [{type:"value",storageOperationType:"set",storageType:a,key:r,value:i}]}else if(typeof i=="object"){if("list"in i&&typeof i.list=="object"){if("origins"in i&&Array.isArray(i.origins)&&i.origins.length>0)return i.origins.reduce(u=>(u.push({type:"value",storageOperationType:"set",storageType:a,key:r,value:Object.values(t.enums[r])}),Object.entries(t.enums[r]).forEach(([l,c])=>{u.push({type:"value",storageOperationType:"set",storageType:a,key:`${r}.${l}`,value:c});}),u),[]);{let u=new Set,l=Object.entries(i.list).reduce((c,[h,f])=>{let[g,p]=h.split(".");return c.push({type:"value",storageOperationType:"set",storageType:a,key:p,value:f}),u.add(g),c},[]);return u.forEach(c=>{l.push({type:"value",storageOperationType:"set",storageType:a,key:c,value:Object.values(t.enums[c])});}),r in t.enums?Object.entries(t.enums[r]).forEach(([c,h])=>{l.push({type:"value",storageOperationType:"set",storageType:a,key:`${r}.${c}`,value:h});}):l.push({type:"value",storageOperationType:"set",storageType:a,key:r,value:Object.values(i.list)}),l}}else if(typeof i=="object"&&"VAR?"in i){if(typeof i["VAR?"]=="string"&&i["VAR?"].includes(".")){let[u,l]=i["VAR?"].split(".");if(u in t.enums&&l in t.enums[u])return [{type:"value",storageOperationType:"set",storageType:a,key:r,value:t.enums[u][l]}]}return [{type:"value",storageOperationType:"set",storageType:a,key:r,value:er({key:i["VAR?"],defaultType:"storage"},e)}]}}return [{type:"value",storageOperationType:"set",storageType:a,key:r,value:i}]}function kl(n){return {type:"value",storageType:"label",storageOperationType:"get",label:n}}function $l(n,e){return e||new RegExp(`${"_|_".replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}c-\\d+$`).test(n)?"call":"jump"}function aa(n,e){if(e){if(typeof e=="string")e.startsWith("^")&&n.push(Ut(e));else if(typeof e=="object"&&"type"in e)switch(e.type){case "value":case "function":console.warn("Warning: trying to add a value or function operation as text. This is likely a mistake, so it will be ignored.");break;default:n.push(e);}}}function Vl(n,e,t,r,i,a={}){let{isNewLine:s=true,isHashtagScript:o=false,isThreads:u=false}=a;return i_(n,e,t,r,i,{isNewLine:s,isHashtagScript:o,isThreads:u})}function i_(n,e,t,r,i,a){if(!e)return;let{isNewLine:s,isHashtagScript:o=false,isThreads:u}=a;if(o){if(Array.isArray(e)&&e.length>0){let l={goNextStep:true},c=[];try{if(e.length===1&&typeof e[0]=="string"){let h=e[0],f=pn.convertTagTolist(h),g=pn.convertOperation(f,l,{silent:!0});g&&(g.$origin=h,c.push(g));}}catch{}c.length===0&&c.push({type:"operationtoconvert",values:e}),n.push({...l,operations:c});}}else if(typeof e=="string"&&e.startsWith("^")||e&&typeof e=="object"&&"type"in e&&e.type==="value"&&e.storageOperationType==="get"){if(!s&&n.length>0){let l=n[n.length-1];!l.glueEnabled&&!l.operations&&!l.labelToOpen&&(l.glueEnabled=true,l.labelToOpen||(l.goNextStep=true)),n[n.length-1]=l;}typeof e=="string"?n.push(s_(Ut(e),r.characterIds)):n.push({dialogue:e});}else if(typeof e=="string"){if(e==="end")n.push({end:"game_end"});else if(e==="done")n.push({end:"label_end",goNextStep:true});else if(e==="<>")if(n.length>0){let l=n[n.length-1];l.glueEnabled=true;let c=l.operations!==void 0&&l.dialogue===void 0;l.labelToOpen||(l.goNextStep=c?true:!s),n[n.length-1]=l;}else n.push({glueEnabled:true,goNextStep:true});}else if(typeof e=="object"){if("type"in e)switch(e.type){case "value":e.storageOperationType==="set"?(typeof e.value=="string"&&e.value.startsWith("^")&&(e.value=Ut(e.value)),n.push({goNextStep:true,operations:[e]})):console.warn("Warning: trying to add a value get operation as step. This is likely a mistake, so it will be ignored.");break;case "function":n.push({goNextStep:true,operations:[e]});break;default:if(!s&&n.length>0){let l=n[n.length-1];!l.glueEnabled&&!l.operations&&(l.glueEnabled=true,l.labelToOpen||(l.goNextStep=true)),n[n.length-1]=l;}n.push({conditionalStep:e});}else if("->"in e){let l=s?void 0:true;if(l&&t.includes("c-")&&n.length>0&&n[n.length-1]?.dialogue===void 0&&(l=void 0),!s&&n.length>0){let c=n[n.length-1];c.labelToOpen||(c.goNextStep=true),n[n.length-1]=c;}if(e.params&&e.params.length===0&&delete e.params,e.var)n.push({labelToOpen:{label:er({key:e["->"],defaultType:"storage"},i),type:u?"call":"jump",params:e.params},glueEnabled:l});else {let c=Nr(e["->"],t);if(!c)return;n.push({labelToOpen:{label:c,type:$l(c,u),params:e.params},glueEnabled:l});}}else if("->t->"in e){let l=s?void 0:true;if(l&&t.includes("c-")&&n.length>0&&n[n.length-1]?.dialogue===void 0&&(l=void 0),!s&&n.length>0){let h=n[n.length-1];h.labelToOpen||(h.goNextStep=true),n[n.length-1]=h;}e.params&&e.params.length===0&&delete e.params;let c=Nr(e["->t->"],t);if(!c)return;n.push({labelToOpen:{label:c,type:"call",params:e.params},glueEnabled:l});}}}function s_(n,e){let t;if(n.includes(": ")){let r=n.split(": "),i=r[0],a=r.slice(1).join(": ");(e?.has(i)||characters.RegisteredCharacters.has(i))&&(t=i,n=a);}return t?{dialogue:{character:t,text:n}}:{dialogue:n}}function jl(n,e,t,r=true,i=false){return a_(n,e,t,r,i)}function a_(n,e,t,r,i=false){e&&(typeof e=="string"&&e.startsWith("^")||e&&typeof e=="object"&&"type"in e&&e.type==="value"&&e.storageOperationType==="get"?typeof e=="string"?n.push(Ut(e)):n.push(e):typeof e=="object"&&"type"in e&&n.push(e));}function oa(n,e,t,r){if(n.length===0){ae.error("Error parsing ink file: Arithmetic statement is not valid",n);return}let i=xn(n,e,t,r);if(i.length===1){let a=i[0];return a&&typeof a=="object"&&"type"in a?{type:"value",storageType:"logic",storageOperationType:"get",operation:a}:a}}function Fr(n,e,t,r="",i,a,s=void 0){let o=[],u="sequential",l=false,c=true;n.forEach(g=>{g==="%"&&(u="loop"),g==="seq"&&(u="random"),g==="MIN"&&(l=true);});let h=n[n.length-1];return Object.keys(h).forEach(g=>{let p=h[g];if(Array.isArray(p)&&p.length>3){p=p.slice(1,p.length-2);let m=[];Pn(p,r,i,m,e,e,t,Ir,s,true,a),m.length===1?o.push(m[0]):o.push({type:"resulttocombine",combine:"cross",secondConditionalItem:m});}else Array.isArray(p)&&p.length===3&&(c=false);}),u==="sequential"?{type:"stepswitch",elements:o,choiceType:u,end:c?"lastItem":void 0,nestedId:s}:l&&u==="random"?{type:"stepswitch",elements:o,choiceType:"sequentialrandom",end:c?"lastItem":void 0,nestedId:s}:{type:"stepswitch",elements:o,choiceType:u}}function Pn(n,e,t,r=[],i,a,s,o,u=void 0,l=true,c=[]){let h=false,f=[],g=false,p=false,m=false,C=[],b=[];if(t.preDialog[e]&&(l=false,i(r,`^${t.preDialog[e].text}`,e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m}),t.preDialog[e].glue&&i(r,"<>",e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m}),delete t.preDialog[e]),n.includes("visit")){let d=Fr(n,a,s,e,t,c,u);d&&(!l&&r.length>0&&i(r,"<>",e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m}),i(r,d,e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m}));return}let y=n[0];if(y&&typeof y=="object"&&"temp="in y){for(;n[0]&&typeof n[0]=="object"&&"temp="in n[0];)c.push(n[0]["temp="]),n.shift();c=c.reverse();}if(n.forEach((d,_)=>{if(p){if(typeof d=="string"&&d==="/#"){let v=[];Pn(b,e,t,v,jl,jl,s,o,u,l),i(r,v,e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m}),p=false,b=[];}else b.push(d);return}else if(h)if(Array.isArray(d))f.push(d);else if(d&&typeof d=="object")"CNT?"in d?_>0&&n[_-1]==="ev"?(g=true,C.push(d)):g?C.push(d):(f.push(d),l=false):"VAR="in d||"temp="in d?Ni({key:"VAR="in d?d["VAR="]:d["temp="],value:n[_-1],defaultType:"VAR="in d?"storage":"tempstorage"},c,t).forEach(w=>{if(w.value&&typeof w.value=="string"&&w.value==="/str"&&(w.value=n[_-2]),w.value&&typeof w.value=="object"&&"^->"in w.value&&(w.value=w.value["^->"]),f.length>1){let D=oa(f,e,c,t);f=[],D&&typeof D=="object"&&"type"in D&&D.type==="value"&&"storageType"in D&&D.storageType==="logic"&&(w.value=D.operation);}(typeof w.key!="string"||!w.key.includes("$r"))&&(i(r,w,e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m}),l=true);}):"VAR?"in d?f.push(d):"^->"in d?d["^->"].includes("$r")||f.push(d):("f()"in d||"list"in d&&typeof d.list=="object")&&f.push(d);else switch(d){case "/ev":g&&C.push(d),h=false,f.push(d);break;case "out":if(f.length>0){let v=f[f.length-1];if(v&&typeof v=="object"&&"VAR?"in v){f.pop();let w=er({key:v["VAR?"],defaultType:"storage"},c);i(r,w,e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m});}else {let w=[];for(;f.length>0&&f[f.length-1]!=="/ev";)w.push(f.pop());w=w.reverse();let D=oa(w,e,c,t);f=[],D&&typeof D=="object"&&"type"in D&&D.type==="value"&&"storageType"in D&&D.storageType==="logic"?i(r,{storageOperationType:"get",storageType:"logic",operation:D.operation,type:"value"},e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m}):(i(r,"<>",e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m}),D=`^${D}`,i(r,D,e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m}));}l=false;}break;case "pop":{let v=f[f.length-1];if(v&&typeof v=="object"&&"f()"in v){let w=[];for(;f.length>0&&f[f.length-1]!=="/ev";)w.push(f.pop());w=w.reverse();let D=xn(w,e,c,t);f=[],D.forEach(O=>{O&&typeof O=="object"&&"type"in O&&O.type==="function"?i(r,O,e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m}):ae.warn("Unhandled case: value is not a function",O);}),l=false;}else f.push(d);return}default:f.push(d);}else if(typeof d=="string")if(d.startsWith("^"))i(r,d,e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m}),l=false;else if(d==="ev")h=true;else if(d===`
|
|
66
|
+
`)l=true;else if(d==="done"||d==="end")i(r,d,e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m}),l=false;else if(d==="<>")i(r,d,e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m}),l=false;else if(d==="nop"&&g){let v=mm(C,a,s,e,t,c,u);v&&i(r,v,e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m}),g=false,C=[];}else d==="#"?p=true:d==="thread"&&(m=true);else if(Array.isArray(d))if(g)C.push(d);else if(d.length>1&&typeof d[d.length-2]=="object"&&d[d.length-2]&&"c"in d[d.length-2]&&typeof d[d.length-1]=="object"&&d[d.length-1]&&"b"in d[d.length-1]){f.pop();let v=[],w=[];for(;f.length>0&&f[f.length-1]!=="/ev";)v.push(f.pop());C=[...C,...v.reverse()],g=true,w.push(d.pop()),w.push(d.pop()),C=[...C,...d],C.push(w);}else if(d.length>1&&typeof d[d.length-1]=="object"&&d[d.length-1]&&"#n"in d[d.length-1]){let v=d.pop();if(!v){ae.error("Error parsing ink file: el is undefined");return}let w=v["#n"];delete v["#n"],d.push(v),i(r,{"->":e?e+"_|_"+w:w},e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m}),s({[w]:d},e,t);}else Pn(d,e,t,r,i,a,s,o,u,l,c);else if(d&&typeof d=="object")if("->"in d&&typeof d["->"]=="string"&&!new RegExp(/^\.\^\.\^\.\d\.s$/).test(d["->"])){let v=[];f.length>0&&(v=Rl(["ev",...f],e,c,t)),d.params=v,i(r,d,e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m}),l=false;}else if("->t->"in d&&typeof d["->t->"]=="string"&&!new RegExp(/^\.\^\.\^\.\d\.s$/).test(d["->t->"])){let v=[];f.length>0&&(v=Rl(["ev",...f],e,c,t)),d.params=v,i(r,d,e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m}),l=false;}else if("*"in d&&typeof d["*"]=="string")d["*"].includes("c")&&(f.push(d),l=false);else if("s"in d&&Array.isArray(d.s))f.push(d),l=false;else if("CNT?"in d)f.push(d),l=false;else if("VAR="in d||"temp="in d){let v="VAR="in d?d["VAR="]:d["temp="],w,D=[];if(v!=="$r"){for(f.pop(),f[f.length-1]==="/ev"&&f.pop();f.length>0&&f[f.length-1]!=="/ev";)D.push(f.pop());D=D.reverse(),w=oa(D,e,c,t),f=[],Ni({key:v,value:w,defaultType:"VAR="in d?"storage":"tempstorage",artmeticValue:true},c,t).forEach(P=>{(P.value!==void 0||P.value!==null)&&i(r,P,e,t,c,{isNewLine:l,isHashtagScript:p,isThreads:m});}),l=false;}}else s(d,e,t);}),o(f,r,e,t,c),e.includes("_|_")&&r.length===2){let d=r[0],_=r[1];d&&_&&typeof d=="object"&&"dialogue"in d&&typeof _=="object"&&"labelToOpen"in _&&d.dialogue===" "&&_.labelToOpen&&(r.shift(),delete _.glueEnabled,r[0]=_);}}function ql(n,e,t,r,i,a){if(e.length===0)return;let s=xn(e,r,t,i);if(s.length===1){let o={type:"ifelse",condition:s[0],then:n,else:a};return o.else||delete o.else,o}else if(s.length>1){let o={type:"ifelse",condition:{type:"union",unionType:"and",conditions:s},then:n,else:a};return o.else||delete o.else,o}}function mm(n,e,t,r,i,a,s=void 0){if(n.length===0){ae.error("Error parsing ink file: Conditional statement is not valid",n);return}let o=[],u=[];if(n.forEach(h=>{Array.isArray(h)?u.push(h):typeof h=="string"&&h==="du"?i.du?o.push(i.du):i.du=o[o.length-1]:(typeof h!="string"||h!=="/ev")&&o.push(h);}),u.length===0){ae.error("Error parsing ink file: Conditional statement is not valid",u);return}let l=Ll(u[0],e,t,`${r}${"_|_"}then`,i,a,`${s||""}then`),c;return u.length===2?c=Ll(u[1],e,t,`${r}${"_|_"}else`,i,a,`${s||""}else`):u.length>2?(u.shift(),u.push("nop"),u=[{b:u}],c=Ll(u,e,t,r,i,a,`${s||""}else`)):c=void 0,i.du=void 0,ql(l,o,a,r,i,c)}function Ll(n,e,t,r,i,a,s=void 0){let o=[];for(let l of n)typeof l=="object"&&"b"in l&&(l.b=l.b.filter(c=>c!==null&&!(typeof c=="object"&&"->"in c&&new RegExp(/.*\.[0-9]/).test(c["->"]))),Pn(l.b,r,i,o,e,e,t,Ir,s,true,a));return o.length===1?o[0]:{type:"resulttocombine",combine:"cross",secondConditionalItem:o}}function Bl(n="",e=""){let t=Array.isArray(n)?n:[n],r=Array.isArray(e)?e:[e];return [...new Set([...t,...r])]}function Ir(n,e,t,r,i){if(n.length>0){let a={};gm(n,a,i,r);for(let[s,o]of Object.entries(a)){let u=t+"_|_"+s,l={text:o.text.length===1?o.text[0]:o.text,label:u,props:{},type:$l(u,false),oneTime:o.onetime};o.text.length===0&&(l.onlyHaveNoChoice=true,l.autoSelect=true),l.oneTime===false&&delete l.oneTime;let c=ql(l,o.conditions,i,t,r)||l,h=e[e.length-1];if(typeof h=="object"&&h&&"type"in h&&(h={conditionalStep:h}),e.length>0&&typeof h=="object"&&h&&"choices"in h&&h.choices){let f=h.choices;f&&Array.isArray(f)?f.push(c):ae.error("Unhandled case: choices is PixiVNJsonConditionalStatements<PixiVNJsonChoices> | undefined",o,f),h.choices=f.sort((g,p)=>{try{let m=g.label.split("."),C=m[m.length-1].replaceAll(".","_|_"),b=p.label.split("."),y=b[b.length-1].replaceAll(".","_|_");if(C.includes("c-")&&y.includes("c-")){let d=C.split("c-")[1],_=Number(d),v=y.split("c-")[1],w=Number(v);return _-w}}catch{}return 0});}else e.push({choices:[c]});o.preDialog&&(r.preDialog[u]={...o.preDialog});}}}function gm(n,e,t,r,i){let a=[],s="",o="",u=false,l=[];for(let c=0;c<n.length;c++){let h=n[c];if(typeof h=="string")h.startsWith("^")?a.push(Ut(h)):cm.includes(h)&&l.push(h);else if(Array.isArray(h)&&h.includes("visit")){let f=Fr(h,aa,(g,p,m)=>{},i,r,t);a.push(f);}else if(h&&typeof h=="object")if("*"in h&&typeof h["*"]&&typeof h["*"]=="string")h["*"].includes("c")&&(s=`c${h["*"].split("c")[1]}`,h.flg&16&&(u=true));else if("s"in h&&Array.isArray(h.s)){let f=ym(h.s),g=h.s.includes("<>");f&&(i&&e[i]?(e[i].preDialog={text:f,glue:g},e[i].text=Bl(f,e[i].text)):(a.push(f),o=f));}else ("CNT?"in h||"VAR?"in h)&&l.push(h);else l.push(h);if(s){e[s]?e[s].text=Bl(a,e[s].text):e[s]={text:a,onetime:u,conditions:l},o&&(e[s].preDialog={text:o,glue:false});let f=n.slice(c+1);gm(f,e,t,r,s);return}}}function ym(n){for(let e of n)if(typeof e=="string"){if(e.startsWith("^"))return Ut(e)}else if(Array.isArray(e)){let t=ym(e);if(t)return t}}var Ml;(i=>{function n(a,s={}){let{labelToRemove:o=[],initialVarsToRemove:u=[],enums:l={},functions:c=[],preDialog:h={},characterIds:f}=s,g={$schema:sa};if(g.labels=e(a.root,{labelToRemove:o,initialVarsToRemove:u,enums:l,functions:c,preDialog:h,characterIds:f}),g.labels&&ta in g.labels){let p=g.labels[ta];delete g.labels[ta],p.forEach(m=>{m.operations&&(g.initialOperations=g.initialOperations?[...g.initialOperations,...m.operations]:[...m.operations]);});}if(g.labels&&Yn in g.labels){let p=g.labels[Yn];delete g.labels[Yn],p.forEach(m=>{m.operations&&(g.initialOperations=g.initialOperations?[...g.initialOperations,...m.operations]:[...m.operations]);});}return o.forEach(p=>{g.labels&&p in g.labels&&delete g.labels[p];}),u.forEach(p=>{g.initialOperations&&(g.initialOperations=g.initialOperations.filter(m=>!(m.type==="value"&&m.key===p)));}),g}i.inkToJson=n;function e(a,s){try{let o={};return t(a,o,s),o}catch(o){ae.error("Error parsing ink file",o);}}function t(a,s,o){for(let u of a)if(u)if(Array.isArray(u))if(u.includes("visit")){let l=Fr(u,aa,(c,h,f)=>{},"",o,[]);l&&(o.externalSwitch=l);}else t(u,s,o);else typeof u=="object"&&(u&&"VAR="in u&&o.externalSwitch&&(s[Yn]||(s[Yn]=[]),s[Yn].push({operations:Ni({defaultType:"storage",key:u["VAR="],value:o.externalSwitch},[],o)})),r(u,s,"",o));}function r(a,s,o="",u){if(a!==null){for(let[l,c]of Object.entries(a))if(Array.isArray(c)){let h=[],f={},g=(o?o+"_|_":"")+l;Pn(c,g,u,h,Vl,Vl,(p,m,C)=>{r(p,f,m,C);},Ir);for(let[p,m]of Object.entries(f))s[p]=m;h.length>0&&(s[g]=h);}}}})(Ml||={});var Pp=An(Uy()),SC=An(wv()),EC=An(yC()),wC=An(pr()),eF=/(?:^|<>)\s*#\s*([^\r\n]+)/g,tF=/^=+[ \t]+(?:function[ \t]+)?(\w+)/gm,nF=new Set(["DONE","END"]),rF="_|_",vC=new Map;function AC(n,e){let t=JSON.stringify([e,n]),r=vC.get(t);if(r)return r;let i=new RegExp(n,e);return vC.set(t,i),i}function zs(n,e){if(!e||typeof e!="object")return false;let t=e,r=t.anyOf;if(Array.isArray(r))return r.some(s=>zs(n,s));let i=t.oneOf;if(Array.isArray(i))return i.some(s=>zs(n,s));let a=t.allOf;if(Array.isArray(a))return a.every(s=>zs(n,s));if(typeof t.const=="string")return n===t.const;if(Array.isArray(t.enum))return t.enum.some(s=>typeof s=="string"&&s===n);if(t.type!=="string"||typeof t.minLength=="number"&&n.length<t.minLength||typeof t.maxLength=="number"&&n.length>t.maxLength)return false;if(typeof t.pattern=="string")try{if(!AC(t.pattern,"").test(n))return !1}catch{return false}return true}function dl(n,e){if(!e||typeof e!="object")return false;let t=e,r=t.anyOf;if(Array.isArray(r))return r.some(o=>dl(n,o));let i=t.oneOf;if(Array.isArray(i))return i.some(o=>dl(n,o));let a=t.allOf;if(Array.isArray(a))return a.every(o=>dl(n,o));if(t.type!=="array"||typeof t.minItems=="number"&&n.length<t.minItems||typeof t.maxItems=="number"&&n.length>t.maxItems)return false;let s=Array.isArray(t.prefixItems)?t.prefixItems:[];if(n.length<s.length)return false;for(let o=0;o<s.length;o++)if(!zs(n[o],s[o]))return false;return n.length===s.length?true:t.items===false||typeof t.items>"u"?false:t.items===true?true:n.slice(s.length).every(o=>zs(o,t.items))}function Ap(n,e){if(e.type==="regexp")try{let t=AC(e.source,e.flags);return t.lastIndex=0,t.test(n.join(" "))}catch{return false}return e.type==="literal"?n.join(" ")===e.value:dl(n,e.schema)}function fl(n){if(!n||typeof n!="object")return [];let e=n;if(Array.isArray(e.anyOf))return e.anyOf.flatMap(fl);if(Array.isArray(e.oneOf))return e.oneOf.flatMap(fl);if(Array.isArray(e.allOf)){let t={};for(let r of e.allOf)r&&typeof r=="object"&&Object.assign(t,r);return fl(t)}return e.type==="array"&&Array.isArray(e.prefixItems)?[e]:[]}function CC(n,e){if(n===e)return 1;let t=Math.max(n.length,e.length);return t===0?1:Math.max(0,1-DC(n,e)/t)}function iF(n,e){if(e&&typeof e=="object"){let t=e;if(typeof t.const=="string")return {weight:2,matched:n===void 0?0:2*CC(n,t.const)};if(Array.isArray(t.enum))return {weight:2,matched:2*(n===void 0?0:Math.max(0,...t.enum.filter(i=>typeof i=="string").map(i=>CC(n,i))))}}return {weight:1,matched:n===void 0?0:1}}function sF(n,e){let t=Array.isArray(e.prefixItems)?e.prefixItems:[],r=Math.min(t.length,n.length),i=0,a=0,s=false;for(let o=0;o<r;o++){let u=iF(n[o],t[o]);i+=u.weight,a+=u.matched,u.weight>1&&(s=true);}return {score:i===0?0:a/i,hasDiscriminant:s}}var aF=.8,bC=new Map;function oF(n){let e=JSON.stringify(n),t=bC.get(e);if(t)return t;let r=new SC.default({strict:false,allErrors:true}).compile(n);return bC.set(e,r),r}function uF(n){if("items"in n)return n;let e=Array.isArray(n.prefixItems)?n.prefixItems.length:0;return {...n,minItems:e,maxItems:e,items:false}}function lF(n,e){let[t]=yl(n.instancePath);if(t!==void 0&&/^\d+$/.test(t)){let r=Number(t);if(r<e.length)return e[r]}return Op(n)}function cF(n){return n.keyword==="const"?`must be "${n.params.allowedValue}"`:n.keyword==="enum"?`must be one of ${(n.params.allowedValues??[]).map(t=>`"${t}"`).join(", ")}`:n.message??"invalid value"}function Dp(n){let e=n.split(/\r?\n/),t=[];for(let r=0;r<e.length;r++){let i=e[r];for(let a of i.matchAll(eF)){let s=(a[1]??"").trim();if(!s)continue;let o=pn.convertTagTolist(s,{mergeInkVariables:true});o.length!==0&&t.push({line:r+1,command:s,tokens:o});}}return t}function Op(n){return n.keyword==="required"&&typeof n.params?.missingProperty=="string"?n.params.missingProperty:n.keyword==="additionalProperties"&&typeof n.params?.additionalProperty=="string"?n.params.additionalProperty:n.instancePath.split("/").pop()||"(root)"}function DC(n,e){let t=n.length+1,r=e.length+1,i=Array.from({length:t},(a,s)=>[s,...Array(r-1).fill(0)]);for(let a=1;a<r;a++)i[0][a]=a;for(let a=1;a<t;a++)for(let s=1;s<r;s++){let o=n[a-1]===e[s-1]?0:1;i[a][s]=Math.min(i[a-1][s]+1,i[a][s-1]+1,i[a-1][s-1]+o);}return i[t-1][r-1]}function hF(n,e){let t,r=1/0;for(let a of e){let s=DC(n,a);s<r&&(r=s,t=a);}let i=Math.max(1,Math.floor(n.length/3));return r<=i?t:void 0}function dF(n,e){if(n.keyword==="additionalProperties"&&typeof n.params?.additionalProperty=="string"){let t=n.params.additionalProperty,r=e&&hF(t,e),i=r?` (did you mean "${r}"?)`:"";return `has an unrecognised property "${t}"${i}`}return n.message??"invalid value"}function yl(n){return n.split("/").filter(Boolean).map(e=>e.replace(/~1/g,"/").replace(/~0/g,"~"))}function fF(n,e){let t=n,r,i=a=>{a&&typeof a=="object"&&typeof a.$origin=="string"&&(r=a.$origin);};i(t);for(let a of yl(e)){if(t===null||typeof t!="object")break;t=t[a],i(t);}return r}function pF(n,e){let t=yl(e);for(let r=t.length;r>=0;r--){let i=t.slice(0,r),a=n;for(let s of i){if(a===null||typeof a!="object"){a=void 0;break}a=a[s];}if(a&&typeof a=="object"&&!Array.isArray(a)&&typeof a.type=="string")return {path:`/${i.map(o=>o.replace(/~/g,"~0").replace(/\//g,"~1")).join("/")}`,node:a}}}function ml(n,e,t=new Set){if(!n||typeof n!="object")return n;let r=n.$ref;if(typeof r!="string")return n;let i=r.match(/^#\/definitions\/([^/]+)$/);return !i?.[1]||t.has(i[1])||!(i[1]in e)?{}:(t.add(i[1]),ml(e[i[1]],e,t))}function gl(n,e){let t=ml(n,e);if(!t||typeof t!="object")return;let r=t;if(!(r.anyOf||r.oneOf)){if(Array.isArray(r.allOf)){let i={properties:{},required:[]};for(let a of r.allOf){let s=gl(a,e);if(!s)return;Object.assign(i.properties,s.properties),i.required.push(...s.required);}return i}return {properties:r.properties??{},required:r.required??[]}}}function _C(n,e){if(!n||typeof n!="object")return true;let t=n;return "const"in t?t.const===e:Array.isArray(t.enum)?t.enum.includes(e):true}function mF(n,e){let t=n.definitions??{},r=[];for(let[i,a]of Object.entries(t)){let s=gl(a,t);if(!s)continue;let o=s.properties.type;o&&typeof o=="object"&&("const"in o||Array.isArray(o.enum))&&_C(o,e.type)&&_C(s.properties.operationType,e.operationType)&&r.push(i);}return r}function gF(n,e,t){let r=n.definitions??{},i={definitions:r,...r[e]},a=new Pp.default({strict:false,allErrors:true}).compile(i);return a(t)?[]:a.errors??[]}function yF(n,e,t){let r=n.definitions??{},i=ml(r[e],r);for(let a of yl(t)){let o=gl(i,r)?.properties[a];if(o===void 0)return [];i=ml(o,r);}return Object.keys(gl(i,r)?.properties??{})}function pl(n){let e=n.map(o=>o.instancePath),t=o=>e.some(u=>u!==o&&u.startsWith(`${o}/`)),r=n.filter(o=>!t(o.instancePath)),i=new Map;for(let o of r){let u=i.get(o.instancePath)??[];u.push(o),i.set(o.instancePath,u);}let a=[];for(let o of i.values()){let u=o.filter(l=>l.keyword!=="anyOf"&&l.keyword!=="oneOf");a.push(...u.length>0?u:o);}let s=new Set;return a.filter(o=>{let u=`${Op(o)}|${o.message}`;return s.has(u)?false:(s.add(u),true)})}function xp(n,e,t){return n.map(r=>({instancePath:r.instancePath||"(root)",element:Op(r),message:dF(r,t?.(r)),origin:fF(e,r.instancePath)}))}function vF(n,e,t){let r=n.map(c=>c.instancePath),i=c=>r.some(h=>h!==c&&h.startsWith(`${c}/`)),a=n.filter(c=>!i(c.instancePath)),s=t&&typeof t=="object"?t:void 0,o=new Map,u=[];for(let c of a){let h=s?pF(e,c.instancePath):void 0;if(!h){u.push(c);continue}let f=o.get(h.path);f?f.errors.push(c):o.set(h.path,{node:h.node,errors:[c]});}let l=xp(pl(u),e);for(let[c,h]of o){let f=s?mF(s,h.node):[],g=f.length===1?f[0]:void 0;if(!g||!s){l.push(...xp(pl(h.errors),e));continue}let m=pl(gF(s,g,h.node)).map(C=>({...C,instancePath:`${c}${C.instancePath}`}));l.push(...xp(m,e,C=>yF(s,g,C.instancePath.slice(c.length))));}return l}var Ht;(h=>{function n(f,g={labelToRemove:[],initialVarsToRemove:[],functions:[],enums:{}}){let p=[];try{return {json:new EC.Compiler(f,{errorHandler:(y,d)=>{let _=y.replace(/^[A-Z]+: line \d+: ?/,""),v=y.match(/line (\d+)/);p.push({message:_,type:d,line:v?Number(v[1]):-1});},countAllVisits:!0,fileHandler:{ResolveInkFilename:y=>y,LoadInkFileContents:()=>""},pluginNames:[],sourceFilename:null}).Compile().ToJson()||"",issues:p}}catch{let C=false,b={...g,textSource:f};return e(p,()=>{C=true;},b),C?n(b.textSource,g):{issues:p}}}h.compile=n;function e(f,g,p){let{functions:m,initialVarsToRemove:C,labelToRemove:b}=p,y=f.find(d=>d.type===wC.ErrorType.Error);if(y){if(y.message.includes("Divert target not found")){let d=y.message.match(/Divert target not found: '-> (\w+)'/);if(d?.[1]){let _=d[1],v=`
|
|
67
67
|
|
|
68
68
|
=== ${_} ===
|
|
69
69
|
|
|
@@ -97,11 +97,11 @@ LIST ${v} = ${w}
|
|
|
97
97
|
|
|
98
98
|
`;return p.textSource=p.textSource.concat(D),p.initialVarsToRemove.push(v),p.initialVarsToRemove.push(`${v}.${w}`),g()}}if(y.message.includes("variable for increment could not be found")){let d=y.message.match(/variable for increment could not be found: '(\w+)' after searching:/);if(d?.[1]){let _=d[1],v=`VAR ${_} = 0
|
|
99
99
|
|
|
100
|
-
`;return p.textSource=v.concat(p.textSource),p.initialVarsToRemove.push(_),g()}}return f.forEach(d=>{let _=d.message.match(/Function call to '(\w+)' requires (\d+) arguments, but got (\d+)/);_?.[1]&&(d.message=`The function '${_[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:f}}return {issues:f}}h.getErrors=e;function t(f,g){return Dp(f).filter(({tokens:p})=>!g.some(({validation:m})=>Ap(p,m)))}h.getUnknownHashtagCommands=t;function r(f,g){let p=g.filter(C=>C.validation.type==="zod");if(p.length===0)return [];let m=[];for(let C of Dp(f)){if(g.some(({validation:d})=>Ap(C.tokens,d)))continue;let b;for(let d of p)for(let _ of fl(d.validation.schema)){let{score:v,hasDiscriminant:w}=sF(C.tokens,_);w&&(!b||v>b.score)&&(b={command:d,branch:_,score:v});}if(!b||b.score<aF)continue;let y=oF(uF(b.branch));if(!y(C.tokens))for(let d of pl(y.errors??[]))m.push({line:C.line,command:C.command,handlerName:b.command.name,instancePath:d.instancePath||"(root)",element:lF(d,C.tokens),message:cF(d),score:b.score});}return m}h.getLikelyUnknownHashtagCommandSchemaIssues=r;function i(f,g){let p=new Set;for(let d of f.matchAll(tF))d[1]&&p.add(d[1]);let m=new Set(g),C=new Set,b=f.split(/\r?\n/),y=[];for(let d=0;d<b.length;d++){let _=(b[d]??"").replace(/\/\/.*$/,"");for(let v of _.matchAll(/->[ \t]+(\w[\w.]*)/g)){let w=v[1];if(!w)continue;let D=w.split(".")[0]??w;nF.has(D)||p.has(D)||m.has(w)||m.has(w.replaceAll(".",rF))||m.has(D)||C.has(w)||(C.add(w),y.push({line:d+1,target:w}));}}return y}h.getUnknownDivertTargets=i;function a(f){return new Pp.default({strict:false,allErrors:true}).compile(f)}h.getSchemaValidator=a;function s(f,g){let p=typeof g=="function"?g:a(g);return p(f)?[]:vF(p.errors??[],f,p.schema)}h.validateAgainstJsonSchema=s;function o(f,g){let p=new Set,m=[];for(let d of g){let _=u(d);_!==void 0?m.push(_):p.add(String(d));}m.sort((d,_)=>_-d);let C=[],b=f.length;for(let d=f.length-1;d>=0;d--)p.has(f[d])&&(C.push({key:f[d],sectionTokens:f.slice(d+1,b)}),b=d);C.reverse();let y=[];for(let d of m)d<0||d>=b||(y.push({key:d,sectionTokens:f.slice(d,b)}),b=d-1);return y.reverse(),[...y,...C]}h.extractKeyedSections=o;function u(f){return typeof f=="number"?Number.isInteger(f)&&f>=0?f:void 0:/^\d+$/.test(f)?Number(f):void 0}function l(f,g){let p=o(f,Object.keys(g)),m=[];for(let{key:C,sectionTokens:b}of p){let y;try{y=pn.convertListStringToObj(b);}catch(_){m.push({key:C,instancePath:"(root)",element:String(C),message:`could not parse "${C}" section into key/value pairs: ${_ instanceof Error?_.message:String(_)}`});continue}let d=s(y,g[C]);m.push(...d.map(_=>({..._,key:C})));}return m}h.validateKeyedJsonSchemas=l;function c(f,g){let p=[];for(let m of Dp(f)){let C=g.find(({validation:y})=>Ap(m.tokens,y));if(!C?.keySchemas)continue;let b=l(m.tokens,C.keySchemas);p.push(...b.map(y=>({...y,line:m.line,command:m.command})));}return p}h.getHashtagKeySchemaIssues=c;})(Ht||={});var Tp=An(pr());function xC(n){if(!n||n.length===0)return;let e=new Set;for(let t of n){let r=typeof t=="string"?t:t?.id;typeof r=="string"&&r.length>0&&e.add(r);}return e.size>0?e:void 0}function Us(n,e={}){let t={labelToRemove:[],initialVarsToRemove:[],functions:e.functions||[],enums:e.enums||{},textSource:n},{json:r,issues:i}=Ht.compile(n,t);if(i.forEach(({message:s,type:o})=>{o===Tp.ErrorType.Error?se.error(`Ink compilation error: ${s}`):o===Tp.ErrorType.Warning?se.warn(`Ink compilation warning: ${s}`):se.info(`Ink compilation info: ${s}`);}),!r){se.error("No JSON generated from ink file");return}let a;try{a=Ti.parse(r);}catch{se.error("Error parsing ink file");return}return t.enums=a.listDefs||{},Ml.inkToJson(a,{...t,characterIds:xC(e.characters)})}var ut;(n=>(n.log=(e,...t)=>console.log(`[Pixi\u2019VN Json] ${e}`,...t),n.warn=(e,...t)=>console.warn(`[Pixi\u2019VN Json] ${e}`,...t),n.error=(e,...t)=>console.error(`[Pixi\u2019VN Json] ${e}`,...t),n.info=(e,...t)=>console.info(`[Pixi\u2019VN Json] ${e}`,...t)))(ut||={});var ie=class oe{static init(e){e.loadAssets&&(oe._loadAssets=e.loadAssets),e.soundOperation&&(oe._soundOperation=e.soundOperation),e.imageOperation&&(oe._imageOperation=e.imageOperation),e.videoOperation&&(oe._videoOperation=e.videoOperation),e.imageContainerOperation&&(oe._imageContainerOperation=e.imageContainerOperation),e.textOperation&&(oe._textOperation=e.textOperation),e.canvasElementOperation&&(oe._canvasElementOperation=e.canvasElementOperation),e.setStorageValue&&(oe._setStorageValue=e.setStorageValue),e.setInitialStorageValue&&(oe._setInitialStorageValue=e.setInitialStorageValue),e.narrationOperation&&(oe._narrationOperation=e.narrationOperation),e.effectOperation&&(oe._effectOperation=e.effectOperation),e.animateOperation&&(oe._animateOperation=e.animateOperation),e.canvasOperation&&(oe._canvasOperation=e.canvasOperation),e.getLogichValue&&(oe._getLogichValue=e.getLogichValue),e.getConditionalStep&&(oe._getConditionalStep=e.getConditionalStep);}static _loadAssets=()=>{};static get loadAssets(){return oe._loadAssets}static _soundOperation=()=>{throw ut.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 oe._soundOperation}static _imageOperation=()=>{throw ut.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 oe._imageOperation}static _videoOperation=()=>{throw ut.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 oe._videoOperation}static _imageContainerOperation=()=>{throw ut.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 oe._imageContainerOperation}static _textOperation=()=>{throw ut.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 oe._textOperation}static _canvasElementOperation=()=>{throw ut.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 oe._canvasElementOperation}static _setStorageValue=()=>{throw ut.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 oe._setStorageValue}static _setInitialStorageValue=()=>{throw ut.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 oe._setInitialStorageValue}static _narrationOperation=()=>{throw ut.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 oe._narrationOperation}static _effectOperation=()=>{throw ut.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 oe._effectOperation}static _animateOperation=()=>{throw ut.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 oe._animateOperation}static _canvasOperation=()=>{throw ut.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 oe._canvasOperation}static _getLogichValue=()=>{throw ut.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 oe._getLogichValue}static _getConditionalStep=()=>{throw ut.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 oe._getConditionalStep}};var xr;(n=>{n.options={replaceRegex:/\[([^\]]+)\]/};let e=[];function t(l,c){e.unshift({fn:l,opts:c});}n.add=t;function r(l){let c=e.findIndex(h=>h.fn===l);c!==-1&&e.splice(c,1);}n.remove=r;function i(){return e.map(l=>l.opts)}n.info=i;function a(l,c){let h=e.filter(f=>(f.opts.type??"after-translation")===c.type);for(let f of h)l=u(l,f.fn,f.opts.validation);return l}n.replace=a;function s(l){let c=e.filter(h=>h.opts.i18nInterpolation);for(let h of c)l=o(l,h.fn,h.opts);return l}n.runI18nPreStep=s;function o(l,c,h){let{validation:f}=h,g=new RegExp(n.options.replaceRegex.source,"g"),p=[...l.matchAll(g)],m=new Set,C=[];for(let b of p)m.has(b[1])||(m.add(b[1]),C.push(b[1]));for(let b of C){if(f==="characterId"){if(!characters.RegisteredCharacters.has(b))continue}else if(f!=="all"){if(f instanceof RegExp){if(!f.test(b))continue}else if(f instanceof zod.ZodType&&!f.safeParse(b).success)continue}c(b)!==void 0&&(l.includes(`{{[${b}]}}`)||(l=l.replaceAll(`[${b}]`,`{{[${b}]}}`)));}return l}function u(l,c,h){let f=new RegExp(n.options.replaceRegex.source,"g"),g=[...l.matchAll(f)],p=new Set,m=[];for(let C of g)p.has(C[1])||(p.add(C[1]),m.push(C[1]));for(let C of m){if(h==="characterId"){if(!characters.RegisteredCharacters.has(C))continue}else if(h!=="all"){if(h instanceof RegExp){if(!h.test(C))continue}else if(h instanceof zod.ZodType&&!h.safeParse(C).success)continue}let b=c(C);b!==void 0&&(l=l.replaceAll(`[${C}]`,b));}return l}})(xr||={});function CF(n,e={}){let t="";return n.values.forEach(r=>{if(typeof r=="string")t+=r;else {let i=ie.getLogichValue(r,e);t+=`${i}`;}}),t}var TC;(n=>{let e=u=>u;function t(u){return Array.isArray(u)?u.map(l=>r(`${l}`)):r(`${u}`)}n.t=t;function r(u){let l=u;return n.beforeToTranslate&&(l=(0, n.beforeToTranslate)(l)),l=xr.replace(l,{type:"before-translation"}),l=e(l),n.afterToTranslate&&(l=(0, n.afterToTranslate)(l)),l=xr.replace(l,{type:"after-translation"}),l}n.translate=r;function i(u){e=u;}n.setTranslate=i;function a(u,l,c){let{defaultValue:h="empty_string"}=c;typeof l=="string"&&(l=[l]),Array.isArray(l)&&l.forEach(f=>{let g=f;if(n.beforeToTranslate&&(g=(0, n.beforeToTranslate)(g)),h==="empty_string")u[g]===void 0&&(u[g]="");else if(h==="copy_key"){let p=f;n.beforeToTranslate&&(p=(0, n.beforeToTranslate)(p));let m=xr.runI18nPreStep(p);m=xr.replace(m,{type:"before-translation"}),u[g]=m;}});}function s(u,l=[]){if(typeof u=="object"&&u&&"type"in u)if(u.type==="ifelse")u.then&&s(u.then,l),u.else&&s(u.else,l);else if(u.type==="stepswitch"){if(u.elements)if(Array.isArray(u.elements))u.elements.forEach(c=>{s(c,l);});else if(u.elements.type==="ifelse"){let c=[];s(u.elements,c),c.forEach(h=>{l.push(...h);});}else if(u.elements.type==="stepswitch"){let c=[];s(u.elements,c),c.forEach(h=>{l.push(...h);});}else s(u.elements,l);}else u.type==="resulttocombine"?(u.firstItem&&s(u.firstItem,l),u.secondConditionalItem&&u.secondConditionalItem.forEach(c=>{s(c,l);})):l.push(u);else u&&l.push(u);return l}async function o(u,l={},c={}){let{defaultValue:h="copy_key",operationStringConvert:f}=c,g=u.map(async p=>{if(p.choices){let m=[];Array.isArray(p.choices)?m=[p.choices]:m=s(p.choices),m.forEach(C=>{C.forEach(b=>{if("type"in b){let y=[];b.type==="ifelse"||b.type==="stepswitch"?s(b,y):y=[b],y.map(d=>s(d.text)).forEach(d=>{Array.isArray(d)&&d.forEach(_=>{Array.isArray(_)?_.forEach(v=>{typeof v=="string"?a(l,v,{defaultValue:h}):s(v).forEach(w=>{Array.isArray(w)?w.forEach(D=>{typeof D=="string"&&a(l,D,{defaultValue:h});}):typeof w=="string"&&a(l,w,{defaultValue:h});});}):typeof _=="string"&&a(l,_,{defaultValue:h});});});}});});}if(p.dialogue){let m=[];Array.isArray(p.dialogue)?m=[p.dialogue]:m=s(p.dialogue),m.forEach(C=>{if(typeof C=="string")a(l,C,{defaultValue:h});else if("text"in C){let b=s(C.text);typeof b=="string"&&(b=[b]),b.forEach(y=>{typeof y=="string"?a(l,y,{defaultValue:h}):s(y).forEach(d=>{typeof d=="string"?a(l,d,{defaultValue:h}):Array.isArray(d)&&d.forEach(_=>{typeof _=="string"?a(l,_,{defaultValue:h}):s(_).forEach(v=>{typeof v=="string"&&a(l,v,{defaultValue:h});});});});});}});}if(p.operations)for(let m of p.operations){if(m.type==="operationtoconvert"&&f){let C=CF(m),b=await f(C,p,{});if(!b)return;m=b;}m.type==="text"&&m.operationType==="show"&&a(l,m.text,{defaultValue:h});}p.conditionalStep&&s(p.conditionalStep).forEach(m=>{Array.isArray(m)?o(m,l,c):o([m],l,c);});});return await Promise.all(g),l}n.generateJsonTranslation=o;})(TC||={});var Ks=TC;var Oe;(n=>(n.log=(e,...t)=>console.log(`[Pixi\u2019VN Json] ${e}`,...t),n.warn=(e,...t)=>console.warn(`[Pixi\u2019VN Json] ${e}`,...t),n.error=(e,...t)=>console.error(`[Pixi\u2019VN Json] ${e}`,...t),n.info=(e,...t)=>console.info(`[Pixi\u2019VN Json] ${e}`,...t)))(Oe||={});var _F="___param___",SF=class ue{static init(e){e.loadAssets&&(ue._loadAssets=e.loadAssets),e.soundOperation&&(ue._soundOperation=e.soundOperation),e.imageOperation&&(ue._imageOperation=e.imageOperation),e.videoOperation&&(ue._videoOperation=e.videoOperation),e.imageContainerOperation&&(ue._imageContainerOperation=e.imageContainerOperation),e.textOperation&&(ue._textOperation=e.textOperation),e.canvasElementOperation&&(ue._canvasElementOperation=e.canvasElementOperation),e.setStorageValue&&(ue._setStorageValue=e.setStorageValue),e.setInitialStorageValue&&(ue._setInitialStorageValue=e.setInitialStorageValue),e.narrationOperation&&(ue._narrationOperation=e.narrationOperation),e.effectOperation&&(ue._effectOperation=e.effectOperation),e.animateOperation&&(ue._animateOperation=e.animateOperation),e.canvasOperation&&(ue._canvasOperation=e.canvasOperation),e.getLogichValue&&(ue._getLogichValue=e.getLogichValue),e.getConditionalStep&&(ue._getConditionalStep=e.getConditionalStep);}static _loadAssets=()=>{};static get loadAssets(){return ue._loadAssets}static _soundOperation=()=>{throw Oe.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 ue._soundOperation}static _imageOperation=()=>{throw Oe.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 ue._imageOperation}static _videoOperation=()=>{throw Oe.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 ue._videoOperation}static _imageContainerOperation=()=>{throw Oe.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 ue._imageContainerOperation}static _textOperation=()=>{throw Oe.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 ue._textOperation}static _canvasElementOperation=()=>{throw Oe.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 ue._canvasElementOperation}static _setStorageValue=()=>{throw Oe.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 ue._setStorageValue}static _setInitialStorageValue=()=>{throw Oe.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 ue._setInitialStorageValue}static _narrationOperation=()=>{throw Oe.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 ue._narrationOperation}static _effectOperation=()=>{throw Oe.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 ue._effectOperation}static _animateOperation=()=>{throw Oe.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 ue._animateOperation}static _canvasOperation=()=>{throw Oe.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 ue._canvasOperation}static _getLogichValue=()=>{throw Oe.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 ue._getLogichValue}static _getConditionalStep=()=>{throw Oe.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 ue._getConditionalStep}};function EF(n,e){if(e&&typeof e=="object"&&typeof n.functionName=="string"&&n.functionName in e){let t=e[n.functionName];if(typeof t=="function"){let r=n.args.map(i=>SF.getLogichValue(i,e));return t(...r)}else Oe.warn(`getLogichValue function ${n.functionName} not found in props`);}}function NC(n,e={}){let t=FC(n,e);if(t&&typeof t=="object"&&"type"in t)switch(t.type){case "value":return AF(t,e);case "arithmetic":case "arithmeticsingle":return wF(t,e);case "compare":case "union":return DF(t,e);case "function":return EF(t,e)}return t}function wF(n,e){let t=ie.getLogichValue(n.leftValue,e);switch(n.type){case "arithmetic":{let r=ie.getLogichValue(n.rightValue,e);switch(n.operator){case "*":return t*r;case "/":return t/r;case "+":return typeof t=="string"||typeof r=="string"?`${t}${r}`:Array.isArray(t)&&Array.isArray(r)?[...t,...r]:Array.isArray(t)?[...t,r]:Array.isArray(r)?[t,...r]:t+r;case "-":if(Array.isArray(t)&&Array.isArray(r))return t.filter(i=>!r.includes(i));if(Array.isArray(t))return t.filter(i=>i!==r);if(Array.isArray(r)){Oe.warn("getValueFromArithmeticOperations cannot subtract array from non-array");return}return t-r;case "%":return t%r;case "POW":return t**r;case "RANDOM":return narration.narration.getRandomNumber(t,r);case "INTERSECTION":if(Array.isArray(t)&&Array.isArray(r))return t.filter(i=>r.includes(i));Oe.warn("getValueFromArithmeticOperations cannot intersect non-array values");return;default:Oe.warn("getValueFromArithmeticOperations unknown operator",n);return}}case "arithmeticsingle":switch(n.operator){case "INT":return Number(t);case "FLOOR":return Math.floor(t)}break}}function AF(n,e){if(n&&typeof n=="object"&&"type"in n&&n.type==="value"&&n.storageOperationType==="get")switch(n.storageType){case "storage":case "tempstorage":return n.key==="_input_value_"?narration.narration.input.value:storage.storage.get(n.key);case "flagStorage":return storage.storage.flags.get(n.key);case "label":return narration.narration.queries.timesLabelOpened(n.label);case "choice":return narration.narration.queries.timesChoiceMade(n.index);case "logic":return ie.getLogichValue(n.operation,e);case "params":{let t=storage.storage.get(`${_F}${narration.narration.labels.opened.length-1}`)||[];if(t&&t.length>n.key)return t[n.key];Oe.warn("getValue params not found");return}}return n}function DF(n,e){if(!n)return false;if(typeof n!="object"||!("type"in n))return !!n;switch(n.type){case "compare":{let t=ie.getLogichValue(n.leftValue,e),r=ie.getLogichValue(n.rightValue,e);switch(n.operator){case "==":return Array.isArray(t)&&Array.isArray(r)?t.length===r.length&&t.every(i=>r.includes(i)):t===r;case "!=":return Array.isArray(t)&&Array.isArray(r)?t.length!==r.length||!t.every(i=>r.includes(i)):t!==r;case "<":return typeof t=="string"&&typeof r=="string"?t.localeCompare(r)<0:Array.isArray(t)&&Array.isArray(r)?t.length<r.length:t<r;case "<=":return typeof t=="string"&&typeof r=="string"?t.localeCompare(r)<=0:Array.isArray(t)&&Array.isArray(r)?t.length<=r.length:t<=r;case ">":return typeof t=="string"&&typeof r=="string"?t.localeCompare(r)>0:Array.isArray(t)&&Array.isArray(r)?t.length>r.length:t>r;case ">=":return typeof t=="string"&&typeof r=="string"?t.localeCompare(r)>=0:Array.isArray(t)&&Array.isArray(r)?t.length>=r.length:t>=r;case "CONTAINS":return Array.isArray(t)&&Array.isArray(r)?r.every(i=>t.includes(i)):Array.isArray(t)?t.includes(r):t.toString().includes(r.toString())}break}case "value":{let t=ie.getLogichValue(n,e);return Array.isArray(t)?t.length>0:t&&typeof t=="object"?Object.keys(t).length>0:!!t}case "union":return xF(n,e)}return !!n}function xF(n,e){if(n.unionType==="not"){let r=NC(n.condition,e);return Array.isArray(r)?r.length===0:r&&typeof r=="object"?Object.keys(r).length===0:!r}let t=r=>ie.getLogichValue(r,e)||false;return n.unionType==="and"?n.conditions.every(t):n.conditions.some(t)}function PF(n,e){return Math.floor(Math.random()*(e-n+1)+n)}function FC(n,e={}){if(Array.isArray(n)||!n)return n;if(n&&typeof n=="object"&&"type"in n)switch(n.type){case "resulttocombine":return OF(n,e);case "ifelse":return ie.getLogichValue(n.condition,e)?ie.getLogichValue(n.then,e):ie.getLogichValue(n.else,e);case "stepswitch":{let t=ie.getLogichValue(n.elements,e)||[];if(t.length===0){Oe.error("getValueFromConditionalStatements elements.length === 0");return}switch(n.choiceType){case "random":{let r=PF(0,t.length-1);return ie.getLogichValue(t[r],e)}case "loop":{let r=narration.NarrationManagerStatic.getCurrentStepTimesCounter(n.nestedId)-1;return r>t.length-1?(r=r%t.length,ie.getLogichValue(t[r],e)):ie.getLogichValue(t[r],e)}case "sequential":{let r,i=narration.NarrationManagerStatic.getCurrentStepTimesCounter(n.nestedId)-1;return n.end==="lastItem"&&(r=ie.getLogichValue(t[t.length-1],e)),i>t.length-1?r:ie.getLogichValue(t[i],e)}case "sequentialrandom":{let r=narration.NarrationManagerStatic.getRandomNumber(0,t.length-1,{nestedId:n.nestedId,onceOnly:true});if(r===void 0&&n.end==="lastItem"){let i=narration.NarrationManagerStatic.getCurrentStepTimesCounterData(n.nestedId);if(!i?.usedRandomNumbers){Oe.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let a=i.usedRandomNumbers[`0-${t.length-1}`];return ie.getLogichValue(t[a[a.length-1]],e)}if(r===void 0){Oe.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return ie.getLogichValue(t[r],e)}}}}return n}function Fp(n,e={}){if(n.conditionalStep){let t=pixiVn.createExportableElement(ie.getLogichValue(n.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 r={...n,conditionalStep:void 0,...t};return Fp(r,e)}else narration.narration.dialogGlue&&(narration.narration.dialogGlue=false);}return n}function OF(n,e){let t=n.firstItem,r=(n.secondConditionalItem??[]).flatMap(a=>Array.isArray(a)?a.map(s=>ie.getLogichValue(s,e)):[ie.getLogichValue(a,e)]),i=t?[t,...r]:r;if(i.length===0){Oe.warn("combinateResult toCheck.length === 0");return}if(typeof i[0]=="string")return Ks.t(i);if(typeof i[0]=="object"){let a=i,s,o=false,u=a.map((y,d)=>{y=Fp(y,e);let _=ie.getLogichValue(y.dialogue,e)||"";return d===0?(s=ie.getLogichValue(y.glueEnabled,e)||false,_):(typeof _=="object"&&"text"in _&&(_=`${_.character}: ${_.text}`),s===false&&o&&(_=`
|
|
100
|
+
`;return p.textSource=v.concat(p.textSource),p.initialVarsToRemove.push(_),g()}}return f.forEach(d=>{let _=d.message.match(/Function call to '(\w+)' requires (\d+) arguments, but got (\d+)/);_?.[1]&&(d.message=`The function '${_[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:f}}return {issues:f}}h.getErrors=e;function t(f,g){return Dp(f).filter(({tokens:p})=>!g.some(({validation:m})=>Ap(p,m)))}h.getUnknownHashtagCommands=t;function r(f,g){let p=g.filter(C=>C.validation.type==="zod");if(p.length===0)return [];let m=[];for(let C of Dp(f)){if(g.some(({validation:d})=>Ap(C.tokens,d)))continue;let b;for(let d of p)for(let _ of fl(d.validation.schema)){let{score:v,hasDiscriminant:w}=sF(C.tokens,_);w&&(!b||v>b.score)&&(b={command:d,branch:_,score:v});}if(!b||b.score<aF)continue;let y=oF(uF(b.branch));if(!y(C.tokens))for(let d of pl(y.errors??[]))m.push({line:C.line,command:C.command,handlerName:b.command.name,instancePath:d.instancePath||"(root)",element:lF(d,C.tokens),message:cF(d),score:b.score});}return m}h.getLikelyUnknownHashtagCommandSchemaIssues=r;function i(f,g){let p=new Set;for(let d of f.matchAll(tF))d[1]&&p.add(d[1]);let m=new Set(g),C=new Set,b=f.split(/\r?\n/),y=[];for(let d=0;d<b.length;d++){let _=(b[d]??"").replace(/\/\/.*$/,"");for(let v of _.matchAll(/->[ \t]+(\w[\w.]*)/g)){let w=v[1];if(!w)continue;let D=w.split(".")[0]??w;nF.has(D)||p.has(D)||m.has(w)||m.has(w.replaceAll(".",rF))||m.has(D)||C.has(w)||(C.add(w),y.push({line:d+1,target:w}));}}return y}h.getUnknownDivertTargets=i;function a(f){return new Pp.default({strict:false,allErrors:true}).compile(f)}h.getSchemaValidator=a;function s(f,g){let p=typeof g=="function"?g:a(g);return p(f)?[]:vF(p.errors??[],f,p.schema)}h.validateAgainstJsonSchema=s;function o(f,g){let p=new Set,m=[];for(let d of g){let _=u(d);_!==void 0?m.push(_):p.add(String(d));}m.sort((d,_)=>_-d);let C=[],b=f.length;for(let d=f.length-1;d>=0;d--)p.has(f[d])&&(C.push({key:f[d],sectionTokens:f.slice(d+1,b)}),b=d);C.reverse();let y=[];for(let d of m)d<0||d>=b||(y.push({key:d,sectionTokens:f.slice(d,b)}),b=d-1);return y.reverse(),[...y,...C]}h.extractKeyedSections=o;function u(f){return typeof f=="number"?Number.isInteger(f)&&f>=0?f:void 0:/^\d+$/.test(f)?Number(f):void 0}function l(f,g){let p=o(f,Object.keys(g)),m=[];for(let{key:C,sectionTokens:b}of p){let y;try{y=pn.convertListStringToObj(b);}catch(_){m.push({key:C,instancePath:"(root)",element:String(C),message:`could not parse "${C}" section into key/value pairs: ${_ instanceof Error?_.message:String(_)}`});continue}let d=s(y,g[C]);m.push(...d.map(_=>({..._,key:C})));}return m}h.validateKeyedJsonSchemas=l;function c(f,g){let p=[];for(let m of Dp(f)){let C=g.find(({validation:y})=>Ap(m.tokens,y));if(!C?.keySchemas)continue;let b=l(m.tokens,C.keySchemas);p.push(...b.map(y=>({...y,line:m.line,command:m.command})));}return p}h.getHashtagKeySchemaIssues=c;})(Ht||={});var Tp=An(pr());function xC(n){if(!n||n.length===0)return;let e=new Set;for(let t of n){let r=typeof t=="string"?t:t?.id;typeof r=="string"&&r.length>0&&e.add(r);}return e.size>0?e:void 0}function Us(n,e={}){let t={labelToRemove:[],initialVarsToRemove:[],functions:e.functions||[],enums:e.enums||{},textSource:n},{json:r,issues:i}=Ht.compile(n,t);if(i.forEach(({message:s,type:o})=>{o===Tp.ErrorType.Error?ae.error(`Ink compilation error: ${s}`):o===Tp.ErrorType.Warning?ae.warn(`Ink compilation warning: ${s}`):ae.info(`Ink compilation info: ${s}`);}),!r){ae.error("No JSON generated from ink file");return}let a;try{a=Ti.parse(r);}catch{ae.error("Error parsing ink file");return}return t.enums=a.listDefs||{},Ml.inkToJson(a,{...t,characterIds:xC(e.characters)})}var ut;(n=>(n.log=(e,...t)=>console.log(`[Pixi\u2019VN Json] ${e}`,...t),n.warn=(e,...t)=>console.warn(`[Pixi\u2019VN Json] ${e}`,...t),n.error=(e,...t)=>console.error(`[Pixi\u2019VN Json] ${e}`,...t),n.info=(e,...t)=>console.info(`[Pixi\u2019VN Json] ${e}`,...t)))(ut||={});var se=class ue{static init(e){e.loadAssets&&(ue._loadAssets=e.loadAssets),e.soundOperation&&(ue._soundOperation=e.soundOperation),e.imageOperation&&(ue._imageOperation=e.imageOperation),e.videoOperation&&(ue._videoOperation=e.videoOperation),e.imageContainerOperation&&(ue._imageContainerOperation=e.imageContainerOperation),e.textOperation&&(ue._textOperation=e.textOperation),e.canvasElementOperation&&(ue._canvasElementOperation=e.canvasElementOperation),e.setStorageValue&&(ue._setStorageValue=e.setStorageValue),e.setInitialStorageValue&&(ue._setInitialStorageValue=e.setInitialStorageValue),e.narrationOperation&&(ue._narrationOperation=e.narrationOperation),e.effectOperation&&(ue._effectOperation=e.effectOperation),e.animateOperation&&(ue._animateOperation=e.animateOperation),e.canvasOperation&&(ue._canvasOperation=e.canvasOperation),e.getLogichValue&&(ue._getLogichValue=e.getLogichValue),e.getConditionalStep&&(ue._getConditionalStep=e.getConditionalStep);}static _loadAssets=()=>{};static get loadAssets(){return ue._loadAssets}static _soundOperation=()=>{throw ut.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 ue._soundOperation}static _imageOperation=()=>{throw ut.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 ue._imageOperation}static _videoOperation=()=>{throw ut.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 ue._videoOperation}static _imageContainerOperation=()=>{throw ut.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 ue._imageContainerOperation}static _textOperation=()=>{throw ut.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 ue._textOperation}static _canvasElementOperation=()=>{throw ut.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 ue._canvasElementOperation}static _setStorageValue=()=>{throw ut.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 ue._setStorageValue}static _setInitialStorageValue=()=>{throw ut.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 ue._setInitialStorageValue}static _narrationOperation=()=>{throw ut.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 ue._narrationOperation}static _effectOperation=()=>{throw ut.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 ue._effectOperation}static _animateOperation=()=>{throw ut.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 ue._animateOperation}static _canvasOperation=()=>{throw ut.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 ue._canvasOperation}static _getLogichValue=()=>{throw ut.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 ue._getLogichValue}static _getConditionalStep=()=>{throw ut.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 ue._getConditionalStep}};var xr;(n=>{n.options={replaceRegex:/\[([^\]]+)\]/};let e=[];function t(l,c){e.unshift({fn:l,opts:c});}n.add=t;function r(l){let c=e.findIndex(h=>h.fn===l);c!==-1&&e.splice(c,1);}n.remove=r;function i(){return e.map(l=>l.opts)}n.info=i;function a(l,c){let h=e.filter(f=>(f.opts.type??"after-translation")===c.type);for(let f of h)l=u(l,f.fn,f.opts.validation);return l}n.replace=a;function s(l){let c=e.filter(h=>h.opts.i18nInterpolation);for(let h of c)l=o(l,h.fn,h.opts);return l}n.runI18nPreStep=s;function o(l,c,h){let{validation:f}=h,g=new RegExp(n.options.replaceRegex.source,"g"),p=[...l.matchAll(g)],m=new Set,C=[];for(let b of p)m.has(b[1])||(m.add(b[1]),C.push(b[1]));for(let b of C){if(f==="characterId"){if(!characters.RegisteredCharacters.has(b))continue}else if(f!=="all"){if(f instanceof RegExp){if(!f.test(b))continue}else if(f instanceof zod.ZodType&&!f.safeParse(b).success)continue}c(b)!==void 0&&(l.includes(`{{[${b}]}}`)||(l=l.replaceAll(`[${b}]`,`{{[${b}]}}`)));}return l}function u(l,c,h){let f=new RegExp(n.options.replaceRegex.source,"g"),g=[...l.matchAll(f)],p=new Set,m=[];for(let C of g)p.has(C[1])||(p.add(C[1]),m.push(C[1]));for(let C of m){if(h==="characterId"){if(!characters.RegisteredCharacters.has(C))continue}else if(h!=="all"){if(h instanceof RegExp){if(!h.test(C))continue}else if(h instanceof zod.ZodType&&!h.safeParse(C).success)continue}let b=c(C);b!==void 0&&(l=l.replaceAll(`[${C}]`,b));}return l}})(xr||={});function CF(n,e={}){let t="";return n.values.forEach(r=>{if(typeof r=="string")t+=r;else {let i=se.getLogichValue(r,e);t+=`${i}`;}}),t}var TC;(n=>{let e=u=>u;function t(u){return Array.isArray(u)?u.map(l=>r(`${l}`)):r(`${u}`)}n.t=t;function r(u){let l=u;return n.beforeToTranslate&&(l=(0, n.beforeToTranslate)(l)),l=xr.replace(l,{type:"before-translation"}),l=e(l),n.afterToTranslate&&(l=(0, n.afterToTranslate)(l)),l=xr.replace(l,{type:"after-translation"}),l}n.translate=r;function i(u){e=u;}n.setTranslate=i;function a(u,l,c){let{defaultValue:h="empty_string"}=c;typeof l=="string"&&(l=[l]),Array.isArray(l)&&l.forEach(f=>{let g=f;if(n.beforeToTranslate&&(g=(0, n.beforeToTranslate)(g)),h==="empty_string")u[g]===void 0&&(u[g]="");else if(h==="copy_key"){let p=f;n.beforeToTranslate&&(p=(0, n.beforeToTranslate)(p));let m=xr.runI18nPreStep(p);m=xr.replace(m,{type:"before-translation"}),u[g]=m;}});}function s(u,l=[]){if(typeof u=="object"&&u&&"type"in u)if(u.type==="ifelse")u.then&&s(u.then,l),u.else&&s(u.else,l);else if(u.type==="stepswitch"){if(u.elements)if(Array.isArray(u.elements))u.elements.forEach(c=>{s(c,l);});else if(u.elements.type==="ifelse"){let c=[];s(u.elements,c),c.forEach(h=>{l.push(...h);});}else if(u.elements.type==="stepswitch"){let c=[];s(u.elements,c),c.forEach(h=>{l.push(...h);});}else s(u.elements,l);}else u.type==="resulttocombine"?(u.firstItem&&s(u.firstItem,l),u.secondConditionalItem&&u.secondConditionalItem.forEach(c=>{s(c,l);})):l.push(u);else u&&l.push(u);return l}async function o(u,l={},c={}){let{defaultValue:h="copy_key",operationStringConvert:f}=c,g=u.map(async p=>{if(p.choices){let m=[];Array.isArray(p.choices)?m=[p.choices]:m=s(p.choices),m.forEach(C=>{C.forEach(b=>{if("type"in b){let y=[];b.type==="ifelse"||b.type==="stepswitch"?s(b,y):y=[b],y.map(d=>s(d.text)).forEach(d=>{Array.isArray(d)&&d.forEach(_=>{Array.isArray(_)?_.forEach(v=>{typeof v=="string"?a(l,v,{defaultValue:h}):s(v).forEach(w=>{Array.isArray(w)?w.forEach(D=>{typeof D=="string"&&a(l,D,{defaultValue:h});}):typeof w=="string"&&a(l,w,{defaultValue:h});});}):typeof _=="string"&&a(l,_,{defaultValue:h});});});}});});}if(p.dialogue){let m=[];Array.isArray(p.dialogue)?m=[p.dialogue]:m=s(p.dialogue),m.forEach(C=>{if(typeof C=="string")a(l,C,{defaultValue:h});else if("text"in C){let b=s(C.text);typeof b=="string"&&(b=[b]),b.forEach(y=>{typeof y=="string"?a(l,y,{defaultValue:h}):s(y).forEach(d=>{typeof d=="string"?a(l,d,{defaultValue:h}):Array.isArray(d)&&d.forEach(_=>{typeof _=="string"?a(l,_,{defaultValue:h}):s(_).forEach(v=>{typeof v=="string"&&a(l,v,{defaultValue:h});});});});});}});}if(p.operations)for(let m of p.operations){if(m.type==="operationtoconvert"&&f){let C=CF(m),b=await f(C,p,{});if(!b)return;m=b;}m.type==="text"&&m.operationType==="show"&&a(l,m.text,{defaultValue:h});}p.conditionalStep&&s(p.conditionalStep).forEach(m=>{Array.isArray(m)?o(m,l,c):o([m],l,c);});});return await Promise.all(g),l}n.generateJsonTranslation=o;})(TC||={});var Ks=TC;var Oe;(n=>(n.log=(e,...t)=>console.log(`[Pixi\u2019VN Json] ${e}`,...t),n.warn=(e,...t)=>console.warn(`[Pixi\u2019VN Json] ${e}`,...t),n.error=(e,...t)=>console.error(`[Pixi\u2019VN Json] ${e}`,...t),n.info=(e,...t)=>console.info(`[Pixi\u2019VN Json] ${e}`,...t)))(Oe||={});var _F="___param___",SF=class le{static init(e){e.loadAssets&&(le._loadAssets=e.loadAssets),e.soundOperation&&(le._soundOperation=e.soundOperation),e.imageOperation&&(le._imageOperation=e.imageOperation),e.videoOperation&&(le._videoOperation=e.videoOperation),e.imageContainerOperation&&(le._imageContainerOperation=e.imageContainerOperation),e.textOperation&&(le._textOperation=e.textOperation),e.canvasElementOperation&&(le._canvasElementOperation=e.canvasElementOperation),e.setStorageValue&&(le._setStorageValue=e.setStorageValue),e.setInitialStorageValue&&(le._setInitialStorageValue=e.setInitialStorageValue),e.narrationOperation&&(le._narrationOperation=e.narrationOperation),e.effectOperation&&(le._effectOperation=e.effectOperation),e.animateOperation&&(le._animateOperation=e.animateOperation),e.canvasOperation&&(le._canvasOperation=e.canvasOperation),e.getLogichValue&&(le._getLogichValue=e.getLogichValue),e.getConditionalStep&&(le._getConditionalStep=e.getConditionalStep);}static _loadAssets=()=>{};static get loadAssets(){return le._loadAssets}static _soundOperation=()=>{throw Oe.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 le._soundOperation}static _imageOperation=()=>{throw Oe.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 le._imageOperation}static _videoOperation=()=>{throw Oe.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 le._videoOperation}static _imageContainerOperation=()=>{throw Oe.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 le._imageContainerOperation}static _textOperation=()=>{throw Oe.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 le._textOperation}static _canvasElementOperation=()=>{throw Oe.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 le._canvasElementOperation}static _setStorageValue=()=>{throw Oe.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 le._setStorageValue}static _setInitialStorageValue=()=>{throw Oe.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 le._setInitialStorageValue}static _narrationOperation=()=>{throw Oe.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 le._narrationOperation}static _effectOperation=()=>{throw Oe.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 le._effectOperation}static _animateOperation=()=>{throw Oe.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 le._animateOperation}static _canvasOperation=()=>{throw Oe.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 le._canvasOperation}static _getLogichValue=()=>{throw Oe.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 le._getLogichValue}static _getConditionalStep=()=>{throw Oe.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 le._getConditionalStep}};function EF(n,e){if(e&&typeof e=="object"&&typeof n.functionName=="string"&&n.functionName in e){let t=e[n.functionName];if(typeof t=="function"){let r=n.args.map(i=>SF.getLogichValue(i,e));return t(...r)}else Oe.warn(`getLogichValue function ${n.functionName} not found in props`);}}function NC(n,e={}){let t=FC(n,e);if(t&&typeof t=="object"&&"type"in t)switch(t.type){case "value":return AF(t,e);case "arithmetic":case "arithmeticsingle":return wF(t,e);case "compare":case "union":return DF(t,e);case "function":return EF(t,e)}return t}function wF(n,e){let t=se.getLogichValue(n.leftValue,e);switch(n.type){case "arithmetic":{let r=se.getLogichValue(n.rightValue,e);switch(n.operator){case "*":return t*r;case "/":return t/r;case "+":return typeof t=="string"||typeof r=="string"?`${t}${r}`:Array.isArray(t)&&Array.isArray(r)?[...t,...r]:Array.isArray(t)?[...t,r]:Array.isArray(r)?[t,...r]:t+r;case "-":if(Array.isArray(t)&&Array.isArray(r))return t.filter(i=>!r.includes(i));if(Array.isArray(t))return t.filter(i=>i!==r);if(Array.isArray(r)){Oe.warn("getValueFromArithmeticOperations cannot subtract array from non-array");return}return t-r;case "%":return t%r;case "POW":return t**r;case "RANDOM":return narration.narration.getRandomNumber(t,r);case "INTERSECTION":if(Array.isArray(t)&&Array.isArray(r))return t.filter(i=>r.includes(i));Oe.warn("getValueFromArithmeticOperations cannot intersect non-array values");return;default:Oe.warn("getValueFromArithmeticOperations unknown operator",n);return}}case "arithmeticsingle":switch(n.operator){case "INT":return Number(t);case "FLOOR":return Math.floor(t)}break}}function AF(n,e){if(n&&typeof n=="object"&&"type"in n&&n.type==="value"&&n.storageOperationType==="get")switch(n.storageType){case "storage":case "tempstorage":return n.key==="_input_value_"?narration.narration.input.value:storage.storage.get(n.key);case "flagStorage":return storage.storage.flags.get(n.key);case "label":return narration.narration.queries.timesLabelOpened(n.label);case "choice":return narration.narration.queries.timesChoiceMade(n.index);case "logic":return se.getLogichValue(n.operation,e);case "params":{let t=storage.storage.get(`${_F}${narration.narration.labels.opened.length-1}`)||[];if(t&&t.length>n.key)return t[n.key];Oe.warn("getValue params not found");return}}return n}function DF(n,e){if(!n)return false;if(typeof n!="object"||!("type"in n))return !!n;switch(n.type){case "compare":{let t=se.getLogichValue(n.leftValue,e),r=se.getLogichValue(n.rightValue,e);switch(n.operator){case "==":return Array.isArray(t)&&Array.isArray(r)?t.length===r.length&&t.every(i=>r.includes(i)):t===r;case "!=":return Array.isArray(t)&&Array.isArray(r)?t.length!==r.length||!t.every(i=>r.includes(i)):t!==r;case "<":return typeof t=="string"&&typeof r=="string"?t.localeCompare(r)<0:Array.isArray(t)&&Array.isArray(r)?t.length<r.length:t<r;case "<=":return typeof t=="string"&&typeof r=="string"?t.localeCompare(r)<=0:Array.isArray(t)&&Array.isArray(r)?t.length<=r.length:t<=r;case ">":return typeof t=="string"&&typeof r=="string"?t.localeCompare(r)>0:Array.isArray(t)&&Array.isArray(r)?t.length>r.length:t>r;case ">=":return typeof t=="string"&&typeof r=="string"?t.localeCompare(r)>=0:Array.isArray(t)&&Array.isArray(r)?t.length>=r.length:t>=r;case "CONTAINS":return Array.isArray(t)&&Array.isArray(r)?r.every(i=>t.includes(i)):Array.isArray(t)?t.includes(r):t.toString().includes(r.toString())}break}case "value":{let t=se.getLogichValue(n,e);return Array.isArray(t)?t.length>0:t&&typeof t=="object"?Object.keys(t).length>0:!!t}case "union":return xF(n,e)}return !!n}function xF(n,e){if(n.unionType==="not"){let r=NC(n.condition,e);return Array.isArray(r)?r.length===0:r&&typeof r=="object"?Object.keys(r).length===0:!r}let t=r=>se.getLogichValue(r,e)||false;return n.unionType==="and"?n.conditions.every(t):n.conditions.some(t)}function PF(n,e){return Math.floor(Math.random()*(e-n+1)+n)}function FC(n,e={}){if(Array.isArray(n)||!n)return n;if(n&&typeof n=="object"&&"type"in n)switch(n.type){case "resulttocombine":return OF(n,e);case "ifelse":return se.getLogichValue(n.condition,e)?se.getLogichValue(n.then,e):se.getLogichValue(n.else,e);case "stepswitch":{let t=se.getLogichValue(n.elements,e)||[];if(t.length===0){Oe.error("getValueFromConditionalStatements elements.length === 0");return}switch(n.choiceType){case "random":{let r=PF(0,t.length-1);return se.getLogichValue(t[r],e)}case "loop":{let r=narration.NarrationManagerStatic.getCurrentStepTimesCounter(n.nestedId)-1;return r>t.length-1?(r=r%t.length,se.getLogichValue(t[r],e)):se.getLogichValue(t[r],e)}case "sequential":{let r,i=narration.NarrationManagerStatic.getCurrentStepTimesCounter(n.nestedId)-1;return n.end==="lastItem"&&(r=se.getLogichValue(t[t.length-1],e)),i>t.length-1?r:se.getLogichValue(t[i],e)}case "sequentialrandom":{let r=narration.NarrationManagerStatic.getRandomNumber(0,t.length-1,{nestedId:n.nestedId,onceOnly:true});if(r===void 0&&n.end==="lastItem"){let i=narration.NarrationManagerStatic.getCurrentStepTimesCounterData(n.nestedId);if(!i?.usedRandomNumbers){Oe.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let a=i.usedRandomNumbers[`0-${t.length-1}`];return se.getLogichValue(t[a[a.length-1]],e)}if(r===void 0){Oe.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return se.getLogichValue(t[r],e)}}}}return n}function Fp(n,e={}){if(n.conditionalStep){let t=pixiVn.createExportableElement(se.getLogichValue(n.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 r={...n,conditionalStep:void 0,...t};return Fp(r,e)}else narration.narration.dialogGlue&&(narration.narration.dialogGlue=false);}return n}function OF(n,e){let t=n.firstItem,r=(n.secondConditionalItem??[]).flatMap(a=>Array.isArray(a)?a.map(s=>se.getLogichValue(s,e)):[se.getLogichValue(a,e)]),i=t?[t,...r]:r;if(i.length===0){Oe.warn("combinateResult toCheck.length === 0");return}if(typeof i[0]=="string")return Ks.t(i);if(typeof i[0]=="object"){let a=i,s,o=false,u=a.map((y,d)=>{y=Fp(y,e);let _=se.getLogichValue(y.dialogue,e)||"";return d===0?(s=se.getLogichValue(y.glueEnabled,e)||false,_):(typeof _=="object"&&"text"in _&&(_=`${_.character}: ${_.text}`),s===false&&o&&(_=`
|
|
101
101
|
|
|
102
|
-
${_}`),_&&(o=true),s=ie.getLogichValue(y.glueEnabled,e)||false,_)}),l=ie.getLogichValue(u[0],e),c=typeof l=="object"&&"character"in l?l.character:void 0,h=u.flatMap(y=>{let d;y&&typeof y=="object"&&"text"in y?d=y.text:d=y;let _;return Array.isArray(d)?_=d.map(v=>{let w=ie.getLogichValue(v,e);return Ks.t(`${w}`)}):_=ie.getLogichValue(d,e)||"",Ks.t(_)}),f=a.find(y=>y.end),g=a.find(y=>y.choices),p=false,m=false;a.length>0&&(a[0].glueEnabled&&a[0].goNextStep&&a[0].dialogue===void 0&&(narration.narration.dialogGlue=true),p=a[a.length-1].glueEnabled,m=a.reverse().find(y=>!(y.operations&&(!y.dialogue||!y.choices)))?.goNextStep);let C=a.find(y=>y.labelToOpen),b=[];return a.forEach(y=>{y.operations&&(b=[...b,...y.operations]);}),{dialogue:c?{character:c,text:h}:h,end:f?.end,choices:g?.choices,glueEnabled:p,goNextStep:m,labelToOpen:C?.labelToOpen,operations:b}}}var Ip;(n=>{let e=new Set;function t(a){e.add(a);}n.add=t;function r(){e.clear();}n.clear=r;function i(a,s={}){let o=c=>NC(c,s)??void 0,u=FC(a,s);if(e.size===0)return o(u);let l=o;for(let c of e){let h=l;l=f=>c(f,h)??void 0;}return l(u)}n.getLogichValue=i;})(Ip||={});var TF=Object.create,kC=Object.defineProperty,NF=Object.getOwnPropertyDescriptor,FF=Object.getOwnPropertyNames,IF=Object.getPrototypeOf,kF=Object.prototype.hasOwnProperty,IC=(n=>typeof Xn<"u"?Xn:typeof Proxy<"u"?new Proxy(n,{get:(e,t)=>(typeof Xn<"u"?Xn:e)[t]}):n)(function(n){if(typeof Xn<"u")return Xn.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')}),RC=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),RF=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of FF(e))!kF.call(n,i)&&i!==t&&kC(n,i,{get:()=>e[i],enumerable:!(r=NF(e,i))||r.enumerable});return n},$F=(n,e,t)=>(t=n!=null?TF(IF(n)):{},RF(kC(t,"default",{value:n,enumerable:true}),n)),VF=RC((n,e)=>{(function(t,r){typeof n=="object"?e.exports=n=r():typeof define=="function"&&define.amd?define([],r):t.CryptoJS=r();})(n,function(){var t=t||(function(r,i){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 IC=="function")try{a=IC("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 y(){}return function(d){var _;return y.prototype=d,_=new y,y.prototype=null,_}})(),u={},l=u.lib={},c=l.Base=(function(){return {extend:function(y){var d=o(this);return y&&d.mixIn(y),(!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 y=this.extend();return y.init.apply(y,arguments),y},init:function(){},mixIn:function(y){for(var d in y)y.hasOwnProperty(d)&&(this[d]=y[d]);y.hasOwnProperty("toString")&&(this.toString=y.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),h=l.WordArray=c.extend({init:function(y,d){y=this.words=y||[],d!=i?this.sigBytes=d:this.sigBytes=y.length*4;},toString:function(y){return (y||g).stringify(this)},concat:function(y){var d=this.words,_=y.words,v=this.sigBytes,w=y.sigBytes;if(this.clamp(),v%4)for(var D=0;D<w;D++){var O=_[D>>>2]>>>24-D%4*8&255;d[v+D>>>2]|=O<<24-(v+D)%4*8;}else for(var P=0;P<w;P+=4)d[v+P>>>2]=_[P>>>2];return this.sigBytes+=w,this},clamp:function(){var y=this.words,d=this.sigBytes;y[d>>>2]&=4294967295<<32-d%4*8,y.length=r.ceil(d/4);},clone:function(){var y=c.clone.call(this);return y.words=this.words.slice(0),y},random:function(y){for(var d=[],_=0;_<y;_+=4)d.push(s());return new h.init(d,y)}}),f=u.enc={},g=f.Hex={stringify:function(y){for(var d=y.words,_=y.sigBytes,v=[],w=0;w<_;w++){var D=d[w>>>2]>>>24-w%4*8&255;v.push((D>>>4).toString(16)),v.push((D&15).toString(16));}return v.join("")},parse:function(y){for(var d=y.length,_=[],v=0;v<d;v+=2)_[v>>>3]|=parseInt(y.substr(v,2),16)<<24-v%8*4;return new h.init(_,d/2)}},p=f.Latin1={stringify:function(y){for(var d=y.words,_=y.sigBytes,v=[],w=0;w<_;w++){var D=d[w>>>2]>>>24-w%4*8&255;v.push(String.fromCharCode(D));}return v.join("")},parse:function(y){for(var d=y.length,_=[],v=0;v<d;v++)_[v>>>2]|=(y.charCodeAt(v)&255)<<24-v%4*8;return new h.init(_,d)}},m=f.Utf8={stringify:function(y){try{return decodeURIComponent(escape(p.stringify(y)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(y){return p.parse(unescape(encodeURIComponent(y)))}},C=l.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new h.init,this._nDataBytes=0;},_append:function(y){typeof y=="string"&&(y=m.parse(y)),this._data.concat(y),this._nDataBytes+=y.sigBytes;},_process:function(y){var d,_=this._data,v=_.words,w=_.sigBytes,D=this.blockSize,O=D*4,P=w/O;y?P=r.ceil(P):P=r.max((P|0)-this._minBufferSize,0);var E=P*D,F=r.min(E*4,w);if(E){for(var R=0;R<E;R+=D)this._doProcessBlock(v,R);d=v.splice(0,E),_.sigBytes-=F;}return new h.init(d,F)},clone:function(){var y=c.clone.call(this);return y._data=this._data.clone(),y},_minBufferSize:0});l.Hasher=C.extend({cfg:c.extend(),init:function(y){this.cfg=this.cfg.extend(y),this.reset();},reset:function(){C.reset.call(this),this._doReset();},update:function(y){return this._append(y),this._process(),this},finalize:function(y){y&&this._append(y);var d=this._doFinalize();return d},blockSize:16,_createHelper:function(y){return function(d,_){return new y.init(_).finalize(d)}},_createHmacHelper:function(y){return function(d,_){return new b.HMAC.init(y,_).finalize(d)}}});var b=u.algo={};return u})(Math);return t});}),jF=RC((n,e)=>{(function(t,r){typeof n=="object"?e.exports=n=r(VF()):typeof define=="function"&&define.amd?define(["./core"],r):r(t.CryptoJS);})(n,function(t){return (function(){var r=t,i=r.lib,a=i.WordArray,s=i.Hasher,o=r.algo,u=[],l=o.SHA1=s.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(c,h){for(var f=this._hash.words,g=f[0],p=f[1],m=f[2],C=f[3],b=f[4],y=0;y<80;y++){if(y<16)u[y]=c[h+y]|0;else {var d=u[y-3]^u[y-8]^u[y-14]^u[y-16];u[y]=d<<1|d>>>31;}var _=(g<<5|g>>>27)+b+u[y];y<20?_+=(p&m|~p&C)+1518500249:y<40?_+=(p^m^C)+1859775393:y<60?_+=(p&m|p&C|m&C)-1894007588:_+=(p^m^C)-899497514,b=C,C=m,m=p<<30|p>>>2,p=g,g=_;}f[0]=f[0]+g|0,f[1]=f[1]+p|0,f[2]=f[2]+m|0,f[3]=f[3]+C|0,f[4]=f[4]+b|0;},_doFinalize:function(){var c=this._data,h=c.words,f=this._nDataBytes*8,g=c.sigBytes*8;return h[g>>>5]|=128<<24-g%32,h[(g+64>>>9<<4)+14]=Math.floor(f/4294967296),h[(g+64>>>9<<4)+15]=f,c.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var c=s.clone.call(this);return c._hash=this._hash.clone(),c}});r.SHA1=s._createHelper(l),r.HmacSHA1=s._createHmacHelper(l);})(),t.SHA1});});var LF;(n=>(n.log=(e,...t)=>console.log(`[Pixi\u2019VN Json] ${e}`,...t),n.warn=(e,...t)=>console.warn(`[Pixi\u2019VN Json] ${e}`,...t),n.error=(e,...t)=>console.error(`[Pixi\u2019VN Json] ${e}`,...t),n.info=(e,...t)=>console.info(`[Pixi\u2019VN Json] ${e}`,...t)))(LF||={});$F(jF());var Qp=An(pr()),Or=An(jC());var LC=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 XF(n){let e=le.normalize(n);return e.length>1&&e[e.length-1]===le.sep&&(e=e.substring(0,e.length-1)),e}var YF=/[\\/]/g;function MC(n,e){return n.replace(YF,e)}var QF=/^[a-z]:[\\/]$/i;function ZF(n){return n==="/"||QF.test(n)}function Rp(n,e){let{resolvePaths:t,normalizePath:r,pathSeparator:i}=e,a=process.platform==="win32"&&n.includes("/")||n.startsWith(".");if(t&&(n=le.resolve(n)),(r||a)&&(n=XF(n)),n===".")return "";let s=n[n.length-1]!==i;return MC(s?n+i:n,i)}function WC(n,e){return e+n}function eI(n,e){return function(t,r){return r.startsWith(n)?r.slice(n.length)+t:MC(le.relative(n,r),e.pathSeparator)+e.pathSeparator+t}}function tI(n){return n}function nI(n,e,t){return e+n+t}function rI(n,e){let{relativePaths:t,includeBasePath:r}=e;return t&&n?eI(n,e):r?WC:tI}function iI(n){return function(e,t){t.push(e.substring(n.length)||".");}}function sI(n){return function(e,t,r){let i=e.substring(n.length)||".";r.every(a=>a(i,true))&&t.push(i);}}var aI=(n,e)=>{e.push(n||".");},oI=(n,e,t)=>{let r=n||".";t.every(i=>i(r,true))&&e.push(r);},uI=()=>{};function lI(n,e){let{includeDirs:t,filters:r,relativePaths:i}=e;return t?i?r&&r.length?sI(n):iI(n):r&&r.length?oI:aI:uI}var cI=(n,e,t,r)=>{r.every(i=>i(n,false))&&t.files++;},hI=(n,e,t,r)=>{r.every(i=>i(n,false))&&e.push(n);},dI=(n,e,t,r)=>{t.files++;},fI=(n,e)=>{e.push(n);},pI=()=>{};function mI(n){let{excludeFiles:e,filters:t,onlyCounts:r}=n;return e?pI:t&&t.length?r?cI:hI:r?dI:fI}var gI=n=>n,yI=()=>[""].slice(0,0);function vI(n){return n.group?yI:gI}var CI=(n,e,t)=>{n.push({directory:e,files:t,dir:e});},bI=()=>{};function _I(n){return n.group?CI:bI}var SI=function(n,e,t){let{queue:r,fs:i,options:{suppressErrors:a}}=e;r.enqueue(),i.realpath(n,(s,o)=>{if(s)return r.dequeue(a?null:s,e);i.stat(o,(u,l)=>{if(u)return r.dequeue(a?null:u,e);if(l.isDirectory()&&GC(n,o,e))return r.dequeue(null,e);t(l,o),r.dequeue(null,e);});});},EI=function(n,e,t){let{queue:r,fs:i,options:{suppressErrors:a}}=e;r.enqueue();try{let s=i.realpathSync(n),o=i.statSync(s);if(o.isDirectory()&&GC(n,s,e))return;t(o,s);}catch(s){if(!a)throw s}};function wI(n,e){return !n.resolveSymlinks||n.excludeSymlinks?null:e?EI:SI}function GC(n,e,t){if(t.options.useRealPaths)return AI(e,t);let r=le.dirname(n),i=1;for(;r!==t.root&&i<2;){let a=t.symlinks.get(r);!!a&&(a===e||a.startsWith(e)||e.startsWith(a))?i++:r=le.dirname(r);}return t.symlinks.set(n,e),i>1}function AI(n,e){return e.visited.includes(n+e.options.pathSeparator)}var DI=n=>n.counts,xI=n=>n.groups,PI=n=>n.paths,OI=n=>n.paths.slice(0,n.options.maxFiles),TI=(n,e,t)=>(_l(e,t,n.counts,n.options.suppressErrors),null),NI=(n,e,t)=>(_l(e,t,n.paths,n.options.suppressErrors),null),FI=(n,e,t)=>(_l(e,t,n.paths.slice(0,n.options.maxFiles),n.options.suppressErrors),null),II=(n,e,t)=>(_l(e,t,n.groups,n.options.suppressErrors),null);function _l(n,e,t,r){e(n&&!r?n:null,t);}function kI(n,e){let{onlyCounts:t,group:r,maxFiles:i}=n;return t?e?DI:TI:r?e?xI:II:i?e?OI:FI:e?PI:NI}var HC={withFileTypes:true},RI=(n,e,t,r,i)=>{if(n.queue.enqueue(),r<0)return n.queue.dequeue(null,n);let{fs:a}=n;n.visited.push(e),n.counts.directories++,a.readdir(e||".",HC,(s,o=[])=>{i(o,t,r),n.queue.dequeue(n.options.suppressErrors?null:s,n);});},$I=(n,e,t,r,i)=>{let{fs:a}=n;if(r<0)return;n.visited.push(e),n.counts.directories++;let s=[];try{s=a.readdirSync(e||".",HC);}catch(o){if(!n.options.suppressErrors)throw o}i(s,t,r);};function VI(n){return n?$I:RI}var jI=class{count=0;constructor(n){this.onQueueEmpty=n;}enqueue(){return this.count++,this.count}dequeue(n,e){this.onQueueEmpty&&(--this.count<=0||n)&&(this.onQueueEmpty(n,e),n&&(e.controller.abort(),this.onQueueEmpty=void 0));}},LI=class{_files=0;_directories=0;set files(n){this._files=n;}get files(){return this._files}set directories(n){this._directories=n;}get directories(){return this._directories}get dirs(){return this._directories}},qI=class{aborted=false;abort(){this.aborted=true;}},JC=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(n,e,t){this.isSynchronous=!t,this.callbackInvoker=kI(e,this.isSynchronous),this.root=Rp(n,e),this.state={root:ZF(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new LI,options:e,queue:new jI((r,i)=>this.callbackInvoker(i,r,t)),symlinks:new Map,visited:[""].slice(0,0),controller:new qI,fs:e.fs||KF__namespace},this.joinPath=rI(this.root,e),this.pushDirectory=lI(this.root,e),this.pushFile=mI(e),this.getArray=vI(e),this.groupFiles=_I(e),this.resolveSymlink=wI(e,this.isSynchronous),this.walkDirectory=VI(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=(n,e,t)=>{let{paths:r,options:{filters:i,resolveSymlinks:a,excludeSymlinks:s,exclude:o,maxFiles:u,signal:l,useRealPaths:c,pathSeparator:h},controller:f}=this.state;if(f.aborted||l&&l.aborted||u&&r.length>u)return;let g=this.getArray(this.state.paths);for(let p=0;p<n.length;++p){let m=n[p];if(m.isFile()||m.isSymbolicLink()&&!a&&!s){let C=this.joinPath(m.name,e);this.pushFile(C,g,this.state.counts,i);}else if(m.isDirectory()){let C=nI(m.name,e,this.state.options.pathSeparator);if(o&&o(m.name,C))continue;this.pushDirectory(C,r,i),this.walkDirectory(this.state,C,C,t-1,this.walk);}else if(this.resolveSymlink&&m.isSymbolicLink()){let C=WC(m.name,e);this.resolveSymlink(C,this.state,(b,y)=>{if(b.isDirectory()){if(y=Rp(y,this.state.options),o&&o(m.name,c?y:C+h))return;this.walkDirectory(this.state,y,c?y:C+h,t-1,this.walk);}else {y=c?y:C;let d=le.basename(y),_=Rp(le.dirname(y),this.state.options);y=this.joinPath(d,_),this.pushFile(y,g,this.state.counts,i);}});}}this.groupFiles(this.state.groups,e,g);}};function BI(n,e){return new Promise((t,r)=>{zC(n,e,(i,a)=>{if(i)return r(i);t(a);});})}function zC(n,e,t){new JC(n,e,t).start();}function MI(n,e){return new JC(n,e).start()}var qC=class{constructor(n,e){this.root=n,this.options=e;}withPromise(){return BI(this.root,this.options)}withCallback(n){zC(this.root,this.options,n);}sync(){return MI(this.root,this.options)}},UC=null;try{LC.resolve("picomatch"),UC=LC("picomatch");}catch{}var KC=class{globCache={};options={maxDepth:1/0,suppressErrors:true,pathSeparator:le.sep,filters:[]};globFunction;constructor(n){this.options={...this.options,...n},this.globFunction=this.options.globFunction;}group(){return this.options.group=true,this}withPathSeparator(n){return this.options.pathSeparator=n,this}withBasePath(){return this.options.includeBasePath=true,this}withRelativePaths(){return this.options.relativePaths=true,this}withDirs(){return this.options.includeDirs=true,this}withMaxDepth(n){return this.options.maxDepth=n,this}withMaxFiles(n){return this.options.maxFiles=n,this}withFullPaths(){return this.options.resolvePaths=true,this.options.includeBasePath=true,this}withErrors(){return this.options.suppressErrors=false,this}withSymlinks({resolvePaths:n=true}={}){return this.options.resolveSymlinks=true,this.options.useRealPaths=n,this.withFullPaths()}withAbortSignal(n){return this.options.signal=n,this}normalize(){return this.options.normalizePath=true,this}filter(n){return this.options.filters.push(n),this}onlyDirs(){return this.options.excludeFiles=true,this.options.includeDirs=true,this}exclude(n){return this.options.exclude=n,this}onlyCounts(){return this.options.onlyCounts=true,this}crawl(n){return new qC(n||".",this.options)}withGlobFunction(n){return this.globFunction=n,this}crawlWithOptions(n,e){return this.options={...this.options,...e},new qC(n||".",this.options)}glob(...n){return this.globFunction?this.globWithOptions(n):this.globWithOptions(n,{dot:true})}globWithOptions(n,...e){let t=this.globFunction||UC;if(!t)throw new Error("Please specify a glob function to use glob matching.");var r=this.globCache[n.join("\0")];return r||(r=t(n,...e),this.globCache[n.join("\0")]=r),this.options.filters.push(i=>r(i)),this}};var Ai=An(Cb()),Ik=Array.isArray,Eb=/\\/g,kk=/^[A-Za-z]:$/,wb=process.platform==="win32",Rk=/^(\/?\.\.)+$/;function $k(n,e={}){let t=n.length,r=Array(t),i=Array(t),a,s;for(a=0;a<t;a++){let o=Ab(n[a]);r[a]=o;let u=o.length,l=Array(u);for(s=0;s<u;s++)l[s]=(0, Ai.default)(o[s],e);i[a]=l;}return o=>{let u=o.split("/");if(u[0]===".."&&Rk.test(o))return true;for(a=0;a<t;a++){let l=r[a],c=i[a],h=u.length,f=Math.min(h,l.length);for(s=0;s<f;){let g=l[s];if(g.includes("/"))return true;if(!c[s](u[s]))break;if(!e.noglobstar&&g==="**")return true;s++;}if(s===h)return true}return false}}var Vk=/^[A-Z]:\/$/i,jk=wb?n=>Vk.test(n):n=>n==="/";function bb(n,e,t){if(n===e||e.startsWith(`${n}/`)){if(t){let i=n.length+ +!jk(n);return (a,s)=>a.slice(i,s?-1:void 0)||"."}let r=e.slice(n.length+1);return r?(i,a)=>{if(i===".")return r;let s=`${r}/${i}`;return a?s.slice(0,-1):s}:(i,a)=>a&&i!=="."?i.slice(0,-1):i}return t?r=>le.posix.relative(n,r)||".":r=>le.posix.relative(n,`${e}/${r}`)||"."}function Lk(n,e){if(e.startsWith(`${n}/`)){let t=e.slice(n.length+1);return r=>`${t}/${r}`}return t=>{let r=le.posix.relative(n,`${e}/${t}`);return t[t.length-1]==="/"&&r!==""?`${r}/`:r||"."}}function _b(n){return n.replace(kk,e=>`${e}/`)}var qk={parts:true};function Ab(n){var e;let t=Ai.default.scan(n,qk);return !((e=t.parts)===null||e===void 0)&&e.length?t.parts:[n]}var Bk=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,Mk=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,Wk=n=>n.replace(Bk,"\\$&"),Gk=n=>n.replace(Mk,"\\$&"),Hk=wb?Gk:Wk;function Jk(n,e){let t=Ai.default.scan(n);return t.isGlob||t.negated}function Zs(...n){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...n);}function Db(n){return typeof n=="string"?[n]:n??[]}var zk=/^(\/?\.\.)+/,Uk=/\\(?=[()[\]{}!*+?@|])/g;function zp(n,e,t,r){var i;let a=e.cwd,s=n;n[n.length-1]==="/"&&(s=n.slice(0,-1)),s[s.length-1]!=="*"&&e.expandDirectories&&(s+="/**");let o=Hk(a);s=le.isAbsolute(s.replace(Uk,""))?le.posix.relative(o,s):le.posix.normalize(s);let u=(i=zk.exec(s))===null||i===void 0?void 0:i[0],l=Ab(s);if(u){let h=(u.length+1)/3,f=0,g=o.split("/");for(;f<h&&l[f+h]===g[g.length+f-h];)s=s.slice(0,(h-f-1)*3)+s.slice((h-f)*3+l[f+h].length+1)||".",f++;let p=le.posix.join(a,u.slice(f*3));p[0]!=="."&&t.root.length>p.length&&(t.root=_b(p),t.depthOffset=-h+f);}if(!r&&t.depthOffset>=0){var c;(c=t.commonPath)!==null&&c!==void 0||(t.commonPath=l);let h=[],f=Math.min(t.commonPath.length,l.length);for(let g=0;g<f;g++){let p=l[g];if(p==="**"&&!l[g+1]){h.pop();break}if(g===l.length-1||p!==t.commonPath[g]||Jk(p))break;h.push(p);}t.depthOffset=h.length,t.commonPath=h,t.root=_b(h.length>0?le.posix.join(a,...h):a);}return s}function Kk(n,e,t){let r=[],i=[];for(let a of n.ignore)a&&(a[0]!=="!"||a[1]==="(")&&i.push(zp(a,n,t,true));for(let a of e)a&&(a[0]!=="!"||a[1]==="("?r.push(zp(a,n,t,false)):(a[1]!=="!"||a[2]==="(")&&i.push(zp(a.slice(1),n,t,true)));return {match:r,ignore:i}}function Xk(n,e){let t=n.cwd,r={root:t,depthOffset:0},i=Kk(n,e,r);n.debug&&Zs("internal processing patterns:",i);let{absolute:a,caseSensitiveMatch:s,debug:o,dot:u,followSymbolicLinks:l,onlyDirectories:c}=n,h=r.root.replace(Eb,""),f={dot:u,nobrace:n.braceExpansion===false,nocase:!s,noextglob:n.extglob===false,noglobstar:n.globstar===false,posix:true},g=(0, Ai.default)(i.match,f),p=(0, Ai.default)(i.ignore,f),m=$k(i.match,f),C=bb(t,h,a),b=a?C:bb(t,h,true),y=(v,w)=>{let D=b(w,true);return D!=="."&&!m(D)||p(D)},d;n.deep!==void 0&&(d=Math.round(n.deep-r.depthOffset));let _=new KC({filters:[o?(v,w)=>{let D=C(v,w),O=g(D)&&!p(D);return O&&Zs(`matched ${D}`),O}:(v,w)=>{let D=C(v,w);return g(D)&&!p(D)}],exclude:o?(v,w)=>{let D=y(v,w);return Zs(`${D?"skipped":"crawling"} ${w}`),D}:y,fs:n.fs,pathSeparator:"/",relativePaths:!a,resolvePaths:a,includeBasePath:a,resolveSymlinks:l,excludeSymlinks:!l,excludeFiles:c,includeDirs:c||!n.onlyFiles,maxDepth:d,signal:n.signal}).crawl(h);return n.debug&&Zs("internal properties:",{...r,root:h}),[_,t!==h&&!a&&Lk(t,h)]}function Yk(n,e){if(e)for(let t=n.length-1;t>=0;t--)n[t]=e(n[t]);return n}var Sb={caseSensitiveMatch:true,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:true,followSymbolicLinks:true,onlyFiles:true};function Qk(n){let e=Object.assign({},n);for(let t in Sb)e[t]===void 0&&Object.assign(e,{[t]:Sb[t]});return e.cwd=(e.cwd instanceof URL?url.fileURLToPath(e.cwd):le.resolve(e.cwd||process.cwd())).replace(Eb,"/"),e.ignore=Db(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||KF.readdir,readdirSync:e.fs.readdirSync||KF.readdirSync,realpath:e.fs.realpath||KF.realpath,realpathSync:e.fs.realpathSync||KF.realpathSync,stat:e.fs.stat||KF.stat,statSync:e.fs.statSync||KF.statSync}),e.debug&&Zs("globbing with options:",e),e}function Zk(n,e={}){var t;if(n&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let r=Ik(n)||typeof n=="string",i=Db((t=r?n:n.patterns)!==null&&t!==void 0?t:"**/*"),a=Qk(r?e:n);return i.length>0?Xk(a,i):[]}async function wl(n,e){let[t,r]=Zk(n,e);return t?Yk(await t.withPromise(),r):[]}var xb="1.2.1";var Sn=Or.default.cyan("(pixi-vn-ink)"),Rb="virtual:pixi-vn-ink",Up=`\0${Rb}`,nR="manifest.json",$b=/\[(name|ext|extname|file|path|dir)\]/g,Pb="ink";function Ob(n){if(typeof n=="string")return {type:"literal",value:n};if(n instanceof RegExp)return {type:"regexp",source:n.source,flags:n.flags};try{return {type:"zod",schema:zod.toJSONSchema(n)}}catch{return {type:"literal",value:""}}}function Un(n){return n.replaceAll("\\","/")}function Al(n){let e=Un(n.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 Tb(n,e){let t=Un(e).split("/"),r=[];for(let i of t)if(!(i==="."||i==="")){if(/[*!?[\]{}()]/.test(i))break;r.push(i);}return le__default.default.resolve(n,...r)}function Nb(n,e){if(!e)return;let t=e.trim();if(!t)throw new Error("vitePluginInk option `inkJsonOutputPattern` must not be empty.");return le__default.default.isAbsolute(t)?le__default.default.normalize(t):le__default.default.resolve(n,t)}function Fb(n,e,t){if(!t)return le__default.default.join(e,nR);let r=t.trim();if(!r)throw new Error("vitePluginInk option `inkJsonManifestPath` must not be empty.");return le__default.default.isAbsolute(r)?le__default.default.normalize(r):le__default.default.resolve(n,r)}function Ib(n){let e=n.search($b);if(e===-1)return le__default.default.dirname(n);let t=n.slice(0,e).replace(/[\\/]+$/g,"");if(!t)throw new Error("vitePluginInk option `inkJsonOutputPattern` must start with a static directory before placeholders.");return le__default.default.normalize(t)}function Di(n,e){let t=le__default.default.relative(n,e);return !t.startsWith("..")&&!le__default.default.isAbsolute(t)}function rR(n,e,t,r){let i=Un(le__default.default.relative(t,r)),a=le__default.default.posix.parse(i),s=Un(le__default.default.relative(e,r)),o=le__default.default.posix.dirname(s),u=le__default.default.posix.dirname(i),l={name:a.name,ext:a.ext.startsWith(".")?a.ext.slice(1):a.ext,extname:a.ext,file:i,path:u==="."?"":`${u}/`,dir:o==="."?"":`${o}/`},c=Un(n).replace($b,(h,f)=>l[f]??"");return le__default.default.normalize(c)}function iR(n,e,t){return Di(t,n)?`/${Un(le__default.default.relative(t,n))}`:Di(e,n)?Un(le__default.default.relative(e,n)):Un(n)}function Kp(n,e,t){let r=Ht.getUnknownHashtagCommands(n,e);r.forEach(({command:i,line:a})=>{t(`Unknown hashtag command "# ${i}": no registered handler matched this command.`,a);}),r.length>0&&t(`Hashtag command metadata is available via ${xi}.`);}function Xp(n,e,t){Ht.getHashtagKeySchemaIssues(n,e).forEach(({command:i,line:a,key:s,element:o,message:u})=>{t(`Hashtag command "# ${i}": "${s}" section ${o} - ${u}`,a);});}function Yp(n,e,t){if(e.length===0)return;Ht.getUnknownDivertTargets(n,e).forEach(({target:i,line:a})=>{t(`Divert target "${i}" not found in any known label source.`,a);});}async function sR(n,e,t){let r=e.get(n);return r||(r=(async()=>{try{let i=await fetch(n);if(!i.ok)throw new Error(`HTTP ${i.status} ${i.statusText}`);let a=await i.json();return Ht.getSchemaValidator(a)}catch(i){t(`Could not load/compile JSON schema from "${n}" (${i instanceof Error?i.message:String(i)}). Skipping schema validation.`);return}})(),e.set(n,r)),r}function aR(n,e){let t=`# ${n}`;if(!e)return Or.default.gray(t);let r=new RegExp(`\\b${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`,"g"),i="",a=0;for(let s of t.matchAll(r)){let o=s.index??a;i+=Or.default.gray(t.slice(a,o)),i+=Or.default.yellow(s[0]),a=o+s[0].length;}return i+=Or.default.gray(t.slice(a)),i}async function oR(n,e,t,r){let i=n.$schema;if(!i)return;let a=await sR(i,t,r);if(!a)return;let s=Ht.validateAgainstJsonSchema(n,a);for(let o of s){let u=o.origin?` \u2014 from ink source:
|
|
103
|
-
${aR(o.origin,o.element)}`:"";r(`${e}: ${o.element} - ${o.message}${u}`);}}function kb(n){return new Promise((e,t)=>{let r="";n.on("data",i=>{r+=i.toString();}),n.on("end",()=>e(r)),n.on("error",t);})}function uR(n){let{inkGlob:e,inkJsonOutputPattern:t,inkJsonManifestPath:r,characters:i}=n??{},a=!!t,s,o=[],u=[],l,c,h,f=[],g,p,m,C=new Map,b=async()=>{let P=pn.info(),E=xr.info();o=P.map(({name:F,description:R,validation:k,deprecated:A,keySchemas:x})=>({name:F,description:R,validation:Ob(k),deprecated:A,keySchemas:x})),u=E.map(({name:F,description:R,validation:k,type:A})=>({name:F,description:R,validation:Ob(k),type:A}));},y=P=>P?.find(E=>E.name==="vite-plugin-pixi-vn"),d=P=>{let E=P?.find(F=>F.name==="vite-plugin-nqtr");return [y(P)?.api?.contentLoaded,E?.api?.contentLoaded].filter(F=>!!F)},_=async P=>{let E=P?.api;if(!E)return;let F=f,R=JSON.stringify(F);if(R!==g)try{if(F.length===0&&E.clearExternalLabels)await E.clearExternalLabels(Pb);else if(E.setExternalLabels)await E.setExternalLabels(Pb,F);else return;g=R;}catch(k){let A=k instanceof Error?k:new Error(String(k));s?.logger.error(`${Sn} Failed to sync Ink labels with vite-plugin-pixi-vn.`,{error:A,timestamp:true});}},v=P=>{if(!a||!c)return false;let E=
|
|
104
|
-
`,"utf-8"),A.push(iR(W,s.root,s.publicDir)),await oR(N,pe,C,I=>s.logger.warn(`${Sn} ${I}`,{timestamp:true}));}let xe=Fb(s.root,F,r);h=
|
|
105
|
-
`,"utf-8");};return {name:"vite-plugin-ink",enforce:"pre",configResolved(P){s=P,c=void 0,h=void 0;let E=e?Al(e):void 0;if(E){let F=Tb(P.root,E);if(!Di(P.root,F))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 F=Nb(P.root,t);if(!F)return;let R=Ib(F);if(c=
|
|
102
|
+
${_}`),_&&(o=true),s=se.getLogichValue(y.glueEnabled,e)||false,_)}),l=se.getLogichValue(u[0],e),c=typeof l=="object"&&"character"in l?l.character:void 0,h=u.flatMap(y=>{let d;y&&typeof y=="object"&&"text"in y?d=y.text:d=y;let _;return Array.isArray(d)?_=d.map(v=>{let w=se.getLogichValue(v,e);return Ks.t(`${w}`)}):_=se.getLogichValue(d,e)||"",Ks.t(_)}),f=a.find(y=>y.end),g=a.find(y=>y.choices),p=false,m=false;a.length>0&&(a[0].glueEnabled&&a[0].goNextStep&&a[0].dialogue===void 0&&(narration.narration.dialogGlue=true),p=a[a.length-1].glueEnabled,m=a.reverse().find(y=>!(y.operations&&(!y.dialogue||!y.choices)))?.goNextStep);let C=a.find(y=>y.labelToOpen),b=[];return a.forEach(y=>{y.operations&&(b=[...b,...y.operations]);}),{dialogue:c?{character:c,text:h}:h,end:f?.end,choices:g?.choices,glueEnabled:p,goNextStep:m,labelToOpen:C?.labelToOpen,operations:b}}}var Ip;(n=>{let e=new Set;function t(a){e.add(a);}n.add=t;function r(){e.clear();}n.clear=r;function i(a,s={}){let o=c=>NC(c,s)??void 0,u=FC(a,s);if(e.size===0)return o(u);let l=o;for(let c of e){let h=l;l=f=>c(f,h)??void 0;}return l(u)}n.getLogichValue=i;})(Ip||={});var TF=Object.create,kC=Object.defineProperty,NF=Object.getOwnPropertyDescriptor,FF=Object.getOwnPropertyNames,IF=Object.getPrototypeOf,kF=Object.prototype.hasOwnProperty,IC=(n=>typeof Xn<"u"?Xn:typeof Proxy<"u"?new Proxy(n,{get:(e,t)=>(typeof Xn<"u"?Xn:e)[t]}):n)(function(n){if(typeof Xn<"u")return Xn.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')}),RC=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),RF=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of FF(e))!kF.call(n,i)&&i!==t&&kC(n,i,{get:()=>e[i],enumerable:!(r=NF(e,i))||r.enumerable});return n},$F=(n,e,t)=>(t=n!=null?TF(IF(n)):{},RF(kC(t,"default",{value:n,enumerable:true}),n)),VF=RC((n,e)=>{(function(t,r){typeof n=="object"?e.exports=n=r():typeof define=="function"&&define.amd?define([],r):t.CryptoJS=r();})(n,function(){var t=t||(function(r,i){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 IC=="function")try{a=IC("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 y(){}return function(d){var _;return y.prototype=d,_=new y,y.prototype=null,_}})(),u={},l=u.lib={},c=l.Base=(function(){return {extend:function(y){var d=o(this);return y&&d.mixIn(y),(!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 y=this.extend();return y.init.apply(y,arguments),y},init:function(){},mixIn:function(y){for(var d in y)y.hasOwnProperty(d)&&(this[d]=y[d]);y.hasOwnProperty("toString")&&(this.toString=y.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),h=l.WordArray=c.extend({init:function(y,d){y=this.words=y||[],d!=i?this.sigBytes=d:this.sigBytes=y.length*4;},toString:function(y){return (y||g).stringify(this)},concat:function(y){var d=this.words,_=y.words,v=this.sigBytes,w=y.sigBytes;if(this.clamp(),v%4)for(var D=0;D<w;D++){var O=_[D>>>2]>>>24-D%4*8&255;d[v+D>>>2]|=O<<24-(v+D)%4*8;}else for(var P=0;P<w;P+=4)d[v+P>>>2]=_[P>>>2];return this.sigBytes+=w,this},clamp:function(){var y=this.words,d=this.sigBytes;y[d>>>2]&=4294967295<<32-d%4*8,y.length=r.ceil(d/4);},clone:function(){var y=c.clone.call(this);return y.words=this.words.slice(0),y},random:function(y){for(var d=[],_=0;_<y;_+=4)d.push(s());return new h.init(d,y)}}),f=u.enc={},g=f.Hex={stringify:function(y){for(var d=y.words,_=y.sigBytes,v=[],w=0;w<_;w++){var D=d[w>>>2]>>>24-w%4*8&255;v.push((D>>>4).toString(16)),v.push((D&15).toString(16));}return v.join("")},parse:function(y){for(var d=y.length,_=[],v=0;v<d;v+=2)_[v>>>3]|=parseInt(y.substr(v,2),16)<<24-v%8*4;return new h.init(_,d/2)}},p=f.Latin1={stringify:function(y){for(var d=y.words,_=y.sigBytes,v=[],w=0;w<_;w++){var D=d[w>>>2]>>>24-w%4*8&255;v.push(String.fromCharCode(D));}return v.join("")},parse:function(y){for(var d=y.length,_=[],v=0;v<d;v++)_[v>>>2]|=(y.charCodeAt(v)&255)<<24-v%4*8;return new h.init(_,d)}},m=f.Utf8={stringify:function(y){try{return decodeURIComponent(escape(p.stringify(y)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(y){return p.parse(unescape(encodeURIComponent(y)))}},C=l.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new h.init,this._nDataBytes=0;},_append:function(y){typeof y=="string"&&(y=m.parse(y)),this._data.concat(y),this._nDataBytes+=y.sigBytes;},_process:function(y){var d,_=this._data,v=_.words,w=_.sigBytes,D=this.blockSize,O=D*4,P=w/O;y?P=r.ceil(P):P=r.max((P|0)-this._minBufferSize,0);var E=P*D,F=r.min(E*4,w);if(E){for(var R=0;R<E;R+=D)this._doProcessBlock(v,R);d=v.splice(0,E),_.sigBytes-=F;}return new h.init(d,F)},clone:function(){var y=c.clone.call(this);return y._data=this._data.clone(),y},_minBufferSize:0});l.Hasher=C.extend({cfg:c.extend(),init:function(y){this.cfg=this.cfg.extend(y),this.reset();},reset:function(){C.reset.call(this),this._doReset();},update:function(y){return this._append(y),this._process(),this},finalize:function(y){y&&this._append(y);var d=this._doFinalize();return d},blockSize:16,_createHelper:function(y){return function(d,_){return new y.init(_).finalize(d)}},_createHmacHelper:function(y){return function(d,_){return new b.HMAC.init(y,_).finalize(d)}}});var b=u.algo={};return u})(Math);return t});}),jF=RC((n,e)=>{(function(t,r){typeof n=="object"?e.exports=n=r(VF()):typeof define=="function"&&define.amd?define(["./core"],r):r(t.CryptoJS);})(n,function(t){return (function(){var r=t,i=r.lib,a=i.WordArray,s=i.Hasher,o=r.algo,u=[],l=o.SHA1=s.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(c,h){for(var f=this._hash.words,g=f[0],p=f[1],m=f[2],C=f[3],b=f[4],y=0;y<80;y++){if(y<16)u[y]=c[h+y]|0;else {var d=u[y-3]^u[y-8]^u[y-14]^u[y-16];u[y]=d<<1|d>>>31;}var _=(g<<5|g>>>27)+b+u[y];y<20?_+=(p&m|~p&C)+1518500249:y<40?_+=(p^m^C)+1859775393:y<60?_+=(p&m|p&C|m&C)-1894007588:_+=(p^m^C)-899497514,b=C,C=m,m=p<<30|p>>>2,p=g,g=_;}f[0]=f[0]+g|0,f[1]=f[1]+p|0,f[2]=f[2]+m|0,f[3]=f[3]+C|0,f[4]=f[4]+b|0;},_doFinalize:function(){var c=this._data,h=c.words,f=this._nDataBytes*8,g=c.sigBytes*8;return h[g>>>5]|=128<<24-g%32,h[(g+64>>>9<<4)+14]=Math.floor(f/4294967296),h[(g+64>>>9<<4)+15]=f,c.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var c=s.clone.call(this);return c._hash=this._hash.clone(),c}});r.SHA1=s._createHelper(l),r.HmacSHA1=s._createHmacHelper(l);})(),t.SHA1});});var LF;(n=>(n.log=(e,...t)=>console.log(`[Pixi\u2019VN Json] ${e}`,...t),n.warn=(e,...t)=>console.warn(`[Pixi\u2019VN Json] ${e}`,...t),n.error=(e,...t)=>console.error(`[Pixi\u2019VN Json] ${e}`,...t),n.info=(e,...t)=>console.info(`[Pixi\u2019VN Json] ${e}`,...t)))(LF||={});$F(jF());var Qp=An(pr()),Or=An(jC());var LC=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 XF(n){let e=ie.normalize(n);return e.length>1&&e[e.length-1]===ie.sep&&(e=e.substring(0,e.length-1)),e}var YF=/[\\/]/g;function MC(n,e){return n.replace(YF,e)}var QF=/^[a-z]:[\\/]$/i;function ZF(n){return n==="/"||QF.test(n)}function Rp(n,e){let{resolvePaths:t,normalizePath:r,pathSeparator:i}=e,a=process.platform==="win32"&&n.includes("/")||n.startsWith(".");if(t&&(n=ie.resolve(n)),(r||a)&&(n=XF(n)),n===".")return "";let s=n[n.length-1]!==i;return MC(s?n+i:n,i)}function WC(n,e){return e+n}function eI(n,e){return function(t,r){return r.startsWith(n)?r.slice(n.length)+t:MC(ie.relative(n,r),e.pathSeparator)+e.pathSeparator+t}}function tI(n){return n}function nI(n,e,t){return e+n+t}function rI(n,e){let{relativePaths:t,includeBasePath:r}=e;return t&&n?eI(n,e):r?WC:tI}function iI(n){return function(e,t){t.push(e.substring(n.length)||".");}}function sI(n){return function(e,t,r){let i=e.substring(n.length)||".";r.every(a=>a(i,true))&&t.push(i);}}var aI=(n,e)=>{e.push(n||".");},oI=(n,e,t)=>{let r=n||".";t.every(i=>i(r,true))&&e.push(r);},uI=()=>{};function lI(n,e){let{includeDirs:t,filters:r,relativePaths:i}=e;return t?i?r&&r.length?sI(n):iI(n):r&&r.length?oI:aI:uI}var cI=(n,e,t,r)=>{r.every(i=>i(n,false))&&t.files++;},hI=(n,e,t,r)=>{r.every(i=>i(n,false))&&e.push(n);},dI=(n,e,t,r)=>{t.files++;},fI=(n,e)=>{e.push(n);},pI=()=>{};function mI(n){let{excludeFiles:e,filters:t,onlyCounts:r}=n;return e?pI:t&&t.length?r?cI:hI:r?dI:fI}var gI=n=>n,yI=()=>[""].slice(0,0);function vI(n){return n.group?yI:gI}var CI=(n,e,t)=>{n.push({directory:e,files:t,dir:e});},bI=()=>{};function _I(n){return n.group?CI:bI}var SI=function(n,e,t){let{queue:r,fs:i,options:{suppressErrors:a}}=e;r.enqueue(),i.realpath(n,(s,o)=>{if(s)return r.dequeue(a?null:s,e);i.stat(o,(u,l)=>{if(u)return r.dequeue(a?null:u,e);if(l.isDirectory()&&GC(n,o,e))return r.dequeue(null,e);t(l,o),r.dequeue(null,e);});});},EI=function(n,e,t){let{queue:r,fs:i,options:{suppressErrors:a}}=e;r.enqueue();try{let s=i.realpathSync(n),o=i.statSync(s);if(o.isDirectory()&&GC(n,s,e))return;t(o,s);}catch(s){if(!a)throw s}};function wI(n,e){return !n.resolveSymlinks||n.excludeSymlinks?null:e?EI:SI}function GC(n,e,t){if(t.options.useRealPaths)return AI(e,t);let r=ie.dirname(n),i=1;for(;r!==t.root&&i<2;){let a=t.symlinks.get(r);!!a&&(a===e||a.startsWith(e)||e.startsWith(a))?i++:r=ie.dirname(r);}return t.symlinks.set(n,e),i>1}function AI(n,e){return e.visited.includes(n+e.options.pathSeparator)}var DI=n=>n.counts,xI=n=>n.groups,PI=n=>n.paths,OI=n=>n.paths.slice(0,n.options.maxFiles),TI=(n,e,t)=>(_l(e,t,n.counts,n.options.suppressErrors),null),NI=(n,e,t)=>(_l(e,t,n.paths,n.options.suppressErrors),null),FI=(n,e,t)=>(_l(e,t,n.paths.slice(0,n.options.maxFiles),n.options.suppressErrors),null),II=(n,e,t)=>(_l(e,t,n.groups,n.options.suppressErrors),null);function _l(n,e,t,r){e(n&&!r?n:null,t);}function kI(n,e){let{onlyCounts:t,group:r,maxFiles:i}=n;return t?e?DI:TI:r?e?xI:II:i?e?OI:FI:e?PI:NI}var HC={withFileTypes:true},RI=(n,e,t,r,i)=>{if(n.queue.enqueue(),r<0)return n.queue.dequeue(null,n);let{fs:a}=n;n.visited.push(e),n.counts.directories++,a.readdir(e||".",HC,(s,o=[])=>{i(o,t,r),n.queue.dequeue(n.options.suppressErrors?null:s,n);});},$I=(n,e,t,r,i)=>{let{fs:a}=n;if(r<0)return;n.visited.push(e),n.counts.directories++;let s=[];try{s=a.readdirSync(e||".",HC);}catch(o){if(!n.options.suppressErrors)throw o}i(s,t,r);};function VI(n){return n?$I:RI}var jI=class{count=0;constructor(n){this.onQueueEmpty=n;}enqueue(){return this.count++,this.count}dequeue(n,e){this.onQueueEmpty&&(--this.count<=0||n)&&(this.onQueueEmpty(n,e),n&&(e.controller.abort(),this.onQueueEmpty=void 0));}},LI=class{_files=0;_directories=0;set files(n){this._files=n;}get files(){return this._files}set directories(n){this._directories=n;}get directories(){return this._directories}get dirs(){return this._directories}},qI=class{aborted=false;abort(){this.aborted=true;}},JC=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(n,e,t){this.isSynchronous=!t,this.callbackInvoker=kI(e,this.isSynchronous),this.root=Rp(n,e),this.state={root:ZF(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new LI,options:e,queue:new jI((r,i)=>this.callbackInvoker(i,r,t)),symlinks:new Map,visited:[""].slice(0,0),controller:new qI,fs:e.fs||KF__namespace},this.joinPath=rI(this.root,e),this.pushDirectory=lI(this.root,e),this.pushFile=mI(e),this.getArray=vI(e),this.groupFiles=_I(e),this.resolveSymlink=wI(e,this.isSynchronous),this.walkDirectory=VI(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=(n,e,t)=>{let{paths:r,options:{filters:i,resolveSymlinks:a,excludeSymlinks:s,exclude:o,maxFiles:u,signal:l,useRealPaths:c,pathSeparator:h},controller:f}=this.state;if(f.aborted||l&&l.aborted||u&&r.length>u)return;let g=this.getArray(this.state.paths);for(let p=0;p<n.length;++p){let m=n[p];if(m.isFile()||m.isSymbolicLink()&&!a&&!s){let C=this.joinPath(m.name,e);this.pushFile(C,g,this.state.counts,i);}else if(m.isDirectory()){let C=nI(m.name,e,this.state.options.pathSeparator);if(o&&o(m.name,C))continue;this.pushDirectory(C,r,i),this.walkDirectory(this.state,C,C,t-1,this.walk);}else if(this.resolveSymlink&&m.isSymbolicLink()){let C=WC(m.name,e);this.resolveSymlink(C,this.state,(b,y)=>{if(b.isDirectory()){if(y=Rp(y,this.state.options),o&&o(m.name,c?y:C+h))return;this.walkDirectory(this.state,y,c?y:C+h,t-1,this.walk);}else {y=c?y:C;let d=ie.basename(y),_=Rp(ie.dirname(y),this.state.options);y=this.joinPath(d,_),this.pushFile(y,g,this.state.counts,i);}});}}this.groupFiles(this.state.groups,e,g);}};function BI(n,e){return new Promise((t,r)=>{zC(n,e,(i,a)=>{if(i)return r(i);t(a);});})}function zC(n,e,t){new JC(n,e,t).start();}function MI(n,e){return new JC(n,e).start()}var qC=class{constructor(n,e){this.root=n,this.options=e;}withPromise(){return BI(this.root,this.options)}withCallback(n){zC(this.root,this.options,n);}sync(){return MI(this.root,this.options)}},UC=null;try{LC.resolve("picomatch"),UC=LC("picomatch");}catch{}var KC=class{globCache={};options={maxDepth:1/0,suppressErrors:true,pathSeparator:ie.sep,filters:[]};globFunction;constructor(n){this.options={...this.options,...n},this.globFunction=this.options.globFunction;}group(){return this.options.group=true,this}withPathSeparator(n){return this.options.pathSeparator=n,this}withBasePath(){return this.options.includeBasePath=true,this}withRelativePaths(){return this.options.relativePaths=true,this}withDirs(){return this.options.includeDirs=true,this}withMaxDepth(n){return this.options.maxDepth=n,this}withMaxFiles(n){return this.options.maxFiles=n,this}withFullPaths(){return this.options.resolvePaths=true,this.options.includeBasePath=true,this}withErrors(){return this.options.suppressErrors=false,this}withSymlinks({resolvePaths:n=true}={}){return this.options.resolveSymlinks=true,this.options.useRealPaths=n,this.withFullPaths()}withAbortSignal(n){return this.options.signal=n,this}normalize(){return this.options.normalizePath=true,this}filter(n){return this.options.filters.push(n),this}onlyDirs(){return this.options.excludeFiles=true,this.options.includeDirs=true,this}exclude(n){return this.options.exclude=n,this}onlyCounts(){return this.options.onlyCounts=true,this}crawl(n){return new qC(n||".",this.options)}withGlobFunction(n){return this.globFunction=n,this}crawlWithOptions(n,e){return this.options={...this.options,...e},new qC(n||".",this.options)}glob(...n){return this.globFunction?this.globWithOptions(n):this.globWithOptions(n,{dot:true})}globWithOptions(n,...e){let t=this.globFunction||UC;if(!t)throw new Error("Please specify a glob function to use glob matching.");var r=this.globCache[n.join("\0")];return r||(r=t(n,...e),this.globCache[n.join("\0")]=r),this.options.filters.push(i=>r(i)),this}};var Ai=An(Cb()),Ik=Array.isArray,Eb=/\\/g,kk=/^[A-Za-z]:$/,wb=process.platform==="win32",Rk=/^(\/?\.\.)+$/;function $k(n,e={}){let t=n.length,r=Array(t),i=Array(t),a,s;for(a=0;a<t;a++){let o=Ab(n[a]);r[a]=o;let u=o.length,l=Array(u);for(s=0;s<u;s++)l[s]=(0, Ai.default)(o[s],e);i[a]=l;}return o=>{let u=o.split("/");if(u[0]===".."&&Rk.test(o))return true;for(a=0;a<t;a++){let l=r[a],c=i[a],h=u.length,f=Math.min(h,l.length);for(s=0;s<f;){let g=l[s];if(g.includes("/"))return true;if(!c[s](u[s]))break;if(!e.noglobstar&&g==="**")return true;s++;}if(s===h)return true}return false}}var Vk=/^[A-Z]:\/$/i,jk=wb?n=>Vk.test(n):n=>n==="/";function bb(n,e,t){if(n===e||e.startsWith(`${n}/`)){if(t){let i=n.length+ +!jk(n);return (a,s)=>a.slice(i,s?-1:void 0)||"."}let r=e.slice(n.length+1);return r?(i,a)=>{if(i===".")return r;let s=`${r}/${i}`;return a?s.slice(0,-1):s}:(i,a)=>a&&i!=="."?i.slice(0,-1):i}return t?r=>ie.posix.relative(n,r)||".":r=>ie.posix.relative(n,`${e}/${r}`)||"."}function Lk(n,e){if(e.startsWith(`${n}/`)){let t=e.slice(n.length+1);return r=>`${t}/${r}`}return t=>{let r=ie.posix.relative(n,`${e}/${t}`);return t[t.length-1]==="/"&&r!==""?`${r}/`:r||"."}}function _b(n){return n.replace(kk,e=>`${e}/`)}var qk={parts:true};function Ab(n){var e;let t=Ai.default.scan(n,qk);return !((e=t.parts)===null||e===void 0)&&e.length?t.parts:[n]}var Bk=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,Mk=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,Wk=n=>n.replace(Bk,"\\$&"),Gk=n=>n.replace(Mk,"\\$&"),Hk=wb?Gk:Wk;function Jk(n,e){let t=Ai.default.scan(n);return t.isGlob||t.negated}function Zs(...n){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...n);}function Db(n){return typeof n=="string"?[n]:n??[]}var zk=/^(\/?\.\.)+/,Uk=/\\(?=[()[\]{}!*+?@|])/g;function zp(n,e,t,r){var i;let a=e.cwd,s=n;n[n.length-1]==="/"&&(s=n.slice(0,-1)),s[s.length-1]!=="*"&&e.expandDirectories&&(s+="/**");let o=Hk(a);s=ie.isAbsolute(s.replace(Uk,""))?ie.posix.relative(o,s):ie.posix.normalize(s);let u=(i=zk.exec(s))===null||i===void 0?void 0:i[0],l=Ab(s);if(u){let h=(u.length+1)/3,f=0,g=o.split("/");for(;f<h&&l[f+h]===g[g.length+f-h];)s=s.slice(0,(h-f-1)*3)+s.slice((h-f)*3+l[f+h].length+1)||".",f++;let p=ie.posix.join(a,u.slice(f*3));p[0]!=="."&&t.root.length>p.length&&(t.root=_b(p),t.depthOffset=-h+f);}if(!r&&t.depthOffset>=0){var c;(c=t.commonPath)!==null&&c!==void 0||(t.commonPath=l);let h=[],f=Math.min(t.commonPath.length,l.length);for(let g=0;g<f;g++){let p=l[g];if(p==="**"&&!l[g+1]){h.pop();break}if(g===l.length-1||p!==t.commonPath[g]||Jk(p))break;h.push(p);}t.depthOffset=h.length,t.commonPath=h,t.root=_b(h.length>0?ie.posix.join(a,...h):a);}return s}function Kk(n,e,t){let r=[],i=[];for(let a of n.ignore)a&&(a[0]!=="!"||a[1]==="(")&&i.push(zp(a,n,t,true));for(let a of e)a&&(a[0]!=="!"||a[1]==="("?r.push(zp(a,n,t,false)):(a[1]!=="!"||a[2]==="(")&&i.push(zp(a.slice(1),n,t,true)));return {match:r,ignore:i}}function Xk(n,e){let t=n.cwd,r={root:t,depthOffset:0},i=Kk(n,e,r);n.debug&&Zs("internal processing patterns:",i);let{absolute:a,caseSensitiveMatch:s,debug:o,dot:u,followSymbolicLinks:l,onlyDirectories:c}=n,h=r.root.replace(Eb,""),f={dot:u,nobrace:n.braceExpansion===false,nocase:!s,noextglob:n.extglob===false,noglobstar:n.globstar===false,posix:true},g=(0, Ai.default)(i.match,f),p=(0, Ai.default)(i.ignore,f),m=$k(i.match,f),C=bb(t,h,a),b=a?C:bb(t,h,true),y=(v,w)=>{let D=b(w,true);return D!=="."&&!m(D)||p(D)},d;n.deep!==void 0&&(d=Math.round(n.deep-r.depthOffset));let _=new KC({filters:[o?(v,w)=>{let D=C(v,w),O=g(D)&&!p(D);return O&&Zs(`matched ${D}`),O}:(v,w)=>{let D=C(v,w);return g(D)&&!p(D)}],exclude:o?(v,w)=>{let D=y(v,w);return Zs(`${D?"skipped":"crawling"} ${w}`),D}:y,fs:n.fs,pathSeparator:"/",relativePaths:!a,resolvePaths:a,includeBasePath:a,resolveSymlinks:l,excludeSymlinks:!l,excludeFiles:c,includeDirs:c||!n.onlyFiles,maxDepth:d,signal:n.signal}).crawl(h);return n.debug&&Zs("internal properties:",{...r,root:h}),[_,t!==h&&!a&&Lk(t,h)]}function Yk(n,e){if(e)for(let t=n.length-1;t>=0;t--)n[t]=e(n[t]);return n}var Sb={caseSensitiveMatch:true,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:true,followSymbolicLinks:true,onlyFiles:true};function Qk(n){let e=Object.assign({},n);for(let t in Sb)e[t]===void 0&&Object.assign(e,{[t]:Sb[t]});return e.cwd=(e.cwd instanceof URL?url.fileURLToPath(e.cwd):ie.resolve(e.cwd||process.cwd())).replace(Eb,"/"),e.ignore=Db(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||KF.readdir,readdirSync:e.fs.readdirSync||KF.readdirSync,realpath:e.fs.realpath||KF.realpath,realpathSync:e.fs.realpathSync||KF.realpathSync,stat:e.fs.stat||KF.stat,statSync:e.fs.statSync||KF.statSync}),e.debug&&Zs("globbing with options:",e),e}function Zk(n,e={}){var t;if(n&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let r=Ik(n)||typeof n=="string",i=Db((t=r?n:n.patterns)!==null&&t!==void 0?t:"**/*"),a=Qk(r?e:n);return i.length>0?Xk(a,i):[]}async function wl(n,e){let[t,r]=Zk(n,e);return t?Yk(await t.withPromise(),r):[]}var xb="1.2.2";var Sn=Or.default.cyan("(pixi-vn-ink)"),Rb="virtual:pixi-vn-ink",Up=`\0${Rb}`,nR="manifest.json",$b=/\[(name|ext|extname|file|path|dir)\]/g,Pb="ink";function Ob(n){if(typeof n=="string")return {type:"literal",value:n};if(n instanceof RegExp)return {type:"regexp",source:n.source,flags:n.flags};try{return {type:"zod",schema:zod.toJSONSchema(n)}}catch{return {type:"literal",value:""}}}function Un(n){return n.replaceAll("\\","/")}function Al(n){let e=Un(n.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 Tb(n,e){let t=Un(e).split("/"),r=[];for(let i of t)if(!(i==="."||i==="")){if(/[*!?[\]{}()]/.test(i))break;r.push(i);}return ie__default.default.resolve(n,...r)}function Nb(n,e){if(!e)return;let t=e.trim();if(!t)throw new Error("vitePluginInk option `inkJsonOutputPattern` must not be empty.");return ie__default.default.isAbsolute(t)?ie__default.default.normalize(t):ie__default.default.resolve(n,t)}function Fb(n,e,t){if(!t)return ie__default.default.join(e,nR);let r=t.trim();if(!r)throw new Error("vitePluginInk option `inkJsonManifestPath` must not be empty.");return ie__default.default.isAbsolute(r)?ie__default.default.normalize(r):ie__default.default.resolve(n,r)}function Ib(n){let e=n.search($b);if(e===-1)return ie__default.default.dirname(n);let t=n.slice(0,e).replace(/[\\/]+$/g,"");if(!t)throw new Error("vitePluginInk option `inkJsonOutputPattern` must start with a static directory before placeholders.");return ie__default.default.normalize(t)}function Di(n,e){let t=ie__default.default.relative(n,e);return !t.startsWith("..")&&!ie__default.default.isAbsolute(t)}function rR(n,e,t,r){let i=Un(ie__default.default.relative(t,r)),a=ie__default.default.posix.parse(i),s=Un(ie__default.default.relative(e,r)),o=ie__default.default.posix.dirname(s),u=ie__default.default.posix.dirname(i),l={name:a.name,ext:a.ext.startsWith(".")?a.ext.slice(1):a.ext,extname:a.ext,file:i,path:u==="."?"":`${u}/`,dir:o==="."?"":`${o}/`},c=Un(n).replace($b,(h,f)=>l[f]??"");return ie__default.default.normalize(c)}function iR(n,e,t){return Di(t,n)?`/${Un(ie__default.default.relative(t,n))}`:Di(e,n)?Un(ie__default.default.relative(e,n)):Un(n)}function Kp(n,e,t){let r=Ht.getUnknownHashtagCommands(n,e);r.forEach(({command:i,line:a})=>{t(`Unknown hashtag command "# ${i}": no registered handler matched this command.`,a);}),r.length>0&&t(`Hashtag command metadata is available via ${xi}.`);}function Xp(n,e,t){Ht.getHashtagKeySchemaIssues(n,e).forEach(({command:i,line:a,key:s,element:o,message:u})=>{t(`Hashtag command "# ${i}": "${s}" section ${o} - ${u}`,a);});}function Yp(n,e,t){if(e.length===0)return;Ht.getUnknownDivertTargets(n,e).forEach(({target:i,line:a})=>{t(`Divert target "${i}" not found in any known label source.`,a);});}async function sR(n,e,t){let r=e.get(n);return r||(r=(async()=>{try{let i=await fetch(n);if(!i.ok)throw new Error(`HTTP ${i.status} ${i.statusText}`);let a=await i.json();return Ht.getSchemaValidator(a)}catch(i){t(`Could not load/compile JSON schema from "${n}" (${i instanceof Error?i.message:String(i)}). Skipping schema validation.`);return}})(),e.set(n,r)),r}function aR(n,e){let t=`# ${n}`;if(!e)return Or.default.gray(t);let r=new RegExp(`\\b${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`,"g"),i="",a=0;for(let s of t.matchAll(r)){let o=s.index??a;i+=Or.default.gray(t.slice(a,o)),i+=Or.default.yellow(s[0]),a=o+s[0].length;}return i+=Or.default.gray(t.slice(a)),i}async function oR(n,e,t,r){let i=n.$schema;if(!i)return;let a=await sR(i,t,r);if(!a)return;let s=Ht.validateAgainstJsonSchema(n,a);for(let o of s){let u=o.origin?` \u2014 from ink source:
|
|
103
|
+
${aR(o.origin,o.element)}`:"";r(`${e}: ${o.element} - ${o.message}${u}`);}}function kb(n){return new Promise((e,t)=>{let r="";n.on("data",i=>{r+=i.toString();}),n.on("end",()=>e(r)),n.on("error",t);})}function uR(n){let{inkGlob:e,inkJsonOutputPattern:t,inkJsonManifestPath:r,characters:i}=n??{},a=!!t,s,o=[],u=[],l,c,h,f=[],g,p,m,C=new Map,b=async()=>{let P=pn.info(),E=xr.info();o=P.map(({name:F,description:R,validation:k,deprecated:A,keySchemas:x})=>({name:F,description:R,validation:Ob(k),deprecated:A,keySchemas:x})),u=E.map(({name:F,description:R,validation:k,type:A})=>({name:F,description:R,validation:Ob(k),type:A}));},y=P=>P?.find(E=>E.name==="vite-plugin-pixi-vn"),d=P=>{let E=P?.find(F=>F.name==="vite-plugin-nqtr");return [y(P)?.api?.contentLoaded,E?.api?.contentLoaded].filter(F=>!!F)},_=async P=>{let E=P?.api;if(!E)return;let F=f,R=JSON.stringify(F);if(R!==g)try{if(F.length===0&&E.clearExternalLabels)await E.clearExternalLabels(Pb);else if(E.setExternalLabels)await E.setExternalLabels(Pb,F);else return;g=R;}catch(k){let A=k instanceof Error?k:new Error(String(k));s?.logger.error(`${Sn} Failed to sync Ink labels with vite-plugin-pixi-vn.`,{error:A,timestamp:true});}},v=P=>{if(!a||!c)return false;let E=ie__default.default.resolve(P);return h&&E===h?true:Di(c,E)},w=()=>{m!==void 0&&clearTimeout(m),m=setTimeout(()=>{m=void 0,O().then(async()=>{await _(y(p?.config.plugins));let P=p?.moduleGraph.getModuleById(Up);P&&p?.moduleGraph.invalidateModule(P),p?.ws.send({type:"custom",event:"ink-updated",data:{inkJson:a?l??[]:void 0}});}).catch(P=>{let E=P instanceof Error?P:new Error(String(P));s?.logger.error(`${Sn} Failed to re-export Ink JSON files after characters update.`,{error:E,timestamp:true});});},150);},D=async()=>{if(!s||!e)return [];let P=Al(e),E=await wl(P,{absolute:true,cwd:s.root,onlyFiles:true}),F=[];for(let R of E)try{let k=await ln__default.default.readFile(R,"utf-8"),A=Us(k,{characters:i??[]});A&&F.push(...Object.keys(A.labels??{}));}catch{}return Array.from(new Set(F)).sort((R,k)=>R.localeCompare(k))},O=async()=>{if(!s||!e){l=void 0,f=[];return}let P=Nb(s.root,t);if(!P){l=void 0,f=[],c=void 0,h=void 0;return}let E=Al(e),F=Ib(P);c=ie__default.default.resolve(F);let R=Tb(s.root,E);if(!Di(s.root,R))throw new Error("vitePluginInk option `inkGlob` must be rooted in Vite `root` and cannot escape it.");let k=await wl(E,{absolute:true,cwd:s.root,onlyFiles:true}),A=[],x=[],Ce=new Set,j=y(s.plugins)?.api?.characters??[],ce=[...i??[],...j];await ln__default.default.mkdir(F,{recursive:true});let Le=new Map;for(let pe of k){let At=await ln__default.default.readFile(pe,"utf-8");Le.set(pe,At);let N;try{N=Us(At,{characters:ce});}catch(I){let z=I instanceof Error?I:new Error(String(I));s.logger.error(`${Sn} Failed to convert "${pe}" to JSON.`,{error:z,timestamp:true});continue}let W=rR(P,s.root,R,pe);if(!Di(F,W)){s.logger.error(`${Sn} Output path "${W}" escapes managed directory "${F}".`,{timestamp:true});continue}if(Ce.add(ie__default.default.resolve(W)),!N){await ln__default.default.rm(W,{force:true});continue}x.push(N),await ln__default.default.mkdir(ie__default.default.dirname(W),{recursive:true}),await ln__default.default.writeFile(W,`${JSON.stringify(N,null,2)}
|
|
104
|
+
`,"utf-8"),A.push(iR(W,s.root,s.publicDir)),await oR(N,pe,C,I=>s.logger.warn(`${Sn} ${I}`,{timestamp:true}));}let xe=Fb(s.root,F,r);h=ie__default.default.resolve(xe);let En=await wl("**/*.json",{absolute:true,cwd:F,onlyFiles:true});for(let pe of En)ie__default.default.resolve(pe)!==ie__default.default.resolve(xe)&&!Ce.has(ie__default.default.resolve(pe))&&await ln__default.default.rm(pe,{force:true});A.sort((pe,At)=>pe.localeCompare(At)),l=x;let wn=x.flatMap(pe=>Object.keys(pe.labels??{}));f=Array.from(new Set(wn)).sort((pe,At)=>pe.localeCompare(At));let cn=wn.length,Jt=y(s.plugins)?.api?.labels??[],J=[...f,...Jt];for(let[pe,At]of Le)Kp(At,o,(N,W)=>s.logger.warn(`${W!==void 0?`${pe}:${W}`:pe}: ${N}`,{timestamp:true})),Xp(At,o,(N,W)=>s.logger.warn(`${W!==void 0?`${pe}:${W}`:pe}: ${N}`,{timestamp:true})),Yp(At,J,(N,W)=>s.logger.warn(`${W!==void 0?`${pe}:${W}`:pe}: ${N}`,{timestamp:true}));s.logger.info(`${Sn} ${Or.default.dim(`${k.length} file(s) exported: ${cn} label(s), ${o.length} hashtag-command(s), ${u.length} text-replace(s)`)}`,{timestamp:true}),await ln__default.default.mkdir(ie__default.default.dirname(xe),{recursive:true}),await ln__default.default.writeFile(xe,`${JSON.stringify(A,null,2)}
|
|
105
|
+
`,"utf-8");};return {name:"vite-plugin-ink",enforce:"pre",configResolved(P){s=P,c=void 0,h=void 0;let E=e?Al(e):void 0;if(E){let F=Tb(P.root,E);if(!Di(P.root,F))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 F=Nb(P.root,t);if(!F)return;let R=Ib(F);if(c=ie__default.default.resolve(R),h=ie__default.default.resolve(Fb(P.root,R,r)),ie__default.default.resolve(R)===ie__default.default.resolve(P.root))throw new Error("vitePluginInk option `inkJsonOutputPattern` must target a directory different from Vite `root`.")}},async buildStart(){let P=y(s?.plugins);f=await D(),await _(P),await Promise.all(d(s?.plugins)),await b(),await O(),await _(P);},configureServer(P){p=P,P.middlewares.use(async(R,k,A)=>{let x=R.url,Ce=R.method;if(x===xi){if(Ce==="GET"){k.setHeader("Content-Type","application/json"),k.end(JSON.stringify(o));return}if(Ce==="POST"){try{let j=await kb(R);o=JSON.parse(j),k.statusCode=204,k.end();}catch(j){s?.logger.warn(`${Sn} Invalid JSON body for POST ${xi}: ${String(j)}`,{timestamp:true}),k.statusCode=400,k.end();}return}}if(x===Dl&&Ce==="GET"){k.setHeader("Content-Type","application/json");let j={version:xb,schemaUrl:sa};k.end(JSON.stringify(j));return}if(x===ea){if(Ce==="GET"){k.setHeader("Content-Type","application/json"),k.end(JSON.stringify(u));return}if(Ce==="POST"){try{let j=await kb(R);u=JSON.parse(j),k.statusCode=204,k.end();}catch(j){s?.logger.warn(`${Sn} Invalid JSON body for POST ${ea}: ${String(j)}`,{timestamp:true}),k.statusCode=400,k.end();}return}}A();});let E=y(P.config.plugins);Promise.all(d(P.config.plugins)).then(async()=>{await b(),await O(),await _(E);}).catch(R=>{let k=R instanceof Error?R:new Error(String(R));s?.logger.error(`${Sn} Failed to export Ink JSON files during server initialization or restart.`,{error:k,timestamp:true});});let F=E?.api?.onReload;F&&F(()=>{b().then(()=>w());});},resolveId(P){if(P===Rb)return Up},load(P){if(P===Up){if(!e)return ["export const inkJsons = undefined;","export default [];"].join(`
|
|
106
106
|
`);let E=Al(e);return [`const modules = import.meta.glob(${JSON.stringify(`/${E}`)}, { eager: true, import: 'default' });`,`export const inkJsons = ${JSON.stringify(a?l??[]:void 0)};`,"export default Object.values(modules);"].join(`
|
|
107
107
|
`)}},hotUpdate:{order:"post",async handler({type:P,file:E,server:F,read:R}){if(E.endsWith(".ink")){if(P!=="delete"){let k=await R(),{issues:A}=Ht.compile(k),x;A.forEach(({line:j,message:ce,type:Le})=>{Le===Qp.ErrorType.Warning?F.config.logger.warn(`${E}:${j} ${ce}`,{timestamp:true}):(F.config.logger.error(`${E}:${j} ${ce}`,{timestamp:true}),x=ce);}),Kp(k,o,(j,ce)=>F.config.logger.warn(`${ce!==void 0?`${E}:${ce}`:E}: ${j}`,{timestamp:true})),Xp(k,o,(j,ce)=>F.config.logger.warn(`${ce!==void 0?`${E}:${ce}`:E}: ${j}`,{timestamp:true}));let Ce=y(F.config.plugins)?.api?.labels??[];Yp(k,[...f,...Ce],(j,ce)=>F.config.logger.warn(`${ce!==void 0?`${E}:${ce}`:E}: ${j}`,{timestamp:true})),await O(),await _(y(F.config.plugins)),x?F.ws.send({type:"error",err:{message:x,stack:E,plugin:"vite-plugin-ink"}}):(F.ws.send({type:"custom",event:"ink-error-cleared",data:{}}),F.ws.send({type:"custom",event:"ink-updated",data:{inkText:k,inkJson:a?l??[]:void 0}}));}else await O(),await _(y(F.config.plugins)),F.ws.send({type:"custom",event:"ink-updated",data:{inkJson:a?l??[]:void 0}});return []}if(E.endsWith(".json")&&v(E))return await _(y(F.config.plugins)),F.ws.send({type:"custom",event:"ink-updated",data:{inkJson:l??[]}}),[]}},async transform(P,E){if(!E.endsWith(".ink"))return null;let F=await ln__default.default.readFile(E,"utf-8"),{issues:R}=Ht.compile(F);R.forEach(({line:A,message:x,type:Ce})=>{Ce===Qp.ErrorType.Warning?this.warn(`${E}:${A} ${x}`):this.error(`${E}:${A} ${x}`);}),Kp(F,o,(A,x)=>this.warn({message:A,loc:x!==void 0?{line:x,column:0}:void 0})),Xp(F,o,(A,x)=>this.warn({message:A,loc:x!==void 0?{line:x,column:0}:void 0}));let k=y(s?.plugins)?.api?.labels??[];return Yp(F,[...f,...k],(A,x)=>this.warn({message:A,loc:x!==void 0?{line:x,column:0}:void 0})),{code:`export default ${JSON.stringify(F)};`,map:null}}}}exports.INK_DEV_API_HASHTAG_COMMANDS=xi;exports.INK_DEV_API_INFO=Dl;exports.INK_DEV_API_TEXT_REPLACES=ea;exports.vitePluginInk=uR;
|