@cratedb/cratedb-sqlparse
Version:
  
1 lines • 710 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["@cratedb/cratedb-sqlparse"]={})}(this,(function(t){"use strict";var e=Object.defineProperty,s=(t,s,i)=>((t,s,i)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[s]=i)(t,"symbol"!=typeof s?s+"":s,i),i={763:()=>{}},r={};function n(t){var e=r[t];if(void 0!==e)return e.exports;var s=r[t]={exports:{}};return i[t](s,s.exports,n),s.exports}n.d=(t,e)=>{for(var s in e)n.o(e,s)&&!n.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var a={};n.d(a,{MG:()=>J,fr:()=>Dt,sR:()=>Ie,Zo:()=>me,iH:()=>Pe,rt:()=>bt,jB:()=>we,M8:()=>ue,$t:()=>fe,aq:()=>ge,pG:()=>kt,eP:()=>Oe,KU:()=>xe,zW:()=>ye,IX:()=>S,mY:()=>L,a7:()=>j,JG:()=>Kt,ay:()=>$t,X2:()=>re,WU:()=>pe,Uw:()=>Re,gw:()=>Ce,iX:()=>Be,re:()=>ae,Pg:()=>Ge,tD:()=>he,R$:()=>ie,Dj:()=>Bt,m7:()=>K,NZ:()=>b,xo:()=>w,ou:()=>h,qC:()=>Ve,mD:()=>p,Ay:()=>ze});class h{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 c(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 s=0;s<t.length;s++)if(!(t[s]===e[s]||t[s].equals&&t[s].equals(e[s])))return!1;return!0}h.INVALID_TYPE=0,h.EPSILON=-2,h.MIN_USER_TOKEN_TYPE=1,h.EOF=-1,h.DEFAULT_CHANNEL=0,h.HIDDEN_CHANNEL=1;const o=Math.round(Math.random()*Math.pow(2,32));function l(t){if(!t)return 0;const e=typeof t,s="string"===e?t:!("object"!==e||!t.toString)&&t.toString();if(!s)return 0;let i,r;const n=3&s.length,a=s.length-n;let h=o;const c=3432918353,l=461845907;let u=0;for(;u<a;)r=255&s.charCodeAt(u)|(255&s.charCodeAt(++u))<<8|(255&s.charCodeAt(++u))<<16|(255&s.charCodeAt(++u))<<24,++u,r=(65535&r)*c+(((r>>>16)*c&65535)<<16)&4294967295,r=r<<15|r>>>17,r=(65535&r)*l+(((r>>>16)*l&65535)<<16)&4294967295,h^=r,h=h<<13|h>>>19,i=5*(65535&h)+((5*(h>>>16)&65535)<<16)&4294967295,h=27492+(65535&i)+((58964+(i>>>16)&65535)<<16);switch(r=0,n){case 3:r^=(255&s.charCodeAt(u+2))<<16;case 2:r^=(255&s.charCodeAt(u+1))<<8;case 1:r^=255&s.charCodeAt(u),r=(65535&r)*c+(((r>>>16)*c&65535)<<16)&4294967295,r=r<<15|r>>>17,r=(65535&r)*l+(((r>>>16)*l&65535)<<16)&4294967295,h^=r}return h^=s.length,h^=h>>>16,h=2246822507*(65535&h)+((2246822507*(h>>>16)&65535)<<16)&4294967295,h^=h>>>13,h=3266489909*(65535&h)+((3266489909*(h>>>16)&65535)<<16)&4294967295,h^=h>>>16,h>>>0}class u{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=l(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 s=this.hash^t;s=s<<13|s>>>19,s=5*s+3864292196,this.hash=s}}}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 u;return t.update.apply(t,arguments),t.finish()}}function T(t){return t?"string"==typeof t?l(t):t.hashCode():-1}function d(t,e){return t&&t.equals?t.equals(e):t===e}function E(t){return null===t?"null":t}function p(t){return Array.isArray(t)?"["+t.map(E).join(", ")+"]":"null"}class R{constructor(t,e){this.buckets=new Array(16),this.threshold=Math.floor(12),this.itemCount=0,this.hashFunction=t||T,this.equalsFunction=e||d}get(t){if(null==t)return t;const e=this._getBucket(t);if(!e)return null;for(const s of e)if(this.equalsFunction(s,t))return s;return null}add(t){return this.getOrAdd(t)===t}getOrAdd(t){this._expand();const e=this._getSlot(t);let s=this.buckets[e];if(!s)return s=[t],this.buckets[e]=s,this.itemCount++,t;for(const i of s)if(this.equalsFunction(i,t))return i;return s.push(t),this.itemCount++,t}has(t){return null!=this.get(t)}values(){return this.buckets.filter((t=>null!=t)).flat(1)}toString(){return p(this.values())}get length(){return this.itemCount}_getSlot(t){return this.hashFunction(t)&this.buckets.length-1}_getBucket(t){return this.buckets[this._getSlot(t)]}_expand(){if(this.itemCount<=this.threshold)return;const t=this.buckets,e=2*this.buckets.length;this.buckets=new Array(e),this.threshold=Math.floor(.75*e);for(const s of t)if(s)for(const t of s){const e=this._getSlot(t);let s=this.buckets[e];s||(s=[],this.buckets[e]=s),s.push(t)}}}class C{hashCode(){const t=new u;return this.updateHashCode(t),t.finish()}evaluate(t,e){}evalPrecedence(t,e){return this}static andContext(t,e){if(null===t||t===C.NONE)return e;if(null===e||e===C.NONE)return t;const s=new A(t,e);return 1===s.opnds.length?s.opnds[0]:s}static orContext(t,e){if(null===t)return e;if(null===e)return t;if(t===C.NONE||e===C.NONE)return C.NONE;const s=new x(t,e);return 1===s.opnds.length?s.opnds[0]:s}}class A extends C{constructor(t,e){super();const s=new R;t instanceof A?t.opnds.map((function(t){s.add(t)})):s.add(t),e instanceof A?e.opnds.map((function(t){s.add(t)})):s.add(e);const i=O(s);if(i.length>0){let t=null;i.map((function(e){(null===t||e.precedence<t.precedence)&&(t=e)})),s.add(t)}this.opnds=Array.from(s.values())}equals(t){return this===t||t instanceof A&&c(this.opnds,t.opnds)}updateHashCode(t){t.update(this.opnds,"AND")}evaluate(t,e){for(let s=0;s<this.opnds.length;s++)if(!this.opnds[s].evaluate(t,e))return!1;return!0}evalPrecedence(t,e){let s=!1;const i=[];for(let n=0;n<this.opnds.length;n++){const r=this.opnds[n],a=r.evalPrecedence(t,e);if(s|=a!==r,null===a)return null;a!==C.NONE&&i.push(a)}if(!s)return this;if(0===i.length)return C.NONE;let r=null;return i.map((function(t){r=null===r?t:C.andContext(r,t)})),r}toString(){const t=this.opnds.map((t=>t.toString()));return(t.length>3?t.slice(3):t).join("&&")}}class x extends C{constructor(t,e){super();const s=new R;t instanceof x?t.opnds.map((function(t){s.add(t)})):s.add(t),e instanceof x?e.opnds.map((function(t){s.add(t)})):s.add(e);const i=O(s);if(i.length>0){const t=i.sort((function(t,e){return t.compareTo(e)})),e=t[t.length-1];s.add(e)}this.opnds=Array.from(s.values())}equals(t){return this===t||t instanceof x&&c(this.opnds,t.opnds)}updateHashCode(t){t.update(this.opnds,"OR")}evaluate(t,e){for(let s=0;s<this.opnds.length;s++)if(this.opnds[s].evaluate(t,e))return!0;return!1}evalPrecedence(t,e){let s=!1;const i=[];for(let r=0;r<this.opnds.length;r++){const n=this.opnds[r],a=n.evalPrecedence(t,e);if(s|=a!==n,a===C.NONE)return C.NONE;null!==a&&i.push(a)}return s?(i.length,null):this}toString(){const t=this.opnds.map((t=>t.toString()));return(t.length>3?t.slice(3):t).join("||")}}function O(t){const e=[];return t.values().map((function(t){t instanceof C.PrecedencePredicate&&e.push(t)})),e}function _(t,e){if(null===t){const t={state:null,alt:null,context:null,semanticContext:null};return e&&(t.reachesIntoOuterContext=0),t}{const s={};return s.state=t.state||null,s.alt=void 0===t.alt?null:t.alt,s.context=t.context||null,s.semanticContext=t.semanticContext||null,e&&(s.reachesIntoOuterContext=t.reachesIntoOuterContext||0,s.precedenceFilterSuppressed=t.precedenceFilterSuppressed||!1),s}}class g{constructor(t,e){this.checkContext(t,e),t=_(t),e=_(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:C.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 u;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 g&&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 u;return t.update(this.state.stateNumber,this.alt,this.semanticContext),t.finish()}equalsForConfigSet(t){return this===t||t instanceof g&&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!==C.NONE?","+this.semanticContext.toString():"")+(this.reachesIntoOuterContext>0?",up="+this.reachesIntoOuterContext:"")+")"}}class S{constructor(t,e){this.start=t,this.stop=e}clone(){return new S(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}}S.INVALID_INTERVAL=new S(-1,-2);class L{constructor(){this.intervals=null,this.readOnly=!1}first(t){return null===this.intervals||0===this.intervals.length?h.INVALID_TYPE:this.intervals[0].start}addOne(t){this.addInterval(new S(t,t+1))}addRange(t,e){this.addInterval(new S(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 s=this.intervals[e];if(t.stop<s.start)return void this.intervals.splice(e,0,t);if(t.stop===s.start)return void(this.intervals[e]=new S(t.start,s.stop));if(t.start<=s.stop)return this.intervals[e]=new S(Math.min(s.start,t.start),Math.max(s.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],s=this.intervals[t+1];e.stop>=s.stop?(this.intervals.splice(t+1,1),this.reduce(t)):e.stop>=s.start&&(this.intervals[t]=new S(e.start,s.stop),this.intervals.splice(t+1,1))}}complement(t,e){const s=new L;return s.addInterval(new S(t,e+1)),null!==this.intervals&&this.intervals.forEach((t=>s.removeRange(t))),s}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 s=0;s<this.intervals.length;s++){const s=this.intervals[e];if(t.stop<=s.start)return;if(t.start>s.start&&t.stop<s.stop){this.intervals[e]=new S(s.start,t.start);const i=new S(t.stop,s.stop);return void this.intervals.splice(e,0,i)}t.start<=s.start&&t.stop>=s.stop?(this.intervals.splice(e,1),e-=1):t.start<s.stop?this.intervals[e]=new S(s.start,t.start):t.stop<s.stop&&(this.intervals[e]=new S(t.stop,s.stop)),e+=1}}}removeOne(t){if(null!==this.intervals)for(let e=0;e<this.intervals.length;e++){const s=this.intervals[e];if(t<s.start)return;if(t===s.start&&t===s.stop-1)return void this.intervals.splice(e,1);if(t===s.start)return void(this.intervals[e]=new S(s.start+1,s.stop));if(t===s.stop-1)return void(this.intervals[e]=new S(s.start,s.stop-1));if(t<s.stop-1){const i=new S(s.start,t);return s.start=t+1,void this.intervals.splice(e,0,i)}}}toString(t,e,s){return t=t||null,e=e||null,s=s||!1,null===this.intervals?"{}":null!==t||null!==e?this.toTokenString(t,e):s?this.toCharString():this.toIndexString()}toCharString(){const t=[];for(let e=0;e<this.intervals.length;e++){const s=this.intervals[e];s.stop===s.start+1?s.start===h.EOF?t.push("<EOF>"):t.push("'"+String.fromCharCode(s.start)+"'"):t.push("'"+String.fromCharCode(s.start)+"'..'"+String.fromCharCode(s.stop-1)+"'")}return t.length>1?"{"+t.join(", ")+"}":t[0]}toIndexString(){const t=[];for(let e=0;e<this.intervals.length;e++){const s=this.intervals[e];s.stop===s.start+1?s.start===h.EOF?t.push("<EOF>"):t.push(s.start.toString()):t.push(s.start.toString()+".."+(s.stop-1).toString())}return t.length>1?"{"+t.join(", ")+"}":t[0]}toTokenString(t,e){const s=[];for(let i=0;i<this.intervals.length;i++){const r=this.intervals[i];for(let i=r.start;i<r.stop;i++)s.push(this.elementName(t,e,i))}return s.length>1?"{"+s.join(", ")+"}":s[0]}elementName(t,e,s){return s===h.EOF?"<EOF>":s===h.EPSILON?"<EPSILON>":t[s]||e[s]}get length(){return this.intervals.map((t=>t.length)).reduce(((t,e)=>t+e))}}class f{constructor(){this.atn=null,this.stateNumber=f.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 f&&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)}}f.INVALID_TYPE=0,f.BASIC=1,f.RULE_START=2,f.BLOCK_START=3,f.PLUS_BLOCK_START=4,f.STAR_BLOCK_START=5,f.TOKEN_START=6,f.RULE_STOP=7,f.BLOCK_END=8,f.STAR_LOOP_BACK=9,f.STAR_LOOP_ENTRY=10,f.PLUS_LOOP_BACK=11,f.LOOP_END=12,f.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"],f.INVALID_STATE_NUMBER=-1;class I extends f{constructor(){return super(),this.stateType=f.RULE_STOP,this}}class N{constructor(t){if(null==t)throw"target cannot be null.";this.target=t,this.isEpsilon=!1,this.label=null}}N.EPSILON=1,N.RANGE=2,N.RULE=3,N.PREDICATE=4,N.ATOM=5,N.ACTION=6,N.SET=7,N.NOT_SET=8,N.WILDCARD=9,N.PRECEDENCE=10,N.serializationNames=["INVALID","EPSILON","RANGE","RULE","PREDICATE","ATOM","ACTION","SET","NOT_SET","WILDCARD","PRECEDENCE"],N.serializationTypes={EpsilonTransition:N.EPSILON,RangeTransition:N.RANGE,RuleTransition:N.RULE,PredicateTransition:N.PREDICATE,AtomTransition:N.ATOM,ActionTransition:N.ACTION,SetTransition:N.SET,NotSetTransition:N.NOT_SET,WildcardTransition:N.WILDCARD,PrecedencePredicateTransition:N.PRECEDENCE};class m extends N{constructor(t,e,s,i){super(t),this.ruleIndex=e,this.precedence=s,this.followState=i,this.serializationType=N.RULE,this.isEpsilon=!0}matches(t,e,s){return!1}}class y extends N{constructor(t,e){super(t),this.serializationType=N.SET,null!=e?this.label=e:(this.label=new L,this.label.addOne(h.INVALID_TYPE))}matches(t,e,s){return this.label.contains(t)}toString(){return this.label.toString()}}class v extends y{constructor(t,e){super(t,e),this.serializationType=N.NOT_SET}matches(t,e,s){return t>=e&&t<=s&&!super.matches(t,e,s)}toString(){return"~"+super.toString()}}class D extends N{constructor(t){super(t),this.serializationType=N.WILDCARD}matches(t,e,s){return t>=e&&t<=s}toString(){return"."}}class k extends N{constructor(t){super(t)}}class P{}class U extends P{}class M extends U{}class b extends M{get ruleContext(){throw new Error("missing interface implementation")}}class w extends M{}class H extends w{}const B={toStringTree:function(t,e,s){e=e||null,null!==(s=s||null)&&(e=s.ruleNames);let i=B.getNodeText(t,e);i=i.replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r");const r=t.getChildCount();if(0===r)return i;let n="("+i+" ";r>0&&(i=B.toStringTree(t.getChild(0),e),n=n.concat(i));for(let a=1;a<r;a++)i=B.toStringTree(t.getChild(a),e),n=n.concat(" "+i);return n=n.concat(")"),n},getNodeText:function(t,e,s){if(e=e||null,null!==(s=s||null)&&(e=s.ruleNames),null!==e){if(t instanceof b){const s=t.ruleContext.getAltNumber();return 0!=s?e[t.ruleIndex]+":"+s:e[t.ruleIndex]}if(t instanceof H)return t.toString();if(t instanceof w&&null!==t.symbol)return t.symbol.text}const i=t.getPayload();return i instanceof h?i.text:t.getPayload().toString()},getChildren:function(t){const e=[];for(let s=0;s<t.getChildCount();s++)e.push(t.getChild(s));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 B.findAllNodes(t,e,!0)},findAllRuleNodes:function(t,e){return B.findAllNodes(t,e,!1)},findAllNodes:function(t,e,s){const i=[];return B._findAllNodes(t,e,s,i),i},_findAllNodes:function(t,e,s,i){s&&t instanceof w?t.symbol.type===e&&i.push(t):!s&&t instanceof b&&t.ruleIndex===e&&i.push(t);for(let r=0;r<t.getChildCount();r++)B._findAllNodes(t.getChild(r),e,s,i)},descendants:function(t){let e=[t];for(let s=0;s<t.getChildCount();s++)e=e.concat(B.descendants(t.getChild(s)));return e}},F=B;class K extends b{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 S.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 s=this,i="[";for(;null!==s&&s!==e;){if(null===t)s.isEmpty()||(i+=s.invokingState);else{const e=s.ruleIndex;i+=e>=0&&e<t.length?t[e]:""+e}null===s.parentCtx||null===t&&s.parentCtx.isEmpty()||(i+=" "),s=s.parentCtx}return i+="]",i}}class G{constructor(t){this.cachedHashCode=t}isEmpty(){return this===G.EMPTY}hasEmptyPath(){return this.getReturnState(this.length-1)===G.EMPTY_RETURN_STATE}hashCode(){return this.cachedHashCode}updateHashCode(t){t.update(this.cachedHashCode)}}G.EMPTY=null,G.EMPTY_RETURN_STATE=2147483647,G.globalNodeCount=1,G.id=G.globalNodeCount,G.trace_atn_sim=!1;class W extends G{constructor(t,e){const s=new u;return s.update(t,e),super(s.finish()),this.parents=t,this.returnStates=e,this}isEmpty(){return this.returnStates[0]===G.EMPTY_RETURN_STATE}getParent(t){return this.parents[t]}getReturnState(t){return this.returnStates[t]}equals(t){return this===t||t instanceof W&&this.hashCode()===t.hashCode()&&c(this.returnStates,t.returnStates)&&c(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]!==G.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 V extends G{constructor(t,e){let s=0;const i=new u;null!==t?i.update(t,e):i.update(1),s=i.finish(),super(s),this.parentCtx=t,this.returnState=e}getParent(t){return this.parentCtx}getReturnState(t){return this.returnState}equals(t){return this===t||t instanceof V&&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===G.EMPTY_RETURN_STATE?"$":""+this.returnState:this.returnState+" "+t}get length(){return 1}static create(t,e){return e===G.EMPTY_RETURN_STATE&&null===t?G.EMPTY:new V(t,e)}}class Y extends V{constructor(){super(null,G.EMPTY_RETURN_STATE)}isEmpty(){return!0}getParent(t){return null}getReturnState(t){return this.returnState}equals(t){return this===t}toString(){return"$"}}G.EMPTY=new Y;class q{constructor(t,e){this.buckets=new Array(16),this.threshold=Math.floor(12),this.itemCount=0,this.hashFunction=t||T,this.equalsFunction=e||d}set(t,e){this._expand();const s=this._getSlot(t);let i=this.buckets[s];if(!i)return i=[[t,e]],this.buckets[s]=i,this.itemCount++,e;const r=i.find((e=>this.equalsFunction(e[0],t)),this);if(r){const t=r[1];return r[1]=e,t}return i.push([t,e]),this.itemCount++,e}containsKey(t){const e=this._getBucket(t);return!!e&&!!e.find((e=>this.equalsFunction(e[0],t)),this)}get(t){const e=this._getBucket(t);if(!e)return null;const s=e.find((e=>this.equalsFunction(e[0],t)),this);return s?s[1]:null}entries(){return this.buckets.filter((t=>null!=t)).flat(1)}getKeys(){return this.entries().map((t=>t[0]))}getValues(){return this.entries().map((t=>t[1]))}toString(){return"["+this.entries().map((t=>"{"+t[0]+":"+t[1]+"}")).join(", ")+"]"}get length(){return this.itemCount}_getSlot(t){return this.hashFunction(t)&this.buckets.length-1}_getBucket(t){return this.buckets[this._getSlot(t)]}_expand(){if(this.itemCount<=this.threshold)return;const t=this.buckets,e=2*this.buckets.length;this.buckets=new Array(e),this.threshold=Math.floor(.75*e);for(const s of t)if(s)for(const t of s){const e=this._getSlot(t[0]);let s=this.buckets[e];s||(s=[],this.buckets[e]=s),s.push(t)}}}function Q(t,e){if(null==e&&(e=K.EMPTY),null===e.parentCtx||e===K.EMPTY)return G.EMPTY;const s=Q(t,e.parentCtx),i=t.states[e.invokingState].transitions[0];return V.create(s,i.followState.stateNumber)}function X(t,e,s){if(t.isEmpty())return t;let i=s.get(t)||null;if(null!==i)return i;if(i=e.get(t),null!==i)return s.set(t,i),i;let r=!1,n=[];for(let h=0;h<n.length;h++){const i=X(t.getParent(h),e,s);if(r||i!==t.getParent(h)){if(!r){n=[];for(let e=0;e<t.length;e++)n[e]=t.getParent(e);r=!0}n[h]=i}}if(!r)return e.add(t),s.set(t,t),t;let a=null;return a=0===n.length?G.EMPTY:1===n.length?V.create(n[0],t.getReturnState(0)):new W(n,t.returnStates),e.add(a),s.set(a,a),s.set(t,a),a}function z(t,e,s,i){if(t===e)return t;if(t instanceof V&&e instanceof V)return function(t,e,s,i){if(null!==i){let s=i.get(t,e);if(null!==s)return s;if(s=i.get(e,t),null!==s)return s}const r=function(t,e,s){if(s){if(t===G.EMPTY)return G.EMPTY;if(e===G.EMPTY)return G.EMPTY}else{if(t===G.EMPTY&&e===G.EMPTY)return G.EMPTY;if(t===G.EMPTY){const t=[e.returnState,G.EMPTY_RETURN_STATE],s=[e.parentCtx,null];return new W(s,t)}if(e===G.EMPTY){const e=[t.returnState,G.EMPTY_RETURN_STATE],s=[t.parentCtx,null];return new W(s,e)}}return null}(t,e,s);if(null!==r)return null!==i&&i.set(t,e,r),r;if(t.returnState===e.returnState){const r=z(t.parentCtx,e.parentCtx,s,i);if(r===t.parentCtx)return t;if(r===e.parentCtx)return e;const n=V.create(r,t.returnState);return null!==i&&i.set(t,e,n),n}{let s=null;if((t===e||null!==t.parentCtx&&t.parentCtx===e.parentCtx)&&(s=t.parentCtx),null!==s){const r=[t.returnState,e.returnState];t.returnState>e.returnState&&(r[0]=e.returnState,r[1]=t.returnState);const n=new W([s,s],r);return null!==i&&i.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 W(n,r);return null!==i&&i.set(t,e,a),a}}(t,e,s,i);if(s){if(t instanceof Y)return t;if(e instanceof Y)return e}return t instanceof V&&(t=new W([t.getParent()],[t.returnState])),e instanceof V&&(e=new W([e.getParent()],[e.returnState])),function(t,e,s,i){if(null!==i){let s=i.get(t,e);if(null!==s)return G.trace_atn_sim&&console.log("mergeArrays a="+t+",b="+e+" -> previous"),s;if(s=i.get(e,t),null!==s)return G.trace_atn_sim&&console.log("mergeArrays a="+t+",b="+e+" -> previous"),s}let r=0,n=0,a=0,h=new Array(t.returnStates.length+e.returnStates.length).fill(0),c=new Array(t.returnStates.length+e.returnStates.length).fill(null);for(;r<t.returnStates.length&&n<e.returnStates.length;){const o=t.parents[r],l=e.parents[n];if(t.returnStates[r]===e.returnStates[n]){const e=t.returnStates[r];e===G.EMPTY_RETURN_STATE&&null===o&&null===l||null!==o&&null!==l&&o===l?(c[a]=o,h[a]=e):(c[a]=z(o,l,s,i),h[a]=e),r+=1,n+=1}else t.returnStates[r]<e.returnStates[n]?(c[a]=o,h[a]=t.returnStates[r],r+=1):(c[a]=l,h[a]=e.returnStates[n],n+=1);a+=1}if(r<t.returnStates.length)for(let l=r;l<t.returnStates.length;l++)c[a]=t.parents[l],h[a]=t.returnStates[l],a+=1;else for(let l=n;l<e.returnStates.length;l++)c[a]=e.parents[l],h[a]=e.returnStates[l],a+=1;if(a<c.length){if(1===a){const s=V.create(c[0],h[0]);return null!==i&&i.set(t,e,s),s}c=c.slice(0,a),h=h.slice(0,a)}const o=new W(c,h);return o.equals(t)?(null!==i&&i.set(t,e,t),G.trace_atn_sim&&console.log("mergeArrays a="+t+",b="+e+" -> a"),t):o.equals(e)?(null!==i&&i.set(t,e,e),G.trace_atn_sim&&console.log("mergeArrays a="+t+",b="+e+" -> b"),e):(function(t){const e=new q;for(let s=0;s<t.length;s++){const i=t[s];e.containsKey(i)||e.set(i,i)}for(let s=0;s<t.length;s++)t[s]=e.get(t[s])}(c),null!==i&&i.set(t,e,o),G.trace_atn_sim&&console.log("mergeArrays a="+t+",b="+e+" -> "+o),o)}(t,e,s,i)}class Z{constructor(){this.data=new Uint32Array(1)}set(t){Z._checkIndex(t),this._resize(t),this.data[t>>>5]|=1<<t%32}get(t){Z._checkIndex(t);const e=t>>>5;return!(e>=this.data.length||!(this.data[e]&1<<t%32))}clear(t){Z._checkIndex(t);const e=t>>>5;e<this.data.length&&(this.data[e]&=~(1<<t))}or(t){const e=Math.min(this.data.length,t.data.length);for(let s=0;s<e;++s)this.data[s]|=t.data[s];if(this.data.length<t.data.length){this._resize((t.data.length<<5)-1);const s=t.data.length;for(let i=e;i<s;++i)this.data[i]=t.data[i]}}values(){const t=new Array(this.length);let e=0;const s=this.data.length;for(let i=0;i<s;++i){let s=this.data[i];for(;0!==s;){const r=s&-s;t[e++]=(i<<5)+Z._bitCount(r-1),s^=r}}return t}minValue(){for(let t=0;t<this.data.length;++t){let e=this.data[t];if(0!==e){let s=0;for(;!(1&e);)s++,e>>=1;return s+32*t}}return 0}hashCode(){return u.hashStuff(this.values())}equals(t){return t instanceof Z&&c(this.data,t.data)}toString(){return"{"+this.values().join(", ")+"}"}get length(){return this.data.map((t=>Z._bitCount(t))).reduce(((t,e)=>t+e),0)}_resize(t){const e=t+32>>>5;if(e<=this.data.length)return;const s=new Uint32Array(e);s.set(this.data),s.fill(0,this.data.length),this.data=s}static _checkIndex(t){if(t<0)throw new RangeError("index cannot be negative")}static _bitCount(t){return t=(t=(858993459&(t-=t>>1&1431655765))+(t>>2&858993459))+(t>>4)&252645135,t+=t>>8,0+(t+=t>>16)&63}}class j{constructor(t){this.atn=t}getDecisionLookahead(t){if(null===t)return null;const e=t.transitions.length,s=[];for(let i=0;i<e;i++){s[i]=new L;const e=new R,r=!1;this._LOOK(t.transition(i).target,null,G.EMPTY,s[i],e,new Z,r,!1),(0===s[i].length||s[i].contains(j.HIT_PRED))&&(s[i]=null)}return s}LOOK(t,e,s){const i=new L,r=null!==(s=s||null)?Q(t.atn,s):null;return this._LOOK(t,e,r,i,new R,new Z,!0,!0),i}_LOOK(t,e,s,i,r,n,a,c){const o=new g({state:t,alt:0,context:s},null);if(!r.has(o)){if(r.add(o),t===e){if(null===s)return void i.addOne(h.EPSILON);if(s.isEmpty()&&c)return void i.addOne(h.EOF)}if(t instanceof I){if(null===s)return void i.addOne(h.EPSILON);if(s.isEmpty()&&c)return void i.addOne(h.EOF);if(s!==G.EMPTY){const h=n.get(t.ruleIndex);try{n.clear(t.ruleIndex);for(let t=0;t<s.length;t++){const h=this.atn.states[s.getReturnState(t)];this._LOOK(h,e,s.getParent(t),i,r,n,a,c)}}finally{h&&n.set(t.ruleIndex)}return}}for(let o=0;o<t.transitions.length;o++){const l=t.transitions[o];if(l.constructor===m){if(n.get(l.target.ruleIndex))continue;const t=V.create(s,l.followState.stateNumber);try{n.set(l.target.ruleIndex),this._LOOK(l.target,e,t,i,r,n,a,c)}finally{n.clear(l.target.ruleIndex)}}else if(l instanceof k)a?this._LOOK(l.target,e,s,i,r,n,a,c):i.addOne(j.HIT_PRED);else if(l.isEpsilon)this._LOOK(l.target,e,s,i,r,n,a,c);else if(l.constructor===D)i.addRange(h.MIN_USER_TOKEN_TYPE,this.atn.maxTokenType);else{let t=l.label;null!==t&&(l instanceof v&&(t=t.complement(h.MIN_USER_TOKEN_TYPE,this.atn.maxTokenType)),i.addSet(t))}}}}}j.HIT_PRED=h.INVALID_TYPE;class J{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 j(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(t,e){if(t<0||t>=this.states.length)throw"Invalid state number.";const s=this.states[t];let i=this.nextTokens(s);if(!i.contains(h.EPSILON))return i;const r=new L;for(r.addSet(i),r.removeOne(h.EPSILON);null!==e&&e.invokingState>=0&&i.contains(h.EPSILON);){const t=this.states[e.invokingState].transitions[0];i=this.nextTokens(t.followState),r.addSet(i),r.removeOne(h.EPSILON),e=e.parentCtx}return i.contains(h.EPSILON)&&r.addOne(h.EOF),r}}J.INVALID_ALT_NUMBER=0;class $ extends f{constructor(){super(),this.stateType=f.BASIC}}class tt extends f{constructor(){return super(),this.decision=-1,this.nonGreedy=!1,this}}class et extends tt{constructor(){return super(),this.endState=null,this}}class st extends f{constructor(){return super(),this.stateType=f.BLOCK_END,this.startState=null,this}}class it extends f{constructor(){return super(),this.stateType=f.LOOP_END,this.loopBackState=null,this}}class rt extends f{constructor(){return super(),this.stateType=f.RULE_START,this.stopState=null,this.isPrecedenceRule=!1,this}}class nt extends tt{constructor(){return super(),this.stateType=f.TOKEN_START,this}}class at extends tt{constructor(){return super(),this.stateType=f.PLUS_LOOP_BACK,this}}class ht extends f{constructor(){return super(),this.stateType=f.STAR_LOOP_BACK,this}}class ct extends tt{constructor(){return super(),this.stateType=f.STAR_LOOP_ENTRY,this.loopBackState=null,this.isPrecedenceDecision=null,this}}class ot extends et{constructor(){return super(),this.stateType=f.PLUS_BLOCK_START,this.loopBackState=null,this}}class lt extends et{constructor(){return super(),this.stateType=f.STAR_BLOCK_START,this}}class ut extends et{constructor(){return super(),this.stateType=f.BLOCK_START,this}}class Tt extends N{constructor(t,e){super(t),this.label_=e,this.label=this.makeLabel(),this.serializationType=N.ATOM}makeLabel(){const t=new L;return t.addOne(this.label_),t}matches(t,e,s){return this.label_===t}toString(){return this.label_}}class dt extends N{constructor(t,e,s){super(t),this.serializationType=N.RANGE,this.start=e,this.stop=s,this.label=this.makeLabel()}makeLabel(){const t=new L;return t.addRange(this.start,this.stop),t}matches(t,e,s){return t>=this.start&&t<=this.stop}toString(){return"'"+String.fromCharCode(this.start)+"'..'"+String.fromCharCode(this.stop)+"'"}}class Et extends N{constructor(t,e,s,i){super(t),this.serializationType=N.ACTION,this.ruleIndex=e,this.actionIndex=void 0===s?-1:s,this.isCtxDependent=void 0!==i&&i,this.isEpsilon=!0}matches(t,e,s){return!1}toString(){return"action_"+this.ruleIndex+":"+this.actionIndex}}class pt extends N{constructor(t,e){super(t),this.serializationType=N.EPSILON,this.isEpsilon=!0,this.outermostPrecedenceReturn=e}matches(t,e,s){return!1}toString(){return"epsilon"}}class Rt extends C{constructor(t,e,s){super(),this.ruleIndex=void 0===t?-1:t,this.predIndex=void 0===e?-1:e,this.isCtxDependent=void 0!==s&&s}evaluate(t,e){const s=this.isCtxDependent?e:null;return t.sempred(s,this.ruleIndex,this.predIndex)}updateHashCode(t){t.update(this.ruleIndex,this.predIndex,this.isCtxDependent)}equals(t){return this===t||t instanceof Rt&&this.ruleIndex===t.ruleIndex&&this.predIndex===t.predIndex&&this.isCtxDependent===t.isCtxDependent}toString(){return"{"+this.ruleIndex+":"+this.predIndex+"}?"}}C.NONE=new Rt;class Ct extends k{constructor(t,e,s,i){super(t),this.serializationType=N.PREDICATE,this.ruleIndex=e,this.predIndex=s,this.isCtxDependent=i,this.isEpsilon=!0}matches(t,e,s){return!1}getPredicate(){return new Rt(this.ruleIndex,this.predIndex,this.isCtxDependent)}toString(){return"pred_"+this.ruleIndex+":"+this.predIndex}}class At extends C{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)?C.NONE:null}compareTo(t){return this.precedence-t.precedence}updateHashCode(t){t.update(this.precedence)}equals(t){return this===t||t instanceof At&&this.precedence===t.precedence}toString(){return"{"+this.precedence+">=prec}?"}}C.PrecedencePredicate=At;class xt extends k{constructor(t,e){super(t),this.serializationType=N.PRECEDENCE,this.precedence=e,this.isEpsilon=!0}matches(t,e,s){return!1}getPredicate(){return new At(this.precedence)}toString(){return this.precedence+" >= _p"}}class Ot{constructor(t){void 0===t&&(t=null),this.readOnly=!1,this.verifyATN=null===t||t.verifyATN,this.generateRuleBypassTransitions=null!==t&&t.generateRuleBypassTransitions}}Ot.defaultOptions=new Ot,Ot.defaultOptions.readOnly=!0;class _t{constructor(t){this.actionType=t,this.isPositionDependent=!1}hashCode(){const t=new u;return this.updateHashCode(t),t.finish()}updateHashCode(t){t.update(this.actionType)}equals(t){return this===t}}class gt extends _t{constructor(){super(6)}execute(t){t.skip()}toString(){return"skip"}}gt.INSTANCE=new gt;class St extends _t{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 St&&this.channel===t.channel}toString(){return"channel("+this.channel+")"}}class Lt extends _t{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 Lt&&this.ruleIndex===t.ruleIndex&&this.actionIndex===t.actionIndex}}class ft extends _t{constructor(){super(3)}execute(t){t.more()}toString(){return"more"}}ft.INSTANCE=new ft;class It extends _t{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 It&&this.type===t.type}toString(){return"type("+this.type+")"}}class Nt extends _t{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 Nt&&this.mode===t.mode}toString(){return"pushMode("+this.mode+")"}}class mt extends _t{constructor(){super(4)}execute(t){t.popMode()}toString(){return"popMode"}}mt.INSTANCE=new mt;class yt extends _t{constructor(t){super(2),this.mode=t}execute(t){t.setMode(this.mode)}updateHashCode(t){t.update(this.actionType,this.mode)}equals(t){return this===t||t instanceof yt&&this.mode===t.mode}toString(){return"mode("+this.mode+")"}}function vt(t,e){const s=[];return s[t-1]=e,s.map((function(t){return e}))}class Dt{constructor(t){null==t&&(t=Ot.defaultOptions),this.deserializationOptions=t,this.stateFactories=null,this.actionFactories=null}deserialize(t){const e=this.reset(t);this.checkVersion(e),e&&this.skipUUID();const s=this.readATN();this.readStates(s,e),this.readRules(s,e),this.readModes(s);const i=[];return this.readSets(s,i,this.readInt.bind(this)),e&&this.readSets(s,i,this.readInt32.bind(this)),this.readEdges(s,i),this.readDecisions(s),this.readLexerActions(s,e),this.markPrecedenceDecisions(s),this.verifyATN(s),this.deserializationOptions.generateRuleBypassTransitions&&1===s.grammarType&&(this.generateRuleBypassTransitions(s),this.verifyATN(s)),s}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},s=t.split("").map(e);return s[0]=t.charCodeAt(0),this.data=s,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 J(t,e)}readStates(t,e){let s,i,r;const n=[],a=[],h=this.readInt();for(let l=0;l<h;l++){const s=this.readInt();if(s===f.INVALID_TYPE){t.addState(null);continue}let i=this.readInt();e&&65535===i&&(i=-1);const r=this.stateFactory(s,i);if(s===f.LOOP_END){const t=this.readInt();n.push([r,t])}else if(r instanceof et){const t=this.readInt();a.push([r,t])}t.addState(r)}for(s=0;s<n.length;s++)i=n[s],i[0].loopBackState=t.states[i[1]];for(s=0;s<a.length;s++)i=a[s],i[0].endState=t.states[i[1]];let c=this.readInt();for(s=0;s<c;s++)r=this.readInt(),t.states[r].nonGreedy=!0;let o=this.readInt();for(s=0;s<o;s++)r=this.readInt(),t.states[r].isPrecedenceRule=!0}readRules(t,e){let s;const i=this.readInt();for(0===t.grammarType&&(t.ruleToTokenType=vt(i,0)),t.ruleToStartState=vt(i,0),s=0;s<i;s++){const i=this.readInt();if(t.ruleToStartState[s]=t.states[i],0===t.grammarType){let i=this.readInt();e&&65535===i&&(i=h.EOF),t.ruleToTokenType[s]=i}}for(t.ruleToStopState=vt(i,0),s=0;s<t.states.length;s++){const e=t.states[s];e instanceof I&&(t.ruleToStopState[e.ruleIndex]=e,t.ruleToStartState[e.ruleIndex].stopState=e)}}readModes(t){const e=this.readInt();for(let s=0;s<e;s++){let e=this.readInt();t.modeToStartState.push(t.states[e])}}readSets(t,e,s){const i=this.readInt();for(let r=0;r<i;r++){const t=new L;e.push(t);const i=this.readInt();0!==this.readInt()&&t.addOne(-1);for(let e=0;e<i;e++){const e=s(),i=s();t.addRange(e,i)}}}readEdges(t,e){let s,i,r,n,a;const h=this.readInt();for(s=0;s<h;s++){const s=this.readInt(),i=this.readInt(),r=this.readInt(),a=this.readInt(),h=this.readInt(),c=this.readInt();n=this.edgeFactory(t,r,s,i,a,h,c,e),t.states[s].addTransition(n)}for(s=0;s<t.states.length;s++)for(r=t.states[s],i=0;i<r.transitions.length;i++){const e=r.transitions[i];if(!(e instanceof m))continue;let s=-1;t.ruleToStartState[e.target.ruleIndex].isPrecedenceRule&&0===e.precedence&&(s=e.target.ruleIndex),n=new pt(e.followState,s),t.ruleToStopState[e.target.ruleIndex].addTransition(n)}for(s=0;s<t.states.length;s++){if(r=t.states[s],r instanceof et){if(null===r.endState)throw"IllegalState";if(null!==r.endState.startState)throw"IllegalState";r.endState.startState=r}if(r instanceof at)for(i=0;i<r.transitions.length;i++)a=r.transitions[i].target,a instanceof ot&&(a.loopBackState=r);else if(r instanceof ht)for(i=0;i<r.transitions.length;i++)a=r.transitions[i].target,a instanceof ct&&(a.loopBackState=r)}}readDecisions(t){const e=this.readInt();for(let s=0;s<e;s++){const e=this.readInt(),i=t.states[e];t.decisionToState.push(i),i.decision=s}}readLexerActions(t,e){if(0===t.grammarType){const s=this.readInt();t.lexerActions=vt(s,null);for(let i=0;i<s;i++){const s=this.readInt();let r=this.readInt();e&&65535===r&&(r=-1);let n=this.readInt();e&&65535===n&&(n=-1),t.lexerActions[i]=this.lexerActionFactory(s,r,n)}}}generateRuleBypassTransitions(t){let e;const s=t.ruleToStartState.length;for(e=0;e<s;e++)t.ruleToTokenType[e]=t.maxTokenType+e+1;for(e=0;e<s;e++)this.generateRuleBypassTransition(t,e)}generateRuleBypassTransition(t,e){let s,i;const r=new ut;r.ruleIndex=e,t.addState(r);const n=new st;n.ruleIndex=e,t.addState(n),r.endState=n,t.defineDecisionState(r),n.startState=r;let a=null,h=null;if(t.ruleToStartState[e].isPrecedenceRule){for(h=null,s=0;s<t.states.length;s++)if(i=t.states[s],this.stateIsEndStateFor(i,e)){h=i,a=i.loopBackState.transitions[0];break}if(null===a)throw"Couldn't identify final state of the precedence rule prefix section."}else h=t.ruleToStopState[e];for(s=0;s<t.states.length;s++){i=t.states[s];for(let t=0;t<i.transitions.length;t++){const e=i.transitions[t];e!==a&&e.target===h&&(e.target=n)}}const c=t.ruleToStartState[e],o=c.transitions.length;for(;o>0;)r.addTransition(c.transitions[o-1]),c.transitions=c.transitions.slice(-1);t.ruleToStartState[e].addTransition(new pt(r)),n.addTransition(new pt(h));const l=new $;t.addState(l),l.addTransition(new Tt(n,t.ruleToTokenType[e])),r.addTransition(new pt(l))}stateIsEndStateFor(t,e){if(t.ruleIndex!==e)return null;if(!(t instanceof ct))return null;const s=t.transitions[t.transitions.length-1].target;return s instanceof it&&s.epsilonOnlyTransitions&&s.transitions[0].target instanceof I?t:null}markPrecedenceDecisions(t){for(let e=0;e<t.states.length;e++){const s=t.states[e];if(s instanceof ct&&t.ruleToStartState[s.ruleIndex].isPrecedenceRule){const t=s.transitions[s.transitions.length-1].target;t instanceof it&&t.epsilonOnlyTransitions&&t.transitions[0].target instanceof I&&(s.isPrecedenceDecision=!0)}}}verifyATN(t){if(this.deserializationOptions.verifyATN)for(let e=0;e<t.states.length;e++){const s=t.states[e];if(null!==s)if(this.checkCondition(s.epsilonOnlyTransitions||s.transitions.length<=1),s instanceof ot)this.checkCondition(null!==s.loopBackState);else if(s instanceof ct)if(this.checkCondition(null!==s.loopBackState),this.checkCondition(2===s.transitions.length),s.transitions[0].target instanceof lt)this.checkCondition(s.transitions[1].target instanceof it),this.checkCondition(!s.nonGreedy);else{if(!(s.transitions[0].target instanceof it))throw"IllegalState";this.checkCondition(s.transitions[1].target instanceof lt),this.checkCondition(s.nonGreedy)}else s instanceof ht?(this.checkCondition(1===s.transitions.length),this.checkCondition(s.transitions[0].target instanceof ct)):s instanceof it?this.checkCondition(null!==s.loopBackState):s instanceof rt?this.checkCondition(null!==s.stopState):s instanceof et?this.checkCondition(null!==s.endState):s instanceof st?this.checkCondition(null!==s.startState):s instanceof tt?this.checkCondition(s.transitions.length<=1||s.decision>=0):this.checkCondition(s.transitions.length<=1||s instanceof I)}}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(t,e,s,i,r,n,a,c){const o=t.states[i];switch(e){case N.EPSILON:return new pt(o);case N.RANGE:return new dt(o,0!==a?h.EOF:r,n);case N.RULE:return new m(t.states[r],n,a,o);case N.PREDICATE:return new Ct(o,r,n,0!==a);case N.PRECEDENCE:return new xt(o,r);case N.ATOM:return new Tt(o,0!==a?h.EOF:r);case N.ACTION:return new Et(o,r,n,0!==a);case N.SET:return new y(o,c[r]);case N.NOT_SET:return new v(o,c[r]);case N.WILDCARD:return new D(o);default:throw"The specified transition type: "+e+" is not valid."}}stateFactory(t,e){if(null===this.stateFactories){const t=[];t[f.INVALID_TYPE]=null,t[f.BASIC]=()=>new $,t[f.RULE_START]=()=>new rt,t[f.BLOCK_START]=()=>new ut,t[f.PLUS_BLOCK_START]=()=>new ot,t[f.STAR_BLOCK_START]=()=>new lt,t[f.TOKEN_START]=()=>new nt,t[f.RULE_STOP]=()=>new I,t[f.BLOCK_END]=()=>new st,t[f.STAR_LOOP_BACK]=()=>new ht,t[f.STAR_LOOP_ENTRY]=()=>new ct,t[f.PLUS_LOOP_BACK]=()=>new at,t[f.LOOP_END]=()=>new it,this.stateFactories=t}if(t>this.stateFactories.length||null===this.stateFactories[t])throw"The specified state type "+t+" is not valid.";{const s=this.stateFactories[t]();if(null!==s)return s.ruleIndex=e,s}}lexerActionFactory(t,e,s){if(null===this.actionFactories){const t=[];t[0]=(t,e)=>new St(t),t[1]=(t,e)=>new Lt(t,e),t[2]=(t,e)=>new yt(t),t[3]=(t,e)=>ft.INSTANCE,t[4]=(t,e)=>mt.INSTANCE,t[5]=(t,e)=>new Nt(t),t[6]=(t,e)=>gt.INSTANCE,t[7]=(t,e)=>new It(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,s)}}class kt{syntaxError(t,e,s,i,r,n){}reportAmbiguity(t,e,s,i,r,n,a){}reportAttemptingFullContext(t,e,s,i,r,n){}reportContextSensitivity(t,e,s,i,r,n){}}class Pt extends kt{constructor(){super()}syntaxError(t,e,s,i,r,n){console.error("line "+s+":"+i+" "+r)}}Pt.INSTANCE=new Pt;class Ut extends kt{constructor(t){if(super(),null===t)throw"delegates";return this.delegates=t,this}syntaxError(t,e,s,i,r,n){this.delegates.map((a=>a.syntaxError(t,e,s,i,r,n)))}reportAmbiguity(t,e,s,i,r,n,a){this.delegates.map((h=>h.reportAmbiguity(t,e,s,i,r,n,a)))}reportAttemptingFullContext(t,e,s,i,r,n){this.delegates.map((a=>a.reportAttemptingFullContext(t,e,s,i,r,n)))}reportContextSensitivity(t,e,s,i,r,n){this.delegates.map((a=>a.reportContextSensitivity(t,e,s,i,r,n)))}}class Mt{constructor(){this._listeners=[Pt.INSTANCE],this._interp=null,this._stateNumber=-1}checkVersion(t){const e="4.13.2";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(),s=t.length>e.length?t.length:e.length;this.tokenNames=[];for(let i=0;i<s;i++)this.tokenNames[i]=t[i]||e[i]||"<INVALID"}return this.tokenNames}getTokenTypeMap(){const t=this.getTokenNames();if(null===t)throw"The current recognizer does not provide a list of token names.";let e=this.tokenTypeMapCache[t];return void 0===e&&(e=t.reduce((function(t,e,s){t[e]=s})),e.EOF=h.EOF,this.tokenTypeMapCache[t]=e),e}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,s){t[e]=s})),this.ruleIndexMapCache[t]=e),e}getTokenType(t){const e=this.getTokenTypeMap()[t];return void 0!==e?e:h.INVALID_TYPE}getErrorHeader(t){return"line "+t.getOffendingToken().line+":"+t.getOffendingToken().column}getTokenErrorDisplay(t){if(null===t)return"<no token>";let e=t.text;return null===e&&(e=t.type===h.EOF?"<EOF>":"<"+t.type+">"),e=e.replace("\n","\\n").replace("\r","\\r").replace("\t","\\t"),"'"+e+"'"}getErrorListenerDispatch(){return console.warn("Calling deprecated method in Recognizer class: getErrorListenerDispatch()"),this.getErrorListener()}getErrorListener(){return new Ut(this._listeners)}sempred(t,e,s){return!0}precpred(t,e){return!0}get atn(){return this._interp.atn}get state(){return this._stateNumber}set state(t){this._stateNumber=t}}Mt.tokenTypeMapCache={},Mt.ruleIndexMapCache={};class bt extends h{constructor(t,e,s,i,r){super(),this.source=void 0!==t?t:bt.EMPTY_SOURCE,this.type=void 0!==e?e:null,this.channel=void 0!==s?s:h.DEFAULT_CHANNEL,this.start=void 0!==i?i:-1,this.stop=void 0!==r?r:-1,this.tokenIndex=-1,null!==this.source[0]?(this.line=t[0].line,this.column=t[0].column):this.column=-1}clone(){const t=new bt(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(t){const e=new bt(this.source,t,this.channel,this.start,this.stop);return e.tokenIndex=this.tokenIndex,e.line=this.line,e.column=this.column,t===h.EOF&&(e.text=""),e}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}}bt.EMPTY_SOURCE=[null,null];class wt{}class Ht extends wt{constructor(t){super(),this.copyText=void 0!==t&&t}create(t,e,s,i,r,n,a,h){const c=new bt(t,e,i,r,n);return c.line=a,c.column=h,null!==s?c.text=s:this.copyText&&null!==t[1]&&(c.text=t[1].getText(r,n)),c}createThin(t,e){const s=new bt(null,t);return s.text=e,s}}Ht.DEFAULT=new Ht;class Bt extends Error{constructor(t){super(t.message),Error.captureStackTrace&&Error.captureStackTrace(this,Bt),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 Ft extends Bt{constructor(t,e,s,i){super({message:"",recognizer:t,input:e,ctx:null}),this.startIndex=s,this.deadEndConfigs=i}toString(){let t="";return this.startIndex>=0&&this.startIndex<this.input.size&&(t=this.input.getText(new S(this.startIndex,this.startIndex))),"LexerNoViableAltException"+t}}class Kt extends Mt{constructor(t){super(),this._input=t,this._factory=Ht.DEFAULT,this._tokenFactorySourcePair=[this,t],this._interp=null,this._token=null,this._tokenStartCharIndex=-1,this._tokenStartLine=-1,this._tokenStartColumn=-1,this._hitEOF=!1,this._channel=h.DEFAULT_CHANNEL,this._type=h.INVALID_TYPE,this._modeStack=[],this._mode=Kt.DEFAULT_MODE,this._text=null}reset(){null!==this._input&&this._input.seek(0),this._token=null,this._type=h.INVALID_TYPE,this._channel=h.DEFAULT_CHANNEL,this._tokenStartCharIndex=-1,this._tokenStartColumn=-1,this._tokenStartLine=-1,this._text=null,this._hitEOF=!1,this._mode=Kt.DEFAULT_MODE,this._modeStack=[],this._interp.reset()}nextToken(){if(null===this._input)throw"nextToken requires a non-null input stream.";const t=this._input.mark();try{for(;;){if(this._hitEOF)return this.emitEOF(),this._token;this._token=null,this._channel=h.DEFAULT_CHANNEL,this._tokenStartCharIndex=this._input.index,this._tokenStartColumn=this._interp.column,this._tokenStartLine=this._interp.line,this._text=null;let t=!1;for(;;){this._type=h.INVALID_TYPE;let s=Kt.SKIP;try{s=this._interp.match(this._input,this._mode)}catch(e){if(!(e instanceof Bt))throw console.log(e.stack),e;this.notifyListeners(e),this.recover(e)}if(this._input.LA(1)===h.EOF&&(this._hitEOF=!0),this._type===h.INVALID_TYPE&&(this._type=s),this._type===Kt.SKIP){t