@hoox-sh/pynets 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/LICENSE +661 -0
  3. package/NOTICE +46 -0
  4. package/README.md +327 -0
  5. package/dist/browser.js +44 -0
  6. package/dist/index.d.ts +348 -0
  7. package/dist/index.js +41741 -0
  8. package/package.json +77 -0
  9. package/src/ast/builder.ts +1002 -0
  10. package/src/ast/dump.ts +43 -0
  11. package/src/ast/helper.ts +77 -0
  12. package/src/ast/nodes.ts +570 -0
  13. package/src/ast/unparse.ts +360 -0
  14. package/src/cli/rich.ts +378 -0
  15. package/src/cli.ts +627 -0
  16. package/src/generated/PinescriptLexer.interp +267 -0
  17. package/src/generated/PinescriptLexer.tokens +131 -0
  18. package/src/generated/PinescriptLexer.ts +673 -0
  19. package/src/generated/PinescriptLexerBase.ts +395 -0
  20. package/src/generated/PinescriptParser.interp +267 -0
  21. package/src/generated/PinescriptParser.tokens +131 -0
  22. package/src/generated/PinescriptParser.ts +8863 -0
  23. package/src/generated/PinescriptParserBase.ts +21 -0
  24. package/src/generated/PinescriptParserVisitor.ts +840 -0
  25. package/src/index.ts +55 -0
  26. package/src/parser/LexerBase.ts +395 -0
  27. package/src/parser/ParserBase.ts +21 -0
  28. package/src/parser/error.ts +33 -0
  29. package/src/runtime/array.ts +486 -0
  30. package/src/runtime/color.ts +164 -0
  31. package/src/runtime/drawings.ts +510 -0
  32. package/src/runtime/input.ts +102 -0
  33. package/src/runtime/interpret.ts +3897 -0
  34. package/src/runtime/library.ts +282 -0
  35. package/src/runtime/log.ts +69 -0
  36. package/src/runtime/map.ts +85 -0
  37. package/src/runtime/math.ts +231 -0
  38. package/src/runtime/matrix.ts +1154 -0
  39. package/src/runtime/provider.ts +232 -0
  40. package/src/runtime/request.ts +372 -0
  41. package/src/runtime/series.ts +44 -0
  42. package/src/runtime/str.ts +433 -0
  43. package/src/runtime/strategy.ts +1105 -0
  44. package/src/runtime/ta.ts +2093 -0
  45. package/src/runtime/ticker.ts +81 -0
  46. package/src/runtime/time.ts +439 -0
  47. package/src/runtime/timeframe.ts +85 -0
  48. package/src/runtime/udt.ts +119 -0
@@ -0,0 +1,44 @@
1
+ var LL={763:()=>{}},Z3={};function J1(T){var L=Z3[T];if(L!==void 0)return L.exports;var I=Z3[T]={exports:{}};return LL[T](I,I.exports,J1),I.exports}J1.d=(T,L)=>{for(var I in L)J1.o(L,I)&&!J1.o(T,I)&&Object.defineProperty(T,I,{enumerable:!0,get:L[I]})},J1.o=(T,L)=>Object.prototype.hasOwnProperty.call(T,L);var c={};J1.d(c,{MG:()=>a,fr:()=>c6,sR:()=>K4,Zo:()=>I1,iH:()=>w3,rt:()=>v0,jB:()=>X4,M8:()=>J4,$t:()=>e1,aq:()=>W4,pG:()=>P1,eP:()=>o6,KU:()=>W1,zW:()=>v6,IX:()=>x,mY:()=>H0,a7:()=>D1,JG:()=>t,ay:()=>n,X2:()=>t1,WU:()=>l6,Uw:()=>Z4,gw:()=>a1,iX:()=>i6,re:()=>U4,Pg:()=>r6,tD:()=>S4,R$:()=>Q0,Dj:()=>r0,m7:()=>_1,NZ:()=>j1,xo:()=>y0,ou:()=>M,qC:()=>l0,mD:()=>o0,Ay:()=>DL});class M{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 E1(T,L){if(!Array.isArray(T)||!Array.isArray(L))return!1;if(T===L)return!0;if(T.length!==L.length)return!1;for(let I=0;I<T.length;I++)if(!(T[I]===L[I]||T[I].equals&&T[I].equals(L[I])))return!1;return!0}M.INVALID_TYPE=0,M.EPSILON=-2,M.MIN_USER_TOKEN_TYPE=1,M.EOF=-1,M.DEFAULT_CHANNEL=0,M.HIDDEN_CHANNEL=1;var IL=Math.round(Math.random()*Math.pow(2,32));function X3(T){if(!T)return 0;let L=typeof T,I=L==="string"?T:!(L!=="object"||!T.toString)&&T.toString();if(!I)return 0;let _,R,$=3&I.length,G=I.length-$,Q=IL,U=3432918353,O=461845907,J=0;for(;J<G;)R=255&I.charCodeAt(J)|(255&I.charCodeAt(++J))<<8|(255&I.charCodeAt(++J))<<16|(255&I.charCodeAt(++J))<<24,++J,R=(65535&R)*U+(((R>>>16)*U&65535)<<16)&4294967295,R=R<<15|R>>>17,R=(65535&R)*O+(((R>>>16)*O&65535)<<16)&4294967295,Q^=R,Q=Q<<13|Q>>>19,_=5*(65535&Q)+((5*(Q>>>16)&65535)<<16)&4294967295,Q=27492+(65535&_)+((58964+(_>>>16)&65535)<<16);switch(R=0,$){case 3:R^=(255&I.charCodeAt(J+2))<<16;case 2:R^=(255&I.charCodeAt(J+1))<<8;case 1:R^=255&I.charCodeAt(J),R=(65535&R)*U+(((R>>>16)*U&65535)<<16)&4294967295,R=R<<15|R>>>17,R=(65535&R)*O+(((R>>>16)*O&65535)<<16)&4294967295,Q^=R}return Q^=I.length,Q^=Q>>>16,Q=2246822507*(65535&Q)+((2246822507*(Q>>>16)&65535)<<16)&4294967295,Q^=Q>>>13,Q=3266489909*(65535&Q)+((3266489909*(Q>>>16)&65535)<<16)&4294967295,Q^=Q>>>16,Q>>>0}class k0{constructor(){this.count=0,this.hash=0}update(){for(let T=0;T<arguments.length;T++){let L=arguments[T];if(L!=null)if(Array.isArray(L))this.update.apply(this,L);else{let I=0;switch(typeof L){case"undefined":case"function":continue;case"number":case"boolean":I=L;break;case"string":I=X3(L);break;default:L.updateHashCode?L.updateHashCode(this):console.log("No updateHashCode for "+L.toString());continue}I*=3432918353,I=I<<15|I>>>17,I*=461845907,this.count=this.count+1;let _=this.hash^I;_=_<<13|_>>>19,_=5*_+3864292196,this.hash=_}}}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(){let T=new k0;return T.update.apply(T,arguments),T.finish()}}function B3(T){return T?typeof T=="string"?X3(T):T.hashCode():-1}function z3(T,L){return T&&T.equals?T.equals(L):T===L}function _L(T){return T===null?"null":T}function o0(T){return Array.isArray(T)?"["+T.map(_L).join(", ")+"]":"null"}class z0{constructor(T,L){this.buckets=Array(16),this.threshold=Math.floor(12),this.itemCount=0,this.hashFunction=T||B3,this.equalsFunction=L||z3}get(T){if(T==null)return T;let L=this._getBucket(T);if(!L)return null;for(let I of L)if(this.equalsFunction(I,T))return I;return null}add(T){return this.getOrAdd(T)===T}getOrAdd(T){this._expand();let L=this._getSlot(T),I=this.buckets[L];if(!I)return I=[T],this.buckets[L]=I,this.itemCount++,T;for(let _ of I)if(this.equalsFunction(_,T))return _;return I.push(T),this.itemCount++,T}has(T){return this.get(T)!=null}values(){return this.buckets.filter((T)=>T!=null).flat(1)}toString(){return o0(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;let T=this.buckets,L=2*this.buckets.length;this.buckets=Array(L),this.threshold=Math.floor(0.75*L);for(let I of T)if(I)for(let _ of I){let R=this._getSlot(_),$=this.buckets[R];$||($=[],this.buckets[R]=$),$.push(_)}}}class o{hashCode(){let T=new k0;return this.updateHashCode(T),T.finish()}evaluate(T,L){}evalPrecedence(T,L){return this}static andContext(T,L){if(T===null||T===o.NONE)return L;if(L===null||L===o.NONE)return T;let I=new o1(T,L);return I.opnds.length===1?I.opnds[0]:I}static orContext(T,L){if(T===null)return L;if(L===null)return T;if(T===o.NONE||L===o.NONE)return o.NONE;let I=new v1(T,L);return I.opnds.length===1?I.opnds[0]:I}}class o1 extends o{constructor(T,L){super();let I=new z0;T instanceof o1?T.opnds.map(function(R){I.add(R)}):I.add(T),L instanceof o1?L.opnds.map(function(R){I.add(R)}):I.add(L);let _=H3(I);if(_.length>0){let R=null;_.map(function($){(R===null||$.precedence<R.precedence)&&(R=$)}),I.add(R)}this.opnds=Array.from(I.values())}equals(T){return this===T||T instanceof o1&&E1(this.opnds,T.opnds)}updateHashCode(T){T.update(this.opnds,"AND")}evaluate(T,L){for(let I=0;I<this.opnds.length;I++)if(!this.opnds[I].evaluate(T,L))return!1;return!0}evalPrecedence(T,L){let I=!1,_=[];for(let $=0;$<this.opnds.length;$++){let G=this.opnds[$],Q=G.evalPrecedence(T,L);if(I|=Q!==G,Q===null)return null;Q!==o.NONE&&_.push(Q)}if(!I)return this;if(_.length===0)return o.NONE;let R=null;return _.map(function($){R=R===null?$:o.andContext(R,$)}),R}toString(){let T=this.opnds.map((L)=>L.toString());return(T.length>3?T.slice(3):T).join("&&")}}class v1 extends o{constructor(T,L){super();let I=new z0;T instanceof v1?T.opnds.map(function(R){I.add(R)}):I.add(T),L instanceof v1?L.opnds.map(function(R){I.add(R)}):I.add(L);let _=H3(I);if(_.length>0){let R=_.sort(function(G,Q){return G.compareTo(Q)}),$=R[R.length-1];I.add($)}this.opnds=Array.from(I.values())}equals(T){return this===T||T instanceof v1&&E1(this.opnds,T.opnds)}updateHashCode(T){T.update(this.opnds,"OR")}evaluate(T,L){for(let I=0;I<this.opnds.length;I++)if(this.opnds[I].evaluate(T,L))return!0;return!1}evalPrecedence(T,L){let I=!1,_=[];for(let R=0;R<this.opnds.length;R++){let $=this.opnds[R],G=$.evalPrecedence(T,L);if(I|=G!==$,G===o.NONE)return o.NONE;G!==null&&_.push(G)}if(!I)return this;if(_.length===0)return null;return _.map(function(R){return R}),null}toString(){let T=this.opnds.map((L)=>L.toString());return(T.length>3?T.slice(3):T).join("||")}}function H3(T){let L=[];return T.values().map(function(I){I instanceof o.PrecedencePredicate&&L.push(I)}),L}function W3(T,L){if(T===null){let I={state:null,alt:null,context:null,semanticContext:null};return L&&(I.reachesIntoOuterContext=0),I}{let I={};return I.state=T.state||null,I.alt=T.alt===void 0?null:T.alt,I.context=T.context||null,I.semanticContext=T.semanticContext||null,L&&(I.reachesIntoOuterContext=T.reachesIntoOuterContext||0,I.precedenceFilterSuppressed=T.precedenceFilterSuppressed||!1),I}}class T0{constructor(T,L){this.checkContext(T,L),T=W3(T),L=W3(L,!0),this.state=T.state!==null?T.state:L.state,this.alt=T.alt!==null?T.alt:L.alt,this.context=T.context!==null?T.context:L.context,this.semanticContext=T.semanticContext!==null?T.semanticContext:L.semanticContext!==null?L.semanticContext:o.NONE,this.reachesIntoOuterContext=L.reachesIntoOuterContext,this.precedenceFilterSuppressed=L.precedenceFilterSuppressed}checkContext(T,L){T.context!==null&&T.context!==void 0||L!==null&&L.context!==null&&L.context!==void 0||(this.context=null)}hashCode(){let T=new k0;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 T0&&this.state.stateNumber===T.state.stateNumber&&this.alt===T.alt&&(this.context===null?T.context===null:this.context.equals(T.context))&&this.semanticContext.equals(T.semanticContext)&&this.precedenceFilterSuppressed===T.precedenceFilterSuppressed}hashCodeForConfigSet(){let T=new k0;return T.update(this.state.stateNumber,this.alt,this.semanticContext),T.finish()}equalsForConfigSet(T){return this===T||T instanceof T0&&this.state.stateNumber===T.state.stateNumber&&this.alt===T.alt&&this.semanticContext.equals(T.semanticContext)}toString(){return"("+this.state+","+this.alt+(this.context!==null?",["+this.context.toString()+"]":"")+(this.semanticContext!==o.NONE?","+this.semanticContext.toString():"")+(this.reachesIntoOuterContext>0?",up="+this.reachesIntoOuterContext:"")+")"}}class x{constructor(T,L){this.start=T,this.stop=L}clone(){return new x(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}}x.INVALID_INTERVAL=new x(-1,-2);class H0{constructor(){this.intervals=null,this.readOnly=!1}first(T){return this.intervals===null||this.intervals.length===0?M.INVALID_TYPE:this.intervals[0].start}addOne(T){this.addInterval(new x(T,T+1))}addRange(T,L){this.addInterval(new x(T,L+1))}addInterval(T){if(this.intervals===null)this.intervals=[],this.intervals.push(T.clone());else{for(let L=0;L<this.intervals.length;L++){let I=this.intervals[L];if(T.stop<I.start)return void this.intervals.splice(L,0,T);if(T.stop===I.start)return void(this.intervals[L]=new x(T.start,I.stop));if(T.start<=I.stop)return this.intervals[L]=new x(Math.min(I.start,T.start),Math.max(I.stop,T.stop)),void this.reduce(L)}this.intervals.push(T.clone())}}addSet(T){return T.intervals!==null&&T.intervals.forEach((L)=>this.addInterval(L),this),this}reduce(T){if(T<this.intervals.length-1){let L=this.intervals[T],I=this.intervals[T+1];L.stop>=I.stop?(this.intervals.splice(T+1,1),this.reduce(T)):L.stop>=I.start&&(this.intervals[T]=new x(L.start,I.stop),this.intervals.splice(T+1,1))}}complement(T,L){let I=new H0;return I.addInterval(new x(T,L+1)),this.intervals!==null&&this.intervals.forEach((_)=>I.removeRange(_)),I}contains(T){if(this.intervals===null)return!1;for(let L=0;L<this.intervals.length;L++)if(this.intervals[L].contains(T))return!0;return!1}removeRange(T){if(T.start===T.stop-1)this.removeOne(T.start);else if(this.intervals!==null){let L=0;for(let I=0;I<this.intervals.length;I++){let _=this.intervals[L];if(T.stop<=_.start)return;if(T.start>_.start&&T.stop<_.stop){this.intervals[L]=new x(_.start,T.start);let R=new x(T.stop,_.stop);return void this.intervals.splice(L,0,R)}T.start<=_.start&&T.stop>=_.stop?(this.intervals.splice(L,1),L-=1):T.start<_.stop?this.intervals[L]=new x(_.start,T.start):T.stop<_.stop&&(this.intervals[L]=new x(T.stop,_.stop)),L+=1}}}removeOne(T){if(this.intervals!==null)for(let L=0;L<this.intervals.length;L++){let I=this.intervals[L];if(T<I.start)return;if(T===I.start&&T===I.stop-1)return void this.intervals.splice(L,1);if(T===I.start)return void(this.intervals[L]=new x(I.start+1,I.stop));if(T===I.stop-1)return void(this.intervals[L]=new x(I.start,I.stop-1));if(T<I.stop-1){let _=new x(I.start,T);return I.start=T+1,void this.intervals.splice(L,0,_)}}}toString(T,L,I){return T=T||null,L=L||null,I=I||!1,this.intervals===null?"{}":T!==null||L!==null?this.toTokenString(T,L):I?this.toCharString():this.toIndexString()}toCharString(){let T=[];for(let L=0;L<this.intervals.length;L++){let I=this.intervals[L];I.stop===I.start+1?I.start===M.EOF?T.push("<EOF>"):T.push("'"+String.fromCharCode(I.start)+"'"):T.push("'"+String.fromCharCode(I.start)+"'..'"+String.fromCharCode(I.stop-1)+"'")}return T.length>1?"{"+T.join(", ")+"}":T[0]}toIndexString(){let T=[];for(let L=0;L<this.intervals.length;L++){let I=this.intervals[L];I.stop===I.start+1?I.start===M.EOF?T.push("<EOF>"):T.push(I.start.toString()):T.push(I.start.toString()+".."+(I.stop-1).toString())}return T.length>1?"{"+T.join(", ")+"}":T[0]}toTokenString(T,L){let I=[];for(let _=0;_<this.intervals.length;_++){let R=this.intervals[_];for(let $=R.start;$<R.stop;$++)I.push(this.elementName(T,L,$))}return I.length>1?"{"+I.join(", ")+"}":I[0]}elementName(T,L,I){return I===M.EOF?"<EOF>":I===M.EPSILON?"<EPSILON>":T[I]||L[I]}get length(){return this.intervals.map((T)=>T.length).reduce((T,L)=>T+L)}}class N{constructor(){this.atn=null,this.stateNumber=N.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 N&&this.stateNumber===T.stateNumber}isNonGreedyExitState(){return!1}addTransition(T,L){L===void 0&&(L=-1),this.transitions.length===0?this.epsilonOnlyTransitions=T.isEpsilon:this.epsilonOnlyTransitions!==T.isEpsilon&&(this.epsilonOnlyTransitions=!1),L===-1?this.transitions.push(T):this.transitions.splice(L,1,T)}}N.INVALID_TYPE=0,N.BASIC=1,N.RULE_START=2,N.BLOCK_START=3,N.PLUS_BLOCK_START=4,N.STAR_BLOCK_START=5,N.TOKEN_START=6,N.RULE_STOP=7,N.BLOCK_END=8,N.STAR_LOOP_BACK=9,N.STAR_LOOP_ENTRY=10,N.PLUS_LOOP_BACK=11,N.LOOP_END=12,N.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"],N.INVALID_STATE_NUMBER=-1;class Z0 extends N{constructor(){return super(),this.stateType=N.RULE_STOP,this}}class P{constructor(T){if(T==null)throw"target cannot be null.";this.target=T,this.isEpsilon=!1,this.label=null}}P.EPSILON=1,P.RANGE=2,P.RULE=3,P.PREDICATE=4,P.ATOM=5,P.ACTION=6,P.SET=7,P.NOT_SET=8,P.WILDCARD=9,P.PRECEDENCE=10,P.serializationNames=["INVALID","EPSILON","RANGE","RULE","PREDICATE","ATOM","ACTION","SET","NOT_SET","WILDCARD","PRECEDENCE"],P.serializationTypes={EpsilonTransition:P.EPSILON,RangeTransition:P.RANGE,RuleTransition:P.RULE,PredicateTransition:P.PREDICATE,AtomTransition:P.ATOM,ActionTransition:P.ACTION,SetTransition:P.SET,NotSetTransition:P.NOT_SET,WildcardTransition:P.WILDCARD,PrecedencePredicateTransition:P.PRECEDENCE};class r1 extends P{constructor(T,L,I,_){super(T),this.ruleIndex=L,this.precedence=I,this.followState=_,this.serializationType=P.RULE,this.isEpsilon=!0}matches(T,L,I){return!1}}class u6 extends P{constructor(T,L){super(T),this.serializationType=P.SET,L!=null?this.label=L:(this.label=new H0,this.label.addOne(M.INVALID_TYPE))}matches(T,L,I){return this.label.contains(T)}toString(){return this.label.toString()}}class g6 extends u6{constructor(T,L){super(T,L),this.serializationType=P.NOT_SET}matches(T,L,I){return T>=L&&T<=I&&!super.matches(T,L,I)}toString(){return"~"+super.toString()}}class n2 extends P{constructor(T){super(T),this.serializationType=P.WILDCARD}matches(T,L,I){return T>=L&&T<=I}toString(){return"."}}class f6 extends P{constructor(T){super(T)}}class V3{}class F3 extends V3{}class t2 extends F3{}class j1 extends t2{get ruleContext(){throw Error("missing interface implementation")}}class y0 extends t2{}class n1 extends y0{}var d0={toStringTree:function(T,L,I){L=L||null,(I=I||null)!==null&&(L=I.ruleNames);let _=d0.getNodeText(T,L);_=function(G){return G=G.replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r")}(_);let R=T.getChildCount();if(R===0)return _;let $="("+_+" ";R>0&&(_=d0.toStringTree(T.getChild(0),L),$=$.concat(_));for(let G=1;G<R;G++)_=d0.toStringTree(T.getChild(G),L),$=$.concat(" "+_);return $=$.concat(")"),$},getNodeText:function(T,L,I){if(L=L||null,(I=I||null)!==null&&(L=I.ruleNames),L!==null){if(T instanceof j1){let R=T.ruleContext.getAltNumber();return R!=0?L[T.ruleIndex]+":"+R:L[T.ruleIndex]}if(T instanceof n1)return T.toString();if(T instanceof y0&&T.symbol!==null)return T.symbol.text}let _=T.getPayload();return _ instanceof M?_.text:T.getPayload().toString()},getChildren:function(T){let L=[];for(let I=0;I<T.getChildCount();I++)L.push(T.getChild(I));return L},getAncestors:function(T){let L=[];for(T=T.getParent();T!==null;)L=[T].concat(L),T=T.getParent();return L},findAllTokenNodes:function(T,L){return d0.findAllNodes(T,L,!0)},findAllRuleNodes:function(T,L){return d0.findAllNodes(T,L,!1)},findAllNodes:function(T,L,I){let _=[];return d0._findAllNodes(T,L,I,_),_},_findAllNodes:function(T,L,I,_){I&&T instanceof y0?T.symbol.type===L&&_.push(T):!I&&T instanceof j1&&T.ruleIndex===L&&_.push(T);for(let R=0;R<T.getChildCount();R++)d0._findAllNodes(T.getChild(R),L,I,_)},descendants:function(T){let L=[T];for(let I=0;I<T.getChildCount();I++)L=L.concat(d0.descendants(T.getChild(I)));return L}},q3=d0;class _1 extends j1{constructor(T,L){super(),this.parentCtx=T||null,this.invokingState=L||-1}depth(){let T=0,L=this;for(;L!==null;)L=L.parentCtx,T+=1;return T}isEmpty(){return this.invokingState===-1}getSourceInterval(){return x.INVALID_INTERVAL}get ruleContext(){return this}getPayload(){return this}getText(){return this.getChildCount()===0?"":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,L){return q3.toStringTree(this,T,L)}toString(T,L){T=T||null,L=L||null;let I=this,_="[";for(;I!==null&&I!==L;){if(T===null)I.isEmpty()||(_+=I.invokingState);else{let R=I.ruleIndex;_+=R>=0&&R<T.length?T[R]:""+R}I.parentCtx===null||T===null&&I.parentCtx.isEmpty()||(_+=" "),I=I.parentCtx}return _+="]",_}}class A{constructor(T){this.cachedHashCode=T}isEmpty(){return this===A.EMPTY}hasEmptyPath(){return this.getReturnState(this.length-1)===A.EMPTY_RETURN_STATE}hashCode(){return this.cachedHashCode}updateHashCode(T){T.update(this.cachedHashCode)}}A.EMPTY=null,A.EMPTY_RETURN_STATE=2147483647,A.globalNodeCount=1,A.id=A.globalNodeCount,A.trace_atn_sim=!1;class f0 extends A{constructor(T,L){let I=new k0;return I.update(T,L),super(I.finish()),this.parents=T,this.returnStates=L,this}isEmpty(){return this.returnStates[0]===A.EMPTY_RETURN_STATE}getParent(T){return this.parents[T]}getReturnState(T){return this.returnStates[T]}equals(T){return this===T||T instanceof f0&&this.hashCode()===T.hashCode()&&E1(this.returnStates,T.returnStates)&&E1(this.parents,T.parents)}toString(){if(this.isEmpty())return"[]";{let T="[";for(let L=0;L<this.returnStates.length;L++)L>0&&(T+=", "),this.returnStates[L]!==A.EMPTY_RETURN_STATE?(T+=this.returnStates[L],this.parents[L]!==null?T=T+" "+this.parents[L]:T+="null"):T+="$";return T+"]"}}get length(){return this.returnStates.length}}class D0 extends A{constructor(T,L){let I=0,_=new k0;T!==null?_.update(T,L):_.update(1),I=_.finish(),super(I),this.parentCtx=T,this.returnState=L}getParent(T){return this.parentCtx}getReturnState(T){return this.returnState}equals(T){return this===T||T instanceof D0&&this.hashCode()===T.hashCode()&&this.returnState===T.returnState&&(this.parentCtx==null?T.parentCtx==null:this.parentCtx.equals(T.parentCtx))}toString(){let T=this.parentCtx===null?"":this.parentCtx.toString();return T.length===0?this.returnState===A.EMPTY_RETURN_STATE?"$":""+this.returnState:this.returnState+" "+T}get length(){return 1}static create(T,L){return L===A.EMPTY_RETURN_STATE&&T===null?A.EMPTY:new D0(T,L)}}class P6 extends D0{constructor(){super(null,A.EMPTY_RETURN_STATE)}isEmpty(){return!0}getParent(T){return null}getReturnState(T){return this.returnState}equals(T){return this===T}toString(){return"$"}}A.EMPTY=new P6;class C1{constructor(T,L){this.buckets=Array(16),this.threshold=Math.floor(12),this.itemCount=0,this.hashFunction=T||B3,this.equalsFunction=L||z3}set(T,L){this._expand();let I=this._getSlot(T),_=this.buckets[I];if(!_)return _=[[T,L]],this.buckets[I]=_,this.itemCount++,L;let R=_.find(($)=>this.equalsFunction($[0],T),this);if(R){let $=R[1];return R[1]=L,$}return _.push([T,L]),this.itemCount++,L}containsKey(T){let L=this._getBucket(T);return!!L&&!!L.find((I)=>this.equalsFunction(I[0],T),this)}get(T){let L=this._getBucket(T);if(!L)return null;let I=L.find((_)=>this.equalsFunction(_[0],T),this);return I?I[1]:null}entries(){return this.buckets.filter((T)=>T!=null).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;let T=this.buckets,L=2*this.buckets.length;this.buckets=Array(L),this.threshold=Math.floor(0.75*L);for(let I of T)if(I)for(let _ of I){let R=this._getSlot(_[0]),$=this.buckets[R];$||($=[],this.buckets[R]=$),$.push(_)}}}function e2(T,L){if(L==null&&(L=_1.EMPTY),L.parentCtx===null||L===_1.EMPTY)return A.EMPTY;let I=e2(T,L.parentCtx),_=T.states[L.invokingState].transitions[0];return D0.create(I,_.followState.stateNumber)}function k3(T,L,I){if(T.isEmpty())return T;let _=I.get(T)||null;if(_!==null)return _;if(_=L.get(T),_!==null)return I.set(T,_),_;let R=!1,$=[];for(let Q=0;Q<$.length;Q++){let U=k3(T.getParent(Q),L,I);if(R||U!==T.getParent(Q)){if(!R){$=[];for(let O=0;O<T.length;O++)$[O]=T.getParent(O);R=!0}$[Q]=U}}if(!R)return L.add(T),I.set(T,T),T;let G=null;return G=$.length===0?A.EMPTY:$.length===1?D0.create($[0],T.getReturnState(0)):new f0($,T.returnStates),L.add(G),I.set(G,G),I.set(T,G),G}function m2(T,L,I,_){if(T===L)return T;if(T instanceof D0&&L instanceof D0)return function(R,$,G,Q){if(Q!==null){let O=Q.get(R,$);if(O!==null)return O;if(O=Q.get($,R),O!==null)return O}let U=function(O,J,D){if(D){if(O===A.EMPTY)return A.EMPTY;if(J===A.EMPTY)return A.EMPTY}else{if(O===A.EMPTY&&J===A.EMPTY)return A.EMPTY;if(O===A.EMPTY){let B=[J.returnState,A.EMPTY_RETURN_STATE],H=[J.parentCtx,null];return new f0(H,B)}if(J===A.EMPTY){let B=[O.returnState,A.EMPTY_RETURN_STATE],H=[O.parentCtx,null];return new f0(H,B)}}return null}(R,$,G);if(U!==null)return Q!==null&&Q.set(R,$,U),U;if(R.returnState===$.returnState){let O=m2(R.parentCtx,$.parentCtx,G,Q);if(O===R.parentCtx)return R;if(O===$.parentCtx)return $;let J=D0.create(O,R.returnState);return Q!==null&&Q.set(R,$,J),J}{let O=null;if((R===$||R.parentCtx!==null&&R.parentCtx===$.parentCtx)&&(O=R.parentCtx),O!==null){let H=[R.returnState,$.returnState];R.returnState>$.returnState&&(H[0]=$.returnState,H[1]=R.returnState);let z=new f0([O,O],H);return Q!==null&&Q.set(R,$,z),z}let J=[R.returnState,$.returnState],D=[R.parentCtx,$.parentCtx];R.returnState>$.returnState&&(J[0]=$.returnState,J[1]=R.returnState,D=[$.parentCtx,R.parentCtx]);let B=new f0(D,J);return Q!==null&&Q.set(R,$,B),B}}(T,L,I,_);if(I){if(T instanceof P6)return T;if(L instanceof P6)return L}return T instanceof D0&&(T=new f0([T.getParent()],[T.returnState])),L instanceof D0&&(L=new f0([L.getParent()],[L.returnState])),function(R,$,G,Q){if(Q!==null){let z=Q.get(R,$);if(z!==null)return A.trace_atn_sim&&console.log("mergeArrays a="+R+",b="+$+" -> previous"),z;if(z=Q.get($,R),z!==null)return A.trace_atn_sim&&console.log("mergeArrays a="+R+",b="+$+" -> previous"),z}let U=0,O=0,J=0,D=Array(R.returnStates.length+$.returnStates.length).fill(0),B=Array(R.returnStates.length+$.returnStates.length).fill(null);for(;U<R.returnStates.length&&O<$.returnStates.length;){let z=R.parents[U],X=$.parents[O];if(R.returnStates[U]===$.returnStates[O]){let k=R.returnStates[U];k===A.EMPTY_RETURN_STATE&&z===null&&X===null||z!==null&&X!==null&&z===X?(B[J]=z,D[J]=k):(B[J]=m2(z,X,G,Q),D[J]=k),U+=1,O+=1}else R.returnStates[U]<$.returnStates[O]?(B[J]=z,D[J]=R.returnStates[U],U+=1):(B[J]=X,D[J]=$.returnStates[O],O+=1);J+=1}if(U<R.returnStates.length)for(let z=U;z<R.returnStates.length;z++)B[J]=R.parents[z],D[J]=R.returnStates[z],J+=1;else for(let z=O;z<$.returnStates.length;z++)B[J]=$.parents[z],D[J]=$.returnStates[z],J+=1;if(J<B.length){if(J===1){let z=D0.create(B[0],D[0]);return Q!==null&&Q.set(R,$,z),z}B=B.slice(0,J),D=D.slice(0,J)}let H=new f0(B,D);return H.equals(R)?(Q!==null&&Q.set(R,$,R),A.trace_atn_sim&&console.log("mergeArrays a="+R+",b="+$+" -> a"),R):H.equals($)?(Q!==null&&Q.set(R,$,$),A.trace_atn_sim&&console.log("mergeArrays a="+R+",b="+$+" -> b"),$):(function(z){let X=new C1;for(let k=0;k<z.length;k++){let C=z[k];X.containsKey(C)||X.set(C,C)}for(let k=0;k<z.length;k++)z[k]=X.get(z[k])}(B),Q!==null&&Q.set(R,$,H),A.trace_atn_sim&&console.log("mergeArrays a="+R+",b="+$+" -> "+H),H)}(T,L,I,_)}class K0{constructor(){this.data=new Uint32Array(1)}set(T){K0._checkIndex(T),this._resize(T),this.data[T>>>5]|=1<<T%32}get(T){K0._checkIndex(T);let L=T>>>5;return!(L>=this.data.length||!(this.data[L]&1<<T%32))}clear(T){K0._checkIndex(T);let L=T>>>5;L<this.data.length&&(this.data[L]&=~(1<<T))}or(T){let L=Math.min(this.data.length,T.data.length);for(let I=0;I<L;++I)this.data[I]|=T.data[I];if(this.data.length<T.data.length){this._resize((T.data.length<<5)-1);let I=T.data.length;for(let _=L;_<I;++_)this.data[_]=T.data[_]}}values(){let T=Array(this.length),L=0,I=this.data.length;for(let _=0;_<I;++_){let R=this.data[_];for(;R!==0;){let $=R&-R;T[L++]=(_<<5)+K0._bitCount($-1),R^=$}}return T}minValue(){for(let T=0;T<this.data.length;++T){let L=this.data[T];if(L!==0){let I=0;for(;!(1&L);)I++,L>>=1;return I+32*T}}return 0}hashCode(){return k0.hashStuff(this.values())}equals(T){return T instanceof K0&&E1(this.data,T.data)}toString(){return"{"+this.values().join(", ")+"}"}get length(){return this.data.map((T)=>K0._bitCount(T)).reduce((T,L)=>T+L,0)}_resize(T){let L=T+32>>>5;if(L<=this.data.length)return;let I=new Uint32Array(L);I.set(this.data),I.fill(0,this.data.length),this.data=I}static _checkIndex(T){if(T<0)throw 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 D1{constructor(T){this.atn=T}getDecisionLookahead(T){if(T===null)return null;let L=T.transitions.length,I=[];for(let _=0;_<L;_++){I[_]=new H0;let R=new z0,$=!1;this._LOOK(T.transition(_).target,null,A.EMPTY,I[_],R,new K0,$,!1),(I[_].length===0||I[_].contains(D1.HIT_PRED))&&(I[_]=null)}return I}LOOK(T,L,I){let _=new H0,R=(I=I||null)!==null?e2(T.atn,I):null;return this._LOOK(T,L,R,_,new z0,new K0,!0,!0),_}_LOOK(T,L,I,_,R,$,G,Q){let U=new T0({state:T,alt:0,context:I},null);if(!R.has(U)){if(R.add(U),T===L){if(I===null)return void _.addOne(M.EPSILON);if(I.isEmpty()&&Q)return void _.addOne(M.EOF)}if(T instanceof Z0){if(I===null)return void _.addOne(M.EPSILON);if(I.isEmpty()&&Q)return void _.addOne(M.EOF);if(I!==A.EMPTY){let O=$.get(T.ruleIndex);try{$.clear(T.ruleIndex);for(let J=0;J<I.length;J++){let D=this.atn.states[I.getReturnState(J)];this._LOOK(D,L,I.getParent(J),_,R,$,G,Q)}}finally{O&&$.set(T.ruleIndex)}return}}for(let O=0;O<T.transitions.length;O++){let J=T.transitions[O];if(J.constructor===r1){if($.get(J.target.ruleIndex))continue;let D=D0.create(I,J.followState.stateNumber);try{$.set(J.target.ruleIndex),this._LOOK(J.target,L,D,_,R,$,G,Q)}finally{$.clear(J.target.ruleIndex)}}else if(J instanceof f6)G?this._LOOK(J.target,L,I,_,R,$,G,Q):_.addOne(D1.HIT_PRED);else if(J.isEpsilon)this._LOOK(J.target,L,I,_,R,$,G,Q);else if(J.constructor===n2)_.addRange(M.MIN_USER_TOKEN_TYPE,this.atn.maxTokenType);else{let D=J.label;D!==null&&(J instanceof g6&&(D=D.complement(M.MIN_USER_TOKEN_TYPE,this.atn.maxTokenType)),_.addSet(D))}}}}}D1.HIT_PRED=M.INVALID_TYPE;class a{constructor(T,L){this.grammarType=T,this.maxTokenType=L,this.states=[],this.decisionToState=[],this.ruleToStartState=[],this.ruleToStopState=null,this.modeNameToStartState={},this.ruleToTokenType=null,this.lexerActions=null,this.modeToStartState=[]}nextTokensInContext(T,L){return new D1(this).LOOK(T,null,L)}nextTokensNoContext(T){return T.nextTokenWithinRule!==null||(T.nextTokenWithinRule=this.nextTokensInContext(T,null),T.nextTokenWithinRule.readOnly=!0),T.nextTokenWithinRule}nextTokens(T,L){return L===void 0?this.nextTokensNoContext(T):this.nextTokensInContext(T,L)}addState(T){T!==null&&(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 this.decisionToState.length===0?null:this.decisionToState[T]}getExpectedTokens(T,L){if(T<0||T>=this.states.length)throw"Invalid state number.";let I=this.states[T],_=this.nextTokens(I);if(!_.contains(M.EPSILON))return _;let R=new H0;for(R.addSet(_),R.removeOne(M.EPSILON);L!==null&&L.invokingState>=0&&_.contains(M.EPSILON);){let $=this.states[L.invokingState].transitions[0];_=this.nextTokens($.followState),R.addSet(_),R.removeOne(M.EPSILON),L=L.parentCtx}return _.contains(M.EPSILON)&&R.addOne(M.EOF),R}}a.INVALID_ALT_NUMBER=0;class d2 extends N{constructor(){super(),this.stateType=N.BASIC}}class K1 extends N{constructor(){return super(),this.decision=-1,this.nonGreedy=!1,this}}class Z1 extends K1{constructor(){return super(),this.endState=null,this}}class M6 extends N{constructor(){return super(),this.stateType=N.BLOCK_END,this.startState=null,this}}class S1 extends N{constructor(){return super(),this.stateType=N.LOOP_END,this.loopBackState=null,this}}class l2 extends N{constructor(){return super(),this.stateType=N.RULE_START,this.stopState=null,this.isPrecedenceRule=!1,this}}class M3 extends K1{constructor(){return super(),this.stateType=N.TOKEN_START,this}}class o2 extends K1{constructor(){return super(),this.stateType=N.PLUS_LOOP_BACK,this}}class E6 extends N{constructor(){return super(),this.stateType=N.STAR_LOOP_BACK,this}}class L1 extends K1{constructor(){return super(),this.stateType=N.STAR_LOOP_ENTRY,this.loopBackState=null,this.isPrecedenceDecision=null,this}}class j6 extends Z1{constructor(){return super(),this.stateType=N.PLUS_BLOCK_START,this.loopBackState=null,this}}class C6 extends Z1{constructor(){return super(),this.stateType=N.STAR_BLOCK_START,this}}class v2 extends Z1{constructor(){return super(),this.stateType=N.BLOCK_START,this}}class N6 extends P{constructor(T,L){super(T),this.label_=L,this.label=this.makeLabel(),this.serializationType=P.ATOM}makeLabel(){let T=new H0;return T.addOne(this.label_),T}matches(T,L,I){return this.label_===T}toString(){return this.label_}}class E3 extends P{constructor(T,L,I){super(T),this.serializationType=P.RANGE,this.start=L,this.stop=I,this.label=this.makeLabel()}makeLabel(){let T=new H0;return T.addRange(this.start,this.stop),T}matches(T,L,I){return T>=this.start&&T<=this.stop}toString(){return"'"+String.fromCharCode(this.start)+"'..'"+String.fromCharCode(this.stop)+"'"}}class T4 extends P{constructor(T,L,I,_){super(T),this.serializationType=P.ACTION,this.ruleIndex=L,this.actionIndex=I===void 0?-1:I,this.isCtxDependent=_!==void 0&&_,this.isEpsilon=!0}matches(T,L,I){return!1}toString(){return"action_"+this.ruleIndex+":"+this.actionIndex}}class q1 extends P{constructor(T,L){super(T),this.serializationType=P.EPSILON,this.isEpsilon=!0,this.outermostPrecedenceReturn=L}matches(T,L,I){return!1}toString(){return"epsilon"}}class p6 extends o{constructor(T,L,I){super(),this.ruleIndex=T===void 0?-1:T,this.predIndex=L===void 0?-1:L,this.isCtxDependent=I!==void 0&&I}evaluate(T,L){let I=this.isCtxDependent?L: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 p6&&this.ruleIndex===T.ruleIndex&&this.predIndex===T.predIndex&&this.isCtxDependent===T.isCtxDependent}toString(){return"{"+this.ruleIndex+":"+this.predIndex+"}?"}}o.NONE=new p6;class L4 extends f6{constructor(T,L,I,_){super(T),this.serializationType=P.PREDICATE,this.ruleIndex=L,this.predIndex=I,this.isCtxDependent=_,this.isEpsilon=!0}matches(T,L,I){return!1}getPredicate(){return new p6(this.ruleIndex,this.predIndex,this.isCtxDependent)}toString(){return"pred_"+this.ruleIndex+":"+this.predIndex}}class x6 extends o{constructor(T){super(),this.precedence=T===void 0?0:T}evaluate(T,L){return T.precpred(L,this.precedence)}evalPrecedence(T,L){return T.precpred(L,this.precedence)?o.NONE:null}compareTo(T){return this.precedence-T.precedence}updateHashCode(T){T.update(this.precedence)}equals(T){return this===T||T instanceof x6&&this.precedence===T.precedence}toString(){return"{"+this.precedence+">=prec}?"}}o.PrecedencePredicate=x6;class j3 extends f6{constructor(T,L){super(T),this.serializationType=P.PRECEDENCE,this.precedence=L,this.isEpsilon=!0}matches(T,L,I){return!1}getPredicate(){return new x6(this.precedence)}toString(){return this.precedence+" >= _p"}}class M1{constructor(T){T===void 0&&(T=null),this.readOnly=!1,this.verifyATN=T===null||T.verifyATN,this.generateRuleBypassTransitions=T!==null&&T.generateRuleBypassTransitions}}M1.defaultOptions=new M1,M1.defaultOptions.readOnly=!0;class p0{constructor(T){this.actionType=T,this.isPositionDependent=!1}hashCode(){let T=new k0;return this.updateHashCode(T),T.finish()}updateHashCode(T){T.update(this.actionType)}equals(T){return this===T}}class y6 extends p0{constructor(){super(6)}execute(T){T.skip()}toString(){return"skip"}}y6.INSTANCE=new y6;class I4 extends p0{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 I4&&this.channel===T.channel}toString(){return"channel("+this.channel+")"}}class _4 extends p0{constructor(T,L){super(1),this.ruleIndex=T,this.actionIndex=L,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 _4&&this.ruleIndex===T.ruleIndex&&this.actionIndex===T.actionIndex}}class b6 extends p0{constructor(){super(3)}execute(T){T.more()}toString(){return"more"}}b6.INSTANCE=new b6;class R4 extends p0{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 R4&&this.type===T.type}toString(){return"type("+this.type+")"}}class $4 extends p0{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 $4&&this.mode===T.mode}toString(){return"pushMode("+this.mode+")"}}class h6 extends p0{constructor(){super(4)}execute(T){T.popMode()}toString(){return"popMode"}}h6.INSTANCE=new h6;class G4 extends p0{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 G4&&this.mode===T.mode}toString(){return"mode("+this.mode+")"}}function k6(T,L){let I=[];return I[T-1]=L,I.map(function(_){return L})}class c6{constructor(T){T==null&&(T=M1.defaultOptions),this.deserializationOptions=T,this.stateFactories=null,this.actionFactories=null}deserialize(T){let L=this.reset(T);this.checkVersion(L),L&&this.skipUUID();let I=this.readATN();this.readStates(I,L),this.readRules(I,L),this.readModes(I);let _=[];return this.readSets(I,_,this.readInt.bind(this)),L&&this.readSets(I,_,this.readInt32.bind(this)),this.readEdges(I,_),this.readDecisions(I),this.readLexerActions(I,L),this.markPrecedenceDecisions(I),this.verifyATN(I),this.deserializationOptions.generateRuleBypassTransitions&&I.grammarType===1&&(this.generateRuleBypassTransitions(I),this.verifyATN(I)),I}reset(T){if((T.charCodeAt?T.charCodeAt(0):T[0])===3){let L=function(_){let R=_.charCodeAt(0);return R>1?R-2:R+65534},I=T.split("").map(L);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){let L=this.readInt();if(!T&&L!==4)throw"Could not deserialize ATN with version "+L+" (expected 4)."}readATN(){let T=this.readInt(),L=this.readInt();return new a(T,L)}readStates(T,L){let I,_,R,$=[],G=[],Q=this.readInt();for(let J=0;J<Q;J++){let D=this.readInt();if(D===N.INVALID_TYPE){T.addState(null);continue}let B=this.readInt();L&&B===65535&&(B=-1);let H=this.stateFactory(D,B);if(D===N.LOOP_END){let z=this.readInt();$.push([H,z])}else if(H instanceof Z1){let z=this.readInt();G.push([H,z])}T.addState(H)}for(I=0;I<$.length;I++)_=$[I],_[0].loopBackState=T.states[_[1]];for(I=0;I<G.length;I++)_=G[I],_[0].endState=T.states[_[1]];let U=this.readInt();for(I=0;I<U;I++)R=this.readInt(),T.states[R].nonGreedy=!0;let O=this.readInt();for(I=0;I<O;I++)R=this.readInt(),T.states[R].isPrecedenceRule=!0}readRules(T,L){let I,_=this.readInt();for(T.grammarType===0&&(T.ruleToTokenType=k6(_,0)),T.ruleToStartState=k6(_,0),I=0;I<_;I++){let R=this.readInt();if(T.ruleToStartState[I]=T.states[R],T.grammarType===0){let $=this.readInt();L&&$===65535&&($=M.EOF),T.ruleToTokenType[I]=$}}for(T.ruleToStopState=k6(_,0),I=0;I<T.states.length;I++){let R=T.states[I];R instanceof Z0&&(T.ruleToStopState[R.ruleIndex]=R,T.ruleToStartState[R.ruleIndex].stopState=R)}}readModes(T){let L=this.readInt();for(let I=0;I<L;I++){let _=this.readInt();T.modeToStartState.push(T.states[_])}}readSets(T,L,I){let _=this.readInt();for(let R=0;R<_;R++){let $=new H0;L.push($);let G=this.readInt();this.readInt()!==0&&$.addOne(-1);for(let Q=0;Q<G;Q++){let U=I(),O=I();$.addRange(U,O)}}}readEdges(T,L){let I,_,R,$,G,Q=this.readInt();for(I=0;I<Q;I++){let U=this.readInt(),O=this.readInt(),J=this.readInt(),D=this.readInt(),B=this.readInt(),H=this.readInt();$=this.edgeFactory(T,J,U,O,D,B,H,L),T.states[U].addTransition($)}for(I=0;I<T.states.length;I++)for(R=T.states[I],_=0;_<R.transitions.length;_++){let U=R.transitions[_];if(!(U instanceof r1))continue;let O=-1;T.ruleToStartState[U.target.ruleIndex].isPrecedenceRule&&U.precedence===0&&(O=U.target.ruleIndex),$=new q1(U.followState,O),T.ruleToStopState[U.target.ruleIndex].addTransition($)}for(I=0;I<T.states.length;I++){if(R=T.states[I],R instanceof Z1){if(R.endState===null)throw"IllegalState";if(R.endState.startState!==null)throw"IllegalState";R.endState.startState=R}if(R instanceof o2)for(_=0;_<R.transitions.length;_++)G=R.transitions[_].target,G instanceof j6&&(G.loopBackState=R);else if(R instanceof E6)for(_=0;_<R.transitions.length;_++)G=R.transitions[_].target,G instanceof L1&&(G.loopBackState=R)}}readDecisions(T){let L=this.readInt();for(let I=0;I<L;I++){let _=this.readInt(),R=T.states[_];T.decisionToState.push(R),R.decision=I}}readLexerActions(T,L){if(T.grammarType===0){let I=this.readInt();T.lexerActions=k6(I,null);for(let _=0;_<I;_++){let R=this.readInt(),$=this.readInt();L&&$===65535&&($=-1);let G=this.readInt();L&&G===65535&&(G=-1),T.lexerActions[_]=this.lexerActionFactory(R,$,G)}}}generateRuleBypassTransitions(T){let L,I=T.ruleToStartState.length;for(L=0;L<I;L++)T.ruleToTokenType[L]=T.maxTokenType+L+1;for(L=0;L<I;L++)this.generateRuleBypassTransition(T,L)}generateRuleBypassTransition(T,L){let I,_,R=new v2;R.ruleIndex=L,T.addState(R);let $=new M6;$.ruleIndex=L,T.addState($),R.endState=$,T.defineDecisionState(R),$.startState=R;let G=null,Q=null;if(T.ruleToStartState[L].isPrecedenceRule){for(Q=null,I=0;I<T.states.length;I++)if(_=T.states[I],this.stateIsEndStateFor(_,L)){Q=_,G=_.loopBackState.transitions[0];break}if(G===null)throw"Couldn't identify final state of the precedence rule prefix section."}else Q=T.ruleToStopState[L];for(I=0;I<T.states.length;I++){_=T.states[I];for(let D=0;D<_.transitions.length;D++){let B=_.transitions[D];B!==G&&B.target===Q&&(B.target=$)}}let U=T.ruleToStartState[L],O=U.transitions.length;for(;O>0;)R.addTransition(U.transitions[O-1]),U.transitions=U.transitions.slice(-1);T.ruleToStartState[L].addTransition(new q1(R)),$.addTransition(new q1(Q));let J=new d2;T.addState(J),J.addTransition(new N6($,T.ruleToTokenType[L])),R.addTransition(new q1(J))}stateIsEndStateFor(T,L){if(T.ruleIndex!==L)return null;if(!(T instanceof L1))return null;let I=T.transitions[T.transitions.length-1].target;return I instanceof S1&&I.epsilonOnlyTransitions&&I.transitions[0].target instanceof Z0?T:null}markPrecedenceDecisions(T){for(let L=0;L<T.states.length;L++){let I=T.states[L];if(I instanceof L1&&T.ruleToStartState[I.ruleIndex].isPrecedenceRule){let _=I.transitions[I.transitions.length-1].target;_ instanceof S1&&_.epsilonOnlyTransitions&&_.transitions[0].target instanceof Z0&&(I.isPrecedenceDecision=!0)}}}verifyATN(T){if(this.deserializationOptions.verifyATN)for(let L=0;L<T.states.length;L++){let I=T.states[L];if(I!==null)if(this.checkCondition(I.epsilonOnlyTransitions||I.transitions.length<=1),I instanceof j6)this.checkCondition(I.loopBackState!==null);else if(I instanceof L1)if(this.checkCondition(I.loopBackState!==null),this.checkCondition(I.transitions.length===2),I.transitions[0].target instanceof C6)this.checkCondition(I.transitions[1].target instanceof S1),this.checkCondition(!I.nonGreedy);else{if(!(I.transitions[0].target instanceof S1))throw"IllegalState";this.checkCondition(I.transitions[1].target instanceof C6),this.checkCondition(I.nonGreedy)}else I instanceof E6?(this.checkCondition(I.transitions.length===1),this.checkCondition(I.transitions[0].target instanceof L1)):I instanceof S1?this.checkCondition(I.loopBackState!==null):I instanceof l2?this.checkCondition(I.stopState!==null):I instanceof Z1?this.checkCondition(I.endState!==null):I instanceof M6?this.checkCondition(I.startState!==null):I instanceof K1?this.checkCondition(I.transitions.length<=1||I.decision>=0):this.checkCondition(I.transitions.length<=1||I instanceof Z0)}}checkCondition(T,L){if(!T)throw L==null&&(L="IllegalState"),L}readInt(){return this.data[this.pos++]}readInt32(){return this.readInt()|this.readInt()<<16}edgeFactory(T,L,I,_,R,$,G,Q){let U=T.states[_];switch(L){case P.EPSILON:return new q1(U);case P.RANGE:return new E3(U,G!==0?M.EOF:R,$);case P.RULE:return new r1(T.states[R],$,G,U);case P.PREDICATE:return new L4(U,R,$,G!==0);case P.PRECEDENCE:return new j3(U,R);case P.ATOM:return new N6(U,G!==0?M.EOF:R);case P.ACTION:return new T4(U,R,$,G!==0);case P.SET:return new u6(U,Q[R]);case P.NOT_SET:return new g6(U,Q[R]);case P.WILDCARD:return new n2(U);default:throw"The specified transition type: "+L+" is not valid."}}stateFactory(T,L){if(this.stateFactories===null){let I=[];I[N.INVALID_TYPE]=null,I[N.BASIC]=()=>new d2,I[N.RULE_START]=()=>new l2,I[N.BLOCK_START]=()=>new v2,I[N.PLUS_BLOCK_START]=()=>new j6,I[N.STAR_BLOCK_START]=()=>new C6,I[N.TOKEN_START]=()=>new M3,I[N.RULE_STOP]=()=>new Z0,I[N.BLOCK_END]=()=>new M6,I[N.STAR_LOOP_BACK]=()=>new E6,I[N.STAR_LOOP_ENTRY]=()=>new L1,I[N.PLUS_LOOP_BACK]=()=>new o2,I[N.LOOP_END]=()=>new S1,this.stateFactories=I}if(T>this.stateFactories.length||this.stateFactories[T]===null)throw"The specified state type "+T+" is not valid.";{let I=this.stateFactories[T]();if(I!==null)return I.ruleIndex=L,I}}lexerActionFactory(T,L,I){if(this.actionFactories===null){let _=[];_[0]=(R,$)=>new I4(R),_[1]=(R,$)=>new _4(R,$),_[2]=(R,$)=>new G4(R),_[3]=(R,$)=>b6.INSTANCE,_[4]=(R,$)=>h6.INSTANCE,_[5]=(R,$)=>new $4(R),_[6]=(R,$)=>y6.INSTANCE,_[7]=(R,$)=>new R4(R),this.actionFactories=_}if(T>this.actionFactories.length||this.actionFactories[T]===null)throw"The specified lexer action type "+T+" is not valid.";return this.actionFactories[T](L,I)}}class P1{syntaxError(T,L,I,_,R,$){}reportAmbiguity(T,L,I,_,R,$,G){}reportAttemptingFullContext(T,L,I,_,R,$){}reportContextSensitivity(T,L,I,_,R,$){}}class w6 extends P1{constructor(){super()}syntaxError(T,L,I,_,R,$){console.error("line "+I+":"+_+" "+R)}}w6.INSTANCE=new w6;class C3 extends P1{constructor(T){if(super(),T===null)throw"delegates";return this.delegates=T,this}syntaxError(T,L,I,_,R,$){this.delegates.map((G)=>G.syntaxError(T,L,I,_,R,$))}reportAmbiguity(T,L,I,_,R,$,G){this.delegates.map((Q)=>Q.reportAmbiguity(T,L,I,_,R,$,G))}reportAttemptingFullContext(T,L,I,_,R,$){this.delegates.map((G)=>G.reportAttemptingFullContext(T,L,I,_,R,$))}reportContextSensitivity(T,L,I,_,R,$){this.delegates.map((G)=>G.reportContextSensitivity(T,L,I,_,R,$))}}class s1{constructor(){this._listeners=[w6.INSTANCE],this._interp=null,this._stateNumber=-1}checkVersion(T){T!=="4.13.2"&&console.log("ANTLR runtime and generated code versions disagree: 4.13.2!="+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){let T=this.getLiteralNames(),L=this.getSymbolicNames(),I=T.length>L.length?T.length:L.length;this.tokenNames=[];for(let _=0;_<I;_++)this.tokenNames[_]=T[_]||L[_]||"<INVALID"}return this.tokenNames}getTokenTypeMap(){let T=this.getTokenNames();if(T===null)throw"The current recognizer does not provide a list of token names.";let L=this.tokenTypeMapCache[T];return L===void 0&&(L=T.reduce(function(I,_,R){I[_]=R}),L.EOF=M.EOF,this.tokenTypeMapCache[T]=L),L}getRuleIndexMap(){let T=this.ruleNames;if(T===null)throw"The current recognizer does not provide a list of rule names.";let L=this.ruleIndexMapCache[T];return L===void 0&&(L=T.reduce(function(I,_,R){I[_]=R}),this.ruleIndexMapCache[T]=L),L}getTokenType(T){let L=this.getTokenTypeMap()[T];return L!==void 0?L:M.INVALID_TYPE}getErrorHeader(T){return"line "+T.getOffendingToken().line+":"+T.getOffendingToken().column}getTokenErrorDisplay(T){if(T===null)return"<no token>";let L=T.text;return L===null&&(L=T.type===M.EOF?"<EOF>":"<"+T.type+">"),L=L.replace(`
2
+ `,"\\n").replace("\r","\\r").replace("\t","\\t"),"'"+L+"'"}getErrorListenerDispatch(){return console.warn("Calling deprecated method in Recognizer class: getErrorListenerDispatch()"),this.getErrorListener()}getErrorListener(){return new C3(this._listeners)}sempred(T,L,I){return!0}precpred(T,L){return!0}get atn(){return this._interp.atn}get state(){return this._stateNumber}set state(T){this._stateNumber=T}}s1.tokenTypeMapCache={},s1.ruleIndexMapCache={};class v0 extends M{constructor(T,L,I,_,R){super(),this.source=T!==void 0?T:v0.EMPTY_SOURCE,this.type=L!==void 0?L:null,this.channel=I!==void 0?I:M.DEFAULT_CHANNEL,this.start=_!==void 0?_:-1,this.stop=R!==void 0?R:-1,this.tokenIndex=-1,this.source[0]!==null?(this.line=T[0].line,this.column=T[0].column):this.column=-1}clone(){let T=new v0(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){let L=new v0(this.source,T,this.channel,this.start,this.stop);return L.tokenIndex=this.tokenIndex,L.line=this.line,L.column=this.column,T===M.EOF&&(L.text=""),L}toString(){let T=this.text;return T=T!==null?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(this._text!==null)return this._text;let T=this.getInputStream();if(T===null)return null;let L=T.size;return this.start<L&&this.stop<L?T.getText(this.start,this.stop):"<EOF>"}set text(T){this._text=T}}v0.EMPTY_SOURCE=[null,null];class P3{}class A6 extends P3{constructor(T){super(),this.copyText=T!==void 0&&T}create(T,L,I,_,R,$,G,Q){let U=new v0(T,L,_,R,$);return U.line=G,U.column=Q,I!==null?U.text=I:this.copyText&&T[1]!==null&&(U.text=T[1].getText(R,$)),U}createThin(T,L){let I=new v0(null,T);return I.text=L,I}}A6.DEFAULT=new A6;class r0 extends Error{constructor(T){super(T.message),Error.captureStackTrace&&Error.captureStackTrace(this,r0),this.message=T.message,this.recognizer=T.recognizer,this.input=T.input,this.ctx=T.ctx,this.offendingToken=null,this.offendingState=-1,this.recognizer!==null&&(this.offendingState=this.recognizer.state)}getExpectedTokens(){return this.recognizer!==null?this.recognizer.atn.getExpectedTokens(this.offendingState,this.ctx):null}toString(){return this.message}}class m6 extends r0{constructor(T,L,I,_){super({message:"",recognizer:T,input:L,ctx:null}),this.startIndex=I,this.deadEndConfigs=_}toString(){let T="";return this.startIndex>=0&&this.startIndex<this.input.size&&(T=this.input.getText(new x(this.startIndex,this.startIndex))),"LexerNoViableAltException"+T}}class t extends s1{constructor(T){super(),this._input=T,this._factory=A6.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=M.DEFAULT_CHANNEL,this._type=M.INVALID_TYPE,this._modeStack=[],this._mode=t.DEFAULT_MODE,this._text=null}reset(){this._input!==null&&this._input.seek(0),this._token=null,this._type=M.INVALID_TYPE,this._channel=M.DEFAULT_CHANNEL,this._tokenStartCharIndex=-1,this._tokenStartColumn=-1,this._tokenStartLine=-1,this._text=null,this._hitEOF=!1,this._mode=t.DEFAULT_MODE,this._modeStack=[],this._interp.reset()}nextToken(){if(this._input===null)throw"nextToken requires a non-null input stream.";let T=this._input.mark();try{for(;;){if(this._hitEOF)return this.emitEOF(),this._token;this._token=null,this._channel=M.DEFAULT_CHANNEL,this._tokenStartCharIndex=this._input.index,this._tokenStartColumn=this._interp.column,this._tokenStartLine=this._interp.line,this._text=null;let L=!1;for(;;){this._type=M.INVALID_TYPE;let I=t.SKIP;try{I=this._interp.match(this._input,this._mode)}catch(_){if(!(_ instanceof r0))throw console.log(_.stack),_;this.notifyListeners(_),this.recover(_)}if(this._input.LA(1)===M.EOF&&(this._hitEOF=!0),this._type===M.INVALID_TYPE&&(this._type=I),this._type===t.SKIP){L=!0;break}if(this._type!==t.MORE)break}if(!L)return this._token===null&&this.emit(),this._token}}finally{this._input.release(T)}}skip(){this._type=t.SKIP}more(){this._type=t.MORE}mode(T){console.warn("Calling deprecated method in Lexer class: mode(...)"),this.setMode(T)}setMode(T){this._mode=T}getMode(){return this._mode}getModeStack(){return this._modeStack}pushMode(T){this._interp.debug&&console.log("pushMode "+T),this._modeStack.push(this._mode),this.setMode(T)}popMode(){if(this._modeStack.length===0)throw"Empty Stack";return this._interp.debug&&console.log("popMode back to "+this._modeStack.slice(0,-1)),this.setMode(this._modeStack.pop()),this._mode}emitToken(T){this._token=T}emit(){let 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(){let T=this.column,L=this.line,I=this._factory.create(this._tokenFactorySourcePair,M.EOF,null,M.DEFAULT_CHANNEL,this._input.index,this._input.index-1,L,T);return this.emitToken(I),I}getCharIndex(){return this._input.index}getAllTokens(){let T=[],L=this.nextToken();for(;L.type!==M.EOF;)T.push(L),L=this.nextToken();return T}notifyListeners(T){let L=this._tokenStartCharIndex,I=this._input.index,_=this._input.getText(L,I),R="token recognition error at: '"+this.getErrorDisplay(_)+"'";this.getErrorListener().syntaxError(this,null,this._tokenStartLine,this._tokenStartColumn,R,T)}getErrorDisplay(T){let L=[];for(let I=0;I<T.length;I++)L.push(T[I]);return L.join("")}getErrorDisplayForChar(T){return T.charCodeAt(0)===M.EOF?"<EOF>":T===`
3
+ `?"\\n":T==="\t"?"\\t":T==="\r"?"\\r":T}getCharErrorDisplay(T){return"'"+this.getErrorDisplayForChar(T)+"'"}recover(T){this._input.LA(1)!==M.EOF&&(T instanceof m6?this._interp.consume(this._input):this._input.consume())}get inputStream(){return this._input}set inputStream(T){this._input=null,this._tokenFactorySourcePair=[this,this._input],this.reset(),this._input=T,this._tokenFactorySourcePair=[this,this._input]}get sourceName(){return this._input.sourceName}get type(){return this._type}set type(T){this._type=T}get line(){return this._interp.line}set line(T){this._interp.line=T}get column(){return this._interp.column}set column(T){this._interp.column=T}get text(){return this._text!==null?this._text:this._interp.getText(this._input)}set text(T){this._text=T}}function RL(T){return T.hashCodeForConfigSet()}function $L(T,L){return T===L||T!==null&&L!==null&&T.equalsForConfigSet(L)}t.DEFAULT_MODE=0,t.MORE=-2,t.SKIP=-3,t.DEFAULT_TOKEN_CHANNEL=M.DEFAULT_CHANNEL,t.HIDDEN=M.HIDDEN_CHANNEL,t.MIN_CHAR_VALUE=0,t.MAX_CHAR_VALUE=1114111;class W0{constructor(T){this.configLookup=new z0(RL,$L),this.fullCtx=T===void 0||T,this.readOnly=!1,this.configs=[],this.uniqueAlt=0,this.conflictingAlts=null,this.hasSemanticContext=!1,this.dipsIntoOuterContext=!1,this.cachedHashCode=-1}add(T,L){if(L===void 0&&(L=null),this.readOnly)throw"This set is readonly";T.semanticContext!==o.NONE&&(this.hasSemanticContext=!0),T.reachesIntoOuterContext>0&&(this.dipsIntoOuterContext=!0);let I=this.configLookup.getOrAdd(T);if(I===T)return this.cachedHashCode=-1,this.configs.push(T),!0;let _=!this.fullCtx,R=m2(I.context,T.context,_,L);return I.reachesIntoOuterContext=Math.max(I.reachesIntoOuterContext,T.reachesIntoOuterContext),T.precedenceFilterSuppressed&&(I.precedenceFilterSuppressed=!0),I.context=R,!0}getStates(){let T=new z0;for(let L=0;L<this.configs.length;L++)T.add(this.configs[L].state);return T}getPredicates(){let T=[];for(let L=0;L<this.configs.length;L++){let I=this.configs[L].semanticContext;I!==o.NONE&&T.push(I.semanticContext)}return T}optimizeConfigs(T){if(this.readOnly)throw"This set is readonly";if(this.configLookup.length!==0)for(let L=0;L<this.configs.length;L++){let I=this.configs[L];I.context=T.getCachedContext(I.context)}}addAll(T){for(let L=0;L<T.length;L++)this.add(T[L]);return!1}equals(T){return this===T||T instanceof W0&&E1(this.configs,T.configs)&&this.fullCtx===T.fullCtx&&this.uniqueAlt===T.uniqueAlt&&this.conflictingAlts===T.conflictingAlts&&this.hasSemanticContext===T.hasSemanticContext&&this.dipsIntoOuterContext===T.dipsIntoOuterContext}hashCode(){let T=new k0;return T.update(this.configs),T.finish()}updateHashCode(T){this.readOnly?(this.cachedHashCode===-1&&(this.cachedHashCode=this.hashCode()),T.update(this.cachedHashCode)):T.update(this.hashCode())}isEmpty(){return this.configs.length===0}contains(T){if(this.configLookup===null)throw"This method is not implemented for readonly sets.";return this.configLookup.contains(T)}containsFast(T){if(this.configLookup===null)throw"This method is not implemented for readonly sets.";return this.configLookup.containsFast(T)}clear(){if(this.readOnly)throw"This set is readonly";this.configs=[],this.cachedHashCode=-1,this.configLookup=new z0}setReadonly(T){this.readOnly=T,T&&(this.configLookup=null)}toString(){return o0(this.configs)+(this.hasSemanticContext?",hasSemanticContext="+this.hasSemanticContext:"")+(this.uniqueAlt!==a.INVALID_ALT_NUMBER?",uniqueAlt="+this.uniqueAlt:"")+(this.conflictingAlts!==null?",conflictingAlts="+this.conflictingAlts:"")+(this.dipsIntoOuterContext?",dipsIntoOuterContext":"")}get items(){return this.configs}get length(){return this.configs.length}}class i0{constructor(T,L){return T===null&&(T=-1),L===null&&(L=new W0),this.stateNumber=T,this.configs=L,this.edges=null,this.isAcceptState=!1,this.prediction=0,this.lexerActionExecutor=null,this.requiresFullContext=!1,this.predicates=null,this}getAltSet(){let T=new z0;if(this.configs!==null)for(let L=0;L<this.configs.length;L++){let I=this.configs[L];T.add(I.alt)}return T.length===0?null:T}equals(T){return this===T||T instanceof i0&&this.configs.equals(T.configs)}toString(){let T=this.stateNumber+":"+this.configs;return this.isAcceptState&&(T+="=>",this.predicates!==null?T+=this.predicates:T+=this.prediction),T}hashCode(){let T=new k0;return T.update(this.configs),T.finish()}}class N0{constructor(T,L){return this.atn=T,this.sharedContextCache=L,this}getCachedContext(T){if(this.sharedContextCache===null)return T;let L=new C1;return k3(T,this.sharedContextCache,L)}}N0.ERROR=new i0(2147483647,new W0);class i2 extends W0{constructor(){super(),this.configLookup=new z0}}class B0 extends T0{constructor(T,L){super(T,L);let I=T.lexerActionExecutor||null;return this.lexerActionExecutor=I||(L!==null?L.lexerActionExecutor:null),this.passedThroughNonGreedyDecision=L!==null&&this.checkNonGreedyDecision(L,this.state),this.hashCodeForConfigSet=B0.prototype.hashCode,this.equalsForConfigSet=B0.prototype.equals,this}updateHashCode(T){T.update(this.state.stateNumber,this.alt,this.context,this.semanticContext,this.passedThroughNonGreedyDecision,this.lexerActionExecutor)}equals(T){return this===T||T instanceof B0&&this.passedThroughNonGreedyDecision===T.passedThroughNonGreedyDecision&&(this.lexerActionExecutor?this.lexerActionExecutor.equals(T.lexerActionExecutor):!T.lexerActionExecutor)&&super.equals(T)}checkNonGreedyDecision(T,L){return T.passedThroughNonGreedyDecision||L instanceof K1&&L.nonGreedy}}class i1 extends p0{constructor(T,L){super(L.actionType),this.offset=T,this.action=L,this.isPositionDependent=!0}execute(T){this.action.execute(T)}updateHashCode(T){T.update(this.actionType,this.offset,this.action)}equals(T){return this===T||T instanceof i1&&this.offset===T.offset&&this.action===T.action}}class k1{constructor(T){return this.lexerActions=T===null?[]:T,this.cachedHashCode=k0.hashStuff(T),this}fixOffsetBeforeMatch(T){let L=null;for(let I=0;I<this.lexerActions.length;I++)!this.lexerActions[I].isPositionDependent||this.lexerActions[I]instanceof i1||(L===null&&(L=this.lexerActions.concat([])),L[I]=new i1(T,this.lexerActions[I]));return L===null?this:new k1(L)}execute(T,L,I){let _=!1,R=L.index;try{for(let $=0;$<this.lexerActions.length;$++){let G=this.lexerActions[$];if(G instanceof i1){let Q=G.offset;L.seek(I+Q),G=G.action,_=I+Q!==R}else G.isPositionDependent&&(L.seek(R),_=!1);G.execute(T)}}finally{_&&L.seek(R)}}hashCode(){return this.cachedHashCode}updateHashCode(T){T.update(this.cachedHashCode)}equals(T){if(this===T)return!0;if(T instanceof k1){if(this.cachedHashCode!=T.cachedHashCode)return!1;if(this.lexerActions.length!=T.lexerActions.length)return!1;{let L=this.lexerActions.length;for(let I=0;I<L;++I)if(!this.lexerActions[I].equals(T.lexerActions[I]))return!1;return!0}}return!1}static append(T,L){if(T===null)return new k1([L]);let I=T.lexerActions.concat([L]);return new k1(I)}}function D3(T){T.index=-1,T.line=0,T.column=-1,T.dfaState=null}class N3{constructor(){D3(this)}reset(){D3(this)}}class n extends N0{constructor(T,L,I,_){super(L,_),this.decisionToDFA=I,this.recog=T,this.startIndex=-1,this.line=1,this.column=0,this.mode=t.DEFAULT_MODE,this.prevAccept=new N3}copyState(T){this.column=T.column,this.line=T.line,this.mode=T.mode,this.startIndex=T.startIndex}match(T,L){this.mode=L;let I=T.mark();try{this.startIndex=T.index,this.prevAccept.reset();let _=this.decisionToDFA[L];return _.s0===null?this.matchATN(T):this.execATN(T,_.s0)}finally{T.release(I)}}reset(){this.prevAccept.reset(),this.startIndex=-1,this.line=1,this.column=0,this.mode=t.DEFAULT_MODE}matchATN(T){let L=this.atn.modeToStartState[this.mode];n.debug&&console.log("matchATN mode "+this.mode+" start: "+L);let I=this.mode,_=this.computeStartState(T,L),R=_.hasSemanticContext;_.hasSemanticContext=!1;let $=this.addDFAState(_);R||(this.decisionToDFA[this.mode].s0=$);let G=this.execATN(T,$);return n.debug&&console.log("DFA after matchATN: "+this.decisionToDFA[I].toLexerString()),G}execATN(T,L){n.debug&&console.log("start state closure="+L.configs),L.isAcceptState&&this.captureSimState(this.prevAccept,T,L);let I=T.LA(1),_=L;for(;;){n.debug&&console.log("execATN loop starting closure: "+_.configs);let R=this.getExistingTargetState(_,I);if(R===null&&(R=this.computeTargetState(T,_,I)),R===N0.ERROR)break;if(I!==M.EOF&&this.consume(T),R.isAcceptState&&(this.captureSimState(this.prevAccept,T,R),I===M.EOF))break;I=T.LA(1),_=R}return this.failOrAccept(this.prevAccept,T,_.configs,I)}getExistingTargetState(T,L){if(T.edges===null||L<n.MIN_DFA_EDGE||L>n.MAX_DFA_EDGE)return null;let I=T.edges[L-n.MIN_DFA_EDGE];return I===void 0&&(I=null),n.debug&&I!==null&&console.log("reuse state "+T.stateNumber+" edge to "+I.stateNumber),I}computeTargetState(T,L,I){let _=new i2;return this.getReachableConfigSet(T,L.configs,_,I),_.items.length===0?(_.hasSemanticContext||this.addDFAEdge(L,I,N0.ERROR),N0.ERROR):this.addDFAEdge(L,I,null,_)}failOrAccept(T,L,I,_){if(this.prevAccept.dfaState!==null){let R=T.dfaState.lexerActionExecutor;return this.accept(L,R,this.startIndex,T.index,T.line,T.column),T.dfaState.prediction}if(_===M.EOF&&L.index===this.startIndex)return M.EOF;throw new m6(this.recog,L,this.startIndex,I)}getReachableConfigSet(T,L,I,_){let R=a.INVALID_ALT_NUMBER;for(let $=0;$<L.items.length;$++){let G=L.items[$],Q=G.alt===R;if(!Q||!G.passedThroughNonGreedyDecision){n.debug&&console.log(`testing %s at %s
4
+ `,this.getTokenName(_),G.toString(this.recog,!0));for(let U=0;U<G.state.transitions.length;U++){let O=G.state.transitions[U],J=this.getReachableTarget(O,_);if(J!==null){let D=G.lexerActionExecutor;D!==null&&(D=D.fixOffsetBeforeMatch(T.index-this.startIndex));let B=_===M.EOF,H=new B0({state:J,lexerActionExecutor:D},G);this.closure(T,H,I,Q,!0,B)&&(R=G.alt)}}}}}accept(T,L,I,_,R,$){n.debug&&console.log(`ACTION %s
5
+ `,L),T.seek(_),this.line=R,this.column=$,L!==null&&this.recog!==null&&L.execute(this.recog,T,I)}getReachableTarget(T,L){return T.matches(L,0,t.MAX_CHAR_VALUE)?T.target:null}computeStartState(T,L){let I=A.EMPTY,_=new i2;for(let R=0;R<L.transitions.length;R++){let $=L.transitions[R].target,G=new B0({state:$,alt:R+1,context:I},null);this.closure(T,G,_,!1,!1,!1)}return _}closure(T,L,I,_,R,$){let G=null;if(n.debug&&console.log("closure("+L.toString(this.recog,!0)+")"),L.state instanceof Z0){if(n.debug&&(this.recog!==null?console.log(`closure at %s rule stop %s
6
+ `,this.recog.ruleNames[L.state.ruleIndex],L):console.log(`closure at rule stop %s
7
+ `,L)),L.context===null||L.context.hasEmptyPath()){if(L.context===null||L.context.isEmpty())return I.add(L),!0;I.add(new B0({state:L.state,context:A.EMPTY},L)),_=!0}if(L.context!==null&&!L.context.isEmpty()){for(let Q=0;Q<L.context.length;Q++)if(L.context.getReturnState(Q)!==A.EMPTY_RETURN_STATE){let U=L.context.getParent(Q),O=this.atn.states[L.context.getReturnState(Q)];G=new B0({state:O,context:U},L),_=this.closure(T,G,I,_,R,$)}}return _}L.state.epsilonOnlyTransitions||_&&L.passedThroughNonGreedyDecision||I.add(L);for(let Q=0;Q<L.state.transitions.length;Q++){let U=L.state.transitions[Q];G=this.getEpsilonTarget(T,L,U,I,R,$),G!==null&&(_=this.closure(T,G,I,_,R,$))}return _}getEpsilonTarget(T,L,I,_,R,$){let G=null;if(I.serializationType===P.RULE){let Q=D0.create(L.context,I.followState.stateNumber);G=new B0({state:I.target,context:Q},L)}else{if(I.serializationType===P.PRECEDENCE)throw"Precedence predicates are not supported in lexers.";if(I.serializationType===P.PREDICATE)n.debug&&console.log("EVAL rule "+I.ruleIndex+":"+I.predIndex),_.hasSemanticContext=!0,this.evaluatePredicate(T,I.ruleIndex,I.predIndex,R)&&(G=new B0({state:I.target},L));else if(I.serializationType===P.ACTION)if(L.context===null||L.context.hasEmptyPath()){let Q=k1.append(L.lexerActionExecutor,this.atn.lexerActions[I.actionIndex]);G=new B0({state:I.target,lexerActionExecutor:Q},L)}else G=new B0({state:I.target},L);else I.serializationType===P.EPSILON?G=new B0({state:I.target},L):I.serializationType!==P.ATOM&&I.serializationType!==P.RANGE&&I.serializationType!==P.SET||$&&I.matches(M.EOF,0,t.MAX_CHAR_VALUE)&&(G=new B0({state:I.target},L))}return G}evaluatePredicate(T,L,I,_){if(this.recog===null)return!0;if(!_)return this.recog.sempred(null,L,I);let R=this.column,$=this.line,G=T.index,Q=T.mark();try{return this.consume(T),this.recog.sempred(null,L,I)}finally{this.column=R,this.line=$,T.seek(G),T.release(Q)}}captureSimState(T,L,I){T.index=L.index,T.line=this.line,T.column=this.column,T.dfaState=I}addDFAEdge(T,L,I,_){if(I===void 0&&(I=null),_===void 0&&(_=null),I===null&&_!==null){let R=_.hasSemanticContext;if(_.hasSemanticContext=!1,I=this.addDFAState(_),R)return I}return L<n.MIN_DFA_EDGE||L>n.MAX_DFA_EDGE||(n.debug&&console.log("EDGE "+T+" -> "+I+" upon "+L),T.edges===null&&(T.edges=[]),T.edges[L-n.MIN_DFA_EDGE]=I),I}addDFAState(T){let L=new i0(null,T),I=null;for(let G=0;G<T.items.length;G++){let Q=T.items[G];if(Q.state instanceof Z0){I=Q;break}}I!==null&&(L.isAcceptState=!0,L.lexerActionExecutor=I.lexerActionExecutor,L.prediction=this.atn.ruleToTokenType[I.state.ruleIndex]);let _=this.decisionToDFA[this.mode],R=_.states.get(L);if(R!==null)return R;let $=L;return $.stateNumber=_.states.length,T.setReadonly(!0),$.configs=T,_.states.add($),$}getDFA(T){return this.decisionToDFA[T]}getText(T){return T.getText(this.startIndex,T.index-1)}consume(T){T.LA(1)===10?(this.line+=1,this.column=0):this.column+=1,T.consume()}getTokenName(T){return T===-1?"EOF":"'"+String.fromCharCode(T)+"'"}}n.debug=!1,n.dfa_debug=!1,n.MIN_DFA_EDGE=0,n.MAX_DFA_EDGE=127;class Q4{constructor(T,L){this.alt=L,this.pred=T}toString(){return"("+this.pred+", "+this.alt+")"}}class y3{constructor(){this.data={}}get(T){return this.data["k-"+T]||null}set(T,L){this.data["k-"+T]=L}values(){return Object.keys(this.data).filter((T)=>T.startsWith("k-")).map((T)=>this.data[T],this)}}var g0={SLL:0,LL:1,LL_EXACT_AMBIG_DETECTION:2,hasSLLConflictTerminatingPrediction:function(T,L){if(g0.allConfigsInRuleStopStates(L))return!0;if(T===g0.SLL&&L.hasSemanticContext){let _=new W0;for(let R=0;R<L.items.length;R++){let $=L.items[R];$=new T0({semanticContext:o.NONE},$),_.add($)}L=_}let I=g0.getConflictingAltSubsets(L);return g0.hasConflictingAltSet(I)&&!g0.hasStateAssociatedWithOneAlt(L)},hasConfigInRuleStopState:function(T){for(let L=0;L<T.items.length;L++)if(T.items[L].state instanceof Z0)return!0;return!1},allConfigsInRuleStopStates:function(T){for(let L=0;L<T.items.length;L++)if(!(T.items[L].state instanceof Z0))return!1;return!0},resolvesToJustOneViableAlt:function(T){return g0.getSingleViableAlt(T)},allSubsetsConflict:function(T){return!g0.hasNonConflictingAltSet(T)},hasNonConflictingAltSet:function(T){for(let L=0;L<T.length;L++)if(T[L].length===1)return!0;return!1},hasConflictingAltSet:function(T){for(let L=0;L<T.length;L++)if(T[L].length>1)return!0;return!1},allSubsetsEqual:function(T){let L=null;for(let I=0;I<T.length;I++){let _=T[I];if(L===null)L=_;else if(_!==L)return!1}return!0},getUniqueAlt:function(T){let L=g0.getAlts(T);return L.length===1?L.minValue():a.INVALID_ALT_NUMBER},getAlts:function(T){let L=new K0;return T.map(function(I){L.or(I)}),L},getConflictingAltSubsets:function(T){let L=new C1;return L.hashFunction=function(I){k0.hashStuff(I.state.stateNumber,I.context)},L.equalsFunction=function(I,_){return I.state.stateNumber===_.state.stateNumber&&I.context.equals(_.context)},T.items.map(function(I){let _=L.get(I);_===null&&(_=new K0,L.set(I,_)),_.set(I.alt)}),L.getValues()},getStateToAltMap:function(T){let L=new y3;return T.items.map(function(I){let _=L.get(I.state);_===null&&(_=new K0,L.set(I.state,_)),_.set(I.alt)}),L},hasStateAssociatedWithOneAlt:function(T){let L=g0.getStateToAltMap(T).values();for(let I=0;I<L.length;I++)if(L[I].length===1)return!0;return!1},getSingleViableAlt:function(T){let L=null;for(let I=0;I<T.length;I++){let _=T[I].minValue();if(L===null)L=_;else if(L!==_)return a.INVALID_ALT_NUMBER}return L}},Q0=g0;class t1 extends r0{constructor(T,L,I,_,R,$){$=$||T._ctx,_=_||T.getCurrentToken(),I=I||T.getCurrentToken(),L=L||T.getInputStream(),super({message:"",recognizer:T,input:L,ctx:$}),this.deadEndConfigs=R,this.startToken=I,this.offendingToken=_}}class b3{constructor(T){this.defaultMapCtor=T||C1,this.cacheMap=new this.defaultMapCtor}get(T,L){let I=this.cacheMap.get(T)||null;return I===null?null:I.get(L)||null}set(T,L,I){let _=this.cacheMap.get(T)||null;_===null&&(_=new this.defaultMapCtor,this.cacheMap.set(T,_)),_.set(L,I)}}class U4 extends N0{constructor(T,L,I,_){super(L,_),this.parser=T,this.decisionToDFA=I,this.predictionMode=Q0.LL,this._input=null,this._startIndex=0,this._outerContext=null,this._dfa=null,this.mergeCache=null,this.debug=!1,this.debug_closure=!1,this.debug_add=!1,this.trace_atn_sim=!1,this.dfa_debug=!1,this.retry_debug=!1}reset(){}adaptivePredict(T,L,I){(this.debug||this.trace_atn_sim)&&console.log("adaptivePredict decision "+L+" exec LA(1)=="+this.getLookaheadName(T)+" line "+T.LT(1).line+":"+T.LT(1).column),this._input=T,this._startIndex=T.index,this._outerContext=I;let _=this.decisionToDFA[L];this._dfa=_;let R=T.mark(),$=T.index;try{let G;if(G=_.precedenceDfa?_.getPrecedenceStartState(this.parser.getPrecedence()):_.s0,G===null){I===null&&(I=_1.EMPTY),this.debug&&console.log("predictATN decision "+_.decision+" exec LA(1)=="+this.getLookaheadName(T)+", outerContext="+I.toString(this.parser.ruleNames));let U=!1,O=this.computeStartState(_.atnStartState,_1.EMPTY,U);_.precedenceDfa?(_.s0.configs=O,O=this.applyPrecedenceFilter(O),G=this.addDFAState(_,new i0(null,O)),_.setPrecedenceStartState(this.parser.getPrecedence(),G)):(G=this.addDFAState(_,new i0(null,O)),_.s0=G)}let Q=this.execATN(_,G,T,$,I);return this.debug&&console.log("DFA after predictATN: "+_.toString(this.parser.literalNames,this.parser.symbolicNames)),Q}finally{this._dfa=null,this.mergeCache=null,T.seek($),T.release(R)}}execATN(T,L,I,_,R){let $;(this.debug||this.trace_atn_sim)&&console.log("execATN decision "+T.decision+", DFA state "+L+", LA(1)=="+this.getLookaheadName(I)+" line "+I.LT(1).line+":"+I.LT(1).column);let G=L;this.debug&&console.log("s0 = "+L);let Q=I.LA(1);for(;;){let U=this.getExistingTargetState(G,Q);if(U===null&&(U=this.computeTargetState(T,G,Q)),U===N0.ERROR){let O=this.noViableAlt(I,R,G.configs,_);if(I.seek(_),$=this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(G.configs,R),$!==a.INVALID_ALT_NUMBER)return $;throw O}if(U.requiresFullContext&&this.predictionMode!==Q0.SLL){let O=null;if(U.predicates!==null){this.debug&&console.log("DFA state has preds in DFA sim LL failover");let B=I.index;if(B!==_&&I.seek(_),O=this.evalSemanticContext(U.predicates,R,!0),O.length===1)return this.debug&&console.log("Full LL avoided"),O.minValue();B!==_&&I.seek(B)}this.dfa_debug&&console.log("ctx sensitive state "+R+" in "+U);let J=!0,D=this.computeStartState(T.atnStartState,R,J);return this.reportAttemptingFullContext(T,O,U.configs,_,I.index),$=this.execATNWithFullContext(T,U,D,I,_,R),$}if(U.isAcceptState){if(U.predicates===null)return U.prediction;let O=I.index;I.seek(_);let J=this.evalSemanticContext(U.predicates,R,!0);if(J.length===0)throw this.noViableAlt(I,R,U.configs,_);return J.length===1||this.reportAmbiguity(T,U,_,O,!1,J,U.configs),J.minValue()}G=U,Q!==M.EOF&&(I.consume(),Q=I.LA(1))}}getExistingTargetState(T,L){let I=T.edges;return I===null?null:I[L+1]||null}computeTargetState(T,L,I){let _=this.computeReachSet(L.configs,I,!1);if(_===null)return this.addDFAEdge(T,L,I,N0.ERROR),N0.ERROR;let R=new i0(null,_),$=this.getUniqueAlt(_);if(this.debug){let G=Q0.getConflictingAltSubsets(_);console.log("SLL altSubSets="+o0(G)+", configs="+_+", predict="+$+", allSubsetsConflict="+Q0.allSubsetsConflict(G)+", conflictingAlts="+this.getConflictingAlts(_))}return $!==a.INVALID_ALT_NUMBER?(R.isAcceptState=!0,R.configs.uniqueAlt=$,R.prediction=$):Q0.hasSLLConflictTerminatingPrediction(this.predictionMode,_)&&(R.configs.conflictingAlts=this.getConflictingAlts(_),R.requiresFullContext=!0,R.isAcceptState=!0,R.prediction=R.configs.conflictingAlts.minValue()),R.isAcceptState&&R.configs.hasSemanticContext&&(this.predicateDFAState(R,this.atn.getDecisionState(T.decision)),R.predicates!==null&&(R.prediction=a.INVALID_ALT_NUMBER)),R=this.addDFAEdge(T,L,I,R),R}predicateDFAState(T,L){let I=L.transitions.length,_=this.getConflictingAltsOrUniqueAlt(T.configs),R=this.getPredsForAmbigAlts(_,T.configs,I);R!==null?(T.predicates=this.getPredicatePredictions(_,R),T.prediction=a.INVALID_ALT_NUMBER):T.prediction=_.minValue()}execATNWithFullContext(T,L,I,_,R,$){(this.debug||this.trace_atn_sim)&&console.log("execATNWithFullContext "+I);let G,Q=!1,U=I;_.seek(R);let O=_.LA(1),J=-1;for(;;){if(G=this.computeReachSet(U,O,!0),G===null){let B=this.noViableAlt(_,$,U,R);_.seek(R);let H=this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(U,$);if(H!==a.INVALID_ALT_NUMBER)return H;throw B}let D=Q0.getConflictingAltSubsets(G);if(this.debug&&console.log("LL altSubSets="+D+", predict="+Q0.getUniqueAlt(D)+", resolvesToJustOneViableAlt="+Q0.resolvesToJustOneViableAlt(D)),G.uniqueAlt=this.getUniqueAlt(G),G.uniqueAlt!==a.INVALID_ALT_NUMBER){J=G.uniqueAlt;break}if(this.predictionMode!==Q0.LL_EXACT_AMBIG_DETECTION){if(J=Q0.resolvesToJustOneViableAlt(D),J!==a.INVALID_ALT_NUMBER)break}else if(Q0.allSubsetsConflict(D)&&Q0.allSubsetsEqual(D)){Q=!0,J=Q0.getSingleViableAlt(D);break}U=G,O!==M.EOF&&(_.consume(),O=_.LA(1))}return G.uniqueAlt!==a.INVALID_ALT_NUMBER?(this.reportContextSensitivity(T,J,G,R,_.index),J):(this.reportAmbiguity(T,L,R,_.index,Q,null,G),J)}computeReachSet(T,L,I){this.debug&&console.log("in computeReachSet, starting closure: "+T),this.mergeCache===null&&(this.mergeCache=new b3);let _=new W0(I),R=null;for(let G=0;G<T.items.length;G++){let Q=T.items[G];if(this.debug&&console.log("testing "+this.getTokenName(L)+" at "+Q),Q.state instanceof Z0)(I||L===M.EOF)&&(R===null&&(R=[]),R.push(Q),this.debug_add&&console.log("added "+Q+" to skippedStopStates"));else for(let U=0;U<Q.state.transitions.length;U++){let O=Q.state.transitions[U],J=this.getReachableTarget(O,L);if(J!==null){let D=new T0({state:J},Q);_.add(D,this.mergeCache),this.debug_add&&console.log("added "+D+" to intermediate")}}}let $=null;if(R===null&&L!==M.EOF&&(_.items.length===1||this.getUniqueAlt(_)!==a.INVALID_ALT_NUMBER)&&($=_),$===null){$=new W0(I);let G=new z0,Q=L===M.EOF;for(let U=0;U<_.items.length;U++)this.closure(_.items[U],$,G,!1,I,Q)}if(L===M.EOF&&($=this.removeAllConfigsNotInRuleStopState($,$===_)),!(R===null||I&&Q0.hasConfigInRuleStopState($)))for(let G=0;G<R.length;G++)$.add(R[G],this.mergeCache);return this.trace_atn_sim&&console.log("computeReachSet "+T+" -> "+$),$.items.length===0?null:$}removeAllConfigsNotInRuleStopState(T,L){if(Q0.allConfigsInRuleStopStates(T))return T;let I=new W0(T.fullCtx);for(let _=0;_<T.items.length;_++){let R=T.items[_];if(R.state instanceof Z0)I.add(R,this.mergeCache);else if(L&&R.state.epsilonOnlyTransitions&&this.atn.nextTokens(R.state).contains(M.EPSILON)){let $=this.atn.ruleToStopState[R.state.ruleIndex];I.add(new T0({state:$},R),this.mergeCache)}}return I}computeStartState(T,L,I){let _=e2(this.atn,L),R=new W0(I);this.trace_atn_sim&&console.log("computeStartState from ATN state "+T+" initialContext="+_.toString(this.parser));for(let $=0;$<T.transitions.length;$++){let G=T.transitions[$].target,Q=new T0({state:G,alt:$+1,context:_},null),U=new z0;this.closure(Q,R,U,!0,I,!1)}return R}applyPrecedenceFilter(T){let L,I=[],_=new W0(T.fullCtx);for(let R=0;R<T.items.length;R++){if(L=T.items[R],L.alt!==1)continue;let $=L.semanticContext.evalPrecedence(this.parser,this._outerContext);$!==null&&(I[L.state.stateNumber]=L.context,$!==L.semanticContext?_.add(new T0({semanticContext:$},L),this.mergeCache):_.add(L,this.mergeCache))}for(let R=0;R<T.items.length;R++)if(L=T.items[R],L.alt!==1){if(!L.precedenceFilterSuppressed){let $=I[L.state.stateNumber]||null;if($!==null&&$.equals(L.context))continue}_.add(L,this.mergeCache)}return _}getReachableTarget(T,L){return T.matches(L,0,this.atn.maxTokenType)?T.target:null}getPredsForAmbigAlts(T,L,I){let _=[];for(let $=0;$<L.items.length;$++){let G=L.items[$];T.get(G.alt)&&(_[G.alt]=o.orContext(_[G.alt]||null,G.semanticContext))}let R=0;for(let $=1;$<I+1;$++){let G=_[$]||null;G===null?_[$]=o.NONE:G!==o.NONE&&(R+=1)}return R===0&&(_=null),this.debug&&console.log("getPredsForAmbigAlts result "+o0(_)),_}getPredicatePredictions(T,L){let I=[],_=!1;for(let R=1;R<L.length;R++){let $=L[R];T!==null&&T.get(R)&&I.push(new Q4($,R)),$!==o.NONE&&(_=!0)}return _?I:null}getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(T,L){let I=this.splitAccordingToSemanticValidity(T,L),_=I[0],R=I[1],$=this.getAltThatFinishedDecisionEntryRule(_);return $!==a.INVALID_ALT_NUMBER||R.items.length>0&&($=this.getAltThatFinishedDecisionEntryRule(R),$!==a.INVALID_ALT_NUMBER)?$:a.INVALID_ALT_NUMBER}getAltThatFinishedDecisionEntryRule(T){let L=[];for(let I=0;I<T.items.length;I++){let _=T.items[I];(_.reachesIntoOuterContext>0||_.state instanceof Z0&&_.context.hasEmptyPath())&&L.indexOf(_.alt)<0&&L.push(_.alt)}return L.length===0?a.INVALID_ALT_NUMBER:Math.min.apply(null,L)}splitAccordingToSemanticValidity(T,L){let I=new W0(T.fullCtx),_=new W0(T.fullCtx);for(let R=0;R<T.items.length;R++){let $=T.items[R];$.semanticContext!==o.NONE?$.semanticContext.evaluate(this.parser,L)?I.add($):_.add($):I.add($)}return[I,_]}evalSemanticContext(T,L,I){let _=new K0;for(let R=0;R<T.length;R++){let $=T[R];if($.pred===o.NONE){if(_.set($.alt),!I)break;continue}let G=$.pred.evaluate(this.parser,L);if((this.debug||this.dfa_debug)&&console.log("eval pred "+$+"="+G),G&&((this.debug||this.dfa_debug)&&console.log("PREDICT "+$.alt),_.set($.alt),!I))break}return _}closure(T,L,I,_,R,$){this.closureCheckingStopState(T,L,I,_,R,0,$)}closureCheckingStopState(T,L,I,_,R,$,G){if((this.trace_atn_sim||this.debug_closure)&&console.log("closure("+T.toString(this.parser,!0)+")"),T.state instanceof Z0){if(!T.context.isEmpty()){for(let Q=0;Q<T.context.length;Q++){if(T.context.getReturnState(Q)===A.EMPTY_RETURN_STATE){if(R){L.add(new T0({state:T.state,context:A.EMPTY},T),this.mergeCache);continue}this.debug&&console.log("FALLING off rule "+this.getRuleName(T.state.ruleIndex)),this.closure_(T,L,I,_,R,$,G);continue}let U=this.atn.states[T.context.getReturnState(Q)],O=T.context.getParent(Q),J={state:U,alt:T.alt,context:O,semanticContext:T.semanticContext},D=new T0(J,null);D.reachesIntoOuterContext=T.reachesIntoOuterContext,this.closureCheckingStopState(D,L,I,_,R,$-1,G)}return}if(R)return void L.add(T,this.mergeCache);this.debug&&console.log("FALLING off rule "+this.getRuleName(T.state.ruleIndex))}this.closure_(T,L,I,_,R,$,G)}closure_(T,L,I,_,R,$,G){let Q=T.state;Q.epsilonOnlyTransitions||L.add(T,this.mergeCache);for(let U=0;U<Q.transitions.length;U++){if(U===0&&this.canDropLoopEntryEdgeInLeftRecursiveRule(T))continue;let O=Q.transitions[U],J=_&&!(O instanceof T4),D=this.getEpsilonTarget(T,O,J,$===0,R,G);if(D!==null){let B=$;if(T.state instanceof Z0){if(this._dfa!==null&&this._dfa.precedenceDfa&&O.outermostPrecedenceReturn===this._dfa.atnStartState.ruleIndex&&(D.precedenceFilterSuppressed=!0),D.reachesIntoOuterContext+=1,I.getOrAdd(D)!==D)continue;L.dipsIntoOuterContext=!0,B-=1,this.debug&&console.log("dips into outer ctx: "+D)}else{if(!O.isEpsilon&&I.getOrAdd(D)!==D)continue;O instanceof r1&&B>=0&&(B+=1)}this.closureCheckingStopState(D,L,I,J,R,B,G)}}}canDropLoopEntryEdgeInLeftRecursiveRule(T){let L=T.state;if(L.stateType!==N.STAR_LOOP_ENTRY)return!1;if(L.stateType!==N.STAR_LOOP_ENTRY||!L.isPrecedenceDecision||T.context.isEmpty()||T.context.hasEmptyPath())return!1;let I=T.context.length;for(let $=0;$<I;$++)if(this.atn.states[T.context.getReturnState($)].ruleIndex!==L.ruleIndex)return!1;let _=L.transitions[0].target.endState.stateNumber,R=this.atn.states[_];for(let $=0;$<I;$++){let G=T.context.getReturnState($),Q=this.atn.states[G];if(Q.transitions.length!==1||!Q.transitions[0].isEpsilon)return!1;let U=Q.transitions[0].target;if(!(Q.stateType===N.BLOCK_END&&U===L||Q===R||U===R||U.stateType===N.BLOCK_END&&U.transitions.length===1&&U.transitions[0].isEpsilon&&U.transitions[0].target===L))return!1}return!0}getRuleName(T){return this.parser!==null&&T>=0?this.parser.ruleNames[T]:"<rule "+T+">"}getEpsilonTarget(T,L,I,_,R,$){switch(L.serializationType){case P.RULE:return this.ruleTransition(T,L);case P.PRECEDENCE:return this.precedenceTransition(T,L,I,_,R);case P.PREDICATE:return this.predTransition(T,L,I,_,R);case P.ACTION:return this.actionTransition(T,L);case P.EPSILON:return new T0({state:L.target},T);case P.ATOM:case P.RANGE:case P.SET:return $&&L.matches(M.EOF,0,1)?new T0({state:L.target},T):null;default:return null}}actionTransition(T,L){if(this.debug){let I=L.actionIndex===-1?65535:L.actionIndex;console.log("ACTION edge "+L.ruleIndex+":"+I)}return new T0({state:L.target},T)}precedenceTransition(T,L,I,_,R){this.debug&&(console.log("PRED (collectPredicates="+I+") "+L.precedence+">=_p, ctx dependent=true"),this.parser!==null&&console.log("context surrounding pred is "+o0(this.parser.getRuleInvocationStack())));let $=null;if(I&&_)if(R){let G=this._input.index;this._input.seek(this._startIndex);let Q=L.getPredicate().evaluate(this.parser,this._outerContext);this._input.seek(G),Q&&($=new T0({state:L.target},T))}else{let G=o.andContext(T.semanticContext,L.getPredicate());$=new T0({state:L.target,semanticContext:G},T)}else $=new T0({state:L.target},T);return this.debug&&console.log("config from pred transition="+$),$}predTransition(T,L,I,_,R){this.debug&&(console.log("PRED (collectPredicates="+I+") "+L.ruleIndex+":"+L.predIndex+", ctx dependent="+L.isCtxDependent),this.parser!==null&&console.log("context surrounding pred is "+o0(this.parser.getRuleInvocationStack())));let $=null;if(I&&(L.isCtxDependent&&_||!L.isCtxDependent))if(R){let G=this._input.index;this._input.seek(this._startIndex);let Q=L.getPredicate().evaluate(this.parser,this._outerContext);this._input.seek(G),Q&&($=new T0({state:L.target},T))}else{let G=o.andContext(T.semanticContext,L.getPredicate());$=new T0({state:L.target,semanticContext:G},T)}else $=new T0({state:L.target},T);return this.debug&&console.log("config from pred transition="+$),$}ruleTransition(T,L){this.debug&&console.log("CALL rule "+this.getRuleName(L.target.ruleIndex)+", ctx="+T.context);let I=L.followState,_=D0.create(T.context,I.stateNumber);return new T0({state:L.target,context:_},T)}getConflictingAlts(T){let L=Q0.getConflictingAltSubsets(T);return Q0.getAlts(L)}getConflictingAltsOrUniqueAlt(T){let L=null;return T.uniqueAlt!==a.INVALID_ALT_NUMBER?(L=new K0,L.set(T.uniqueAlt)):L=T.conflictingAlts,L}getTokenName(T){if(T===M.EOF)return"EOF";if(this.parser!==null&&this.parser.literalNames!==null){if(!(T>=this.parser.literalNames.length&&T>=this.parser.symbolicNames.length))return(this.parser.literalNames[T]||this.parser.symbolicNames[T])+"<"+T+">";console.log(T+" ttype out of range: "+this.parser.literalNames),console.log(""+this.parser.getInputStream().getTokens())}return""+T}getLookaheadName(T){return this.getTokenName(T.LA(1))}dumpDeadEndConfigs(T){console.log("dead end configs: ");let L=T.getDeadEndConfigs();for(let I=0;I<L.length;I++){let _=L[I],R="no edges";if(_.state.transitions.length>0){let $=_.state.transitions[0];$ instanceof N6?R="Atom "+this.getTokenName($.label):$ instanceof u6&&(R=($ instanceof g6?"~":"")+"Set "+$.set)}console.error(_.toString(this.parser,!0)+":"+R)}}noViableAlt(T,L,I,_){return new t1(this.parser,T,T.get(_),T.LT(1),I,L)}getUniqueAlt(T){let L=a.INVALID_ALT_NUMBER;for(let I=0;I<T.items.length;I++){let _=T.items[I];if(L===a.INVALID_ALT_NUMBER)L=_.alt;else if(_.alt!==L)return a.INVALID_ALT_NUMBER}return L}addDFAEdge(T,L,I,_){if(this.debug&&console.log("EDGE "+L+" -> "+_+" upon "+this.getTokenName(I)),_===null)return null;if(_=this.addDFAState(T,_),L===null||I<-1||I>this.atn.maxTokenType)return _;if(L.edges===null&&(L.edges=[]),L.edges[I+1]=_,this.debug){let R=this.parser===null?null:this.parser.literalNames,$=this.parser===null?null:this.parser.symbolicNames;console.log(`DFA=
8
+ `+T.toString(R,$))}return _}addDFAState(T,L){if(L===N0.ERROR)return L;let I=T.states.get(L);return I!==null?(this.trace_atn_sim&&console.log("addDFAState "+L+" exists"),I):(L.stateNumber=T.states.length,L.configs.readOnly||(L.configs.optimizeConfigs(this),L.configs.setReadonly(!0)),this.trace_atn_sim&&console.log("addDFAState new "+L),T.states.add(L),this.debug&&console.log("adding new DFA state: "+L),L)}reportAttemptingFullContext(T,L,I,_,R){if(this.debug||this.retry_debug){let $=new x(_,R+1);console.log("reportAttemptingFullContext decision="+T.decision+":"+I+", input="+this.parser.getTokenStream().getText($))}this.parser!==null&&this.parser.getErrorListener().reportAttemptingFullContext(this.parser,T,_,R,L,I)}reportContextSensitivity(T,L,I,_,R){if(this.debug||this.retry_debug){let $=new x(_,R+1);console.log("reportContextSensitivity decision="+T.decision+":"+I+", input="+this.parser.getTokenStream().getText($))}this.parser!==null&&this.parser.getErrorListener().reportContextSensitivity(this.parser,T,_,R,L,I)}reportAmbiguity(T,L,I,_,R,$,G){if(this.debug||this.retry_debug){let Q=new x(I,_+1);console.log("reportAmbiguity "+$+":"+G+", input="+this.parser.getTokenStream().getText(Q))}this.parser!==null&&this.parser.getErrorListener().reportAmbiguity(this.parser,T,I,_,R,$,G)}}class S4{constructor(){this.cache=new C1}add(T){if(T===A.EMPTY)return A.EMPTY;let L=this.cache.get(T)||null;return L!==null?L:(this.cache.set(T,T),T)}get(T){return this.cache.get(T)||null}get length(){return this.cache.length}}var GL={ATN:a,ATNDeserializer:c6,LexerATNSimulator:n,ParserATNSimulator:U4,PredictionMode:Q0,PredictionContextCache:S4};class d6{constructor(T,L,I){this.dfa=T,this.literalNames=L||[],this.symbolicNames=I||[]}toString(){if(this.dfa.s0===null)return null;let T="",L=this.dfa.sortedStates();for(let I=0;I<L.length;I++){let _=L[I];if(_.edges!==null){let R=_.edges.length;for(let $=0;$<R;$++){let G=_.edges[$]||null;G!==null&&G.stateNumber!==2147483647&&(T=T.concat(this.getStateString(_)),T=T.concat("-"),T=T.concat(this.getEdgeLabel($)),T=T.concat("->"),T=T.concat(this.getStateString(G)),T=T.concat(`
9
+ `))}}}return T.length===0?null:T}getEdgeLabel(T){return T===0?"EOF":this.literalNames!==null||this.symbolicNames!==null?this.literalNames[T-1]||this.symbolicNames[T-1]:String.fromCharCode(T-1)}getStateString(T){let L=(T.isAcceptState?":":"")+"s"+T.stateNumber+(T.requiresFullContext?"^":"");return T.isAcceptState?T.predicates!==null?L+"=>"+o0(T.predicates):L+"=>"+T.prediction.toString():L}}class O4 extends d6{constructor(T){super(T,null)}getEdgeLabel(T){return"'"+String.fromCharCode(T)+"'"}}class J4{constructor(T,L){if(L===void 0&&(L=0),this.atnStartState=T,this.decision=L,this._states=new z0,this.s0=null,this.precedenceDfa=!1,T instanceof L1&&T.isPrecedenceDecision){this.precedenceDfa=!0;let I=new i0(null,new W0);I.edges=[],I.isAcceptState=!1,I.requiresFullContext=!1,this.s0=I}}getPrecedenceStartState(T){if(!this.precedenceDfa)throw"Only precedence DFAs may contain a precedence start state.";return T<0||T>=this.s0.edges.length?null:this.s0.edges[T]||null}setPrecedenceStartState(T,L){if(!this.precedenceDfa)throw"Only precedence DFAs may contain a precedence start state.";T<0||(this.s0.edges[T]=L)}setPrecedenceDfa(T){if(this.precedenceDfa!==T){if(this._states=new z0,T){let L=new i0(null,new W0);L.edges=[],L.isAcceptState=!1,L.requiresFullContext=!1,this.s0=L}else this.s0=null;this.precedenceDfa=T}}sortedStates(){return this._states.values().sort(function(T,L){return T.stateNumber-L.stateNumber})}toString(T,L){return T=T||null,L=L||null,this.s0===null?"":new d6(this,T,L).toString()}toLexerString(){return this.s0===null?"":new O4(this).toString()}get states(){return this._states}}var QL={DFA:J4,DFASerializer:d6,LexerDFASerializer:O4,PredPrediction:Q4},UL={PredictionContext:A},SL={Interval:x,IntervalSet:H0};class l6{visitTerminal(T){}visitErrorNode(T){}enterEveryRule(T){}exitEveryRule(T){}}class Z4{visit(T){return Array.isArray(T)?T.map(function(L){return L.accept(this)},this):T.accept(this)}visitChildren(T){return T.children?this.visit(T.children):null}visitTerminal(T){}visitErrorNode(T){}}class a1{walk(T,L){if(L instanceof n1||L.isErrorNode!==void 0&&L.isErrorNode())T.visitErrorNode(L);else if(L instanceof y0)T.visitTerminal(L);else{this.enterRule(T,L);for(let I=0;I<L.getChildCount();I++){let _=L.getChild(I);this.walk(T,_)}this.exitRule(T,L)}}enterRule(T,L){let I=L.ruleContext;T.enterEveryRule(I),I.enterRule(T)}exitRule(T,L){let I=L.ruleContext;I.exitRule(T),T.exitEveryRule(I)}}a1.DEFAULT=new a1;var OL={Trees:q3,RuleNode:j1,ErrorNode:n1,TerminalNode:y0,ParseTreeListener:l6,ParseTreeVisitor:Z4,ParseTreeWalker:a1};class W1 extends r0{constructor(T){super({message:"",recognizer:T,input:T.getInputStream(),ctx:T._ctx}),this.offendingToken=T.getCurrentToken()}}class o6 extends r0{constructor(T,L,I){super({message:JL(L,I||null),recognizer:T,input:T.getInputStream(),ctx:T._ctx});let _=T._interp.atn.states[T.state].transitions[0];_ instanceof L4?(this.ruleIndex=_.ruleIndex,this.predicateIndex=_.predIndex):(this.ruleIndex=0,this.predicateIndex=0),this.predicate=L,this.offendingToken=T.getCurrentToken()}}function JL(T,L){return L!==null?L:"failed predicate: {"+T+"}?"}class W4 extends P1{constructor(T){super(),T=T||!0,this.exactOnly=T}reportAmbiguity(T,L,I,_,R,$,G){if(this.exactOnly&&!R)return;let Q="reportAmbiguity d="+this.getDecisionDescription(T,L)+": ambigAlts="+this.getConflictingAlts($,G)+", input='"+T.getTokenStream().getText(new x(I,_))+"'";T.notifyErrorListeners(Q)}reportAttemptingFullContext(T,L,I,_,R,$){let G="reportAttemptingFullContext d="+this.getDecisionDescription(T,L)+", input='"+T.getTokenStream().getText(new x(I,_))+"'";T.notifyErrorListeners(G)}reportContextSensitivity(T,L,I,_,R,$){let G="reportContextSensitivity d="+this.getDecisionDescription(T,L)+", input='"+T.getTokenStream().getText(new x(I,_))+"'";T.notifyErrorListeners(G)}getDecisionDescription(T,L){let I=L.decision,_=L.atnStartState.ruleIndex,R=T.ruleNames;if(_<0||_>=R.length)return""+I;let $=R[_]||null;return $===null||$.length===0?""+I:`${I} (${$})`}getConflictingAlts(T,L){if(T!==null)return T;let I=new K0;for(let _=0;_<L.items.length;_++)I.set(L.items[_].alt);return`{${I.values().join(", ")}}`}}class D4 extends Error{constructor(){super(),Error.captureStackTrace(this,D4)}}class h3{reset(T){}recoverInline(T){}recover(T,L){}sync(T){}inErrorRecoveryMode(T){}reportError(T){}}class e1 extends h3{constructor(){super(),this.errorRecoveryMode=!1,this.lastErrorIndex=-1,this.lastErrorStates=null,this.nextTokensContext=null,this.nextTokenState=0}reset(T){this.endErrorCondition(T)}beginErrorCondition(T){this.errorRecoveryMode=!0}inErrorRecoveryMode(T){return this.errorRecoveryMode}endErrorCondition(T){this.errorRecoveryMode=!1,this.lastErrorStates=null,this.lastErrorIndex=-1}reportMatch(T){this.endErrorCondition(T)}reportError(T,L){this.inErrorRecoveryMode(T)||(this.beginErrorCondition(T),L instanceof t1?this.reportNoViableAlternative(T,L):L instanceof W1?this.reportInputMismatch(T,L):L instanceof o6?this.reportFailedPredicate(T,L):(console.log("unknown recognition error type: "+L.constructor.name),console.log(L.stack),T.notifyErrorListeners(L.getOffendingToken(),L.getMessage(),L)))}recover(T,L){this.lastErrorIndex===T.getInputStream().index&&this.lastErrorStates!==null&&this.lastErrorStates.indexOf(T.state)>=0&&T.consume(),this.lastErrorIndex=T._input.index,this.lastErrorStates===null&&(this.lastErrorStates=[]),this.lastErrorStates.push(T.state);let I=this.getErrorRecoverySet(T);this.consumeUntil(T,I)}sync(T){if(this.inErrorRecoveryMode(T))return;let L=T._interp.atn.states[T.state],I=T.getTokenStream().LA(1),_=T.atn.nextTokens(L);if(_.contains(I))return this.nextTokensContext=null,void(this.nextTokenState=N.INVALID_STATE_NUMBER);if(_.contains(M.EPSILON))this.nextTokensContext===null&&(this.nextTokensContext=T._ctx,this.nextTokensState=T._stateNumber);else switch(L.stateType){case N.BLOCK_START:case N.STAR_BLOCK_START:case N.PLUS_BLOCK_START:case N.STAR_LOOP_ENTRY:if(this.singleTokenDeletion(T)!==null)return;throw new W1(T);case N.PLUS_LOOP_BACK:case N.STAR_LOOP_BACK:{this.reportUnwantedToken(T);let R=new H0;R.addSet(T.getExpectedTokens());let $=R.addSet(this.getErrorRecoverySet(T));this.consumeUntil(T,$)}}}reportNoViableAlternative(T,L){let I=T.getTokenStream(),_;_=I!==null?L.startToken.type===M.EOF?"<EOF>":I.getText(new x(L.startToken.tokenIndex,L.offendingToken.tokenIndex)):"<unknown input>";let R="no viable alternative at input "+this.escapeWSAndQuote(_);T.notifyErrorListeners(R,L.offendingToken,L)}reportInputMismatch(T,L){let I="mismatched input "+this.getTokenErrorDisplay(L.offendingToken)+" expecting "+L.getExpectedTokens().toString(T.literalNames,T.symbolicNames);T.notifyErrorListeners(I,L.offendingToken,L)}reportFailedPredicate(T,L){let I="rule "+T.ruleNames[T._ctx.ruleIndex]+" "+L.message;T.notifyErrorListeners(I,L.offendingToken,L)}reportUnwantedToken(T){if(this.inErrorRecoveryMode(T))return;this.beginErrorCondition(T);let L=T.getCurrentToken(),I="extraneous input "+this.getTokenErrorDisplay(L)+" expecting "+this.getExpectedTokens(T).toString(T.literalNames,T.symbolicNames);T.notifyErrorListeners(I,L,null)}reportMissingToken(T){if(this.inErrorRecoveryMode(T))return;this.beginErrorCondition(T);let L=T.getCurrentToken(),I="missing "+this.getExpectedTokens(T).toString(T.literalNames,T.symbolicNames)+" at "+this.getTokenErrorDisplay(L);T.notifyErrorListeners(I,L,null)}recoverInline(T){let L=this.singleTokenDeletion(T);if(L!==null)return T.consume(),L;if(this.singleTokenInsertion(T))return this.getMissingSymbol(T);throw new W1(T)}singleTokenInsertion(T){let L=T.getTokenStream().LA(1),I=T._interp.atn,_=I.states[T.state].transitions[0].target;return!!I.nextTokens(_,T._ctx).contains(L)&&(this.reportMissingToken(T),!0)}singleTokenDeletion(T){let L=T.getTokenStream().LA(2);if(this.getExpectedTokens(T).contains(L)){this.reportUnwantedToken(T),T.consume();let I=T.getCurrentToken();return this.reportMatch(T),I}return null}getMissingSymbol(T){let L=T.getCurrentToken(),I=this.getExpectedTokens(T).first(),_;_=I===M.EOF?"<missing EOF>":"<missing "+T.literalNames[I]+">";let R=L,$=T.getTokenStream().LT(-1);return R.type===M.EOF&&$!==null&&(R=$),T.getTokenFactory().create(R.source,I,_,M.DEFAULT_CHANNEL,-1,-1,R.line,R.column)}getExpectedTokens(T){return T.getExpectedTokens()}getTokenErrorDisplay(T){if(T===null)return"<no token>";let L=T.text;return L===null&&(L=T.type===M.EOF?"<EOF>":"<"+T.type+">"),this.escapeWSAndQuote(L)}escapeWSAndQuote(T){return"'"+(T=(T=(T=T.replace(/\n/g,"\\n")).replace(/\r/g,"\\r")).replace(/\t/g,"\\t"))+"'"}getErrorRecoverySet(T){let L=T._interp.atn,I=T._ctx,_=new H0;for(;I!==null&&I.invokingState>=0;){let R=L.states[I.invokingState].transitions[0],$=L.nextTokens(R.followState);_.addSet($),I=I.parentCtx}return _.removeOne(M.EPSILON),_}consumeUntil(T,L){let I=T.getTokenStream().LA(1);for(;I!==M.EOF&&!L.contains(I);)T.consume(),I=T.getTokenStream().LA(1)}}class K4 extends e1{constructor(){super()}recover(T,L){let I=T._ctx;for(;I!==null;)I.exception=L,I=I.parentCtx;throw new D4(L)}recoverInline(T){this.recover(T,new W1(T))}sync(T){}}var ZL={RecognitionException:r0,NoViableAltException:t1,LexerNoViableAltException:m6,InputMismatchException:W1,FailedPredicateException:o6,DiagnosticErrorListener:W4,BailErrorStrategy:K4,DefaultErrorStrategy:e1,ErrorListener:P1};class I1{constructor(T,L){if(this.name="<empty>",this.strdata=T,this.decodeToUnicodeCodePoints=L||!1,this._index=0,this.data=[],this.decodeToUnicodeCodePoints)for(let I=0;I<this.strdata.length;){let _=this.strdata.codePointAt(I);this.data.push(_),I+=_<=65535?1:2}else{this.data=Array(this.strdata.length);for(let I=0;I<this.strdata.length;I++)this.data[I]=this.strdata.charCodeAt(I)}this._size=this.data.length}reset(){this._index=0}consume(){if(this._index>=this._size)throw"cannot consume EOF";this._index+=1}LA(T){if(T===0)return 0;T<0&&(T+=1);let L=this._index+T-1;return L<0||L>=this._size?M.EOF:this.data[L]}LT(T){return this.LA(T)}mark(){return-1}release(T){}seek(T){T<=this._index?this._index=T:this._index=Math.min(T,this._size)}getText(T,L){if(L>=this._size&&(L=this._size-1),T>=this._size)return"";if(this.decodeToUnicodeCodePoints){let I="";for(let _=T;_<=L;_++)I+=String.fromCodePoint(this.data[_]);return I}return this.strdata.slice(T,L+1)}toString(){return this.strdata}get index(){return this._index}get size(){return this._size}}class v6 extends I1{constructor(T,L){super(T,L)}}var K3=J1(763),Y3=typeof process<"u"&&process.versions!=null&&process.versions.node!=null;class r2 extends v6{static fromPath(T,L,I){if(!Y3)throw Error("FileStream is only available when running in Node!");K3.readFile(T,L,function(_,R){let $=null;R!==null&&($=new I1(R,!0)),I(_,$)})}constructor(T,L,I){if(!Y3)throw Error("FileStream is only available when running in Node!");super(K3.readFileSync(T,L||"utf-8"),I),this.fileName=T}}var w3={fromString:function(T){return new I1(T,!0)},fromBlob:function(T,L,I,_){let R=new window.FileReader;R.onload=function($){let G=new I1($.target.result,!0);I(G)},R.onerror=_,R.readAsText(T,L)},fromBuffer:function(T,L){return new I1(T.toString(L),!0)},fromPath:function(T,L,I){r2.fromPath(T,L,I)},fromPathSync:function(T,L){return new r2(T,L)}},WL={arrayToString:o0,stringToCharArray:function(T){let L=new Uint16Array(T.length);for(let I=0;I<T.length;I++)L[I]=T.charCodeAt(I);return L}};class A3{}class Y4 extends A3{constructor(T){super(),this.tokenSource=T,this.tokens=[],this.index=-1,this.fetchedEOF=!1}mark(){return 0}release(T){}reset(){this.seek(0)}seek(T){this.lazyInit(),this.index=this.adjustSeekIndex(T)}get size(){return this.tokens.length}get(T){return this.lazyInit(),this.tokens[T]}consume(){let T=!1;if(T=this.index>=0&&(this.fetchedEOF?this.index<this.tokens.length-1:this.index<this.tokens.length),!T&&this.LA(1)===M.EOF)throw"cannot consume EOF";this.sync(this.index+1)&&(this.index=this.adjustSeekIndex(this.index+1))}sync(T){let L=T-this.tokens.length+1;return!(L>0)||this.fetch(L)>=L}fetch(T){if(this.fetchedEOF)return 0;for(let L=0;L<T;L++){let I=this.tokenSource.nextToken();if(I.tokenIndex=this.tokens.length,this.tokens.push(I),I.type===M.EOF)return this.fetchedEOF=!0,L+1}return T}getTokens(T,L,I){if(I===void 0&&(I=null),T<0||L<0)return null;this.lazyInit();let _=[];L>=this.tokens.length&&(L=this.tokens.length-1);for(let R=T;R<L;R++){let $=this.tokens[R];if($.type===M.EOF)break;(I===null||I.contains($.type))&&_.push($)}return _}LA(T){return this.LT(T).type}LB(T){return this.index-T<0?null:this.tokens[this.index-T]}LT(T){if(this.lazyInit(),T===0)return null;if(T<0)return this.LB(-T);let L=this.index+T-1;return this.sync(L),L>=this.tokens.length?this.tokens[this.tokens.length-1]:this.tokens[L]}adjustSeekIndex(T){return T}lazyInit(){this.index===-1&&this.setup()}setup(){this.sync(0),this.index=this.adjustSeekIndex(0)}setTokenSource(T){this.tokenSource=T,this.tokens=[],this.index=-1,this.fetchedEOF=!1}nextTokenOnChannel(T,L){if(this.sync(T),T>=this.tokens.length)return-1;let I=this.tokens[T];for(;I.channel!==L;){if(I.type===M.EOF)return-1;T+=1,this.sync(T),I=this.tokens[T]}return T}previousTokenOnChannel(T,L){for(;T>=0&&this.tokens[T].channel!==L;)T-=1;return T}getHiddenTokensToRight(T,L){if(L===void 0&&(L=-1),this.lazyInit(),T<0||T>=this.tokens.length)throw T+" not in 0.."+this.tokens.length-1;let I=this.nextTokenOnChannel(T+1,t.DEFAULT_TOKEN_CHANNEL),_=T+1,R=I===-1?this.tokens.length-1:I;return this.filterForChannel(_,R,L)}getHiddenTokensToLeft(T,L){if(L===void 0&&(L=-1),this.lazyInit(),T<0||T>=this.tokens.length)throw T+" not in 0.."+this.tokens.length-1;let I=this.previousTokenOnChannel(T-1,t.DEFAULT_TOKEN_CHANNEL);if(I===T-1)return null;let _=I+1,R=T-1;return this.filterForChannel(_,R,L)}filterForChannel(T,L,I){let _=[];for(let R=T;R<L+1;R++){let $=this.tokens[R];I===-1?$.channel!==t.DEFAULT_TOKEN_CHANNEL&&_.push($):$.channel===I&&_.push($)}return _.length===0?null:_}getSourceName(){return this.tokenSource.getSourceName()}getText(T){this.lazyInit(),this.fill(),T||(T=new x(0,this.tokens.length-1));let L=T.start;L instanceof M&&(L=L.tokenIndex);let I=T.stop;if(I instanceof M&&(I=I.tokenIndex),L===null||I===null||L<0||I<0)return"";I>=this.tokens.length&&(I=this.tokens.length-1);let _="";for(let R=L;R<I+1;R++){let $=this.tokens[R];if($.type===M.EOF)break;_+=$.text}return _}fill(){for(this.lazyInit();this.fetch(1000)===1000;);}}Object.defineProperty(Y4,"size",{get:function(){return this.tokens.length}});class X4 extends Y4{constructor(T,L){super(T),this.channel=L===void 0?M.DEFAULT_CHANNEL:L}adjustSeekIndex(T){return this.nextTokenOnChannel(T,this.channel)}LB(T){if(T===0||this.index-T<0)return null;let L=this.index,I=1;for(;I<=T;)L=this.previousTokenOnChannel(L-1,this.channel),I+=1;return L<0?null:this.tokens[L]}LT(T){if(this.lazyInit(),T===0)return null;if(T<0)return this.LB(-T);let L=this.index,I=1;for(;I<T;)this.sync(L+1)&&(L=this.nextTokenOnChannel(L+1,this.channel)),I+=1;return this.tokens[L]}getNumberOfOnChannelTokens(){let T=0;this.fill();for(let L=0;L<this.tokens.length;L++){let I=this.tokens[L];if(I.channel===this.channel&&(T+=1),I.type===M.EOF)break}return T}}class u3 extends l6{constructor(T){super(),this.parser=T}enterEveryRule(T){console.log("enter "+this.parser.ruleNames[T.ruleIndex]+", LT(1)="+this.parser._input.LT(1).text)}visitTerminal(T){console.log("consume "+T.symbol+" rule "+this.parser.ruleNames[this.parser._ctx.ruleIndex])}exitEveryRule(T){console.log("exit "+this.parser.ruleNames[T.ruleIndex]+", LT(1)="+this.parser._input.LT(1).text)}}class i6 extends s1{constructor(T){super(),this._input=null,this._errHandler=new e1,this._precedenceStack=[],this._precedenceStack.push(0),this._ctx=null,this.buildParseTrees=!0,this._tracer=null,this._parseListeners=null,this._syntaxErrors=0,this.setInputStream(T)}reset(){this._input!==null&&this._input.seek(0),this._errHandler.reset(this),this._ctx=null,this._syntaxErrors=0,this.setTrace(!1),this._precedenceStack=[],this._precedenceStack.push(0),this._interp!==null&&this._interp.reset()}match(T){let L=this.getCurrentToken();return L.type===T?(this._errHandler.reportMatch(this),this.consume()):(L=this._errHandler.recoverInline(this),this.buildParseTrees&&L.tokenIndex===-1&&this._ctx.addErrorNode(L)),L}matchWildcard(){let T=this.getCurrentToken();return T.type>0?(this._errHandler.reportMatch(this),this.consume()):(T=this._errHandler.recoverInline(this),this.buildParseTrees&&T.tokenIndex===-1&&this._ctx.addErrorNode(T)),T}getParseListeners(){return this._parseListeners||[]}addParseListener(T){if(T===null)throw"listener";this._parseListeners===null&&(this._parseListeners=[]),this._parseListeners.push(T)}removeParseListener(T){if(this._parseListeners!==null){let L=this._parseListeners.indexOf(T);L>=0&&this._parseListeners.splice(L,1),this._parseListeners.length===0&&(this._parseListeners=null)}}removeParseListeners(){this._parseListeners=null}triggerEnterRuleEvent(){if(this._parseListeners!==null){let T=this._ctx;this._parseListeners.forEach(function(L){L.enterEveryRule(T),T.enterRule(L)})}}triggerExitRuleEvent(){if(this._parseListeners!==null){let T=this._ctx;this._parseListeners.slice(0).reverse().forEach(function(L){T.exitRule(L),L.exitEveryRule(T)})}}getTokenFactory(){return this._input.tokenSource._factory}setTokenFactory(T){this._input.tokenSource._factory=T}getATNWithBypassAlts(){let T=this.getSerializedATN();if(T===null)throw"The current parser does not support an ATN with bypass alternatives.";let L=this.bypassAltsAtnCache[T];if(L===null){let I=new M1;I.generateRuleBypassTransitions=!0,L=new c6(I).deserialize(T),this.bypassAltsAtnCache[T]=L}return L}getInputStream(){return this.getTokenStream()}setInputStream(T){this.setTokenStream(T)}getTokenStream(){return this._input}setTokenStream(T){this._input=null,this.reset(),this._input=T}get syntaxErrorsCount(){return this._syntaxErrors}getCurrentToken(){return this._input.LT(1)}notifyErrorListeners(T,L,I){I=I||null,(L=L||null)===null&&(L=this.getCurrentToken()),this._syntaxErrors+=1;let{line:_,column:R}=L;this.getErrorListener().syntaxError(this,L,_,R,T,I)}consume(){let T=this.getCurrentToken();T.type!==M.EOF&&this.getInputStream().consume();let L=this._parseListeners!==null&&this._parseListeners.length>0;if(this.buildParseTrees||L){let I;I=this._errHandler.inErrorRecoveryMode(this)?this._ctx.addErrorNode(T):this._ctx.addTokenNode(T),I.invokingState=this.state,L&&this._parseListeners.forEach(function(_){I instanceof n1||I.isErrorNode!==void 0&&I.isErrorNode()?_.visitErrorNode(I):I instanceof y0&&_.visitTerminal(I)})}return T}addContextToParseTree(){this._ctx.parentCtx!==null&&this._ctx.parentCtx.addChild(this._ctx)}enterRule(T,L,I){this.state=L,this._ctx=T,this._ctx.start=this._input.LT(1),this.buildParseTrees&&this.addContextToParseTree(),this.triggerEnterRuleEvent()}exitRule(){this._ctx.stop=this._input.LT(-1),this.triggerExitRuleEvent(),this.state=this._ctx.invokingState,this._ctx=this._ctx.parentCtx}enterOuterAlt(T,L){T.setAltNumber(L),this.buildParseTrees&&this._ctx!==T&&this._ctx.parentCtx!==null&&(this._ctx.parentCtx.removeLastChild(),this._ctx.parentCtx.addChild(T)),this._ctx=T}getPrecedence(){return this._precedenceStack.length===0?-1:this._precedenceStack[this._precedenceStack.length-1]}enterRecursionRule(T,L,I,_){this.state=L,this._precedenceStack.push(_),this._ctx=T,this._ctx.start=this._input.LT(1),this.triggerEnterRuleEvent()}pushNewRecursionContext(T,L,I){let _=this._ctx;_.parentCtx=T,_.invokingState=L,_.stop=this._input.LT(-1),this._ctx=T,this._ctx.start=_.start,this.buildParseTrees&&this._ctx.addChild(_),this.triggerEnterRuleEvent()}unrollRecursionContexts(T){this._precedenceStack.pop(),this._ctx.stop=this._input.LT(-1);let L=this._ctx,I=this.getParseListeners();if(I!==null&&I.length>0)for(;this._ctx!==T;)this.triggerExitRuleEvent(),this._ctx=this._ctx.parentCtx;else this._ctx=T;L.parentCtx=T,this.buildParseTrees&&T!==null&&T.addChild(L)}getInvokingContext(T){let L=this._ctx;for(;L!==null;){if(L.ruleIndex===T)return L;L=L.parentCtx}return null}precpred(T,L){return L>=this._precedenceStack[this._precedenceStack.length-1]}inContext(T){return!1}isExpectedToken(T){let L=this._interp.atn,I=this._ctx,_=L.states[this.state],R=L.nextTokens(_);if(R.contains(T))return!0;if(!R.contains(M.EPSILON))return!1;for(;I!==null&&I.invokingState>=0&&R.contains(M.EPSILON);){let $=L.states[I.invokingState].transitions[0];if(R=L.nextTokens($.followState),R.contains(T))return!0;I=I.parentCtx}return!(!R.contains(M.EPSILON)||T!==M.EOF)}getExpectedTokens(){return this._interp.atn.getExpectedTokens(this.state,this._ctx)}getExpectedTokensWithinCurrentRule(){let T=this._interp.atn,L=T.states[this.state];return T.nextTokens(L)}getRuleIndex(T){let L=this.getRuleIndexMap()[T];return L!==null?L:-1}getRuleInvocationStack(T){(T=T||null)===null&&(T=this._ctx);let L=[];for(;T!==null;){let I=T.ruleIndex;I<0?L.push("n/a"):L.push(this.ruleNames[I]),T=T.parentCtx}return L}getDFAStrings(){return this._interp.decisionToDFA.toString()}dumpDFA(){let T=!1;for(let L=0;L<this._interp.decisionToDFA.length;L++){let I=this._interp.decisionToDFA[L];I.states.length>0&&(T&&console.log(),this.printer.println("Decision "+I.decision+":"),this.printer.print(I.toString(this.literalNames,this.symbolicNames)),T=!0)}}getSourceName(){return this._input.getSourceName()}setTrace(T){T?(this._tracer!==null&&this.removeParseListener(this._tracer),this._tracer=new u3(this),this.addParseListener(this._tracer)):(this.removeParseListener(this._tracer),this._tracer=null)}}i6.bypassAltsAtnCache={};class B4 extends y0{constructor(T){super(),this.parentCtx=null,this.symbol=T}getChild(T){return null}getSymbol(){return this.symbol}getParent(){return this.parentCtx}getPayload(){return this.symbol}getSourceInterval(){if(this.symbol===null)return x.INVALID_INTERVAL;let T=this.symbol.tokenIndex;return new x(T,T)}getChildCount(){return 0}accept(T){return T.visitTerminal(this)}getText(){return this.symbol.text}toString(){return this.symbol.type===M.EOF?"<EOF>":this.symbol.text}}class s2 extends B4{constructor(T){super(T)}isErrorNode(){return!0}accept(T){return T.visitErrorNode(this)}}class r6 extends _1{constructor(T,L){super(T,L),this.children=null,this.start=null,this.stop=null,this.exception=null}copyFrom(T){this.parentCtx=T.parentCtx,this.invokingState=T.invokingState,this.children=null,this.start=T.start,this.stop=T.stop,T.children&&(this.children=[],T.children.map(function(L){L instanceof s2&&(this.children.push(L),L.parentCtx=this)},this))}enterRule(T){}exitRule(T){}addChild(T){return this.children===null&&(this.children=[]),this.children.push(T),T}removeLastChild(){this.children!==null&&this.children.pop()}addTokenNode(T){let L=new B4(T);return this.addChild(L),L.parentCtx=this,L}addErrorNode(T){let L=new s2(T);return this.addChild(L),L.parentCtx=this,L}getChild(T,L){if(L=L||null,this.children===null||T<0||T>=this.children.length)return null;if(L===null)return this.children[T];for(let I=0;I<this.children.length;I++){let _=this.children[I];if(_ instanceof L){if(T===0)return _;T-=1}}return null}getToken(T,L){if(this.children===null||L<0||L>=this.children.length)return null;for(let I=0;I<this.children.length;I++){let _=this.children[I];if(_ instanceof y0&&_.symbol.type===T){if(L===0)return _;L-=1}}return null}getTokens(T){if(this.children===null)return[];{let L=[];for(let I=0;I<this.children.length;I++){let _=this.children[I];_ instanceof y0&&_.symbol.type===T&&L.push(_)}return L}}getTypedRuleContext(T,L){return this.getChild(L,T)}getTypedRuleContexts(T){if(this.children===null)return[];{let L=[];for(let I=0;I<this.children.length;I++){let _=this.children[I];_ instanceof T&&L.push(_)}return L}}getChildCount(){return this.children===null?0:this.children.length}getSourceInterval(){return this.start===null||this.stop===null?x.INVALID_INTERVAL:new x(this.start.tokenIndex,this.stop.tokenIndex)}}_1.EMPTY=new r6;class l0{static DEFAULT_PROGRAM_NAME="default";constructor(T){this.tokens=T,this.programs=new Map}getTokenStream(){return this.tokens}insertAfter(T,L){let I,_=arguments.length>2&&arguments[2]!==void 0?arguments[2]:l0.DEFAULT_PROGRAM_NAME;I=typeof T=="number"?T:T.tokenIndex;let R=this.getProgram(_),$=new a2(this.tokens,I,R.length,L);R.push($)}insertBefore(T,L){let I,_=arguments.length>2&&arguments[2]!==void 0?arguments[2]:l0.DEFAULT_PROGRAM_NAME;I=typeof T=="number"?T:T.tokenIndex;let R=this.getProgram(_),$=new O1(this.tokens,I,R.length,L);R.push($)}replaceSingle(T,L){let I=arguments.length>2&&arguments[2]!==void 0?arguments[2]:l0.DEFAULT_PROGRAM_NAME;this.replace(T,T,L,I)}replace(T,L,I){let _=arguments.length>3&&arguments[3]!==void 0?arguments[3]:l0.DEFAULT_PROGRAM_NAME;if(typeof T!="number"&&(T=T.tokenIndex),typeof L!="number"&&(L=L.tokenIndex),T>L||T<0||L<0||L>=this.tokens.size)throw RangeError(`replace: range invalid: ${T}..${L}(size=${this.tokens.size})`);let R=this.getProgram(_),$=new l1(this.tokens,T,L,R.length,I);R.push($)}delete(T,L){let I=arguments.length>2&&arguments[2]!==void 0?arguments[2]:l0.DEFAULT_PROGRAM_NAME;L===void 0&&(L=T),this.replace(T,L,null,I)}getProgram(T){let L=this.programs.get(T);return L==null&&(L=this.initializeProgram(T)),L}initializeProgram(T){let L=[];return this.programs.set(T,L),L}getText(T){let L,I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l0.DEFAULT_PROGRAM_NAME;L=T instanceof x?T:new x(0,this.tokens.size-1),typeof T=="string"&&(I=T);let _=this.programs.get(I),R=L.start,$=L.stop;if($>this.tokens.size-1&&($=this.tokens.size-1),R<0&&(R=0),_==null||_.length===0)return this.tokens.getText(new x(R,$));let G=[],Q=this.reduceToSingleOperationPerIndex(_),U=R;for(;U<=$&&U<this.tokens.size;){let O=Q.get(U);Q.delete(U);let J=this.tokens.get(U);O==null?(J.type!==M.EOF&&G.push(String(J.text)),U++):U=O.execute(G)}if($===this.tokens.size-1)for(let O of Q.values())O.index>=this.tokens.size-1&&G.push(O.text.toString());return G.join("")}reduceToSingleOperationPerIndex(T){for(let I=0;I<T.length;I++){let _=T[I];if(_==null)continue;if(!(_ instanceof l1))continue;let R=_,$=this.getKindOfOps(T,O1,I);for(let Q of $)Q.index===R.index?(T[Q.instructionIndex]=void 0,R.text=Q.text.toString()+(R.text!=null?R.text.toString():"")):Q.index>R.index&&Q.index<=R.lastIndex&&(T[Q.instructionIndex]=void 0);let G=this.getKindOfOps(T,l1,I);for(let Q of G){if(Q.index>=R.index&&Q.lastIndex<=R.lastIndex){T[Q.instructionIndex]=void 0;continue}let U=Q.lastIndex<R.index||Q.index>R.lastIndex;if(Q.text!=null||R.text!=null||U){if(!U)throw Error(`replace op boundaries of ${R} overlap with previous ${Q}`)}else T[Q.instructionIndex]=void 0,R.index=Math.min(Q.index,R.index),R.lastIndex=Math.max(Q.lastIndex,R.lastIndex)}}for(let I=0;I<T.length;I++){let _=T[I];if(_==null)continue;if(!(_ instanceof O1))continue;let R=_,$=this.getKindOfOps(T,O1,I);for(let Q of $)Q.index===R.index&&(Q instanceof a2?(R.text=this.catOpText(Q.text,R.text),T[Q.instructionIndex]=void 0):Q instanceof O1&&(R.text=this.catOpText(R.text,Q.text),T[Q.instructionIndex]=void 0));let G=this.getKindOfOps(T,l1,I);for(let Q of G)if(R.index!==Q.index){if(R.index>=Q.index&&R.index<=Q.lastIndex)throw Error(`insert op ${R} within boundaries of previous ${Q}`)}else Q.text=this.catOpText(R.text,Q.text),T[I]=void 0}let L=new Map;for(let I of T)if(I!=null){if(L.get(I.index)!=null)throw Error("should only be one op per index");L.set(I.index,I)}return L}catOpText(T,L){let I="",_="";return T!=null&&(I=T.toString()),L!=null&&(_=L.toString()),I+_}getKindOfOps(T,L,I){return T.slice(0,I).filter((_)=>_&&_ instanceof L)}}class z4{constructor(T,L,I,_){this.tokens=T,this.instructionIndex=I,this.index=L,this.text=_===void 0?"":_}toString(){let T=this.constructor.name,L=T.indexOf("$");return T=T.substring(L+1,T.length),"<"+T+"@"+this.tokens.get(this.index)+':"'+this.text+'">'}}class O1 extends z4{constructor(T,L,I,_){super(T,L,I,_)}execute(T){return this.text&&T.push(this.text.toString()),this.tokens.get(this.index).type!==M.EOF&&T.push(String(this.tokens.get(this.index).text)),this.index+1}}class a2 extends O1{constructor(T,L,I,_){super(T,L+1,I,_)}}class l1 extends z4{constructor(T,L,I,_,R){super(T,L,_,R),this.lastIndex=I}execute(T){return this.text&&T.push(this.text.toString()),this.lastIndex+1}toString(){return this.text==null?"<DeleteOp@"+this.tokens.get(this.index)+".."+this.tokens.get(this.lastIndex)+">":"<ReplaceOp@"+this.tokens.get(this.index)+".."+this.tokens.get(this.lastIndex)+':"'+this.text+'">'}}var DL={atn:GL,dfa:QL,context:UL,misc:SL,tree:OL,error:ZL,Token:M,CommonToken:v0,CharStreams:w3,CharStream:I1,InputStream:v6,CommonTokenStream:X4,Lexer:t,Parser:i6,ParserRuleContext:r6,Interval:x,IntervalSet:H0,LL1Analyzer:D1,Utils:WL,TokenStreamRewriter:l0},U0=c.MG,s6=c.fr,o_=c.sR,v_=c.Zo,H4=c.iH,i_=c.rt,g3=c.jB,a6=c.M8,r_=c.$t,s_=c.aq,f3=c.pG,p3=c.eP,a_=c.KU,n_=c.zW,t_=c.IX,e_=c.mY,TR=c.a7,x3=c.JG,c3=c.ay,x0=c.X2,LR=c.WU,m3=c.Uw,IR=c.gw,d3=c.iX,l3=c.re,F=c.Pg,n6=c.tD,_R=c.R$,q=c.Dj,RR=c.m7,$R=c.NZ,GR=c.xo,L0=c.ou,QR=c.qC,UR=c.mD,SR=c.Ay;class t6 extends m3{visitStart;visitStart_script;visitStart_expression;visitStart_comments;visitStatements;visitStatement;visitCompound_statement;visitSimple_statements;visitTrailing_structure_statements;visitSimple_statement;visitCompound_assignment;visitCompound_variable_initialization;visitCompound_name_initialization;visitCompound_tuple_initialization;visitCompound_reassignment;visitCompound_augassignment;visitFunction_declaration;visitParameter_list;visitParameter_definition;visitMethod_declaration;visitMethod_parameter_list;visitMethod_parameter_definition;visitType_declaration;visitField_definitions;visitField_definition;visitEnum_declaration;visitEnum_definitions;visitEnum_definition;visitStructure;visitStructure_statement;visitStructure_expression;visitIf_structure;visitElif_structure;visitIf_tail;visitElse_block;visitFor_structure;visitFor_structure_to;visitFor_structure_in;visitFor_iterator;visitWhile_structure;visitSwitch_structure;visitSwitch_cases;visitSwitch_pattern_case;visitSwitch_default_case;visitLocal_block;visitIndented_local_block;visitInline_local_block;visitSimple_assignment;visitSimple_variable_initialization;visitSimple_name_initialization;visitSimple_tuple_initialization;visitSimple_reassignment;visitSimple_augassignment;visitExpression;visitExpression_statement;visitConditional_expression;visitDisjunction_expression;visitConjunction_expression;visitBitwise_or_expression;visitBitwise_xor_expression;visitBitwise_and_expression;visitEquality_expression;visitEquality_trailing_pair;visitEqual_trailing_pair;visitNot_equal_trailing_pair;visitInequality_expression;visitInequality_trailing_pair;visitLess_than_equal_trailing_pair;visitLess_than_trailing_pair;visitGreater_than_equal_trailing_pair;visitGreater_than_trailing_pair;visitShift_expression;visitShift_op;visitAdditive_expression;visitAdditive_op;visitMultiplicative_expression;visitMultiplicative_op;visitUnary_expression;visitUnary_op;visitPrimary_expression_attribute;visitPrimary_expression_call;visitPrimary_expression_fallback;visitPrimary_expression_subscript;visitArgument_list;visitArgument_definition;visitSubscript_slice;visitAtomic_expression;visitLiteral_expression;visitLiteral_number;visitLiteral_string;visitLiteral_bool;visitLiteral_color;visitGrouped_expression;visitTuple_expression;visitImport_statement;visitBreak_statement;visitContinue_statement;visitVariable_declaration;visitTuple_declaration;visitDeclaration_mode;visitAssignment_target;visitAssignment_target_attribute;visitAssignment_target_subscript;visitAssignment_target_name;visitAssignment_target_group;visitAugassign_op;visitType_specification;visitType_qualifier;visitAttributed_type_name;visitTemplate_spec_suffix;visitArray_type_suffix;visitType_argument_list;visitName;visitName_load;visitName_store;visitComments;visitComment}var b0={kind:"Load"},T6={kind:"Store"},o3={kind:"Var"},V4={kind:"VarIp"},F4={kind:"Add"},v3={kind:"Sub"},q4={kind:"Mult"},i3={kind:"Div"},r3={kind:"Mod"},k4={kind:"UAdd"},s3={kind:"USub"},a3={kind:"Not"},n3={kind:"Invert"},t3={kind:"Eq"},e3={kind:"NotEq"},T8={kind:"Lt"},L8={kind:"LtE"},I8={kind:"Gt"},_8={kind:"GtE"},R8={kind:"And"},$8={kind:"Or"};function G8(T=[],L=[]){return{kind:"Script",body:T,annotations:L}}function Q8(T){return{kind:"Expression",body:T}}function L6(T){return{kind:"Expr",value:T}}function U8(T,L=[]){return{kind:"Call",func:T,args:L}}function M4(T,L=b0){return{kind:"Name",id:T,ctx:L}}function S8(T,L=null){return{kind:"Constant",value:T,kind_lit:L}}function O8(T,L=null){return{kind:"Arg",value:T,name:L}}function E4(T,L,I=b0){return{kind:"Attribute",value:T,attr:L,ctx:I}}function j4(T,L=null,I=b0){return{kind:"Subscript",value:T,slice:L,ctx:I}}function C4(T,L,I){return{kind:"BinOp",left:T,op:L,right:I}}function J8(T,L){return{kind:"UnaryOp",op:T,operand:L}}function N1(T,L,I=null,_=null,R=null,$=[]){return{kind:"Assign",target:T,value:L,type:I,mode:_,export:R,annotations:$}}function P4(T,L){return{kind:"ReAssign",target:T,value:L}}function N4(T,L=[],I=[],_=null,R=null,$=[]){return{kind:"FunctionDef",name:T,args:L,body:I,method:_,export:R,annotations:$}}function Z8(T,L=[],I=null,_=[]){return{kind:"TypeDef",name:T,body:L,export:I,annotations:_}}function W8(T,L=[],I=null,_=[]){return{kind:"EnumDef",name:T,body:L,export:I,annotations:_}}function y4(T,L=null,I=null){return{kind:"Param",name:T,default:L,type:I}}function b4(T,L,I){return{kind:"Compare",left:T,ops:L,comparators:I}}function h4(T,L=[],I=[]){return{kind:"If",test:T,body:L,orelse:I}}function e6(T,L=T6){return{kind:"Tuple",elts:T,ctx:L}}function D8(T,L,I){return{kind:"Conditional",test:T,body:L,orelse:I}}function K8(T,L,I,_,R=null){return{kind:"ForTo",target:T,start:L,end:I,body:_,step:R}}function Y8(T,L,I){return{kind:"ForIn",target:T,iter:L,body:I}}function X8(T,L=[]){return{kind:"While",test:T,body:L}}function B8(T=[],L=null){return{kind:"Switch",cases:T,subject:L}}function w4(T=[],L=null){return{kind:"Case",body:T,pattern:L}}function A4(T,L=[]){return{kind:"BoolOp",op:T,values:L}}function z8(){return{kind:"Break"}}function H8(){return{kind:"Continue"}}function V8(T,L,I,_=null){return{kind:"Import",namespace:T,name:L,version:I,alias:_}}function h(T,L){let I=L.start,_=L.stop??L.start;if(I)T.lineno=I.line,T.col_offset=I.column;if(_){T.end_lineno=_.line;let R=_.text??"";T.end_col_offset=_.column+R.length}}function KL(T){let L=T.replaceAll("_","");if(/^0[xX]/.test(L))return Number.parseInt(L,16);if(/^0[bB]/.test(L))return Number.parseInt(L.slice(2),2);if(/^0[oO]/.test(L))return Number.parseInt(L.slice(2),8);return Number(L)}function YL(T){let L="";for(let I=0;I<T.length;I++){let _=T[I];if(_!=="\\"||I+1>=T.length){L+=_;continue}let R=T[++I];switch(R){case"n":L+=`
10
+ `;break;case"r":L+="\r";break;case"t":L+="\t";break;case"\\":case"'":case'"':L+=R;break;default:L+=R;break}}return L}function XL(T){if(T.startsWith('"""')&&T.endsWith('"""')||T.startsWith("'''")&&T.endsWith("'''"))return T.slice(3,-3);if(T.length>=2){let L=T[0];if((L==='"'||L==="'")&&T.endsWith(L))return YL(T.slice(1,-1))}return T}function s0(T){while(Array.isArray(T)&&T.length===1)T=T[0];if(Array.isArray(T))return T.map(s0);return T}function h0(T){if(T==null||typeof T!=="object")return!1;if(!("symbol"in T))return!1;return T.symbol!=null}function v(T){return T!=null&&typeof T==="object"&&"ruleIndex"in T&&typeof T.ruleIndex==="number"}function F8(T){if(T.kind==="Name"||T.kind==="Attribute"||T.kind==="Subscript")T.ctx=T6;return T}class u4 extends t6{visitChildren(T){let L=T.children??[],I=[];for(let _ of L){if(!v(_))continue;let R=_.accept;if(typeof R!=="function")continue;let $=s0(R.call(_,this));if($!==void 0&&$!==null)I.push($)}if(I.length===0)return;if(I.length===1)return I[0];return I}visitStart_script=(T)=>{let L=T.statements(),I=L?this.visit(L):[];return G8(I)};visitStart_expression=(T)=>{return Q8(this.visit(T.expression()))};visitStatements=(T)=>{let L=[];for(let I of T.statement_list()){let _=s0(this.visit(I));if(Array.isArray(_))L.push(..._);else if(_)L.push(_)}return L};visitStatement=(T)=>{let L=T.compound_statement(),I=T.simple_statements(),_=T.trailing_structure_statements();if(L)return[this.visit(L)];if(I)return this.visit(I);if(_)return this.visit(_);return[]};visitSimple_statements=(T)=>{return T.simple_statement_list().map((L)=>this.visit(L))};visitExpression_statement=(T)=>{let L=L6(this.visit(T.expression()));return h(L,T),L};visitConditional_expression=(T)=>{let L=this.visit(T.disjunction_expression());if(h0(T.QUESTION())){let I=this.visit(T.expression(0)),_=this.visit(T.expression(1)),R=D8(L,I,_);return h(R,T),R}return L};visitDisjunction_expression=(T)=>{let L=T.conjunction_expression_list()??[];if(L.length>1){let I=L.map((R)=>this.visit(R)),_=A4($8,I);return h(_,T),_}return this.visit(L[0])};visitConjunction_expression=(T)=>{let L=T.bitwise_or_expression_list()??[];if(L.length>1){let I=L.map((R)=>this.visit(R)),_=A4(R8,I);return h(_,T),_}return this.visit(L[0])};visitAdditive_expression=(T)=>{if(T.additive_op()){let L=C4(this.visit(T.additive_expression()),this.visit(T.additive_op()),this.visit(T.multiplicative_expression()));return h(L,T),L}return this.visit(T.multiplicative_expression())};visitAdditive_op=(T)=>{if(T.PLUS())return F4;if(T.MINUS())return v3;return F4};visitMultiplicative_expression=(T)=>{if(T.multiplicative_op()){let L=C4(this.visit(T.multiplicative_expression()),this.visit(T.multiplicative_op()),this.visit(T.unary_expression()));return h(L,T),L}return this.visit(T.unary_expression())};visitMultiplicative_op=(T)=>{if(T.STAR())return q4;if(T.SLASH())return i3;if(T.PERCENT())return r3;return q4};visitUnary_expression=(T)=>{if(T.unary_op()){let L=J8(this.visit(T.unary_op()),this.visit(T.unary_expression()));return h(L,T),L}return this.visit(T.primary_expression())};visitUnary_op=(T)=>{if(T.NOT())return a3;if(T.PLUS())return k4;if(T.MINUS())return s3;if(T.TILDE())return n3;return k4};visitPrimary_expression_call=(T)=>{let L=this.visit(T.primary_expression()),I=T.argument_list(),_=v(I)?BL(this.visit(I)):[],R=U8(L,_);return h(R,T),R};visitPrimary_expression_attribute=(T)=>{let L=this.visit(T.primary_expression()),I=this.visit(T.name_load()),_=E4(L,I.id,b0);return h(_,T),_};visitPrimary_expression_subscript=(T)=>{let L=this.visit(T.primary_expression()),I=this.visit(T.subscript_slice()),_=j4(L,I,b0);return h(_,T),_};visitArgument_list=(T)=>{return T.argument_definition_list().map((L)=>this.visit(L))};visitArgument_definition=(T)=>{let L=T.name_store(),I=null;if(v(L)&&h0(T.EQUAL())){let R=this.visit(L);if(typeof R==="string")I=R;else if(HL(R))I=R.id;else{let $=L.getText();I=$.length>0?$:null}}let _=O8(this.visit(T.expression()),I);return h(_,T),_};visitSubscript_slice=(T)=>{let L=T.expression_list().map((_)=>this.visit(_));if(L.length<=1)return L[0];let I=e6(L,b0);return h(I,T),I};visitLiteral_expression=(T)=>{let L=T.getChild(0),I=this.visit(L),_=S8(I);if(h(_,T),v(T.literal_color()))_.kind_lit="#";return _};visitLiteral_number=(T)=>{return KL(T.getText())};visitLiteral_string=(T)=>{return XL(T.getText())};visitLiteral_bool=(T)=>{if(T.TRUE())return!0;if(T.FALSE())return!1;return!1};visitLiteral_color=(T)=>{return T.getText()};visitName=(T)=>{return T.getText()};visitName_load=(T)=>{let L=M4(T.name().getText(),b0);return h(L,T),L};visitName_store=(T)=>{let L=M4(T.name().getText(),T6);return h(L,T),L};visitGrouped_expression=(T)=>{return this.visit(T.expression())};visitTuple_expression=(T)=>{let L=(T.expression_list()??[]).map((_)=>this.visit(_)),I=e6(L,b0);return h(I,T),I};visitType_specification=(T)=>{let L=this.visit(T.attributed_type_name());if(v(T.array_type_suffix())){let I=j4(L,null,b0);h(I,T),I.lineno=L.lineno,I.col_offset=L.col_offset,L=I}return L};visitAttributed_type_name=(T)=>{let L=(T.name_load_list()??[]).map((_)=>this.visit(_));if(L.length===0)return;let I=L[0];for(let _=1;_<L.length;_++){let R=L[_],$=E4(I,R.id,b0);$.lineno=I.lineno,$.col_offset=I.col_offset,$.end_lineno=R.end_lineno??null,$.end_col_offset=R.end_col_offset??null,I=$}return I};visitSimple_name_initialization=(T)=>{let L=this.visit(T.variable_declaration());if(L.value=this.visit(T.expression()),h0(T.EXPORT()))L.export=1;return h(L,T),L};visitCompound_name_initialization=(T)=>{let L=this.visit(T.variable_declaration()),I=T.structure_expression();if(v(I))L.value=this.visit(I);if(h0(T.EXPORT()))L.export=1;return h(L,T),L};visitCompound_tuple_initialization=(T)=>{let L=this.visit(T.tuple_declaration()),I=this.visit(T.structure_expression()),_=N1(L,I);return h(_,T),_};visitCompound_reassignment=(T)=>{let L=F8(this.visit(T.primary_expression())),I=this.visit(T.structure_expression()),_=P4(L,I);return h(_,T),_};visitStructure_expression=(T)=>{return this.visit(T.structure())};visitTrailing_structure_statements=(T)=>{let L=[];for(let $ of T.simple_statement_list()??[]){let G=s0(this.visit($));if(Array.isArray(G))L.push(...G);else if(G)L.push(G)}let I=this.visit(T.structure()),_=L6(I),R=T.structure();if(v(R))h(_,R);else h(_,T);return L.push(_),L};visitSimple_tuple_initialization=(T)=>{let L=this.visit(T.tuple_declaration()),I=this.visit(T.expression()),_=N1(L,I);return h(_,T),_};visitSimple_reassignment=(T)=>{let L=F8(this.visit(T.primary_expression())),I=this.visit(T.expression()),_=P4(L,I);return h(_,T),_};visitVariable_declaration=(T)=>{let L=this.visit(T.name_store()),I=T.type_specification(),_=T.declaration_mode(),R=v(I)?this.visit(I)??null:null,$=v(_)?this.visit(_)??null:null,G=N1(L,null,R,$);return h(G,T),G};visitTuple_declaration=(T)=>{let L=T.name_store_list().map((_)=>this.visit(_)),I=e6(L,T6);return h(I,T),I};visitDeclaration_mode=(T)=>{if(h0(T.VARIP()))return V4;if(h0(T.VAR()))return o3;return};visitFunction_declaration=(T)=>{let L=this.visit(T.name()),I=T.parameter_list(),_=v(I)?q8(this.visit(I)):[],R=V0(this.visit(T.local_block())),$=h0(T.EXPORT())?1:0,G=N4(L,_,R,0,$);return h(G,T),G};visitParameter_list=(T)=>{return T.parameter_definition_list().map((L)=>this.visit(L))};visitParameter_definition=(T)=>{let L=this.visit(T.name_store()),I=T.expression(),_=T.type_specification(),R=v(I)?this.visit(I)??null:null,$=v(_)?this.visit(_)??null:null,G=y4(L.id,R,$);return h(G,T),G};visitMethod_declaration=(T)=>{let L=this.visit(T.name()),I=T.method_parameter_list(),_=v(I)?q8(this.visit(I)):[],R=V0(this.visit(T.local_block())),$=h0(T.EXPORT())?1:0,G=N4(L,_,R,1,$);return h(G,T),G};visitMethod_parameter_list=(T)=>{return T.method_parameter_definition_list().map((L)=>this.visit(L))};visitMethod_parameter_definition=(T)=>{let L=T.type_specification(),I=T.name_store();if(v(L)&&v(I)){let _=this.visit(L)??null,R=this.visit(I),$=y4(R.id,null,_);return h($,T),$}return this.visit(T.parameter_definition())};visitType_declaration=(T)=>{let L=this.visit(T.name()),I=V0(this.visit(T.field_definitions())),_=h0(T.EXPORT())?1:0,R=Z8(L,I,_);return h(R,T),R};visitEnum_declaration=(T)=>{let L=this.visit(T.name()),I=V0(this.visit(T.enum_definitions())),_=h0(T.EXPORT())?1:0,R=W8(L,I,_);return h(R,T),R};visitField_definitions=(T)=>{return T.field_definition_list().map((L)=>this.visit(L))};visitField_definition=(T)=>{let L=this.visit(T.name_store()),I=T.expression(),_=T.type_specification(),R=v(I)?this.visit(I)??null:null,$=v(_)?this.visit(_)??null:null,G=h0(T.VARIP())?V4:null,Q=N1(L,R,$,G);return h(Q,T),Q};visitEnum_definitions=(T)=>{return T.enum_definition_list().map((L)=>this.visit(L))};visitEnum_definition=(T)=>{let L=this.visit(T.name_store()),I=T.expression(),_=v(I)?this.visit(I)??null:null,R=N1(L,_);return h(R,T),R};visitStructure_statement=(T)=>{let L=L6(this.visit(T.structure()));return h(L,T),L};visitIf_structure=(T)=>{let L=this.visit(T.expression()),I=V0(this.visit(T.local_block())),_=T.if_tail(),R=v(_)?V0(this.visit(_)):[],$=h4(L,I,R);return h($,T),$};visitFor_structure=(T)=>{let L=T.for_structure_to();if(v(L))return this.visit(L);let I=T.for_structure_in();if(v(I))return this.visit(I);return this.visitChildren(T)};visitFor_iterator=(T)=>{let L=T.tuple_declaration();if(v(L))return this.visit(L);return this.visit(T.name_store())};visitFor_structure_to=(T)=>{let L=this.visit(T.for_iterator()),I=this.visit(T.expression(0)),_=this.visit(T.expression(1)),R=T.expression(2),$=v(R)?this.visit(R)??null:null,G=V0(this.visit(T.local_block())),Q=K8(L,I,_,G,$);return h(Q,T),Q};visitFor_structure_in=(T)=>{let L=this.visit(T.for_iterator()),I=this.visit(T.expression()),_=V0(this.visit(T.local_block())),R=Y8(L,I,_);return h(R,T),R};visitWhile_structure=(T)=>{let L=this.visit(T.expression()),I=V0(this.visit(T.local_block())),_=X8(L,I);return h(_,T),_};visitSwitch_structure=(T)=>{let L=zL(this.visit(T.switch_cases())),I=T.expression(),_=v(I)?this.visit(I)??null:null,R=B8(L,_);return h(R,T),R};visitSwitch_cases=(T)=>{let L=(T.switch_pattern_case_list()??[]).map((_)=>this.visit(_)),I=T.switch_default_case();if(v(I))L.push(this.visit(I));return L};visitSwitch_pattern_case=(T)=>{let L=V0(this.visit(T.local_block())),I=this.visit(T.expression()),_=w4(L,I);return h(_,T),_};visitSwitch_default_case=(T)=>{let L=V0(this.visit(T.local_block())),I=w4(L,null);return h(I,T),I};visitElif_structure=(T)=>{let L=this.visit(T.expression()),I=V0(this.visit(T.local_block())),_=T.if_tail(),R=v(_)?V0(this.visit(_)):[],$=h4(L,I,R);h($,T);let G=L6($);return h(G,T),[G]};visitIf_tail=(T)=>{let L=T.elif_structure();if(v(L))return this.visit(L);let I=T.else_block();if(v(I))return this.visit(I);return[]};visitElse_block=(T)=>{return this.visit(T.local_block())};visitLocal_block=(T)=>{let L=T.indented_local_block();if(v(L))return this.visit(L);let I=T.inline_local_block();if(v(I))return this.visit(I);return[]};visitIndented_local_block=(T)=>{return this.visit(T.statements())};visitInline_local_block=(T)=>{return V0(this.visit(T.statement()))};visitEquality_expression=(T)=>{let L=this.visit(T.inequality_expression()),I=T.equality_trailing_pair_list()??[];if(I.length===0)return L;let _=[],R=[];for(let G of I){let Q=this.visit(G);_.push(Q[0]),R.push(Q[1])}let $=b4(L,_,R);return h($,T),$};visitEqual_trailing_pair=(T)=>{return[t3,this.visit(T.inequality_expression())]};visitNot_equal_trailing_pair=(T)=>{return[e3,this.visit(T.inequality_expression())]};visitInequality_expression=(T)=>{let L=this.visit(T.shift_expression()),I=T.inequality_trailing_pair_list()??[];if(I.length===0)return L;let _=[],R=[];for(let G of I){let Q=s0(this.visit(G));_.push(Q[0]),R.push(Q[1])}let $=b4(L,_,R);return h($,T),$};visitLess_than_equal_trailing_pair=(T)=>{return[L8,this.visit(T.shift_expression())]};visitLess_than_trailing_pair=(T)=>{return[T8,this.visit(T.shift_expression())]};visitGreater_than_equal_trailing_pair=(T)=>{return[_8,this.visit(T.shift_expression())]};visitGreater_than_trailing_pair=(T)=>{return[I8,this.visit(T.shift_expression())]};visitBreak_statement=(T)=>{let L=z8();return h(L,T),L};visitContinue_statement=(T)=>{let L=H8();return h(L,T),L};visitImport_statement=(T)=>{let L=String(this.visit(T.name(0))??""),I=String(this.visit(T.name(1))??""),_=this.visit(T.literal_number()),R=typeof _==="number"&&Number.isFinite(_)?Math.trunc(_):1,$=T.AS()?T.name(2):void 0,G=$?String(this.visit($)??""):null,Q=V8(L,I,R,G||null);return h(Q,T),Q}}function V0(T){let L=s0(T);if(L==null)return[];if(Array.isArray(L))return L.filter(Boolean);return[L]}function q8(T){let L=s0(T);if(L==null)return[];if(Array.isArray(L))return L.filter(Boolean);return[L]}function BL(T){let L=s0(T);if(L==null)return[];if(Array.isArray(L))return L.filter(Boolean);return[L]}function zL(T){let L=s0(T);if(L==null)return[];if(Array.isArray(L))return L.filter(Boolean);return[L]}function HL(T){return T!=null&&typeof T==="object"&&T.kind==="Name"&&typeof T.id==="string"}function T2(T,L){if(T==null)return"None";if(typeof T==="boolean")return T?"True":"False";if(typeof T==="string")return JSON.stringify(T);if(typeof T==="number")return String(T);if(Array.isArray(T))return`[${T.map((I)=>T2(I,L)).join(", ")}]`;if(typeof T==="object"&&T!==null&&"kind"in T)return g4(T,{annotate_fields:L});return String(T)}var VL=new Set(["kind","lineno","col_offset","end_lineno","end_col_offset","kind_lit"]);function g4(T,L={}){let I=L.annotate_fields!==!1,_=T,R=[];for(let[$,G]of Object.entries(_)){if(VL.has($))continue;if($==="annotations"&&Array.isArray(G)&&G.length===0)continue;if(G===void 0)continue;let Q=T2(G,I);R.push(I?`${$}=${Q}`:Q)}if(T.kind==="Constant"&&_.kind_lit)R.push(I?`kind=${T2(_.kind_lit,I)}`:T2(_.kind_lit,I));return`${T.kind}(${R.join(", ")})`}var k8={Add:"+",Sub:"-",Mult:"*",Div:"/",Mod:"%"},M8={UAdd:"+",USub:"-",Not:"not ",Invert:"~"},FL={Eq:"==",NotEq:"!=",Lt:"<",LtE:"<=",Gt:">",GtE:">="},qL={And:"and",Or:"or"};function kL(T){if(T.includes(`
11
+ `)||T.includes("\r")){if(!T.includes('"""'))return`"""${T}"""`;if(!T.includes("'''"))return`'''${T}'''`}return JSON.stringify(T)}function f(T){switch(T.kind){case"Name":return T.id;case"Constant":return f8(T);case"Call":return x8(T);case"Attribute":return`${f(T.value)}.${T.attr}`;case"Subscript":return`${f(T.value)}[${P8(T.slice)}]`;case"BinOp":return`${f(T.left)} ${k8[T.op.kind]??"?"} ${f(T.right)}`;case"UnaryOp":return`${M8[T.op.kind]??""}${f(T.operand)}`;case"Compare":return E8(T);case"If":return j8(T);case"Tuple":return C8(T);case"Conditional":return N8(T);case"ForTo":return b8(T);case"ForIn":return h8(T);case"While":return w8(T);case"Switch":return u8(T);case"BoolOp":return g8(T)}}function E8(T){let L=f(T.left);for(let I=0;I<T.ops.length;I++)L+=` ${FL[T.ops[I].kind]??"??"} ${f(T.comparators[I])}`;return L}function j8(T){let L=T.body.map(Y1).join("; ");if(T.orelse.length===0)return`if ${f(T.test)}
12
+ ${L}`;let I=T.orelse.map(Y1).join("; ");return`if ${f(T.test)}
13
+ ${L}
14
+ else
15
+ ${I}`}function C8(T){return`[${T.elts.map(f).join(", ")}]`}function P8(T){if(T==null)return"";if(T.kind==="Tuple")return T.elts.map(f).join(", ");return f(T)}function N8(T){return`${f(T.test)} ? ${f(T.body)} : ${f(T.orelse)}`}function y8(T){if(!T.length)return"";let L=T.map(Y1);if(L.length===1&&!L[0].includes(`
16
+ `))return` ${L[0]}`;return L.map((I)=>`
17
+ ${I.replaceAll(`
18
+ `,`
19
+ `)}`).join("")}function b8(T){let L=`for ${f(T.target)} = ${f(T.start)} to ${f(T.end)}`;if(T.step)L+=` by ${f(T.step)}`;return L+y8(T.body)}function h8(T){return`for ${f(T.target)} in ${f(T.iter)}${y8(T.body)}`}function f4(T){if(!T.length)return"";return T.map((L)=>`
20
+ ${Y1(L).replaceAll(`
21
+ `,`
22
+ `)}`).join("")}function w8(T){return`while ${f(T.test)}${f4(T.body)}`}function ML(T){if(!T.length)return"";if(T.length===1&&T[0].kind==="Expr")return` ${f(T[0].value)}`;let L=T.map(Y1);if(L.length===1&&!L[0].includes(`
23
+ `))return` ${L[0]}`;return L.map((I)=>`
24
+ ${I.replaceAll(`
25
+ `,`
26
+ `)}`).join("")}function A8(T){return(T.pattern?`${f(T.pattern)} =>`:"=>")+ML(T.body)}function u8(T){let L=T.subject?`switch ${f(T.subject)}`:"switch";if(!T.cases.length)return L;return L+T.cases.map((I)=>`
27
+ ${A8(I).replaceAll(`
28
+ `,`
29
+ `)}`).join("")}function g8(T){let L=qL[T.op.kind]??"and";return T.values.map(f).join(` ${L} `)}function f8(T){if(T.kind_lit)return String(T.value);let L=T.value;if(L===!0)return"true";if(L===!1)return"false";if(L===null||L===void 0)return"na";if(typeof L==="string")return kL(L);return String(L)}function p8(T){let L=f(T.value);return T.name?`${T.name}=${L}`:L}function EL(T){if(T==null)return[];return Array.isArray(T)?T:[T]}function x8(T){return`${f(T.func)}(${EL(T.args).map(p8).join(", ")})`}function c8(T){let L=`import ${T.namespace}/${T.name}/${T.version}`;return T.alias?`${L} as ${T.alias}`:L}function Y1(T){if(T==null||typeof T!=="object")return"";if(T.kind==="Expr")return f(T.value);if(T.kind==="Assign")return v8(T);if(T.kind==="ReAssign")return i8(T);if(T.kind==="FunctionDef")return o8(T);if(T.kind==="TypeDef")return d8(T);if(T.kind==="EnumDef")return l8(T);if(T.kind==="Import")return c8(T);if(T.kind==="Break")return"break";if(T.kind==="Continue")return"continue";return""}function jL(T){if(T==null)return[];return Array.isArray(T)?T:[T]}function m8(T){let L=T.name;if(T.type)L=`${f(T.type)} ${L}`;if(T.default)L+=`=${f(T.default)}`;return L}function d8(T){let L=[];if(T.export)L.push("export");L.push("type"),L.push(T.name);let I=`${L.join(" ")}${f4(T.body)}`;if(T.annotations.length)return`${T.annotations.join(`
30
+ `)}
31
+ ${I}`;return I}function l8(T){let L=[];if(T.export)L.push("export");L.push("enum"),L.push(T.name);let I=`${L.join(" ")}${f4(T.body)}`;if(T.annotations.length)return`${T.annotations.join(`
32
+ `)}
33
+ ${I}`;return I}function o8(T){let L=[];if(T.export)L.push("export");if(T.method)L.push("method");L.push(`${T.name}(${jL(T.args).map(m8).join(", ")}) =>`);let I=L.join(" "),_=T.body,R;if(_.length===1&&_[0].kind==="Expr")R=`${I} ${f(_[0].value)}`;else if(!_.length)R=I;else R=`${I}${_.map(($)=>`
34
+ ${Y1($).replaceAll(`
35
+ `,`
36
+ `)}`).join("")}`;if(T.annotations.length)return`${T.annotations.join(`
37
+ `)}
38
+ ${R}`;return R}function v8(T){let L=[];if(T.export)L.push("export");if(T.mode)L.push(T.mode.kind==="VarIp"?"varip":"var");if(T.type)L.push(f(T.type));L.push(f(T.target));let I=L.join(" "),_=T.value==null?I:`${I} = ${f(T.value)}`;if(T.annotations.length)return`${T.annotations.join(`
39
+ `)}
40
+ ${_}`;return _}function i8(T){return`${f(T.target)} := ${f(T.value)}`}function r8(T){if(T.kind==="Script"){let L=T,I=[];for(let _ of L.annotations)I.push(_);for(let _ of L.body)I.push(Y1(_));return I.join(`
41
+ `)}if(T.kind==="Expression")return f(T.body);if(T.kind==="Expr")return f(T.value);if(T.kind==="Assign")return v8(T);if(T.kind==="ReAssign")return i8(T);if(T.kind==="FunctionDef")return o8(T);if(T.kind==="TypeDef")return d8(T);if(T.kind==="EnumDef")return l8(T);if(T.kind==="Param")return m8(T);if(T.kind==="Var")return"var";if(T.kind==="VarIp")return"varip";if(T.kind==="Call")return x8(T);if(T.kind==="Name")return T.id;if(T.kind==="Constant")return f8(T);if(T.kind==="Arg")return p8(T);if(T.kind==="Attribute"){let L=T;return`${f(L.value)}.${L.attr}`}if(T.kind==="Subscript"){let L=T;return`${f(L.value)}[${P8(L.slice)}]`}if(T.kind==="BinOp"){let L=T;return`${f(L.left)} ${k8[L.op.kind]??"?"} ${f(L.right)}`}if(T.kind==="UnaryOp"){let L=T;return`${M8[L.op.kind]??""}${f(L.operand)}`}if(T.kind==="Compare")return E8(T);if(T.kind==="If")return j8(T);if(T.kind==="Tuple")return C8(T);if(T.kind==="Conditional")return N8(T);if(T.kind==="ForTo")return b8(T);if(T.kind==="ForIn")return h8(T);if(T.kind==="While")return w8(T);if(T.kind==="Switch")return u8(T);if(T.kind==="Case")return A8(T);if(T.kind==="BoolOp")return g8(T);if(T.kind==="Import")return c8(T);if(T.kind==="Break")return"break";if(T.kind==="Continue")return"continue";return""}var CL=/(\r?\n)+/g,PL=/(\r?\n)(\s)+/g;function s8(T){return T==null?L0.INVALID_TYPE:T.type}class L2 extends x3{static _operator_types=null;_operators;_tabLength=4;_indentLength=4;_currentToken=null;_followingToken=null;_pendingTokens=[];_pendingHead=0;_lastPendingTokenType=0;_lastPendingTokenTypeFromDefaultChannel=0;_numOpens=0;_indentLengthStack=[];_inputStarted=!1;constructor(T){super(T);let L=this.constructor,I=L._operator_types;if(I==null)I=new Set([L.AND,L.COLON,L.COLONEQUAL,L.COMMA,L.EQEQUAL,L.EQUAL,L.GREATER,L.GREATEREQUAL,L.LESS,L.LESSEQUAL,L.MINEQUAL,L.MINUS,L.NOTEQUAL,L.OR,L.PERCENT,L.PERCENTEQUAL,L.PLUS,L.PLUSEQUAL,L.QUESTION,L.SLASH,L.SLASHEQUAL,L.STAR,L.STAREQUAL,L.AMP,L.PIPE,L.CARET,L.LSHIFT,L.RSHIFT,L.TILDE]),L._operator_types=I;this._operators=I}get C(){return this.constructor}_resetInternalStates(){this._currentToken=null,this._followingToken=null,this._pendingTokens=[],this._pendingHead=0,this._lastPendingTokenType=0,this._lastPendingTokenTypeFromDefaultChannel=0,this._numOpens=0,this._indentLengthStack=[],this._inputStarted=!1}nextToken(){return this._checkNextToken(),this._popPendingToken()}_checkNextToken(){if(this._lastPendingTokenType===L0.EOF)return;if(this._setNextInternalTokens(),!this._inputStarted)this._handleStartOfInputIfNecessary();let T=this._currentToken,L=T.type,I=this.C;if(L===I.LPAR||L===I.LSQB)this._numOpens+=1,this._addPendingToken(T);else if(L===I.RPAR||L===I.RSQB)this._numOpens-=1,this._addPendingToken(T);else if(L===I.NEWLINE)this._handleNEWLINEToken();else if(L===I.STRING)this._handleSTRINGToken();else if(L===I.ERROR_TOKEN){let _="token recognition error at: '"+T.text+"'";this._reportLexerError(_,T),this._addPendingToken(T)}else if(L===L0.EOF)this._handleEOFToken();else this._addPendingToken(T)}_setNextInternalTokens(){this._currentToken=this._followingToken==null?super.nextToken():this._followingToken,this._followingToken=this._currentToken.type===L0.EOF?this._currentToken:super.nextToken()}_handleStartOfInputIfNecessary(){if(this._inputStarted)return;this._inputStarted=!0,this._indentLengthStack.push(0);while(this._currentToken.type!==L0.EOF){if(this._currentToken.channel===L0.DEFAULT_CHANNEL)if(this._currentToken.type===this.C.NEWLINE)this._hideAndAddPendingToken(this._currentToken);else{this._checkLeadingIndentIfAny();return}else this._addPendingToken(this._currentToken);this._setNextInternalTokens()}}_checkLeadingIndentIfAny(){if(this._lastPendingTokenType===this.C.WS){let T=this._pendingTokens[this._pendingTokens.length-1];if(this._getIndentationLength(T.text??"")!==0)this._reportLexerError("first statement indented",this._currentToken),this._createAndAddPendingToken(this.C.INDENT,L0.DEFAULT_CHANNEL,"first statement indented",this._currentToken)}}_getIndentationLength(T){let L=0,I=this._tabLength;for(let _ of T)if(_===" ")L+=1;else if(_==="\t")L+=I;else if(_==="\f")L=0;return L}_createAndAddPendingToken(T,L,I,_){let R=_.clone();R.type=T,R.channel=L,R.stop=_.start-1;let $=this.C.symbolicNames??this.getSymbolicNames();R.text=I==null?"<"+String($?.[T]??T)+">":I,this._addPendingToken(R)}_addPendingToken(T){if(this._lastPendingTokenType=T.type,T.channel===L0.DEFAULT_CHANNEL)this._lastPendingTokenTypeFromDefaultChannel=this._lastPendingTokenType;this._pendingTokens.push(T)}_hideAndAddPendingToken(T){T.channel=L0.HIDDEN_CHANNEL,this._addPendingToken(T)}_popPendingToken(){let T=this._pendingTokens[this._pendingHead];if(this._pendingHead+=1,this._pendingHead>32&&this._pendingHead*2>this._pendingTokens.length)this._pendingTokens=this._pendingTokens.slice(this._pendingHead),this._pendingHead=0;return T}_handleNEWLINEToken(){if(this._numOpens>0||this._operators.has(this._lastPendingTokenTypeFromDefaultChannel)){this._hideAndAddPendingToken(this._currentToken);return}let T=this._currentToken,L=s8(this._followingToken),I=L===this.C.WS;if(I)this._setNextInternalTokens(),L=s8(this._followingToken);if(L===this.C.NEWLINE||L===this.C.COMMENT){if(this._hideAndAddPendingToken(T),I)this._addPendingToken(this._currentToken)}else if(I){let _=L===L0.EOF?0:this._getIndentationLength(this._currentToken.text??"");if(_%this._indentLength===0)this._addPendingToken(T),this._addPendingToken(this._currentToken),this._insertIndentOrDedentToken(_);else this._hideAndAddPendingToken(T),this._addPendingToken(this._currentToken)}else this._addPendingToken(T),this._insertIndentOrDedentToken(0)}_insertIndentOrDedentToken(T){let L=this._indentLengthStack[this._indentLengthStack.length-1]??0;if(T>L)this._createAndAddPendingToken(this.C.INDENT,L0.DEFAULT_CHANNEL,null,this._followingToken),this._indentLengthStack.push(T);else while(T<L)if(this._indentLengthStack.pop(),L=this._indentLengthStack[this._indentLengthStack.length-1]??0,T<=L)this._createAndAddPendingToken(this.C.DEDENT,L0.DEFAULT_CHANNEL,null,this._followingToken);else this._reportLexerError("inconsistent dedent",this._followingToken),this._createAndAddPendingToken(this.C.ERROR_TOKEN,L0.DEFAULT_CHANNEL,"inconsistent dedent",this._followingToken)}_handleSTRINGToken(){let T=this._currentToken.text??"";if(T.startsWith('"""')||T.startsWith("'''")){this._addPendingToken(this._currentToken);return}if(!T.includes(`
42
+ `)&&!T.includes("\r")){this._addPendingToken(this._currentToken);return}let L=T.replace(CL,"$1");if(L=L.replace(PL,""),T.length===L.length)this._addPendingToken(this._currentToken);else{let I=this._currentToken.clone();this._currentToken.text=L,this._addPendingToken(this._currentToken),this._hideAndAddPendingToken(I)}}_insertTrailingTokens(){let T=this._lastPendingTokenTypeFromDefaultChannel;if(T!==this.C.NEWLINE&&T!==this.C.DEDENT)this._createAndAddPendingToken(this.C.NEWLINE,L0.DEFAULT_CHANNEL,null,this._followingToken);this._insertIndentOrDedentToken(0)}_handleEOFToken(){if(this._lastPendingTokenTypeFromDefaultChannel>0)this._insertTrailingTokens();this._addPendingToken(this._currentToken)}_reportLexerError(T,L){this.getErrorListener().syntaxError(this,L.type,L.line,L.column,T,void 0)}reset(){this._resetInternalStates(),super.reset()}}class S0 extends L2{static INDENT=1;static DEDENT=2;static AND=3;static AS=4;static BREAK=5;static BY=6;static CONST=7;static CONTINUE=8;static ELSE=9;static ENUM=10;static EXPORT=11;static FALSE=12;static FOR=13;static IF=14;static IMPORT=15;static IN=16;static INPUT=17;static METHOD=18;static NOT=19;static OR=20;static SERIES=21;static SIMPLE=22;static SWITCH=23;static TO=24;static TYPE=25;static TRUE=26;static VAR=27;static VARIP=28;static WHILE=29;static LPAR=30;static RPAR=31;static LSQB=32;static RSQB=33;static LSHIFT=34;static RSHIFT=35;static LESSEQUAL=36;static GREATEREQUAL=37;static EQEQUAL=38;static NOTEQUAL=39;static LESS=40;static GREATER=41;static EQUAL=42;static RARROW=43;static DOT=44;static COMMA=45;static COLON=46;static QUESTION=47;static TILDE=48;static AMP=49;static PIPE=50;static CARET=51;static PLUS=52;static MINUS=53;static STAR=54;static SLASH=55;static PERCENT=56;static PLUSEQUAL=57;static MINEQUAL=58;static STAREQUAL=59;static SLASHEQUAL=60;static PERCENTEQUAL=61;static COLONEQUAL=62;static NAME=63;static NUMBER=64;static STRING=65;static COLOR=66;static NEWLINE=67;static WS=68;static COMMENT=69;static UNICODE_NOISE=70;static ERROR_TOKEN=71;static EOF=L0.EOF;static COMMENT_CHANNEL=2;static channelNames=["DEFAULT_TOKEN_CHANNEL","HIDDEN","COMMENT_CHANNEL"];static literalNames=[null,null,null,"'and'","'as'","'break'","'by'","'const'","'continue'","'else'","'enum'","'export'","'false'","'for'","'if'","'import'","'in'","'input'","'method'","'not'","'or'","'series'","'simple'","'switch'","'to'","'type'","'true'","'var'","'varip'","'while'","'('","')'","'['","']'","'<<'","'>>'","'<='","'>='","'=='","'!='","'<'","'>'","'='","'=>'","'.'","','","':'","'?'","'~'","'&'","'|'","'^'","'+'","'-'","'*'","'/'","'%'","'+='","'-='","'*='","'/='","'%='","':='"];static symbolicNames=[null,"INDENT","DEDENT","AND","AS","BREAK","BY","CONST","CONTINUE","ELSE","ENUM","EXPORT","FALSE","FOR","IF","IMPORT","IN","INPUT","METHOD","NOT","OR","SERIES","SIMPLE","SWITCH","TO","TYPE","TRUE","VAR","VARIP","WHILE","LPAR","RPAR","LSQB","RSQB","LSHIFT","RSHIFT","LESSEQUAL","GREATEREQUAL","EQEQUAL","NOTEQUAL","LESS","GREATER","EQUAL","RARROW","DOT","COMMA","COLON","QUESTION","TILDE","AMP","PIPE","CARET","PLUS","MINUS","STAR","SLASH","PERCENT","PLUSEQUAL","MINEQUAL","STAREQUAL","SLASHEQUAL","PERCENTEQUAL","COLONEQUAL","NAME","NUMBER","STRING","COLOR","NEWLINE","WS","COMMENT","UNICODE_NOISE","ERROR_TOKEN"];static modeNames=["DEFAULT_MODE"];static ruleNames=["AND","AS","BREAK","BY","CONST","CONTINUE","ELSE","ENUM","EXPORT","FALSE","FOR","IF","IMPORT","IN","INPUT","METHOD","NOT","OR","SERIES","SIMPLE","SWITCH","TO","TYPE","TRUE","VAR","VARIP","WHILE","LPAR","RPAR","LSQB","RSQB","LSHIFT","RSHIFT","LESSEQUAL","GREATEREQUAL","EQEQUAL","NOTEQUAL","LESS","GREATER","EQUAL","RARROW","DOT","COMMA","COLON","QUESTION","TILDE","AMP","PIPE","CARET","PLUS","MINUS","STAR","SLASH","PERCENT","PLUSEQUAL","MINEQUAL","STAREQUAL","SLASHEQUAL","PERCENTEQUAL","COLONEQUAL","NAME","NUMBER","STRING","COLOR","NEWLINE","WS","COMMENT","HASH_COMMENT","BACKTICKS","UNICODE_NOISE","ERROR_TOKEN","TRIPLE_DQ_STRING","TRIPLE_SQ_STRING","STRING_LITERAL","SINGLE_QUOTED_STRING","DOUBLE_QUOTED_STRING","STRING_ITEM_FOR_SINGLE_QUOTE","STRING_ITEM_FOR_DOUBLE_QUOTE","STRING_CHAR_NO_SINGLE_QUOTE","STRING_CHAR_NO_DOUBLE_QUOTE","STRING_ESCAPE_SEQ","COLOR_LITERAL","COLOR_LITERAL_RGBA","COLOR_LITERAL_RGB","NUMBER_LITERAL","INTEGER","DEC_INTEGER","BIN_INTEGER","OCT_INTEGER","HEX_INTEGER","NON_ZERO_DIGIT","DIGIT","BIN_DIGIT","OCT_DIGIT","HEX_DIGIT","FLOAT_NUMBER","POINT_FLOAT","EXPONENT_FLOAT","DIGIT_PART","FRACTION","EXPONENT","IMAG_NUMBER","OS_INDEPENDENT_NL","ID_START","ID_CONTINUE"];constructor(T){super(T);this._interp=new c3(this,S0._ATN,S0.DecisionsToDFA,new n6)}get grammarFileName(){return"PinescriptLexer.g4"}get literalNames(){return S0.literalNames}get symbolicNames(){return S0.symbolicNames}get ruleNames(){return S0.ruleNames}get serializedATN(){return S0._serializedATN}get channelNames(){return S0.channelNames}get modeNames(){return S0.modeNames}static _serializedATN=[4,0,71,729,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2,33,7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2,39,7,39,2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45,7,45,2,46,7,46,2,47,7,47,2,48,7,48,2,49,7,49,2,50,7,50,2,51,7,51,2,52,7,52,2,53,7,53,2,54,7,54,2,55,7,55,2,56,7,56,2,57,7,57,2,58,7,58,2,59,7,59,2,60,7,60,2,61,7,61,2,62,7,62,2,63,7,63,2,64,7,64,2,65,7,65,2,66,7,66,2,67,7,67,2,68,7,68,2,69,7,69,2,70,7,70,2,71,7,71,2,72,7,72,2,73,7,73,2,74,7,74,2,75,7,75,2,76,7,76,2,77,7,77,2,78,7,78,2,79,7,79,2,80,7,80,2,81,7,81,2,82,7,82,2,83,7,83,2,84,7,84,2,85,7,85,2,86,7,86,2,87,7,87,2,88,7,88,2,89,7,89,2,90,7,90,2,91,7,91,2,92,7,92,2,93,7,93,2,94,7,94,2,95,7,95,2,96,7,96,2,97,7,97,2,98,7,98,2,99,7,99,2,100,7,100,2,101,7,101,2,102,7,102,2,103,7,103,2,104,7,104,1,0,1,0,1,0,1,0,1,1,1,1,1,1,1,2,1,2,1,2,1,2,1,2,1,2,1,3,1,3,1,3,1,4,1,4,1,4,1,4,1,4,1,4,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,6,1,6,1,6,1,6,1,6,1,7,1,7,1,7,1,7,1,7,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,9,1,9,1,9,1,9,1,9,1,9,1,10,1,10,1,10,1,10,1,11,1,11,1,11,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,13,1,13,1,13,1,14,1,14,1,14,1,14,1,14,1,14,1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,16,1,16,1,16,1,16,1,17,1,17,1,17,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,20,1,20,1,20,1,20,1,20,1,20,1,20,1,21,1,21,1,21,1,22,1,22,1,22,1,22,1,22,1,23,1,23,1,23,1,23,1,23,1,24,1,24,1,24,1,24,1,25,1,25,1,25,1,25,1,25,1,25,1,26,1,26,1,26,1,26,1,26,1,26,1,27,1,27,1,28,1,28,1,29,1,29,1,30,1,30,1,31,1,31,1,31,1,32,1,32,1,32,1,33,1,33,1,33,1,34,1,34,1,34,1,35,1,35,1,35,1,36,1,36,1,36,1,37,1,37,1,38,1,38,1,39,1,39,1,40,1,40,1,40,1,41,1,41,1,42,1,42,1,43,1,43,1,44,1,44,1,45,1,45,1,46,1,46,1,47,1,47,1,48,1,48,1,49,1,49,1,50,1,50,1,51,1,51,1,52,1,52,1,53,1,53,1,54,1,54,1,54,1,55,1,55,1,55,1,56,1,56,1,56,1,57,1,57,1,57,1,58,1,58,1,58,1,59,1,59,1,59,1,60,1,60,5,60,434,8,60,10,60,12,60,437,9,60,1,61,1,61,1,62,1,62,1,63,1,63,1,64,1,64,1,65,4,65,448,8,65,11,65,12,65,449,1,65,1,65,1,66,1,66,1,66,1,66,5,66,458,8,66,10,66,12,66,461,9,66,1,66,1,66,1,67,1,67,1,67,5,67,468,8,67,10,67,12,67,471,9,67,1,67,1,67,5,67,475,8,67,10,67,12,67,478,9,67,3,67,480,8,67,1,67,1,67,1,67,1,68,4,68,486,8,68,11,68,12,68,487,1,68,1,68,1,68,1,69,1,69,1,69,1,69,1,70,1,70,1,71,1,71,1,71,1,71,1,71,1,71,1,71,1,71,1,71,1,71,1,71,5,71,510,8,71,10,71,12,71,513,9,71,1,71,1,71,1,71,1,71,1,71,1,71,1,72,1,72,1,72,1,72,1,72,1,72,1,72,1,72,1,72,1,72,1,72,5,72,532,8,72,10,72,12,72,535,9,72,1,72,1,72,1,72,1,72,1,72,1,72,1,73,1,73,3,73,545,8,73,1,74,1,74,5,74,549,8,74,10,74,12,74,552,9,74,1,74,1,74,1,75,1,75,5,75,558,8,75,10,75,12,75,561,9,75,1,75,1,75,1,76,1,76,3,76,567,8,76,1,77,1,77,3,77,571,8,77,1,78,1,78,1,79,1,79,1,80,1,80,1,80,1,81,1,81,3,81,582,8,81,1,82,1,82,1,82,1,82,1,82,1,82,1,82,1,82,1,82,1,82,1,83,1,83,1,83,1,83,1,83,1,83,1,83,1,83,1,84,1,84,1,84,3,84,605,8,84,1,85,1,85,1,85,1,85,3,85,611,8,85,1,86,1,86,3,86,615,8,86,1,86,5,86,618,8,86,10,86,12,86,621,9,86,1,86,1,86,3,86,625,8,86,1,86,5,86,628,8,86,10,86,12,86,631,9,86,3,86,633,8,86,1,87,1,87,1,87,3,87,638,8,87,1,87,4,87,641,8,87,11,87,12,87,642,1,88,1,88,1,88,3,88,648,8,88,1,88,4,88,651,8,88,11,88,12,88,652,1,89,1,89,1,89,3,89,658,8,89,1,89,4,89,661,8,89,11,89,12,89,662,1,90,1,90,1,91,1,91,1,92,1,92,1,93,1,93,1,94,1,94,3,94,675,8,94,1,95,1,95,3,95,679,8,95,1,96,3,96,682,8,96,1,96,1,96,1,96,1,96,3,96,688,8,96,1,97,1,97,3,97,692,8,97,1,97,1,97,1,98,1,98,3,98,698,8,98,1,98,5,98,701,8,98,10,98,12,98,704,9,98,1,99,1,99,1,99,1,100,1,100,3,100,711,8,100,1,100,1,100,1,101,1,101,3,101,717,8,101,1,101,1,101,1,102,3,102,722,8,102,1,102,1,102,1,103,1,103,1,104,1,104,0,0,105,1,3,3,4,5,5,7,6,9,7,11,8,13,9,15,10,17,11,19,12,21,13,23,14,25,15,27,16,29,17,31,18,33,19,35,20,37,21,39,22,41,23,43,24,45,25,47,26,49,27,51,28,53,29,55,30,57,31,59,32,61,33,63,34,65,35,67,36,69,37,71,38,73,39,75,40,77,41,79,42,81,43,83,44,85,45,87,46,89,47,91,48,93,49,95,50,97,51,99,52,101,53,103,54,105,55,107,56,109,57,111,58,113,59,115,60,117,61,119,62,121,63,123,64,125,65,127,66,129,67,131,68,133,69,135,0,137,0,139,70,141,71,143,0,145,0,147,0,149,0,151,0,153,0,155,0,157,0,159,0,161,0,163,0,165,0,167,0,169,0,171,0,173,0,175,0,177,0,179,0,181,0,183,0,185,0,187,0,189,0,191,0,193,0,195,0,197,0,199,0,201,0,203,0,205,0,207,0,209,0,1,0,20,3,0,9,9,12,12,32,32,2,0,10,10,13,13,5,0,10,10,13,13,48,57,65,70,97,102,7,0,183,183,8211,8212,8216,8217,8220,8221,8226,8226,8592,8595,8656,8659,1,0,34,34,1,0,39,39,2,0,39,39,92,92,2,0,34,34,92,92,2,0,66,66,98,98,2,0,79,79,111,111,2,0,88,88,120,120,1,0,49,57,1,0,48,57,1,0,48,55,2,0,65,70,97,102,2,0,69,69,101,101,2,0,43,43,45,45,2,0,74,74,106,106,660,0,65,90,95,95,97,122,170,170,181,181,186,186,192,214,216,246,248,705,710,721,736,740,748,748,750,750,880,884,886,887,890,893,895,895,902,902,904,906,908,908,910,929,931,1013,1015,1153,1162,1327,1329,1366,1369,1369,1376,1416,1488,1514,1519,1522,1568,1610,1646,1647,1649,1747,1749,1749,1765,1766,1774,1775,1786,1788,1791,1791,1808,1808,1810,1839,1869,1957,1969,1969,1994,2026,2036,2037,2042,2042,2048,2069,2074,2074,2084,2084,2088,2088,2112,2136,2144,2154,2160,2183,2185,2190,2208,2249,2308,2361,2365,2365,2384,2384,2392,2401,2417,2432,2437,2444,2447,2448,2451,2472,2474,2480,2482,2482,2486,2489,2493,2493,2510,2510,2524,2525,2527,2529,2544,2545,2556,2556,2565,2570,2575,2576,2579,2600,2602,2608,2610,2611,2613,2614,2616,2617,2649,2652,2654,2654,2674,2676,2693,2701,2703,2705,2707,2728,2730,2736,2738,2739,2741,2745,2749,2749,2768,2768,2784,2785,2809,2809,2821,2828,2831,2832,2835,2856,2858,2864,2866,2867,2869,2873,2877,2877,2908,2909,2911,2913,2929,2929,2947,2947,2949,2954,2958,2960,2962,2965,2969,2970,2972,2972,2974,2975,2979,2980,2984,2986,2990,3001,3024,3024,3077,3084,3086,3088,3090,3112,3114,3129,3133,3133,3160,3162,3165,3165,3168,3169,3200,3200,3205,3212,3214,3216,3218,3240,3242,3251,3253,3257,3261,3261,3293,3294,3296,3297,3313,3314,3332,3340,3342,3344,3346,3386,3389,3389,3406,3406,3412,3414,3423,3425,3450,3455,3461,3478,3482,3505,3507,3515,3517,3517,3520,3526,3585,3632,3634,3635,3648,3654,3713,3714,3716,3716,3718,3722,3724,3747,3749,3749,3751,3760,3762,3763,3773,3773,3776,3780,3782,3782,3804,3807,3840,3840,3904,3911,3913,3948,3976,3980,4096,4138,4159,4159,4176,4181,4186,4189,4193,4193,4197,4198,4206,4208,4213,4225,4238,4238,4256,4293,4295,4295,4301,4301,4304,4346,4348,4680,4682,4685,4688,4694,4696,4696,4698,4701,4704,4744,4746,4749,4752,4784,4786,4789,4792,4798,4800,4800,4802,4805,4808,4822,4824,4880,4882,4885,4888,4954,4992,5007,5024,5109,5112,5117,5121,5740,5743,5759,5761,5786,5792,5866,5873,5880,5888,5905,5919,5937,5952,5969,5984,5996,5998,6000,6016,6067,6103,6103,6108,6108,6176,6264,6272,6276,6279,6312,6314,6314,6320,6389,6400,6430,6480,6509,6512,6516,6528,6571,6576,6601,6656,6678,6688,6740,6823,6823,6917,6963,6981,6988,7043,7072,7086,7087,7098,7141,7168,7203,7245,7247,7258,7293,7296,7304,7312,7354,7357,7359,7401,7404,7406,7411,7413,7414,7418,7418,7424,7615,7680,7957,7960,7965,7968,8005,8008,8013,8016,8023,8025,8025,8027,8027,8029,8029,8031,8061,8064,8116,8118,8124,8126,8126,8130,8132,8134,8140,8144,8147,8150,8155,8160,8172,8178,8180,8182,8188,8305,8305,8319,8319,8336,8348,8450,8450,8455,8455,8458,8467,8469,8469,8473,8477,8484,8484,8486,8486,8488,8488,8490,8493,8495,8505,8508,8511,8517,8521,8526,8526,8579,8580,11264,11492,11499,11502,11506,11507,11520,11557,11559,11559,11565,11565,11568,11623,11631,11631,11648,11670,11680,11686,11688,11694,11696,11702,11704,11710,11712,11718,11720,11726,11728,11734,11736,11742,11823,11823,12293,12294,12337,12341,12347,12348,12353,12438,12445,12447,12449,12538,12540,12543,12549,12591,12593,12686,12704,12735,12784,12799,13312,19903,19968,42124,42192,42237,42240,42508,42512,42527,42538,42539,42560,42606,42623,42653,42656,42725,42775,42783,42786,42888,42891,42954,42960,42961,42963,42963,42965,42969,42994,43009,43011,43013,43015,43018,43020,43042,43072,43123,43138,43187,43250,43255,43259,43259,43261,43262,43274,43301,43312,43334,43360,43388,43396,43442,43471,43471,43488,43492,43494,43503,43514,43518,43520,43560,43584,43586,43588,43595,43616,43638,43642,43642,43646,43695,43697,43697,43701,43702,43705,43709,43712,43712,43714,43714,43739,43741,43744,43754,43762,43764,43777,43782,43785,43790,43793,43798,43808,43814,43816,43822,43824,43866,43868,43881,43888,44002,44032,55203,55216,55238,55243,55291,63744,64109,64112,64217,64256,64262,64275,64279,64285,64285,64287,64296,64298,64310,64312,64316,64318,64318,64320,64321,64323,64324,64326,64433,64467,64829,64848,64911,64914,64967,65008,65019,65136,65140,65142,65276,65313,65338,65345,65370,65382,65470,65474,65479,65482,65487,65490,65495,65498,65500,65536,65547,65549,65574,65576,65594,65596,65597,65599,65613,65616,65629,65664,65786,66176,66204,66208,66256,66304,66335,66349,66368,66370,66377,66384,66421,66432,66461,66464,66499,66504,66511,66560,66717,66736,66771,66776,66811,66816,66855,66864,66915,66928,66938,66940,66954,66956,66962,66964,66965,66967,66977,66979,66993,66995,67001,67003,67004,67072,67382,67392,67413,67424,67431,67456,67461,67463,67504,67506,67514,67584,67589,67592,67592,67594,67637,67639,67640,67644,67644,67647,67669,67680,67702,67712,67742,67808,67826,67828,67829,67840,67861,67872,67897,67968,68023,68030,68031,68096,68096,68112,68115,68117,68119,68121,68149,68192,68220,68224,68252,68288,68295,68297,68324,68352,68405,68416,68437,68448,68466,68480,68497,68608,68680,68736,68786,68800,68850,68864,68899,69248,69289,69296,69297,69376,69404,69415,69415,69424,69445,69488,69505,69552,69572,69600,69622,69635,69687,69745,69746,69749,69749,69763,69807,69840,69864,69891,69926,69956,69956,69959,69959,69968,70002,70006,70006,70019,70066,70081,70084,70106,70106,70108,70108,70144,70161,70163,70187,70207,70208,70272,70278,70280,70280,70282,70285,70287,70301,70303,70312,70320,70366,70405,70412,70415,70416,70419,70440,70442,70448,70450,70451,70453,70457,70461,70461,70480,70480,70493,70497,70656,70708,70727,70730,70751,70753,70784,70831,70852,70853,70855,70855,71040,71086,71128,71131,71168,71215,71236,71236,71296,71338,71352,71352,71424,71450,71488,71494,71680,71723,71840,71903,71935,71942,71945,71945,71948,71955,71957,71958,71960,71983,71999,71999,72001,72001,72096,72103,72106,72144,72161,72161,72163,72163,72192,72192,72203,72242,72250,72250,72272,72272,72284,72329,72349,72349,72368,72440,72704,72712,72714,72750,72768,72768,72818,72847,72960,72966,72968,72969,72971,73008,73030,73030,73056,73061,73063,73064,73066,73097,73112,73112,73440,73458,73474,73474,73476,73488,73490,73523,73648,73648,73728,74649,74880,75075,77712,77808,77824,78895,78913,78918,82944,83526,92160,92728,92736,92766,92784,92862,92880,92909,92928,92975,92992,92995,93027,93047,93053,93071,93760,93823,93952,94026,94032,94032,94099,94111,94176,94177,94179,94179,94208,100343,100352,101589,101632,101640,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,113664,113770,113776,113788,113792,113800,113808,113817,119808,119892,119894,119964,119966,119967,119970,119970,119973,119974,119977,119980,119982,119993,119995,119995,119997,120003,120005,120069,120071,120074,120077,120084,120086,120092,120094,120121,120123,120126,120128,120132,120134,120134,120138,120144,120146,120485,120488,120512,120514,120538,120540,120570,120572,120596,120598,120628,120630,120654,120656,120686,120688,120712,120714,120744,120746,120770,120772,120779,122624,122654,122661,122666,122928,122989,123136,123180,123191,123197,123214,123214,123536,123565,123584,123627,124112,124139,124896,124902,124904,124907,124909,124910,124912,124926,124928,125124,125184,125251,125259,125259,126464,126467,126469,126495,126497,126498,126500,126500,126503,126503,126505,126514,126516,126519,126521,126521,126523,126523,126530,126530,126535,126535,126537,126537,126539,126539,126541,126543,126545,126546,126548,126548,126551,126551,126553,126553,126555,126555,126557,126557,126559,126559,126561,126562,126564,126564,126567,126570,126572,126578,126580,126583,126585,126588,126590,126590,126592,126601,126603,126619,126625,126627,126629,126633,126635,126651,131072,173791,173824,177977,177984,178205,178208,183969,183984,191456,194560,195101,196608,201546,201552,205743,706,0,48,57,65,90,95,95,97,122,170,170,181,181,186,186,192,214,216,246,248,705,710,721,736,740,748,748,750,750,880,884,886,887,890,893,895,895,902,902,904,906,908,908,910,929,931,1013,1015,1153,1162,1327,1329,1366,1369,1369,1376,1416,1488,1514,1519,1522,1568,1610,1632,1641,1646,1647,1649,1747,1749,1749,1765,1766,1774,1788,1791,1791,1808,1808,1810,1839,1869,1957,1969,1969,1984,2026,2036,2037,2042,2042,2048,2069,2074,2074,2084,2084,2088,2088,2112,2136,2144,2154,2160,2183,2185,2190,2208,2249,2308,2361,2365,2365,2384,2384,2392,2401,2406,2415,2417,2432,2437,2444,2447,2448,2451,2472,2474,2480,2482,2482,2486,2489,2493,2493,2510,2510,2524,2525,2527,2529,2534,2545,2556,2556,2565,2570,2575,2576,2579,2600,2602,2608,2610,2611,2613,2614,2616,2617,2649,2652,2654,2654,2662,2671,2674,2676,2693,2701,2703,2705,2707,2728,2730,2736,2738,2739,2741,2745,2749,2749,2768,2768,2784,2785,2790,2799,2809,2809,2821,2828,2831,2832,2835,2856,2858,2864,2866,2867,2869,2873,2877,2877,2908,2909,2911,2913,2918,2927,2929,2929,2947,2947,2949,2954,2958,2960,2962,2965,2969,2970,2972,2972,2974,2975,2979,2980,2984,2986,2990,3001,3024,3024,3046,3055,3077,3084,3086,3088,3090,3112,3114,3129,3133,3133,3160,3162,3165,3165,3168,3169,3174,3183,3200,3200,3205,3212,3214,3216,3218,3240,3242,3251,3253,3257,3261,3261,3293,3294,3296,3297,3302,3311,3313,3314,3332,3340,3342,3344,3346,3386,3389,3389,3406,3406,3412,3414,3423,3425,3430,3439,3450,3455,3461,3478,3482,3505,3507,3515,3517,3517,3520,3526,3558,3567,3585,3632,3634,3635,3648,3654,3664,3673,3713,3714,3716,3716,3718,3722,3724,3747,3749,3749,3751,3760,3762,3763,3773,3773,3776,3780,3782,3782,3792,3801,3804,3807,3840,3840,3872,3881,3904,3911,3913,3948,3976,3980,4096,4138,4159,4169,4176,4181,4186,4189,4193,4193,4197,4198,4206,4208,4213,4225,4238,4238,4240,4249,4256,4293,4295,4295,4301,4301,4304,4346,4348,4680,4682,4685,4688,4694,4696,4696,4698,4701,4704,4744,4746,4749,4752,4784,4786,4789,4792,4798,4800,4800,4802,4805,4808,4822,4824,4880,4882,4885,4888,4954,4992,5007,5024,5109,5112,5117,5121,5740,5743,5759,5761,5786,5792,5866,5873,5880,5888,5905,5919,5937,5952,5969,5984,5996,5998,6000,6016,6067,6103,6103,6108,6108,6112,6121,6160,6169,6176,6264,6272,6276,6279,6312,6314,6314,6320,6389,6400,6430,6470,6509,6512,6516,6528,6571,6576,6601,6608,6617,6656,6678,6688,6740,6784,6793,6800,6809,6823,6823,6917,6963,6981,6988,6992,7001,7043,7072,7086,7141,7168,7203,7232,7241,7245,7293,7296,7304,7312,7354,7357,7359,7401,7404,7406,7411,7413,7414,7418,7418,7424,7615,7680,7957,7960,7965,7968,8005,8008,8013,8016,8023,8025,8025,8027,8027,8029,8029,8031,8061,8064,8116,8118,8124,8126,8126,8130,8132,8134,8140,8144,8147,8150,8155,8160,8172,8178,8180,8182,8188,8305,8305,8319,8319,8336,8348,8450,8450,8455,8455,8458,8467,8469,8469,8473,8477,8484,8484,8486,8486,8488,8488,8490,8493,8495,8505,8508,8511,8517,8521,8526,8526,8579,8580,11264,11492,11499,11502,11506,11507,11520,11557,11559,11559,11565,11565,11568,11623,11631,11631,11648,11670,11680,11686,11688,11694,11696,11702,11704,11710,11712,11718,11720,11726,11728,11734,11736,11742,11823,11823,12293,12294,12337,12341,12347,12348,12353,12438,12445,12447,12449,12538,12540,12543,12549,12591,12593,12686,12704,12735,12784,12799,13312,19903,19968,42124,42192,42237,42240,42508,42512,42539,42560,42606,42623,42653,42656,42725,42775,42783,42786,42888,42891,42954,42960,42961,42963,42963,42965,42969,42994,43009,43011,43013,43015,43018,43020,43042,43072,43123,43138,43187,43216,43225,43250,43255,43259,43259,43261,43262,43264,43301,43312,43334,43360,43388,43396,43442,43471,43481,43488,43492,43494,43518,43520,43560,43584,43586,43588,43595,43600,43609,43616,43638,43642,43642,43646,43695,43697,43697,43701,43702,43705,43709,43712,43712,43714,43714,43739,43741,43744,43754,43762,43764,43777,43782,43785,43790,43793,43798,43808,43814,43816,43822,43824,43866,43868,43881,43888,44002,44016,44025,44032,55203,55216,55238,55243,55291,63744,64109,64112,64217,64256,64262,64275,64279,64285,64285,64287,64296,64298,64310,64312,64316,64318,64318,64320,64321,64323,64324,64326,64433,64467,64829,64848,64911,64914,64967,65008,65019,65136,65140,65142,65276,65296,65305,65313,65338,65345,65370,65382,65470,65474,65479,65482,65487,65490,65495,65498,65500,65536,65547,65549,65574,65576,65594,65596,65597,65599,65613,65616,65629,65664,65786,66176,66204,66208,66256,66304,66335,66349,66368,66370,66377,66384,66421,66432,66461,66464,66499,66504,66511,66560,66717,66720,66729,66736,66771,66776,66811,66816,66855,66864,66915,66928,66938,66940,66954,66956,66962,66964,66965,66967,66977,66979,66993,66995,67001,67003,67004,67072,67382,67392,67413,67424,67431,67456,67461,67463,67504,67506,67514,67584,67589,67592,67592,67594,67637,67639,67640,67644,67644,67647,67669,67680,67702,67712,67742,67808,67826,67828,67829,67840,67861,67872,67897,67968,68023,68030,68031,68096,68096,68112,68115,68117,68119,68121,68149,68192,68220,68224,68252,68288,68295,68297,68324,68352,68405,68416,68437,68448,68466,68480,68497,68608,68680,68736,68786,68800,68850,68864,68899,68912,68921,69248,69289,69296,69297,69376,69404,69415,69415,69424,69445,69488,69505,69552,69572,69600,69622,69635,69687,69734,69743,69745,69746,69749,69749,69763,69807,69840,69864,69872,69881,69891,69926,69942,69951,69956,69956,69959,69959,69968,70002,70006,70006,70019,70066,70081,70084,70096,70106,70108,70108,70144,70161,70163,70187,70207,70208,70272,70278,70280,70280,70282,70285,70287,70301,70303,70312,70320,70366,70384,70393,70405,70412,70415,70416,70419,70440,70442,70448,70450,70451,70453,70457,70461,70461,70480,70480,70493,70497,70656,70708,70727,70730,70736,70745,70751,70753,70784,70831,70852,70853,70855,70855,70864,70873,71040,71086,71128,71131,71168,71215,71236,71236,71248,71257,71296,71338,71352,71352,71360,71369,71424,71450,71472,71481,71488,71494,71680,71723,71840,71913,71935,71942,71945,71945,71948,71955,71957,71958,71960,71983,71999,71999,72001,72001,72016,72025,72096,72103,72106,72144,72161,72161,72163,72163,72192,72192,72203,72242,72250,72250,72272,72272,72284,72329,72349,72349,72368,72440,72704,72712,72714,72750,72768,72768,72784,72793,72818,72847,72960,72966,72968,72969,72971,73008,73030,73030,73040,73049,73056,73061,73063,73064,73066,73097,73112,73112,73120,73129,73440,73458,73474,73474,73476,73488,73490,73523,73552,73561,73648,73648,73728,74649,74880,75075,77712,77808,77824,78895,78913,78918,82944,83526,92160,92728,92736,92766,92768,92777,92784,92862,92864,92873,92880,92909,92928,92975,92992,92995,93008,93017,93027,93047,93053,93071,93760,93823,93952,94026,94032,94032,94099,94111,94176,94177,94179,94179,94208,100343,100352,101589,101632,101640,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,113664,113770,113776,113788,113792,113800,113808,113817,119808,119892,119894,119964,119966,119967,119970,119970,119973,119974,119977,119980,119982,119993,119995,119995,119997,120003,120005,120069,120071,120074,120077,120084,120086,120092,120094,120121,120123,120126,120128,120132,120134,120134,120138,120144,120146,120485,120488,120512,120514,120538,120540,120570,120572,120596,120598,120628,120630,120654,120656,120686,120688,120712,120714,120744,120746,120770,120772,120779,120782,120831,122624,122654,122661,122666,122928,122989,123136,123180,123191,123197,123200,123209,123214,123214,123536,123565,123584,123627,123632,123641,124112,124139,124144,124153,124896,124902,124904,124907,124909,124910,124912,124926,124928,125124,125184,125251,125259,125259,125264,125273,126464,126467,126469,126495,126497,126498,126500,126500,126503,126503,126505,126514,126516,126519,126521,126521,126523,126523,126530,126530,126535,126535,126537,126537,126539,126539,126541,126543,126545,126546,126548,126548,126551,126551,126553,126553,126555,126555,126557,126557,126559,126559,126561,126562,126564,126564,126567,126570,126572,126578,126580,126583,126585,126588,126590,126590,126592,126601,126603,126619,126625,126627,126629,126633,126635,126651,130032,130041,131072,173791,173824,177977,177984,178205,178208,183969,183984,191456,194560,195101,196608,201546,201552,205743,741,0,1,1,0,0,0,0,3,1,0,0,0,0,5,1,0,0,0,0,7,1,0,0,0,0,9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0,0,0,15,1,0,0,0,0,17,1,0,0,0,0,19,1,0,0,0,0,21,1,0,0,0,0,23,1,0,0,0,0,25,1,0,0,0,0,27,1,0,0,0,0,29,1,0,0,0,0,31,1,0,0,0,0,33,1,0,0,0,0,35,1,0,0,0,0,37,1,0,0,0,0,39,1,0,0,0,0,41,1,0,0,0,0,43,1,0,0,0,0,45,1,0,0,0,0,47,1,0,0,0,0,49,1,0,0,0,0,51,1,0,0,0,0,53,1,0,0,0,0,55,1,0,0,0,0,57,1,0,0,0,0,59,1,0,0,0,0,61,1,0,0,0,0,63,1,0,0,0,0,65,1,0,0,0,0,67,1,0,0,0,0,69,1,0,0,0,0,71,1,0,0,0,0,73,1,0,0,0,0,75,1,0,0,0,0,77,1,0,0,0,0,79,1,0,0,0,0,81,1,0,0,0,0,83,1,0,0,0,0,85,1,0,0,0,0,87,1,0,0,0,0,89,1,0,0,0,0,91,1,0,0,0,0,93,1,0,0,0,0,95,1,0,0,0,0,97,1,0,0,0,0,99,1,0,0,0,0,101,1,0,0,0,0,103,1,0,0,0,0,105,1,0,0,0,0,107,1,0,0,0,0,109,1,0,0,0,0,111,1,0,0,0,0,113,1,0,0,0,0,115,1,0,0,0,0,117,1,0,0,0,0,119,1,0,0,0,0,121,1,0,0,0,0,123,1,0,0,0,0,125,1,0,0,0,0,127,1,0,0,0,0,129,1,0,0,0,0,131,1,0,0,0,0,133,1,0,0,0,0,135,1,0,0,0,0,137,1,0,0,0,0,139,1,0,0,0,0,141,1,0,0,0,0,143,1,0,0,0,0,145,1,0,0,0,1,211,1,0,0,0,3,215,1,0,0,0,5,218,1,0,0,0,7,224,1,0,0,0,9,227,1,0,0,0,11,233,1,0,0,0,13,242,1,0,0,0,15,247,1,0,0,0,17,252,1,0,0,0,19,259,1,0,0,0,21,265,1,0,0,0,23,269,1,0,0,0,25,272,1,0,0,0,27,279,1,0,0,0,29,282,1,0,0,0,31,288,1,0,0,0,33,295,1,0,0,0,35,299,1,0,0,0,37,302,1,0,0,0,39,309,1,0,0,0,41,316,1,0,0,0,43,323,1,0,0,0,45,326,1,0,0,0,47,331,1,0,0,0,49,336,1,0,0,0,51,340,1,0,0,0,53,346,1,0,0,0,55,352,1,0,0,0,57,354,1,0,0,0,59,356,1,0,0,0,61,358,1,0,0,0,63,360,1,0,0,0,65,363,1,0,0,0,67,366,1,0,0,0,69,369,1,0,0,0,71,372,1,0,0,0,73,375,1,0,0,0,75,378,1,0,0,0,77,380,1,0,0,0,79,382,1,0,0,0,81,384,1,0,0,0,83,387,1,0,0,0,85,389,1,0,0,0,87,391,1,0,0,0,89,393,1,0,0,0,91,395,1,0,0,0,93,397,1,0,0,0,95,399,1,0,0,0,97,401,1,0,0,0,99,403,1,0,0,0,101,405,1,0,0,0,103,407,1,0,0,0,105,409,1,0,0,0,107,411,1,0,0,0,109,413,1,0,0,0,111,416,1,0,0,0,113,419,1,0,0,0,115,422,1,0,0,0,117,425,1,0,0,0,119,428,1,0,0,0,121,431,1,0,0,0,123,438,1,0,0,0,125,440,1,0,0,0,127,442,1,0,0,0,129,444,1,0,0,0,131,447,1,0,0,0,133,453,1,0,0,0,135,464,1,0,0,0,137,485,1,0,0,0,139,492,1,0,0,0,141,496,1,0,0,0,143,498,1,0,0,0,145,520,1,0,0,0,147,544,1,0,0,0,149,546,1,0,0,0,151,555,1,0,0,0,153,566,1,0,0,0,155,570,1,0,0,0,157,572,1,0,0,0,159,574,1,0,0,0,161,576,1,0,0,0,163,581,1,0,0,0,165,583,1,0,0,0,167,593,1,0,0,0,169,604,1,0,0,0,171,610,1,0,0,0,173,632,1,0,0,0,175,634,1,0,0,0,177,644,1,0,0,0,179,654,1,0,0,0,181,664,1,0,0,0,183,666,1,0,0,0,185,668,1,0,0,0,187,670,1,0,0,0,189,674,1,0,0,0,191,678,1,0,0,0,193,687,1,0,0,0,195,691,1,0,0,0,197,695,1,0,0,0,199,705,1,0,0,0,201,708,1,0,0,0,203,716,1,0,0,0,205,721,1,0,0,0,207,725,1,0,0,0,209,727,1,0,0,0,211,212,5,97,0,0,212,213,5,110,0,0,213,214,5,100,0,0,214,2,1,0,0,0,215,216,5,97,0,0,216,217,5,115,0,0,217,4,1,0,0,0,218,219,5,98,0,0,219,220,5,114,0,0,220,221,5,101,0,0,221,222,5,97,0,0,222,223,5,107,0,0,223,6,1,0,0,0,224,225,5,98,0,0,225,226,5,121,0,0,226,8,1,0,0,0,227,228,5,99,0,0,228,229,5,111,0,0,229,230,5,110,0,0,230,231,5,115,0,0,231,232,5,116,0,0,232,10,1,0,0,0,233,234,5,99,0,0,234,235,5,111,0,0,235,236,5,110,0,0,236,237,5,116,0,0,237,238,5,105,0,0,238,239,5,110,0,0,239,240,5,117,0,0,240,241,5,101,0,0,241,12,1,0,0,0,242,243,5,101,0,0,243,244,5,108,0,0,244,245,5,115,0,0,245,246,5,101,0,0,246,14,1,0,0,0,247,248,5,101,0,0,248,249,5,110,0,0,249,250,5,117,0,0,250,251,5,109,0,0,251,16,1,0,0,0,252,253,5,101,0,0,253,254,5,120,0,0,254,255,5,112,0,0,255,256,5,111,0,0,256,257,5,114,0,0,257,258,5,116,0,0,258,18,1,0,0,0,259,260,5,102,0,0,260,261,5,97,0,0,261,262,5,108,0,0,262,263,5,115,0,0,263,264,5,101,0,0,264,20,1,0,0,0,265,266,5,102,0,0,266,267,5,111,0,0,267,268,5,114,0,0,268,22,1,0,0,0,269,270,5,105,0,0,270,271,5,102,0,0,271,24,1,0,0,0,272,273,5,105,0,0,273,274,5,109,0,0,274,275,5,112,0,0,275,276,5,111,0,0,276,277,5,114,0,0,277,278,5,116,0,0,278,26,1,0,0,0,279,280,5,105,0,0,280,281,5,110,0,0,281,28,1,0,0,0,282,283,5,105,0,0,283,284,5,110,0,0,284,285,5,112,0,0,285,286,5,117,0,0,286,287,5,116,0,0,287,30,1,0,0,0,288,289,5,109,0,0,289,290,5,101,0,0,290,291,5,116,0,0,291,292,5,104,0,0,292,293,5,111,0,0,293,294,5,100,0,0,294,32,1,0,0,0,295,296,5,110,0,0,296,297,5,111,0,0,297,298,5,116,0,0,298,34,1,0,0,0,299,300,5,111,0,0,300,301,5,114,0,0,301,36,1,0,0,0,302,303,5,115,0,0,303,304,5,101,0,0,304,305,5,114,0,0,305,306,5,105,0,0,306,307,5,101,0,0,307,308,5,115,0,0,308,38,1,0,0,0,309,310,5,115,0,0,310,311,5,105,0,0,311,312,5,109,0,0,312,313,5,112,0,0,313,314,5,108,0,0,314,315,5,101,0,0,315,40,1,0,0,0,316,317,5,115,0,0,317,318,5,119,0,0,318,319,5,105,0,0,319,320,5,116,0,0,320,321,5,99,0,0,321,322,5,104,0,0,322,42,1,0,0,0,323,324,5,116,0,0,324,325,5,111,0,0,325,44,1,0,0,0,326,327,5,116,0,0,327,328,5,121,0,0,328,329,5,112,0,0,329,330,5,101,0,0,330,46,1,0,0,0,331,332,5,116,0,0,332,333,5,114,0,0,333,334,5,117,0,0,334,335,5,101,0,0,335,48,1,0,0,0,336,337,5,118,0,0,337,338,5,97,0,0,338,339,5,114,0,0,339,50,1,0,0,0,340,341,5,118,0,0,341,342,5,97,0,0,342,343,5,114,0,0,343,344,5,105,0,0,344,345,5,112,0,0,345,52,1,0,0,0,346,347,5,119,0,0,347,348,5,104,0,0,348,349,5,105,0,0,349,350,5,108,0,0,350,351,5,101,0,0,351,54,1,0,0,0,352,353,5,40,0,0,353,56,1,0,0,0,354,355,5,41,0,0,355,58,1,0,0,0,356,357,5,91,0,0,357,60,1,0,0,0,358,359,5,93,0,0,359,62,1,0,0,0,360,361,5,60,0,0,361,362,5,60,0,0,362,64,1,0,0,0,363,364,5,62,0,0,364,365,5,62,0,0,365,66,1,0,0,0,366,367,5,60,0,0,367,368,5,61,0,0,368,68,1,0,0,0,369,370,5,62,0,0,370,371,5,61,0,0,371,70,1,0,0,0,372,373,5,61,0,0,373,374,5,61,0,0,374,72,1,0,0,0,375,376,5,33,0,0,376,377,5,61,0,0,377,74,1,0,0,0,378,379,5,60,0,0,379,76,1,0,0,0,380,381,5,62,0,0,381,78,1,0,0,0,382,383,5,61,0,0,383,80,1,0,0,0,384,385,5,61,0,0,385,386,5,62,0,0,386,82,1,0,0,0,387,388,5,46,0,0,388,84,1,0,0,0,389,390,5,44,0,0,390,86,1,0,0,0,391,392,5,58,0,0,392,88,1,0,0,0,393,394,5,63,0,0,394,90,1,0,0,0,395,396,5,126,0,0,396,92,1,0,0,0,397,398,5,38,0,0,398,94,1,0,0,0,399,400,5,124,0,0,400,96,1,0,0,0,401,402,5,94,0,0,402,98,1,0,0,0,403,404,5,43,0,0,404,100,1,0,0,0,405,406,5,45,0,0,406,102,1,0,0,0,407,408,5,42,0,0,408,104,1,0,0,0,409,410,5,47,0,0,410,106,1,0,0,0,411,412,5,37,0,0,412,108,1,0,0,0,413,414,5,43,0,0,414,415,5,61,0,0,415,110,1,0,0,0,416,417,5,45,0,0,417,418,5,61,0,0,418,112,1,0,0,0,419,420,5,42,0,0,420,421,5,61,0,0,421,114,1,0,0,0,422,423,5,47,0,0,423,424,5,61,0,0,424,116,1,0,0,0,425,426,5,37,0,0,426,427,5,61,0,0,427,118,1,0,0,0,428,429,5,58,0,0,429,430,5,61,0,0,430,120,1,0,0,0,431,435,3,207,103,0,432,434,3,209,104,0,433,432,1,0,0,0,434,437,1,0,0,0,435,433,1,0,0,0,435,436,1,0,0,0,436,122,1,0,0,0,437,435,1,0,0,0,438,439,3,169,84,0,439,124,1,0,0,0,440,441,3,147,73,0,441,126,1,0,0,0,442,443,3,163,81,0,443,128,1,0,0,0,444,445,3,205,102,0,445,130,1,0,0,0,446,448,7,0,0,0,447,446,1,0,0,0,448,449,1,0,0,0,449,447,1,0,0,0,449,450,1,0,0,0,450,451,1,0,0,0,451,452,6,65,0,0,452,132,1,0,0,0,453,454,5,47,0,0,454,455,5,47,0,0,455,459,1,0,0,0,456,458,8,1,0,0,457,456,1,0,0,0,458,461,1,0,0,0,459,457,1,0,0,0,459,460,1,0,0,0,460,462,1,0,0,0,461,459,1,0,0,0,462,463,6,66,1,0,463,134,1,0,0,0,464,479,5,35,0,0,465,469,7,0,0,0,466,468,8,1,0,0,467,466,1,0,0,0,468,471,1,0,0,0,469,467,1,0,0,0,469,470,1,0,0,0,470,480,1,0,0,0,471,469,1,0,0,0,472,476,8,2,0,0,473,475,8,1,0,0,474,473,1,0,0,0,475,478,1,0,0,0,476,474,1,0,0,0,476,477,1,0,0,0,477,480,1,0,0,0,478,476,1,0,0,0,479,465,1,0,0,0,479,472,1,0,0,0,480,481,1,0,0,0,481,482,6,67,2,0,482,483,6,67,1,0,483,136,1,0,0,0,484,486,5,96,0,0,485,484,1,0,0,0,486,487,1,0,0,0,487,485,1,0,0,0,487,488,1,0,0,0,488,489,1,0,0,0,489,490,6,68,2,0,490,491,6,68,1,0,491,138,1,0,0,0,492,493,7,3,0,0,493,494,1,0,0,0,494,495,6,69,0,0,495,140,1,0,0,0,496,497,9,0,0,0,497,142,1,0,0,0,498,499,5,34,0,0,499,500,5,34,0,0,500,501,5,34,0,0,501,511,1,0,0,0,502,510,8,4,0,0,503,504,5,34,0,0,504,510,8,4,0,0,505,506,5,34,0,0,506,507,5,34,0,0,507,508,1,0,0,0,508,510,8,4,0,0,509,502,1,0,0,0,509,503,1,0,0,0,509,505,1,0,0,0,510,513,1,0,0,0,511,509,1,0,0,0,511,512,1,0,0,0,512,514,1,0,0,0,513,511,1,0,0,0,514,515,5,34,0,0,515,516,5,34,0,0,516,517,5,34,0,0,517,518,1,0,0,0,518,519,6,71,3,0,519,144,1,0,0,0,520,521,5,39,0,0,521,522,5,39,0,0,522,523,5,39,0,0,523,533,1,0,0,0,524,532,8,5,0,0,525,526,5,39,0,0,526,532,8,5,0,0,527,528,5,39,0,0,528,529,5,39,0,0,529,530,1,0,0,0,530,532,8,5,0,0,531,524,1,0,0,0,531,525,1,0,0,0,531,527,1,0,0,0,532,535,1,0,0,0,533,531,1,0,0,0,533,534,1,0,0,0,534,536,1,0,0,0,535,533,1,0,0,0,536,537,5,39,0,0,537,538,5,39,0,0,538,539,5,39,0,0,539,540,1,0,0,0,540,541,6,72,3,0,541,146,1,0,0,0,542,545,3,149,74,0,543,545,3,151,75,0,544,542,1,0,0,0,544,543,1,0,0,0,545,148,1,0,0,0,546,550,5,39,0,0,547,549,3,153,76,0,548,547,1,0,0,0,549,552,1,0,0,0,550,548,1,0,0,0,550,551,1,0,0,0,551,553,1,0,0,0,552,550,1,0,0,0,553,554,5,39,0,0,554,150,1,0,0,0,555,559,5,34,0,0,556,558,3,155,77,0,557,556,1,0,0,0,558,561,1,0,0,0,559,557,1,0,0,0,559,560,1,0,0,0,560,562,1,0,0,0,561,559,1,0,0,0,562,563,5,34,0,0,563,152,1,0,0,0,564,567,3,157,78,0,565,567,3,161,80,0,566,564,1,0,0,0,566,565,1,0,0,0,567,154,1,0,0,0,568,571,3,159,79,0,569,571,3,161,80,0,570,568,1,0,0,0,570,569,1,0,0,0,571,156,1,0,0,0,572,573,8,6,0,0,573,158,1,0,0,0,574,575,8,7,0,0,575,160,1,0,0,0,576,577,5,92,0,0,577,578,9,0,0,0,578,162,1,0,0,0,579,582,3,165,82,0,580,582,3,167,83,0,581,579,1,0,0,0,581,580,1,0,0,0,582,164,1,0,0,0,583,584,5,35,0,0,584,585,3,189,94,0,585,586,3,189,94,0,586,587,3,189,94,0,587,588,3,189,94,0,588,589,3,189,94,0,589,590,3,189,94,0,590,591,3,189,94,0,591,592,3,189,94,0,592,166,1,0,0,0,593,594,5,35,0,0,594,595,3,189,94,0,595,596,3,189,94,0,596,597,3,189,94,0,597,598,3,189,94,0,598,599,3,189,94,0,599,600,3,189,94,0,600,168,1,0,0,0,601,605,3,171,85,0,602,605,3,191,95,0,603,605,3,203,101,0,604,601,1,0,0,0,604,602,1,0,0,0,604,603,1,0,0,0,605,170,1,0,0,0,606,611,3,173,86,0,607,611,3,175,87,0,608,611,3,177,88,0,609,611,3,179,89,0,610,606,1,0,0,0,610,607,1,0,0,0,610,608,1,0,0,0,610,609,1,0,0,0,611,172,1,0,0,0,612,619,3,181,90,0,613,615,5,95,0,0,614,613,1,0,0,0,614,615,1,0,0,0,615,616,1,0,0,0,616,618,3,183,91,0,617,614,1,0,0,0,618,621,1,0,0,0,619,617,1,0,0,0,619,620,1,0,0,0,620,633,1,0,0,0,621,619,1,0,0,0,622,629,5,48,0,0,623,625,5,95,0,0,624,623,1,0,0,0,624,625,1,0,0,0,625,626,1,0,0,0,626,628,3,183,91,0,627,624,1,0,0,0,628,631,1,0,0,0,629,627,1,0,0,0,629,630,1,0,0,0,630,633,1,0,0,0,631,629,1,0,0,0,632,612,1,0,0,0,632,622,1,0,0,0,633,174,1,0,0,0,634,635,5,48,0,0,635,640,7,8,0,0,636,638,5,95,0,0,637,636,1,0,0,0,637,638,1,0,0,0,638,639,1,0,0,0,639,641,3,185,92,0,640,637,1,0,0,0,641,642,1,0,0,0,642,640,1,0,0,0,642,643,1,0,0,0,643,176,1,0,0,0,644,645,5,48,0,0,645,650,7,9,0,0,646,648,5,95,0,0,647,646,1,0,0,0,647,648,1,0,0,0,648,649,1,0,0,0,649,651,3,187,93,0,650,647,1,0,0,0,651,652,1,0,0,0,652,650,1,0,0,0,652,653,1,0,0,0,653,178,1,0,0,0,654,655,5,48,0,0,655,660,7,10,0,0,656,658,5,95,0,0,657,656,1,0,0,0,657,658,1,0,0,0,658,659,1,0,0,0,659,661,3,189,94,0,660,657,1,0,0,0,661,662,1,0,0,0,662,660,1,0,0,0,662,663,1,0,0,0,663,180,1,0,0,0,664,665,7,11,0,0,665,182,1,0,0,0,666,667,7,12,0,0,667,184,1,0,0,0,668,669,2,48,49,0,669,186,1,0,0,0,670,671,7,13,0,0,671,188,1,0,0,0,672,675,3,183,91,0,673,675,7,14,0,0,674,672,1,0,0,0,674,673,1,0,0,0,675,190,1,0,0,0,676,679,3,193,96,0,677,679,3,195,97,0,678,676,1,0,0,0,678,677,1,0,0,0,679,192,1,0,0,0,680,682,3,197,98,0,681,680,1,0,0,0,681,682,1,0,0,0,682,683,1,0,0,0,683,688,3,199,99,0,684,685,3,197,98,0,685,686,5,46,0,0,686,688,1,0,0,0,687,681,1,0,0,0,687,684,1,0,0,0,688,194,1,0,0,0,689,692,3,197,98,0,690,692,3,193,96,0,691,689,1,0,0,0,691,690,1,0,0,0,692,693,1,0,0,0,693,694,3,201,100,0,694,196,1,0,0,0,695,702,3,183,91,0,696,698,5,95,0,0,697,696,1,0,0,0,697,698,1,0,0,0,698,699,1,0,0,0,699,701,3,183,91,0,700,697,1,0,0,0,701,704,1,0,0,0,702,700,1,0,0,0,702,703,1,0,0,0,703,198,1,0,0,0,704,702,1,0,0,0,705,706,5,46,0,0,706,707,3,197,98,0,707,200,1,0,0,0,708,710,7,15,0,0,709,711,7,16,0,0,710,709,1,0,0,0,710,711,1,0,0,0,711,712,1,0,0,0,712,713,3,197,98,0,713,202,1,0,0,0,714,717,3,191,95,0,715,717,3,197,98,0,716,714,1,0,0,0,716,715,1,0,0,0,717,718,1,0,0,0,718,719,7,17,0,0,719,204,1,0,0,0,720,722,5,13,0,0,721,720,1,0,0,0,721,722,1,0,0,0,722,723,1,0,0,0,723,724,5,10,0,0,724,206,1,0,0,0,725,726,7,18,0,0,726,208,1,0,0,0,727,728,7,19,0,0,728,210,1,0,0,0,41,0,435,449,459,469,476,479,487,509,511,531,533,544,550,559,566,570,581,604,610,614,619,624,629,632,637,642,647,652,657,662,674,678,681,687,691,697,702,710,716,721,4,0,1,0,0,2,0,7,69,0,7,65,0];static __ATN;static get _ATN(){if(!S0.__ATN)S0.__ATN=new s6().deserialize(S0._serializedATN);return S0.__ATN}static DecisionsToDFA=S0._ATN.decisionToState.map((T,L)=>new a6(T,L))}class I2 extends d3{constructor(T){super(T)}isEqualToCurrentTokenText(T){return this.getCurrentToken().text===T}isNotEqualToCurrentTokenText(T){return!this.isEqualToCurrentTokenText(T)}}class S extends I2{static INDENT=1;static DEDENT=2;static AND=3;static AS=4;static BREAK=5;static BY=6;static CONST=7;static CONTINUE=8;static ELSE=9;static ENUM=10;static EXPORT=11;static FALSE=12;static FOR=13;static IF=14;static IMPORT=15;static IN=16;static INPUT=17;static METHOD=18;static NOT=19;static OR=20;static SERIES=21;static SIMPLE=22;static SWITCH=23;static TO=24;static TYPE=25;static TRUE=26;static VAR=27;static VARIP=28;static WHILE=29;static LPAR=30;static RPAR=31;static LSQB=32;static RSQB=33;static LSHIFT=34;static RSHIFT=35;static LESSEQUAL=36;static GREATEREQUAL=37;static EQEQUAL=38;static NOTEQUAL=39;static LESS=40;static GREATER=41;static EQUAL=42;static RARROW=43;static DOT=44;static COMMA=45;static COLON=46;static QUESTION=47;static TILDE=48;static AMP=49;static PIPE=50;static CARET=51;static PLUS=52;static MINUS=53;static STAR=54;static SLASH=55;static PERCENT=56;static PLUSEQUAL=57;static MINEQUAL=58;static STAREQUAL=59;static SLASHEQUAL=60;static PERCENTEQUAL=61;static COLONEQUAL=62;static NAME=63;static NUMBER=64;static STRING=65;static COLOR=66;static NEWLINE=67;static WS=68;static COMMENT=69;static UNICODE_NOISE=70;static ERROR_TOKEN=71;static EOF=L0.EOF;static RULE_start=0;static RULE_start_script=1;static RULE_start_expression=2;static RULE_start_comments=3;static RULE_statements=4;static RULE_statement=5;static RULE_compound_statement=6;static RULE_simple_statements=7;static RULE_trailing_structure_statements=8;static RULE_simple_statement=9;static RULE_compound_assignment=10;static RULE_compound_variable_initialization=11;static RULE_compound_name_initialization=12;static RULE_compound_tuple_initialization=13;static RULE_compound_reassignment=14;static RULE_compound_augassignment=15;static RULE_function_declaration=16;static RULE_parameter_list=17;static RULE_parameter_definition=18;static RULE_method_declaration=19;static RULE_method_parameter_list=20;static RULE_method_parameter_definition=21;static RULE_type_declaration=22;static RULE_field_definitions=23;static RULE_field_definition=24;static RULE_enum_declaration=25;static RULE_enum_definitions=26;static RULE_enum_definition=27;static RULE_structure=28;static RULE_structure_statement=29;static RULE_structure_expression=30;static RULE_if_structure=31;static RULE_elif_structure=32;static RULE_if_tail=33;static RULE_else_block=34;static RULE_for_structure=35;static RULE_for_structure_to=36;static RULE_for_structure_in=37;static RULE_for_iterator=38;static RULE_while_structure=39;static RULE_switch_structure=40;static RULE_switch_cases=41;static RULE_switch_pattern_case=42;static RULE_switch_default_case=43;static RULE_local_block=44;static RULE_indented_local_block=45;static RULE_inline_local_block=46;static RULE_simple_assignment=47;static RULE_simple_variable_initialization=48;static RULE_simple_name_initialization=49;static RULE_simple_tuple_initialization=50;static RULE_simple_reassignment=51;static RULE_simple_augassignment=52;static RULE_expression=53;static RULE_expression_statement=54;static RULE_conditional_expression=55;static RULE_disjunction_expression=56;static RULE_conjunction_expression=57;static RULE_bitwise_or_expression=58;static RULE_bitwise_xor_expression=59;static RULE_bitwise_and_expression=60;static RULE_equality_expression=61;static RULE_equality_trailing_pair=62;static RULE_equal_trailing_pair=63;static RULE_not_equal_trailing_pair=64;static RULE_inequality_expression=65;static RULE_inequality_trailing_pair=66;static RULE_less_than_equal_trailing_pair=67;static RULE_less_than_trailing_pair=68;static RULE_greater_than_equal_trailing_pair=69;static RULE_greater_than_trailing_pair=70;static RULE_shift_expression=71;static RULE_shift_op=72;static RULE_additive_expression=73;static RULE_additive_op=74;static RULE_multiplicative_expression=75;static RULE_multiplicative_op=76;static RULE_unary_expression=77;static RULE_unary_op=78;static RULE_primary_expression=79;static RULE_argument_list=80;static RULE_argument_definition=81;static RULE_subscript_slice=82;static RULE_atomic_expression=83;static RULE_literal_expression=84;static RULE_literal_number=85;static RULE_literal_string=86;static RULE_literal_bool=87;static RULE_literal_color=88;static RULE_grouped_expression=89;static RULE_tuple_expression=90;static RULE_import_statement=91;static RULE_break_statement=92;static RULE_continue_statement=93;static RULE_variable_declaration=94;static RULE_tuple_declaration=95;static RULE_declaration_mode=96;static RULE_assignment_target=97;static RULE_assignment_target_attribute=98;static RULE_assignment_target_subscript=99;static RULE_assignment_target_name=100;static RULE_assignment_target_group=101;static RULE_augassign_op=102;static RULE_type_specification=103;static RULE_type_qualifier=104;static RULE_attributed_type_name=105;static RULE_template_spec_suffix=106;static RULE_array_type_suffix=107;static RULE_type_argument_list=108;static RULE_name=109;static RULE_name_load=110;static RULE_name_store=111;static RULE_comments=112;static RULE_comment=113;static literalNames=[null,null,null,"'and'","'as'","'break'","'by'","'const'","'continue'","'else'","'enum'","'export'","'false'","'for'","'if'","'import'","'in'","'input'","'method'","'not'","'or'","'series'","'simple'","'switch'","'to'","'type'","'true'","'var'","'varip'","'while'","'('","')'","'['","']'","'<<'","'>>'","'<='","'>='","'=='","'!='","'<'","'>'","'='","'=>'","'.'","','","':'","'?'","'~'","'&'","'|'","'^'","'+'","'-'","'*'","'/'","'%'","'+='","'-='","'*='","'/='","'%='","':='"];static symbolicNames=[null,"INDENT","DEDENT","AND","AS","BREAK","BY","CONST","CONTINUE","ELSE","ENUM","EXPORT","FALSE","FOR","IF","IMPORT","IN","INPUT","METHOD","NOT","OR","SERIES","SIMPLE","SWITCH","TO","TYPE","TRUE","VAR","VARIP","WHILE","LPAR","RPAR","LSQB","RSQB","LSHIFT","RSHIFT","LESSEQUAL","GREATEREQUAL","EQEQUAL","NOTEQUAL","LESS","GREATER","EQUAL","RARROW","DOT","COMMA","COLON","QUESTION","TILDE","AMP","PIPE","CARET","PLUS","MINUS","STAR","SLASH","PERCENT","PLUSEQUAL","MINEQUAL","STAREQUAL","SLASHEQUAL","PERCENTEQUAL","COLONEQUAL","NAME","NUMBER","STRING","COLOR","NEWLINE","WS","COMMENT","UNICODE_NOISE","ERROR_TOKEN"];static ruleNames=["start","start_script","start_expression","start_comments","statements","statement","compound_statement","simple_statements","trailing_structure_statements","simple_statement","compound_assignment","compound_variable_initialization","compound_name_initialization","compound_tuple_initialization","compound_reassignment","compound_augassignment","function_declaration","parameter_list","parameter_definition","method_declaration","method_parameter_list","method_parameter_definition","type_declaration","field_definitions","field_definition","enum_declaration","enum_definitions","enum_definition","structure","structure_statement","structure_expression","if_structure","elif_structure","if_tail","else_block","for_structure","for_structure_to","for_structure_in","for_iterator","while_structure","switch_structure","switch_cases","switch_pattern_case","switch_default_case","local_block","indented_local_block","inline_local_block","simple_assignment","simple_variable_initialization","simple_name_initialization","simple_tuple_initialization","simple_reassignment","simple_augassignment","expression","expression_statement","conditional_expression","disjunction_expression","conjunction_expression","bitwise_or_expression","bitwise_xor_expression","bitwise_and_expression","equality_expression","equality_trailing_pair","equal_trailing_pair","not_equal_trailing_pair","inequality_expression","inequality_trailing_pair","less_than_equal_trailing_pair","less_than_trailing_pair","greater_than_equal_trailing_pair","greater_than_trailing_pair","shift_expression","shift_op","additive_expression","additive_op","multiplicative_expression","multiplicative_op","unary_expression","unary_op","primary_expression","argument_list","argument_definition","subscript_slice","atomic_expression","literal_expression","literal_number","literal_string","literal_bool","literal_color","grouped_expression","tuple_expression","import_statement","break_statement","continue_statement","variable_declaration","tuple_declaration","declaration_mode","assignment_target","assignment_target_attribute","assignment_target_subscript","assignment_target_name","assignment_target_group","augassign_op","type_specification","type_qualifier","attributed_type_name","template_spec_suffix","array_type_suffix","type_argument_list","name","name_load","name_store","comments","comment"];get grammarFileName(){return"PinescriptParser.g4"}get literalNames(){return S.literalNames}get symbolicNames(){return S.symbolicNames}get ruleNames(){return S.ruleNames}get serializedATN(){return S._serializedATN}createFailedPredicateException(T,L){return new p3(this,T,L)}constructor(T){super(T);this._interp=new l3(this,S._ATN,S.DecisionsToDFA,new n6)}start(){let T=new a8(this,this._ctx,this.state);this.enterRule(T,0,S.RULE_start);try{this.enterOuterAlt(T,1),this.state=228,this.start_script()}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}start_script(){let T=new p4(this,this._ctx,this.state);this.enterRule(T,2,S.RULE_start_script);let L;try{this.enterOuterAlt(T,1);{if(this.state=231,this._errHandler.sync(this),L=this._input.LA(1),(L-4&-32)===0&&(1<<L-4&402583519)!==0||(L-48&-32)===0&&(1<<L-48&491569)!==0)this.state=230,this.statements();this.state=233,this.match(S.EOF)}}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}start_expression(){let T=new n8(this,this._ctx,this.state);this.enterRule(T,4,S.RULE_start_expression);let L;try{this.enterOuterAlt(T,1);{if(this.state=235,this.expression(),this.state=237,this._errHandler.sync(this),L=this._input.LA(1),L===67)this.state=236,this.match(S.NEWLINE);this.state=239,this.match(S.EOF)}}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}start_comments(){let T=new t8(this,this._ctx,this.state);this.enterRule(T,6,S.RULE_start_comments);let L;try{this.enterOuterAlt(T,1);{if(this.state=242,this._errHandler.sync(this),L=this._input.LA(1),L===69)this.state=241,this.comments();this.state=244,this.match(S.EOF)}}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}statements(){let T=new Z2(this,this._ctx,this.state);this.enterRule(T,8,S.RULE_statements);let L;try{this.enterOuterAlt(T,1);{this.state=247,this._errHandler.sync(this),L=this._input.LA(1);do this.state=246,this.statement(),this.state=249,this._errHandler.sync(this),L=this._input.LA(1);while((L-4&-32)===0&&(1<<L-4&402583519)!==0||(L-48&-32)===0&&(1<<L-48&491569)!==0)}}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}statement(){let T=new I6(this,this._ctx,this.state);this.enterRule(T,10,S.RULE_statement);try{switch(this.state=254,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,4,this._ctx)){case 1:this.enterOuterAlt(T,1),this.state=251,this.compound_statement();break;case 2:this.enterOuterAlt(T,2),this.state=252,this.simple_statements();break;case 3:this.enterOuterAlt(T,3),this.state=253,this.trailing_structure_statements();break}}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}compound_statement(){let T=new x4(this,this._ctx,this.state);this.enterRule(T,12,S.RULE_compound_statement);try{switch(this.state=262,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,5,this._ctx)){case 1:this.enterOuterAlt(T,1),this.state=256,this.compound_assignment();break;case 2:this.enterOuterAlt(T,2),this.state=257,this.type_declaration();break;case 3:this.enterOuterAlt(T,3),this.state=258,this.enum_declaration();break;case 4:this.enterOuterAlt(T,4),this.state=259,this.structure_statement();break;case 5:this.enterOuterAlt(T,5),this.state=260,this.method_declaration();break;case 6:this.enterOuterAlt(T,6),this.state=261,this.function_declaration();break}}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}simple_statements(){let T=new c4(this,this._ctx,this.state);this.enterRule(T,14,S.RULE_simple_statements);let L;try{let I;this.enterOuterAlt(T,1);{this.state=264,this.simple_statement(),this.state=269,this._errHandler.sync(this),I=this._interp.adaptivePredict(this._input,6,this._ctx);while(I!==2&&I!==U0.INVALID_ALT_NUMBER){if(I===1)this.state=265,this.match(S.COMMA),this.state=266,this.simple_statement();this.state=271,this._errHandler.sync(this),I=this._interp.adaptivePredict(this._input,6,this._ctx)}if(this.state=273,this._errHandler.sync(this),L=this._input.LA(1),L===45)this.state=272,this.match(S.COMMA);this.state=275,this.match(S.NEWLINE)}}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}trailing_structure_statements(){let T=new m4(this,this._ctx,this.state);this.enterRule(T,16,S.RULE_trailing_structure_statements);try{let L;this.enterOuterAlt(T,1);{this.state=277,this.simple_statement(),this.state=282,this._errHandler.sync(this),L=this._interp.adaptivePredict(this._input,8,this._ctx);while(L!==2&&L!==U0.INVALID_ALT_NUMBER){if(L===1)this.state=278,this.match(S.COMMA),this.state=279,this.simple_statement();this.state=284,this._errHandler.sync(this),L=this._interp.adaptivePredict(this._input,8,this._ctx)}this.state=285,this.match(S.COMMA),this.state=286,this.structure()}}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}simple_statement(){let T=new y1(this,this._ctx,this.state);this.enterRule(T,18,S.RULE_simple_statement);try{switch(this.state=293,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,9,this._ctx)){case 1:this.enterOuterAlt(T,1),this.state=288,this.simple_assignment();break;case 2:this.enterOuterAlt(T,2),this.state=289,this.expression_statement();break;case 3:this.enterOuterAlt(T,3),this.state=290,this.import_statement();break;case 4:this.enterOuterAlt(T,4),this.state=291,this.break_statement();break;case 5:this.enterOuterAlt(T,5),this.state=292,this.continue_statement();break}}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}compound_assignment(){let T=new d4(this,this._ctx,this.state);this.enterRule(T,20,S.RULE_compound_assignment);try{switch(this.state=298,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,10,this._ctx)){case 1:this.enterOuterAlt(T,1),this.state=295,this.compound_variable_initialization();break;case 2:this.enterOuterAlt(T,2),this.state=296,this.compound_reassignment();break;case 3:this.enterOuterAlt(T,3),this.state=297,this.compound_augassignment();break}}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}compound_variable_initialization(){let T=new l4(this,this._ctx,this.state);this.enterRule(T,22,S.RULE_compound_variable_initialization);try{switch(this.state=302,this._errHandler.sync(this),this._input.LA(1)){case 4:case 6:case 7:case 10:case 11:case 17:case 18:case 21:case 22:case 24:case 25:case 27:case 28:case 63:this.enterOuterAlt(T,1),this.state=300,this.compound_name_initialization();break;case 32:this.enterOuterAlt(T,2),this.state=301,this.compound_tuple_initialization();break;default:throw new x0(this)}}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}compound_name_initialization(){let T=new o4(this,this._ctx,this.state);this.enterRule(T,24,S.RULE_compound_name_initialization);let L;try{this.enterOuterAlt(T,1);{if(this.state=305,this._errHandler.sync(this),L=this._input.LA(1),L===11)this.state=304,this.match(S.EXPORT);this.state=307,this.variable_declaration(),this.state=308,this.match(S.EQUAL),this.state=309,this.structure_expression()}}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}compound_tuple_initialization(){let T=new v4(this,this._ctx,this.state);this.enterRule(T,26,S.RULE_compound_tuple_initialization);try{this.enterOuterAlt(T,1),this.state=311,this.tuple_declaration(),this.state=312,this.match(S.EQUAL),this.state=313,this.structure_expression()}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}compound_reassignment(){let T=new i4(this,this._ctx,this.state);this.enterRule(T,28,S.RULE_compound_reassignment);try{this.enterOuterAlt(T,1),this.state=315,this.primary_expression(0),this.state=316,this.match(S.COLONEQUAL),this.state=317,this.structure_expression()}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}compound_augassignment(){let T=new r4(this,this._ctx,this.state);this.enterRule(T,30,S.RULE_compound_augassignment);try{this.enterOuterAlt(T,1),this.state=319,this.primary_expression(0),this.state=320,this.augassign_op(),this.state=321,this.structure_expression()}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}function_declaration(){let T=new s4(this,this._ctx,this.state);this.enterRule(T,32,S.RULE_function_declaration);let L;try{this.enterOuterAlt(T,1);{if(this.state=324,this._errHandler.sync(this),L=this._input.LA(1),L===11)this.state=323,this.match(S.EXPORT);switch(this.state=327,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,14,this._ctx)){case 1:this.state=326,this.type_specification();break}if(this.state=329,this.name(),this.state=330,this.match(S.LPAR),this.state=332,this._errHandler.sync(this),L=this._input.LA(1),(L&-32)===0&&(1<<L&57017552)!==0||L===63)this.state=331,this.parameter_list();this.state=334,this.match(S.RPAR),this.state=335,this.match(S.RARROW),this.state=336,this.local_block()}}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}parameter_list(){let T=new a4(this,this._ctx,this.state);this.enterRule(T,34,S.RULE_parameter_list);let L;try{let I;this.enterOuterAlt(T,1);{this.state=338,this.parameter_definition(),this.state=343,this._errHandler.sync(this),I=this._interp.adaptivePredict(this._input,16,this._ctx);while(I!==2&&I!==U0.INVALID_ALT_NUMBER){if(I===1)this.state=339,this.match(S.COMMA),this.state=340,this.parameter_definition();this.state=345,this._errHandler.sync(this),I=this._interp.adaptivePredict(this._input,16,this._ctx)}if(this.state=347,this._errHandler.sync(this),L=this._input.LA(1),L===45)this.state=346,this.match(S.COMMA)}}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}parameter_definition(){let T=new _6(this,this._ctx,this.state);this.enterRule(T,36,S.RULE_parameter_definition);let L;try{this.enterOuterAlt(T,1);{switch(this.state=350,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,18,this._ctx)){case 1:this.state=349,this.type_specification();break}if(this.state=352,this.name_store(),this.state=355,this._errHandler.sync(this),L=this._input.LA(1),L===42)this.state=353,this.match(S.EQUAL),this.state=354,this.expression()}}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}method_declaration(){let T=new n4(this,this._ctx,this.state);this.enterRule(T,38,S.RULE_method_declaration);let L;try{this.enterOuterAlt(T,1);{if(this.state=358,this._errHandler.sync(this),L=this._input.LA(1),L===11)this.state=357,this.match(S.EXPORT);switch(this.state=360,this.match(S.METHOD),this.state=362,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,21,this._ctx)){case 1:this.state=361,this.type_specification();break}if(this.state=364,this.name(),this.state=365,this.match(S.LPAR),this.state=367,this._errHandler.sync(this),L=this._input.LA(1),(L&-32)===0&&(1<<L&57017552)!==0||L===63)this.state=366,this.method_parameter_list();this.state=369,this.match(S.RPAR),this.state=370,this.match(S.RARROW),this.state=371,this.local_block()}}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}method_parameter_list(){let T=new t4(this,this._ctx,this.state);this.enterRule(T,40,S.RULE_method_parameter_list);let L;try{let I;this.enterOuterAlt(T,1);{this.state=373,this.method_parameter_definition(),this.state=378,this._errHandler.sync(this),I=this._interp.adaptivePredict(this._input,23,this._ctx);while(I!==2&&I!==U0.INVALID_ALT_NUMBER){if(I===1)this.state=374,this.match(S.COMMA),this.state=375,this.method_parameter_definition();this.state=380,this._errHandler.sync(this),I=this._interp.adaptivePredict(this._input,23,this._ctx)}if(this.state=382,this._errHandler.sync(this),L=this._input.LA(1),L===45)this.state=381,this.match(S.COMMA)}}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}method_parameter_definition(){let T=new _2(this,this._ctx,this.state);this.enterRule(T,42,S.RULE_method_parameter_definition);try{switch(this.state=388,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,25,this._ctx)){case 1:this.enterOuterAlt(T,1),this.state=384,this.type_specification(),this.state=385,this.name_store();break;case 2:this.enterOuterAlt(T,2),this.state=387,this.parameter_definition();break}}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}type_declaration(){let T=new e4(this,this._ctx,this.state);this.enterRule(T,44,S.RULE_type_declaration);let L;try{this.enterOuterAlt(T,1);{if(this.state=391,this._errHandler.sync(this),L=this._input.LA(1),L===11)this.state=390,this.match(S.EXPORT);this.state=393,this.match(S.TYPE),this.state=394,this.name(),this.state=395,this.match(S.NEWLINE),this.state=396,this.match(S.INDENT),this.state=397,this.field_definitions(),this.state=398,this.match(S.DEDENT)}}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}field_definitions(){let T=new T7(this,this._ctx,this.state);this.enterRule(T,46,S.RULE_field_definitions);let L;try{this.enterOuterAlt(T,1);{this.state=401,this._errHandler.sync(this),L=this._input.LA(1);do this.state=400,this.field_definition(),this.state=403,this._errHandler.sync(this),L=this._input.LA(1);while((L&-32)===0&&(1<<L&325453008)!==0||L===63)}}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}field_definition(){let T=new R2(this,this._ctx,this.state);this.enterRule(T,48,S.RULE_field_definition);let L;try{this.enterOuterAlt(T,1);{if(this.state=406,this._errHandler.sync(this),L=this._input.LA(1),L===28)this.state=405,this.match(S.VARIP);if(this.state=408,this.type_specification(),this.state=409,this.name_store(),this.state=412,this._errHandler.sync(this),L=this._input.LA(1),L===42)this.state=410,this.match(S.EQUAL),this.state=411,this.expression();this.state=414,this.match(S.NEWLINE)}}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}enum_declaration(){let T=new L7(this,this._ctx,this.state);this.enterRule(T,50,S.RULE_enum_declaration);let L;try{this.enterOuterAlt(T,1);{if(this.state=417,this._errHandler.sync(this),L=this._input.LA(1),L===11)this.state=416,this.match(S.EXPORT);this.state=419,this.match(S.ENUM),this.state=420,this.name(),this.state=421,this.match(S.NEWLINE),this.state=422,this.match(S.INDENT),this.state=423,this.enum_definitions(),this.state=424,this.match(S.DEDENT)}}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}enum_definitions(){let T=new I7(this,this._ctx,this.state);this.enterRule(T,52,S.RULE_enum_definitions);let L;try{this.enterOuterAlt(T,1);{this.state=427,this._errHandler.sync(this),L=this._input.LA(1);do this.state=426,this.enum_definition(),this.state=429,this._errHandler.sync(this),L=this._input.LA(1);while((L&-32)===0&&(1<<L&57017552)!==0||L===63)}}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}enum_definition(){let T=new $2(this,this._ctx,this.state);this.enterRule(T,54,S.RULE_enum_definition);let L;try{this.enterOuterAlt(T,1);{if(this.state=431,this.name_store(),this.state=434,this._errHandler.sync(this),L=this._input.LA(1),L===42)this.state=432,this.match(S.EQUAL),this.state=433,this.expression();this.state=436,this.match(S.NEWLINE)}}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}structure(){let T=new U6(this,this._ctx,this.state);this.enterRule(T,56,S.RULE_structure);try{switch(this.state=442,this._errHandler.sync(this),this._input.LA(1)){case 14:this.enterOuterAlt(T,1),this.state=438,this.if_structure();break;case 13:this.enterOuterAlt(T,2),this.state=439,this.for_structure();break;case 29:this.enterOuterAlt(T,3),this.state=440,this.while_structure();break;case 23:this.enterOuterAlt(T,4),this.state=441,this.switch_structure();break;default:throw new x0(this)}}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}structure_statement(){let T=new _7(this,this._ctx,this.state);this.enterRule(T,58,S.RULE_structure_statement);try{this.enterOuterAlt(T,1),this.state=444,this.structure()}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}structure_expression(){let T=new w1(this,this._ctx,this.state);this.enterRule(T,60,S.RULE_structure_expression);try{this.enterOuterAlt(T,1),this.state=446,this.structure()}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}if_structure(){let T=new R7(this,this._ctx,this.state);this.enterRule(T,62,S.RULE_if_structure);try{switch(this.enterOuterAlt(T,1),this.state=448,this.match(S.IF),this.state=449,this.expression(),this.state=450,this.local_block(),this.state=452,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,34,this._ctx)){case 1:this.state=451,this.if_tail();break}}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}elif_structure(){let T=new $7(this,this._ctx,this.state);this.enterRule(T,64,S.RULE_elif_structure);try{switch(this.enterOuterAlt(T,1),this.state=454,this.match(S.ELSE),this.state=455,this.match(S.IF),this.state=456,this.expression(),this.state=457,this.local_block(),this.state=459,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,35,this._ctx)){case 1:this.state=458,this.if_tail();break}}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}if_tail(){let T=new W2(this,this._ctx,this.state);this.enterRule(T,66,S.RULE_if_tail);try{switch(this.state=463,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,36,this._ctx)){case 1:this.enterOuterAlt(T,1),this.state=461,this.elif_structure();break;case 2:this.enterOuterAlt(T,2),this.state=462,this.else_block();break}}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}else_block(){let T=new G7(this,this._ctx,this.state);this.enterRule(T,68,S.RULE_else_block);try{this.enterOuterAlt(T,1),this.state=465,this.match(S.ELSE),this.state=466,this.local_block()}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}for_structure(){let T=new Q7(this,this._ctx,this.state);this.enterRule(T,70,S.RULE_for_structure);try{switch(this.state=470,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,37,this._ctx)){case 1:this.enterOuterAlt(T,1),this.state=468,this.for_structure_to();break;case 2:this.enterOuterAlt(T,2),this.state=469,this.for_structure_in();break}}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}for_structure_to(){let T=new U7(this,this._ctx,this.state);this.enterRule(T,72,S.RULE_for_structure_to);try{this.enterOuterAlt(T,1);{switch(this.state=472,this.match(S.FOR),this.state=473,this.for_iterator(),this.state=474,this.match(S.EQUAL),this.state=475,this.expression(),this.state=476,this.match(S.TO),this.state=477,this.expression(),this.state=480,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,38,this._ctx)){case 1:this.state=478,this.match(S.BY),this.state=479,this.expression();break}this.state=482,this.local_block()}}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}for_structure_in(){let T=new S7(this,this._ctx,this.state);this.enterRule(T,74,S.RULE_for_structure_in);try{this.enterOuterAlt(T,1),this.state=484,this.match(S.FOR),this.state=485,this.for_iterator(),this.state=486,this.match(S.IN),this.state=487,this.expression(),this.state=488,this.local_block()}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}for_iterator(){let T=new D2(this,this._ctx,this.state);this.enterRule(T,76,S.RULE_for_iterator);try{switch(this.state=495,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,39,this._ctx)){case 1:this.enterOuterAlt(T,1),this.state=490,this.type_specification(),this.state=491,this.name_store();break;case 2:this.enterOuterAlt(T,2),this.state=493,this.name_store();break;case 3:this.enterOuterAlt(T,3),this.state=494,this.tuple_declaration();break}}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}while_structure(){let T=new O7(this,this._ctx,this.state);this.enterRule(T,78,S.RULE_while_structure);try{this.enterOuterAlt(T,1),this.state=497,this.match(S.WHILE),this.state=498,this.expression(),this.state=499,this.local_block()}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}switch_structure(){let T=new J7(this,this._ctx,this.state);this.enterRule(T,80,S.RULE_switch_structure);let L;try{this.enterOuterAlt(T,1);{if(this.state=501,this.match(S.SWITCH),this.state=503,this._errHandler.sync(this),L=this._input.LA(1),(L-4&-32)===0&&(1<<L-4&343335245)!==0||(L-48&-32)===0&&(1<<L-48&491569)!==0)this.state=502,this.expression();this.state=505,this.match(S.NEWLINE),this.state=506,this.match(S.INDENT),this.state=507,this.switch_cases(),this.state=508,this.match(S.DEDENT)}}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}switch_cases(){let T=new Z7(this,this._ctx,this.state);this.enterRule(T,82,S.RULE_switch_cases);let L;try{this.enterOuterAlt(T,1);{this.state=511,this._errHandler.sync(this),L=this._input.LA(1);do this.state=510,this.switch_pattern_case(),this.state=513,this._errHandler.sync(this),L=this._input.LA(1);while((L-4&-32)===0&&(1<<L-4&343335245)!==0||(L-48&-32)===0&&(1<<L-48&491569)!==0);if(this.state=516,this._errHandler.sync(this),L=this._input.LA(1),L===43)this.state=515,this.switch_default_case()}}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}switch_pattern_case(){let T=new G2(this,this._ctx,this.state);this.enterRule(T,84,S.RULE_switch_pattern_case);try{this.enterOuterAlt(T,1),this.state=518,this.expression(),this.state=519,this.match(S.RARROW),this.state=520,this.local_block()}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}switch_default_case(){let T=new W7(this,this._ctx,this.state);this.enterRule(T,86,S.RULE_switch_default_case);try{this.enterOuterAlt(T,1),this.state=522,this.match(S.RARROW),this.state=523,this.local_block()}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}local_block(){let T=new C0(this,this._ctx,this.state);this.enterRule(T,88,S.RULE_local_block);try{switch(this.state=527,this._errHandler.sync(this),this._input.LA(1)){case 67:this.enterOuterAlt(T,1),this.state=525,this.indented_local_block();break;case 4:case 5:case 6:case 7:case 8:case 10:case 11:case 12:case 13:case 14:case 15:case 17:case 18:case 19:case 21:case 22:case 23:case 24:case 25:case 26:case 27:case 28:case 29:case 30:case 32:case 48:case 52:case 53:case 63:case 64:case 65:case 66:this.enterOuterAlt(T,2),this.state=526,this.inline_local_block();break;default:throw new x0(this)}}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}indented_local_block(){let T=new D7(this,this._ctx,this.state);this.enterRule(T,90,S.RULE_indented_local_block);try{this.enterOuterAlt(T,1),this.state=529,this.match(S.NEWLINE),this.state=530,this.match(S.INDENT),this.state=531,this.statements(),this.state=532,this.match(S.DEDENT)}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}inline_local_block(){let T=new K7(this,this._ctx,this.state);this.enterRule(T,92,S.RULE_inline_local_block);try{this.enterOuterAlt(T,1),this.state=534,this.statement()}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}simple_assignment(){let T=new Y7(this,this._ctx,this.state);this.enterRule(T,94,S.RULE_simple_assignment);try{switch(this.state=539,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,44,this._ctx)){case 1:this.enterOuterAlt(T,1),this.state=536,this.simple_variable_initialization();break;case 2:this.enterOuterAlt(T,2),this.state=537,this.simple_reassignment();break;case 3:this.enterOuterAlt(T,3),this.state=538,this.simple_augassignment();break}}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}simple_variable_initialization(){let T=new X7(this,this._ctx,this.state);this.enterRule(T,96,S.RULE_simple_variable_initialization);try{switch(this.state=543,this._errHandler.sync(this),this._input.LA(1)){case 4:case 6:case 7:case 10:case 11:case 17:case 18:case 21:case 22:case 24:case 25:case 27:case 28:case 63:this.enterOuterAlt(T,1),this.state=541,this.simple_name_initialization();break;case 32:this.enterOuterAlt(T,2),this.state=542,this.simple_tuple_initialization();break;default:throw new x0(this)}}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}simple_name_initialization(){let T=new B7(this,this._ctx,this.state);this.enterRule(T,98,S.RULE_simple_name_initialization);let L;try{this.enterOuterAlt(T,1);{if(this.state=546,this._errHandler.sync(this),L=this._input.LA(1),L===11)this.state=545,this.match(S.EXPORT);this.state=548,this.variable_declaration(),this.state=549,this.match(S.EQUAL),this.state=550,this.expression()}}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}simple_tuple_initialization(){let T=new z7(this,this._ctx,this.state);this.enterRule(T,100,S.RULE_simple_tuple_initialization);try{this.enterOuterAlt(T,1),this.state=552,this.tuple_declaration(),this.state=553,this.match(S.EQUAL),this.state=554,this.expression()}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}simple_reassignment(){let T=new H7(this,this._ctx,this.state);this.enterRule(T,102,S.RULE_simple_reassignment);let L;try{this.enterOuterAlt(T,1);{if(this.state=556,this.primary_expression(0),this.state=557,L=this._input.LA(1),!(L===42||L===62))this._errHandler.recoverInline(this);else this._errHandler.reportMatch(this),this.consume();this.state=558,this.expression()}}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}simple_augassignment(){let T=new V7(this,this._ctx,this.state);this.enterRule(T,104,S.RULE_simple_augassignment);try{this.enterOuterAlt(T,1),this.state=560,this.primary_expression(0),this.state=561,this.augassign_op(),this.state=562,this.expression()}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}expression(){let T=new r(this,this._ctx,this.state);this.enterRule(T,106,S.RULE_expression);try{this.enterOuterAlt(T,1),this.state=564,this.conditional_expression()}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}expression_statement(){let T=new F7(this,this._ctx,this.state);this.enterRule(T,108,S.RULE_expression_statement);try{this.enterOuterAlt(T,1),this.state=566,this.expression()}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}conditional_expression(){let T=new q7(this,this._ctx,this.state);this.enterRule(T,110,S.RULE_conditional_expression);let L;try{if(this.enterOuterAlt(T,1),this.state=568,this.disjunction_expression(),this.state=574,this._errHandler.sync(this),L=this._input.LA(1),L===47)this.state=569,this.match(S.QUESTION),this.state=570,this.expression(),this.state=571,this.match(S.COLON),this.state=572,this.expression()}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}disjunction_expression(){let T=new k7(this,this._ctx,this.state);this.enterRule(T,112,S.RULE_disjunction_expression);let L;try{this.enterOuterAlt(T,1);{this.state=576,this.conjunction_expression(),this.state=581,this._errHandler.sync(this),L=this._input.LA(1);while(L===20)this.state=577,this.match(S.OR),this.state=578,this.conjunction_expression(),this.state=583,this._errHandler.sync(this),L=this._input.LA(1)}}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}conjunction_expression(){let T=new Q2(this,this._ctx,this.state);this.enterRule(T,114,S.RULE_conjunction_expression);let L;try{this.enterOuterAlt(T,1);{this.state=584,this.bitwise_or_expression(0),this.state=589,this._errHandler.sync(this),L=this._input.LA(1);while(L===3)this.state=585,this.match(S.AND),this.state=586,this.bitwise_or_expression(0),this.state=591,this._errHandler.sync(this),L=this._input.LA(1)}}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}bitwise_or_expression(T){if(T===void 0)T=0;let L=this._ctx,I=this.state,_=new b1(this,this._ctx,I),R=_,$=116;this.enterRecursionRule(_,116,S.RULE_bitwise_or_expression,T);try{let G;this.enterOuterAlt(_,1);{this.state=593,this.bitwise_xor_expression(0),this._ctx.stop=this._input.LT(-1),this.state=600,this._errHandler.sync(this),G=this._interp.adaptivePredict(this._input,50,this._ctx);while(G!==2&&G!==U0.INVALID_ALT_NUMBER){if(G===1){if(this._parseListeners!=null)this.triggerExitRuleEvent();R=_;{if(_=new b1(this,L,I),this.pushNewRecursionContext(_,$,S.RULE_bitwise_or_expression),this.state=595,!this.precpred(this._ctx,2))throw this.createFailedPredicateException("this.precpred(this._ctx, 2)");this.state=596,this.match(S.PIPE),this.state=597,this.bitwise_xor_expression(0)}}this.state=602,this._errHandler.sync(this),G=this._interp.adaptivePredict(this._input,50,this._ctx)}}}catch(G){if(G instanceof q)_.exception=G,this._errHandler.reportError(this,G),this._errHandler.recover(this,G);else throw G}finally{this.unrollRecursionContexts(L)}return _}bitwise_xor_expression(T){if(T===void 0)T=0;let L=this._ctx,I=this.state,_=new R6(this,this._ctx,I),R=_,$=118;this.enterRecursionRule(_,118,S.RULE_bitwise_xor_expression,T);try{let G;this.enterOuterAlt(_,1);{this.state=604,this.bitwise_and_expression(0),this._ctx.stop=this._input.LT(-1),this.state=611,this._errHandler.sync(this),G=this._interp.adaptivePredict(this._input,51,this._ctx);while(G!==2&&G!==U0.INVALID_ALT_NUMBER){if(G===1){if(this._parseListeners!=null)this.triggerExitRuleEvent();R=_;{if(_=new R6(this,L,I),this.pushNewRecursionContext(_,$,S.RULE_bitwise_xor_expression),this.state=606,!this.precpred(this._ctx,2))throw this.createFailedPredicateException("this.precpred(this._ctx, 2)");this.state=607,this.match(S.CARET),this.state=608,this.bitwise_and_expression(0)}}this.state=613,this._errHandler.sync(this),G=this._interp.adaptivePredict(this._input,51,this._ctx)}}}catch(G){if(G instanceof q)_.exception=G,this._errHandler.reportError(this,G),this._errHandler.recover(this,G);else throw G}finally{this.unrollRecursionContexts(L)}return _}bitwise_and_expression(T){if(T===void 0)T=0;let L=this._ctx,I=this.state,_=new $6(this,this._ctx,I),R=_,$=120;this.enterRecursionRule(_,120,S.RULE_bitwise_and_expression,T);try{let G;this.enterOuterAlt(_,1);{this.state=615,this.equality_expression(),this._ctx.stop=this._input.LT(-1),this.state=622,this._errHandler.sync(this),G=this._interp.adaptivePredict(this._input,52,this._ctx);while(G!==2&&G!==U0.INVALID_ALT_NUMBER){if(G===1){if(this._parseListeners!=null)this.triggerExitRuleEvent();R=_;{if(_=new $6(this,L,I),this.pushNewRecursionContext(_,$,S.RULE_bitwise_and_expression),this.state=617,!this.precpred(this._ctx,2))throw this.createFailedPredicateException("this.precpred(this._ctx, 2)");this.state=618,this.match(S.AMP),this.state=619,this.equality_expression()}}this.state=624,this._errHandler.sync(this),G=this._interp.adaptivePredict(this._input,52,this._ctx)}}}catch(G){if(G instanceof q)_.exception=G,this._errHandler.reportError(this,G),this._errHandler.recover(this,G);else throw G}finally{this.unrollRecursionContexts(L)}return _}equality_expression(){let T=new M7(this,this._ctx,this.state);this.enterRule(T,122,S.RULE_equality_expression);try{let L;this.enterOuterAlt(T,1);{this.state=625,this.inequality_expression(),this.state=629,this._errHandler.sync(this),L=this._interp.adaptivePredict(this._input,53,this._ctx);while(L!==2&&L!==U0.INVALID_ALT_NUMBER){if(L===1)this.state=626,this.equality_trailing_pair();this.state=631,this._errHandler.sync(this),L=this._interp.adaptivePredict(this._input,53,this._ctx)}}}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}equality_trailing_pair(){let T=new U2(this,this._ctx,this.state);this.enterRule(T,124,S.RULE_equality_trailing_pair);try{switch(this.state=634,this._errHandler.sync(this),this._input.LA(1)){case 38:this.enterOuterAlt(T,1),this.state=632,this.equal_trailing_pair();break;case 39:this.enterOuterAlt(T,2),this.state=633,this.not_equal_trailing_pair();break;default:throw new x0(this)}}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}equal_trailing_pair(){let T=new E7(this,this._ctx,this.state);this.enterRule(T,126,S.RULE_equal_trailing_pair);try{this.enterOuterAlt(T,1),this.state=636,this.match(S.EQEQUAL),this.state=637,this.inequality_expression()}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}not_equal_trailing_pair(){let T=new j7(this,this._ctx,this.state);this.enterRule(T,128,S.RULE_not_equal_trailing_pair);try{this.enterOuterAlt(T,1),this.state=639,this.match(S.NOTEQUAL),this.state=640,this.inequality_expression()}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}inequality_expression(){let T=new S6(this,this._ctx,this.state);this.enterRule(T,130,S.RULE_inequality_expression);try{let L;this.enterOuterAlt(T,1);{this.state=642,this.shift_expression(0),this.state=646,this._errHandler.sync(this),L=this._interp.adaptivePredict(this._input,55,this._ctx);while(L!==2&&L!==U0.INVALID_ALT_NUMBER){if(L===1)this.state=643,this.inequality_trailing_pair();this.state=648,this._errHandler.sync(this),L=this._interp.adaptivePredict(this._input,55,this._ctx)}}}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}inequality_trailing_pair(){let T=new S2(this,this._ctx,this.state);this.enterRule(T,132,S.RULE_inequality_trailing_pair);try{switch(this.state=653,this._errHandler.sync(this),this._input.LA(1)){case 36:this.enterOuterAlt(T,1),this.state=649,this.less_than_equal_trailing_pair();break;case 40:this.enterOuterAlt(T,2),this.state=650,this.less_than_trailing_pair();break;case 37:this.enterOuterAlt(T,3),this.state=651,this.greater_than_equal_trailing_pair();break;case 41:this.enterOuterAlt(T,4),this.state=652,this.greater_than_trailing_pair();break;default:throw new x0(this)}}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}less_than_equal_trailing_pair(){let T=new C7(this,this._ctx,this.state);this.enterRule(T,134,S.RULE_less_than_equal_trailing_pair);try{this.enterOuterAlt(T,1),this.state=655,this.match(S.LESSEQUAL),this.state=656,this.shift_expression(0)}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}less_than_trailing_pair(){let T=new P7(this,this._ctx,this.state);this.enterRule(T,136,S.RULE_less_than_trailing_pair);try{this.enterOuterAlt(T,1),this.state=658,this.match(S.LESS),this.state=659,this.shift_expression(0)}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}greater_than_equal_trailing_pair(){let T=new N7(this,this._ctx,this.state);this.enterRule(T,138,S.RULE_greater_than_equal_trailing_pair);try{this.enterOuterAlt(T,1),this.state=661,this.match(S.GREATEREQUAL),this.state=662,this.shift_expression(0)}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}greater_than_trailing_pair(){let T=new y7(this,this._ctx,this.state);this.enterRule(T,140,S.RULE_greater_than_trailing_pair);try{this.enterOuterAlt(T,1),this.state=664,this.match(S.GREATER),this.state=665,this.shift_expression(0)}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}shift_expression(T){if(T===void 0)T=0;let L=this._ctx,I=this.state,_=new a0(this,this._ctx,I),R=_,$=142;this.enterRecursionRule(_,142,S.RULE_shift_expression,T);try{let G;this.enterOuterAlt(_,1);{this.state=668,this.additive_expression(0),this._ctx.stop=this._input.LT(-1),this.state=676,this._errHandler.sync(this),G=this._interp.adaptivePredict(this._input,57,this._ctx);while(G!==2&&G!==U0.INVALID_ALT_NUMBER){if(G===1){if(this._parseListeners!=null)this.triggerExitRuleEvent();R=_;{if(_=new a0(this,L,I),this.pushNewRecursionContext(_,$,S.RULE_shift_expression),this.state=670,!this.precpred(this._ctx,2))throw this.createFailedPredicateException("this.precpred(this._ctx, 2)");this.state=671,this.shift_op(),this.state=672,this.additive_expression(0)}}this.state=678,this._errHandler.sync(this),G=this._interp.adaptivePredict(this._input,57,this._ctx)}}}catch(G){if(G instanceof q)_.exception=G,this._errHandler.reportError(this,G),this._errHandler.recover(this,G);else throw G}finally{this.unrollRecursionContexts(L)}return _}shift_op(){let T=new b7(this,this._ctx,this.state);this.enterRule(T,144,S.RULE_shift_op);let L;try{if(this.enterOuterAlt(T,1),this.state=679,L=this._input.LA(1),!(L===34||L===35))this._errHandler.recoverInline(this);else this._errHandler.reportMatch(this),this.consume()}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}additive_expression(T){if(T===void 0)T=0;let L=this._ctx,I=this.state,_=new G6(this,this._ctx,I),R=_,$=146;this.enterRecursionRule(_,146,S.RULE_additive_expression,T);try{let G;this.enterOuterAlt(_,1);{this.state=682,this.multiplicative_expression(0),this._ctx.stop=this._input.LT(-1),this.state=690,this._errHandler.sync(this),G=this._interp.adaptivePredict(this._input,58,this._ctx);while(G!==2&&G!==U0.INVALID_ALT_NUMBER){if(G===1){if(this._parseListeners!=null)this.triggerExitRuleEvent();R=_;{if(_=new G6(this,L,I),this.pushNewRecursionContext(_,$,S.RULE_additive_expression),this.state=684,!this.precpred(this._ctx,2))throw this.createFailedPredicateException("this.precpred(this._ctx, 2)");this.state=685,this.additive_op(),this.state=686,this.multiplicative_expression(0)}}this.state=692,this._errHandler.sync(this),G=this._interp.adaptivePredict(this._input,58,this._ctx)}}}catch(G){if(G instanceof q)_.exception=G,this._errHandler.reportError(this,G),this._errHandler.recover(this,G);else throw G}finally{this.unrollRecursionContexts(L)}return _}additive_op(){let T=new h7(this,this._ctx,this.state);this.enterRule(T,148,S.RULE_additive_op);let L;try{if(this.enterOuterAlt(T,1),this.state=693,L=this._input.LA(1),!(L===52||L===53))this._errHandler.recoverInline(this);else this._errHandler.reportMatch(this),this.consume()}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}multiplicative_expression(T){if(T===void 0)T=0;let L=this._ctx,I=this.state,_=new Q6(this,this._ctx,I),R=_,$=150;this.enterRecursionRule(_,150,S.RULE_multiplicative_expression,T);try{let G;this.enterOuterAlt(_,1);{this.state=696,this.unary_expression(),this._ctx.stop=this._input.LT(-1),this.state=704,this._errHandler.sync(this),G=this._interp.adaptivePredict(this._input,59,this._ctx);while(G!==2&&G!==U0.INVALID_ALT_NUMBER){if(G===1){if(this._parseListeners!=null)this.triggerExitRuleEvent();R=_;{if(_=new Q6(this,L,I),this.pushNewRecursionContext(_,$,S.RULE_multiplicative_expression),this.state=698,!this.precpred(this._ctx,2))throw this.createFailedPredicateException("this.precpred(this._ctx, 2)");this.state=699,this.multiplicative_op(),this.state=700,this.unary_expression()}}this.state=706,this._errHandler.sync(this),G=this._interp.adaptivePredict(this._input,59,this._ctx)}}}catch(G){if(G instanceof q)_.exception=G,this._errHandler.reportError(this,G),this._errHandler.recover(this,G);else throw G}finally{this.unrollRecursionContexts(L)}return _}multiplicative_op(){let T=new w7(this,this._ctx,this.state);this.enterRule(T,152,S.RULE_multiplicative_op);let L;try{if(this.enterOuterAlt(T,1),this.state=707,L=this._input.LA(1),!((L-54&-32)===0&&(1<<L-54&7)!==0))this._errHandler.recoverInline(this);else this._errHandler.reportMatch(this),this.consume()}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}unary_expression(){let T=new K2(this,this._ctx,this.state);this.enterRule(T,154,S.RULE_unary_expression);try{switch(this.state=713,this._errHandler.sync(this),this._input.LA(1)){case 19:case 48:case 52:case 53:this.enterOuterAlt(T,1),this.state=709,this.unary_op(),this.state=710,this.unary_expression();break;case 4:case 6:case 7:case 10:case 12:case 17:case 18:case 21:case 22:case 24:case 25:case 26:case 30:case 32:case 63:case 64:case 65:case 66:this.enterOuterAlt(T,2),this.state=712,this.primary_expression(0);break;default:throw new x0(this)}}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}unary_op(){let T=new A7(this,this._ctx,this.state);this.enterRule(T,156,S.RULE_unary_op);let L;try{if(this.enterOuterAlt(T,1),this.state=715,L=this._input.LA(1),!(L===19||(L-48&-32)===0&&(1<<L-48&49)!==0))this._errHandler.recoverInline(this);else this._errHandler.reportMatch(this),this.consume()}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}primary_expression(T){if(T===void 0)T=0;let L=this._ctx,I=this.state,_=new O0(this,this._ctx,I),R=_,$=158;this.enterRecursionRule(_,158,S.RULE_primary_expression,T);let G;try{let Q;this.enterOuterAlt(_,1);{_=new L9(this,_),this._ctx=_,R=_,this.state=718,this.atomic_expression(),this._ctx.stop=this._input.LT(-1),this.state=739,this._errHandler.sync(this),Q=this._interp.adaptivePredict(this._input,64,this._ctx);while(Q!==2&&Q!==U0.INVALID_ALT_NUMBER){if(Q===1){if(this._parseListeners!=null)this.triggerExitRuleEvent();switch(R=_,this.state=737,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,63,this._ctx)){case 1:{if(_=new e8(this,new O0(this,L,I)),this.pushNewRecursionContext(_,$,S.RULE_primary_expression),this.state=720,!this.precpred(this._ctx,4))throw this.createFailedPredicateException("this.precpred(this._ctx, 4)");this.state=721,this.match(S.DOT),this.state=722,this.name_load()}break;case 2:{if(_=new T9(this,new O0(this,L,I)),this.pushNewRecursionContext(_,$,S.RULE_primary_expression),this.state=723,!this.precpred(this._ctx,3))throw this.createFailedPredicateException("this.precpred(this._ctx, 3)");if(this.state=725,this._errHandler.sync(this),G=this._input.LA(1),G===40)this.state=724,this.template_spec_suffix();if(this.state=727,this.match(S.LPAR),this.state=729,this._errHandler.sync(this),G=this._input.LA(1),(G-4&-32)===0&&(1<<G-4&343335245)!==0||(G-48&-32)===0&&(1<<G-48&491569)!==0)this.state=728,this.argument_list();this.state=731,this.match(S.RPAR)}break;case 3:{if(_=new I9(this,new O0(this,L,I)),this.pushNewRecursionContext(_,$,S.RULE_primary_expression),this.state=732,!this.precpred(this._ctx,2))throw this.createFailedPredicateException("this.precpred(this._ctx, 2)");this.state=733,this.match(S.LSQB),this.state=734,this.subscript_slice(),this.state=735,this.match(S.RSQB)}break}}this.state=741,this._errHandler.sync(this),Q=this._interp.adaptivePredict(this._input,64,this._ctx)}}}catch(Q){if(Q instanceof q)_.exception=Q,this._errHandler.reportError(this,Q),this._errHandler.recover(this,Q);else throw Q}finally{this.unrollRecursionContexts(L)}return _}argument_list(){let T=new u7(this,this._ctx,this.state);this.enterRule(T,160,S.RULE_argument_list);let L;try{let I;this.enterOuterAlt(T,1);{this.state=742,this.argument_definition(),this.state=747,this._errHandler.sync(this),I=this._interp.adaptivePredict(this._input,65,this._ctx);while(I!==2&&I!==U0.INVALID_ALT_NUMBER){if(I===1)this.state=743,this.match(S.COMMA),this.state=744,this.argument_definition();this.state=749,this._errHandler.sync(this),I=this._interp.adaptivePredict(this._input,65,this._ctx)}if(this.state=751,this._errHandler.sync(this),L=this._input.LA(1),L===45)this.state=750,this.match(S.COMMA)}}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}argument_definition(){let T=new O2(this,this._ctx,this.state);this.enterRule(T,162,S.RULE_argument_definition);try{this.enterOuterAlt(T,1);{switch(this.state=756,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,67,this._ctx)){case 1:this.state=753,this.name_store(),this.state=754,this.match(S.EQUAL);break}this.state=758,this.expression()}}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}subscript_slice(){let T=new Y2(this,this._ctx,this.state);this.enterRule(T,164,S.RULE_subscript_slice);let L;try{let I;this.enterOuterAlt(T,1);{this.state=760,this.expression(),this.state=765,this._errHandler.sync(this),I=this._interp.adaptivePredict(this._input,68,this._ctx);while(I!==2&&I!==U0.INVALID_ALT_NUMBER){if(I===1)this.state=761,this.match(S.COMMA),this.state=762,this.expression();this.state=767,this._errHandler.sync(this),I=this._interp.adaptivePredict(this._input,68,this._ctx)}if(this.state=769,this._errHandler.sync(this),L=this._input.LA(1),L===45)this.state=768,this.match(S.COMMA)}}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}atomic_expression(){let T=new g7(this,this._ctx,this.state);this.enterRule(T,166,S.RULE_atomic_expression);try{switch(this.state=775,this._errHandler.sync(this),this._input.LA(1)){case 4:case 6:case 7:case 10:case 17:case 18:case 21:case 22:case 24:case 25:case 63:this.enterOuterAlt(T,1),this.state=771,this.name_load();break;case 12:case 26:case 64:case 65:case 66:this.enterOuterAlt(T,2),this.state=772,this.literal_expression();break;case 30:this.enterOuterAlt(T,3),this.state=773,this.grouped_expression();break;case 32:this.enterOuterAlt(T,4),this.state=774,this.tuple_expression();break;default:throw new x0(this)}}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}literal_expression(){let T=new f7(this,this._ctx,this.state);this.enterRule(T,168,S.RULE_literal_expression);try{switch(this.state=781,this._errHandler.sync(this),this._input.LA(1)){case 64:this.enterOuterAlt(T,1),this.state=777,this.literal_number();break;case 65:this.enterOuterAlt(T,2),this.state=778,this.literal_string();break;case 12:case 26:this.enterOuterAlt(T,3),this.state=779,this.literal_bool();break;case 66:this.enterOuterAlt(T,4),this.state=780,this.literal_color();break;default:throw new x0(this)}}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}literal_number(){let T=new X2(this,this._ctx,this.state);this.enterRule(T,170,S.RULE_literal_number);try{this.enterOuterAlt(T,1),this.state=783,this.match(S.NUMBER)}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}literal_string(){let T=new p7(this,this._ctx,this.state);this.enterRule(T,172,S.RULE_literal_string);try{this.enterOuterAlt(T,1),this.state=785,this.match(S.STRING)}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}literal_bool(){let T=new x7(this,this._ctx,this.state);this.enterRule(T,174,S.RULE_literal_bool);let L;try{if(this.enterOuterAlt(T,1),this.state=787,L=this._input.LA(1),!(L===12||L===26))this._errHandler.recoverInline(this);else this._errHandler.reportMatch(this),this.consume()}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}literal_color(){let T=new c7(this,this._ctx,this.state);this.enterRule(T,176,S.RULE_literal_color);try{this.enterOuterAlt(T,1),this.state=789,this.match(S.COLOR)}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}grouped_expression(){let T=new m7(this,this._ctx,this.state);this.enterRule(T,178,S.RULE_grouped_expression);try{this.enterOuterAlt(T,1),this.state=791,this.match(S.LPAR),this.state=792,this.expression(),this.state=793,this.match(S.RPAR)}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}tuple_expression(){let T=new d7(this,this._ctx,this.state);this.enterRule(T,180,S.RULE_tuple_expression);let L;try{let I;this.enterOuterAlt(T,1);{if(this.state=795,this.match(S.LSQB),this.state=807,this._errHandler.sync(this),L=this._input.LA(1),(L-4&-32)===0&&(1<<L-4&343335245)!==0||(L-48&-32)===0&&(1<<L-48&491569)!==0){this.state=796,this.expression(),this.state=801,this._errHandler.sync(this),I=this._interp.adaptivePredict(this._input,72,this._ctx);while(I!==2&&I!==U0.INVALID_ALT_NUMBER){if(I===1)this.state=797,this.match(S.COMMA),this.state=798,this.expression();this.state=803,this._errHandler.sync(this),I=this._interp.adaptivePredict(this._input,72,this._ctx)}if(this.state=805,this._errHandler.sync(this),L=this._input.LA(1),L===45)this.state=804,this.match(S.COMMA)}this.state=809,this.match(S.RSQB)}}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}import_statement(){let T=new l7(this,this._ctx,this.state);this.enterRule(T,182,S.RULE_import_statement);let L;try{if(this.enterOuterAlt(T,1),this.state=811,this.match(S.IMPORT),this.state=812,this.name(),this.state=813,this.match(S.SLASH),this.state=814,this.name(),this.state=815,this.match(S.SLASH),this.state=816,this.literal_number(),this.state=819,this._errHandler.sync(this),L=this._input.LA(1),L===4)this.state=817,this.match(S.AS),this.state=818,this.name()}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}break_statement(){let T=new o7(this,this._ctx,this.state);this.enterRule(T,184,S.RULE_break_statement);try{this.enterOuterAlt(T,1),this.state=821,this.match(S.BREAK)}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}continue_statement(){let T=new v7(this,this._ctx,this.state);this.enterRule(T,186,S.RULE_continue_statement);try{this.enterOuterAlt(T,1),this.state=823,this.match(S.CONTINUE)}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}variable_declaration(){let T=new B2(this,this._ctx,this.state);this.enterRule(T,188,S.RULE_variable_declaration);let L;try{this.enterOuterAlt(T,1);{if(this.state=826,this._errHandler.sync(this),L=this._input.LA(1),L===27||L===28)this.state=825,this.declaration_mode();switch(this.state=829,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,77,this._ctx)){case 1:this.state=828,this.type_specification();break}this.state=831,this.name_store()}}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}tuple_declaration(){let T=new O6(this,this._ctx,this.state);this.enterRule(T,190,S.RULE_tuple_declaration);let L;try{let I;this.enterOuterAlt(T,1);{this.state=833,this.match(S.LSQB),this.state=834,this.name_store(),this.state=839,this._errHandler.sync(this),I=this._interp.adaptivePredict(this._input,78,this._ctx);while(I!==2&&I!==U0.INVALID_ALT_NUMBER){if(I===1)this.state=835,this.match(S.COMMA),this.state=836,this.name_store();this.state=841,this._errHandler.sync(this),I=this._interp.adaptivePredict(this._input,78,this._ctx)}if(this.state=843,this._errHandler.sync(this),L=this._input.LA(1),L===45)this.state=842,this.match(S.COMMA);this.state=845,this.match(S.RSQB)}}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}declaration_mode(){let T=new i7(this,this._ctx,this.state);this.enterRule(T,192,S.RULE_declaration_mode);let L;try{if(this.enterOuterAlt(T,1),this.state=847,L=this._input.LA(1),!(L===27||L===28))this._errHandler.recoverInline(this);else this._errHandler.reportMatch(this),this.consume()}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}assignment_target(){let T=new r7(this,this._ctx,this.state);this.enterRule(T,194,S.RULE_assignment_target);try{switch(this.state=853,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,80,this._ctx)){case 1:this.enterOuterAlt(T,1),this.state=849,this.assignment_target_attribute();break;case 2:this.enterOuterAlt(T,2),this.state=850,this.assignment_target_subscript();break;case 3:this.enterOuterAlt(T,3),this.state=851,this.assignment_target_name();break;case 4:this.enterOuterAlt(T,4),this.state=852,this.assignment_target_group();break}}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}assignment_target_attribute(){let T=new s7(this,this._ctx,this.state);this.enterRule(T,196,S.RULE_assignment_target_attribute);try{this.enterOuterAlt(T,1),this.state=855,this.primary_expression(0),this.state=856,this.match(S.DOT),this.state=857,this.name_store()}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}assignment_target_subscript(){let T=new a7(this,this._ctx,this.state);this.enterRule(T,198,S.RULE_assignment_target_subscript);try{this.enterOuterAlt(T,1),this.state=859,this.primary_expression(0),this.state=860,this.match(S.LSQB),this.state=861,this.subscript_slice(),this.state=862,this.match(S.RSQB)}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}assignment_target_name(){let T=new n7(this,this._ctx,this.state);this.enterRule(T,200,S.RULE_assignment_target_name);try{this.enterOuterAlt(T,1),this.state=864,this.name_store()}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}assignment_target_group(){let T=new t7(this,this._ctx,this.state);this.enterRule(T,202,S.RULE_assignment_target_group);try{this.enterOuterAlt(T,1),this.state=866,this.match(S.LPAR),this.state=867,this.assignment_target(),this.state=868,this.match(S.RPAR)}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}augassign_op(){let T=new z2(this,this._ctx,this.state);this.enterRule(T,204,S.RULE_augassign_op);let L;try{if(this.enterOuterAlt(T,1),this.state=870,L=this._input.LA(1),!((L-57&-32)===0&&(1<<L-57&31)!==0))this._errHandler.recoverInline(this);else this._errHandler.reportMatch(this),this.consume()}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}type_specification(){let T=new w0(this,this._ctx,this.state);this.enterRule(T,206,S.RULE_type_specification);let L;try{this.enterOuterAlt(T,1);{switch(this.state=873,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,81,this._ctx)){case 1:this.state=872,this.type_qualifier();break}if(this.state=875,this.attributed_type_name(),this.state=877,this._errHandler.sync(this),L=this._input.LA(1),L===40)this.state=876,this.template_spec_suffix();if(this.state=880,this._errHandler.sync(this),L=this._input.LA(1),L===32)this.state=879,this.array_type_suffix()}}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}type_qualifier(){let T=new e7(this,this._ctx,this.state);this.enterRule(T,208,S.RULE_type_qualifier);let L;try{if(this.enterOuterAlt(T,1),this.state=882,L=this._input.LA(1),!((L&-32)===0&&(1<<L&6422656)!==0))this._errHandler.recoverInline(this);else this._errHandler.reportMatch(this),this.consume()}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}attributed_type_name(){let T=new T5(this,this._ctx,this.state);this.enterRule(T,210,S.RULE_attributed_type_name);let L;try{this.enterOuterAlt(T,1);{this.state=884,this.name_load(),this.state=889,this._errHandler.sync(this),L=this._input.LA(1);while(L===44)this.state=885,this.match(S.DOT),this.state=886,this.name_load(),this.state=891,this._errHandler.sync(this),L=this._input.LA(1)}}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}template_spec_suffix(){let T=new H2(this,this._ctx,this.state);this.enterRule(T,212,S.RULE_template_spec_suffix);let L;try{this.enterOuterAlt(T,1);{if(this.state=892,this.match(S.LESS),this.state=894,this._errHandler.sync(this),L=this._input.LA(1),(L&-32)===0&&(1<<L&57017552)!==0||L===63)this.state=893,this.type_argument_list();this.state=896,this.match(S.GREATER)}}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}array_type_suffix(){let T=new L5(this,this._ctx,this.state);this.enterRule(T,214,S.RULE_array_type_suffix);try{this.enterOuterAlt(T,1),this.state=898,this.match(S.LSQB),this.state=899,this.match(S.RSQB)}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}type_argument_list(){let T=new I5(this,this._ctx,this.state);this.enterRule(T,216,S.RULE_type_argument_list);let L;try{let I;this.enterOuterAlt(T,1);{this.state=901,this.type_specification(),this.state=906,this._errHandler.sync(this),I=this._interp.adaptivePredict(this._input,86,this._ctx);while(I!==2&&I!==U0.INVALID_ALT_NUMBER){if(I===1)this.state=902,this.match(S.COMMA),this.state=903,this.type_specification();this.state=908,this._errHandler.sync(this),I=this._interp.adaptivePredict(this._input,86,this._ctx)}if(this.state=910,this._errHandler.sync(this),L=this._input.LA(1),L===45)this.state=909,this.match(S.COMMA)}}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}name(){let T=new c0(this,this._ctx,this.state);this.enterRule(T,218,S.RULE_name);let L;try{if(this.enterOuterAlt(T,1),this.state=912,L=this._input.LA(1),!((L&-32)===0&&(1<<L&57017552)!==0||L===63))this._errHandler.recoverInline(this);else this._errHandler.reportMatch(this),this.consume()}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}name_load(){let T=new h1(this,this._ctx,this.state);this.enterRule(T,220,S.RULE_name_load);try{this.enterOuterAlt(T,1),this.state=914,this.name()}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}name_store(){let T=new M0(this,this._ctx,this.state);this.enterRule(T,222,S.RULE_name_store);try{this.enterOuterAlt(T,1),this.state=916,this.name()}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}comments(){let T=new _5(this,this._ctx,this.state);this.enterRule(T,224,S.RULE_comments);let L;try{this.enterOuterAlt(T,1);{this.state=919,this._errHandler.sync(this),L=this._input.LA(1);do this.state=918,this.comment(),this.state=921,this._errHandler.sync(this),L=this._input.LA(1);while(L===69)}}catch(I){if(I instanceof q)T.exception=I,this._errHandler.reportError(this,I),this._errHandler.recover(this,I);else throw I}finally{this.exitRule()}return T}comment(){let T=new J2(this,this._ctx,this.state);this.enterRule(T,226,S.RULE_comment);try{this.enterOuterAlt(T,1),this.state=923,this.match(S.COMMENT)}catch(L){if(L instanceof q)T.exception=L,this._errHandler.reportError(this,L),this._errHandler.recover(this,L);else throw L}finally{this.exitRule()}return T}sempred(T,L,I){switch(L){case 58:return this.bitwise_or_expression_sempred(T,I);case 59:return this.bitwise_xor_expression_sempred(T,I);case 60:return this.bitwise_and_expression_sempred(T,I);case 71:return this.shift_expression_sempred(T,I);case 73:return this.additive_expression_sempred(T,I);case 75:return this.multiplicative_expression_sempred(T,I);case 79:return this.primary_expression_sempred(T,I)}return!0}bitwise_or_expression_sempred(T,L){switch(L){case 0:return this.precpred(this._ctx,2)}return!0}bitwise_xor_expression_sempred(T,L){switch(L){case 1:return this.precpred(this._ctx,2)}return!0}bitwise_and_expression_sempred(T,L){switch(L){case 2:return this.precpred(this._ctx,2)}return!0}shift_expression_sempred(T,L){switch(L){case 3:return this.precpred(this._ctx,2)}return!0}additive_expression_sempred(T,L){switch(L){case 4:return this.precpred(this._ctx,2)}return!0}multiplicative_expression_sempred(T,L){switch(L){case 5:return this.precpred(this._ctx,2)}return!0}primary_expression_sempred(T,L){switch(L){case 6:return this.precpred(this._ctx,4);case 7:return this.precpred(this._ctx,3);case 8:return this.precpred(this._ctx,2)}return!0}static _serializedATN=[4,1,71,926,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2,33,7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2,39,7,39,2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45,7,45,2,46,7,46,2,47,7,47,2,48,7,48,2,49,7,49,2,50,7,50,2,51,7,51,2,52,7,52,2,53,7,53,2,54,7,54,2,55,7,55,2,56,7,56,2,57,7,57,2,58,7,58,2,59,7,59,2,60,7,60,2,61,7,61,2,62,7,62,2,63,7,63,2,64,7,64,2,65,7,65,2,66,7,66,2,67,7,67,2,68,7,68,2,69,7,69,2,70,7,70,2,71,7,71,2,72,7,72,2,73,7,73,2,74,7,74,2,75,7,75,2,76,7,76,2,77,7,77,2,78,7,78,2,79,7,79,2,80,7,80,2,81,7,81,2,82,7,82,2,83,7,83,2,84,7,84,2,85,7,85,2,86,7,86,2,87,7,87,2,88,7,88,2,89,7,89,2,90,7,90,2,91,7,91,2,92,7,92,2,93,7,93,2,94,7,94,2,95,7,95,2,96,7,96,2,97,7,97,2,98,7,98,2,99,7,99,2,100,7,100,2,101,7,101,2,102,7,102,2,103,7,103,2,104,7,104,2,105,7,105,2,106,7,106,2,107,7,107,2,108,7,108,2,109,7,109,2,110,7,110,2,111,7,111,2,112,7,112,2,113,7,113,1,0,1,0,1,1,3,1,232,8,1,1,1,1,1,1,2,1,2,3,2,238,8,2,1,2,1,2,1,3,3,3,243,8,3,1,3,1,3,1,4,4,4,248,8,4,11,4,12,4,249,1,5,1,5,1,5,3,5,255,8,5,1,6,1,6,1,6,1,6,1,6,1,6,3,6,263,8,6,1,7,1,7,1,7,5,7,268,8,7,10,7,12,7,271,9,7,1,7,3,7,274,8,7,1,7,1,7,1,8,1,8,1,8,5,8,281,8,8,10,8,12,8,284,9,8,1,8,1,8,1,8,1,9,1,9,1,9,1,9,1,9,3,9,294,8,9,1,10,1,10,1,10,3,10,299,8,10,1,11,1,11,3,11,303,8,11,1,12,3,12,306,8,12,1,12,1,12,1,12,1,12,1,13,1,13,1,13,1,13,1,14,1,14,1,14,1,14,1,15,1,15,1,15,1,15,1,16,3,16,325,8,16,1,16,3,16,328,8,16,1,16,1,16,1,16,3,16,333,8,16,1,16,1,16,1,16,1,16,1,17,1,17,1,17,5,17,342,8,17,10,17,12,17,345,9,17,1,17,3,17,348,8,17,1,18,3,18,351,8,18,1,18,1,18,1,18,3,18,356,8,18,1,19,3,19,359,8,19,1,19,1,19,3,19,363,8,19,1,19,1,19,1,19,3,19,368,8,19,1,19,1,19,1,19,1,19,1,20,1,20,1,20,5,20,377,8,20,10,20,12,20,380,9,20,1,20,3,20,383,8,20,1,21,1,21,1,21,1,21,3,21,389,8,21,1,22,3,22,392,8,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,23,4,23,402,8,23,11,23,12,23,403,1,24,3,24,407,8,24,1,24,1,24,1,24,1,24,3,24,413,8,24,1,24,1,24,1,25,3,25,418,8,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,26,4,26,428,8,26,11,26,12,26,429,1,27,1,27,1,27,3,27,435,8,27,1,27,1,27,1,28,1,28,1,28,1,28,3,28,443,8,28,1,29,1,29,1,30,1,30,1,31,1,31,1,31,1,31,3,31,453,8,31,1,32,1,32,1,32,1,32,1,32,3,32,460,8,32,1,33,1,33,3,33,464,8,33,1,34,1,34,1,34,1,35,1,35,3,35,471,8,35,1,36,1,36,1,36,1,36,1,36,1,36,1,36,1,36,3,36,481,8,36,1,36,1,36,1,37,1,37,1,37,1,37,1,37,1,37,1,38,1,38,1,38,1,38,1,38,3,38,496,8,38,1,39,1,39,1,39,1,39,1,40,1,40,3,40,504,8,40,1,40,1,40,1,40,1,40,1,40,1,41,4,41,512,8,41,11,41,12,41,513,1,41,3,41,517,8,41,1,42,1,42,1,42,1,42,1,43,1,43,1,43,1,44,1,44,3,44,528,8,44,1,45,1,45,1,45,1,45,1,45,1,46,1,46,1,47,1,47,1,47,3,47,540,8,47,1,48,1,48,3,48,544,8,48,1,49,3,49,547,8,49,1,49,1,49,1,49,1,49,1,50,1,50,1,50,1,50,1,51,1,51,1,51,1,51,1,52,1,52,1,52,1,52,1,53,1,53,1,54,1,54,1,55,1,55,1,55,1,55,1,55,1,55,3,55,575,8,55,1,56,1,56,1,56,5,56,580,8,56,10,56,12,56,583,9,56,1,57,1,57,1,57,5,57,588,8,57,10,57,12,57,591,9,57,1,58,1,58,1,58,1,58,1,58,1,58,5,58,599,8,58,10,58,12,58,602,9,58,1,59,1,59,1,59,1,59,1,59,1,59,5,59,610,8,59,10,59,12,59,613,9,59,1,60,1,60,1,60,1,60,1,60,1,60,5,60,621,8,60,10,60,12,60,624,9,60,1,61,1,61,5,61,628,8,61,10,61,12,61,631,9,61,1,62,1,62,3,62,635,8,62,1,63,1,63,1,63,1,64,1,64,1,64,1,65,1,65,5,65,645,8,65,10,65,12,65,648,9,65,1,66,1,66,1,66,1,66,3,66,654,8,66,1,67,1,67,1,67,1,68,1,68,1,68,1,69,1,69,1,69,1,70,1,70,1,70,1,71,1,71,1,71,1,71,1,71,1,71,1,71,5,71,675,8,71,10,71,12,71,678,9,71,1,72,1,72,1,73,1,73,1,73,1,73,1,73,1,73,1,73,5,73,689,8,73,10,73,12,73,692,9,73,1,74,1,74,1,75,1,75,1,75,1,75,1,75,1,75,1,75,5,75,703,8,75,10,75,12,75,706,9,75,1,76,1,76,1,77,1,77,1,77,1,77,3,77,714,8,77,1,78,1,78,1,79,1,79,1,79,1,79,1,79,1,79,1,79,1,79,3,79,726,8,79,1,79,1,79,3,79,730,8,79,1,79,1,79,1,79,1,79,1,79,1,79,5,79,738,8,79,10,79,12,79,741,9,79,1,80,1,80,1,80,5,80,746,8,80,10,80,12,80,749,9,80,1,80,3,80,752,8,80,1,81,1,81,1,81,3,81,757,8,81,1,81,1,81,1,82,1,82,1,82,5,82,764,8,82,10,82,12,82,767,9,82,1,82,3,82,770,8,82,1,83,1,83,1,83,1,83,3,83,776,8,83,1,84,1,84,1,84,1,84,3,84,782,8,84,1,85,1,85,1,86,1,86,1,87,1,87,1,88,1,88,1,89,1,89,1,89,1,89,1,90,1,90,1,90,1,90,5,90,800,8,90,10,90,12,90,803,9,90,1,90,3,90,806,8,90,3,90,808,8,90,1,90,1,90,1,91,1,91,1,91,1,91,1,91,1,91,1,91,1,91,3,91,820,8,91,1,92,1,92,1,93,1,93,1,94,3,94,827,8,94,1,94,3,94,830,8,94,1,94,1,94,1,95,1,95,1,95,1,95,5,95,838,8,95,10,95,12,95,841,9,95,1,95,3,95,844,8,95,1,95,1,95,1,96,1,96,1,97,1,97,1,97,1,97,3,97,854,8,97,1,98,1,98,1,98,1,98,1,99,1,99,1,99,1,99,1,99,1,100,1,100,1,101,1,101,1,101,1,101,1,102,1,102,1,103,3,103,874,8,103,1,103,1,103,3,103,878,8,103,1,103,3,103,881,8,103,1,104,1,104,1,105,1,105,1,105,5,105,888,8,105,10,105,12,105,891,9,105,1,106,1,106,3,106,895,8,106,1,106,1,106,1,107,1,107,1,107,1,108,1,108,1,108,5,108,905,8,108,10,108,12,108,908,9,108,1,108,3,108,911,8,108,1,109,1,109,1,110,1,110,1,111,1,111,1,112,4,112,920,8,112,11,112,12,112,921,1,113,1,113,1,113,0,7,116,118,120,142,146,150,158,114,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,162,164,166,168,170,172,174,176,178,180,182,184,186,188,190,192,194,196,198,200,202,204,206,208,210,212,214,216,218,220,222,224,226,0,10,2,0,42,42,62,62,1,0,34,35,1,0,52,53,1,0,54,56,3,0,19,19,48,48,52,53,2,0,12,12,26,26,1,0,27,28,1,0,57,61,3,0,7,7,17,17,21,22,7,0,4,4,6,7,10,10,17,18,21,22,24,25,63,63,922,0,228,1,0,0,0,2,231,1,0,0,0,4,235,1,0,0,0,6,242,1,0,0,0,8,247,1,0,0,0,10,254,1,0,0,0,12,262,1,0,0,0,14,264,1,0,0,0,16,277,1,0,0,0,18,293,1,0,0,0,20,298,1,0,0,0,22,302,1,0,0,0,24,305,1,0,0,0,26,311,1,0,0,0,28,315,1,0,0,0,30,319,1,0,0,0,32,324,1,0,0,0,34,338,1,0,0,0,36,350,1,0,0,0,38,358,1,0,0,0,40,373,1,0,0,0,42,388,1,0,0,0,44,391,1,0,0,0,46,401,1,0,0,0,48,406,1,0,0,0,50,417,1,0,0,0,52,427,1,0,0,0,54,431,1,0,0,0,56,442,1,0,0,0,58,444,1,0,0,0,60,446,1,0,0,0,62,448,1,0,0,0,64,454,1,0,0,0,66,463,1,0,0,0,68,465,1,0,0,0,70,470,1,0,0,0,72,472,1,0,0,0,74,484,1,0,0,0,76,495,1,0,0,0,78,497,1,0,0,0,80,501,1,0,0,0,82,511,1,0,0,0,84,518,1,0,0,0,86,522,1,0,0,0,88,527,1,0,0,0,90,529,1,0,0,0,92,534,1,0,0,0,94,539,1,0,0,0,96,543,1,0,0,0,98,546,1,0,0,0,100,552,1,0,0,0,102,556,1,0,0,0,104,560,1,0,0,0,106,564,1,0,0,0,108,566,1,0,0,0,110,568,1,0,0,0,112,576,1,0,0,0,114,584,1,0,0,0,116,592,1,0,0,0,118,603,1,0,0,0,120,614,1,0,0,0,122,625,1,0,0,0,124,634,1,0,0,0,126,636,1,0,0,0,128,639,1,0,0,0,130,642,1,0,0,0,132,653,1,0,0,0,134,655,1,0,0,0,136,658,1,0,0,0,138,661,1,0,0,0,140,664,1,0,0,0,142,667,1,0,0,0,144,679,1,0,0,0,146,681,1,0,0,0,148,693,1,0,0,0,150,695,1,0,0,0,152,707,1,0,0,0,154,713,1,0,0,0,156,715,1,0,0,0,158,717,1,0,0,0,160,742,1,0,0,0,162,756,1,0,0,0,164,760,1,0,0,0,166,775,1,0,0,0,168,781,1,0,0,0,170,783,1,0,0,0,172,785,1,0,0,0,174,787,1,0,0,0,176,789,1,0,0,0,178,791,1,0,0,0,180,795,1,0,0,0,182,811,1,0,0,0,184,821,1,0,0,0,186,823,1,0,0,0,188,826,1,0,0,0,190,833,1,0,0,0,192,847,1,0,0,0,194,853,1,0,0,0,196,855,1,0,0,0,198,859,1,0,0,0,200,864,1,0,0,0,202,866,1,0,0,0,204,870,1,0,0,0,206,873,1,0,0,0,208,882,1,0,0,0,210,884,1,0,0,0,212,892,1,0,0,0,214,898,1,0,0,0,216,901,1,0,0,0,218,912,1,0,0,0,220,914,1,0,0,0,222,916,1,0,0,0,224,919,1,0,0,0,226,923,1,0,0,0,228,229,3,2,1,0,229,1,1,0,0,0,230,232,3,8,4,0,231,230,1,0,0,0,231,232,1,0,0,0,232,233,1,0,0,0,233,234,5,0,0,1,234,3,1,0,0,0,235,237,3,106,53,0,236,238,5,67,0,0,237,236,1,0,0,0,237,238,1,0,0,0,238,239,1,0,0,0,239,240,5,0,0,1,240,5,1,0,0,0,241,243,3,224,112,0,242,241,1,0,0,0,242,243,1,0,0,0,243,244,1,0,0,0,244,245,5,0,0,1,245,7,1,0,0,0,246,248,3,10,5,0,247,246,1,0,0,0,248,249,1,0,0,0,249,247,1,0,0,0,249,250,1,0,0,0,250,9,1,0,0,0,251,255,3,12,6,0,252,255,3,14,7,0,253,255,3,16,8,0,254,251,1,0,0,0,254,252,1,0,0,0,254,253,1,0,0,0,255,11,1,0,0,0,256,263,3,20,10,0,257,263,3,44,22,0,258,263,3,50,25,0,259,263,3,58,29,0,260,263,3,38,19,0,261,263,3,32,16,0,262,256,1,0,0,0,262,257,1,0,0,0,262,258,1,0,0,0,262,259,1,0,0,0,262,260,1,0,0,0,262,261,1,0,0,0,263,13,1,0,0,0,264,269,3,18,9,0,265,266,5,45,0,0,266,268,3,18,9,0,267,265,1,0,0,0,268,271,1,0,0,0,269,267,1,0,0,0,269,270,1,0,0,0,270,273,1,0,0,0,271,269,1,0,0,0,272,274,5,45,0,0,273,272,1,0,0,0,273,274,1,0,0,0,274,275,1,0,0,0,275,276,5,67,0,0,276,15,1,0,0,0,277,282,3,18,9,0,278,279,5,45,0,0,279,281,3,18,9,0,280,278,1,0,0,0,281,284,1,0,0,0,282,280,1,0,0,0,282,283,1,0,0,0,283,285,1,0,0,0,284,282,1,0,0,0,285,286,5,45,0,0,286,287,3,56,28,0,287,17,1,0,0,0,288,294,3,94,47,0,289,294,3,108,54,0,290,294,3,182,91,0,291,294,3,184,92,0,292,294,3,186,93,0,293,288,1,0,0,0,293,289,1,0,0,0,293,290,1,0,0,0,293,291,1,0,0,0,293,292,1,0,0,0,294,19,1,0,0,0,295,299,3,22,11,0,296,299,3,28,14,0,297,299,3,30,15,0,298,295,1,0,0,0,298,296,1,0,0,0,298,297,1,0,0,0,299,21,1,0,0,0,300,303,3,24,12,0,301,303,3,26,13,0,302,300,1,0,0,0,302,301,1,0,0,0,303,23,1,0,0,0,304,306,5,11,0,0,305,304,1,0,0,0,305,306,1,0,0,0,306,307,1,0,0,0,307,308,3,188,94,0,308,309,5,42,0,0,309,310,3,60,30,0,310,25,1,0,0,0,311,312,3,190,95,0,312,313,5,42,0,0,313,314,3,60,30,0,314,27,1,0,0,0,315,316,3,158,79,0,316,317,5,62,0,0,317,318,3,60,30,0,318,29,1,0,0,0,319,320,3,158,79,0,320,321,3,204,102,0,321,322,3,60,30,0,322,31,1,0,0,0,323,325,5,11,0,0,324,323,1,0,0,0,324,325,1,0,0,0,325,327,1,0,0,0,326,328,3,206,103,0,327,326,1,0,0,0,327,328,1,0,0,0,328,329,1,0,0,0,329,330,3,218,109,0,330,332,5,30,0,0,331,333,3,34,17,0,332,331,1,0,0,0,332,333,1,0,0,0,333,334,1,0,0,0,334,335,5,31,0,0,335,336,5,43,0,0,336,337,3,88,44,0,337,33,1,0,0,0,338,343,3,36,18,0,339,340,5,45,0,0,340,342,3,36,18,0,341,339,1,0,0,0,342,345,1,0,0,0,343,341,1,0,0,0,343,344,1,0,0,0,344,347,1,0,0,0,345,343,1,0,0,0,346,348,5,45,0,0,347,346,1,0,0,0,347,348,1,0,0,0,348,35,1,0,0,0,349,351,3,206,103,0,350,349,1,0,0,0,350,351,1,0,0,0,351,352,1,0,0,0,352,355,3,222,111,0,353,354,5,42,0,0,354,356,3,106,53,0,355,353,1,0,0,0,355,356,1,0,0,0,356,37,1,0,0,0,357,359,5,11,0,0,358,357,1,0,0,0,358,359,1,0,0,0,359,360,1,0,0,0,360,362,5,18,0,0,361,363,3,206,103,0,362,361,1,0,0,0,362,363,1,0,0,0,363,364,1,0,0,0,364,365,3,218,109,0,365,367,5,30,0,0,366,368,3,40,20,0,367,366,1,0,0,0,367,368,1,0,0,0,368,369,1,0,0,0,369,370,5,31,0,0,370,371,5,43,0,0,371,372,3,88,44,0,372,39,1,0,0,0,373,378,3,42,21,0,374,375,5,45,0,0,375,377,3,42,21,0,376,374,1,0,0,0,377,380,1,0,0,0,378,376,1,0,0,0,378,379,1,0,0,0,379,382,1,0,0,0,380,378,1,0,0,0,381,383,5,45,0,0,382,381,1,0,0,0,382,383,1,0,0,0,383,41,1,0,0,0,384,385,3,206,103,0,385,386,3,222,111,0,386,389,1,0,0,0,387,389,3,36,18,0,388,384,1,0,0,0,388,387,1,0,0,0,389,43,1,0,0,0,390,392,5,11,0,0,391,390,1,0,0,0,391,392,1,0,0,0,392,393,1,0,0,0,393,394,5,25,0,0,394,395,3,218,109,0,395,396,5,67,0,0,396,397,5,1,0,0,397,398,3,46,23,0,398,399,5,2,0,0,399,45,1,0,0,0,400,402,3,48,24,0,401,400,1,0,0,0,402,403,1,0,0,0,403,401,1,0,0,0,403,404,1,0,0,0,404,47,1,0,0,0,405,407,5,28,0,0,406,405,1,0,0,0,406,407,1,0,0,0,407,408,1,0,0,0,408,409,3,206,103,0,409,412,3,222,111,0,410,411,5,42,0,0,411,413,3,106,53,0,412,410,1,0,0,0,412,413,1,0,0,0,413,414,1,0,0,0,414,415,5,67,0,0,415,49,1,0,0,0,416,418,5,11,0,0,417,416,1,0,0,0,417,418,1,0,0,0,418,419,1,0,0,0,419,420,5,10,0,0,420,421,3,218,109,0,421,422,5,67,0,0,422,423,5,1,0,0,423,424,3,52,26,0,424,425,5,2,0,0,425,51,1,0,0,0,426,428,3,54,27,0,427,426,1,0,0,0,428,429,1,0,0,0,429,427,1,0,0,0,429,430,1,0,0,0,430,53,1,0,0,0,431,434,3,222,111,0,432,433,5,42,0,0,433,435,3,106,53,0,434,432,1,0,0,0,434,435,1,0,0,0,435,436,1,0,0,0,436,437,5,67,0,0,437,55,1,0,0,0,438,443,3,62,31,0,439,443,3,70,35,0,440,443,3,78,39,0,441,443,3,80,40,0,442,438,1,0,0,0,442,439,1,0,0,0,442,440,1,0,0,0,442,441,1,0,0,0,443,57,1,0,0,0,444,445,3,56,28,0,445,59,1,0,0,0,446,447,3,56,28,0,447,61,1,0,0,0,448,449,5,14,0,0,449,450,3,106,53,0,450,452,3,88,44,0,451,453,3,66,33,0,452,451,1,0,0,0,452,453,1,0,0,0,453,63,1,0,0,0,454,455,5,9,0,0,455,456,5,14,0,0,456,457,3,106,53,0,457,459,3,88,44,0,458,460,3,66,33,0,459,458,1,0,0,0,459,460,1,0,0,0,460,65,1,0,0,0,461,464,3,64,32,0,462,464,3,68,34,0,463,461,1,0,0,0,463,462,1,0,0,0,464,67,1,0,0,0,465,466,5,9,0,0,466,467,3,88,44,0,467,69,1,0,0,0,468,471,3,72,36,0,469,471,3,74,37,0,470,468,1,0,0,0,470,469,1,0,0,0,471,71,1,0,0,0,472,473,5,13,0,0,473,474,3,76,38,0,474,475,5,42,0,0,475,476,3,106,53,0,476,477,5,24,0,0,477,480,3,106,53,0,478,479,5,6,0,0,479,481,3,106,53,0,480,478,1,0,0,0,480,481,1,0,0,0,481,482,1,0,0,0,482,483,3,88,44,0,483,73,1,0,0,0,484,485,5,13,0,0,485,486,3,76,38,0,486,487,5,16,0,0,487,488,3,106,53,0,488,489,3,88,44,0,489,75,1,0,0,0,490,491,3,206,103,0,491,492,3,222,111,0,492,496,1,0,0,0,493,496,3,222,111,0,494,496,3,190,95,0,495,490,1,0,0,0,495,493,1,0,0,0,495,494,1,0,0,0,496,77,1,0,0,0,497,498,5,29,0,0,498,499,3,106,53,0,499,500,3,88,44,0,500,79,1,0,0,0,501,503,5,23,0,0,502,504,3,106,53,0,503,502,1,0,0,0,503,504,1,0,0,0,504,505,1,0,0,0,505,506,5,67,0,0,506,507,5,1,0,0,507,508,3,82,41,0,508,509,5,2,0,0,509,81,1,0,0,0,510,512,3,84,42,0,511,510,1,0,0,0,512,513,1,0,0,0,513,511,1,0,0,0,513,514,1,0,0,0,514,516,1,0,0,0,515,517,3,86,43,0,516,515,1,0,0,0,516,517,1,0,0,0,517,83,1,0,0,0,518,519,3,106,53,0,519,520,5,43,0,0,520,521,3,88,44,0,521,85,1,0,0,0,522,523,5,43,0,0,523,524,3,88,44,0,524,87,1,0,0,0,525,528,3,90,45,0,526,528,3,92,46,0,527,525,1,0,0,0,527,526,1,0,0,0,528,89,1,0,0,0,529,530,5,67,0,0,530,531,5,1,0,0,531,532,3,8,4,0,532,533,5,2,0,0,533,91,1,0,0,0,534,535,3,10,5,0,535,93,1,0,0,0,536,540,3,96,48,0,537,540,3,102,51,0,538,540,3,104,52,0,539,536,1,0,0,0,539,537,1,0,0,0,539,538,1,0,0,0,540,95,1,0,0,0,541,544,3,98,49,0,542,544,3,100,50,0,543,541,1,0,0,0,543,542,1,0,0,0,544,97,1,0,0,0,545,547,5,11,0,0,546,545,1,0,0,0,546,547,1,0,0,0,547,548,1,0,0,0,548,549,3,188,94,0,549,550,5,42,0,0,550,551,3,106,53,0,551,99,1,0,0,0,552,553,3,190,95,0,553,554,5,42,0,0,554,555,3,106,53,0,555,101,1,0,0,0,556,557,3,158,79,0,557,558,7,0,0,0,558,559,3,106,53,0,559,103,1,0,0,0,560,561,3,158,79,0,561,562,3,204,102,0,562,563,3,106,53,0,563,105,1,0,0,0,564,565,3,110,55,0,565,107,1,0,0,0,566,567,3,106,53,0,567,109,1,0,0,0,568,574,3,112,56,0,569,570,5,47,0,0,570,571,3,106,53,0,571,572,5,46,0,0,572,573,3,106,53,0,573,575,1,0,0,0,574,569,1,0,0,0,574,575,1,0,0,0,575,111,1,0,0,0,576,581,3,114,57,0,577,578,5,20,0,0,578,580,3,114,57,0,579,577,1,0,0,0,580,583,1,0,0,0,581,579,1,0,0,0,581,582,1,0,0,0,582,113,1,0,0,0,583,581,1,0,0,0,584,589,3,116,58,0,585,586,5,3,0,0,586,588,3,116,58,0,587,585,1,0,0,0,588,591,1,0,0,0,589,587,1,0,0,0,589,590,1,0,0,0,590,115,1,0,0,0,591,589,1,0,0,0,592,593,6,58,-1,0,593,594,3,118,59,0,594,600,1,0,0,0,595,596,10,2,0,0,596,597,5,50,0,0,597,599,3,118,59,0,598,595,1,0,0,0,599,602,1,0,0,0,600,598,1,0,0,0,600,601,1,0,0,0,601,117,1,0,0,0,602,600,1,0,0,0,603,604,6,59,-1,0,604,605,3,120,60,0,605,611,1,0,0,0,606,607,10,2,0,0,607,608,5,51,0,0,608,610,3,120,60,0,609,606,1,0,0,0,610,613,1,0,0,0,611,609,1,0,0,0,611,612,1,0,0,0,612,119,1,0,0,0,613,611,1,0,0,0,614,615,6,60,-1,0,615,616,3,122,61,0,616,622,1,0,0,0,617,618,10,2,0,0,618,619,5,49,0,0,619,621,3,122,61,0,620,617,1,0,0,0,621,624,1,0,0,0,622,620,1,0,0,0,622,623,1,0,0,0,623,121,1,0,0,0,624,622,1,0,0,0,625,629,3,130,65,0,626,628,3,124,62,0,627,626,1,0,0,0,628,631,1,0,0,0,629,627,1,0,0,0,629,630,1,0,0,0,630,123,1,0,0,0,631,629,1,0,0,0,632,635,3,126,63,0,633,635,3,128,64,0,634,632,1,0,0,0,634,633,1,0,0,0,635,125,1,0,0,0,636,637,5,38,0,0,637,638,3,130,65,0,638,127,1,0,0,0,639,640,5,39,0,0,640,641,3,130,65,0,641,129,1,0,0,0,642,646,3,142,71,0,643,645,3,132,66,0,644,643,1,0,0,0,645,648,1,0,0,0,646,644,1,0,0,0,646,647,1,0,0,0,647,131,1,0,0,0,648,646,1,0,0,0,649,654,3,134,67,0,650,654,3,136,68,0,651,654,3,138,69,0,652,654,3,140,70,0,653,649,1,0,0,0,653,650,1,0,0,0,653,651,1,0,0,0,653,652,1,0,0,0,654,133,1,0,0,0,655,656,5,36,0,0,656,657,3,142,71,0,657,135,1,0,0,0,658,659,5,40,0,0,659,660,3,142,71,0,660,137,1,0,0,0,661,662,5,37,0,0,662,663,3,142,71,0,663,139,1,0,0,0,664,665,5,41,0,0,665,666,3,142,71,0,666,141,1,0,0,0,667,668,6,71,-1,0,668,669,3,146,73,0,669,676,1,0,0,0,670,671,10,2,0,0,671,672,3,144,72,0,672,673,3,146,73,0,673,675,1,0,0,0,674,670,1,0,0,0,675,678,1,0,0,0,676,674,1,0,0,0,676,677,1,0,0,0,677,143,1,0,0,0,678,676,1,0,0,0,679,680,7,1,0,0,680,145,1,0,0,0,681,682,6,73,-1,0,682,683,3,150,75,0,683,690,1,0,0,0,684,685,10,2,0,0,685,686,3,148,74,0,686,687,3,150,75,0,687,689,1,0,0,0,688,684,1,0,0,0,689,692,1,0,0,0,690,688,1,0,0,0,690,691,1,0,0,0,691,147,1,0,0,0,692,690,1,0,0,0,693,694,7,2,0,0,694,149,1,0,0,0,695,696,6,75,-1,0,696,697,3,154,77,0,697,704,1,0,0,0,698,699,10,2,0,0,699,700,3,152,76,0,700,701,3,154,77,0,701,703,1,0,0,0,702,698,1,0,0,0,703,706,1,0,0,0,704,702,1,0,0,0,704,705,1,0,0,0,705,151,1,0,0,0,706,704,1,0,0,0,707,708,7,3,0,0,708,153,1,0,0,0,709,710,3,156,78,0,710,711,3,154,77,0,711,714,1,0,0,0,712,714,3,158,79,0,713,709,1,0,0,0,713,712,1,0,0,0,714,155,1,0,0,0,715,716,7,4,0,0,716,157,1,0,0,0,717,718,6,79,-1,0,718,719,3,166,83,0,719,739,1,0,0,0,720,721,10,4,0,0,721,722,5,44,0,0,722,738,3,220,110,0,723,725,10,3,0,0,724,726,3,212,106,0,725,724,1,0,0,0,725,726,1,0,0,0,726,727,1,0,0,0,727,729,5,30,0,0,728,730,3,160,80,0,729,728,1,0,0,0,729,730,1,0,0,0,730,731,1,0,0,0,731,738,5,31,0,0,732,733,10,2,0,0,733,734,5,32,0,0,734,735,3,164,82,0,735,736,5,33,0,0,736,738,1,0,0,0,737,720,1,0,0,0,737,723,1,0,0,0,737,732,1,0,0,0,738,741,1,0,0,0,739,737,1,0,0,0,739,740,1,0,0,0,740,159,1,0,0,0,741,739,1,0,0,0,742,747,3,162,81,0,743,744,5,45,0,0,744,746,3,162,81,0,745,743,1,0,0,0,746,749,1,0,0,0,747,745,1,0,0,0,747,748,1,0,0,0,748,751,1,0,0,0,749,747,1,0,0,0,750,752,5,45,0,0,751,750,1,0,0,0,751,752,1,0,0,0,752,161,1,0,0,0,753,754,3,222,111,0,754,755,5,42,0,0,755,757,1,0,0,0,756,753,1,0,0,0,756,757,1,0,0,0,757,758,1,0,0,0,758,759,3,106,53,0,759,163,1,0,0,0,760,765,3,106,53,0,761,762,5,45,0,0,762,764,3,106,53,0,763,761,1,0,0,0,764,767,1,0,0,0,765,763,1,0,0,0,765,766,1,0,0,0,766,769,1,0,0,0,767,765,1,0,0,0,768,770,5,45,0,0,769,768,1,0,0,0,769,770,1,0,0,0,770,165,1,0,0,0,771,776,3,220,110,0,772,776,3,168,84,0,773,776,3,178,89,0,774,776,3,180,90,0,775,771,1,0,0,0,775,772,1,0,0,0,775,773,1,0,0,0,775,774,1,0,0,0,776,167,1,0,0,0,777,782,3,170,85,0,778,782,3,172,86,0,779,782,3,174,87,0,780,782,3,176,88,0,781,777,1,0,0,0,781,778,1,0,0,0,781,779,1,0,0,0,781,780,1,0,0,0,782,169,1,0,0,0,783,784,5,64,0,0,784,171,1,0,0,0,785,786,5,65,0,0,786,173,1,0,0,0,787,788,7,5,0,0,788,175,1,0,0,0,789,790,5,66,0,0,790,177,1,0,0,0,791,792,5,30,0,0,792,793,3,106,53,0,793,794,5,31,0,0,794,179,1,0,0,0,795,807,5,32,0,0,796,801,3,106,53,0,797,798,5,45,0,0,798,800,3,106,53,0,799,797,1,0,0,0,800,803,1,0,0,0,801,799,1,0,0,0,801,802,1,0,0,0,802,805,1,0,0,0,803,801,1,0,0,0,804,806,5,45,0,0,805,804,1,0,0,0,805,806,1,0,0,0,806,808,1,0,0,0,807,796,1,0,0,0,807,808,1,0,0,0,808,809,1,0,0,0,809,810,5,33,0,0,810,181,1,0,0,0,811,812,5,15,0,0,812,813,3,218,109,0,813,814,5,55,0,0,814,815,3,218,109,0,815,816,5,55,0,0,816,819,3,170,85,0,817,818,5,4,0,0,818,820,3,218,109,0,819,817,1,0,0,0,819,820,1,0,0,0,820,183,1,0,0,0,821,822,5,5,0,0,822,185,1,0,0,0,823,824,5,8,0,0,824,187,1,0,0,0,825,827,3,192,96,0,826,825,1,0,0,0,826,827,1,0,0,0,827,829,1,0,0,0,828,830,3,206,103,0,829,828,1,0,0,0,829,830,1,0,0,0,830,831,1,0,0,0,831,832,3,222,111,0,832,189,1,0,0,0,833,834,5,32,0,0,834,839,3,222,111,0,835,836,5,45,0,0,836,838,3,222,111,0,837,835,1,0,0,0,838,841,1,0,0,0,839,837,1,0,0,0,839,840,1,0,0,0,840,843,1,0,0,0,841,839,1,0,0,0,842,844,5,45,0,0,843,842,1,0,0,0,843,844,1,0,0,0,844,845,1,0,0,0,845,846,5,33,0,0,846,191,1,0,0,0,847,848,7,6,0,0,848,193,1,0,0,0,849,854,3,196,98,0,850,854,3,198,99,0,851,854,3,200,100,0,852,854,3,202,101,0,853,849,1,0,0,0,853,850,1,0,0,0,853,851,1,0,0,0,853,852,1,0,0,0,854,195,1,0,0,0,855,856,3,158,79,0,856,857,5,44,0,0,857,858,3,222,111,0,858,197,1,0,0,0,859,860,3,158,79,0,860,861,5,32,0,0,861,862,3,164,82,0,862,863,5,33,0,0,863,199,1,0,0,0,864,865,3,222,111,0,865,201,1,0,0,0,866,867,5,30,0,0,867,868,3,194,97,0,868,869,5,31,0,0,869,203,1,0,0,0,870,871,7,7,0,0,871,205,1,0,0,0,872,874,3,208,104,0,873,872,1,0,0,0,873,874,1,0,0,0,874,875,1,0,0,0,875,877,3,210,105,0,876,878,3,212,106,0,877,876,1,0,0,0,877,878,1,0,0,0,878,880,1,0,0,0,879,881,3,214,107,0,880,879,1,0,0,0,880,881,1,0,0,0,881,207,1,0,0,0,882,883,7,8,0,0,883,209,1,0,0,0,884,889,3,220,110,0,885,886,5,44,0,0,886,888,3,220,110,0,887,885,1,0,0,0,888,891,1,0,0,0,889,887,1,0,0,0,889,890,1,0,0,0,890,211,1,0,0,0,891,889,1,0,0,0,892,894,5,40,0,0,893,895,3,216,108,0,894,893,1,0,0,0,894,895,1,0,0,0,895,896,1,0,0,0,896,897,5,41,0,0,897,213,1,0,0,0,898,899,5,32,0,0,899,900,5,33,0,0,900,215,1,0,0,0,901,906,3,206,103,0,902,903,5,45,0,0,903,905,3,206,103,0,904,902,1,0,0,0,905,908,1,0,0,0,906,904,1,0,0,0,906,907,1,0,0,0,907,910,1,0,0,0,908,906,1,0,0,0,909,911,5,45,0,0,910,909,1,0,0,0,910,911,1,0,0,0,911,217,1,0,0,0,912,913,7,9,0,0,913,219,1,0,0,0,914,915,3,218,109,0,915,221,1,0,0,0,916,917,3,218,109,0,917,223,1,0,0,0,918,920,3,226,113,0,919,918,1,0,0,0,920,921,1,0,0,0,921,919,1,0,0,0,921,922,1,0,0,0,922,225,1,0,0,0,923,924,5,69,0,0,924,227,1,0,0,0,89,231,237,242,249,254,262,269,273,282,293,298,302,305,324,327,332,343,347,350,355,358,362,367,378,382,388,391,403,406,412,417,429,434,442,452,459,463,470,480,495,503,513,516,527,539,543,546,574,581,589,600,611,622,629,634,646,653,676,690,704,713,725,729,737,739,747,751,756,765,769,775,781,801,805,807,819,826,829,839,843,853,873,877,880,889,894,906,910,921];static __ATN;static get _ATN(){if(!S.__ATN)S.__ATN=new s6().deserialize(S._serializedATN);return S.__ATN}static DecisionsToDFA=S._ATN.decisionToState.map((T,L)=>new a6(T,L))}class a8 extends F{constructor(T,L,I){super(L,I);this.parser=T}start_script(){return this.getTypedRuleContext(p4,0)}get ruleIndex(){return S.RULE_start}accept(T){if(T.visitStart)return T.visitStart(this);else return T.visitChildren(this)}}class p4 extends F{constructor(T,L,I){super(L,I);this.parser=T}EOF(){return this.getToken(S.EOF,0)}statements(){return this.getTypedRuleContext(Z2,0)}get ruleIndex(){return S.RULE_start_script}accept(T){if(T.visitStart_script)return T.visitStart_script(this);else return T.visitChildren(this)}}class n8 extends F{constructor(T,L,I){super(L,I);this.parser=T}expression(){return this.getTypedRuleContext(r,0)}EOF(){return this.getToken(S.EOF,0)}NEWLINE(){return this.getToken(S.NEWLINE,0)}get ruleIndex(){return S.RULE_start_expression}accept(T){if(T.visitStart_expression)return T.visitStart_expression(this);else return T.visitChildren(this)}}class t8 extends F{constructor(T,L,I){super(L,I);this.parser=T}EOF(){return this.getToken(S.EOF,0)}comments(){return this.getTypedRuleContext(_5,0)}get ruleIndex(){return S.RULE_start_comments}accept(T){if(T.visitStart_comments)return T.visitStart_comments(this);else return T.visitChildren(this)}}class Z2 extends F{constructor(T,L,I){super(L,I);this.parser=T}statement_list(){return this.getTypedRuleContexts(I6)}statement(T){return this.getTypedRuleContext(I6,T)}get ruleIndex(){return S.RULE_statements}accept(T){if(T.visitStatements)return T.visitStatements(this);else return T.visitChildren(this)}}class I6 extends F{constructor(T,L,I){super(L,I);this.parser=T}compound_statement(){return this.getTypedRuleContext(x4,0)}simple_statements(){return this.getTypedRuleContext(c4,0)}trailing_structure_statements(){return this.getTypedRuleContext(m4,0)}get ruleIndex(){return S.RULE_statement}accept(T){if(T.visitStatement)return T.visitStatement(this);else return T.visitChildren(this)}}class x4 extends F{constructor(T,L,I){super(L,I);this.parser=T}compound_assignment(){return this.getTypedRuleContext(d4,0)}type_declaration(){return this.getTypedRuleContext(e4,0)}enum_declaration(){return this.getTypedRuleContext(L7,0)}structure_statement(){return this.getTypedRuleContext(_7,0)}method_declaration(){return this.getTypedRuleContext(n4,0)}function_declaration(){return this.getTypedRuleContext(s4,0)}get ruleIndex(){return S.RULE_compound_statement}accept(T){if(T.visitCompound_statement)return T.visitCompound_statement(this);else return T.visitChildren(this)}}class c4 extends F{constructor(T,L,I){super(L,I);this.parser=T}simple_statement_list(){return this.getTypedRuleContexts(y1)}simple_statement(T){return this.getTypedRuleContext(y1,T)}NEWLINE(){return this.getToken(S.NEWLINE,0)}COMMA_list(){return this.getTokens(S.COMMA)}COMMA(T){return this.getToken(S.COMMA,T)}get ruleIndex(){return S.RULE_simple_statements}accept(T){if(T.visitSimple_statements)return T.visitSimple_statements(this);else return T.visitChildren(this)}}class m4 extends F{constructor(T,L,I){super(L,I);this.parser=T}simple_statement_list(){return this.getTypedRuleContexts(y1)}simple_statement(T){return this.getTypedRuleContext(y1,T)}COMMA_list(){return this.getTokens(S.COMMA)}COMMA(T){return this.getToken(S.COMMA,T)}structure(){return this.getTypedRuleContext(U6,0)}get ruleIndex(){return S.RULE_trailing_structure_statements}accept(T){if(T.visitTrailing_structure_statements)return T.visitTrailing_structure_statements(this);else return T.visitChildren(this)}}class y1 extends F{constructor(T,L,I){super(L,I);this.parser=T}simple_assignment(){return this.getTypedRuleContext(Y7,0)}expression_statement(){return this.getTypedRuleContext(F7,0)}import_statement(){return this.getTypedRuleContext(l7,0)}break_statement(){return this.getTypedRuleContext(o7,0)}continue_statement(){return this.getTypedRuleContext(v7,0)}get ruleIndex(){return S.RULE_simple_statement}accept(T){if(T.visitSimple_statement)return T.visitSimple_statement(this);else return T.visitChildren(this)}}class d4 extends F{constructor(T,L,I){super(L,I);this.parser=T}compound_variable_initialization(){return this.getTypedRuleContext(l4,0)}compound_reassignment(){return this.getTypedRuleContext(i4,0)}compound_augassignment(){return this.getTypedRuleContext(r4,0)}get ruleIndex(){return S.RULE_compound_assignment}accept(T){if(T.visitCompound_assignment)return T.visitCompound_assignment(this);else return T.visitChildren(this)}}class l4 extends F{constructor(T,L,I){super(L,I);this.parser=T}compound_name_initialization(){return this.getTypedRuleContext(o4,0)}compound_tuple_initialization(){return this.getTypedRuleContext(v4,0)}get ruleIndex(){return S.RULE_compound_variable_initialization}accept(T){if(T.visitCompound_variable_initialization)return T.visitCompound_variable_initialization(this);else return T.visitChildren(this)}}class o4 extends F{constructor(T,L,I){super(L,I);this.parser=T}variable_declaration(){return this.getTypedRuleContext(B2,0)}EQUAL(){return this.getToken(S.EQUAL,0)}structure_expression(){return this.getTypedRuleContext(w1,0)}EXPORT(){return this.getToken(S.EXPORT,0)}get ruleIndex(){return S.RULE_compound_name_initialization}accept(T){if(T.visitCompound_name_initialization)return T.visitCompound_name_initialization(this);else return T.visitChildren(this)}}class v4 extends F{constructor(T,L,I){super(L,I);this.parser=T}tuple_declaration(){return this.getTypedRuleContext(O6,0)}EQUAL(){return this.getToken(S.EQUAL,0)}structure_expression(){return this.getTypedRuleContext(w1,0)}get ruleIndex(){return S.RULE_compound_tuple_initialization}accept(T){if(T.visitCompound_tuple_initialization)return T.visitCompound_tuple_initialization(this);else return T.visitChildren(this)}}class i4 extends F{constructor(T,L,I){super(L,I);this.parser=T}primary_expression(){return this.getTypedRuleContext(O0,0)}COLONEQUAL(){return this.getToken(S.COLONEQUAL,0)}structure_expression(){return this.getTypedRuleContext(w1,0)}get ruleIndex(){return S.RULE_compound_reassignment}accept(T){if(T.visitCompound_reassignment)return T.visitCompound_reassignment(this);else return T.visitChildren(this)}}class r4 extends F{constructor(T,L,I){super(L,I);this.parser=T}primary_expression(){return this.getTypedRuleContext(O0,0)}augassign_op(){return this.getTypedRuleContext(z2,0)}structure_expression(){return this.getTypedRuleContext(w1,0)}get ruleIndex(){return S.RULE_compound_augassignment}accept(T){if(T.visitCompound_augassignment)return T.visitCompound_augassignment(this);else return T.visitChildren(this)}}class s4 extends F{constructor(T,L,I){super(L,I);this.parser=T}name(){return this.getTypedRuleContext(c0,0)}LPAR(){return this.getToken(S.LPAR,0)}RPAR(){return this.getToken(S.RPAR,0)}RARROW(){return this.getToken(S.RARROW,0)}local_block(){return this.getTypedRuleContext(C0,0)}EXPORT(){return this.getToken(S.EXPORT,0)}type_specification(){return this.getTypedRuleContext(w0,0)}parameter_list(){return this.getTypedRuleContext(a4,0)}get ruleIndex(){return S.RULE_function_declaration}accept(T){if(T.visitFunction_declaration)return T.visitFunction_declaration(this);else return T.visitChildren(this)}}class a4 extends F{constructor(T,L,I){super(L,I);this.parser=T}parameter_definition_list(){return this.getTypedRuleContexts(_6)}parameter_definition(T){return this.getTypedRuleContext(_6,T)}COMMA_list(){return this.getTokens(S.COMMA)}COMMA(T){return this.getToken(S.COMMA,T)}get ruleIndex(){return S.RULE_parameter_list}accept(T){if(T.visitParameter_list)return T.visitParameter_list(this);else return T.visitChildren(this)}}class _6 extends F{constructor(T,L,I){super(L,I);this.parser=T}name_store(){return this.getTypedRuleContext(M0,0)}type_specification(){return this.getTypedRuleContext(w0,0)}EQUAL(){return this.getToken(S.EQUAL,0)}expression(){return this.getTypedRuleContext(r,0)}get ruleIndex(){return S.RULE_parameter_definition}accept(T){if(T.visitParameter_definition)return T.visitParameter_definition(this);else return T.visitChildren(this)}}class n4 extends F{constructor(T,L,I){super(L,I);this.parser=T}METHOD(){return this.getToken(S.METHOD,0)}name(){return this.getTypedRuleContext(c0,0)}LPAR(){return this.getToken(S.LPAR,0)}RPAR(){return this.getToken(S.RPAR,0)}RARROW(){return this.getToken(S.RARROW,0)}local_block(){return this.getTypedRuleContext(C0,0)}EXPORT(){return this.getToken(S.EXPORT,0)}type_specification(){return this.getTypedRuleContext(w0,0)}method_parameter_list(){return this.getTypedRuleContext(t4,0)}get ruleIndex(){return S.RULE_method_declaration}accept(T){if(T.visitMethod_declaration)return T.visitMethod_declaration(this);else return T.visitChildren(this)}}class t4 extends F{constructor(T,L,I){super(L,I);this.parser=T}method_parameter_definition_list(){return this.getTypedRuleContexts(_2)}method_parameter_definition(T){return this.getTypedRuleContext(_2,T)}COMMA_list(){return this.getTokens(S.COMMA)}COMMA(T){return this.getToken(S.COMMA,T)}get ruleIndex(){return S.RULE_method_parameter_list}accept(T){if(T.visitMethod_parameter_list)return T.visitMethod_parameter_list(this);else return T.visitChildren(this)}}class _2 extends F{constructor(T,L,I){super(L,I);this.parser=T}type_specification(){return this.getTypedRuleContext(w0,0)}name_store(){return this.getTypedRuleContext(M0,0)}parameter_definition(){return this.getTypedRuleContext(_6,0)}get ruleIndex(){return S.RULE_method_parameter_definition}accept(T){if(T.visitMethod_parameter_definition)return T.visitMethod_parameter_definition(this);else return T.visitChildren(this)}}class e4 extends F{constructor(T,L,I){super(L,I);this.parser=T}TYPE(){return this.getToken(S.TYPE,0)}name(){return this.getTypedRuleContext(c0,0)}NEWLINE(){return this.getToken(S.NEWLINE,0)}INDENT(){return this.getToken(S.INDENT,0)}field_definitions(){return this.getTypedRuleContext(T7,0)}DEDENT(){return this.getToken(S.DEDENT,0)}EXPORT(){return this.getToken(S.EXPORT,0)}get ruleIndex(){return S.RULE_type_declaration}accept(T){if(T.visitType_declaration)return T.visitType_declaration(this);else return T.visitChildren(this)}}class T7 extends F{constructor(T,L,I){super(L,I);this.parser=T}field_definition_list(){return this.getTypedRuleContexts(R2)}field_definition(T){return this.getTypedRuleContext(R2,T)}get ruleIndex(){return S.RULE_field_definitions}accept(T){if(T.visitField_definitions)return T.visitField_definitions(this);else return T.visitChildren(this)}}class R2 extends F{constructor(T,L,I){super(L,I);this.parser=T}type_specification(){return this.getTypedRuleContext(w0,0)}name_store(){return this.getTypedRuleContext(M0,0)}NEWLINE(){return this.getToken(S.NEWLINE,0)}VARIP(){return this.getToken(S.VARIP,0)}EQUAL(){return this.getToken(S.EQUAL,0)}expression(){return this.getTypedRuleContext(r,0)}get ruleIndex(){return S.RULE_field_definition}accept(T){if(T.visitField_definition)return T.visitField_definition(this);else return T.visitChildren(this)}}class L7 extends F{constructor(T,L,I){super(L,I);this.parser=T}ENUM(){return this.getToken(S.ENUM,0)}name(){return this.getTypedRuleContext(c0,0)}NEWLINE(){return this.getToken(S.NEWLINE,0)}INDENT(){return this.getToken(S.INDENT,0)}enum_definitions(){return this.getTypedRuleContext(I7,0)}DEDENT(){return this.getToken(S.DEDENT,0)}EXPORT(){return this.getToken(S.EXPORT,0)}get ruleIndex(){return S.RULE_enum_declaration}accept(T){if(T.visitEnum_declaration)return T.visitEnum_declaration(this);else return T.visitChildren(this)}}class I7 extends F{constructor(T,L,I){super(L,I);this.parser=T}enum_definition_list(){return this.getTypedRuleContexts($2)}enum_definition(T){return this.getTypedRuleContext($2,T)}get ruleIndex(){return S.RULE_enum_definitions}accept(T){if(T.visitEnum_definitions)return T.visitEnum_definitions(this);else return T.visitChildren(this)}}class $2 extends F{constructor(T,L,I){super(L,I);this.parser=T}name_store(){return this.getTypedRuleContext(M0,0)}NEWLINE(){return this.getToken(S.NEWLINE,0)}EQUAL(){return this.getToken(S.EQUAL,0)}expression(){return this.getTypedRuleContext(r,0)}get ruleIndex(){return S.RULE_enum_definition}accept(T){if(T.visitEnum_definition)return T.visitEnum_definition(this);else return T.visitChildren(this)}}class U6 extends F{constructor(T,L,I){super(L,I);this.parser=T}if_structure(){return this.getTypedRuleContext(R7,0)}for_structure(){return this.getTypedRuleContext(Q7,0)}while_structure(){return this.getTypedRuleContext(O7,0)}switch_structure(){return this.getTypedRuleContext(J7,0)}get ruleIndex(){return S.RULE_structure}accept(T){if(T.visitStructure)return T.visitStructure(this);else return T.visitChildren(this)}}class _7 extends F{constructor(T,L,I){super(L,I);this.parser=T}structure(){return this.getTypedRuleContext(U6,0)}get ruleIndex(){return S.RULE_structure_statement}accept(T){if(T.visitStructure_statement)return T.visitStructure_statement(this);else return T.visitChildren(this)}}class w1 extends F{constructor(T,L,I){super(L,I);this.parser=T}structure(){return this.getTypedRuleContext(U6,0)}get ruleIndex(){return S.RULE_structure_expression}accept(T){if(T.visitStructure_expression)return T.visitStructure_expression(this);else return T.visitChildren(this)}}class R7 extends F{constructor(T,L,I){super(L,I);this.parser=T}IF(){return this.getToken(S.IF,0)}expression(){return this.getTypedRuleContext(r,0)}local_block(){return this.getTypedRuleContext(C0,0)}if_tail(){return this.getTypedRuleContext(W2,0)}get ruleIndex(){return S.RULE_if_structure}accept(T){if(T.visitIf_structure)return T.visitIf_structure(this);else return T.visitChildren(this)}}class $7 extends F{constructor(T,L,I){super(L,I);this.parser=T}ELSE(){return this.getToken(S.ELSE,0)}IF(){return this.getToken(S.IF,0)}expression(){return this.getTypedRuleContext(r,0)}local_block(){return this.getTypedRuleContext(C0,0)}if_tail(){return this.getTypedRuleContext(W2,0)}get ruleIndex(){return S.RULE_elif_structure}accept(T){if(T.visitElif_structure)return T.visitElif_structure(this);else return T.visitChildren(this)}}class W2 extends F{constructor(T,L,I){super(L,I);this.parser=T}elif_structure(){return this.getTypedRuleContext($7,0)}else_block(){return this.getTypedRuleContext(G7,0)}get ruleIndex(){return S.RULE_if_tail}accept(T){if(T.visitIf_tail)return T.visitIf_tail(this);else return T.visitChildren(this)}}class G7 extends F{constructor(T,L,I){super(L,I);this.parser=T}ELSE(){return this.getToken(S.ELSE,0)}local_block(){return this.getTypedRuleContext(C0,0)}get ruleIndex(){return S.RULE_else_block}accept(T){if(T.visitElse_block)return T.visitElse_block(this);else return T.visitChildren(this)}}class Q7 extends F{constructor(T,L,I){super(L,I);this.parser=T}for_structure_to(){return this.getTypedRuleContext(U7,0)}for_structure_in(){return this.getTypedRuleContext(S7,0)}get ruleIndex(){return S.RULE_for_structure}accept(T){if(T.visitFor_structure)return T.visitFor_structure(this);else return T.visitChildren(this)}}class U7 extends F{constructor(T,L,I){super(L,I);this.parser=T}FOR(){return this.getToken(S.FOR,0)}for_iterator(){return this.getTypedRuleContext(D2,0)}EQUAL(){return this.getToken(S.EQUAL,0)}expression_list(){return this.getTypedRuleContexts(r)}expression(T){return this.getTypedRuleContext(r,T)}TO(){return this.getToken(S.TO,0)}local_block(){return this.getTypedRuleContext(C0,0)}BY(){return this.getToken(S.BY,0)}get ruleIndex(){return S.RULE_for_structure_to}accept(T){if(T.visitFor_structure_to)return T.visitFor_structure_to(this);else return T.visitChildren(this)}}class S7 extends F{constructor(T,L,I){super(L,I);this.parser=T}FOR(){return this.getToken(S.FOR,0)}for_iterator(){return this.getTypedRuleContext(D2,0)}IN(){return this.getToken(S.IN,0)}expression(){return this.getTypedRuleContext(r,0)}local_block(){return this.getTypedRuleContext(C0,0)}get ruleIndex(){return S.RULE_for_structure_in}accept(T){if(T.visitFor_structure_in)return T.visitFor_structure_in(this);else return T.visitChildren(this)}}class D2 extends F{constructor(T,L,I){super(L,I);this.parser=T}type_specification(){return this.getTypedRuleContext(w0,0)}name_store(){return this.getTypedRuleContext(M0,0)}tuple_declaration(){return this.getTypedRuleContext(O6,0)}get ruleIndex(){return S.RULE_for_iterator}accept(T){if(T.visitFor_iterator)return T.visitFor_iterator(this);else return T.visitChildren(this)}}class O7 extends F{constructor(T,L,I){super(L,I);this.parser=T}WHILE(){return this.getToken(S.WHILE,0)}expression(){return this.getTypedRuleContext(r,0)}local_block(){return this.getTypedRuleContext(C0,0)}get ruleIndex(){return S.RULE_while_structure}accept(T){if(T.visitWhile_structure)return T.visitWhile_structure(this);else return T.visitChildren(this)}}class J7 extends F{constructor(T,L,I){super(L,I);this.parser=T}SWITCH(){return this.getToken(S.SWITCH,0)}NEWLINE(){return this.getToken(S.NEWLINE,0)}INDENT(){return this.getToken(S.INDENT,0)}switch_cases(){return this.getTypedRuleContext(Z7,0)}DEDENT(){return this.getToken(S.DEDENT,0)}expression(){return this.getTypedRuleContext(r,0)}get ruleIndex(){return S.RULE_switch_structure}accept(T){if(T.visitSwitch_structure)return T.visitSwitch_structure(this);else return T.visitChildren(this)}}class Z7 extends F{constructor(T,L,I){super(L,I);this.parser=T}switch_pattern_case_list(){return this.getTypedRuleContexts(G2)}switch_pattern_case(T){return this.getTypedRuleContext(G2,T)}switch_default_case(){return this.getTypedRuleContext(W7,0)}get ruleIndex(){return S.RULE_switch_cases}accept(T){if(T.visitSwitch_cases)return T.visitSwitch_cases(this);else return T.visitChildren(this)}}class G2 extends F{constructor(T,L,I){super(L,I);this.parser=T}expression(){return this.getTypedRuleContext(r,0)}RARROW(){return this.getToken(S.RARROW,0)}local_block(){return this.getTypedRuleContext(C0,0)}get ruleIndex(){return S.RULE_switch_pattern_case}accept(T){if(T.visitSwitch_pattern_case)return T.visitSwitch_pattern_case(this);else return T.visitChildren(this)}}class W7 extends F{constructor(T,L,I){super(L,I);this.parser=T}RARROW(){return this.getToken(S.RARROW,0)}local_block(){return this.getTypedRuleContext(C0,0)}get ruleIndex(){return S.RULE_switch_default_case}accept(T){if(T.visitSwitch_default_case)return T.visitSwitch_default_case(this);else return T.visitChildren(this)}}class C0 extends F{constructor(T,L,I){super(L,I);this.parser=T}indented_local_block(){return this.getTypedRuleContext(D7,0)}inline_local_block(){return this.getTypedRuleContext(K7,0)}get ruleIndex(){return S.RULE_local_block}accept(T){if(T.visitLocal_block)return T.visitLocal_block(this);else return T.visitChildren(this)}}class D7 extends F{constructor(T,L,I){super(L,I);this.parser=T}NEWLINE(){return this.getToken(S.NEWLINE,0)}INDENT(){return this.getToken(S.INDENT,0)}statements(){return this.getTypedRuleContext(Z2,0)}DEDENT(){return this.getToken(S.DEDENT,0)}get ruleIndex(){return S.RULE_indented_local_block}accept(T){if(T.visitIndented_local_block)return T.visitIndented_local_block(this);else return T.visitChildren(this)}}class K7 extends F{constructor(T,L,I){super(L,I);this.parser=T}statement(){return this.getTypedRuleContext(I6,0)}get ruleIndex(){return S.RULE_inline_local_block}accept(T){if(T.visitInline_local_block)return T.visitInline_local_block(this);else return T.visitChildren(this)}}class Y7 extends F{constructor(T,L,I){super(L,I);this.parser=T}simple_variable_initialization(){return this.getTypedRuleContext(X7,0)}simple_reassignment(){return this.getTypedRuleContext(H7,0)}simple_augassignment(){return this.getTypedRuleContext(V7,0)}get ruleIndex(){return S.RULE_simple_assignment}accept(T){if(T.visitSimple_assignment)return T.visitSimple_assignment(this);else return T.visitChildren(this)}}class X7 extends F{constructor(T,L,I){super(L,I);this.parser=T}simple_name_initialization(){return this.getTypedRuleContext(B7,0)}simple_tuple_initialization(){return this.getTypedRuleContext(z7,0)}get ruleIndex(){return S.RULE_simple_variable_initialization}accept(T){if(T.visitSimple_variable_initialization)return T.visitSimple_variable_initialization(this);else return T.visitChildren(this)}}class B7 extends F{constructor(T,L,I){super(L,I);this.parser=T}variable_declaration(){return this.getTypedRuleContext(B2,0)}EQUAL(){return this.getToken(S.EQUAL,0)}expression(){return this.getTypedRuleContext(r,0)}EXPORT(){return this.getToken(S.EXPORT,0)}get ruleIndex(){return S.RULE_simple_name_initialization}accept(T){if(T.visitSimple_name_initialization)return T.visitSimple_name_initialization(this);else return T.visitChildren(this)}}class z7 extends F{constructor(T,L,I){super(L,I);this.parser=T}tuple_declaration(){return this.getTypedRuleContext(O6,0)}EQUAL(){return this.getToken(S.EQUAL,0)}expression(){return this.getTypedRuleContext(r,0)}get ruleIndex(){return S.RULE_simple_tuple_initialization}accept(T){if(T.visitSimple_tuple_initialization)return T.visitSimple_tuple_initialization(this);else return T.visitChildren(this)}}class H7 extends F{constructor(T,L,I){super(L,I);this.parser=T}primary_expression(){return this.getTypedRuleContext(O0,0)}expression(){return this.getTypedRuleContext(r,0)}COLONEQUAL(){return this.getToken(S.COLONEQUAL,0)}EQUAL(){return this.getToken(S.EQUAL,0)}get ruleIndex(){return S.RULE_simple_reassignment}accept(T){if(T.visitSimple_reassignment)return T.visitSimple_reassignment(this);else return T.visitChildren(this)}}class V7 extends F{constructor(T,L,I){super(L,I);this.parser=T}primary_expression(){return this.getTypedRuleContext(O0,0)}augassign_op(){return this.getTypedRuleContext(z2,0)}expression(){return this.getTypedRuleContext(r,0)}get ruleIndex(){return S.RULE_simple_augassignment}accept(T){if(T.visitSimple_augassignment)return T.visitSimple_augassignment(this);else return T.visitChildren(this)}}class r extends F{constructor(T,L,I){super(L,I);this.parser=T}conditional_expression(){return this.getTypedRuleContext(q7,0)}get ruleIndex(){return S.RULE_expression}accept(T){if(T.visitExpression)return T.visitExpression(this);else return T.visitChildren(this)}}class F7 extends F{constructor(T,L,I){super(L,I);this.parser=T}expression(){return this.getTypedRuleContext(r,0)}get ruleIndex(){return S.RULE_expression_statement}accept(T){if(T.visitExpression_statement)return T.visitExpression_statement(this);else return T.visitChildren(this)}}class q7 extends F{constructor(T,L,I){super(L,I);this.parser=T}disjunction_expression(){return this.getTypedRuleContext(k7,0)}QUESTION(){return this.getToken(S.QUESTION,0)}expression_list(){return this.getTypedRuleContexts(r)}expression(T){return this.getTypedRuleContext(r,T)}COLON(){return this.getToken(S.COLON,0)}get ruleIndex(){return S.RULE_conditional_expression}accept(T){if(T.visitConditional_expression)return T.visitConditional_expression(this);else return T.visitChildren(this)}}class k7 extends F{constructor(T,L,I){super(L,I);this.parser=T}conjunction_expression_list(){return this.getTypedRuleContexts(Q2)}conjunction_expression(T){return this.getTypedRuleContext(Q2,T)}OR_list(){return this.getTokens(S.OR)}OR(T){return this.getToken(S.OR,T)}get ruleIndex(){return S.RULE_disjunction_expression}accept(T){if(T.visitDisjunction_expression)return T.visitDisjunction_expression(this);else return T.visitChildren(this)}}class Q2 extends F{constructor(T,L,I){super(L,I);this.parser=T}bitwise_or_expression_list(){return this.getTypedRuleContexts(b1)}bitwise_or_expression(T){return this.getTypedRuleContext(b1,T)}AND_list(){return this.getTokens(S.AND)}AND(T){return this.getToken(S.AND,T)}get ruleIndex(){return S.RULE_conjunction_expression}accept(T){if(T.visitConjunction_expression)return T.visitConjunction_expression(this);else return T.visitChildren(this)}}class b1 extends F{constructor(T,L,I){super(L,I);this.parser=T}bitwise_xor_expression(){return this.getTypedRuleContext(R6,0)}bitwise_or_expression(){return this.getTypedRuleContext(b1,0)}PIPE(){return this.getToken(S.PIPE,0)}get ruleIndex(){return S.RULE_bitwise_or_expression}accept(T){if(T.visitBitwise_or_expression)return T.visitBitwise_or_expression(this);else return T.visitChildren(this)}}class R6 extends F{constructor(T,L,I){super(L,I);this.parser=T}bitwise_and_expression(){return this.getTypedRuleContext($6,0)}bitwise_xor_expression(){return this.getTypedRuleContext(R6,0)}CARET(){return this.getToken(S.CARET,0)}get ruleIndex(){return S.RULE_bitwise_xor_expression}accept(T){if(T.visitBitwise_xor_expression)return T.visitBitwise_xor_expression(this);else return T.visitChildren(this)}}class $6 extends F{constructor(T,L,I){super(L,I);this.parser=T}equality_expression(){return this.getTypedRuleContext(M7,0)}bitwise_and_expression(){return this.getTypedRuleContext($6,0)}AMP(){return this.getToken(S.AMP,0)}get ruleIndex(){return S.RULE_bitwise_and_expression}accept(T){if(T.visitBitwise_and_expression)return T.visitBitwise_and_expression(this);else return T.visitChildren(this)}}class M7 extends F{constructor(T,L,I){super(L,I);this.parser=T}inequality_expression(){return this.getTypedRuleContext(S6,0)}equality_trailing_pair_list(){return this.getTypedRuleContexts(U2)}equality_trailing_pair(T){return this.getTypedRuleContext(U2,T)}get ruleIndex(){return S.RULE_equality_expression}accept(T){if(T.visitEquality_expression)return T.visitEquality_expression(this);else return T.visitChildren(this)}}class U2 extends F{constructor(T,L,I){super(L,I);this.parser=T}equal_trailing_pair(){return this.getTypedRuleContext(E7,0)}not_equal_trailing_pair(){return this.getTypedRuleContext(j7,0)}get ruleIndex(){return S.RULE_equality_trailing_pair}accept(T){if(T.visitEquality_trailing_pair)return T.visitEquality_trailing_pair(this);else return T.visitChildren(this)}}class E7 extends F{constructor(T,L,I){super(L,I);this.parser=T}EQEQUAL(){return this.getToken(S.EQEQUAL,0)}inequality_expression(){return this.getTypedRuleContext(S6,0)}get ruleIndex(){return S.RULE_equal_trailing_pair}accept(T){if(T.visitEqual_trailing_pair)return T.visitEqual_trailing_pair(this);else return T.visitChildren(this)}}class j7 extends F{constructor(T,L,I){super(L,I);this.parser=T}NOTEQUAL(){return this.getToken(S.NOTEQUAL,0)}inequality_expression(){return this.getTypedRuleContext(S6,0)}get ruleIndex(){return S.RULE_not_equal_trailing_pair}accept(T){if(T.visitNot_equal_trailing_pair)return T.visitNot_equal_trailing_pair(this);else return T.visitChildren(this)}}class S6 extends F{constructor(T,L,I){super(L,I);this.parser=T}shift_expression(){return this.getTypedRuleContext(a0,0)}inequality_trailing_pair_list(){return this.getTypedRuleContexts(S2)}inequality_trailing_pair(T){return this.getTypedRuleContext(S2,T)}get ruleIndex(){return S.RULE_inequality_expression}accept(T){if(T.visitInequality_expression)return T.visitInequality_expression(this);else return T.visitChildren(this)}}class S2 extends F{constructor(T,L,I){super(L,I);this.parser=T}less_than_equal_trailing_pair(){return this.getTypedRuleContext(C7,0)}less_than_trailing_pair(){return this.getTypedRuleContext(P7,0)}greater_than_equal_trailing_pair(){return this.getTypedRuleContext(N7,0)}greater_than_trailing_pair(){return this.getTypedRuleContext(y7,0)}get ruleIndex(){return S.RULE_inequality_trailing_pair}accept(T){if(T.visitInequality_trailing_pair)return T.visitInequality_trailing_pair(this);else return T.visitChildren(this)}}class C7 extends F{constructor(T,L,I){super(L,I);this.parser=T}LESSEQUAL(){return this.getToken(S.LESSEQUAL,0)}shift_expression(){return this.getTypedRuleContext(a0,0)}get ruleIndex(){return S.RULE_less_than_equal_trailing_pair}accept(T){if(T.visitLess_than_equal_trailing_pair)return T.visitLess_than_equal_trailing_pair(this);else return T.visitChildren(this)}}class P7 extends F{constructor(T,L,I){super(L,I);this.parser=T}LESS(){return this.getToken(S.LESS,0)}shift_expression(){return this.getTypedRuleContext(a0,0)}get ruleIndex(){return S.RULE_less_than_trailing_pair}accept(T){if(T.visitLess_than_trailing_pair)return T.visitLess_than_trailing_pair(this);else return T.visitChildren(this)}}class N7 extends F{constructor(T,L,I){super(L,I);this.parser=T}GREATEREQUAL(){return this.getToken(S.GREATEREQUAL,0)}shift_expression(){return this.getTypedRuleContext(a0,0)}get ruleIndex(){return S.RULE_greater_than_equal_trailing_pair}accept(T){if(T.visitGreater_than_equal_trailing_pair)return T.visitGreater_than_equal_trailing_pair(this);else return T.visitChildren(this)}}class y7 extends F{constructor(T,L,I){super(L,I);this.parser=T}GREATER(){return this.getToken(S.GREATER,0)}shift_expression(){return this.getTypedRuleContext(a0,0)}get ruleIndex(){return S.RULE_greater_than_trailing_pair}accept(T){if(T.visitGreater_than_trailing_pair)return T.visitGreater_than_trailing_pair(this);else return T.visitChildren(this)}}class a0 extends F{constructor(T,L,I){super(L,I);this.parser=T}additive_expression(){return this.getTypedRuleContext(G6,0)}shift_expression(){return this.getTypedRuleContext(a0,0)}shift_op(){return this.getTypedRuleContext(b7,0)}get ruleIndex(){return S.RULE_shift_expression}accept(T){if(T.visitShift_expression)return T.visitShift_expression(this);else return T.visitChildren(this)}}class b7 extends F{constructor(T,L,I){super(L,I);this.parser=T}LSHIFT(){return this.getToken(S.LSHIFT,0)}RSHIFT(){return this.getToken(S.RSHIFT,0)}get ruleIndex(){return S.RULE_shift_op}accept(T){if(T.visitShift_op)return T.visitShift_op(this);else return T.visitChildren(this)}}class G6 extends F{constructor(T,L,I){super(L,I);this.parser=T}multiplicative_expression(){return this.getTypedRuleContext(Q6,0)}additive_expression(){return this.getTypedRuleContext(G6,0)}additive_op(){return this.getTypedRuleContext(h7,0)}get ruleIndex(){return S.RULE_additive_expression}accept(T){if(T.visitAdditive_expression)return T.visitAdditive_expression(this);else return T.visitChildren(this)}}class h7 extends F{constructor(T,L,I){super(L,I);this.parser=T}PLUS(){return this.getToken(S.PLUS,0)}MINUS(){return this.getToken(S.MINUS,0)}get ruleIndex(){return S.RULE_additive_op}accept(T){if(T.visitAdditive_op)return T.visitAdditive_op(this);else return T.visitChildren(this)}}class Q6 extends F{constructor(T,L,I){super(L,I);this.parser=T}unary_expression(){return this.getTypedRuleContext(K2,0)}multiplicative_expression(){return this.getTypedRuleContext(Q6,0)}multiplicative_op(){return this.getTypedRuleContext(w7,0)}get ruleIndex(){return S.RULE_multiplicative_expression}accept(T){if(T.visitMultiplicative_expression)return T.visitMultiplicative_expression(this);else return T.visitChildren(this)}}class w7 extends F{constructor(T,L,I){super(L,I);this.parser=T}STAR(){return this.getToken(S.STAR,0)}SLASH(){return this.getToken(S.SLASH,0)}PERCENT(){return this.getToken(S.PERCENT,0)}get ruleIndex(){return S.RULE_multiplicative_op}accept(T){if(T.visitMultiplicative_op)return T.visitMultiplicative_op(this);else return T.visitChildren(this)}}class K2 extends F{constructor(T,L,I){super(L,I);this.parser=T}unary_op(){return this.getTypedRuleContext(A7,0)}unary_expression(){return this.getTypedRuleContext(K2,0)}primary_expression(){return this.getTypedRuleContext(O0,0)}get ruleIndex(){return S.RULE_unary_expression}accept(T){if(T.visitUnary_expression)return T.visitUnary_expression(this);else return T.visitChildren(this)}}class A7 extends F{constructor(T,L,I){super(L,I);this.parser=T}NOT(){return this.getToken(S.NOT,0)}PLUS(){return this.getToken(S.PLUS,0)}MINUS(){return this.getToken(S.MINUS,0)}TILDE(){return this.getToken(S.TILDE,0)}get ruleIndex(){return S.RULE_unary_op}accept(T){if(T.visitUnary_op)return T.visitUnary_op(this);else return T.visitChildren(this)}}class O0 extends F{constructor(T,L,I){super(L,I);this.parser=T}get ruleIndex(){return S.RULE_primary_expression}copyFrom(T){super.copyFrom(T)}}class e8 extends O0{constructor(T,L){super(T,L.parentCtx,L.invokingState);super.copyFrom(L)}primary_expression(){return this.getTypedRuleContext(O0,0)}DOT(){return this.getToken(S.DOT,0)}name_load(){return this.getTypedRuleContext(h1,0)}accept(T){if(T.visitPrimary_expression_attribute)return T.visitPrimary_expression_attribute(this);else return T.visitChildren(this)}}class T9 extends O0{constructor(T,L){super(T,L.parentCtx,L.invokingState);super.copyFrom(L)}primary_expression(){return this.getTypedRuleContext(O0,0)}LPAR(){return this.getToken(S.LPAR,0)}RPAR(){return this.getToken(S.RPAR,0)}template_spec_suffix(){return this.getTypedRuleContext(H2,0)}argument_list(){return this.getTypedRuleContext(u7,0)}accept(T){if(T.visitPrimary_expression_call)return T.visitPrimary_expression_call(this);else return T.visitChildren(this)}}class L9 extends O0{constructor(T,L){super(T,L.parentCtx,L.invokingState);super.copyFrom(L)}atomic_expression(){return this.getTypedRuleContext(g7,0)}accept(T){if(T.visitPrimary_expression_fallback)return T.visitPrimary_expression_fallback(this);else return T.visitChildren(this)}}class I9 extends O0{constructor(T,L){super(T,L.parentCtx,L.invokingState);super.copyFrom(L)}primary_expression(){return this.getTypedRuleContext(O0,0)}LSQB(){return this.getToken(S.LSQB,0)}subscript_slice(){return this.getTypedRuleContext(Y2,0)}RSQB(){return this.getToken(S.RSQB,0)}accept(T){if(T.visitPrimary_expression_subscript)return T.visitPrimary_expression_subscript(this);else return T.visitChildren(this)}}class u7 extends F{constructor(T,L,I){super(L,I);this.parser=T}argument_definition_list(){return this.getTypedRuleContexts(O2)}argument_definition(T){return this.getTypedRuleContext(O2,T)}COMMA_list(){return this.getTokens(S.COMMA)}COMMA(T){return this.getToken(S.COMMA,T)}get ruleIndex(){return S.RULE_argument_list}accept(T){if(T.visitArgument_list)return T.visitArgument_list(this);else return T.visitChildren(this)}}class O2 extends F{constructor(T,L,I){super(L,I);this.parser=T}expression(){return this.getTypedRuleContext(r,0)}name_store(){return this.getTypedRuleContext(M0,0)}EQUAL(){return this.getToken(S.EQUAL,0)}get ruleIndex(){return S.RULE_argument_definition}accept(T){if(T.visitArgument_definition)return T.visitArgument_definition(this);else return T.visitChildren(this)}}class Y2 extends F{constructor(T,L,I){super(L,I);this.parser=T}expression_list(){return this.getTypedRuleContexts(r)}expression(T){return this.getTypedRuleContext(r,T)}COMMA_list(){return this.getTokens(S.COMMA)}COMMA(T){return this.getToken(S.COMMA,T)}get ruleIndex(){return S.RULE_subscript_slice}accept(T){if(T.visitSubscript_slice)return T.visitSubscript_slice(this);else return T.visitChildren(this)}}class g7 extends F{constructor(T,L,I){super(L,I);this.parser=T}name_load(){return this.getTypedRuleContext(h1,0)}literal_expression(){return this.getTypedRuleContext(f7,0)}grouped_expression(){return this.getTypedRuleContext(m7,0)}tuple_expression(){return this.getTypedRuleContext(d7,0)}get ruleIndex(){return S.RULE_atomic_expression}accept(T){if(T.visitAtomic_expression)return T.visitAtomic_expression(this);else return T.visitChildren(this)}}class f7 extends F{constructor(T,L,I){super(L,I);this.parser=T}literal_number(){return this.getTypedRuleContext(X2,0)}literal_string(){return this.getTypedRuleContext(p7,0)}literal_bool(){return this.getTypedRuleContext(x7,0)}literal_color(){return this.getTypedRuleContext(c7,0)}get ruleIndex(){return S.RULE_literal_expression}accept(T){if(T.visitLiteral_expression)return T.visitLiteral_expression(this);else return T.visitChildren(this)}}class X2 extends F{constructor(T,L,I){super(L,I);this.parser=T}NUMBER(){return this.getToken(S.NUMBER,0)}get ruleIndex(){return S.RULE_literal_number}accept(T){if(T.visitLiteral_number)return T.visitLiteral_number(this);else return T.visitChildren(this)}}class p7 extends F{constructor(T,L,I){super(L,I);this.parser=T}STRING(){return this.getToken(S.STRING,0)}get ruleIndex(){return S.RULE_literal_string}accept(T){if(T.visitLiteral_string)return T.visitLiteral_string(this);else return T.visitChildren(this)}}class x7 extends F{constructor(T,L,I){super(L,I);this.parser=T}TRUE(){return this.getToken(S.TRUE,0)}FALSE(){return this.getToken(S.FALSE,0)}get ruleIndex(){return S.RULE_literal_bool}accept(T){if(T.visitLiteral_bool)return T.visitLiteral_bool(this);else return T.visitChildren(this)}}class c7 extends F{constructor(T,L,I){super(L,I);this.parser=T}COLOR(){return this.getToken(S.COLOR,0)}get ruleIndex(){return S.RULE_literal_color}accept(T){if(T.visitLiteral_color)return T.visitLiteral_color(this);else return T.visitChildren(this)}}class m7 extends F{constructor(T,L,I){super(L,I);this.parser=T}LPAR(){return this.getToken(S.LPAR,0)}expression(){return this.getTypedRuleContext(r,0)}RPAR(){return this.getToken(S.RPAR,0)}get ruleIndex(){return S.RULE_grouped_expression}accept(T){if(T.visitGrouped_expression)return T.visitGrouped_expression(this);else return T.visitChildren(this)}}class d7 extends F{constructor(T,L,I){super(L,I);this.parser=T}LSQB(){return this.getToken(S.LSQB,0)}RSQB(){return this.getToken(S.RSQB,0)}expression_list(){return this.getTypedRuleContexts(r)}expression(T){return this.getTypedRuleContext(r,T)}COMMA_list(){return this.getTokens(S.COMMA)}COMMA(T){return this.getToken(S.COMMA,T)}get ruleIndex(){return S.RULE_tuple_expression}accept(T){if(T.visitTuple_expression)return T.visitTuple_expression(this);else return T.visitChildren(this)}}class l7 extends F{constructor(T,L,I){super(L,I);this.parser=T}IMPORT(){return this.getToken(S.IMPORT,0)}name_list(){return this.getTypedRuleContexts(c0)}name(T){return this.getTypedRuleContext(c0,T)}SLASH_list(){return this.getTokens(S.SLASH)}SLASH(T){return this.getToken(S.SLASH,T)}literal_number(){return this.getTypedRuleContext(X2,0)}AS(){return this.getToken(S.AS,0)}get ruleIndex(){return S.RULE_import_statement}accept(T){if(T.visitImport_statement)return T.visitImport_statement(this);else return T.visitChildren(this)}}class o7 extends F{constructor(T,L,I){super(L,I);this.parser=T}BREAK(){return this.getToken(S.BREAK,0)}get ruleIndex(){return S.RULE_break_statement}accept(T){if(T.visitBreak_statement)return T.visitBreak_statement(this);else return T.visitChildren(this)}}class v7 extends F{constructor(T,L,I){super(L,I);this.parser=T}CONTINUE(){return this.getToken(S.CONTINUE,0)}get ruleIndex(){return S.RULE_continue_statement}accept(T){if(T.visitContinue_statement)return T.visitContinue_statement(this);else return T.visitChildren(this)}}class B2 extends F{constructor(T,L,I){super(L,I);this.parser=T}name_store(){return this.getTypedRuleContext(M0,0)}declaration_mode(){return this.getTypedRuleContext(i7,0)}type_specification(){return this.getTypedRuleContext(w0,0)}get ruleIndex(){return S.RULE_variable_declaration}accept(T){if(T.visitVariable_declaration)return T.visitVariable_declaration(this);else return T.visitChildren(this)}}class O6 extends F{constructor(T,L,I){super(L,I);this.parser=T}LSQB(){return this.getToken(S.LSQB,0)}name_store_list(){return this.getTypedRuleContexts(M0)}name_store(T){return this.getTypedRuleContext(M0,T)}RSQB(){return this.getToken(S.RSQB,0)}COMMA_list(){return this.getTokens(S.COMMA)}COMMA(T){return this.getToken(S.COMMA,T)}get ruleIndex(){return S.RULE_tuple_declaration}accept(T){if(T.visitTuple_declaration)return T.visitTuple_declaration(this);else return T.visitChildren(this)}}class i7 extends F{constructor(T,L,I){super(L,I);this.parser=T}VARIP(){return this.getToken(S.VARIP,0)}VAR(){return this.getToken(S.VAR,0)}get ruleIndex(){return S.RULE_declaration_mode}accept(T){if(T.visitDeclaration_mode)return T.visitDeclaration_mode(this);else return T.visitChildren(this)}}class r7 extends F{constructor(T,L,I){super(L,I);this.parser=T}assignment_target_attribute(){return this.getTypedRuleContext(s7,0)}assignment_target_subscript(){return this.getTypedRuleContext(a7,0)}assignment_target_name(){return this.getTypedRuleContext(n7,0)}assignment_target_group(){return this.getTypedRuleContext(t7,0)}get ruleIndex(){return S.RULE_assignment_target}accept(T){if(T.visitAssignment_target)return T.visitAssignment_target(this);else return T.visitChildren(this)}}class s7 extends F{constructor(T,L,I){super(L,I);this.parser=T}primary_expression(){return this.getTypedRuleContext(O0,0)}DOT(){return this.getToken(S.DOT,0)}name_store(){return this.getTypedRuleContext(M0,0)}get ruleIndex(){return S.RULE_assignment_target_attribute}accept(T){if(T.visitAssignment_target_attribute)return T.visitAssignment_target_attribute(this);else return T.visitChildren(this)}}class a7 extends F{constructor(T,L,I){super(L,I);this.parser=T}primary_expression(){return this.getTypedRuleContext(O0,0)}LSQB(){return this.getToken(S.LSQB,0)}subscript_slice(){return this.getTypedRuleContext(Y2,0)}RSQB(){return this.getToken(S.RSQB,0)}get ruleIndex(){return S.RULE_assignment_target_subscript}accept(T){if(T.visitAssignment_target_subscript)return T.visitAssignment_target_subscript(this);else return T.visitChildren(this)}}class n7 extends F{constructor(T,L,I){super(L,I);this.parser=T}name_store(){return this.getTypedRuleContext(M0,0)}get ruleIndex(){return S.RULE_assignment_target_name}accept(T){if(T.visitAssignment_target_name)return T.visitAssignment_target_name(this);else return T.visitChildren(this)}}class t7 extends F{constructor(T,L,I){super(L,I);this.parser=T}LPAR(){return this.getToken(S.LPAR,0)}assignment_target(){return this.getTypedRuleContext(r7,0)}RPAR(){return this.getToken(S.RPAR,0)}get ruleIndex(){return S.RULE_assignment_target_group}accept(T){if(T.visitAssignment_target_group)return T.visitAssignment_target_group(this);else return T.visitChildren(this)}}class z2 extends F{constructor(T,L,I){super(L,I);this.parser=T}STAREQUAL(){return this.getToken(S.STAREQUAL,0)}SLASHEQUAL(){return this.getToken(S.SLASHEQUAL,0)}PERCENTEQUAL(){return this.getToken(S.PERCENTEQUAL,0)}PLUSEQUAL(){return this.getToken(S.PLUSEQUAL,0)}MINEQUAL(){return this.getToken(S.MINEQUAL,0)}get ruleIndex(){return S.RULE_augassign_op}accept(T){if(T.visitAugassign_op)return T.visitAugassign_op(this);else return T.visitChildren(this)}}class w0 extends F{constructor(T,L,I){super(L,I);this.parser=T}attributed_type_name(){return this.getTypedRuleContext(T5,0)}type_qualifier(){return this.getTypedRuleContext(e7,0)}template_spec_suffix(){return this.getTypedRuleContext(H2,0)}array_type_suffix(){return this.getTypedRuleContext(L5,0)}get ruleIndex(){return S.RULE_type_specification}accept(T){if(T.visitType_specification)return T.visitType_specification(this);else return T.visitChildren(this)}}class e7 extends F{constructor(T,L,I){super(L,I);this.parser=T}CONST(){return this.getToken(S.CONST,0)}INPUT(){return this.getToken(S.INPUT,0)}SIMPLE(){return this.getToken(S.SIMPLE,0)}SERIES(){return this.getToken(S.SERIES,0)}get ruleIndex(){return S.RULE_type_qualifier}accept(T){if(T.visitType_qualifier)return T.visitType_qualifier(this);else return T.visitChildren(this)}}class T5 extends F{constructor(T,L,I){super(L,I);this.parser=T}name_load_list(){return this.getTypedRuleContexts(h1)}name_load(T){return this.getTypedRuleContext(h1,T)}DOT_list(){return this.getTokens(S.DOT)}DOT(T){return this.getToken(S.DOT,T)}get ruleIndex(){return S.RULE_attributed_type_name}accept(T){if(T.visitAttributed_type_name)return T.visitAttributed_type_name(this);else return T.visitChildren(this)}}class H2 extends F{constructor(T,L,I){super(L,I);this.parser=T}LESS(){return this.getToken(S.LESS,0)}GREATER(){return this.getToken(S.GREATER,0)}type_argument_list(){return this.getTypedRuleContext(I5,0)}get ruleIndex(){return S.RULE_template_spec_suffix}accept(T){if(T.visitTemplate_spec_suffix)return T.visitTemplate_spec_suffix(this);else return T.visitChildren(this)}}class L5 extends F{constructor(T,L,I){super(L,I);this.parser=T}LSQB(){return this.getToken(S.LSQB,0)}RSQB(){return this.getToken(S.RSQB,0)}get ruleIndex(){return S.RULE_array_type_suffix}accept(T){if(T.visitArray_type_suffix)return T.visitArray_type_suffix(this);else return T.visitChildren(this)}}class I5 extends F{constructor(T,L,I){super(L,I);this.parser=T}type_specification_list(){return this.getTypedRuleContexts(w0)}type_specification(T){return this.getTypedRuleContext(w0,T)}COMMA_list(){return this.getTokens(S.COMMA)}COMMA(T){return this.getToken(S.COMMA,T)}get ruleIndex(){return S.RULE_type_argument_list}accept(T){if(T.visitType_argument_list)return T.visitType_argument_list(this);else return T.visitChildren(this)}}class c0 extends F{constructor(T,L,I){super(L,I);this.parser=T}NAME(){return this.getToken(S.NAME,0)}TYPE(){return this.getToken(S.TYPE,0)}METHOD(){return this.getToken(S.METHOD,0)}CONST(){return this.getToken(S.CONST,0)}INPUT(){return this.getToken(S.INPUT,0)}SIMPLE(){return this.getToken(S.SIMPLE,0)}SERIES(){return this.getToken(S.SERIES,0)}ENUM(){return this.getToken(S.ENUM,0)}AS(){return this.getToken(S.AS,0)}BY(){return this.getToken(S.BY,0)}TO(){return this.getToken(S.TO,0)}get ruleIndex(){return S.RULE_name}accept(T){if(T.visitName)return T.visitName(this);else return T.visitChildren(this)}}class h1 extends F{constructor(T,L,I){super(L,I);this.parser=T}name(){return this.getTypedRuleContext(c0,0)}get ruleIndex(){return S.RULE_name_load}accept(T){if(T.visitName_load)return T.visitName_load(this);else return T.visitChildren(this)}}class M0 extends F{constructor(T,L,I){super(L,I);this.parser=T}name(){return this.getTypedRuleContext(c0,0)}get ruleIndex(){return S.RULE_name_store}accept(T){if(T.visitName_store)return T.visitName_store(this);else return T.visitChildren(this)}}class _5 extends F{constructor(T,L,I){super(L,I);this.parser=T}comment_list(){return this.getTypedRuleContexts(J2)}comment(T){return this.getTypedRuleContext(J2,T)}get ruleIndex(){return S.RULE_comments}accept(T){if(T.visitComments)return T.visitComments(this);else return T.visitChildren(this)}}class J2 extends F{constructor(T,L,I){super(L,I);this.parser=T}COMMENT(){return this.getToken(S.COMMENT,0)}get ruleIndex(){return S.RULE_comment}accept(T){if(T.visitComment)return T.visitComment(this);else return T.visitChildren(this)}}class J6 extends Error{name="PinescriptSyntaxError";lineno;col_offset;constructor(T,L=null,I=null){super(T);this.lineno=L,this.col_offset=I}}class Z6 extends f3{static INSTANCE=new Z6;syntaxError(T,L,I,_,R,$){throw new J6(`${R} (${I}:${_})`,I,_)}}function NL(T,L){if(T.kind!=="Script")return;let I=T;L.fill();let _=[];for(let R of L.tokens){if(R==null||R.type!==S0.COMMENT)continue;let $=(R.text??"").trim();if($.startsWith("//@"))_.push($)}if(_.length)I.annotations=_}function V2(T,L="<unknown>",I="exec"){if(I!=="exec"&&I!=="eval")throw Error(`invalid argument mode: ${I}`);let _=H4.fromString(T),R=new S0(_),$=new g3(R),G=new S($),Q=Z6.INSTANCE;R.removeErrorListeners(),G.removeErrorListeners(),R.addErrorListener(Q),G.addErrorListener(Q);let U=I==="exec"?G.start_script():G.start_expression(),J=new u4().visit(U);if(!J||typeof J!=="object"||!("kind"in J))throw new J6("parse produced no AST");if(I==="exec"&&T.includes("@"))NL(J,$);return J}function yL(T){let L=H4.fromString(T),I=new S0(L);I.removeErrorListeners(),I.addErrorListener(Z6.INSTANCE);let _=[];for(;;){let R=I.nextToken();if(_.push(R),R.type===L0.EOF)break}return _}function R5(T,L){if(!Number.isFinite(T))return null;let I=Math.trunc(T);if(I<0)I=L+I;if(I<0||I>=L)return null;return I}function A1(T){return T!==null&&Number.isFinite(T)}function _9(T){return T!==null&&T!==0}function $5(T,L){if(T===null)return!1;if(L===null)return!0;return T<L}function G5(T,L){if(T===null&&L===null)return!0;if(T===null||L===null)return!1;return T===L}function W6(T){let L=0;for(let I of T)L+=I;return L/T.length}class G0{cells=[];constructor(T,L){if(T===void 0)return;if(!Number.isFinite(T)||T<0)return;let I=Math.min(Math.trunc(T),1e6),_=L===void 0?null:L;for(let R=0;R<I;R++)this.cells.push(_)}size(){return this.cells.length}get(T){let L=R5(T,this.cells.length);return L===null?null:this.cells[L]}set(T,L){let I=R5(T,this.cells.length);if(I===null)return;this.cells[I]=L}push(T){if(this.cells.length>=1e6)return;this.cells.push(T)}pop(){if(this.cells.length===0)return null;return this.cells.pop()}unshift(T){if(this.cells.length>=1e6)return;this.cells.unshift(T)}shift(){if(this.cells.length===0)return null;return this.cells.shift()}clear(){this.cells.length=0}includes(T){return this.cells.includes(T)}first(){return this.cells.length===0?null:this.cells[0]}last(){return this.cells.length===0?null:this.cells[this.cells.length-1]}insert(T,L){if(this.cells.length>=1e6)return;if(!Number.isFinite(T))return;let I=Math.trunc(T);if(I<0)I=this.cells.length+I;if(I<0)I=0;if(I>this.cells.length)I=this.cells.length;this.cells.splice(I,0,L)}remove(T){let L=R5(T,this.cells.length);if(L===null)return null;return this.cells.splice(L,1)[0]}fill(T){for(let L=0;L<this.cells.length;L++)this.cells[L]=T}slice(T,L){let I=this.cells.length,_=Number.isFinite(T)?Math.trunc(T):0,R=L===void 0||!Number.isFinite(L)?I:Math.trunc(L);if(_<0)_=0;let $=new G0;if(R<_)return $;for(let G of this.cells.slice(_,R))$.push(G);return $}copy(){let T=new G0;for(let L of this.cells)T.push(L);return T}reverse(){this.cells.reverse()}sort(T="asc"){this.cells.sort((L,I)=>{if(L===null&&I===null)return 0;if(L===null)return 1;if(I===null)return-1;return T==="desc"?I-L:L-I})}indexof(T){for(let L=0;L<this.cells.length;L++)if(Object.is(this.cells[L],T))return L;return-1}avg(){let T=this.finiteAll();if(T===null||T.length===0)return null;let L=0;for(let I of T)L+=I;return L/T.length}min(){let T=this.finiteAll();if(T===null||T.length===0)return null;let L=T[0];for(let I of T)if(I<L)L=I;return L}max(){let T=this.finiteAll();if(T===null||T.length===0)return null;let L=T[0];for(let I of T)if(I>L)L=I;return L}sum(){let T=this.finiteAll();if(T===null||T.length===0)return null;let L=0;for(let I of T)L+=I;return L}join(T=","){return this.cells.map((L)=>L===null?"":String(L)).join(T)}static from(...T){let L=new G0,I=Math.min(T.length,1e6);for(let _=0;_<I;_++)L.push(T[_]);return L}lastIndexOf(T){for(let L=this.cells.length-1;L>=0;L--)if(Object.is(this.cells[L],T))return L;return-1}concat(T){for(let L of T.cells){if(this.cells.length>=1e6)break;this.cells.push(L)}return this}abs(){let T=new G0;for(let L of this.cells)T.push(L===null?null:Math.abs(L));return T}every(){for(let T of this.cells)if(!_9(T))return!1;return!0}some(){for(let T of this.cells)if(_9(T))return!0;return!1}median(){let T=this.finiteAll();if(T===null||T.length===0)return null;let L=T.slice().sort((_,R)=>_-R),I=L.length>>1;if(L.length%2===1)return L[I];return(L[I-1]+L[I])/2}range(){let T=this.max(),L=this.min();if(T===null||L===null)return null;return T-L}mode(){let T=new Map,L=null,I=0;for(let _ of this.cells){if(!A1(_))continue;let R=(T.get(_)??0)+1;if(T.set(_,R),R>I)I=R,L=_}return L}binarySearch(T){return this.binarySearchBy(T,"any")}binarySearchLeftmost(T){if(T===null||this.cells.some((L)=>L===null)){let L=this.indexof(T);return typeof L==="number"?L:-1}return this.binarySearchBy(T,"left")}binarySearchRightmost(T){if(T===null||this.cells.some((L)=>L===null)){let L=this.lastIndexOf(T);return typeof L==="number"?L:-1}return this.binarySearchBy(T,"right")}stdev(T=!0){let L=this.finiteSkip();if(L.length<2)return null;let I=W6(L),_=0;for(let G of L)_+=(G-I)**2;let R=T?L.length:L.length-1;if(R<=0)return null;let $=Math.sqrt(_/R);return Number.isFinite($)?$:null}variance(T=!0){let L=this.finiteSkip();if(L.length<2)return null;let I=W6(L),_=0;for(let G of L)_+=(G-I)**2;let R=T?L.length:L.length-1;if(R<=0)return null;let $=_/R;return Number.isFinite($)?$:null}covariance(T,L=!0){let I=this.finiteSkip(),_=T.finiteSkip(),R=Math.min(I.length,_.length);if(R<2)return null;let $=I.slice(0,R),G=_.slice(0,R),Q=W6($),U=W6(G),O=0;for(let B=0;B<R;B++)O+=($[B]-Q)*(G[B]-U);let J=L?R:R-1;if(J<=0)return null;let D=O/J;return Number.isFinite(D)?D:null}percentileLinearInterpolation(T){if(!Number.isFinite(T)||T<0||T>100)return null;let L=this.finiteSkip().sort((G,Q)=>G-Q);if(L.length===0)return null;let I=L.length,_=T/100*(I-1),R=Math.trunc(_),$=_-R;if(R>=I-1)return L[I-1];if(R<0)return L[0];return L[R]*(1-$)+L[R+1]*$}percentileNearestRank(T){if(!Number.isFinite(T)||T<0||T>100)return null;let L=this.finiteSkip().sort((R,$)=>R-$);if(L.length===0)return null;let I=L.length,_=Math.max(1,Math.trunc(T/100*I+0.5));return L[Math.min(_,I)-1]}percentrank(T){if(!A1(T))return null;let L=this.finiteSkip();if(L.length===0)return null;if(L.length===1)return 0;let I=0;for(let _ of L)if(_<=T)I+=1;return(I-1)/(L.length-1)*100}standardize(){let T=this.finiteSkip();if(T.length<2)return null;let L=W6(T),I=0;for(let $ of T)I+=($-L)**2;let _=Math.sqrt(I/(T.length-1));if(_===0||!Number.isFinite(_))return null;let R=new G0;for(let $ of this.cells)R.push(A1($)?($-L)/_:null);return R}sortIndices(T="asc"){let L=[],I=[];for(let R=0;R<this.cells.length;R++){let $=this.cells[R];if(!A1($)){I.push(R);continue}L.push({key:$,idx:R})}let _=T==="desc";return L.sort((R,$)=>{let G=R.key-$.key;if(G!==0)return _?-G:G;return R.idx-$.idx}),L.map((R)=>R.idx).concat(I)}binarySearchBy(T,L){let I=this.cells,_=I.length;if(L==="left"){let G=0,Q=_;while(G<Q){let U=Math.trunc((G+Q)/2);if($5(I[U],T))G=U+1;else Q=U}if(G<_&&G5(I[G],T))return G;return-1}if(L==="right"){let G=0,Q=_;while(G<Q){let U=Math.trunc((G+Q)/2);if($5(T,I[U]))Q=U;else G=U+1}if(G>0&&G5(I[G-1],T))return G-1;return-1}let R=0,$=_-1;while(R<=$){let G=Math.trunc((R+$)/2),Q=I[G];if(G5(Q,T))return G;if($5(Q,T))R=G+1;else $=G-1}return-1}finiteAll(){let T=[];for(let L of this.cells){if(!A1(L))return null;T.push(L)}return T}finiteSkip(){let T=[];for(let L of this.cells)if(A1(L))T.push(L);return T}toValues(){return this.cells.slice()}}var bL=/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/;function A0(T){return typeof T==="number"&&Number.isFinite(T)}function X1(T){return Math.max(0,Math.min(255,Math.round(T)))}function R9(T,L,I,_){return{r:X1(T),g:X1(L),b:X1(I),a:X1(_)}}function Q5(T){if(typeof T!=="object"||T===null)return!1;let L=T;return A0(L.r)&&A0(L.g)&&A0(L.b)&&A0(L.a)}function hL(T){return 255*(1-Math.max(0,Math.min(100,T))/100)}function wL(T){return Math.max(0,Math.min(100,Math.round((1-T/255)*100)))}function U5(T){if(typeof T!=="string")return null;let L=bL.exec(T.trim());if(!L)return null;let I=L[1],_=parseInt(I.slice(0,2),16),R=parseInt(I.slice(2,4),16),$=parseInt(I.slice(4,6),16),G=I.length===8?parseInt(I.slice(6,8),16):255;if(![_,R,$,G].every((Q)=>Number.isFinite(Q)))return null;return{r:_,g:R,b:$,a:G}}function S5(T,L,I,_){if(!A0(T)||!A0(L)||!A0(I))return null;let R=A0(_)?hL(_):255;return R9(T,L,I,R)}function $9(T,L,I,_){return S5(T,L,I,_)}function G9(T,L,I,_,R){if(!A0(T)||!A0(L)||!A0(I))return null;if(!Q5(_)||!Q5(R))return null;let $=I-L,G=$===0?0:Math.max(0,Math.min(1,(T-L)/$));return R9(_.r+(R.r-_.r)*G,_.g+(R.g-_.g)*G,_.b+(R.b-_.b)*G,_.a+(R.a-_.a)*G)}var AL={red:{r:255,g:0,b:0,a:255},green:{r:0,g:128,b:0,a:255},blue:{r:0,g:0,b:255,a:255},black:{r:0,g:0,b:0,a:255},white:{r:255,g:255,b:255,a:255},gray:{r:128,g:128,b:128,a:255},grey:{r:128,g:128,b:128,a:255},silver:{r:192,g:192,b:192,a:255},yellow:{r:255,g:255,b:0,a:255},orange:{r:255,g:165,b:0,a:255},purple:{r:128,g:0,b:128,a:255},aqua:{r:0,g:255,b:255,a:255},fuchsia:{r:255,g:0,b:255,a:255},lime:{r:0,g:255,b:0,a:255},maroon:{r:128,g:0,b:0,a:255},navy:{r:0,g:0,b:128,a:255},olive:{r:128,g:128,b:0,a:255},teal:{r:0,g:128,b:128,a:255}};function O5(T){if(typeof T!=="string")return null;let L=T.trim().toLowerCase();if(L.startsWith("color."))L=L.slice(6);let I=AL[L];return I?{...I}:null}function u1(T){if(Q5(T))return T;if(typeof T!=="string")return null;return U5(T)??O5(T)}function Q9(T){let L=u1(T);return L?X1(L.r):null}function U9(T){let L=u1(T);return L?X1(L.g):null}function S9(T){let L=u1(T);return L?X1(L.b):null}function O9(T){let L=u1(T);return L?wL(L.a):null}class m0{name;fields;methods=new Map;isExported=!1;constructor(T,L){this.name=T;this.fields=L.map((I)=>({name:I.name,default:I.default??null}))}addMethod(T,L){this.methods.set(T,L)}getMethod(T){return this.methods.get(T)}cloneType(){let T=new m0(this.name,this.fields.map((L)=>({name:L.name,default:L.default})));T.isExported=this.isExported;for(let[L,I]of this.methods)T.addMethod(L,I);return T}newInstance(T){let L=new R1(this);if(T){for(let I of this.fields)if(Object.hasOwn(T,I.name))L.set(I.name,T[I.name])}return L}}class R1{type;typeName;values=new Map;constructor(T){this.type=T,this.typeName=T.name;for(let L of T.fields)this.values.set(L.name,L.default??null)}get(T){return this.values.has(T)?this.values.get(T):null}set(T,L){if(!this.values.has(T))return;this.values.set(T,L)}getMethod(T){return this.type.getMethod(T)}}class $1{enumName;name;value;constructor(T,L,I){this.enumName=T;this.name=L;this.value=I}equals(T){return T instanceof $1&&T.enumName===this.enumName&&T.name===this.name}toString(){return this.name}}class g1{name;members;constructor(T,L){this.name=T;this.members=L}}function J9(T,L){return new m0(T,L)}function Z9(T,L){let I=new Map;for(let _ of L)I.set(_,new $1(T,_));return new g1(T,I)}var uL=new Set(["request.security","request.security_lower_tf","request.dividends","request.earnings","request.splits","request.financial","request.economic","request.quandl","request.currency_rate","request.seed","request.footprint"]),gL=null,J5=60,Z5=1440,W5=10080,D6=43200,fL={H:J5,"1H":J5,D:Z5,"1D":Z5,W:W5,"1W":W5,M:D6,MO:D6,"1M":D6,"1MO":D6};function Y9(T){return T!=null&&uL.has(T)}function B1(T){if(T==null)return null;let L=T.trim();if(L==="")return null;if(/^\d+$/.test(L)){let G=Number(L);return G>0?G:null}let I=L.toUpperCase(),_=fL[I];if(_!=null)return _;let R=/^(\d+)(MO|H|D|W|M)$/.exec(I);if(R==null)return null;let $=Number(R[1]);if(!($>0))return null;switch(R[2]){case"MO":return $*D6;case"H":return $*J5;case"D":return $*Z5;case"W":return $*W5;case"M":return $;default:return null}}function pL(T){return typeof T==="number"&&Number.isFinite(T)?T:null}function q2(T,L,I,_){let R=I??{};if(!X9(R.symbol,T??""))return null;let $=pL(_),G=B1(R.timeframe),Q=B1(L);if(G!=null&&Q!=null&&G>Q)return $;return $}function xL(T,L){let I=B1(T),_=B1(L);return I!=null&&_!=null&&I<_}function cL(T,L,I,_){let R=I??{};if(!X9(R.symbol,T??""))return null;if(xL(R.timeframe,L))return null;return q2(T,L,R,_)}function X9(T,L){let I=(T??"").trim();if(I==="")return!0;return W9(I)===W9(L)}function W9(T){let L=T.trim().toUpperCase(),I=L.lastIndexOf(":");return I>=0?L.slice(I+1):L}function mL(){return null}function dL(T,L){let[I,_]=iL(T,L);if(I!==""&&I===_)return 1;return null}function lL(T){return gL=rL(T??0),null}function k2(T,L,I={}){if(T==="request.security"){let{sec:_,value:R}=D9(I);return q2(L.symbol,L.timeframe??null,_,R)}if(T==="request.security_lower_tf"){let{sec:_,value:R}=D9(I);return cL(L.symbol,L.timeframe??null,_,R)}if(T==="request.currency_rate"){let[_,R]=oL(I);return dL(_,R)}if(T==="request.seed")return lL(vL(I));return mL()}function D5(T){return!Array.isArray(T)}function D9(T){if(!D5(T))return{sec:{symbol:F2(T[0]),timeframe:F2(T[1]),expression:T[2]},value:sL(T[2])};return{sec:{symbol:T.symbol,timeframe:T.timeframe,expression:T.expression},value:T.sameSymbolValue??null}}function oL(T){if(!D5(T))return[F2(T[0]),F2(T[1])];let L=T.from??T.from_currency??null,I=T.to??T.to_currency??null;return[L,I]}function vL(T){if(!D5(T))return T[0]??0;return T.seed??0}function iL(T,L){let I=(T??"").trim().toUpperCase(),_=(L??"").trim().toUpperCase();if(_!=="")return[I,_];let R=I.indexOf("/");if(R>=0)return[I.slice(0,R),I.slice(R+1)];if(/^[A-Z]{6}$/.test(I))return[I.slice(0,3),I.slice(3)];return[I,_]}function rL(T){if(typeof T==="number"&&Number.isFinite(T))return Math.trunc(T);if(typeof T==="string"){let L=Number(T);if(T.trim()!==""&&Number.isFinite(L))return Math.trunc(L);return K9(T)}if(T==null)return 0;return K9(String(T))}function K9(T){let L=2166136261;for(let I=0;I<T.length;I++)L^=T.charCodeAt(I),L=Math.imul(L,16777619);return L>>>0}function F2(T){if(T==null)return null;return typeof T==="string"?T:String(T)}function sL(T){if(T==null)return null;if(typeof T==="number")return Number.isFinite(T)?T:null;return null}var M2=60,K5=86400,Y5=604800,X5=2592000;function B9(T){let L=B1(T);return L==null?null:L*M2}function z9(T){if(!Number.isFinite(T)||T<=0)return null;if(T<=M2)return"1";if(T<=K5){let I=Math.ceil(T/M2);return I>=K5/M2?"D":String(I)}if(T<=Y5){let I=Math.ceil(T/K5);if(I>=7)return"W";return I<=1?"D":`${I}D`}if(T<=X5){let I=Math.ceil(T/Y5);if(I*Y5>=X5)return"M";return I<=1?"W":`${I}W`}let L=Math.ceil(T/X5);return L<=1?"M":`${L}M`}function H9(T){if(B5(T)||z5(T)||H5(T))return!1;return B1(T)!=null}function B5(T){let L=V5(T);if(L==null||/^\d+$/.test(L))return!1;return L==="D"||L==="DAY"||L==="DAYS"||/^\d+D$/.test(L)}function z5(T){let L=V5(T);if(L==null||/^\d+$/.test(L))return!1;return L==="W"||L==="WEEK"||L==="WEEKS"||/^\d+W$/.test(L)}function H5(T){let L=V5(T);if(L==null||/^\d+$/.test(L))return!1;return L==="M"||L==="1M"||L==="MO"||L==="MONTH"||L==="MONTHS"||/^\d+MO$/.test(L)}function V9(T){if(T==null||T==="")return 1;let L=T.trim().match(/^(\d+)/);return L?Number(L[1]):1}function V5(T){if(T==null)return null;let L=T.trim().toUpperCase();return L===""?null:L}function n0(T){return typeof T==="number"&&Number.isFinite(T)}function E2(T,L,I){if(T==null||typeof T!=="number"||!Number.isFinite(T))return L;return Math.max(1,Math.min(I,Math.trunc(T)))}function F9(T){return n0(T)?T:0}function F5(T){if(T==null||typeof T!=="object"||Array.isArray(T))return;return{...T}}function Y0(T,L,I){if(n0(I))T[L]=I}function F0(T,L,I){T[L]=I}function aL(T,L){if(!n0(T)||!n0(L))return;return`${T},${L}`}class j2{items=[];byId=new Map;nextId=0;maxLines=50;maxLabels=50;maxBoxes=50;maxPolylines=50;constructor(T){if(T!=null)this.configure(T)}configure(T){if(T==null||typeof T!=="object")return;if(T.max_lines_count!==void 0)this.maxLines=E2(T.max_lines_count,this.maxLines,500);if(T.max_labels_count!==void 0)this.maxLabels=E2(T.max_labels_count,this.maxLabels,500);if(T.max_boxes_count!==void 0)this.maxBoxes=E2(T.max_boxes_count,this.maxBoxes,500);if(T.max_polylines_count!==void 0)this.maxPolylines=E2(T.max_polylines_count,this.maxPolylines,100);this.gc("line",this.maxLines),this.gc("label",this.maxLabels),this.gc("box",this.maxBoxes),this.gc("polyline",this.maxPolylines)}get(T){return this.byId.get(T)}all(T){return this.items.filter((L)=>L.kind===T&&!L.deleted)}lineNew(T,L){return this.push("line",T,{extra:L,cap:this.maxLines})}labelNew(T,L){return this.push("label",T,{text:L,cap:this.maxLabels})}boxNew(T){return this.push("box",T,{cap:this.maxBoxes})}tableNew(T){return this.push("table",T)}polylineNew(T){return this.push("polyline",T,{cap:this.maxPolylines})}linefillNew(T,L,I){let _={},R=F5(L);if(R!=null)Object.assign(_,R);else{if(n0(L))_.id1=L;if(n0(I))_.id2=I}return this.push("linefill",T,{extra:Object.keys(_).length?_:void 0})}alert(T,L){this.items.push({kind:"alert",bar:F9(T),text:L==null?"":String(L)})}lineSetXy(T,L,I,_,R){let $=this.extraOf(T);if(!$)return;Y0($,"x1",L),Y0($,"y1",I),Y0($,"x2",_),Y0($,"y2",R)}lineSetXy1(T,L,I){let _=this.extraOf(T);if(!_)return;Y0(_,"x1",L),Y0(_,"y1",I)}lineSetXy2(T,L,I){let _=this.extraOf(T);if(!_)return;Y0(_,"x2",L),Y0(_,"y2",I)}labelSetText(T,L){let I=this.byId.get(T);if(!I)return;I.text=L==null?"":String(L)}labelSetXy(T,L,I){let _=this.extraOf(T);if(!_)return;Y0(_,"x",L),Y0(_,"y",I)}boxSet(T,L){let I=this.byId.get(T),_=F5(L);if(!I||_==null)return;I.extra={...I.extra??{},..._}}boxSetCorners(T,L,I,_,R){let $=this.extraOf(T,"box");if(!$)return;Y0($,"left",L),Y0($,"top",I),Y0($,"right",_),Y0($,"bottom",R)}lineSetColor(T,L){let I=this.extraOf(T,"line");if(!I)return;F0(I,"color",L)}lineSetWidth(T,L){let I=this.extraOf(T,"line");if(!I)return;Y0(I,"width",L)}lineSetStyle(T,L){let I=this.extraOf(T,"line");if(!I)return;F0(I,"style",L)}lineSetExtend(T,L){let I=this.extraOf(T,"line");if(!I)return;F0(I,"extend",L)}lineGetX1(T){return this.lineGetNum(T,"x1")}lineGetY1(T){return this.lineGetNum(T,"y1")}lineGetX2(T){return this.lineGetNum(T,"x2")}lineGetY2(T){return this.lineGetNum(T,"y2")}getX1(T){return this.extraNum(T,"x1")}getY1(T){return this.extraNum(T,"y1")}getX2(T){return this.extraNum(T,"x2")}getY2(T){return this.extraNum(T,"y2")}labelGetX(T){let L=this.byId.get(T);if(!L||L.kind!=="label")return null;return this.extraNum(T,"x")}labelGetY(T){let L=this.byId.get(T);if(!L||L.kind!=="label")return null;return this.extraNum(T,"y")}labelGetText(T){let L=this.byId.get(T);if(!L||L.kind!=="label")return null;if(L.text!==void 0)return L.text;let I=L.extra?.text;return I==null?null:String(I)}lineGetPrice(T,L){if(!n0(L))return null;let I=this.lineGetNum(T,"x1"),_=this.lineGetNum(T,"y1"),R=this.lineGetNum(T,"x2"),$=this.lineGetNum(T,"y2");if(I==null||_==null||R==null||$==null)return null;if(I===R)return _;let G=(L-I)/(R-I);return _+G*($-_)}labelSetColor(T,L){let I=this.extraOf(T,"label");if(!I)return;F0(I,"color",L)}labelSetStyle(T,L){let I=this.extraOf(T,"label");if(!I)return;F0(I,"style",L)}labelSetSize(T,L){let I=this.extraOf(T,"label");if(!I)return;F0(I,"size",L)}labelSetTextalign(T,L){let I=this.extraOf(T,"label");if(!I)return;F0(I,"textalign",L)}labelSetTooltip(T,L){let I=this.extraOf(T,"label");if(!I)return;F0(I,"tooltip",L)}boxSetBgcolor(T,L){let I=this.extraOf(T,"box");if(!I)return;F0(I,"bgcolor",L)}boxSetBorderColor(T,L){let I=this.extraOf(T,"box");if(!I)return;F0(I,"border_color",L)}boxSetText(T,L){let I=this.extraOf(T,"box");if(!I)return;F0(I,"text",L==null?"":String(L))}boxSetExtend(T,L){let I=this.extraOf(T,"box");if(!I)return;F0(I,"extend",L)}tableCell(T,L,I,_){this.upsertCell(T,L,I,_,_!==void 0)}tableCellSetText(T,L,I,_){this.upsertCell(T,L,I,_,!0)}tableSetPosition(T,L){let I=this.extraOf(T,"table");if(!I)return;F0(I,"position",L)}linefillSetColor(T,L){let I=this.extraOf(T,"linefill");if(!I)return;F0(I,"color",L)}exportForApi(){let T=[];for(let L of this.items){if(L.deleted)continue;let I={kind:L.kind,bar:L.bar};if(L.text!==void 0)I.text=L.text;if(L.extra!==void 0)I.extra={...L.extra};T.push(I)}return T}lineDelete(T){this.markDeleted(T)}labelDelete(T){this.markDeleted(T)}boxDelete(T){this.markDeleted(T)}push(T,L,I){let _=this.nextId++,R={kind:T,bar:F9(L)};if(I?.text!==void 0&&I.text!==null)R.text=String(I.text);let $=F5(I?.extra);if($!==void 0)R.extra=$;if(this.items.push(R),this.byId.set(_,R),I?.cap!=null)this.gc(T,I.cap);return _}extraOf(T,L){let I=this.byId.get(T);if(!I)return;if(L!=null&&I.kind!==L)return;if(I.extra==null)I.extra={};return I.extra}lineGetNum(T,L){let I=this.byId.get(T);if(!I||I.kind!=="line")return null;let _=I.extra?.[L];return n0(_)?_:null}extraNum(T,L){let I=this.byId.get(T);if(!I)return null;let _=I.extra?.[L];return n0(_)?_:null}upsertCell(T,L,I,_,R){let $=this.extraOf(T,"table"),G=aL(L,I);if(!$||G==null)return;let Q=$.cells,U=Q!=null&&typeof Q==="object"&&!Array.isArray(Q)?Q:{};if(U!==Q)$.cells=U;let O=U[G],J=O!=null&&typeof O==="object"&&!Array.isArray(O)?O:{};if(R)J.text=_==null?"":String(_);else if(J.text===void 0)J.text="";U[G]=J}markDeleted(T){let L=this.byId.get(T);if(!L)return;L.deleted=!0}gc(T,L){let I=L>0?L:50,_=0;for(let $ of this.items)if($.kind===T&&!$.deleted)_++;let R=_-I;if(R<=0)return;for(let $=0;$<this.items.length&&R>0;){let G=this.items[$];if(G.kind===T&&!G.deleted)G.deleted=!0,this.items.splice($,1),this.forget(G),R--;else $++}}forget(T){for(let[L,I]of this.byId)if(I===T){this.byId.delete(L);return}}}class C2{records=[];info(T,L){this.records.push({level:"INFO",bar:T,message:L})}warning(T,L){this.records.push({level:"WARNING",bar:T,message:L})}error(T,L){this.records.push({level:"ERROR",bar:T,message:L})}clear(){this.records.length=0}snapshot(){return this.records.slice()}}class q5 extends Error{name="RuntimeError";constructor(T){super(T)}}function k5(T){throw new q5(T)}function M5(T){if(T.length===0)return"";let L=T[0];if(typeof L==="string"&&T.length>1&&/\{[0-9]/.test(L))return L.replace(/\{(\d+)\}/g,(I,_)=>q9(T[Number(_)+1]));return T.map(q9).join(" ")}function q9(T){if(T==null)return"na";if(typeof T==="number"&&!Number.isFinite(T))return"na";return String(T)}class I0{symbol;session;adjust;heikinashi=!1;renko=!1;kagi=!1;linebreak=!1;pointfigure=!1;constructor(T,L,I){this.symbol=T;this.session=L;this.adjust=I}toString(){return this.symbol}}function E5(T,L,I){return new I0(T,L,I)}function j5(T){let L=new I0(typeof T==="string"?T:String(T));return L.heikinashi=!0,L}function C5(T){return new I0(T)}function P5(T){let L=new I0(T);return L.renko=!0,L}function N5(T){let L=new I0(typeof T==="string"?T:String(T));return L.kagi=!0,L}function y5(T){let L=new I0(typeof T==="string"?T:String(T));return L.linebreak=!0,L}function b5(T){let L=new I0(typeof T==="string"?T:String(T));return L.pointfigure=!0,L}function h5(T,L){let I=typeof T==="string"?new I0(T):T,_=new I0(L?.symbol??I.symbol,L?.session??I.session,L?.adjust??L?.adjustment??I.adjust);return _.heikinashi=I.heikinashi,_.renko=I.renko,_.kagi=I.kagi,_.linebreak=I.linebreak,_.pointfigure=I.pointfigure,_}var nL=new Set(["input","input.bool","input.int","input.float","input.price","input.string","input.symbol","input.session","input.source","input.time","input.timeframe","input.color","input.enum","input.text_area"]);function k9(T){return T!=null&&nL.has(T)}function tL(T,L={}){if(L.defval!==void 0)return L.defval;return T[0]}function M9(T,L,I={}){let _=tL(L,I);switch(T){case"input.bool":return _==null?!1:Boolean(_);case"input.int":case"input.time":return TI(_,0);case"input.float":case"input.price":return E9(_,0);case"input.string":case"input.symbol":case"input.session":case"input.source":case"input.timeframe":case"input.color":case"input.enum":case"input.text_area":return _==null?"":String(_);default:return eL(_)}}function w5(T){if(T==null)return null;if(typeof T==="boolean")return T?1:0;if(typeof T==="number")return Number.isFinite(T)?T:null;let L=Number(T);return Number.isFinite(L)?L:null}function eL(T){if(T==null)return null;if(typeof T==="boolean"||typeof T==="string")return T;if(typeof T==="number")return Number.isFinite(T)?T:null;return null}function E9(T,L){if(typeof T==="number"&&Number.isFinite(T))return T;if(typeof T==="boolean")return T?1:0;if(typeof T==="string"&&T!==""){let I=Number(T);if(Number.isFinite(I))return I}return L}function TI(T,L){return Math.trunc(E9(T,L))}function s(T){return T!==null&&Number.isFinite(T)?T:null}function _0(T){return Number.isFinite(T)?T:null}function j9(T){return T>=0?Math.round(T):-Math.round(-T)}function C9(T){let L=s(T);return L===null?null:Math.abs(L)}function P9(T){let L=s(T);if(L===null)return null;if(L>0)return 1;if(L<0)return-1;return 0}function N9(T){let L=s(T);if(L===null||L<0)return null;return _0(Math.sqrt(L))}function y9(T,L){let I=s(T);if(I===null||I<=0)return null;if(L===void 0)return _0(Math.log(I));let _=s(L);if(_===null||_<=0||_===1)return null;return _0(Math.log(I)/Math.log(_))}function b9(T){let L=s(T);if(L===null||L<=0)return null;return _0(Math.log10(L))}function h9(T){let L=s(T);return L===null?null:_0(Math.exp(L))}function w9(T,L){let I=s(T),_=s(L);if(I===null||_===null)return null;return _0(Math.pow(I,_))}function A9(...T){if(T.length===0)return null;let L=-1/0;for(let I of T){let _=s(I);if(_===null)return null;if(_>L)L=_}return _0(L)}function u9(...T){if(T.length===0)return null;let L=1/0;for(let I of T){let _=s(I);if(_===null)return null;if(_<L)L=_}return _0(L)}function g9(T,L){let I=s(T);if(I===null)return null;if(L===void 0)return j9(I);let _=s(L);if(_===null)return null;let R=10**Math.trunc(_);if(!Number.isFinite(R))return null;return _0(j9(I*R)/R)}function f9(T){let L=s(T);return L===null?null:Math.floor(L)}function p9(T){let L=s(T);return L===null?null:Math.ceil(L)}function x9(...T){if(T.length===0)return null;let L=0;for(let I of T){let _=s(I);if(_===null)return null;L+=_}return _0(L/T.length)}function c9(...T){if(T.length===0)return null;let L=0;for(let I of T){let _=s(I);if(_===null)return null;L+=_}return _0(L)}function P2(T,L){let I=s(T);return I===null?null:_0(L(I))}function m9(T){return P2(T,Math.sin)}function d9(T){return P2(T,Math.cos)}function l9(T){return P2(T,Math.tan)}function o9(T){let L=s(T);if(L===null||L<-1||L>1)return null;return _0(Math.asin(L))}function v9(T){let L=s(T);if(L===null||L<-1||L>1)return null;return _0(Math.acos(L))}function i9(T){return P2(T,Math.atan)}function r9(T){let L=s(T);return L===null?null:_0(L*180/Math.PI)}function s9(T){let L=s(T);return L===null?null:_0(L*Math.PI/180)}function a9(T){if(T===null)return null;return Number.isFinite(T)?1:0}function n9(T,L=0.01){let I=s(T),_=s(L);if(I===null||_===null||_<=0)return I===null?null:_0(Number(I.toFixed(8)));return _0(Math.round(I/_)*_)}function t9(T,L,I=Math.random){if(T===void 0&&L===void 0)return _0(I());if(L===void 0){let $=s(T);if($===null)return null;return _0($*I())}let _=s(T),R=s(L);if(_===null||R===null)return null;return _0(_+(R-_)*I())}function K6(T){let L=Number.isFinite(T)?Math.trunc(T/1000):0;if(L<-62167219200)L=-62167219200;else if(L>253402300799)L=253402300799;let I=Math.trunc(L/86400),_=L%86400;if(_<0)I-=1,_+=86400;let R=Math.trunc(_/3600);_%=3600;let $=Math.trunc(_/60),G=_%60,U=(((I+3)%7+7)%7+1)%7+1,O=I+719468,J=Math.trunc((O>=0?O:O-146096)/146097),D=O-J*146097,B=Math.trunc((D-Math.trunc(D/1460)+Math.trunc(D/36524)-Math.trunc(D/146096))/365),H=B+J*400,z=D-(365*B+Math.trunc(B/4)-Math.trunc(B/100)),X=Math.trunc((5*z+2)/153),k=z-Math.trunc((153*X+2)/5)+1,C=X<10?X+3:X-9;return{year:H+(C<=2?1:0),month:C,dayofmonth:k,hour:R,minute:$,second:G,dayofweek:U}}var e9=86400000,f5=86400,TT={jan:1,january:1,feb:2,february:2,mar:3,march:3,apr:4,april:4,may:5,jun:6,june:6,jul:7,july:7,aug:8,august:8,sep:9,september:9,oct:10,october:10,nov:11,november:11,dec:12,december:12};function z1(T,L){return Math.floor(T/L)}function _T(T,L){return(T%L+L)%L}function c5(T,L,I){T-=L<=2?1:0;let _=z1(T>=0?T:T-399,400),R=T-_*400,$=z1(153*(L+(L>2?-3:9))+2,5)+I-1,G=R*365+z1(R,4)-z1(R,100)+$;return _*146097+G-719468}function LI(T){return T%4===0&&(T%100!==0||T%400===0)}function II(T,L){if(L===2)return LI(T)?29:28;return L===4||L===6||L===9||L===11?30:31}function _I(T,L,I,_,R,$){return(c5(T,L,I)*f5+_*3600+R*60+$)*1000}function RI(T,L){let I=T,_=L;if(_===0)_=1;else if(_<1||_>12){let R=_-1;I+=z1(R,12),_=_T(R,12)+1}if(I<1)I=1;else if(I>9999)I=9999;return[I,_]}function y2(T){if(T==null)return null;if(typeof T==="number")return Number.isFinite(T)?Math.trunc(T):null;if(typeof T==="string"){let L=T.trim();if(!L)return null;let I=Number(L);return Number.isFinite(I)?Math.trunc(I):null}return null}function A5(T,L=0){if(T==null)return L;if(typeof T==="number")return Number.isFinite(T)?Math.trunc(T):L;if(typeof T==="string"){let I=T.trim();if(!I)return L;let _=Number(I);return Number.isFinite(_)?Math.trunc(_):L}return L}function f1(T,L,I){return(T==="+"?1:-1)*(L*60+I)}function u5(T,L){if(!L||L.length>4||!/^\d+$/.test(L))return null;if(L.length<=2)return f1(T,Number(L),0);let I=L.padStart(4,"0");return f1(T,Number(I.slice(0,2)),Number(I.slice(2)))}function $I(T){let L=T.trim();if(!L||/^(?:syminfo\.timezone|UTC|utc|Etc\/UTC|GMT|gmt)$/.test(L))return 0;let I=/^(?:(?:UTC|GMT)\s*)?([+-])\s*(\d{1,2})(?::(\d{2})|(\d{2}))?$/i.exec(L);if(!I)return 0;return f1(I[1],Number(I[2]),Number(I[3]||I[4]||0))}function LT(T){let L=T.trim().replace(/\s+/g," ");return L=L.replace(/\b0000-/,"0001-"),L=L.replace(/(\d{4}-\d{2}-\d{2}):(\d{1,2}:\d{2})/,"$1 $2"),L=L.replace(/(\d)([A-Za-z]{3,})/g,"$1 $2"),L=L.replace(/\bSept\b/gi,"Sep"),L=L.replace(/\bJanv\b/gi,"Jan"),L}function GI(T){let L=0,I=/^(?:UTC|GMT)\s+/i.exec(T);if(I)T=T.slice(I[0].length).trim();let _=/\s*(?:GMT|UTC)\s*([+-])(\d{1,2})(?::?(\d{2}))?\s*$/i.exec(T);if(_&&_.index!==void 0)return L=f1(_[1],Number(_[2]),_[3]?Number(_[3]):0),{date:T.slice(0,_.index).trim(),offsetMin:L};if(_=/Z\s*$/i.exec(T),_&&T.length>1&&_.index!==void 0)return{date:T.slice(0,_.index).trim(),offsetMin:L};if(_=/\s+([+-])(\d{1,2}):(\d{2})\s*$/.exec(T),_&&_.index!==void 0)return L=f1(_[1],Number(_[2]),Number(_[3])),{date:T.slice(0,_.index).trim(),offsetMin:L};if(_=/\s+([+-])(\d{1,4})\s*$/.exec(T),_&&_.index!==void 0){let R=u5(_[1],_[2]);if(R!=null)return{date:T.slice(0,_.index).trim(),offsetMin:R}}if(_=/(?<=\d)([+-])(\d{2}):(\d{2})\s*$/.exec(T),_&&_.index!==void 0)return L=f1(_[1],Number(_[2]),Number(_[3])),{date:T.slice(0,_.index).trim(),offsetMin:L};if(_=/(?<=\d)([+-])(\d{4})\s*$/.exec(T),_&&_.index!==void 0){let R=u5(_[1],_[2]);if(R!=null)return{date:T.slice(0,_.index).trim(),offsetMin:R}}if(_=/(?<=\d)([+-])(\d{2})\s*$/.exec(T),_&&_.index!==void 0){let R=T.slice(0,_.index);if(/\d{1,2}:\d{2}$/.test(R)||R.endsWith("T")||/T\d/.test(R)){let $=u5(_[1],_[2]);if($!=null)return{date:R.trim(),offsetMin:$}}}return{date:T.replace(/\s+(?:GMT|UTC)\s*$/i,"").trim(),offsetMin:L}}function N2(T,L,I,_,R,$){if(T<1||T>9999)return null;if(L<1||L>12)return null;if(I<1||I>II(T,L))return null;if(_<0||_>23||R<0||R>59||$<0||$>59)return null;return _I(T,L,I,_,R,$)}function QI(T){let L=/^([A-Za-z]+)\s+(\d{1,2}),?\s+(\d{4})(?:\s+(\d{1,2}):(\d{2})(?::(\d{2}))?)?$/.exec(T);if(L){let I=TT[L[1].toLowerCase()];if(I==null)return null;return N2(Number(L[3]),I,Number(L[2]),Number(L[4]??0),Number(L[5]??0),Number(L[6]??0))}if(L=/^(\d{1,2})\s+([A-Za-z]+),?\s+(\d{4})(?:\s+(\d{1,2}):(\d{2})(?::(\d{2}))?)?$/.exec(T),L){let I=TT[L[2].toLowerCase()];if(I==null)return null;return N2(Number(L[3]),I,Number(L[1]),Number(L[4]??0),Number(L[5]??0),Number(L[6]??0))}if(L=/^(\d{4})-(\d{2})-(\d{2})(?:[ T](\d{1,2}):(\d{2})(?::(\d{2}))?)?$/.exec(T),L)return N2(Number(L[1]),Number(L[2]),Number(L[3]),Number(L[4]??0),Number(L[5]??0),Number(L[6]??0));if(L=/^(\d{4})\s+(\d{1,2})\s+(\d{1,2})(?:\s+(\d{1,2}):(\d{2})(?::(\d{2}))?)?$/.exec(T),L)return N2(Number(L[1]),Number(L[2]),Number(L[3]),Number(L[4]??0),Number(L[5]??0),Number(L[6]??0));return null}function IT(T,L){let I=QI(T);if(I==null)return null;return I-L*60000}function RT(T,L,I){return c5(T,L,I)+719163}function g5(T){let L=RT(T,1,1),I=_T(L+6,7),_=L-I;if(I>3)_+=7;return _}function UI(T,L,I){let _=RT(T,L,I),R=g5(T),$=z1(_-R,7);if($<0)R=g5(T-1),$=z1(_-R,7);else if($>=52&&_>=g5(T+1))$=0;return $+1}function p5(T,L,I,_=0,R=0,$=0,G){let Q=y2(T),U=y2(L),O=y2(I);if(Q==null||U==null||O==null)return null;let J=A5(_,0),D=A5(R,0),B=A5($,0),[H,z]=RI(Q,U),k=c5(H,z,1)*f5+(O-1)*f5+J*3600+D*60+B;if(G!=null&&Number.isFinite(G))k-=Math.trunc(G)*60;return k*1000}function x5(T){let L=T.trim();if(!L)return null;let I=LT(L),_=IT(I,0);if(_!=null)return _;let R=GI(I),$=LT(R.date);if(!$)return null;return IT($,R.offsetMin)}function m5(...T){let L=T.length;if(L===0)return null;if(L===1){let I=T[0];if(typeof I==="string")return x5(I);return y2(I)}if(typeof T[0]==="string"){let I=T[0].trim(),_=I!==""&&/^[+-]?\d+(?:\.\d+)?$/.test(I);if(L>=4&&!_)return p5(T[1],T[2],T[3],L>4?T[4]:0,L>5?T[5]:0,L>6?T[6]:0,$I(T[0]));if(L<4)return x5(T[0])}if(L>=3)return p5(T[0],T[1],T[2],L>3?T[3]:0,L>4?T[4]:0,L>5?T[5]:0);return null}function d5(T){if(!Number.isFinite(T))return null;let L=K6(T);return UI(L.year,L.month,L.dayofmonth)}function l5(T){if(!Number.isFinite(T))return null;return Math.floor(T/e9)*e9}function o5(T){if(T==null||typeof T!=="object"||Array.isArray(T))return!1;let L=Object.getPrototypeOf(T);return L===Object.prototype||L===null}function Y6(T){if(T==null)return null;if(typeof T==="boolean")return T?1:0;if(typeof T==="number"){if(!Number.isFinite(T))return null;return Math.trunc(T)}if(typeof T==="bigint"){let L=Number(T);if(!Number.isFinite(L))return null;return Math.trunc(L)}if(typeof T==="string"){let L=T.trim();if(!/^[+-]?\d+$/.test(L))return null;let I=Number(L);if(!Number.isFinite(I))return null;return Math.trunc(I)}return null}function $T(T,L,I){let _=T.slice();for(let[R,$]of Object.entries(L)){let G=I.indexOf(R);if(G<0)continue;while(_.length<=G)_.push(null);if(G<T.length&&T[G]!=null)continue;_[G]=$}return _}function GT(T,L){if(L!==void 0)return{args:T,kwargs:L};if(T.length===0)return{args:[],kwargs:{}};if(T.length===1&&o5(T[0]))return{args:[],kwargs:T[0]};if(Array.isArray(T[0])&&(T.length===1||T.length===2)&&(T[1]===void 0||o5(T[1])))return{args:T[0],kwargs:T[1]??{}};let I=T[T.length-1];if(T.length>1&&o5(I))return{args:T.slice(0,-1),kwargs:I};return{args:T,kwargs:{}}}function QT(T,L){let I=["dimension_x","dimension_y","index_x","index_y"],_={dim_x:"dimension_x",dim_y:"dimension_y",ix:"index_x",iy:"index_y"},R={};for(let[O,J]of Object.entries(L))R[_[O]??O]=J;let $=$T(T,R,I);if($.length<4)return null;let G=Y6($[1]),Q=Y6($[2]),U=Y6($[3]);if(G==null||Q==null||U==null)return null;return Q*G+U}function UT(T,L){let I=["dimension_x","dimension_y","index"],_={dim_x:"dimension_x",dim_y:"dimension_y",i:"index"},R={};for(let[J,D]of Object.entries(L))R[_[J]??J]=D;let $=$T(T,R,I);if($.length<3)return null;let G=Y6($[1]),Q=Y6($[2]);if(G==null||Q==null||G===0)return null;let U=Math.floor(Q/G),O=(Q%G+G)%G;return[U,O]}function SI(...T){let L=GT(T);return QT(L.args,L.kwargs)}function OI(...T){let L=GT(T);return UT(L.args,L.kwargs)}var G1={index_2d_to_1d:SI,index_1d_to_2d:OI};function JI(T,L=[],I={}){if(T==="index_2d_to_1d")return QT(L,I);if(T==="index_1d_to_2d")return UT(L,I);let _=G1[T];if(_==null)return;return _(L,I)}function ZI(T){if(T==null)return new Map;if(T instanceof Map)return T;return new Map(Object.entries(T))}class H1{title;namespace;version;exports;kinds;resolveStubs;constructor(T,L){this.title=T,this.namespace=L?.namespace??null,this.version=L?.version??null,this.exports=ZI(L?.exports),this.kinds=new Map,this.resolveStubs=L?.resolveStubs===!0}get(T){if(this.exports.has(T))return this.exports.get(T);if(this.resolveStubs&&Object.hasOwn(G1,T))return G1[T];return}has(T){if(this.exports.has(T))return!0;return this.resolveStubs&&Object.hasOwn(G1,T)}setExport(T,L){this.putExport(T,L,"const")}exportType(T,L){this.putExport(T,L,"type")}exportEnum(T,L){this.putExport(T,L,"enum")}exportFn(T,L){this.putExport(T,L,"fn")}kindOf(T){let L=this.kinds.get(T);if(L!==void 0)return L;if(this.resolveStubs&&Object.hasOwn(G1,T))return"fn";return}allExports(){let T={};for(let[L,I]of this.exports)T[L]=I;return T}putExport(T,L,I){this.exports.set(T,L),this.kinds.set(T,I)}}function v5(T){return new H1(T,{resolveStubs:!0})}function b2(T,L,I){return`${T}\x00${L}\x00${Math.trunc(I)}`}class X6{byPath=new Map;byTitle=new Map;sources=new Map;register(T){if(this.byTitle.set(T.title,T),T.namespace!=null&&T.version!=null)this.byPath.set(b2(T.namespace,T.title,T.version),T)}registerSource(T,L,I,_){this.sources.set(b2(T,L,Math.trunc(I)),_)}getSource(T,L,I){return this.sources.get(b2(T,L,Math.trunc(I)))??null}lookup(T){let{namespace:L,name:I,version:_}=T;if(L!=null&&_!=null){let R=this.byPath.get(b2(L,I,_));if(R!=null)return R}return this.byTitle.get(I)??null}clear(){this.byPath.clear(),this.byTitle.clear(),this.sources.clear()}}var K=null;class p1{data=[];push(T){this.data.push(T)}setCurrent(T){if(this.data.length===0)this.data.push(T);else this.data[this.data.length-1]=T}get current(){return this.data.length===0?null:this.data[this.data.length-1]}get(T){if(typeof T!=="number"||!Number.isFinite(T)||T<0)return null;let L=this.data.length;if(L===0)return null;let I=L-1-Math.trunc(T);if(I<0||I>=L)return null;let _=this.data[I];if(_==null)return null;if(typeof _==="number"&&!Number.isFinite(_))return null;return _}get length(){return this.data.length}}function i(T){if(T==null)return null;return typeof T==="string"?T:String(T)}function r5(T){return i(T)??""}function OT(T){let L=i(T);return L==null?null:L.length}function JT(T,L){let I=i(T),_=i(L);if(I==null||_==null)return null;return I.includes(_)}function ZT(T){let L=i(T);return L==null?null:L.toUpperCase()}function WT(T){let L=i(T);return L==null?null:L.toLowerCase()}function DT(T,L,I,_){if(T==null)return null;let R=i(T)??"",$=i(L)??"",G=i(I)??"",Q=typeof _==="number"&&Number.isFinite(_)?Math.trunc(_):0;if(Q<0)return R;if($===""){if(Q>R.length)return R;return R.slice(0,Q)+G+R.slice(Q)}let U=0;for(let O=0;O<=Q;O++){let J=R.indexOf($,U);if(J<0)return R;if(O===Q)return R.slice(0,J)+G+R.slice(J+$.length);U=J+$.length}return R}function i5(T){if(T==null)return null;if(typeof T==="boolean")return T?1:0;if(typeof T==="number")return Number.isFinite(T)?Math.trunc(T):null;if(typeof T==="string"){let L=Number(T.trim());return Number.isFinite(L)?Math.trunc(L):null}return null}function WI(T){if(T===0)return"0";let L=T.toPrecision(6);if(/[eE]/.test(L))return L.replace(/\.?0+([eE])/,"$1");return String(Number(L))}function KT(T,L){let I=i(T),_=i(L);if(I==null||_==null)return null;return I.startsWith(_)}function YT(T,L){let I=i(T),_=i(L);if(I==null||_==null)return null;return I.endsWith(_)}function XT(T,L,I){if(T==null)return null;let _=i(T)??"";if(L==null)return null;let R=i5(L);if(R==null)return null;if(I===void 0)return _.slice(R);if(I==null)return null;let $=i5(I);if($==null)return null;return _.slice(R,$)}var DI=1e6;function BT(T,L){if(T==null||L==null)return null;let I=i(T)??"",_=i5(L);if(_==null)return null;if(_<0)_=0;if(I.length>0&&_>Math.floor(DI/I.length))return null;return I.repeat(_)}function zT(T){let L=i(T);return L==null?null:L.trim()}function HT(T,L){let I=T==null?"":i(T)??"";if(L===void 0||L==null){let R=I.trim();return R===""?[]:R.split(/\s+/)}let _=i(L)??"";if(_==="")return[...I];return I.split(_)}function VT(T){if(T==null)return null;if(typeof T==="boolean")return T?1:0;if(typeof T==="number")return Number.isFinite(T)?T:null;let L=(i(T)??"").trim();if(!L)return null;let I=Number(L);return Number.isFinite(I)?I:null}function FT(T,L){let I=i(T),_=i(L);if(I==null||_==null)return null;return I.indexOf(_)}function qT(T,L){let I=i(T),_=i(L);if(I==null||_==null)return null;try{let R=I.match(new RegExp(_));return R==null?null:R[0]}catch{return null}}var ST="yyyy-MM-dd'T'HH:mm:ssZ",KI=["January","February","March","April","May","June","July","August","September","October","November","December"],YI=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Q1(T){return T<10?`0${T}`:String(T)}function XI(T){let L=new Date(T);return{year:L.getUTCFullYear(),month:L.getUTCMonth()+1,day:L.getUTCDate(),hour:L.getUTCHours(),minute:L.getUTCMinutes(),second:L.getUTCSeconds()}}function BI(T){let L=T;if(Array.isArray(L))L=L.length?L[L.length-1]:null;if(typeof L!=="string")return 0;let I=L.trim();if(!I||I==="syminfo.timezone"||I==="UTC"||I==="utc"||I==="Etc/UTC"||I==="GMT")return 0;if(I.toUpperCase().includes("GMT")||I.startsWith("UTC+")||I.startsWith("UTC-")||I.startsWith("utc+")||I.startsWith("utc-")){let _=I.toUpperCase().replaceAll("GMT","").replaceAll("UTC","").trim();if(!_||!/^[+-]?\d+$/.test(_))return 0;let R=Number.parseInt(_,10);return Number.isFinite(R)?R:0}return 0}function zI(T){let L=T;if(L!=null&&typeof L==="object"&&"current"in L)L=L.current;if(L==null||typeof L==="boolean"||typeof L==="string")return null;if(typeof L!=="number"||!Number.isFinite(L))return null;let I=Math.trunc(L);if(I>0&&I<10000000000)I*=1000;return I}function HI(T){return`${T>=0?"+":"-"}${Q1(Math.abs(T))}00`}function VI(T){if(T===0)return"UTC";return`UTC${T>=0?"+":"-"}${Q1(Math.abs(T))}:00`}function kT(T,L,I){let _=zI(T);if(_==null)return"NaN";let R=L==null?ST:i(L)??ST,$=BI(I),G=XI(_+$*3600000),Q=(G.hour-1)%12+1,U={yyyy:String(G.year),yy:String(G.year).slice(-2),MMMM:KI[G.month-1]??"",MMM:YI[G.month-1]??"",MM:Q1(G.month),M:String(G.month),dd:Q1(G.day),d:String(G.day),HH:Q1(G.hour),H:String(G.hour),hh:Q1(Q),h:String(Q),mm:Q1(G.minute),m:String(G.minute),ss:Q1(G.second),s:String(G.second),a:G.hour<12?"AM":"PM",zzz:VI($),z:HI($)},O=R;for(let J of Object.keys(U).sort((D,B)=>B.length-D.length))O=O.split(J).join(U[J]);return O.replaceAll("'","")}function MT(T,...L){if(T==null)return"NaN";return(typeof T==="string"?T:String(T)).replace(/\{([^{}]+)\}/g,(_,R)=>{let $=R.split(",").map((J)=>J.trim()),G=Number.parseInt($[0]??"",10);if(!Number.isFinite(G))return _;if(G<0||G>=L.length)return"";let Q=L[G];if(Q==null)return"NaN";let U=($[1]??"").toLowerCase(),O=$[2]??"";if(U===""||U==="string")return String(Q);if(U==="number"){let J=typeof Q==="number"?Q:Number(Q);if(!Number.isFinite(J))return String(Q);if(O){if(O.includes(".")){let D=O.split(".",2)[1].length;return J.toFixed(D)}return String(Math.trunc(J))}return WI(J)}if(U==="integer"){let J=typeof Q==="number"?Q:Number(Q);if(!Number.isFinite(J))return String(Q);return String(Math.trunc(J))}return String(Q)})}function ET(T,L){if(T==null)return null;if(!Array.isArray(T))return null;let I=L==null?"":i(L)??"";return T.map((_)=>_==null?"":String(_)).join(I)}function FI(T,L,I){if(L==="")return T;return T.split(L).join(I)}function jT(T,L,I){if(T==null)return null;let _=i(T)??"",R=i(L)??"",$=i(I)??"";return FI(_,R,$)}function E(T){return typeof T==="number"&&Number.isFinite(T)}function CT(T){return E(T)?T:null}function qI(T,L,I,_){let{limit:R,stop:$,direction:G}=T;if(R!=null&&$!=null){if(G==="long"&&I>=$&&_<=R)return R;if(G==="short"&&_<=$&&I>=R)return R;return null}if(R!=null){if(G==="long"&&_<=R)return Math.min(R,L);if(G==="short"&&I>=R)return Math.max(R,L);return null}if($!=null){if(G==="long"&&I>=$)return Math.max($,L);if(G==="short"&&_<=$)return Math.min($,L);return null}return null}function PT(T,L){return E(T)?T:L}function NT(T){if(T==null||!E(T))return;return Math.max(0,Math.trunc(T))}function h2(T){if(T===1||T==="1")return"long";if(T===-1||T==="-1")return"short";let L=String(T??"").toLowerCase();if(L.includes("long"))return"long";if(L.includes("short"))return"short";return"long"}function yT(T){let L=Math.trunc(T);if(L>10000000000)return Math.trunc(L/86400000);if(L>1e7)return Math.trunc(L/86400);return L}function kI(T){let L=String(T??"none").trim().toLowerCase();if(L==="cancel"||L==="oca.cancel"||L==="strategy.oca.cancel")return"cancel";if(L==="reduce"||L==="oca.reduce"||L==="strategy.oca.reduce")return"reduce";return"none"}class s5{events=[];position={qty:0,avgPrice:null};fills=[];pending=[];openTrades=[];closedTrades=[];commissionPaid=0;realizedPnl=0;closedCount=0;wintrades=0;losstrades=0;eventrades=0;grossprofit=0;grossloss=0;initialCapital=1e6;allow_entry_in="all";max_position_size_percent;max_drawdown_risk;max_drawdown_risk_percent;max_cons_loss_days;max_intraday_loss=Number.POSITIVE_INFINITY;max_intraday_filled_orders;entries_blocked=!1;consecutive_loss_days=0;get opentrades(){return this.openTrades.length}get closedtrades(){return this.closedTrades.length}commission;slippage;pyramiding;sameDirAdds=0;lastTradeDay=null;dayPnl=0;fillsDay=null;dayFilledOrders=0;equityPeak;equityTrough;maxDrawdownAbs=0;maxDdPercent=0;maxRunupAbs=0;maxRuPercent=0;maxHeldAll=0;maxHeldLong=0;maxHeldShort=0;constructor(T){this.commission=PT(T?.commission,0),this.slippage=PT(T?.slippage,0),this.pyramiding=NT(T?.pyramiding),this.equityPeak=this.initialCapital,this.equityTrough=this.initialCapital}equity(T){this.ensureSanePosition();let L=this.position.qty,I=this.position.avgPrice,_=E(this.realizedPnl)?this.realizedPnl:0,R=E(this.commissionPaid)?this.commissionPaid:0,$=L===0||!E(I)||!E(T)?0:L*(T-I),G=this.initialCapital+_-R+$;return this.trackEquityCurve(G),G}closedTrade(T){return this.pickTrade(this.closedTrades,T)}openTrade(T){return this.pickTrade(this.openTrades,T)}closedEntryBar(T){return this.closedTrade(T)?.entryBar??null}closedEntryPrice(T){return this.closedTrade(T)?.entryPrice??null}closedExitBar(T){return this.closedTrade(T)?.exitBar??null}closedExitPrice(T){return this.closedTrade(T)?.exitPrice??null}closedProfit(T){let L=this.closedTrade(T);return L!=null&&L.profit!==void 0?L.profit:null}closedSize(T){return this.closedTrade(T)?.qty??null}closedId(T){return this.closedTrade(T)?.id??null}closedCommission(T){return this.closedTrade(T)?.commission??null}openEntryBar(T){return this.openTrade(T)?.entryBar??null}openEntryPrice(T){return this.openTrade(T)?.entryPrice??null}openSize(T){return this.openTrade(T)?.qty??null}openId(T){return this.openTrade(T)?.id??null}openProfit(T,L){let I=this.openTrade(T);if(I==null||!E(L))return null;return this.markProfit(I,L)}avgTrade(){let T=this.closedTrades.length;return T===0?0:(this.grossprofit-this.grossloss)/T}avgWinningTrade(){return this.wintrades===0?0:this.grossprofit/this.wintrades}avgLosingTrade(){return this.losstrades===0?0:this.grossloss/this.losstrades}netprofit(){return E(this.realizedPnl)?this.realizedPnl:0}netprofitPercent(T){return this.pctOfInitial(this.netprofit())}openprofit(T){this.ensureSanePosition();let L=this.position.qty,I=this.position.avgPrice;if(L===0||!E(I)||!E(T))return 0;return L*(T-I)}openprofitPercent(T){return this.pctOfInitial(this.openprofit(T))}grossprofitPercent(){return this.pctOfInitial(this.grossprofit)}grosslossPercent(){return this.pctOfInitial(this.grossloss)}avgTradePercent(){return this.pctOfInitial(this.avgTrade())}avgWinningTradePercent(){return this.pctOfInitial(this.avgWinningTrade())}avgLosingTradePercent(){return this.pctOfInitial(this.avgLosingTrade())}maxDrawdown(){return this.maxDrawdownAbs}maxDrawdownPercent(){return this.maxDdPercent}maxRunup(){return this.maxRunupAbs}maxRunupPercent(){return this.maxRuPercent}percentProfitable(){let T=this.closedTrades.length;return T===0?0:100*this.wintrades/T}profitFactor(){let T=this.grossprofit,L=this.grossloss;if(!E(T)||!E(L))return 0;if(L>0)return T/L;return T>0?999.99:0}maxContractsHeldAll(){return this.maxHeldAll}maxContractsHeldLong(){return this.maxHeldLong}maxContractsHeldShort(){return this.maxHeldShort}summary(T){return{netprofit:this.netprofit(),netprofitPercent:this.netprofitPercent(T),openprofit:this.openprofit(T),equity:this.equity(T),wintrades:this.wintrades,losstrades:this.losstrades,eventrades:this.eventrades,closedtrades:this.closedtrades,opentrades:this.opentrades,grossprofit:this.grossprofit,grossloss:this.grossloss,avgTrade:this.avgTrade(),avgWinningTrade:this.avgWinningTrade(),avgLosingTrade:this.avgLosingTrade(),percentProfitable:this.percentProfitable(),profitFactor:this.profitFactor(),maxDrawdown:this.maxDrawdown(),maxDrawdownPercent:this.maxDrawdownPercent(),maxRunup:this.maxRunup(),maxRunupPercent:this.maxRunupPercent(),initialCapital:this.initialCapital}}markOpenTrades(T,L,I){if(this.openTrades.length===0)return;for(let _ of this.openTrades){let R=_.direction==="long"?E(T)?T:I:E(L)?L:I,$=_.direction==="long"?E(L)?L:I:E(T)?T:I;if(E(R)){let G=this.markProfit(_,R);if(G>0)_.max_runup=Math.max(_.max_runup??0,G)}if(E($)){let G=this.markProfit(_,$);if(G<0)_.max_drawdown=Math.max(_.max_drawdown??0,-G)}}}configure(T){if(E(T.commission))this.commission=T.commission;if(E(T.slippage))this.slippage=T.slippage;if(T.pyramiding!==void 0){let L=NT(T.pyramiding);if(L!==void 0||T.pyramiding==null)this.pyramiding=L}}riskAllowEntryIn(T="all"){let L=String(T??"all").replace(/strategy\./gi,"").trim().toLowerCase();this.allow_entry_in=L==="long"||L==="short"||L==="all"?L:"all"}riskMaxPositionSize(T){if(T==null||!E(T)||T<=0)return;this.max_position_size_percent=T}riskMaxDrawdown(T,L="absolute"){if(T==null||!E(T)||T<0)return;let I=String(L??"absolute").replace(/strategy\./gi,"").trim().toLowerCase();if(I==="percent"||I==="percentage"||I==="percent_of_equity"||I==="%")this.max_drawdown_risk_percent=T;else this.max_drawdown_risk=T}riskMaxConsLossDays(T){if(T==null||!E(T))return;let L=Math.trunc(T);if(L<0)return;this.max_cons_loss_days=L}riskMaxIntradayLoss(T){if(T==null||!E(T)||T<0)return;this.max_intraday_loss=T}riskMaxIntradayFilledOrders(T){if(T==null||!E(T))return;let L=Math.trunc(T);if(L<0)return;this.max_intraday_filled_orders=L}noteClosedTradeDay(T,L){if(!E(T)||!E(L))return;let I=yT(T);if(this.lastTradeDay==null||I!==this.lastTradeDay){if(this.lastTradeDay!=null){if(this.dayPnl<0)this.consecutive_loss_days+=1;else if(this.dayPnl>0)this.consecutive_loss_days=0}this.lastTradeDay=I,this.dayPnl=0}if(this.dayPnl+=L,this.max_cons_loss_days!=null&&this.consecutive_loss_days>=this.max_cons_loss_days)this.entries_blocked=!0;if(Number.isFinite(this.max_intraday_loss)&&this.max_intraday_loss<Number.POSITIVE_INFINITY&&this.initialCapital>0&&this.dayPnl<0){if(100*-this.dayPnl/this.initialCapital>=this.max_intraday_loss)this.entries_blocked=!0}}entry(T,L,I,_){let R={type:"entry",id:String(L??""),direction:h2(I),bar:E(T)?T:0};if(_!==void 0)R.qty=_;this.events.push(R)}close(T,L){this.events.push({type:"close",id:String(L??""),bar:E(T)?T:0})}exit(T,L){this.events.push({type:"exit",id:String(L??""),bar:E(T)?T:0})}cancel(T,L){this.dropPending(String(L??"")),this.events.push({type:"cancel",id:String(L??""),bar:E(T)?T:0})}closeAll(T,L){let I=E(T)?T:0;if(this.dropPending(),E(L)&&this.position.qty!==0)this.flattenAt(I,"close_all",L);this.events.push({type:"close_all",id:"",bar:I})}cancelAll(T){this.dropPending(),this.events.push({type:"cancel_all",id:"",bar:E(T)?T:0})}placeEntry(T,L,I,_,R){let $=CT(R?.limit),G=CT(R?.stop);if($==null&&G==null){if(E(R?.price)){let z=h2(I),X=E(R?.time)?R.time:T;if(this.updateEquityExtremes(R.price),!this.riskAllowsEntry(z,X))return;this.fillEntry(T,L,I,_,R.price,R)}else this.entry(T,L,I,_);return}let Q=h2(I),U=E(_)?Math.abs(_):Number.NaN,O=E(T)?T:0,J=String(L??"");if(this.entry(O,J,Q,E(U)?U:_),!E(U)||U===0)return;let D={id:J,direction:Q,qty:U,limit:$,stop:G,bar:O},B=R?.oca_name==null||R.oca_name===""?void 0:String(R.oca_name),H=kI(R?.oca_type);if(B!==void 0)D.oca_name=B;if(H!=="none")D.oca_type=H;this.upsertPending(D)}order(T,L,I,_,R){this.placeEntry(T,L,I,_,R)}processPending(T,L){if(this.pending.length===0||L==null)return[];if(!(E(L.open)||E(L.high)||E(L.low)||E(L.close)))return[];let _=E(T)?T:0,R=E(L.close)?L.close:E(L.open)?L.open:E(L.high)?L.high:L.low,$=E(L.open)?L.open:R,G=E(L.high)?L.high:Math.max($,R),Q=E(L.low)?L.low:Math.min($,R),U=[];for(let O of this.pending.slice()){if(!this.pending.some((B)=>B.id===O.id))continue;let J=qI(O,$,G,Q);if(J==null)continue;if(this.dropPending(O.id),this.applyEntryFill(_,O.id,O.direction,O.qty,J,!1)){let B=Math.abs(this.fills.at(-1)?.qty??O.qty);this.ocaAfterFill(O,B,_),this.events.push({type:"fill",id:O.id,direction:O.direction,qty:B,bar:_}),U.push(O.id)}}return U}fillEntry(T,L,I,_,R,$){this.applyEntryFill(T,L,I,_,R,!0,$)}fillClose(T,L,I,_){this.ensureSanePosition();let R=E(T)?T:0,$=String(L??"");if(this.position.qty!==0){if(!E(I))return;this.flattenAt(R,$,I,_?.time)}this.close(R,$)}applyEntryFill(T,L,I,_,R,$,G){if(this.ensureSanePosition(),!E(_)||_===0||!E(R))return!1;let Q=Math.abs(_);if(!E(Q)||Q===0)return!1;let U=h2(I),O=E(T)?T:0,J=String(L??""),D=E(G?.time)?G.time:O;if(this.updateEquityExtremes(R),!this.riskAllowsEntry(U,D))return!1;let B=this.capQtyByMaxPosition(Q,R);if(!E(B)||B<=0)return!1;let H=U==="long"?B:-B;if(this.position.qty!==0&&Math.sign(this.position.qty)!==Math.sign(H)){if(!this.flattenAt(O,J,R,G?.time))return!1;this.close(O,J)}else if(this.position.qty!==0&&this.pyramiding!==void 0&&this.sameDirAdds>=this.pyramiding)return!1;if(this.position.qty!==0)this.sameDirAdds++;else this.sameDirAdds=0;if(this.addPosition(O,J,H,R,G),this.noteFilledOrder(D),this.updateEquityExtremes(R),$)this.entry(O,J,U,B);return!0}upsertPending(T){let L=this.pending.findIndex((I)=>I.id===T.id);if(L>=0)this.pending[L]=T;else this.pending.push(T)}dropPending(T){if(T===void 0){this.pending.length=0;return}for(let L=this.pending.length-1;L>=0;L--)if(this.pending[L].id===T)this.pending.splice(L,1)}addPosition(T,L,I,_,R){if(!E(I)||I===0||!E(_))return;let $=this.position.qty,G=Math.abs($),Q=Math.abs(I),U=I>0?"buy":"sell",O=this.recordFill(T,L,U,Q,_);if(!E(O))return;let J=this.fillFee(Q,O),D=this.position.avgPrice;this.position.avgPrice=G===0||!E(D)?O:(D*G+O*Q)/(G+Q);let B=$+I;if(this.position.qty=E(B)&&B!==0?B:0,this.position.qty===0){this.position.avgPrice=null;return}let H=this.position.qty>0?"long":"short";this.notePositionSize();let z=R?.comment!=null?String(R.comment):void 0,X=E(R?.time)?R.time:void 0;if(G===0||this.openTrades.length===0){this.openTrades.length=0;let C={id:L,direction:H,qty:Math.abs(this.position.qty),entryBar:T,entryPrice:this.position.avgPrice??O,commission:J};if(X!==void 0)C.entryTime=X;if(z!==void 0)C.comment=z;this.openTrades.push(C);return}let k=this.openTrades[0];k.qty=Math.abs(this.position.qty),k.entryPrice=this.position.avgPrice??O,k.commission+=J}flattenAt(T,L,I,_){let R=this.position.qty;if(R===0||!E(R)||!E(I))return!1;let $=R>0?"sell":"buy",G=Math.abs(R),Q=this.recordFill(T,L,$,G,I);if(!E(Q))return!1;let U=this.position.avgPrice,O=E(U)?U:Q,J=R*(Q-O);if(E(J))this.realizedPnl+=J;let D=E(_)?_:T;return this.closeOpenTrades(T,L,Q,G,R>0?"long":"short",O,D),this.position.qty=0,this.position.avgPrice=null,this.sameDirAdds=0,this.closedCount+=1,this.noteFilledOrder(D),this.updateEquityExtremes(Q),!0}ensureSanePosition(){let T=this.position.qty,L=this.position.avgPrice;if(!E(T)||T!==0&&!E(L))this.position.qty=0,this.position.avgPrice=null,this.sameDirAdds=0,this.openTrades.length=0}closeOpenTrades(T,L,I,_,R,$,G){if(this.openTrades.length===0&&_>0)this.openTrades.push({id:L,direction:R,qty:_,entryBar:T,entryPrice:$,commission:0});let Q=this.openTrades.reduce((O,J)=>O+J.qty,0),U=this.fillFee(_,I);for(let O of this.openTrades){let J=Q>0?O.qty/Q:1,D=U*J,B=this.markProfit(O,I)-D,H={id:O.id,direction:O.direction,qty:O.qty,entryBar:O.entryBar,entryPrice:O.entryPrice,exitBar:T,exitPrice:I,profit:B,commission:O.commission+D};if(O.entryTime!==void 0)H.entryTime=O.entryTime;if(O.comment!==void 0)H.comment=O.comment;if(O.max_runup!==void 0)H.max_runup=O.max_runup;if(O.max_drawdown!==void 0)H.max_drawdown=O.max_drawdown;this.closedTrades.push(H),this.noteClosedProfit(B),this.noteClosedTradeDay(E(G)?G:T,B)}this.openTrades.length=0}noteClosedProfit(T){if(!E(T))return;if(T>0)this.grossprofit+=T,this.wintrades+=1;else if(T<0)this.grossloss+=-T,this.losstrades+=1;else this.eventrades+=1}markProfit(T,L){return(T.direction==="long"?1:-1)*(L-T.entryPrice)*T.qty-T.commission}fillFee(T,L){let I=E(this.commission)?this.commission:0,_=Math.abs(T)*Math.abs(L)*I;return E(_)?_:0}pickTrade(T,L){if(!E(L)||!Number.isInteger(L)||L<0||L>=T.length)return null;return T[L]??null}riskAllowsEntry(T,L){let I=(this.allow_entry_in||"all").toLowerCase().replace(/strategy\./g,"");if(I==="long"&&T!=="long")return!1;if(I==="short"&&T!=="short")return!1;if(this.entries_blocked)return!1;if(this.max_drawdown_risk!=null&&this.maxDrawdownAbs>=this.max_drawdown_risk)return this.entries_blocked=!0,!1;if(this.max_drawdown_risk_percent!=null&&this.maxDdPercent>=this.max_drawdown_risk_percent)return this.entries_blocked=!0,!1;if(this.max_cons_loss_days!=null&&this.consecutive_loss_days>=this.max_cons_loss_days)return this.entries_blocked=!0,!1;if(Number.isFinite(this.max_intraday_loss)&&this.max_intraday_loss<Number.POSITIVE_INFINITY&&this.initialCapital>0&&this.dayPnl<0){if(100*-this.dayPnl/this.initialCapital>=this.max_intraday_loss)return this.entries_blocked=!0,!1}if(this.max_intraday_filled_orders!=null){if(this.rollFillDay(L),this.dayFilledOrders>=this.max_intraday_filled_orders)return!1}return!0}capQtyByMaxPosition(T,L){let I=this.max_position_size_percent;if(I==null||I<=0||!E(L)||L<=0)return T;let R=this.equity(L)*(I/100)/L;if(!E(R)||R<0)return 0;return Math.min(T,R)}updateEquityExtremes(T){this.equity(T)}trackEquityCurve(T){if(!E(T))return;if(T>this.equityPeak)this.equityPeak=T;if(T<this.equityTrough)this.equityTrough=T;let L=this.equityPeak-T;if(L>this.maxDrawdownAbs){if(this.maxDrawdownAbs=L,this.equityPeak>0)this.maxDdPercent=100*L/this.equityPeak}let I=T-this.equityTrough;if(I>this.maxRunupAbs){if(this.maxRunupAbs=I,this.equityTrough>0)this.maxRuPercent=100*I/this.equityTrough}}pctOfInitial(T){let L=this.initialCapital;if(!E(L)||L<=0||!E(T))return 0;return 100*T/L}notePositionSize(){let T=Math.abs(this.position.qty);if(!E(T)||T===0)return;if(T>this.maxHeldAll)this.maxHeldAll=T;if(this.position.qty>0&&T>this.maxHeldLong)this.maxHeldLong=T;if(this.position.qty<0&&T>this.maxHeldShort)this.maxHeldShort=T}rollFillDay(T){let L=yT(E(T)?T:0);if(this.fillsDay==null||L!==this.fillsDay)this.fillsDay=L,this.dayFilledOrders=0}noteFilledOrder(T){this.rollFillDay(T),this.dayFilledOrders+=1}ocaAfterFill(T,L,I){let _=T.oca_name,R=T.oca_type??"none";if(!_||R==="none")return;for(let $ of this.pending.slice()){if($.id===T.id||$.oca_name!==_)continue;if(R==="cancel")this.dropPending($.id),this.events.push({type:"cancel",id:$.id,bar:I});else if(R==="reduce"){if($.qty=Math.max(0,$.qty-L),$.qty<=0.000000000001)this.dropPending($.id),this.events.push({type:"cancel",id:$.id,bar:I})}}}recordFill(T,L,I,_,R){let $=E(this.slippage)?this.slippage:0,G=I==="buy"?R+$:R-$;if(!E(G)||!E(_)||_===0)return Number.NaN;this.fills.push({bar:T,id:L,side:I,qty:_,price:G});let Q=E(this.commission)?this.commission:0,U=Math.abs(_)*Math.abs(G)*Q;if(E(U))this.commissionPaid+=U;return G}}function w2(T){if(typeof T==="string")return`s:${T}`;if(typeof T==="number"&&Number.isFinite(T))return`n:${Object.is(T,-0)?0:T}`;return null}function bT(T){return T.startsWith("s:")?T.slice(2):Number(T.slice(2))}class V1{data=new Map;order=[];size(){return this.data.size}put(T,L){let I=w2(T);if(I==null)return;if(!this.data.has(I))this.order.push(I);this.data.set(I,L)}get(T){let L=w2(T);if(L==null)return null;return this.data.has(L)?this.data.get(L):null}contains(T){let L=w2(T);return L!=null&&this.data.has(L)}remove(T){let L=w2(T);if(L==null||!this.data.has(L))return null;let I=this.data.get(L);this.data.delete(L);let _=this.order.indexOf(L);if(_>=0)this.order.splice(_,1);return I}clear(){this.data.clear(),this.order.length=0}keys(){return this.order.map(bT)}values(){return this.order.map((T)=>this.data.get(T))}copy(){let T=new V1;for(let L of this.order)T.put(bT(L),this.data.get(L));return T}putAll(T){if(!(T instanceof V1))return;let L=T.keys(),I=T.values();for(let _=0;_<L.length;_++)this.put(L[_],I[_])}}function E0(T,L){if(!Number.isFinite(T))return null;let I=Math.trunc(T);if(I<0||I>=L)return null;return I}function hT(T){if(!Number.isFinite(T)||T<0)return 0;return Math.min(Math.trunc(T),1e6)}function B6(T,L){if(T<=0||L<=0)return!0;return L<=Math.floor(1e6/T)}function wT(T,L){let I=[],_=T??[];for(let R=0;R<L;R++)I.push(R<_.length?_[R]:null);return I}function a5(T){let L=[];for(let I=0;I<T.length;I++)L.push(T[I].slice());return L}function A2(T,L,I,_){let R=T+_,$=T*_-L*I,G=R*R-4*$;if(G>=0){let U=Math.sqrt(G);return[(R+U)/2,(R-U)/2]}let Q=R/2;return[Q,Q]}function MI(T,L,I,_){if((T-_)*(T-_)+4*L*I<0)return _;let[R,$]=A2(T,L,I,_);return Math.abs(R-_)<Math.abs($-_)?R:$}function EI(T){let L=T.length,I=T[0].length,_=a5(T),R=[];for(let Q=0;Q<I;Q++){let U=[];for(let O=0;O<I;O++)U.push(Q===O?1:0);R.push(U)}for(let Q=0;Q<50;Q++){let U=!1;for(let O=0;O<I-1;O++)for(let J=O+1;J<I;J++){let D=0,B=0,H=0;for(let d=0;d<L;d++){let J0=_[d][O],X0=_[d][J];D+=J0*J0,B+=X0*X0,H+=J0*X0}if(!Number.isFinite(D)||!Number.isFinite(B)||!Number.isFinite(H))return null;let z=0.000000000000001*Math.sqrt(Math.max(D*B,0));if(Math.abs(H)<=z)continue;U=!0;let X=(B-D)/(2*H),k=(X>=0?1:-1)/(Math.abs(X)+Math.hypot(1,X)),C=1/Math.sqrt(1+k*k),u=C*k;for(let d=0;d<L;d++){let J0=_[d][O],X0=_[d][J];_[d][O]=C*J0-u*X0,_[d][J]=u*J0+C*X0}for(let d=0;d<I;d++){let J0=R[d][O],X0=R[d][J];R[d][O]=C*J0-u*X0,R[d][J]=u*J0+C*X0}}if(!U)break}let $=[],G=[];for(let Q=0;Q<L;Q++){let U=[];for(let O=0;O<I;O++)U.push(0);G.push(U)}for(let Q=0;Q<I;Q++){let U=0;for(let O=0;O<L;O++)U+=_[O][Q]*_[O][Q];if(U=Math.sqrt(U),!Number.isFinite(U))return null;if($.push(U),U>0)for(let O=0;O<L;O++)G[O][Q]=_[O][Q]/U}return{u:G,s:$,v:R}}function jI(T){let L=T.length;for(let I=0;I<L-2;I++){let _=0;for(let O=I+2;O<L;O++)_+=T[O][I]*T[O][I];if(_<0.000000000000000000000000000001)continue;let R=_+T[I+1][I]*T[I+1][I];if(R=Math.sqrt(R),R<0.000000000000000000000000000001)continue;let $=T[I+1][I],G=($>=0?1:-1)*R,Q=[$+G];for(let O=I+2;O<L;O++)Q.push(T[O][I]);let U=0;for(let O of Q)U+=O*O;if(U=Math.sqrt(U),U<0.000000000000000000000000000001)continue;for(let O=0;O<Q.length;O++)Q[O]/=U;for(let O=I;O<L;O++){let J=0;for(let D=0;D<Q.length;D++)J+=Q[D]*T[I+1+D][O];J*=2;for(let D=0;D<Q.length;D++)T[I+1+D][O]-=J*Q[D]}for(let O=0;O<L;O++){let J=0;for(let D=0;D<Q.length;D++)J+=T[O][I+1+D]*Q[D];J*=2;for(let D=0;D<Q.length;D++)T[O][I+1+D]-=J*Q[D]}T[I+1][I]=-G;for(let O=I+2;O<L;O++)T[O][I]=0}}function CI(T,L,I){let _=[];for(let R=0;R<L;R++)T[R][R]-=I;for(let R=0;R<L-1;R++){let $=T[R][R],G=T[R+1][R],Q=Math.hypot($,G),U=Q>0?$/Q:1,O=Q>0?G/Q:0;_.push({c:U,s:O});for(let J=R;J<L;J++){let D=U*T[R][J]+O*T[R+1][J],B=-O*T[R][J]+U*T[R+1][J];T[R][J]=D,T[R+1][J]=B}}for(let R=0;R<L-1;R++){let{c:$,s:G}=_[R];for(let Q=0;Q<=R+1&&Q<L;Q++){let U=$*T[Q][R]+G*T[Q][R+1],O=-G*T[Q][R]+$*T[Q][R+1];T[Q][R]=U,T[Q][R+1]=O}}for(let R=0;R<L;R++)T[R][R]+=I}function AT(T){let L=T.length;if(L===0)return[];if(L===1){let Q=T[0][0];return Number.isFinite(Q)?[Q]:null}if(L===2){let Q=A2(T[0][0],T[0][1],T[1][0],T[1][1]);if(!Number.isFinite(Q[0])||!Number.isFinite(Q[1]))return null;return[Q[0],Q[1]]}let I=a5(T);jI(I);let _=[],R=L,$=40*L*L,G=0;while(R>0){if(++G>$)return null;if(R===1){let J=I[0][0];if(!Number.isFinite(J))return null;_.push(J);break}if(R===2){let J=A2(I[0][0],I[0][1],I[1][0],I[1][1]);if(!Number.isFinite(J[0])||!Number.isFinite(J[1]))return null;_.push(J[0],J[1]);break}let Q=Math.abs(I[R-1][R-1])+Math.abs(I[R-2][R-2]);if(Math.abs(I[R-1][R-2])<=0.00000000000001*Math.max(1,Q)){let J=I[R-1][R-1];if(!Number.isFinite(J))return null;_.push(J),R--;continue}let U=Math.abs(I[R-2][R-2])+Math.abs(I[R-3][R-3]);if(Math.abs(I[R-2][R-3])<=0.00000000000001*Math.max(1,U)){let J=A2(I[R-2][R-2],I[R-2][R-1],I[R-1][R-2],I[R-1][R-1]);if(!Number.isFinite(J[0])||!Number.isFinite(J[1]))return null;_.push(J[0],J[1]),R-=2;continue}let O=MI(I[R-2][R-2],I[R-2][R-1],I[R-1][R-2],I[R-1][R-1]);if(G%10===0)O+=Math.abs(I[R-1][R-2])+Math.abs(I[R-2][R-3]);if(!Number.isFinite(O))return null;CI(I,R,O);for(let J=0;J<R;J++)for(let D=0;D<J-1;D++)I[J][D]=0}return _}function PI(T){let L=T.length;if(L===0)return[];let I=a5(T),_=0;for(let D=0;D<L;D++)for(let B=0;B<L;B++){let H=I[D][B];if(!Number.isFinite(H))return null;if(Math.abs(H)>_)_=Math.abs(H)}let R=Math.max(0.00000000000001,0.000000000001*_),$=Array(L).fill(-1),G=Array(L).fill(!1),Q=0;for(let D=0;D<L&&Q<L;D++){let B=Q,H=Math.abs(I[Q][D]);for(let X=Q+1;X<L;X++){let k=Math.abs(I[X][D]);if(k>H)H=k,B=X}if(H<R)continue;if(B!==Q){let X=I[Q];I[Q]=I[B],I[B]=X}let z=I[Q][D];for(let X=D;X<L;X++)I[Q][X]/=z;for(let X=0;X<L;X++){if(X===Q)continue;let k=I[X][D];if(k===0)continue;for(let C=D;C<L;C++)I[X][C]-=k*I[Q][C]}$[Q]=D,G[D]=!0,Q++}let U=-1;for(let D=0;D<L;D++)if(!G[D]){U=D;break}if(U<0)return null;let O=Array(L).fill(0);O[U]=1;for(let D=L-1;D>=0;D--){let B=$[D];if(B<0)continue;let H=0;for(let z=0;z<L;z++){if(z===B)continue;H+=I[D][z]*O[z]}O[B]=-H}let J=0;for(let D of O){if(!Number.isFinite(D))return null;J+=D*D}if(J=Math.sqrt(J),!(J>R))return null;for(let D=0;D<L;D++)O[D]/=J;return O}class e{cells=[];nRows;nCols;constructor(T,L,I){let _=hT(T),R=hT(L);if(_>0&&R>Math.floor(1e6/_))_=0,R=0;this.nRows=_,this.nCols=R;let $=I===void 0?null:I;for(let G=0;G<this.nRows;G++){let Q=[];for(let U=0;U<this.nCols;U++)Q.push($);this.cells.push(Q)}}rows(){return this.nRows}columns(){return this.nCols}get(T,L){let I=E0(T,this.nRows),_=E0(L,this.nCols);if(I===null||_===null)return null;return this.cells[I][_]}set(T,L,I){let _=E0(T,this.nRows),R=E0(L,this.nCols);if(_===null||R===null)return;this.cells[_][R]=I}fill(T){for(let L=0;L<this.nRows;L++){let I=this.cells[L];for(let _=0;_<this.nCols;_++)I[_]=T}}transpose(){let T=new e(this.nCols,this.nRows);for(let L=0;L<this.nRows;L++)for(let I=0;I<this.nCols;I++)T.set(I,L,this.cells[L][I]);return T}row(T){let L=E0(T,this.nRows);return L===null?[]:this.cells[L].slice()}col(T){let L=E0(T,this.nCols);if(L===null)return[];let I=[];for(let _=0;_<this.nRows;_++)I.push(this.cells[_][L]);return I}copy(){let T=new e(this.nRows,this.nCols);for(let L=0;L<this.nRows;L++)for(let I=0;I<this.nCols;I++)T.set(L,I,this.cells[L][I]);return T}elementsCount(){return this.nRows*this.nCols}isSquare(){return this.nRows===this.nCols&&this.nRows>0}sum(){let T=this.finiteAll();if(T===null)return null;let L=0;for(let I of T)L+=I;return L}avg(){let T=this.finiteAll();if(T===null||T.length===0)return null;let L=0;for(let I of T)L+=I;return L/T.length}min(){let T=this.finiteAll();if(T===null||T.length===0)return null;let L=T[0];for(let I of T)if(I<L)L=I;return L}max(){let T=this.finiteAll();if(T===null||T.length===0)return null;let L=T[0];for(let I of T)if(I>L)L=I;return L}trace(){if(!this.isSquare())return null;let T=0;for(let L=0;L<this.nRows;L++){let I=this.cells[L][L];if(I===null||!Number.isFinite(I))return null;T+=I}return T}det(){if(!this.isSquare())return null;let T=this.nRows;if(T===0)return null;let L=[];for(let R=0;R<T;R++){let $=[];for(let G=0;G<T;G++){let Q=this.cells[R][G];if(Q===null||!Number.isFinite(Q))return null;$.push(Q)}L.push($)}if(T===1)return L[0][0];if(T===2){let R=L[0][0]*L[1][1]-L[0][1]*L[1][0];return Number.isFinite(R)?R:null}let I=1;for(let R=0;R<T;R++){let $=R,G=Math.abs(L[R][R]);for(let U=R+1;U<T;U++){let O=Math.abs(L[U][R]);if(O>G)G=O,$=U}if(G===0)return 0;if($!==R){let U=L[R];L[R]=L[$],L[$]=U,I=-I}let Q=L[R][R];for(let U=R+1;U<T;U++){let O=L[U][R]/Q;for(let J=R;J<T;J++)L[U][J]-=O*L[R][J]}}let _=I;for(let R=0;R<T;R++)_*=L[R][R];return Number.isFinite(_)?_:null}mult(T){if(typeof T==="number"){if(!Number.isFinite(T))return null;let R=new e(this.nRows,this.nCols);for(let $=0;$<this.nRows;$++)for(let G=0;G<this.nCols;G++){let Q=this.cells[$][G];if(Q===null||!Number.isFinite(Q)){R.set($,G,null);continue}let U=Q*T;R.set($,G,Number.isFinite(U)?U:null)}return R}if(this.nCols!==T.nRows)return null;let L=this.asFiniteGrid(),I=T.asFiniteGrid();if(L===null||I===null)return null;let _=new e(this.nRows,T.nCols,0);for(let R=0;R<this.nRows;R++)for(let $=0;$<T.nCols;$++){let G=0;for(let Q=0;Q<this.nCols;Q++)G+=L[R][Q]*I[Q][$];if(!Number.isFinite(G))return null;_.set(R,$,G)}return _}inv(){if(this.nRows!==this.nCols)return null;let T=this.nRows;if(T===0)return new e(0,0);let L=this.asFiniteGrid();if(L===null)return null;let I=[];for(let $=0;$<T;$++){let G=L[$].slice();for(let Q=0;Q<T;Q++)G.push($===Q?1:0);I.push(G)}let _=0.000000000001;for(let $=0;$<T;$++){let G=$,Q=Math.abs(I[$][$]);for(let O=$+1;O<T;O++){let J=Math.abs(I[O][$]);if(J>Q)Q=J,G=O}if(Q<_)return null;if(G!==$){let O=I[$];I[$]=I[G],I[G]=O}let U=I[$][$];for(let O=0;O<2*T;O++)I[$][O]/=U;for(let O=0;O<T;O++){if(O===$)continue;let J=I[O][$];if(J===0)continue;for(let D=0;D<2*T;D++)I[O][D]-=J*I[$][D]}}let R=new e(T,T,0);for(let $=0;$<T;$++)for(let G=0;G<T;G++){let Q=I[$][T+G];if(!Number.isFinite(Q))return null;R.set($,G,Q)}return R}pow(T){if(this.nRows!==this.nCols)return null;if(!Number.isFinite(T))return null;let L=Math.trunc(T);if(L===0)return e.eye(this.nRows);if(L<0){let $=this.inv();return $===null?null:$.pow(-L)}if(this.asFiniteGrid()===null)return null;let I=e.eye(this.nRows),_=this.copy(),R=L;while(R>0){if(R%2===1){if(I=I.mult(_),I===null)return null}if(R=Math.trunc(R/2),R>0){if(_=_.mult(_),_===null)return null}}return I}kron(T){let L=this.asFiniteGrid(),I=T.asFiniteGrid();if(L===null||I===null)return null;let{nRows:_,nCols:R}=T,$=new e(this.nRows*_,this.nCols*R,0);for(let G=0;G<this.nRows;G++)for(let Q=0;Q<this.nCols;Q++){let U=L[G][Q];for(let O=0;O<_;O++)for(let J=0;J<R;J++){let D=U*I[O][J];$.set(G*_+O,Q*R+J,Number.isFinite(D)?D:null)}}return $}isZero(){for(let T=0;T<this.nRows;T++)for(let L=0;L<this.nCols;L++){let I=this.cells[T][L];if(I===null)continue;if(I!==0)return!1}return!0}isIdentity(){if(this.nRows!==this.nCols)return!1;for(let T=0;T<this.nRows;T++)for(let L=0;L<this.nCols;L++){let I=T===L?1:0,_=this.cells[T][L];if(_===null||_!==I)return!1}return!0}isDiagonal(){if(this.nRows!==this.nCols)return!1;for(let T=0;T<this.nRows;T++)for(let L=0;L<this.nCols;L++){if(T===L)continue;let I=this.cells[T][L];if(I!==null&&I!==0)return!1}return!0}isSymmetric(){if(this.nRows!==this.nCols)return!1;for(let T=0;T<this.nRows;T++)for(let L=T+1;L<this.nCols;L++)if(this.cells[T][L]!==this.cells[L][T])return!1;return!0}isAntisymmetric(){if(this.nRows!==this.nCols)return!1;for(let T=0;T<this.nRows;T++)for(let L=0;L<this.nCols;L++){let I=this.cells[T][L],_=this.cells[L][T];if(T===L){if(I!==null&&I!==0)return!1;continue}if(I!==null&&_!==null){if(I!==-_)return!1}else if(I!==_)return!1}return!0}isTriangular(){if(this.nRows!==this.nCols)return!1;let T=!0,L=!0;for(let I=0;I<this.nRows;I++)for(let _=0;_<this.nCols;_++){let R=this.cells[I][_],$=R!==null&&R!==0;if(I>_&&$)T=!1;if(I<_&&$)L=!1}return T||L}swapRows(T,L){let I=E0(T,this.nRows),_=E0(L,this.nRows);if(I===null||_===null||I===_)return;let R=this.cells[I];this.cells[I]=this.cells[_],this.cells[_]=R}swapColumns(T,L){let I=E0(T,this.nCols),_=E0(L,this.nCols);if(I===null||_===null||I===_)return;for(let R of this.cells){let $=R[I];R[I]=R[_],R[_]=$}}addRow(T,L){let I=this.nRows===0&&this.nCols===0,_=I?L?.length??0:this.nCols;if(!B6(this.nRows+1,_))return;if(T!==void 0){if(!Number.isFinite(T))return;if(Math.trunc(T)<0)return}let R=wT(L,_);if(I)this.nCols=_;let $=T===void 0?this.nRows:Math.trunc(T);if($>=this.nRows)this.cells.push(R);else this.cells.splice($,0,R);this.nRows+=1}addCol(T,L){if(this.nRows===0&&this.nCols===0){let R=L?.length??0;if(!B6(R,R===0?0:1))return;for(let $ of L??[])this.cells.push([$]);this.nRows=R,this.nCols=R===0?0:1;return}if(!B6(this.nRows,this.nCols+1))return;if(T!==void 0){if(!Number.isFinite(T))return;if(Math.trunc(T)<0)return}let I=wT(L,this.nRows),_=T===void 0?this.nCols:Math.min(Math.trunc(T),this.nCols);for(let R=0;R<this.nRows;R++)this.cells[R].splice(_,0,I[R]);this.nCols+=1}removeRow(T){let L=E0(T,this.nRows);if(L===null)return;this.cells.splice(L,1),this.nRows-=1}removeCol(T){let L=E0(T,this.nCols);if(L===null)return;for(let I of this.cells)I.splice(L,1);this.nCols-=1}reshape(T,L){if(!Number.isFinite(T)||!Number.isFinite(L))return null;let I=Math.trunc(T),_=Math.trunc(L);if(I<0||_<0)return null;if(I*_!==this.nRows*this.nCols)return null;if(!B6(I,_))return null;let R=this.flatten(),$=new e(I,_);for(let G=0;G<I;G++)for(let Q=0;Q<_;Q++)$.set(G,Q,R[G*_+Q]);return $}concat(T){if(this.nCols!==T.nCols)return null;let L=this.nRows+T.nRows,I=this.nCols;if(!B6(L,I))return null;let _=new e(L,I);for(let R=0;R<this.nRows;R++)for(let $=0;$<I;$++)_.set(R,$,this.cells[R][$]);for(let R=0;R<T.nRows;R++)for(let $=0;$<I;$++)_.set(this.nRows+R,$,T.cells[R][$]);return _}submatrix(T,L,I,_){if(!Number.isFinite(T)||!Number.isFinite(L)||!Number.isFinite(I)||!Number.isFinite(_))return null;let R=Math.trunc(T),$=Math.trunc(L),G=Math.trunc(I),Q=Math.trunc(_);if(!(0<=R&&R<=$&&$<=this.nRows))return null;if(!(0<=G&&G<=Q&&Q<=this.nCols))return null;let U=new e($-R,Q-G);for(let O=R;O<$;O++)for(let J=G;J<Q;J++)U.set(O-R,J-G,this.cells[O][J]);return U}reverse(){this.cells.reverse();for(let T of this.cells)T.reverse()}sort(T=0,L="asc"){if(this.nRows===0)return;let I=E0(T,this.nCols);if(I===null)return;let _=L==="desc",R=[],$=[];for(let G of this.cells){let Q=G[I];if(Q===null||!Number.isFinite(Q))$.push(G);else R.push(G)}R.sort((G,Q)=>{let U=G[I]-Q[I];return _?-U:U}),this.cells.length=0;for(let G of R)this.cells.push(G);for(let G of $)this.cells.push(G)}median(){let T=[];for(let I=0;I<this.nRows;I++)for(let _=0;_<this.nCols;_++){let R=this.cells[I][_];if(R!==null&&Number.isFinite(R))T.push(R)}if(T.length===0)return null;T.sort((I,_)=>I-_);let L=Math.floor(T.length/2);if(T.length%2===1)return T[L];return(T[L-1]+T[L])/2}mode(){let T=new Map,L=null,I=0;for(let _=0;_<this.nRows;_++)for(let R=0;R<this.nCols;R++){let $=this.cells[_][R];if($===null||!Number.isFinite($))continue;let G=(T.get($)??0)+1;if(T.set($,G),G>I)L=$,I=G}return L}isBinary(){for(let T=0;T<this.nRows;T++)for(let L=0;L<this.nCols;L++){let I=this.cells[T][L];if(I!==0&&I!==1)return!1}return!0}isStochastic(){for(let T=0;T<this.nRows;T++){let L=0;for(let I=0;I<this.nCols;I++){let _=this.cells[T][I];if(_===null||!Number.isFinite(_)||_<0)return!1;L+=_}if(Math.abs(L-1)>0.000000001)return!1}return!0}isAntidiagonal(){if(this.nRows!==this.nCols)return!1;let T=this.nRows;for(let L=0;L<T;L++)for(let I=0;I<T;I++){if(L+I===T-1)continue;let _=this.cells[L][I];if(_!==null&&_!==0)return!1}return!0}diff(T){if(this.nRows!==T.nRows||this.nCols!==T.nCols)return null;let L=new e(this.nRows,this.nCols);for(let I=0;I<this.nRows;I++)for(let _=0;_<this.nCols;_++){let R=this.cells[I][_],$=T.cells[I][_];if(R===null||$===null||!Number.isFinite(R)||!Number.isFinite($)){L.set(I,_,null);continue}let G=R-$;L.set(I,_,Number.isFinite(G)?G:null)}return L}rank(){if(this.nRows===0||this.nCols===0)return 0;let T=this.asFiniteGrid();if(T===null)return null;let L=this.nRows,I=this.nCols,_=[];for(let G=0;G<L;G++)_.push(T[G].slice());let R=0.000000000001,$=0;for(let G=0;G<I&&$<L;G++){let Q=$,U=Math.abs(_[$][G]);for(let J=$+1;J<L;J++){let D=Math.abs(_[J][G]);if(D>U)U=D,Q=J}if(U<R)continue;if(Q!==$){let J=_[$];_[$]=_[Q],_[Q]=J}let O=_[$][G];for(let J=$+1;J<L;J++){let D=_[J][G]/O;for(let B=G;B<I;B++)_[J][B]-=D*_[$][B]}$++}return $}pinv(){if(this.nRows===0||this.nCols===0)return new e(this.nCols,this.nRows);let T=this.asFiniteGrid();if(T===null)return null;let L=EI(T);if(L===null)return null;let{u:I,s:_,v:R}=L,$=this.nRows,G=this.nCols,Q=0;for(let D of _){if(!Number.isFinite(D))return null;if(D>Q)Q=D}let U=0.000000000001*Q*Math.max($,G),O=[];for(let D of _)O.push(D>U?1/D:0);let J=new e(G,$,0);for(let D=0;D<G;D++)for(let B=0;B<$;B++){let H=0;for(let z=0;z<G;z++)H+=R[D][z]*O[z]*I[B][z];if(!Number.isFinite(H))return null;J.set(D,B,H)}return J}eigenvalues(){if(this.nRows!==this.nCols)return null;if(this.nRows===0)return[];let T=this.asFiniteGrid();if(T===null)return null;return AT(T)}eigenvectors(){if(this.nRows!==this.nCols)return null;if(this.nRows===0)return new e(0,0);let T=this.asFiniteGrid();if(T===null)return null;let L=AT(T);if(L===null)return null;let I=this.nRows,_=new e(I,I,0);for(let R=0;R<I;R++){let $=L[R],G=[];for(let U=0;U<I;U++){let O=T[U].slice();O[U]-=$,G.push(O)}let Q=PI(G);if(Q===null)return null;for(let U=0;U<I;U++){let O=Q[U];if(!Number.isFinite(O))return null;_.set(U,R,O)}}return _}static eye(T){let L=new e(T,T,0);for(let I=0;I<T;I++)L.set(I,I,1);return L}asFiniteGrid(){let T=[];for(let L=0;L<this.nRows;L++){let I=[];for(let _=0;_<this.nCols;_++){let R=this.cells[L][_];if(R===null||!Number.isFinite(R))return null;I.push(R)}T.push(I)}return T}finiteAll(){let T=[];for(let L=0;L<this.nRows;L++)for(let I=0;I<this.nCols;I++){let _=this.cells[L][I];if(_===null||!Number.isFinite(_))return null;T.push(_)}return T}flatten(){let T=[];for(let L=0;L<this.nRows;L++)for(let I=0;I<this.nCols;I++)T.push(this.cells[L][I]);return T}}function j(T){return T!==null&&Number.isFinite(T)?T:null}var NI=0.000000001;function m(T){if(!Number.isFinite(T)||T<=0)return null;let L=Math.round(T),I=Math.abs(T-L)<=NI?L:Math.floor(T);return I>0?I:null}function uT(T,L,I){let _=1/I;if(!T.started){if(L===null)return null;T.started=!0}if(!T.seeded){if(L!==null)T.seedBuf.push(L);if(T.seedBuf.length<I)return null;let R=T.seedBuf.reduce(($,G)=>$+G,0)/I;return T.rma=R,T.seeded=!0,T.seedBuf=[],R}if(L===null)return T.rma;return T.rma=_*L+(1-_)*(T.rma??L),T.rma}class u2{smaSites=new Map;emaSites=new Map;rmaSites=new Map;atrSites=new Map;rsiSites=new Map;trSites=new Map;highestSites=new Map;lowestSites=new Map;stdevSites=new Map;changeSites=new Map;wmaSites=new Map;sumSites=new Map;rocSites=new Map;vwmaSites=new Map;cciSites=new Map;crossoverSites=new Map;crossunderSites=new Map;linregSites=new Map;vwapSites=new Map;risingSites=new Map;fallingSites=new Map;almaSites=new Map;cmoSites=new Map;kamaSites=new Map;obvSites=new Map;pivotHighSites=new Map;pivotLowSites=new Map;mfiSites=new Map;sarSites=new Map;adxSites=new Map;dmiSites=new Map;correlationSites=new Map;highestBarsSites=new Map;lowestBarsSites=new Map;swmaSites=new Map;cogSites=new Map;tsiSites=new Map;devSites=new Map;varianceSites=new Map;medianSites=new Map;modeSites=new Map;percentrankSites=new Map;percentileNearestSites=new Map;percentileLinearSites=new Map;cumSites=new Map;barssinceSites=new Map;valuewhenSites=new Map;accdistSites=new Map;pvtSites=new Map;wadSites=new Map;nviSites=new Map;pviSites=new Map;wvadSites=new Map;sma(T,L,I){let _=m(I);if(_===null)return null;let R=this.smaSites.get(T);if(R===void 0||R.period!==_)R={period:_,window:[],sum:0,count:0},this.smaSites.set(T,R);let $=j(L);if(R.window.length===_){let G=R.window.shift();if(G!==null)R.sum-=G,R.count-=1}if(R.window.push($),$!==null)R.sum+=$,R.count+=1;if(R.window.length<_||R.count!==_)return null;return R.sum/_}ema(T,L,I){let _=m(I);if(_===null)return null;let R=this.emaSites.get(T);if(R===void 0||R.period!==_)R={period:_,ema:null,seeded:!1,seedBuf:[]},this.emaSites.set(T,R);let $=j(L),G=2/(_+1);if(!R.seeded){if($===null)return null;if(R.seedBuf.push($),R.seedBuf.length<_)return null;let Q=R.seedBuf.reduce((U,O)=>U+O,0)/_;return R.ema=Q,R.seeded=!0,R.seedBuf=[],Q}if($===null)return R.ema;return R.ema=R.ema==null?$:G*$+(1-G)*R.ema,R.ema}rma(T,L,I){let _=m(I);if(_===null)return null;let R=this.rmaSites.get(T);if(R===void 0||R.period!==_)R={period:_,rma:null,seeded:!1,started:!1,seedBuf:[]},this.rmaSites.set(T,R);return uT(R,j(L),_)}atr(T,L,I,_,R){let $=m(R);if($===null)return null;let G=this.atrSites.get(T);if(G===void 0||G.period!==$)G={period:$,prevClose:null,rma:{period:$,rma:null,seeded:!1,started:!1,seedBuf:[]}},this.atrSites.set(T,G);let Q=G.prevClose;if(G.prevClose=j(_),Q===null)return null;let U=j(L),O=j(I),J=j(_);if(U===null||O===null||J===null)return null;let D=Math.max(U-O,Math.abs(U-Q),Math.abs(O-Q));return uT(G.rma,D,$)}rsi(T,L,I){let _=m(I);if(_===null)return null;let R=this.rsiSites.get(T);if(R===void 0||R.period!==_)R={period:_,prev:null,gainSeed:[],lossSeed:[],avgGain:null,avgLoss:null,seeded:!1},this.rsiSites.set(T,R);let $=j(L);if($===null)return null;let G=R.prev;if(R.prev=$,G===null)return null;let Q=$-G,U=Q>0?Q:0,O=Q<0?-Q:0,J=1/_;if(!R.seeded){if(R.gainSeed.push(U),R.lossSeed.push(O),R.gainSeed.length<_)return null;let B=0,H=0;for(let z=0;z<_;z++)B+=R.gainSeed[z],H+=R.lossSeed[z];R.avgGain=B/_,R.avgLoss=H/_,R.seeded=!0,R.gainSeed=[],R.lossSeed=[]}else R.avgGain=J*U+(1-J)*R.avgGain,R.avgLoss=J*O+(1-J)*R.avgLoss;if(R.avgLoss===0)return 100;return 100-100/(1+R.avgGain/R.avgLoss)}kc(T,L,I,_,R,$){let G=m(R);if(G===null)return{mid:null,up:null,lo:null};let Q=this.ema(`${T}:ema`,_,G),U=this.atr(`${T}:atr`,L,I,_,G);if(Q===null)return{mid:null,up:null,lo:null};let O=(U??0)*$;return{mid:Q,up:Q+O,lo:Q-O}}supertrend(T,L,I,_,R,$){let G=m($),Q=G===null?null:this.atr(`${T}:atr`,L,I,_,G),U=Q===null||!Number.isFinite(Q)?0:Q,O=j(L)??0,J=j(I)??0,D=j(_)??O,B=(O+J)/2,H=B+R*U,z=B-R*U,X=D>=B?-1:1;return{st:X<0?z:H,dir:X}}tr(T,L,I,_){let R=this.trSites.get(T);if(R===void 0)R={prevClose:null},this.trSites.set(T,R);let $=R.prevClose;if(R.prevClose=j(_),$===null)return null;let G=j(L),Q=j(I);if(G===null||Q===null)return null;return Math.max(G-Q,Math.abs(G-$),Math.abs(Q-$))}highest(T,L,I){let _=m(I);if(_===null)return null;let R=this.highestSites.get(T);if(R===void 0||R.period!==_)R={period:_,window:[]},this.highestSites.set(T,R);if(R.window.length===_)R.window.shift();if(R.window.push(j(L)),R.window.length<_)return null;let $=null;for(let G of R.window)if(G!==null&&($===null||G>$))$=G;return $}lowest(T,L,I){let _=m(I);if(_===null)return null;let R=this.lowestSites.get(T);if(R===void 0||R.period!==_)R={period:_,window:[]},this.lowestSites.set(T,R);if(R.window.length===_)R.window.shift();if(R.window.push(j(L)),R.window.length<_)return null;let $=null;for(let G of R.window)if(G!==null&&($===null||G<$))$=G;return $}stdev(T,L,I){let _=m(I);if(_===null||_<=1)return null;let R=this.stdevSites.get(T);if(R===void 0||R.period!==_)R={period:_,window:[],sum:0,sumsq:0,count:0},this.stdevSites.set(T,R);let $=j(L);if(R.window.length===_){let Q=R.window.shift();if(Q!==null)R.sum-=Q,R.sumsq-=Q*Q,R.count-=1}if(R.window.push($),$!==null)R.sum+=$,R.sumsq+=$*$,R.count+=1;if(R.window.length<_||R.count!==_)return null;let G=(R.sumsq-R.sum*R.sum/_)/(_-1);if(G<0)G=0;return Math.sqrt(G)}change(T,L,I=1){if(!Number.isFinite(I)||I<0)return null;let _=Math.trunc(I),R=j(L);if(_===0)return R===null?null:0;let $=this.changeSites.get(T);if($===void 0||$.length!==_)$={length:_,window:[]},this.changeSites.set(T,$);if($.window.length===_+1)$.window.shift();if($.window.push(R),$.window.length<=_)return null;let G=$.window[$.window.length-1],Q=$.window[0];if(G===null||Q===null)return null;return G-Q}wma(T,L,I){let _=m(I);if(_===null)return null;let R=this.wmaSites.get(T);if(R===void 0||R.period!==_)R={period:_,window:[]},this.wmaSites.set(T,R);if(R.window.length===_)R.window.shift();if(R.window.push(j(L)),R.window.length<_)return null;let $=0;for(let G=0;G<_;G++){let Q=R.window[G];if(Q==null)return null;$+=Q*(G+1)}return $/(_*(_+1)/2)}crossover(T,L,I){return this.crossStep(this.crossoverSites,T,L,I,!1)}crossunder(T,L,I){return this.crossStep(this.crossunderSites,T,L,I,!0)}macd(T,L,I=12,_=26,R=9){let $=this.ema(`${T}:fast`,L,I),G=this.ema(`${T}:slow`,L,_),Q=$===null||G===null?null:$-G,U=this.ema(`${T}:signal`,Q,R),O=Q!==null&&U!==null&&Number.isFinite(Q)&&Number.isFinite(U)?Q-U:null;return{macd:Q,signal:U,hist:O}}bb(T,L,I,_=2){let R=this.sma(`${T}:sma`,L,I),$=this.stdev(`${T}:stdev`,L,I);if(R===null||$===null)return{mid:null,up:null,lo:null};return{mid:R,up:R+_*$,lo:R-_*$}}sum(T,L,I){let _=m(I);if(_===null)return null;let R=this.sumSites.get(T);if(R===void 0||R.period!==_)R={period:_,window:[],sum:0,count:0},this.sumSites.set(T,R);let $=j(L);if(R.window.length===_){let G=R.window.shift();if(G!==null)R.sum-=G,R.count-=1}if(R.window.push($),$!==null)R.sum+=$,R.count+=1;if(R.window.length<_||R.count!==_)return null;return R.sum}roc(T,L,I){if(!Number.isFinite(I)||I<=0)return null;let _=Math.trunc(I),R=j(L);if(_<=0)return null;let $=this.rocSites.get(T);if($===void 0||$.length!==_)$={length:_,window:[]},this.rocSites.set(T,$);if($.window.length===_+1)$.window.shift();if($.window.push(R),$.window.length<=_)return null;let G=$.window[$.window.length-1],Q=$.window[0];if(G===null||Q===null||Q===0)return null;return 100*(G-Q)/Q}mom(T,L,I){return this.change(T,L,I)}vwma(T,L,I,_){let R=m(_);if(R===null)return null;let $=this.vwmaSites.get(T);if($===void 0||$.period!==R)$={period:R,srcWindow:[],volWindow:[],sumPv:0,sumV:0,naCount:0},this.vwmaSites.set(T,$);let G=j(L),Q=j(I);if($.srcWindow.length===R){let U=$.srcWindow.shift(),O=$.volWindow.shift();if(U===null||O===null)$.naCount-=1;else $.sumPv-=U*O,$.sumV-=O}if($.srcWindow.push(G),$.volWindow.push(Q),G===null||Q===null)$.naCount+=1;else $.sumPv+=G*Q,$.sumV+=Q;if($.srcWindow.length<R||$.naCount>0||$.sumV===0)return null;return $.sumPv/$.sumV}cci(T,L,I){let _=m(I);if(_===null)return null;let R=this.cciSites.get(T);if(R===void 0||R.period!==_)R={period:_,window:[]},this.cciSites.set(T,R);if(R.window.length===_)R.window.shift();if(R.window.push(j(L)),R.window.length<_)return null;let $=0;for(let O of R.window){if(O==null)return null;$+=O}let G=$/_,Q=0;for(let O of R.window)Q+=Math.abs(O-G);let U=Q/_;if(U===0)return null;return(R.window[_-1]-G)/(0.015*U)}willr(T,L,I,_,R){let $=m(R);if($===null)return null;let G=this.highest(`${T}:hh`,L,$),Q=this.lowest(`${T}:ll`,I,$),U=j(_);if(G===null||Q===null||U===null||G===Q)return null;return-100*(G-U)/(G-Q)}stoch(T,L,I,_,R){let $=m(R);if($===null)return null;let G=this.highest(`${T}:hh`,I,$),Q=this.lowest(`${T}:ll`,_,$),U=j(L);if(G===null||Q===null||U===null||G===Q)return null;return 100*(U-Q)/(G-Q)}linreg(T,L,I,_=0){let R=m(I);if(R===null||R<2)return null;let $=Number.isFinite(_)?Math.trunc(_):0,G=this.linregSites.get(T);if(G===void 0||G.period!==R||G.offset!==$)G={period:R,offset:$,window:[]},this.linregSites.set(T,G);if(G.window.length===R)G.window.shift();if(G.window.push(j(L)),G.window.length<R)return null;let Q=0;for(let H of G.window){if(H==null)return null;Q+=H}let U=(R-1)/2,O=Q/R,J=0,D=0;for(let H=0;H<R;H++){let z=H-U;J+=z*(G.window[H]-O),D+=z*z}if(D===0)return O;let B=J/D;return O+B*(R-1-$-U)}vwap(T,L,I){let _=this.vwapSites.get(T);if(_===void 0)_={cumPv:0,cumV:0,value:null},this.vwapSites.set(T,_);let R=j(L);if(R===null)return _.value;let $=j(I)??0;return _.cumPv+=R*$,_.cumV+=$,_.value=_.cumV!==0?_.cumPv/_.cumV:R,_.value}rising(T,L,I){return this.riseFallStep(this.risingSites,T,L,I,!1)}falling(T,L,I){return this.riseFallStep(this.fallingSites,T,L,I,!0)}riseFallStep(T,L,I,_,R){let $=m(_);if($===null)return 0;let G=T.get(L);if(G===void 0||G.length!==$)G={length:$,prev:null,streak:0,started:!1},T.set(L,G);let Q=j(I);if(!G.started)return G.prev=Q,G.started=!0,G.streak=0,0;let U=G.prev,O=Q!==null&&U!==null&&(R?Q<U:Q>U);return G.streak=O?G.streak+1:0,G.prev=Q,G.streak>=$?1:0}crossStep(T,L,I,_,R){let $=T.get(L);if($===void 0)$={prevA:null,prevB:null,started:!1},T.set(L,$);let G=j(I),Q=j(_),U=0;if($.started&&$.prevA!==null&&$.prevB!==null&&G!==null&&Q!==null)U=(R?$.prevA>=$.prevB&&G<Q:$.prevA<=$.prevB&&G>Q)?1:0;return $.prevA=G,$.prevB=Q,$.started=!0,U}cross(T,L,I){let _=this.crossover(`${T}:up`,L,I),R=this.crossunder(`${T}:down`,L,I);return _===1||R===1?1:0}bbw(T,L,I,_=2){let R=this.bb(T,L,I,_);if(R.mid===null||R.up===null||R.lo===null||R.mid===0)return null;return(R.up-R.lo)/R.mid}dema(T,L,I){let _=this.ema(`${T}:e1`,L,I),R=this.ema(`${T}:e2`,_,I);if(_===null||R===null)return null;return 2*_-R}tema(T,L,I){let _=this.ema(`${T}:e1`,L,I),R=this.ema(`${T}:e2`,_,I),$=this.ema(`${T}:e3`,R,I);if(_===null||R===null||$===null)return null;return 3*_-3*R+$}highestbars(T,L,I){return this.extremeBars(this.highestBarsSites,T,L,I,!0)}lowestbars(T,L,I){return this.extremeBars(this.lowestBarsSites,T,L,I,!1)}extremeBars(T,L,I,_,R){let $=m(_);if($===null)return null;let G=T.get(L);if(G===void 0||G.period!==$)G={period:$,window:[]},T.set(L,G);if(G.window.length===$)G.window.shift();if(G.window.push(j(I)),G.window.length<$)return null;let Q=-1,U=null;for(let O=0;O<G.window.length;O++){let J=G.window[O];if(J===null)continue;if(U===null||(R?J>U:J<U))U=J,Q=O}if(Q<0)return null;return Q-(G.window.length-1)}alma(T,L,I,_=0.85,R=6){let $=m(I);if($===null)return null;if(!Number.isFinite(_)||!Number.isFinite(R))return null;let G=_,Q=R,U=this.almaSites.get(T);if(U===void 0||U.period!==$||U.offset!==G||U.sigma!==Q){let J=G*($-1),D=Q===0?0:$/Q,B=[],H=0;for(let z=0;z<$;z++){let X=D===0?1:Math.exp(-((z-J)**2)/(2*D*D));B.push(X),H+=X}U={period:$,offset:G,sigma:Q,window:[],weights:B,wsum:H},this.almaSites.set(T,U)}if(U.window.length===$)U.window.shift();if(U.window.push(j(L)),U.window.length<$||U.wsum===0)return null;let O=0;for(let J=0;J<$;J++){let D=U.window[J];if(D==null)return null;O+=D*U.weights[J]}return O/U.wsum}cmo(T,L,I){let _=m(I);if(_===null)return null;let R=this.cmoSites.get(T);if(R===void 0||R.period!==_)R={period:_,window:[],up:0,down:0},this.cmoSites.set(T,R);let $=j(L);if(R.window.length===_+1){let U=R.window[0],O=R.window[1];if(U!==null&&O!==null){let J=O-U;if(J>0)R.up-=J;else R.down-=-J}R.window.shift()}let G=R.window.length===0?null:R.window[R.window.length-1];if(R.window.push($),G!==null&&$!==null){let U=$-G;if(U>0)R.up+=U;else R.down+=-U}if(R.window.length<_+1)return null;let Q=R.up+R.down;if(Q===0)return 0;return 100*(R.up-R.down)/Q}kama(T,L,I,_=2,R=30){let $=m(I);if($===null)return null;let G=Number.isFinite(_)?Math.trunc(_):2,Q=Number.isFinite(R)?Math.trunc(R):30;if(G===-1||Q===-1)return null;let U=this.kamaSites.get(T);if(U===void 0||U.period!==$||U.fast!==G||U.slow!==Q)U={period:$,fast:G,slow:Q,prices:[],diffs:[],vol:0,kama:null,seeded:!1,bars:0},this.kamaSites.set(T,U);let O=j(L);if(O===null)return null;let J=U.prices.length===0?null:U.prices[U.prices.length-1];if(U.prices.length===$+1)U.prices.shift();if(U.prices.push(O),U.bars+=1,J!==null){let X=Math.abs(O-J);if(U.diffs.length===$)U.vol-=U.diffs.shift();U.diffs.push(X),U.vol+=X}if(!U.seeded){if(U.bars<$)return null;return U.kama=O,U.seeded=!0,null}let D=U.prices[0],B=Math.abs(O-D),H=U.vol,z;if(H!==0){let X=B/H,k=2/(G+1),C=2/(Q+1),u=X*(k-C)+C;z=u*u}else z=(2/(Q+1))**2;return U.kama=(U.kama??O)+z*(O-(U.kama??O)),U.kama}obv(T,L,I){let _=this.obvSites.get(T);if(_===void 0)_={prev:null,obv:0,bars:0},this.obvSites.set(T,_);let R=j(L),$=j(I)??0;if(_.bars+=1,_.bars<3)return _.prev=R,0;if(R!==null&&_.prev!==null){if(R>_.prev)_.obv+=$;else if(R<_.prev)_.obv-=$}return _.prev=R,_.obv}pivothigh(T,L,I,_){return this.pivotStep(this.pivotHighSites,T,L,I,_,!0)}pivotlow(T,L,I,_){return this.pivotStep(this.pivotLowSites,T,L,I,_,!1)}pivotStep(T,L,I,_,R,$){if(!Number.isFinite(_)||!Number.isFinite(R)||_<0||R<0)return null;let G=Math.trunc(_),Q=Math.trunc(R),U=T.get(L);if(U===void 0||U.left!==G||U.right!==Q)U={left:G,right:Q,window:[],n:0},T.set(L,U);let O=G+1;if(U.window.length===O)U.window.shift();if(U.window.push(j(I)),U.n+=1,U.n<=G+Q||U.window.length<O)return null;let J=U.window[U.window.length-1];if(J===null)return null;for(let D=1;D<=G;D++){let B=U.window[U.window.length-1-D];if(B===null)continue;if($?B>=J:B<=J)return null}return J}hma(T,L,I){let _=m(I);if(_===null)return null;let R=Math.max(1,Math.trunc(_/2)),$=Math.max(1,Math.trunc(Math.sqrt(_))),G=this.wma(`${T}:half`,L,R),Q=this.wma(`${T}:full`,L,_),U=G===null||Q===null?null:2*G-Q;return this.wma(`${T}:sqrt`,U,$)}mfi(T,L,I,_,R,$){let G=m($);if(G===null)return null;let Q=this.mfiSites.get(T);if(Q===void 0||Q.period!==G)Q={period:G,tps:[],mfs:[]},this.mfiSites.set(T,Q);let U=j(L),O=j(I),J=j(_);if(Q.tps.length===G+1)Q.tps.shift(),Q.mfs.shift();if(U===null||O===null||J===null)return Q.tps.push(null),Q.mfs.push(null),null;let D=j(R)??0,B=(U+O+J)/3;if(Q.tps.push(B),Q.mfs.push(B*D),Q.tps.length<=G)return null;let H=0,z=0,X=Q.tps.length-G;for(let C=X;C<Q.tps.length;C++){let u=Q.tps[C],d=Q.tps[C-1],J0=Q.mfs[C];if(u===null||d===null||J0===null)return null;if(u>d)H+=J0;else if(u<d)z+=J0}if(z===0)return H===0?50:100;return 100-100/(1+H/z)}sar(T,L,I,_=0.02,R=0.02,$=0.2){if(!Number.isFinite(_)||!Number.isFinite(R)||!Number.isFinite($))return null;let G=_,Q=R,U=$,O=this.sarSites.get(T);if(O===void 0||O.start!==G||O.increment!==Q||O.maximum!==U)O={start:G,increment:Q,maximum:U,started:!1,sar:null,ep:null,trend:1,af:G},this.sarSites.set(T,O);let J=j(L),D=j(I);if(!O.started){if(J===null||D===null)return null;return O.started=!0,O.sar=D,O.ep=J,O.trend=1,O.af=G,D}let{sar:B,ep:H}=O;if(B===null||J===null||D===null||H===null)return B;let{trend:z,af:X}=O,k=H,C;if(z===1){if(C=B+X*(k-B),J>k)k=J,X=Math.min(X+Q,U);if(C>D)z=-1,C=k,k=D,X=G}else{if(C=B-X*(B-k),D<k)k=D,X=Math.min(X+Q,U);if(C<J)z=1,C=k,k=J,X=G}return O.sar=C,O.ep=k,O.trend=z,O.af=X,Number.isFinite(C)?C:null}adx(T,L,I,_,R){let $=m(R);if($===null)return 0;let G=this.adxSites.get(T);if(G===void 0||G.period!==$)G={period:$,prevH:null,prevL:null,prevC:null,n:0},this.adxSites.set(T,G);let Q,U,O;if(G.prevH===null||G.prevL===null||G.prevC===null)Q=null,U=null,O=null;else{let X=L!==null&&Number.isFinite(L)?L:Number.NaN,k=I!==null&&Number.isFinite(I)?I:Number.NaN,C=Math.max(X-k,Math.abs(X-G.prevC),Math.abs(k-G.prevC));Q=Number.isFinite(C)?C:null;let u=X-G.prevH,d=G.prevL-k;U=u>d&&u>0?u:0,O=d>u&&d>0?d:0}G.prevH=j(L),G.prevL=j(I),G.prevC=j(_),G.n+=1;let J=this.rma(`${T}:tr`,Q,$),D=this.rma(`${T}:pdm`,U,$),B=this.rma(`${T}:mdm`,O,$);if(G.n<$)return 0;if(J===null)return 0;let H;if(D===null||B===null)H=null;else{let X=J!==0?100*D/J:0,k=J!==0?100*B/J:0,C=X+k;H=C!==0?100*Math.abs(X-k)/C:0}let z=this.rma(`${T}:dx`,H,$);return z===null?0:z}dmi(T,L,I,_,R,$){let G=m(R);if(G===null)return{plus:null,minus:null,adx:null};let Q=this.dmiSites.get(T);if(Q===void 0||Q.diLen!==G)Q={diLen:G,prevH:null,prevL:null,prevC:null},this.dmiSites.set(T,Q);let U,O,J;if(Q.prevH===null||Q.prevL===null||Q.prevC===null)U=null,O=0,J=0;else{let C=j(L)??0,u=j(I)??0,d=Q.prevH,J0=Q.prevL,X0=Q.prevC;U=Math.max(C-u,Math.abs(C-X0),Math.abs(u-X0));let T1=C-d,q6=J0-u;O=T1>q6&&T1>0?T1:0,J=q6>T1&&q6>0?q6:0}Q.prevH=j(L),Q.prevL=j(I),Q.prevC=j(_);let D=this.rma(`${T}:tr`,U,G),B=this.rma(`${T}:pdm`,O,G),H=this.rma(`${T}:mdm`,J,G),z,X;if(D===null)z=null,X=null;else if(D===0)z=0,X=0;else z=100*(B??0)/D,X=100*(H??0)/D;let k=this.adx(`${T}:adx`,L,I,_,$);return{plus:z,minus:X,adx:k}}correlation(T,L,I,_){let R=m(_);if(R===null||R<2)return null;let $=this.correlationSites.get(T);if($===void 0||$.length!==R)$={length:R,a:[],b:[]},this.correlationSites.set(T,$);if($.a.length===R)$.a.shift(),$.b.shift();if($.a.push(j(L)),$.b.push(j(I)),$.a.length<R)return null;let G=[],Q=[];for(let k=0;k<R;k++){let C=$.a[k],u=$.b[k];if(C!==null&&u!==null)G.push(C),Q.push(u)}if(G.length<2)return null;let U=G.length,O=0,J=0;for(let k=0;k<U;k++)O+=G[k],J+=Q[k];O/=U,J/=U;let D=0,B=0,H=0;for(let k=0;k<U;k++){let C=G[k]-O,u=Q[k]-J;D+=C*u,B+=C*C,H+=u*u}let z=Math.sqrt(B),X=Math.sqrt(H);if(z===0||X===0)return null;return D/(z*X)}accdist(T,L,I,_,R){let $=this.accdistSites.get(T);if($===void 0)$={ad:0},this.accdistSites.set(T,$);let G=j(L),Q=j(I),U=j(_);if(G===null||Q===null||U===null)return $.ad;let O=j(R)??0,J=G-Q,D=J===0?0:(U-Q-(G-U))/J;return $.ad+=D*O,$.ad}pvt(T,L,I){let _=this.pvtSites.get(T);if(_===void 0)_={pvt:0,prev:null},this.pvtSites.set(T,_);let R=j(L),$=_.prev;if($!==null&&$!==0&&R!==null){let G=j(I)??0;_.pvt+=G*(R-$)/$}if(R!==null)_.prev=R;return _.pvt}wad(T,L,I,_){let R=this.wadSites.get(T);if(R===void 0)R={wad:0,prev:null,started:!1},this.wadSites.set(T,R);let $=j(L),G=j(I),Q=j(_);if($===null||G===null||Q===null)return R.wad;if(!R.started)return R.started=!0,R.prev=Q,R.wad;let U=R.prev;if(U!==null){if(Q>U)R.wad+=Q-G;else if(Q<U)R.wad-=$-Q}return R.prev=Q,R.wad}nvi(T,L,I){return this.volIndexStep(this.nviSites,T,L,I,(_,R)=>_<R)}pvi(T,L,I){return this.volIndexStep(this.pviSites,T,L,I,(_,R)=>_>R)}volIndexStep(T,L,I,_,R){let $=T.get(L);if($===void 0)$={value:1000,prevClose:null,prevVol:null,started:!1},T.set(L,$);let G=j(I),Q=j(_)??0;if(!$.started){if($.started=!0,G!==null)$.prevClose=G;return $.prevVol=Q,$.value}if(G!==null&&$.prevClose!==null&&R(Q,$.prevVol??0)){let U=$.prevClose!==0?(G-$.prevClose)/$.prevClose:0,O=$.value*(1+U);if(Number.isFinite(O))$.value=O}if(G!==null)$.prevClose=G;return $.prevVol=Q,$.value}iii(T,L,I,_,R){let $=j(L),G=j(I),Q=j(_);if($===null||G===null||Q===null)return null;let U=$-G;if(U===0)return 0;let O=j(R)??0;return(2*Q-$-G)/U*O}wvad(T,L,I,_,R,$){let G=this.wvadSites.get(T);if(G===void 0)G={value:0},this.wvadSites.set(T,G);let Q=j(L),U=j(I),O=j(_),J=j(R);if(Q===null||U===null||O===null||J===null)return G.value;let D=U-O,B=j($)??0;if(D!==0)G.value+=(J-Q)/D*B;return G.value}pivotPoints(T,L,I,_,R){let $=j(L),G=j(I),Q=j(_);if($===null||G===null||Q===null)return{pp:null,r1:null,s1:null,r2:null,s2:null};let U=($+G+Q)/3,O=$-G;return{pp:U,r1:2*U-G,s1:2*U-$,r2:U+O,s2:U-O}}swma(T,L,I){let R=I===void 0||Number.isNaN(I)?4:m(I);if(R===null)return null;let $=this.swmaSites.get(T);if($===void 0||$.period!==R){let Q=[],U=0;for(let O=0;O<R;O++){let J=O<R>>1?O+1:O>R-1>>1?R-O:(R>>1)+1;Q.push(J),U+=J}$={period:R,window:[],weights:Q,wsum:U},this.swmaSites.set(T,$)}if($.window.length===R)$.window.shift();if($.window.push(j(L)),$.window.length<R||$.wsum===0)return null;let G=0;for(let Q=0;Q<R;Q++){let U=$.window[Q];if(U==null)return null;G+=U*$.weights[Q]}return G/$.wsum}cog(T,L,I){let _=m(I);if(_===null)return null;let R=this.cogSites.get(T);if(R===void 0||R.period!==_)R={period:_,window:[]},this.cogSites.set(T,R);if(R.window.length===_)R.window.shift();if(R.window.push(j(L)),R.window.length<_)return null;let $=0,G=0;for(let Q=0;Q<_;Q++){let U=R.window[_-1-Q];if(U===null)continue;$+=(Q+1)*U,G+=U}if(G===0)return null;return-$/G}tsi(T,L,I,_){let R=m(I),$=m(_);if(R===null||$===null)return null;let G=this.tsiSites.get(T);if(G===void 0||G.longPeriod!==R||G.shortPeriod!==$)G={longPeriod:R,shortPeriod:$,prev:null,nBars:0,value:null},this.tsiSites.set(T,G);let Q=j(L);G.nBars+=1;let U=G.prev;if(G.prev=Q,U===null||Q===null){if(G.nBars<R+$)return G.value=null,null;return G.value}let O=Q-U,J=`${T}:${R}:${$}`,D=this.ema(`${J}:mom`,O,R),B=this.ema(`${J}:mom2`,D,$),H=this.ema(`${J}:abs`,Math.abs(O),R),z=this.ema(`${J}:abs2`,H,$);if(G.nBars<R+$)return G.value=null,null;if(z===null||z===0)return G.value=z===0?0:null,G.value;if(B===null)return G.value=null,null;return G.value=100*(B/z),G.value}kcw(T,L,I,_,R,$){let G=this.kc(T,L,I,_,R,$);if(G.mid===null||G.up===null||G.lo===null||G.mid===0)return null;return(G.up-G.lo)/G.mid}dev(T,L,I){let _=m(I);if(_===null)return null;let R=this.devSites.get(T);if(R===void 0||R.period!==_)R={period:_,window:[],sum:0,count:0},this.devSites.set(T,R);let $=j(L);if(R.window.length===_){let U=R.window.shift();if(U!==null)R.sum-=U,R.count-=1}if(R.window.push($),$!==null)R.sum+=$,R.count+=1;if(R.window.length<_||R.count!==_)return null;let G=R.sum/_,Q=0;for(let U of R.window){if(U===null)return null;Q+=Math.abs(U-G)}return Q/_}variance(T,L,I){let _=m(I);if(_===null||_<=1)return null;let R=this.varianceSites.get(T);if(R===void 0||R.period!==_)R={period:_,window:[],sum:0,sumsq:0,count:0},this.varianceSites.set(T,R);let $=j(L);if(R.window.length===_){let Q=R.window.shift();if(Q!==null)R.sum-=Q,R.sumsq-=Q*Q,R.count-=1}if(R.window.push($),$!==null)R.sum+=$,R.sumsq+=$*$,R.count+=1;if(R.window.length<_||R.count!==_)return null;let G=(R.sumsq-R.sum*R.sum/_)/(_-1);if(G<0)G=0;return G}median(T,L,I){let _=m(I);if(_===null)return null;let R=this.medianSites.get(T);if(R===void 0||R.period!==_)R={period:_,window:[]},this.medianSites.set(T,R);if(R.window.length===_)R.window.shift();if(R.window.push(j(L)),R.window.length<_)return null;let $=[];for(let Q of R.window)if(Q!==null)$.push(Q);if($.length===0)return null;$.sort((Q,U)=>Q-U);let G=$.length>>1;if($.length%2===1)return $[G];return($[G-1]+$[G])/2}mode(T,L,I){let _=m(I);if(_===null)return null;let R=this.modeSites.get(T);if(R===void 0||R.period!==_)R={period:_,window:[]},this.modeSites.set(T,R);if(R.window.length===_)R.window.shift();if(R.window.push(j(L)),R.window.length<_)return null;let $=new Map,G=null,Q=0;for(let U of R.window){if(U===null)continue;let O=($.get(U)??0)+1;if($.set(U,O),O>Q)Q=O,G=U}return G}percentrank(T,L,I){let _=m(I);if(_===null)return null;let R=this.percentrankSites.get(T);if(R===void 0||R.period!==_)R={period:_,window:[]},this.percentrankSites.set(T,R);let $=j(L);if(R.window.length===_)R.window.shift();if(R.window.push($),R.window.length<_)return null;let G=[];for(let U of R.window)if(U!==null)G.push(U);if(G.length<2)return 50;if($===null)return null;let Q=0;for(let U of G)if(U<$)Q+=1;return Q/G.length*100}percentileNearest(T,L,I,_){return this.percentileStep(this.percentileNearestSites,T,L,I,_,!1)}percentileLinear(T,L,I,_){return this.percentileStep(this.percentileLinearSites,T,L,I,_,!0)}percentileStep(T,L,I,_,R,$){let G=m(_);if(G===null||!Number.isFinite(R))return null;let Q=T.get(L);if(Q===void 0||Q.period!==G||Q.percentage!==R)Q={period:G,percentage:R,window:[]},T.set(L,Q);if(Q.window.length===G)Q.window.shift();if(Q.window.push(j(I)),Q.window.length<G)return null;let U=[];for(let D of Q.window)if(D!==null)U.push(D);if(U.length===0)return null;U.sort((D,B)=>D-B);let O=U.length;if($){if(O===1)return U[0];let D=R/100*(O-1),B=Math.trunc(D),H=Math.min(B+1,O-1),z=D-B;return U[B]*(1-z)+U[H]*z}let J=Math.trunc(R/100*O+0.999999);if(J<1)J=1;if(J>O)J=O;return U[J-1]}cum(T,L){let I=this.cumSites.get(T);if(I===void 0)I={total:0},this.cumSites.set(T,I);let _=j(L);return I.total+=_??0,I.total}barssince(T,L){let I=this.barssinceSites.get(T);if(I===void 0)I={everTrue:!1,barsSince:0},this.barssinceSites.set(T,I);let _=j(L);if(_!==null&&_!==0)return I.everTrue=!0,I.barsSince=0,0;return I.barsSince+=1,I.everTrue?I.barsSince:null}valuewhen(T,L,I,_=0){if(!Number.isFinite(_)||_<0)return null;let R=Math.trunc(_),$=this.valuewhenSites.get(T);if($===void 0||$.occurrence!==R)$={occurrence:R,hits:[]},this.valuewhenSites.set(T,$);let G=j(L);if(G!==null&&G!==0){if($.hits.length===R+1)$.hits.shift();$.hits.push(j(I))}if($.hits.length<=R)return null;return $.hits[$.hits.length-1-R]}range(T,L,I){let _=this.highest(`${T}:hi`,L,I),R=this.lowest(`${T}:lo`,L,I);if(_===null||R===null)return null;return _-R}max(T,L,I){return this.highest(T,L,I)}min(T,L,I){return this.lowest(T,L,I)}}var m1=Object.freeze({__loop:"break"}),d1=Object.freeze({__loop:"continue"}),yI=1e4,L3=1e6;class Q3{symbol;inputs;broker;timeframe;libraries;constructor(T="AAPL",L){this.symbol=T;this.inputs=L?.inputs??{},this.broker=L?.broker??{},this.timeframe=L?.timeframe??null,this.libraries=L?.libraries??new X6}registerLibrarySource(T,L,I,_){this.libraries.registerSource(T,L,I,_)}run(T,L,I){let _;try{_=V2(T)}catch($){return{series:{},plots:[],plot_meta:[],count:0,script_name:null,script_type:"indicator",mode:"interpret",error:x2($),error_kind:"parse"}}let R=I&&!G_(I)?I:void 0;try{return xT(_,L,{symbol:this.symbol,inputs:Q_(this.inputs,I),broker:R?.broker??this.broker,timeframe:R?.timeframe??this.timeframe,libraries:R?.libraries??this.libraries})}catch($){return{series:{},plots:[],plot_meta:[],count:0,script_name:null,script_type:"indicator",mode:"interpret",error:x2($),error_kind:"runtime"}}}stream(T){return new U3(this,T)}async runProvider(T,L,I){let _=await L.fetch({symbol:this.symbol,timeframe:I?.timeframe??this.timeframe,limit:I?.limit});return this.run(T,_,I)}}class U3{runtime;source;bars=[];barHandlers=[];errorHandlers=[];endHandlers=[];closed=!1;constructor(T,L){this.runtime=T;this.source=L}on(T,L){if(T==="bar")this.barHandlers.push(L);else if(T==="error")this.errorHandlers.push(L);else this.endHandlers.push(L);return this}push(T){if(this.closed)return;this.bars.push(T);try{let L=this.runtime.run(this.source,this.bars);for(let I of this.barHandlers)I(L);return L}catch(L){let I=L instanceof Error?L:Error(String(L));for(let _ of this.errorHandlers)_(I);return}}close(){this.closed=!0;let T=this.runtime.run(this.source,this.bars);for(let L of this.endHandlers)L(T);return T}}function bI(T,L){let I=new Q3().run(T,L);if(I.error)throw Error(I.error);return{plots:I.plots}}function xT(T,L,I){let R=(T.kind==="Script"?T:null)?.body??[],$={},G=[],Q=null,U="indicator",O={ctx:{},series:new Map,varInited:new Set,barIndex:0,ta:new u2,callSites:new WeakMap,plotKeys:new WeakMap,nextSite:0,plots:$,plot_meta:G,book:new s5(I?.broker),drawings:new j2,symbol:I?.symbol??"AAPL",timeframe:I?.timeframe??null,inputs:I?.inputs??{},inputStore:new Map,udfs:new Map,udfSites:new Map,frames:[],barCount:L.length,lastBarTime:L.length===0?0:L[L.length-1].time??(L.length-1)*60000,logs:new C2,barTimes:L.map((H,z)=>H.time??z*60000),libraries:I?.libraries??new X6,pendingExports:new Map},J=L.length,D;try{for(let H=0;H<J;H++){wI(O,L[H],H),O.book.processPending(H,{open:V(O.ctx.open)??void 0,high:V(O.ctx.high)??void 0,low:V(O.ctx.low)??void 0,close:V(O.ctx.close)??void 0}),O.book.markOpenTrades(V(O.ctx.high)??V(O.ctx.close)??0,V(O.ctx.low)??V(O.ctx.close)??0,V(O.ctx.close)??0);try{for(let z of R){let X=iT(z);if(X){if(Q==null)Q=X.name;if(X.kind==="strategy")U="strategy",dI(z,O);else if(X.kind==="library")U="library",I3(z,O);else I3(z,O);continue}U1(z,O)}if(H===0&&U==="library"&&Q)rT(O,Q)}catch(z){if(z===m1||z===d1)continue;D={error:x2(z),error_kind:"runtime"};break}}}catch(H){if(H!==m1&&H!==d1)D={error:x2(H),error_kind:"runtime"}}let B=G[0]?.title;return{series:$,plots:B?$[B]??[]:[],plot_meta:G,count:J,script_name:Q,script_type:U,mode:"interpret",events:O.book.events,fills:S_(O.book),drawings:O_(O.drawings),logs:O.logs.records.length?O.logs.records:void 0,plot_data:hI($,O.barTimes),...U==="strategy"||O.book.fills.length>0?{strategy:O.book.summary(V(O.ctx.close)??0)}:{},...D??{}}}function hI(T,L){let I={};for(let[_,R]of Object.entries(T))I[_]={data:R.map(($,G)=>{let Q=L[G];return Q==null?{value:$}:{value:$,time:Q}})};return I}function x1(T,L,I){T.ctx[L]=I;let _=T.series.get(L);if(!_)_=new p1,T.series.set(L,_);_.push(I)}function wI(T,L,I){T.barIndex=I;let _=L.open??0,R=L.high??0,$=L.low??0,G=L.close??0,Q=L.volume??1,U=L.time??I*60000;x1(T,"open",_),x1(T,"high",R),x1(T,"low",$),x1(T,"close",G),x1(T,"volume",Q),x1(T,"time",U),T.ctx.bar_index=I,T.ctx.last_bar_index=T.barCount-1,T.ctx.last_bar_time=T.lastBarTime,g2(T,"hl2",(R+$)/2),g2(T,"hlc3",(R+$+G)/3),g2(T,"ohlc4",(_+R+$+G)/4),g2(T,"hlcc4",(R+$+G+G)/4);let O=K6(U);T.ctx.year=O.year,T.ctx.month=O.month,T.ctx.dayofmonth=O.dayofmonth,T.ctx.dayofweek=O.dayofweek,T.ctx.hour=O.hour,T.ctx.minute=O.minute,T.ctx.second=O.second;for(let J of T.varInited){let D=T.series.get(J);if(D==null)continue;if(D.length===I)D.push(D.current);T.ctx[J]=D.current}}function g2(T,L,I){T.ctx[L]=I;let _=T.series.get(L);if(!_)_=new p1,T.series.set(L,_);if(_.length===T.barIndex)_.push(I);else if(_.length===T.barIndex+1)_.setCurrent(I);else{while(_.length<T.barIndex)_.push(K);_.push(I)}}function cT(T){if(T.kind==="Name")return T.id;if(T.kind==="Attribute"){let L=cT(T.value);return L?`${L}.${T.attr}`:T.attr}return null}function S3(T){if(T.func.kind==="Name")return T.func.id;return cT(T.func)}function $0(T){if(T==null)return[];return Array.isArray(T)?T:[T]}function mT(T){for(let L of $0(T))if(L.value.kind==="Constant"&&typeof L.value.value==="string")return L.value.value;return null}function q0(T){if(T.name!=null&&T.name!=="")return T.name;let L=T;if(typeof L.arg==="string"&&L.arg!=="")return L.arg;if(typeof L.keyword==="string"&&L.keyword!=="")return L.keyword;return dT(T)?.name??null}function dT(T){if(T.name!=null&&T.name!=="")return null;let L=T.value;if((L.kind==="Assign"||L.kind==="ReAssign")&&L.target?.kind==="Name"&&L.value!=null)return{name:L.target.id,value:L.value};return null}function H6(T){return dT(T)?.value??T.value}function lT(T,L){for(let I of $0(T)){if(q0(I)!==L)continue;let _=H6(I);if(_.kind==="Constant"&&typeof _.value==="string")return _.value}return null}function O3(T,L){let I=L.callSites.get(T);if(I!=null)return I;let R=`${T.lineno!=null&&T.col_offset!=null?`${T.lineno}:${T.col_offset}`:""}#${L.nextSite++}`;return L.callSites.set(T,R),R}function W(T,L,I){let _=$0(T);for(let $ of _){let G=q0($);if(G!=null&&I.includes(G))return H6($)}let R=0;for(let $ of _){if(q0($)!=null)continue;if(R===L)return $.value;R++}return}function AI(T){if(T==="hline")return"hline";if(T==="plotshape")return"shape";if(T==="plotchar")return"char";if(T==="plotarrow")return"arrow";if(T==="bgcolor")return"bgcolor";if(T==="barcolor")return"barcolor";return"plot"}function uI(T,L){let I=lT(T,"title");if(I!=null){let $=I.trim();if($)return $}let _=[];for(let $ of T){if(q0($)!=null)continue;_.push($)}if(_.length>1){let $=H6(_[1]);if($.kind==="Constant"&&typeof $.value==="string"){let G=$.value.trim();if(G)return G}}let R=mT(T.slice(1));if(R!=null){let $=R.trim();if($)return $}return AI(L)}function gI(T,L,I){let _=T.plotKeys.get(L);if(_!=null)return _;let R=I.trim()||"plot",$=R,G=2;while(Object.prototype.hasOwnProperty.call(T.plots,$))$=`${R}_${G++}`;return T.plotKeys.set(L,$),$}function f2(T){return T.mode?.kind==="Var"}function J3(T){return typeof T==="object"&&T!==null&&T.__tuple===!0}function t0(T){return{__tuple:!0,elts:T}}function fI(T){return T===null||typeof T==="number"&&Number.isFinite(T)}function oT(T){return T.frames.length>0?T.frames[T.frames.length-1]:null}function pI(T){return oT(T)?.varInited??T.varInited}function c1(T,L){for(let I=T.frames.length-1;I>=0;I--){let _=T.frames[I].ctx;if(Object.prototype.hasOwnProperty.call(_,L))return _[L]}if(Object.prototype.hasOwnProperty.call(T.ctx,L))return T.ctx[L];return}function xI(T,L){for(let I=T.frames.length-1;I>=0;I--){let _=T.frames[I].series.get(L);if(_)return _}return T.series.get(L)}function j0(T,L,I){let _=typeof I==="number"&&!Number.isFinite(I)?K:I,R=oT(T),$=R?R.ctx:T.ctx,G=R?R.series:T.series;if($[L]=_,!fI(_))return;let Q=G.get(L);if(!Q)Q=new p1,G.set(L,Q);if(Q.length===T.barIndex+1)Q.setCurrent(_);else{while(Q.length<T.barIndex)Q.push(K);Q.push(_)}}function vT(T,L,I){if(!J3(L))return;let _=Math.min(T.elts.length,L.elts.length);for(let R=0;R<_;R++){let $=T.elts[R];if($?.kind==="Name")j0(I,$.id,Y(L.elts[R]))}}function cI(T,L){if(T.value==null)return K;let I=pI(L);if(T.target.kind==="Tuple"){if(f2(T)){if(T.target.elts.some((Q)=>Q.kind==="Name"&&I.has(Q.id))||L.barIndex!==0&&T.target.elts.some((Q)=>Q.kind==="Name"&&c1(L,Q.id)!==void 0)){for(let Q of T.target.elts)if(Q.kind==="Name")I.add(Q.id);return K}}let $=Z(T.value,L);if(vT(T.target,$,L),f2(T)){for(let G of T.target.elts)if(G.kind==="Name")I.add(G.id)}return $}if(T.target.kind!=="Name")return K;let _=T.target.id;if(f2(T)&&(I.has(_)||L.barIndex!==0&&c1(L,_)!==void 0)){I.add(_);let $=c1(L,_);return $===void 0?K:$}let R=Z(T.value,L);if(j0(L,_,R),f2(T))I.add(_);if(T.export)L.pendingExports.set(_,R);return R}function mI(T,L){if(T.target.kind==="Tuple"){let _=Z(T.value,L);return vT(T.target,_,L),_}if(T.target.kind==="Attribute"){let _=Z(T.target.value,L),R=Z(T.value,L);if(_ instanceof R1)return _.set(T.target.attr,R),R;return K}if(T.target.kind!=="Name")return K;let I=Z(T.value,L);return j0(L,T.target.id,I),I}function dI(T,L){if(T.kind!=="Expr"||T.value?.kind!=="Call")return;let I={},_=Y(Z(W(T.value.args,-1,["commission","commission_value"]),L)),R=Y(Z(W(T.value.args,-1,["slippage"]),L)),$=Y(Z(W(T.value.args,-1,["pyramiding"]),L));if(_!=null)I.commission=_;if(R!=null)I.slippage=R;if($!=null)I.pyramiding=Math.trunc($);if(Object.keys(I).length)L.book.configure(I);let G=Y(Z(W(T.value.args,-1,["initial_capital"]),L));if(G!=null&&Number.isFinite(G))L.book.initialCapital=G;I3(T,L)}function I3(T,L){if(T.kind!=="Expr"||T.value?.kind!=="Call")return;let I=Y(Z(W(T.value.args,-1,["max_lines_count"]),L)),_=Y(Z(W(T.value.args,-1,["max_labels_count"]),L)),R=Y(Z(W(T.value.args,-1,["max_boxes_count"]),L)),$=Y(Z(W(T.value.args,-1,["max_polylines_count"]),L));if(I==null&&_==null&&R==null&&$==null)return;L.drawings.configure({max_lines_count:I??void 0,max_labels_count:_??void 0,max_boxes_count:R??void 0,max_polylines_count:$??void 0})}function iT(T){if(T.kind!=="Expr"||T.value?.kind!=="Call")return null;let L=S3(T.value);if(L!=="indicator"&&L!=="strategy"&&L!=="library")return null;return{name:mT(T.value.args),kind:L}}function U1(T,L){if(T.kind==="FunctionDef")return N_(T,L),K;if(T.kind==="TypeDef")return y_(T,L),K;if(T.kind==="EnumDef")return b_(T,L),K;if(T.kind==="Import")return g_(T,L),K;if(T.kind==="Assign")return cI(T,L);if(T.kind==="ReAssign")return mI(T,L);if(T.kind==="Break")throw m1;if(T.kind==="Continue")throw d1;if(T.kind==="Switch"||T.kind==="While"||T.kind==="If")return Z(T,L);if(T.kind!=="Expr"||!("value"in T)||T.value==null)return K;let I=T.value;if(I.kind==="Call"){let _=S3(I);if(_==="indicator"||_==="strategy"||_==="library")return K;if(_==="plot"||_==="plotshape"||_==="hline"||_==="plotchar"||_==="plotarrow"||_==="bgcolor"||_==="barcolor"){let R=$0(I.args),$=uI(R,_),G=gI(L,I,$),Q=W(I.args,0,["series","source"])??R[0]?.value,U=Y(Z(Q,L));if(!L.plots[G])L.plots[G]=[],L.plot_meta.push({title:G});let O=L.plots[G];while(O.length<L.barIndex)O.push(null);return O.push(U),U}}return Z(I,L)}function e0(T){return T!=null&&T!==0}function Z(T,L){if(T==null)return K;switch(T.kind){case"Name":{let I=c1(L,T.id);return I===void 0?K:I}case"Constant":{let I=T.value;if(typeof I==="number")return Number.isFinite(I)?I:K;if(typeof I==="string")return I;if(I===!0)return 1;if(I===!1)return 0;return K}case"BinOp":{let I=Z(T.left,L),_=Z(T.right,L);if(T.op.kind==="Add"&&(typeof I==="string"||typeof _==="string"))return _3(I)+_3(_);let R=Y(I),$=Y(_);if(R==null||$==null)return K;switch(T.op.kind){case"Add":return R+$;case"Sub":return R-$;case"Mult":return R*$;case"Div":return $===0?K:R/$;case"Mod":return $===0?K:R%$}return K}case"UnaryOp":{let I=Y(Z(T.operand,L));if(T.op.kind==="Not")return e0(I)?0:1;if(I==null)return K;if(T.op.kind==="USub")return-I;if(T.op.kind==="UAdd")return I;if(T.op.kind==="Invert")return~Math.trunc(I);return K}case"Subscript":{let I=Y(Z(T.slice??void 0,L));if(I==null||!Number.isFinite(I))return K;let _=Math.trunc(I);if(_<0)return K;if(T.value.kind==="Name"){let R=xI(L,T.value.id);if(R)return R.get(_)}return K}case"Call":return eI(T,L);case"Compare":{let I=Z(T.left,L);for(let _=0;_<T.ops.length;_++){let R=Z(T.comparators[_],L),$=tI(I,T.ops[_].kind,R);if($==null)return K;if(!$)return 0;I=R}return 1}case"If":{let I=Y(Z(T.test,L)),_=e0(I)?T.body:T.orelse,R=K;for(let $ of _)R=U1($,L);return R}case"Attribute":return aI(T,L);case"Conditional":return lI(T,L);case"ForTo":return oI(T,L);case"Tuple":return t0(T.elts.map((I)=>Z(I,L)));case"ForIn":return sI(T,L);case"While":return vI(T,L);case"Switch":return iI(T,L);case"BoolOp":return rI(T,L)}}function lI(T,L){let I=Y(Z(T.test,L));return e0(I)?Z(T.body,L):Z(T.orelse,L)}function oI(T,L){let I=Y(Z(T.start,L)),_=Y(Z(T.end,L));if(I==null||_==null||!Number.isFinite(I)||!Number.isFinite(_))return K;let R;if(T.step!=null){let D=Y(Z(T.step,L));if(D==null||!Number.isFinite(D)||D===0)return K;if(R=Math.trunc(D),R===0)return K}else R=I<=_?1:-1;let $=Math.trunc(I),G=Math.trunc(_),Q=T.target.kind==="Name"?T.target.id:null,U=K,O=0,J=(D)=>{if(Q)j0(L,Q,D);try{for(let B of T.body)U=U1(B,L)}catch(B){if(B===m1)return"break";if(B===d1)return"ok";throw B}return"ok"};if(R>0)for(let D=$;D<=G;D+=R){if(++O>L3)break;if(J(D)==="break")break}else for(let D=$;D>=G;D+=R){if(++O>L3)break;if(J(D)==="break")break}return U}function vI(T,L){let I=K,_=0;while(e0(Y(Z(T.test,L)))){if(++_>yI)break;try{for(let R of V6(T.body))I=U1(R,L)}catch(R){if(R===m1)break;if(R===d1)continue;throw R}}return I}function iI(T,L){let I=Array.isArray(T.cases)?T.cases:[],_=T.subject!=null,R=_?Z(T.subject,L):null;for(let $ of I){if($.pattern==null)return n5($.body,L);if(_){let G=Z($.pattern,L);if(R3(G,R))return n5($.body,L)}else if(e0(Y(Z($.pattern,L))))return n5($.body,L)}return K}function n5(T,L){let I=K;for(let _ of V6(T))I=U1(_,L);return I}function rI(T,L){let I=T.values??[],_=typeof T.op==="string"?T.op:T.op?.kind;if(_==="And"){for(let R of I){let $=Y(Z(R,L));if($==null)return K;if(!e0($))return 0}return 1}if(_==="Or"){let R=!1;for(let $ of I){let G=Y(Z($,L));if(G==null){R=!0;continue}if(e0(G))return 1}return R?K:0}return K}function sI(T,L){let I=Z(T.iter,L),_=[];if(J3(I))_=I.elts;else if(I instanceof G0)_=I.toValues();let R=T.target.kind==="Name"?T.target.id:null,$=K,G=Math.min(_.length,L3);for(let Q=0;Q<G;Q++){let U=_[Q];if(R)j0(L,R,U);try{for(let O of T.body)$=U1(O,L)}catch(O){if(O===m1)break;if(O===d1)continue;throw O}}return $}function aI(T,L){if(T.value.kind==="Name"){if(T.value.id==="strategy"){if(T.attr==="long"||T.attr==="short")return T.attr;if(T.attr==="position_size")return L.book.position.qty;if(T.attr==="position_avg_price")return L.book.position.avgPrice;if(T.attr==="netprofit")return L.book.realizedPnl;if(T.attr==="openprofit"){let _=L.book.position.qty,R=L.book.position.avgPrice,$=V(L.ctx.close);if(_===0||R==null||$==null)return 0;return _*($-R)}if(T.attr==="equity")return L.book.equity(V(L.ctx.close)??0);if(T.attr==="opentrades")return L.book.opentrades;if(T.attr==="closedtrades")return L.book.closedtrades;if(T.attr==="wintrades")return L.book.wintrades;if(T.attr==="losstrades")return L.book.losstrades;if(T.attr==="eventrades")return L.book.eventrades;if(T.attr==="grossprofit")return L.book.grossprofit;if(T.attr==="grossloss")return L.book.grossloss;if(T.attr==="avg_trade")return L.book.avgTrade();if(T.attr==="avg_winning_trade")return L.book.avgWinningTrade();if(T.attr==="avg_losing_trade")return L.book.avgLosingTrade();if(T.attr==="netprofit_percent")return L.book.netprofitPercent(V(L.ctx.close)??0);if(T.attr==="openprofit_percent")return L.book.openprofitPercent(V(L.ctx.close)??0);if(T.attr==="grossprofit_percent")return L.book.grossprofitPercent();if(T.attr==="grossloss_percent")return L.book.grosslossPercent();if(T.attr==="avg_trade_percent")return L.book.avgTradePercent();if(T.attr==="avg_winning_trade_percent")return L.book.avgWinningTradePercent();if(T.attr==="avg_losing_trade_percent")return L.book.avgLosingTradePercent();if(T.attr==="max_drawdown")return L.book.maxDrawdown();if(T.attr==="max_drawdown_percent")return L.book.maxDrawdownPercent();if(T.attr==="max_runup")return L.book.maxRunup();if(T.attr==="max_runup_percent")return L.book.maxRunupPercent();if(T.attr==="percent_profitable"||T.attr==="winrate")return L.book.percentProfitable();if(T.attr==="profitfactor"||T.attr==="profit_factor")return L.book.profitFactor();if(T.attr==="initial_capital")return L.book.initialCapital;if(T.attr==="commission")return 0;if(T.attr==="cash")return"cash";if(T.attr==="fixed")return"fixed";if(T.attr==="percent_of_equity")return"percent_of_equity"}if(T.value.id==="syminfo"){if(T.attr==="ticker"||T.attr==="tickerid")return L.symbol;if(T.attr==="timezone")return"Etc/UTC";if(T.attr==="currency")return"USD";if(T.attr==="mintick")return 0.01;if(T.attr==="type")return"stock"}if(T.value.id==="timeframe"){if(T.attr==="period")return L.timeframe??"";if(T.attr==="multiplier")return V9(L.timeframe);if(T.attr==="isintraday")return H9(L.timeframe)?1:0;if(T.attr==="isdaily")return B5(L.timeframe)?1:0;if(T.attr==="isweekly")return z5(L.timeframe)?1:0;if(T.attr==="ismonthly")return H5(L.timeframe)?1:0}if(T.value.id==="color"){let _=O5(T.attr);if(_)return _}if(T.value.id==="barstate"){let _=L.barIndex===L.barCount-1;if(T.attr==="isfirst")return L.barIndex===0?1:0;if(T.attr==="islast")return _?1:0;if(T.attr==="ishistory")return _?0:1;if(T.attr==="isconfirmed")return 1;if(T.attr==="isnew")return 1;if(T.attr==="isrealtime")return 0;if(T.attr==="islastconfirmedhistory")return _?1:0}if(T.value.id==="session"){if(T.attr==="regular")return"regular";if(T.attr==="extended")return"extended";if(T.attr==="ismarket")return 1;if(T.attr==="ispremarket"||T.attr==="ispostmarket")return 0;if(T.attr==="isfirstbar"||T.attr==="isfirstbar_regular")return L.barIndex===0?1:0;if(T.attr==="islastbar"||T.attr==="islastbar_regular")return L.barIndex===L.barCount-1?1:0}if(T.value.id==="chart"){if(T.attr==="is_heikinashi"||T.attr==="is_renko"||T.attr==="is_kagi")return 0;if(T.attr==="fg_color")return"#ffffff";if(T.attr==="bg_color")return"#131722"}if(T.value.id==="ta"){let _=nI(T.attr,L);if(_!==void 0)return _}}let I=Z(T.value,L);if(I instanceof R1){let _=I.get(T.attr);if(typeof _==="number"||_===null||typeof _==="string")return _;if(_ instanceof R1||_ instanceof $1)return _;return K}if(I instanceof m0&&T.attr==="new")return I;if(I instanceof g1)return I.members.get(T.attr)??K;if(I instanceof H1){let _=I.get(T.attr);if(_===void 0)return K;if(c2(_))return _;if(typeof _==="function")return K;return _}return K}function nI(T,L){let I=L.ta,_=`attr:ta.${T}`;if(T==="accdist"||T==="ad")return I.accdist(_,V(L.ctx.high),V(L.ctx.low),V(L.ctx.close),V(L.ctx.volume));if(T==="obv"&&typeof I.obv==="function")return I.obv.call(L.ta,_,V(L.ctx.close),V(L.ctx.volume));if(T==="tr"&&typeof I.tr==="function")return I.tr.call(L.ta,_,V(L.ctx.high),V(L.ctx.low),V(L.ctx.close));if(T==="vwap"&&typeof I.vwap==="function"){let R=V(L.ctx.high),$=V(L.ctx.low),G=V(L.ctx.close),Q=R!=null&&$!=null&&G!=null?(R+$+G)/3:G;return I.vwap.call(L.ta,_,Q,V(L.ctx.volume))}if(T==="pvt"&&typeof I.pvt==="function")return I.pvt.call(L.ta,_,V(L.ctx.close),V(L.ctx.volume));if(T==="nvi"&&typeof I.nvi==="function")return I.nvi.call(L.ta,_,V(L.ctx.close),V(L.ctx.volume));if(T==="pvi"&&typeof I.pvi==="function")return I.pvi.call(L.ta,_,V(L.ctx.close),V(L.ctx.volume));return}function gT(T,L){if(T==null)return"long";if(T.kind==="Constant"&&typeof T.value==="string")return T.value;let I=Z(T,L);if(typeof I==="string")return I;let _=Y(I);if(_===1)return"long";if(_===-1)return"short";return"long"}function z6(T){if(T==null)return"entry";if(T.kind==="Constant"&&typeof T.value==="string")return T.value;if(T.kind==="Name")return T.id;return"entry"}function _3(T){if(typeof T==="string")return T;if(T instanceof I0)return T.toString();let L=Y(T);return L==null?"na":String(L)}function F1(T){if(T==null)return!0;if(typeof T==="number")return!Number.isFinite(T);return!1}function R3(T,L){if(F1(T)&&F1(L))return!0;if(F1(T)||F1(L))return!1;if(T instanceof $1)return T.equals(L);if(L instanceof $1)return L.equals(T);if(typeof T==="string"||typeof L==="string")return T===L;if(typeof T==="number"&&typeof L==="number")return T===L;return T===L}function tI(T,L,I){let _=F1(T),R=F1(I);switch(L){case"Eq":return R3(T,I);case"NotEq":if(_||R)return!1;return!R3(T,I);case"Lt":case"LtE":case"Gt":case"GtE":{let $=Y(T),G=Y(I);if($==null||G==null)return!1;if(L==="Lt")return $<G;if(L==="LtE")return $<=G;if(L==="Gt")return $>G;return $>=G}default:return null}}function eI(T,L){if(T.func.kind==="Attribute"){let X=Z(T.func.value,L);if(X instanceof H1)return u_(X,T.func.attr,T,L);if(X instanceof R1){let k=X.getMethod(T.func.attr);if(k&&c2(k.body))return G3(k.body,T,L,X)}if(X instanceof m0&&T.func.attr==="new"){let k={};for(let C of $0(T.args)){let u=q0(C);if(u)k[u]=Z(C.value,L)}return X.newInstance(k)}}let I=S3(T),_=O3(T,L);if(I==="ta.sma"||I==="sma")return L.ta.sma(_,b(T,L),g(T,L,1));if(I==="ta.ema"||I==="ema")return L.ta.ema(_,b(T,L),g(T,L,1));if(I==="ta.rsi"||I==="rsi")return L.ta.rsi(_,b(T,L),g(T,L,1));if(I==="ta.rma"||I==="rma")return L.ta.rma(_,b(T,L),g(T,L,1));if(I==="ta.atr"||I==="atr"){let X=g(T,L,0);return L.ta.atr(_,V(L.ctx.high),V(L.ctx.low),V(L.ctx.close),X)}if(I==="ta.kc"||I==="kc")return T_(T,L,_);if(I==="ta.supertrend"||I==="supertrend")return L_(T,L,_);if(I==="ta.tr"||I==="tr")return I_(T,L,_);let R=z_(I,T,L,_);if(R!==void 0)return R;let $=B_(I,T,L);if($!==void 0)return $;if(k9(I))return W_(T,L,I);if(Y9(I)||I==="request.security")return X_(I,T,L);let G=V_(I,T,L);if(G!==void 0)return G;let Q=C_(I,T,L);if(Q!==void 0)return Q;let U=P_(I,T,L);if(U!==void 0)return U;if(I==="na"){let X=W(T.args,0,["x","source"]);if(X==null)return K;return F1(Z(X,L))?1:0}if(I==="iff"){let X=Y(Z(W(T.args,0,["condition","cond"]),L));if(X==null)return K;return e0(X)?Z(W(T.args,1,["then","if_true"]),L):Z(W(T.args,2,["else","if_false"]),L)}if(I==="fixnan"){let X=Y(Z(W(T.args,0,["source","x"]),L));return X==null?0:X}if(I==="int"){let X=Y(Z(W(T.args,0,["x","source"]),L));return X==null?K:Math.trunc(X)}if(I==="float")return Y(Z(W(T.args,0,["x","source"]),L));if(I==="bool"){let X=Y(Z(W(T.args,0,["x","source"]),L));return e0(X)?1:0}if(I==="string"||I==="str")return _3(Z(W(T.args,0,["x","source"]),L));if(I==="log.info"||I==="log.warning"||I==="log.error"){let X=$0(T.args).map((C)=>{let u=Z(C.value,L);if(u instanceof I0)return u.toString();return typeof u==="string"?u:Y(u)}),k=M5(X);if(I==="log.info")L.logs.info(L.barIndex,k);else if(I==="log.warning")L.logs.warning(L.barIndex,k);else L.logs.error(L.barIndex,k);return K}let O=A_(I,T,L);if(O!==void 0)return O;if(I==="timeframe.in_seconds"){let X=p(W(T.args,0,["timeframe","period"]),L)??L.timeframe;return B9(X)}if(I==="timeframe.from_seconds"){let X=Y(Z(W(T.args,0,["seconds"]),L));return X==null?K:z9(X)}if(I==="runtime.error"){let X=$0(T.args).map((k)=>{let C=Z(k.value,L);return typeof C==="string"?C:Y(C)});k5(M5(X)||"runtime.error")}if(I==="ticker.new"){let X=p(W(T.args,0,["symbol"]),L)??L.symbol,k=p(W(T.args,1,["session"]),L)??void 0;return E5(X,k)}if(I==="ticker.heikinashi"){let X=Z(W(T.args,0,["symbol"]),L),k=X instanceof I0?X.symbol:typeof X==="string"?X:L.symbol;return j5(k)}if(I==="ticker.standard"){let X=Z(W(T.args,0,["symbol"]),L),k=X instanceof I0?X.symbol:typeof X==="string"?X:L.symbol;return C5(k)}if(I==="ticker.renko"){let X=Z(W(T.args,0,["symbol"]),L),k=X instanceof I0?X.symbol:typeof X==="string"?X:L.symbol;return P5(k)}if(I==="ticker.kagi"){let X=Z(W(T.args,0,["symbol"]),L),k=X instanceof I0?X.symbol:typeof X==="string"?X:L.symbol;return N5(k)}if(I==="ticker.linebreak"){let X=Z(W(T.args,0,["symbol"]),L),k=X instanceof I0?X.symbol:typeof X==="string"?X:L.symbol;return y5(k)}if(I==="ticker.pointfigure"){let X=Z(W(T.args,0,["symbol"]),L),k=X instanceof I0?X.symbol:typeof X==="string"?X:L.symbol;return b5(k)}if(I==="ticker.modify"){let X=Z(W(T.args,0,["ticker","tickerid"]),L),k=X instanceof I0?X:typeof X==="string"?X:L.symbol;return h5(k,{symbol:p(W(T.args,1,["symbol"]),L)??void 0,session:p(W(T.args,2,["session"]),L)??void 0,adjust:p(W(T.args,3,["adjust","adjustment"]),L)??void 0})}let J=F_(I,T,L);if(J!==void 0)return J;let D=M_(I,T,L);if(D!==void 0)return D;let B=E_(I,T,L);if(B!==void 0)return B;if(I==="nz"){let X=Y(Z(W(T.args,0,["source","x"]),L)),k=Y(Z(W(T.args,1,["replacement"]),L));return X==null?k??0:X}if(I==="strategy.entry"){let X=z6(W(T.args,0,["id"])),k=gT(W(T.args,1,["direction"]),L),C=W(T.args,2,["qty"]),u=C==null?1:Y(Z(C,L)),d=u==null||!Number.isFinite(u)?Number.NaN:u,J0=Y(Z(W(T.args,-1,["limit"]),L)),X0=Y(Z(W(T.args,-1,["stop"]),L)),T1=V(L.ctx.close);return L.book.placeEntry(L.barIndex,X,k,d,{limit:J0,stop:X0,price:T1==null||!Number.isFinite(T1)?void 0:T1,time:V(L.ctx.time)??void 0,oca_name:p(W(T.args,-1,["oca_name"]),L),oca_type:p(W(T.args,-1,["oca_type"]),L)}),K}if(I==="strategy.close"){let X=z6(W(T.args,0,["id"])),k=V(L.ctx.close);if(L.book.position.qty!==0&&k!=null)L.book.fillClose(L.barIndex,X,k,{time:V(L.ctx.time)??void 0});else L.book.close(L.barIndex,X);return K}if(I==="strategy.exit")return L.book.exit(L.barIndex,z6(W(T.args,0,["id"]))),K;if(I==="strategy.close_all")return L.book.closeAll(L.barIndex,V(L.ctx.close)??void 0),K;if(I==="strategy.cancel")return L.book.cancel(L.barIndex,z6(W(T.args,0,["id"]))),K;if(I==="strategy.cancel_all")return L.book.cancelAll(L.barIndex),K;if(I==="strategy.order"){let X=z6(W(T.args,0,["id"])),k=gT(W(T.args,1,["direction"]),L),C=Y(Z(W(T.args,2,["qty"]),L)),u=C==null||!Number.isFinite(C)?Number.NaN:C;return L.book.order(L.barIndex,X,k,u,{limit:Y(Z(W(T.args,-1,["limit"]),L)),stop:Y(Z(W(T.args,-1,["stop"]),L)),price:V(L.ctx.close)??void 0,time:V(L.ctx.time)??void 0,oca_name:p(W(T.args,-1,["oca_name"]),L),oca_type:p(W(T.args,-1,["oca_type"]),L)}),K}let H=D_(I,T,L);if(H!==void 0)return H;let z=K_(I,T,L);if(z!==void 0)return z;if(I!=null&&I.endsWith(".new")){let X=I.slice(0,-4),k=c1(L,X);if(k instanceof m0){let C={};for(let u of $0(T.args)){let d=q0(u);if(d)C[d]=Z(u.value,L)}return k.newInstance(C)}}if(I!=null){let X=L.udfs.get(I);if(X)return G3(X,T,L)}return K}function T_(T,L,I){let _=$0(T.args).filter((J)=>q0(J)==null),R=V(L.ctx.high),$=V(L.ctx.low),G=b(T,L),Q=g(T,L,1),U=$3(T,L,2,["mult","multiplier"],1);if(_.length>=4)R=Y(Z(_[0].value,L)),$=Y(Z(_[1].value,L)),G=Y(Z(_[2].value,L)),Q=g(T,L,3),U=$3(T,L,4,["mult","multiplier"],1);let O=__(L,I,R,$,G,Q,U);return t0([O.mid,O.up,O.lo])}function L_(T,L,I){let _=$3(T,L,0,["factor"],3),R=$_(T,L,1,["atrPeriod","length"],10),$=R_(L,I,V(L.ctx.high),V(L.ctx.low),V(L.ctx.close),_,R);return t0([$.st,$.dir])}function I_(T,L,I){let _=$0(T.args).filter((R)=>q0(R)==null);if(_.length>=3)return fT(L,I,Y(Z(_[0].value,L)),Y(Z(_[1].value,L)),Y(Z(_[2].value,L)));return fT(L,I,V(L.ctx.high),V(L.ctx.low),V(L.ctx.close))}function __(T,L,I,_,R,$,G){let Q=T.ta.kc;if(typeof Q==="function")return Q.call(T.ta,L,I,_,R,$,G);let U=T.ta.ema(`${L}:ema`,R,$),O=T.ta.atr(`${L}:atr`,I,_,R,$);if(U==null)return{mid:null,up:null,lo:null};let J=(O??0)*G;return{mid:U,up:U+J,lo:U-J}}function R_(T,L,I,_,R,$,G){let Q=T.ta.supertrend;if(typeof Q==="function")return Q.call(T.ta,L,I,_,R,$,G);let U=T.ta.atr(`${L}:atr`,I,_,R,G),O=U==null||!Number.isFinite(U)?0:U,J=I??0,D=_??0,B=R??J,H=(J+D)/2,z=H+$*O,X=H-$*O,k=B>=H?-1:1;return{st:k<0?X:z,dir:k}}function fT(T,L,I,_,R){let $=T.ta.tr;if(typeof $==="function")return $.call(T.ta,L,I,_,R);return T.ta.atr(L,I,_,R,1)==null&&T.barIndex===0?K:K}function V(T){if(T===void 0)return K;return Y(T)}function b(T,L){return Y(Z(W(T.args,0,["source","series"]),L))}function g(T,L,I){let _=Y(Z(W(T.args,I,["length"]),L));return _==null||!Number.isFinite(_)?0:_}function $_(T,L,I,_,R){let $=Y(Z(W(T.args,I,_),L));return $==null||!Number.isFinite($)?R:$}function $3(T,L,I,_,R){let $=Y(Z(W(T.args,I,_),L));return $==null||!Number.isFinite($)?R:$}function Y(T){if(T==null)return K;if(typeof T==="number")return Number.isFinite(T)?T:K;return K}function x2(T){if(T instanceof Error)return(T.message||T.name||"runtime error").split(`
43
+ `)[0].trim()||"runtime error";if(typeof T==="string")return T.split(`
44
+ `)[0].trim()||"runtime error";return"runtime error"}function G_(T){return!("inputs"in T)&&!("broker"in T)&&!("timeframe"in T)&&!("libraries"in T)}function Q_(T,L){let I=U_(L);if(I==null)return T;return{...T,...I}}function U_(T){if(T==null||typeof T!=="object")return;if("inputs"in T){let L=T.inputs;if(L!=null&&typeof L==="object"&&!Array.isArray(L))return L;return}return T}function S_(T){let L=T.fills;if(L==null||L.length===0)return;return L.map((I)=>({type:"fill",...I}))}function O_(T){return T.items.length===0?void 0:T.items}function J_(T){let L=lT(T.args,"title");if(L!=null)return L;let I=$0(T.args),_=0;for(let R of I){if(q0(R)!=null)continue;if(_===1&&R.value.kind==="Constant"&&typeof R.value.value==="string")return R.value.value;_++}return null}function Z_(T,L){if(T.kind==="Constant")return T.value;let I=Z(T,L);if(typeof I==="string")return I;return Y(I)}function W_(T,L,I){let _=J_(T),R=_??O3(T,L),$=L.inputStore.get(R);if($!==void 0)return w5($);let G=[],Q={};for(let O of $0(T.args)){let J=Z_(H6(O),L),D=q0(O);if(D!=null)Q[D]=J;else G.push(J)}let U=M9(I,G,Q);if(_!=null&&L.inputs[_]!==void 0)U=L.inputs[_];return L.inputStore.set(R,U),w5(U)}function p(T,L){if(T==null)return null;if(T.kind==="Constant"&&typeof T.value==="string")return T.value;let I=Z(T,L);return typeof I==="string"?I:null}function D_(T,L,I){if(T==null||!T.startsWith("strategy.risk."))return;let _=I.book;if(T==="strategy.risk.allow_entry_in"){let R=Z(W(L.args,0,["value"]),I);return _.riskAllowEntryIn(typeof R==="string"?R:Y(R)),K}if(T==="strategy.risk.max_position_size")return _.riskMaxPositionSize(Y(Z(W(L.args,0,["percent","value"]),I))),K;if(T==="strategy.risk.max_drawdown"){let R=Y(Z(W(L.args,0,["value"]),I)),$=Z(W(L.args,1,["type"]),I);return _.riskMaxDrawdown(R,typeof $==="string"?$:Y($)),K}if(T==="strategy.risk.max_cons_loss_days")return _.riskMaxConsLossDays(Y(Z(W(L.args,0,["days","value"]),I))),K;if(T==="strategy.risk.max_intraday_loss")return _.riskMaxIntradayLoss(Y(Z(W(L.args,0,["percent","value"]),I))),K;if(T==="strategy.risk.max_intraday_filled_orders")return _.riskMaxIntradayFilledOrders(Y(Z(W(L.args,0,["max","max_orders","value"]),I))),K;return}function K_(T,L,I){if(T==null||!T.startsWith("strategy."))return;let _=Y(Z(W(L.args,0,["trade_num","trade_index","index"]),I)),R=_==null?0:Math.trunc(_),$=V(I.ctx.close)??0,G=I.book;switch(T){case"strategy.closedtrades.entry_bar_index":return G.closedEntryBar(R);case"strategy.closedtrades.entry_price":return G.closedEntryPrice(R);case"strategy.closedtrades.exit_bar_index":return G.closedExitBar(R);case"strategy.closedtrades.exit_price":return G.closedExitPrice(R);case"strategy.closedtrades.profit":return G.closedProfit(R);case"strategy.closedtrades.size":return G.closedSize(R);case"strategy.closedtrades.entry_id":case"strategy.closedtrades.exit_id":return G.closedId(R);case"strategy.closedtrades.commission":return G.closedCommission(R);case"strategy.opentrades.entry_bar_index":return G.openEntryBar(R);case"strategy.opentrades.entry_price":return G.openEntryPrice(R);case"strategy.opentrades.size":return G.openSize(R);case"strategy.opentrades.entry_id":return G.openId(R);case"strategy.opentrades.profit":return G.openProfit(R,$);default:return}}function Y_(T,L){let I=p(W(T.args,0,["symbol"]),L),_=p(W(T.args,1,["timeframe"]),L),R=W(T.args,2,["expression"]),$=Y(Z(R,L));return q2(L.symbol,L.timeframe,{symbol:I,timeframe:_,expression:R},$)}function X_(T,L,I){if(T==="request.security"||T==="request.security_lower_tf")return Y_(L,I);let _={symbol:I.symbol,timeframe:I.timeframe};if(T==="request.currency_rate"){let $=p(W(L.args,0,["from","from_currency"]),I),G=p(W(L.args,1,["to","to_currency"]),I),Q=k2(T,_,{from:$,to:G});return typeof Q==="number"||Q===null?Q:K}if(T==="request.seed"){let $=Y(Z(W(L.args,0,["seed"]),I)),G=k2(T,_,{seed:$});return typeof G==="number"||G===null?G:K}let R=k2(T,_,{});return typeof R==="number"||R===null?R:K}function B_(T,L,I){if(T==="math.abs"||T==="abs")return C9(R0(L,I,0,["number","x"]));if(T==="math.max"||T==="max")return A9(...p2(L,I));if(T==="math.min"||T==="min")return u9(...p2(L,I));if(T==="math.sqrt"||T==="sqrt")return N9(R0(L,I,0,["number","x"]));if(T==="math.log"||T==="log")return y9(R0(L,I,0,["number","x"]));if(T==="math.log10"||T==="log10")return b9(R0(L,I,0,["number","x"]));if(T==="math.exp"||T==="exp")return h9(R0(L,I,0,["number","x"]));if(T==="math.pow"||T==="pow")return w9(R0(L,I,0,["base","number","x"]),R0(L,I,1,["exponent","exp","y"]));if(T==="math.round"||T==="round"){let _=W(L.args,1,["precision"]);return g9(R0(L,I,0,["number","x"]),_==null?void 0:Y(Z(_,I)))}if(T==="math.floor"||T==="floor")return f9(R0(L,I,0,["number","x"]));if(T==="math.ceil"||T==="ceil")return p9(R0(L,I,0,["number","x"]));if(T==="math.sign"||T==="sign")return P9(R0(L,I,0,["number","x"]));if(T==="math.avg"||T==="avg")return x9(...p2(L,I));if(T==="math.sum"){let _=Z(W(L.args,0,["source","id","array"]),I),R=w(_);if(R)return R.sum();return c9(...p2(L,I))}if(T==="math.sin"||T==="sin")return m9(R0(L,I,0,["angle","x"]));if(T==="math.cos"||T==="cos")return d9(R0(L,I,0,["angle","x"]));if(T==="math.tan"||T==="tan")return l9(R0(L,I,0,["angle","x"]));if(T==="math.asin"||T==="asin")return o9(R0(L,I,0,["x"]));if(T==="math.acos"||T==="acos")return v9(R0(L,I,0,["x"]));if(T==="math.atan"||T==="atan")return i9(R0(L,I,0,["x"]));if(T==="math.todegrees")return r9(R0(L,I,0,["radians","x"]));if(T==="math.toradians")return s9(R0(L,I,0,["degrees","x"]));if(T==="math.isfinite")return a9(R0(L,I,0,["number","x"]));if(T==="math.random"){let _=W(L.args,0,["min"]),R=W(L.args,1,["max"]);return t9(_==null?void 0:Y(Z(_,I)),R==null?void 0:Y(Z(R,I)))}if(T==="math.round_to_mintick"){let _=typeof I.ctx["syminfo.mintick"]==="number"?I.ctx["syminfo.mintick"]:0.01;return n9(R0(L,I,0,["number","x"]),_)}return}function R0(T,L,I,_){return Y(Z(W(T.args,I,_),L))}function p2(T,L){return $0(T.args).map((I)=>Y(Z(I.value,L)))}function l(T,L,I,_,R){let $=W(T.args,I,_);if($==null)return R;let G=Y(Z($,L));return G==null||!Number.isFinite(G)?R:G}function z_(T,L,I,_){let R=I.ta;if(T==="ta.highest"||T==="highest"){if(typeof R.highest!=="function")return K;return R.highest.call(I.ta,_,b(L,I),g(L,I,1))}if(T==="ta.lowest"||T==="lowest"){if(typeof R.lowest!=="function")return K;return R.lowest.call(I.ta,_,b(L,I),g(L,I,1))}if(T==="ta.stdev"||T==="stdev"){if(typeof R.stdev!=="function")return K;return R.stdev.call(I.ta,_,b(L,I),g(L,I,1))}if(T==="ta.change"||T==="change"){if(typeof R.change!=="function")return K;return R.change.call(I.ta,_,b(L,I),l(L,I,1,["length"],1))}if(T==="ta.wma"||T==="wma"){if(typeof R.wma!=="function")return K;return R.wma.call(I.ta,_,b(L,I),g(L,I,1))}if(T==="ta.crossover"||T==="crossover"){if(typeof R.crossover!=="function")return K;return R.crossover.call(I.ta,_,b(L,I),Y(Z(W(L.args,1,["source2","b","series2"]),I)))}if(T==="ta.crossunder"||T==="crossunder"){if(typeof R.crossunder!=="function")return K;return R.crossunder.call(I.ta,_,b(L,I),Y(Z(W(L.args,1,["source2","b","series2"]),I)))}if(T==="ta.macd"||T==="macd"){if(typeof R.macd!=="function")return K;let $=R.macd.call(I.ta,_,b(L,I),l(L,I,1,["fastlen","fastLength","fast"],12),l(L,I,2,["slowlen","slowLength","slow"],26),l(L,I,3,["signal","signalLength","siglen"],9));return t0([$.macd,$.signal,$.hist])}if(T==="ta.bb"||T==="bb"){if(typeof R.bb!=="function")return K;let $=R.bb.call(I.ta,_,b(L,I),g(L,I,1),l(L,I,2,["mult","multiplier"],2));return t0([$.mid,$.up,$.lo])}if(T==="ta.sum"||T==="sum"){if(typeof R.sum!=="function")return K;return R.sum.call(I.ta,_,b(L,I),g(L,I,1))}if(T==="ta.roc"||T==="roc"){if(typeof R.roc!=="function")return K;return R.roc.call(I.ta,_,b(L,I),l(L,I,1,["length"],1))}if(T==="ta.mom"||T==="mom"){if(typeof R.mom!=="function")return K;return R.mom.call(I.ta,_,b(L,I),l(L,I,1,["length"],1))}if(T==="ta.vwma"||T==="vwma"){if(typeof R.vwma!=="function")return K;return R.vwma.call(I.ta,_,b(L,I),V(I.ctx.volume),g(L,I,1))}if(T==="ta.cci"||T==="cci"){if(typeof R.cci!=="function")return K;let $=V(I.ctx.high),G=V(I.ctx.low),Q=b(L,I),U=$!=null&&G!=null&&Q!=null?($+G+Q)/3:Q;return R.cci.call(I.ta,_,U,g(L,I,1))}if(T==="ta.wpr"||T==="wpr"){if(typeof R.willr!=="function")return K;return R.willr.call(I.ta,_,V(I.ctx.high),V(I.ctx.low),V(I.ctx.close),g(L,I,0))}if(T==="ta.willr"||T==="willr"){if(typeof R.willr!=="function")return K;return R.willr.call(I.ta,_,V(I.ctx.high),V(I.ctx.low),V(I.ctx.close),g(L,I,0))}if(T==="ta.stoch"||T==="stoch"){if(typeof R.stoch!=="function")return K;let $=$0(L.args).filter((Q)=>q0(Q)==null),G=W(L.args,1,["high"]);if(G==null&&$.length<=1)return R.stoch.call(I.ta,_,V(I.ctx.close),V(I.ctx.high),V(I.ctx.low),g(L,I,0));return R.stoch.call(I.ta,_,b(L,I),Y(Z(G,I)),Y(Z(W(L.args,2,["low"]),I)),g(L,I,3))}if(T==="ta.linreg"||T==="linreg"){if(typeof R.linreg!=="function")return K;return R.linreg.call(I.ta,_,b(L,I),g(L,I,1),l(L,I,2,["offset"],0))}if(T==="ta.vwap"||T==="vwap"){if(typeof R.vwap!=="function")return K;let $=W(L.args,0,["source","series"]),G=$!=null?Y(Z($,I)):H_(I);return R.vwap.call(I.ta,_,G,V(I.ctx.volume))}if(T==="ta.rising"||T==="rising"){if(typeof R.rising!=="function")return K;return R.rising.call(I.ta,_,b(L,I),l(L,I,1,["length"],1))}if(T==="ta.falling"||T==="falling"){if(typeof R.falling!=="function")return K;return R.falling.call(I.ta,_,b(L,I),l(L,I,1,["length"],1))}if(T==="ta.cross"||T==="cross"){if(typeof R.cross!=="function")return K;return R.cross.call(I.ta,_,b(L,I),Y(Z(W(L.args,1,["source2","b","series2"]),I)))}if(T==="ta.bbw"||T==="bbw"){if(typeof R.bbw!=="function")return K;return R.bbw.call(I.ta,_,b(L,I),g(L,I,1),l(L,I,2,["mult","multiplier"],2))}if(T==="ta.dema"||T==="dema"){if(typeof R.dema!=="function")return K;return R.dema.call(I.ta,_,b(L,I),g(L,I,1))}if(T==="ta.tema"||T==="tema"){if(typeof R.tema!=="function")return K;return R.tema.call(I.ta,_,b(L,I),g(L,I,1))}if(T==="ta.highestbars"||T==="highestbars"){if(typeof R.highestbars!=="function")return K;return R.highestbars.call(I.ta,_,b(L,I),g(L,I,1))}if(T==="ta.lowestbars"||T==="lowestbars"){if(typeof R.lowestbars!=="function")return K;return R.lowestbars.call(I.ta,_,b(L,I),g(L,I,1))}if(T==="ta.alma"||T==="alma"){if(typeof R.alma!=="function")return K;return R.alma.call(I.ta,_,b(L,I),g(L,I,1),l(L,I,2,["offset"],0.85),l(L,I,3,["sigma"],6))}if(T==="ta.cmo"||T==="cmo"){if(typeof R.cmo!=="function")return K;return R.cmo.call(I.ta,_,b(L,I),g(L,I,1))}if(T==="ta.kama"||T==="kama"){if(typeof R.kama!=="function")return K;return R.kama.call(I.ta,_,b(L,I),g(L,I,1),l(L,I,2,["fastLength","fast","fastlen"],2),l(L,I,3,["slowLength","slow","slowlen"],30))}if(T==="ta.accdist"||T==="accdist"||T==="ta.ad"||T==="ad"){let $=W(L.args,0,["high"]),G=W(L.args,1,["low"]),Q=W(L.args,2,["close"]),U=W(L.args,3,["volume"]);return I.ta.accdist(_,$==null?V(I.ctx.high):Y(Z($,I)),G==null?V(I.ctx.low):Y(Z(G,I)),Q==null?V(I.ctx.close):Y(Z(Q,I)),U==null?V(I.ctx.volume):Y(Z(U,I)))}if(T==="ta.obv"||T==="obv"){if(typeof R.obv!=="function")return K;let $=W(L.args,0,["source","close"]),G=W(L.args,1,["volume"]),Q=$==null?V(I.ctx.close):Y(Z($,I)),U=G==null?V(I.ctx.volume):Y(Z(G,I));return R.obv.call(I.ta,_,Q,U)}if(T==="ta.pivothigh"||T==="pivothigh"){if(typeof R.pivothigh!=="function")return K;return R.pivothigh.call(I.ta,_,b(L,I),l(L,I,1,["leftbars","left"],5),l(L,I,2,["rightbars","right"],5))}if(T==="ta.pivotlow"||T==="pivotlow"){if(typeof R.pivotlow!=="function")return K;return R.pivotlow.call(I.ta,_,b(L,I),l(L,I,1,["leftbars","left"],5),l(L,I,2,["rightbars","right"],5))}if(T==="ta.hma"||T==="hma"){if(typeof R.hma!=="function")return K;return R.hma.call(I.ta,_,b(L,I),g(L,I,1))}if(T==="ta.mfi"||T==="mfi"){if(typeof R.mfi!=="function")return K;let $=$0(L.args).filter((G)=>G.name==null);if($.length<=1)return R.mfi.call(I.ta,_,V(I.ctx.high),V(I.ctx.low),V(I.ctx.close),V(I.ctx.volume),g(L,I,0));if($.length===2)return R.mfi.call(I.ta,_,b(L,I),b(L,I),b(L,I),V(I.ctx.volume),g(L,I,1));return R.mfi.call(I.ta,_,Y(Z(W(L.args,0,["high"]),I)),Y(Z(W(L.args,1,["low"]),I)),Y(Z(W(L.args,2,["close"]),I)),Y(Z(W(L.args,3,["volume"]),I)),g(L,I,4))}if(T==="ta.sar"||T==="sar"){if(typeof R.sar!=="function")return K;return R.sar.call(I.ta,_,V(I.ctx.high),V(I.ctx.low),l(L,I,0,["start"],0.02),l(L,I,1,["increment"],0.02),l(L,I,2,["maximum","max"],0.2))}if(T==="ta.dmi"||T==="dmi"){if(typeof R.dmi!=="function")return K;let $=R.dmi.call(I.ta,_,V(I.ctx.high),V(I.ctx.low),V(I.ctx.close),l(L,I,0,["diLength","length"],14),l(L,I,1,["adxSmoothing","adxlen"],14));return t0([$.plus,$.minus,$.adx])}if(T==="ta.adx"||T==="adx"){if(typeof R.adx!=="function")return K;return R.adx.call(I.ta,_,V(I.ctx.high),V(I.ctx.low),V(I.ctx.close),l(L,I,0,["length"],14))}if(T==="ta.correlation"||T==="correlation"){if(typeof R.correlation!=="function")return K;return R.correlation.call(I.ta,_,b(L,I),Y(Z(W(L.args,1,["source2","b","series2"]),I)),g(L,I,2))}if(T==="ta.swma"||T==="swma"){if(typeof R.swma!=="function")return K;let $=W(L.args,1,["length"]);return R.swma.call(I.ta,_,b(L,I),$==null?void 0:g(L,I,1))}if(T==="ta.cog"||T==="cog"){if(typeof R.cog!=="function")return K;return R.cog.call(I.ta,_,b(L,I),g(L,I,1))}if(T==="ta.tsi"||T==="tsi"){if(typeof R.tsi!=="function")return K;if($0(L.args).filter((G)=>G.name==null).length===2)return R.tsi.call(I.ta,_,V(I.ctx.close),l(L,I,1,["long","long_length"],25),l(L,I,0,["short","short_length"],13));return R.tsi.call(I.ta,_,b(L,I),l(L,I,2,["long","long_length"],25),l(L,I,1,["short","short_length"],13))}if(T==="ta.kcw"||T==="kcw"){if(typeof R.kcw!=="function")return K;return R.kcw.call(I.ta,_,V(I.ctx.high),V(I.ctx.low),V(I.ctx.close),g(L,I,0),l(L,I,1,["mult","multiplier"],2))}if(T==="ta.dev"||T==="dev"){if(typeof R.dev!=="function")return K;return R.dev.call(I.ta,_,b(L,I),g(L,I,1))}if(T==="ta.variance"||T==="variance"){if(typeof R.variance!=="function")return K;return R.variance.call(I.ta,_,b(L,I),g(L,I,1))}if(T==="ta.median"||T==="median"){if(typeof R.median!=="function")return K;return R.median.call(I.ta,_,b(L,I),g(L,I,1))}if(T==="ta.mode"||T==="mode"){if(typeof R.mode!=="function")return K;return R.mode.call(I.ta,_,b(L,I),g(L,I,1))}if(T==="ta.percentrank"||T==="percentrank"){if(typeof R.percentrank!=="function")return K;return R.percentrank.call(I.ta,_,b(L,I),g(L,I,1))}if(T==="ta.percentile_nearest_rank"){if(typeof R.percentileNearest!=="function")return K;return R.percentileNearest.call(I.ta,_,b(L,I),g(L,I,1),l(L,I,2,["percentage","percent"],50))}if(T==="ta.percentile_linear_interpolation"){if(typeof R.percentileLinear!=="function")return K;return R.percentileLinear.call(I.ta,_,b(L,I),g(L,I,1),l(L,I,2,["percentage","percent"],50))}if(T==="ta.cum"||T==="cum"){if(typeof R.cum!=="function")return K;return R.cum.call(I.ta,_,b(L,I))}if(T==="ta.barssince"||T==="barssince"){if(typeof R.barssince!=="function")return K;return R.barssince.call(I.ta,_,Y(Z(W(L.args,0,["condition","cond"]),I)))}if(T==="ta.valuewhen"||T==="valuewhen"){if(typeof R.valuewhen!=="function")return K;return R.valuewhen.call(I.ta,_,Y(Z(W(L.args,0,["condition","cond"]),I)),Y(Z(W(L.args,1,["source"]),I)),l(L,I,2,["occurrence"],0))}if(T==="ta.range"){if(typeof R.range!=="function")return K;return R.range.call(I.ta,_,b(L,I),g(L,I,1))}if((T==="ta.max"||T==="ta.min")&&typeof R.max==="function")return(T==="ta.max"?R.max:R.min).call(I.ta,_,b(L,I),g(L,I,1));if(T==="ta.accdist"||T==="accdist"){if(typeof R.accdist!=="function")return K;return R.accdist.call(I.ta,_,V(I.ctx.high),V(I.ctx.low),V(I.ctx.close),V(I.ctx.volume))}if(T==="ta.pvt"||T==="pvt"){if(typeof R.pvt!=="function")return K;return R.pvt.call(I.ta,_,V(I.ctx.close),V(I.ctx.volume))}if(T==="ta.wad"||T==="wad"){if(typeof R.wad!=="function")return K;return R.wad.call(I.ta,_,V(I.ctx.high),V(I.ctx.low),V(I.ctx.close))}if(T==="ta.nvi"||T==="nvi"){if(typeof R.nvi!=="function")return K;return R.nvi.call(I.ta,_,V(I.ctx.close),V(I.ctx.volume))}if(T==="ta.pvi"||T==="pvi"){if(typeof R.pvi!=="function")return K;return R.pvi.call(I.ta,_,V(I.ctx.close),V(I.ctx.volume))}if(T==="ta.iii"||T==="iii"){if(typeof R.iii!=="function")return K;return R.iii.call(I.ta,_,V(I.ctx.high),V(I.ctx.low),V(I.ctx.close),V(I.ctx.volume))}if(T==="ta.wvad"||T==="wvad"){if(typeof R.wvad!=="function")return K;return R.wvad.call(I.ta,_,V(I.ctx.open),V(I.ctx.high),V(I.ctx.low),V(I.ctx.close),V(I.ctx.volume))}if(T==="ta.pivot_point_levels"){if(typeof R.pivotPoints!=="function")return K;let $=R.pivotPoints.call(I.ta,_,V(I.ctx.high),V(I.ctx.low),V(I.ctx.close));return t0([$.pp,$.r1,$.s1,$.r2,$.s2])}return}function H_(T){let L=V(T.ctx.high),I=V(T.ctx.low),_=V(T.ctx.close);if(L==null||I==null||_==null)return _??L??I;return(L+I+_)/3}function w(T){if(T instanceof G0)return T;if(T&&typeof T==="object"&&"__array"in T){let L=T.elts,I=new G0;for(let _ of L)I.push(Y(_));return I}return null}function V_(T,L,I){if(T==="array.new_float"||T==="array.new"||T==="array.new_int"){let _=Y(Z(W(L.args,0,["size"]),I))??0,R=Y(Z(W(L.args,1,["initial_value"]),I));return new G0(_,R)}if(T==="array.push"){let _=w(Z(W(L.args,0,["id"]),I)),R=Y(Z(W(L.args,1,["value"]),I));return _?.push(R),K}if(T==="array.get"){let _=w(Z(W(L.args,0,["id"]),I)),R=Y(Z(W(L.args,1,["index"]),I));return _?_.get(R??0):K}if(T==="array.set"){let _=w(Z(W(L.args,0,["id"]),I)),R=Y(Z(W(L.args,1,["index"]),I)),$=Y(Z(W(L.args,2,["value"]),I));if(_&&R!=null)_.set(R,$);return K}if(T==="array.size"){let _=w(Z(W(L.args,0,["id"]),I));return _?_.size():K}if(T==="array.pop"){let _=w(Z(W(L.args,0,["id"]),I));return _?_.pop():K}if(T==="array.clear")return w(Z(W(L.args,0,["id"]),I))?.clear(),K;if(T==="array.unshift")return w(Z(W(L.args,0,["id"]),I))?.unshift(Y(Z(W(L.args,1,["value"]),I))),K;if(T==="array.shift"){let _=w(Z(W(L.args,0,["id"]),I));return _?_.shift():K}if(T==="array.includes")return w(Z(W(L.args,0,["id"]),I))?.includes(Y(Z(W(L.args,1,["value"]),I)))?1:0;if(T==="array.first"){let _=w(Z(W(L.args,0,["id"]),I));return _?_.first():K}if(T==="array.last"){let _=w(Z(W(L.args,0,["id"]),I));return _?_.last():K}if(T==="array.insert"){let _=w(Z(W(L.args,0,["id"]),I)),R=Y(Z(W(L.args,1,["index"]),I)),$=Y(Z(W(L.args,2,["value"]),I));if(_&&R!=null)_.insert(R,$);return K}if(T==="array.remove"){let _=w(Z(W(L.args,0,["id"]),I)),R=Y(Z(W(L.args,1,["index"]),I));return _&&R!=null?_.remove(R):K}if(T==="array.fill")return w(Z(W(L.args,0,["id"]),I))?.fill(Y(Z(W(L.args,1,["value"]),I))),K;if(T==="array.slice"){let _=w(Z(W(L.args,0,["id"]),I)),R=Y(Z(W(L.args,1,["index_from","from"]),I))??0,$=W(L.args,2,["index_to","to"]),G=$==null?void 0:Y(Z($,I))??void 0;return _?_.slice(R,G):K}if(T==="array.copy"){let _=w(Z(W(L.args,0,["id"]),I));return _?_.copy():K}if(T==="array.reverse")return w(Z(W(L.args,0,["id"]),I))?.reverse(),K;if(T==="array.sort"){let _=w(Z(W(L.args,0,["id"]),I)),R=Z(W(L.args,1,["order"]),I),$=typeof R==="string"&&R.toLowerCase().includes("desc")?"desc":"asc";return _?.sort($),K}if(T==="array.indexof"){let _=w(Z(W(L.args,0,["id"]),I));return _?_.indexof(Y(Z(W(L.args,1,["value"]),I))):K}if(T==="array.avg"){let _=w(Z(W(L.args,0,["id"]),I));return _?_.avg():K}if(T==="array.min"){let _=w(Z(W(L.args,0,["id"]),I));return _?_.min():K}if(T==="array.max"){let _=w(Z(W(L.args,0,["id"]),I));return _?_.max():K}if(T==="array.sum"){let _=w(Z(W(L.args,0,["id"]),I));return _?_.sum():K}if(T==="array.join"){let _=w(Z(W(L.args,0,["id"]),I)),R=p(W(L.args,1,["separator","sep"]),I);return _?_.join(R??","):K}if(T==="array.new_bool"||T==="array.new_string"){let _=Y(Z(W(L.args,0,["size"]),I))??0,R=Y(Z(W(L.args,1,["initial_value"]),I));return new G0(_,R)}if(T==="array.from"){let _=new G0;for(let R of $0(L.args))_.push(Y(Z(R.value,I)));return _}if(T==="array.lastindexof"){let _=w(Z(W(L.args,0,["id"]),I));return _?_.lastIndexOf(Y(Z(W(L.args,1,["value"]),I))):K}if(T==="array.concat"){let _=w(Z(W(L.args,0,["id"]),I)),R=w(Z(W(L.args,1,["other","id2"]),I));return _&&R?_.concat(R):K}if(T==="array.abs"){let _=w(Z(W(L.args,0,["id"]),I));return _?_.abs():K}if(T==="array.every"){let _=w(Z(W(L.args,0,["id"]),I));return _&&_.every()?1:0}if(T==="array.some"){let _=w(Z(W(L.args,0,["id"]),I));return _&&_.some()?1:0}if(T==="array.median"){let _=w(Z(W(L.args,0,["id"]),I));return _?_.median():K}if(T==="array.range"){let _=w(Z(W(L.args,0,["id"]),I));return _?_.range():K}if(T==="array.mode"){let _=w(Z(W(L.args,0,["id"]),I));return _?_.mode():K}if(T==="array.binary_search"){let _=w(Z(W(L.args,0,["id"]),I));return _?_.binarySearch(Y(Z(W(L.args,1,["value"]),I))):K}if(T==="array.binary_search_leftmost"){let _=w(Z(W(L.args,0,["id"]),I));return _?_.binarySearchLeftmost(Y(Z(W(L.args,1,["value"]),I))):K}if(T==="array.binary_search_rightmost"){let _=w(Z(W(L.args,0,["id"]),I));return _?_.binarySearchRightmost(Y(Z(W(L.args,1,["value"]),I))):K}if(T==="array.stdev"){let _=w(Z(W(L.args,0,["id"]),I)),R=t5(L,I);return _?_.stdev(R):K}if(T==="array.variance"){let _=w(Z(W(L.args,0,["id"]),I));return _?_.variance(t5(L,I)):K}if(T==="array.covariance"){let _=w(Z(W(L.args,0,["id"]),I)),R=w(Z(W(L.args,1,["id2","other"]),I));return _&&R?_.covariance(R,t5(L,I,2)):K}if(T==="array.percentile_linear_interpolation"){let _=w(Z(W(L.args,0,["id"]),I)),R=Y(Z(W(L.args,1,["percentage","percent"]),I));return _&&R!=null?_.percentileLinearInterpolation(R):K}if(T==="array.percentile_nearest_rank"){let _=w(Z(W(L.args,0,["id"]),I)),R=Y(Z(W(L.args,1,["percentage","percent"]),I));return _&&R!=null?_.percentileNearestRank(R):K}if(T==="array.percentrank"){let _=w(Z(W(L.args,0,["id"]),I));return _?_.percentrank(Y(Z(W(L.args,1,["value"]),I))):K}if(T==="array.standardize"){let _=w(Z(W(L.args,0,["id"]),I));return _?_.standardize():K}if(T==="array.sort_indices"){let _=w(Z(W(L.args,0,["id"]),I)),R=Z(W(L.args,1,["order"]),I),$=typeof R==="string"&&R.toLowerCase().includes("desc")?"desc":"asc";if(!_)return K;let G=_.sortIndices($);if(G==null)return K;let Q=new G0;for(let U of G)Q.push(U);return Q}return}function t5(T,L,I=1){let _=Y(Z(W(T.args,I,["biased"]),L));if(_==null)return!0;return _!==0}function u0(T){return T instanceof V1?T:null}function F_(T,L,I){if(T==="map.new"||T==="map.new<float,float>"||T==="map.new_string_float")return new V1;if(T==="map.put"){let _=u0(Z(W(L.args,0,["id"]),I)),R=Z(W(L.args,1,["key"]),I),$=Y(Z(W(L.args,2,["value"]),I));return _?.put(typeof R==="string"||typeof R==="number"?R:Y(R),$),K}if(T==="map.get"){let _=u0(Z(W(L.args,0,["id"]),I)),R=Z(W(L.args,1,["key"]),I);return _?_.get(typeof R==="string"||typeof R==="number"?R:Y(R)):K}if(T==="map.contains"){let _=u0(Z(W(L.args,0,["id"]),I)),R=Z(W(L.args,1,["key"]),I);return _?.contains(typeof R==="string"||typeof R==="number"?R:Y(R))?1:0}if(T==="map.size"){let _=u0(Z(W(L.args,0,["id"]),I));return _?_.size():K}if(T==="map.remove"){let _=u0(Z(W(L.args,0,["id"]),I)),R=Z(W(L.args,1,["key"]),I);return _?_.remove(typeof R==="string"||typeof R==="number"?R:Y(R)):K}if(T==="map.clear")return u0(Z(W(L.args,0,["id"]),I))?.clear(),K;if(T==="map.put_all"){let _=u0(Z(W(L.args,0,["id"]),I)),R=u0(Z(W(L.args,1,["id2","other"]),I));if(_&&R)_.putAll(R);return K}if(T==="map.keys"){let _=u0(Z(W(L.args,0,["id"]),I));if(!_)return K;let R=new G0;for(let $ of _.keys())R.push(typeof $==="number"?$:null);return R}if(T==="map.values"){let _=u0(Z(W(L.args,0,["id"]),I));if(!_)return K;let R=new G0;for(let $ of _.values())R.push($);return R}if(T==="map.copy"){let _=u0(Z(W(L.args,0,["id"]),I));return _?_.copy():K}return}function q_(T){if(T==null||!T.startsWith("matrix."))return null;let L=T.indexOf("<");return L>=0?T.slice(0,L):T}function y(T){return T instanceof e?T:null}function k_(T){return T==="matrix.new"||T.startsWith("matrix.new_")}function M_(T,L,I){let _=q_(T);if(_==null)return;if(k_(_)){let R=Y(Z(W(L.args,0,["rows"]),I))??0,$=Y(Z(W(L.args,1,["columns","cols"]),I))??0,G=W(L.args,2,["initial_value","initial"]),Q=G==null?void 0:Y(Z(G,I));return new e(R,$,Q)}if(_==="matrix.get"){let R=y(Z(W(L.args,0,["id"]),I)),$=Y(Z(W(L.args,1,["row"]),I)),G=Y(Z(W(L.args,2,["column","col"]),I));return R?R.get($??0,G??0):K}if(_==="matrix.set"){let R=y(Z(W(L.args,0,["id"]),I)),$=Y(Z(W(L.args,1,["row"]),I)),G=Y(Z(W(L.args,2,["column","col"]),I)),Q=Y(Z(W(L.args,3,["value"]),I));if(R&&$!=null&&G!=null)R.set($,G,Q);return K}if(_==="matrix.rows"){let R=y(Z(W(L.args,0,["id"]),I));return R?R.rows():K}if(_==="matrix.columns"){let R=y(Z(W(L.args,0,["id"]),I));return R?R.columns():K}if(_==="matrix.fill"){let R=y(Z(W(L.args,0,["id"]),I)),$=Y(Z(W(L.args,1,["value"]),I));return R?.fill($),K}if(_==="matrix.transpose"){let R=y(Z(W(L.args,0,["id"]),I));return R?R.transpose():K}if(_==="matrix.copy"){let R=y(Z(W(L.args,0,["id"]),I));return R?R.copy():K}if(_==="matrix.elements_count"){let R=y(Z(W(L.args,0,["id"]),I));return R?R.elementsCount():K}if(_==="matrix.is_square"){let R=y(Z(W(L.args,0,["id"]),I));return R&&R.isSquare()?1:0}if(_==="matrix.sum"||_==="matrix.sum_all"){let R=y(Z(W(L.args,0,["id"]),I));return R?R.sum():K}if(_==="matrix.avg"||_==="matrix.avg_all"){let R=y(Z(W(L.args,0,["id"]),I));return R?R.avg():K}if(_==="matrix.min"||_==="matrix.min_all"){let R=y(Z(W(L.args,0,["id"]),I));return R?R.min():K}if(_==="matrix.max"||_==="matrix.max_all"){let R=y(Z(W(L.args,0,["id"]),I));return R?R.max():K}if(_==="matrix.trace"){let R=y(Z(W(L.args,0,["id"]),I));return R?R.trace():K}if(_==="matrix.det"){let R=y(Z(W(L.args,0,["id"]),I));return R?R.det():K}if(_==="matrix.row"){let R=y(Z(W(L.args,0,["id"]),I)),$=Y(Z(W(L.args,1,["row","index"]),I));if(!R||$==null)return K;let G=new G0;for(let Q of R.row($))G.push(Q);return G}if(_==="matrix.col"||_==="matrix.column"){let R=y(Z(W(L.args,0,["id"]),I)),$=Y(Z(W(L.args,1,["column","col","index"]),I));if(!R||$==null)return K;let G=new G0;for(let Q of R.col($))G.push(Q);return G}if(_==="matrix.mult"){let R=y(Z(W(L.args,0,["id"]),I)),$=Z(W(L.args,1,["other","matrix_2"]),I);if(!R)return K;let G=y($);return G?R.mult(G):R.mult(Y($)??0)}if(_==="matrix.inv"){let R=y(Z(W(L.args,0,["id"]),I));return R?R.inv():K}if(_==="matrix.pinv"){let R=y(Z(W(L.args,0,["id"]),I));return R?R.pinv():K}if(_==="matrix.eigenvalues"){let $=y(Z(W(L.args,0,["id"]),I))?.eigenvalues();if($==null)return K;let G=new G0;for(let Q of $)G.push(Q);return G}if(_==="matrix.eigenvectors"){let R=y(Z(W(L.args,0,["id"]),I));return R?R.eigenvectors():K}if(_==="matrix.pow"){let R=y(Z(W(L.args,0,["id"]),I)),$=Y(Z(W(L.args,1,["power","n"]),I));return R&&$!=null?R.pow($):K}if(_==="matrix.kron"){let R=y(Z(W(L.args,0,["id"]),I)),$=y(Z(W(L.args,1,["other"]),I));return R&&$?R.kron($):K}if(_==="matrix.diff"){let R=y(Z(W(L.args,0,["id"]),I)),$=y(Z(W(L.args,1,["other"]),I));return R&&$?R.diff($):K}if(_==="matrix.rank"){let R=y(Z(W(L.args,0,["id"]),I));return R?R.rank():K}if(_==="matrix.swap_rows"){let R=y(Z(W(L.args,0,["id"]),I)),$=Y(Z(W(L.args,1,["row1","i"]),I)),G=Y(Z(W(L.args,2,["row2","j"]),I));if(R&&$!=null&&G!=null)R.swapRows($,G);return K}if(_==="matrix.swap_columns"){let R=y(Z(W(L.args,0,["id"]),I)),$=Y(Z(W(L.args,1,["column1","i"]),I)),G=Y(Z(W(L.args,2,["column2","j"]),I));if(R&&$!=null&&G!=null)R.swapColumns($,G);return K}if(_==="matrix.is_zero"){let R=y(Z(W(L.args,0,["id"]),I));return R&&R.isZero()?1:0}if(_==="matrix.is_identity"){let R=y(Z(W(L.args,0,["id"]),I));return R&&R.isIdentity()?1:0}if(_==="matrix.is_diagonal"){let R=y(Z(W(L.args,0,["id"]),I));return R&&R.isDiagonal()?1:0}if(_==="matrix.is_symmetric"){let R=y(Z(W(L.args,0,["id"]),I));return R&&R.isSymmetric()?1:0}if(_==="matrix.is_antisymmetric"){let R=y(Z(W(L.args,0,["id"]),I));return R&&R.isAntisymmetric()?1:0}if(_==="matrix.is_triangular"){let R=y(Z(W(L.args,0,["id"]),I));return R&&R.isTriangular()?1:0}if(_==="matrix.add_row"){let R=y(Z(W(L.args,0,["id"]),I)),$=Y(Z(W(L.args,1,["row","index"]),I)),G=w(Z(W(L.args,2,["array"]),I));return R?.addRow($??void 0,G?.toValues()),K}if(_==="matrix.add_col"||_==="matrix.add_column"){let R=y(Z(W(L.args,0,["id"]),I)),$=Y(Z(W(L.args,1,["column","index"]),I)),G=w(Z(W(L.args,2,["array"]),I));return R?.addCol($??void 0,G?.toValues()),K}if(_==="matrix.remove_row"){let R=y(Z(W(L.args,0,["id"]),I)),$=Y(Z(W(L.args,1,["row","index"]),I));if(R&&$!=null)R.removeRow($);return K}if(_==="matrix.remove_col"||_==="matrix.remove_column"){let R=y(Z(W(L.args,0,["id"]),I)),$=Y(Z(W(L.args,1,["column","index"]),I));if(R&&$!=null)R.removeCol($);return K}if(_==="matrix.reshape"){let R=y(Z(W(L.args,0,["id"]),I)),$=Y(Z(W(L.args,1,["rows"]),I)),G=Y(Z(W(L.args,2,["columns","cols"]),I));return R&&$!=null&&G!=null?R.reshape($,G):K}if(_==="matrix.concat"){let R=y(Z(W(L.args,0,["id"]),I)),$=y(Z(W(L.args,1,["other"]),I));return R&&$?R.concat($):K}if(_==="matrix.submatrix"){let R=y(Z(W(L.args,0,["id"]),I));if(!R)return K;return R.submatrix(Y(Z(W(L.args,1,["from_row"]),I))??0,Y(Z(W(L.args,2,["to_row"]),I))??R.rows(),Y(Z(W(L.args,3,["from_column","from_col"]),I))??0,Y(Z(W(L.args,4,["to_column","to_col"]),I))??R.columns())}if(_==="matrix.reverse")return y(Z(W(L.args,0,["id"]),I))?.reverse(),K;if(_==="matrix.sort"){let R=y(Z(W(L.args,0,["id"]),I)),$=Y(Z(W(L.args,1,["column","col"]),I))??0,G=Z(W(L.args,2,["order"]),I),Q=typeof G==="string"&&G.toLowerCase().includes("desc")?"desc":"asc";return R?.sort($,Q),K}if(_==="matrix.median"){let R=y(Z(W(L.args,0,["id"]),I));return R?R.median():K}if(_==="matrix.mode"){let R=y(Z(W(L.args,0,["id"]),I));return R?R.mode():K}if(_==="matrix.is_binary"){let R=y(Z(W(L.args,0,["id"]),I));return R&&R.isBinary()?1:0}if(_==="matrix.is_stochastic"){let R=y(Z(W(L.args,0,["id"]),I));return R&&R.isStochastic()?1:0}if(_==="matrix.is_antidiagonal"){let R=y(Z(W(L.args,0,["id"]),I));return R&&R.isAntidiagonal()?1:0}return}function E_(T,L,I){if(T==="line.new")return I.drawings.lineNew(I.barIndex);if(T==="label.new"){let _=p(W(L.args,2,["text"]),I);return I.drawings.labelNew(I.barIndex,_??void 0)}if(T==="box.new")return I.drawings.boxNew(I.barIndex);if(T==="alert"){let _=j_(W(L.args,0,["message"]),I);return I.drawings.alert(I.barIndex,_),K}if(T==="table.new")return I.drawings.tableNew(I.barIndex);if(T==="polyline.new")return I.drawings.polylineNew(I.barIndex);if(T==="linefill.new"){let _=Y(Z(W(L.args,0,["id1"]),I)),R=Y(Z(W(L.args,1,["id2"]),I));return I.drawings.linefillNew(I.barIndex,_==null?void 0:_,R==null?void 0:R)}if(T==="line.set_xy"){let _=Y(Z(W(L.args,0,["id"]),I));if(_!=null)I.drawings.lineSetXy(_,Y(Z(W(L.args,1,["x1"]),I))??0,Y(Z(W(L.args,2,["y1"]),I))??0,Y(Z(W(L.args,3,["x2"]),I))??0,Y(Z(W(L.args,4,["y2"]),I))??0);return K}if(T==="label.set_text"){let _=Y(Z(W(L.args,0,["id"]),I));if(_!=null)I.drawings.labelSetText(_,p(W(L.args,1,["text"]),I)??"");return K}if(T==="line.delete"||T==="label.delete"||T==="box.delete"){let _=Y(Z(W(L.args,0,["id"]),I));if(_!=null)if(T==="line.delete")I.drawings.lineDelete(_);else if(T==="label.delete")I.drawings.labelDelete(_);else I.drawings.boxDelete(_);return K}if(T==="line.set_color"){let _=Y(Z(W(L.args,0,["id"]),I));if(_!=null)I.drawings.lineSetColor(_,p(W(L.args,1,["color"]),I)??"");return K}if(T==="line.get_price"){let _=Y(Z(W(L.args,0,["id"]),I)),R=Y(Z(W(L.args,1,["x"]),I));return _!=null&&R!=null?I.drawings.lineGetPrice(_,R):K}if(T==="line.get_x1"){let _=Y(Z(W(L.args,0,["id"]),I));return _!=null?I.drawings.getX1(_):K}if(T==="line.get_y1"){let _=Y(Z(W(L.args,0,["id"]),I));return _!=null?I.drawings.getY1(_):K}if(T==="line.get_x2"){let _=Y(Z(W(L.args,0,["id"]),I));return _!=null?I.drawings.getX2(_):K}if(T==="line.get_y2"){let _=Y(Z(W(L.args,0,["id"]),I));return _!=null?I.drawings.getY2(_):K}if(T==="label.get_text"){let _=Y(Z(W(L.args,0,["id"]),I));return _!=null?I.drawings.labelGetText(_):K}if(T==="label.set_xy"){let _=Y(Z(W(L.args,0,["id"]),I));if(_!=null)I.drawings.labelSetXy(_,Y(Z(W(L.args,1,["x"]),I))??0,Y(Z(W(L.args,2,["y"]),I))??0);return K}if(T==="box.set_lefttop"||T==="box.set_corners"){let _=Y(Z(W(L.args,0,["id"]),I));if(_!=null)I.drawings.boxSetCorners(_,Y(Z(W(L.args,1,["left","x1"]),I))??0,Y(Z(W(L.args,2,["top","y1"]),I))??0,Y(Z(W(L.args,3,["right","x2"]),I))??0,Y(Z(W(L.args,4,["bottom","y2"]),I))??0);return K}if(T==="label.set_color"){let _=Y(Z(W(L.args,0,["id"]),I));if(_!=null)I.drawings.labelSetColor(_,p(W(L.args,1,["color"]),I)??"");return K}if(T==="table.cell"){let _=Y(Z(W(L.args,0,["id"]),I)),R=Y(Z(W(L.args,1,["column"]),I)),$=Y(Z(W(L.args,2,["row"]),I)),G=p(W(L.args,3,["text"]),I)??void 0;if(_!=null&&R!=null&&$!=null)I.drawings.tableCell(_,R,$,G);return K}return}function j_(T,L){if(T==null)return"";let I=Z(T,L);if(typeof I==="string")return I;let _=Y(I);return _==null?"":String(_)}function C_(T,L,I){if(T==="color.r"||T==="color.g"||T==="color.b"||T==="color.t"){let _=Z(W(L.args,0,["color"]),I),R=typeof _==="string"?_:_&&typeof _==="object"&&("r"in _)?_:null;if(T==="color.r")return Q9(R);if(T==="color.g")return U9(R);if(T==="color.b")return S9(R);return O9(R)}if(T==="color.rgb")return $9(Y(Z(W(L.args,0,["red","r"]),I)),Y(Z(W(L.args,1,["green","g"]),I)),Y(Z(W(L.args,2,["blue","b"]),I)),Y(Z(W(L.args,3,["transp","t"]),I))??void 0);if(T==="color.from_gradient"){let _=Z(W(L.args,3,["color1"]),I),R=Z(W(L.args,4,["color2"]),I),$=(G)=>{if(G&&typeof G==="object"&&"r"in G&&"g"in G)return G;if(typeof G==="string")return U5(G);return null};return G9(Y(Z(W(L.args,0,["value"]),I)),Y(Z(W(L.args,1,["bottom_value","bottom"]),I)),Y(Z(W(L.args,2,["top_value","top"]),I)),$(_)??{r:0,g:0,b:0,a:255},$(R)??{r:255,g:255,b:255,a:255})}if(T==="color.new"||T==="color"){let _=Z(W(L.args,0,["color"]),I),R=u1(_);if(!R)return K;let $=Y(Z(W(L.args,1,["transp"]),I));return S5(R.r,R.g,R.b,$??void 0)}return}function P_(T,L,I){if(T==="str.tostring"||T==="str.tostring"){let _=Z(W(L.args,0,["value","source"]),I);if(typeof _==="string")return _;let R=Y(_);return r5(R)}if(T==="str.length"){let _=Z(W(L.args,0,["string","source"]),I);return OT(typeof _==="string"?_:null)}if(T==="str.contains"){let _=Z(W(L.args,0,["source"]),I),R=Z(W(L.args,1,["str"]),I),$=JT(typeof _==="string"?_:null,typeof R==="string"?R:null);return $==null?K:$?1:0}if(T==="str.upper"){let _=Z(W(L.args,0,["source"]),I);return ZT(typeof _==="string"?_:null)}if(T==="str.lower"){let _=Z(W(L.args,0,["source"]),I);return WT(typeof _==="string"?_:null)}if(T==="str.replace"){let _=Z(W(L.args,0,["source"]),I),R=Z(W(L.args,1,["target"]),I),$=Z(W(L.args,2,["replacement"]),I),G=Y(Z(W(L.args,3,["occurrence"]),I));return DT(typeof _==="string"?_:null,typeof R==="string"?R:null,typeof $==="string"?$:null,G)}if(T==="str.replace_all"){let _=Z(W(L.args,0,["source"]),I),R=Z(W(L.args,1,["target"]),I),$=Z(W(L.args,2,["replacement"]),I);return jT(typeof _==="string"?_:null,typeof R==="string"?R:null,typeof $==="string"?$:null)}if(T==="str.startswith"){let _=KT(p(W(L.args,0,["source"]),I),p(W(L.args,1,["str"]),I));return _==null?K:_?1:0}if(T==="str.endswith"){let _=YT(p(W(L.args,0,["source"]),I),p(W(L.args,1,["str"]),I));return _==null?K:_?1:0}if(T==="str.substring"){let _=W(L.args,2,["end_pos","end"]);return XT(p(W(L.args,0,["source"]),I),Y(Z(W(L.args,1,["begin_pos","begin"]),I)),_==null?void 0:Y(Z(_,I)))}if(T==="str.repeat")return BT(p(W(L.args,0,["source"]),I),Y(Z(W(L.args,1,["n","times"]),I)));if(T==="str.trim")return zT(p(W(L.args,0,["source"]),I));if(T==="str.split"){let _=HT(p(W(L.args,0,["source"]),I),p(W(L.args,1,["separator","sep"]),I));return _==null?K:t0(_)}if(T==="str.tonumber"||T==="tonumber")return VT(p(W(L.args,0,["source","string"]),I));if(T==="tostring"){let _=Z(W(L.args,0,["value","source"]),I);return typeof _==="string"?_:r5(Y(_))}if(T==="str.pos")return FT(p(W(L.args,0,["source"]),I),p(W(L.args,1,["str","substr"]),I));if(T==="str.match")return qT(p(W(L.args,0,["source"]),I),p(W(L.args,1,["regex","pattern"]),I));if(T==="str.format_time")return kT(Y(Z(W(L.args,0,["time","timestamp"]),I))??Z(W(L.args,0,["time","timestamp"]),I),p(W(L.args,1,["format"]),I),p(W(L.args,2,["timezone"]),I));if(T==="str.format"){let _=p(W(L.args,0,["formatString","format"]),I),R=$0(L.args).slice(1).map(($)=>{let G=Z($.value,I);return typeof G==="string"?G:Y(G)});return MT(_,...R)}if(T==="str.join"){let _=Z(W(L.args,0,["array","parts"]),I),R=p(W(L.args,1,["separator","sep"]),I),$=J3(_)?_.elts.map((G)=>typeof G==="string"?G:G==null?null:String(Y(G))):null;return $?ET($,R):K}return}function e5(T){if(T==null)return[];return Array.isArray(T)?T:[T]}function V6(T){if(T==null)return[];return Array.isArray(T)?T:[T]}function N_(T,L){if(L.barIndex!==0)return;let I={__udf:!0,params:e5(T.args),body:V6(T.body)};if(L.udfs.set(T.name,I),T.export)L.pendingExports.set(T.name,I);if(T.method){let _=e5(T.args)[0],R=w_(_?.type??null),$=R!=null?c1(L,R):void 0;if($ instanceof m0)$.addMethod(T.name,{name:T.name,params:e5(T.args).map((G)=>({name:G.name})),body:I,exported:Boolean(T.export)})}}function y_(T,L){if(L.barIndex!==0)return;let I=[];for(let R of V6(T.body)){if(R.kind!=="Assign")continue;let $=R;if($.target.kind!=="Name")continue;I.push({name:$.target.id,default:$.value==null?null:Z($.value,L)})}let _=J9(T.name,I);if(j0(L,T.name,_),T.export)L.pendingExports.set(T.name,_)}function b_(T,L){if(L.barIndex!==0)return;let I=[];for(let R of V6(T.body))if(R.kind==="Assign"){let $=R.target;if($.kind==="Name")I.push($.id)}else if(R.kind==="Expr"&&R.value?.kind==="Name")I.push(R.value.id);let _=Z9(T.name,I);if(j0(L,T.name,_),T.export)L.pendingExports.set(T.name,_)}function h_(T,L){let I=T.udfSites.get(L);if(!I)I={ctx:{},series:new Map,varInited:new Set},T.udfSites.set(L,I);for(let _ of I.varInited){let R=I.series.get(_);if(R==null)continue;while(R.length<T.barIndex)R.push(R.current);if(R.length===T.barIndex)R.push(R.current);I.ctx[_]=R.current}T.frames.push(I)}function w_(T){if(T==null)return null;if(T.kind==="Name")return T.id;if(T.kind==="Attribute")return T.attr;return null}function G3(T,L,I,_){let R=$0(L.args),$=new Set;h_(I,O3(L,I));try{let G=0;if(_!==void 0){let U=T.params[G++];if(U)j0(I,U.name,_),$.add(U.name)}for(let U of R){if(q0(U)!=null)continue;let O=T.params[G++];if(O)j0(I,O.name,Z(U.value,I)),$.add(O.name)}for(let U of R){let O=q0(U);if(O==null)continue;if(T.params.some((J)=>J.name===O))j0(I,O,Z(H6(U),I)),$.add(O)}for(let U of T.params)if(!$.has(U.name)&&U.default!=null)j0(I,U.name,Z(U.default,I));let Q=K;for(let U of T.body){let O=U1(U,I);if(U.kind==="Expr"||U.kind==="Assign"||U.kind==="ReAssign")Q=O}return Q}finally{I.frames.pop()}}function c2(T){return typeof T==="object"&&T!==null&&T.__udf===!0}function A_(T,L,I){if(T==="timestamp"){let R=$0(L.args).map(($)=>{let G=Z($.value,I);return typeof G==="string"?G:Y(G)});return m5(...R)}let _=T==="year"||T==="month"||T==="dayofmonth"||T==="dayofweek"||T==="hour"||T==="minute"||T==="second"?T:null;if(_!=null){let R=T3(L,I);if(R==null)return K;return K6(R)[_]}if(T==="weekofyear"){let R=T3(L,I);return R==null?K:d5(R)}if(T==="time_tradingday"){let R=T3(L,I);return R==null?K:l5(R)}return}function T3(T,L){let I=W(T.args,0,["time","timestamp"]);if(I==null)return V(L.ctx.time);return Y(Z(I,L))}function u_(T,L,I,_){let R=T.get(L);if(R===void 0){let $=G1[L];if($)return pT($,I,_);return K}if(c2(R))return G3(R,I,_);if(typeof R==="function")return pT(R,I,_);return R}function pT(T,L,I){let _=[],R={};for(let G of $0(L.args)){let Q=q0(G),U=Z(G.value,I),O=typeof U==="string"?U:Y(U);if(Q)R[Q]=O;else _.push(O)}let $=Object.keys(R).length>0?T(_,R):T(..._);if($==null)return K;if(typeof $==="number"&&Number.isFinite($))return $;if(typeof $==="string")return $;if(Array.isArray($)&&$.every((G)=>typeof G==="number"&&Number.isFinite(G)))return t0($.map((G)=>G));return K}function g_(T,L){if(L.barIndex!==0)return;let I=T.alias||T.name,_=L.libraries.lookup({namespace:T.namespace,name:T.name,version:T.version});if(_==null){let R=L.libraries.getSource(T.namespace,T.name,T.version);if(R!=null){if(f_(L,R,T.name),_=L.libraries.lookup({namespace:T.namespace,name:T.name,version:T.version}),_==null){if(_=L.libraries.lookup({name:T.name}),_!=null)_.namespace=T.namespace,_.version=T.version,L.libraries.register(_)}}}if(_==null){let R=v5(T.name);R.namespace=T.namespace,R.version=T.version,j0(L,I,R);return}if(_.namespace==null)_.namespace=T.namespace;if(_.version==null)_.version=T.version;j0(L,I,_)}function f_(T,L,I){let _;try{_=V2(L)}catch{return}if(_.kind!=="Script")return;let R=_,$=new Map(T.pendingExports);T.pendingExports.clear();let G=null;for(let U of R.body){let O=iT(U);if(O){if(O.kind==="library"&&O.name)G=O.name;continue}let J=U.kind;if(J==="FunctionDef"||J==="TypeDef"||J==="EnumDef"||J==="Import"||J==="Assign")U1(U,T)}let Q=G??I;if(Q)rT(T,Q);T.pendingExports=$}function rT(T,L){let _=T.libraries.lookup({name:L})??new H1(L);for(let[R,$]of T.pendingExports)if(c2($))_.exportFn(R,$);else if($ instanceof m0)$.isExported=!0,_.exportType(R,$);else if($ instanceof g1)_.exportEnum(R,$);else _.setExport(R,$);T.libraries.register(_),T.pendingExports.clear()}class F6 extends Error{status;constructor(T,L){super(T);this.name="ProviderError",this.status=L}}class sT{bars;constructor(T){this.bars=T}async fetch(T){let L=T.limit;if(L==null||L>=this.bars.length)return this.bars.slice();return this.bars.slice(-L)}}class aT{feeds;constructor(T){this.feeds=T}async fetch(T){let L=T.timeframe,I=L!=null&&L!==""?`${T.symbol}:${L}`:void 0,_=(I!==void 0?this.feeds[I]:void 0)??this.feeds[T.symbol]??[];return TL(_,T.limit)}}class nT{url;fetchImpl;mapFn;headers;fetchBars;constructor(T){this.url=T.url,this.fetchImpl=T.fetch??globalThis.fetch.bind(globalThis),this.mapFn=T.map??tT,this.headers=T.headers,this.fetchBars=T.fetchBars}async fetch(T){let L=this.fetchBars?await this.fetchBars(T):await this.getJson(T);return TL(this.mapFn(L),T.limit)}async getJson(T){if(this.url==null)throw new F6("JsonBarProvider requires `url` or `fetchBars`");let L=this.url(T),I=await this.fetchImpl(L,{method:"GET",headers:this.headers});if(!I.ok)throw new F6(`HTTP ${I.status}${I.statusText?` ${I.statusText}`:""}`.trim(),I.status);try{return await I.json()}catch(_){let R=_ instanceof Error?_.message:String(_);throw new F6(`invalid JSON: ${R}`,I.status)}}}var p_=["open","high","low","close","volume","time"];function tT(T){let L=x_(T);if(L==null)return[];let I=[];for(let _ of L){let R=c_(_);if(R!=null)I.push(R)}return I}function x_(T){if(Array.isArray(T))return T;if(T!=null&&typeof T==="object"){let L=T;if(Array.isArray(L.bars))return L.bars;if(Array.isArray(L.data))return L.data}return null}function c_(T){if(T==null||typeof T!=="object")return null;if(Array.isArray(T))return m_(T);let L=T,I={};return P0(I,"time",L.time??L.t),P0(I,"open",L.open??L.o),P0(I,"high",L.high??L.h),P0(I,"low",L.low??L.l),P0(I,"close",L.close??L.c),P0(I,"volume",L.volume??L.v),eT(I)?I:null}function m_(T){if(T.length<5)return null;let L={};if(P0(L,"time",T[0]),P0(L,"open",T[1]),P0(L,"high",T[2]),P0(L,"low",T[3]),P0(L,"close",T[4]),T.length>5)P0(L,"volume",T[5]);return eT(L)?L:null}function P0(T,L,I){let _=l_(I);if(_===void 0)return;T[L]=L==="time"?d_(_):_}function d_(T){return T<1000000000000?T*1000:T}function l_(T){return typeof T==="number"&&Number.isFinite(T)?T:void 0}function eT(T){return p_.some((L)=>T[L]!==void 0)}function TL(T,L){if(L==null||L>=T.length)return T.slice();return T.slice(-L)}export{d5 as weekOfYear,K6 as utcPartsFromMs,r8 as unparse,yL as tokenize,p5 as timestampFromComponents,m5 as timestamp,l5 as timeTradingDay,C5 as tickerStandard,P5 as tickerRenko,b5 as tickerPointfigure,E5 as tickerNew,h5 as tickerModify,y5 as tickerLinebreak,N5 as tickerKagi,j5 as tickerHeikinashi,k5 as runtimeError,x5 as parseTimestampString,V2 as parse,tT as mapJsonBars,xT as interpretTree,bI as interpret,g4 as dump,v5 as createStubModule,JI as applyStubExport,m0 as UdtType,R1 as UdtInstance,I0 as TickerId,u2 as TaEngine,aT as StaticMapProvider,G1 as STUB_KNOWN_EXPORTS,U3 as RuntimeStream,q5 as RuntimeError,Q3 as Runtime,F6 as ProviderError,J6 as PinescriptSyntaxError,p1 as PineSeries,e as PineMatrix,V1 as PineMap,G0 as PineArray,K as NA,sT as MemoryProvider,C2 as LogBook,X6 as LibraryRegistry,H1 as LibraryModule,nT as JsonBarProvider,g1 as EnumType,$1 as EnumMember,j2 as DrawingBook};