prettier-plugin-solidity
Version:
A Prettier Plugin for automatically formatting your Solidity code.
1 lines • 411 kB
JavaScript
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("prettier/standalone")):"function"==typeof define&&define.amd?define(["prettier/standalone"],e):"object"==typeof exports?exports.prettierPluginSolidity=e(require("prettier/standalone")):(t.prettierPlugins=t.prettierPlugins||{},t.prettierPlugins.solidity=e(t.prettier))}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this||{},(t=>(()=>{var e={121:function(t,e,i){"use strict";var s;"undefined"!=typeof globalThis?globalThis:void 0!==i.g?i.g:"undefined"!=typeof self&&self,s=()=>{var t=(()=>{var t=Object.defineProperty,e=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,r={};((e,i)=>{for(var s in i)t(e,s,{get:i[s],enumerable:!0})})(r,{ParserError:()=>De,default:()=>He,parse:()=>Pe,tokenize:()=>Oe,visit:()=>Fe});var n={92:()=>{}},a={};function o(t){var e=a[t];if(void 0!==e)return e.exports;var i=a[t]={exports:{}};return n[t](i,i.exports,o),i.exports}o.d=(t,e)=>{for(var i in e)o.o(e,i)&&!o.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var l={};(()=>{o.d(l,{dx:()=>Y,q2:()=>At,FO:()=>ve,xf:()=>Se,Gy:()=>Ne,s4:()=>Dt,c7:()=>Oe,_7:()=>le,tx:()=>Re,gp:()=>ge,cK:()=>wt,zs:()=>fe,AV:()=>Se,Xp:()=>g,VS:()=>T,ul:()=>W,hW:()=>Ht,x1:()=>Xt,z5:()=>ee,oN:()=>pe,TB:()=>de,u1:()=>me,_b:()=>Fe,$F:()=>se,_T:()=>Me,db:()=>re,Zx:()=>te,_x:()=>Ft,r8:()=>U,JI:()=>k,TP:()=>D,WU:()=>t,Nj:()=>c,ZP:()=>Xe});class t{constructor(){this.source=null,this.type=null,this.channel=null,this.start=null,this.stop=null,this.tokenIndex=null,this.line=null,this.column=null,this._text=null}getTokenSource(){return this.source[0]}getInputStream(){return this.source[1]}get text(){return this._text}set text(t){this._text=t}}function e(t,e){if(!Array.isArray(t)||!Array.isArray(e))return!1;if(t===e)return!0;if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!(t[i]===e[i]||t[i].equals&&t[i].equals(e[i])))return!1;return!0}t.INVALID_TYPE=0,t.EPSILON=-2,t.MIN_USER_TOKEN_TYPE=1,t.EOF=-1,t.DEFAULT_CHANNEL=0,t.HIDDEN_CHANNEL=1;const i=Math.round(Math.random()*Math.pow(2,32));function s(t){if(!t)return 0;const e=typeof t,s="string"===e?t:!("object"!==e||!t.toString)&&t.toString();if(!s)return 0;let r,n;const a=3&s.length,o=s.length-a;let l=i;const h=3432918353,c=461845907;let u=0;for(;u<o;)n=255&s.charCodeAt(u)|(255&s.charCodeAt(++u))<<8|(255&s.charCodeAt(++u))<<16|(255&s.charCodeAt(++u))<<24,++u,n=(65535&n)*h+(((n>>>16)*h&65535)<<16)&4294967295,n=n<<15|n>>>17,n=(65535&n)*c+(((n>>>16)*c&65535)<<16)&4294967295,l^=n,l=l<<13|l>>>19,r=5*(65535&l)+((5*(l>>>16)&65535)<<16)&4294967295,l=27492+(65535&r)+((58964+(r>>>16)&65535)<<16);switch(n=0,a){case 3:n^=(255&s.charCodeAt(u+2))<<16;case 2:n^=(255&s.charCodeAt(u+1))<<8;case 1:n^=255&s.charCodeAt(u),n=(65535&n)*h+(((n>>>16)*h&65535)<<16)&4294967295,n=n<<15|n>>>17,n=(65535&n)*c+(((n>>>16)*c&65535)<<16)&4294967295,l^=n}return l^=s.length,l^=l>>>16,l=2246822507*(65535&l)+((2246822507*(l>>>16)&65535)<<16)&4294967295,l^=l>>>13,l=3266489909*(65535&l)+((3266489909*(l>>>16)&65535)<<16)&4294967295,l^=l>>>16,l>>>0}class r{constructor(){this.count=0,this.hash=0}update(){for(let t=0;t<arguments.length;t++){const e=arguments[t];if(null!=e)if(Array.isArray(e))this.update.apply(this,e);else{let t=0;switch(typeof e){case"undefined":case"function":continue;case"number":case"boolean":t=e;break;case"string":t=s(e);break;default:e.updateHashCode?e.updateHashCode(this):console.log("No updateHashCode for "+e.toString());continue}t*=3432918353,t=t<<15|t>>>17,t*=461845907,this.count=this.count+1;let i=this.hash^t;i=i<<13|i>>>19,i=5*i+3864292196,this.hash=i}}}finish(){let t=this.hash^4*this.count;return t^=t>>>16,t*=2246822507,t^=t>>>13,t*=3266489909,t^=t>>>16,t}static hashStuff(){const t=new r;return t.update.apply(t,arguments),t.finish()}}function n(t){return t?"string"==typeof t?s(t):t.hashCode():-1}function a(t,e){return t?t.equals(e):t===e}function h(t){return null===t?"null":t}function c(t){return Array.isArray(t)?"["+t.map(h).join(", ")+"]":"null"}const u="h-";class p{constructor(t,e){this.data={},this.hashFunction=t||n,this.equalsFunction=e||a}add(t){const e=u+this.hashFunction(t);if(e in this.data){const i=this.data[e];for(let e=0;e<i.length;e++)if(this.equalsFunction(t,i[e]))return i[e];return i.push(t),t}return this.data[e]=[t],t}has(t){return null!=this.get(t)}get(t){const e=u+this.hashFunction(t);if(e in this.data){const i=this.data[e];for(let e=0;e<i.length;e++)if(this.equalsFunction(t,i[e]))return i[e]}return null}values(){return Object.keys(this.data).filter((t=>t.startsWith(u))).flatMap((t=>this.data[t]),this)}toString(){return c(this.values())}get length(){return Object.keys(this.data).filter((t=>t.startsWith(u))).map((t=>this.data[t].length),this).reduce(((t,e)=>t+e),0)}}class d{hashCode(){const t=new r;return this.updateHashCode(t),t.finish()}evaluate(t,e){}evalPrecedence(t,e){return this}static andContext(t,e){if(null===t||t===d.NONE)return e;if(null===e||e===d.NONE)return t;const i=new m(t,e);return 1===i.opnds.length?i.opnds[0]:i}static orContext(t,e){if(null===t)return e;if(null===e)return t;if(t===d.NONE||e===d.NONE)return d.NONE;const i=new _(t,e);return 1===i.opnds.length?i.opnds[0]:i}}class m extends d{constructor(t,e){super();const i=new p;t instanceof m?t.opnds.map((function(t){i.add(t)})):i.add(t),e instanceof m?e.opnds.map((function(t){i.add(t)})):i.add(e);const s=x(i);if(s.length>0){let t=null;s.map((function(e){(null===t||e.precedence<t.precedence)&&(t=e)})),i.add(t)}this.opnds=Array.from(i.values())}equals(t){return this===t||t instanceof m&&e(this.opnds,t.opnds)}updateHashCode(t){t.update(this.opnds,"AND")}evaluate(t,e){for(let i=0;i<this.opnds.length;i++)if(!this.opnds[i].evaluate(t,e))return!1;return!0}evalPrecedence(t,e){let i=!1;const s=[];for(let r=0;r<this.opnds.length;r++){const n=this.opnds[r],a=n.evalPrecedence(t,e);if(i|=a!==n,null===a)return null;a!==d.NONE&&s.push(a)}if(!i)return this;if(0===s.length)return d.NONE;let r=null;return s.map((function(t){r=null===r?t:d.andContext(r,t)})),r}toString(){const t=this.opnds.map((t=>t.toString()));return(t.length>3?t.slice(3):t).join("&&")}}class _ extends d{constructor(t,e){super();const i=new p;t instanceof _?t.opnds.map((function(t){i.add(t)})):i.add(t),e instanceof _?e.opnds.map((function(t){i.add(t)})):i.add(e);const s=x(i);if(s.length>0){const t=s.sort((function(t,e){return t.compareTo(e)})),e=t[t.length-1];i.add(e)}this.opnds=Array.from(i.values())}equals(t){return this===t||t instanceof _&&e(this.opnds,t.opnds)}updateHashCode(t){t.update(this.opnds,"OR")}evaluate(t,e){for(let i=0;i<this.opnds.length;i++)if(this.opnds[i].evaluate(t,e))return!0;return!1}evalPrecedence(t,e){let i=!1;const s=[];for(let r=0;r<this.opnds.length;r++){const n=this.opnds[r],a=n.evalPrecedence(t,e);if(i|=a!==n,a===d.NONE)return d.NONE;null!==a&&s.push(a)}return i?(0===s.length||s.map((function(t){return t})),null):this}toString(){const t=this.opnds.map((t=>t.toString()));return(t.length>3?t.slice(3):t).join("||")}}function x(t){const e=[];return t.values().map((function(t){t instanceof d.PrecedencePredicate&&e.push(t)})),e}function f(t,e){if(null===t){const t={state:null,alt:null,context:null,semanticContext:null};return e&&(t.reachesIntoOuterContext=0),t}{const i={};return i.state=t.state||null,i.alt=void 0===t.alt?null:t.alt,i.context=t.context||null,i.semanticContext=t.semanticContext||null,e&&(i.reachesIntoOuterContext=t.reachesIntoOuterContext||0,i.precedenceFilterSuppressed=t.precedenceFilterSuppressed||!1),i}}class y{constructor(t,e){this.checkContext(t,e),t=f(t),e=f(e,!0),this.state=null!==t.state?t.state:e.state,this.alt=null!==t.alt?t.alt:e.alt,this.context=null!==t.context?t.context:e.context,this.semanticContext=null!==t.semanticContext?t.semanticContext:null!==e.semanticContext?e.semanticContext:d.NONE,this.reachesIntoOuterContext=e.reachesIntoOuterContext,this.precedenceFilterSuppressed=e.precedenceFilterSuppressed}checkContext(t,e){null!==t.context&&void 0!==t.context||null!==e&&null!==e.context&&void 0!==e.context||(this.context=null)}hashCode(){const t=new r;return this.updateHashCode(t),t.finish()}updateHashCode(t){t.update(this.state.stateNumber,this.alt,this.context,this.semanticContext)}equals(t){return this===t||t instanceof y&&this.state.stateNumber===t.state.stateNumber&&this.alt===t.alt&&(null===this.context?null===t.context:this.context.equals(t.context))&&this.semanticContext.equals(t.semanticContext)&&this.precedenceFilterSuppressed===t.precedenceFilterSuppressed}hashCodeForConfigSet(){const t=new r;return t.update(this.state.stateNumber,this.alt,this.semanticContext),t.finish()}equalsForConfigSet(t){return this===t||t instanceof y&&this.state.stateNumber===t.state.stateNumber&&this.alt===t.alt&&this.semanticContext.equals(t.semanticContext)}toString(){return"("+this.state+","+this.alt+(null!==this.context?",["+this.context.toString()+"]":"")+(this.semanticContext!==d.NONE?","+this.semanticContext.toString():"")+(this.reachesIntoOuterContext>0?",up="+this.reachesIntoOuterContext:"")+")"}}class g{constructor(t,e){this.start=t,this.stop=e}clone(){return new g(this.start,this.stop)}contains(t){return t>=this.start&&t<this.stop}toString(){return this.start===this.stop-1?this.start.toString():this.start.toString()+".."+(this.stop-1).toString()}get length(){return this.stop-this.start}}g.INVALID_INTERVAL=new g(-1,-2);class T{constructor(){this.intervals=null,this.readOnly=!1}first(e){return null===this.intervals||0===this.intervals.length?t.INVALID_TYPE:this.intervals[0].start}addOne(t){this.addInterval(new g(t,t+1))}addRange(t,e){this.addInterval(new g(t,e+1))}addInterval(t){if(null===this.intervals)this.intervals=[],this.intervals.push(t.clone());else{for(let e=0;e<this.intervals.length;e++){const i=this.intervals[e];if(t.stop<i.start)return void this.intervals.splice(e,0,t);if(t.stop===i.start)return void(this.intervals[e]=new g(t.start,i.stop));if(t.start<=i.stop)return this.intervals[e]=new g(Math.min(i.start,t.start),Math.max(i.stop,t.stop)),void this.reduce(e)}this.intervals.push(t.clone())}}addSet(t){return null!==t.intervals&&t.intervals.forEach((t=>this.addInterval(t)),this),this}reduce(t){if(t<this.intervals.length-1){const e=this.intervals[t],i=this.intervals[t+1];e.stop>=i.stop?(this.intervals.splice(t+1,1),this.reduce(t)):e.stop>=i.start&&(this.intervals[t]=new g(e.start,i.stop),this.intervals.splice(t+1,1))}}complement(t,e){const i=new T;return i.addInterval(new g(t,e+1)),null!==this.intervals&&this.intervals.forEach((t=>i.removeRange(t))),i}contains(t){if(null===this.intervals)return!1;for(let e=0;e<this.intervals.length;e++)if(this.intervals[e].contains(t))return!0;return!1}removeRange(t){if(t.start===t.stop-1)this.removeOne(t.start);else if(null!==this.intervals){let e=0;for(let i=0;i<this.intervals.length;i++){const i=this.intervals[e];if(t.stop<=i.start)return;if(t.start>i.start&&t.stop<i.stop){this.intervals[e]=new g(i.start,t.start);const s=new g(t.stop,i.stop);return void this.intervals.splice(e,0,s)}t.start<=i.start&&t.stop>=i.stop?(this.intervals.splice(e,1),e-=1):t.start<i.stop?this.intervals[e]=new g(i.start,t.start):t.stop<i.stop&&(this.intervals[e]=new g(t.stop,i.stop)),e+=1}}}removeOne(t){if(null!==this.intervals)for(let e=0;e<this.intervals.length;e++){const i=this.intervals[e];if(t<i.start)return;if(t===i.start&&t===i.stop-1)return void this.intervals.splice(e,1);if(t===i.start)return void(this.intervals[e]=new g(i.start+1,i.stop));if(t===i.stop-1)return void(this.intervals[e]=new g(i.start,i.stop-1));if(t<i.stop-1){const s=new g(i.start,t);return i.start=t+1,void this.intervals.splice(e,0,s)}}}toString(t,e,i){return t=t||null,e=e||null,i=i||!1,null===this.intervals?"{}":null!==t||null!==e?this.toTokenString(t,e):i?this.toCharString():this.toIndexString()}toCharString(){const e=[];for(let i=0;i<this.intervals.length;i++){const s=this.intervals[i];s.stop===s.start+1?s.start===t.EOF?e.push("<EOF>"):e.push("'"+String.fromCharCode(s.start)+"'"):e.push("'"+String.fromCharCode(s.start)+"'..'"+String.fromCharCode(s.stop-1)+"'")}return e.length>1?"{"+e.join(", ")+"}":e[0]}toIndexString(){const e=[];for(let i=0;i<this.intervals.length;i++){const s=this.intervals[i];s.stop===s.start+1?s.start===t.EOF?e.push("<EOF>"):e.push(s.start.toString()):e.push(s.start.toString()+".."+(s.stop-1).toString())}return e.length>1?"{"+e.join(", ")+"}":e[0]}toTokenString(t,e){const i=[];for(let s=0;s<this.intervals.length;s++){const r=this.intervals[s];for(let s=r.start;s<r.stop;s++)i.push(this.elementName(t,e,s))}return i.length>1?"{"+i.join(", ")+"}":i[0]}elementName(e,i,s){return s===t.EOF?"<EOF>":s===t.EPSILON?"<EPSILON>":e[s]||i[s]}get length(){return this.intervals.map((t=>t.length)).reduce(((t,e)=>t+e))}}class E{constructor(){this.atn=null,this.stateNumber=E.INVALID_STATE_NUMBER,this.stateType=null,this.ruleIndex=0,this.epsilonOnlyTransitions=!1,this.transitions=[],this.nextTokenWithinRule=null}toString(){return this.stateNumber}equals(t){return t instanceof E&&this.stateNumber===t.stateNumber}isNonGreedyExitState(){return!1}addTransition(t,e){void 0===e&&(e=-1),0===this.transitions.length?this.epsilonOnlyTransitions=t.isEpsilon:this.epsilonOnlyTransitions!==t.isEpsilon&&(this.epsilonOnlyTransitions=!1),-1===e?this.transitions.push(t):this.transitions.splice(e,1,t)}}E.INVALID_TYPE=0,E.BASIC=1,E.RULE_START=2,E.BLOCK_START=3,E.PLUS_BLOCK_START=4,E.STAR_BLOCK_START=5,E.TOKEN_START=6,E.RULE_STOP=7,E.BLOCK_END=8,E.STAR_LOOP_BACK=9,E.STAR_LOOP_ENTRY=10,E.PLUS_LOOP_BACK=11,E.LOOP_END=12,E.serializationNames=["INVALID","BASIC","RULE_START","BLOCK_START","PLUS_BLOCK_START","STAR_BLOCK_START","TOKEN_START","RULE_STOP","BLOCK_END","STAR_LOOP_BACK","STAR_LOOP_ENTRY","PLUS_LOOP_BACK","LOOP_END"],E.INVALID_STATE_NUMBER=-1;class R extends E{constructor(){return super(),this.stateType=E.RULE_STOP,this}}class v{constructor(t){if(null==t)throw"target cannot be null.";this.target=t,this.isEpsilon=!1,this.label=null}}v.EPSILON=1,v.RANGE=2,v.RULE=3,v.PREDICATE=4,v.ATOM=5,v.ACTION=6,v.SET=7,v.NOT_SET=8,v.WILDCARD=9,v.PRECEDENCE=10,v.serializationNames=["INVALID","EPSILON","RANGE","RULE","PREDICATE","ATOM","ACTION","SET","NOT_SET","WILDCARD","PRECEDENCE"],v.serializationTypes={EpsilonTransition:v.EPSILON,RangeTransition:v.RANGE,RuleTransition:v.RULE,PredicateTransition:v.PREDICATE,AtomTransition:v.ATOM,ActionTransition:v.ACTION,SetTransition:v.SET,NotSetTransition:v.NOT_SET,WildcardTransition:v.WILDCARD,PrecedencePredicateTransition:v.PRECEDENCE};class b extends v{constructor(t,e,i,s){super(t),this.ruleIndex=e,this.precedence=i,this.followState=s,this.serializationType=v.RULE,this.isEpsilon=!0}matches(t,e,i){return!1}}class L extends v{constructor(e,i){super(e),this.serializationType=v.SET,null!=i?this.label=i:(this.label=new T,this.label.addOne(t.INVALID_TYPE))}matches(t,e,i){return this.label.contains(t)}toString(){return this.label.toString()}}class S extends L{constructor(t,e){super(t,e),this.serializationType=v.NOT_SET}matches(t,e,i){return t>=e&&t<=i&&!super.matches(t,e,i)}toString(){return"~"+super.toString()}}class C extends v{constructor(t){super(t),this.serializationType=v.WILDCARD}matches(t,e,i){return t>=e&&t<=i}toString(){return"."}}class A extends v{constructor(t){super(t)}}class w{}class N extends w{}class I extends N{}class k extends I{get ruleContext(){throw new Error("missing interface implementation")}}class D extends I{}class O extends D{}const P={toStringTree:function(t,e,i){e=e||null,null!==(i=i||null)&&(e=i.ruleNames);let s=P.getNodeText(t,e);s=s.replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r");const r=t.getChildCount();if(0===r)return s;let n="("+s+" ";r>0&&(s=P.toStringTree(t.getChild(0),e),n=n.concat(s));for(let i=1;i<r;i++)s=P.toStringTree(t.getChild(i),e),n=n.concat(" "+s);return n=n.concat(")"),n},getNodeText:function(e,i,s){if(i=i||null,null!==(s=s||null)&&(i=s.ruleNames),null!==i){if(e instanceof k){const t=e.ruleContext.getAltNumber();return 0!=t?i[e.ruleIndex]+":"+t:i[e.ruleIndex]}if(e instanceof O)return e.toString();if(e instanceof D&&null!==e.symbol)return e.symbol.text}const r=e.getPayload();return r instanceof t?r.text:e.getPayload().toString()},getChildren:function(t){const e=[];for(let i=0;i<t.getChildCount();i++)e.push(t.getChild(i));return e},getAncestors:function(t){let e=[];for(t=t.getParent();null!==t;)e=[t].concat(e),t=t.getParent();return e},findAllTokenNodes:function(t,e){return P.findAllNodes(t,e,!0)},findAllRuleNodes:function(t,e){return P.findAllNodes(t,e,!1)},findAllNodes:function(t,e,i){const s=[];return P._findAllNodes(t,e,i,s),s},_findAllNodes:function(t,e,i,s){i&&t instanceof D?t.symbol.type===e&&s.push(t):!i&&t instanceof k&&t.ruleIndex===e&&s.push(t);for(let r=0;r<t.getChildCount();r++)P._findAllNodes(t.getChild(r),e,i,s)},descendants:function(t){let e=[t];for(let i=0;i<t.getChildCount();i++)e=e.concat(P.descendants(t.getChild(i)));return e}},F=P;class U extends k{constructor(t,e){super(),this.parentCtx=t||null,this.invokingState=e||-1}depth(){let t=0,e=this;for(;null!==e;)e=e.parentCtx,t+=1;return t}isEmpty(){return-1===this.invokingState}getSourceInterval(){return g.INVALID_INTERVAL}get ruleContext(){return this}getPayload(){return this}getText(){return 0===this.getChildCount()?"":this.children.map((function(t){return t.getText()})).join("")}getAltNumber(){return 0}setAltNumber(t){}getChild(t){return null}getChildCount(){return 0}accept(t){return t.visitChildren(this)}toStringTree(t,e){return F.toStringTree(this,t,e)}toString(t,e){t=t||null,e=e||null;let i=this,s="[";for(;null!==i&&i!==e;){if(null===t)i.isEmpty()||(s+=i.invokingState);else{const e=i.ruleIndex;s+=e>=0&&e<t.length?t[e]:""+e}null===i.parentCtx||null===t&&i.parentCtx.isEmpty()||(s+=" "),i=i.parentCtx}return s+="]",s}}class H{constructor(t){this.cachedHashCode=t}isEmpty(){return this===H.EMPTY}hasEmptyPath(){return this.getReturnState(this.length-1)===H.EMPTY_RETURN_STATE}hashCode(){return this.cachedHashCode}updateHashCode(t){t.update(this.cachedHashCode)}}H.EMPTY=null,H.EMPTY_RETURN_STATE=2147483647,H.globalNodeCount=1,H.id=H.globalNodeCount,H.trace_atn_sim=!1;class M extends H{constructor(t,e){const i=new r;return i.update(t,e),super(i.finish()),this.parents=t,this.returnStates=e,this}isEmpty(){return this.returnStates[0]===H.EMPTY_RETURN_STATE}getParent(t){return this.parents[t]}getReturnState(t){return this.returnStates[t]}equals(t){return this===t||t instanceof M&&this.hashCode()===t.hashCode()&&e(this.returnStates,t.returnStates)&&e(this.parents,t.parents)}toString(){if(this.isEmpty())return"[]";{let t="[";for(let e=0;e<this.returnStates.length;e++)e>0&&(t+=", "),this.returnStates[e]!==H.EMPTY_RETURN_STATE?(t+=this.returnStates[e],null!==this.parents[e]?t=t+" "+this.parents[e]:t+="null"):t+="$";return t+"]"}}get length(){return this.returnStates.length}}class K extends H{constructor(t,e){let i=0;const s=new r;null!==t?s.update(t,e):s.update(1),i=s.finish(),super(i),this.parentCtx=t,this.returnState=e}getParent(t){return this.parentCtx}getReturnState(t){return this.returnState}equals(t){return this===t||t instanceof K&&this.hashCode()===t.hashCode()&&this.returnState===t.returnState&&(null==this.parentCtx?null==t.parentCtx:this.parentCtx.equals(t.parentCtx))}toString(){const t=null===this.parentCtx?"":this.parentCtx.toString();return 0===t.length?this.returnState===H.EMPTY_RETURN_STATE?"$":""+this.returnState:this.returnState+" "+t}get length(){return 1}static create(t,e){return e===H.EMPTY_RETURN_STATE&&null===t?H.EMPTY:new K(t,e)}}class V extends K{constructor(){super(null,H.EMPTY_RETURN_STATE)}isEmpty(){return!0}getParent(t){return null}getReturnState(t){return this.returnState}equals(t){return this===t}toString(){return"$"}}H.EMPTY=new V;const B="h-";class ${constructor(t,e){this.data={},this.hashFunction=t||n,this.equalsFunction=e||a}set(t,e){const i=B+this.hashFunction(t);if(i in this.data){const s=this.data[i];for(let i=0;i<s.length;i++){const r=s[i];if(this.equalsFunction(t,r.key)){const t=r.value;return r.value=e,t}}return s.push({key:t,value:e}),e}return this.data[i]=[{key:t,value:e}],e}containsKey(t){const e=B+this.hashFunction(t);if(e in this.data){const i=this.data[e];for(let e=0;e<i.length;e++){const s=i[e];if(this.equalsFunction(t,s.key))return!0}}return!1}get(t){const e=B+this.hashFunction(t);if(e in this.data){const i=this.data[e];for(let e=0;e<i.length;e++){const s=i[e];if(this.equalsFunction(t,s.key))return s.value}}return null}entries(){return Object.keys(this.data).filter((t=>t.startsWith(B))).flatMap((t=>this.data[t]),this)}getKeys(){return this.entries().map((t=>t.key))}getValues(){return this.entries().map((t=>t.value))}toString(){return"["+this.entries().map((t=>"{"+t.key+":"+t.value+"}")).join(", ")+"]"}get length(){return Object.keys(this.data).filter((t=>t.startsWith(B))).map((t=>this.data[t].length),this).reduce(((t,e)=>t+e),0)}}function j(t,e){if(null==e&&(e=U.EMPTY),null===e.parentCtx||e===U.EMPTY)return H.EMPTY;const i=j(t,e.parentCtx),s=t.states[e.invokingState].transitions[0];return K.create(i,s.followState.stateNumber)}function G(t,e,i){if(t.isEmpty())return t;let s=i.get(t)||null;if(null!==s)return s;if(s=e.get(t),null!==s)return i.set(t,s),s;let r=!1,n=[];for(let s=0;s<n.length;s++){const a=G(t.getParent(s),e,i);if(r||a!==t.getParent(s)){if(!r){n=[];for(let e=0;e<t.length;e++)n[e]=t.getParent(e);r=!0}n[s]=a}}if(!r)return e.add(t),i.set(t,t),t;let a=null;return a=0===n.length?H.EMPTY:1===n.length?K.create(n[0],t.getReturnState(0)):new M(n,t.returnStates),e.add(a),i.set(a,a),i.set(t,a),a}function z(t,e,i,s){if(t===e)return t;if(t instanceof K&&e instanceof K)return function(t,e,i,s){if(null!==s){let i=s.get(t,e);if(null!==i)return i;if(i=s.get(e,t),null!==i)return i}const r=function(t,e,i){if(i){if(t===H.EMPTY)return H.EMPTY;if(e===H.EMPTY)return H.EMPTY}else{if(t===H.EMPTY&&e===H.EMPTY)return H.EMPTY;if(t===H.EMPTY){const t=[e.returnState,H.EMPTY_RETURN_STATE],i=[e.parentCtx,null];return new M(i,t)}if(e===H.EMPTY){const e=[t.returnState,H.EMPTY_RETURN_STATE],i=[t.parentCtx,null];return new M(i,e)}}return null}(t,e,i);if(null!==r)return null!==s&&s.set(t,e,r),r;if(t.returnState===e.returnState){const r=z(t.parentCtx,e.parentCtx,i,s);if(r===t.parentCtx)return t;if(r===e.parentCtx)return e;const n=K.create(r,t.returnState);return null!==s&&s.set(t,e,n),n}{let i=null;if((t===e||null!==t.parentCtx&&t.parentCtx===e.parentCtx)&&(i=t.parentCtx),null!==i){const r=[t.returnState,e.returnState];t.returnState>e.returnState&&(r[0]=e.returnState,r[1]=t.returnState);const n=new M([i,i],r);return null!==s&&s.set(t,e,n),n}const r=[t.returnState,e.returnState];let n=[t.parentCtx,e.parentCtx];t.returnState>e.returnState&&(r[0]=e.returnState,r[1]=t.returnState,n=[e.parentCtx,t.parentCtx]);const a=new M(n,r);return null!==s&&s.set(t,e,a),a}}(t,e,i,s);if(i){if(t instanceof V)return t;if(e instanceof V)return e}return t instanceof K&&(t=new M([t.getParent()],[t.returnState])),e instanceof K&&(e=new M([e.getParent()],[e.returnState])),function(t,e,i,s){if(null!==s){let i=s.get(t,e);if(null!==i)return H.trace_atn_sim&&console.log("mergeArrays a="+t+",b="+e+" -> previous"),i;if(i=s.get(e,t),null!==i)return H.trace_atn_sim&&console.log("mergeArrays a="+t+",b="+e+" -> previous"),i}let r=0,n=0,a=0,o=new Array(t.returnStates.length+e.returnStates.length).fill(0),l=new Array(t.returnStates.length+e.returnStates.length).fill(null);for(;r<t.returnStates.length&&n<e.returnStates.length;){const h=t.parents[r],c=e.parents[n];if(t.returnStates[r]===e.returnStates[n]){const e=t.returnStates[r];e===H.EMPTY_RETURN_STATE&&null===h&&null===c||null!==h&&null!==c&&h===c?(l[a]=h,o[a]=e):(l[a]=z(h,c,i,s),o[a]=e),r+=1,n+=1}else t.returnStates[r]<e.returnStates[n]?(l[a]=h,o[a]=t.returnStates[r],r+=1):(l[a]=c,o[a]=e.returnStates[n],n+=1);a+=1}if(r<t.returnStates.length)for(let e=r;e<t.returnStates.length;e++)l[a]=t.parents[e],o[a]=t.returnStates[e],a+=1;else for(let t=n;t<e.returnStates.length;t++)l[a]=e.parents[t],o[a]=e.returnStates[t],a+=1;if(a<l.length){if(1===a){const i=K.create(l[0],o[0]);return null!==s&&s.set(t,e,i),i}l=l.slice(0,a),o=o.slice(0,a)}const h=new M(l,o);return h.equals(t)?(null!==s&&s.set(t,e,t),H.trace_atn_sim&&console.log("mergeArrays a="+t+",b="+e+" -> a"),t):h.equals(e)?(null!==s&&s.set(t,e,e),H.trace_atn_sim&&console.log("mergeArrays a="+t+",b="+e+" -> b"),e):(function(t){const e=new $;for(let i=0;i<t.length;i++){const s=t[i];e.containsKey(s)||e.set(s,s)}for(let i=0;i<t.length;i++)t[i]=e.get(t[i])}(l),null!==s&&s.set(t,e,h),H.trace_atn_sim&&console.log("mergeArrays a="+t+",b="+e+" -> "+h),h)}(t,e,i,s)}class q{constructor(){this.data=[]}add(t){this.data[t]=!0}or(t){Object.keys(t.data).map((t=>this.add(t)),this)}remove(t){delete this.data[t]}has(t){return!0===this.data[t]}values(){return Object.keys(this.data)}minValue(){return Math.min.apply(null,this.values())}hashCode(){return r.hashStuff(this.values())}equals(t){return t instanceof q&&e(this.data,t.data)}toString(){return"{"+this.values().join(", ")+"}"}get length(){return this.values().length}}class W{constructor(t){this.atn=t}getDecisionLookahead(t){if(null===t)return null;const e=t.transitions.length,i=[];for(let s=0;s<e;s++){i[s]=new T;const e=new p,r=!1;this._LOOK(t.transition(s).target,null,H.EMPTY,i[s],e,new q,r,!1),(0===i[s].length||i[s].contains(W.HIT_PRED))&&(i[s]=null)}return i}LOOK(t,e,i){const s=new T,r=null!==(i=i||null)?j(t.atn,i):null;return this._LOOK(t,e,r,s,new p,new q,!0,!0),s}_LOOK(e,i,s,r,n,a,o,l){const h=new y({state:e,alt:0,context:s},null);if(!n.has(h)){if(n.add(h),e===i){if(null===s)return void r.addOne(t.EPSILON);if(s.isEmpty()&&l)return void r.addOne(t.EOF)}if(e instanceof R){if(null===s)return void r.addOne(t.EPSILON);if(s.isEmpty()&&l)return void r.addOne(t.EOF);if(s!==H.EMPTY){const t=a.has(e.ruleIndex);try{a.remove(e.ruleIndex);for(let t=0;t<s.length;t++){const e=this.atn.states[s.getReturnState(t)];this._LOOK(e,i,s.getParent(t),r,n,a,o,l)}}finally{t&&a.add(e.ruleIndex)}return}}for(let h=0;h<e.transitions.length;h++){const c=e.transitions[h];if(c.constructor===b){if(a.has(c.target.ruleIndex))continue;const t=K.create(s,c.followState.stateNumber);try{a.add(c.target.ruleIndex),this._LOOK(c.target,i,t,r,n,a,o,l)}finally{a.remove(c.target.ruleIndex)}}else if(c instanceof A)o?this._LOOK(c.target,i,s,r,n,a,o,l):r.addOne(W.HIT_PRED);else if(c.isEpsilon)this._LOOK(c.target,i,s,r,n,a,o,l);else if(c.constructor===C)r.addRange(t.MIN_USER_TOKEN_TYPE,this.atn.maxTokenType);else{let e=c.label;null!==e&&(c instanceof S&&(e=e.complement(t.MIN_USER_TOKEN_TYPE,this.atn.maxTokenType)),r.addSet(e))}}}}}W.HIT_PRED=t.INVALID_TYPE;class Y{constructor(t,e){this.grammarType=t,this.maxTokenType=e,this.states=[],this.decisionToState=[],this.ruleToStartState=[],this.ruleToStopState=null,this.modeNameToStartState={},this.ruleToTokenType=null,this.lexerActions=null,this.modeToStartState=[]}nextTokensInContext(t,e){return new W(this).LOOK(t,null,e)}nextTokensNoContext(t){return null!==t.nextTokenWithinRule||(t.nextTokenWithinRule=this.nextTokensInContext(t,null),t.nextTokenWithinRule.readOnly=!0),t.nextTokenWithinRule}nextTokens(t,e){return void 0===e?this.nextTokensNoContext(t):this.nextTokensInContext(t,e)}addState(t){null!==t&&(t.atn=this,t.stateNumber=this.states.length),this.states.push(t)}removeState(t){this.states[t.stateNumber]=null}defineDecisionState(t){return this.decisionToState.push(t),t.decision=this.decisionToState.length-1,t.decision}getDecisionState(t){return 0===this.decisionToState.length?null:this.decisionToState[t]}getExpectedTokens(e,i){if(e<0||e>=this.states.length)throw"Invalid state number.";const s=this.states[e];let r=this.nextTokens(s);if(!r.contains(t.EPSILON))return r;const n=new T;for(n.addSet(r),n.removeOne(t.EPSILON);null!==i&&i.invokingState>=0&&r.contains(t.EPSILON);){const e=this.states[i.invokingState].transitions[0];r=this.nextTokens(e.followState),n.addSet(r),n.removeOne(t.EPSILON),i=i.parentCtx}return r.contains(t.EPSILON)&&n.addOne(t.EOF),n}}Y.INVALID_ALT_NUMBER=0;class X extends E{constructor(){super(),this.stateType=E.BASIC}}class J extends E{constructor(){return super(),this.decision=-1,this.nonGreedy=!1,this}}class Q extends J{constructor(){return super(),this.endState=null,this}}class Z extends E{constructor(){return super(),this.stateType=E.BLOCK_END,this.startState=null,this}}class tt extends E{constructor(){return super(),this.stateType=E.LOOP_END,this.loopBackState=null,this}}class et extends E{constructor(){return super(),this.stateType=E.RULE_START,this.stopState=null,this.isPrecedenceRule=!1,this}}class it extends J{constructor(){return super(),this.stateType=E.TOKEN_START,this}}class st extends J{constructor(){return super(),this.stateType=E.PLUS_LOOP_BACK,this}}class rt extends E{constructor(){return super(),this.stateType=E.STAR_LOOP_BACK,this}}class nt extends J{constructor(){return super(),this.stateType=E.STAR_LOOP_ENTRY,this.loopBackState=null,this.isPrecedenceDecision=null,this}}class at extends Q{constructor(){return super(),this.stateType=E.PLUS_BLOCK_START,this.loopBackState=null,this}}class ot extends Q{constructor(){return super(),this.stateType=E.STAR_BLOCK_START,this}}class lt extends Q{constructor(){return super(),this.stateType=E.BLOCK_START,this}}class ht extends v{constructor(t,e){super(t),this.label_=e,this.label=this.makeLabel(),this.serializationType=v.ATOM}makeLabel(){const t=new T;return t.addOne(this.label_),t}matches(t,e,i){return this.label_===t}toString(){return this.label_}}class ct extends v{constructor(t,e,i){super(t),this.serializationType=v.RANGE,this.start=e,this.stop=i,this.label=this.makeLabel()}makeLabel(){const t=new T;return t.addRange(this.start,this.stop),t}matches(t,e,i){return t>=this.start&&t<=this.stop}toString(){return"'"+String.fromCharCode(this.start)+"'..'"+String.fromCharCode(this.stop)+"'"}}class ut extends v{constructor(t,e,i,s){super(t),this.serializationType=v.ACTION,this.ruleIndex=e,this.actionIndex=void 0===i?-1:i,this.isCtxDependent=void 0!==s&&s,this.isEpsilon=!0}matches(t,e,i){return!1}toString(){return"action_"+this.ruleIndex+":"+this.actionIndex}}class pt extends v{constructor(t,e){super(t),this.serializationType=v.EPSILON,this.isEpsilon=!0,this.outermostPrecedenceReturn=e}matches(t,e,i){return!1}toString(){return"epsilon"}}class dt extends d{constructor(t,e,i){super(),this.ruleIndex=void 0===t?-1:t,this.predIndex=void 0===e?-1:e,this.isCtxDependent=void 0!==i&&i}evaluate(t,e){const i=this.isCtxDependent?e:null;return t.sempred(i,this.ruleIndex,this.predIndex)}updateHashCode(t){t.update(this.ruleIndex,this.predIndex,this.isCtxDependent)}equals(t){return this===t||t instanceof dt&&this.ruleIndex===t.ruleIndex&&this.predIndex===t.predIndex&&this.isCtxDependent===t.isCtxDependent}toString(){return"{"+this.ruleIndex+":"+this.predIndex+"}?"}}d.NONE=new dt;class mt extends A{constructor(t,e,i,s){super(t),this.serializationType=v.PREDICATE,this.ruleIndex=e,this.predIndex=i,this.isCtxDependent=s,this.isEpsilon=!0}matches(t,e,i){return!1}getPredicate(){return new dt(this.ruleIndex,this.predIndex,this.isCtxDependent)}toString(){return"pred_"+this.ruleIndex+":"+this.predIndex}}class _t extends d{constructor(t){super(),this.precedence=void 0===t?0:t}evaluate(t,e){return t.precpred(e,this.precedence)}evalPrecedence(t,e){return t.precpred(e,this.precedence)?d.NONE:null}compareTo(t){return this.precedence-t.precedence}updateHashCode(t){t.update(this.precedence)}equals(t){return this===t||t instanceof _t&&this.precedence===t.precedence}toString(){return"{"+this.precedence+">=prec}?"}}d.PrecedencePredicate=_t;class xt extends A{constructor(t,e){super(t),this.serializationType=v.PRECEDENCE,this.precedence=e,this.isEpsilon=!0}matches(t,e,i){return!1}getPredicate(){return new _t(this.precedence)}toString(){return this.precedence+" >= _p"}}class ft{constructor(t){void 0===t&&(t=null),this.readOnly=!1,this.verifyATN=null===t||t.verifyATN,this.generateRuleBypassTransitions=null!==t&&t.generateRuleBypassTransitions}}ft.defaultOptions=new ft,ft.defaultOptions.readOnly=!0;class yt{constructor(t){this.actionType=t,this.isPositionDependent=!1}hashCode(){const t=new r;return this.updateHashCode(t),t.finish()}updateHashCode(t){t.update(this.actionType)}equals(t){return this===t}}class gt extends yt{constructor(){super(6)}execute(t){t.skip()}toString(){return"skip"}}gt.INSTANCE=new gt;class Tt extends yt{constructor(t){super(0),this.channel=t}execute(t){t._channel=this.channel}updateHashCode(t){t.update(this.actionType,this.channel)}equals(t){return this===t||t instanceof Tt&&this.channel===t.channel}toString(){return"channel("+this.channel+")"}}class Et extends yt{constructor(t,e){super(1),this.ruleIndex=t,this.actionIndex=e,this.isPositionDependent=!0}execute(t){t.action(null,this.ruleIndex,this.actionIndex)}updateHashCode(t){t.update(this.actionType,this.ruleIndex,this.actionIndex)}equals(t){return this===t||t instanceof Et&&this.ruleIndex===t.ruleIndex&&this.actionIndex===t.actionIndex}}class Rt extends yt{constructor(){super(3)}execute(t){t.more()}toString(){return"more"}}Rt.INSTANCE=new Rt;class vt extends yt{constructor(t){super(7),this.type=t}execute(t){t.type=this.type}updateHashCode(t){t.update(this.actionType,this.type)}equals(t){return this===t||t instanceof vt&&this.type===t.type}toString(){return"type("+this.type+")"}}class bt extends yt{constructor(t){super(5),this.mode=t}execute(t){t.pushMode(this.mode)}updateHashCode(t){t.update(this.actionType,this.mode)}equals(t){return this===t||t instanceof bt&&this.mode===t.mode}toString(){return"pushMode("+this.mode+")"}}class Lt extends yt{constructor(){super(4)}execute(t){t.popMode()}toString(){return"popMode"}}Lt.INSTANCE=new Lt;class St extends yt{constructor(t){super(2),this.mode=t}execute(t){t.mode(this.mode)}updateHashCode(t){t.update(this.actionType,this.mode)}equals(t){return this===t||t instanceof St&&this.mode===t.mode}toString(){return"mode("+this.mode+")"}}function Ct(t,e){const i=[];return i[t-1]=e,i.map((function(t){return e}))}class At{constructor(t){null==t&&(t=ft.defaultOptions),this.deserializationOptions=t,this.stateFactories=null,this.actionFactories=null}deserialize(t){const e=this.reset(t);this.checkVersion(e),e&&this.skipUUID();const i=this.readATN();this.readStates(i,e),this.readRules(i,e),this.readModes(i);const s=[];return this.readSets(i,s,this.readInt.bind(this)),e&&this.readSets(i,s,this.readInt32.bind(this)),this.readEdges(i,s),this.readDecisions(i),this.readLexerActions(i,e),this.markPrecedenceDecisions(i),this.verifyATN(i),this.deserializationOptions.generateRuleBypassTransitions&&1===i.grammarType&&(this.generateRuleBypassTransitions(i),this.verifyATN(i)),i}reset(t){if(3===(t.charCodeAt?t.charCodeAt(0):t[0])){const e=function(t){const e=t.charCodeAt(0);return e>1?e-2:e+65534},i=t.split("").map(e);return i[0]=t.charCodeAt(0),this.data=i,this.pos=0,!0}return this.data=t,this.pos=0,!1}skipUUID(){let t=0;for(;t++<8;)this.readInt()}checkVersion(t){const e=this.readInt();if(!t&&4!==e)throw"Could not deserialize ATN with version "+e+" (expected 4)."}readATN(){const t=this.readInt(),e=this.readInt();return new Y(t,e)}readStates(t,e){let i,s,r;const n=[],a=[],o=this.readInt();for(let i=0;i<o;i++){const i=this.readInt();if(i===E.INVALID_TYPE){t.addState(null);continue}let s=this.readInt();e&&65535===s&&(s=-1);const r=this.stateFactory(i,s);if(i===E.LOOP_END){const t=this.readInt();n.push([r,t])}else if(r instanceof Q){const t=this.readInt();a.push([r,t])}t.addState(r)}for(i=0;i<n.length;i++)s=n[i],s[0].loopBackState=t.states[s[1]];for(i=0;i<a.length;i++)s=a[i],s[0].endState=t.states[s[1]];let l=this.readInt();for(i=0;i<l;i++)r=this.readInt(),t.states[r].nonGreedy=!0;let h=this.readInt();for(i=0;i<h;i++)r=this.readInt(),t.states[r].isPrecedenceRule=!0}readRules(e,i){let s;const r=this.readInt();for(0===e.grammarType&&(e.ruleToTokenType=Ct(r,0)),e.ruleToStartState=Ct(r,0),s=0;s<r;s++){const r=this.readInt();if(e.ruleToStartState[s]=e.states[r],0===e.grammarType){let r=this.readInt();i&&65535===r&&(r=t.EOF),e.ruleToTokenType[s]=r}}for(e.ruleToStopState=Ct(r,0),s=0;s<e.states.length;s++){const t=e.states[s];t instanceof R&&(e.ruleToStopState[t.ruleIndex]=t,e.ruleToStartState[t.ruleIndex].stopState=t)}}readModes(t){const e=this.readInt();for(let i=0;i<e;i++){let e=this.readInt();t.modeToStartState.push(t.states[e])}}readSets(t,e,i){const s=this.readInt();for(let t=0;t<s;t++){const t=new T;e.push(t);const s=this.readInt();0!==this.readInt()&&t.addOne(-1);for(let e=0;e<s;e++){const e=i(),s=i();t.addRange(e,s)}}}readEdges(t,e){let i,s,r,n,a;const o=this.readInt();for(i=0;i<o;i++){const i=this.readInt(),s=this.readInt(),r=this.readInt(),a=this.readInt(),o=this.readInt(),l=this.readInt();n=this.edgeFactory(t,r,i,s,a,o,l,e),t.states[i].addTransition(n)}for(i=0;i<t.states.length;i++)for(r=t.states[i],s=0;s<r.transitions.length;s++){const e=r.transitions[s];if(!(e instanceof b))continue;let i=-1;t.ruleToStartState[e.target.ruleIndex].isPrecedenceRule&&0===e.precedence&&(i=e.target.ruleIndex),n=new pt(e.followState,i),t.ruleToStopState[e.target.ruleIndex].addTransition(n)}for(i=0;i<t.states.length;i++){if(r=t.states[i],r instanceof Q){if(null===r.endState)throw"IllegalState";if(null!==r.endState.startState)throw"IllegalState";r.endState.startState=r}if(r instanceof st)for(s=0;s<r.transitions.length;s++)a=r.transitions[s].target,a instanceof at&&(a.loopBackState=r);else if(r instanceof rt)for(s=0;s<r.transitions.length;s++)a=r.transitions[s].target,a instanceof nt&&(a.loopBackState=r)}}readDecisions(t){const e=this.readInt();for(let i=0;i<e;i++){const e=this.readInt(),s=t.states[e];t.decisionToState.push(s),s.decision=i}}readLexerActions(t,e){if(0===t.grammarType){const i=this.readInt();t.lexerActions=Ct(i,null);for(let s=0;s<i;s++){const i=this.readInt();let r=this.readInt();e&&65535===r&&(r=-1);let n=this.readInt();e&&65535===n&&(n=-1),t.lexerActions[s]=this.lexerActionFactory(i,r,n)}}}generateRuleBypassTransitions(t){let e;const i=t.ruleToStartState.length;for(e=0;e<i;e++)t.ruleToTokenType[e]=t.maxTokenType+e+1;for(e=0;e<i;e++)this.generateRuleBypassTransition(t,e)}generateRuleBypassTransition(t,e){let i,s;const r=new lt;r.ruleIndex=e,t.addState(r);const n=new Z;n.ruleIndex=e,t.addState(n),r.endState=n,t.defineDecisionState(r),n.startState=r;let a=null,o=null;if(t.ruleToStartState[e].isPrecedenceRule){for(o=null,i=0;i<t.states.length;i++)if(s=t.states[i],this.stateIsEndStateFor(s,e)){o=s,a=s.loopBackState.transitions[0];break}if(null===a)throw"Couldn't identify final state of the precedence rule prefix section."}else o=t.ruleToStopState[e];for(i=0;i<t.states.length;i++){s=t.states[i];for(let t=0;t<s.transitions.length;t++){const e=s.transitions[t];e!==a&&e.target===o&&(e.target=n)}}const l=t.ruleToStartState[e],h=l.transitions.length;for(;h>0;)r.addTransition(l.transitions[h-1]),l.transitions=l.transitions.slice(-1);t.ruleToStartState[e].addTransition(new pt(r)),n.addTransition(new pt(o));const c=new X;t.addState(c),c.addTransition(new ht(n,t.ruleToTokenType[e])),r.addTransition(new pt(c))}stateIsEndStateFor(t,e){if(t.ruleIndex!==e)return null;if(!(t instanceof nt))return null;const i=t.transitions[t.transitions.length-1].target;return i instanceof tt&&i.epsilonOnlyTransitions&&i.transitions[0].target instanceof R?t:null}markPrecedenceDecisions(t){for(let e=0;e<t.states.length;e++){const i=t.states[e];if(i instanceof nt&&t.ruleToStartState[i.ruleIndex].isPrecedenceRule){const t=i.transitions[i.transitions.length-1].target;t instanceof tt&&t.epsilonOnlyTransitions&&t.transitions[0].target instanceof R&&(i.isPrecedenceDecision=!0)}}}verifyATN(t){if(this.deserializationOptions.verifyATN)for(let e=0;e<t.states.length;e++){const i=t.states[e];if(null!==i)if(this.checkCondition(i.epsilonOnlyTransitions||i.transitions.length<=1),i instanceof at)this.checkCondition(null!==i.loopBackState);else if(i instanceof nt)if(this.checkCondition(null!==i.loopBackState),this.checkCondition(2===i.transitions.length),i.transitions[0].target instanceof ot)this.checkCondition(i.transitions[1].target instanceof tt),this.checkCondition(!i.nonGreedy);else{if(!(i.transitions[0].target instanceof tt))throw"IllegalState";this.checkCondition(i.transitions[1].target instanceof ot),this.checkCondition(i.nonGreedy)}else i instanceof rt?(this.checkCondition(1===i.transitions.length),this.checkCondition(i.transitions[0].target instanceof nt)):i instanceof tt?this.checkCondition(null!==i.loopBackState):i instanceof et?this.checkCondition(null!==i.stopState):i instanceof Q?this.checkCondition(null!==i.endState):i instanceof Z?this.checkCondition(null!==i.startState):i instanceof J?this.checkCondition(i.transitions.length<=1||i.decision>=0):this.checkCondition(i.transitions.length<=1||i instanceof R)}}checkCondition(t,e){if(!t)throw null==e&&(e="IllegalState"),e}readInt(){return this.data[this.pos++]}readInt32(){return this.readInt()|this.readInt()<<16}edgeFactory(e,i,s,r,n,a,o,l){const h=e.states[r];switch(i){case v.EPSILON:return new pt(h);case v.RANGE:return new ct(h,0!==o?t.EOF:n,a);case v.RULE:return new b(e.states[n],a,o,h);case v.PREDICATE:return new mt(h,n,a,0!==o);case v.PRECEDENCE:return new xt(h,n);case v.ATOM:return new ht(h,0!==o?t.EOF:n);case v.ACTION:return new ut(h,n,a,0!==o);case v.SET:return new L(h,l[n]);case v.NOT_SET:return new S(h,l[n]);case v.WILDCARD:return new C(h);default:throw"The specified transition type: "+i+" is not valid."}}stateFactory(t,e){if(null===this.stateFactories){const t=[];t[E.INVALID_TYPE]=null,t[E.BASIC]=()=>new X,t[E.RULE_START]=()=>new et,t[E.BLOCK_START]=()=>new lt,t[E.PLUS_BLOCK_START]=()=>new at,t[E.STAR_BLOCK_START]=()=>new ot,t[E.TOKEN_START]=()=>new it,t[E.RULE_STOP]=()=>new R,t[E.BLOCK_END]=()=>new Z,t[E.STAR_LOOP_BACK]=()=>new rt,t[E.STAR_LOOP_ENTRY]=()=>new nt,t[E.PLUS_LOOP_BACK]=()=>new st,t[E.LOOP_END]=()=>new tt,this.stateFactories=t}if(t>this.stateFactories.length||null===this.stateFactories[t])throw"The specified state type "+t+" is not valid.";{const i=this.stateFactories[t]();if(null!==i)return i.ruleIndex=e,i}}lexerActionFactory(t,e,i){if(null===this.actionFactories){const t=[];t[0]=(t,e)=>new Tt(t),t[1]=(t,e)=>new Et(t,e),t[2]=(t,e)=>new St(t),t[3]=(t,e)=>Rt.INSTANCE,t[4]=(t,e)=>Lt.INSTANCE,t[5]=(t,e)=>new bt(t),t[6]=(t,e)=>gt.INSTANCE,t[7]=(t,e)=>new vt(t),this.actionFactories=t}if(t>this.actionFactories.length||null===this.actionFactories[t])throw"The specified lexer action type "+t+" is not valid.";return this.actionFactories[t](e,i)}}class wt{syntaxError(t,e,i,s,r,n){}reportAmbiguity(t,e,i,s,r,n,a){}reportAttemptingFullContext(t,e,i,s,r,n){}reportContextSensitivity(t,e,i,s,r,n){}}class Nt extends wt{constructor(){super()}syntaxError(t,e,i,s,r,n){console.error("line "+i+":"+s+" "+r)}}Nt.INSTANCE=new Nt;class It extends wt{constructor(t){if(super(),null===t)throw"delegates";return this.delegates=t,this}syntaxError(t,e,i,s,r,n){this.delegates.map((a=>a.syntaxError(t,e,i,s,r,n)))}reportAmbiguity(t,e,i,s,r,n,a){this.delegates.map((o=>o.reportAmbiguity(t,e,i,s,r,n,a)))}reportAttemptingFullContext(t,e,i,s,r,n){this.delegates.map((a=>a.reportAttemptingFullContext(t,e,i,s,r,n)))}reportContextSensitivity(t,e,i,s,r,n){this.delegates.map((a=>a.reportContextSensitivity(t,e,i,s,r,n)))}}class kt{constructor(){this._listeners=[Nt.INSTANCE],this._interp=null,this._stateNumber=-1}checkVersion(t){const e="4.13.1";e!==t&&console.log("ANTLR runtime and generated code versions disagree: "+e+"!="+t)}addErrorListener(t){this._listeners.push(t)}removeErrorListeners(){this._listeners=[]}getLiteralNames(){return Object.getPrototypeOf(this).constructor.literalNames||[]}getSymbolicNames(){return Object.getPrototypeOf(this).constructor.symbolicNames||[]}getTokenNames(){if(!this.tokenNames){const t=this.getLiteralNames(),e=this.getSymbolicNames(),i=t.length>e.length?t.length:e.length;this.tokenNames=[];for(let s=0;s<i;s++)this.tokenNames[s]=t[s]||e[s]||"<INVALID"}return this.tokenNames}getTokenTypeMap(){const e=this.getTokenNames();if(null===e)throw"The current recognizer does not provide a list of token names.";let i=this.tokenTypeMapCache[e];return void 0===i&&(i=e.reduce((function(t,e,i){t[e]=i})),i.EOF=t.EOF,this.tokenTypeMapCache[e]=i),i}getRuleIndexMap(){const t=this.ruleNames;if(null===t)throw"The current recognizer does not provide a list of rule names.";let e=this.ruleIndexMapCache[t];return void 0===e&&(e=t.reduce((function(t,e,i){t[e]=i})),this.ruleIndexMapCache[t]=e),e}getTokenType(e){const i=this.getTokenTypeMap()[e];return void 0!==i?i:t.INVALID_TYPE}getErrorHeader(t){return"line "+t.getOffendingToken().line+":"+t.getOffendingToken().column}getTokenErrorDisplay(e){if(null===e)return"<no token>";let i=e.text;return null===i&&(i=e.type===t.EOF?"<EOF>":"<"+e.type+">"),i=i.replace("\n","\\n").replace("\r","\\r").replace("\t","\\t"),"'"+i+"'"}getErrorListenerDispatch(){return new It(this._listeners)}sempred(t,e,i){return!0}precpred(t,e){return!0}get atn(){return this._interp.atn}get state(){return this._stateNumber}set state(t){this._stateNumber=t}}kt.tokenTypeMapCache={},kt.ruleIndexMapCache={};class Dt extends t{constructor(e,i,s,r,n){super(),this.source=void 0!==e?e:Dt.EMPTY_SOURCE,this.type=void 0!==i?i:null,this.channel=void 0!==s?s:t.DEFAULT_CHANNEL,this.start=void 0!==r?r:-1,this.stop=void 0!==n?n:-1,this.tokenIndex=-1,null!==this.source[0]?(this.line=e[0].line,this.column=e[0].column):this.column=-1}clone(){const t=new Dt(this.source,this.type,this.channel,this.start,this.stop);return t.tokenIndex=this.tokenIndex,t.line=this.line,t.column=this.column,t.text=this.text,t}cloneWithType(e){const i=new Dt(this.source,e,this.channel,this.start,this.stop);return i.tokenIndex=this.tokenIndex,i.line=this.line,i.column=this.column,e===t.EOF&&(i.text=""),i}toString(){let t=this.text;return t=null!==t?t.replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t"):"<no text>","[@"+this.tokenIndex+","+this.start+":"+this.stop+"='"+t+"',<"+this.type+">"+(this.channel>0?",channel="+this.channel:"")+","+this.line+":"+this.column+"]"}get text(){if(null!==this._text)return this._text;const t=this.getInputStream();if(null===t)return null;const e=t.size;return this.start<e&&this.stop<e?t.getText(this.start,this.stop):"<EOF>"}set text(t){this._text=t}}Dt.EMPTY_SOURCE=[null,null];class Ot{}class Pt extends Ot{constructor(t){super(),this.copyText=void 0!==t&&t}create(t,e,i,s,r,n,a,o){const l=new Dt(t,e,s,r,n);return l.line=a,l.column=o,null!==i?l.text=i:this.copyText&&null!==t[1]&&(l.text=t[1].getText(r,n)),l}createThin(t,e){const i=new Dt(null,t);return i.text=e,i}}Pt.DEFAULT=new Pt;class Ft extends Error{constructor(t){super(t.message),Error.captureStackTrace&&Error.captureStackTrace(this,Ft),this.message=t.message,this.recognizer=t.recognizer,this.input=t.input,this.ctx=t.ctx,this.offendingToken=null,this.offendingState=-1,null!==this.recognizer&&(this.offendingState=this.recognizer.state)}getExpectedTokens(){return null!==this.recognizer?this.recognizer.atn.getExpectedTokens(this.offendingState,this.ctx):null}toString(){return this.message}}class Ut extends Ft{constructor(t,e,i,s){super({message:"",recognizer:t,input:e,ctx:null}),this.startIndex=i,this.deadEndConfigs=s}toString(){let t="";return this.startIndex>=0&&this.startIndex<this.input.size&&(t=this.input.getText(new g(this.startIndex,this.startIndex))),"LexerNoViableAltException"+t}}class Ht extends kt{constructor(e){super(),this._input=e,this._factory=Pt.DEFAULT,this._tokenFactorySourcePair=[this,e],this._interp=null,this._token=null,this._tokenStartCharIndex=-1,this._tokenStartLine=-1,this._tokenStartColumn=-1,this._hitEOF=!1,this._channel=t.DEFAULT_CHANNEL,this._type=t.INVALID_TYPE,this._modeStack=[],this._mode=Ht.DEFAULT_MODE,this._text=null}reset(){null!==this._input&&this._input.seek(0),this._token=null,this._type=t.INVALID_TYPE,this._channel=t.DEFAULT_CHANNEL,this._tokenStartCharIndex=-1,this._tokenStartColumn=-1,this._tokenStartLine=-1,this._text=null,this._hitEOF=!1,this._mode=Ht.DEFAULT_MODE,this._modeStack=[],this._interp.reset()}nextToken(){if(null===this._input)throw"nextToken requires a non-null input stream.";const e=this._input.mark();try{for(;;){if(this._hitEOF)return this.emitEOF(),this._token;this._token=null,this._channel=t.DEFAULT_CHANNEL,this._tokenStartCharIndex=this._input.index,this._tokenStartColumn=this._interp.column,this._tokenStartLine=this._interp.line,this._text=null;let e=!1;for(;;){this._type=t.INVALID_TYPE;let i=Ht.SKIP;try{i=this._interp.match(this._input,this._mode)}catch(t){if(!(t instanceof Ft))throw console.log(t.stack),t;this.notifyListeners(t),this.recover(t)}if(this._input.LA(1)===t.EOF&&(this._hitEOF=!0),this._type===t.INVALID_TYPE&&(this._type=i),this._type===Ht.SKIP){e=!0;break}if(this._type!==Ht.MORE)break}if(!e)return null===this._token&&this.emit(),this._token}}finally{this._input.release(e)}}skip(){this._type=Ht.SKIP}more(){this._type=Ht.MORE}mode(t){this._mode=t}pushMode(t){this._interp.debug&&console.log("pushMode "+t),this._modeStack.push(this._mode),this.mode(t)}popMode(){if(0===this._modeStack.length)throw"Empty Stack";return this._interp.debug&&console.log("popMode back to "+this._modeStack.slice(0,-1)),this.mode(this._modeStack.pop()),this._mode}emitToken(t){this._token=t}emit(){const t=this._factory.create(this._tokenFactorySourcePair,this._type,this._text,this._channel,this._tokenStartCharIndex,this.getCharIndex()-1,this._tokenStartLine,this._tokenStartColumn);return this.emitToken(t),t}emitEOF(){const e=this.column,i=this.line,s=this._factory.create(this._tokenFactorySourcePair,t.EOF,null,t.DEFAULT_CHANNEL,this._input.index,this._input.index-1,i,e);return this.emitToken(s),s}getCharIndex(){return this._input.index}getAllTokens(){const e=[];let i=this.nextToken();for(;i.type!==t.EOF;)e.push(i),i=this.nextToken();return e}notifyListeners(t){const e=this._t