@lostcityrs/runescript 0.9.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021-2026 Joshua Filby and other contributors.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,7 @@
1
+ <div align="center">
2
+ <h1>RuneScriptTS</h1>
3
+ </div>
4
+
5
+ A fork of [Neptune](https://github.com/neptune-ps/neptune) (a project undertaking modern OSRS), this project is instead entirely RuneScript-focused.
6
+
7
+ This is a work-in-progress effort to port [this](https://github.com/LostCityRS/RuneScriptKt) to run in TypeScript, and the upstream repo will be sunsetted in favor of this.
@@ -0,0 +1,3 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export declare function CompileServerScript(): void;
@@ -0,0 +1,29 @@
1
+ import{createRequire as u9}from"node:module";var I0=(U,X)=>()=>(X||U((X={exports:{}}).exports,X),X.exports);var v9=u9(import.meta.url);var k5=I0((o8,M5)=>{class A1 extends Error{constructor(U,X,Y){super("[ParserError] "+U,X,Y);if(this.name="ParserError",this.code="ParserError",Error.captureStackTrace)Error.captureStackTrace(this,A1)}}class j3{constructor(U){this.parser=U,this.buf="",this.returned=null,this.result=null,this.resultTable=null,this.resultArr=null}}class v2{constructor(){this.pos=0,this.col=0,this.line=0,this.obj={},this.ctx=this.obj,this.stack=[],this._buf="",this.char=null,this.ii=0,this.state=new j3(this.parseStart)}parse(U){if(U.length===0||U.length==null)return;this._buf=String(U),this.ii=-1,this.char=-1;let X;while(X===!1||this.nextChar())X=this.runOne();this._buf=null}nextChar(){if(this.char===10)++this.line,this.col=-1;return++this.ii,this.char=this._buf.codePointAt(this.ii),++this.pos,++this.col,this.haveBuffer()}haveBuffer(){return this.ii<this._buf.length}runOne(){return this.state.parser.call(this,this.state.returned)}finish(){this.char=1114112;let U;do U=this.state.parser,this.runOne();while(this.state.parser!==U);return this.ctx=null,this.state=null,this._buf=null,this.obj}next(U){if(typeof U!=="function")throw new A1("Tried to set state to non-existent state: "+JSON.stringify(U));this.state.parser=U}goto(U){return this.next(U),this.runOne()}call(U,X){if(X)this.next(X);this.stack.push(this.state),this.state=new j3(U)}callNow(U,X){return this.call(U,X),this.runOne()}return(U){if(this.stack.length===0)throw this.error(new A1("Stack underflow"));if(U===void 0)U=this.state.buf;this.state=this.stack.pop(),this.state.returned=U}returnNow(U){return this.return(U),this.runOne()}consume(){if(this.char===1114112)throw this.error(new A1("Unexpected end-of-buffer"));this.state.buf+=this._buf[this.ii]}error(U){return U.line=this.line,U.col=this.col,U.pos=this.pos,U}parseStart(){throw new A1("Must declare a parseStart method")}}v2.END=1114112;v2.Error=A1;M5.exports=v2});var j5=I0((i8,O5)=>{O5.exports=(U)=>{let X=new Date(U);if(isNaN(X))throw TypeError("Invalid Datetime");else return X}});var S2=I0((t8,h5)=>{h5.exports=(U,X)=>{X=String(X);while(X.length<U)X="0"+X;return X}});var f5=I0((r8,C5)=>{var x1=S2();class E5 extends Date{constructor(U){super(U+"Z");this.isFloating=!0}toISOString(){let U=`${this.getUTCFullYear()}-${x1(2,this.getUTCMonth()+1)}-${x1(2,this.getUTCDate())}`,X=`${x1(2,this.getUTCHours())}:${x1(2,this.getUTCMinutes())}:${x1(2,this.getUTCSeconds())}.${x1(3,this.getUTCMilliseconds())}`;return`${U}T${X}`}}C5.exports=(U)=>{let X=new E5(U);if(isNaN(X))throw TypeError("Invalid Datetime");else return X}});var u5=I0((e8,b5)=>{var V5=S2(),S9=global.Date;class P5 extends S9{constructor(U){super(U);this.isDate=!0}toISOString(){return`${this.getUTCFullYear()}-${V5(2,this.getUTCMonth()+1)}-${V5(2,this.getUTCDate())}`}}b5.exports=(U)=>{let X=new P5(U);if(isNaN(X))throw TypeError("Invalid Datetime");else return X}});var x5=I0((UU,S5)=>{var x2=S2();class v5 extends Date{constructor(U){super(`0000-01-01T${U}Z`);this.isTime=!0}toISOString(){return`${x2(2,this.getUTCHours())}:${x2(2,this.getUTCMinutes())}:${x2(2,this.getUTCSeconds())}.${x2(3,this.getUTCMilliseconds())}`}}S5.exports=(U)=>{let X=new v5(U);if(isNaN(X))throw TypeError("Invalid Datetime");else return X}});var c2=I0(($6,W2)=>{W2.exports=G6(k5());W2.exports.makeParserClass=G6;class k extends Error{constructor(U){super(U);if(this.name="TomlError",Error.captureStackTrace)Error.captureStackTrace(this,k);this.fromTOML=!0,this.wrapped=null}}k.wrap=(U)=>{let X=new k(U.message);return X.code=U.code,X.wrapped=U,X};W2.exports.TomlError=k;var h3=j5(),g5=f5(),m5=u5(),d5=x5(),m=9,$0=10,N0=13,g2=31,p=32,u0=34,K1=35,c0=39,m2=43,T5=44,a0=45,L0=46,G1=48,x9=49,g9=55,l2=57,D1=58,m9=61,v3=65,$2=69,d9=70,T9=84,l9=85,T2=90,M0=95,F2=97,t5=98,B1=101,q2=102,l5=105,y9=108,Q2=110,c9=111,r5=114,a9=115,b3=116,y5=117,s9=120,e5=122,n9=123,c5=125,E3=91,u3=92,Z2=93,d2=127,p9=55296,o9=57343,a5={[t5]:"\b",[b3]:"\t",[Q2]:`
2
+ `,[q2]:"\f",[r5]:"\r",[u0]:'"',[u3]:"\\"};function a(U){return U>=G1&&U<=l2}function C3(U){return U>=v3&&U<=d9||U>=F2&&U<=q2||U>=G1&&U<=l2}function i9(U){return U===x9||U===G1}function t9(U){return U>=G1&&U<=g9}function r9(U){return U>=v3&&U<=T2||U>=F2&&U<=e5||U>=G1&&U<=l2||U===c0||U===u0||U===M0||U===a0}function e9(U){return U>=v3&&U<=T2||U>=F2&&U<=e5||U>=G1&&U<=l2||U===M0||U===a0}var Z0=Symbol("type"),N2=Symbol("declared"),U7=Object.prototype.hasOwnProperty,X7=Object.defineProperty,Y7={configurable:!0,enumerable:!0,writable:!0,value:void 0};function Y1(U,X){if(U7.call(U,X))return!0;if(X==="__proto__")X7(U,"__proto__",Y7);return!1}var S3=Symbol("inline-table");function s5(){return Object.defineProperties({},{[Z0]:{value:S3}})}function G7(U){if(U===null||typeof U!=="object")return!1;return U[Z0]===S3}var x3=Symbol("table");function w1(){return Object.defineProperties({},{[Z0]:{value:x3},[N2]:{value:!1,writable:!0}})}function J2(U){if(U===null||typeof U!=="object")return!1;return U[Z0]===x3}var U6=Symbol("content-type"),g3=Symbol("inline-list");function n5(U){return Object.defineProperties([],{[Z0]:{value:g3},[U6]:{value:U}})}function p5(U){if(U===null||typeof U!=="object")return!1;return U[Z0]===g3}var m3=Symbol("list");function $7(){return Object.defineProperties([],{[Z0]:{value:m3}})}function f3(U){if(U===null||typeof U!=="object")return!1;return U[Z0]===m3}var X6;try{let utilInspect=eval("require('util').inspect");X6=utilInspect.custom}catch(U){}var d3=X6||"inspect";class Y6{constructor(U){try{this.value=global.BigInt.asIntN(64,U)}catch(X){this.value=null}Object.defineProperty(this,Z0,{value:y2})}isNaN(){return this.value===null}toString(){return String(this.value)}[d3](){return`[BigInt: ${this.toString()}]}`}valueOf(){return this.value}}var y2=Symbol("integer");function R1(U){let X=Number(U);if(Object.is(X,-0))X=0;if(global.BigInt&&!Number.isSafeInteger(X))return new Y6(U);else return Object.defineProperties(new Number(X),{isNaN:{value:function(){return isNaN(this)}},[Z0]:{value:y2},[d3]:{value:()=>`[Integer: ${U}]`}})}function V3(U){if(U===null||typeof U!=="object")return!1;return U[Z0]===y2}var T3=Symbol("float");function o5(U){return Object.defineProperties(new Number(U),{[Z0]:{value:T3},[d3]:{value:()=>`[Float: ${U}]`}})}function P3(U){if(U===null||typeof U!=="object")return!1;return U[Z0]===T3}function i5(U){let X=typeof U;if(X==="object"){if(U===null)return"null";if(U instanceof Date)return"datetime";if(Z0 in U)switch(U[Z0]){case S3:return"inline-table";case g3:return"inline-list";case x3:return"table";case m3:return"list";case T3:return"float";case y2:return"integer"}}return X}function G6(U){class X extends U{constructor(){super();this.ctx=this.obj=w1()}atEndOfWord(){return this.char===K1||this.char===m||this.char===p||this.atEndOfLine()}atEndOfLine(){return this.char===U.END||this.char===$0||this.char===N0}parseStart(){if(this.char===U.END)return null;else if(this.char===E3)return this.call(this.parseTableOrList);else if(this.char===K1)return this.call(this.parseComment);else if(this.char===$0||this.char===p||this.char===m||this.char===N0)return null;else if(r9(this.char))return this.callNow(this.parseAssignStatement);else throw this.error(new k(`Unknown character "${this.char}"`))}parseWhitespaceToEOL(){if(this.char===p||this.char===m||this.char===N0)return null;else if(this.char===K1)return this.goto(this.parseComment);else if(this.char===U.END||this.char===$0)return this.return();else throw this.error(new k("Unexpected character, expected only whitespace or comments till end of line"))}parseAssignStatement(){return this.callNow(this.parseAssign,this.recordAssignStatement)}recordAssignStatement(Y){let G=this.ctx,$=Y.key.pop();for(let Z of Y.key){if(Y1(G,Z)&&(!J2(G[Z])||G[Z][N2]))throw this.error(new k("Can't redefine existing key"));G=G[Z]=G[Z]||w1()}if(Y1(G,$))throw this.error(new k("Can't redefine existing key"));if(V3(Y.value)||P3(Y.value))G[$]=Y.value.valueOf();else G[$]=Y.value;return this.goto(this.parseWhitespaceToEOL)}parseAssign(){return this.callNow(this.parseKeyword,this.recordAssignKeyword)}recordAssignKeyword(Y){if(this.state.resultTable)this.state.resultTable.push(Y);else this.state.resultTable=[Y];return this.goto(this.parseAssignKeywordPreDot)}parseAssignKeywordPreDot(){if(this.char===L0)return this.next(this.parseAssignKeywordPostDot);else if(this.char!==p&&this.char!==m)return this.goto(this.parseAssignEqual)}parseAssignKeywordPostDot(){if(this.char!==p&&this.char!==m)return this.callNow(this.parseKeyword,this.recordAssignKeyword)}parseAssignEqual(){if(this.char===m9)return this.next(this.parseAssignPreValue);else throw this.error(new k('Invalid character, expected "="'))}parseAssignPreValue(){if(this.char===p||this.char===m)return null;else return this.callNow(this.parseValue,this.recordAssignValue)}recordAssignValue(Y){return this.returnNow({key:this.state.resultTable,value:Y})}parseComment(){do if(this.char===U.END||this.char===$0)return this.return();while(this.nextChar())}parseTableOrList(){if(this.char===E3)this.next(this.parseList);else return this.goto(this.parseTable)}parseTable(){return this.ctx=this.obj,this.goto(this.parseTableNext)}parseTableNext(){if(this.char===p||this.char===m)return null;else return this.callNow(this.parseKeyword,this.parseTableMore)}parseTableMore(Y){if(this.char===p||this.char===m)return null;else if(this.char===Z2){if(Y1(this.ctx,Y)&&(!J2(this.ctx[Y])||this.ctx[Y][N2]))throw this.error(new k("Can't redefine existing key"));else this.ctx=this.ctx[Y]=this.ctx[Y]||w1(),this.ctx[N2]=!0;return this.next(this.parseWhitespaceToEOL)}else if(this.char===L0){if(!Y1(this.ctx,Y))this.ctx=this.ctx[Y]=w1();else if(J2(this.ctx[Y]))this.ctx=this.ctx[Y];else if(f3(this.ctx[Y]))this.ctx=this.ctx[Y][this.ctx[Y].length-1];else throw this.error(new k("Can't redefine existing key"));return this.next(this.parseTableNext)}else throw this.error(new k("Unexpected character, expected whitespace, . or ]"))}parseList(){return this.ctx=this.obj,this.goto(this.parseListNext)}parseListNext(){if(this.char===p||this.char===m)return null;else return this.callNow(this.parseKeyword,this.parseListMore)}parseListMore(Y){if(this.char===p||this.char===m)return null;else if(this.char===Z2){if(!Y1(this.ctx,Y))this.ctx[Y]=$7();if(p5(this.ctx[Y]))throw this.error(new k("Can't extend an inline array"));else if(f3(this.ctx[Y])){let G=w1();this.ctx[Y].push(G),this.ctx=G}else throw this.error(new k("Can't redefine an existing key"));return this.next(this.parseListEnd)}else if(this.char===L0){if(!Y1(this.ctx,Y))this.ctx=this.ctx[Y]=w1();else if(p5(this.ctx[Y]))throw this.error(new k("Can't extend an inline array"));else if(G7(this.ctx[Y]))throw this.error(new k("Can't extend an inline table"));else if(f3(this.ctx[Y]))this.ctx=this.ctx[Y][this.ctx[Y].length-1];else if(J2(this.ctx[Y]))this.ctx=this.ctx[Y];else throw this.error(new k("Can't redefine an existing key"));return this.next(this.parseListNext)}else throw this.error(new k("Unexpected character, expected whitespace, . or ]"))}parseListEnd(Y){if(this.char===Z2)return this.next(this.parseWhitespaceToEOL);else throw this.error(new k("Unexpected character, expected whitespace, . or ]"))}parseValue(){if(this.char===U.END)throw this.error(new k("Key without value"));else if(this.char===u0)return this.next(this.parseDoubleString);if(this.char===c0)return this.next(this.parseSingleString);else if(this.char===a0||this.char===m2)return this.goto(this.parseNumberSign);else if(this.char===l5)return this.next(this.parseInf);else if(this.char===Q2)return this.next(this.parseNan);else if(a(this.char))return this.goto(this.parseNumberOrDateTime);else if(this.char===b3||this.char===q2)return this.goto(this.parseBoolean);else if(this.char===E3)return this.call(this.parseInlineList,this.recordValue);else if(this.char===n9)return this.call(this.parseInlineTable,this.recordValue);else throw this.error(new k("Unexpected character, expecting string, number, datetime, boolean, inline array or inline table"))}recordValue(Y){return this.returnNow(Y)}parseInf(){if(this.char===Q2)return this.next(this.parseInf2);else throw this.error(new k('Unexpected character, expected "inf", "+inf" or "-inf"'))}parseInf2(){if(this.char===q2)if(this.state.buf==="-")return this.return(-1/0);else return this.return(1/0);else throw this.error(new k('Unexpected character, expected "inf", "+inf" or "-inf"'))}parseNan(){if(this.char===F2)return this.next(this.parseNan2);else throw this.error(new k('Unexpected character, expected "nan"'))}parseNan2(){if(this.char===Q2)return this.return(NaN);else throw this.error(new k('Unexpected character, expected "nan"'))}parseKeyword(){if(this.char===u0)return this.next(this.parseBasicString);else if(this.char===c0)return this.next(this.parseLiteralString);else return this.goto(this.parseBareKey)}parseBareKey(){do if(this.char===U.END)throw this.error(new k("Key ended without value"));else if(e9(this.char))this.consume();else if(this.state.buf.length===0)throw this.error(new k("Empty bare keys are not allowed"));else return this.returnNow();while(this.nextChar())}parseSingleString(){if(this.char===c0)return this.next(this.parseLiteralMultiStringMaybe);else return this.goto(this.parseLiteralString)}parseLiteralString(){do if(this.char===c0)return this.return();else if(this.atEndOfLine())throw this.error(new k("Unterminated string"));else if(this.char===d2||this.char<=g2&&this.char!==m)throw this.errorControlCharInString();else this.consume();while(this.nextChar())}parseLiteralMultiStringMaybe(){if(this.char===c0)return this.next(this.parseLiteralMultiString);else return this.returnNow()}parseLiteralMultiString(){if(this.char===N0)return null;else if(this.char===$0)return this.next(this.parseLiteralMultiStringContent);else return this.goto(this.parseLiteralMultiStringContent)}parseLiteralMultiStringContent(){do if(this.char===c0)return this.next(this.parseLiteralMultiEnd);else if(this.char===U.END)throw this.error(new k("Unterminated multi-line string"));else if(this.char===d2||this.char<=g2&&this.char!==m&&this.char!==$0&&this.char!==N0)throw this.errorControlCharInString();else this.consume();while(this.nextChar())}parseLiteralMultiEnd(){if(this.char===c0)return this.next(this.parseLiteralMultiEnd2);else return this.state.buf+="'",this.goto(this.parseLiteralMultiStringContent)}parseLiteralMultiEnd2(){if(this.char===c0)return this.return();else return this.state.buf+="''",this.goto(this.parseLiteralMultiStringContent)}parseDoubleString(){if(this.char===u0)return this.next(this.parseMultiStringMaybe);else return this.goto(this.parseBasicString)}parseBasicString(){do if(this.char===u3)return this.call(this.parseEscape,this.recordEscapeReplacement);else if(this.char===u0)return this.return();else if(this.atEndOfLine())throw this.error(new k("Unterminated string"));else if(this.char===d2||this.char<=g2&&this.char!==m)throw this.errorControlCharInString();else this.consume();while(this.nextChar())}recordEscapeReplacement(Y){return this.state.buf+=Y,this.goto(this.parseBasicString)}parseMultiStringMaybe(){if(this.char===u0)return this.next(this.parseMultiString);else return this.returnNow()}parseMultiString(){if(this.char===N0)return null;else if(this.char===$0)return this.next(this.parseMultiStringContent);else return this.goto(this.parseMultiStringContent)}parseMultiStringContent(){do if(this.char===u3)return this.call(this.parseMultiEscape,this.recordMultiEscapeReplacement);else if(this.char===u0)return this.next(this.parseMultiEnd);else if(this.char===U.END)throw this.error(new k("Unterminated multi-line string"));else if(this.char===d2||this.char<=g2&&this.char!==m&&this.char!==$0&&this.char!==N0)throw this.errorControlCharInString();else this.consume();while(this.nextChar())}errorControlCharInString(){let Y="\\u00";if(this.char<16)Y+="0";return Y+=this.char.toString(16),this.error(new k(`Control characters (codes < 0x1f and 0x7f) are not allowed in strings, use ${Y} instead`))}recordMultiEscapeReplacement(Y){return this.state.buf+=Y,this.goto(this.parseMultiStringContent)}parseMultiEnd(){if(this.char===u0)return this.next(this.parseMultiEnd2);else return this.state.buf+='"',this.goto(this.parseMultiStringContent)}parseMultiEnd2(){if(this.char===u0)return this.return();else return this.state.buf+='""',this.goto(this.parseMultiStringContent)}parseMultiEscape(){if(this.char===N0||this.char===$0)return this.next(this.parseMultiTrim);else if(this.char===p||this.char===m)return this.next(this.parsePreMultiTrim);else return this.goto(this.parseEscape)}parsePreMultiTrim(){if(this.char===p||this.char===m)return null;else if(this.char===N0||this.char===$0)return this.next(this.parseMultiTrim);else throw this.error(new k("Can't escape whitespace"))}parseMultiTrim(){if(this.char===$0||this.char===p||this.char===m||this.char===N0)return null;else return this.returnNow()}parseEscape(){if(this.char in a5)return this.return(a5[this.char]);else if(this.char===y5)return this.call(this.parseSmallUnicode,this.parseUnicodeReturn);else if(this.char===l9)return this.call(this.parseLargeUnicode,this.parseUnicodeReturn);else throw this.error(new k("Unknown escape character: "+this.char))}parseUnicodeReturn(Y){try{let G=parseInt(Y,16);if(G>=p9&&G<=o9)throw this.error(new k("Invalid unicode, character in range 0xD800 - 0xDFFF is reserved"));return this.returnNow(String.fromCodePoint(G))}catch(G){throw this.error(k.wrap(G))}}parseSmallUnicode(){if(!C3(this.char))throw this.error(new k("Invalid character in unicode sequence, expected hex"));else if(this.consume(),this.state.buf.length>=4)return this.return()}parseLargeUnicode(){if(!C3(this.char))throw this.error(new k("Invalid character in unicode sequence, expected hex"));else if(this.consume(),this.state.buf.length>=8)return this.return()}parseNumberSign(){return this.consume(),this.next(this.parseMaybeSignedInfOrNan)}parseMaybeSignedInfOrNan(){if(this.char===l5)return this.next(this.parseInf);else if(this.char===Q2)return this.next(this.parseNan);else return this.callNow(this.parseNoUnder,this.parseNumberIntegerStart)}parseNumberIntegerStart(){if(this.char===G1)return this.consume(),this.next(this.parseNumberIntegerExponentOrDecimal);else return this.goto(this.parseNumberInteger)}parseNumberIntegerExponentOrDecimal(){if(this.char===L0)return this.consume(),this.call(this.parseNoUnder,this.parseNumberFloat);else if(this.char===$2||this.char===B1)return this.consume(),this.next(this.parseNumberExponentSign);else return this.returnNow(R1(this.state.buf))}parseNumberInteger(){if(a(this.char))this.consume();else if(this.char===M0)return this.call(this.parseNoUnder);else if(this.char===$2||this.char===B1)return this.consume(),this.next(this.parseNumberExponentSign);else if(this.char===L0)return this.consume(),this.call(this.parseNoUnder,this.parseNumberFloat);else{let Y=R1(this.state.buf);if(Y.isNaN())throw this.error(new k("Invalid number"));else return this.returnNow(Y)}}parseNoUnder(){if(this.char===M0||this.char===L0||this.char===$2||this.char===B1)throw this.error(new k("Unexpected character, expected digit"));else if(this.atEndOfWord())throw this.error(new k("Incomplete number"));return this.returnNow()}parseNoUnderHexOctBinLiteral(){if(this.char===M0||this.char===L0)throw this.error(new k("Unexpected character, expected digit"));else if(this.atEndOfWord())throw this.error(new k("Incomplete number"));return this.returnNow()}parseNumberFloat(){if(this.char===M0)return this.call(this.parseNoUnder,this.parseNumberFloat);else if(a(this.char))this.consume();else if(this.char===$2||this.char===B1)return this.consume(),this.next(this.parseNumberExponentSign);else return this.returnNow(o5(this.state.buf))}parseNumberExponentSign(){if(a(this.char))return this.goto(this.parseNumberExponent);else if(this.char===a0||this.char===m2)this.consume(),this.call(this.parseNoUnder,this.parseNumberExponent);else throw this.error(new k("Unexpected character, expected -, + or digit"))}parseNumberExponent(){if(a(this.char))this.consume();else if(this.char===M0)return this.call(this.parseNoUnder);else return this.returnNow(o5(this.state.buf))}parseNumberOrDateTime(){if(this.char===G1)return this.consume(),this.next(this.parseNumberBaseOrDateTime);else return this.goto(this.parseNumberOrDateTimeOnly)}parseNumberOrDateTimeOnly(){if(this.char===M0)return this.call(this.parseNoUnder,this.parseNumberInteger);else if(a(this.char)){if(this.consume(),this.state.buf.length>4)this.next(this.parseNumberInteger)}else if(this.char===$2||this.char===B1)return this.consume(),this.next(this.parseNumberExponentSign);else if(this.char===L0)return this.consume(),this.call(this.parseNoUnder,this.parseNumberFloat);else if(this.char===a0)return this.goto(this.parseDateTime);else if(this.char===D1)return this.goto(this.parseOnlyTimeHour);else return this.returnNow(R1(this.state.buf))}parseDateTimeOnly(){if(this.state.buf.length<4)if(a(this.char))return this.consume();else if(this.char===D1)return this.goto(this.parseOnlyTimeHour);else throw this.error(new k("Expected digit while parsing year part of a date"));else if(this.char===a0)return this.goto(this.parseDateTime);else throw this.error(new k("Expected hyphen (-) while parsing year part of date"))}parseNumberBaseOrDateTime(){if(this.char===t5)return this.consume(),this.call(this.parseNoUnderHexOctBinLiteral,this.parseIntegerBin);else if(this.char===c9)return this.consume(),this.call(this.parseNoUnderHexOctBinLiteral,this.parseIntegerOct);else if(this.char===s9)return this.consume(),this.call(this.parseNoUnderHexOctBinLiteral,this.parseIntegerHex);else if(this.char===L0)return this.goto(this.parseNumberInteger);else if(a(this.char))return this.goto(this.parseDateTimeOnly);else return this.returnNow(R1(this.state.buf))}parseIntegerHex(){if(C3(this.char))this.consume();else if(this.char===M0)return this.call(this.parseNoUnderHexOctBinLiteral);else{let Y=R1(this.state.buf);if(Y.isNaN())throw this.error(new k("Invalid number"));else return this.returnNow(Y)}}parseIntegerOct(){if(t9(this.char))this.consume();else if(this.char===M0)return this.call(this.parseNoUnderHexOctBinLiteral);else{let Y=R1(this.state.buf);if(Y.isNaN())throw this.error(new k("Invalid number"));else return this.returnNow(Y)}}parseIntegerBin(){if(i9(this.char))this.consume();else if(this.char===M0)return this.call(this.parseNoUnderHexOctBinLiteral);else{let Y=R1(this.state.buf);if(Y.isNaN())throw this.error(new k("Invalid number"));else return this.returnNow(Y)}}parseDateTime(){if(this.state.buf.length<4)throw this.error(new k("Years less than 1000 must be zero padded to four characters"));return this.state.result=this.state.buf,this.state.buf="",this.next(this.parseDateMonth)}parseDateMonth(){if(this.char===a0){if(this.state.buf.length<2)throw this.error(new k("Months less than 10 must be zero padded to two characters"));return this.state.result+="-"+this.state.buf,this.state.buf="",this.next(this.parseDateDay)}else if(a(this.char))this.consume();else throw this.error(new k("Incomplete datetime"))}parseDateDay(){if(this.char===T9||this.char===p){if(this.state.buf.length<2)throw this.error(new k("Days less than 10 must be zero padded to two characters"));return this.state.result+="-"+this.state.buf,this.state.buf="",this.next(this.parseStartTimeHour)}else if(this.atEndOfWord())return this.returnNow(m5(this.state.result+"-"+this.state.buf));else if(a(this.char))this.consume();else throw this.error(new k("Incomplete datetime"))}parseStartTimeHour(){if(this.atEndOfWord())return this.returnNow(m5(this.state.result));else return this.goto(this.parseTimeHour)}parseTimeHour(){if(this.char===D1){if(this.state.buf.length<2)throw this.error(new k("Hours less than 10 must be zero padded to two characters"));return this.state.result+="T"+this.state.buf,this.state.buf="",this.next(this.parseTimeMin)}else if(a(this.char))this.consume();else throw this.error(new k("Incomplete datetime"))}parseTimeMin(){if(this.state.buf.length<2&&a(this.char))this.consume();else if(this.state.buf.length===2&&this.char===D1)return this.state.result+=":"+this.state.buf,this.state.buf="",this.next(this.parseTimeSec);else throw this.error(new k("Incomplete datetime"))}parseTimeSec(){if(a(this.char)){if(this.consume(),this.state.buf.length===2)return this.state.result+=":"+this.state.buf,this.state.buf="",this.next(this.parseTimeZoneOrFraction)}else throw this.error(new k("Incomplete datetime"))}parseOnlyTimeHour(){if(this.char===D1){if(this.state.buf.length<2)throw this.error(new k("Hours less than 10 must be zero padded to two characters"));return this.state.result=this.state.buf,this.state.buf="",this.next(this.parseOnlyTimeMin)}else throw this.error(new k("Incomplete time"))}parseOnlyTimeMin(){if(this.state.buf.length<2&&a(this.char))this.consume();else if(this.state.buf.length===2&&this.char===D1)return this.state.result+=":"+this.state.buf,this.state.buf="",this.next(this.parseOnlyTimeSec);else throw this.error(new k("Incomplete time"))}parseOnlyTimeSec(){if(a(this.char)){if(this.consume(),this.state.buf.length===2)return this.next(this.parseOnlyTimeFractionMaybe)}else throw this.error(new k("Incomplete time"))}parseOnlyTimeFractionMaybe(){if(this.state.result+=":"+this.state.buf,this.char===L0)this.state.buf="",this.next(this.parseOnlyTimeFraction);else return this.return(d5(this.state.result))}parseOnlyTimeFraction(){if(a(this.char))this.consume();else if(this.atEndOfWord()){if(this.state.buf.length===0)throw this.error(new k("Expected digit in milliseconds"));return this.returnNow(d5(this.state.result+"."+this.state.buf))}else throw this.error(new k("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"))}parseTimeZoneOrFraction(){if(this.char===L0)this.consume(),this.next(this.parseDateTimeFraction);else if(this.char===a0||this.char===m2)this.consume(),this.next(this.parseTimeZoneHour);else if(this.char===T2)return this.consume(),this.return(h3(this.state.result+this.state.buf));else if(this.atEndOfWord())return this.returnNow(g5(this.state.result+this.state.buf));else throw this.error(new k("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"))}parseDateTimeFraction(){if(a(this.char))this.consume();else if(this.state.buf.length===1)throw this.error(new k("Expected digit in milliseconds"));else if(this.char===a0||this.char===m2)this.consume(),this.next(this.parseTimeZoneHour);else if(this.char===T2)return this.consume(),this.return(h3(this.state.result+this.state.buf));else if(this.atEndOfWord())return this.returnNow(g5(this.state.result+this.state.buf));else throw this.error(new k("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"))}parseTimeZoneHour(){if(a(this.char)){if(this.consume(),/\d\d$/.test(this.state.buf))return this.next(this.parseTimeZoneSep)}else throw this.error(new k("Unexpected character in datetime, expected digit"))}parseTimeZoneSep(){if(this.char===D1)this.consume(),this.next(this.parseTimeZoneMin);else throw this.error(new k("Unexpected character in datetime, expected colon"))}parseTimeZoneMin(){if(a(this.char)){if(this.consume(),/\d\d$/.test(this.state.buf))return this.return(h3(this.state.result+this.state.buf))}else throw this.error(new k("Unexpected character in datetime, expected digit"))}parseBoolean(){if(this.char===b3)return this.consume(),this.next(this.parseTrue_r);else if(this.char===q2)return this.consume(),this.next(this.parseFalse_a)}parseTrue_r(){if(this.char===r5)return this.consume(),this.next(this.parseTrue_u);else throw this.error(new k("Invalid boolean, expected true or false"))}parseTrue_u(){if(this.char===y5)return this.consume(),this.next(this.parseTrue_e);else throw this.error(new k("Invalid boolean, expected true or false"))}parseTrue_e(){if(this.char===B1)return this.return(!0);else throw this.error(new k("Invalid boolean, expected true or false"))}parseFalse_a(){if(this.char===F2)return this.consume(),this.next(this.parseFalse_l);else throw this.error(new k("Invalid boolean, expected true or false"))}parseFalse_l(){if(this.char===y9)return this.consume(),this.next(this.parseFalse_s);else throw this.error(new k("Invalid boolean, expected true or false"))}parseFalse_s(){if(this.char===a9)return this.consume(),this.next(this.parseFalse_e);else throw this.error(new k("Invalid boolean, expected true or false"))}parseFalse_e(){if(this.char===B1)return this.return(!1);else throw this.error(new k("Invalid boolean, expected true or false"))}parseInlineList(){if(this.char===p||this.char===m||this.char===N0||this.char===$0)return null;else if(this.char===U.END)throw this.error(new k("Unterminated inline array"));else if(this.char===K1)return this.call(this.parseComment);else if(this.char===Z2)return this.return(this.state.resultArr||n5());else return this.callNow(this.parseValue,this.recordInlineListValue)}recordInlineListValue(Y){if(this.state.resultArr){let G=this.state.resultArr[U6],$=i5(Y);if(G!==$)throw this.error(new k(`Inline lists must be a single type, not a mix of ${G} and ${$}`))}else this.state.resultArr=n5(i5(Y));if(P3(Y)||V3(Y))this.state.resultArr.push(Y.valueOf());else this.state.resultArr.push(Y);return this.goto(this.parseInlineListNext)}parseInlineListNext(){if(this.char===p||this.char===m||this.char===N0||this.char===$0)return null;else if(this.char===K1)return this.call(this.parseComment);else if(this.char===T5)return this.next(this.parseInlineList);else if(this.char===Z2)return this.goto(this.parseInlineList);else throw this.error(new k("Invalid character, expected whitespace, comma (,) or close bracket (])"))}parseInlineTable(){if(this.char===p||this.char===m)return null;else if(this.char===U.END||this.char===K1||this.char===$0||this.char===N0)throw this.error(new k("Unterminated inline array"));else if(this.char===c5)return this.return(this.state.resultTable||s5());else{if(!this.state.resultTable)this.state.resultTable=s5();return this.callNow(this.parseAssign,this.recordInlineTableValue)}}recordInlineTableValue(Y){let G=this.state.resultTable,$=Y.key.pop();for(let Z of Y.key){if(Y1(G,Z)&&(!J2(G[Z])||G[Z][N2]))throw this.error(new k("Can't redefine existing key"));G=G[Z]=G[Z]||w1()}if(Y1(G,$))throw this.error(new k("Can't redefine existing key"));if(V3(Y.value)||P3(Y.value))G[$]=Y.value.valueOf();else G[$]=Y.value;return this.goto(this.parseInlineTableNext)}parseInlineTableNext(){if(this.char===p||this.char===m)return null;else if(this.char===U.END||this.char===K1||this.char===$0||this.char===N0)throw this.error(new k("Unterminated inline array"));else if(this.char===T5)return this.next(this.parseInlineTable);else if(this.char===c5)return this.goto(this.parseInlineTable);else throw this.error(new k("Invalid character, expected whitespace, comma (,) or close bracket (])"))}}return X}});var a2=I0((XU,Z6)=>{Z6.exports=Z7;function Z7(U,X){if(U.pos==null||U.line==null)return U;let Y=U.message;if(Y+=` at row ${U.line+1}, col ${U.col+1}, pos ${U.pos}:
3
+ `,X&&X.split){let G=X.split(/\n/),$=String(Math.min(G.length,U.line+3)).length,Z=" ";while(Z.length<$)Z+=" ";for(let J=Math.max(0,U.line-1);J<Math.min(G.length,U.line+2);++J){let Q=String(J+1);if(Q.length<$)Q=" "+Q;if(U.line===J){Y+=Q+"> "+G[J]+`
4
+ `,Y+=Z+" ";for(let F=0;F<U.col;++F)Y+=" ";Y+=`^
5
+ `}else Y+=Q+": "+G[J]+`
6
+ `}}return U.message=Y+`
7
+ `,U}});var Q6=I0((YU,J6)=>{J6.exports=N7;var J7=c2(),Q7=a2();function N7(U){if(global.Buffer&&global.Buffer.isBuffer(U))U=U.toString("utf8");let X=new J7;try{return X.parse(U),X.finish()}catch(Y){throw Q7(Y,U)}}});var F6=I0((GU,q6)=>{q6.exports=F7;var q7=c2(),N6=a2();function F7(U,X){if(!X)X={};let Y=0,G=X.blocksize||40960,$=new q7;return new Promise((J,Q)=>{setImmediate(Z,Y,G,J,Q)});function Z(J,Q,F,_){if(J>=U.length)try{return F($.finish())}catch(I){return _(N6(I,U))}try{$.parse(U.slice(J,J+Q)),setImmediate(Z,J+Q,Q,F,_)}catch(I){_(N6(I,U))}}}});var z6=I0(($U,_6)=>{_6.exports=_7;var W7=v9("stream"),W6=c2();function _7(U){if(U)return z7(U);else return I7(U)}function z7(U){let X=new W6;return U.setEncoding("utf8"),new Promise((Y,G)=>{let $,Z=!1,J=!1;function Q(){if(Z=!0,$)return;try{Y(X.finish())}catch(I){G(I)}}function F(I){J=!0,G(I)}U.once("end",Q),U.once("error",F),_();function _(){$=!0;let I;while((I=U.read())!==null)try{X.parse(I)}catch(H){return F(H)}if($=!1,Z)return Q();if(J)return;U.once("readable",_)}})}function I7(){let U=new W6;return new W7.Transform({objectMode:!0,transform(X,Y,G){try{U.parse(X.toString(Y))}catch($){this.emit("error",$)}G()},flush(X){try{this.push(U.finish())}catch(Y){this.emit("error",Y)}X()}})}});var I6=I0((ZU,_2)=>{_2.exports=Q6();_2.exports.async=F6();_2.exports.stream=z6();_2.exports.prettyError=a2()});var L6=I0((JU,c3)=>{c3.exports=A7;c3.exports.value=y3;function A7(U){if(U===null)throw H1("null");if(U===void 0)throw H1("undefined");if(typeof U!=="object")throw H1(typeof U);if(typeof U.toJSON==="function")U=U.toJSON();if(U==null)return null;let X=q0(U);if(X!=="table")throw H1(X);return l3("","",U)}function H1(U){return Error("Can only stringify objects, not "+U)}function K7(){return Error("Array values can't have mixed types")}function A6(U){return Object.keys(U).filter((X)=>K6(U[X]))}function D7(U){return Object.keys(U).filter((X)=>!K6(U[X]))}function s2(U){let X=Array.isArray(U)?[]:Object.prototype.hasOwnProperty.call(U,"__proto__")?{["__proto__"]:void 0}:{};for(let Y of Object.keys(U))if(U[Y]&&typeof U[Y].toJSON==="function"&&!("toISOString"in U[Y]))X[Y]=U[Y].toJSON();else X[Y]=U[Y];return X}function l3(U,X,Y){Y=s2(Y);var G,$;G=A6(Y),$=D7(Y);var Z=[],J=X||"";if(G.forEach((F)=>{var _=q0(Y[F]);if(_!=="undefined"&&_!=="null")Z.push(J+n2(F)+" = "+w6(Y[F],!0))}),Z.length>0)Z.push("");var Q=U&&G.length>0?X+" ":"";return $.forEach((F)=>{Z.push(E7(U,Q,F,Y[F]))}),Z.join(`
8
+ `)}function K6(U){switch(q0(U)){case"undefined":case"null":case"integer":case"nan":case"float":case"boolean":case"string":case"datetime":return!0;case"array":return U.length===0||q0(U[0])!=="table";case"table":return Object.keys(U).length===0;default:return!1}}function q0(U){if(U===void 0)return"undefined";else if(U===null)return"null";else if(typeof U==="bigint"||Number.isInteger(U)&&!Object.is(U,-0))return"integer";else if(typeof U==="number")return"float";else if(typeof U==="boolean")return"boolean";else if(typeof U==="string")return"string";else if("toISOString"in U)return isNaN(U)?"undefined":"datetime";else if(Array.isArray(U))return"array";else return"table"}function n2(U){var X=String(U);if(/^[-A-Za-z0-9_]+$/.test(X))return X;else return D6(X)}function D6(U){return'"'+B6(U).replace(/"/g,"\\\"")+'"'}function B7(U){return"'"+U+"'"}function w7(U,X){while(X.length<U)X="0"+X;return X}function B6(U){return U.replace(/\\/g,"\\\\").replace(/[\b]/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/([\u0000-\u001f\u007f])/,(X)=>"\\u"+w7(4,X.codePointAt(0).toString(16)))}function R7(U){let X=U.split(/\n/).map((Y)=>{return B6(Y).replace(/"(?="")/g,"\\\"")}).join(`
9
+ `);if(X.slice(-1)==='"')X+="\\\n";return`"""
10
+ `+X+'"""'}function w6(U,X){let Y=q0(U);if(Y==="string"){if(X&&/\n/.test(U))Y="string-multiline";else if(!/[\b\t\n\f\r']/.test(U)&&/"/.test(U))Y="string-literal"}return y3(U,Y)}function y3(U,X){if(!X)X=q0(U);switch(X){case"string-multiline":return R7(U);case"string":return D6(U);case"string-literal":return B7(U);case"integer":return R6(U);case"float":return H7(U);case"boolean":return L7(U);case"datetime":return M7(U);case"array":return j7(U.filter((Y)=>q0(Y)!=="null"&&q0(Y)!=="undefined"&&q0(Y)!=="nan"));case"table":return h7(U);default:throw H1(X)}}function R6(U){return String(U).replace(/\B(?=(\d{3})+(?!\d))/g,"_")}function H7(U){if(U===1/0)return"inf";else if(U===-1/0)return"-inf";else if(Object.is(U,NaN))return"nan";else if(Object.is(U,-0))return"-0.0";var X=String(U).split("."),Y=X[0],G=X[1]||0;return R6(Y)+"."+G}function L7(U){return String(U)}function M7(U){return U.toISOString()}function k7(U){return U==="float"||U==="integer"}function O7(U){var X=q0(U[0]);if(U.every((Y)=>q0(Y)===X))return X;if(U.every((Y)=>k7(q0(Y))))return"float";return"mixed"}function H6(U){let X=O7(U);if(X==="mixed")throw K7();return X}function j7(U){U=s2(U);let X=H6(U);var Y="[",G=U.map(($)=>y3($,X));if(G.join(", ").length>60||/\n/.test(G))Y+=`
11
+ `+G.join(`,
12
+ `)+`
13
+ `;else Y+=" "+G.join(", ")+(G.length>0?" ":"");return Y+"]"}function h7(U){U=s2(U);var X=[];return Object.keys(U).forEach((Y)=>{X.push(n2(Y)+" = "+w6(U[Y],!1))}),"{ "+X.join(", ")+(X.length>0?" ":"")+"}"}function E7(U,X,Y,G){var $=q0(G);if($==="array")return C7(U,X,Y,G);else if($==="table")return f7(U,X,Y,G);else throw H1($)}function C7(U,X,Y,G){G=s2(G),H6(G);var $=q0(G[0]);if($!=="table")throw H1($);var Z=U+n2(Y),J="";return G.forEach((Q)=>{if(J.length>0)J+=`
14
+ `;J+=X+"[["+Z+`]]
15
+ `,J+=l3(Z+".",X,Q)}),J}function f7(U,X,Y,G){var $=U+n2(Y),Z="";if(A6(G).length>0)Z+=X+"["+$+`]
16
+ `;return Z+l3($+".",X,G)}});import{existsSync as K5,readFileSync as D5}from"fs";import{join as E9,resolve as M3}from"path";var a3=I6(),V7=L6();import{exit as C9}from"process";class N{representation;static ACTIVE_PLAYER=new N("active_player");static ACTIVE_PLAYER2=new N(".active_player");static P_ACTIVE_PLAYER=new N("p_active_player");static P_ACTIVE_PLAYER2=new N(".p_active_player");static ACTIVE_NPC=new N("active_npc");static ACTIVE_NPC2=new N(".active_npc");static ACTIVE_LOC=new N("active_loc");static ACTIVE_LOC2=new N(".active_loc");static ACTIVE_OBJ=new N("active_obj");static ACTIVE_OBJ2=new N(".active_obj");static FIND_PLAYER=new N("find_player");static FIND_NPC=new N("find_npc");static FIND_LOC=new N("find_loc");static FIND_OBJ=new N("find_obj");static FIND_DB=new N("find_db");static LAST_COM=new N("last_com");static LAST_INT=new N("last_int");static LAST_ITEM=new N("last_item");static LAST_SLOT=new N("last_slot");static LAST_TARGETSLOT=new N("last_targetslot");static LAST_USEITEM=new N("last_useitem");static LAST_USESLOT=new N("last_useslot");static ALL=Object.values(N).filter((U)=>U instanceof N);static NAME_TO_TYPE=N.ALL.reduce((U,X)=>{return U[X.getName().toLowerCase()]=X,U},{});constructor(U){this.representation=U}getName(){for(let U of Object.keys(N))if(N[U]===this)return U;return""}static forName(U){return this.NAME_TO_TYPE[U.toLowerCase()]}}class s0{trigger;name;parameters;returns;constructor(U,X,Y,G){this.trigger=U;this.name=X;this.parameters=Y;this.returns=G}pointers(U){return U.getPointers(this)}}class z2 extends s0{}class B{constructor(){}static None=new class extends B{};static Name=new class extends B{};static Type(U,X=!0,Y=!0){return new class extends B{type=U;category=X;global=Y}}}var A0={id:-1,identifier:"command",subjectMode:B.Name,allowParameters:!0,parameters:null,allowReturns:!0,returns:null,pointers:null};class s3{commands=new Map;scripts=new Map;symbols=new Map;putSymbol(U,X){if(this.symbols.has(X)){if(X.context?.diagnostics)X.context.diagnostics.report(`Duplicate symbol: ${X}.`);return}this.symbols.set(X,U)}putCommand(U,X){if(this.commands.has(X))return;this.commands.set(X,U)}putScript(U,X){if(this.scripts.has(X))return;this.scripts.set(X,U)}get(U){if(U instanceof s0)if(U.trigger===A0){let Y=U.name.substring(U.name.indexOf(".")+1),G=this.commands.get(Y);if(G===void 0){if(U.context?.diagnostics)U.context.diagnostics.report(`Unable to find id for '${U}'.`);return-1}return G}else{let Y=`[${U.trigger.identifier},${U.name}]`,G=this.scripts.get(Y);if(G===void 0){if(U.context?.diagnostics)U.context.diagnostics.report(`Unable to find id for '${U}'.`);return-1}return G}let X=this.symbols.get(U);if(X===void 0)throw Error(`Unable to find id for '${U}'.`);return X}}import*as U0 from"fs";import*as K2 from"path";class W{constructor(){}static PushConstantInt=new W;static PushConstantString=new W;static PushConstantLong=new W;static PushConstantSymbol=new W;static PushLocalVar=new W;static PopLocalVar=new W;static PushVar=new W;static PushVar2=new W;static PopVar=new W;static PopVar2=new W;static DefineArray=new W;static Switch=new W;static Branch=new W;static BranchNot=new W;static BranchEquals=new W;static BranchLessThan=new W;static BranchGreaterThan=new W;static BranchLessThanOrEquals=new W;static BranchGreaterThanOrEquals=new W;static LongBranchNot=new W;static LongBranchEquals=new W;static LongBranchLessThan=new W;static LongBranchGreaterThan=new W;static LongBranchLessThanOrEquals=new W;static LongBranchGreaterThanOrEquals=new W;static ObjBranchNot=new W;static ObjBranchEquals=new W;static JoinString=new W;static Discard=new W;static Gosub=new W;static Jump=new W;static Command=new W;static Return=new W;static Add=new W;static Sub=new W;static Multiply=new W;static Divide=new W;static Modulo=new W;static Or=new W;static And=new W;static LongAdd=new W;static LongSub=new W;static LongMultiply=new W;static LongDivide=new W;static LongModulo=new W;static LongOr=new W;static LongAnd=new W;static LineNumber=new W}class k0{name;type;constructor(U,X){this.name=U;this.type=X}}class J0{name;type;isProtected;constructor(U,X,Y=!1){this.name=U;this.type=X;this.isProtected=Y}}class g1{name;value;constructor(U,X){this.name=U;this.value=X}}class y{allowSwitch=!0;allowArray=!0;allowDeclaration=!0;constructor(U){if(U)Object.assign(this,U)}}class K{name;representation;baseType=0;defaultValue=-1;options=new y({allowSwitch:!1,allowArray:!1,allowDeclaration:!1});constructor(U){this.name=U;this.representation=U.toLowerCase()}get code(){throw Error("MetaType has no character representation.")}static Any=new K("any");static Nothing=new K("nothing");static Error=new K("error");static Unit=new K("unit");static Type=class extends K{inner;constructor(U){super("type");this.inner=U,this.representation=`type<${U.representation}>`}};static Script=class extends K{trigger;parameterType;returnType;constructor(U,X,Y){super("script");this.trigger=U,this.parameterType=X,this.returnType=Y,this.representation=U.identifier}};static Hook=class extends K{transmitListType;constructor(U){super("hook");this.transmitListType=U,this.representation=`hook<${U.representation}>`}}}class I2{representation;code;baseType;defaultValue;options}class L extends I2{code;baseType;defaultValue;constructor(U,X,Y,G,$){super();this.code=X;this.baseType=Y;this.defaultValue=G;this.representation=U.toLowerCase();let Z=new y;$?.(Z),this.options=Z}static INT=new L("INT","i",0,0);static BOOLEAN=new L("BOOLEAN","1",0,0);static COORD=new L("COORD","c",0,-1);static STRING=new L("STRING","s",1,"",(U)=>{U.allowArray=!1,U.allowSwitch=!1});static CHAR=new L("CHAR","z",0,-1);static LONG=new L("LONG","Ï",2,-1,(U)=>{U.allowArray=!1,U.allowSwitch=!1});static MAPZONE=new L("MAPZONE","0",0,-1);static ALL=[L.INT,L.BOOLEAN,L.COORD,L.STRING,L.CHAR,L.LONG,L.MAPZONE];static byRepresentation(U){return L.ALL.find((X)=>X.representation===U)}}class o{inner;options=new y({allowArray:!1,allowDeclaration:!0,allowSwitch:!0});constructor(U){if(U instanceof o)throw Error("ArrayType cannot wrap another ArrayType.");this.inner=U}get representation(){return`${this.inner.representation}array`}get code(){throw Error("ArrayType has no character representation.")}get baseType(){return 0}get defaultValue(){throw Error("ArrayType hass no default value.")}toString(){return`ArrayType{inner=${this.inner}}`}}class $1{code=void 0;baseType=0;defaultValue=-1;options=new y({allowArray:!1,allowDeclaration:!1,allowSwitch:!1})}class B0 extends $1{inner;representation;constructor(U){super();this.inner=U;this.representation=`varp<${U.representation}>`}}class w0 extends $1{inner;representation;constructor(U){super();this.inner=U;this.representation=`varbit<${U.representation}>`}}class O0 extends $1{inner;representation;constructor(U){super();this.inner=U;this.representation=`varn<${U.representation}>`}}class m1 extends $1{inner;representation;constructor(U){super();this.inner=U;this.representation=`vars<${U.representation}>`}}class F0{idProvider;constructor(U){this.idProvider=U}write(U){let X=this.createContext(U);for(let Y of U.blocks){this.enterBlock(X,Y);for(let G of Y.instructions)this.writeInstruction(X,G),X.curIndex++}this.finishWrite(U,X)}close(){}writeInstruction(U,X){let{opcode:Y,operand:G}=X;switch(Y){case W.PushConstantInt:this.writePushConstantInt(U,G);break;case W.PushConstantString:this.writePushConstantString(U,G);break;case W.PushConstantLong:this.writePushConstantLong(U,G);break;case W.PushConstantSymbol:this.writePushConstantSymbol(U,G);break;case W.PushLocalVar:this.writePushLocalVar(U,G);break;case W.PopLocalVar:this.writePopLocalVar(U,G);break;case W.PushVar:this.writePushVar(U,G,!1);break;case W.PushVar2:this.writePushVar(U,G,!0);break;case W.PopVar:this.writePopVar(U,G,!1);break;case W.PopVar2:this.writePopVar(U,G,!0);break;case W.DefineArray:this.writeDefineArray(U,G);break;case W.Switch:this.writeSwitch(U,G);break;case W.Branch:case W.BranchNot:case W.BranchEquals:case W.BranchLessThan:case W.BranchGreaterThan:case W.BranchLessThanOrEquals:case W.BranchGreaterThanOrEquals:case W.LongBranchNot:case W.LongBranchEquals:case W.LongBranchLessThan:case W.LongBranchGreaterThan:case W.LongBranchLessThanOrEquals:case W.LongBranchGreaterThanOrEquals:case W.ObjBranchNot:case W.ObjBranchEquals:this.writeBranch(U,Y,G);break;case W.JoinString:this.writeJoinString(U,G);break;case W.Discard:this.writeDiscard(U,G);break;case W.Gosub:this.writeGosub(U,G);break;case W.Jump:this.writeJump(U,G);break;case W.Command:this.writeCommand(U,G);break;case W.Return:this.writeReturn(U);break;case W.Add:case W.Sub:case W.Multiply:case W.Divide:case W.Modulo:case W.Or:case W.And:case W.LongAdd:case W.LongSub:case W.LongMultiply:case W.LongDivide:case W.LongModulo:case W.LongOr:case W.LongAnd:this.writeMath(U,Y);break;case W.LineNumber:throw Error("LineNumber opcode should not exist.")}}enterBlock(U,X){throw Error("Not implemented")}writePushConstantInt(U,X){throw Error("Not implemented")}writePushConstantString(U,X){throw Error("Not implemented")}writePushConstantLong(U,X){throw Error("Not implemented")}writePushConstantSymbol(U,X){throw Error("Not implemented")}writePushLocalVar(U,X){throw Error("Not implemented")}writePopLocalVar(U,X){throw Error("Not implemented")}writePushVar(U,X,Y){throw Error("Not implemented")}writePopVar(U,X,Y){throw Error("Not implemented")}writeDefineArray(U,X){throw Error("Not implemented")}writeSwitch(U,X){throw Error("Not implemented")}writeBranch(U,X,Y){throw Error("Not implemented")}writeJoinString(U,X){throw Error("Not implemented")}writeDiscard(U,X){throw Error("Not implemented")}writeJump(U,X){throw Error("Not implemented")}writeGosub(U,X){throw Error("Not implemented")}writeCommand(U,X){throw Error("Not implemented")}writeReturn(U){throw Error("Not implemented")}writeMath(U,X){throw Error("Not implemented")}static generateLineNumberTable(U){let X=new Map,Y=0,G=-1;for(let $ of U.blocks)for(let Z of $.instructions){let J=Z.source?.line;if(J!==void 0&&J!==G)X.set(Y,J),G=J;Y++}return X}static generateJumpTable(U){let X=new Map,Y=0;for(let G of U.blocks)X.set(G.label,Y),Y+=G.instructions.length;return X}static getParameterCount(U,X){return U.parameters.filter((Y)=>Y.type.baseType===X).length}static getLocalCount(U,X){return U.all.filter((Y)=>Y.type.baseType===X&&(!(Y.type instanceof o)||U.parameters.includes(Y))).length}static getVariableId(U,X){if(X.type instanceof o)return U.all.filter((Y)=>Y.type instanceof o).indexOf(X);return U.all.filter((Y)=>Y.type.baseType===X.type.baseType&&(!(Y.type instanceof o)||U.parameters.includes(Y))).indexOf(X)}}class n3{script;curIndex=0;lineNumberTable;jumpTable;constructor(U){this.script=U;this.lineNumberTable=F0.generateLineNumberTable(U),this.jumpTable=F0.generateJumpTable(U)}close(){}}class w{id;largeOperand;constructor(U,X=!1){this.id=U;this.largeOperand=X}static PUSH_CONSTANT_INT=new w(0,!0);static PUSH_VARP=new w(1,!0);static POP_VARP=new w(2,!0);static PUSH_CONSTANT_STRING=new w(3,!0);static PUSH_VARN=new w(4,!0);static POP_VARN=new w(5,!0);static BRANCH=new w(6,!0);static BRANCH_NOT=new w(7,!0);static BRANCH_EQUALS=new w(8,!0);static BRANCH_LESS_THAN=new w(9,!0);static BRANCH_GREATER_THAN=new w(10,!0);static PUSH_VARS=new w(11,!0);static POP_VARS=new w(12,!0);static RETURN=new w(21);static GOSUB=new w(22);static JUMP=new w(23);static SWITCH=new w(24,!0);static PUSH_VARBIT=new w(25,!0);static POP_VARBIT=new w(27,!0);static BRANCH_LESS_THAN_OR_EQUALS=new w(31,!0);static BRANCH_GREATER_THAN_OR_EQUALS=new w(32,!0);static PUSH_INT_LOCAL=new w(33,!0);static POP_INT_LOCAL=new w(34,!0);static PUSH_STRING_LOCAL=new w(35,!0);static POP_STRING_LOCAL=new w(36,!0);static JOIN_STRING=new w(37,!0);static POP_INT_DISCARD=new w(38);static POP_STRING_DISCARD=new w(39);static GOSUB_WITH_PARAMS=new w(40,!0);static JUMP_WITH_PARAMS=new w(41,!0);static DEFINE_ARRAY=new w(44,!0);static PUSH_ARRAY_INT=new w(45,!0);static POP_ARRAY_INT=new w(46,!0);static ADD=new w(4600);static SUB=new w(4601);static MULTIPLY=new w(4602);static DIVIDE=new w(4603);static MODULO=new w(4611);static AND=new w(4614);static OR=new w(4615);static ALL=[w.PUSH_CONSTANT_INT,w.PUSH_VARP,w.POP_VARP,w.PUSH_CONSTANT_STRING,w.PUSH_VARN,w.POP_VARN,w.BRANCH,w.BRANCH_NOT,w.BRANCH_EQUALS,w.BRANCH_LESS_THAN,w.BRANCH_GREATER_THAN,w.PUSH_VARS,w.POP_VARS,w.RETURN,w.GOSUB,w.JUMP,w.SWITCH,w.PUSH_VARBIT,w.POP_VARBIT,w.BRANCH_LESS_THAN_OR_EQUALS,w.BRANCH_GREATER_THAN_OR_EQUALS,w.PUSH_INT_LOCAL,w.POP_INT_LOCAL,w.PUSH_STRING_LOCAL,w.POP_STRING_LOCAL,w.JOIN_STRING,w.POP_INT_DISCARD,w.POP_STRING_DISCARD,w.GOSUB_WITH_PARAMS,w.JUMP_WITH_PARAMS,w.DEFINE_ARRAY,w.PUSH_ARRAY_INT,w.POP_ARRAY_INT,w.ADD,w.SUB,w.MULTIPLY,w.DIVIDE,w.MODULO,w.AND,w.OR]}class z extends I2{static ALL=[];constructor(U,X=0,Y=-1,G){super();this.code=U,this.baseType=X,this.defaultValue=Y,this.representation=G,this.options=new y,z.ALL.push(this)}static SEQ=new z("A",0,-1,"seq");static LOC_SHAPE=new z("H",0,-1,"locshape");static COMPONENT=new z("I",0,-1,"component");static IDKIT=new z("K",0,-1,"idkit");static MIDI=new z("M",0,-1,"midi");static NPC_MODE=new z("N",0,-1,"npc_mode");static NAMEDOBJ=new z("O",0,-1,"namedobj");static SYNTH=new z("P",0,-1,"synth");static AREA=new z("R",0,-1,"area");static STAT=new z("S",0,-1,"stat");static NPC_STAT=new z("T",0,-1,"npc_stat");static WRITEINV=new z("V",0,-1,"writeinv");static MAPAREA=new z("`",0,-1,"wma");static GRAPHIC=new z("d",0,-1,"graphic");static FONTMETRICS=new z("f",0,-1,"fontmetrics");static ENUM=new z("g",0,-1,"enum");static HUNT=new z("h",0,-1,"hunt");static JINGLE=new z("j",0,-1,"jingle");static LOC=new z("l",0,-1,"loc");static MODEL=new z("m",0,-1,"model");static NPC=new z("n",0,-1,"npc");static OBJ=new z("o",0,-1,"obj");static PLAYER_UID=new z("p",0,-1,"player_uid");static SPOTANIM=new z("t",0,-1,"spotanim");static NPC_UID=new z("u",0,-1,"npc_uid");static INV=new z("v",0,-1,"inv");static TEXTURE=new z("x",0,-1,"texture");static CATEGORY=new z("y",0,-1,"category");static MAPELEMENT=new z("µ",0,-1,"mapelement");static HITMARK=new z("×",0,-1,"hitmark");static STRUCT=new z("J",0,-1,"struct");static DBROW=new z("Ð",0,-1,"dbrow");static INTERFACE=new z("a",0,-1,"interface");static TOPLEVELINTERFACE=new z("F",0,-1,"toplevelinterface");static OVERLAYINTERFACE=new z("L",0,-1,"overlayinterface");static MOVESPEED=new z("Ý",0,-1,"movespeed");static ENTITYOVERLAY=new z("-",0,-1,"entityoverlay");static DBTABLE=new z("Ø",0,-1,"dbtable");static STRINGVECTOR=new z("¸",0,-1,"stringvector");static MESANIM=new z("Á",0,-1,"mesanim");static VERIFY_OBJECT=new z("®",0,-1,"verifyobj")}class E{children;representation;code=null;baseType=null;defaultValue=null;options=new y({allowArray:!1,allowSwitch:!1,allowDeclaration:!1});constructor(...U){let X=E.flatten(U);if(X.length<2)throw Error("TupleType should not be used when type count is < 2");this.children=X,this.representation=this.children.map((Y)=>Y.representation).join(",")}static fromList(U){if(!U||U.length===0)return K.Unit;if(U.length===1)return U[0];return new E(...U)}static toList(U){if(!U||U===K.Unit||U===K.Nothing)return[];if(U instanceof E)return U.children;return[U]}static flatten(U){let X=[];for(let Y of U)if(Y instanceof E)X.push(...Y.children);else X.push(Y);return X}}class D{static ALL=[];id;subjectMode;allowParameters;parameters;allowReturns;returns;pointers;identifier;constructor({id:U,name:X,subjectMode:Y,allowParameters:G=!1,parameters:$=null,allowReturns:Z=!1,returns:J=null,pointers:Q=null}){if(this.id=U,Y==null)this.subjectMode=B.Name;else this.subjectMode=Y;this.allowParameters=G,this.parameters=$,this.allowReturns=Z,this.returns=J,this.pointers=Q??null,this.identifier=X.toLowerCase(),D.ALL.push(this)}static PROC=new D({id:0,name:"PROC",subjectMode:B.Name,allowParameters:!0,allowReturns:!0,pointers:new Set(Object.values(N))});static LABEL=new D({id:1,name:"LABEL",subjectMode:B.Name,allowParameters:!0,pointers:new Set(Object.values(N))});static DEBUGPROC=new D({id:2,name:"DEBUGPROC",subjectMode:B.Name,allowParameters:!0,pointers:new Set([N.ACTIVE_PLAYER])});static APNPC1=new D({id:3,name:"APNPC1",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_NPC])});static APNPC2=new D({id:4,name:"APNPC2",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_NPC])});static APNPC3=new D({id:5,name:"APNPC3",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_NPC])});static APNPC4=new D({id:6,name:"APNPC4",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_NPC])});static APNPC5=new D({id:7,name:"APNPC5",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_NPC])});static APNPCU=new D({id:8,name:"APNPCU",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.LAST_USEITEM,N.LAST_USESLOT,N.ACTIVE_NPC])});static APNPCT=new D({id:9,name:"APNPCT",subjectMode:B.Type(z.COMPONENT,!1,!1),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_NPC])});static OPNPC1=new D({id:10,name:"OPNPC1",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_NPC])});static OPNPC2=new D({id:11,name:"OPNPC2",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_NPC])});static OPNPC3=new D({id:12,name:"OPNPC3",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_NPC])});static OPNPC4=new D({id:13,name:"OPNPC4",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_NPC])});static OPNPC5=new D({id:14,name:"OPNPC5",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_NPC])});static OPNPCU=new D({id:15,name:"OPNPCU",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.LAST_USEITEM,N.LAST_USESLOT,N.ACTIVE_NPC])});static OPNPCT=new D({id:16,name:"OPNPCT",subjectMode:B.Type(z.COMPONENT,!1,!1),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_NPC])});static AI_APNPC1=new D({id:17,name:"AI_APNPC1",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_NPC2])});static AI_APNPC2=new D({id:18,name:"AI_APNPC2",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_NPC2])});static AI_APNPC3=new D({id:19,name:"AI_APNPC3",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_NPC2])});static AI_APNPC4=new D({id:20,name:"AI_APNPC4",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_NPC2])});static AI_APNPC5=new D({id:21,name:"AI_APNPC5",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_NPC2])});static AI_OPNPC1=new D({id:24,name:"AI_OPNPC1",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_NPC2])});static AI_OPNPC2=new D({id:25,name:"AI_OPNPC2",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_NPC2])});static AI_OPNPC3=new D({id:26,name:"AI_OPNPC3",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_NPC2])});static AI_OPNPC4=new D({id:27,name:"AI_OPNPC4",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_NPC2])});static AI_OPNPC5=new D({id:28,name:"AI_OPNPC5",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_NPC2])});static APOBJ1=new D({id:31,name:"APOBJ1",subjectMode:B.Type(z.NAMEDOBJ),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_OBJ])});static APOBJ2=new D({id:32,name:"APOBJ2",subjectMode:B.Type(z.NAMEDOBJ),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_OBJ])});static APOBJ3=new D({id:33,name:"APOBJ3",subjectMode:B.Type(z.NAMEDOBJ),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_OBJ])});static APOBJ4=new D({id:34,name:"APOBJ4",subjectMode:B.Type(z.NAMEDOBJ),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_OBJ])});static APOBJ5=new D({id:35,name:"APOBJ5",subjectMode:B.Type(z.NAMEDOBJ),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_OBJ])});static APOBJU=new D({id:36,name:"APOBJU",subjectMode:B.Type(z.NAMEDOBJ),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.LAST_USEITEM,N.LAST_USESLOT,N.ACTIVE_OBJ])});static APOBJT=new D({id:37,name:"APOBJT",subjectMode:B.Type(z.COMPONENT,!1,!1),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_OBJ])});static OPOBJ1=new D({id:38,name:"OPOBJ1",subjectMode:B.Type(z.NAMEDOBJ),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_OBJ])});static OPOBJ2=new D({id:39,name:"OPOBJ2",subjectMode:B.Type(z.NAMEDOBJ),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_OBJ])});static OPOBJ3=new D({id:40,name:"OPOBJ3",subjectMode:B.Type(z.NAMEDOBJ),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_OBJ])});static OPOBJ4=new D({id:41,name:"OPOBJ4",subjectMode:B.Type(z.NAMEDOBJ),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_OBJ])});static OPOBJ5=new D({id:42,name:"OPOBJ5",subjectMode:B.Type(z.NAMEDOBJ),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_OBJ])});static OPOBJU=new D({id:43,name:"OPOBJU",subjectMode:B.Type(z.NAMEDOBJ),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.LAST_USEITEM,N.LAST_USESLOT,N.ACTIVE_OBJ])});static OPOBJT=new D({id:44,name:"OPOBJT",subjectMode:B.Type(z.COMPONENT,!1,!1),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_OBJ])});static AI_APOBJ1=new D({id:45,name:"AI_APOBJ1",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_OBJ])});static AI_APOBJ2=new D({id:46,name:"AI_APOBJ2",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_OBJ])});static AI_APOBJ3=new D({id:47,name:"AI_APOBJ3",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_OBJ])});static AI_APOBJ4=new D({id:48,name:"AI_APOBJ4",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_OBJ])});static AI_APOBJ5=new D({id:49,name:"AI_APOBJ5",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_OBJ])});static AI_OPOBJ1=new D({id:52,name:"AI_OPOBJ1",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_OBJ])});static AI_OPOBJ2=new D({id:53,name:"AI_OPOBJ2",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_OBJ])});static AI_OPOBJ3=new D({id:54,name:"AI_OPOBJ3",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_OBJ])});static AI_OPOBJ4=new D({id:55,name:"AI_OPOBJ4",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_OBJ])});static AI_OPOBJ5=new D({id:56,name:"AI_OPOBJ5",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_OBJ])});static APLOC1=new D({id:59,name:"APLOC1",subjectMode:B.Type(z.LOC),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_LOC])});static APLOC2=new D({id:60,name:"APLOC2",subjectMode:B.Type(z.LOC),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_LOC])});static APLOC3=new D({id:61,name:"APLOC3",subjectMode:B.Type(z.LOC),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_LOC])});static APLOC4=new D({id:62,name:"APLOC4",subjectMode:B.Type(z.LOC),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_LOC])});static APLOC5=new D({id:63,name:"APLOC5",subjectMode:B.Type(z.LOC),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_LOC])});static APLOCU=new D({id:64,name:"APLOCU",subjectMode:B.Type(z.LOC),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.LAST_USEITEM,N.LAST_USESLOT,N.ACTIVE_LOC])});static APLOCT=new D({id:65,name:"APLOCT",subjectMode:B.Type(z.COMPONENT,!1,!1),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_LOC])});static OPLOC1=new D({id:66,name:"OPLOC1",subjectMode:B.Type(z.LOC),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_LOC])});static OPLOC2=new D({id:67,name:"OPLOC2",subjectMode:B.Type(z.LOC),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_LOC])});static OPLOC3=new D({id:68,name:"OPLOC3",subjectMode:B.Type(z.LOC),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_LOC])});static OPLOC4=new D({id:69,name:"OPLOC4",subjectMode:B.Type(z.LOC),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_LOC])});static OPLOC5=new D({id:70,name:"OPLOC5",subjectMode:B.Type(z.LOC),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_LOC])});static OPLOCU=new D({id:71,name:"OPLOCU",subjectMode:B.Type(z.LOC),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.LAST_USEITEM,N.LAST_USESLOT,N.ACTIVE_LOC])});static OPLOCT=new D({id:72,name:"OPLOCT",subjectMode:B.Type(z.COMPONENT,!1,!1),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_LOC])});static AI_APLOC1=new D({id:73,name:"AI_APLOC1",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_LOC])});static AI_APLOC2=new D({id:74,name:"AI_APLOC2",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_LOC])});static AI_APLOC3=new D({id:75,name:"AI_APLOC3",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_LOC])});static AI_APLOC4=new D({id:76,name:"AI_APLOC4",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_LOC])});static AI_APLOC5=new D({id:77,name:"AI_APLOC5",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_LOC])});static AI_OPLOC1=new D({id:80,name:"AI_OPLOC1",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_LOC])});static AI_OPLOC2=new D({id:81,name:"AI_OPLOC2",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_LOC])});static AI_OPLOC3=new D({id:82,name:"AI_OPLOC3",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_LOC])});static AI_OPLOC4=new D({id:83,name:"AI_OPLOC4",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_LOC])});static AI_OPLOC5=new D({id:84,name:"AI_OPLOC5",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_LOC])});static APPLAYER1=new D({id:87,name:"APPLAYER1",subjectMode:B.None,pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_PLAYER2])});static APPLAYER2=new D({id:88,name:"APPLAYER2",subjectMode:B.None,pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_PLAYER2])});static APPLAYER3=new D({id:89,name:"APPLAYER3",subjectMode:B.None,pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_PLAYER2])});static APPLAYER4=new D({id:90,name:"APPLAYER4",subjectMode:B.None,pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_PLAYER2])});static APPLAYER5=new D({id:91,name:"APPLAYER5",subjectMode:B.None,pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_PLAYER2])});static APPLAYERU=new D({id:92,name:"APPLAYERU",subjectMode:B.Type(z.NAMEDOBJ,!0,!1),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.LAST_USEITEM,N.LAST_USESLOT,N.ACTIVE_PLAYER2])});static APPLAYERT=new D({id:93,name:"APPLAYERT",subjectMode:B.Type(z.COMPONENT,!1,!1),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_PLAYER2])});static OPPLAYER1=new D({id:94,name:"OPPLAYER1",subjectMode:B.None,pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_PLAYER2])});static OPPLAYER2=new D({id:95,name:"OPPLAYER2",subjectMode:B.None,pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_PLAYER2])});static OPPLAYER3=new D({id:96,name:"OPPLAYER3",subjectMode:B.None,pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_PLAYER2])});static OPPLAYER4=new D({id:97,name:"OPPLAYER4",subjectMode:B.None,pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_PLAYER2])});static OPPLAYER5=new D({id:98,name:"OPPLAYER5",subjectMode:B.None,pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_PLAYER2])});static OPPLAYERU=new D({id:99,name:"OPPLAYERU",subjectMode:B.Type(z.NAMEDOBJ,!0,!1),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.LAST_USEITEM,N.LAST_USESLOT,N.ACTIVE_PLAYER2])});static OPPLAYERT=new D({id:100,name:"OPPLAYERT",subjectMode:B.Type(z.COMPONENT,!1,!1),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.ACTIVE_PLAYER2])});static AI_APPLAYER1=new D({id:101,name:"AI_APPLAYER1",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_PLAYER])});static AI_APPLAYER2=new D({id:102,name:"AI_APPLAYER2",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_PLAYER])});static AI_APPLAYER3=new D({id:103,name:"AI_APPLAYER3",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_PLAYER])});static AI_APPLAYER4=new D({id:104,name:"AI_APPLAYER4",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_PLAYER])});static AI_APPLAYER5=new D({id:105,name:"AI_APPLAYER5",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_PLAYER])});static AI_OPPLAYER1=new D({id:108,name:"AI_OPPLAYER1",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_PLAYER])});static AI_OPPLAYER2=new D({id:109,name:"AI_OPPLAYER2",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_PLAYER])});static AI_OPPLAYER3=new D({id:110,name:"AI_OPPLAYER3",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_PLAYER])});static AI_OPPLAYER4=new D({id:111,name:"AI_OPPLAYER4",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_PLAYER])});static AI_OPPLAYER5=new D({id:112,name:"AI_OPPLAYER5",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.ACTIVE_PLAYER])});static QUEUE=new D({id:116,name:"QUEUE",allowParameters:!0,pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER])});static AI_QUEUE1=new D({id:117,name:"AI_QUEUE1",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.LAST_INT])});static AI_QUEUE2=new D({id:118,name:"AI_QUEUE2",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.LAST_INT])});static AI_QUEUE3=new D({id:119,name:"AI_QUEUE3",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.LAST_INT])});static AI_QUEUE4=new D({id:120,name:"AI_QUEUE4",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.LAST_INT])});static AI_QUEUE5=new D({id:121,name:"AI_QUEUE5",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.LAST_INT])});static AI_QUEUE6=new D({id:122,name:"AI_QUEUE6",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.LAST_INT])});static AI_QUEUE7=new D({id:123,name:"AI_QUEUE7",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.LAST_INT])});static AI_QUEUE8=new D({id:124,name:"AI_QUEUE8",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.LAST_INT])});static AI_QUEUE9=new D({id:125,name:"AI_QUEUE9",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.LAST_INT])});static AI_QUEUE10=new D({id:126,name:"AI_QUEUE10",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.LAST_INT])});static AI_QUEUE11=new D({id:127,name:"AI_QUEUE11",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.LAST_INT])});static AI_QUEUE12=new D({id:128,name:"AI_QUEUE12",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.LAST_INT])});static AI_QUEUE13=new D({id:129,name:"AI_QUEUE13",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.LAST_INT])});static AI_QUEUE14=new D({id:130,name:"AI_QUEUE14",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.LAST_INT])});static AI_QUEUE15=new D({id:131,name:"AI_QUEUE15",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.LAST_INT])});static AI_QUEUE16=new D({id:132,name:"AI_QUEUE16",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.LAST_INT])});static AI_QUEUE17=new D({id:133,name:"AI_QUEUE17",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.LAST_INT])});static AI_QUEUE18=new D({id:134,name:"AI_QUEUE18",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.LAST_INT])});static AI_QUEUE19=new D({id:135,name:"AI_QUEUE19",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.LAST_INT])});static AI_QUEUE20=new D({id:136,name:"AI_QUEUE20",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC,N.LAST_INT])});static SOFTTIMER=new D({id:137,name:"SOFTTIMER",allowParameters:!0,pointers:new Set([N.ACTIVE_PLAYER])});static TIMER=new D({id:138,name:"TIMER",allowParameters:!0,pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER])});static AI_TIMER=new D({id:139,name:"AI_TIMER",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC])});static OPHELD1=new D({id:140,name:"OPHELD1",subjectMode:B.Type(z.NAMEDOBJ),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.LAST_ITEM,N.LAST_SLOT])});static OPHELD2=new D({id:141,name:"OPHELD2",subjectMode:B.Type(z.NAMEDOBJ),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.LAST_ITEM,N.LAST_SLOT])});static OPHELD3=new D({id:142,name:"OPHELD3",subjectMode:B.Type(z.NAMEDOBJ),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.LAST_ITEM,N.LAST_SLOT])});static OPHELD4=new D({id:143,name:"OPHELD4",subjectMode:B.Type(z.NAMEDOBJ),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.LAST_ITEM,N.LAST_SLOT])});static OPHELD5=new D({id:144,name:"OPHELD5",subjectMode:B.Type(z.NAMEDOBJ),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.LAST_ITEM,N.LAST_SLOT])});static OPHELDU=new D({id:145,name:"OPHELDU",subjectMode:B.Type(z.NAMEDOBJ),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.LAST_ITEM,N.LAST_SLOT,N.LAST_USEITEM,N.LAST_USESLOT])});static OPHELDT=new D({id:146,name:"OPHELDT",subjectMode:B.Type(z.COMPONENT,!1,!1),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.LAST_ITEM,N.LAST_SLOT])});static IF_BUTTON=new D({id:147,name:"IF_BUTTON",subjectMode:B.Type(z.COMPONENT),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.LAST_COM])});static IF_CLOSE=new D({id:148,name:"IF_CLOSE",subjectMode:B.Type(z.INTERFACE),pointers:new Set([N.ACTIVE_PLAYER])});static INV_BUTTON1=new D({id:149,name:"INV_BUTTON1",subjectMode:B.Type(z.COMPONENT),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.LAST_ITEM,N.LAST_SLOT])});static INV_BUTTON2=new D({id:150,name:"INV_BUTTON2",subjectMode:B.Type(z.COMPONENT),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.LAST_ITEM,N.LAST_SLOT])});static INV_BUTTON3=new D({id:151,name:"INV_BUTTON3",subjectMode:B.Type(z.COMPONENT),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.LAST_ITEM,N.LAST_SLOT])});static INV_BUTTON4=new D({id:152,name:"INV_BUTTON4",subjectMode:B.Type(z.COMPONENT),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.LAST_ITEM,N.LAST_SLOT])});static INV_BUTTON5=new D({id:153,name:"INV_BUTTON5",subjectMode:B.Type(z.COMPONENT),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.LAST_ITEM,N.LAST_SLOT])});static INV_BUTTOND=new D({id:154,name:"INV_BUTTOND",subjectMode:B.Type(z.COMPONENT),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER,N.LAST_SLOT,N.LAST_TARGETSLOT])});static WALKTRIGGER=new D({id:155,name:"WALKTRIGGER",subjectMode:B.Name,pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER])});static AI_WALKTRIGGER=new D({id:156,name:"AI_WALKTRIGGER",subjectMode:B.Name,pointers:new Set([N.ACTIVE_NPC])});static LOGIN=new D({id:157,name:"LOGIN",subjectMode:B.None,pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER])});static LOGOUT=new D({id:158,name:"LOGOUT",subjectMode:B.None,allowReturns:!0,returns:L.BOOLEAN,pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER])});static TUTORIAL=new D({id:159,name:"TUTORIAL",subjectMode:B.None,pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER])});static ADVANCESTAT=new D({id:160,name:"ADVANCESTAT",subjectMode:B.Type(z.STAT),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER])});static MAPZONE=new D({id:161,name:"MAPZONE",subjectMode:B.Type(L.MAPZONE),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER])});static MAPZONEEXIT=new D({id:162,name:"MAPZONEEXIT",subjectMode:B.Type(L.MAPZONE),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER])});static ZONE=new D({id:163,name:"ZONE",subjectMode:B.Type(L.COORD),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER])});static ZONEEXIT=new D({id:164,name:"ZONEEXIT",subjectMode:B.Type(L.COORD),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER])});static CHANGESTAT=new D({id:165,name:"CHANGESTAT",subjectMode:B.Type(z.STAT),pointers:new Set([N.ACTIVE_PLAYER,N.P_ACTIVE_PLAYER])});static AI_SPAWN=new D({id:166,name:"AI_SPAWN",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC])});static AI_DESPAWN=new D({id:167,name:"AI_DESPAWN",subjectMode:B.Type(z.NPC),pointers:new Set([N.ACTIVE_NPC])})}class A2 extends n3{lookupKey;static INITIAL_CAPACITY=512;instructionBuffer;switchBuffer;instructionCount=0;instructionOffset=0;switchOffset=0;constructor(U,X){super(U);this.lookupKey=X;this.instructionBuffer=Buffer.alloc(A2.INITIAL_CAPACITY),this.switchBuffer=Buffer.alloc(A2.INITIAL_CAPACITY)}ensureInstructionCapacity(U){if(this.instructionOffset+U>this.instructionBuffer.length){let X=Buffer.alloc(this.instructionBuffer.length*2);this.instructionBuffer.copy(X),this.instructionBuffer=X}}ensureSwitchCapacity(U){if(this.switchOffset+U>this.switchBuffer.length){let X=Buffer.alloc(this.switchBuffer.length*2);this.switchBuffer.copy(X),this.switchBuffer=X}}instruction(U,X){if(this.instructionCount++,this.ensureInstructionCapacity(U.largeOperand?6:4),this.instructionBuffer.writeUInt16BE(U.id,this.instructionOffset),this.instructionOffset+=2,U.largeOperand)this.instructionBuffer.writeInt32BE(X|0,this.instructionOffset),this.instructionOffset+=4;else this.instructionBuffer.writeUInt8(X,this.instructionOffset),this.instructionOffset+=1}instructionRaw(U,X){this.instructionCount++,this.ensureInstructionCapacity(3),this.instructionBuffer.writeUInt16BE(U,this.instructionOffset),this.instructionOffset+=2,this.instructionBuffer.writeUInt8(X,this.instructionOffset),this.instructionOffset+=1}instructionString(U,X){this.instructionCount++;let Y=X.length+1;this.ensureInstructionCapacity(2+Y),this.instructionBuffer.writeUInt16BE(U.id,this.instructionOffset),this.instructionOffset+=2,this.instructionOffset=this.writeString(this.instructionBuffer,X,this.instructionOffset)}switch(U,X){this.instruction(w.SWITCH,U);let Y=this.switchOffset;this.ensureSwitchCapacity(2),this.switchOffset+=2;let G=X();this.switchBuffer.writeUInt16BE(G,Y)}switchCase(U,X){this.ensureSwitchCapacity(8),this.switchBuffer.writeInt32BE(U,this.switchOffset),this.switchOffset+=4,this.switchBuffer.writeInt32BE(X,this.switchOffset),this.switchOffset+=4}finish(){let U=this.calculateBufferSize(),X=Buffer.alloc(U),Y=0;if(Y=this.writeString(X,this.script.fullName,Y),Y=this.writeString(X,this.script.sourceName,Y),X.writeInt32BE(this.lookupKey,Y),Y+=4,this.script.trigger===D.DEBUGPROC){let $=E.toList(this.script.symbol.parameters);X.writeUInt8($.length,Y++);for(let Z of $){let J=Z.code?.charCodeAt(0)??-1;X.writeInt8(J,Y++)}}else X.writeUInt8(0,Y++);X.writeUInt16BE(this.lineNumberTable.size,Y),Y+=2;for(let[$,Z]of this.lineNumberTable)X.writeInt32BE($,Y),Y+=4,X.writeInt32BE(Z,Y),Y+=4;this.instructionBuffer.copy(X,Y,0,this.instructionOffset),Y+=this.instructionOffset,X.writeInt32BE(this.instructionCount,Y),Y+=4;let G=this.script.locals;return X.writeUInt16BE(F0.getLocalCount(G,0),Y),Y+=2,X.writeUInt16BE(F0.getLocalCount(G,1),Y),Y+=2,X.writeUInt16BE(F0.getParameterCount(G,0),Y),Y+=2,X.writeUInt16BE(F0.getParameterCount(G,1),Y),Y+=2,X.writeUInt8(this.script.switchTables.length,Y++),this.switchBuffer.copy(X,Y,0,this.switchOffset),Y+=this.switchOffset,X.writeUInt16BE(this.switchOffset+1,Y),X}calculateBufferSize(){let U=0;if(U+=this.script.fullName.length+1,U+=this.script.sourceName.length+1,U+=4,this.script.trigger===D.DEBUGPROC){let X=E.toList(this.script.symbol.parameters);U+=1+X.length}else U+=1;return U+=this.lineNumberTable.size*8+2,U+=this.instructionOffset,U+=4,U+=8,U+=1,U+=this.switchOffset,U+=2,U}close(){}writeString(U,X,Y){for(let G=0;G<X.length;G++)U.writeUInt8(X.charCodeAt(G)&255,Y++);return U.writeUInt8(0,Y++),Y}}class p3 extends F0{constructor(U){super(U)}finishWrite(U,X){let Y=X.finish();try{this.outputScript(U,Y)}finally{}}createContext(U){let X=this.generateLookupKey(U);return new A2(U,X)}generateLookupKey(U){let X=U.trigger,Y=U.trigger.subjectMode,G=U.subjectReference;if(Y===B.Name)return-1;let $=X.id;if("type"in Y&&G!=null){let Z=G.type,J;if(G.type===L.MAPZONE||G.type===L.COORD)J=parseInt(G.name,10);else J=this.idProvider.get(G);let Q=Z===z.CATEGORY?1:2;$+=Q<<8|J<<10}return $}enterBlock(U,X){}writePushConstantInt(U,X){U.instruction(w.PUSH_CONSTANT_INT,X)}writePushConstantString(U,X){U.instructionString(w.PUSH_CONSTANT_STRING,X)}writePushConstantLong(U,X){throw Error("Not supported.")}writePushConstantSymbol(U,X){let Y;if(X instanceof k0)Y=F0.getVariableId(U.script.locals,X);else if(X instanceof J0&&X.type instanceof K.Type){let G=X.type;if(typeof G.inner.code==="string"&&G.inner.code.length>0)Y=G.inner.code.charCodeAt(0);else throw Error(`Type has chno code: ${G.inner}.`)}else Y=this.idProvider.get(X);U.instruction(w.PUSH_CONSTANT_INT,Y)}writePushLocalVar(U,X){let Y=F0.getVariableId(U.script.locals,X),G;if(X.type instanceof o)G=w.PUSH_ARRAY_INT;else if(X.type.baseType===1)G=w.PUSH_STRING_LOCAL;else if(X.type.baseType===0)G=w.PUSH_INT_LOCAL;else throw Error(`Unsupported local variable type: ${X.type}.`);U.instruction(G,Y)}writePopLocalVar(U,X){let Y=F0.getVariableId(U.script.locals,X),G;if(X.type instanceof o)G=w.POP_ARRAY_INT;else if(X.type.baseType===1)G=w.POP_STRING_LOCAL;else if(X.type.baseType===0)G=w.POP_INT_LOCAL;else throw Error(`Unsupported local variable type: ${X.type}.`);U.instruction(G,Y)}writePushVar(U,X,Y){let G=this.idProvider.get(X),$;if(X.type instanceof B0)$=w.PUSH_VARP;else if(X.type instanceof w0)$=w.PUSH_VARBIT;else if(X.type instanceof O0)$=w.PUSH_VARN;else if(X.type instanceof m1)$=w.PUSH_VARS;else throw Error(`Unsupported variable type: ${X.type}.`);let Z=G;if(Y)Z+=65536;U.instruction($,Z)}writePopVar(U,X,Y){let G=this.idProvider.get(X),$;if(X.type instanceof B0)$=w.POP_VARP;else if(X.type instanceof w0)$=w.POP_VARBIT;else if(X.type instanceof O0)$=w.POP_VARN;else if(X.type instanceof m1)$=w.POP_VARS;else throw Error(`Unsupported variable typ: ${X.type}.`);let Z=G;if(Y)Z+=65536;U.instruction($,Z)}writeDefineArray(U,X){let Y=F0.getVariableId(U.script.locals,X),G=X.type;if(typeof G.inner.code!=="string"||G.inner.code.length===0)throw Error(`Type has no char code: ${G.inner}.`);let $=G.inner.code.charCodeAt(0);U.instruction(w.DEFINE_ARRAY,Y<<16|$)}writeSwitch(U,X){U.switch(X.id,()=>{let Y=0;for(let G of X.cases.entries()){let $=U.jumpTable.get(G[1].label);if($===void 0)throw Error(`Label not found: ${G[1].label}.`);let Z=$-U.curIndex-1;for(let J of G[1].keys)U.switchCase(this.findCaseKeyValue(J),Z);Y+=G[1].keys.length}return Y})}findCaseKeyValue(U){if(typeof U==="number")return U;return this.idProvider.get(U)}writeBranch(U,X,Y){let G;switch(X){case W.Branch:G=w.BRANCH;break;case W.BranchNot:G=w.BRANCH_NOT;break;case W.BranchEquals:G=w.BRANCH_EQUALS;break;case W.BranchLessThan:G=w.BRANCH_LESS_THAN;break;case W.BranchGreaterThan:G=w.BRANCH_GREATER_THAN;break;case W.BranchLessThanOrEquals:G=w.BRANCH_LESS_THAN_OR_EQUALS;break;case W.BranchGreaterThanOrEquals:G=w.BRANCH_GREATER_THAN_OR_EQUALS;break;default:throw Error(`Unsupported opcode: ${X}.`)}let $=U.jumpTable.get(Y);if($===void 0)throw Error(`Label not found: ${Y}.`);U.instruction(G,$-U.curIndex-1)}writeJoinString(U,X){U.instruction(w.JOIN_STRING,X)}writeDiscard(U,X){let Y;switch(X){case 0:Y=w.POP_INT_DISCARD;break;case 1:Y=w.POP_STRING_DISCARD;break;default:throw Error(`Unsupported base type: ${X}.`)}U.instruction(Y,0)}writeGosub(U,X){let Y=this.idProvider.get(X);U.instruction(w.GOSUB_WITH_PARAMS,Y)}writeJump(U,X){let Y=this.idProvider.get(X);U.instruction(w.JUMP_WITH_PARAMS,Y)}writeCommand(U,X){let Y=this.idProvider.get(X),G=X.name.startsWith(".");U.instructionRaw(Y,G?1:0)}writeReturn(U){U.instruction(w.RETURN,0)}writeMath(U,X){let Y;switch(X){case W.Add:Y=w.ADD;break;case W.Sub:Y=w.SUB;break;case W.Multiply:Y=w.MULTIPLY;break;case W.Divide:Y=w.DIVIDE;break;case W.Modulo:Y=w.MODULO;break;case W.Or:Y=w.OR;break;case W.And:Y=w.AND;break;default:throw Error(`Unsupported math opcode: ${X}`)}U.instruction(Y,0)}}var CX=K.Type;class p2 extends p3{output;buffers=new Map;static VERSION=26;constructor(U,X){super(X);if(this.output=U,!U0.existsSync(U))U0.mkdirSync(U,{recursive:!0});if(!U0.statSync(U).isDirectory())throw Error(`${K2.resolve(U)} is not a directory.`)}outputScript(U,X){let Y=this.idProvider.get(U.symbol);this.buffers.set(Y,Buffer.from(X))}close(){let U=K2.join(this.output,"script.dat"),X=K2.join(this.output,"script.idx"),Y=U0.openSync(U,"w"),G=U0.openSync(X,"w");try{let $=[...this.buffers.keys()].sort((J,Q)=>J-Q),Z=$.length>0?$[$.length-1]:0;this.p4(Y,Z+1),this.p4(G,Z+1),this.p4(Y,p2.VERSION);for(let J=0;J<=Z;J++){let Q=this.buffers.get(J);if(!Q){this.p4(G,0);continue}this.p4(G,Q.length),U0.writeSync(Y,Q)}}finally{U0.closeSync(Y),U0.closeSync(G)}}p2(U,X){let Y=Buffer.allocUnsafe(2);Y.writeUInt16BE(X&65535,0),U0.writeSync(U,Y)}p4(U,X){let Y=Buffer.allocUnsafe(4);Y.writeInt32BE(X,0),U0.writeSync(U,Y)}}class o2{parent;symbols=new Map;constructor(U=null){this.parent=U}insert(U,X){let Y=this;while(Y){if(Y.symbols.get(U)?.has(X.name))return!1;Y=Y.parent}let G=this.symbols.get(U);if(!G)G=new Map,this.symbols.set(U,G);return G.set(X.name,X),!0}find(U,X){let G=this.symbols.get(U)?.get(X);if(G)return G;return this.parent?.find(U,X)??null}findAll(U,X){let Y=[];for(let G of this.symbols.values()){let $=G.get(U);if($&&(!X||$ instanceof X))Y.push($)}if(this.parent)Y.push(...this.parent.findAll(U,X));return Y}createSubTable(){return new o2(this)}}class o3{nameToTrigger=new Map;register(U,X){if(this.nameToTrigger.has(U))throw Error(`Trigger '${U}' is already registered.`);this.nameToTrigger.set(U,X)}registerTrigger(U){this.register(U.identifier,U)}registerAll(U){for(let X of U.ALL)this.registerTrigger(X)}find(U){let X=this.nameToTrigger.get(U);if(!X)throw Error(`Unable to find trigger '${U}'.`);return X}findOrNull(U){return this.nameToTrigger.get(U)??null}}class i3{nameToType=new Map;checkers=[];register(U,X){if(typeof U==="string"){if(this.nameToType.get(U))throw Error(`Type '${U} is already registered.`);if(!X)throw Error("Type must be provided.");this.nameToType.set(U,X)}else{let Y=U.representation;if(this.nameToType.get(Y))throw Error(`Type '${Y}' is already registered.`);this.nameToType.set(Y,U)}}registerNew(U,X,Y=0,G=-1,$){let Z=new y;if($)$(Z);let J={representation:U,code:X,baseType:Y,defaultValue:G,options:Z};return this.register(J),J}registerAll(U){for(let X of U.ALL)this.register(X)}changeOptions(U,X){let Y=this.nameToType.get(U);if(!Y)throw Error(`'${U}' was not found.`);let G=Y.options;X(G)}find(U,X=!1){let Y=this.findOrNull(U,X);if(!Y)throw Error(`Unable to find type: '${U}'.`);return Y}findOrNull(U,X=!1){if(X&&U.endsWith("array")){let Y=U.substring(0,U.length-5),G=this.findOrNull(Y);if(!G||!G.options.allowArray)return null;return new o(G)}return this.nameToType.get(U)??null}addTypeChecker(U){this.checkers.push(U)}check(U,X){return this.checkers.some((Y)=>Y(U,X))}}import*as M6 from"fs";import*as k6 from"path";class t3{handleParse(U){this.handleShared(U)}handleTypeChecking(U){this.handleShared(U)}handleCodeGeneration(U){this.handleShared(U)}handlePointerChecking(U){this.handleShared(U)}handleShared(U){let X=new Map;for(let Y of U.diagnostics){let G=k6.resolve(Y.sourceLocation.name);if(!X.has(G))X.set(G,M6.readFileSync(G,"utf-8").split(/\r?\n/));let $=X.get(G),Z=`${Y.sourceLocation.name}:${Y.sourceLocation.line}:${Y.sourceLocation.column}`;console.log(`${Z}: ${Y.type}: ${Y.message}`);let J=Y.sourceLocation.line-1;if(J>=0&&J<$.length){let Q=$[J],F=Q.replace(/\t/g," "),_=(Q.match(/\t/g)??[]).length,I=Y.sourceLocation.column??1,H=Math.max(1,I),j=Math.max(0,_*3+(H-1));console.log(` > ${F}`),console.log(` > ${" ".repeat(j)}^`)}}if(U.hasErrors())process.exit(1)}}import*as h9 from"fs";import*as b0 from"path";class L1{_diagnostics=[];get diagnostics(){return this._diagnostics}report(U){this._diagnostics.push(U)}hasErrors(){return this._diagnostics.some((U)=>L1.ERROR_TYPES.has(U.type))}static ERROR_TYPES=new Set(["ERROR","SYNTAX_ERROR"])}class i{source;parent=null;_children=[];get children(){return this._children}attributes=new Map;constructor(U){this.source=U;this.source=U}addChild(U){if(!U)return;if(U.parent)throw Error("Parent already set.");U.parent=this,this._children.push(U)}addChildren(U){for(let X of U){if(!X)continue;if(X.parent)throw Error("Parent already set.");X.parent=this,this._children.push(X)}}findParentByType(U){let X=this.parent;while(X!==null){if(X instanceof U)return X;X=X.parent}return null}reportInfo(U,X,...Y){U.report(new W0("INFO",this,X,...Y))}reportWarning(U,X,...Y){U.report(new W0("WARNING",this,X,...Y))}reportError(U,X,...Y){U.report(new W0("ERROR",this,X,...Y))}}class W0{type;sourceLocation;message;messageArgs;constructor(U,X,Y,...G){if(this.type=U,"source"in X)this.sourceLocation=X.source;else this.sourceLocation=X;this.messageArgs=G,this.message=Y}isError(){return this.type==="ERROR"||this.type==="SYNTAX_ERROR"}}class B2{sourceFile;diagnostics;lineOffset;columnOffset;constructor(U,X,Y=0,G=0){this.sourceFile=U;this.diagnostics=X;this.lineOffset=Y;this.columnOffset=G}syntaxError(U,X,Y,G,$,Z){let J=Y===1?this.columnOffset:0,Q=Y+this.lineOffset,F=G+J+1,_={name:this.sourceFile,line:Q,column:F,endLine:Q,endColumn:F};this.diagnostics.report(new W0("SYNTAX_ERROR",_,$.replace(/%/g,"%%"),[]))}reportAmbiguity(U,X,Y,G,$,Z,J){}reportAttemptingFullContext(U,X,Y,G,$,Z){}reportContextSensitivity(U,X,Y,G,$,Z){}}import{readFileSync as v8}from"fs";import{readFile as S8}from"fs/promises";var P7=Object.defineProperty,A=(U,X)=>P7(U,"name",{value:X,configurable:!0}),r2;((U)=>{U.EOF=-1,U.UNKNOWN_SOURCE_NAME="<unknown>"})(r2||(r2={}));var R;((U)=>{U.INVALID_TYPE=0,U.EPSILON=-2,U.MIN_USER_TOKEN_TYPE=1,U.EOF=r2.EOF,U.DEFAULT_CHANNEL=0,U.HIDDEN_CHANNEL=1,U.MIN_USER_CHANNEL_VALUE=2})(R||(R={}));var b7=A((U)=>{let X=U;return X.tokenSource!==void 0&&X.channel!==void 0},"isToken"),x0=class{static{A(this,"BitSet")}data;constructor(U){if(U)this.data=new Uint32Array(U.map((X)=>{return X>>>0}));else this.data=new Uint32Array(1)}[Symbol.iterator](){let U=this.data.length,X=0,Y=this.data[X],G=this.data;return{[Symbol.iterator](){return this},next:A(()=>{while(X<U)if(Y!==0){let $=Y&-Y,Z=(X<<5)+this.bitCount($-1);return Y^=$,{done:!1,value:Z}}else if(X++,X<U)Y=G[X];return{done:!0,value:void 0}},"next")}}clear(U){if(U===void 0)this.data=new Uint32Array;else this.resize(U),this.data[U>>>5]&=~(1<<U)}or(U){let X=Math.min(this.data.length,U.data.length);for(let Y=0;Y<X;++Y)this.data[Y]|=U.data[Y];if(this.data.length<U.data.length){this.resize((U.data.length<<5)-1);let Y=U.data.length;for(let G=X;G<Y;++G)this.data[G]=U.data[G]}}get(U){if(U<0)throw RangeError("index cannot be negative");let X=U>>>5;if(X>=this.data.length)return!1;return(this.data[X]&1<<U%32)!==0}get length(){let U=0,X=this.data.length,Y=this.data;for(let G=0;G<X;G++)U+=this.bitCount(Y[G]);return U}values(){let U=Array(this.length),X=0,Y=this.data.length;for(let G=0;G<Y;++G){let $=this.data[G];while($!==0){let Z=$&-$;U[X++]=(G<<5)+this.bitCount(Z-1),$^=Z}}return U}nextSetBit(U){if(U<0)throw RangeError("index cannot be negative");for(let X of this)if(X>=U)return X;return}set(U){if(U<0)throw RangeError("index cannot be negative");this.resize(U),this.data[U>>>5]|=1<<U%32}toString(){return"{"+this.values().join(", ")+"}"}resize(U){let X=U+32>>>5;if(X<=this.data.length)return;let Y=new Uint32Array(X);Y.set(this.data),Y.fill(0,this.data.length),this.data=Y}bitCount(U){return U=U-(U>>1&1431655765),U=(U&858993459)+(U>>2&858993459),U=U+(U>>4)&252645135,U=U+(U>>8),U=U+(U>>16),U&63}},u7=3432918353,v7=461845907,O6=15,j6=13,S7=5,x7=3864292196,O=class U{static{A(this,"MurmurHash")}static defaultSeed=701;constructor(){}static initialize(X=U.defaultSeed){return X}static updateFromComparable(X,Y){return this.update(X,Y?.hashCode()??0)}static update(X,Y){return Y=Math.imul(Y,u7),Y=Y<<O6|Y>>>32-O6,Y=Math.imul(Y,v7),X=X^Y,X=X<<j6|X>>>32-j6,X=Math.imul(X,S7)+x7,X}static finish(X,Y){return X^=Y*4,X^=X>>>16,X=Math.imul(X,2246822507),X^=X>>>13,X=Math.imul(X,3266489909),X^=X>>>16,X}static hashCode(X,Y){return U.finish(U.update(Y??U.defaultSeed,X),1)}},k1=class U{static{A(this,"ObjectEqualityComparator")}static instance=new U;hashCode(X){if(X==null)return 0;return X.hashCode()}equals(X,Y){if(X==null)return Y==null;return X.equals(Y)}},m6=class U{static{A(this,"DefaultEqualityComparator")}static instance=new U;hashCode(X){if(X==null)return 0;return k1.instance.hashCode(X)}equals(X,Y){if(X==null)return Y==null;if(typeof X==="string"||typeof X==="number")return X===Y;return k1.instance.equals(X,Y)}},R0=class U{static{A(this,"HashSet")}static defaultLoadFactor=0.75;static initialCapacity=16;comparator;buckets;threshold;itemCount=0;constructor(X,Y=U.initialCapacity){if(X instanceof U){this.comparator=X.comparator,this.buckets=X.buckets.slice(0);for(let G=0;G<this.buckets.length;G++){let $=this.buckets[G];if($)this.buckets[G]=$.slice(0)}this.itemCount=X.itemCount,this.threshold=X.threshold}else this.comparator=X??m6.instance,this.buckets=this.createBuckets(Y),this.threshold=Math.floor(U.initialCapacity*U.defaultLoadFactor)}getOrAdd(X){if(this.itemCount>this.threshold)this.expand();let Y=this.getBucket(X),G=this.buckets[Y];if(!G)return G=[X],this.buckets[Y]=G,++this.itemCount,X;for(let $ of G)if(this.comparator.equals($,X))return $;return G.push(X),++this.itemCount,X}get(X){if(X==null)return X;let Y=this.getBucket(X),G=this.buckets[Y];if(!G)return;for(let $ of G)if(this.comparator.equals($,X))return $;return}remove(X){if(X==null)return!1;let Y=this.getBucket(X),G=this.buckets[Y];if(!G)return!1;for(let $=0;$<G.length;$++){let Z=G[$];if(this.comparator.equals(Z,X))return G.splice($,1),--this.itemCount,!0}return!1}hashCode(){let X=O.initialize();for(let Y of this.buckets){if(Y==null)continue;for(let G of Y){if(G==null)break;X=O.update(X,this.comparator.hashCode(G))}}return X=O.finish(X,this.size),X}equals(X){if(X===this)return!0;if(!(X instanceof U))return!1;if(X.size!==this.size)return!1;return this.containsAll(X)}add(X){return this.getOrAdd(X)===X}contains(X){return this.containsFast(X)}containsFast(X){if(X==null)return!1;return this.get(X)!==void 0}*[Symbol.iterator](){yield*this.toArray()}toArray(){let X=Array(this.size),Y=0;for(let G of this.buckets){if(G==null)continue;for(let $ of G){if($==null)break;X[Y++]=$}}return X}containsAll(X){if(X instanceof U)for(let Y of X.buckets){if(Y==null)continue;for(let G of Y){if(G==null)break;if(!this.containsFast(G))return!1}}else for(let Y of X)if(!this.containsFast(Y))return!1;return!0}addAll(X){let Y=!1;for(let G of X)if(this.getOrAdd(G)!==G)Y=!0;return Y}clear(){this.buckets=this.createBuckets(U.initialCapacity),this.itemCount=0,this.threshold=Math.floor(U.initialCapacity*U.defaultLoadFactor)}toString(){if(this.size===0)return"{}";let X="{",Y=!0;for(let G of this.buckets){if(G==null)continue;for(let $ of G){if($==null)break;if(Y)Y=!1;else X+=", ";X+=$.toString()}}return X+="}",X}toTableString(){let X="";for(let Y of this.buckets){if(Y==null){X+=`null
17
+ `;continue}X+="[";let G=!0;for(let $ of Y){if(G)G=!1;else X+=" ";if($==null)X+="_";else X+=$.toString()}X+=`]
18
+ `}return X}getBucket(X){return this.comparator.hashCode(X)&this.buckets.length-1}expand(){let X=this.buckets,Y=this.buckets.length*2,G=this.createBuckets(Y);this.buckets=G,this.threshold=Math.floor(Y*U.defaultLoadFactor);for(let $ of X){if(!$)continue;for(let Z of $){let J=this.getBucket(Z),Q=this.buckets[J];if(!Q)Q=[],this.buckets[J]=Q;Q.push(Z)}}}get size(){return this.itemCount}get isEmpty(){return this.itemCount===0}createBuckets(X){return Array(X)}},v=class U{static{A(this,"Interval")}static INVALID_INTERVAL=new U(-1,-2);static INTERVAL_POOL_MAX_VALUE=1000;static cache=[];start;stop;cachedHashCode;constructor(X,Y){this.start=X,this.stop=Y,this.cachedHashCode=Math.imul(651+X,31)+Y}static of(X,Y){if(X!==Y||X<0||X>U.INTERVAL_POOL_MAX_VALUE)return new U(X,Y);if(!U.cache[X])U.cache[X]=new U(X,X);return U.cache[X]}equals(X){return this.start===X.start&&this.stop===X.stop}hashCode(){return this.cachedHashCode}startsBeforeDisjoint(X){return this.start<X.start&&this.stop<X.start}startsBeforeNonDisjoint(X){return this.start<=X.start&&this.stop>=X.start}startsAfter(X){return this.start>X.start}startsAfterDisjoint(X){return this.start>X.stop}startsAfterNonDisjoint(X){return this.start>X.start&&this.start<=X.stop}disjoint(X){return this.startsBeforeDisjoint(X)||this.startsAfterDisjoint(X)}adjacent(X){return this.start===X.stop+1||this.stop===X.start-1}properlyContains(X){return X.start>=this.start&&X.stop<=this.stop}union(X){return U.of(Math.min(this.start,X.start),Math.max(this.stop,X.stop))}intersection(X){return U.of(Math.max(this.start,X.start),Math.min(this.stop,X.stop))}differenceNotProperlyContained(X){let Y=null;if(X.startsBeforeNonDisjoint(this))Y=U.of(Math.max(this.start,X.stop+1),this.stop);else if(X.startsAfterNonDisjoint(this))Y=U.of(this.start,X.start-1);return Y}toString(){return`${this.start}..${this.stop}`}get length(){if(this.stop<this.start)return 0;return this.stop-this.start+1}},f0=class U{static{A(this,"Vocabulary")}static EMPTY_NAMES=[];static EMPTY_VOCABULARY=new U(U.EMPTY_NAMES,U.EMPTY_NAMES,U.EMPTY_NAMES);maxTokenType;literalNames;symbolicNames;displayNames;constructor(X,Y,G){this.literalNames=X??U.EMPTY_NAMES,this.symbolicNames=Y??U.EMPTY_NAMES,this.displayNames=G??U.EMPTY_NAMES,this.maxTokenType=Math.max(this.displayNames.length,Math.max(this.literalNames.length,this.symbolicNames.length))-1}static fromTokenNames(X){if(X==null||X.length===0)return U.EMPTY_VOCABULARY;let Y=[...X],G=[...X];for(let $=0;$<X.length;$++){let Z=X[$];if(Z==null)continue;if(Z.length>0){let J=Z.codePointAt(0);if(J===39){G[$]=null;continue}else if(J>=65&&J<=90){Y[$]=null;continue}}Y[$]=null,G[$]=null}return new U(Y,G,X)}getMaxTokenType(){return this.maxTokenType}getLiteralName(X){if(X>=0&&X<this.literalNames.length)return this.literalNames[X];return null}getSymbolicName(X){if(X>=0&&X<this.symbolicNames.length)return this.symbolicNames[X];if(X===R.EOF)return"EOF";return null}getDisplayName(X){if(X>=0&&X<this.displayNames.length){let $=this.displayNames[X];if($!=null)return $}let Y=this.getLiteralName(X);if(Y!=null)return Y;let G=this.getSymbolicName(X);if(G!=null)return G;return`${X}`}getLiteralNames(){return this.literalNames}getSymbolicNames(){return this.symbolicNames}getDisplayNames(){return this.displayNames}},E0=class U{static{A(this,"IntervalSet")}intervals=[];cachedHashCode;constructor(X){if(X)if(Array.isArray(X))for(let Y of X)this.addOne(Y);else this.addSet(X)}static of(X,Y){let G=new U;return G.addRange(X,Y),G}static or(X){let Y=new U;for(let G of X)Y.addSet(G);return Y}[Symbol.iterator](){return this.intervals[Symbol.iterator]()}get(X){return this.intervals[X]}get minElement(){if(this.intervals.length===0)return R.INVALID_TYPE;return this.intervals[0].start}get maxElement(){if(this.intervals.length===0)return R.INVALID_TYPE;return this.intervals[this.intervals.length-1].stop}clear(){this.cachedHashCode=void 0,this.intervals=[]}addOne(X){this.addInterval(new v(X,X))}addRange(X,Y){this.addInterval(new v(X,Y))}addInterval(X){if(this.cachedHashCode=void 0,this.intervals.length===0)this.intervals.push(X);else{for(let Y=0;Y<this.intervals.length;Y++){let G=this.intervals[Y];if(X.equals(G))return;if(X.adjacent(G)||!X.disjoint(G)){let $=X.union(G);this.intervals[Y]=$;for(let Z=Y+1;Z<this.intervals.length;){let J=this.intervals[Z];if(!$.adjacent(J)&&$.disjoint(J))break;this.intervals.splice(Z,1),this.intervals[Y]=$.union(J)}return}if(X.startsBeforeDisjoint(G)){this.intervals.splice(Y,0,X);return}}this.intervals.push(X)}}addSet(X){return X.intervals.forEach((Y)=>{return this.addInterval(Y)},this),this}complementWithVocabulary(X){let Y=new U;if(!X)return Y;if(X.length===0)return Y;return Y.addSet(X),Y.subtract(this)}complement(X,Y){let G=new U;return G.addInterval(new v(X,Y)),G.subtract(this)}or(X){let Y=new U;return Y.addSet(this),X.forEach((G)=>{return Y.addSet(G)}),Y}and(X){if(X.length===0)return new U;let Y=this.intervals,G=X.intervals,$,Z=Y.length,J=G.length,Q=0,F=0;while(Q<Z&&F<J){let _=Y[Q],I=G[F];if(_.startsBeforeDisjoint(I))Q++;else if(I.startsBeforeDisjoint(_))F++;else if(_.properlyContains(I)){if(!$)$=new U;$.addInterval(_.intersection(I)),F++}else if(I.properlyContains(_)){if(!$)$=new U;$.addInterval(_.intersection(I)),Q++}else if(!_.disjoint(I)){if(!$)$=new U;if($.addInterval(_.intersection(I)),_.startsAfterNonDisjoint(I))F++;else if(I.startsAfterNonDisjoint(_))Q++}}if(!$)return new U;return $}subtract(X){if(this.length===0)return new U;let Y=new U(this);if(X.length===0)return Y;let G=0,$=0;while(G<Y.intervals.length&&$<X.intervals.length){let Z=Y.intervals[G],J=X.intervals[$];if(J.stop<Z.start){$++;continue}if(J.start>Z.stop){G++;continue}let Q,F;if(J.start>Z.start)Q=new v(Z.start,J.start-1);if(J.stop<Z.stop)F=new v(J.stop+1,Z.stop);if(Q)if(F)Y.intervals[G]=Q,Y.intervals.splice(G+1,0,F),G++,$++;else Y.intervals[G]=Q,G++;else if(F)Y.intervals[G]=F,$++;else Y.intervals.splice(G,1)}return Y}contains(X){let Y=this.intervals.length,G=0,$=Y-1;while(G<=$){let Z=Math.floor((G+$)/2),J=this.intervals[Z];if(J.stop<X)G=Z+1;else if(J.start>X)$=Z-1;else return!0}return!1}removeRange(X){if(this.cachedHashCode=void 0,X.start===X.stop)this.removeOne(X.start);else if(this.intervals!==null){let Y=0;for(let G of this.intervals){if(X.stop<=G.start)return;else if(X.start>G.start&&X.stop<G.stop){this.intervals[Y]=new v(G.start,X.start);let $=new v(X.stop,G.stop);this.intervals.splice(Y,0,$);return}else if(X.start<=G.start&&X.stop>=G.stop)this.intervals.splice(Y,1),Y=Y-1;else if(X.start<G.stop)this.intervals[Y]=new v(G.start,X.start);else if(X.stop<G.stop)this.intervals[Y]=new v(X.stop,G.stop);Y+=1}}}removeOne(X){this.cachedHashCode=void 0;for(let Y=0;Y<this.intervals.length;Y++){let G=this.intervals[Y];if(X<G.start)return;else if(X===G.start&&X===G.stop){this.intervals.splice(Y,1);return}else if(X===G.start){this.intervals[Y]=new v(G.start+1,G.stop);return}else if(X===G.stop){this.intervals[Y]=new v(G.start,G.stop-1);return}else if(X<G.stop){let $=new v(G.start,X-1);this.intervals[Y]=new v(X+1,G.stop),this.intervals.splice(Y,0,$);return}}}hashCode(){if(this.cachedHashCode===void 0){let X=O.initialize();for(let Y of this.intervals)X=O.update(X,Y.start),X=O.update(X,Y.stop);this.cachedHashCode=O.finish(X,this.intervals.length*2)}return this.cachedHashCode}equals(X){if(this===X)return!0;if(this.intervals.length!==X.intervals.length)return!1;for(let Y=0;Y<this.intervals.length;Y++)if(!this.intervals[Y].equals(X.intervals[Y]))return!1;return!0}toString(X){if(this.intervals.length===0)return"{}";let Y="";if(this.length>1)Y+="{";for(let G=0;G<this.intervals.length;++G){let $=this.intervals[G],Z=$.start,J=$.stop;if(Z===J)if(Z===R.EOF)Y+="<EOF>";else if(X)Y+="'"+String.fromCodePoint(Z)+"'";else Y+=Z;else if(X)Y+="'"+String.fromCodePoint(Z)+"'..'"+String.fromCodePoint(J)+"'";else Y+=Z+".."+J;if(G<this.intervals.length-1)Y+=", "}if(this.length>1)Y+="}";return Y}toStringWithVocabulary(X){if(this.intervals.length===0)return"{}";let Y="";if(this.length>1)Y+="{";for(let G=0;G<this.intervals.length;++G){let $=this.intervals[G],Z=$.start,J=$.stop;if(Z===J)if(Z===R.EOF)Y+="<EOF>";else Y+=this.elementName(X,Z);else for(let Q=Z;Q<=J;++Q){if(Q>Z)Y+=", ";Y+=this.elementName(X,Q)}if(G<this.intervals.length-1)Y+=", "}if(this.length>1)Y+="}";return Y}toStringWithRuleNames(X){if(this.intervals.length===0)return"{}";let Y="";if(this.length>1)Y+="{";let G=f0.fromTokenNames(X);for(let $=0;$<this.intervals.length;++$){let Z=this.intervals[$],J=Z.start,Q=Z.stop;if(J===Q)if(J===R.EOF)Y+="<EOF>";else Y+=this.elementName(G,J);else for(let F=J;F<=Q;++F){if(F>J)Y+=", ";Y+=this.elementName(G,F)}if($<this.intervals.length-1)Y+=", "}if(this.length>1)Y+="}";return Y}toArray(){let X=[];for(let Y of this.intervals)for(let G=Y.start;G<=Y.stop;G++)X.push(G);return X}get length(){let X=0;for(let Y of this.intervals)X+=Y.length;return X}elementName(X,Y){if(Y===R.EOF)return"<EOF>";if(Y===R.EPSILON)return"<EPSILON>";return X.getDisplayName(Y)}};var g7=A((U)=>{return U===null?"null":U},"valueToString"),y1=A((U)=>{return Array.isArray(U)?"["+U.map(g7).join(", ")+"]":"null"},"arrayToString"),X3=A((U,X)=>{if(U===X)return!0;if(U.length!==X.length)return!1;for(let Y=0;Y<U.length;Y++){let G=U[Y],$=X[Y];if(G===$)continue;if(!G||!G.equals($))return!1}return!0},"equalArrays"),m7=A((U,X)=>{if(U===X)return!0;if(U.length!==X.length)return!1;for(let Y=0;Y<U.length;Y++)if(U[Y]!==X[Y])return!1;return!0},"equalNumberArrays"),d7=A((U,X=!1)=>{if(U=U.replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r"),X)U=U.replace(/ /g,"·");return U},"escapeWhitespace"),S=class U{static{A(this,"SemanticContext")}cachedHashCode;static andContext(X,Y){if(X===null||X===U.NONE)return Y;if(Y===null||Y===U.NONE)return X;let G=new T7(X,Y);if(G.operands.length===1)return G.operands[0];return G}static orContext(X,Y){if(X===null)return Y;if(Y===null)return X;if(X===U.NONE||Y===U.NONE)return U.NONE;let G=new l7(X,Y);if(G.operands.length===1)return G.operands[0];else return G}static filterPrecedencePredicates(X){let Y=[];for(let G of X)if(G instanceof U.PrecedencePredicate)Y.push(G);return Y}evalPrecedence(X,Y){return this}},T7=class U extends S{static{A(this,"AND")}operands;constructor(X,Y){super();let G=new R0;if(X instanceof U)X.operands.forEach((Z)=>{G.add(Z)});else G.add(X);if(Y instanceof U)Y.operands.forEach((Z)=>{G.add(Z)});else G.add(Y);let $=S.filterPrecedencePredicates(G);if($.length>0){let Z=null;if($.forEach((J)=>{if(Z===null||J.precedence<Z.precedence)Z=J}),Z)G.add(Z)}this.operands=G.toArray()}equals(X){if(this===X)return!0;if(!(X instanceof U))return!1;return X3(this.operands,X.operands)}hashCode(){if(this.cachedHashCode===void 0){let X=O.initialize();for(let Y of this.operands)X=O.updateFromComparable(X,Y);X=O.update(X,3813686060),this.cachedHashCode=O.finish(X,this.operands.length+1)}return this.cachedHashCode}evaluate(X,Y){for(let G of this.operands)if(!G.evaluate(X,Y))return!1;return!0}evalPrecedence(X,Y){let G=!1,$=[];for(let J of this.operands){let Q=J.evalPrecedence(X,Y);if(G||=Q!==J,Q===null)return null;else if(Q!==S.NONE)$.push(Q)}if(!G)return this;if($.length===0)return S.NONE;let Z=null;return $.forEach((J)=>{Z=Z===null?J:S.andContext(Z,J)}),Z}toString(){let X=this.operands.map((Y)=>{return Y.toString()});return(X.length>3?X.slice(3):X).join("&&")}},l7=class U extends S{static{A(this,"OR")}operands;constructor(X,Y){super();let G=new R0;if(X instanceof U)X.operands.forEach((Z)=>{G.add(Z)});else G.add(X);if(Y instanceof U)Y.operands.forEach((Z)=>{G.add(Z)});else G.add(Y);let $=S.filterPrecedencePredicates(G);if($.length>0){let Z=$.sort((Q,F)=>{return Q.compareTo(F)}),J=Z[Z.length-1];G.add(J)}this.operands=G.toArray()}equals(X){if(this===X)return!0;else if(!(X instanceof U))return!1;else return X3(this.operands,X.operands)}hashCode(){if(this.cachedHashCode===void 0){let X=O.initialize();for(let Y of this.operands)X=O.updateFromComparable(X,Y);X=O.update(X,3383313031),this.cachedHashCode=O.finish(X,this.operands.length+1)}return this.cachedHashCode}evaluate(X,Y){for(let G of this.operands)if(G.evaluate(X,Y))return!0;return!1}evalPrecedence(X,Y){let G=!1,$=[];for(let J of this.operands){let Q=J.evalPrecedence(X,Y);if(G||=Q!==J,Q===S.NONE)return S.NONE;else if(Q!==null)$.push(Q)}if(!G)return this;if($.length===0)return null;let Z=null;return $.forEach((J)=>{Z=Z===null?J:S.orContext(Z,J)}),Z}toString(){let X=this.operands.map((Y)=>{return Y.toString()});return(X.length>3?X.slice(3):X).join("||")}};((U)=>{class X extends U{static{A(this,"Predicate")}ruleIndex;predIndex;isCtxDependent;constructor(G,$,Z){super();this.ruleIndex=G??-1,this.predIndex=$??-1,this.isCtxDependent=Z??!1}evaluate(G,$){let Z=this.isCtxDependent?$:null;return G.sempred(Z,this.ruleIndex,this.predIndex)}hashCode(){if(this.cachedHashCode===void 0){let G=O.initialize();G=O.update(G,this.ruleIndex),G=O.update(G,this.predIndex),G=O.update(G,this.isCtxDependent?1:0),G=O.finish(G,3),this.cachedHashCode=G}return this.cachedHashCode}equals(G){if(this===G)return!0;return this.ruleIndex===G.ruleIndex&&this.predIndex===G.predIndex&&this.isCtxDependent===G.isCtxDependent}toString(){return"{"+this.ruleIndex+":"+this.predIndex+"}?"}}U.Predicate=X;class Y extends U{static{A(this,"PrecedencePredicate")}precedence;constructor(G){super();this.precedence=G??0}evaluate(G,$){return G.precpred($,this.precedence)}evalPrecedence(G,$){if(G.precpred($??null,this.precedence))return U.NONE;return null}compareTo(G){return this.precedence-G.precedence}hashCode(){return 31+this.precedence}equals(G){if(this===G)return!0;return this.precedence===G.precedence}toString(){return"{"+this.precedence+">=prec}?"}}U.PrecedencePredicate=Y,U.NONE=new X})(S||(S={}));var s=class U{static{A(this,"ATNConfig")}state;alt;reachesIntoOuterContext=!1;precedenceFilterSuppressed=!1;get semanticContext(){return this.#X}cachedHashCode;#U=null;#X;constructor(X,Y,G,$){if(this.state=Y,this.alt=X.alt,this.context=G,this.#X=$??S.NONE,this.reachesIntoOuterContext=X.reachesIntoOuterContext,X.precedenceFilterSuppressed!==void 0)this.precedenceFilterSuppressed=X.precedenceFilterSuppressed}static duplicate(X,Y){return new U(X,X.state,X.context,Y??X.semanticContext)}static createWithContext(X,Y,G,$){return new U({alt:Y},X,G,$)}static createWithConfig(X,Y,G){return new U(Y,X,G??Y.context,Y.semanticContext)}static createWithSemanticContext(X,Y,G){return new U(Y,X??Y.state,Y.context,G)}hashCode(){if(this.cachedHashCode===void 0){let X=O.initialize(7);X=O.update(X,this.state.stateNumber),X=O.update(X,this.alt),X=O.updateFromComparable(X,this.#U),X=O.updateFromComparable(X,this.semanticContext),X=O.finish(X,4),this.cachedHashCode=X}return this.cachedHashCode}get context(){return this.#U}set context(X){this.#U=X,this.cachedHashCode=void 0}equals(X){if(this===X)return!0;return this.state.stateNumber===X.state.stateNumber&&this.alt===X.alt&&(this.context===null?X.context===null:this.context.equals(X.context))&&this.semanticContext.equals(X.semanticContext)&&this.precedenceFilterSuppressed===X.precedenceFilterSuppressed}toString(X,Y=!0){let G="";if(Y)G=","+this.alt;return"("+this.state+G+(this.context!==null?",["+this.context.toString()+"]":"")+(this.semanticContext!==S.NONE?","+this.semanticContext.toString():"")+(this.reachesIntoOuterContext?",up="+this.reachesIntoOuterContext:"")+")"}},f=class U{static{A(this,"ATNState")}static INVALID_STATE_NUMBER=-1;static INVALID_TYPE=0;static BASIC=1;static RULE_START=2;static BLOCK_START=3;static PLUS_BLOCK_START=4;static STAR_BLOCK_START=5;static TOKEN_START=6;static RULE_STOP=7;static BLOCK_END=8;static STAR_LOOP_BACK=9;static STAR_LOOP_ENTRY=10;static PLUS_LOOP_BACK=11;static LOOP_END=12;static stateType=U.INVALID_STATE_NUMBER;stateNumber=0;ruleIndex=0;epsilonOnlyTransitions=!1;nextTokenWithinRule;transitions=[];hashCode(){return this.stateNumber}equals(X){return this.stateNumber===X.stateNumber}toString(){return`${this.stateNumber}`}addTransitionAtIndex(X,Y){if(this.transitions.length===0)this.epsilonOnlyTransitions=Y.isEpsilon;else if(this.epsilonOnlyTransitions!==Y.isEpsilon)this.epsilonOnlyTransitions=!1;this.transitions.splice(X,0,Y)}addTransition(X){if(this.transitions.length===0)this.epsilonOnlyTransitions=X.isEpsilon;else if(this.epsilonOnlyTransitions!==X.isEpsilon)this.epsilonOnlyTransitions=!1;this.transitions.push(X)}setTransition(X,Y){this.transitions.splice(X,1,Y)}removeTransition(X){return this.transitions.splice(X,1)[0]}},t=class U{static{A(this,"PredictionContext")}static EMPTY_RETURN_STATE=2147483647;static traceATNSimulator=!1;cachedHashCode;constructor(X){this.cachedHashCode=X}static calculateEmptyHashCode(){let X=O.initialize(31);return X=O.finish(X,0),X}static calculateHashCodeSingle(X,Y){let G=O.initialize(31);return G=O.updateFromComparable(G,X),G=O.update(G,Y),G=O.finish(G,2),G}static calculateHashCodeList(X,Y){let G=O.initialize(31);for(let $ of X)G=O.updateFromComparable(G,$);for(let $ of Y)G=O.update(G,$);return G=O.finish(G,2*X.length),G}isEmpty(){return!1}hasEmptyPath(){return this.getReturnState(this.length-1)===U.EMPTY_RETURN_STATE}hashCode(){return this.cachedHashCode}toString(X){return""}},c1=class U extends t{static{A(this,"SingletonPredictionContext")}parent;returnState;constructor(X,Y){super(X?t.calculateHashCodeSingle(X,Y):t.calculateEmptyHashCode());this.parent=X??null,this.returnState=Y}getParent(X){return this.parent}getReturnState(X){return this.returnState}equals(X){if(this===X)return!0;if(!(X instanceof U))return!1;if(this.hashCode()!==X.hashCode())return!1;if(this.returnState!==X.returnState)return!1;if(this.parent==null)return X.parent==null;return this.parent.equals(X.parent)}toString(){let X=this.parent===null?"":this.parent.toString();if(X.length===0){if(this.returnState===t.EMPTY_RETURN_STATE)return"$";return""+this.returnState}else return""+this.returnState+" "+X}get length(){return 1}},n=class U extends c1{static{A(this,"EmptyPredictionContext")}static instance=new U;constructor(){super(void 0,t.EMPTY_RETURN_STATE)}isEmpty(){return!0}getParent(){return null}getReturnState(){return this.returnState}equals(X){return this===X}toString(){return"$"}},h=class{static{A(this,"Transition")}static INVALID=0;static EPSILON=1;static RANGE=2;static RULE=3;static PREDICATE=4;static ATOM=5;static ACTION=6;static SET=7;static NOT_SET=8;static WILDCARD=9;static PRECEDENCE=10;target;constructor(U){this.target=U}get isEpsilon(){return!1}get label(){return null}toString(){return""}},Q4=class extends h{static{A(this,"SetTransition")}set;constructor(U,X){super(U);if(X)this.set=X;else this.set=E0.of(R.INVALID_TYPE,R.INVALID_TYPE)}get transitionType(){return h.SET}get label(){return this.set}matches(U,X,Y){return this.set.contains(U)}toString(){return this.set.toString()}},N4=class extends Q4{static{A(this,"NotSetTransition")}get transitionType(){return h.NOT_SET}matches(U,X,Y){return U>=X&&U<=Y&&!super.matches(U,X,Y)}toString(){return"~"+super.toString()}},y7=class{static{A(this,"MapKeyEqualityComparator")}keyComparator;constructor(U){this.keyComparator=U}hashCode(U){return this.keyComparator.hashCode(U.key)}equals(U,X){return this.keyComparator.equals(U.key,X.key)}},p0=class U{static{A(this,"HashMap")}backingStore;constructor(X){if(X instanceof U)this.backingStore=new R0(X.backingStore);else X=X??m6.instance,this.backingStore=new R0(new y7(X))}clear(){this.backingStore.clear()}containsKey(X){return this.backingStore.contains({key:X})}get(X){let Y=this.backingStore.get({key:X});if(!Y)return;return Y.value}get isEmpty(){return this.backingStore.isEmpty}set(X,Y){let G=this.backingStore.get({key:X,value:Y}),$;if(!G)this.backingStore.add({key:X,value:Y});else $=G.value,G.value=Y;return $}setIfAbsent(X,Y){let G=this.backingStore.get({key:X,value:Y}),$;if(!G)this.backingStore.add({key:X,value:Y});else $=G.value;return $}keys(){return this.backingStore.toArray().map((X)=>{return X.key})}values(){return this.backingStore.toArray().map((X)=>{return X.value})}get size(){return this.backingStore.size}hashCode(){return this.backingStore.hashCode()}equals(X){return this.backingStore.equals(X.backingStore)}},C0=class{static{A(this,"TerminalNode")}parent=null;symbol;constructor(U){this.symbol=U}getChild(U){return null}getSymbol(){return this.symbol}getPayload(){return this.symbol}getSourceInterval(){if(this.symbol===null)return v.INVALID_INTERVAL;let U=this.symbol.tokenIndex;return new v(U,U)}getChildCount(){return 0}accept(U){return U.visitTerminal(this)}getText(){return this.symbol?.text??""}toString(){if(this.symbol?.type===R.EOF)return"<EOF>";else return this.symbol?.text??""}toStringTree(){return this.toString()}},L2=class extends C0{static{A(this,"ErrorNode")}accept(U){return U.visitErrorNode(this)}},e2=class U{static{A(this,"CommonToken")}static EMPTY_SOURCE=[null,null];source;tokenIndex;start;stop;type;line;column;channel;#U;constructor(X){if(this.type=X.type,this.source=X.source,this.tokenIndex=X.tokenIndex??-1,this.line=X.line??0,this.column=X.column??-1,this.channel=X.channel??R.DEFAULT_CHANNEL,this.start=X.start??0,this.stop=X.stop??0,this.#U=X.text,X.line===void 0&&X.source[0]!==null)this.line=X.source[0].line;if(X.column===void 0&&X.source[0]!==null)this.column=X.source[0].column}static fromToken(X){let Y=[X.tokenSource,X.inputStream];return new U({type:X.type,line:X.line,tokenIndex:X.tokenIndex,column:X.column,channel:X.channel,start:X.start,stop:X.stop,text:X.text,source:Y})}static fromType(X,Y){return new U({type:X,text:Y,source:U.EMPTY_SOURCE})}static fromSource(X,Y,G,$,Z){return new U({type:Y,channel:G,start:$,stop:Z,source:X})}get tokenSource(){return this.source[0]}get inputStream(){return this.source[1]}set inputStream(X){this.source[1]=X}clone(){return new U({source:this.source,type:this.type,channel:this.channel,start:this.start,stop:this.stop,tokenIndex:this.tokenIndex,line:this.line,column:this.column,text:this.#U})}toString(X){let Y="";if(this.channel>0)Y=",channel="+this.channel;let G=this.text;if(G)G=G.replace(/\n/g,"\\n"),G=G.replace(/\r/g,"\\r"),G=G.replace(/\t/g,"\\t");else G="<no text>";let $=String(this.type);if(X)$=X.vocabulary.getDisplayName(this.type)??"<unknown>";return"[@"+this.tokenIndex+","+this.start+":"+this.stop+"='"+G+"',<"+$+">"+Y+","+this.line+":"+this.column+"]"}get text(){if(this.#U!==void 0)return this.#U;let X=this.inputStream;if(!X)return;let Y=X.size;if(this.start<Y&&this.stop<Y)return X.getTextFromRange(this.start,this.stop);return"<EOF>"}set text(X){this.#U=X}setText(X){this.#U=X}setType(X){this.type=X}setLine(X){this.line=X}setCharPositionInLine(X){this.column=X}setChannel(X){this.channel=X}setTokenIndex(X){this.tokenIndex=X}},J1=class U{static{A(this,"Trees")}static toStringTree(X,Y,G){if(Y=Y??null,G)Y=G.ruleNames;let $=U.getNodeText(X,Y);$=d7($,!1);let Z=X.getChildCount();if(Z===0)return $;let J="("+$+" ";if(Z>0)$=U.toStringTree(X.getChild(0),Y),J=J.concat($);for(let Q=1;Q<Z;Q++)$=U.toStringTree(X.getChild(Q),Y),J=J.concat(" "+$);return J=J.concat(")"),J}static getNodeText(X,Y,G){if(Y=Y??null,G)Y=G.ruleNames;if(Y!==null){if(X instanceof C){let J=X.ruleContext.getAltNumber();if(J!==0)return Y[X.ruleIndex]+":"+J;return Y[X.ruleIndex]}else if(X instanceof L2)return X.toString();else if(X instanceof C0)return X.symbol.text}let $=X.getPayload();if(b7($))return $.text;return String(X.getPayload())}static getChildren(X){let Y=[];for(let G=0;G<X.getChildCount();G++)Y.push(X.getChild(G));return Y}static getAncestors(X){if(X.parent===null)return[];let Y=[],G=X.parent;while(G!==null)Y=[G].concat(Y),G=G.parent;return Y}static isAncestorOf(X,Y){if(X===null||Y===null||X.parent===null)return!1;let G=Y.parent;while(G!==null){if(X===G)return!0;G=G.parent}return!1}static findAllTokenNodes(X,Y){return U.findAllNodes(X,Y,!0)}static findAllRuleNodes(X,Y){return U.findAllNodes(X,Y,!1)}static findAllNodes(X,Y,G){let $=[];return U.doFindAllNodes(X,Y,G,$),$}static descendants(X){let Y=[X];for(let G=0;G<X.getChildCount();G++)Y=Y.concat(U.descendants(X.getChild(G)));return Y}static getRootOfSubtreeEnclosingRegion(X,Y,G){let $=X.getChildCount();for(let Z=0;Z<$;Z++){let J=X.getChild(Z),Q=this.getRootOfSubtreeEnclosingRegion(J,Y,G);if(Q!==null)return Q}if(X instanceof C){if(Y>=X.start.tokenIndex&&(X.stop===null||G<=X.stop.tokenIndex))return X}return null}static stripChildrenOutOfRange(X,Y,G,$){if(X===null)return;for(let Z=0;Z<X.getChildCount();Z++){let J=X.getChild(Z),Q=J.getSourceInterval();if(X instanceof C&&(Q.stop<G||Q.start>$)){if(this.isAncestorOf(J,Y)){let F=e2.fromType(R.INVALID_TYPE,"...");X.children[Z]=new C0(F)}}}}static doFindAllNodes(X,Y,G,$){if(G&&X instanceof C0){if(X.symbol?.type===Y)$.push(X)}else if(!G&&X instanceof C){if(X.ruleIndex===Y)$.push(X)}for(let Z=0;Z<X.getChildCount();Z++)U.doFindAllNodes(X.getChild(Z),Y,G,$)}},C=class U{static{A(this,"ParserRuleContext")}static empty=new U(null);start=null;stop=null;children=[];invokingState;parent;constructor(X,Y=-1){this.parent=X,this.invokingState=Y}copyFrom(X){if(this.parent=X.parent,this.invokingState=X.invokingState,this.children.slice(0,this.children.length),this.start=X.start,this.stop=X.stop,X.children)X.children.forEach((Y)=>{if(Y instanceof L2)this.children.push(Y),Y.parent=this})}enterRule(X){}exitRule(X){}addChild(X){return this.children.push(X),X}removeLastChild(){this.children.pop()}addTokenNode(X){let Y=new C0(X);return this.children.push(Y),Y.parent=this,Y}addErrorNode(X){return X.parent=this,this.children.push(X),X}getChild(X,Y){if(X<0||X>=this.children.length)return null;if(!Y)return this.children[X];for(let G of this.children)if(G instanceof Y)if(X===0)return G;else X-=1;return null}getToken(X,Y){if(Y<0||Y>=this.children.length)return null;for(let G of this.children)if("symbol"in G){if(G.symbol?.type===X)if(Y===0)return G;else Y-=1}return null}getTokens(X){let Y=[];for(let G of this.children)if("symbol"in G){if(G.symbol?.type===X)Y.push(G)}return Y}getRuleContext(X,Y){return this.getChild(X,Y)}getRuleContexts(X){let Y=[];for(let G of this.children)if(G instanceof X)Y.push(G);return Y}getChildCount(){return this.children.length}getSourceInterval(){if(this.start===null)return v.INVALID_INTERVAL;if(this.stop===null||this.stop.tokenIndex<this.start.tokenIndex)return new v(this.start.tokenIndex,this.start.tokenIndex-1);return new v(this.start.tokenIndex,this.stop.tokenIndex)}depth(){let X=0,Y=this;while(Y!==null)Y=Y.parent,X+=1;return X}isEmpty(){return this.invokingState===-1}get ruleContext(){return this}get ruleIndex(){return-1}getPayload(){return this}getText(){if(this.children.length===0)return"";return this.children.map((X)=>{return X.getText()}).join("")}getAltNumber(){return b.INVALID_ALT_NUMBER}setAltNumber(X){}accept(X){return X.visitChildren(this)}toStringTree(...X){if(X.length<2)return J1.toStringTree(this,null,X[0]);return J1.toStringTree(this,X[0],X[1])}toString(X,Y){X=X??null,Y=Y??null;let G=this,$="[";while(G!==null&&G!==Y){if(X===null){if(!G.isEmpty())$+=G.invokingState}else{let Z=G.ruleIndex,J=Z>=0&&Z<X.length?X[Z]:""+Z;$+=J}if(G.parent!==null&&(X!==null||!G.parent.isEmpty()))$+=" ";G=G.parent}return $+="]",$}},Q1=class U extends t{static{A(this,"ArrayPredictionContext")}parents=[];returnStates=[];constructor(X,Y){super(t.calculateHashCodeList(X,Y));return this.parents=X,this.returnStates=Y,this}isEmpty(){return this.returnStates[0]===t.EMPTY_RETURN_STATE}get length(){return this.returnStates.length}getParent(X){return this.parents[X]}getReturnState(X){return this.returnStates[X]}equals(X){if(this===X)return!0;if(!(X instanceof U)||this.hashCode()!==X.hashCode())return!1;return m7(this.returnStates,X.returnStates)&&X3(this.parents,X.parents)}toString(){if(this.isEmpty())return"[]";let X=[];for(let Y=0;Y<this.returnStates.length;Y++){if(this.returnStates[Y]===t.EMPTY_RETURN_STATE){X.push("$");continue}if(X.push(this.returnStates[Y].toString()),this.parents[Y])X.push(this.parents[Y].toString());else X.push("null")}return`[${X.join(", ")}]`}},O1=A((U,X)=>{if(X===t.EMPTY_RETURN_STATE&&U===null)return n.instance;else return new c1(U,X)},"createSingletonPredictionContext"),q4=A((U,X)=>{if(!X)X=C.empty;if(!X.parent||X===C.empty)return n.instance;let Y=q4(U,X.parent),$=U.states[X.invokingState].transitions[0];return O1(Y,$.followState.stateNumber)},"predictionContextFromRuleContext"),d6=A((U,X,Y)=>{if(U.isEmpty())return U;let G=Y.get(U);if(G)return G;if(G=X.get(U),G)return Y.set(U,G),G;let $=!1,Z=[];for(let Q=0;Q<Z.length;Q++){let F=d6(U.getParent(Q),X,Y);if($||F!==U.getParent(Q)){if(!$){Z=[];for(let _=0;_<U.length;_++)Z[_]=U.getParent(_);$=!0}Z[Q]=F}}if(!$)return X.add(U),Y.set(U,U),U;let J;if(Z.length===0)J=n.instance;else if(Z.length===1)J=O1(Z[0]??void 0,U.getReturnState(0));else J=new Q1(Z,U.returnStates);return X.add(J),Y.set(J,J),Y.set(U,J),J},"getCachedPredictionContext"),F4=A((U,X,Y,G)=>{if(U===X||U.equals(X))return U;if(U instanceof c1&&X instanceof c1)return s7(U,X,Y,G);if(Y){if(U instanceof n)return U;if(X instanceof n)return X}if(U instanceof c1)U=new Q1([U.parent],[U.returnState]);if(X instanceof c1)X=new Q1([X.parent],[X.returnState]);return c7(U,X,Y,G)},"merge"),c7=A((U,X,Y,G)=>{if(G){let I=G.get(U,X);if(I)return I;if(I=G.get(X,U),I)return I}let $=0,Z=0,J=0,Q=Array(U.returnStates.length+X.returnStates.length).fill(0),F=Array(U.returnStates.length+X.returnStates.length).fill(null);while($<U.returnStates.length&&Z<X.returnStates.length){let I=U.parents[$],H=X.parents[Z];if(U.returnStates[$]===X.returnStates[Z]){let j=U.returnStates[$];if(j===t.EMPTY_RETURN_STATE&&I===null&&H===null||I!==null&&H!==null&&I===H)F[J]=I,Q[J]=j;else F[J]=F4(I,H,Y,G),Q[J]=j;$+=1,Z+=1}else if(U.returnStates[$]<X.returnStates[Z])F[J]=I,Q[J]=U.returnStates[$],$+=1;else F[J]=H,Q[J]=X.returnStates[Z],Z+=1;J+=1}if($<U.returnStates.length)for(let I=$;I<U.returnStates.length;I++)F[J]=U.parents[I],Q[J]=U.returnStates[I],J+=1;else for(let I=Z;I<X.returnStates.length;I++)F[J]=X.parents[I],Q[J]=X.returnStates[I],J+=1;if(J<F.length){if(J===1){let I=O1(F[0]??void 0,Q[0]);if(G!==null)G.set(U,X,I);return I}F=F.slice(0,J),Q=Q.slice(0,J)}let _=new Q1(F,Q);if(_.equals(U)){if(G!==null)G.set(U,X,U);if(t.traceATNSimulator)console.log("mergeArrays a="+U+",b="+X+" -> a");return U}if(_.equals(X)){if(G!==null)G.set(U,X,X);return X}if(a7(F),G!==null)G.set(U,X,_);if(t.traceATNSimulator)console.log("mergeArrays a="+U+",b="+X+" -> "+_);return _},"mergeArrays"),a7=A((U)=>{let X=new p0(k1.instance);for(let Y of U)if(Y){if(!X.containsKey(Y))X.set(Y,Y)}for(let Y=0;Y<U.length;Y++)if(U[Y])U[Y]=X.get(U[Y])??null},"combineCommonParents"),s7=A((U,X,Y,G)=>{if(G!==null){let Z=G.get(U,X);if(Z!==null)return Z;if(Z=G.get(X,U),Z!==null)return Z}let $=n7(U,X,Y);if($!==null){if(G!==null)G.set(U,X,$);return $}if(U.returnState===X.returnState){let Z=F4(U.parent,X.parent,Y,G);if(Z===U.parent)return U;if(Z===X.parent)return X;let J=O1(Z,U.returnState);if(G!==null)G.set(U,X,J);return J}else{let Z=null;if(U===X||U.parent!==null&&U.parent.equals(X.parent))Z=U.parent;if(Z!==null){let _=[U.returnState,X.returnState];if(U.returnState>X.returnState)_[0]=X.returnState,_[1]=U.returnState;let H=new Q1([Z,Z],_);if(G!==null)G.set(U,X,H);return H}let J=[U.returnState,X.returnState],Q=[U.parent,X.parent];if(U.returnState>X.returnState)J[0]=X.returnState,J[1]=U.returnState,Q=[X.parent,U.parent];let F=new Q1(Q,J);if(G!==null)G.set(U,X,F);return F}},"mergeSingletons"),n7=A((U,X,Y)=>{if(Y){if(U===n.instance||X===n.instance)return n.instance}else{if(U===n.instance&&X===n.instance)return n.instance;if(U===n.instance){let G=[X.returnState,t.EMPTY_RETURN_STATE],$=[X.parent,null];return new Q1($,G)}if(X===n.instance){let G=[U.returnState,t.EMPTY_RETURN_STATE],$=[U.parent,null];return new Q1($,G)}}return null},"mergeRoot"),p7=class U{constructor(X){this.atn=X}static{A(this,"LL1Analyzer")}static hitPredicate=R.INVALID_TYPE;getDecisionLookahead(X){let Y=X.transitions.length,G=Array(Y);for(let $=0;$<Y;$++){let Z=new E0,J=new R0;if(this.doLook(X.transitions[$].target,void 0,n.instance,Z,J,new x0,!1,!1),Z.length>0&&!Z.contains(U.hitPredicate))G[$]=Z}return G}look(X,Y,G){let $=new E0,Z=G?q4(this.atn,G):null;return this.doLook(X,Y,Z,$,new R0,new x0,!0,!0),$}doLook(X,Y,G,$,Z,J,Q,F){let _=s.createWithContext(X,0,G);if(Z.get(_))return;if(Z.add(_),X===Y){if(!G){$.addOne(R.EPSILON);return}else if(G.isEmpty()&&F){$.addOne(R.EOF);return}}if(X.constructor.stateType===f.RULE_STOP){if(!G){$.addOne(R.EPSILON);return}else if(G.isEmpty()&&F){$.addOne(R.EOF);return}if(G!==n.instance){let I=J.get(X.ruleIndex);try{J.clear(X.ruleIndex);for(let H=0;H<G.length;H++){let j=this.atn.states[G.getReturnState(H)];this.doLook(j,Y,G.getParent(H),$,Z,J,Q,F)}}finally{if(I)J.set(X.ruleIndex)}return}}for(let I of X.transitions)switch(I.transitionType){case h.RULE:{if(J.get(I.target.ruleIndex))continue;let H=O1(G??void 0,I.followState.stateNumber);try{J.set(I.target.ruleIndex),this.doLook(I.target,Y,H,$,Z,J,Q,F)}finally{J.clear(I.target.ruleIndex)}break}case h.PREDICATE:case h.PRECEDENCE:{if(Q)this.doLook(I.target,Y,G,$,Z,J,Q,F);else $.addOne(U.hitPredicate);break}case h.WILDCARD:{$.addRange(R.MIN_USER_TOKEN_TYPE,this.atn.maxTokenType);break}default:{if(I.isEpsilon)this.doLook(I.target,Y,G,$,Z,J,Q,F);else{let H=I.label;if(H){if(I instanceof N4)H=H.complement(R.MIN_USER_TOKEN_TYPE,this.atn.maxTokenType);$.addSet(H)}}break}}}},b=class{static{A(this,"ATN")}static INVALID_ALT_NUMBER=0;static LEXER=0;static PARSER=1;grammarType;maxTokenType;states=[];decisionToState=[];ruleToStartState=[];ruleToStopState=[];modeNameToStartState=new Map;ruleToTokenType=[];lexerActions=[];modeToStartState=[];analyzer;constructor(U,X){this.grammarType=U,this.maxTokenType=X,this.analyzer=new p7(this)}nextTokens(U,X){if(!X&&U.nextTokenWithinRule)return U.nextTokenWithinRule;let Y=this.analyzer.look(U,void 0,X);if(!X)U.nextTokenWithinRule=Y;return Y}addState(U){if(U)U.stateNumber=this.states.length;this.states.push(U)}removeState(U){this.states[U.stateNumber]=null}defineDecisionState(U){return this.decisionToState.push(U),U.decision=this.decisionToState.length-1,U.decision}getDecisionState(U){if(this.decisionToState.length===0)return null;else return this.decisionToState[U]}getNumberOfDecisions(){return this.decisionToState.length}getExpectedTokens(U,X){if(U<0||U>=this.states.length)throw Error("Invalid state number.");let Y=this.states[U],G=this.nextTokens(Y);if(!G.contains(R.EPSILON))return G;let $=X,Z=new E0;Z.addSet(G),Z.removeOne(R.EPSILON);while($!==null&&$.invokingState>=0&&G.contains(R.EPSILON)){let Q=this.states[$.invokingState].transitions[0];G=this.nextTokens(Q.followState),Z.addSet(G),Z.removeOne(R.EPSILON),$=$.parent}if(G.contains(R.EPSILON))Z.addOne(R.EOF);return Z}},h6=class U{static{A(this,"KeyTypeEqualityComparer")}static instance=new U;hashCode(X){let Y=7;return Y=31*Y+X.state.stateNumber,Y=31*Y+X.alt,Y=31*Y+X.semanticContext.hashCode(),Y}equals(X,Y){if(X===Y)return!0;return X.state.stateNumber===Y.state.stateNumber&&X.alt===Y.alt&&X.semanticContext.equals(Y.semanticContext)}},n0=class{static{A(this,"ATNConfigSet")}configLookup=new R0(h6.instance);configs=[];uniqueAlt=0;hasSemanticContext=!1;dipsIntoOuterContext=!1;fullCtx=!1;readOnly=!1;conflictingAlts=null;firstStopState;#U=-1;constructor(U){if(U!==void 0)if(typeof U==="boolean")this.fullCtx=U??!0;else{let X=U;this.addAll(X.configs),this.uniqueAlt=X.uniqueAlt,this.conflictingAlts=X.conflictingAlts,this.hasSemanticContext=X.hasSemanticContext,this.dipsIntoOuterContext=X.dipsIntoOuterContext}}[Symbol.iterator](){return this.configs[Symbol.iterator]()}add(U,X=null){if(this.readOnly)throw Error("This set is readonly");if(!this.firstStopState&&U.state.constructor.stateType===f.RULE_STOP)this.firstStopState=U;this.hasSemanticContext||=U.semanticContext!==S.NONE,this.dipsIntoOuterContext||=U.reachesIntoOuterContext;let Y=this.configLookup.getOrAdd(U);if(Y===U){this.#U=-1,this.configs.push(U);return}let G=!this.fullCtx,$=F4(Y.context,U.context,G,X);Y.reachesIntoOuterContext||=U.reachesIntoOuterContext,Y.precedenceFilterSuppressed||=U.precedenceFilterSuppressed,Y.context=$}get elements(){return this.configs}getAlts(){let U=new x0;for(let X of this.configs)U.set(X.alt);return U}getPredicates(){let U=[];for(let X of this.configs)if(X.semanticContext!==S.NONE)U.push(X.semanticContext);return U}getStates(){let U=new R0;for(let X of this.configs)U.add(X.state);return U}optimizeConfigs(U){if(this.readOnly)throw Error("This set is readonly");if(this.configLookup.size===0)return;for(let X of this.configs)X.context=U.getCachedContext(X.context)}addAll(U){for(let X of U)this.add(X);return!1}equals(U){if(this===U)return!0;if(this.fullCtx===U.fullCtx&&this.uniqueAlt===U.uniqueAlt&&this.conflictingAlts===U.conflictingAlts&&this.hasSemanticContext===U.hasSemanticContext&&this.dipsIntoOuterContext===U.dipsIntoOuterContext&&X3(this.configs,U.configs))return!0;return!1}hashCode(){if(this.#U===-1)this.#U=this.computeHashCode();return this.#U}get length(){return this.configs.length}isEmpty(){return this.configs.length===0}contains(U){if(this.configLookup===null)throw Error("This method is not implemented for readonly sets.");return this.configLookup.contains(U)}containsFast(U){if(this.configLookup===null)throw Error("This method is not implemented for readonly sets.");return this.configLookup.contains(U)}clear(){if(this.readOnly)throw Error("This set is readonly");this.configs=[],this.#U=-1,this.configLookup=new R0(h6.instance)}setReadonly(U){if(this.readOnly=U,U)this.configLookup=null}toString(){return y1(this.configs)+(this.hasSemanticContext?",hasSemanticContext="+this.hasSemanticContext:"")+(this.uniqueAlt!==b.INVALID_ALT_NUMBER?",uniqueAlt="+this.uniqueAlt:"")+(this.conflictingAlts!==null?",conflictingAlts="+this.conflictingAlts:"")+(this.dipsIntoOuterContext?",dipsIntoOuterContext":"")}computeHashCode(){let U=O.initialize();return this.configs.forEach((X)=>{U=O.update(U,X.hashCode())}),U=O.finish(U,this.configs.length),U}},E6=class extends f{static{A(this,"BasicState")}static stateType=f.BASIC},j1=class extends f{static{A(this,"DecisionState")}decision=-1;nonGreedy=!1},M1=class extends j1{static{A(this,"BlockStartState")}endState},r3=class extends f{static{A(this,"BlockEndState")}static stateType=f.BLOCK_END;startState},d1=class extends f{static{A(this,"LoopEndState")}static stateType=f.LOOP_END;loopBackState},G4=class extends f{static{A(this,"RuleStartState")}static stateType=f.RULE_START;stopState;isLeftRecursiveRule=!1},h0=class extends f{static{A(this,"RuleStopState")}static stateType=f.RULE_STOP},o7=class extends j1{static{A(this,"TokensStartState")}static stateType=f.TOKEN_START},C6=class extends j1{static{A(this,"PlusLoopbackState")}static stateType=f.PLUS_LOOP_BACK},e3=class extends f{static{A(this,"StarLoopbackState")}static stateType=f.STAR_LOOP_BACK},Z1=class extends j1{static{A(this,"StarLoopEntryState")}static stateType=f.STAR_LOOP_ENTRY;loopBackState;precedenceRuleDecision=!1},U4=class extends M1{static{A(this,"PlusBlockStartState")}static stateType=f.PLUS_BLOCK_START;loopBackState},X4=class extends M1{static{A(this,"StarBlockStartState")}static stateType=f.STAR_BLOCK_START},f6=class extends M1{static{A(this,"BasicBlockStartState")}static stateType=f.BLOCK_START},R2=class extends h{static{A(this,"AtomTransition")}labelValue;#U;constructor(U,X){super(U);this.labelValue=X,this.#U=E0.of(X,X)}get label(){return this.#U}get transitionType(){return h.ATOM}matches(U){return this.labelValue===U}toString(){return this.labelValue.toString()}},$4=class extends h{static{A(this,"RuleTransition")}ruleIndex;precedence;followState;constructor(U,X,Y,G){super(U);this.ruleIndex=X,this.precedence=Y,this.followState=G}get isEpsilon(){return!0}get transitionType(){return h.RULE}matches(U,X,Y){return!1}},Z4=class extends h{static{A(this,"RangeTransition")}start;stop;#U=new E0;constructor(U,X,Y){super(U);this.start=X,this.stop=Y,this.#U.addRange(X,Y)}get label(){return this.#U}get transitionType(){return h.RANGE}matches(U,X,Y){return U>=this.start&&U<=this.stop}toString(){return"'"+String.fromCharCode(this.start)+"'..'"+String.fromCharCode(this.stop)+"'"}},T6=class extends h{static{A(this,"ActionTransition")}ruleIndex;actionIndex;isCtxDependent;constructor(U,X,Y,G){super(U);this.ruleIndex=X,this.actionIndex=Y??-1,this.isCtxDependent=G??!1}get isEpsilon(){return!0}get transitionType(){return h.ACTION}matches(U,X,Y){return!1}toString(){return"action_"+this.ruleIndex+":"+this.actionIndex}},w2=class extends h{static{A(this,"EpsilonTransition")}#U;constructor(U,X=-1){super(U);this.#U=X}get outermostPrecedenceReturn(){return this.#U}get isEpsilon(){return!0}get transitionType(){return h.EPSILON}matches(){return!1}toString(){return"epsilon"}},i7=class extends h{static{A(this,"WildcardTransition")}get transitionType(){return h.WILDCARD}matches(U,X,Y){return U>=X&&U<=Y}toString(){return"."}},l6=class extends h{static{A(this,"AbstractPredicateTransition")}constructor(U){super(U)}},y6=class extends l6{static{A(this,"PredicateTransition")}ruleIndex;predIndex;isCtxDependent;constructor(U,X,Y,G){super(U);this.ruleIndex=X,this.predIndex=Y,this.isCtxDependent=G}get isEpsilon(){return!0}matches(U,X,Y){return!1}get transitionType(){return h.PREDICATE}getPredicate(){return new S.Predicate(this.ruleIndex,this.predIndex,this.isCtxDependent)}toString(){return"pred_"+this.ruleIndex+":"+this.predIndex}},t7=class extends l6{static{A(this,"PrecedencePredicateTransition")}precedence;constructor(U,X){super(U);this.precedence=X}get isEpsilon(){return!0}matches(U,X,Y){return!1}getPredicate(){return new S.PrecedencePredicate(this.precedence)}get transitionType(){return h.PRECEDENCE}toString(){return this.precedence+" >= _p"}},x={CHANNEL:0,CUSTOM:1,MODE:2,MORE:3,POP_MODE:4,PUSH_MODE:5,SKIP:6,TYPE:7},r7=class U{static{A(this,"LexerSkipAction")}static instance=new U;actionType;isPositionDependent=!1;constructor(){this.actionType=x.SKIP}equals(X){return X===this}hashCode(){return x.SKIP}execute(X){X.skip()}toString(){return"skip"}},e7=class U{static{A(this,"LexerChannelAction")}channel;actionType;isPositionDependent=!1;cachedHashCode;constructor(X){this.actionType=x.CHANNEL,this.channel=X}execute(X){X.channel=this.channel}hashCode(){if(this.cachedHashCode===void 0){let X=O.initialize();X=O.update(X,this.actionType),X=O.update(X,this.channel),this.cachedHashCode=O.finish(X,2)}return this.cachedHashCode}equals(X){if(this===X)return!0;if(!(X instanceof U))return!1;return this.channel===X.channel}toString(){return"channel("+this.channel+")"}},U8=class U{static{A(this,"LexerCustomAction")}ruleIndex;actionIndex;actionType;isPositionDependent=!0;cachedHashCode;constructor(X,Y){this.actionType=x.CUSTOM,this.ruleIndex=X,this.actionIndex=Y}execute(X){X.action(null,this.ruleIndex,this.actionIndex)}hashCode(){if(this.cachedHashCode===void 0){let X=O.initialize();X=O.update(X,this.actionType),X=O.update(X,this.ruleIndex),X=O.update(X,this.actionIndex),this.cachedHashCode=O.finish(X,3)}return this.cachedHashCode}equals(X){if(this===X)return!0;if(!(X instanceof U))return!1;return this.ruleIndex===X.ruleIndex&&this.actionIndex===X.actionIndex}},X8=class U{static{A(this,"LexerMoreAction")}static instance=new U;actionType;isPositionDependent=!1;constructor(){this.actionType=x.MORE}equals(X){return X===this}hashCode(){return x.MORE}execute(X){X.more()}toString(){return"more"}},Y8=class U{static{A(this,"LexerTypeAction")}type;actionType;isPositionDependent=!1;cachedHashCode;constructor(X){this.actionType=x.TYPE,this.type=X}execute(X){X.type=this.type}hashCode(){if(this.cachedHashCode===void 0){let X=O.initialize();X=O.update(X,this.actionType),X=O.update(X,this.type),this.cachedHashCode=O.finish(X,2)}return this.cachedHashCode}equals(X){if(this===X)return!0;if(!(X instanceof U))return!1;return this.type===X.type}toString(){return"type("+this.type+")"}},G8=class U{static{A(this,"LexerPushModeAction")}mode;actionType;isPositionDependent=!1;cachedHashCode;constructor(X){this.actionType=x.PUSH_MODE,this.mode=X}execute(X){X.pushMode(this.mode)}hashCode(){if(this.cachedHashCode===void 0){let X=O.initialize();X=O.update(X,this.actionType),X=O.update(X,this.mode),this.cachedHashCode=O.finish(X,2)}return this.cachedHashCode}equals(X){if(this===X)return!0;if(!(X instanceof U))return!1;return this.mode===X.mode}toString(){return"pushMode("+this.mode+")"}},$8=class U{static{A(this,"LexerPopModeAction")}static instance=new U;actionType;isPositionDependent=!1;constructor(){this.actionType=x.POP_MODE}equals(X){return X===this}hashCode(){return x.POP_MODE}execute(X){X.popMode()}toString(){return"popMode"}},Z8=class U{static{A(this,"LexerModeAction")}mode;actionType;isPositionDependent=!1;cachedHashCode;constructor(X){this.actionType=x.MODE,this.mode=X}execute(X){X.mode=this.mode}hashCode(){if(this.cachedHashCode===void 0){let X=O.initialize();X=O.update(X,this.actionType),X=O.update(X,this.mode),this.cachedHashCode=O.finish(X,2)}return this.cachedHashCode}equals(X){if(this===X)return!0;if(!(X instanceof U))return!1;return this.mode===X.mode}toString(){return"mode("+this.mode+")"}},N1=class U{static{A(this,"ATNDeserializer")}static SERIALIZED_VERSION=4;static stateTypeMapper=new Map([[f.INVALID_TYPE,void 0],[f.BASIC,E6],[f.RULE_START,G4],[f.BLOCK_START,f6],[f.PLUS_BLOCK_START,U4],[f.STAR_BLOCK_START,X4],[f.TOKEN_START,o7],[f.RULE_STOP,h0],[f.BLOCK_END,r3],[f.STAR_LOOP_BACK,e3],[f.STAR_LOOP_ENTRY,Z1],[f.PLUS_LOOP_BACK,C6],[f.LOOP_END,d1]]);static lexerActionFactoryMapper=new Map([[x.CHANNEL,(X)=>{return new e7(X)}],[x.CUSTOM,(X,Y)=>{return new U8(X,Y)}],[x.MODE,(X)=>{return new Z8(X)}],[x.MORE,()=>{return X8.instance}],[x.POP_MODE,()=>{return $8.instance}],[x.PUSH_MODE,(X)=>{return new G8(X)}],[x.SKIP,()=>{return r7.instance}],[x.TYPE,(X)=>{return new Y8(X)}]]);data=[];pos=0;deserializationOptions;actionFactories;constructor(X){if(!X)X={readOnly:!1,verifyATN:!0,generateRuleBypassTransitions:!1};this.deserializationOptions=X}deserialize(X){this.data=X,this.checkVersion();let Y=this.readATN();this.readStates(Y),this.readRules(Y),this.readModes(Y);let G=[];if(this.readSets(Y,G),this.readEdges(Y,G),this.readDecisions(Y),this.readLexerActions(Y),this.markPrecedenceDecisions(Y),this.verifyATN(Y),this.deserializationOptions.generateRuleBypassTransitions&&Y.grammarType===b.PARSER)this.generateRuleBypassTransitions(Y),this.verifyATN(Y);return Y}checkVersion(){let X=this.data[this.pos++];if(X!==U.SERIALIZED_VERSION)throw Error("Could not deserialize ATN with version "+X+" (expected "+U.SERIALIZED_VERSION+").")}readATN(){let X=this.data[this.pos++],Y=this.data[this.pos++];return new b(X,Y)}readStates(X){let Y,G,$=[],Z=[],J=this.data[this.pos++];for(let _=0;_<J;_++){let I=this.data[this.pos++];if(I===f.INVALID_TYPE){X.addState(null);continue}let H=this.data[this.pos++],j=this.stateFactory(I,H);if(I===f.LOOP_END){let P=this.data[this.pos++];$.push([j,P])}else if(j instanceof M1){let P=this.data[this.pos++];Z.push([j,P])}X.addState(j)}for(Y=0;Y<$.length;Y++){let _=$[Y];_[0].loopBackState=X.states[_[1]]??void 0}for(Y=0;Y<Z.length;Y++){let _=Z[Y];_[0].endState=X.states[_[1]]}let Q=this.data[this.pos++];for(Y=0;Y<Q;Y++)G=this.data[this.pos++],X.states[G].nonGreedy=!0;let F=this.data[this.pos++];for(Y=0;Y<F;Y++)G=this.data[this.pos++],X.states[G].isLeftRecursiveRule=!0}readRules(X){let Y,G=this.data[this.pos++];if(X.grammarType===b.LEXER)X.ruleToTokenType=Array(G),X.ruleToTokenType.fill(0);X.ruleToStartState=Array(G),X.ruleToStartState.fill(null);for(Y=0;Y<G;Y++){let $=this.data[this.pos++];if(X.ruleToStartState[Y]=X.states[$],X.grammarType===b.LEXER){let Z=this.data[this.pos++];X.ruleToTokenType[Y]=Z}}X.ruleToStopState=Array(G),X.ruleToStopState.fill(null);for(Y=0;Y<X.states.length;Y++){let $=X.states[Y];if(!($ instanceof h0))continue;X.ruleToStopState[$.ruleIndex]=$,X.ruleToStartState[$.ruleIndex].stopState=$}}readModes(X){let Y=this.data[this.pos++];for(let G=0;G<Y;G++){let $=this.data[this.pos++];X.modeToStartState.push(X.states[$])}}readSets(X,Y){let G=this.data[this.pos++];for(let $=0;$<G;$++){let Z=new E0;Y.push(Z);let J=this.data[this.pos++];if(this.data[this.pos++]!==0)Z.addOne(-1);for(let F=0;F<J;F++){let _=this.data[this.pos++],I=this.data[this.pos++];Z.addRange(_,I)}}}readEdges(X,Y){let G,$,Z,J,Q,F=this.data[this.pos++];for(G=0;G<F;G++){let _=this.data[this.pos++],I=this.data[this.pos++],H=this.data[this.pos++],j=this.data[this.pos++],P=this.data[this.pos++],g=this.data[this.pos++];J=this.edgeFactory(X,H,I,j,P,g,Y),X.states[_].addTransition(J)}for(G=0;G<X.states.length;G++){Z=X.states[G];for($=0;$<Z.transitions.length;$++){let _=Z.transitions[$];if(!(_ instanceof $4))continue;let I=-1;if(X.ruleToStartState[_.target.ruleIndex].isLeftRecursiveRule){if(_.precedence===0)I=_.target.ruleIndex}J=new w2(_.followState,I),X.ruleToStopState[_.target.ruleIndex].addTransition(J)}}for(G=0;G<X.states.length;G++){if(Z=X.states[G],Z instanceof M1){if(!Z.endState)throw Error("IllegalState");if(Z.endState.startState)throw Error("IllegalState");Z.endState.startState=Z}if(Z instanceof C6){for($=0;$<Z.transitions.length;$++)if(Q=Z.transitions[$].target,Q instanceof U4)Q.loopBackState=Z}else if(Z instanceof e3){for($=0;$<Z.transitions.length;$++)if(Q=Z.transitions[$].target,Q instanceof Z1)Q.loopBackState=Z}}}readDecisions(X){let Y=this.data[this.pos++];for(let G=0;G<Y;G++){let $=this.data[this.pos++],Z=X.states[$];X.decisionToState.push(Z),Z.decision=G}}readLexerActions(X){if(X.grammarType===b.LEXER){let Y=this.data[this.pos++];X.lexerActions=[];for(let G=0;G<Y;G++){let $=this.data[this.pos++],Z=this.data[this.pos++],J=this.data[this.pos++];X.lexerActions.push(this.lexerActionFactory($,Z,J))}}}generateRuleBypassTransitions(X){let Y,G=X.ruleToStartState.length;for(Y=0;Y<G;Y++)X.ruleToTokenType[Y]=X.maxTokenType+Y+1;for(Y=0;Y<G;Y++)this.generateRuleBypassTransition(X,Y)}generateRuleBypassTransition(X,Y){let G,$,Z=new f6;Z.ruleIndex=Y,X.addState(Z);let J=new r3;J.ruleIndex=Y,X.addState(J),Z.endState=J,X.defineDecisionState(Z),J.startState=Z;let Q=null,F=null;if(X.ruleToStartState[Y].isLeftRecursiveRule){F=null;for(G=0;G<X.states.length;G++)if($=X.states[G],this.stateIsEndStateFor($,Y)){F=$,Q=$.loopBackState.transitions[0];break}if(Q===null)throw Error("Couldn't identify final state of the precedence rule prefix section.")}else F=X.ruleToStopState[Y];for(G=0;G<X.states.length;G++){$=X.states[G];for(let H of $.transitions){if(H===Q)continue;if(H.target===F)H.target=J}}let _=X.ruleToStartState[Y];while(_.transitions.length>0){let H=_.removeTransition(_.transitions.length-1);Z.addTransition(H)}if(X.ruleToStartState[Y].addTransition(new w2(Z)),F)J.addTransition(new w2(F));let I=new E6;X.addState(I),I.addTransition(new R2(J,X.ruleToTokenType[Y])),Z.addTransition(new w2(I))}stateIsEndStateFor(X,Y){if(X.ruleIndex!==Y)return null;if(!(X instanceof Z1))return null;let G=X.transitions[X.transitions.length-1].target;if(!(G instanceof d1))return null;if(G.epsilonOnlyTransitions&&G.transitions[0].target instanceof h0)return X;else return null}markPrecedenceDecisions(X){for(let Y of X.states){if(!(Y instanceof Z1))continue;if(X.ruleToStartState[Y.ruleIndex].isLeftRecursiveRule){let G=Y.transitions[Y.transitions.length-1].target;if(G instanceof d1){if(G.epsilonOnlyTransitions&&G.transitions[0].target instanceof h0)Y.precedenceRuleDecision=!0}}}}verifyATN(X){if(!this.deserializationOptions.verifyATN)return;for(let Y of X.states){if(Y===null)continue;if(this.checkCondition(Y.epsilonOnlyTransitions||Y.transitions.length<=1),Y instanceof U4)this.checkCondition(Y.loopBackState!==null);else if(Y instanceof Z1)if(this.checkCondition(Y.loopBackState!==null),this.checkCondition(Y.transitions.length===2),Y.transitions[0].target instanceof X4)this.checkCondition(Y.transitions[1].target instanceof d1),this.checkCondition(!Y.nonGreedy);else if(Y.transitions[0].target instanceof d1)this.checkCondition(Y.transitions[1].target instanceof X4),this.checkCondition(Y.nonGreedy);else throw Error("IllegalState");else if(Y instanceof e3)this.checkCondition(Y.transitions.length===1),this.checkCondition(Y.transitions[0].target instanceof Z1);else if(Y instanceof d1)this.checkCondition(Y.loopBackState!==null);else if(Y instanceof G4)this.checkCondition(Y.stopState!==null);else if(Y instanceof M1)this.checkCondition(Y.endState!==null);else if(Y instanceof r3)this.checkCondition(Y.startState!==null);else if(Y instanceof j1)this.checkCondition(Y.transitions.length<=1||Y.decision>=0);else this.checkCondition(Y.transitions.length<=1||Y instanceof h0)}}checkCondition(X,Y){if(!X){if(Y===void 0||Y===null)Y="IllegalState";throw Y}}edgeFactory(X,Y,G,$,Z,J,Q){let F=X.states[G];switch(Y){case h.EPSILON:return new w2(F);case h.RANGE:return J!==0?new Z4(F,R.EOF,Z):new Z4(F,$,Z);case h.RULE:return new $4(X.states[$],Z,J,F);case h.PREDICATE:return new y6(F,$,Z,J!==0);case h.PRECEDENCE:return new t7(F,$);case h.ATOM:return J!==0?new R2(F,R.EOF):new R2(F,$);case h.ACTION:return new T6(F,$,Z,J!==0);case h.SET:return new Q4(F,Q[$]);case h.NOT_SET:return new N4(F,Q[$]);case h.WILDCARD:return new i7(F);default:throw Error("The specified transition type: "+Y+" is not valid.")}}stateFactory(X,Y){let G=U.stateTypeMapper.get(X);if(!G)throw Error("The specified state type "+X+" is not valid.");let $=new G;return $.ruleIndex=Y,$}lexerActionFactory(X,Y,G){let $=U.lexerActionFactoryMapper.get(X);if(!$)throw Error("The specified lexer action type "+X+" is not valid.");return $(Y,G)}},J8=class U extends p0{static{A(this,"OrderedHashMap")}#U=[];clear(){super.clear(),this.#U=[]}get(X){return super.get(X)}set(X,Y){let G=super.set(X,Y);if(G===void 0)this.#U.push(X);return G}setIfAbsent(X,Y){let G=super.setIfAbsent(X,Y);if(G===void 0)this.#U.push(X);return G}values(){return{[Symbol.iterator]:()=>{let X=0;return{next:A(()=>{if(X<this.#U.length)return{done:!1,value:super.get(this.#U[X++])};return{done:!0,value:void 0}},"next")}}}}keys(){return this.#U[Symbol.iterator]()}equals(X){if(!(X instanceof U))return!1;return super.equals(X)}},rX=class U{static{A(this,"ATNSerializer")}atn;data=[];sets=new J8(k1.instance);nonGreedyStates=[];precedenceStates=[];constructor(X){this.atn=X}static getSerialized(X){return new U(X).serialize()}static serializeSets(X,Y){X.push(Y.length);for(let G of Y){let $=G.contains(R.EOF),Z=[...G];if($&&Z[0].stop===R.EOF)X.push(Z.length-1);else X.push(Z.length);X.push($?1:0);for(let J of Z){if(J.start===R.EOF)if(J.stop===R.EOF)continue;else X.push(0);else X.push(J.start);X.push(J.stop)}}}serialize(){this.addPreamble();let X=this.addEdges();this.addNonGreedyStates(),this.addPrecedenceStates(),this.addRuleStatesAndLexerTokenTypes(),this.addModeStartStates();let Y=this.addSets();return this.addEdges(X,Y),this.addDecisionStartStates(),this.addLexerActions(),this.data}addPreamble(){this.data.push(N1.SERIALIZED_VERSION),this.data.push(this.atn.grammarType),this.data.push(this.atn.maxTokenType)}addLexerActions(){if(this.atn.grammarType===b.LEXER){this.data.push(this.atn.lexerActions.length);for(let X of this.atn.lexerActions)switch(this.data.push(X.actionType),X.actionType){case x.CHANNEL:{let Y=X.channel;this.data.push(Y),this.data.push(0);break}case x.CUSTOM:{let{ruleIndex:Y,actionIndex:G}=X;this.data.push(Y),this.data.push(G);break}case x.MODE:{let Y=X.mode;this.data.push(Y),this.data.push(0);break}case x.MORE:{this.data.push(0),this.data.push(0);break}case x.POP_MODE:{this.data.push(0),this.data.push(0);break}case x.PUSH_MODE:{let Y=X.mode;this.data.push(Y),this.data.push(0);break}case x.SKIP:{this.data.push(0),this.data.push(0);break}case x.TYPE:{let Y=X.type;this.data.push(Y),this.data.push(0);break}default:throw Error(`The specified lexer action type ${X.actionType} is not valid.`)}}}addDecisionStartStates(){this.data.push(this.atn.decisionToState.length);for(let X of this.atn.decisionToState)this.data.push(X.stateNumber)}addEdges(...X){switch(X.length){case 0:{let Y=0;this.data.push(this.atn.states.length);for(let G of this.atn.states){if(G===null){this.data.push(f.INVALID_TYPE);continue}let $=G.constructor.stateType;if(G instanceof j1&&G.nonGreedy)this.nonGreedyStates.push(G.stateNumber);if(G instanceof G4&&G.isLeftRecursiveRule)this.precedenceStates.push(G.stateNumber);if(this.data.push($),this.data.push(G.ruleIndex),G.constructor.stateType===f.LOOP_END)this.data.push(G.loopBackState.stateNumber);else if(G instanceof M1)this.data.push(G.endState.stateNumber);if(G.constructor.stateType!==f.RULE_STOP)Y+=G.transitions.length;for(let Z of G.transitions){let J=Z.transitionType;if(J===h.SET||J===h.NOT_SET){let Q=Z;this.sets.set(Q.set,!0)}}}return Y}case 2:{let[Y,G]=X;this.data.push(Y);for(let $ of this.atn.states){if($===null)continue;if($.constructor.stateType===f.RULE_STOP)continue;for(let Z of $.transitions){if(this.atn.states[Z.target.stateNumber]===null)throw Error("Cannot serialize a transition to a removed state.");let J=$.stateNumber,Q=Z.target.stateNumber,F=Z.transitionType,_=0,I=0,H=0;switch(F){case h.RULE:{Q=Z.followState.stateNumber,_=Z.target.stateNumber,I=Z.ruleIndex,H=Z.precedence;break}case h.PRECEDENCE:{_=Z.precedence;break}case h.PREDICATE:{let j=Z;_=j.ruleIndex,I=j.predIndex,H=j.isCtxDependent?1:0;break}case h.RANGE:{if(_=Z.start,I=Z.stop,_===R.EOF)_=0,H=1;break}case h.ATOM:{if(_=Z.labelValue,_===R.EOF)_=0,H=1;break}case h.ACTION:{let j=Z;_=j.ruleIndex,I=j.actionIndex,H=j.isCtxDependent?1:0;break}case h.SET:{_=G.get(Z.set);break}case h.NOT_SET:{_=G.get(Z.set);break}case h.WILDCARD:break;default:}this.data.push(J),this.data.push(Q),this.data.push(F),this.data.push(_),this.data.push(I),this.data.push(H)}}break}default:throw Error("Invalid number of arguments")}}addSets(){U.serializeSets(this.data,[...this.sets.keys()]);let X=new p0,Y=0;for(let G of this.sets.keys())X.set(G,Y++);return X}addModeStartStates(){let X=this.atn.modeToStartState.length;if(this.data.push(X),X>0)for(let Y of this.atn.modeToStartState)this.data.push(Y.stateNumber)}addRuleStatesAndLexerTokenTypes(){let X=this.atn.ruleToStartState.length;this.data.push(X);for(let Y=0;Y<X;Y++){let G=this.atn.ruleToStartState[Y];if(this.data.push(G.stateNumber),this.atn.grammarType===b.LEXER)this.data.push(this.atn.ruleToTokenType[Y])}}addPrecedenceStates(){this.data.push(this.precedenceStates.length);for(let X of this.precedenceStates)this.data.push(X)}addNonGreedyStates(){this.data.push(this.nonGreedyStates.length);for(let X of this.nonGreedyStates)this.data.push(X)}},a1=class U{static{A(this,"DFAState")}stateNumber=-1;configs;edges=[];isAcceptState=!1;prediction=-1;lexerActionExecutor=null;requiresFullContext=!1;predicates=null;constructor(X){if(X)this.configs=X}static fromState(X){let Y=new U;return Y.stateNumber=X,Y}static fromConfigs(X){return new U(X)}static hashCode(X){return X.configs.hashCode()}static equals(X,Y){return X.configs.equals(Y.configs)}getAltSet(){let X=new Set;for(let Y of this.configs)X.add(Y.alt);if(X.size===0)return null;return X}toString(){let X="";if(X+=this.stateNumber,X+=":",X+=this.configs?this.configs.toString():"",this.isAcceptState)if(X+="=>",this.predicates)X+=y1(this.predicates);else X+=this.prediction;return X.toString()}},S0=class{static{A(this,"ATNSimulator")}static ERROR=a1.fromState(2147483647);atn;sharedContextCache;constructor(U,X){return this.atn=U,this.sharedContextCache=X,this}getCachedContext(U){if(!this.sharedContextCache)return U;let X=new p0(k1.instance);return d6(U,this.sharedContextCache,X)}},eX=class U{static{A(this,"CodePointTransitions")}static createWithCodePoint(X,Y){return U.createWithCodePointRange(X,Y,Y)}static createWithCodePointRange(X,Y,G){return Y===G?new R2(X,Y):new Z4(X,Y,G)}},Q8=class{static{A(this,"DecisionInfo")}decision=0;invocations=0;timeInPrediction=0;sllTotalLook=0;sllMinLook=0;sllMaxLook=0;sllMaxLookEvent;llTotalLook=0;llMinLook=0;llMaxLook=0;llMaxLookEvent;contextSensitivities;errors;ambiguities;predicateEvals;sllATNTransitions=0;sllDFATransitions=0;llFallback=0;llATNTransitions=0;llDFATransitions=0;constructor(U){this.decision=U,this.contextSensitivities=[],this.errors=[],this.ambiguities=[],this.predicateEvals=[]}toString(){return"{decision="+this.decision+", contextSensitivities="+this.contextSensitivities.length+", errors="+this.errors.length+", ambiguities="+this.ambiguities.length+", sllLookahead="+this.sllTotalLook+", sllATNTransitions="+this.sllATNTransitions+", sllDFATransitions="+this.sllDFATransitions+", llFallback="+this.llFallback+", llLookahead="+this.llTotalLook+", llATNTransitions="+this.llATNTransitions+"}"}},v0=class U extends s{static{A(this,"LexerATNConfig")}lexerActionExecutor;passedThroughNonGreedyDecision;constructor(X,Y,G,$){super(X,Y,G??X.context,G?S.NONE:X.semanticContext);return this.lexerActionExecutor=G?$:X.lexerActionExecutor??null,this.passedThroughNonGreedyDecision=U.checkNonGreedyDecision(X,this.state),this}static createWithExecutor(X,Y,G){return new U(X,Y,X.context,G)}static createWithConfig(X,Y,G){return new U(Y,X,G??null,Y.lexerActionExecutor)}static createWithContext(X,Y,G){return new U({alt:Y},X,G,null)}static checkNonGreedyDecision(X,Y){return X.passedThroughNonGreedyDecision||"nonGreedy"in Y&&Y.nonGreedy}hashCode(){if(this.cachedHashCode===void 0){let X=O.initialize(7);X=O.update(X,this.state.stateNumber),X=O.update(X,this.alt),X=O.updateFromComparable(X,this.context),X=O.updateFromComparable(X,this.semanticContext),X=O.update(X,this.passedThroughNonGreedyDecision?1:0),X=O.updateFromComparable(X,this.lexerActionExecutor),X=O.finish(X,6),this.cachedHashCode=X}return this.cachedHashCode}equals(X){if(this===X)return!0;return this.passedThroughNonGreedyDecision===X.passedThroughNonGreedyDecision&&(this.lexerActionExecutor&&X.lexerActionExecutor?this.lexerActionExecutor.equals(X.lexerActionExecutor):!X.lexerActionExecutor)&&super.equals(X)}},Y3=class{static{A(this,"BaseErrorListener")}syntaxError(U,X,Y,G,$,Z){}reportAmbiguity(U,X,Y,G,$,Z,J){}reportAttemptingFullContext(U,X,Y,G,$,Z){}reportContextSensitivity(U,X,Y,G,$,Z){}},N8=class U extends Y3{static{A(this,"ConsoleErrorListener")}static instance=new U;syntaxError(X,Y,G,$,Z,J){console.error("line "+G+":"+$+" "+Z)}},q8=class extends Y3{constructor(U){super();return this.delegates=U,this}static{A(this,"ProxyErrorListener")}syntaxError(U,X,Y,G,$,Z){this.delegates.forEach((J)=>{J.syntaxError(U,X,Y,G,$,Z)})}reportAmbiguity(U,X,Y,G,$,Z,J){this.delegates.forEach((Q)=>{Q.reportAmbiguity(U,X,Y,G,$,Z,J)})}reportAttemptingFullContext(U,X,Y,G,$,Z){this.delegates.forEach((J)=>{J.reportAttemptingFullContext(U,X,Y,G,$,Z)})}reportContextSensitivity(U,X,Y,G,$,Z){this.delegates.forEach((J)=>{J.reportContextSensitivity(U,X,Y,G,$,Z)})}},c6=class U{static{A(this,"Recognizer")}static EOF=-1;static tokenTypeMapCache=new Map;static ruleIndexMapCache=new Map;interpreter;listeners=[N8.instance];stateNumber=-1;checkVersion(X){if(X!=="4.13.1")console.error("ANTLR runtime and generated code versions disagree: 4.13.1!="+X)}addErrorListener(X){this.listeners.push(X)}removeErrorListeners(){this.listeners=[]}removeErrorListener(X){for(let Y=0;Y<this.listeners.length;Y++)if(this.listeners[Y]===X){this.listeners.splice(Y,1);return}}getErrorListeners(){return this.listeners}getTokenTypeMap(){let X=this.vocabulary,Y=U.tokenTypeMapCache.get(X);if(!Y){Y=new Map;for(let G=0;G<=this.atn.maxTokenType;G++){let $=X.getLiteralName(G);if($)Y.set($,G);let Z=X.getSymbolicName(G);if(Z)Y.set(Z,G)}Y.set("EOF",R.EOF),U.tokenTypeMapCache.set(X,Y)}return Y}getRuleIndexMap(){let X=this.ruleNames,Y=U.ruleIndexMapCache.get(X);if(!Y)Y=new Map,X.forEach((G,$)=>{return Y.set(G,$)}),U.ruleIndexMapCache.set(X,Y);return Y}getTokenType(X){let Y=this.getTokenTypeMap().get(X);if(Y)return Y;return R.INVALID_TYPE}getErrorHeader(X){let Y=X.offendingToken?.line,G=X.offendingToken?.column;return"line "+Y+":"+G}get errorListenerDispatch(){return new q8(this.listeners)}sempred(X,Y,G){return!0}precpred(X,Y){return!0}action(X,Y,G){}get atn(){return this.interpreter.atn}get state(){return this.stateNumber}set state(X){this.stateNumber=X}getParseInfo(){return}},a6=class U{static{A(this,"CommonTokenFactory")}static DEFAULT=new U;copyText=!1;constructor(X){this.copyText=X??!1}create(X,Y,G,$,Z,J,Q,F){let _=e2.fromSource(X,Y,$,Z,J);if(_.line=Q,_.column=F,G)_.text=G;else if(this.copyText&&X[1]!==null)_.text=X[1].getTextFromRange(Z,J);return _}},V=class U extends Error{static{A(this,"RecognitionException")}ctx;offendingToken=null;offendingState=-1;recognizer;input;constructor(X){super(X.message);if(Error.captureStackTrace)Error.captureStackTrace(this,U);if(this.message=X.message,this.recognizer=X.recognizer,this.input=X.input,this.ctx=X.ctx,this.recognizer!==null)this.offendingState=this.recognizer.state}getExpectedTokens(){if(this.recognizer!==null&&this.ctx!==null)return this.recognizer.atn.getExpectedTokens(this.offendingState,this.ctx);else return null}toString(){return this.message}},U3=class extends V{static{A(this,"LexerNoViableAltException")}startIndex;deadEndConfigs;constructor(U,X,Y,G){super({message:"",recognizer:U,input:X,ctx:null});this.startIndex=Y,this.deadEndConfigs=G}toString(){let U="";if(this.input&&this.startIndex>=0&&this.startIndex<this.input.size)U=this.input.getTextFromRange(this.startIndex,this.startIndex);return`LexerNoViableAltException(${U})`}},g0=class U extends c6{static{A(this,"Lexer")}static DEFAULT_MODE=0;static MORE=-2;static SKIP=-3;static DEFAULT_TOKEN_CHANNEL=R.DEFAULT_CHANNEL;static HIDDEN=R.HIDDEN_CHANNEL;options={minDFAEdge:0,maxDFAEdge:256,minCodePoint:0,maxCodePoint:1114111};tokenStartCharIndex=-1;channel=0;type=0;mode=U.DEFAULT_MODE;currentTokenColumn=0;currentTokenStartLine=0;input;token=null;hitEOF=!1;factory;#U=[];#X;constructor(X,Y){super();this.options={...this.options,...Y},this.input=X,this.factory=a6.DEFAULT}reset(X=!0){if(X)this.input.seek(0);this.token=null,this.type=R.INVALID_TYPE,this.channel=R.DEFAULT_CHANNEL,this.tokenStartCharIndex=-1,this.currentTokenColumn=-1,this.currentTokenStartLine=-1,this.#X=void 0,this.hitEOF=!1,this.mode=U.DEFAULT_MODE,this.#U=[],this.interpreter.reset()}nextToken(){if(this.input===null)throw Error("nextToken requires a non-null input stream.");let X=this.input.mark();try{while(!0){if(this.hitEOF)return this.emitEOF(),this.token;this.token=null,this.channel=R.DEFAULT_CHANNEL,this.tokenStartCharIndex=this.input.index,this.currentTokenColumn=this.interpreter.column,this.currentTokenStartLine=this.interpreter.line,this.#X=void 0;let Y=!1;while(!0){this.type=R.INVALID_TYPE;let G=U.SKIP;try{G=this.interpreter.match(this.input,this.mode)}catch($){if($ instanceof U3)this.notifyListeners($),this.recover($);else throw $}if(this.input.LA(1)===R.EOF)this.hitEOF=!0;if(this.type===R.INVALID_TYPE)this.type=G;if(this.type===U.SKIP){Y=!0;break}if(this.type!==U.MORE)break}if(Y)continue;if(this.token===null)this.emit();return this.token}}finally{this.input.release(X)}}skip(){this.type=U.SKIP}more(){this.type=U.MORE}pushMode(X){if(s1.debug)console.log("pushMode "+X);this.#U.push(this.mode),this.mode=X}popMode(){if(this.#U.length===0)throw Error("Empty Stack");if(s1.debug)console.log("popMode back to "+this.#U.slice(0,-1));return this.mode=this.#U.pop(),this.mode}get modeStack(){return this.#U}emitToken(X){this.token=X}emit(){let X=this.factory.create([this,this.input],this.type,this.#X,this.channel,this.tokenStartCharIndex,this.getCharIndex()-1,this.currentTokenStartLine,this.currentTokenColumn);return this.emitToken(X),X}emitEOF(){let X=this.factory.create([this,this.input],R.EOF,void 0,R.DEFAULT_CHANNEL,this.input.index,this.input.index-1,this.line,this.column);return this.emitToken(X),X}getCharIndex(){return this.input.index}getAllTokens(){let X=[],Y=this.nextToken();while(Y.type!==R.EOF)X.push(Y),Y=this.nextToken();return X}notifyListeners(X){let Y=this.tokenStartCharIndex,G=this.input.index,$=this.input.getTextFromRange(Y,G),Z="token recognition error at: '"+this.getErrorDisplay($)+"'";this.errorListenerDispatch.syntaxError(this,null,this.currentTokenStartLine,this.currentTokenColumn,Z,X)}getErrorDisplay(X){return X}getErrorDisplayForChar(X){if(X.charCodeAt(0)===R.EOF)return"<EOF>";if(X===`
19
+ `)return"\\n";if(X==="\t")return"\\t";if(X==="\r")return"\\r";return X}getCharErrorDisplay(X){return"'"+this.getErrorDisplayForChar(X)+"'"}recover(X){if(this.input.LA(1)!==R.EOF)if(X instanceof U3)this.interpreter.consume(this.input);else this.input.consume()}get inputStream(){return this.input}set inputStream(X){this.reset(!1),this.input=X}set tokenFactory(X){this.factory=X}get tokenFactory(){return this.factory}get sourceName(){return this.input.getSourceName()}get line(){return this.interpreter.line}set line(X){this.interpreter.line=X}get column(){return this.interpreter.column}set column(X){this.interpreter.column=X}get text(){if(this.#X)return this.#X;else return this.interpreter.getText(this.input)}set text(X){this.#X=X}},s6=class{static{A(this,"DFASerializer")}dfa;vocabulary;constructor(U,X){this.dfa=U,this.vocabulary=X}toString(){if(!this.dfa.s0)return"";let U="",X=this.dfa.getStates();for(let Y of X){let G=0;G=Y.edges.length;for(let $=0;$<G;$++){let Z=Y.edges[$];if(Z&&Z.stateNumber!==2147483647){U+=this.getStateString(Y);let J=this.getEdgeLabel($);U+="-",U+=J,U+="->",U+=this.getStateString(Z),U+=`
20
+ `}}}return U}getEdgeLabel(U){return`${this.vocabulary.getDisplayName(U-1)}`}getStateString(U){let X=U.stateNumber,Y=(U.isAcceptState?":":"")+"s"+X+(U.requiresFullContext?"^":"");if(U.isAcceptState){if(U.predicates!==null)return`${Y}=>${U.predicates.toString()}`;return`${Y}=>${U.prediction}`}else return`${Y}`}},F8=class extends s6{static{A(this,"LexerDFASerializer")}constructor(U){super(U,f0.EMPTY_VOCABULARY)}getEdgeLabel=A((U)=>{return"'"+String.fromCharCode(U)+"'"},"getEdgeLabel")},o0=class{static{A(this,"DFA")}s0;decision;atnStartState;isPrecedenceDfa;states=new Map;constructor(U,X){this.atnStartState=U,this.decision=X??0;let Y=!1;if(U instanceof Z1){if(U.precedenceRuleDecision)Y=!0,this.s0=a1.fromState(-1)}this.isPrecedenceDfa=Y}[Symbol.iterator]=()=>{return this.states.values()[Symbol.iterator]()};getPrecedenceStartState=A((U)=>{if(!this.isPrecedenceDfa)throw Error("Only precedence DFAs may contain a precedence start state.");if(!this.s0||!this.s0.edges||U<0||U>=this.s0.edges.length)return;return this.s0.edges[U]},"getPrecedenceStartState");setPrecedenceStartState=A((U,X)=>{if(!this.isPrecedenceDfa)throw Error("Only precedence DFAs may contain a precedence start state.");if(U<0||!this.s0)return;this.s0.edges[U]=X},"setPrecedenceStartState");getStates(){let U=[...this.states.values()];return U.sort((X,Y)=>{return X.stateNumber-Y.stateNumber}),U}getState(U){return this.states.get(U.configs.hashCode())??null}getStateForConfigs(U){return this.states.get(U.hashCode())??null}addState(U){let X=U.configs.hashCode();if(this.states.has(X))return;this.states.set(X,U),U.stateNumber=this.states.size-1}toString(U){if(!U)return this.toString(f0.EMPTY_VOCABULARY);if(!this.s0)return"";return new s6(this,U).toString()??""}toLexerString(){if(!this.s0)return"";return new F8(this).toString()??""}get length(){return this.states.size}},Y4=class U{static{A(this,"LexerIndexedCustomAction")}offset;action;actionType;isPositionDependent=!0;cachedHashCode;constructor(X,Y){this.actionType=Y.actionType,this.offset=X,this.action=Y}execute(X){this.action.execute(X)}hashCode(){if(this.cachedHashCode===void 0){let X=O.initialize();X=O.update(X,this.offset),X=O.updateFromComparable(X,this.action),this.cachedHashCode=O.finish(X,2)}return this.cachedHashCode}equals(X){if(this===X)return!0;if(!(X instanceof U))return!1;return this.offset===X.offset&&this.action===X.action}},W8=class U{static{A(this,"LexerActionExecutor")}lexerActions;actionType;isPositionDependent=!1;cachedHashCode;constructor(X){return this.actionType=-1,this.lexerActions=X??[],this}static append(X,Y){if(X===null)return new U([Y]);let G=X.lexerActions.concat([Y]);return new U(G)}fixOffsetBeforeMatch(X){let Y=null;for(let G=0;G<this.lexerActions.length;G++)if(this.lexerActions[G].isPositionDependent&&!(this.lexerActions[G]instanceof Y4)){if(Y===null)Y=this.lexerActions.concat([]);Y[G]=new Y4(X,this.lexerActions[G])}if(Y===null)return this;else return new U(Y)}execute(X,Y,G){if(Y===void 0||G===void 0)return;let $=!1,Z=Y.index;try{for(let J of this.lexerActions){let Q=J;if(J instanceof Y4){let F=J.offset;Y.seek(G+F),Q=J.action,$=G+F!==Z}else if(J.isPositionDependent)Y.seek(Z),$=!1;Q.execute(X)}}finally{if($)Y.seek(Z)}}hashCode(){if(this.cachedHashCode===void 0){let X=O.initialize(7);for(let Y of this.lexerActions)X=O.update(X,Y.hashCode());this.cachedHashCode=O.finish(X,this.lexerActions.length)}return this.cachedHashCode}equals(X){if(this===X)return!0;if(this.cachedHashCode!==X.cachedHashCode)return!1;if(this.lexerActions.length!==X.lexerActions.length)return!1;return this.lexerActions.every((Y,G)=>{return Y.equals(X.lexerActions[G])})}},_8=class U extends R0{static{A(this,"OrderedHashSet")}elements=[];getOrAdd(X){let Y=this.size,G=super.getOrAdd(X);if(this.size>Y)this.elements.push(X);return G}equals(X){if(!(X instanceof U))return!1;return super.equals(X)}clear(){super.clear(),this.elements=[]}*[Symbol.iterator](){yield*this.elements}toArray(){return this.elements.slice(0)}},V6=class extends n0{static{A(this,"OrderedATNConfigSet")}constructor(){super();this.configLookup=new _8}},s1=class U extends S0{static{A(this,"LexerATNSimulator")}static debug=!1;decisionToDFA;recognizer=null;startIndex=-1;line=1;column=0;mode=g0.DEFAULT_MODE;prevAccept;options;lexerATNConfigFactory;constructor(X,Y,G,$){super(Y,$);if(this.decisionToDFA=G,this.recognizer=X,X)this.options=X.options;else this.options={minDFAEdge:0,maxDFAEdge:256,minCodePoint:0,maxCodePoint:1114111}}match(X,Y){this.mode=Y;let G=X.mark();try{this.startIndex=X.index,this.prevAccept=void 0;let $=this.decisionToDFA[Y];if(!$.s0)return this.matchATN(X);return this.execATN(X,$.s0)}finally{X.release(G)}}reset(){this.prevAccept=void 0,this.startIndex=-1,this.line=1,this.column=0,this.mode=g0.DEFAULT_MODE}clearDFA(){for(let X=0;X<this.decisionToDFA.length;X++)this.decisionToDFA[X]=new o0(this.atn.getDecisionState(X),X)}getDFA(X){return this.decisionToDFA[X]}getText(X){return X.getTextFromRange(this.startIndex,X.index-1)}consume(X){if(X.LA(1)===10)this.line+=1,this.column=0;else this.column+=1;X.consume()}getTokenName(X){if(X===R.EOF)return"EOF";else return"'"+String.fromCharCode(X)+"'"}matchATN(X){let Y=this.atn.modeToStartState[this.mode];if(U.debug)console.log("matchATN mode "+this.mode+" start: "+Y);let G=this.mode,$=this.computeStartState(X,Y),Z=$.hasSemanticContext;$.hasSemanticContext=!1;let J=this.addDFAState($);if(!Z)this.decisionToDFA[this.mode].s0=J;let Q=this.execATN(X,J);if(U.debug)console.log("DFA after matchATN: "+this.decisionToDFA[G].toLexerString());return Q}execATN(X,Y){if(U.debug)console.log("start state closure="+Y.configs);if(Y.isAcceptState)this.captureSimState(X,Y);let G=X.LA(1);while(!0){if(U.debug)console.log("execATN loop starting closure: "+Y.configs);let $=this.getExistingTargetState(Y,G);if(!$)$=this.computeTargetState(X,Y,G);if($===S0.ERROR)break;if(G!==R.EOF)this.consume(X);if($.isAcceptState){if(this.captureSimState(X,$),G===R.EOF)break}G=X.LA(1),Y=$}return this.failOrAccept(X,Y.configs,G)}getExistingTargetState(X,Y){if(Y>=this.options.minDFAEdge&&Y<=this.options.maxDFAEdge){let G=X.edges[Y-this.options.minDFAEdge];if(U.debug&&G)console.log("reuse state "+X.stateNumber+" edge to "+G.stateNumber);return G}return}computeTargetState(X,Y,G){let $=new V6;if(this.getReachableConfigSet(X,Y.configs,$,G),$.length===0){if(!$.hasSemanticContext)this.addDFAEdge(Y,G,S0.ERROR);return S0.ERROR}return this.addDFAEdge(Y,G,null,$)}failOrAccept(X,Y,G){if(this.prevAccept?.dfaState){let{dfaState:$,index:Z,line:J,column:Q}=this.prevAccept;return this.accept(X,$.lexerActionExecutor,this.startIndex,Z,J,Q),$.prediction}if(G===R.EOF&&X.index===this.startIndex)return R.EOF;throw new U3(this.recognizer,X,this.startIndex,Y)}getReachableConfigSet(X,Y,G,$){let Z=b.INVALID_ALT_NUMBER;for(let J of Y){let Q=J.alt===Z;if(Q&&J.passedThroughNonGreedyDecision)continue;if(U.debug)console.log(`testing %s at %s
21
+ `,this.getTokenName($),J.toString(this.recognizer,!0));for(let F of J.state.transitions){let _=this.getReachableTarget(F,$);if(_){let I=J.lexerActionExecutor;if(I)I=I.fixOffsetBeforeMatch(X.index-this.startIndex);let H=$===R.EOF,j=v0.createWithExecutor(J,_,I);if(this.closure(X,j,G,Q,!0,H))Z=J.alt}}}}accept(X,Y,G,$,Z,J){if(U.debug)console.log(`ACTION %s
22
+ `,Y);if(X.seek($),this.line=Z,this.column=J,Y&&this.recognizer)Y.execute(this.recognizer,X,G)}getReachableTarget(X,Y){if(X.matches(Y,this.options.minCodePoint,this.options.maxCodePoint))return X.target;else return}computeStartState(X,Y){let G=n.instance,$=new V6;for(let Z=0;Z<Y.transitions.length;Z++){let J=Y.transitions[Z].target,Q=v0.createWithContext(J,Z+1,G);this.closure(X,Q,$,!1,!1,!1)}return $}closure(X,Y,G,$,Z,J){let Q=null;if(U.debug)console.log("closure("+Y.toString(this.recognizer,!0)+")");if(Y.state.constructor.stateType===f.RULE_STOP){if(U.debug)if(this.recognizer!==null)console.log(`closure at %s rule stop %s
23
+ `,this.recognizer.ruleNames[Y.state.ruleIndex],Y);else console.log(`closure at rule stop %s
24
+ `,Y);if(!Y.context||Y.context.hasEmptyPath())if(!Y.context||Y.context.isEmpty())return G.add(Y),!0;else G.add(v0.createWithConfig(Y.state,Y,n.instance)),$=!0;if(Y.context&&!Y.context.isEmpty()){for(let F=0;F<Y.context.length;F++)if(Y.context.getReturnState(F)!==t.EMPTY_RETURN_STATE){let _=Y.context.getParent(F),I=this.atn.states[Y.context.getReturnState(F)];Q=v0.createWithConfig(I,Y,_),$=this.closure(X,Q,G,$,Z,J)}}return $}if(!Y.state.epsilonOnlyTransitions){if(!$||!Y.passedThroughNonGreedyDecision)G.add(Y)}for(let F of Y.state.transitions)if(Q=this.getEpsilonTarget(X,Y,F,G,Z,J),Q)$=this.closure(X,Q,G,$,Z,J);return $}getEpsilonTarget(X,Y,G,$,Z,J){if(!this.lexerATNConfigFactory)this.setupATNFactoryLookup();let Q=this.lexerATNConfigFactory[G.transitionType];if(!Q)return null;return Q(X,Y,G,$,Z,J)}setupATNFactoryLookup(){this.lexerATNConfigFactory=[],this.lexerATNConfigFactory[h.RULE]=(Y,G,$)=>{let Z=O1(G.context??void 0,$.followState.stateNumber);return v0.createWithConfig($.target,G,Z)},this.lexerATNConfigFactory[h.PRECEDENCE]=()=>{throw Error("Precedence predicates are not supported in lexers.")},this.lexerATNConfigFactory[h.PREDICATE]=(Y,G,$,Z,J)=>{let Q=$;if(U.debug)console.log("EVAL rule "+Q.ruleIndex+":"+Q.predIndex);if(Z.hasSemanticContext=!0,this.evaluatePredicate(Y,Q.ruleIndex,Q.predIndex,J))return v0.createWithConfig($.target,G);return null},this.lexerATNConfigFactory[h.ACTION]=(Y,G,$)=>{if(G.context===null||G.context.hasEmptyPath()){let Z=W8.append(G.lexerActionExecutor,this.atn.lexerActions[$.actionIndex]);return v0.createWithExecutor(G,$.target,Z)}else return v0.createWithConfig($.target,G)},this.lexerATNConfigFactory[h.EPSILON]=(Y,G,$)=>{return v0.createWithConfig($.target,G)};let X=A((Y,G,$,Z,J,Q)=>{if(Q){if($.matches(R.EOF,this.options.minCodePoint,this.options.maxCodePoint))return v0.createWithConfig($.target,G)}return null},"simple");this.lexerATNConfigFactory[h.ATOM]=X,this.lexerATNConfigFactory[h.RANGE]=X,this.lexerATNConfigFactory[h.SET]=X}evaluatePredicate(X,Y,G,$){if(!this.recognizer)return!0;if(!$)return this.recognizer.sempred(null,Y,G);let Z=this.column,J=this.line,Q=X.index,F=X.mark();try{return this.consume(X),this.recognizer.sempred(null,Y,G)}finally{this.column=Z,this.line=J,X.seek(Q),X.release(F)}}captureSimState(X,Y){this.prevAccept={index:X.index,line:this.line,column:this.column,dfaState:Y}}addDFAEdge(X,Y,G,$){if(!G&&$){let Z=$.hasSemanticContext;if($.hasSemanticContext=!1,G=this.addDFAState($),Z)return G}if(Y<this.options.minDFAEdge||Y>this.options.maxDFAEdge)return G;if(U.debug)console.log("EDGE "+X+" -> "+G+" upon "+Y);return X.edges[Y-this.options.minDFAEdge]=G,G}addDFAState(X){let Y=this.decisionToDFA[this.mode],G=Y.getStateForConfigs(X);if(G)return G;let $=a1.fromConfigs(X),Z=X.firstStopState;if(Z)$.isAcceptState=!0,$.lexerActionExecutor=Z.lexerActionExecutor,$.prediction=this.atn.ruleToTokenType[Z.state.ruleIndex];return X.setReadonly(!0),Y.addState($),$}},z8=class{static{A(this,"ParseInfo")}atnSimulator;constructor(U){this.atnSimulator=U}getDecisionInfo(){return this.atnSimulator.getDecisionInfo()}getLLDecisions(){let U=this.atnSimulator.getDecisionInfo(),X=[];for(let Y=0;Y<U.length;Y++)if(U[Y].llFallback>0)X.push(Y);return X}getTotalTimeInPrediction(){let U=this.atnSimulator.getDecisionInfo(),X=0;for(let Y of U)X+=Y.timeInPrediction;return X}getTotalSLLLookaheadOps(){let U=this.atnSimulator.getDecisionInfo(),X=0;for(let Y of U)X+=Y.sllTotalLook;return X}getTotalLLLookaheadOps(){let U=this.atnSimulator.getDecisionInfo(),X=0;for(let Y of U)X+=Y.llTotalLook;return X}getTotalSLLATNLookaheadOps(){let U=this.atnSimulator.getDecisionInfo(),X=0;for(let Y of U)X+=Y.sllATNTransitions;return X}getTotalLLATNLookaheadOps(){let U=this.atnSimulator.getDecisionInfo(),X=0;for(let Y of U)X+=Y.llATNTransitions;return X}getTotalATNLookaheadOps(){let U=this.atnSimulator.getDecisionInfo(),X=0;for(let Y of U)X+=Y.sllATNTransitions,X+=Y.llATNTransitions;return X}getDFASize(U){if(U===void 0){let X=0,Y=this.atnSimulator.decisionToDFA;for(let G=0;G<Y.length;G++)X+=this.getDFASize(G);return X}else return this.atnSimulator.decisionToDFA[U].length}},h1=class extends V{static{A(this,"NoViableAltException")}deadEndConfigs=null;startToken;constructor(U,X=null,Y=null,G=null,$=null,Z=null){Z=Z??U.context,G=G??U.getCurrentToken(),Y=Y??U.getCurrentToken(),X=X??U.inputStream;super({message:"",recognizer:U,input:X,ctx:Z});this.deadEndConfigs=$,this.startToken=Y,this.offendingToken=G}},P6=class{static{A(this,"DoubleDict")}cacheMap;constructor(){this.cacheMap=new p0}get(U,X){let Y=this.cacheMap.get(U)??null;return Y===null?null:Y.get(X)??null}set(U,X,Y){let G=this.cacheMap.get(U);if(!G)G=new p0,this.cacheMap.set(U,G);G.set(X,Y)}},I8=class U{static{A(this,"SubsetEqualityComparer")}static instance=new U;hashCode(X){let Y=O.initialize(7);return Y=O.update(Y,X.state.stateNumber),Y=O.updateFromComparable(Y,X.context),Y=O.finish(Y,2),Y}equals(X,Y){return X.state.stateNumber===Y.state.stateNumber&&(X.context?.equals(Y.context)??!0)}},X0=class U{static{A(this,"PredictionMode")}static SLL=0;static LL=1;static LL_EXACT_AMBIG_DETECTION=2;static hasSLLConflictTerminatingPrediction(X,Y){if(U.allConfigsInRuleStopStates(Y))return!0;if(X===U.SLL){if(Y.hasSemanticContext){let $=new n0;for(let Z of Y)Z=s.duplicate(Z,S.NONE),$.add(Z);Y=$}}let G=U.getConflictingAltSubsets(Y);return U.hasConflictingAltSet(G)&&!U.hasStateAssociatedWithOneAlt(Y)}static hasConfigInRuleStopState(X){for(let Y of X)if(Y.state instanceof h0)return!0;return!1}static allConfigsInRuleStopStates(X){for(let Y of X)if(!(Y.state instanceof h0))return!1;return!0}static resolvesToJustOneViableAlt(X){return U.getSingleViableAlt(X)}static allSubsetsConflict(X){return!U.hasNonConflictingAltSet(X)}static hasNonConflictingAltSet(X){for(let Y of X)if(Y.length===1)return!0;return!1}static hasConflictingAltSet(X){for(let Y of X)if(Y.length>1)return!0;return!1}static allSubsetsEqual(X){let Y=null;for(let G of X)if(Y===null)Y=G;else if(G!==Y)return!1;return!0}static getUniqueAlt(X){let Y=U.getAlts(X);if(Y.length===1)return Y.nextSetBit(0);else return b.INVALID_ALT_NUMBER}static getAlts(X){let Y=new x0;return X.forEach((G)=>{Y.or(G)}),Y}static getConflictingAltSubsets(X){let Y=new p0(I8.instance);for(let G of X){let $=Y.get(G);if(!$)$=new x0,Y.set(G,$);$.set(G.alt)}return Array.from(Y.values())}static getStateToAltMap(X){let Y=new p0(k1.instance);for(let G of X){let $=Y.get(G.state);if(!$)$=new x0,Y.set(G.state,$);$.set(G.alt)}return Y}static hasStateAssociatedWithOneAlt(X){let Y={};for(let G of X){let $=G.state.stateNumber;if(!Y[$])Y[$]=0;Y[$]++}return Object.values(Y).some((G)=>{return G===1})}static getSingleViableAlt(X){let Y=null;for(let G of X){let $=G.nextSetBit(0);if(Y===null)Y=$;else if(Y!==$)return b.INVALID_ALT_NUMBER}return Y??0}},k2=class U extends S0{static{A(this,"ParserATNSimulator")}static traceATNSimulator=!1;static debug;static debugAdd=!1;static debugClosure=!1;static dfaDebug=!1;static retryDebug=!1;predictionMode;decisionToDFA;parser;mergeCache=new P6;predictionState;constructor(X,Y,G,$){super(Y,$);this.parser=X,this.decisionToDFA=G}static getUniqueAlt(X){let Y=b.INVALID_ALT_NUMBER;for(let G of X)if(Y===b.INVALID_ALT_NUMBER)Y=G.alt;else if(G.alt!==Y)return b.INVALID_ALT_NUMBER;return Y}reset(){}clearDFA(){for(let X=0;X<this.decisionToDFA.length;X++)this.decisionToDFA[X]=new o0(this.atn.getDecisionState(X),X)}adaptivePredict(X,Y,G){if(U.debug||U.traceATNSimulator)console.log("adaptivePredict decision "+Y+" exec LA(1)=="+this.getLookaheadName(X)+" line "+X.LT(1).line+":"+X.LT(1).column);let $=this.decisionToDFA[Y];this.predictionState={input:X,startIndex:X.index,outerContext:G??void 0,dfa:$};let Z=X.mark(),J=X.index;try{let Q;if($.isPrecedenceDfa)Q=$.getPrecedenceStartState(this.parser.getPrecedence());else Q=$.s0;if(!Q){if(!G)G=C.empty;if(U.debug)console.log("predictATN decision "+$.decision+" exec LA(1)=="+this.getLookaheadName(X)+", outerContext="+G.toString(this.parser.ruleNames));let _=!1,I=this.computeStartState($.atnStartState,C.empty,_);if($.isPrecedenceDfa)I=this.applyPrecedenceFilter(I),Q=this.addDFAState($,a1.fromConfigs(I)),$.setPrecedenceStartState(this.parser.getPrecedence(),Q);else Q=this.addDFAState($,a1.fromConfigs(I)),$.s0=Q}let F=this.execATN($,Q,X,J,G);if(U.debug)console.log("DFA after predictATN: "+$.toString(this.parser.vocabulary));return F}finally{this.predictionState.dfa=void 0,this.mergeCache=new P6,X.seek(J),X.release(Z)}}execATN(X,Y,G,$,Z){if(U.debug||U.traceATNSimulator)console.log("execATN decision "+X.decision+", DFA state "+Y+", LA(1)=="+this.getLookaheadName(G)+" line "+G.LT(1).line+":"+G.LT(1).column);let J,Q=Y,F=G.LA(1);while(!0){let _=this.getExistingTargetState(Q,F);if(!_)_=this.computeTargetState(X,Q,F);if(_===S0.ERROR){let I=this.noViableAlt(G,Z,Q.configs,$);if(G.seek($),J=this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(Q.configs,Z),J!==b.INVALID_ALT_NUMBER)return J;else throw I}if(_.requiresFullContext&&this.predictionMode!==X0.SLL){let I=null;if(_.predicates!==null){if(U.debug)console.log("DFA state has preds in DFA sim LL failover");let P=G.index;if(P!==$)G.seek($);if(I=this.evalSemanticContext(_.predicates,Z,!0),I.length===1){if(U.debug)console.log("Full LL avoided");return I.nextSetBit(0)}if(P!==$)G.seek(P)}if(U.dfaDebug)console.log("ctx sensitive state "+Z+" in "+_);let H=!0,j=this.computeStartState(X.atnStartState,Z,H);return this.reportAttemptingFullContext(X,I,_.configs,$,G.index),J=this.execATNWithFullContext(X,_,j,G,$,Z),J}if(_.isAcceptState){if(_.predicates===null)return _.prediction;let I=G.index;G.seek($);let H=this.evalSemanticContext(_.predicates,Z,!0);if(H.length===0)throw this.noViableAlt(G,Z,_.configs,$);if(H.length===1)return H.nextSetBit(0);return this.reportAmbiguity(X,_,$,I,!1,H,_.configs),H.nextSetBit(0)}if(Q=_,F!==R.EOF)G.consume(),F=G.LA(1)}}getExistingTargetState(X,Y){return X.edges[Y+1]}computeTargetState(X,Y,G){let $=this.computeReachSet(Y.configs,G,!1);if($===null)return this.addDFAEdge(X,Y,G,S0.ERROR),S0.ERROR;let Z=a1.fromConfigs($),J=U.getUniqueAlt($);if(U.debug){let Q=X0.getConflictingAltSubsets($);console.log("SLL altSubSets="+y1(Q)+", configs="+$+", predict="+J+", allSubsetsConflict="+X0.allSubsetsConflict(Q)+", conflictingAlts="+this.getConflictingAlts($))}if(J!==b.INVALID_ALT_NUMBER)Z.isAcceptState=!0,Z.configs.uniqueAlt=J,Z.prediction=J;else if(X0.hasSLLConflictTerminatingPrediction(this.predictionMode,$))Z.configs.conflictingAlts=this.getConflictingAlts($),Z.requiresFullContext=!0,Z.isAcceptState=!0,Z.prediction=Z.configs.conflictingAlts.nextSetBit(0);if(Z.isAcceptState&&Z.configs.hasSemanticContext){if(this.predicateDFAState(Z,this.atn.getDecisionState(X.decision)),Z.predicates!==null)Z.prediction=b.INVALID_ALT_NUMBER}return Z=this.addDFAEdge(X,Y,G,Z),Z}getRuleName(X){if(this.parser!==null&&X>=0)return this.parser.ruleNames[X];else return"<rule "+X+">"}getTokenName(X){if(X===R.EOF)return"EOF";let G=(this.parser?.vocabulary??f0.EMPTY_VOCABULARY).getDisplayName(X);if(G===X.toString())return G;return G+"<"+X+">"}getLookaheadName(X){return this.getTokenName(X.LA(1))}dumpDeadEndConfigs(X){console.log("dead end configs: ");let Y=X.deadEndConfigs;for(let G of Y){let $="no edges";if(G.state.transitions.length>0){let Z=G.state.transitions[0];if(Z instanceof R2)$="Atom "+this.getTokenName(Z.labelValue);else if(Z instanceof Q4)$=(Z instanceof N4?"~":"")+"Set "+Z.label}console.error(G.toString(this.parser,!0)+":"+$)}}predicateDFAState(X,Y){let G=Y.transitions.length,$=this.getConflictingAltsOrUniqueAlt(X.configs),Z=this.getPredsForAmbigAlts($,X.configs,G);if(Z!==null)X.predicates=this.getPredicatePredictions($,Z),X.prediction=b.INVALID_ALT_NUMBER;else X.prediction=$.nextSetBit(0)}execATNWithFullContext(X,Y,G,$,Z,J){if(U.debug||U.traceATNSimulator)console.log("execATNWithFullContext "+G);let Q=!0,F=!1,_,I=G;$.seek(Z);let H=$.LA(1),j=-1;for(;;){if(_=this.computeReachSet(I,H,Q),_===null){let g=this.noViableAlt($,J,I,Z);$.seek(Z);let G0=this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(I,J);if(G0!==b.INVALID_ALT_NUMBER)return G0;else throw g}let P=X0.getConflictingAltSubsets(_);if(U.debug)console.log("LL altSubSets="+P+", predict="+X0.getUniqueAlt(P)+", resolvesToJustOneViableAlt="+X0.resolvesToJustOneViableAlt(P));if(_.uniqueAlt=U.getUniqueAlt(_),_.uniqueAlt!==b.INVALID_ALT_NUMBER){j=_.uniqueAlt;break}else if(this.predictionMode!==X0.LL_EXACT_AMBIG_DETECTION){if(j=X0.resolvesToJustOneViableAlt(P),j!==b.INVALID_ALT_NUMBER)break}else if(X0.allSubsetsConflict(P)&&X0.allSubsetsEqual(P)){F=!0,j=X0.getSingleViableAlt(P);break}if(I=_,H!==R.EOF)$.consume(),H=$.LA(1)}if(_.uniqueAlt!==b.INVALID_ALT_NUMBER)return this.reportContextSensitivity(X,j,_,Z,$.index),j;return this.reportAmbiguity(X,Y,Z,$.index,F,_.getAlts(),_),j}computeReachSet(X,Y,G){if(U.debug)console.log("in computeReachSet, starting closure: "+X);let $=new n0(G),Z=null;for(let Q of X){if(U.debug)console.log("testing "+this.getTokenName(Y)+" at "+Q);if(Q.state instanceof h0){if(G||Y===R.EOF){if(Z===null)Z=[];Z.push(Q)}continue}for(let F of Q.state.transitions){let _=this.getReachableTarget(F,Y);if(_!==null){let I=s.createWithConfig(_,Q);if($.add(I,this.mergeCache),U.debugAdd)console.log("added "+I+" to intermediate")}}}let J=null;if(Z===null&&Y!==R.EOF){if($.length===1)J=$;else if(U.getUniqueAlt($)!==b.INVALID_ALT_NUMBER)J=$}if(J===null){J=new n0(G);let Q=new R0,F=Y===R.EOF;for(let _ of $)this.closure(_,J,Q,!1,G,F)}if(Y===R.EOF)J=this.removeAllConfigsNotInRuleStopState(J,J===$);if(Z!==null&&(!G||!X0.hasConfigInRuleStopState(J)))for(let Q of Z)J.add(Q,this.mergeCache);if(U.traceATNSimulator)console.log("computeReachSet "+X+" -> "+J);if(J.length===0)return null;else return J}removeAllConfigsNotInRuleStopState(X,Y){if(X0.allConfigsInRuleStopStates(X))return X;let G=new n0(X.fullCtx);for(let $ of X){if($.state instanceof h0){G.add($,this.mergeCache);continue}if(Y&&$.state.epsilonOnlyTransitions){if(this.atn.nextTokens($.state).contains(R.EPSILON)){let J=this.atn.ruleToStopState[$.state.ruleIndex];G.add(s.createWithConfig(J,$),this.mergeCache)}}}return G}computeStartState(X,Y,G){let $=q4(this.atn,Y),Z=new n0(G);if(U.traceATNSimulator)console.log("computeStartState from ATN state "+X+" initialContext="+$.toString(this.parser));for(let J=0;J<X.transitions.length;J++){let Q=X.transitions[J].target,F=s.createWithContext(Q,J+1,$),_=new R0;this.closure(F,Z,_,!0,G,!1)}return Z}applyPrecedenceFilter(X){let Y=[],G=new n0(X.fullCtx);for(let $ of X){if($.alt!==1)continue;let Z=$.semanticContext.evalPrecedence(this.parser,this.predictionState.outerContext);if(Z===null)continue;if(Y[$.state.stateNumber]=$.context,Z!==$.semanticContext)G.add(s.duplicate($,Z),this.mergeCache);else G.add($,this.mergeCache)}for(let $ of X){if($.alt===1)continue;if(!$.precedenceFilterSuppressed){let Z=Y[$.state.stateNumber]||null;if(Z!==null&&Z.equals($.context))continue}G.add($,this.mergeCache)}return G}getReachableTarget(X,Y){if(X.matches(Y,0,this.atn.maxTokenType))return X.target;else return null}getPredsForAmbigAlts(X,Y,G){let $=[];for(let J of Y)if(X.get(J.alt))$[J.alt]=S.orContext($[J.alt]??null,J.semanticContext);let Z=0;for(let J=1;J<G+1;J++){let Q=$[J]??null;if(Q===null)$[J]=S.NONE;else if(Q!==S.NONE)Z+=1}if(Z===0)$=null;if(U.debug)console.log("getPredsForAmbigAlts result "+y1($));return $}getPredicatePredictions(X,Y){let G=[],$=!1;for(let Z=1;Z<Y.length;Z++){let J=Y[Z];if(X.get(Z))G.push({pred:J,alt:Z});if(J!==S.NONE)$=!0}if(!$)return null;return G}getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(X,Y){let G=this.splitAccordingToSemanticValidity(X,Y),$=G[0],Z=G[1],J=this.getAltThatFinishedDecisionEntryRule($);if(J!==b.INVALID_ALT_NUMBER)return J;if(Z.length>0){if(J=this.getAltThatFinishedDecisionEntryRule(Z),J!==b.INVALID_ALT_NUMBER)return J}return b.INVALID_ALT_NUMBER}getAltThatFinishedDecisionEntryRule(X){let Y=[];for(let G of X)if(G.reachesIntoOuterContext||G.state instanceof h0&&G.context.hasEmptyPath()){if(Y.indexOf(G.alt)<0)Y.push(G.alt)}if(Y.length===0)return b.INVALID_ALT_NUMBER;else return Math.min(...Y)}splitAccordingToSemanticValidity(X,Y){let G=new n0(X.fullCtx),$=new n0(X.fullCtx);for(let Z of X)if(Z.semanticContext!==S.NONE)if(Z.semanticContext.evaluate(this.parser,Y))G.add(Z);else $.add(Z);else G.add(Z);return[G,$]}evalSemanticContext(X,Y,G){let $=new x0;for(let Z of X){if(Z.pred===S.NONE){if($.set(Z.alt),!G)break;continue}let J=Z.pred.evaluate(this.parser,Y);if(U.debug||U.dfaDebug)console.log("eval pred "+Z+"="+J);if(J){if($.set(Z.alt),!G)break}}return $}closure(X,Y,G,$,Z,J){this.closureCheckingStopState(X,Y,G,$,Z,0,J)}closureCheckingStopState(X,Y,G,$,Z,J,Q){if(U.traceATNSimulator||U.debugClosure)console.log("closure("+X.toString(this.parser,!0)+")");if(X.state instanceof h0){if(X.context&&!X.context.isEmpty()){for(let F=0;F<X.context.length;F++){if(X.context.getReturnState(F)===t.EMPTY_RETURN_STATE){if(Z){Y.add(s.createWithConfig(X.state,X,n.instance),this.mergeCache);continue}else{if(U.debug)console.log("FALLING off rule "+this.getRuleName(X.state.ruleIndex));this.closure_(X,Y,G,$,Z,J,Q)}continue}let _=this.atn.states[X.context.getReturnState(F)],I=X.context.getParent(F),H=s.createWithContext(_,X.alt,I,X.semanticContext);H.reachesIntoOuterContext=X.reachesIntoOuterContext,this.closureCheckingStopState(H,Y,G,$,Z,J-1,Q)}return}else if(Z){Y.add(X,this.mergeCache);return}else if(U.debug)console.log("FALLING off rule "+this.getRuleName(X.state.ruleIndex))}this.closure_(X,Y,G,$,Z,J,Q)}closure_(X,Y,G,$,Z,J,Q){let F=X.state;if(!F.epsilonOnlyTransitions)Y.add(X,this.mergeCache);for(let _=0;_<F.transitions.length;_++){if(_===0&&this.canDropLoopEntryEdgeInLeftRecursiveRule(X))continue;let I=F.transitions[_],H=$&&!(I instanceof T6),j=this.getEpsilonTarget(X,I,H,J===0,Z,Q);if(j){let P=J;if(X.state.constructor.stateType===f.RULE_STOP){if(this.predictionState.dfa&&this.predictionState?.dfa.isPrecedenceDfa){if(I.outermostPrecedenceReturn===this.predictionState?.dfa.atnStartState?.ruleIndex)j.precedenceFilterSuppressed=!0}if(j.reachesIntoOuterContext=!0,G.getOrAdd(j)!==j)continue;if(Y.dipsIntoOuterContext=!0,P-=1,U.debug)console.log("dips into outer ctx: "+j)}else{if(!I.isEpsilon&&G.getOrAdd(j)!==j)continue;if(I instanceof $4){if(P>=0)P+=1}}this.closureCheckingStopState(j,Y,G,H,Z,P,Q)}}}canDropLoopEntryEdgeInLeftRecursiveRule(X){let Y=X.state;if(Y.constructor.stateType!==f.STAR_LOOP_ENTRY||!X.context)return!1;if(!Y.precedenceRuleDecision||X.context.isEmpty()||X.context.hasEmptyPath())return!1;let G=X.context.length;for(let Q=0;Q<G;Q++)if(this.atn.states[X.context.getReturnState(Q)].ruleIndex!==Y.ruleIndex)return!1;let Z=Y.transitions[0].target.endState.stateNumber,J=this.atn.states[Z];for(let Q=0;Q<G;Q++){let F=X.context.getReturnState(Q),_=this.atn.states[F];if(_.transitions.length!==1||!_.transitions[0].isEpsilon)return!1;let I=_.transitions[0].target;if(_.constructor.stateType===f.BLOCK_END&&I===Y)continue;if(_===J)continue;if(I===J)continue;if(I.constructor.stateType===f.BLOCK_END&&I.transitions.length===1&&I.transitions[0].isEpsilon&&I.transitions[0].target===Y)continue;return!1}return!0}getEpsilonTarget(X,Y,G,$,Z,J){switch(Y.transitionType){case h.RULE:return this.ruleTransition(X,Y);case h.PRECEDENCE:return this.precedenceTransition(X,Y,G,$,Z);case h.PREDICATE:return this.predTransition(X,Y,G,$,Z);case h.ACTION:{if(U.debug){let Q=Y,F=Q.actionIndex===-1?65535:Q.actionIndex;console.log("ACTION edge "+Q.ruleIndex+":"+F)}return s.createWithConfig(Y.target,X)}case h.EPSILON:return s.createWithConfig(Y.target,X);case h.ATOM:case h.RANGE:case h.SET:{if(J){if(Y.matches(R.EOF,0,1))return s.createWithConfig(Y.target,X)}return null}default:return null}}precedenceTransition(X,Y,G,$,Z){if(U.debug){if(console.log("PRED (collectPredicates="+G+") "+Y.precedence+">=_p, ctx dependent=true"),this.parser!==null)console.log("context surrounding pred is "+y1(this.parser.getRuleInvocationStack()))}let J=null;if(G&&$)if(Z&&this.predictionState?.input){let Q=this.predictionState.input.index;this.predictionState.input.seek(this.predictionState.startIndex);let F=Y.getPredicate().evaluate(this.parser,this.predictionState.outerContext);if(this.predictionState.input.seek(Q),F)J=s.createWithConfig(Y.target,X)}else{let Q=S.andContext(X.semanticContext,Y.getPredicate());J=s.createWithSemanticContext(Y.target,X,Q)}else J=s.createWithConfig(Y.target,X);if(U.debug)console.log("config from pred transition="+J);return J}predTransition(X,Y,G,$,Z){if(U.debug){if(console.log("PRED (collectPredicates="+G+") "+Y.ruleIndex+":"+Y.predIndex+", ctx dependent="+Y.isCtxDependent),this.parser!==null)console.log("context surrounding pred is "+y1(this.parser.getRuleInvocationStack()))}let J=null;if(G&&(Y.isCtxDependent&&$||!Y.isCtxDependent))if(Z&&this.predictionState?.input){let Q=this.predictionState.input.index;this.predictionState.input.seek(this.predictionState.startIndex);let F=Y.getPredicate().evaluate(this.parser,this.predictionState.outerContext);if(this.predictionState.input.seek(Q),F)J=s.createWithConfig(Y.target,X)}else{let Q=S.andContext(X.semanticContext,Y.getPredicate());J=s.createWithSemanticContext(Y.target,X,Q)}else J=s.createWithConfig(Y.target,X);if(U.debug)console.log("config from pred transition="+J);return J}ruleTransition(X,Y){if(U.debug)console.log("CALL rule "+this.getRuleName(Y.target.ruleIndex)+", ctx="+X.context);let G=Y.followState,$=O1(X.context??void 0,G.stateNumber);return s.createWithConfig(Y.target,X,$)}getConflictingAlts(X){let Y=X0.getConflictingAltSubsets(X);return X0.getAlts(Y)}getConflictingAltsOrUniqueAlt(X){let Y;if(X.uniqueAlt!==b.INVALID_ALT_NUMBER)Y=new x0,Y.set(X.uniqueAlt);else Y=X.conflictingAlts;return Y}noViableAlt(X,Y,G,$){return new h1(this.parser,X,X.get($),X.LT(1),G,Y)}addDFAEdge(X,Y,G,$){if(U.debug)console.log("EDGE "+Y+" -> "+$+" upon "+this.getTokenName(G));if($=this.addDFAState(X,$),G<-1||G>this.atn.maxTokenType)return $;if(U.debug)console.log(`DFA=
25
+ `+X.toString(this.parser!=null?this.parser.vocabulary:f0.EMPTY_VOCABULARY));return Y.edges[G+1]=$,$}addDFAState(X,Y){if(Y===S0.ERROR)return Y;let G=X.getState(Y);if(G!==null)return G;if(!Y.configs.readOnly)Y.configs.optimizeConfigs(this),Y.configs.setReadonly(!0);if(U.traceATNSimulator)console.log("addDFAState new "+Y);return X.addState(Y),Y}reportAttemptingFullContext(X,Y,G,$,Z){if(U.debug||U.retryDebug){let J=new v($,Z+1);console.log("reportAttemptingFullContext decision="+X.decision+":"+G+", input="+this.parser.tokenStream.getTextFromInterval(J))}this.parser.errorListenerDispatch.reportAttemptingFullContext(this.parser,X,$,Z,Y,G)}reportContextSensitivity(X,Y,G,$,Z){if(U.debug||U.retryDebug){let J=new v($,Z+1);console.log("reportContextSensitivity decision="+X.decision+":"+G+", input="+this.parser.tokenStream.getTextFromInterval(J))}this.parser.errorListenerDispatch.reportContextSensitivity(this.parser,X,$,Z,Y,G)}reportAmbiguity(X,Y,G,$,Z,J,Q){if(U.debug||U.retryDebug){let F=new v(G,$+1);console.log("reportAmbiguity "+J+":"+Q+", input="+this.parser.tokenStream.getTextFromInterval(F))}this.parser.errorListenerDispatch.reportAmbiguity(this.parser,X,G,$,Z,J,Q)}},E1=class{static{A(this,"PredictionContextCache")}cache=new p0(k1.instance);add(U){if(U===n.instance)return U;let X=this.cache.get(U);if(X)return X;return this.cache.set(U,U),U}get(U){return this.cache.get(U)}get length(){return this.cache.size}},i2=class extends k2{static{A(this,"ProfilingATNSimulator")}decisions;numDecisions=0;currentDecision=0;currentState;conflictingAltResolvedBySLL;sllStopIndex=0;llStopIndex=0;constructor(U){let X=U.interpreter.sharedContextCache;super(U,U.interpreter.atn,U.interpreter.decisionToDFA,X);if(X){this.numDecisions=this.atn.decisionToState.length,this.decisions=Array(this.numDecisions);for(let Y=0;Y<this.numDecisions;Y++)this.decisions[Y]=new Q8(Y)}}adaptivePredict(U,X,Y){try{this.sllStopIndex=-1,this.llStopIndex=-1,this.currentDecision=X;let G=performance.now(),$=super.adaptivePredict(U,X,Y),Z=performance.now();this.decisions[X].timeInPrediction+=Z-G,this.decisions[X].invocations++;let J=this.sllStopIndex-this.predictionState.startIndex+1;if(this.decisions[X].sllTotalLook+=J,this.decisions[X].sllMinLook=this.decisions[X].sllMinLook===0?J:Math.min(this.decisions[X].sllMinLook,J),J>this.decisions[X].sllMaxLook)this.decisions[X].sllMaxLook=J,this.decisions[X].sllMaxLookEvent={decision:X,configs:null,predictedAlt:$,input:U,startIndex:this.predictionState.startIndex,stopIndex:this.sllStopIndex,fullCtx:!1};if(this.llStopIndex>=0){let Q=this.llStopIndex-this.predictionState.startIndex+1;if(this.decisions[X].llTotalLook+=Q,this.decisions[X].llMinLook=this.decisions[X].llMinLook===0?Q:Math.min(this.decisions[X].llMinLook,Q),Q>this.decisions[X].llMaxLook)this.decisions[X].llMaxLook=Q,this.decisions[X].llMaxLookEvent={decision:X,configs:null,predictedAlt:$,input:U,startIndex:this.predictionState.startIndex,stopIndex:this.llStopIndex,fullCtx:!0}}return $}finally{this.currentDecision=-1}}getExistingTargetState(U,X){this.sllStopIndex=this.predictionState.input.index;let Y=super.getExistingTargetState(U,X);if(Y!==void 0){if(this.decisions[this.currentDecision].sllDFATransitions++,Y===S0.ERROR)this.decisions[this.currentDecision].errors.push({decision:this.currentDecision,configs:U.configs,input:this.predictionState.input,startIndex:this.predictionState.startIndex,stopIndex:this.sllStopIndex,fullCtx:!1})}return this.currentState=Y,Y}computeTargetState(U,X,Y){let G=super.computeTargetState(U,X,Y);return this.currentState=G,G}computeReachSet(U,X,Y){if(Y&&this.predictionState?.input)this.llStopIndex=this.predictionState.input.index;let G=super.computeReachSet(U,X,Y);if(this.predictionState?.input){if(Y){if(this.decisions[this.currentDecision].llATNTransitions++,G===null)this.decisions[this.currentDecision].errors.push({decision:this.currentDecision,configs:U,input:this.predictionState.input,startIndex:this.predictionState.startIndex,stopIndex:this.sllStopIndex,fullCtx:!0})}else if(this.decisions[this.currentDecision].sllATNTransitions++,G===null)this.decisions[this.currentDecision].errors.push({decision:this.currentDecision,configs:U,input:this.predictionState.input,startIndex:this.predictionState.startIndex,stopIndex:this.sllStopIndex,fullCtx:!1})}return G}reportAttemptingFullContext(U,X,Y,G,$){if(X!==null)this.conflictingAltResolvedBySLL=X.nextSetBit(0);else this.conflictingAltResolvedBySLL=Y.getAlts().nextSetBit(0);if(this.decisions[this.currentDecision].llFallback++,X)super.reportAttemptingFullContext(U,X,Y,G,$)}reportContextSensitivity(U,X,Y,G,$){if(X!==this.conflictingAltResolvedBySLL&&this.predictionState.input)this.decisions[this.currentDecision].contextSensitivities.push({decision:this.currentDecision,configs:Y,input:this.predictionState.input,startIndex:G,stopIndex:$,fullCtx:!0});super.reportContextSensitivity(U,X,Y,G,$)}reportAmbiguity(U,X,Y,G,$,Z,J){let Q;if(Z)Q=Z.nextSetBit(0);else Q=J.getAlts().nextSetBit(0);if(this.predictionState?.input){if(J.fullCtx&&Q!==this.conflictingAltResolvedBySLL)this.decisions[this.currentDecision].contextSensitivities.push({decision:this.currentDecision,configs:J,input:this.predictionState.input,startIndex:Y,stopIndex:G,fullCtx:!0});this.decisions[this.currentDecision].ambiguities.push({ambigAlts:Z,decision:this.currentDecision,configs:J,input:this.predictionState.input,startIndex:Y,stopIndex:G,fullCtx:J.fullCtx})}super.reportAmbiguity(U,X,Y,G,$,Z,J)}getDecisionInfo(){return this.decisions}getCurrentState(){return this.currentState}},b6;((U)=>{U.toString=A((X)=>{return`(${X.pred}, ${X.alt})`},"toString")})(b6||(b6={}));var J4=class extends Error{static{A(this,"ParseCancellationException")}constructor(U){super();this.cause=U}},UY=class{static{A(this,"InterpreterDataReader")}static parseInterpreterData(U){let X=[],Y=[],G=[],$=[],Z=[],J=U.split(`
26
+ `),Q=0,F=J[Q++];if(F!=="token literal names:")throw Error("Unexpected data entry");do{if(F=J[Q++],F.length===0)break;$.push(F==="null"?null:F)}while(!0);if(F=J[Q++],F!=="token symbolic names:")throw Error("Unexpected data entry");do{if(F=J[Q++],F.length===0)break;Z.push(F==="null"?null:F)}while(!0);if(F=J[Q++],F!=="rule names:")throw Error("Unexpected data entry");do{if(F=J[Q++],F.length===0)break;X.push(F)}while(!0);if(F=J[Q++],F==="channel names:"){do{if(F=J[Q++],F.length===0)break;Y.push(F)}while(!0);if(F=J[Q++],F!=="mode names:")throw Error("Unexpected data entry");do{if(F=J[Q++],F.length===0)break;G.push(F)}while(!0)}if(F=J[Q++],F!=="atn:")throw Error("Unexpected data entry");F=J[Q++];let _=F.split(","),I,H=[];for(let P=0;P<_.length;++P){let g=_[P];if(g.startsWith("["))I=Number(g.substring(1).trim());else if(g.endsWith("]"))I=Number(g.substring(0,g.length-1).trim());else I=Number(g.trim());H[P]=I}return{atn:new N1().deserialize(H),vocabulary:new f0($,Z,[]),ruleNames:X,channels:Y.length>0?Y:void 0,modes:G.length>0?G:void 0}}},n6=class{static{A(this,"AbstractParseTreeVisitor")}visit(U){return U.accept(this)}visitChildren(U){let X=this.defaultResult(),Y=U.getChildCount();for(let G=0;G<Y;G++){if(!this.shouldVisitNextChild(U,X))break;let $=U.getChild(G);if($){let Z=$.accept(this);X=this.aggregateResult(X,Z)}}return X}visitTerminal(U){return this.defaultResult()}visitErrorNode(U){return this.defaultResult()}defaultResult(){return null}shouldVisitNextChild(U,X){return!0}aggregateResult(U,X){return X}},XY=class U{static{A(this,"ParseTreeWalker")}static DEFAULT=new U;walk(X,Y){if(Y instanceof L2)X.visitErrorNode(Y);else if(Y instanceof C0)X.visitTerminal(Y);else{let $=Y;this.enterRule(X,$);for(let Z=0;Z<Y.getChildCount();Z++)this.walk(X,Y.getChild(Z));this.exitRule(X,$)}}enterRule(X,Y){let G=Y.ruleContext;X.enterEveryRule(G),G.enterRule(X)}exitRule(X,Y){let G=Y.ruleContext;G.exitRule(X),X.exitEveryRule(G)}},H0;((U)=>{U.fromString=A((X)=>{return new A8(X)},"fromString")})(H0||(H0={}));var A8=class{static{A(this,"CharStreamImpl")}name="";index=0;data;constructor(U){let X=[];for(let Y of U)X.push(Y.codePointAt(0));this.data=new Uint32Array(X)}reset(){this.index=0}consume(){if(this.index>=this.data.length)throw Error("cannot consume EOF");this.index+=1}LA(U){if(U===0)return 0;if(U<0)U+=1;let X=this.index+U-1;if(X<0||X>=this.data.length)return R.EOF;return this.data[X]}mark(){return-1}release(U){}seek(U){if(U<=this.index){this.index=U;return}this.index=Math.min(U,this.data.length)}getTextFromRange(U,X){if(X=X??this.data.length-1,X>=this.data.length)X=this.data.length-1;if(U>=this.data.length)return"";return this.stringFromRange(U,X+1)}getTextFromInterval(U){let{start:X,stop:Y}=U;if(Y>=this.data.length)Y=this.data.length-1;if(X>=this.data.length)return"";return this.stringFromRange(X,Y+1)}toString(){return this.stringFromRange(0)}get size(){return this.data.length}getSourceName(){if(this.name)return this.name;return r2.UNKNOWN_SOURCE_NAME}stringFromRange(U,X){let Y=this.data.slice(U,X),G="";return Y.forEach(($)=>{G+=String.fromCodePoint($)}),G}},p6=A((U)=>{return U.setText!==void 0},"isWritableToken"),K8=class{static{A(this,"BufferedTokenStream")}tokenSource;tokens=[];p=-1;fetchedEOF=!1;constructor(U){this.tokenSource=U}mark(){return 0}release(U){}reset(){this.seek(0)}seek(U){this.lazyInit(),this.p=this.adjustSeekIndex(U)}get size(){return this.tokens.length}get index(){return this.p}get(U){return this.lazyInit(),this.tokens[U]}consume(){let U=!1;if(this.p>=0)if(this.fetchedEOF)U=this.p<this.tokens.length-1;else U=this.p<this.tokens.length;else U=!1;if(!U&&this.LA(1)===R.EOF)throw Error("cannot consume EOF");if(this.sync(this.p+1))this.p=this.adjustSeekIndex(this.p+1)}sync(U){let X=U-this.tokens.length+1;if(X>0)return this.fetch(X)>=X;return!0}fetch(U){if(this.fetchedEOF)return 0;for(let X=0;X<U;X++){let Y=this.tokenSource.nextToken();if(p6(Y))Y.tokenIndex=this.tokens.length;if(this.tokens.push(Y),Y.type===R.EOF)return this.fetchedEOF=!0,X+1}return U}getTokens(U,X,Y){if(this.lazyInit(),U===void 0&&X===void 0)return this.tokens;if(U??=0,X===void 0)X=this.tokens.length-1;if(U<0||X>=this.tokens.length||X<0||U>=this.tokens.length)throw RangeError("start "+U+" or stop "+X+" not in 0.."+(this.tokens.length-1));if(U>X)return[];if(Y===void 0)return this.tokens.slice(U,X+1);let G=[];if(X>=this.tokens.length)X=this.tokens.length-1;for(let $=U;$<X;$++){let Z=this.tokens[$];if(Z.type===R.EOF){G.push(Z);break}if(Y.has(Z.type))G.push(Z)}return G}LA(U){return this.LT(U)?.type??R.INVALID_TYPE}LB(U){if(this.p-U<0)return null;return this.tokens[this.p-U]}LT(U){if(this.lazyInit(),U===0)return null;if(U<0)return this.LB(-U);let X=this.p+U-1;if(this.sync(X),X>=this.tokens.length)return this.tokens[this.tokens.length-1];return this.tokens[X]}adjustSeekIndex(U){return U}lazyInit(){if(this.p===-1)this.setup()}setup(){this.sync(0),this.p=this.adjustSeekIndex(0)}setTokenSource(U){this.tokenSource=U,this.tokens=[],this.p=-1,this.fetchedEOF=!1}nextTokenOnChannel(U,X){if(this.sync(U),U>=this.tokens.length)return-1;let Y=this.tokens[U];while(Y.channel!==X){if(Y.type===R.EOF)return-1;U+=1,this.sync(U),Y=this.tokens[U]}return U}previousTokenOnChannel(U,X){if(U>=this.tokens.length)return this.tokens.length-1;while(U>=0){let Y=this.tokens[U];if(Y.type===R.EOF||Y.channel===X)return U;--U}return U}getHiddenTokensToRight(U,X){if(X===void 0)X=-1;if(this.lazyInit(),U<0||U>=this.tokens.length)throw Error(`${U} not in 0..${this.tokens.length-1}`);let Y=this.nextTokenOnChannel(U+1,g0.DEFAULT_TOKEN_CHANNEL),G=U+1,$=Y===-1?this.tokens.length-1:Y;return this.filterForChannel(G,$,X)}getHiddenTokensToLeft(U,X){if(X===void 0)X=-1;if(this.lazyInit(),U<0||U>=this.tokens.length)throw Error(`${U} not in 0..${this.tokens.length-1}`);let Y=this.previousTokenOnChannel(U-1,g0.DEFAULT_TOKEN_CHANNEL);if(Y===U-1)return;let G=Y+1,$=U-1;return this.filterForChannel(G,$,X)}filterForChannel(U,X,Y){let G=[];for(let $=U;$<X+1;$++){let Z=this.tokens[$];if(Y===-1){if(Z.channel!==g0.DEFAULT_TOKEN_CHANNEL)G.push(Z)}else if(Z.channel===Y)G.push(Z)}if(G.length===0)return;return G}getSourceName(){return this.tokenSource.sourceName}getText(){return this.getTextFromInterval(v.of(0,this.size-1))}getTextFromInterval(U){let{start:X,stop:Y}=U;if(X<0||Y<0)return"";if(this.sync(Y),Y>=this.tokens.length)Y=this.tokens.length-1;let G="";for(let $=X;$<=Y;++$){let Z=this.tokens[$];if(Z.type===R.EOF)break;G+=Z.text}return G}getTextFromContext(U){return this.getTextFromInterval(U.getSourceInterval())}getTextFromRange(U,X){if(U!==null&&X!==null)return this.getTextFromInterval(v.of(U.tokenIndex,X.tokenIndex));return""}fill(){this.lazyInit();while(this.fetch(1000)===1000);}setLine(U){this.tokenSource.line=U}setColumn(U){this.tokenSource.column=U}},G3=class extends K8{static{A(this,"CommonTokenStream")}channel=R.DEFAULT_CHANNEL;constructor(U,X){super(U);this.channel=X??R.DEFAULT_CHANNEL}adjustSeekIndex(U){return this.nextTokenOnChannel(U,this.channel)}LB(U){if(U===0||this.index-U<0)return null;let X=this.index,Y=1;while(Y<=U)X=this.previousTokenOnChannel(X-1,this.channel),Y+=1;if(X<0)return null;return this.tokens[X]}LT(U){if(this.lazyInit(),U===0)return null;if(U<0)return this.LB(-U);let X=this.index,Y=1;while(Y<U){if(this.sync(X+1))X=this.nextTokenOnChannel(X+1,this.channel);Y+=1}return this.tokens[X]}getNumberOfOnChannelTokens(){let U=0;this.fill();for(let X of this.tokens){if(X.channel===this.channel)U+=1;if(X.type===R.EOF)break}return U}},j0=class U extends g0{static{A(this,"XPathLexer")}static TOKEN_REF=1;static RULE_REF=2;static ANYWHERE=3;static ROOT=4;static WILDCARD=5;static BANG=6;static ID=7;static STRING=8;static channelNames=["DEFAULT_TOKEN_CHANNEL","HIDDEN"];static literalNames=[null,null,null,"'//'","'/'","'*'","'!'"];static symbolicNames=[null,"TOKEN_REF","RULE_REF","ANYWHERE","ROOT","WILDCARD","BANG","ID","STRING"];static modeNames=["DEFAULT_MODE"];static ruleNames=["ANYWHERE","ROOT","WILDCARD","BANG","ID","NameChar","NameStartChar","STRING"];constructor(X){super(X);this.interpreter=new s1(this,U._ATN,U.decisionsToDFA,new E1)}get grammarFileName(){return"XPathLexer.g4"}get literalNames(){return U.literalNames}get symbolicNames(){return U.symbolicNames}get ruleNames(){return U.ruleNames}get serializedATN(){return U._serializedATN}get channelNames(){return U.channelNames}get modeNames(){return U.modeNames}action(X,Y,G){switch(Y){case 4:this.ID_action(X,G);break}}ID_action(X,Y){switch(Y){case 0:let G=this.text;if(G.charAt(0)===G.charAt(0).toUpperCase())this.type=U.TOKEN_REF;else this.type=U.RULE_REF;break}}static _serializedATN=[4,0,8,48,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,1,0,1,0,1,0,1,1,1,1,1,2,1,2,1,3,1,3,1,4,1,4,5,4,29,8,4,10,4,12,4,32,9,4,1,4,1,4,1,5,1,5,1,6,1,6,1,7,1,7,5,7,42,8,7,10,7,12,7,45,9,7,1,7,1,7,1,43,0,8,1,3,3,4,5,5,7,6,9,7,11,0,13,0,15,8,1,0,2,784,0,0,8,14,27,48,57,65,90,95,95,97,122,127,159,170,170,173,173,181,181,186,186,192,214,216,246,248,705,710,721,736,740,748,748,750,750,768,884,886,887,890,893,895,895,902,902,904,906,908,908,910,929,931,1013,1015,1153,1155,1159,1162,1327,1329,1366,1369,1369,1376,1416,1425,1469,1471,1471,1473,1474,1476,1477,1479,1479,1488,1514,1519,1522,1536,1541,1552,1562,1564,1564,1568,1641,1646,1747,1749,1757,1759,1768,1770,1788,1791,1791,1807,1866,1869,1969,1984,2037,2042,2042,2045,2045,2048,2093,2112,2139,2144,2154,2160,2183,2185,2190,2192,2193,2200,2403,2406,2415,2417,2435,2437,2444,2447,2448,2451,2472,2474,2480,2482,2482,2486,2489,2492,2500,2503,2504,2507,2510,2519,2519,2524,2525,2527,2531,2534,2545,2556,2556,2558,2558,2561,2563,2565,2570,2575,2576,2579,2600,2602,2608,2610,2611,2613,2614,2616,2617,2620,2620,2622,2626,2631,2632,2635,2637,2641,2641,2649,2652,2654,2654,2662,2677,2689,2691,2693,2701,2703,2705,2707,2728,2730,2736,2738,2739,2741,2745,2748,2757,2759,2761,2763,2765,2768,2768,2784,2787,2790,2799,2809,2815,2817,2819,2821,2828,2831,2832,2835,2856,2858,2864,2866,2867,2869,2873,2876,2884,2887,2888,2891,2893,2901,2903,2908,2909,2911,2915,2918,2927,2929,2929,2946,2947,2949,2954,2958,2960,2962,2965,2969,2970,2972,2972,2974,2975,2979,2980,2984,2986,2990,3001,3006,3010,3014,3016,3018,3021,3024,3024,3031,3031,3046,3055,3072,3084,3086,3088,3090,3112,3114,3129,3132,3140,3142,3144,3146,3149,3157,3158,3160,3162,3165,3165,3168,3171,3174,3183,3200,3203,3205,3212,3214,3216,3218,3240,3242,3251,3253,3257,3260,3268,3270,3272,3274,3277,3285,3286,3293,3294,3296,3299,3302,3311,3313,3315,3328,3340,3342,3344,3346,3396,3398,3400,3402,3406,3412,3415,3423,3427,3430,3439,3450,3455,3457,3459,3461,3478,3482,3505,3507,3515,3517,3517,3520,3526,3530,3530,3535,3540,3542,3542,3544,3551,3558,3567,3570,3571,3585,3642,3648,3662,3664,3673,3713,3714,3716,3716,3718,3722,3724,3747,3749,3749,3751,3773,3776,3780,3782,3782,3784,3790,3792,3801,3804,3807,3840,3840,3864,3865,3872,3881,3893,3893,3895,3895,3897,3897,3902,3911,3913,3948,3953,3972,3974,3991,3993,4028,4038,4038,4096,4169,4176,4253,4256,4293,4295,4295,4301,4301,4304,4346,4348,4680,4682,4685,4688,4694,4696,4696,4698,4701,4704,4744,4746,4749,4752,4784,4786,4789,4792,4798,4800,4800,4802,4805,4808,4822,4824,4880,4882,4885,4888,4954,4957,4959,4992,5007,5024,5109,5112,5117,5121,5740,5743,5759,5761,5786,5792,5866,5870,5880,5888,5909,5919,5940,5952,5971,5984,5996,5998,6000,6002,6003,6016,6099,6103,6103,6108,6109,6112,6121,6155,6169,6176,6264,6272,6314,6320,6389,6400,6430,6432,6443,6448,6459,6470,6509,6512,6516,6528,6571,6576,6601,6608,6617,6656,6683,6688,6750,6752,6780,6783,6793,6800,6809,6823,6823,6832,6845,6847,6862,6912,6988,6992,7001,7019,7027,7040,7155,7168,7223,7232,7241,7245,7293,7296,7304,7312,7354,7357,7359,7376,7378,7380,7418,7424,7957,7960,7965,7968,8005,8008,8013,8016,8023,8025,8025,8027,8027,8029,8029,8031,8061,8064,8116,8118,8124,8126,8126,8130,8132,8134,8140,8144,8147,8150,8155,8160,8172,8178,8180,8182,8188,8203,8207,8234,8238,8255,8256,8276,8276,8288,8292,8294,8303,8305,8305,8319,8319,8336,8348,8400,8412,8417,8417,8421,8432,8450,8450,8455,8455,8458,8467,8469,8469,8473,8477,8484,8484,8486,8486,8488,8488,8490,8493,8495,8505,8508,8511,8517,8521,8526,8526,8544,8584,11264,11492,11499,11507,11520,11557,11559,11559,11565,11565,11568,11623,11631,11631,11647,11670,11680,11686,11688,11694,11696,11702,11704,11710,11712,11718,11720,11726,11728,11734,11736,11742,11744,11775,11823,11823,12293,12295,12321,12335,12337,12341,12344,12348,12353,12438,12441,12442,12445,12447,12449,12538,12540,12543,12549,12591,12593,12686,12704,12735,12784,12799,13312,19903,19968,42124,42192,42237,42240,42508,42512,42539,42560,42607,42612,42621,42623,42737,42775,42783,42786,42888,42891,42954,42960,42961,42963,42963,42965,42969,42994,43047,43052,43052,43072,43123,43136,43205,43216,43225,43232,43255,43259,43259,43261,43309,43312,43347,43360,43388,43392,43456,43471,43481,43488,43518,43520,43574,43584,43597,43600,43609,43616,43638,43642,43714,43739,43741,43744,43759,43762,43766,43777,43782,43785,43790,43793,43798,43808,43814,43816,43822,43824,43866,43868,43881,43888,44010,44012,44013,44016,44025,44032,55203,55216,55238,55243,55291,63744,64109,64112,64217,64256,64262,64275,64279,64285,64296,64298,64310,64312,64316,64318,64318,64320,64321,64323,64324,64326,64433,64467,64829,64848,64911,64914,64967,65008,65019,65024,65039,65056,65071,65075,65076,65101,65103,65136,65140,65142,65276,65279,65279,65296,65305,65313,65338,65343,65343,65345,65370,65382,65470,65474,65479,65482,65487,65490,65495,65498,65500,65529,65531,65536,65547,65549,65574,65576,65594,65596,65597,65599,65613,65616,65629,65664,65786,65856,65908,66045,66045,66176,66204,66208,66256,66272,66272,66304,66335,66349,66378,66384,66426,66432,66461,66464,66499,66504,66511,66513,66517,66560,66717,66720,66729,66736,66771,66776,66811,66816,66855,66864,66915,66928,66938,66940,66954,66956,66962,66964,66965,66967,66977,66979,66993,66995,67001,67003,67004,67072,67382,67392,67413,67424,67431,67456,67461,67463,67504,67506,67514,67584,67589,67592,67592,67594,67637,67639,67640,67644,67644,67647,67669,67680,67702,67712,67742,67808,67826,67828,67829,67840,67861,67872,67897,67968,68023,68030,68031,68096,68099,68101,68102,68108,68115,68117,68119,68121,68149,68152,68154,68159,68159,68192,68220,68224,68252,68288,68295,68297,68326,68352,68405,68416,68437,68448,68466,68480,68497,68608,68680,68736,68786,68800,68850,68864,68903,68912,68921,69248,69289,69291,69292,69296,69297,69373,69404,69415,69415,69424,69456,69488,69509,69552,69572,69600,69622,69632,69702,69734,69749,69759,69818,69821,69821,69826,69826,69837,69837,69840,69864,69872,69881,69888,69940,69942,69951,69956,69959,69968,70003,70006,70006,70016,70084,70089,70092,70094,70106,70108,70108,70144,70161,70163,70199,70206,70209,70272,70278,70280,70280,70282,70285,70287,70301,70303,70312,70320,70378,70384,70393,70400,70403,70405,70412,70415,70416,70419,70440,70442,70448,70450,70451,70453,70457,70459,70468,70471,70472,70475,70477,70480,70480,70487,70487,70493,70499,70502,70508,70512,70516,70656,70730,70736,70745,70750,70753,70784,70853,70855,70855,70864,70873,71040,71093,71096,71104,71128,71133,71168,71232,71236,71236,71248,71257,71296,71352,71360,71369,71424,71450,71453,71467,71472,71481,71488,71494,71680,71738,71840,71913,71935,71942,71945,71945,71948,71955,71957,71958,71960,71989,71991,71992,71995,72003,72016,72025,72096,72103,72106,72151,72154,72161,72163,72164,72192,72254,72263,72263,72272,72345,72349,72349,72368,72440,72704,72712,72714,72758,72760,72768,72784,72793,72818,72847,72850,72871,72873,72886,72960,72966,72968,72969,72971,73014,73018,73018,73020,73021,73023,73031,73040,73049,73056,73061,73063,73064,73066,73102,73104,73105,73107,73112,73120,73129,73440,73462,73472,73488,73490,73530,73534,73538,73552,73561,73648,73648,73728,74649,74752,74862,74880,75075,77712,77808,77824,78933,82944,83526,92160,92728,92736,92766,92768,92777,92784,92862,92864,92873,92880,92909,92912,92916,92928,92982,92992,92995,93008,93017,93027,93047,93053,93071,93760,93823,93952,94026,94031,94087,94095,94111,94176,94177,94179,94180,94192,94193,94208,100343,100352,101589,101632,101640,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,113664,113770,113776,113788,113792,113800,113808,113817,113821,113822,113824,113827,118528,118573,118576,118598,119141,119145,119149,119170,119173,119179,119210,119213,119362,119364,119808,119892,119894,119964,119966,119967,119970,119970,119973,119974,119977,119980,119982,119993,119995,119995,119997,120003,120005,120069,120071,120074,120077,120084,120086,120092,120094,120121,120123,120126,120128,120132,120134,120134,120138,120144,120146,120485,120488,120512,120514,120538,120540,120570,120572,120596,120598,120628,120630,120654,120656,120686,120688,120712,120714,120744,120746,120770,120772,120779,120782,120831,121344,121398,121403,121452,121461,121461,121476,121476,121499,121503,121505,121519,122624,122654,122661,122666,122880,122886,122888,122904,122907,122913,122915,122916,122918,122922,122928,122989,123023,123023,123136,123180,123184,123197,123200,123209,123214,123214,123536,123566,123584,123641,124112,124153,124896,124902,124904,124907,124909,124910,124912,124926,124928,125124,125136,125142,125184,125259,125264,125273,126464,126467,126469,126495,126497,126498,126500,126500,126503,126503,126505,126514,126516,126519,126521,126521,126523,126523,126530,126530,126535,126535,126537,126537,126539,126539,126541,126543,126545,126546,126548,126548,126551,126551,126553,126553,126555,126555,126557,126557,126559,126559,126561,126562,126564,126564,126567,126570,126572,126578,126580,126583,126585,126588,126590,126590,126592,126601,126603,126619,126625,126627,126629,126633,126635,126651,130032,130041,131072,173791,173824,177977,177984,178205,178208,183969,183984,191456,194560,195101,196608,201546,201552,205743,917505,917505,917536,917631,917760,917999,662,0,65,90,97,122,170,170,181,181,186,186,192,214,216,246,248,705,710,721,736,740,748,748,750,750,880,884,886,887,890,893,895,895,902,902,904,906,908,908,910,929,931,1013,1015,1153,1162,1327,1329,1366,1369,1369,1376,1416,1488,1514,1519,1522,1568,1610,1646,1647,1649,1747,1749,1749,1765,1766,1774,1775,1786,1788,1791,1791,1808,1808,1810,1839,1869,1957,1969,1969,1994,2026,2036,2037,2042,2042,2048,2069,2074,2074,2084,2084,2088,2088,2112,2136,2144,2154,2160,2183,2185,2190,2208,2249,2308,2361,2365,2365,2384,2384,2392,2401,2417,2432,2437,2444,2447,2448,2451,2472,2474,2480,2482,2482,2486,2489,2493,2493,2510,2510,2524,2525,2527,2529,2544,2545,2556,2556,2565,2570,2575,2576,2579,2600,2602,2608,2610,2611,2613,2614,2616,2617,2649,2652,2654,2654,2674,2676,2693,2701,2703,2705,2707,2728,2730,2736,2738,2739,2741,2745,2749,2749,2768,2768,2784,2785,2809,2809,2821,2828,2831,2832,2835,2856,2858,2864,2866,2867,2869,2873,2877,2877,2908,2909,2911,2913,2929,2929,2947,2947,2949,2954,2958,2960,2962,2965,2969,2970,2972,2972,2974,2975,2979,2980,2984,2986,2990,3001,3024,3024,3077,3084,3086,3088,3090,3112,3114,3129,3133,3133,3160,3162,3165,3165,3168,3169,3200,3200,3205,3212,3214,3216,3218,3240,3242,3251,3253,3257,3261,3261,3293,3294,3296,3297,3313,3314,3332,3340,3342,3344,3346,3386,3389,3389,3406,3406,3412,3414,3423,3425,3450,3455,3461,3478,3482,3505,3507,3515,3517,3517,3520,3526,3585,3632,3634,3635,3648,3654,3713,3714,3716,3716,3718,3722,3724,3747,3749,3749,3751,3760,3762,3763,3773,3773,3776,3780,3782,3782,3804,3807,3840,3840,3904,3911,3913,3948,3976,3980,4096,4138,4159,4159,4176,4181,4186,4189,4193,4193,4197,4198,4206,4208,4213,4225,4238,4238,4256,4293,4295,4295,4301,4301,4304,4346,4348,4680,4682,4685,4688,4694,4696,4696,4698,4701,4704,4744,4746,4749,4752,4784,4786,4789,4792,4798,4800,4800,4802,4805,4808,4822,4824,4880,4882,4885,4888,4954,4992,5007,5024,5109,5112,5117,5121,5740,5743,5759,5761,5786,5792,5866,5870,5880,5888,5905,5919,5937,5952,5969,5984,5996,5998,6000,6016,6067,6103,6103,6108,6108,6176,6264,6272,6276,6279,6312,6314,6314,6320,6389,6400,6430,6480,6509,6512,6516,6528,6571,6576,6601,6656,6678,6688,6740,6823,6823,6917,6963,6981,6988,7043,7072,7086,7087,7098,7141,7168,7203,7245,7247,7258,7293,7296,7304,7312,7354,7357,7359,7401,7404,7406,7411,7413,7414,7418,7418,7424,7615,7680,7957,7960,7965,7968,8005,8008,8013,8016,8023,8025,8025,8027,8027,8029,8029,8031,8061,8064,8116,8118,8124,8126,8126,8130,8132,8134,8140,8144,8147,8150,8155,8160,8172,8178,8180,8182,8188,8305,8305,8319,8319,8336,8348,8450,8450,8455,8455,8458,8467,8469,8469,8473,8477,8484,8484,8486,8486,8488,8488,8490,8493,8495,8505,8508,8511,8517,8521,8526,8526,8544,8584,11264,11492,11499,11502,11506,11507,11520,11557,11559,11559,11565,11565,11568,11623,11631,11631,11648,11670,11680,11686,11688,11694,11696,11702,11704,11710,11712,11718,11720,11726,11728,11734,11736,11742,11823,11823,12293,12295,12321,12329,12337,12341,12344,12348,12353,12438,12445,12447,12449,12538,12540,12543,12549,12591,12593,12686,12704,12735,12784,12799,13312,19903,19968,42124,42192,42237,42240,42508,42512,42527,42538,42539,42560,42606,42623,42653,42656,42735,42775,42783,42786,42888,42891,42954,42960,42961,42963,42963,42965,42969,42994,43009,43011,43013,43015,43018,43020,43042,43072,43123,43138,43187,43250,43255,43259,43259,43261,43262,43274,43301,43312,43334,43360,43388,43396,43442,43471,43471,43488,43492,43494,43503,43514,43518,43520,43560,43584,43586,43588,43595,43616,43638,43642,43642,43646,43695,43697,43697,43701,43702,43705,43709,43712,43712,43714,43714,43739,43741,43744,43754,43762,43764,43777,43782,43785,43790,43793,43798,43808,43814,43816,43822,43824,43866,43868,43881,43888,44002,44032,55203,55216,55238,55243,55291,63744,64109,64112,64217,64256,64262,64275,64279,64285,64285,64287,64296,64298,64310,64312,64316,64318,64318,64320,64321,64323,64324,64326,64433,64467,64829,64848,64911,64914,64967,65008,65019,65136,65140,65142,65276,65313,65338,65345,65370,65382,65470,65474,65479,65482,65487,65490,65495,65498,65500,65536,65547,65549,65574,65576,65594,65596,65597,65599,65613,65616,65629,65664,65786,65856,65908,66176,66204,66208,66256,66304,66335,66349,66378,66384,66421,66432,66461,66464,66499,66504,66511,66513,66517,66560,66717,66736,66771,66776,66811,66816,66855,66864,66915,66928,66938,66940,66954,66956,66962,66964,66965,66967,66977,66979,66993,66995,67001,67003,67004,67072,67382,67392,67413,67424,67431,67456,67461,67463,67504,67506,67514,67584,67589,67592,67592,67594,67637,67639,67640,67644,67644,67647,67669,67680,67702,67712,67742,67808,67826,67828,67829,67840,67861,67872,67897,67968,68023,68030,68031,68096,68096,68112,68115,68117,68119,68121,68149,68192,68220,68224,68252,68288,68295,68297,68324,68352,68405,68416,68437,68448,68466,68480,68497,68608,68680,68736,68786,68800,68850,68864,68899,69248,69289,69296,69297,69376,69404,69415,69415,69424,69445,69488,69505,69552,69572,69600,69622,69635,69687,69745,69746,69749,69749,69763,69807,69840,69864,69891,69926,69956,69956,69959,69959,69968,70002,70006,70006,70019,70066,70081,70084,70106,70106,70108,70108,70144,70161,70163,70187,70207,70208,70272,70278,70280,70280,70282,70285,70287,70301,70303,70312,70320,70366,70405,70412,70415,70416,70419,70440,70442,70448,70450,70451,70453,70457,70461,70461,70480,70480,70493,70497,70656,70708,70727,70730,70751,70753,70784,70831,70852,70853,70855,70855,71040,71086,71128,71131,71168,71215,71236,71236,71296,71338,71352,71352,71424,71450,71488,71494,71680,71723,71840,71903,71935,71942,71945,71945,71948,71955,71957,71958,71960,71983,71999,71999,72001,72001,72096,72103,72106,72144,72161,72161,72163,72163,72192,72192,72203,72242,72250,72250,72272,72272,72284,72329,72349,72349,72368,72440,72704,72712,72714,72750,72768,72768,72818,72847,72960,72966,72968,72969,72971,73008,73030,73030,73056,73061,73063,73064,73066,73097,73112,73112,73440,73458,73474,73474,73476,73488,73490,73523,73648,73648,73728,74649,74752,74862,74880,75075,77712,77808,77824,78895,78913,78918,82944,83526,92160,92728,92736,92766,92784,92862,92880,92909,92928,92975,92992,92995,93027,93047,93053,93071,93760,93823,93952,94026,94032,94032,94099,94111,94176,94177,94179,94179,94208,100343,100352,101589,101632,101640,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,113664,113770,113776,113788,113792,113800,113808,113817,119808,119892,119894,119964,119966,119967,119970,119970,119973,119974,119977,119980,119982,119993,119995,119995,119997,120003,120005,120069,120071,120074,120077,120084,120086,120092,120094,120121,120123,120126,120128,120132,120134,120134,120138,120144,120146,120485,120488,120512,120514,120538,120540,120570,120572,120596,120598,120628,120630,120654,120656,120686,120688,120712,120714,120744,120746,120770,120772,120779,122624,122654,122661,122666,122928,122989,123136,123180,123191,123197,123214,123214,123536,123565,123584,123627,124112,124139,124896,124902,124904,124907,124909,124910,124912,124926,124928,125124,125184,125251,125259,125259,126464,126467,126469,126495,126497,126498,126500,126500,126503,126503,126505,126514,126516,126519,126521,126521,126523,126523,126530,126530,126535,126535,126537,126537,126539,126539,126541,126543,126545,126546,126548,126548,126551,126551,126553,126553,126555,126555,126557,126557,126559,126559,126561,126562,126564,126564,126567,126570,126572,126578,126580,126583,126585,126588,126590,126590,126592,126601,126603,126619,126625,126627,126629,126633,126635,126651,131072,173791,173824,177977,177984,178205,178208,183969,183984,191456,194560,195101,196608,201546,201552,205743,47,0,1,1,0,0,0,0,3,1,0,0,0,0,5,1,0,0,0,0,7,1,0,0,0,0,9,1,0,0,0,0,15,1,0,0,0,1,17,1,0,0,0,3,20,1,0,0,0,5,22,1,0,0,0,7,24,1,0,0,0,9,26,1,0,0,0,11,35,1,0,0,0,13,37,1,0,0,0,15,39,1,0,0,0,17,18,5,47,0,0,18,19,5,47,0,0,19,2,1,0,0,0,20,21,5,47,0,0,21,4,1,0,0,0,22,23,5,42,0,0,23,6,1,0,0,0,24,25,5,33,0,0,25,8,1,0,0,0,26,30,3,13,6,0,27,29,3,11,5,0,28,27,1,0,0,0,29,32,1,0,0,0,30,28,1,0,0,0,30,31,1,0,0,0,31,33,1,0,0,0,32,30,1,0,0,0,33,34,6,4,0,0,34,10,1,0,0,0,35,36,7,0,0,0,36,12,1,0,0,0,37,38,7,1,0,0,38,14,1,0,0,0,39,43,5,39,0,0,40,42,9,0,0,0,41,40,1,0,0,0,42,45,1,0,0,0,43,44,1,0,0,0,43,41,1,0,0,0,44,46,1,0,0,0,45,43,1,0,0,0,46,47,5,39,0,0,47,16,1,0,0,0,3,0,30,43,1,1,4,0];static __ATN;static get _ATN(){if(!U.__ATN)U.__ATN=new N1().deserialize(U._serializedATN);return U.__ATN}static vocabulary=new f0(U.literalNames,U.symbolicNames,[]);get vocabulary(){return U.vocabulary}static decisionsToDFA=U._ATN.decisionToState.map((X,Y)=>{return new o0(X,Y)})},D8=class extends Y3{static{A(this,"XPathLexerErrorListener")}syntaxError(U,X,Y,G,$,Z){}},n1=class{static{A(this,"XPathElement")}invert;nodeName;constructor(U){this.nodeName=U,this.invert=!1}toString(){return"XPathElement["+(this.invert?"!":"")+this.nodeName+"]"}},B8=class extends n1{static{A(this,"XPathRuleAnywhereElement")}ruleIndex;constructor(U,X){super(U);this.ruleIndex=X}evaluate(U){return J1.findAllRuleNodes(U,this.ruleIndex)}toString(){return"XPathRuleAnywhereElement["+(this.invert?"!":"")+this.nodeName+"]"}},w8=class extends n1{static{A(this,"XPathRuleElement")}ruleIndex;constructor(U,X){super(U);this.ruleIndex=X}evaluate(U){let X=[];for(let Y of J1.getChildren(U))if(Y instanceof C){if(Y.ruleIndex===this.ruleIndex&&!this.invert||Y.ruleIndex!==this.ruleIndex&&this.invert)X.push(Y)}return X}toString(){return"XPathRuleElement["+(this.invert?"!":"")+this.nodeName+"]"}},R8=class extends n1{static{A(this,"XPathTokenAnywhereElement")}tokenType;constructor(U,X){super(U);this.tokenType=X}evaluate(U){return J1.findAllTokenNodes(U,this.tokenType)}toString(){return"XPathTokenAnywhereElement["+(this.invert?"!":"")+this.nodeName+"]"}},H8=class extends n1{static{A(this,"XPathTokenElement")}tokenType;constructor(U,X){super(U);this.tokenType=X}evaluate(U){let X=[];for(let Y of J1.getChildren(U))if(Y instanceof C0&&Y.symbol){if(Y.symbol.type===this.tokenType&&!this.invert||Y.symbol.type!==this.tokenType&&this.invert)X.push(Y)}return X}toString(){return"XPathTokenElement["+(this.invert?"!":"")+this.nodeName+"]"}},L8=class extends n1{static{A(this,"XPathWildcardAnywhereElement")}constructor(){super(W4.WILDCARD)}evaluate(U){if(this.invert)return[];return J1.descendants(U)}toString(){return"XPathWildcardAnywhereElement["+(this.invert?"!":"")+this.nodeName+"]"}},M8=class extends n1{static{A(this,"XPathWildcardElement")}constructor(){super(W4.WILDCARD)}evaluate(U){let X=[];if(this.invert)return X;for(let Y of J1.getChildren(U))X.push(Y);return X}toString(){return"XPathWildcardElement["+(this.invert?"!":"")+this.nodeName+"]"}},W4=class U{static{A(this,"XPath")}static WILDCARD="*";static NOT="!";path;elements;parser;constructor(X,Y){this.parser=X,this.path=Y,this.elements=this.split(Y)}static findAll(X,Y,G){return new U(G,Y).evaluate(X)}split(X){let Y=new j0(H0.fromString(X));Y.recover=(F)=>{throw F},Y.removeErrorListeners(),Y.addErrorListener(new D8);let G=new G3(Y);try{G.fill()}catch(F){if(F instanceof U3){let I="Invalid tokens or characters at index "+Y.column+" in path '"+X+"' -- "+F.message;throw RangeError(I)}throw F}let $=G.getTokens(),Z=[],J=$.length,Q=0;U:while(Q<J){let F=$[Q],_;switch(F.type){case j0.ROOT:case j0.ANYWHERE:let I=F.type===j0.ANYWHERE;Q++,_=$[Q];let H=_.type===j0.BANG;if(H)Q++,_=$[Q];let j=this.getXPathElement(_,I);j.invert=H,Z.push(j),Q++;break;case j0.TOKEN_REF:case j0.RULE_REF:case j0.WILDCARD:Z.push(this.getXPathElement(F,!1)),++Q;break;case R.EOF:break U;default:throw Error("Unknown path element "+F)}}return Z}evaluate(X){let Y=new C(null);Y.addChild(X);let G=new Set([Y]),$=0;while($<this.elements.length){let Z=new Set;for(let J of G)if(J.getChildCount()>0)this.elements[$].evaluate(J).forEach((F)=>{Z.add(F)},Z);$++,G=Z}return G}getXPathElement(X,Y){if(X.type===R.EOF)throw Error("Missing path element at end of path");let G=X.text;if(G==null)throw Error("Expected wordToken to have text content.");let $=this.parser.getTokenType(G),Z=this.parser.getRuleIndex(G);switch(X.type){case j0.WILDCARD:return Y?new L8:new M8;case j0.TOKEN_REF:case j0.STRING:if($===R.INVALID_TYPE)throw Error(G+" at index "+X.start+" isn't a valid token name");return Y?new R8(G,$):new H8(G,$);default:if(Z===-1)throw Error(G+" at index "+X.start+" isn't a valid rule name");return Y?new B8(G,Z):new w8(G,Z)}}},o6=class{static{A(this,"Chunk")}},k8=class{static{A(this,"ParseTreeMatch")}tree;pattern;labels;mismatchedNode;constructor(U,X,Y,G){this.tree=U,this.pattern=X,this.labels=Y,this.mismatchedNode=G}get(U){let X=this.labels.get(U);if(!X||X.length===0)return null;return X[X.length-1]}getAll(U){return this.labels.get(U)??[]}getLabels(){return this.labels}getMismatchedNode(){return this.mismatchedNode}succeeded(){return!this.mismatchedNode}getPattern(){return this.pattern}getTree(){return this.tree}toString(){return`Match ${this.succeeded()?"succeeded":"failed"}; found ${this.getLabels().size} labels`}},O8=class{static{A(this,"ParseTreePattern")}patternRuleIndex;pattern;patternTree;matcher;constructor(U,X,Y,G){this.matcher=U,this.patternRuleIndex=Y,this.pattern=X,this.patternTree=G}match(U){return this.matcher.match(U,this)}matches(U){return this.matcher.match(U,this).succeeded()}findAll(U,X){let Y=W4.findAll(U,X,this.matcher.getParser()),G=[];for(let $ of Y){let Z=this.match($);if(Z.succeeded())G.push(Z)}return G}getMatcher(){return this.matcher}getPattern(){return this.pattern}getPatternRuleIndex(){return this.patternRuleIndex}getPatternTree(){return this.patternTree}},H2=class extends V{static{A(this,"InputMismatchException")}constructor(U){super({message:"",recognizer:U,input:U.inputStream,ctx:U.context});this.offendingToken=U.getCurrentToken()}},M2=class extends V{static{A(this,"FailedPredicateException")}ruleIndex=0;predicateIndex=0;predicate;constructor(U,X,Y=null){super({message:j8(X??"no predicate",Y??null),recognizer:U,input:U.inputStream,ctx:U.context});let $=U.atn.states[U.state].transitions[0];if($ instanceof y6)this.ruleIndex=$.ruleIndex,this.predicateIndex=$.predIndex;else this.ruleIndex=0,this.predicateIndex=0;this.predicate=X,this.offendingToken=U.getCurrentToken()}},j8=A((U,X)=>{if(X!==null)return X;return"failed predicate: {"+U+"}?"},"formatMessage"),i6=class{static{A(this,"DefaultErrorStrategy")}errorRecoveryMode=!1;lastErrorIndex=-1;lastErrorStates=new E0;nextTokensContext=null;nextTokenState=0;reset(U){this.endErrorCondition(U)}beginErrorCondition(U){this.errorRecoveryMode=!0}inErrorRecoveryMode(U){return this.errorRecoveryMode}endErrorCondition(U){this.errorRecoveryMode=!1,this.lastErrorStates=new E0,this.lastErrorIndex=-1}reportMatch(U){this.endErrorCondition(U)}reportError(U,X){if(this.inErrorRecoveryMode(U))return;if(this.beginErrorCondition(U),X instanceof h1)this.reportNoViableAlternative(U,X);else if(X instanceof H2)this.reportInputMismatch(U,X);else if(X instanceof M2)this.reportFailedPredicate(U,X);else U.notifyErrorListeners(X.message,X.offendingToken,X)}recover(U,X){if(this.lastErrorIndex===U.inputStream?.index&&this.lastErrorStates.contains(U.state))U.consume();this.lastErrorIndex=U.inputStream?.index??0,this.lastErrorStates.addOne(U.state);let Y=this.getErrorRecoverySet(U);this.consumeUntil(U,Y)}sync(U){if(this.inErrorRecoveryMode(U))return;let X=U.atn.states[U.state],Y=U.tokenStream.LA(1),G=U.atn.nextTokens(X);if(G.contains(Y)){this.nextTokensContext=null,this.nextTokenState=f.INVALID_STATE_NUMBER;return}if(G.contains(R.EPSILON)){if(this.nextTokensContext===null)this.nextTokensContext=U.context,this.nextTokenState=U.state;return}switch(X.constructor.stateType){case f.BLOCK_START:case f.STAR_BLOCK_START:case f.PLUS_BLOCK_START:case f.STAR_LOOP_ENTRY:{if(this.singleTokenDeletion(U)!==null)return;throw new H2(U)}case f.PLUS_LOOP_BACK:case f.STAR_LOOP_BACK:{this.reportUnwantedToken(U);let $=new E0;$.addSet(U.getExpectedTokens());let Z=$.addSet(this.getErrorRecoverySet(U));this.consumeUntil(U,Z);break}default:}}reportNoViableAlternative(U,X){if(X.message.length>0){U.notifyErrorListeners(X.message,X.offendingToken,X);return}let Y=U.tokenStream,G;if(Y!==null&&X.startToken)if(X.startToken.type===R.EOF)G="<EOF>";else G=Y.getTextFromRange(X.startToken,X.offendingToken);else G="<unknown input>";let $="no viable alternative at input "+this.escapeWSAndQuote(G);U.notifyErrorListeners($,X.offendingToken,X)}reportInputMismatch(U,X){if(X.message.length>0){U.notifyErrorListeners(X.message,X.offendingToken,X);return}let Y="mismatched input "+this.getTokenErrorDisplay(X.offendingToken)+" expecting "+X.getExpectedTokens().toStringWithVocabulary(U.vocabulary);U.notifyErrorListeners(Y,X.offendingToken,X)}reportFailedPredicate(U,X){let G="rule "+U.ruleNames[U.context.ruleIndex]+" "+X.message;U.notifyErrorListeners(G,X.offendingToken,X)}reportUnwantedToken(U){if(this.inErrorRecoveryMode(U))return;this.beginErrorCondition(U);let X=U.getCurrentToken(),Y=this.getTokenErrorDisplay(X),G=this.getExpectedTokens(U),$="extraneous input "+Y+" expecting "+G.toStringWithVocabulary(U.vocabulary);U.notifyErrorListeners($,X,null)}reportMissingToken(U){if(this.inErrorRecoveryMode(U))return;this.beginErrorCondition(U);let X=U.getCurrentToken(),G="missing "+this.getExpectedTokens(U).toStringWithVocabulary(U.vocabulary)+" at "+this.getTokenErrorDisplay(X);U.notifyErrorListeners(G,X,null)}recoverInline(U){let X=this.singleTokenDeletion(U);if(X)return U.consume(),X;if(this.singleTokenInsertion(U))return this.getMissingSymbol(U);throw new H2(U)}singleTokenInsertion(U){let X=U.tokenStream?.LA(1)??-1,Y=U.atn,$=Y.states[U.state].transitions[0].target;if(Y.nextTokens($,U.context??void 0).contains(X))return this.reportMissingToken(U),!0;return!1}singleTokenDeletion(U){let X=U.tokenStream?.LA(2)??-1;if(this.getExpectedTokens(U).contains(X)){this.reportUnwantedToken(U),U.consume();let G=U.getCurrentToken();return this.reportMatch(U),G}return null}getMissingSymbol(U){let X=U.getCurrentToken(),Y=this.getExpectedTokens(U),G=R.INVALID_TYPE;if(Y.length!==0)G=Y.minElement;let $;if(G===R.EOF)$="<missing EOF>";else $="<missing "+U.vocabulary.getDisplayName(G)+">";let Z=X,J=U.tokenStream?.LT(-1);if(Z.type===R.EOF&&J!==null)Z=J;return U.getTokenFactory().create(Z.source,G,$,R.DEFAULT_CHANNEL,-1,-1,Z.line,Z.column)}getExpectedTokens(U){return U.getExpectedTokens()}getTokenErrorDisplay(U){if(U===null)return"<no token>";let X=U.text;if(!X)if(U.type===R.EOF)X="<EOF>";else X="<"+U.type+">";return this.escapeWSAndQuote(X)}escapeWSAndQuote(U){return U=U.replace(/\n/g,"\\n"),U=U.replace(/\r/g,"\\r"),U=U.replace(/\t/g,"\\t"),"'"+U+"'"}getErrorRecoverySet(U){let{atn:X,context:Y}=U,G=new E0;while(Y!==null&&Y.invokingState>=0){let Z=X.states[Y.invokingState].transitions[0],J=X.nextTokens(Z.followState);G.addSet(J),Y=Y.parent}return G.removeOne(R.EPSILON),G}consumeUntil(U,X){let Y=U.tokenStream?.LA(1)??-1;while(Y!==R.EOF&&!X.contains(Y))U.consume(),Y=U.tokenStream?.LA(1)??-1}},h8=class extends i6{static{A(this,"BailErrorStrategy")}recover(U,X){throw new J4(X)}recoverInline(U){let X=new H2(U);throw new J4(X)}sync(U){}},E8=class{static{A(this,"ListTokenSource")}sourceName;tokenFactory=a6.DEFAULT;tokens=[];i=0;eofToken=null;constructor(U,X){this.tokens=U,this.sourceName=X??""}get column(){if(this.i<this.tokens.length)return this.tokens[this.i].column;if(this.eofToken!==null)return this.eofToken.column;if(this.tokens.length>0){let U=this.tokens[this.tokens.length-1],X=U.text;if(X){let Y=X.lastIndexOf(`
27
+ `);if(Y>=0)return X.length-Y-1}return U.column+U.stop-U.start+1}return 0}nextToken(){if(this.i>=this.tokens.length){if(this.eofToken===null){let X=-1;if(this.tokens.length>0){let G=this.tokens[this.tokens.length-1].stop;if(G!==-1)X=G+1}let Y=Math.max(-1,X-1);this.eofToken=this.tokenFactory.create([this,this.inputStream],R.EOF,"EOF",R.DEFAULT_CHANNEL,X,Y,this.line,this.column)}return this.eofToken}let U=this.tokens[this.i];if(this.i===this.tokens.length-1&&U.type===R.EOF)this.eofToken=U;return this.i++,U}get line(){if(this.i<this.tokens.length)return this.tokens[this.i].line;if(this.eofToken!==null)return this.eofToken.line;if(this.tokens.length>0){let U=this.tokens[this.tokens.length-1],X=U.line,Y=U.text;if(Y){for(let G of Y)if(G===`
28
+ `)X++}return X}return 1}get inputStream(){if(this.i<this.tokens.length)return this.tokens[this.i].inputStream;if(this.eofToken!==null)return this.eofToken.inputStream;if(this.tokens.length>0)return this.tokens[this.tokens.length-1].inputStream;return null}getSourceName(){if(this.sourceName!==null)return this.sourceName;let U=this.inputStream;if(U!==null)return U.getSourceName();return"List"}},C8=class extends C{static{A(this,"InterpreterRuleContext")}#U;constructor(U,X,Y){super(X,Y);this.#U=U}get ruleIndex(){return this.#U}},f8=class{static{A(this,"TraceListener")}parser;constructor(U){this.parser=U}enterEveryRule(U){console.log("enter "+this.parser.ruleNames[U.ruleIndex]+", LT(1)="+this.parser.inputStream?.LT(1)?.text)}visitTerminal(U){console.log("consume "+U.getSymbol()+" rule "+this.parser.ruleNames[this.parser.context.ruleIndex])}exitEveryRule(U){console.log("exit "+this.parser.ruleNames[U.ruleIndex]+", LT(1)="+this.parser.inputStream?.LT(1)?.text)}visitErrorNode(U){}},_4=class extends c6{static{A(this,"Parser")}printer=null;buildParseTrees=!0;errorHandler=new i6;context=null;precedenceStack=[];parseListeners=null;syntaxErrors=0;matchedEOF=!1;tracer=null;bypassAltsAtnCache=null;#U;constructor(U){super();this.precedenceStack.push(0),this.syntaxErrors=0,this.#U=U}reset(U=!0){if(U)this.inputStream.seek(0);if(this.errorHandler.reset(this),this.context=null,this.syntaxErrors=0,this.matchedEOF=!1,this.setTrace(!1),this.precedenceStack=[],this.precedenceStack.push(0),this.interpreter)this.interpreter.reset()}match(U){let X=this.getCurrentToken();if(X.type===U){if(U===R.EOF)this.matchedEOF=!0;this.errorHandler.reportMatch(this),this.consume()}else if(X=this.errorHandler.recoverInline(this),this.buildParseTrees&&X.tokenIndex===-1)this.context.addErrorNode(this.createErrorNode(this.context,X));return X}matchWildcard(){let U=this.getCurrentToken();if(U.type>0)this.errorHandler.reportMatch(this),this.consume();else if(U=this.errorHandler.recoverInline(this),this.buildParseTrees&&U.tokenIndex===-1)this.context.addErrorNode(this.createErrorNode(this.context,U));return U}getParseListeners(){return this.parseListeners??[]}addParseListener(U){if(U===null)throw Error("listener");if(this.parseListeners===null)this.parseListeners=[];this.parseListeners.push(U)}removeParseListener(U){if(this.parseListeners!==null&&U!==null){let X=this.parseListeners.indexOf(U);if(X>=0)this.parseListeners.splice(X,1);if(this.parseListeners.length===0)this.parseListeners=null}}removeParseListeners(){this.parseListeners=null}triggerEnterRuleEvent(){if(this.parseListeners!==null){let U=this.context;this.parseListeners.forEach((X)=>{X.enterEveryRule(U),U.enterRule(X)})}}triggerExitRuleEvent(){if(this.parseListeners!==null){let U=this.context;this.parseListeners.slice(0).reverse().forEach((X)=>{U.exitRule(X),X.exitEveryRule(U)})}}getTokenFactory(){return this.inputStream.tokenSource.tokenFactory}setTokenFactory(U){this.inputStream.tokenSource.tokenFactory=U}compileParseTreePattern(U,X,Y){if(!Y){if(this.tokenStream!==null){let $=this.tokenStream.tokenSource;if($ instanceof g0)Y=$}}if(!Y)throw Error("Parser can't discover a lexer to use");return new u8(Y,this).compile(U,X)}getATNWithBypassAlts(){let U=this.serializedATN;if(U===null)throw Error("The current parser does not support an ATN with bypass alternatives.");if(this.bypassAltsAtnCache!==null)return this.bypassAltsAtnCache;let X={readOnly:!1,verifyATN:!0,generateRuleBypassTransitions:!0};return this.bypassAltsAtnCache=new N1(X).deserialize(U),this.bypassAltsAtnCache}get numberOfSyntaxErrors(){return this.syntaxErrors}get inputStream(){return this.#U}set inputStream(U){this.tokenStream=U}get tokenStream(){return this.#U}set tokenStream(U){this.reset(!1),this.#U=U}getCurrentToken(){return this.inputStream.LT(1)}notifyErrorListeners(U,X,Y){if(X=X??null,Y=Y??null,X===null)X=this.getCurrentToken();this.syntaxErrors+=1;let{line:G,column:$}=X;this.errorListenerDispatch.syntaxError(this,X,G,$,U,Y)}consume(){let U=this.getCurrentToken();if(U.type!==R.EOF)this.tokenStream.consume();let X=this.parseListeners!==null&&this.parseListeners.length>0;if(this.buildParseTrees||X){let Y;if(this.errorHandler.inErrorRecoveryMode(this))Y=this.context.addErrorNode(this.createErrorNode(this.context,U));else Y=this.context.addTokenNode(U);if(X)this.parseListeners.forEach((G)=>{if(Y instanceof L2)G.visitErrorNode(Y);else G.visitTerminal(Y)})}return U}addContextToParseTree(){if(this.context?.parent)this.context.parent.addChild(this.context)}enterRule(U,X,Y){if(this.state=X,this.context=U,this.context.start=this.inputStream.LT(1),this.buildParseTrees)this.addContextToParseTree();this.triggerEnterRuleEvent()}exitRule(){if(this.matchedEOF)this.context.stop=this.inputStream.LT(1);else this.context.stop=this.inputStream.LT(-1);this.triggerExitRuleEvent(),this.state=this.context.invokingState,this.context=this.context.parent}enterOuterAlt(U,X){if(U.setAltNumber(X),this.buildParseTrees&&this.context!==U){if(this.context?.parent)this.context.parent.removeLastChild(),this.context.parent.addChild(U)}this.context=U}getPrecedence(){if(this.precedenceStack.length===0)return-1;return this.precedenceStack[this.precedenceStack.length-1]}enterRecursionRule(U,X,Y,G){this.state=X,this.precedenceStack.push(G),this.context=U,this.context.start=this.inputStream.LT(1),this.triggerEnterRuleEvent()}pushNewRecursionContext(U,X,Y){let G=this.context;if(G.parent=U,G.invokingState=X,G.stop=this.inputStream.LT(-1),this.context=U,this.context.start=G.start,this.buildParseTrees)this.context.addChild(G);this.triggerEnterRuleEvent()}unrollRecursionContexts(U){this.precedenceStack.pop(),this.context.stop=this.inputStream.LT(-1);let X=this.context,Y=this.getParseListeners();if(Y!==null&&Y.length>0)while(this.context!==U)this.triggerExitRuleEvent(),this.context=this.context.parent;else this.context=U;if(X.parent=U,this.buildParseTrees&&U!==null)U.addChild(X)}getInvokingContext(U){let X=this.context;while(X!==null){if(X.ruleIndex===U)return X;X=X.parent}return null}precpred(U,X){return X>=this.precedenceStack[this.precedenceStack.length-1]}isExpectedToken(U){let X=this.interpreter.atn,Y=this.context,G=X.states[this.state],$=X.nextTokens(G);if($.contains(U))return!0;if(!$.contains(R.EPSILON))return!1;while(Y!==null&&Y.invokingState>=0&&$.contains(R.EPSILON)){let J=X.states[Y.invokingState].transitions[0];if($=X.nextTokens(J.followState),$.contains(U))return!0;Y=Y.parent}if($.contains(R.EPSILON)&&U===R.EOF)return!0;else return!1}getExpectedTokens(){return this.interpreter.atn.getExpectedTokens(this.state,this.context)}getExpectedTokensWithinCurrentRule(){let U=this.interpreter.atn,X=U.states[this.state];return U.nextTokens(X)}getRuleIndex(U){return this.getRuleIndexMap().get(U)??-1}getRuleInvocationStack(U){if(U=U??null,U===null)U=this.context;let X=[];while(U!==null){let Y=U.ruleIndex;if(Y<0)X.push("n/a");else X.push(this.ruleNames[Y]);U=U.parent}return X}getDFAStrings(){return this.interpreter.decisionToDFA.toString()}dumpDFA(){let U=!1;for(let X of this.interpreter.decisionToDFA)if(X.length>0){if(U)console.log();if(this.printer)this.printer.println("Decision "+X.decision+":"),this.printer.print(X.toString(this.vocabulary));U=!0}}getSourceName(){return this.inputStream.getSourceName()}getParseInfo(){let U=this.interpreter;if(U instanceof i2)return new z8(U);return}setProfile(U){let X=this.interpreter,Y=X.predictionMode;if(U){if(!(X instanceof i2))this.interpreter=new i2(this)}else if(X instanceof i2){let G=X.sharedContextCache;if(G){let $=new k2(this,this.atn,X.decisionToDFA,G);this.interpreter=$}}this.interpreter.predictionMode=Y}setTrace(U){if(!U)this.removeParseListener(this.tracer),this.tracer=null;else{if(this.tracer!==null)this.removeParseListener(this.tracer);this.tracer=new f8(this),this.addParseListener(this.tracer)}}createTerminalNode(U,X){return new C0(X)}createErrorNode(U,X){return new L2(X)}},V8=class extends _4{static{A(this,"ParserInterpreter")}rootContext;overrideDecisionRoot=null;parentContextStack=[];overrideDecisionAlt=-1;overrideDecisionReached=!1;decisionToDFA;sharedContextCache=new E1;pushRecursionContextStates;#U=-1;#X=-1;#G;#Y;#$;#Z;constructor(U,X,Y,G,$){super($);this.#G=U,this.#Y=G,this.#$=Y.slice(0),this.#Z=X,this.pushRecursionContextStates=new x0;for(let Z of G.states)if(Z instanceof Z1&&Z.precedenceRuleDecision)this.pushRecursionContextStates.set(Z.stateNumber);this.decisionToDFA=G.decisionToState.map((Z,J)=>{return new o0(Z,J)}),this.interpreter=new k2(this,G,this.decisionToDFA,this.sharedContextCache)}reset(){super.reset(),this.overrideDecisionReached=!1,this.overrideDecisionRoot=null}get atn(){return this.#Y}get vocabulary(){return this.#Z}get ruleNames(){return this.#$}get grammarFileName(){return this.#G}get atnState(){return this.#Y.states[this.state]}parse(U){let X=this.#Y.ruleToStartState[U];if(this.rootContext=this.createInterpreterRuleContext(null,f.INVALID_STATE_NUMBER,U),X.isLeftRecursiveRule)this.enterRecursionRule(this.rootContext,X.stateNumber,U,0);else this.enterRule(this.rootContext,X.stateNumber,U);while(!0){let Y=this.atnState;switch(Y.constructor.stateType){case f.RULE_STOP:{if(this.context?.isEmpty())if(X.isLeftRecursiveRule){let G=this.context,$=this.parentContextStack.pop();return this.unrollRecursionContexts($[0]),G}else return this.exitRule(),this.rootContext;this.visitRuleStopState(Y);break}default:{try{this.visitState(Y)}catch(G){if(G instanceof V)this.state=this.#Y.ruleToStopState[Y.ruleIndex].stateNumber,this.errorHandler.reportError(this,G),this.recover(G);else throw G}break}}}}addDecisionOverride(U,X,Y){this.#U=U,this.#X=X,this.overrideDecisionAlt=Y}get overrideDecision(){return this.#U}get overrideDecisionInputIndex(){return this.#X}enterRecursionRule(U,X,Y,G){this.parentContextStack.push([this.context,U.invokingState]),super.enterRecursionRule(U,X,Y,G)}get serializedATN(){throw Error("The ParserInterpreter does not support the serializedATN property.")}visitState(U){let X=1;if(U instanceof j1)X=this.visitDecisionState(U);let Y=U.transitions[X-1];switch(Y.transitionType){case h.EPSILON:if(this.pushRecursionContextStates.get(U.stateNumber)&&Y.target.constructor.stateType!==f.LOOP_END){let F=this.parentContextStack[this.parentContextStack.length-1],_=this.createInterpreterRuleContext(F[0],F[1],this.context.ruleIndex);this.pushNewRecursionContext(_,this.#Y.ruleToStartState[U.ruleIndex].stateNumber,this.context.ruleIndex)}break;case h.ATOM:this.match(Y.label.minElement);break;case h.RANGE:case h.SET:case h.NOT_SET:if(!Y.matches(this.inputStream.LA(1),R.MIN_USER_TOKEN_TYPE,65535))this.recoverInline();this.matchWildcard();break;case h.WILDCARD:this.matchWildcard();break;case h.RULE:let G=Y.target,$=G.ruleIndex,Z=this.createInterpreterRuleContext(this.context,U.stateNumber,$);if(G.isLeftRecursiveRule)this.enterRecursionRule(Z,G.stateNumber,$,Y.precedence);else this.enterRule(Z,Y.target.stateNumber,$);break;case h.PREDICATE:let J=Y;if(!this.sempred(this.context,J.ruleIndex,J.predIndex))throw new M2(this);break;case h.ACTION:let Q=Y;this.action(this.context,Q.ruleIndex,Q.actionIndex);break;case h.PRECEDENCE:if(!this.precpred(this.context,Y.precedence)){let F=Y.precedence;throw new M2(this,`precpred(_ctx, ${F})`)}break;default:throw Error("UnsupportedOperationException: Unrecognized ATN transition type.")}this.state=Y.target.stateNumber}visitDecisionState(U){let X=1;if(U.transitions.length>1){this.errorHandler.sync(this);let Y=U.decision;if(Y===this.#U&&this.inputStream.index===this.#X&&!this.overrideDecisionReached)X=this.overrideDecisionAlt,this.overrideDecisionReached=!0;else X=this.interpreter.adaptivePredict(this.inputStream,Y,this.context)}return X}createInterpreterRuleContext(U,X,Y){return new C8(Y,U,X)}visitRuleStopState(U){if(this.#Y.ruleToStartState[U.ruleIndex].isLeftRecursiveRule){let[G,$]=this.parentContextStack.pop();this.unrollRecursionContexts(G),this.state=$}else this.exitRule();let Y=this.#Y.states[this.state].transitions[0];this.state=Y.followState.stateNumber}recover(U){let X=this.inputStream.index;if(this.errorHandler.recover(this,U),this.inputStream.index===X){let Y=U.offendingToken;if(!Y)throw Error("Expected exception to have an offending token");let G=Y.tokenSource,$=G?.inputStream??null,Z=[G,$];if(U instanceof H2){let J=U.getExpectedTokens();if(!J)throw Error("Expected the exception to provide expected tokens");let Q=R.INVALID_TYPE;if(J.length!==0)Q=J.minElement;let F=this.getTokenFactory().create(Z,Q,Y.text,R.DEFAULT_CHANNEL,-1,-1,Y.line,Y.column);this.context.addErrorNode(this.createErrorNode(this.context,F))}else{let J=this.getTokenFactory().create(Z,R.INVALID_TYPE,Y.text,R.DEFAULT_CHANNEL,-1,-1,Y.line,Y.column);this.context.addErrorNode(this.createErrorNode(this.context,J))}}}recoverInline(){return this.errorHandler.recoverInline(this)}},u6=class extends Map{static{A(this,"MultiMap")}map(U,X){let Y=this.get(U);if(!Y)Y=[],this.set(U,Y);Y.push(X)}getPairs(){let U=[];for(let X of this.keys()){let Y=this.get(X)??[];for(let G of Y)U.push([X,G])}return U}toString(){let U=[];return this.forEach((X,Y)=>{U.push(`${Y}=[${X.join(", ")}]`)}),`{${U.join(", ")}}`}},P8=class extends Error{static{A(this,"CannotInvokeStartRuleError")}constructor(U){super();this.cause=U}},v6=class{static{A(this,"RuleTagToken")}label;ruleName;bypassTokenType;constructor(U,X,Y){this.ruleName=U,this.bypassTokenType=X,this.label=Y}get channel(){return R.DEFAULT_CHANNEL}get text(){if(this.label!==void 0)return"<"+this.label+":"+this.ruleName+">";return"<"+this.ruleName+">"}get type(){return this.bypassTokenType}get line(){return 0}get column(){return-1}get tokenIndex(){return-1}get start(){return-1}get stop(){return-1}get tokenSource(){return null}get inputStream(){return null}toString(){return this.ruleName+":"+this.bypassTokenType}},b8=class extends Error{static{A(this,"StartRuleDoesNotConsumeFullPatternError")}},S6=class extends o6{static{A(this,"TagChunk")}tag;label;constructor(...U){let X,Y;if(U.length===1)Y=U[0];else X=U[0],Y=U[1];super();if(!Y)throw Error("tag cannot be null or empty");this.label=X,this.tag=Y}toString(){if(this.label!==void 0)return this.label+":"+this.tag;return this.tag}},T1=class extends o6{static{A(this,"TextChunk")}text;constructor(U){super();this.text=U}toString(){return"'"+this.text+"'"}},x6=class extends e2{static{A(this,"TokenTagToken")}tokenName;label;constructor(U,X,Y){super({type:X,source:e2.EMPTY_SOURCE});this.tokenName=U,this.label=Y}get text(){if(this.label!==void 0)return"<"+this.label+":"+this.tokenName+">";return"<"+this.tokenName+">"}toString(){return this.tokenName+":"+this.type}},u8=class{static{A(this,"ParseTreePatternMatcher")}start="<";stop=">";escape="\\";lexer;parser;constructor(U,X){this.lexer=U,this.parser=X}setDelimiters(U,X,Y){if(U===null||U.length===0)throw Error("start cannot be null or empty");if(X===null||X.length===0)throw Error("stop cannot be null or empty");this.start=U,this.stop=X,this.escape=Y}matches(...U){switch(U.length){case 2:{let[X,Y]=U,G=new u6;return this.matchImpl(X,Y.getPatternTree(),G)===null}case 3:{let[X,Y,G]=U,$=this.compile(Y,G);return this.matches(X,$)}default:throw Error("Invalid number of arguments")}}match(...U){switch(U.length){case 2:{let[X,Y]=U,G=new u6,$=this.matchImpl(X,Y.getPatternTree(),G);return new k8(X,Y,G,$)}case 3:{let[X,Y,G]=U,$=this.compile(Y,G);return this.match(X,$)}default:throw Error("Invalid number of arguments")}}compile(U,X){let Y=this.tokenize(U),G=new E8(Y),$=new G3(G),Z=new V8(this.parser.grammarFileName,this.parser.vocabulary,this.parser.ruleNames,this.parser.getATNWithBypassAlts(),$);Z.removeErrorListeners();let J=null;try{Z.errorHandler=new h8,J=Z.parse(X)}catch(Q){if(Q instanceof J4)throw Q.cause;else if(Q instanceof V)throw Q;else if(Q instanceof Error)throw new P8(Q);else throw Q}if($.LA(1)!==R.EOF)throw new b8;return new O8(this,U,X,J)}getLexer(){return this.lexer}getParser(){return this.parser}tokenize(U){let X=this.split(U),Y=[];for(let G of X)if(G instanceof S6){let $=G,Z=$.tag[0];if(Z===Z.toUpperCase()){let J=this.parser.getTokenType($.tag);if(J===R.INVALID_TYPE)throw Error("Unknown token "+$.tag+" in pattern: "+U);let Q=new x6($.tag,J,$.label);Y.push(Q)}else if(Z===Z.toLowerCase()){let J=this.parser.getRuleIndex($.tag);if(J===-1)throw Error("Unknown rule "+$.tag+" in pattern: "+U);let Q=this.parser.getATNWithBypassAlts().ruleToTokenType[J];Y.push(new v6($.tag,Q,$.label))}else throw Error("invalid tag: "+$.tag+" in pattern: "+U)}else{let $=G,Z=H0.fromString($.text);this.lexer.inputStream=Z;let J=this.lexer.nextToken();while(J.type!==R.EOF)Y.push(J),J=this.lexer.nextToken()}return Y}split(U){let X=0,Y=U.length,G=[],$=[],Z=[];while(X<Y)if(X===U.indexOf(this.escape+this.start,X))X+=this.escape.length+this.start.length;else if(X===U.indexOf(this.escape+this.stop,X))X+=this.escape.length+this.stop.length;else if(X===U.indexOf(this.start,X))$.push(X),X+=this.start.length;else if(X===U.indexOf(this.stop,X))Z.push(X),X+=this.stop.length;else X++;if($.length>Z.length)throw Error("unterminated tag in pattern: "+U);if($.length<Z.length)throw Error("missing start tag in pattern: "+U);let J=$.length;for(let Q=0;Q<J;Q++)if($[Q]>=Z[Q])throw Error("tag delimiters out of order in pattern: "+U);if(J===0){let Q=U.substring(0,Y);G.push(new T1(Q))}if(J>0&&$[0]>0){let Q=U.substring(0,$[0]);G.push(new T1(Q))}for(let Q=0;Q<J;Q++){let F=U.substring($[Q]+this.start.length,Z[Q]),_=F,I,H=F.indexOf(":");if(H>=0)I=F.substring(0,H),_=F.substring(H+1,F.length);if(G.push(new S6(I,_)),Q+1<J){let j=U.substring(Z[Q]+this.stop.length,$[Q+1]);G.push(new T1(j))}}if(J>0){let Q=Z[J-1]+this.stop.length;if(Q<Y){let F=U.substring(Q,Y);G.push(new T1(F))}}for(let Q=0;Q<G.length;Q++){let F=G[Q];if(F instanceof T1){let _=F,I=_.text.replaceAll(this.escape,"");if(I.length<_.text.length)G[Q]=new T1(I)}}return G}matchImpl(U,X,Y){if(U instanceof C0&&X instanceof C0){let G=U,$=X,Z;if(G.getSymbol().type===$.getSymbol().type){if($.getSymbol()instanceof x6){let J=$.getSymbol();if(Y.map(J.tokenName,U),J.label!==void 0)Y.map(J.label,U)}else if(G.getText()===$.getText());else if(!Z)Z=G}else if(!Z)Z=G;return Z}if(U instanceof C&&X instanceof C){let G,$=this.getRuleTagToken(X);if($){if(U.ruleIndex===X.ruleIndex){if(Y.map($.ruleName,U),$.label)Y.map($.label,U)}else if(!G)G=U;return G}if(U.getChildCount()!==X.getChildCount()){if(!G)G=U;return G}let Z=U.getChildCount();for(let J=0;J<Z;J++){let Q=this.matchImpl(U.getChild(J),X.getChild(J),Y);if(Q)return Q}return G}return U}getRuleTagToken(U){if(U instanceof C){if(U.getChildCount()===1&&U.getChild(0)instanceof C0){let X=U.getChild(0);if(X.getSymbol()instanceof v6)return X.getSymbol()}}return}},YY=class extends Y3{static{A(this,"DiagnosticErrorListener")}exactOnly;constructor(U){super();this.exactOnly=U??!0}reportAmbiguity=A((U,X,Y,G,$,Z,J)=>{if(this.exactOnly&&!$)return;let Q=this.getDecisionDescription(U,X),F=this.getConflictingAlts(Z,J),_=U.tokenStream?.getTextFromInterval(v.of(Y,G)),I=`reportAmbiguity d=${Q}: ambigAlts=${F}, input='${_}'`;U.notifyErrorListeners(I,null,null)},"reportAmbiguity");reportAttemptingFullContext=A((U,X,Y,G,$,Z)=>{let J=this.getDecisionDescription(U,X),Q=U.tokenStream?.getTextFromInterval(v.of(Y,G)),F=`reportAttemptingFullContext d=${J}, input='${Q}'`;U.notifyErrorListeners(F,null,null)},"reportAttemptingFullContext");reportContextSensitivity=A((U,X,Y,G,$,Z)=>{let J=this.getDecisionDescription(U,X),Q=U.tokenStream?.getTextFromInterval(v.of(Y,G)),F=`reportContextSensitivity d=${J}, input='${Q}'`;U.notifyErrorListeners(F,null,null)},"reportContextSensitivity");getDecisionDescription=A((U,X)=>{let Y=X.decision,G=X.atnStartState.ruleIndex,$=U.ruleNames;if(G<0||G>=$.length)return Y.toString();let Z=$[G];if(Z.length===0)return Y.toString();return`${Y} (${Z})`},"getDecisionDescription");getConflictingAlts=A((U,X)=>{if(U)return U;let Y=new x0;for(let G=0;G<X.configs.length;G++)Y.set(X.configs[G].alt);return Y},"getConflictingAlts")},GY=class extends g0{static{A(this,"LexerInterpreter")}decisionToDFA;sharedContextCache=new E1;#U;#X;#G;#Y;#$;#Z;constructor(U,X,Y,G,$,Z,J){super(J);if(Z.grammarType!==b.LEXER)throw Error("IllegalArgumentException: The ATN must be a lexer ATN.");this.#U=U,this.#X=Z,this.#G=Y.slice(0),this.#Y=G.slice(0),this.#$=$.slice(0),this.#Z=X,this.decisionToDFA=Z.decisionToState.map((Q,F)=>{return new o0(Q,F)}),this.interpreter=new s1(this,Z,this.decisionToDFA,this.sharedContextCache)}get atn(){return this.#X}get grammarFileName(){return this.#U}get ruleNames(){return this.#G}get channelNames(){return this.#Y}get modeNames(){return this.#$}get vocabulary(){return this.#Z}get serializedATN(){throw Error("The LexerInterpreter does not support the serializedATN property.")}},$Y=class U{static{A(this,"RuntimeMetaData")}static VERSION="4.13.1";static getRuntimeVersion(){return U.VERSION}static checkVersion(X,Y){let G=U.VERSION,$=!1,Z=!1;if($=G!==X&&U.getMajorMinorVersion(G)!==U.getMajorMinorVersion(X),Z=G!==Y&&U.getMajorMinorVersion(G)!==U.getMajorMinorVersion(Y),$)console.error(`ANTLR Tool version ${X} used for code generation does not match the current runtime version ${G}`);if(Z)console.error(`ANTLR Runtime version ${Y} used for parser compilation does not match the current runtime version ${G}`)}static getMajorMinorVersion(X){let Y=X.indexOf("."),G=Y>=0?X.indexOf(".",Y+1):-1,$=X.indexOf("-"),Z=X.length;if(G>=0)Z=Math.min(Z,G);if($>=0)Z=Math.min(Z,$);return X.substring(0,Z)}},ZY=class U{static{A(this,"TokenStreamRewriter")}static DEFAULT_PROGRAM_NAME="default";static PROGRAM_INIT_SIZE=100;static MIN_TOKEN_INDEX=0;tokens;programs=new Map;lastRewriteTokenIndexes;constructor(X){this.tokens=X}getTokenStream(){return this.tokens}insertAfter(X,Y,G=U.DEFAULT_PROGRAM_NAME){let $;if(typeof X==="number")$=X;else $=X.tokenIndex;let Z=this.getProgram(G),J=new g6(this.tokens,$,Z.length,Y);Z.push(J)}insertBefore(X,Y,G=U.DEFAULT_PROGRAM_NAME){let $;if(typeof X==="number")$=X;else $=X.tokenIndex;let Z=this.getProgram(G),J=new l1(this.tokens,$,Z.length,Y);Z.push(J)}replaceSingle(X,Y,G=U.DEFAULT_PROGRAM_NAME){this.replace(X,X,Y,G)}replace(X,Y,G,$=U.DEFAULT_PROGRAM_NAME){if(typeof X!=="number")X=X.tokenIndex;if(typeof Y!=="number")Y=Y.tokenIndex;if(X>Y||X<0||Y<0||Y>=this.tokens.size)throw RangeError(`replace: range invalid: ${X}..${Y}(size=${this.tokens.size})`);let Z=this.getProgram($),J=new t2(this.tokens,X,Y,Z.length,G);Z.push(J)}delete(X,Y,G=U.DEFAULT_PROGRAM_NAME){if(Y==null)Y=X;this.replace(X,Y,null,G)}getProgram(X){let Y=this.programs.get(X);if(Y==null)Y=this.initializeProgram(X);return Y}initializeProgram(X){let Y=[];return this.programs.set(X,Y),Y}getText(X,Y=U.DEFAULT_PROGRAM_NAME){let G;if(X instanceof v)G=X;else G=new v(0,this.tokens.size-1);if(typeof X==="string")Y=X;let $=this.programs.get(Y),Z=G.start,J=G.stop;if(J>this.tokens.size-1)J=this.tokens.size-1;if(Z<0)Z=0;if($==null||$.length===0)return this.tokens.getTextFromInterval(new v(Z,J));let Q=[],F=this.reduceToSingleOperationPerIndex($),_=Z;while(_<=J&&_<this.tokens.size){let I=F.get(_);F.delete(_);let H=this.tokens.get(_);if(I==null){if(H.type!==R.EOF)Q.push(String(H.text));_++}else _=I.execute(Q)}if(J===this.tokens.size-1){for(let I of F.values())if(I&&I.index>=this.tokens.size-1)Q.push(String(I.text))}return Q.join("")}reduceToSingleOperationPerIndex(X){for(let G=0;G<X.length;G++){let $=X[G];if($==null)continue;if(!($ instanceof t2))continue;let Z=$,J=this.getKindOfOps(X,l1,G);for(let F of J)if(F.index===Z.index)X[F.instructionIndex]=null,Z.text=String(F.text)+(Z.text!=null?Z.text.toString():"");else if(F.index>Z.index&&F.index<=Z.lastIndex)X[F.instructionIndex]=null;let Q=this.getKindOfOps(X,t2,G);for(let F of Q){if(F.index>=Z.index&&F.lastIndex<=Z.lastIndex){X[F.instructionIndex]=null;continue}let _=F.lastIndex<Z.index||F.index>Z.lastIndex;if(F.text==null&&Z.text==null&&!_)X[F.instructionIndex]=null,Z.index=Math.min(F.index,Z.index),Z.lastIndex=Math.max(F.lastIndex,Z.lastIndex);else if(!_)throw Error(`replace op boundaries of ${Z} overlap with previous ${F}`)}}for(let G=0;G<X.length;G++){let $=X[G];if($==null)continue;if(!($ instanceof l1))continue;let Z=$,J=this.getKindOfOps(X,l1,G);for(let F of J)if(F.index===Z.index){if(F instanceof g6)Z.text=this.catOpText(F.text,Z.text),X[F.instructionIndex]=null;else if(F instanceof l1)Z.text=this.catOpText(Z.text,F.text),X[F.instructionIndex]=null}let Q=this.getKindOfOps(X,t2,G);for(let F of Q){if(Z.index===F.index){F.text=this.catOpText(Z.text,F.text),X[G]=null;continue}if(Z.index>=F.index&&Z.index<=F.lastIndex)throw Error(`insert op ${Z} within boundaries of previous ${F}`)}}let Y=new Map;for(let G of X){if(G==null)continue;if(Y.get(G.index)!=null)throw Error("should only be one op per index");Y.set(G.index,G)}return Y}catOpText(X,Y){let G="",$="";if(X!=null)G=X.toString();if(Y!=null)$=Y.toString();return G+$}getKindOfOps(X,Y,G){return X.slice(0,G).filter(($)=>{return $&&$ instanceof Y})}},t6=class{static{A(this,"RewriteOperation")}instructionIndex;index;text;tokens;constructor(U,X,Y,G){this.tokens=U,this.instructionIndex=Y,this.index=X,this.text=G===void 0?"":G}execute(U){return this.index}toString(){return"<RewriteOperation@"+this.tokens.get(this.index)+':"'+this.text+'">'}},l1=class extends t6{static{A(this,"InsertBeforeOp")}constructor(U,X,Y,G){super(U,X,Y,G)}execute(U){if(this.text)U.push(this.text.toString());if(this.tokens.get(this.index).type!==R.EOF)U.push(String(this.tokens.get(this.index).text));return this.index+1}toString(){return"<InsertBeforeOp@"+this.tokens.get(this.index)+':"'+this.text+'">'}},g6=class extends l1{static{A(this,"InsertAfterOp")}constructor(U,X,Y,G){super(U,X+1,Y,G)}toString(){return"<InsertAfterOp@"+this.tokens.get(this.index)+':"'+this.text+'">'}},t2=class extends t6{static{A(this,"ReplaceOp")}lastIndex;constructor(U,X,Y,G,$){super(U,X,G,$);this.lastIndex=Y}execute(U){if(this.text)U.push(this.text.toString());return this.lastIndex+1}toString(){if(this.text==null)return"<DeleteOp@"+this.tokens.get(this.index)+".."+this.tokens.get(this.lastIndex)+">";return"<ReplaceOp@"+this.tokens.get(this.index)+".."+this.tokens.get(this.lastIndex)+':"'+this.text+'">'}},JY=class{static{A(this,"UnbufferedTokenStream")}tokenSource;tokens;n;p=0;numMarkers=0;lastToken;lastTokenBufferStart;currentTokenIndex=0;constructor(U,X){this.tokenSource=U,X=X??256,this.tokens=Array(X),this.n=0,this.fill(1)}get(U){let X=this.getBufferStartIndex();if(U<X||U>=X+this.n)throw Error("get("+U+") outside buffer: "+X+".."+(X+this.n));return this.tokens[U-X]}LT(U){if(U===-1)return this.lastToken;this.sync(U);let X=this.p+U-1;if(X<0)throw Error("LT("+U+") gives negative index");if(X>=this.n)return this.tokens[this.n-1];return this.tokens[X]}LA(U){return this.LT(U).type}getText(){return""}getTextFromContext(U){return this.getTextFromInterval(U.getSourceInterval())}getTextFromInterval(U){let X=this.getBufferStartIndex(),Y=X+this.tokens.length-1,G=U.start,$=U.stop;if(G<X||$>Y)throw Error("interval "+U+" not in token buffer window: "+X+".."+Y);let Z=G-X,J=$-X,Q="";for(let F=Z;F<=J;F++){let _=this.tokens[F];Q+=_.text}return Q}getTextFromRange(U,X){return this.getTextFromInterval(v.of(U.tokenIndex,X.tokenIndex))}consume(){if(this.LA(1)===R.EOF)throw Error("cannot consume EOF");if(this.lastToken=this.tokens[this.p],this.p===this.n-1&&this.numMarkers===0)this.n=0,this.p=-1,this.lastTokenBufferStart=this.lastToken;this.p++,this.currentTokenIndex++,this.sync(1)}mark(){if(this.numMarkers===0)this.lastTokenBufferStart=this.lastToken;let U=-this.numMarkers-1;return this.numMarkers++,U}release(U){let X=-this.numMarkers;if(U!==X)throw Error("release() called with an invalid marker.");if(this.numMarkers--,this.numMarkers===0){if(this.p>0)this.tokens.copyWithin(0,this.p,this.n),this.n=this.n-this.p,this.p=0;this.lastTokenBufferStart=this.lastToken}}get index(){return this.currentTokenIndex}seek(U){if(U===this.currentTokenIndex)return;if(U>this.currentTokenIndex)this.sync(U-this.currentTokenIndex),U=Math.min(U,this.getBufferStartIndex()+this.n-1);let X=this.getBufferStartIndex(),Y=U-X;if(Y<0)throw Error("cannot seek to negative index "+U);else if(Y>=this.n)throw Error("seek to index outside buffer: "+U+" not in "+X+".."+(X+this.n));if(this.p=Y,this.currentTokenIndex=U,this.p===0)this.lastToken=this.lastTokenBufferStart;else this.lastToken=this.tokens[this.p-1]}get size(){throw Error("Unbuffered stream cannot know its size")}getSourceName(){return this.tokenSource.sourceName}setLine(U){this.tokenSource.line=U}setColumn(U){this.tokenSource.column=U}sync(U){let X=this.p+U-1-this.n+1;if(X>0)this.fill(X)}fill(U){for(let X=0;X<U;X++){if(this.n>0&&this.tokens[this.n-1].type===R.EOF)return X;let Y=this.tokenSource.nextToken();this.add(Y)}return U}add(U){if(this.n>=this.tokens.length)this.tokens.length=this.tokens.length*2;if(p6(U))U.setTokenIndex(this.getBufferStartIndex()+this.n);this.tokens[this.n++]=U}getBufferStartIndex(){return this.currentTokenIndex-this.p}};class c extends g0{static LPAREN=1;static RPAREN=2;static COLON=3;static SEMICOLON=4;static COMMA=5;static LBRACK=6;static RBRACK=7;static LBRACE=8;static RBRACE=9;static PLUS=10;static MINUS=11;static MUL=12;static DIV=13;static DOTMOD=14;static MOD=15;static AND=16;static OR=17;static EQ=18;static EXCL=19;static DOLLAR=20;static CARET=21;static TILDE=22;static AT=23;static GT=24;static GTE=25;static LT=26;static LTE=27;static IF=28;static ELSE=29;static WHILE=30;static CASE=31;static DEFAULT=32;static RETURN=33;static CALC=34;static TYPE_ARRAY=35;static DEF_TYPE=36;static SWITCH_TYPE=37;static INTEGER_LITERAL=38;static HEX_LITERAL=39;static COORD_LITERAL=40;static MAPZONE_LITERAL=41;static BOOLEAN_LITERAL=42;static CHAR_LITERAL=43;static NULL_LITERAL=44;static LINE_COMMENT=45;static BLOCK_COMMENT=46;static QUOTE_OPEN=47;static IDENTIFIER=48;static WHITESPACE=49;static QUOTE_CLOSE=50;static STRING_TEXT=51;static STRING_TAG=52;static STRING_CLOSE_TAG=53;static STRING_PARTIAL_TAG=54;static STRING_P_TAG=55;static STRING_EXPR_START=56;static STRING_EXPR_END=57;static String=1;static channelNames=["DEFAULT_TOKEN_CHANNEL","HIDDEN"];static literalNames=[null,"'('","')'","':'","';'","','","'['","']'","'{'","'}'","'+'","'-'","'*'","'/'","'.%'","'%'","'&'","'|'","'='","'!'","'$'","'^'","'~'","'@'",null,"'>='",null,"'<='","'if'","'else'","'while'","'case'","'default'","'return'","'calc'",null,null,null,null,null,null,null,null,null,"'null'"];static symbolicNames=[null,"LPAREN","RPAREN","COLON","SEMICOLON","COMMA","LBRACK","RBRACK","LBRACE","RBRACE","PLUS","MINUS","MUL","DIV","DOTMOD","MOD","AND","OR","EQ","EXCL","DOLLAR","CARET","TILDE","AT","GT","GTE","LT","LTE","IF","ELSE","WHILE","CASE","DEFAULT","RETURN","CALC","TYPE_ARRAY","DEF_TYPE","SWITCH_TYPE","INTEGER_LITERAL","HEX_LITERAL","COORD_LITERAL","MAPZONE_LITERAL","BOOLEAN_LITERAL","CHAR_LITERAL","NULL_LITERAL","LINE_COMMENT","BLOCK_COMMENT","QUOTE_OPEN","IDENTIFIER","WHITESPACE","QUOTE_CLOSE","STRING_TEXT","STRING_TAG","STRING_CLOSE_TAG","STRING_PARTIAL_TAG","STRING_P_TAG","STRING_EXPR_START","STRING_EXPR_END"];static modeNames=["DEFAULT_MODE","String"];static ruleNames=["LPAREN","RPAREN","COLON","SEMICOLON","COMMA","LBRACK","RBRACK","LBRACE","RBRACE","PLUS","MINUS","MUL","DIV","DOTMOD","MOD","AND","OR","EQ","EXCL","DOLLAR","CARET","TILDE","AT","GT","GTE","LT","LTE","IF","ELSE","WHILE","CASE","DEFAULT","RETURN","CALC","TYPE_ARRAY","DEF_TYPE","SWITCH_TYPE","INTEGER_LITERAL","HEX_LITERAL","COORD_LITERAL","MAPZONE_LITERAL","BOOLEAN_LITERAL","CHAR_LITERAL","NULL_LITERAL","LINE_COMMENT","BLOCK_COMMENT","Digit","CharEscapeSequence","QUOTE_OPEN","IDENTIFIER","WHITESPACE","QUOTE_CLOSE","STRING_TEXT","STRING_TAG","STRING_CLOSE_TAG","STRING_PARTIAL_TAG","STRING_P_TAG","STRING_EXPR_START","STRING_EXPR_END","StringEscapeSequence","Tag"];depth=0;constructor(U){super(U);this.interpreter=new s1(this,c._ATN,c.decisionsToDFA,new E1)}get grammarFileName(){return"RuneScriptLexer.g4"}get literalNames(){return c.literalNames}get symbolicNames(){return c.symbolicNames}get ruleNames(){return c.ruleNames}get serializedATN(){return c._serializedATN}get channelNames(){return c.channelNames}get modeNames(){return c.modeNames}action(U,X,Y){switch(X){case 23:this.GT_action(U,Y);break;case 48:this.QUOTE_OPEN_action(U,Y);break;case 51:this.QUOTE_CLOSE_action(U,Y);break}}GT_action(U,X){switch(X){case 0:if(this.depth>0)this.type=c.STRING_EXPR_END,this.popMode();break}}QUOTE_OPEN_action(U,X){switch(X){case 1:this.depth++;break}}QUOTE_CLOSE_action(U,X){switch(X){case 2:this.depth--;break}}static _serializedATN=[4,0,57,456,6,-1,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2,33,7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2,39,7,39,2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45,7,45,2,46,7,46,2,47,7,47,2,48,7,48,2,49,7,49,2,50,7,50,2,51,7,51,2,52,7,52,2,53,7,53,2,54,7,54,2,55,7,55,2,56,7,56,2,57,7,57,2,58,7,58,2,59,7,59,2,60,7,60,1,0,1,0,1,1,1,1,1,2,1,2,1,3,1,3,1,4,1,4,1,5,1,5,1,6,1,6,1,7,1,7,1,8,1,8,1,9,1,9,1,10,1,10,1,11,1,11,1,12,1,12,1,13,1,13,1,13,1,14,1,14,1,15,1,15,1,16,1,16,1,17,1,17,1,18,1,18,1,19,1,19,1,20,1,20,1,21,1,21,1,22,1,22,1,23,1,23,1,23,1,24,1,24,1,24,1,25,1,25,1,26,1,26,1,26,1,27,1,27,1,27,1,28,1,28,1,28,1,28,1,28,1,29,1,29,1,29,1,29,1,29,1,29,1,30,1,30,1,30,1,30,1,30,1,31,1,31,1,31,1,31,1,31,1,31,1,31,1,31,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,33,1,33,1,33,1,33,1,33,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,35,1,35,1,35,1,35,1,35,1,35,1,35,1,36,1,36,1,36,1,36,1,36,1,36,1,36,1,36,1,36,1,36,1,37,3,37,247,8,37,1,37,4,37,250,8,37,11,37,12,37,251,1,38,1,38,1,38,4,38,257,8,38,11,38,12,38,258,1,39,4,39,262,8,39,11,39,12,39,263,1,39,1,39,4,39,268,8,39,11,39,12,39,269,1,39,1,39,4,39,274,8,39,11,39,12,39,275,1,39,1,39,4,39,280,8,39,11,39,12,39,281,1,39,1,39,4,39,286,8,39,11,39,12,39,287,1,40,4,40,291,8,40,11,40,12,40,292,1,40,1,40,4,40,297,8,40,11,40,12,40,298,1,40,1,40,4,40,303,8,40,11,40,12,40,304,1,41,1,41,1,41,1,41,1,41,1,41,1,41,1,41,1,41,3,41,316,8,41,1,42,1,42,1,42,3,42,321,8,42,1,42,1,42,1,43,1,43,1,43,1,43,1,43,1,44,1,44,1,44,1,44,5,44,334,8,44,10,44,12,44,337,9,44,1,44,3,44,340,8,44,1,44,1,44,1,45,1,45,1,45,1,45,5,45,348,8,45,10,45,12,45,351,9,45,1,45,1,45,1,45,1,45,1,45,1,46,1,46,1,47,1,47,1,47,1,48,1,48,1,48,1,48,1,48,1,49,4,49,369,8,49,11,49,12,49,370,1,50,4,50,374,8,50,11,50,12,50,375,1,50,1,50,1,51,1,51,1,51,1,51,1,51,1,52,1,52,4,52,387,8,52,11,52,12,52,388,3,52,391,8,52,1,53,1,53,1,53,1,53,4,53,397,8,53,11,53,12,53,398,3,53,401,8,53,1,53,1,53,1,54,1,54,1,54,1,54,1,54,1,54,1,55,1,55,1,55,1,55,1,56,1,56,1,56,1,56,1,56,4,56,420,8,56,11,56,12,56,421,1,56,1,56,1,57,1,57,1,57,1,57,1,58,1,58,1,59,1,59,1,59,1,60,1,60,1,60,1,60,1,60,1,60,1,60,1,60,1,60,1,60,1,60,1,60,1,60,1,60,1,60,1,60,1,60,1,60,1,60,1,60,3,60,455,8,60,2,335,349,0,61,2,1,4,2,6,3,8,4,10,5,12,6,14,7,16,8,18,9,20,10,22,11,24,12,26,13,28,14,30,15,32,16,34,17,36,18,38,19,40,20,42,21,44,22,46,23,48,24,50,25,52,26,54,27,56,28,58,29,60,30,62,31,64,32,66,33,68,34,70,35,72,36,74,37,76,38,78,39,80,40,82,41,84,42,86,43,88,44,90,45,92,46,94,0,96,0,98,47,100,48,102,49,104,50,106,51,108,52,110,53,112,54,114,55,116,56,118,57,120,0,122,0,2,0,1,11,2,0,88,88,120,120,3,0,48,57,65,70,97,102,4,0,10,10,13,13,39,39,92,92,1,1,10,10,1,0,48,57,2,0,39,39,92,92,6,0,43,43,46,46,48,58,65,90,95,95,97,122,3,0,9,10,13,13,32,32,5,0,10,10,13,13,34,34,60,60,92,92,2,0,60,60,62,62,3,0,34,34,60,60,92,92,479,0,2,1,0,0,0,0,4,1,0,0,0,0,6,1,0,0,0,0,8,1,0,0,0,0,10,1,0,0,0,0,12,1,0,0,0,0,14,1,0,0,0,0,16,1,0,0,0,0,18,1,0,0,0,0,20,1,0,0,0,0,22,1,0,0,0,0,24,1,0,0,0,0,26,1,0,0,0,0,28,1,0,0,0,0,30,1,0,0,0,0,32,1,0,0,0,0,34,1,0,0,0,0,36,1,0,0,0,0,38,1,0,0,0,0,40,1,0,0,0,0,42,1,0,0,0,0,44,1,0,0,0,0,46,1,0,0,0,0,48,1,0,0,0,0,50,1,0,0,0,0,52,1,0,0,0,0,54,1,0,0,0,0,56,1,0,0,0,0,58,1,0,0,0,0,60,1,0,0,0,0,62,1,0,0,0,0,64,1,0,0,0,0,66,1,0,0,0,0,68,1,0,0,0,0,70,1,0,0,0,0,72,1,0,0,0,0,74,1,0,0,0,0,76,1,0,0,0,0,78,1,0,0,0,0,80,1,0,0,0,0,82,1,0,0,0,0,84,1,0,0,0,0,86,1,0,0,0,0,88,1,0,0,0,0,90,1,0,0,0,0,92,1,0,0,0,0,98,1,0,0,0,0,100,1,0,0,0,0,102,1,0,0,0,1,104,1,0,0,0,1,106,1,0,0,0,1,108,1,0,0,0,1,110,1,0,0,0,1,112,1,0,0,0,1,114,1,0,0,0,1,116,1,0,0,0,1,118,1,0,0,0,2,124,1,0,0,0,4,126,1,0,0,0,6,128,1,0,0,0,8,130,1,0,0,0,10,132,1,0,0,0,12,134,1,0,0,0,14,136,1,0,0,0,16,138,1,0,0,0,18,140,1,0,0,0,20,142,1,0,0,0,22,144,1,0,0,0,24,146,1,0,0,0,26,148,1,0,0,0,28,150,1,0,0,0,30,153,1,0,0,0,32,155,1,0,0,0,34,157,1,0,0,0,36,159,1,0,0,0,38,161,1,0,0,0,40,163,1,0,0,0,42,165,1,0,0,0,44,167,1,0,0,0,46,169,1,0,0,0,48,171,1,0,0,0,50,174,1,0,0,0,52,177,1,0,0,0,54,179,1,0,0,0,56,182,1,0,0,0,58,185,1,0,0,0,60,190,1,0,0,0,62,196,1,0,0,0,64,201,1,0,0,0,66,209,1,0,0,0,68,216,1,0,0,0,70,221,1,0,0,0,72,228,1,0,0,0,74,235,1,0,0,0,76,246,1,0,0,0,78,253,1,0,0,0,80,261,1,0,0,0,82,290,1,0,0,0,84,315,1,0,0,0,86,317,1,0,0,0,88,324,1,0,0,0,90,329,1,0,0,0,92,343,1,0,0,0,94,357,1,0,0,0,96,359,1,0,0,0,98,362,1,0,0,0,100,368,1,0,0,0,102,373,1,0,0,0,104,379,1,0,0,0,106,390,1,0,0,0,108,392,1,0,0,0,110,404,1,0,0,0,112,410,1,0,0,0,114,414,1,0,0,0,116,425,1,0,0,0,118,429,1,0,0,0,120,431,1,0,0,0,122,454,1,0,0,0,124,125,5,40,0,0,125,3,1,0,0,0,126,127,5,41,0,0,127,5,1,0,0,0,128,129,5,58,0,0,129,7,1,0,0,0,130,131,5,59,0,0,131,9,1,0,0,0,132,133,5,44,0,0,133,11,1,0,0,0,134,135,5,91,0,0,135,13,1,0,0,0,136,137,5,93,0,0,137,15,1,0,0,0,138,139,5,123,0,0,139,17,1,0,0,0,140,141,5,125,0,0,141,19,1,0,0,0,142,143,5,43,0,0,143,21,1,0,0,0,144,145,5,45,0,0,145,23,1,0,0,0,146,147,5,42,0,0,147,25,1,0,0,0,148,149,5,47,0,0,149,27,1,0,0,0,150,151,5,46,0,0,151,152,5,37,0,0,152,29,1,0,0,0,153,154,5,37,0,0,154,31,1,0,0,0,155,156,5,38,0,0,156,33,1,0,0,0,157,158,5,124,0,0,158,35,1,0,0,0,159,160,5,61,0,0,160,37,1,0,0,0,161,162,5,33,0,0,162,39,1,0,0,0,163,164,5,36,0,0,164,41,1,0,0,0,165,166,5,94,0,0,166,43,1,0,0,0,167,168,5,126,0,0,168,45,1,0,0,0,169,170,5,64,0,0,170,47,1,0,0,0,171,172,5,62,0,0,172,173,6,23,0,0,173,49,1,0,0,0,174,175,5,62,0,0,175,176,5,61,0,0,176,51,1,0,0,0,177,178,5,60,0,0,178,53,1,0,0,0,179,180,5,60,0,0,180,181,5,61,0,0,181,55,1,0,0,0,182,183,5,105,0,0,183,184,5,102,0,0,184,57,1,0,0,0,185,186,5,101,0,0,186,187,5,108,0,0,187,188,5,115,0,0,188,189,5,101,0,0,189,59,1,0,0,0,190,191,5,119,0,0,191,192,5,104,0,0,192,193,5,105,0,0,193,194,5,108,0,0,194,195,5,101,0,0,195,61,1,0,0,0,196,197,5,99,0,0,197,198,5,97,0,0,198,199,5,115,0,0,199,200,5,101,0,0,200,63,1,0,0,0,201,202,5,100,0,0,202,203,5,101,0,0,203,204,5,102,0,0,204,205,5,97,0,0,205,206,5,117,0,0,206,207,5,108,0,0,207,208,5,116,0,0,208,65,1,0,0,0,209,210,5,114,0,0,210,211,5,101,0,0,211,212,5,116,0,0,212,213,5,117,0,0,213,214,5,114,0,0,214,215,5,110,0,0,215,67,1,0,0,0,216,217,5,99,0,0,217,218,5,97,0,0,218,219,5,108,0,0,219,220,5,99,0,0,220,69,1,0,0,0,221,222,3,100,49,0,222,223,5,97,0,0,223,224,5,114,0,0,224,225,5,114,0,0,225,226,5,97,0,0,226,227,5,121,0,0,227,71,1,0,0,0,228,229,5,100,0,0,229,230,5,101,0,0,230,231,5,102,0,0,231,232,5,95,0,0,232,233,1,0,0,0,233,234,3,100,49,0,234,73,1,0,0,0,235,236,5,115,0,0,236,237,5,119,0,0,237,238,5,105,0,0,238,239,5,116,0,0,239,240,5,99,0,0,240,241,5,104,0,0,241,242,5,95,0,0,242,243,1,0,0,0,243,244,3,100,49,0,244,75,1,0,0,0,245,247,5,45,0,0,246,245,1,0,0,0,246,247,1,0,0,0,247,249,1,0,0,0,248,250,3,94,46,0,249,248,1,0,0,0,250,251,1,0,0,0,251,249,1,0,0,0,251,252,1,0,0,0,252,77,1,0,0,0,253,254,5,48,0,0,254,256,7,0,0,0,255,257,7,1,0,0,256,255,1,0,0,0,257,258,1,0,0,0,258,256,1,0,0,0,258,259,1,0,0,0,259,79,1,0,0,0,260,262,3,94,46,0,261,260,1,0,0,0,262,263,1,0,0,0,263,261,1,0,0,0,263,264,1,0,0,0,264,265,1,0,0,0,265,267,5,95,0,0,266,268,3,94,46,0,267,266,1,0,0,0,268,269,1,0,0,0,269,267,1,0,0,0,269,270,1,0,0,0,270,271,1,0,0,0,271,273,5,95,0,0,272,274,3,94,46,0,273,272,1,0,0,0,274,275,1,0,0,0,275,273,1,0,0,0,275,276,1,0,0,0,276,277,1,0,0,0,277,279,5,95,0,0,278,280,3,94,46,0,279,278,1,0,0,0,280,281,1,0,0,0,281,279,1,0,0,0,281,282,1,0,0,0,282,283,1,0,0,0,283,285,5,95,0,0,284,286,3,94,46,0,285,284,1,0,0,0,286,287,1,0,0,0,287,285,1,0,0,0,287,288,1,0,0,0,288,81,1,0,0,0,289,291,3,94,46,0,290,289,1,0,0,0,291,292,1,0,0,0,292,290,1,0,0,0,292,293,1,0,0,0,293,294,1,0,0,0,294,296,5,95,0,0,295,297,3,94,46,0,296,295,1,0,0,0,297,298,1,0,0,0,298,296,1,0,0,0,298,299,1,0,0,0,299,300,1,0,0,0,300,302,5,95,0,0,301,303,3,94,46,0,302,301,1,0,0,0,303,304,1,0,0,0,304,302,1,0,0,0,304,305,1,0,0,0,305,83,1,0,0,0,306,307,5,116,0,0,307,308,5,114,0,0,308,309,5,117,0,0,309,316,5,101,0,0,310,311,5,102,0,0,311,312,5,97,0,0,312,313,5,108,0,0,313,314,5,115,0,0,314,316,5,101,0,0,315,306,1,0,0,0,315,310,1,0,0,0,316,85,1,0,0,0,317,320,5,39,0,0,318,321,3,96,47,0,319,321,8,2,0,0,320,318,1,0,0,0,320,319,1,0,0,0,321,322,1,0,0,0,322,323,5,39,0,0,323,87,1,0,0,0,324,325,5,110,0,0,325,326,5,117,0,0,326,327,5,108,0,0,327,328,5,108,0,0,328,89,1,0,0,0,329,330,5,47,0,0,330,331,5,47,0,0,331,335,1,0,0,0,332,334,9,0,0,0,333,332,1,0,0,0,334,337,1,0,0,0,335,336,1,0,0,0,335,333,1,0,0,0,336,339,1,0,0,0,337,335,1,0,0,0,338,340,7,3,0,0,339,338,1,0,0,0,340,341,1,0,0,0,341,342,6,44,1,0,342,91,1,0,0,0,343,344,5,47,0,0,344,345,5,42,0,0,345,349,1,0,0,0,346,348,9,0,0,0,347,346,1,0,0,0,348,351,1,0,0,0,349,350,1,0,0,0,349,347,1,0,0,0,350,352,1,0,0,0,351,349,1,0,0,0,352,353,5,42,0,0,353,354,5,47,0,0,354,355,1,0,0,0,355,356,6,45,1,0,356,93,1,0,0,0,357,358,7,4,0,0,358,95,1,0,0,0,359,360,5,92,0,0,360,361,7,5,0,0,361,97,1,0,0,0,362,363,5,34,0,0,363,364,6,48,2,0,364,365,1,0,0,0,365,366,6,48,3,0,366,99,1,0,0,0,367,369,7,6,0,0,368,367,1,0,0,0,369,370,1,0,0,0,370,368,1,0,0,0,370,371,1,0,0,0,371,101,1,0,0,0,372,374,7,7,0,0,373,372,1,0,0,0,374,375,1,0,0,0,375,373,1,0,0,0,375,376,1,0,0,0,376,377,1,0,0,0,377,378,6,50,1,0,378,103,1,0,0,0,379,380,5,34,0,0,380,381,6,51,4,0,381,382,1,0,0,0,382,383,6,51,5,0,383,105,1,0,0,0,384,391,3,120,59,0,385,387,8,8,0,0,386,385,1,0,0,0,387,388,1,0,0,0,388,386,1,0,0,0,388,389,1,0,0,0,389,391,1,0,0,0,390,384,1,0,0,0,390,386,1,0,0,0,391,107,1,0,0,0,392,393,5,60,0,0,393,400,3,122,60,0,394,396,5,61,0,0,395,397,8,9,0,0,396,395,1,0,0,0,397,398,1,0,0,0,398,396,1,0,0,0,398,399,1,0,0,0,399,401,1,0,0,0,400,394,1,0,0,0,400,401,1,0,0,0,401,402,1,0,0,0,402,403,5,62,0,0,403,109,1,0,0,0,404,405,5,60,0,0,405,406,5,47,0,0,406,407,1,0,0,0,407,408,3,122,60,0,408,409,5,62,0,0,409,111,1,0,0,0,410,411,5,60,0,0,411,412,3,122,60,0,412,413,5,61,0,0,413,113,1,0,0,0,414,415,5,60,0,0,415,416,5,112,0,0,416,417,5,44,0,0,417,419,1,0,0,0,418,420,8,9,0,0,419,418,1,0,0,0,420,421,1,0,0,0,421,419,1,0,0,0,421,422,1,0,0,0,422,423,1,0,0,0,423,424,5,62,0,0,424,115,1,0,0,0,425,426,5,60,0,0,426,427,1,0,0,0,427,428,6,57,6,0,428,117,1,0,0,0,429,430,5,62,0,0,430,119,1,0,0,0,431,432,5,92,0,0,432,433,7,10,0,0,433,121,1,0,0,0,434,435,5,98,0,0,435,455,5,114,0,0,436,437,5,99,0,0,437,438,5,111,0,0,438,455,5,108,0,0,439,440,5,115,0,0,440,441,5,116,0,0,441,455,5,114,0,0,442,443,5,115,0,0,443,444,5,104,0,0,444,445,5,97,0,0,445,455,5,100,0,0,446,455,5,117,0,0,447,448,5,105,0,0,448,449,5,109,0,0,449,455,5,103,0,0,450,451,5,103,0,0,451,455,5,116,0,0,452,453,5,108,0,0,453,455,5,116,0,0,454,434,1,0,0,0,454,436,1,0,0,0,454,439,1,0,0,0,454,442,1,0,0,0,454,446,1,0,0,0,454,447,1,0,0,0,454,450,1,0,0,0,454,452,1,0,0,0,455,123,1,0,0,0,26,0,1,246,251,258,263,269,275,281,287,292,298,304,315,320,335,339,349,370,375,388,390,398,400,421,454,7,1,23,0,0,1,0,1,48,1,5,1,0,1,51,2,4,0,0,5,0,0];static __ATN;static get _ATN(){if(!c.__ATN)c.__ATN=new N1().deserialize(c._serializedATN);return c.__ATN}static vocabulary=new f0(c.literalNames,c.symbolicNames,[]);get vocabulary(){return c.vocabulary}static decisionsToDFA=c._ATN.decisionToState.map((U,X)=>new o0(U,X))}class z4 extends i{text;constructor(U,X){super(U);this.text=X}accept(U){return U.visitToken(this)}}class I4 extends i{scripts;constructor(U,X){super(U);this.scripts=X,this.addChildren(this.scripts)}accept(U){return U.visitScriptFile(this)}}class q1 extends i{kind="Script";trigger;name;isStar;parameters;returnTokens;statements;block;symbol;returnType;triggerType;subjectReference=null;parameterType;constructor(U){super(U.source);if(this.trigger=U.trigger,this.name=U.name,this.isStar=U.isStar,this.parameters=U.parameters,this.returnTokens=U.returnTokens,this.statements=U.statements,this.addChild(this.trigger),this.addChild(this.name),this.parameters)this.addChildren(this.parameters);if(this.returnTokens)this.addChildren(this.returnTokens);this.addChildren(this.statements)}get nameString(){return this.isStar?`${this.name.text}*`:this.name.text}accept(U){return U.visitScript(this)}}class A4 extends i{typeToken;name;symbol;constructor(U,X,Y){super(U);this.typeToken=X,this.name=Y,this.addChild(this.typeToken),this.addChild(this.name)}accept(U){return U.visitParameter(this)}}class d extends i{constructor(U){super(U)}}class K4 extends d{kind="BlockStatement";statements;scope;constructor(U,X){super(U);this.statements=X,this.addChildren(this.statements)}accept(U){return U.visitBlockStatement(this)}}class r extends i{constructor(U){super(U)}type=null;typeHint=null;getNullableType(){return this.type}getType(){if(this.type==null)throw Error("Attribute: 'type' should be initialized before get.");else return this.type}}class e extends r{value;constructor(U,X){super(U);this.value=X}}class D4 extends e{kind="NullLiteral";constructor(U){super(U,-1)}accept(U){return U.visitNullLiteral(this)}}class B4 extends d{kind="ReturnStatement";expressions;constructor(U,X){super(U);this.expressions=X,this.addChildren(this.expressions)}accept(U){return U.visitReturnStatement(this)}}class w4 extends d{kind="IfStatement";condition;thenStatement;elseStatement;constructor(U,X,Y,G){super(U);this.condition=X,this.thenStatement=Y,this.elseStatement=G,this.addChild(this.condition),this.addChild(this.thenStatement),this.addChild(this.elseStatement)}accept(U){return U.visitIfStatement(this)}}class R4 extends d{kind="WhileStatement";condition;thenStatement;constructor(U,X,Y){super(U);this.condition=X,this.thenStatement=Y,this.addChild(this.condition),this.addChild(this.thenStatement)}accept(U){return U.visitWhileStatement(this)}}class O2 extends d{kind="SwitchStatement";typeToken;condition;cases;defaultCase=null;type;constructor(U,X,Y,G){super(U);this.typeToken=X,this.condition=Y,this.cases=G,this.addChild(this.typeToken),this.addChild(this.condition),this.addChildren(this.cases)}accept(U){return U.visitSwitchStatement(this)}}class H4 extends i{kind="SwitchCase";keys;statements;scope;constructor(U,X,Y){super(U);this.keys=X,this.statements=Y,this.addChildren(this.keys),this.addChildren(this.statements)}get isDefault(){return this.keys.length===0}accept(U){return U.visitSwitchCase(this)}}class L4 extends d{kind="DeclarationStatement";typeToken;name;initializer;symbol;constructor(U,X,Y,G){super(U);this.typeToken=X,this.name=Y,this.initializer=G,this.addChild(this.typeToken),this.addChild(this.name),this.addChild(this.initializer)}accept(U){return U.visitDeclarationStatement(this)}}class M4 extends d{kind="ArrayDeclarationStatement";typeToken;name;initializer;symbol;constructor(U,X,Y,G){super(U);this.typeToken=X,this.name=Y,this.initializer=G,this.addChild(this.typeToken),this.addChild(this.name),this.addChild(this.initializer)}accept(U){return U.visitArrayDeclarationStatement(this)}}class k4 extends d{kind="AssignmentStatement";vars;expressions;constructor(U,X,Y){super(U);this.vars=X,this.expressions=Y,this.addChildren(this.vars),this.addChildren(this.expressions)}accept(U){return U.visitAssignmentStatement(this)}}class O4 extends d{kind="ExpressionStatement";expression;constructor(U,X){super(U);this.expression=X,this.addChild(this.expression)}accept(U){return U.visitExpressionStatement(this)}}class j4 extends d{readonly="EmptyStatement";constructor(U){super(U)}accept(U){return U.visitEmptyStatement(this)}}class i0 extends r{kind="ParenthesizedExpression";expression;constructor(U,X){super(U);this.expression=X,this.addChild(this.expression)}accept(U){return U.visitParenthesizedExpression(this)}}class C1 extends r{left;operator;right;constructor(U,X,Y,G){super(U);this.left=X,this.operator=Y,this.right=G,this.addChild(this.left),this.addChild(this.operator),this.addChild(this.right)}accept(U){return U.visitBinaryExpression(this)}}class h4 extends C1{kind="ArithmeticExpression";constructor(U,X,Y,G){super(U,X,Y,G)}accept(U){return U.visitArithmeticExpression(this)}}class f1 extends r{name;reference=null;constructor(U,X){super(U);this.name=X,this.addChild(this.name)}}class F1 extends f1{kind="LocalVariableExpression";index;constructor(U,X,Y){super(U,X);this.index=Y,this.addChild(this.index)}get isArray(){return this.index!=null}accept(U){return U.visitLocalVariableExpression(this)}}class E4 extends r{kind="CalcExpression";expression;constructor(U,X){super(U);this.expression=X,this.addChild(this.expression)}accept(U){return U.visitCalcExpression(this)}}class Y0 extends r{name;arguments;symbol;constructor(U,X,Y){super(U);this.name=X,this.arguments=Y,this.addChild(this.name),this.addChildren(this.arguments)}}class m0 extends Y0{kind="CommandCallExpression";arguments2;constructor(U,X,Y,G){super(U,X,Y);if(this.arguments2=G,this.arguments2)this.addChildren(this.arguments2)}get isStar(){return this.arguments2!=null}get nameString(){return this.isStar?`${this.name.text}*`:this.name.text}accept(U){return U.visitCommandCallExpression(this)}}class j2 extends Y0{kind="ProcCallExpression";constructor(U,X,Y){super(U,X,Y)}accept(U){return U.visitProcCallExpression(this)}}class h2 extends Y0{kind="JumpCallExpression";constructor(U,X,Y){super(U,X,Y)}accept(U){return U.visitJumpCallExpression(this)}}class E2 extends Y0{kind="ClientScriptExpression";transmitList;constructor(U,X,Y,G){super(U,X,Y);this.transmitList=G,this.addChildren(this.transmitList)}accept(U){return U.visitClientScriptExpression(this)}}class C2 extends f1{kind="GameVariableExpression";dot;constructor(U,X,Y){super(U,Y);this.dot=X}accept(U){return U.visitGameVariableExpression(this)}}class V1 extends f1{kind="ConstantVariableExpression";subExpression=null;constructor(U,X){super(U,X)}accept(U){return U.visitConstantVariableExpression(this)}}class $3 extends e{kind="IntegerLiteral";constructor(U,X){super(U,X)}accept(U){return U.visitIntegerLiteral(this)}}class C4 extends e{kind="CoordLiteral";constructor(U,X){super(U,X)}accept(U){return U.visitCoordLiteral(this)}}class f4 extends e{kind="BooleanLiteral";constructor(U,X){super(U,X)}accept(U){return U.visitBooleanLiteral(this)}}class P1 extends C1{kind="ConditionExpression";constructor(U,X,Y,G){super(U,X,Y,G)}accept(U){return U.visitConditionExpression(this)}}class V4 extends e{kind="CharacterLiteral";constructor(U,X){super(U,X)}accept(U){return U.visitCharacterLiteral(this)}}class W1 extends e{kind="StringLiteral";symbol=null;subExpression=null;constructor(U,X){super(U,X)}accept(U){return U.visitStringLiteral(this)}}class P4 extends r{kind="JoinedStringExpression";parts;constructor(U,X){super(U);this.parts=X,this.addChildren(this.parts)}accept(U){return U.visitJoinedStringExpression(this)}}class b4 extends i{constructor(U){super(U)}accept(U){return U.visitJoinedStringPart(this)}}class t0 extends b4{kind="BasicStringPart";value;constructor(U,X){super(U);this.value=X}}class u4 extends t0{kind="PTagStringPart"}class r0 extends b4{kind="ExpressionStringPart";expression;constructor(U,X){super(U);this.expression=X,this.addChild(this.expression)}}class _0 extends r{kind="Identifier";text;reference=null;constructor(U,X){super(U);this.text=X}accept(U){return U.visitIdentifier(this)}}class q extends _4{static LPAREN=1;static RPAREN=2;static COLON=3;static SEMICOLON=4;static COMMA=5;static LBRACK=6;static RBRACK=7;static LBRACE=8;static RBRACE=9;static PLUS=10;static MINUS=11;static MUL=12;static DIV=13;static DOTMOD=14;static MOD=15;static AND=16;static OR=17;static EQ=18;static EXCL=19;static DOLLAR=20;static CARET=21;static TILDE=22;static AT=23;static GT=24;static GTE=25;static LT=26;static LTE=27;static IF=28;static ELSE=29;static WHILE=30;static CASE=31;static DEFAULT=32;static RETURN=33;static CALC=34;static TYPE_ARRAY=35;static DEF_TYPE=36;static SWITCH_TYPE=37;static INTEGER_LITERAL=38;static HEX_LITERAL=39;static COORD_LITERAL=40;static MAPZONE_LITERAL=41;static BOOLEAN_LITERAL=42;static CHAR_LITERAL=43;static NULL_LITERAL=44;static LINE_COMMENT=45;static BLOCK_COMMENT=46;static QUOTE_OPEN=47;static IDENTIFIER=48;static WHITESPACE=49;static QUOTE_CLOSE=50;static STRING_TEXT=51;static STRING_TAG=52;static STRING_CLOSE_TAG=53;static STRING_PARTIAL_TAG=54;static STRING_P_TAG=55;static STRING_EXPR_START=56;static STRING_EXPR_END=57;static RULE_scriptFile=0;static RULE_script=1;static RULE_parameterList=2;static RULE_parameter=3;static RULE_typeList=4;static RULE_statement=5;static RULE_blockStatement=6;static RULE_returnStatement=7;static RULE_ifStatement=8;static RULE_whileStatement=9;static RULE_switchStatement=10;static RULE_switchCase=11;static RULE_declarationStatement=12;static RULE_arrayDeclarationStatement=13;static RULE_assignmentStatement=14;static RULE_expressionStatement=15;static RULE_emptyStatement=16;static RULE_expressionList=17;static RULE_parenthesis=18;static RULE_singleExpression=19;static RULE_expression=20;static RULE_condition=21;static RULE_calc=22;static RULE_arithmetic=23;static RULE_call=24;static RULE_clientScript=25;static RULE_assignableVariableList=26;static RULE_assignableVariable=27;static RULE_localVariable=28;static RULE_localArrayVariable=29;static RULE_gameVariable=30;static RULE_constantVariable=31;static RULE_literal=32;static RULE_stringLiteral=33;static RULE_stringLiteralContent=34;static RULE_joinedString=35;static RULE_stringTag=36;static RULE_stringPTag=37;static RULE_stringExpression=38;static RULE_identifier=39;static RULE_advancedIdentifier=40;static literalNames=[null,"'('","')'","':'","';'","','","'['","']'","'{'","'}'","'+'","'-'","'*'","'/'","'.%'","'%'","'&'","'|'","'='","'!'","'$'","'^'","'~'","'@'",null,"'>='",null,"'<='","'if'","'else'","'while'","'case'","'default'","'return'","'calc'",null,null,null,null,null,null,null,null,null,"'null'"];static symbolicNames=[null,"LPAREN","RPAREN","COLON","SEMICOLON","COMMA","LBRACK","RBRACK","LBRACE","RBRACE","PLUS","MINUS","MUL","DIV","DOTMOD","MOD","AND","OR","EQ","EXCL","DOLLAR","CARET","TILDE","AT","GT","GTE","LT","LTE","IF","ELSE","WHILE","CASE","DEFAULT","RETURN","CALC","TYPE_ARRAY","DEF_TYPE","SWITCH_TYPE","INTEGER_LITERAL","HEX_LITERAL","COORD_LITERAL","MAPZONE_LITERAL","BOOLEAN_LITERAL","CHAR_LITERAL","NULL_LITERAL","LINE_COMMENT","BLOCK_COMMENT","QUOTE_OPEN","IDENTIFIER","WHITESPACE","QUOTE_CLOSE","STRING_TEXT","STRING_TAG","STRING_CLOSE_TAG","STRING_PARTIAL_TAG","STRING_P_TAG","STRING_EXPR_START","STRING_EXPR_END"];static ruleNames=["scriptFile","script","parameterList","parameter","typeList","statement","blockStatement","returnStatement","ifStatement","whileStatement","switchStatement","switchCase","declarationStatement","arrayDeclarationStatement","assignmentStatement","expressionStatement","emptyStatement","expressionList","parenthesis","singleExpression","expression","condition","calc","arithmetic","call","clientScript","assignableVariableList","assignableVariable","localVariable","localArrayVariable","gameVariable","constantVariable","literal","stringLiteral","stringLiteralContent","joinedString","stringTag","stringPTag","stringExpression","identifier","advancedIdentifier"];get grammarFileName(){return"RuneScriptParser.g4"}get literalNames(){return q.literalNames}get symbolicNames(){return q.symbolicNames}get ruleNames(){return q.ruleNames}get serializedATN(){return q._serializedATN}createFailedPredicateException(U,X){return new M2(this,U,X)}constructor(U){super(U);this.interpreter=new k2(this,q._ATN,q.decisionsToDFA,new E1)}scriptFile(){let U=new e6(this.context,this.state);this.enterRule(U,0,q.RULE_scriptFile);let X;try{this.enterOuterAlt(U,1);{this.state=85,this.errorHandler.sync(this),X=this.tokenStream.LA(1);while(X===6)this.state=82,this.script(),this.state=87,this.errorHandler.sync(this),X=this.tokenStream.LA(1);this.state=88,this.match(q.EOF)}}catch(Y){if(Y instanceof V)this.errorHandler.reportError(this,Y),this.errorHandler.recover(this,Y);else throw Y}finally{this.exitRule()}return U}script(){let U=new Z3(this.context,this.state);this.enterRule(U,2,q.RULE_script);let X;try{this.enterOuterAlt(U,1);{if(this.state=90,this.match(q.LBRACK),this.state=91,U._trigger=this.identifier(),this.state=92,this.match(q.COMMA),this.state=93,U._name=this.identifier(),this.state=95,this.errorHandler.sync(this),X=this.tokenStream.LA(1),X===12)this.state=94,this.match(q.MUL);switch(this.state=97,this.match(q.RBRACK),this.state=111,this.errorHandler.sync(this),this.interpreter.adaptivePredict(this.tokenStream,5,this.context)){case 1:{{if(this.state=98,this.match(q.LPAREN),this.state=100,this.errorHandler.sync(this),X=this.tokenStream.LA(1),X===35||X===48)this.state=99,this.parameterList();this.state=102,this.match(q.RPAREN)}switch(this.state=109,this.errorHandler.sync(this),this.interpreter.adaptivePredict(this.tokenStream,4,this.context)){case 1:{if(this.state=104,this.match(q.LPAREN),this.state=106,this.errorHandler.sync(this),X=this.tokenStream.LA(1),X===48)this.state=105,this.typeList();this.state=108,this.match(q.RPAREN)}break}}break}this.state=116,this.errorHandler.sync(this),X=this.tokenStream.LA(1);while((X&-32)===0&&(1<<X&1357955346)!==0||(X-32&-32)===0&&(1<<X-32&106495)!==0)this.state=113,this.statement(),this.state=118,this.errorHandler.sync(this),X=this.tokenStream.LA(1)}}catch(Y){if(Y instanceof V)this.errorHandler.reportError(this,Y),this.errorHandler.recover(this,Y);else throw Y}finally{this.exitRule()}return U}parameterList(){let U=new x4(this.context,this.state);this.enterRule(U,4,q.RULE_parameterList);let X;try{this.enterOuterAlt(U,1);{this.state=119,this.parameter(),this.state=124,this.errorHandler.sync(this),X=this.tokenStream.LA(1);while(X===5)this.state=120,this.match(q.COMMA),this.state=121,this.parameter(),this.state=126,this.errorHandler.sync(this),X=this.tokenStream.LA(1)}}catch(Y){if(Y instanceof V)this.errorHandler.reportError(this,Y),this.errorHandler.recover(this,Y);else throw Y}finally{this.exitRule()}return U}parameter(){let U=new J3(this.context,this.state);this.enterRule(U,6,q.RULE_parameter);let X;try{this.enterOuterAlt(U,1);{if(this.state=127,U._type_=this.tokenStream.LT(1),X=this.tokenStream.LA(1),!(X===35||X===48))U._type_=this.errorHandler.recoverInline(this);else this.errorHandler.reportMatch(this),this.consume();this.state=128,this.match(q.DOLLAR),this.state=129,this.advancedIdentifier()}}catch(Y){if(Y instanceof V)this.errorHandler.reportError(this,Y),this.errorHandler.recover(this,Y);else throw Y}finally{this.exitRule()}return U}typeList(){let U=new g4(this.context,this.state);this.enterRule(U,8,q.RULE_typeList);let X;try{this.enterOuterAlt(U,1);{this.state=131,this.match(q.IDENTIFIER),this.state=136,this.errorHandler.sync(this),X=this.tokenStream.LA(1);while(X===5)this.state=132,this.match(q.COMMA),this.state=133,this.match(q.IDENTIFIER),this.state=138,this.errorHandler.sync(this),X=this.tokenStream.LA(1)}}catch(Y){if(Y instanceof V)this.errorHandler.reportError(this,Y),this.errorHandler.recover(this,Y);else throw Y}finally{this.exitRule()}return U}statement(){let U=new V0(this.context,this.state);this.enterRule(U,10,q.RULE_statement);try{switch(this.state=149,this.errorHandler.sync(this),this.interpreter.adaptivePredict(this.tokenStream,9,this.context)){case 1:this.enterOuterAlt(U,1),this.state=139,this.blockStatement();break;case 2:this.enterOuterAlt(U,2),this.state=140,this.returnStatement();break;case 3:this.enterOuterAlt(U,3),this.state=141,this.ifStatement();break;case 4:this.enterOuterAlt(U,4),this.state=142,this.whileStatement();break;case 5:this.enterOuterAlt(U,5),this.state=143,this.switchStatement();break;case 6:this.enterOuterAlt(U,6),this.state=144,this.declarationStatement();break;case 7:this.enterOuterAlt(U,7),this.state=145,this.arrayDeclarationStatement();break;case 8:this.enterOuterAlt(U,8),this.state=146,this.assignmentStatement();break;case 9:this.enterOuterAlt(U,9),this.state=147,this.expressionStatement();break;case 10:this.enterOuterAlt(U,10),this.state=148,this.emptyStatement();break}}catch(X){if(X instanceof V)this.errorHandler.reportError(this,X),this.errorHandler.recover(this,X);else throw X}finally{this.exitRule()}return U}blockStatement(){let U=new m4(this.context,this.state);this.enterRule(U,12,q.RULE_blockStatement);let X;try{this.enterOuterAlt(U,1);{this.state=151,this.match(q.LBRACE),this.state=155,this.errorHandler.sync(this),X=this.tokenStream.LA(1);while((X&-32)===0&&(1<<X&1357955346)!==0||(X-32&-32)===0&&(1<<X-32&106495)!==0)this.state=152,this.statement(),this.state=157,this.errorHandler.sync(this),X=this.tokenStream.LA(1);this.state=158,this.match(q.RBRACE)}}catch(Y){if(Y instanceof V)this.errorHandler.reportError(this,Y),this.errorHandler.recover(this,Y);else throw Y}finally{this.exitRule()}return U}returnStatement(){let U=new d4(this.context,this.state);this.enterRule(U,14,q.RULE_returnStatement);let X;try{this.enterOuterAlt(U,1);{if(this.state=160,this.match(q.RETURN),this.state=166,this.errorHandler.sync(this),X=this.tokenStream.LA(1),X===1){if(this.state=161,this.match(q.LPAREN),this.state=163,this.errorHandler.sync(this),X=this.tokenStream.LA(1),(X&-32)===0&&(1<<X&15777794)!==0||(X-32&-32)===0&&(1<<X-32&106493)!==0)this.state=162,this.expressionList();this.state=165,this.match(q.RPAREN)}this.state=168,this.match(q.SEMICOLON)}}catch(Y){if(Y instanceof V)this.errorHandler.reportError(this,Y),this.errorHandler.recover(this,Y);else throw Y}finally{this.exitRule()}return U}ifStatement(){let U=new T4(this.context,this.state);this.enterRule(U,16,q.RULE_ifStatement);try{switch(this.enterOuterAlt(U,1),this.state=170,this.match(q.IF),this.state=171,this.match(q.LPAREN),this.state=172,this.condition(0),this.state=173,this.match(q.RPAREN),this.state=174,this.statement(),this.state=177,this.errorHandler.sync(this),this.interpreter.adaptivePredict(this.tokenStream,13,this.context)){case 1:this.state=175,this.match(q.ELSE),this.state=176,this.statement();break}}catch(X){if(X instanceof V)this.errorHandler.reportError(this,X),this.errorHandler.recover(this,X);else throw X}finally{this.exitRule()}return U}whileStatement(){let U=new l4(this.context,this.state);this.enterRule(U,18,q.RULE_whileStatement);try{this.enterOuterAlt(U,1),this.state=179,this.match(q.WHILE),this.state=180,this.match(q.LPAREN),this.state=181,this.condition(0),this.state=182,this.match(q.RPAREN),this.state=183,this.statement()}catch(X){if(X instanceof V)this.errorHandler.reportError(this,X),this.errorHandler.recover(this,X);else throw X}finally{this.exitRule()}return U}switchStatement(){let U=new y4(this.context,this.state);this.enterRule(U,20,q.RULE_switchStatement);let X;try{this.enterOuterAlt(U,1);{this.state=185,this.match(q.SWITCH_TYPE),this.state=186,this.parenthesis(),this.state=187,this.match(q.LBRACE),this.state=191,this.errorHandler.sync(this),X=this.tokenStream.LA(1);while(X===31)this.state=188,this.switchCase(),this.state=193,this.errorHandler.sync(this),X=this.tokenStream.LA(1);this.state=194,this.match(q.RBRACE)}}catch(Y){if(Y instanceof V)this.errorHandler.reportError(this,Y),this.errorHandler.recover(this,Y);else throw Y}finally{this.exitRule()}return U}switchCase(){let U=new Q3(this.context,this.state);this.enterRule(U,22,q.RULE_switchCase);let X;try{this.enterOuterAlt(U,1);{switch(this.state=196,this.match(q.CASE),this.state=199,this.errorHandler.sync(this),this.interpreter.adaptivePredict(this.tokenStream,15,this.context)){case 1:this.state=197,this.match(q.DEFAULT);break;case 2:this.state=198,this.expressionList();break}this.state=201,this.match(q.COLON),this.state=205,this.errorHandler.sync(this),X=this.tokenStream.LA(1);while((X&-32)===0&&(1<<X&1357955346)!==0||(X-32&-32)===0&&(1<<X-32&106495)!==0)this.state=202,this.statement(),this.state=207,this.errorHandler.sync(this),X=this.tokenStream.LA(1)}}catch(Y){if(Y instanceof V)this.errorHandler.reportError(this,Y),this.errorHandler.recover(this,Y);else throw Y}finally{this.exitRule()}return U}declarationStatement(){let U=new c4(this.context,this.state);this.enterRule(U,24,q.RULE_declarationStatement);let X;try{this.enterOuterAlt(U,1);{if(this.state=208,this.match(q.DEF_TYPE),this.state=209,this.match(q.DOLLAR),this.state=210,this.advancedIdentifier(),this.state=213,this.errorHandler.sync(this),X=this.tokenStream.LA(1),X===18)this.state=211,this.match(q.EQ),this.state=212,this.expression();this.state=215,this.match(q.SEMICOLON)}}catch(Y){if(Y instanceof V)this.errorHandler.reportError(this,Y),this.errorHandler.recover(this,Y);else throw Y}finally{this.exitRule()}return U}arrayDeclarationStatement(){let U=new a4(this.context,this.state);this.enterRule(U,26,q.RULE_arrayDeclarationStatement);try{this.enterOuterAlt(U,1),this.state=217,this.match(q.DEF_TYPE),this.state=218,this.match(q.DOLLAR),this.state=219,this.advancedIdentifier(),this.state=220,this.parenthesis(),this.state=221,this.match(q.SEMICOLON)}catch(X){if(X instanceof V)this.errorHandler.reportError(this,X),this.errorHandler.recover(this,X);else throw X}finally{this.exitRule()}return U}assignmentStatement(){let U=new s4(this.context,this.state);this.enterRule(U,28,q.RULE_assignmentStatement);try{this.enterOuterAlt(U,1),this.state=223,this.assignableVariableList(),this.state=224,this.match(q.EQ),this.state=225,this.expressionList(),this.state=226,this.match(q.SEMICOLON)}catch(X){if(X instanceof V)this.errorHandler.reportError(this,X),this.errorHandler.recover(this,X);else throw X}finally{this.exitRule()}return U}expressionStatement(){let U=new n4(this.context,this.state);this.enterRule(U,30,q.RULE_expressionStatement);try{this.enterOuterAlt(U,1),this.state=228,this.expression(),this.state=229,this.match(q.SEMICOLON)}catch(X){if(X instanceof V)this.errorHandler.reportError(this,X),this.errorHandler.recover(this,X);else throw X}finally{this.exitRule()}return U}emptyStatement(){let U=new p4(this.context,this.state);this.enterRule(U,32,q.RULE_emptyStatement);try{this.enterOuterAlt(U,1),this.state=231,this.match(q.SEMICOLON)}catch(X){if(X instanceof V)this.errorHandler.reportError(this,X),this.errorHandler.recover(this,X);else throw X}finally{this.exitRule()}return U}expressionList(){let U=new P0(this.context,this.state);this.enterRule(U,34,q.RULE_expressionList);let X;try{this.enterOuterAlt(U,1);{this.state=233,this.expression(),this.state=238,this.errorHandler.sync(this),X=this.tokenStream.LA(1);while(X===5)this.state=234,this.match(q.COMMA),this.state=235,this.expression(),this.state=240,this.errorHandler.sync(this),X=this.tokenStream.LA(1)}}catch(Y){if(Y instanceof V)this.errorHandler.reportError(this,Y),this.errorHandler.recover(this,Y);else throw Y}finally{this.exitRule()}return U}parenthesis(){let U=new t1(this.context,this.state);this.enterRule(U,36,q.RULE_parenthesis);try{this.enterOuterAlt(U,1),this.state=241,this.match(q.LPAREN),this.state=242,this.expression(),this.state=243,this.match(q.RPAREN)}catch(X){if(X instanceof V)this.errorHandler.reportError(this,X),this.errorHandler.recover(this,X);else throw X}finally{this.exitRule()}return U}singleExpression(){let U=new U9(this.context,this.state);this.enterRule(U,38,q.RULE_singleExpression);try{this.enterOuterAlt(U,1),this.state=245,this.expression(),this.state=246,this.match(q.EOF)}catch(X){if(X instanceof V)this.errorHandler.reportError(this,X),this.errorHandler.recover(this,X);else throw X}finally{this.exitRule()}return U}expression(){let U=new T(this.context,this.state);this.enterRule(U,40,q.RULE_expression);try{switch(this.state=258,this.errorHandler.sync(this),this.interpreter.adaptivePredict(this.tokenStream,19,this.context)){case 1:U=new X9(U),this.enterOuterAlt(U,1),this.state=248,this.parenthesis();break;case 2:U=new Y9(U),this.enterOuterAlt(U,2),this.state=249,this.calc();break;case 3:U=new G9(U),this.enterOuterAlt(U,3),this.state=250,this.call();break;case 4:U=new $9(U),this.enterOuterAlt(U,4),this.state=251,this.localVariable();break;case 5:U=new Z9(U),this.enterOuterAlt(U,5),this.state=252,this.localArrayVariable();break;case 6:U=new J9(U),this.enterOuterAlt(U,6),this.state=253,this.gameVariable();break;case 7:U=new Q9(U),this.enterOuterAlt(U,7),this.state=254,this.constantVariable();break;case 8:U=new N9(U),this.enterOuterAlt(U,8),this.state=255,this.literal();break;case 9:U=new q9(U),this.enterOuterAlt(U,9),this.state=256,this.joinedString();break;case 10:U=new F9(U),this.enterOuterAlt(U,10),this.state=257,this.identifier();break}}catch(X){if(X instanceof V)this.errorHandler.reportError(this,X),this.errorHandler.recover(this,X);else throw X}finally{this.exitRule()}return U}condition(U){if(U===void 0)U=0;let X=this.context,Y=this.state,G=new z0(this.context,Y),$=G,Z=42;this.enterRecursionRule(G,42,q.RULE_condition,U);let J;try{let Q;this.enterOuterAlt(G,1);{switch(this.state=266,this.errorHandler.sync(this),this.interpreter.adaptivePredict(this.tokenStream,20,this.context)){case 1:G=new W9(G),this.context=G,$=G,this.state=261,this.match(q.LPAREN),this.state=262,this.condition(0),this.state=263,this.match(q.RPAREN);break;case 2:G=new _9(G),this.context=G,$=G,this.state=265,this.expression();break}this.context.stop=this.tokenStream.LT(-1),this.state=282,this.errorHandler.sync(this),Q=this.interpreter.adaptivePredict(this.tokenStream,22,this.context);while(Q!==2&&Q!==b.INVALID_ALT_NUMBER){if(Q===1){if(this.parseListeners!=null)this.triggerExitRuleEvent();switch($=G,this.state=280,this.errorHandler.sync(this),this.interpreter.adaptivePredict(this.tokenStream,21,this.context)){case 1:{if(G=new f2(new z0(X,Y)),this.pushNewRecursionContext(G,Z,q.RULE_condition),this.state=268,!this.precpred(this.context,5))throw this.createFailedPredicateException("this.precpred(this.context, 5)");if(this.state=269,G._op=this.tokenStream.LT(1),J=this.tokenStream.LA(1),!((J&-32)===0&&(1<<J&251658240)!==0))G._op=this.errorHandler.recoverInline(this);else this.errorHandler.reportMatch(this),this.consume();this.state=270,this.condition(6)}break;case 2:{if(G=new f2(new z0(X,Y)),this.pushNewRecursionContext(G,Z,q.RULE_condition),this.state=271,!this.precpred(this.context,4))throw this.createFailedPredicateException("this.precpred(this.context, 4)");if(this.state=272,G._op=this.tokenStream.LT(1),J=this.tokenStream.LA(1),!(J===18||J===19))G._op=this.errorHandler.recoverInline(this);else this.errorHandler.reportMatch(this),this.consume();this.state=273,this.condition(5)}break;case 3:{if(G=new f2(new z0(X,Y)),this.pushNewRecursionContext(G,Z,q.RULE_condition),this.state=274,!this.precpred(this.context,3))throw this.createFailedPredicateException("this.precpred(this.context, 3)");this.state=275,G._op=this.match(q.AND),this.state=276,this.condition(4)}break;case 4:{if(G=new f2(new z0(X,Y)),this.pushNewRecursionContext(G,Z,q.RULE_condition),this.state=277,!this.precpred(this.context,2))throw this.createFailedPredicateException("this.precpred(this.context, 2)");this.state=278,G._op=this.match(q.OR),this.state=279,this.condition(3)}break}}this.state=284,this.errorHandler.sync(this),Q=this.interpreter.adaptivePredict(this.tokenStream,22,this.context)}}}catch(Q){if(Q instanceof V)this.errorHandler.reportError(this,Q),this.errorHandler.recover(this,Q);else throw Q}finally{this.unrollRecursionContexts(X)}return G}calc(){let U=new o4(this.context,this.state);this.enterRule(U,44,q.RULE_calc);try{this.enterOuterAlt(U,1),this.state=285,this.match(q.CALC),this.state=286,this.match(q.LPAREN),this.state=287,this.arithmetic(0),this.state=288,this.match(q.RPAREN)}catch(X){if(X instanceof V)this.errorHandler.reportError(this,X),this.errorHandler.recover(this,X);else throw X}finally{this.exitRule()}return U}arithmetic(U){if(U===void 0)U=0;let X=this.context,Y=this.state,G=new K0(this.context,Y),$=G,Z=46;this.enterRecursionRule(G,46,q.RULE_arithmetic,U);let J;try{let Q;this.enterOuterAlt(G,1);{switch(this.state=296,this.errorHandler.sync(this),this.interpreter.adaptivePredict(this.tokenStream,23,this.context)){case 1:G=new z9(G),this.context=G,$=G,this.state=291,this.match(q.LPAREN),this.state=292,this.arithmetic(0),this.state=293,this.match(q.RPAREN);break;case 2:G=new I9(G),this.context=G,$=G,this.state=295,this.expression();break}this.context.stop=this.tokenStream.LT(-1),this.state=312,this.errorHandler.sync(this),Q=this.interpreter.adaptivePredict(this.tokenStream,25,this.context);while(Q!==2&&Q!==b.INVALID_ALT_NUMBER){if(Q===1){if(this.parseListeners!=null)this.triggerExitRuleEvent();switch($=G,this.state=310,this.errorHandler.sync(this),this.interpreter.adaptivePredict(this.tokenStream,24,this.context)){case 1:{if(G=new V2(new K0(X,Y)),this.pushNewRecursionContext(G,Z,q.RULE_arithmetic),this.state=298,!this.precpred(this.context,5))throw this.createFailedPredicateException("this.precpred(this.context, 5)");if(this.state=299,G._op=this.tokenStream.LT(1),J=this.tokenStream.LA(1),!((J&-32)===0&&(1<<J&45056)!==0))G._op=this.errorHandler.recoverInline(this);else this.errorHandler.reportMatch(this),this.consume();this.state=300,this.arithmetic(6)}break;case 2:{if(G=new V2(new K0(X,Y)),this.pushNewRecursionContext(G,Z,q.RULE_arithmetic),this.state=301,!this.precpred(this.context,4))throw this.createFailedPredicateException("this.precpred(this.context, 4)");if(this.state=302,G._op=this.tokenStream.LT(1),J=this.tokenStream.LA(1),!(J===10||J===11))G._op=this.errorHandler.recoverInline(this);else this.errorHandler.reportMatch(this),this.consume();this.state=303,this.arithmetic(5)}break;case 3:{if(G=new V2(new K0(X,Y)),this.pushNewRecursionContext(G,Z,q.RULE_arithmetic),this.state=304,!this.precpred(this.context,3))throw this.createFailedPredicateException("this.precpred(this.context, 3)");this.state=305,G._op=this.match(q.AND),this.state=306,this.arithmetic(4)}break;case 4:{if(G=new V2(new K0(X,Y)),this.pushNewRecursionContext(G,Z,q.RULE_arithmetic),this.state=307,!this.precpred(this.context,2))throw this.createFailedPredicateException("this.precpred(this.context, 2)");this.state=308,G._op=this.match(q.OR),this.state=309,this.arithmetic(3)}break}}this.state=314,this.errorHandler.sync(this),Q=this.interpreter.adaptivePredict(this.tokenStream,25,this.context)}}}catch(Q){if(Q instanceof V)this.errorHandler.reportError(this,Q),this.errorHandler.recover(this,Q);else throw Q}finally{this.unrollRecursionContexts(X)}return G}call(){let U=new r1(this.context,this.state);this.enterRule(U,48,q.RULE_call);let X;try{switch(this.state=353,this.errorHandler.sync(this),this.interpreter.adaptivePredict(this.tokenStream,33,this.context)){case 1:U=new v4(U),this.enterOuterAlt(U,1);{if(this.state=315,this.identifier(),this.state=316,this.match(q.MUL),this.state=317,this.match(q.LPAREN),this.state=319,this.errorHandler.sync(this),X=this.tokenStream.LA(1),(X&-32)===0&&(1<<X&15777794)!==0||(X-32&-32)===0&&(1<<X-32&106493)!==0)this.state=318,this.expressionList();if(this.state=321,this.match(q.RPAREN),this.state=322,this.match(q.LPAREN),this.state=324,this.errorHandler.sync(this),X=this.tokenStream.LA(1),(X&-32)===0&&(1<<X&15777794)!==0||(X-32&-32)===0&&(1<<X-32&106493)!==0)this.state=323,this.expressionList();this.state=326,this.match(q.RPAREN)}break;case 2:U=new v4(U),this.enterOuterAlt(U,2);{if(this.state=328,this.identifier(),this.state=329,this.match(q.LPAREN),this.state=331,this.errorHandler.sync(this),X=this.tokenStream.LA(1),(X&-32)===0&&(1<<X&15777794)!==0||(X-32&-32)===0&&(1<<X-32&106493)!==0)this.state=330,this.expressionList();this.state=333,this.match(q.RPAREN)}break;case 3:switch(U=new A9(U),this.enterOuterAlt(U,3),this.state=335,this.match(q.TILDE),this.state=336,this.identifier(),this.state=342,this.errorHandler.sync(this),this.interpreter.adaptivePredict(this.tokenStream,30,this.context)){case 1:{if(this.state=337,this.match(q.LPAREN),this.state=339,this.errorHandler.sync(this),X=this.tokenStream.LA(1),(X&-32)===0&&(1<<X&15777794)!==0||(X-32&-32)===0&&(1<<X-32&106493)!==0)this.state=338,this.expressionList();this.state=341,this.match(q.RPAREN)}break}break;case 4:switch(U=new K9(U),this.enterOuterAlt(U,4),this.state=344,this.match(q.AT),this.state=345,this.identifier(),this.state=351,this.errorHandler.sync(this),this.interpreter.adaptivePredict(this.tokenStream,32,this.context)){case 1:{if(this.state=346,this.match(q.LPAREN),this.state=348,this.errorHandler.sync(this),X=this.tokenStream.LA(1),(X&-32)===0&&(1<<X&15777794)!==0||(X-32&-32)===0&&(1<<X-32&106493)!==0)this.state=347,this.expressionList();this.state=350,this.match(q.RPAREN)}break}break}}catch(Y){if(Y instanceof V)this.errorHandler.reportError(this,Y),this.errorHandler.recover(this,Y);else throw Y}finally{this.exitRule()}return U}clientScript(){let U=new D9(this.context,this.state);this.enterRule(U,50,q.RULE_clientScript);let X;try{this.enterOuterAlt(U,1);{if(this.state=355,this.identifier(),this.state=361,this.errorHandler.sync(this),X=this.tokenStream.LA(1),X===1){if(this.state=356,this.match(q.LPAREN),this.state=358,this.errorHandler.sync(this),X=this.tokenStream.LA(1),(X&-32)===0&&(1<<X&15777794)!==0||(X-32&-32)===0&&(1<<X-32&106493)!==0)this.state=357,U._args=this.expressionList();this.state=360,this.match(q.RPAREN)}if(this.state=368,this.errorHandler.sync(this),X=this.tokenStream.LA(1),X===8){if(this.state=363,this.match(q.LBRACE),this.state=365,this.errorHandler.sync(this),X=this.tokenStream.LA(1),(X&-32)===0&&(1<<X&15777794)!==0||(X-32&-32)===0&&(1<<X-32&106493)!==0)this.state=364,U._triggers=this.expressionList();this.state=367,this.match(q.RBRACE)}this.state=370,this.match(q.EOF)}}catch(Y){if(Y instanceof V)this.errorHandler.reportError(this,Y),this.errorHandler.recover(this,Y);else throw Y}finally{this.exitRule()}return U}assignableVariableList(){let U=new i4(this.context,this.state);this.enterRule(U,52,q.RULE_assignableVariableList);let X;try{this.enterOuterAlt(U,1);{this.state=372,this.assignableVariable(),this.state=377,this.errorHandler.sync(this),X=this.tokenStream.LA(1);while(X===5)this.state=373,this.match(q.COMMA),this.state=374,this.assignableVariable(),this.state=379,this.errorHandler.sync(this),X=this.tokenStream.LA(1)}}catch(Y){if(Y instanceof V)this.errorHandler.reportError(this,Y),this.errorHandler.recover(this,Y);else throw Y}finally{this.exitRule()}return U}assignableVariable(){let U=new N3(this.context,this.state);this.enterRule(U,54,q.RULE_assignableVariable);try{switch(this.state=383,this.errorHandler.sync(this),this.interpreter.adaptivePredict(this.tokenStream,39,this.context)){case 1:this.enterOuterAlt(U,1),this.state=380,this.localVariable();break;case 2:this.enterOuterAlt(U,2),this.state=381,this.localArrayVariable();break;case 3:this.enterOuterAlt(U,3),this.state=382,this.gameVariable();break}}catch(X){if(X instanceof V)this.errorHandler.reportError(this,X),this.errorHandler.recover(this,X);else throw X}finally{this.exitRule()}return U}localVariable(){let U=new q3(this.context,this.state);this.enterRule(U,56,q.RULE_localVariable);try{this.enterOuterAlt(U,1),this.state=385,this.match(q.DOLLAR),this.state=386,this.advancedIdentifier()}catch(X){if(X instanceof V)this.errorHandler.reportError(this,X),this.errorHandler.recover(this,X);else throw X}finally{this.exitRule()}return U}localArrayVariable(){let U=new F3(this.context,this.state);this.enterRule(U,58,q.RULE_localArrayVariable);try{this.enterOuterAlt(U,1),this.state=388,this.match(q.DOLLAR),this.state=389,this.advancedIdentifier(),this.state=390,this.parenthesis()}catch(X){if(X instanceof V)this.errorHandler.reportError(this,X),this.errorHandler.recover(this,X);else throw X}finally{this.exitRule()}return U}gameVariable(){let U=new W3(this.context,this.state);this.enterRule(U,60,q.RULE_gameVariable);try{switch(this.state=396,this.errorHandler.sync(this),this.tokenStream.LA(1)){case q.MOD:this.enterOuterAlt(U,1),this.state=392,this.match(q.MOD),this.state=393,this.advancedIdentifier();break;case q.DOTMOD:this.enterOuterAlt(U,2),this.state=394,this.match(q.DOTMOD),this.state=395,this.advancedIdentifier();break;default:throw new h1(this)}}catch(X){if(X instanceof V)this.errorHandler.reportError(this,X),this.errorHandler.recover(this,X);else throw X}finally{this.exitRule()}return U}constantVariable(){let U=new t4(this.context,this.state);this.enterRule(U,62,q.RULE_constantVariable);try{this.enterOuterAlt(U,1),this.state=398,this.match(q.CARET),this.state=399,this.advancedIdentifier()}catch(X){if(X instanceof V)this.errorHandler.reportError(this,X),this.errorHandler.recover(this,X);else throw X}finally{this.exitRule()}return U}literal(){let U=new e0(this.context,this.state);this.enterRule(U,64,q.RULE_literal);try{switch(this.state=408,this.errorHandler.sync(this),this.tokenStream.LA(1)){case q.INTEGER_LITERAL:U=new S4(U),this.enterOuterAlt(U,1),this.state=401,this.match(q.INTEGER_LITERAL);break;case q.HEX_LITERAL:U=new S4(U),this.enterOuterAlt(U,2),this.state=402,this.match(q.HEX_LITERAL);break;case q.COORD_LITERAL:U=new B9(U),this.enterOuterAlt(U,3),this.state=403,this.match(q.COORD_LITERAL);break;case q.BOOLEAN_LITERAL:U=new w9(U),this.enterOuterAlt(U,4),this.state=404,this.match(q.BOOLEAN_LITERAL);break;case q.CHAR_LITERAL:U=new R9(U),this.enterOuterAlt(U,5),this.state=405,this.match(q.CHAR_LITERAL);break;case q.NULL_LITERAL:U=new H9(U),this.enterOuterAlt(U,6),this.state=406,this.match(q.NULL_LITERAL);break;case q.QUOTE_OPEN:U=new L9(U),this.enterOuterAlt(U,7),this.state=407,this.stringLiteral();break;default:throw new h1(this)}}catch(X){if(X instanceof V)this.errorHandler.reportError(this,X),this.errorHandler.recover(this,X);else throw X}finally{this.exitRule()}return U}stringLiteral(){let U=new r4(this.context,this.state);this.enterRule(U,66,q.RULE_stringLiteral);let X;try{this.enterOuterAlt(U,1);{this.state=410,this.match(q.QUOTE_OPEN),this.state=414,this.errorHandler.sync(this),X=this.tokenStream.LA(1);while(X===51)this.state=411,this.stringLiteralContent(),this.state=416,this.errorHandler.sync(this),X=this.tokenStream.LA(1);this.state=417,this.match(q.QUOTE_CLOSE)}}catch(Y){if(Y instanceof V)this.errorHandler.reportError(this,Y),this.errorHandler.recover(this,Y);else throw Y}finally{this.exitRule()}return U}stringLiteralContent(){let U=new _1(this.context,this.state);this.enterRule(U,68,q.RULE_stringLiteralContent);try{this.enterOuterAlt(U,1),this.state=419,this.match(q.STRING_TEXT)}catch(X){if(X instanceof V)this.errorHandler.reportError(this,X),this.errorHandler.recover(this,X);else throw X}finally{this.exitRule()}return U}joinedString(){let U=new e4(this.context,this.state);this.enterRule(U,70,q.RULE_joinedString);let X;try{this.enterOuterAlt(U,1);{this.state=421,this.match(q.QUOTE_OPEN),this.state=428,this.errorHandler.sync(this),X=this.tokenStream.LA(1);while((X-51&-32)===0&&(1<<X-51&63)!==0){switch(this.state=426,this.errorHandler.sync(this),this.tokenStream.LA(1)){case q.STRING_TEXT:this.state=422,this.stringLiteralContent();break;case q.STRING_TAG:case q.STRING_CLOSE_TAG:case q.STRING_PARTIAL_TAG:this.state=423,this.stringTag();break;case q.STRING_P_TAG:this.state=424,this.stringPTag();break;case q.STRING_EXPR_START:this.state=425,this.stringExpression();break;default:throw new h1(this)}this.state=430,this.errorHandler.sync(this),X=this.tokenStream.LA(1)}this.state=431,this.match(q.QUOTE_CLOSE)}}catch(Y){if(Y instanceof V)this.errorHandler.reportError(this,Y),this.errorHandler.recover(this,Y);else throw Y}finally{this.exitRule()}return U}stringTag(){let U=new p1(this.context,this.state);this.enterRule(U,72,q.RULE_stringTag);let X;try{if(this.enterOuterAlt(U,1),this.state=433,X=this.tokenStream.LA(1),!((X-52&-32)===0&&(1<<X-52&7)!==0))this.errorHandler.recoverInline(this);else this.errorHandler.reportMatch(this),this.consume()}catch(Y){if(Y instanceof V)this.errorHandler.reportError(this,Y),this.errorHandler.recover(this,Y);else throw Y}finally{this.exitRule()}return U}stringPTag(){let U=new o1(this.context,this.state);this.enterRule(U,74,q.RULE_stringPTag);try{this.enterOuterAlt(U,1),this.state=435,this.match(q.STRING_P_TAG)}catch(X){if(X instanceof V)this.errorHandler.reportError(this,X),this.errorHandler.recover(this,X);else throw X}finally{this.exitRule()}return U}stringExpression(){let U=new i1(this.context,this.state);this.enterRule(U,76,q.RULE_stringExpression);try{this.enterOuterAlt(U,1),this.state=437,this.match(q.STRING_EXPR_START),this.state=438,this.expression(),this.state=439,this.match(q.STRING_EXPR_END)}catch(X){if(X instanceof V)this.errorHandler.reportError(this,X),this.errorHandler.recover(this,X);else throw X}finally{this.exitRule()}return U}identifier(){let U=new d0(this.context,this.state);this.enterRule(U,78,q.RULE_identifier);let X;try{if(this.enterOuterAlt(U,1),this.state=441,X=this.tokenStream.LA(1),!((X-32&-32)===0&&(1<<X-32&71609)!==0))this.errorHandler.recoverInline(this);else this.errorHandler.reportMatch(this),this.consume()}catch(Y){if(Y instanceof V)this.errorHandler.reportError(this,Y),this.errorHandler.recover(this,Y);else throw Y}finally{this.exitRule()}return U}advancedIdentifier(){let U=new U1(this.context,this.state);this.enterRule(U,80,q.RULE_advancedIdentifier);try{switch(this.state=449,this.errorHandler.sync(this),this.tokenStream.LA(1)){case q.DEFAULT:case q.TYPE_ARRAY:case q.DEF_TYPE:case q.SWITCH_TYPE:case q.HEX_LITERAL:case q.COORD_LITERAL:case q.MAPZONE_LITERAL:case q.BOOLEAN_LITERAL:case q.NULL_LITERAL:case q.IDENTIFIER:this.enterOuterAlt(U,1),this.state=443,this.identifier();break;case q.IF:this.enterOuterAlt(U,2),this.state=444,this.match(q.IF);break;case q.ELSE:this.enterOuterAlt(U,3),this.state=445,this.match(q.ELSE);break;case q.WHILE:this.enterOuterAlt(U,4),this.state=446,this.match(q.WHILE);break;case q.RETURN:this.enterOuterAlt(U,5),this.state=447,this.match(q.RETURN);break;case q.CALC:this.enterOuterAlt(U,6),this.state=448,this.match(q.CALC);break;default:throw new h1(this)}}catch(X){if(X instanceof V)this.errorHandler.reportError(this,X),this.errorHandler.recover(this,X);else throw X}finally{this.exitRule()}return U}sempred(U,X,Y){switch(X){case 21:return this.condition_sempred(U,Y);case 23:return this.arithmetic_sempred(U,Y)}return!0}condition_sempred(U,X){switch(X){case 0:return this.precpred(this.context,5);case 1:return this.precpred(this.context,4);case 2:return this.precpred(this.context,3);case 3:return this.precpred(this.context,2)}return!0}arithmetic_sempred(U,X){switch(X){case 4:return this.precpred(this.context,5);case 5:return this.precpred(this.context,4);case 6:return this.precpred(this.context,3);case 7:return this.precpred(this.context,2)}return!0}static _serializedATN=[4,1,57,452,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2,33,7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2,39,7,39,2,40,7,40,1,0,5,0,84,8,0,10,0,12,0,87,9,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,3,1,96,8,1,1,1,1,1,1,1,3,1,101,8,1,1,1,1,1,1,1,1,1,3,1,107,8,1,1,1,3,1,110,8,1,3,1,112,8,1,1,1,5,1,115,8,1,10,1,12,1,118,9,1,1,2,1,2,1,2,5,2,123,8,2,10,2,12,2,126,9,2,1,3,1,3,1,3,1,3,1,4,1,4,1,4,5,4,135,8,4,10,4,12,4,138,9,4,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,3,5,150,8,5,1,6,1,6,5,6,154,8,6,10,6,12,6,157,9,6,1,6,1,6,1,7,1,7,1,7,3,7,164,8,7,1,7,3,7,167,8,7,1,7,1,7,1,8,1,8,1,8,1,8,1,8,1,8,1,8,3,8,178,8,8,1,9,1,9,1,9,1,9,1,9,1,9,1,10,1,10,1,10,1,10,5,10,190,8,10,10,10,12,10,193,9,10,1,10,1,10,1,11,1,11,1,11,3,11,200,8,11,1,11,1,11,5,11,204,8,11,10,11,12,11,207,9,11,1,12,1,12,1,12,1,12,1,12,3,12,214,8,12,1,12,1,12,1,13,1,13,1,13,1,13,1,13,1,13,1,14,1,14,1,14,1,14,1,14,1,15,1,15,1,15,1,16,1,16,1,17,1,17,1,17,5,17,237,8,17,10,17,12,17,240,9,17,1,18,1,18,1,18,1,18,1,19,1,19,1,19,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,20,3,20,259,8,20,1,21,1,21,1,21,1,21,1,21,1,21,3,21,267,8,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,5,21,281,8,21,10,21,12,21,284,9,21,1,22,1,22,1,22,1,22,1,22,1,23,1,23,1,23,1,23,1,23,1,23,3,23,297,8,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,1,23,5,23,311,8,23,10,23,12,23,314,9,23,1,24,1,24,1,24,1,24,3,24,320,8,24,1,24,1,24,1,24,3,24,325,8,24,1,24,1,24,1,24,1,24,1,24,3,24,332,8,24,1,24,1,24,1,24,1,24,1,24,1,24,3,24,340,8,24,1,24,3,24,343,8,24,1,24,1,24,1,24,1,24,3,24,349,8,24,1,24,3,24,352,8,24,3,24,354,8,24,1,25,1,25,1,25,3,25,359,8,25,1,25,3,25,362,8,25,1,25,1,25,3,25,366,8,25,1,25,3,25,369,8,25,1,25,1,25,1,26,1,26,1,26,5,26,376,8,26,10,26,12,26,379,9,26,1,27,1,27,1,27,3,27,384,8,27,1,28,1,28,1,28,1,29,1,29,1,29,1,29,1,30,1,30,1,30,1,30,3,30,397,8,30,1,31,1,31,1,31,1,32,1,32,1,32,1,32,1,32,1,32,1,32,3,32,409,8,32,1,33,1,33,5,33,413,8,33,10,33,12,33,416,9,33,1,33,1,33,1,34,1,34,1,35,1,35,1,35,1,35,1,35,5,35,427,8,35,10,35,12,35,430,9,35,1,35,1,35,1,36,1,36,1,37,1,37,1,38,1,38,1,38,1,38,1,39,1,39,1,40,1,40,1,40,1,40,1,40,1,40,3,40,450,8,40,1,40,0,2,42,46,41,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,0,7,2,0,35,35,48,48,1,0,24,27,1,0,18,19,2,0,12,13,15,15,1,0,10,11,1,0,52,54,5,0,32,32,35,37,39,42,44,44,48,48,490,0,85,1,0,0,0,2,90,1,0,0,0,4,119,1,0,0,0,6,127,1,0,0,0,8,131,1,0,0,0,10,149,1,0,0,0,12,151,1,0,0,0,14,160,1,0,0,0,16,170,1,0,0,0,18,179,1,0,0,0,20,185,1,0,0,0,22,196,1,0,0,0,24,208,1,0,0,0,26,217,1,0,0,0,28,223,1,0,0,0,30,228,1,0,0,0,32,231,1,0,0,0,34,233,1,0,0,0,36,241,1,0,0,0,38,245,1,0,0,0,40,258,1,0,0,0,42,266,1,0,0,0,44,285,1,0,0,0,46,296,1,0,0,0,48,353,1,0,0,0,50,355,1,0,0,0,52,372,1,0,0,0,54,383,1,0,0,0,56,385,1,0,0,0,58,388,1,0,0,0,60,396,1,0,0,0,62,398,1,0,0,0,64,408,1,0,0,0,66,410,1,0,0,0,68,419,1,0,0,0,70,421,1,0,0,0,72,433,1,0,0,0,74,435,1,0,0,0,76,437,1,0,0,0,78,441,1,0,0,0,80,449,1,0,0,0,82,84,3,2,1,0,83,82,1,0,0,0,84,87,1,0,0,0,85,83,1,0,0,0,85,86,1,0,0,0,86,88,1,0,0,0,87,85,1,0,0,0,88,89,5,0,0,1,89,1,1,0,0,0,90,91,5,6,0,0,91,92,3,78,39,0,92,93,5,5,0,0,93,95,3,78,39,0,94,96,5,12,0,0,95,94,1,0,0,0,95,96,1,0,0,0,96,97,1,0,0,0,97,111,5,7,0,0,98,100,5,1,0,0,99,101,3,4,2,0,100,99,1,0,0,0,100,101,1,0,0,0,101,102,1,0,0,0,102,103,5,2,0,0,103,109,1,0,0,0,104,106,5,1,0,0,105,107,3,8,4,0,106,105,1,0,0,0,106,107,1,0,0,0,107,108,1,0,0,0,108,110,5,2,0,0,109,104,1,0,0,0,109,110,1,0,0,0,110,112,1,0,0,0,111,98,1,0,0,0,111,112,1,0,0,0,112,116,1,0,0,0,113,115,3,10,5,0,114,113,1,0,0,0,115,118,1,0,0,0,116,114,1,0,0,0,116,117,1,0,0,0,117,3,1,0,0,0,118,116,1,0,0,0,119,124,3,6,3,0,120,121,5,5,0,0,121,123,3,6,3,0,122,120,1,0,0,0,123,126,1,0,0,0,124,122,1,0,0,0,124,125,1,0,0,0,125,5,1,0,0,0,126,124,1,0,0,0,127,128,7,0,0,0,128,129,5,20,0,0,129,130,3,80,40,0,130,7,1,0,0,0,131,136,5,48,0,0,132,133,5,5,0,0,133,135,5,48,0,0,134,132,1,0,0,0,135,138,1,0,0,0,136,134,1,0,0,0,136,137,1,0,0,0,137,9,1,0,0,0,138,136,1,0,0,0,139,150,3,12,6,0,140,150,3,14,7,0,141,150,3,16,8,0,142,150,3,18,9,0,143,150,3,20,10,0,144,150,3,24,12,0,145,150,3,26,13,0,146,150,3,28,14,0,147,150,3,30,15,0,148,150,3,32,16,0,149,139,1,0,0,0,149,140,1,0,0,0,149,141,1,0,0,0,149,142,1,0,0,0,149,143,1,0,0,0,149,144,1,0,0,0,149,145,1,0,0,0,149,146,1,0,0,0,149,147,1,0,0,0,149,148,1,0,0,0,150,11,1,0,0,0,151,155,5,8,0,0,152,154,3,10,5,0,153,152,1,0,0,0,154,157,1,0,0,0,155,153,1,0,0,0,155,156,1,0,0,0,156,158,1,0,0,0,157,155,1,0,0,0,158,159,5,9,0,0,159,13,1,0,0,0,160,166,5,33,0,0,161,163,5,1,0,0,162,164,3,34,17,0,163,162,1,0,0,0,163,164,1,0,0,0,164,165,1,0,0,0,165,167,5,2,0,0,166,161,1,0,0,0,166,167,1,0,0,0,167,168,1,0,0,0,168,169,5,4,0,0,169,15,1,0,0,0,170,171,5,28,0,0,171,172,5,1,0,0,172,173,3,42,21,0,173,174,5,2,0,0,174,177,3,10,5,0,175,176,5,29,0,0,176,178,3,10,5,0,177,175,1,0,0,0,177,178,1,0,0,0,178,17,1,0,0,0,179,180,5,30,0,0,180,181,5,1,0,0,181,182,3,42,21,0,182,183,5,2,0,0,183,184,3,10,5,0,184,19,1,0,0,0,185,186,5,37,0,0,186,187,3,36,18,0,187,191,5,8,0,0,188,190,3,22,11,0,189,188,1,0,0,0,190,193,1,0,0,0,191,189,1,0,0,0,191,192,1,0,0,0,192,194,1,0,0,0,193,191,1,0,0,0,194,195,5,9,0,0,195,21,1,0,0,0,196,199,5,31,0,0,197,200,5,32,0,0,198,200,3,34,17,0,199,197,1,0,0,0,199,198,1,0,0,0,200,201,1,0,0,0,201,205,5,3,0,0,202,204,3,10,5,0,203,202,1,0,0,0,204,207,1,0,0,0,205,203,1,0,0,0,205,206,1,0,0,0,206,23,1,0,0,0,207,205,1,0,0,0,208,209,5,36,0,0,209,210,5,20,0,0,210,213,3,80,40,0,211,212,5,18,0,0,212,214,3,40,20,0,213,211,1,0,0,0,213,214,1,0,0,0,214,215,1,0,0,0,215,216,5,4,0,0,216,25,1,0,0,0,217,218,5,36,0,0,218,219,5,20,0,0,219,220,3,80,40,0,220,221,3,36,18,0,221,222,5,4,0,0,222,27,1,0,0,0,223,224,3,52,26,0,224,225,5,18,0,0,225,226,3,34,17,0,226,227,5,4,0,0,227,29,1,0,0,0,228,229,3,40,20,0,229,230,5,4,0,0,230,31,1,0,0,0,231,232,5,4,0,0,232,33,1,0,0,0,233,238,3,40,20,0,234,235,5,5,0,0,235,237,3,40,20,0,236,234,1,0,0,0,237,240,1,0,0,0,238,236,1,0,0,0,238,239,1,0,0,0,239,35,1,0,0,0,240,238,1,0,0,0,241,242,5,1,0,0,242,243,3,40,20,0,243,244,5,2,0,0,244,37,1,0,0,0,245,246,3,40,20,0,246,247,5,0,0,1,247,39,1,0,0,0,248,259,3,36,18,0,249,259,3,44,22,0,250,259,3,48,24,0,251,259,3,56,28,0,252,259,3,58,29,0,253,259,3,60,30,0,254,259,3,62,31,0,255,259,3,64,32,0,256,259,3,70,35,0,257,259,3,78,39,0,258,248,1,0,0,0,258,249,1,0,0,0,258,250,1,0,0,0,258,251,1,0,0,0,258,252,1,0,0,0,258,253,1,0,0,0,258,254,1,0,0,0,258,255,1,0,0,0,258,256,1,0,0,0,258,257,1,0,0,0,259,41,1,0,0,0,260,261,6,21,-1,0,261,262,5,1,0,0,262,263,3,42,21,0,263,264,5,2,0,0,264,267,1,0,0,0,265,267,3,40,20,0,266,260,1,0,0,0,266,265,1,0,0,0,267,282,1,0,0,0,268,269,10,5,0,0,269,270,7,1,0,0,270,281,3,42,21,6,271,272,10,4,0,0,272,273,7,2,0,0,273,281,3,42,21,5,274,275,10,3,0,0,275,276,5,16,0,0,276,281,3,42,21,4,277,278,10,2,0,0,278,279,5,17,0,0,279,281,3,42,21,3,280,268,1,0,0,0,280,271,1,0,0,0,280,274,1,0,0,0,280,277,1,0,0,0,281,284,1,0,0,0,282,280,1,0,0,0,282,283,1,0,0,0,283,43,1,0,0,0,284,282,1,0,0,0,285,286,5,34,0,0,286,287,5,1,0,0,287,288,3,46,23,0,288,289,5,2,0,0,289,45,1,0,0,0,290,291,6,23,-1,0,291,292,5,1,0,0,292,293,3,46,23,0,293,294,5,2,0,0,294,297,1,0,0,0,295,297,3,40,20,0,296,290,1,0,0,0,296,295,1,0,0,0,297,312,1,0,0,0,298,299,10,5,0,0,299,300,7,3,0,0,300,311,3,46,23,6,301,302,10,4,0,0,302,303,7,4,0,0,303,311,3,46,23,5,304,305,10,3,0,0,305,306,5,16,0,0,306,311,3,46,23,4,307,308,10,2,0,0,308,309,5,17,0,0,309,311,3,46,23,3,310,298,1,0,0,0,310,301,1,0,0,0,310,304,1,0,0,0,310,307,1,0,0,0,311,314,1,0,0,0,312,310,1,0,0,0,312,313,1,0,0,0,313,47,1,0,0,0,314,312,1,0,0,0,315,316,3,78,39,0,316,317,5,12,0,0,317,319,5,1,0,0,318,320,3,34,17,0,319,318,1,0,0,0,319,320,1,0,0,0,320,321,1,0,0,0,321,322,5,2,0,0,322,324,5,1,0,0,323,325,3,34,17,0,324,323,1,0,0,0,324,325,1,0,0,0,325,326,1,0,0,0,326,327,5,2,0,0,327,354,1,0,0,0,328,329,3,78,39,0,329,331,5,1,0,0,330,332,3,34,17,0,331,330,1,0,0,0,331,332,1,0,0,0,332,333,1,0,0,0,333,334,5,2,0,0,334,354,1,0,0,0,335,336,5,22,0,0,336,342,3,78,39,0,337,339,5,1,0,0,338,340,3,34,17,0,339,338,1,0,0,0,339,340,1,0,0,0,340,341,1,0,0,0,341,343,5,2,0,0,342,337,1,0,0,0,342,343,1,0,0,0,343,354,1,0,0,0,344,345,5,23,0,0,345,351,3,78,39,0,346,348,5,1,0,0,347,349,3,34,17,0,348,347,1,0,0,0,348,349,1,0,0,0,349,350,1,0,0,0,350,352,5,2,0,0,351,346,1,0,0,0,351,352,1,0,0,0,352,354,1,0,0,0,353,315,1,0,0,0,353,328,1,0,0,0,353,335,1,0,0,0,353,344,1,0,0,0,354,49,1,0,0,0,355,361,3,78,39,0,356,358,5,1,0,0,357,359,3,34,17,0,358,357,1,0,0,0,358,359,1,0,0,0,359,360,1,0,0,0,360,362,5,2,0,0,361,356,1,0,0,0,361,362,1,0,0,0,362,368,1,0,0,0,363,365,5,8,0,0,364,366,3,34,17,0,365,364,1,0,0,0,365,366,1,0,0,0,366,367,1,0,0,0,367,369,5,9,0,0,368,363,1,0,0,0,368,369,1,0,0,0,369,370,1,0,0,0,370,371,5,0,0,1,371,51,1,0,0,0,372,377,3,54,27,0,373,374,5,5,0,0,374,376,3,54,27,0,375,373,1,0,0,0,376,379,1,0,0,0,377,375,1,0,0,0,377,378,1,0,0,0,378,53,1,0,0,0,379,377,1,0,0,0,380,384,3,56,28,0,381,384,3,58,29,0,382,384,3,60,30,0,383,380,1,0,0,0,383,381,1,0,0,0,383,382,1,0,0,0,384,55,1,0,0,0,385,386,5,20,0,0,386,387,3,80,40,0,387,57,1,0,0,0,388,389,5,20,0,0,389,390,3,80,40,0,390,391,3,36,18,0,391,59,1,0,0,0,392,393,5,15,0,0,393,397,3,80,40,0,394,395,5,14,0,0,395,397,3,80,40,0,396,392,1,0,0,0,396,394,1,0,0,0,397,61,1,0,0,0,398,399,5,21,0,0,399,400,3,80,40,0,400,63,1,0,0,0,401,409,5,38,0,0,402,409,5,39,0,0,403,409,5,40,0,0,404,409,5,42,0,0,405,409,5,43,0,0,406,409,5,44,0,0,407,409,3,66,33,0,408,401,1,0,0,0,408,402,1,0,0,0,408,403,1,0,0,0,408,404,1,0,0,0,408,405,1,0,0,0,408,406,1,0,0,0,408,407,1,0,0,0,409,65,1,0,0,0,410,414,5,47,0,0,411,413,3,68,34,0,412,411,1,0,0,0,413,416,1,0,0,0,414,412,1,0,0,0,414,415,1,0,0,0,415,417,1,0,0,0,416,414,1,0,0,0,417,418,5,50,0,0,418,67,1,0,0,0,419,420,5,51,0,0,420,69,1,0,0,0,421,428,5,47,0,0,422,427,3,68,34,0,423,427,3,72,36,0,424,427,3,74,37,0,425,427,3,76,38,0,426,422,1,0,0,0,426,423,1,0,0,0,426,424,1,0,0,0,426,425,1,0,0,0,427,430,1,0,0,0,428,426,1,0,0,0,428,429,1,0,0,0,429,431,1,0,0,0,430,428,1,0,0,0,431,432,5,50,0,0,432,71,1,0,0,0,433,434,7,5,0,0,434,73,1,0,0,0,435,436,5,55,0,0,436,75,1,0,0,0,437,438,5,56,0,0,438,439,3,40,20,0,439,440,5,57,0,0,440,77,1,0,0,0,441,442,7,6,0,0,442,79,1,0,0,0,443,450,3,78,39,0,444,450,5,28,0,0,445,450,5,29,0,0,446,450,5,30,0,0,447,450,5,33,0,0,448,450,5,34,0,0,449,443,1,0,0,0,449,444,1,0,0,0,449,445,1,0,0,0,449,446,1,0,0,0,449,447,1,0,0,0,449,448,1,0,0,0,450,81,1,0,0,0,46,85,95,100,106,109,111,116,124,136,149,155,163,166,177,191,199,205,213,238,258,266,280,282,296,310,312,319,324,331,339,342,348,351,353,358,361,365,368,377,383,396,408,414,426,428,449];static __ATN;static get _ATN(){if(!q.__ATN)q.__ATN=new N1().deserialize(q._serializedATN);return q.__ATN}static vocabulary=new f0(q.literalNames,q.symbolicNames,[]);get vocabulary(){return q.vocabulary}static decisionsToDFA=q._ATN.decisionToState.map((U,X)=>new o0(U,X))}class e6 extends C{constructor(U,X){super(U,X)}EOF(){return this.getToken(q.EOF,0)}script(U){if(U===void 0)return this.getRuleContexts(Z3);return this.getRuleContext(U,Z3)}get ruleIndex(){return q.RULE_scriptFile}accept(U){if(U.visitScriptFile)return U.visitScriptFile(this);else return U.visitChildren(this)}}class Z3 extends C{_trigger;_name;constructor(U,X){super(U,X)}LBRACK(){return this.getToken(q.LBRACK,0)}COMMA(){return this.getToken(q.COMMA,0)}RBRACK(){return this.getToken(q.RBRACK,0)}identifier(U){if(U===void 0)return this.getRuleContexts(d0);return this.getRuleContext(U,d0)}MUL(){return this.getToken(q.MUL,0)}statement(U){if(U===void 0)return this.getRuleContexts(V0);return this.getRuleContext(U,V0)}LPAREN(U){if(U===void 0)return this.getTokens(q.LPAREN);else return this.getToken(q.LPAREN,U)}RPAREN(U){if(U===void 0)return this.getTokens(q.RPAREN);else return this.getToken(q.RPAREN,U)}parameterList(){return this.getRuleContext(0,x4)}typeList(){return this.getRuleContext(0,g4)}get ruleIndex(){return q.RULE_script}accept(U){if(U.visitScript)return U.visitScript(this);else return U.visitChildren(this)}}class x4 extends C{constructor(U,X){super(U,X)}parameter(U){if(U===void 0)return this.getRuleContexts(J3);return this.getRuleContext(U,J3)}COMMA(U){if(U===void 0)return this.getTokens(q.COMMA);else return this.getToken(q.COMMA,U)}get ruleIndex(){return q.RULE_parameterList}accept(U){if(U.visitParameterList)return U.visitParameterList(this);else return U.visitChildren(this)}}class J3 extends C{_type_;constructor(U,X){super(U,X)}DOLLAR(){return this.getToken(q.DOLLAR,0)}advancedIdentifier(){return this.getRuleContext(0,U1)}IDENTIFIER(){return this.getToken(q.IDENTIFIER,0)}TYPE_ARRAY(){return this.getToken(q.TYPE_ARRAY,0)}get ruleIndex(){return q.RULE_parameter}accept(U){if(U.visitParameter)return U.visitParameter(this);else return U.visitChildren(this)}}class g4 extends C{constructor(U,X){super(U,X)}IDENTIFIER(U){if(U===void 0)return this.getTokens(q.IDENTIFIER);else return this.getToken(q.IDENTIFIER,U)}COMMA(U){if(U===void 0)return this.getTokens(q.COMMA);else return this.getToken(q.COMMA,U)}get ruleIndex(){return q.RULE_typeList}accept(U){if(U.visitTypeList)return U.visitTypeList(this);else return U.visitChildren(this)}}class V0 extends C{constructor(U,X){super(U,X)}blockStatement(){return this.getRuleContext(0,m4)}returnStatement(){return this.getRuleContext(0,d4)}ifStatement(){return this.getRuleContext(0,T4)}whileStatement(){return this.getRuleContext(0,l4)}switchStatement(){return this.getRuleContext(0,y4)}declarationStatement(){return this.getRuleContext(0,c4)}arrayDeclarationStatement(){return this.getRuleContext(0,a4)}assignmentStatement(){return this.getRuleContext(0,s4)}expressionStatement(){return this.getRuleContext(0,n4)}emptyStatement(){return this.getRuleContext(0,p4)}get ruleIndex(){return q.RULE_statement}accept(U){if(U.visitStatement)return U.visitStatement(this);else return U.visitChildren(this)}}class m4 extends C{constructor(U,X){super(U,X)}LBRACE(){return this.getToken(q.LBRACE,0)}RBRACE(){return this.getToken(q.RBRACE,0)}statement(U){if(U===void 0)return this.getRuleContexts(V0);return this.getRuleContext(U,V0)}get ruleIndex(){return q.RULE_blockStatement}accept(U){if(U.visitBlockStatement)return U.visitBlockStatement(this);else return U.visitChildren(this)}}class d4 extends C{constructor(U,X){super(U,X)}RETURN(){return this.getToken(q.RETURN,0)}SEMICOLON(){return this.getToken(q.SEMICOLON,0)}LPAREN(){return this.getToken(q.LPAREN,0)}RPAREN(){return this.getToken(q.RPAREN,0)}expressionList(){return this.getRuleContext(0,P0)}get ruleIndex(){return q.RULE_returnStatement}accept(U){if(U.visitReturnStatement)return U.visitReturnStatement(this);else return U.visitChildren(this)}}class T4 extends C{constructor(U,X){super(U,X)}IF(){return this.getToken(q.IF,0)}LPAREN(){return this.getToken(q.LPAREN,0)}condition(){return this.getRuleContext(0,z0)}RPAREN(){return this.getToken(q.RPAREN,0)}statement(U){if(U===void 0)return this.getRuleContexts(V0);return this.getRuleContext(U,V0)}ELSE(){return this.getToken(q.ELSE,0)}get ruleIndex(){return q.RULE_ifStatement}accept(U){if(U.visitIfStatement)return U.visitIfStatement(this);else return U.visitChildren(this)}}class l4 extends C{constructor(U,X){super(U,X)}WHILE(){return this.getToken(q.WHILE,0)}LPAREN(){return this.getToken(q.LPAREN,0)}condition(){return this.getRuleContext(0,z0)}RPAREN(){return this.getToken(q.RPAREN,0)}statement(){return this.getRuleContext(0,V0)}get ruleIndex(){return q.RULE_whileStatement}accept(U){if(U.visitWhileStatement)return U.visitWhileStatement(this);else return U.visitChildren(this)}}class y4 extends C{constructor(U,X){super(U,X)}SWITCH_TYPE(){return this.getToken(q.SWITCH_TYPE,0)}parenthesis(){return this.getRuleContext(0,t1)}LBRACE(){return this.getToken(q.LBRACE,0)}RBRACE(){return this.getToken(q.RBRACE,0)}switchCase(U){if(U===void 0)return this.getRuleContexts(Q3);return this.getRuleContext(U,Q3)}get ruleIndex(){return q.RULE_switchStatement}accept(U){if(U.visitSwitchStatement)return U.visitSwitchStatement(this);else return U.visitChildren(this)}}class Q3 extends C{constructor(U,X){super(U,X)}CASE(){return this.getToken(q.CASE,0)}COLON(){return this.getToken(q.COLON,0)}DEFAULT(){return this.getToken(q.DEFAULT,0)}expressionList(){return this.getRuleContext(0,P0)}statement(U){if(U===void 0)return this.getRuleContexts(V0);return this.getRuleContext(U,V0)}get ruleIndex(){return q.RULE_switchCase}accept(U){if(U.visitSwitchCase)return U.visitSwitchCase(this);else return U.visitChildren(this)}}class c4 extends C{constructor(U,X){super(U,X)}DEF_TYPE(){return this.getToken(q.DEF_TYPE,0)}DOLLAR(){return this.getToken(q.DOLLAR,0)}advancedIdentifier(){return this.getRuleContext(0,U1)}SEMICOLON(){return this.getToken(q.SEMICOLON,0)}EQ(){return this.getToken(q.EQ,0)}expression(){return this.getRuleContext(0,T)}get ruleIndex(){return q.RULE_declarationStatement}accept(U){if(U.visitDeclarationStatement)return U.visitDeclarationStatement(this);else return U.visitChildren(this)}}class a4 extends C{constructor(U,X){super(U,X)}DEF_TYPE(){return this.getToken(q.DEF_TYPE,0)}DOLLAR(){return this.getToken(q.DOLLAR,0)}advancedIdentifier(){return this.getRuleContext(0,U1)}parenthesis(){return this.getRuleContext(0,t1)}SEMICOLON(){return this.getToken(q.SEMICOLON,0)}get ruleIndex(){return q.RULE_arrayDeclarationStatement}accept(U){if(U.visitArrayDeclarationStatement)return U.visitArrayDeclarationStatement(this);else return U.visitChildren(this)}}class s4 extends C{constructor(U,X){super(U,X)}assignableVariableList(){return this.getRuleContext(0,i4)}EQ(){return this.getToken(q.EQ,0)}expressionList(){return this.getRuleContext(0,P0)}SEMICOLON(){return this.getToken(q.SEMICOLON,0)}get ruleIndex(){return q.RULE_assignmentStatement}accept(U){if(U.visitAssignmentStatement)return U.visitAssignmentStatement(this);else return U.visitChildren(this)}}class n4 extends C{constructor(U,X){super(U,X)}expression(){return this.getRuleContext(0,T)}SEMICOLON(){return this.getToken(q.SEMICOLON,0)}get ruleIndex(){return q.RULE_expressionStatement}accept(U){if(U.visitExpressionStatement)return U.visitExpressionStatement(this);else return U.visitChildren(this)}}class p4 extends C{constructor(U,X){super(U,X)}SEMICOLON(){return this.getToken(q.SEMICOLON,0)}get ruleIndex(){return q.RULE_emptyStatement}accept(U){if(U.visitEmptyStatement)return U.visitEmptyStatement(this);else return U.visitChildren(this)}}class P0 extends C{constructor(U,X){super(U,X)}expression(U){if(U===void 0)return this.getRuleContexts(T);return this.getRuleContext(U,T)}COMMA(U){if(U===void 0)return this.getTokens(q.COMMA);else return this.getToken(q.COMMA,U)}get ruleIndex(){return q.RULE_expressionList}accept(U){if(U.visitExpressionList)return U.visitExpressionList(this);else return U.visitChildren(this)}}class t1 extends C{constructor(U,X){super(U,X)}LPAREN(){return this.getToken(q.LPAREN,0)}expression(){return this.getRuleContext(0,T)}RPAREN(){return this.getToken(q.RPAREN,0)}get ruleIndex(){return q.RULE_parenthesis}accept(U){if(U.visitParenthesis)return U.visitParenthesis(this);else return U.visitChildren(this)}}class U9 extends C{constructor(U,X){super(U,X)}expression(){return this.getRuleContext(0,T)}EOF(){return this.getToken(q.EOF,0)}get ruleIndex(){return q.RULE_singleExpression}accept(U){if(U.visitSingleExpression)return U.visitSingleExpression(this);else return U.visitChildren(this)}}class T extends C{constructor(U,X){super(U,X)}get ruleIndex(){return q.RULE_expression}copyFrom(U){super.copyFrom(U)}}class X9 extends T{constructor(U){super(U.parent,U.invokingState);super.copyFrom(U)}parenthesis(){return this.getRuleContext(0,t1)}accept(U){if(U.visitParenthesizedExpression)return U.visitParenthesizedExpression(this);else return U.visitChildren(this)}}class Y9 extends T{constructor(U){super(U.parent,U.invokingState);super.copyFrom(U)}calc(){return this.getRuleContext(0,o4)}accept(U){if(U.visitCalcExpression)return U.visitCalcExpression(this);else return U.visitChildren(this)}}class G9 extends T{constructor(U){super(U.parent,U.invokingState);super.copyFrom(U)}call(){return this.getRuleContext(0,r1)}accept(U){if(U.visitCallExpression)return U.visitCallExpression(this);else return U.visitChildren(this)}}class $9 extends T{constructor(U){super(U.parent,U.invokingState);super.copyFrom(U)}localVariable(){return this.getRuleContext(0,q3)}accept(U){if(U.visitLocalVariableExpression)return U.visitLocalVariableExpression(this);else return U.visitChildren(this)}}class Z9 extends T{constructor(U){super(U.parent,U.invokingState);super.copyFrom(U)}localArrayVariable(){return this.getRuleContext(0,F3)}accept(U){if(U.visitLocalArrayVariableExpression)return U.visitLocalArrayVariableExpression(this);else return U.visitChildren(this)}}class J9 extends T{constructor(U){super(U.parent,U.invokingState);super.copyFrom(U)}gameVariable(){return this.getRuleContext(0,W3)}accept(U){if(U.visitGameVariableExpression)return U.visitGameVariableExpression(this);else return U.visitChildren(this)}}class Q9 extends T{constructor(U){super(U.parent,U.invokingState);super.copyFrom(U)}constantVariable(){return this.getRuleContext(0,t4)}accept(U){if(U.visitConstantVariableExpression)return U.visitConstantVariableExpression(this);else return U.visitChildren(this)}}class N9 extends T{constructor(U){super(U.parent,U.invokingState);super.copyFrom(U)}literal(){return this.getRuleContext(0,e0)}accept(U){if(U.visitLiteralExpression)return U.visitLiteralExpression(this);else return U.visitChildren(this)}}class q9 extends T{constructor(U){super(U.parent,U.invokingState);super.copyFrom(U)}joinedString(){return this.getRuleContext(0,e4)}accept(U){if(U.visitJoinedStringExpression)return U.visitJoinedStringExpression(this);else return U.visitChildren(this)}}class F9 extends T{constructor(U){super(U.parent,U.invokingState);super.copyFrom(U)}identifier(){return this.getRuleContext(0,d0)}accept(U){if(U.visitIdentifierExpression)return U.visitIdentifierExpression(this);else return U.visitChildren(this)}}class z0 extends C{constructor(U,X){super(U,X)}get ruleIndex(){return q.RULE_condition}copyFrom(U){super.copyFrom(U)}}class W9 extends z0{constructor(U){super(U.parent,U.invokingState);super.copyFrom(U)}LPAREN(){return this.getToken(q.LPAREN,0)}condition(){return this.getRuleContext(0,z0)}RPAREN(){return this.getToken(q.RPAREN,0)}accept(U){if(U.visitConditionParenthesizedExpression)return U.visitConditionParenthesizedExpression(this);else return U.visitChildren(this)}}class _9 extends z0{constructor(U){super(U.parent,U.invokingState);super.copyFrom(U)}expression(){return this.getRuleContext(0,T)}accept(U){if(U.visitConditionNormalExpression)return U.visitConditionNormalExpression(this);else return U.visitChildren(this)}}class f2 extends z0{_op;constructor(U){super(U.parent,U.invokingState);super.copyFrom(U)}condition(U){if(U===void 0)return this.getRuleContexts(z0);return this.getRuleContext(U,z0)}LT(){return this.getToken(q.LT,0)}GT(){return this.getToken(q.GT,0)}LTE(){return this.getToken(q.LTE,0)}GTE(){return this.getToken(q.GTE,0)}EQ(){return this.getToken(q.EQ,0)}EXCL(){return this.getToken(q.EXCL,0)}AND(){return this.getToken(q.AND,0)}OR(){return this.getToken(q.OR,0)}accept(U){if(U.visitConditionBinaryExpression)return U.visitConditionBinaryExpression(this);else return U.visitChildren(this)}}class o4 extends C{constructor(U,X){super(U,X)}CALC(){return this.getToken(q.CALC,0)}LPAREN(){return this.getToken(q.LPAREN,0)}arithmetic(){return this.getRuleContext(0,K0)}RPAREN(){return this.getToken(q.RPAREN,0)}get ruleIndex(){return q.RULE_calc}accept(U){if(U.visitCalc)return U.visitCalc(this);else return U.visitChildren(this)}}class K0 extends C{constructor(U,X){super(U,X)}get ruleIndex(){return q.RULE_arithmetic}copyFrom(U){super.copyFrom(U)}}class z9 extends K0{constructor(U){super(U.parent,U.invokingState);super.copyFrom(U)}LPAREN(){return this.getToken(q.LPAREN,0)}arithmetic(){return this.getRuleContext(0,K0)}RPAREN(){return this.getToken(q.RPAREN,0)}accept(U){if(U.visitArithmeticParenthesizedExpression)return U.visitArithmeticParenthesizedExpression(this);else return U.visitChildren(this)}}class I9 extends K0{constructor(U){super(U.parent,U.invokingState);super.copyFrom(U)}expression(){return this.getRuleContext(0,T)}accept(U){if(U.visitArithmeticNormalExpression)return U.visitArithmeticNormalExpression(this);else return U.visitChildren(this)}}class V2 extends K0{_op;constructor(U){super(U.parent,U.invokingState);super.copyFrom(U)}arithmetic(U){if(U===void 0)return this.getRuleContexts(K0);return this.getRuleContext(U,K0)}MUL(){return this.getToken(q.MUL,0)}DIV(){return this.getToken(q.DIV,0)}MOD(){return this.getToken(q.MOD,0)}PLUS(){return this.getToken(q.PLUS,0)}MINUS(){return this.getToken(q.MINUS,0)}AND(){return this.getToken(q.AND,0)}OR(){return this.getToken(q.OR,0)}accept(U){if(U.visitArithmeticBinaryExpression)return U.visitArithmeticBinaryExpression(this);else return U.visitChildren(this)}}class r1 extends C{constructor(U,X){super(U,X)}get ruleIndex(){return q.RULE_call}copyFrom(U){super.copyFrom(U)}}class v4 extends r1{constructor(U){super(U.parent,U.invokingState);super.copyFrom(U)}identifier(){return this.getRuleContext(0,d0)}MUL(){return this.getToken(q.MUL,0)}LPAREN(U){if(U===void 0)return this.getTokens(q.LPAREN);else return this.getToken(q.LPAREN,U)}RPAREN(U){if(U===void 0)return this.getTokens(q.RPAREN);else return this.getToken(q.RPAREN,U)}expressionList(U){if(U===void 0)return this.getRuleContexts(P0);return this.getRuleContext(U,P0)}accept(U){if(U.visitCommandCallExpression)return U.visitCommandCallExpression(this);else return U.visitChildren(this)}}class A9 extends r1{constructor(U){super(U.parent,U.invokingState);super.copyFrom(U)}TILDE(){return this.getToken(q.TILDE,0)}identifier(){return this.getRuleContext(0,d0)}LPAREN(){return this.getToken(q.LPAREN,0)}RPAREN(){return this.getToken(q.RPAREN,0)}expressionList(){return this.getRuleContext(0,P0)}accept(U){if(U.visitProcCallExpression)return U.visitProcCallExpression(this);else return U.visitChildren(this)}}class K9 extends r1{constructor(U){super(U.parent,U.invokingState);super.copyFrom(U)}AT(){return this.getToken(q.AT,0)}identifier(){return this.getRuleContext(0,d0)}LPAREN(){return this.getToken(q.LPAREN,0)}RPAREN(){return this.getToken(q.RPAREN,0)}expressionList(){return this.getRuleContext(0,P0)}accept(U){if(U.visitJumpCallExpression)return U.visitJumpCallExpression(this);else return U.visitChildren(this)}}class D9 extends C{_args;_triggers;constructor(U,X){super(U,X)}identifier(){return this.getRuleContext(0,d0)}EOF(){return this.getToken(q.EOF,0)}LPAREN(){return this.getToken(q.LPAREN,0)}RPAREN(){return this.getToken(q.RPAREN,0)}LBRACE(){return this.getToken(q.LBRACE,0)}RBRACE(){return this.getToken(q.RBRACE,0)}expressionList(U){if(U===void 0)return this.getRuleContexts(P0);return this.getRuleContext(U,P0)}get ruleIndex(){return q.RULE_clientScript}accept(U){if(U.visitClientScript)return U.visitClientScript(this);else return U.visitChildren(this)}}class i4 extends C{constructor(U,X){super(U,X)}assignableVariable(U){if(U===void 0)return this.getRuleContexts(N3);return this.getRuleContext(U,N3)}COMMA(U){if(U===void 0)return this.getTokens(q.COMMA);else return this.getToken(q.COMMA,U)}get ruleIndex(){return q.RULE_assignableVariableList}accept(U){if(U.visitAssignableVariableList)return U.visitAssignableVariableList(this);else return U.visitChildren(this)}}class N3 extends C{constructor(U,X){super(U,X)}localVariable(){return this.getRuleContext(0,q3)}localArrayVariable(){return this.getRuleContext(0,F3)}gameVariable(){return this.getRuleContext(0,W3)}get ruleIndex(){return q.RULE_assignableVariable}accept(U){if(U.visitAssignableVariable)return U.visitAssignableVariable(this);else return U.visitChildren(this)}}class q3 extends C{constructor(U,X){super(U,X)}DOLLAR(){return this.getToken(q.DOLLAR,0)}advancedIdentifier(){return this.getRuleContext(0,U1)}get ruleIndex(){return q.RULE_localVariable}accept(U){if(U.visitLocalVariable)return U.visitLocalVariable(this);else return U.visitChildren(this)}}class F3 extends C{constructor(U,X){super(U,X)}DOLLAR(){return this.getToken(q.DOLLAR,0)}advancedIdentifier(){return this.getRuleContext(0,U1)}parenthesis(){return this.getRuleContext(0,t1)}get ruleIndex(){return q.RULE_localArrayVariable}accept(U){if(U.visitLocalArrayVariable)return U.visitLocalArrayVariable(this);else return U.visitChildren(this)}}class W3 extends C{constructor(U,X){super(U,X)}MOD(){return this.getToken(q.MOD,0)}advancedIdentifier(){return this.getRuleContext(0,U1)}DOTMOD(){return this.getToken(q.DOTMOD,0)}get ruleIndex(){return q.RULE_gameVariable}accept(U){if(U.visitGameVariable)return U.visitGameVariable(this);else return U.visitChildren(this)}}class t4 extends C{constructor(U,X){super(U,X)}CARET(){return this.getToken(q.CARET,0)}advancedIdentifier(){return this.getRuleContext(0,U1)}get ruleIndex(){return q.RULE_constantVariable}accept(U){if(U.visitConstantVariable)return U.visitConstantVariable(this);else return U.visitChildren(this)}}class e0 extends C{constructor(U,X){super(U,X)}get ruleIndex(){return q.RULE_literal}copyFrom(U){super.copyFrom(U)}}class S4 extends e0{constructor(U){super(U.parent,U.invokingState);super.copyFrom(U)}INTEGER_LITERAL(){return this.getToken(q.INTEGER_LITERAL,0)}HEX_LITERAL(){return this.getToken(q.HEX_LITERAL,0)}accept(U){if(U.visitIntegerLiteral)return U.visitIntegerLiteral(this);else return U.visitChildren(this)}}class B9 extends e0{constructor(U){super(U.parent,U.invokingState);super.copyFrom(U)}COORD_LITERAL(){return this.getToken(q.COORD_LITERAL,0)}accept(U){if(U.visitCoordLiteral)return U.visitCoordLiteral(this);else return U.visitChildren(this)}}class w9 extends e0{constructor(U){super(U.parent,U.invokingState);super.copyFrom(U)}BOOLEAN_LITERAL(){return this.getToken(q.BOOLEAN_LITERAL,0)}accept(U){if(U.visitBooleanLiteral)return U.visitBooleanLiteral(this);else return U.visitChildren(this)}}class R9 extends e0{constructor(U){super(U.parent,U.invokingState);super.copyFrom(U)}CHAR_LITERAL(){return this.getToken(q.CHAR_LITERAL,0)}accept(U){if(U.visitCharacterLiteral)return U.visitCharacterLiteral(this);else return U.visitChildren(this)}}class H9 extends e0{constructor(U){super(U.parent,U.invokingState);super.copyFrom(U)}NULL_LITERAL(){return this.getToken(q.NULL_LITERAL,0)}accept(U){if(U.visitNullLiteral)return U.visitNullLiteral(this);else return U.visitChildren(this)}}class L9 extends e0{constructor(U){super(U.parent,U.invokingState);super.copyFrom(U)}stringLiteral(){return this.getRuleContext(0,r4)}accept(U){if(U.visitStringLiteralExpression)return U.visitStringLiteralExpression(this);else return U.visitChildren(this)}}class r4 extends C{constructor(U,X){super(U,X)}QUOTE_OPEN(){return this.getToken(q.QUOTE_OPEN,0)}QUOTE_CLOSE(){return this.getToken(q.QUOTE_CLOSE,0)}stringLiteralContent(U){if(U===void 0)return this.getRuleContexts(_1);return this.getRuleContext(U,_1)}get ruleIndex(){return q.RULE_stringLiteral}accept(U){if(U.visitStringLiteral)return U.visitStringLiteral(this);else return U.visitChildren(this)}}class _1 extends C{constructor(U,X){super(U,X)}STRING_TEXT(){return this.getToken(q.STRING_TEXT,0)}get ruleIndex(){return q.RULE_stringLiteralContent}accept(U){if(U.visitStringLiteralContent)return U.visitStringLiteralContent(this);else return U.visitChildren(this)}}class e4 extends C{constructor(U,X){super(U,X)}QUOTE_OPEN(){return this.getToken(q.QUOTE_OPEN,0)}QUOTE_CLOSE(){return this.getToken(q.QUOTE_CLOSE,0)}stringLiteralContent(U){if(U===void 0)return this.getRuleContexts(_1);return this.getRuleContext(U,_1)}stringTag(U){if(U===void 0)return this.getRuleContexts(p1);return this.getRuleContext(U,p1)}stringPTag(U){if(U===void 0)return this.getRuleContexts(o1);return this.getRuleContext(U,o1)}stringExpression(U){if(U===void 0)return this.getRuleContexts(i1);return this.getRuleContext(U,i1)}get ruleIndex(){return q.RULE_joinedString}accept(U){if(U.visitJoinedString)return U.visitJoinedString(this);else return U.visitChildren(this)}}class p1 extends C{constructor(U,X){super(U,X)}STRING_TAG(){return this.getToken(q.STRING_TAG,0)}STRING_CLOSE_TAG(){return this.getToken(q.STRING_CLOSE_TAG,0)}STRING_PARTIAL_TAG(){return this.getToken(q.STRING_PARTIAL_TAG,0)}get ruleIndex(){return q.RULE_stringTag}accept(U){if(U.visitStringTag)return U.visitStringTag(this);else return U.visitChildren(this)}}class o1 extends C{constructor(U,X){super(U,X)}STRING_P_TAG(){return this.getToken(q.STRING_P_TAG,0)}get ruleIndex(){return q.RULE_stringPTag}accept(U){if(U.visitStringPTag)return U.visitStringPTag(this);else return U.visitChildren(this)}}class i1 extends C{constructor(U,X){super(U,X)}STRING_EXPR_START(){return this.getToken(q.STRING_EXPR_START,0)}expression(){return this.getRuleContext(0,T)}STRING_EXPR_END(){return this.getToken(q.STRING_EXPR_END,0)}get ruleIndex(){return q.RULE_stringExpression}accept(U){if(U.visitStringExpression)return U.visitStringExpression(this);else return U.visitChildren(this)}}class d0 extends C{constructor(U,X){super(U,X)}IDENTIFIER(){return this.getToken(q.IDENTIFIER,0)}HEX_LITERAL(){return this.getToken(q.HEX_LITERAL,0)}BOOLEAN_LITERAL(){return this.getToken(q.BOOLEAN_LITERAL,0)}NULL_LITERAL(){return this.getToken(q.NULL_LITERAL,0)}COORD_LITERAL(){return this.getToken(q.COORD_LITERAL,0)}MAPZONE_LITERAL(){return this.getToken(q.MAPZONE_LITERAL,0)}TYPE_ARRAY(){return this.getToken(q.TYPE_ARRAY,0)}SWITCH_TYPE(){return this.getToken(q.SWITCH_TYPE,0)}DEF_TYPE(){return this.getToken(q.DEF_TYPE,0)}DEFAULT(){return this.getToken(q.DEFAULT,0)}get ruleIndex(){return q.RULE_identifier}accept(U){if(U.visitIdentifier)return U.visitIdentifier(this);else return U.visitChildren(this)}}class U1 extends C{constructor(U,X){super(U,X)}identifier(){return this.getRuleContext(0,d0)}IF(){return this.getToken(q.IF,0)}ELSE(){return this.getToken(q.ELSE,0)}WHILE(){return this.getToken(q.WHILE,0)}RETURN(){return this.getToken(q.RETURN,0)}CALC(){return this.getToken(q.CALC,0)}get ruleIndex(){return q.RULE_advancedIdentifier}accept(U){if(U.visitAdvancedIdentifier)return U.visitAdvancedIdentifier(this);else return U.visitChildren(this)}}class U5 extends n6{visitScriptFile;visitScript;visitParameterList;visitParameter;visitTypeList;visitStatement;visitBlockStatement;visitReturnStatement;visitIfStatement;visitWhileStatement;visitSwitchStatement;visitSwitchCase;visitDeclarationStatement;visitArrayDeclarationStatement;visitAssignmentStatement;visitExpressionStatement;visitEmptyStatement;visitExpressionList;visitParenthesis;visitSingleExpression;visitParenthesizedExpression;visitCalcExpression;visitCallExpression;visitLocalVariableExpression;visitLocalArrayVariableExpression;visitGameVariableExpression;visitConstantVariableExpression;visitLiteralExpression;visitJoinedStringExpression;visitIdentifierExpression;visitConditionParenthesizedExpression;visitConditionNormalExpression;visitConditionBinaryExpression;visitCalc;visitArithmeticParenthesizedExpression;visitArithmeticNormalExpression;visitArithmeticBinaryExpression;visitCommandCallExpression;visitProcCallExpression;visitJumpCallExpression;visitClientScript;visitAssignableVariableList;visitAssignableVariable;visitLocalVariable;visitLocalArrayVariable;visitGameVariable;visitConstantVariable;visitIntegerLiteral;visitCoordLiteral;visitBooleanLiteral;visitCharacterLiteral;visitNullLiteral;visitStringLiteralExpression;visitStringLiteral;visitStringLiteralContent;visitJoinedString;visitStringTag;visitStringPTag;visitStringExpression;visitIdentifier;visitAdvancedIdentifier}class X5 extends U5{source;lineOffset;columnOffset;constructor(U,X,Y){super();this.source=U,this.lineOffset=X,this.columnOffset=Y}visitScriptFile=(U)=>{return new I4(this.location(U),U.script().map((X)=>this.visitNode(X)))};visitScript=(U)=>{let X=U.typeList()?.IDENTIFIER()?.map((Y)=>this.toAstToken(Y.symbol));return new q1({source:this.location(U),trigger:this.visitNode(U._trigger),name:this.visitNode(U._name),isStar:U.MUL()!==null,parameters:U.parameterList()?.parameter().map((Y)=>this.visitNode(Y))??null,returnTokens:X??null,statements:U.statement().map((Y)=>this.visitNode(Y))})};visitParameter=(U)=>{return new A4(this.location(U),this.toAstToken(U._type_),this.visitNode(U.advancedIdentifier()))};visitBlockStatement=(U)=>{return new K4(this.location(U),U.statement().map((X)=>this.visitNode(X)))};visitReturnStatement=(U)=>{return new B4(this.location(U),this.collectExpressionList(U.expressionList()))};visitIfStatement=(U)=>{let X=U.statement();if(!X[0])throw Error("IfStatement missing then statement.");return new w4(this.location(U),this.visitNode(U.condition()),this.visitNode(X[0]),X.length>1?this.visitNode(X[1]):null)};visitWhileStatement=(U)=>{return new R4(this.location(U),this.visitNode(U.condition()),this.visitNode(U.statement()))};visitSwitchStatement=(U)=>{return new O2(this.location(U),this.toAstToken(U.SWITCH_TYPE().symbol),this.extractParenthesisExpression(U.parenthesis()),U.switchCase().map((X)=>this.visitNode(X)))};visitSwitchCase=(U)=>{return new H4(this.location(U),this.collectExpressionList(U.expressionList()),U.statement()?.map((X)=>this.visitNode(X))??[])};visitDeclarationStatement=(U)=>{return new L4(this.location(U),this.toAstToken(U.DEF_TYPE().symbol),this.visitNode(U.advancedIdentifier()),U.expression()?this.visitNode(U.expression()):null)};visitArrayDeclarationStatement=(U)=>{return new M4(this.location(U),this.toAstToken(U.DEF_TYPE().symbol),this.visitNode(U.advancedIdentifier()),this.extractParenthesisExpression(U.parenthesis()))};visitAssignmentStatement=(U)=>{return new k4(this.location(U),U.assignableVariableList().assignableVariable().map((X)=>this.visitNode(X)),this.collectExpressionList(U.expressionList()))};visitExpressionStatement=(U)=>{return new O4(this.location(U),this.visitNode(U.expression()))};visitEmptyStatement=(U)=>{return new j4(this.location(U))};visitSingleExpression=(U)=>{return this.visitNode(U.expression())};visitParenthesizedExpression=(U)=>{return new i0(this.location(U),this.extractParenthesisExpression(U.parenthesis()))};visitConditionParenthesizedExpression=(U)=>{return new i0(this.location(U),this.visitNode(U.condition()))};visitArithmeticParenthesizedExpression=(U)=>{return new i0(this.location(U),this.visitNode(U.arithmetic()))};visitConditionBinaryExpression=(U)=>{return new P1(this.location(U),this.visitNode(U.condition(0)),this.toAstToken(U._op),this.visitNode(U.condition(1)))};visitArithmeticBinaryExpression=(U)=>{return new h4(this.location(U),this.visitNode(U.arithmetic(0)),this.toAstToken(U._op),this.visitNode(U.arithmetic(1)))};visitCalcExpression=(U)=>{return new E4(this.location(U),this.visitNode(U.calc().arithmetic()))};visitCommandCallExpression=(U)=>{let X=U.expressionList(),Y=Array.isArray(X)?X:X?[X]:[],G=U.MUL()!==null?this.collectExpressionList(Y[1]):null;return new m0(this.location(U),this.visitNode(U.identifier()),this.collectExpressionList(Y[0]),G)};visitProcCallExpression=(U)=>{let X=U.expressionList(),Y=Array.isArray(X)?X:X?[X]:[];return new j2(this.location(U),this.visitNode(U.identifier()),this.collectExpressionList(Y[0]))};visitJumpCallExpression=(U)=>{let X=U.expressionList(),Y=Array.isArray(X)?X:X?[X]:[];return new h2(this.location(U),this.visitNode(U.identifier()),this.collectExpressionList(Y[0]))};visitClientScript=(U)=>{return new E2(this.location(U),this.visitNode(U.identifier()),this.collectExpressionList(U._args),this.collectExpressionList(U._triggers))};visitLocalVariable=(U)=>{return new F1(this.location(U),this.visitNode(U.advancedIdentifier()),null)};visitLocalArrayVariable=(U)=>{return new F1(this.location(U),this.visitNode(U.advancedIdentifier()),this.extractParenthesisExpression(U.parenthesis()))};visitGameVariable=(U)=>{let X=U.DOTMOD()!==null;return new C2(this.location(U),X,this.visitNode(U.advancedIdentifier()))};visitConstantVariable=(U)=>{return new V1(this.location(U),this.visitNode(U.advancedIdentifier()))};visitIntegerLiteral=(U)=>{let X=U.getText();if(X.length>1&&X[0]==="0"&&(X[1]==="x"||X[1]==="X"))return new $3(this.location(U),parseInt(X.slice(2),16));return new $3(this.location(U),parseInt(X,10))};visitCoordLiteral=(U)=>{let Y=U.getText().split("_").map((Q)=>parseInt(Q,10)),G=Y[1]<<6|Y[3]&16383,$=Y[2]<<6|Y[4]&16383,Z=Y[0]&3,J=$|G<<14|Z<<28|0;return new C4(this.location(U),J)};visitBooleanLiteral=(U)=>{return new f4(this.location(U),U.getText()==="true")};visitCharacterLiteral=(U)=>{let X=this.unescape(U.getText().slice(1,-1));if(X.length!==1)throw Error(`invalid character literal: text=${U.getText()}, cleaned=${X}`);return new V4(this.location(U),X)};visitStringLiteral=(U)=>{return new W1(this.location(U),this.unescape(U.getText().slice(1,-1)))};visitNullLiteral=(U)=>{return new D4(this.location(U))};visitJoinedString=(U)=>{let X=[];for(let Y of U.children??[])if(Y instanceof _1)X.push(new t0(this.location(Y),this.unescape(Y.getText())));else if(Y instanceof p1)X.push(new t0(this.location(Y),Y.getText()));else if(Y instanceof o1)X.push(new u4(this.location(Y),Y.getText()));else if(Y instanceof i1){let G=this.visitNode(Y.expression());X.push(new r0(this.location(Y),G))}return new P4(this.location(U),X)};visitIdentifier=(U)=>{return new _0(this.location(U),U.getText())};visitAdvancedIdentifier=(U)=>{return new _0(this.location(U),U.getText())};visitConditionNormalExpression=(U)=>{return this.visitNode(U.expression())};visitArithmeticNormalExpression=(U)=>{return this.visitNode(U.expression())};visitCallExpression=(U)=>{return this.visitNode(U.call())};visitIdentifierExpression=(U)=>{return this.visitNode(U.identifier())};visitLiteralExpression=(U)=>{return this.visitNode(U.literal())};visitJoinedStringExpression=(U)=>{return this.visitNode(U.joinedString())};visitLocalVariableExpression=(U)=>{return this.visitNode(U.localVariable())};visitLocalArrayVariableExpression=(U)=>{return this.visitNode(U.localArrayVariable())};visitGameVariableExpression=(U)=>{return this.visitNode(U.gameVariable())};visitConstantVariableExpression=(U)=>{return this.visitNode(U.constantVariable())};location(U){let X=U.stop??U.start;return this.locationFromRange(U.start,X)}locationFromToken(U){return this.locationFromRange(U,U)}locationFromRange(U,X){let Y=U.line===1?this.columnOffset:0,G=X.line===1?this.columnOffset:0,$=Math.max(X.text?.length??0,1);return{name:this.source,line:U.line-1+this.lineOffset,column:U.column+Y,endLine:X.line-1+this.lineOffset,endColumn:X.column+G+$}}toAstToken(U){return new z4(this.locationFromToken(U),U.text??"")}visitNode(U){if(!U)throw Error("Expected parser context but recieved null/undefined.");return this.visit(U)}collectExpressionList(U){if(!U)return[];let X=U.expression();return(Array.isArray(X)?X:[X]).map((G)=>this.visitNode(G))}extractParenthesisExpression(U){return this.visitNode(U.expression())}unescape(U){let X="";for(let Y=0;Y<U.length;Y+=1){let G=U[Y];if(G==="\\"){let $=Y===U.length-1?"\\":U[Y+1];if($==="\\"||$==="'"||$==='"'||$==="<")X+=$;else throw Error(`Unsupported escape sequence: \\${$}`);Y+=1}else X+=G}return X}}class e1{static createScriptFile(U,X){let Y=v8(U,"utf8"),G=H0.fromString(Y);return G.name=U,this.invokeParser(G,($)=>$.scriptFile(),X)}static async createScriptFileAsync(U,X){let Y=await S8(U,"utf8"),G=H0.fromString(Y);return G.name=U,this.invokeParser(G,($)=>$.scriptFile(),X)}static createScriptFileFromString(U,X){let Y=H0.fromString(U);return Y.name="<source>",this.invokeParser(Y,(G)=>G.scriptFile(),X)}static createScript(U,X){let Y=H0.fromString(U);return Y.name="<source>",this.invokeParser(Y,(G)=>G.script(),X)}static invokeParser(U,X,Y,G=0,$=0){let Z=new c(U),J=new G3(Z),Q=new q(J);if(Y)Z.removeErrorListeners(),Z.addErrorListener(Y),Q.removeErrorListeners(),Q.addErrorListener(Y);let F=X(Q);if(Q.numberOfSyntaxErrors>0)return null;return new X5(U.getSourceName(),G,$).visit(F)}}class X1{visitScriptFile(U){return this.visitNode(U)}visitScript(U){return this.visitNode(U)}visitParameter(U){return this.visitNode(U)}visitBlockStatement(U){return this.visitStatement(U)}visitReturnStatement(U){return this.visitStatement(U)}visitIfStatement(U){return this.visitStatement(U)}visitWhileStatement(U){return this.visitStatement(U)}visitSwitchStatement(U){return this.visitStatement(U)}visitSwitchCase(U){return this.visitNode(U)}visitDeclarationStatement(U){return this.visitStatement(U)}visitArrayDeclarationStatement(U){return this.visitStatement(U)}visitAssignmentStatement(U){return this.visitStatement(U)}visitExpressionStatement(U){return this.visitStatement(U)}visitEmptyStatement(U){return this.visitStatement(U)}visitStatement(U){return this.visitNode(U)}visitParenthesizedExpression(U){return this.visitExpression(U)}visitConditionExpression(U){return this.visitBinaryExpression(U)}visitArithmeticExpression(U){return this.visitBinaryExpression(U)}visitBinaryExpression(U){return this.visitExpression(U)}visitCalcExpression(U){return this.visitExpression(U)}visitProcCallExpression(U){return this.visitCallExpression(U)}visitCommandCallExpression(U){return this.visitCallExpression(U)}visitJumpCallExpression(U){return this.visitCallExpression(U)}visitCallExpression(U){return this.visitExpression(U)}visitClientScriptExpression(U){return this.visitExpression(U)}visitLocalVariableExpression(U){return this.visitVariableExpression(U)}visitGameVariableExpression(U){return this.visitVariableExpression(U)}visitConstantVariableExpression(U){return this.visitVariableExpression(U)}visitVariableExpression(U){return this.visitExpression(U)}visitExpression(U){return this.visitNode(U)}visitIntegerLiteral(U){return this.visitLiteral(U)}visitCoordLiteral(U){return this.visitLiteral(U)}visitBooleanLiteral(U){return this.visitLiteral(U)}visitCharacterLiteral(U){return this.visitLiteral(U)}visitNullLiteral(U){return this.visitLiteral(U)}visitStringLiteral(U){return this.visitLiteral(U)}visitLiteral(U){return this.visitExpression(U)}visitJoinedStringExpression(U){return this.visitExpression(U)}visitJoinedStringPart(U){return this.visitNode(U)}visitIdentifier(U){return this.visitExpression(U)}visitToken(U){return this.visitNode(U)}visitNode(U){throw Error(`Not implemented: ${U.constructor.name}`)}}var M={UNSUPPORTED_SYMBOLTYPE_TO_TYPE:"Internal compiler error: Unsupported SymbolType -> Type conversion: %s",CASE_WITHOUT_SWITCH:"Internal compiler error: Case without switch statement as parent.",RETURN_ORPHAN:"Internal compiler error: Orphaned `return` statement, no parent `script` node found.",TRIGGER_TYPE_NOT_FOUND:"Internal compiler error: The trigger '%s' has no declaration.",CUSTOM_HANDLER_NOTYPE:"Internal compiler error: Custom command handler did not assign return type.",CUSTOM_HANDLER_NOSYMBOL:"Internal compiler error: Custom command handler did not assign symbol.",SYMBOL_IS_NULL:"Internal compiler error: Symbol has not been defined for the node.",TYPE_HAS_NO_BASETYPE:"Internal compiler error: Type has no defined base type: %s.",TYPE_HAS_NO_DEFAULT:"Internal compiler error: Return type '%s' has no defined default value.",INVALID_CONDITION:"Internal compiler error: %s is not a supported expression type for conditions.",NULL_CONSTANT:"Internal compiler error: %s evaluated to 'null' constant value.",EXPRESSION_NO_SUBEXPR:"Internal compiler error: No sub expression node.",GENERIC_INVALID_TYPE:"'%s' is not a valid type.",GENERIC_TYPE_MISMATCH:"Type mismatch: '%s' was given but '%s' was expected.",GENERIC_UNRESOLVED_SYMBOL:"'%s' could not be resolved to a symbol.",ARITHMETIC_INVALID_TYPE:"Type mismatch: '%s' was given but 'int' or 'long' was expected.",SCRIPT_REDECLARATION:"[%s,%s] is already defined.",SCRIPT_LOCAL_REDECLARATION:"'$%s' is already defined.",SCRIPT_TRIGGER_INVALID:"'%s' is not a valid trigger type.",SCRIPT_COMMAND_ONLY:"Using a '*' is only allowed for commands.",SCRIPT_TRIGGER_NO_PARAMETERS:"The trigger type '%s' is not allowed to have parameters defined.",SCRIPT_TRIGGER_EXPECTED_PARAMETERS:"The trigger type '%s' is expected to accept (%s).",SCRIPT_TRIGGER_NO_RETURNS:"The trigger type '%s' is not allowed to return values.",SCRIPT_TRIGGER_EXPECTED_RETURNS:"The trigger type '%s' is expected to return (%s).",SCRIPT_SUBJECT_ONLY_GLOBAL:"Trigger '%s' only allows global subjects.",SCRIPT_SUBJECT_NO_GLOBAL:"Trigger '%s' does not allow global subjects.",SCRIPT_SUBJECT_NO_CATEGORY:"Trigger '%s' does not allow category subjects.",SWITCH_INVALID_TYPE:"'%s' is not allowed within a switch statement.",SWITCH_DUPLICATE_DEFAULT:"Duplicate default label.",SWITCH_CASE_NOT_CONSTANT:"Switch case value is not a constant expression.",ASSIGN_MULTI_ARRAY:"Arrays are not allowed in multi-assignment statements.",CONDITION_INVALID_NODE_TYPE:"Conditions are only allowed to be binary expressions.",BINOP_INVALID_TYPES:"Operator '%s' cannot be applied to '%s', '%s'.",BINOP_TUPLE_TYPE:"%s side of binary expressions can only have one type but has '%s'.",COMMAND_REFERENCE_UNRESOLVED:"'%s' cannot be resolved to a command.",COMMAND_NOARGS_EXPECTED:"'%s' is expected to have no arguments but has '%s'.",PROC_REFERENCE_UNRESOLVED:"'~%s' cannot be resolved to a proc.",PROC_NOARGS_EXPECTED:"'~%s' is expected to have no arguments but has '%s'.",JUMP_REFERENCE_UNRESOLVED:"'@%s' cannot be resolved to a label.",JUMP_NOARGS_EXPECTED:"'@%s' is expected to have no arguments but has '%s'.",CLIENTSCRIPT_REFERENCE_UNRESOLVED:"'%s' cannot be resolved to a clientscript.",CLIENTSCRIPT_NOARGS_EXPECTED:"'%s' is expected to have no arguments but has '%s'.",HOOK_TRANSMIT_LIST_UNEXPECTED:"Unexpected hook transmit list.",LOCAL_DECLARATION_INVALID_TYPE:"'%s' is not allowed to be declared as a type.",LOCAL_REFERENCE_UNRESOLVED:"'$%s' cannot be resolved to a local variable.",LOCAL_REFERENCE_NOT_ARRAY:"Access of indexed value of non-array type variable '$%s'.",LOCAL_ARRAY_INVALID_TYPE:"'%s' is not allowed to be used as an array.",LOCAL_ARRAY_REFERENCE_NOINDEX:"'$%s' is a reference to an array variable without specifying the index.",GAME_REFERENCE_UNRESOLVED:"'%%%s' cannot be resolved to a game variable.",CONSTANT_REFERENCE_UNRESOLVED:"'^%s' cannot be resolved to a constant.",CONSTANT_CYCLIC_REF:"Cyclic constant references are not permitted: %s.",CONSTANT_UNKNOWN_TYPE:"Unable to infer type for '^%s'.",CONSTANT_PARSE_ERROR:"Unable to parse constant value of '%s' into type '%s'.",CONSTANT_NONCONSTANT:"Constant value of '%s' evaluated to a non-constant expression.",POINTER_UNINITIALIZED:"Attempt to access uninitialized pointer %s.",POINTER_CORRUPTED:"Attempt to access corrupted pointer %s.",POINTER_CORRUPTED_LOC:"%s corrupted here.",POINTER_REQUIRED_LOC:"%s required here."};var M9=new WeakMap,k9=new WeakMap,O9=new Map,x8={kind:"LocalVariable"},g8={kind:"Constant"},l={serverScript:(U)=>{let X=M9.get(U);if(!X)X={kind:"ServerScript",type:U},M9.set(U,X);return X},clientScript:(U)=>{let X=k9.get(U);if(!X)X={kind:"ClientScript",type:U},k9.set(U,X);return X},localVariable:()=>x8,basic:(U)=>{let X=O9.get(U);if(!X)X={kind:"Basic",type:U},O9.set(U,X);return X},constant:()=>g8};class Y5 extends X1{typeManager;triggerManager;rootTable;diagnostics;tables=[];get table(){return this.tables[0]}categoryType;constructor(U,X,Y,G){super();this.typeManager=U;this.triggerManager=X;this.rootTable=Y;this.diagnostics=G;this.categoryType=this.typeManager.findOrNull("category"),this.tables.unshift(this.rootTable.createSubTable())}isTypeMode(U){return"type"in U}createScopedTable(U){this.tables.unshift(this.table.createSubTable());try{U()}finally{this.tables.shift()}}visitScriptFile(U){for(let X of U.scripts)this.createScopedTable(()=>{X.accept(this)})}visitScript(U){let X=this.triggerManager.findOrNull(U.trigger.text);if(!X)U.trigger.reportError(this.diagnostics,M.SCRIPT_TRIGGER_INVALID,U.trigger.text);else U.triggerType=X;if(U.isStar&&X!==A0)U.name.reportError(this.diagnostics,M.SCRIPT_COMMAND_ONLY);this.checkScriptSubject(X,U);let Y=U.parameters;Y?.forEach(($)=>$.accept(this)),U.parameterType=E.fromList(Y?.map(($)=>$.symbol.type??K.Error)??[]),this.checkScriptParameters(X,U,Y);let G=U.returnTokens;if(G&&G.length>0){let $=[];for(let Z of G){let J=this.typeManager.findOrNull(Z.text);if(!J)Z.reportError(this.diagnostics,M.GENERIC_INVALID_TYPE,Z.text);$.push(J??K.Error)}U.returnType=E.fromList($.map((Z)=>Z??K.Error))}else U.returnType=!X?K.Error:X.allowReturns?K.Unit:K.Nothing;if(this.checkScriptReturns(X,U),X){let $=new z2(X,U.nameString,U.parameterType,U.returnType);if(!this.rootTable.insert(l.serverScript(X),$))U.reportError(this.diagnostics,M.SCRIPT_REDECLARATION,X.identifier,U.nameString);else U.symbol=$}U.statements.forEach(($)=>$.accept(this)),U.block=this.table}checkScriptSubject(U,X){let Y=U?.subjectMode;if(!Y)return;let G=X.name.text;if(Y===B.Name)return;if(G==="_"){this.checkGlobalScriptSubject(U,X);return}if(G.startsWith("_")){this.checkCategoryScriptSubject(U,X,G.substring(1));return}this.checkTypeScriptSubject(U,X,G)}checkGlobalScriptSubject(U,X){let Y=U.subjectMode;if(Y===B.None)return;if(this.isTypeMode(Y)){if(!Y.global)X.name.reportError(this.diagnostics,M.SCRIPT_SUBJECT_NO_GLOBAL,U.identifier);return}throw Error(`Unexpected subject mode: ${Y}.`)}checkCategoryScriptSubject(U,X,Y){let G=U.subjectMode,$=this.categoryType;if(!$)throw Error("'category' type not defined.");if(G===B.None){X.name.reportError(this.diagnostics,M.SCRIPT_SUBJECT_ONLY_GLOBAL,U.identifier);return}if(this.isTypeMode(G)){if(!G.category){X.name.reportError(this.diagnostics,M.SCRIPT_SUBJECT_NO_CATEGORY,U.identifier);return}this.resolveSubjectSymbol(X,Y,$);return}throw Error(`Unexpected subject mode: ${G}.`)}checkTypeScriptSubject(U,X,Y){let G=U.subjectMode;if(G===B.None){X.name.reportError(this.diagnostics,M.SCRIPT_SUBJECT_ONLY_GLOBAL,U.identifier);return}if(this.isTypeMode(G)){this.resolveSubjectSymbol(X,Y,G.type);return}throw Error(`Unexpected subject mode: ${G}.`)}tryParseMapZone(U,X){let Y=X.split("_");if(Y.length!==3)return U.name.reportError(this.diagnostics,"Mapzone subject must be of the form: 'level_mx_mz'."),-1;let[G,$,Z]=Y,J=parseInt(G,10),Q=parseInt($,10),F=parseInt(Z,10);if(Q<0||Q>255||F<0||F>255)U.name.reportError(this.diagnostics,"Invalid mapzone coord.");if(J!==0)return U.name.reportError(this.diagnostics,"Mapzone affect all level, just specify '0'."),-1;let _=Q<<6;return F<<6&16383|(_&16383)<<14}tryParseZone(U,X){let Y=X.split("_");if(Y.length!==5)return U.name.reportError(this.diagnostics,"Zone subject must be of the form: 'level_mx_mz_lx_lz'."),-1;let[G,$,Z,J,Q]=Y,F=parseInt(G,10),_=parseInt($,10),I=parseInt(Z,10),H=parseInt(J,10),j=parseInt(Q,10);if(F<0||F>3||_<0||_>255||I<0||I>255||H<0||H>63||j<0||j>63)U.name.reportError(this.diagnostics,"Invalid zone coord.");if(H%8!==0||j%8!==0)return U.name.reportError(this.diagnostics,"Local zone coord must be a multiple of 8"),-1;let P=(_<<6|H)>>3<<3;return(I<<6|j)>>3<<3&16383|(P&16383)<<14|(F&3)<<28}resolveSubjectSymbol(U,X,Y){if(Y===L.MAPZONE){let $=this.tryParseMapZone(U,X);U.subjectReference=new J0($.toString(),Y,!1);return}if(Y===L.COORD){let $=this.tryParseZone(U,X);U.subjectReference=new J0($.toString(),Y,!1);return}let G=this.rootTable.find(l.basic(Y),X);if(!G){U.name.reportError(this.diagnostics,M.GENERIC_UNRESOLVED_SYMBOL,X);return}if(!(("type"in G)&&("isProtected"in G))){U.name.reportError(this.diagnostics,M.GENERIC_UNRESOLVED_SYMBOL,X);return}U.subjectReference=G}checkScriptParameters(U,X,Y){let G=U?.parameters,$=X.parameterType;if(U&&!U.allowParameters&&Y&&Y.length>0)Y[0].reportError(this.diagnostics,M.SCRIPT_TRIGGER_NO_PARAMETERS,U.identifier);else if(G&&$!==G){let Z=G.representation;X.reportError(this.diagnostics,M.SCRIPT_TRIGGER_EXPECTED_PARAMETERS,X.trigger.text,Z)}}checkScriptReturns(U,X){let Y=U?.returns,G=X.returnType;if(U&&!U.allowReturns&&G!==K.Nothing)X.reportError(this.diagnostics,M.SCRIPT_TRIGGER_NO_RETURNS,U.identifier);else if(Y&&G!==Y){let $=Y.representation;X.reportError(this.diagnostics,M.SCRIPT_TRIGGER_EXPECTED_RETURNS,X.trigger.text,$)}}visitParameter(U){let X=U.name.text,Y=U.typeToken.text,G=this.typeManager.findOrNull(Y,!0);if(!G)U.reportError(this.diagnostics,M.GENERIC_INVALID_TYPE,Y);let $=new k0(X,G??K.Error);if(!this.table.insert(l.localVariable(),$))U.reportError(this.diagnostics,M.SCRIPT_LOCAL_REDECLARATION,X);U.symbol=$}visitBlockStatement(U){this.createScopedTable(()=>{this.visit(U.statements),U.scope=this.table})}visitSwitchStatement(U){let X=U.typeToken.text.replace(/^switch_/,""),Y=this.typeManager.findOrNull(X);if(!Y)U.typeToken.reportError(this.diagnostics,M.GENERIC_INVALID_TYPE,X);else if(!Y?.options?.allowSwitch)U.typeToken.reportError(this.diagnostics,M.SWITCH_INVALID_TYPE,Y.representation);U.condition.accept(this),this.visit(U.cases),U.type=Y??K.Error}visitSwitchCase(U){this.visit(U.keys),this.createScopedTable(()=>{this.visit(U.statements),U.scope=this.table})}visitNode(U){this.visit(U.children)}visit(U){for(let X of U)X.accept(this)}}class _3{typeChecker;typeManager;expression;diagnostics;get arguments(){if(this.expression instanceof Y0)return this.expression.arguments;return[]}get isConstant(){if(!this.expression)return!1;return this.typeChecker.isConstantExpression(this.expression)}constructor(U,X,Y,G){this.typeChecker=U;this.typeManager=X;this.expression=Y;this.diagnostics=G}getArgumentsList(U=!1){if(U&&this.expression instanceof m0)return this.expression.arguments2??[];return this.arguments}checkArgument(U,X,Y=!1){let G=this.getArgumentsList(Y);if(U<0||U>=G.length)return null;let $=G[U];return this.visitExpression($,X),$}checkTypeArgument(U){let X=this.arguments;if(U<0||U>=X.length)return null;let Y=X[U];if(!(Y instanceof _0))return this.diagnostics.report(new W0("ERROR",Y,_3.DIAGNOSTIC_TYPEREF_EXPECTED)),Y.type=K.Error,Y;let G=this.typeManager.findOrNull(Y.text);if(!G)return this.diagnostics.report(new W0("ERROR",Y,M.GENERIC_INVALID_TYPE,Y.text)),Y.type=K.Error,Y;return Y.type=new K.Type(G),Y.reference=new J0(Y.text,Y.type),Y}checkArgumentTypes(U,X=!0,Y=!1){let G=this.getArgumentsList(Y),$=[];for(let J of G){if(!J.getNullableType())this.visitExpression(J);$.push(J.type??K.Error)}let Z=E.fromList($.map((J)=>J??K.Error));return this.typeChecker.checkTypeMatch(this.expression,U,Z,X)}collectTypes(...U){return E.fromList(U.filter((X)=>!!X).map((X)=>X.getNullableType()??K.Error))}visitNode(U){if(U)this.typeChecker.visitNodeOrNull(U)}visitExpression(U,X){if(!U)return;if(X)U.typeHint=X;this.typeChecker.visitNodeOrNull(U)}visitNodeList(U){if(!U)return;for(let X of U)this.typeChecker.visitNodeOrNull(X)}static DIAGNOSTIC_TYPEREF_EXPECTED="Type reference expected."}class T0 extends X1{typeManager;triggerManager;rootTable;dynamicCommands;diagnostics;commandTrigger;procTrigger;clientscriptTrigger;labelTrigger;table;constantsBeingEvaluated;constructor(U,X,Y,G,$){super();this.typeManager=U;this.triggerManager=X;this.rootTable=Y;this.dynamicCommands=G;this.diagnostics=$;this.commandTrigger=this.triggerManager.find("command"),this.procTrigger=this.triggerManager.find("proc"),this.clientscriptTrigger=this.triggerManager.findOrNull("clientscript"),this.labelTrigger=this.triggerManager.findOrNull("label"),this.table=this.rootTable,this.constantsBeingEvaluated=new Set}scoped(U,X){let Y=this.table;this.table=U,X(),this.table=Y}visitScriptFile(U){this.visitNodes(U.scripts)}visitScript(U){this.scoped(U.block,()=>{this.visitNodes(U.statements)})}visitBlockStatement(U){this.scoped(U.scope,()=>{this.visitNodes(U.statements)})}visitReturnStatement(U){let X=U.findParentByType(q1);if(X==null){U.reportError(this.diagnostics,M.RETURN_ORPHAN);return}let Y=E.toList(X.returnType),G=this.typeHintExpressionList(Y,U.expressions),$=E.fromList(Y),Z=E.fromList(G);this.checkTypeMatch(U,$,Z)}visitIfStatement(U){this.checkCondition(U.condition),this.visitNodeOrNull(U.thenStatement),this.visitNodeOrNull(U.elseStatement)}visitWhileStatement(U){this.checkCondition(U.condition),this.visitNodeOrNull(U.thenStatement)}checkCondition(U){U.typeHint=L.BOOLEAN;let X=this.findInvalidConditionExpression(U);if(X==null)this.visitNodeOrNull(U),this.checkTypeMatch(U,L.BOOLEAN,U.type??K.Error);else X.reportError(this.diagnostics,M.CONDITION_INVALID_NODE_TYPE)}findInvalidConditionExpression(U){if(U instanceof P1){let X=U.operator.text;if(X==="|"||X==="&")return this.findInvalidConditionExpression(U.left)??this.findInvalidConditionExpression(U.right);else return null}else if(U instanceof i0)return this.findInvalidConditionExpression(U.expression);else return U}visitSwitchStatement(U){let{type:X,condition:Y}=U;Y.typeHint=X,this.visitNodeOrNull(Y),this.checkTypeMatch(Y,X,Y.type??K.Error);let G=null;for(let $ of U.cases){if($.isDefault)if(G==null)G=$;else $.reportError(this.diagnostics,M.SWITCH_DUPLICATE_DEFAULT);this.visitNodeOrNull($)}U.defaultCase=G}visitSwitchCase(U){let X=U.findParentByType(O2);if(!X){U.reportError(this.diagnostics,M.CASE_WITHOUT_SWITCH);return}let Y=X.type;for(let G of U.keys){if(G.typeHint=Y,this.visitNodeOrNull(G),!this.isConstantExpression(G)){G.reportError(this.diagnostics,M.SWITCH_CASE_NOT_CONSTANT);continue}this.checkTypeMatch(G,Y,G.type)}this.scoped(U.scope,()=>{this.visitNodes(U.statements)})}isConstantExpression(U){if(U instanceof V1)return!0;if(U instanceof W1){let X=U.subExpression;return X==null||this.isConstantExpression(X)}if(U instanceof e)return!0;if(U instanceof _0){let X=U.reference;return X==null||this.isConstantSymobl(X)}return!1}isConstantSymobl(U){return U instanceof J0||U instanceof g1}visitDeclarationStatement(U){let X=U.typeToken.text.replace(/^def_/,""),Y=U.name.text,G=this.typeManager.findOrNull(X);if(!G)U.typeToken.reportError(this.diagnostics,M.GENERIC_INVALID_TYPE,X);else if(G.options&&!G.options.allowDeclaration)U.typeToken.reportError(this.diagnostics,M.LOCAL_DECLARATION_INVALID_TYPE,G.representation);let $=new k0(Y,G??K.Error);if(!this.table.insert(l.localVariable(),$))U.name.reportError(this.diagnostics,M.SCRIPT_LOCAL_REDECLARATION,Y);let J=U.initializer;if(J!=null)J.typeHint=$.type,this.visitNodeOrNull(J),this.checkTypeMatch(J,$.type,J.type??K.Error);U.symbol=$}visitArrayDeclarationStatement(U){let X=U.typeToken.text.replace(/^def_/,""),Y=U.name.text,G=this.typeManager.findOrNull(X);if(!G)U.typeToken.reportError(this.diagnostics,M.GENERIC_INVALID_TYPE,X);else if(G.options&&!G.options.allowDeclaration)U.typeToken.reportError(this.diagnostics,M.LOCAL_DECLARATION_INVALID_TYPE,G.representation);else if(G.options&&!G.options.allowArray)U.typeToken.reportError(this.diagnostics,M.LOCAL_ARRAY_INVALID_TYPE,G.representation);if(G)G=new o(G);else G=K.Error;let $=U.initializer;$.typeHint=L.INT,this.visitNodeOrNull($),this.checkTypeMatch($,L.INT,$.type??K.Error);let Z=new k0(Y,G);if(!this.table.insert(l.localVariable(),Z))U.name.reportError(this.diagnostics,M.SCRIPT_LOCAL_REDECLARATION,Y);U.symbol=Z}visitAssignmentStatement(U){let X=U.vars;this.visitNodes(X);let Y=X.map((Q)=>this.getSafeType(Q)),G=this.typeHintExpressionList(Y,U.expressions).map((Q)=>Q??K.Error),$=E.fromList(Y),Z=E.fromList(G);this.checkTypeMatch(U,$,Z);let J=X.find((Q)=>Q instanceof F1&&Q.isArray);if(X.length>1&&J)J.reportError(this.diagnostics,M.ASSIGN_MULTI_ARRAY)}visitExpressionStatement(U){this.visitNodeOrNull(U.expression)}visitEmptyStatement(U){}visitParenthesizedExpression(U){let X=U.expression;X.typeHint=U.typeHint,this.visitNodeOrNull(X),U.type=X.type}visitConditionExpression(U){let{left:X,right:Y,operator:G}=U;if(!this.checkBinaryConditionOperation(X,G,Y)){U.type=K.Error;return}U.type=L.BOOLEAN}checkBinaryConditionOperation(U,X,Y){let G;switch(X.text){case"&":case"|":G=T0.ALLOWED_LOGICAL_TYPES;break;case"<":case">":case"<=":case">=":G=T0.ALLOWED_RELATIONAL_TYPES;break;default:G=null}if(G!=null)U.typeHint=G[0],Y.typeHint=G[0];else U.typeHint=U.typeHint??(Y.type??null),Y.typeHint=Y.typeHint??(U.type??null);if(this.visitNodeOrNull(U),Y.typeHint=Y.typeHint??U.type,this.visitNodeOrNull(Y),U.type==null||Y.type==null)return X.reportError(this.diagnostics,M.BINOP_INVALID_TYPES,X.text,U.type?U.type.representation:"<null>",Y.type?Y.type.representation:"<null>"),!1;if(U.type instanceof E||Y.type instanceof E){if(U.type instanceof E)U.reportError(this.diagnostics,M.BINOP_TUPLE_TYPE,"Left",U.type.representation);if(Y.type instanceof E)Y.reportError(this.diagnostics,M.BINOP_TUPLE_TYPE,"Right",Y.type.representation);return!1}else if(U.type==K.Unit||Y.type==K.Unit)return X.reportError(this.diagnostics,M.BINOP_INVALID_TYPES,X.text,U.type.representation,Y.type.representation),!1;if(G!=null){if(!this.checkTypeMatchAny(U,G,U.type)||!this.checkTypeMatchAny(Y,G,Y.type))return X.reportError(this.diagnostics,M.BINOP_INVALID_TYPES,X.text,U.type.representation,Y.type.representation),!1}if(!this.checkTypeMatch(U,U.type,Y.type,!1))return X.reportError(this.diagnostics,M.BINOP_INVALID_TYPES,X.text,U.type.representation,Y.type.representation),!1;else if(U.type==L.STRING&&Y.type==L.STRING)return X.reportError(this.diagnostics,M.BINOP_INVALID_TYPES,X.text,U.type.representation,Y.type.representation),!1;return!0}visitArithmeticExpression(U){let{left:X,right:Y,operator:G}=U,$=U.typeHint??L.INT;if(X.typeHint=$,this.visitNodeOrNull(X),Y.typeHint=$,this.visitNodeOrNull(Y),X.type==null||Y.type==null||!this.checkTypeMatchAny(X,T0.ALLOWED_ARITHMETIC_TYPES,X.type??K.Error)||!this.checkTypeMatchAny(X,T0.ALLOWED_ARITHMETIC_TYPES,Y.type??K.Error)||!this.checkTypeMatch(X,$,X.type??K.Error,!1)||!this.checkTypeMatch(Y,$,Y.type??K.Error,!1)){G.reportError(this.diagnostics,M.BINOP_INVALID_TYPES,G.text,X.type?X.type.representation:"<null>",Y.type?Y.type.representation:"<null>"),U.type=K.Error;return}U.type=$}visitCalcExpression(U){let X=U.typeHint??L.INT,Y=U.expression;if(Y.typeHint=X,this.visitNodeOrNull(Y),Y.type==null||!this.checkTypeMatchAny(Y,T0.ALLOWED_ARITHMETIC_TYPES,Y.type??K.Error))Y.reportError(this.diagnostics,M.ARITHMETIC_INVALID_TYPE,Y.type?Y.type.representation:"<null>"),U.type=K.Error;else U.type=Y.type}visitCommandCallExpression(U){let X=U.nameString;if(this.checkDynamicCommand(X,U))return;this.checkCallExpression(U,this.commandTrigger,M.COMMAND_REFERENCE_UNRESOLVED)}visitProcCallExpression(U){this.checkCallExpression(U,this.procTrigger,M.PROC_REFERENCE_UNRESOLVED)}visitJumpCallExpression(U){if(!this.labelTrigger){U.reportError(this.diagnostics,"Jump expression not allowed.");return}let X=U.findParentByType(q1);if(!X)throw Error("Parent script not found.");if(X.triggerType===this.procTrigger){U.reportError(this.diagnostics,"Unable to jump to labels from within a proc.");return}this.checkCallExpression(U,this.labelTrigger,M.JUMP_REFERENCE_UNRESOLVED)}checkDynamicCommand(U,X){let Y=this.dynamicCommands.get(U);if(!Y)return!1;return(()=>{let G=new _3(this,this.typeManager,X,this.diagnostics);if(Y.typeCheck(G),!X.getNullableType())X.reportError(this.diagnostics,M.CUSTOM_HANDLER_NOTYPE);if(X instanceof _0&&!X.reference||X instanceof Y0&&!X.symbol){let Z=this.rootTable.find(l.serverScript(this.commandTrigger),U);if(!Z)X.reportError(this.diagnostics,M.CUSTOM_HANDLER_NOSYMBOL);if(X instanceof _0)X.reference=Z;else if(X instanceof Y0)X.symbol=Z}})(),!0}checkCallExpression(U,X,Y){let G=U.name.text,$=l.serverScript(X),Z=this.rootTable.find($,G);if(!Z)U.type=K.Error,U.reportError(this.diagnostics,Y,G);else U.symbol=Z,U.type=Z.returns;this.typeCheckArguments(Z,U,G)}visitClientScriptExpression(U){if(!this.clientscriptTrigger){U.reportError(this.diagnostics,M.TRIGGER_TYPE_NOT_FOUND,"clientscript");return}let X=U.typeHint;if(!(X instanceof K.Hook))throw Error("Expected MetaType Hook");let Y=U.name.text,G=l.clientScript(this.clientscriptTrigger),$=this.rootTable.find(G,Y);if(!$)U.reportError(this.diagnostics,M.CLIENTSCRIPT_REFERENCE_UNRESOLVED,Y),U.type=K.Error;else U.symbol=$,U.type=X;this.typeCheckArguments($,U,Y);let Z=X.transmitListType;if(Z==K.Unit&&U.transmitList.length>0){U.transmitList[0].reportError(this.diagnostics,M.HOOK_TRANSMIT_LIST_UNEXPECTED),U.type=K.Error;return}for(let J of U.transmitList)J.typeHint=Z,this.visitNodeOrNull(J),this.checkTypeMatch(J,Z,J.type??K.Error)}typeCheckArguments(U,X,Y){let G=U?.parameters??K.Error,$=G instanceof E?[...G.children]:[G],Z=this.typeHintExpressionList($,X.arguments),J=E.fromList($),Q=E.fromList(Z);if(J==K.Unit&&Q!=K.Unit){let F;if(X instanceof m0)F=M.COMMAND_NOARGS_EXPECTED;else if(X instanceof j2)F=M.PROC_NOARGS_EXPECTED;else if(X instanceof h2)F=M.JUMP_NOARGS_EXPECTED;else if(X instanceof E2)F=M.CLIENTSCRIPT_NOARGS_EXPECTED;else throw Error(`Unexpected callExpression type: ${X}`);X.reportError(this.diagnostics,F,Y,Q.representation);return}this.checkTypeMatch(X,J,Q)}visitLocalVariableExpression(U){let X=U.name.text,Y=this.table.find(l.localVariable(),X);if(!Y){U.reportError(this.diagnostics,M.LOCAL_REFERENCE_UNRESOLVED,X),U.type=K.Error;return}let G=Y.type instanceof o;if(!G&&U.isArray){U.reportError(this.diagnostics,M.LOCAL_REFERENCE_NOT_ARRAY,X),U.type=K.Error;return}if(G&&!U.isArray){U.reportError(this.diagnostics,M.LOCAL_ARRAY_REFERENCE_NOINDEX,X),U.type=K.Error;return}let $=U.index;if(Y.type instanceof o&&$!=null)this.visitNodeOrNull($),this.checkTypeMatch($,L.INT,$.type??K.Error);U.reference=Y,U.type=Y.type instanceof o?Y.type.inner:Y.type}visitGameVariableExpression(U){let X=U.name.text,Y=this.rootTable.findAll(X).find((G)=>G.type instanceof $1);if(!Y||!(Y.type instanceof $1)){U.type=K.Error,U.reportError(this.diagnostics,M.GAME_REFERENCE_UNRESOLVED,X);return}U.reference=Y,U.type=Y.type.inner}visitConstantVariableExpression(U){let X=U.name.text,Y=U.typeHint;if(!Y){U.reportError(this.diagnostics,M.CONSTANT_UNKNOWN_TYPE,X),U.type=K.Error;return}else if(Y==K.Error){U.type=K.Error;return}let G=this.rootTable.find(l.constant(),X);if(!G){U.reportError(this.diagnostics,M.CONSTANT_REFERENCE_UNRESOLVED,X),U.type=K.Error;return}if(this.constantsBeingEvaluated.has(G)){let $=Array.from(this.constantsBeingEvaluated).map((Z)=>`^${Z.name}`).join(" -> ");$+=` -> ^${G.name}`,U.reportError(this.diagnostics,M.CONSTANT_CYCLIC_REF,$),U.type=K.Error;return}this.constantsBeingEvaluated.add(G);try{let{name:$,line:Z,column:J}=U.source,Q=this.typeManager.findOrNull("graphic"),F=Y==L.STRING||Q!=null&&Y==Q,_=H0.fromString(G.value);_.name=$;let I=F?new W1({name:$,line:Z-1,column:J-1,endLine:Z-1,endColumn:J},G.value):e1.invokeParser(_,(H)=>H.singleExpression(),T0.DISCARD_ERROR_LISTENER,Z-1,J-1);if(!I){U.reportError(this.diagnostics,M.CONSTANT_PARSE_ERROR,G.value,Y.representation),U.type=K.Error;return}if(I.typeHint=Y,this.visitNodeOrNull(I),!this.isConstantExpression(I)){U.reportError(this.diagnostics,M.CONSTANT_NONCONSTANT,G.value),U.type=K.Error;return}U.subExpression=I,U.type=I.type}finally{this.constantsBeingEvaluated.delete(G)}}visitIntegerLiteral(U){U.type=L.INT}visitCoordLiteral(U){U.type=L.COORD}visitBooleanLiteral(U){U.type=L.BOOLEAN}visitCharacterLiteral(U){U.type=L.CHAR}visitNullLiteral(U){let X=U.typeHint;if(X!=null){U.type=X;return}U.type=L.INT}visitStringLiteral(U){let X=U.typeHint;if(!X||this.typeManager.check(X,L.STRING))U.type=L.STRING;else if(X instanceof K.Hook)this.handleClientScriptExpression(U,X);else if(!T0.LITERAL_TYPES.has(X))U.symbol=this.resolveSymbol(U,U.value,X);else U.type=L.STRING}handleClientScriptExpression(U,X){let{name:Y,line:G,column:$}=U.source,Z=new B2(Y,this.diagnostics,G-1,$),J=H0.fromString(U.value);J.name=Y;let Q=e1.invokeParser(J,(F)=>F.clientScript(),Z,G-1,$);if(!Q){U.type=K.Error;return}Q.typeHint=X,this.visitNodeOrNull(Q),U.subExpression=Q,U.type=Q.type}visitJoinedStringExpression(U){U.parts.forEach((X)=>X.accept(this)),U.type=L.STRING}visitJoinedStringPart(U){if(U instanceof r0){let X=U.expression;X.typeHint=L.STRING,X.accept(this),this.checkTypeMatch(X,L.STRING,X.type??K.Error)}}visitIdentifier(U){let{text:X,typeHint:Y}=U;if(this.checkDynamicCommand(X,U))return;let G=this.resolveSymbol(U,X,Y??void 0);if(!G)return;if(G instanceof s0&&G.trigger===this.commandTrigger&&G.parameters!==K.Unit)U.reportError(this.diagnostics,M.GENERIC_TYPE_MISMATCH,"<unit>",G.parameters.representation);U.reference=G}resolveSymbol(U,X,Y){let G=null,$=null;for(let Z of this.table.findAll(X)){let J=this.symbolToType(Z);if(!J)continue;if(!Y&&J instanceof K.Script)continue;else if(!Y||this.typeManager.check(Y,J)){G=Z,$=J;break}else if(!G)G=Z,$=J}if(!G)return U.type=K.Error,U.reportError(this.diagnostics,M.GENERIC_UNRESOLVED_SYMBOL,X),null;if(!$)return U.type=K.Error,U.reportError(this.diagnostics,M.UNSUPPORTED_SYMBOLTYPE_TO_TYPE,G.constructor.name),null;return U.type=$,G}symbolToType(U){if(U instanceof s0)if(U.trigger===A0)return U.returns;else return new K.Script(U.trigger,U.parameters,U.returns);else if(U instanceof k0)if(U.type instanceof o)return U.type;else return null;else if(U instanceof J0)return U.type;else if(U instanceof g1)return null;return null}visitToken(U){}visitNode(U){let X=U.parent;if(!X)U.reportInfo(this.diagnostics,`Unhandled node: ${U.constructor.name}.`);else U.reportInfo(this.diagnostics,`Unhandled node: ${U.constructor.name}. Parent: ${X.constructor.name}.`)}typeHintExpressionList(U,X){let Y=[],G=0;for(let $ of X)if($.typeHint=G<U.length?U[G]:null,$.accept(this),Y.push(this.getSafeType($)),$.type instanceof E)G+=$.type.children.length;else G+=1;return Y}checkTypeMatch(U,X,Y,G=!0){let $=X instanceof E?X.children:[X],Z=Y instanceof E?Y.children:[Y],J=!0;if(X===K.Error)J=!0;else if($.length!==Z.length)J=!1;else for(let Q=0;Q<$.length;Q++)J=J&&this.typeManager.check($[Q],Z[Q]);if(!J&&G){let Q=Y===K.Unit?"<unit>":Y.representation;U.reportError(this.diagnostics,M.GENERIC_TYPE_MISMATCH,Q,X.representation)}return J}checkTypeMatchAny(U,X,Y){for(let G of X)if(this.checkTypeMatch(U,G,Y,!1))return!0;return!1}visitNodeOrNull(U){if(!U)return;U.accept(this)}visitNodes(U){if(!U)return;for(let X of U)this.visitNodeOrNull(X)}getSafeType(U){return U&&U.type?U.type:K.Error}static ALLOWED_LOGICAL_TYPES=[L.BOOLEAN];static ALLOWED_RELATIONAL_TYPES=[L.INT,L.LONG];static ALLOWED_ARITHMETIC_TYPES=[L.INT,L.LONG];static LITERAL_TYPES=new Set([L.INT,L.BOOLEAN,L.COORD,L.STRING,L.CHAR,L.LONG]);static DISCARD_ERROR_LISTENER={syntaxError(U,X,Y,G,$,Z){},reportAmbiguity:function(U,X,Y,G,$,Z,J){},reportAttemptingFullContext:function(U,X,Y,G,$,Z){},reportContextSensitivity:function(U,X,Y,G,$,Z){}}}class G5{codeGenerator;rootTable;expression;diagnostics;constructor(U,X,Y,G){this.codeGenerator=U;this.rootTable=X;this.expression=Y;this.diagnostics=G}get arguments(){if(this.expression instanceof Y0)return this.expression.arguments;return[]}get arguments2(){if(this.expression instanceof m0&&this.expression.isStar&&this.expression.arguments2)return this.expression.arguments2;return[]}instruction(U,X,Y){this.codeGenerator.instruction(U,X,Y)}command(){let U=(()=>{if(this.expression instanceof m0)return this.expression.symbol;if(this.expression instanceof _0)return this.expression.reference;return null})();if(this.lineInstruction(this.expression),!U)throw Error("Symbol cannot be null for command generation.");this.instruction(W.Command,U,this.expression.source)}lineInstruction(U){this.codeGenerator.lineInstruction(U)}visitNode(U){if(!U)return;this.codeGenerator.visitNodeOrNull(U)}visitExpression(U){if(!U)return;this.codeGenerator.visitNodeOrNull(U)}visitNodes(U){if(!U)return;this.codeGenerator.visitNodes(U)}}class z3{opcode;operand;source;constructor(U,X,Y){this.opcode=U;this.operand=X;this.source=Y}deconstruct(){return[this.opcode,this.operand]}toString(){return`Instruction(opcode=${this.opcode}, operand=${this.operand})`}}class I3{label;instructions=[];constructor(U){this.label=U}add(U){this.instructions.push(U)}plusAssign(U){this.add(U)}}class P2{name;constructor(U){this.name=U}}class $5{names=new Map;generate(U){let X=this.names.get(U)??0;return this.names.set(U,X+1),new P2(`${U}_${X}`)}reset(){this.names.clear()}}class Z5{label;keys;constructor(U,X){this.label=U;this.keys=X}}class J5{id;_cases=[];constructor(U){this.id=U}get cases(){return this._cases}addCase(U){this._cases.push(U)}}class Q5{sourceName;symbol;subjectReference;trigger;name;fullName;locals;blocks=[];switchTables=[];constructor(U,X,Y){this.sourceName=U;this.symbol=X;this.subjectReference=Y;this.trigger=X.trigger,this.name=X.name,this.fullName=`[${this.trigger.identifier},${this.name}]`,this.locals=new j9}generateSwitchTable(){let U=new J5(this.switchTables.length);return this.switchTables.push(U),U}}class j9{parameters=[];all=[]}class Q0 extends X1{rootTable;dynamicCommands;diagnostics;labelGenerator=new $5;_scripts=[];block;lastLineNumber=-1;constructor(U,X,Y){super();this.rootTable=U;this.dynamicCommands=X;this.diagnostics=Y}get scripts(){return this._scripts}get script(){return this._scripts[this._scripts.length-1]}bind(U){return this.block=U,U}generateBlock(U,X=!0){let Y=X?this.labelGenerator.generate(U):new P2(U),G=new I3(Y);return this.script.blocks.push(G),G}generateBlockLabel(U){let X=new I3(U);return this.script.blocks.push(X),X}instruction(U,X,Y,G=this.block){G.instructions.push(new z3(U,X,Y))}instructionUnit(U,X,Y=this.block){Y.instructions.push(new z3(U,void 0,X))}lineInstruction(U){if(U.source.line!==this.lastLineNumber)this.lastLineNumber=U.source.line}visitScriptFile(U){this.visitNodes(U.scripts)}visitScript(U){if(U.triggerType==A0)return;this._scripts.push(new Q5(U.source.name,U.symbol,U.subjectReference)),this.visitNodes(U.parameters),this.bind(this.generateBlock("entry",!1)),this.lineInstruction(U),this.visitNodes(U.statements),this.generateDefaultReturns(U),this.labelGenerator.reset(),this.lastLineNumber=-1}visitParameter(U){let X=U.symbol;this.script.locals.parameters.push(X),this.script.locals.all.push(X)}generateDefaultReturns(U){this.lineInstruction(U);let X=E.toList(U.returnType);for(let Y of X)if(Y==L.INT)this.instruction(W.PushConstantInt,0);else if(Y.baseType==0)this.instruction(W.PushConstantInt,-1);else if(Y.baseType==1)this.instruction(W.PushConstantString,"");else if(Y.baseType==2)this.instruction(W.PushConstantLong,BigInt(-1));else throw Error(`Unsupported type in returns: ${Y}`);this.instructionUnit(W.Return)}visitBlockStatement(U){this.visitNodes(U.statements)}visitReturnStatement(U){this.visitNodes(U.expressions),this.lineInstruction(U),this.instructionUnit(W.Return,U.source)}visitIfStatement(U){let X=this.labelGenerator.generate("if_true"),Y=U.elseStatement?this.labelGenerator.generate("if_else"):null,G=this.labelGenerator.generate("if_end");if(this.generateCondition(U.condition,this.block,X,Y??G),this.bind(this.generateBlockLabel(X)),this.visitNodeOrNull(U.thenStatement),this.instruction(W.Branch,G),Y!=null)this.bind(this.generateBlockLabel(Y)),this.visitNodeOrNull(U.elseStatement),this.instruction(W.Branch,G);this.bind(this.generateBlockLabel(G))}visitWhileStatement(U){let X=this.labelGenerator.generate("while_start"),Y=this.labelGenerator.generate("while_body"),G=this.labelGenerator.generate("while_end"),$=this.bind(this.generateBlockLabel(X));this.generateCondition(U.condition,$,Y,G),this.bind(this.generateBlockLabel(Y)),this.visitNodeOrNull(U.thenStatement),this.instruction(W.Branch,X),this.bind(this.generateBlockLabel(G))}generateCondition(U,X,Y,G){if(U instanceof C1||U instanceof P1)if(!Q0.LOGICAL_OPERATORS.includes(U.operator.text)){let Z=U.left.type.baseType;if(Z==null){U.left.reportError(this.diagnostics,M.TYPE_HAS_NO_BASETYPE,U.left.type);return}let J=Q0.BRANCH_MAPPINGS.get(Z);if(!J)throw Error(`No mappings for BaseType: ${Z}`);let Q=J.get(U.operator.text);if(!Q)throw Error(`No mappings for operator: ${U.operator.text}`);this.visitNodeOrNull(U.left),this.visitNodeOrNull(U.right),this.instruction(Q,Y,void 0,X),this.instruction(W.Branch,G,void 0,X)}else{let Z=U.operator.text===Q0.LOGICAL_OR?this.labelGenerator.generate("condition_or"):this.labelGenerator.generate("condition_and"),J=U.operator.text===Q0.LOGICAL_OR?Y:Z,Q=U.operator.text===Q0.LOGICAL_OR?Z:G;this.generateCondition(U.left,X,J,Q);let F=this.bind(this.generateBlockLabel(Z));this.generateCondition(U.right,F,Y,G)}else if(U instanceof i0)this.generateCondition(U.expression,X,Y,G);else U.reportError(this.diagnostics,M.INVALID_CONDITION,U.constructor.name)}visitSwitchStatement(U){let X=this.script.generateSwitchTable(),G=U.defaultCase!=null?this.labelGenerator.generate("switch_default_case"):null,$=this.labelGenerator.generate("switch_end");this.visitNodeOrNull(U.condition),this.instruction(W.Switch,X,U.source);let Z=U.cases[0]??null;if(Z==null||!Z.isDefault)this.instruction(W.Branch,G??$);for(let J of U.cases){let Q=!J.isDefault?this.labelGenerator.generate(`switch_${X.id}_case`):G??(()=>{throw Error("switchDefault null while having a default case")}),F=[];for(let _ of J.keys){let I=this.resolveConstantValue(_);if(I==null){_.reportError(this.diagnostics,M.NULL_CONSTANT,_.constructor.name);continue}F.push(I)}X.addCase(new Z5(Q,F)),this.bind(this.generateBlockLabel(Q)),this.visitNodes(J.statements),this.instruction(W.Branch,$)}this.bind(this.generateBlockLabel($))}resolveConstantValue(U){if(U instanceof V1)return U.subExpression?this.resolveConstantValue(U.subExpression):null;if(U instanceof _0)return U.reference;if(U instanceof W1)return U.symbol??U.value;if(U instanceof e)return U.value;return null}visitDeclarationStatement(U){let X=U.symbol;if(this.script.locals.all.push(X),U.initializer!=null)this.visitNodeOrNull(U.initializer);else{let G=X.type.defaultValue;if(typeof G==="number")this.instruction(W.PushConstantInt,G);else if(typeof G==="string")this.instruction(W.PushConstantString,G);else if(typeof G==="bigint")this.instruction(W.PushConstantLong,G);else throw Error(`Unsupported default type: ${G?.constructor?.name}`)}this.instruction(W.PopLocalVar,X,U.source)}visitArrayDeclarationStatement(U){let X=U.symbol;this.script.locals.all.push(X),this.visitNodeOrNull(U.initializer),this.instruction(W.DefineArray,X,U.source)}visitAssignmentStatement(U){let X=U.vars,Y=X[0];if(Y instanceof F1&&Y.index!=null)this.visitNodeOrNull(Y.index);this.visitNodes(U.expressions);for(let G=X.length-1;G>=0;G--){let $=X[G],Z=$.reference;if(Z==null){$.reportError(this.diagnostics,M.SYMBOL_IS_NULL);return}if(Z instanceof k0)this.instruction(W.PopLocalVar,Z,$.source);else if(Z instanceof J0){if(!($ instanceof C2))throw Error("Expected 'GameVariableExpression'.");this.instruction(!$.dot?W.PopVar:W.PopVar2,Z,$.source)}else throw Error(`Unsupported reference type: ${Z}`)}}visitExpressionStatement(U){let X=U.expression;this.visitNodeOrNull(X);let Y=E.toList(X.type);for(let G of Y){let $=G.baseType;if($==null){U.reportError(this.diagnostics,M.TYPE_HAS_NO_BASETYPE,G);return}this.instruction(W.Discard,$)}}visitEmptyStatement(U){}visitLocalVariableExpression(U){let X=U.reference;if(X==null){U.reportError(this.diagnostics,M.SYMBOL_IS_NULL);return}this.lineInstruction(U),this.visitNodeOrNull(U.index),this.instruction(W.PushLocalVar,X,U.source)}visitGameVariableExpression(U){let X=U.reference;if(X==null){U.reportError(this.diagnostics,M.SYMBOL_IS_NULL);return}this.lineInstruction(U),this.instruction(!U.dot?W.PushVar:W.PushVar2,X,U.source)}visitConstantVariableExpression(U){let X=U.subExpression;if(X==null){U.reportError(this.diagnostics,M.EXPRESSION_NO_SUBEXPR);return}this.visitNodeOrNull(X)}visitParenthesizedExpression(U){this.lineInstruction(U),this.visitNodeOrNull(U.expression)}visitArithmeticExpression(U){let X=U.operator.text,Y=U.left.type.baseType,$=(()=>{switch(Y){case 0:return Q0.INT_OPERATIONS;case 2:return Q0.LONG_OPERATIONS;default:throw Error(`No mapping for BaseType: ${Y}.`)}})().get(X);if(!$)throw Error(`No mapping for operator: ${X}.`);this.visitNodeOrNull(U.left),this.visitNodeOrNull(U.right),this.instructionUnit($)}visitCalcExpression(U){this.lineInstruction(U),this.visitNodeOrNull(U.expression)}visitCommandCallExpression(U){let X=U.symbol;if(X==null){U.reportError(this.diagnostics,M.SYMBOL_IS_NULL);return}if(this.emitDynamicCommand(U.nameString,U))return;this.visitNodes(U.arguments),this.lineInstruction(U),this.instruction(W.Command,X,U.source)}emitDynamicCommand(U,X){let Y=this.dynamicCommands.get(U);if(!Y)return!1;let G=new G5(this,this.rootTable,X,this.diagnostics);if(Y.generateCode)Y.generateCode(G);else G.visitNodes(G.arguments),G.command();return!0}visitProcCallExpression(U){let X=U.symbol;if(X==null){U.reportError(this.diagnostics,M.SYMBOL_IS_NULL);return}this.visitNodes(U.arguments),this.lineInstruction(U),this.instruction(W.Gosub,X,U.source)}visitJumpCallExpression(U){let X=U.symbol;if(X==null){U.reportError(this.diagnostics,M.SYMBOL_IS_NULL);return}this.visitNodes(U.arguments),this.lineInstruction(U),this.instruction(W.Jump,X,U.source)}visitClientScriptExpression(U){let X=U.symbol;if(X==null){U.reportError(this.diagnostics,M.SYMBOL_IS_NULL);return}let Y=E.toList(X.parameters),G=Y.map(($)=>$.code).filter(Boolean).join("");if(Y.length!==G.length)throw Error("Mismatch between argument types and their codes.");if(this.instruction(W.PushConstantSymbol,X,U.source),this.visitNodes(U.arguments),U.transmitList.length>0)this.visitNodes(U.transmitList),G+="Y",this.instruction(W.PushConstantInt,U.transmitList.length);this.instruction(W.PushConstantString,G)}visitIntegerLiteral(U){this.lineInstruction(U),this.instruction(W.PushConstantInt,U.value,U.source)}visitCoordLiteral(U){this.lineInstruction(U),this.instruction(W.PushConstantInt,U.value,U.source)}visitBooleanLiteral(U){this.lineInstruction(U),this.instruction(W.PushConstantInt,U.value?1:0,U.source)}visitCharacterLiteral(U){this.lineInstruction(U),this.instruction(W.PushConstantInt,U.value.charCodeAt(0),U.source)}visitNullLiteral(U){this.lineInstruction(U);let X=U.type.baseType;if(X==1){this.instruction(W.PushConstantString,"null");return}else if(X==2){this.instruction(W.PushConstantLong,BigInt(-1));return}if(this.instruction(W.PushConstantInt,-1,U.source),U.getType()instanceof K.Hook)this.instruction(W.PushConstantString,"")}visitStringLiteral(U){this.lineInstruction(U);let X=U.subExpression;if(X!=null){this.visitNodeOrNull(X);return}let Y=U.symbol;if(Y!=null){this.instruction(W.PushConstantSymbol,Y,U.source);return}this.instruction(W.PushConstantString,U.value,U.source)}visitJoinedStringExpression(U){if(this.visitNodes(U.parts),U.parts.length>1)this.lineInstruction(U),this.instruction(W.JoinString,U.parts.length,U.source)}visitJoinedStringPart(U){if(this.lineInstruction(U),U instanceof t0)this.instruction(W.PushConstantString,U.value,U.source);else if(U instanceof r0)this.visitNodeOrNull(U.expression);else throw Error(`Unsupported StringPart: ${U.constructor.name}`)}visitIdentifier(U){let X=U.reference;if(X==null){U.reportError(this.diagnostics,M.SYMBOL_IS_NULL);return}if(this.lineInstruction(U),X instanceof z2&&X.trigger==A0){if(this.emitDynamicCommand(U.text,U))return;this.instruction(W.Command,X,U.source)}else this.instruction(W.PushConstantSymbol,X,U.source)}visitNodeOrNull(U){if(!U)return;U.accept(this)}visitNodes(U){if(!U)return;for(let X of U)this.visitNodeOrNull(X)}static LOGICAL_AND="&";static LOGICAL_OR="|";static LOGICAL_OPERATORS=[Q0.LOGICAL_AND,Q0.LOGICAL_OR];static INT_BRANCHES=new Map([["=",W.BranchEquals],["!",W.BranchNot],["<",W.BranchLessThan],[">",W.BranchGreaterThan],["<=",W.BranchLessThanOrEquals],[">=",W.BranchGreaterThanOrEquals]]);static OBJ_BRANCHES=new Map([["=",W.ObjBranchEquals],["!",W.ObjBranchNot]]);static LONG_BRANCHES=new Map([["=",W.LongBranchEquals],["!",W.LongBranchNot],["<",W.LongBranchLessThan],[">",W.LongBranchGreaterThan],["<=",W.LongBranchLessThanOrEquals],[">=",W.LongBranchGreaterThanOrEquals]]);static BRANCH_MAPPINGS=new Map([[0,Q0.INT_BRANCHES],[1,Q0.OBJ_BRANCHES],[2,Q0.LONG_BRANCHES]]);static INT_OPERATIONS=new Map([["+",W.Add],["-",W.Sub],["*",W.Multiply],["/",W.Divide],["%",W.Modulo],["&",W.And],["|",W.Or]]);static LONG_OPERATIONS=new Map([["+",W.LongAdd],["-",W.LongSub],["*",W.LongMultiply],["/",W.LongDivide],["%",W.LongModulo],["&",W.LongAnd],["|",W.LongOr]])}class U2{instruction;next=[];previous=[];constructor(U){this.instruction=U}addNext(U){this.next.push(U),U.previous.push(this)}toString(){return`InstructionNode(instruction=${this.instruction})`}}class X2 extends U2{set;constructor(U){super(null);this.set=U}}class N5{commandPointers;constructor(U){this.commandPointers=U}generate(U){let X=new Map,Y=[],G=new U2(null);G.addNext(this.firstInstruction(U[0],X,U)),Y.push(G);let $=!1;for(let Z=0;Z<U.length;Z++){let J=U[Z];for(let Q=0;Q<J.instructions.length;Q++){let F=J.instructions[Q];if(F.opcode===W.LineNumber)continue;let _=this.getOrCreate(X,F);if(Y.push(_),$&&F.opcode===W.BranchEquals&&this.checkInvertedConditional(J.instructions,Q)){if(Q+1>=J.instructions.length)throw Error("Invalid inverted conditional layout");let I=J.instructions[Q+1],H=this.getOrCreate(X,I);if(I.opcode!==W.Branch)throw Error("Expected Branch opcode");let j=J.instructions[Q-2];if(j.opcode!==W.Command)throw Error("Expected command before conditional");let P=j.operand.name,g=this.commandPointers.get(P).set,G0=new X2(g);Y.push(G0),_.addNext(G0),G0.addNext(H),$=!1}else if(!m8.has(F.opcode)){let I;if(Q+1<J.instructions.length)I=J.instructions[Q+1];else if(Z+1<U.length)I=U[Z+1].instructions[0];else throw Error("No next instruction");_.addNext(this.getOrCreate(X,I))}if($&&F.opcode===W.BranchEquals&&this.checkConditional(J.instructions,Q)){let I=F.operand,H=U.find((S1)=>S1.label===I);if(!H)throw Error("Unable to find block.");let j=J.instructions[Q-2];if(j.opcode!==W.Command)throw Error("Expected command before conditional.");let P=j.operand.name,g=this.commandPointers.get(P).set,G0=new X2(g);Y.push(G0),_.addNext(G0),G0.addNext(this.firstInstruction(H,X,U)),$=!1}else if(d8.has(F.opcode)){let I=F.operand,H=U.find((j)=>j.label===I);if(!H)throw Error("Unable to find block.");_.addNext(this.firstInstruction(H,X,U))}else if(F.opcode===W.Switch){let I=F.operand;for(let H of I.cases){if(H.keys.length===0)continue;let j=U.find((P)=>P.label===H.label);if(!j)throw Error("Unable to find block.");_.addNext(this.firstInstruction(j,X,U))}}if(this.isConditionalPointerSetter(F))$=!0}}return Y}checkConditional(U,X){if(X<2)return!1;let Y=U[X-2];if(!this.isConditionalPointerSetter(Y))return!1;let G=U[X-1];return G.opcode===W.PushConstantInt&&G.operand===1}checkInvertedConditional(U,X){if(X<2)return!1;let Y=U[X-2];if(!this.isConditionalPointerSetter(Y))return!1;let G=U[X-1];return G.opcode===W.PushConstantInt&&G.operand===0}isConditionalPointerSetter(U){if(U.opcode==W.Command&&U.operand instanceof s0){let X=this.commandPointers.get(U.operand.name);return X!==void 0&&X.conditionalSet}return!1}firstInstruction(U,X,Y){let G=this.firstValid(U.instructions);if(G)return this.getOrCreate(X,G);let $=Y.indexOf(U);for(let Z=$;Z<Y.length;Z++){let J=this.firstValid(Y[Z].instructions);if(J)return this.getOrCreate(X,J)}throw Error("No instructions remaining.")}firstValid(U){for(let X of U)if(X.opcode!==W.LineNumber)return X;return null}getOrCreate(U,X){let Y=U.get(X);if(!Y)Y=new U2(X),U.set(X,Y);return Y}}var m8=new Set([W.Branch,W.Jump,W.Return]),d8=new Set([W.Branch,W.BranchNot,W.BranchEquals,W.BranchLessThan,W.BranchGreaterThan,W.BranchLessThanOrEquals,W.BranchGreaterThanOrEquals,W.LongBranchNot,W.LongBranchEquals,W.LongBranchLessThan,W.LongBranchGreaterThan,W.LongBranchLessThanOrEquals,W.LongBranchGreaterThanOrEquals,W.ObjBranchNot,W.ObjBranchEquals]);class q5{diagnostics;scripts;commandPointers;scriptsBySymbol;graphGenerator;scriptGraphs=new Map;scriptPointers=new Map;pendingScripts=new Set;constructor(U,X,Y){this.diagnostics=U;this.scripts=X;this.commandPointers=Y;this.scriptsBySymbol=new Map(X.map((G)=>[G.symbol,G])),this.graphGenerator=new N5(Y)}getGraph(U){let X=this.scriptGraphs.get(U.symbol);if(X)return X;let Y=this.graphGenerator.generate(U.blocks);return this.scriptGraphs.set(U.symbol,Y),Y}getPointers(U){let X=this.scriptPointers.get(U);if(X)return X;let Y=this.calculatePointers(U);return this.scriptPointers.set(U,Y),Y}run(){for(let U of this.scripts){let X=performance.now();this.validatePointers(U);let Y=performance.now()-X}}calculatePointers(U){if(this.pendingScripts.has(U))return{required:new Set,set:new Set,conditionalSet:!1,corrupted:new Set};let X=this.scriptsBySymbol.get(U);if(!X)throw Error(`Unable to find script from symbol: ${U.name}`);let Y=new Set,G=new Set,$=new Set;this.pendingScripts.add(U);for(let Z of N.ALL){if(this.requiresPointerScript(X,Z))Y.add(Z);if(this.setsPointerScript(X,Z))G.add(Z);if(this.corruptsPointerScript(X,Z))$.add(Z)}return this.pendingScripts.delete(U),{required:Y,set:G,conditionalSet:!1,corrupted:$}}validatePointers(U){for(let X of N.ALL)this.validatePointer(U,X)}validatePointer(U,X){let Y=this.getGraph(U),G=Y.filter((Q)=>this.requiresPointerNode(Q,X)),$=Y.filter((Q)=>this.setsPointerNode(Q,X)),Z=Y.filter((Q)=>this.corruptsPointerNode(Q,X));if(!this.setsPointerTrigger(U.trigger,X)){if(Y.length>0)Z.push(Y[0])}let J=this.findEdgePath(G,(Q)=>Z.includes(Q),(Q)=>Q.previous.filter((F)=>!$.includes(F)));if(J!==null){let Q=J[0],F=Q.instruction?.source??(()=>{throw Error("Unknown instruction source.")})(),_=J[J.length-1],I=_!==Y[0]&&_!==Q,H=I?M.POINTER_CORRUPTED:M.POINTER_UNINITIALIZED;if(this.diagnostics.report(new W0("ERROR",F,H,[X.representation])),I){let P=_.instruction?.source??(()=>{throw Error("Unknown instruction source.")})();this.diagnostics.report(new W0("HINT",P,M.POINTER_CORRUPTED_LOC,[X.representation]))}let j=(P)=>{let g=P.instruction?.opcode;if(g!==W.Gosub&&g!==W.Jump)return;let G0=P.instruction.operand,S1=this.scripts.find((O3)=>O3.symbol===G0);if(!S1)throw Error("Unable to find script.");let b2=this.requiresPointerPathScript(S1,X);if(!b2)throw Error("Unable to find requirement path?");let u2=b2[0],k3=u2.instruction?.source??(()=>{throw Error("Invalid instruction/source.")})();this.diagnostics.report(new W0("HINT",k3,M.POINTER_REQUIRED_LOC,[X.representation])),j(u2)};j(Q)}}setsPointerTrigger(U,X){let Y=U.pointers;return Y!=null&&Y.has(X)}requiresPointerScript(U,X){return this.requiresPointerPathScript(U,X)!==null}requiresPointerPathScript(U,X){let Y=this.getGraph(U),G=Y.filter(($)=>this.requiresPointerNode($,X));return this.findEdgePath(G,($)=>$===Y[0],($)=>$.previous.filter((Z)=>!this.setsPointerNode(Z,X)))}setsPointerScript(U,X){let Y=this.getGraph(U),G=Y.filter(($)=>$.instruction?.opcode===W.Return);return this.findEdgePath(G,($)=>$===Y[0]||this.corruptsPointerNode($,X),($)=>$.previous.filter((Z)=>!this.setsPointerNode(Z,X)))===null}corruptsPointerScript(U,X){let G=this.getGraph(U).filter(($)=>$.instruction?.opcode===W.Return);return this.findEdgePath(G,($)=>this.corruptsPointerNode($,X),($)=>$.previous.filter((Z)=>!this.setsPointerNode(Z,X)))!==null}requiresPointerNode(U,X){let Y=U.instruction;if(!Y)return!1;switch(Y.opcode){case W.Command:{let G=Y.operand,$=this.commandPointers.get(G.name);return $?$.required.has(X):!1}case W.Gosub:case W.Jump:{let G=Y.operand;return this.getPointers(G).required.has(X)}case W.PushVar:{let $=Y.operand.type;if($ instanceof B0)return X===N.ACTIVE_PLAYER;if($ instanceof w0)return X===N.ACTIVE_PLAYER;if($ instanceof O0)return X===N.ACTIVE_NPC;return!1}case W.PopVar:{let G=Y.operand,$=G.type;if($ instanceof B0||$ instanceof w0)return G.isProtected?X===N.P_ACTIVE_PLAYER:X===N.ACTIVE_PLAYER;if($ instanceof O0)return X===N.ACTIVE_NPC;return!1}case W.PushVar2:{let $=Y.operand.type;if($ instanceof B0)return X===N.ACTIVE_PLAYER2;if($ instanceof w0)return X===N.ACTIVE_PLAYER2;if($ instanceof O0)return X===N.ACTIVE_NPC2;return!1}case W.PopVar2:{let G=Y.operand,$=G.type;if($ instanceof B0||$ instanceof w0)return G.isProtected?X===N.P_ACTIVE_PLAYER2:X===N.ACTIVE_PLAYER2;if($ instanceof O0)return X===N.ACTIVE_NPC2;return!1}default:return!1}}setsPointerNode(U,X){if(U instanceof X2)return U.set.has(X);let Y=U.instruction;if(!Y)return!1;switch(Y.opcode){case W.Command:{let G=Y.operand,$=this.commandPointers.get(G.name);return $?$.set.has(X)&&!$.conditionalSet:!1}case W.Gosub:{let G=Y.operand;return this.getPointers(G).set.has(X)}default:return!1}}corruptsPointerNode(U,X){let Y=U.instruction;if(!Y)return!1;switch(Y.opcode){case W.Command:{let G=Y.operand,$=this.commandPointers.get(G.name);return $?$.corrupted.has(X):!1}case W.Gosub:{let G=Y.operand;return this.getPointers(G).corrupted.has(X)}default:return!1}}findEdgePath(U,X,Y){if(!U.length)return null;let G=new Map,$=new Map,Z=[];for(let J of U)for(let Q of Y(J))if(!G.has(Q))$.set(Q,J),G.set(Q,null),Z.push(Q);while(Z.length){let J=Z.shift();if(X(J)){let Q=[],F=J;while(F)Q.unshift(F),F=G.get(F)??void 0;return Q.unshift($.get(Q[0])),Q}for(let Q of Y(J))if(!G.has(Q))G.set(Q,J),Z.push(Q)}return null}}class A3{scriptWriter;commandPointers;logger=console;sourcePaths;excludePaths;rootTable=new o2;symbolLoaders=[];dynamicCommandHandlers=new Map;types=new i3;triggers=new o3;static DEFAULT_DIAGNOSTICS_HANDLER=new t3;diagnosticsHandler=A3.DEFAULT_DIAGNOSTICS_HANDLER;constructor(U,X,Y,G){this.scriptWriter=Y;this.commandPointers=G;this.sourcePaths=U.map(($)=>this.normalizePath($)),this.excludePaths=X.map(($)=>this.normalizePath($)),this.types.registerAll(L),this.setupDefaultTypeCheckers(),this.triggers.registerTrigger(A0)}setupDefaultTypeCheckers(){this.types.addTypeChecker((U,X)=>U===K.Any),this.types.addTypeChecker((U,X)=>X===K.Nothing),this.types.addTypeChecker((U,X)=>U===K.Error||X===K.Error),this.types.addTypeChecker((U,X)=>U===X),this.types.addTypeChecker((U,X)=>U instanceof K.Script&&X instanceof K.Script&&U.trigger===X.trigger&&this.types.check(U.parameterType,X.parameterType)&&this.types.check(U.returnType,X.returnType)),this.types.addTypeChecker((U,X)=>U instanceof K.Hook&&X instanceof K.Hook&&this.types.check(U.transmitListType,X.transmitListType)),this.types.addTypeChecker((U,X)=>{let Y="inner"in U&&U.inner!=null,G="inner"in X&&X.inner!=null;if(!Y||!G)return!1;if(U.constructor.name!==X.constructor.name)return!1;return this.types.check(U.inner,X.inner)}),this.types.addTypeChecker((U,X)=>{if(!(U instanceof E)||!(X instanceof E))return!1;if(U.children.length!==X.children.length)return!1;for(let Y=0;Y<U.children.length;Y++)if(!this.types.check(U.children[Y],X.children[Y]))return!1;return!0}),this.types.addTypeChecker((U,X)=>{return U.representation===X.representation})}addSymbolLoader(U){this.symbolLoaders.push(U)}addDynamicCommandHandler(U,X){if(this.dynamicCommandHandlers.has(U))throw Error(`A dynamic command handler with the name of '${U}' already exists.`);this.dynamicCommandHandlers.set(U,X)}run(U){if(this.loadSymbols(),this.compile(U),"close"in this.scriptWriter)this.scriptWriter.close()}loadSymbols(){for(let U of this.symbolLoaders)U.load(this.rootTable,this)}compile(U){let[X,Y]=this.parse(U);if(!X)return;if(!this.analyze(Y))return;let[$,Z]=this.codegen(Y);if(!$)return;if(!this.checkPointers(Z))return;this.write(Z)}parse(U){let X=new L1,Y=[],G=0;for(let $ of this.sourcePaths){let Z=this.walkTopDown($);for(let J of Z){if(!J.endsWith(`.${U}`))continue;let Q=new B2(J,X),F=e1.createScriptFile(J,Q);if(F)Y.push(F);G++}}return this.diagnosticsHandler.handleParse?.(X),[X.hasErrors()===!1,Y]}analyze(U){let X=new L1,Y=new Y5(this.types,this.triggers,this.rootTable,X);for(let $ of U)$.accept(Y);let G=new T0(this.types,this.triggers,this.rootTable,this.dynamicCommandHandlers,X);for(let $ of U)$.accept(G);return this.diagnosticsHandler.handleTypeChecking?.(X),!X.hasErrors()}codegen(U){let X=new L1,Y=[];for(let G of U){let $=new Q0(this.rootTable,this.dynamicCommandHandlers,X);G.accept($),Y.push(...$.scripts)}return this.diagnosticsHandler.handleCodeGeneration?.(X),[X.hasErrors()===!1,Y]}checkPointers(U){if(this.commandPointers.size<1)return!1;let X=new L1;return new q5(X,U,this.commandPointers).run(),this.diagnosticsHandler.handlePointerChecking?.(X),!X.hasErrors()}write(U){for(let X of U){if(this.isExcluded(X.sourceName))continue;this.scriptWriter.write(X)}}isExcluded(U){let X;try{X=b0.normalize(b0.resolve(U))}catch{return!1}return this.excludePaths.some((Y)=>{let G=b0.normalize(Y);return X===G||X.startsWith(G+b0.sep)})}normalizePath(U){return b0.normalize(b0.resolve(U))}walkTopDown(U){let X=[];for(let Y of h9.readdirSync(U,{withFileTypes:!0})){let G=b0.join(U,Y.name);if(Y.isDirectory())X=X.concat(this.walkTopDown(G));else X.push(G)}return X}}import*as H3 from"fs";import*as L3 from"path";import{readFileSync as T8}from"fs";class b1{addConstant(U,X,Y){let G=new g1(X,Y);if(!U.insert(l.constant(),G))throw Error(`Unable to add constant: name=${X}, value=${Y}.`);return G}addBasic(U,X,Y,G=!1){let $=new J0(Y,X,G);if(!U.insert(l.basic(X),$))throw Error(`Unable to add basic: type=${X}, name=${Y}`);return $}}class F5 extends b1{path;constructor(U){super();this.path=U}load(U,X){let Y=T8(this.path,"utf8");for(let G of Y.split(/\r?\n/)){let $=G.split("\t",2);if($.length!==2)continue;this.addConstant(U,$[0],$[1])}}}import{readFileSync as l8}from"fs";class K3 extends b1{mapper;path;typeSupplier;constructor(U,X,Y){super();this.mapper=U,this.path=X,this.typeSupplier=Y}static withType(U,X,Y){return new K3(U,X,()=>Y)}load(U,X){let Y=l8(this.path,"utf8").split(`
29
+ `);for(let G of Y){if(!G)continue;let $=G.split("\t");if($.length<2)continue;let Z=Number($[0]),J=$[1],Q=$.length>=3&&$[2]!=="none"?E.fromList($[2].split(",").map((H)=>X.types.find(H)??K.Error)):K.Unit,F=$.length>=4?$[3]==="true":!1,_=this.typeSupplier(Q),I=this.addBasic(U,_,J,F);this.mapper.putSymbol(Z,I)}}}import{readFileSync as y8}from"fs";class D3 extends b1{mapper;path;typeSupplier;constructor(U,X,Y){super();this.mapper=U,this.path=X,this.typeSupplier=Y}static withType(U,X,Y){return new D3(U,X,()=>Y)}load(U,X){let G=y8(this.path,"utf-8").split(/\r?\n/);for(let $ of G){if(!$)continue;let Z=$.split("\t");if(Z.length<2)continue;let J=Number(Z[0]),Q=Z[1],F=Z.length>=3?E.fromList(Z[2].split(",").map((H)=>X.types.find(H)??K.Error)):K.Unit,_=this.typeSupplier(F),I=this.addBasic(U,_,Q);this.mapper.putSymbol(J,I)}}}class z1{queueType;constructor(U){this.queueType=U}typeCheck(U){U.checkArgument(0,this.queueType),U.checkArgument(1,L.INT),U.checkArgument(2,L.INT);let X=[this.queueType,L.INT,L.INT];U.checkArgumentTypes(E.fromList(X)),U.expression.type=K.Unit}}class I1{queueType;constructor(U){this.queueType=U}typeCheck(U){let X=U.checkArgument(0,this.queueType);U.checkArgument(1,L.INT);let Y=[this.queueType,L.INT],G=[],$=X?.type;if($ instanceof K.Script&&$.trigger==this.queueType.trigger&&$.parameterType!=K.Unit)G.push(...E.toList($.parameterType));U.checkArgumentTypes(E.fromList(Y),!0,!1),U.checkArgumentTypes(E.fromList(G),!0,!0),U.expression.type=K.Unit}generateCode(U){let X=U.arguments;U.visitNodes(X);let Y=U.arguments2;if(U.visitNodes(Y),Y.length>2){let G=Y.slice(2).map(($)=>$.type.code).filter(($)=>$!=null).join("");U.instruction(W.PushConstantString,G)}else U.instruction(W.PushConstantString,"");U.command()}}class B3{queueType;constructor(U){this.queueType=U}typeCheck(U){U.checkArgument(0,this.queueType),U.checkArgument(1,L.INT),U.checkArgument(2,L.INT),U.checkArgument(3,L.INT);let X=[this.queueType,L.INT,L.INT,L.INT];U.checkArgumentTypes(E.fromList(X)),U.expression.type=K.Unit}}class w3{queueType;constructor(U){this.queueType=U}typeCheck(U){let X=U.checkArgument(0,this.queueType);U.checkArgument(1,L.INT),U.checkArgument(2,L.INT);let Y=[this.queueType,L.INT,L.INT],G=[],$=X?.type;if($ instanceof K.Script&&$.trigger==this.queueType.trigger&&$.parameterType!=K.Unit)G.push(...E.toList($.parameterType));U.checkArgumentTypes(E.fromList(Y),!0,!1),U.checkArgumentTypes(E.fromList(G),!0,!0),U.expression.type=K.Unit}generateCode(U){let X=U.arguments;U.visitNodes(X);let Y=U.arguments2;if(U.visitNodes(Y),Y.length>2){let G=Y.slice(2).map(($)=>$.type.code).filter(($)=>$!=null).join("");U.instruction(W.PushConstantString,G)}else U.instruction(W.PushConstantString,"");U.command()}}class Y2{timerType;constructor(U){this.timerType=U}typeCheck(U){let X=U.checkArgument(0,this.timerType);U.checkArgument(1,L.INT);let Y=X?.type,G=[this.timerType,L.INT];if(Y instanceof K.Script&&Y.trigger==this.timerType.trigger&&Y.parameterType!=K.Unit)G.push(...E.toList(Y.parameterType));U.checkArgumentTypes(E.fromList(G)),U.expression.type=K.Unit}generateCode(U){let X=U.arguments;if(U.visitNodes(X),arguments.length>2){let Y=X.slice(2).map((G)=>G.type.code).filter((G)=>G!=null).join("");U.instruction(W.PushConstantString,Y)}else U.instruction(W.PushConstantString,"");U.command()}}class u1{inner;representation;code;baseType=0;defaultValue=-1;options;constructor(U){this.inner=U;this.representation=`param<${U.representation}>`,this.options=new y({allowSwitch:!1,allowArray:!1,allowDeclaration:!1})}}class l0{type;constructor(U){this.type=U}typeCheck(U){let X=[];if(this.type!==null)X.push(this.type),U.checkArgument(0,this.type);let Y=this.type===null?0:1,G=U.checkArgument(Y,l0.PARAM_ANY),$=G?.type instanceof u1?G.type.inner:void 0;if(X.push(new u1($??K.Any)),!U.checkArgumentTypes(E.fromList(X))){U.expression.type=K.Error;return}if($==null){U.expression.reportError(U.diagnostics,"Param return type was not able to be found."),U.expression.type=K.Error;return}U.expression.type=$}static PARAM_ANY=new u1(K.Any)}class W5 extends X1{visitBinaryExpression(U){return`${this.visit(U.left)} ${U.operator.text} ${this.visit(U.right)}`}visitCalcExpression(U){return`calc${this.visit(U.expression)}`}visitCommandCallExpression(U){let X="~"+this.visit(U.name);if(U.arguments.length>0)X+="(",X+=U.arguments.map((Y)=>this.visit(Y)).join(""),X+=")";return X}visitLocalVariableExpression(U){return`$${this.visit(U.name)}`}visitGameVariableExpression(U){return`%${this.visit(U.name)}`}visitConstantVariableExpression(U){return`^${this.visit(U.name)}`}visitCharacterLiteral(U){return`'${U.value}'`}visitNullLiteral(U){return"null"}visitStringLiteral(U){return`"${U.value}"`}visitLiteral(U){return String(U.value)}visitJoinedStringExpression(U){let X='"';for(let Y of U.parts)X+=this.visit(Y);return X+='"',X}visitJoinedStringPart(U){if(U instanceof t0)return U.value;if(U instanceof r0)return`<${this.visit(U.expression)}>`;throw Error(`Unsupported StringPart: ${U}`)}visitIdentifier(U){return U.text}visit(U){U.accept(this)}}class v1{typeCheck(U){if(U.arguments.length===0)U.expression.reportError(U.diagnostics,v1.DIAGNOSTIC_INVALID_SIGNATURE);else U.arguments.forEach((X,Y)=>{U.checkArgument(Y,K.Any);let G=X.type;if(G instanceof E)X.reportError(U.diagnostics,v1.DIAGNOSTIC_TUPLE_TYPE,G.representation);else if(G.baseType!==0&&G.baseType!==1)X.reportError(U.diagnostics,v1.DIAGNOSTIC_UNIT_TYPE,G.representation)});U.expression.type=L.STRING}generateCode(U){U.lineInstruction(U.expression);let X=0;U.arguments.forEach((Y,G)=>{let $=Y.accept(v1.EXPRESSION_GENERATOR);if(U.instruction(W.PushConstantString,`${$}=`),X++,U.visitNode(Y),this.typeToString(U,Y.type),G!==U.arguments.length-1)U.instruction(W.PushConstantString,", "),X++}),U.instruction(W.JoinString,X)}typeToString(U,X){let Y;if(X===L.STRING)Y="escape";else if(X.baseType===0)Y="toString";else throw Error(`Unsupported type conversion to string: ${X}`);let G=U.rootTable.find(l.serverScript(A0),Y);if(G)U.instruction(W.Command,G)}static DIAGNOSTIC_INVALID_SIGNATURE="Type mismatch: '<unit>' was given but 'any...' was expected.";static DIAGNOSTIC_TUPLE_TYPE="Unable to dump multi-value types: %s";static DIAGNOSTIC_INVALID_BASE_TYPE="Unable to debug '%s' expressions.";static DIAGNOSTIC_UNIT_TYPE="Unable to debug expression with no return value.";static EXPRESSION_GENERATOR=new W5}class _5{typeCheck(U){U.checkArgumentTypes(K.Unit),U.expression.type=L.STRING}generateCode(U){let X=U.expression.findParentByType(q1);if(!X)throw Error("Script not found.");let Y=`[${X.trigger.text}, ${X.name.text}]`;U.lineInstruction(U.expression),U.instruction(W.PushConstantString,Y)}}class y0{inner;representation;code;baseType=0;defaultValue=-1;options;constructor(U){this.inner=U;this.representation=`dbcolumn<${U.representation}>`,this.options=new y({allowSwitch:!1,allowArray:!1,allowDeclaration:!1})}}class R3{withCount;constructor(U){this.withCount=U}typeCheck(U){let X=U.checkArgument(0,new y0(K.Any)),Y=X?.type?.inner;U.checkArgument(1,Y);let G=new E(new y0(Y??K.Any),Y??K.Any);if(Y instanceof E)X.reportError(U.diagnostics,"Tuple columns are not supported.");else U.checkArgumentTypes(G);U.expression.type=this.withCount?L.INT:K.Unit}generateCode(U){let Y=U.arguments[0].type.inner.baseType,G=(()=>{switch(Y){case 0:return 0;case 2:return 1;case 1:return 2;default:throw Error(`Unsupported base type: ${Y}.`)}})();U.visitNodes(U.arguments),U.instruction(W.PushConstantInt,G),U.command()}}class z5{typeCheck(U){U.checkArgument(0,z.DBROW);let X=U.checkArgument(1,new y0(K.Any));U.checkArgument(2,L.INT);let Y=X?.type?.inner,G=new E(z.DBROW,new y0(Y??K.Any),L.INT);if(!U.checkArgumentTypes(G)){U.expression.type=K.Error;return}if(X==null){(X??U.expression).reportError(U.diagnostics,"Unable to extract type from argument."),U.expression.type=K.Error;return}U.expression.type=Y}}class I5{typeCheck(U){let X=U.checkTypeArgument(0),Y=U.checkTypeArgument(1);U.checkArgument(2,z.ENUM);let G=X?.type instanceof K.Type?X.type.inner:void 0,$=Y?.type instanceof K.Type?Y.type.inner:void 0;U.checkArgument(3,G);let Z=new E(new K.Type(G??K.Any),new K.Type($??K.Any),z.ENUM,G??K.Any);U.checkArgumentTypes(Z),U.expression.type=$??K.Error}}class A5 extends A3{symbolPaths;mapper;constructor(U,X,Y,G,$,Z){super(U,X,Y,G);this.symbolPaths=$,this.mapper=Z}setup(){this.triggers.registerAll(D),this.types.registerAll(z),this.types.changeOptions("long",(U)=>{U.allowDeclaration=!1}),this.types.register("proc",new K.Script(D.PROC,K.Unit,K.Unit)),this.types.register("label",new K.Script(D.LABEL,K.Unit,K.Nothing)),this.types.addTypeChecker((U,X)=>U===z.OBJ&&X===z.NAMEDOBJ),this.addSymConstantLoaders(),this.types.register("walktrigger",new K.Script(D.WALKTRIGGER,K.Any,K.Nothing)),this.types.register("ai_walktrigger",new K.Script(D.AI_WALKTRIGGER,K.Any,K.Nothing)),this.types.register("queue",new K.Script(D.QUEUE,K.Any,K.Nothing)),this.addDynamicCommandHandler("queue",new z1(this.types.find("queue"))),this.addDynamicCommandHandler(".queue",new z1(this.types.find("queue"))),this.addDynamicCommandHandler("queue*",new I1(this.types.find("queue"))),this.addDynamicCommandHandler(".queue*",new I1(this.types.find("queue"))),this.addDynamicCommandHandler("longqueue",new B3(this.types.find("queue"))),this.addDynamicCommandHandler(".longqueue",new B3(this.types.find("queue"))),this.addDynamicCommandHandler("longqueue*",new w3(this.types.find("queue"))),this.addDynamicCommandHandler(".longqueue*",new w3(this.types.find("queue"))),this.types.register("timer",new K.Script(D.TIMER,K.Any,K.Nothing)),this.addDynamicCommandHandler("settimer",new Y2(this.types.find("timer"))),this.addDynamicCommandHandler(".settimer",new Y2(this.types.find("timer"))),this.addDynamicCommandHandler("lc_param",new l0(z.LOC)),this.addDynamicCommandHandler("loc_param",new l0(null)),this.addSymLoader("loc",z.LOC),this.addDynamicCommandHandler("nc_param",new l0(z.NPC)),this.addDynamicCommandHandler("npc_param",new l0(null)),this.addSymLoader("npc",z.NPC),this.addDynamicCommandHandler("oc_param",new l0(z.OBJ)),this.addDynamicCommandHandler("obj_param",new l0(null)),this.addSymLoader("obj",z.NAMEDOBJ),this.addSymLoader("component",z.COMPONENT),this.addSymLoader("interface",z.INTERFACE),this.addSymLoader("overlayinterface",z.OVERLAYINTERFACE),this.addSymLoader("fontmetrics",z.FONTMETRICS),this.addSymLoader("category",z.CATEGORY),this.addSymLoader("hunt",z.HUNT),this.addSymLoader("inv",z.INV),this.addSymLoader("idk",z.IDKIT),this.addSymLoader("mesanim",z.MESANIM),this.addSymLoaderWithSupplier("param",(U)=>new u1(U)),this.addSymLoader("seq",z.SEQ),this.addSymLoader("spotanim",z.SPOTANIM),this.types.register("varp",new B0(K.Any)),this.addProtectedSymLoaderWithSupplier("varp",(U)=>new B0(U)),this.addSymLoaderWithSupplier("varn",(U)=>new O0(U)),this.addSymLoaderWithSupplier("vars",(U)=>new m1(U)),this.addSymLoader("stat",z.STAT),this.addSymLoader("locshape",z.LOC_SHAPE),this.addSymLoader("movespeed",z.MOVESPEED),this.addSymLoader("npc_mode",z.NPC_MODE),this.addSymLoader("npc_stat",z.NPC_STAT),this.addSymLoader("model",z.MODEL),this.addSymLoader("synth",z.SYNTH),this.types.register("varbit",new w0(K.Any)),this.addProtectedSymLoaderWithSupplier("varbit",(U)=>new w0(U)),this.addDynamicCommandHandler("weakqueue",new z1(this.types.find("queue"))),this.addDynamicCommandHandler(".weakqueue",new z1(this.types.find("queue"))),this.addDynamicCommandHandler("weakqueue*",new I1(this.types.find("queue"))),this.addDynamicCommandHandler(".weakqueue*",new I1(this.types.find("queue"))),this.addDynamicCommandHandler("strongqueue",new z1(this.types.find("queue"))),this.addDynamicCommandHandler(".strongqueue",new z1(this.types.find("queue"))),this.addDynamicCommandHandler("strongqueue*",new I1(this.types.find("queue"))),this.addDynamicCommandHandler(".strongqueue*",new I1(this.types.find("queue"))),this.addDynamicCommandHandler("enum",new I5),this.addSymLoader("enum",z.ENUM),this.addDynamicCommandHandler("struct_param",new l0(z.STRUCT)),this.addSymLoader("struct",z.STRUCT),this.types.register("softtimer",new K.Script(D.SOFTTIMER,K.Any,K.Nothing)),this.addDynamicCommandHandler("softtimer",new Y2(this.types.find("softtimer"))),this.addDynamicCommandHandler(".softtimer",new Y2(this.types.find("softtimer"))),this.types.register("dbcolumn",new y0(K.Any)),this.addDynamicCommandHandler("db_find",new R3(!0)),this.addDynamicCommandHandler("db_find_refine",new R3(!0)),this.addDynamicCommandHandler("db_getfield",new z5),this.addSymLoaderWithSupplier("dbcolumn",(U)=>new y0(U)),this.addSymLoader("dbrow",z.DBROW),this.addSymLoader("dbtable",z.DBTABLE),this.addDynamicCommandHandler("dump",new v1),this.addDynamicCommandHandler("script",new _5)}addSymConstantLoaders(){for(let U of this.symbolPaths){let X=L3.join(U,"constant.sym");if(H3.existsSync(X))this.addSymbolLoader(new F5(X))}}addSymLoader(U,X){this.addSymLoaderWithSupplier(U,()=>X)}addSymLoaderWithSupplier(U,X){for(let Y of this.symbolPaths){let G=L3.join(Y,`${U}.sym`);if(H3.existsSync(G))this.addSymbolLoader(new D3(this.mapper,G,X))}}addProtectedSymLoader(U,X){this.addProtectedSymLoaderWithSupplier(U,()=>X)}addProtectedSymLoaderWithSupplier(U,X){for(let Y of this.symbolPaths){let G=L3.join(Y,`${U}.sym`);if(H3.existsSync(G))this.addSymbolLoader(new K3(this.mapper,G,X))}}}import*as B5 from"console";function c8(){let U=a8("neptune.toml"),X=U.sourcePaths.map((I)=>M3(I)),Y=U.symbolPaths.map((I)=>M3(I)),G=U.excludePaths.map((I)=>M3(I)),$=U.checkPointers,{binary:Z}=U.writers,J=new s3,Q;if(Z)Q=new p2(M3(Z.output),J);else B5.error("No writer configured."),C9(1);let F=new Map;s8(Y,J,F,$);let _=new A5(X,G,Q,F,Y,J);_.setup(),_.run("rs2")}function a8(U){if(!K5(U))B5.error(`Unable to locate configuration file: ${U}.`),C9(1);let X=D5(U,"utf-8"),Y=a3(X);return{sourcePaths:Y.sources??[],symbolPaths:Y.symbols??[],excludePaths:Y.excluded??[],checkPointers:Y.check_pointers??!1,writers:{binary:Y.writer?.binary}}}function s8(U,X,Y,G){for(let $ of U){let Z=E9($,"commands.sym");if(K5(Z)){let Q=D5(Z,"utf-8").split(/\r?\n/);for(let F of Q){if(!F.trim())continue;let _=F.split("\t"),I=parseInt(_[0],10),H=_[1];if(G&&_.length>2){let j=_[2]??"",P=_[3]??"",g=P.includes("CONDITIONAL:")?P.split("CONDITIONAL:")[1]:P,G0=_[4]??"",[S1,b2]=j.split(":"),[u2,k3]=g.split(":"),[O3,f9]=G0.split(":"),V9=G2(S1),w5=G2(b2),P9=G2(u2),R5=G2(k3),H5=P!==g,b9=G2(O3),L5=G2(f9);if(Y.set(H,{required:V9,set:P9,conditionalSet:H5,corrupted:b9}),w5.size||R5.size||L5.size)Y.set(`.${H}`,{required:w5,set:R5,conditionalSet:H5,corrupted:L5})}X.putCommand(I,H)}}let J=E9($,"runescript.sym");if(K5(J)){let Q=D5(J,"utf-8").split(/\r?\n/);for(let F of Q){if(!F.trim())continue;let _=F.split("\t"),I=parseInt(_[0],10),H=_[1];X.putScript(I,H)}}}}function G2(U){if(!U||U==="none")return new Set;let X=new Set,Y=U.split(",");for(let G of Y){let $=N.forName(G);if($)X.add($);else throw Error(`Invalid pointer name: ${G}.`)}return X}export{c8 as CompileServerScript};
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@lostcityrs/runescript",
3
+ "version": "0.9.0",
4
+ "description": "Compiler for a community-derived RuneScript implementation, written in TypeScript",
5
+ "license": "MIT",
6
+ "author": "LostCityRS",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/LostCityRS/RuneScriptTS.git"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/LostCityRS/RuneScriptTS/issues"
13
+ },
14
+ "homepage": "https://github.com/LostCityRS/RuneScriptTS#readme",
15
+ "main": "dist/runescript.js",
16
+ "types": "dist/runescript.d.ts",
17
+ "type": "module",
18
+ "files": [
19
+ "/dist"
20
+ ],
21
+ "scripts": {
22
+ "antlr": "antlr-ng -Dlanguage=TypeScript -o src/antlr --generate-visitor true --generate-listener false --exact-output-dir true src/antlr/RuneScriptLexer.g4 src/antlr/RuneScriptParser.g4",
23
+ "build": "bun build --target node --outfile dist/runescript.js --minify src/Compiler.ts"
24
+ },
25
+ "dependencies": {
26
+ "@iarna/toml": "^2.2.5",
27
+ "antlr4ng": "^3.0.16"
28
+ },
29
+ "devDependencies": {
30
+ "@types/node": "^25.2.3",
31
+ "antlr-ng": "^1.0.10",
32
+ "typescript": "^5.3.0"
33
+ }
34
+ }