(function($,de){typeof exports=="object"&&typeof module<"u"?de(exports,require("uglify-js")):typeof define=="function"&&define.amd?define(["exports","uglify-js"],de):($=typeof globalThis<"u"?globalThis:$||self,de($["prettier-plugin-edgejs"]={},$["uglify-js"]))})(this,function($,de){"use strict";var Gm=Object.defineProperty;var Bm=($,de,et)=>de in $?Gm($,de,{enumerable:!0,configurable:!0,writable:!0,value:et}):$[de]=et;var qe=($,de,et)=>Bm($,typeof de!="symbol"?de+"":de,et);var et=t=>{throw TypeError(t)},ri=(t,e,r)=>e.has(t)||et("Cannot "+r),pa=(t,e,r)=>(ri(t,e,"read from private field"),r?r.call(t):e.get(t)),ni=(t,e,r)=>e.has(t)?et("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),ii=(t,e,r)=>(ri(t,e,"access private method"),r),si=typeof global=="object"&&global&&global.Object===Object&&global,da=typeof self=="object"&&self&&self.Object===Object&&self,Ne=si||da||Function("return this")(),Te=Ne.Symbol,oi=Object.prototype,ma=oi.hasOwnProperty,ga=oi.toString,Et=Te?Te.toStringTag:void 0;function va(t){var e=ma.call(t,Et),r=t[Et];try{t[Et]=void 0;var n=!0}catch{}var i=ga.call(t);return n&&(e?t[Et]=r:delete t[Et]),i}var Ea=Object.prototype,Ta=Ea.toString;function _a(t){return Ta.call(t)}var ya="[object Null]",Aa="[object Undefined]",ai=Te?Te.toStringTag:void 0;function Ye(t){return t==null?t===void 0?Aa:ya:ai&&ai in Object(t)?va(t):_a(t)}function Oe(t){return t!=null&&typeof t=="object"}var Sa="[object Symbol]";function Gt(t){return typeof t=="symbol"||Oe(t)&&Ye(t)==Sa}function Bt(t,e){for(var r=-1,n=t==null?0:t.length,i=Array(n);++r0){if(++e>=tc)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function sc(t){return function(){return t}}var Wt=function(){try{var t=rt(Object,"defineProperty");return t({},"",{}),t}catch{}}(),oc=Wt?function(t,e){return Wt(t,"toString",{configurable:!0,enumerable:!1,value:sc(e),writable:!0})}:ut,ac=ic(oc);function di(t,e){for(var r=-1,n=t==null?0:t.length;++r-1}var lc=9007199254740991,hc=/^(?:0|[1-9]\d*)$/;function Kt(t,e){var r=typeof t;return e=e??lc,!!e&&(r=="number"||r!="symbol"&&hc.test(t))&&t>-1&&t%1==0&&t-1&&t%1==0&&t<=mc}function Pe(t){return t!=null&&Gr(t.length)&&!$e(t)}function Ei(t,e,r){if(!_e(r))return!1;var n=typeof e;return(n=="number"?Pe(r)&&Kt(e,r.length):n=="string"&&e in r)?Tt(r[e],t):!1}function gc(t){return $r(function(e,r){var n=-1,i=r.length,s=i>1?r[i-1]:void 0,o=i>2?r[2]:void 0;for(s=t.length>3&&typeof s=="function"?(i--,s):void 0,o&&Ei(r[0],r[1],o)&&(s=i<3?void 0:s,i=1),e=Object(e);++n-1}function Iu(t,e){var r=this.__data__,n=Yt(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}function Ge(t){var e=-1,r=t==null?0:t.length;for(this.clear();++ei?0:i+e),r=r>i?i:r,r<0&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0;for(var s=Array(i);++nc))return!1;var u=s.get(t),l=s.get(e);if(u&&l)return u==e&&l==t;var h=-1,m=!0,p=r&yh?new ht:void 0;for(s.set(t,e),s.set(e,t);++h2?e[2]:void 0;for(i&&Ei(e[0],e[1],i)&&(n=1);++r=ff&&(s=en,o=!1,e=new ht(e));e:for(;++i-1?i[s?e[o]:o]:void 0}}var Ef=Math.max;function Tf(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var i=r==null?0:Vt(r);return i<0&&(i=Ef(n+i,0)),mi(t,xe(e),i)}var pt=vf(Tf);function Ce(t){return t&&t.length?t[0]:void 0}function _f(t,e){var r=-1,n=Pe(t)?Array(t.length):[];return it(t,function(i,s,o){n[++r]=e(i,s,o)}),n}function C(t,e){var r=j(t)?Bt:_f;return r(t,xe(e))}function Re(t,e){return qr(C(t,e))}var yf=Object.prototype,Af=yf.hasOwnProperty,Sf=lf(function(t,e,r){Af.call(t,r)?t[r].push(e):Fr(t,r,[e])}),Rf=Object.prototype,Of=Rf.hasOwnProperty;function Lf(t,e){return t!=null&&Of.call(t,e)}function M(t,e){return t!=null&&os(t,e,Lf)}var If="[object String]";function he(t){return typeof t=="string"||!j(t)&&Oe(t)&&Ye(t)==If}function Cf(t,e){return Bt(e,function(r){return t[r]})}function te(t){return t==null?[]:Cf(t,ye(t))}var Mf=Math.max;function ce(t,e,r,n){t=Pe(t)?t:te(t),r=r?Vt(r):0;var i=t.length;return r<0&&(r=Mf(i+r,0)),he(t)?r<=i&&t.indexOf(e,r)>-1:!!i&&Dr(t,e,r)>-1}function ls(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var i=0;return Dr(t,e,i)}var bf="[object Map]",kf="[object Set]",Nf=Object.prototype,Pf=Nf.hasOwnProperty;function H(t){if(t==null)return!0;if(Pe(t)&&(j(t)||typeof t=="string"||typeof t.splice=="function"||yt(t)||Vr(t)||zt(t)))return!t.length;var e=Ae(t);if(e==bf||e==kf)return!t.size;if(_t(t))return!Ci(t).length;for(var r in t)if(Pf.call(t,r))return!1;return!0}var wf="[object RegExp]";function xf(t){return Oe(t)&&Ye(t)==wf}var hs=Xe&&Xe.isRegExp,Ve=hs?qt(hs):xf;function We(t){return t===void 0}var Uf="Expected a function";function Df(t){if(typeof t!="function")throw new TypeError(Uf);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}function Ff(t,e,r,n){if(!_e(t))return t;e=Qt(e,t);for(var i=-1,s=e.length,o=s-1,c=t;c!=null&&++i=Wf){var u=Vf(t);if(u)return tn(u);o=!1,i=en,a=new ht}else a=c;e:for(;++n{r.accept(e)})}}class ve extends Ue{constructor(e){super([]),this.idx=1,me(this,Me(e,r=>r!==void 0))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}}class dt extends Ue{constructor(e){super(e.definition),this.orgText="",me(this,Me(e,r=>r!==void 0))}}class fe extends Ue{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,me(this,Me(e,r=>r!==void 0))}}class pe extends Ue{constructor(e){super(e.definition),this.idx=1,me(this,Me(e,r=>r!==void 0))}}class De extends Ue{constructor(e){super(e.definition),this.idx=1,me(this,Me(e,r=>r!==void 0))}}class Fe extends Ue{constructor(e){super(e.definition),this.idx=1,me(this,Me(e,r=>r!==void 0))}}class re extends Ue{constructor(e){super(e.definition),this.idx=1,me(this,Me(e,r=>r!==void 0))}}class be extends Ue{constructor(e){super(e.definition),this.idx=1,me(this,Me(e,r=>r!==void 0))}}class ke extends Ue{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,me(this,Me(e,r=>r!==void 0))}}class X{constructor(e){this.idx=1,me(this,Me(e,r=>r!==void 0))}accept(e){e.visit(this)}}function qf(t){return C(t,nr)}function nr(t){function e(r){return C(r,nr)}if(t instanceof ve){const r={type:"NonTerminal",name:t.nonTerminalName,idx:t.idx};return he(t.label)&&(r.label=t.label),r}else{if(t instanceof fe)return{type:"Alternative",definition:e(t.definition)};if(t instanceof pe)return{type:"Option",idx:t.idx,definition:e(t.definition)};if(t instanceof De)return{type:"RepetitionMandatory",idx:t.idx,definition:e(t.definition)};if(t instanceof Fe)return{type:"RepetitionMandatoryWithSeparator",idx:t.idx,separator:nr(new X({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof be)return{type:"RepetitionWithSeparator",idx:t.idx,separator:nr(new X({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof re)return{type:"Repetition",idx:t.idx,definition:e(t.definition)};if(t instanceof ke)return{type:"Alternation",idx:t.idx,definition:e(t.definition)};if(t instanceof X){const r={type:"Terminal",name:t.terminalType.name,label:Hf(t.terminalType),idx:t.idx};he(t.label)&&(r.terminalLabel=t.label);const n=t.terminalType.PATTERN;return t.terminalType.PATTERN&&(r.pattern=Ve(n)?n.source:n),r}else{if(t instanceof dt)return{type:"Rule",name:t.name,orgText:t.orgText,definition:e(t.definition)};throw Error("non exhaustive match")}}}class mt{visit(e){const r=e;switch(r.constructor){case ve:return this.visitNonTerminal(r);case fe:return this.visitAlternative(r);case pe:return this.visitOption(r);case De:return this.visitRepetitionMandatory(r);case Fe:return this.visitRepetitionMandatoryWithSeparator(r);case be:return this.visitRepetitionWithSeparator(r);case re:return this.visitRepetition(r);case ke:return this.visitAlternation(r);case X:return this.visitTerminal(r);case dt:return this.visitRule(r);default:throw Error("non exhaustive match")}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}}function Yf(t){return t instanceof fe||t instanceof pe||t instanceof re||t instanceof De||t instanceof Fe||t instanceof be||t instanceof X||t instanceof dt}function ir(t,e=[]){return t instanceof pe||t instanceof re||t instanceof be?!0:t instanceof ke?fs(t.definition,r=>ir(r,e)):t instanceof ve&&ce(e,t)?!1:t instanceof Ue?(t instanceof ve&&e.push(t),Ie(t.definition,r=>ir(r,e))):!1}function Xf(t){return t instanceof ke}function je(t){if(t instanceof ve)return"SUBRULE";if(t instanceof pe)return"OPTION";if(t instanceof ke)return"OR";if(t instanceof De)return"AT_LEAST_ONE";if(t instanceof Fe)return"AT_LEAST_ONE_SEP";if(t instanceof be)return"MANY_SEP";if(t instanceof re)return"MANY";if(t instanceof X)return"CONSUME";throw Error("non exhaustive match")}class sr{walk(e,r=[]){k(e.definition,(n,i)=>{const s=oe(e.definition,i+1);if(n instanceof ve)this.walkProdRef(n,s,r);else if(n instanceof X)this.walkTerminal(n,s,r);else if(n instanceof fe)this.walkFlat(n,s,r);else if(n instanceof pe)this.walkOption(n,s,r);else if(n instanceof De)this.walkAtLeastOne(n,s,r);else if(n instanceof Fe)this.walkAtLeastOneSep(n,s,r);else if(n instanceof be)this.walkManySep(n,s,r);else if(n instanceof re)this.walkMany(n,s,r);else if(n instanceof ke)this.walkOr(n,s,r);else throw Error("non exhaustive match")})}walkTerminal(e,r,n){}walkProdRef(e,r,n){}walkFlat(e,r,n){const i=r.concat(n);this.walk(e,i)}walkOption(e,r,n){const i=r.concat(n);this.walk(e,i)}walkAtLeastOne(e,r,n){const i=[new pe({definition:e.definition})].concat(r,n);this.walk(e,i)}walkAtLeastOneSep(e,r,n){const i=gs(e,r,n);this.walk(e,i)}walkMany(e,r,n){const i=[new pe({definition:e.definition})].concat(r,n);this.walk(e,i)}walkManySep(e,r,n){const i=gs(e,r,n);this.walk(e,i)}walkOr(e,r,n){const i=r.concat(n);k(e.definition,s=>{const o=new fe({definition:[s]});this.walk(o,i)})}}function gs(t,e,r){return[new pe({definition:[new X({terminalType:t.separator})].concat(t.definition)})].concat(e,r)}function Ct(t){if(t instanceof ve)return Ct(t.referencedRule);if(t instanceof X)return Zf(t);if(Yf(t))return Qf(t);if(Xf(t))return Jf(t);throw Error("non exhaustive match")}function Qf(t){let e=[];const r=t.definition;let n=0,i=r.length>n,s,o=!0;for(;i&&o;)s=r[n],o=ir(s),e=e.concat(Ct(s)),n=n+1,i=r.length>n;return on(e)}function Jf(t){const e=C(t.definition,r=>Ct(r));return on(Le(e))}function Zf(t){return[t.terminalType]}const vs="_~IN~_";class ep extends sr{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,r,n){}walkProdRef(e,r,n){const i=rp(e.referencedRule,e.idx)+this.topProd.name,s=r.concat(n),o=new fe({definition:s}),c=Ct(o);this.follows[i]=c}}function tp(t){const e={};return k(t,r=>{const n=new ep(r).startWalking();me(e,n)}),e}function rp(t,e){return t.name+e+vs}function P(t){return t.charCodeAt(0)}function cn(t,e){Array.isArray(t)?t.forEach(function(r){e.push(r)}):e.push(t)}function Mt(t,e){if(t[e]===!0)throw"duplicate flag "+e;t[e],t[e]=!0}function gt(t){if(t===void 0)throw Error("Internal Error - Should never get here!");return!0}function np(){throw Error("Internal Error - Should never get here!")}function Es(t){return t.type==="Character"}const or=[];for(let t=P("0");t<=P("9");t++)or.push(t);const ar=[P("_")].concat(or);for(let t=P("a");t<=P("z");t++)ar.push(t);for(let t=P("A");t<=P("Z");t++)ar.push(t);const Ts=[P(" "),P("\f"),P(` `),P("\r"),P(" "),P("\v"),P(" "),P(" "),P(" "),P(" "),P(" "),P(" "),P(" "),P(" "),P(" "),P(" "),P(" "),P(" "),P(" "),P(" "),P("\u2028"),P("\u2029"),P(" "),P(" "),P(" "),P("\uFEFF")],ip=/[0-9a-fA-F]/,cr=/[0-9]/,sp=/[1-9]/;class op{constructor(){this.idx=0,this.input="",this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar("/");const r=this.disjunction();this.consumeChar("/");const n={type:"Flags",loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":Mt(n,"global");break;case"i":Mt(n,"ignoreCase");break;case"m":Mt(n,"multiLine");break;case"u":Mt(n,"unicode");break;case"y":Mt(n,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:n,value:r,loc:this.loc(0)}}disjunction(){const e=[],r=this.idx;for(e.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(r)}}alternative(){const e=[],r=this.idx;for(;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(r)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){const e=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(e)};case"$":return{type:"EndAnchor",loc:this.loc(e)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(e)};case"B":return{type:"NonWordBoundary",loc:this.loc(e)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");let r;switch(this.popChar()){case"=":r="Lookahead";break;case"!":r="NegativeLookahead";break}gt(r);const n=this.disjunction();return this.consumeChar(")"),{type:r,value:n,loc:this.loc(e)}}return np()}quantifier(e=!1){let r;const n=this.idx;switch(this.popChar()){case"*":r={atLeast:0,atMost:1/0};break;case"+":r={atLeast:1,atMost:1/0};break;case"?":r={atLeast:0,atMost:1};break;case"{":const i=this.integerIncludingZero();switch(this.popChar()){case"}":r={atLeast:i,atMost:i};break;case",":let s;this.isDigit()?(s=this.integerIncludingZero(),r={atLeast:i,atMost:s}):r={atLeast:i,atMost:1/0},this.consumeChar("}");break}if(e===!0&&r===void 0)return;gt(r);break}if(!(e===!0&&r===void 0)&>(r))return this.peekChar(0)==="?"?(this.consumeChar("?"),r.greedy=!1):r.greedy=!0,r.type="Quantifier",r.loc=this.loc(n),r}atom(){let e;const r=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group();break}if(e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),gt(e))return e.loc=this.loc(r),this.isQuantifier()&&(e.quantifier=this.quantifier()),e}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[P(` `),P("\r"),P("\u2028"),P("\u2029")]}}atomEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:"GroupBackReference",value:this.positiveInteger()}}characterClassEscape(){let e,r=!1;switch(this.popChar()){case"d":e=or;break;case"D":e=or,r=!0;break;case"s":e=Ts;break;case"S":e=Ts,r=!0;break;case"w":e=ar;break;case"W":e=ar,r=!0;break}if(gt(e))return{type:"Set",value:e,complement:r}}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=P("\f");break;case"n":e=P(` `);break;case"r":e=P("\r");break;case"t":e=P(" ");break;case"v":e=P("\v");break}if(gt(e))return{type:"Character",value:e}}controlLetterEscapeAtom(){this.consumeChar("c");const e=this.popChar();if(/[a-zA-Z]/.test(e)===!1)throw Error("Invalid ");return{type:"Character",value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:P("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){const e=this.popChar();return{type:"Character",value:P(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case` `:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:const e=this.popChar();return{type:"Character",value:P(e)}}}characterClass(){const e=[];let r=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),r=!0);this.isClassAtom();){const n=this.classAtom();if(n.type,Es(n)&&this.isRangeDash()){this.consumeChar("-");const i=this.classAtom();if(i.type,Es(i)){if(i.value=this.input.length)throw Error("Unexpected end of input");this.idx++}loc(e){return{begin:e,end:this.idx}}}class un{visitChildren(e){for(const r in e){const n=e[r];e.hasOwnProperty(r)&&(n.type!==void 0?this.visit(n):Array.isArray(n)&&n.forEach(i=>{this.visit(i)},this))}}visit(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e);break}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}}let ur={};const ap=new op;function lr(t){const e=t.toString();if(ur.hasOwnProperty(e))return ur[e];{const r=ap.pattern(e);return ur[e]=r,r}}function cp(){ur={}}const _s="Complement Sets are not supported for first char optimization",hr=`Unable to use "first char" lexer optimizations: `;function up(t,e=!1){try{const r=lr(t);return ln(r.value,{},r.flags.ignoreCase)}catch(r){if(r.message===_s)e&&ps(`${hr} Unable to optimize: < ${t.toString()} > Complement Sets cannot be automatically optimized. This will disable the lexer's first char optimizations. See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let n="";e&&(n=` This will disable the lexer's first char optimizations. See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),an(`${hr} Failed parsing: < ${t.toString()} > Using the @chevrotain/regexp-to-ast library Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+n)}}return[]}function ln(t,e,r){switch(t.type){case"Disjunction":for(let i=0;i{if(typeof a=="number")fr(a,e,r);else{const u=a;if(r===!0)for(let l=u.from;l<=u.to;l++)fr(l,e,r);else{for(let l=u.from;l<=u.to&&l=kt){const l=u.from>=kt?u.from:kt,h=u.to,m=Qe(l),p=Qe(h);for(let d=m;d<=p;d++)e[d]=d}}}});break;case"Group":ln(o.value,e,r);break;default:throw Error("Non Exhaustive Match")}const c=o.quantifier!==void 0&&o.quantifier.atLeast===0;if(o.type==="Group"&&hn(o)===!1||o.type!=="Group"&&c===!1)break}break;default:throw Error("non exhaustive match!")}return te(e)}function fr(t,e,r){const n=Qe(t);e[n]=n,r===!0&&lp(t,e)}function lp(t,e){const r=String.fromCharCode(t),n=r.toUpperCase();if(n!==r){const i=Qe(n.charCodeAt(0));e[i]=i}else{const i=r.toLowerCase();if(i!==r){const s=Qe(i.charCodeAt(0));e[s]=s}}}function ys(t,e){return pt(t.value,r=>{if(typeof r=="number")return ce(e,r);{const n=r;return pt(e,i=>n.from<=i&&i<=n.to)!==void 0}})}function hn(t){const e=t.quantifier;return e&&e.atLeast===0?!0:t.value?j(t.value)?Ie(t.value,hn):hn(t.value):!1}class hp extends un{constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(this.found!==!0){switch(e.type){case"Lookahead":this.visitLookahead(e);return;case"NegativeLookahead":this.visitNegativeLookahead(e);return}super.visitChildren(e)}}visitCharacter(e){ce(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?ys(e,this.targetCharCodes)===void 0&&(this.found=!0):ys(e,this.targetCharCodes)!==void 0&&(this.found=!0)}}function fn(t,e){if(e instanceof RegExp){const r=lr(e),n=new hp(t);return n.visit(r),n.found}else return pt(e,r=>ce(t,r.charCodeAt(0)))!==void 0}const st="PATTERN",bt="defaultMode",pr="modes";let As=typeof new RegExp("(?:)").sticky=="boolean";function fp(t,e){e=sn(e,{useSticky:As,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",` `],tracer:(E,T)=>T()});const r=e.tracer;r("initCharCodeToOptimizedIndexMap",()=>{xp()});let n;r("Reject Lexer.NA",()=>{n=rr(t,E=>E[st]===ue.NA)});let i=!1,s;r("Transform Patterns",()=>{i=!1,s=C(n,E=>{const T=E[st];if(Ve(T)){const f=T.source;return f.length===1&&f!=="^"&&f!=="$"&&f!=="."&&!T.ignoreCase?f:f.length===2&&f[0]==="\\"&&!ce(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],f[1])?f[1]:e.useSticky?Rs(T):Ss(T)}else{if($e(T))return i=!0,{exec:T};if(typeof T=="object")return i=!0,T;if(typeof T=="string"){if(T.length===1)return T;{const f=T.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),v=new RegExp(f);return e.useSticky?Rs(v):Ss(v)}}else throw Error("non exhaustive match")}})});let o,c,a,u,l;r("misc mapping",()=>{o=C(n,E=>E.tokenTypeIdx),c=C(n,E=>{const T=E.GROUP;if(T!==ue.SKIPPED){if(he(T))return T;if(We(T))return!1;throw Error("non exhaustive match")}}),a=C(n,E=>{const T=E.LONGER_ALT;if(T)return j(T)?C(T,f=>ls(n,f)):[ls(n,T)]}),u=C(n,E=>E.PUSH_MODE),l=C(n,E=>M(E,"POP_MODE"))});let h;r("Line Terminator Handling",()=>{const E=Is(e.lineTerminatorCharacters);h=C(n,T=>!1),e.positionTracking!=="onlyOffset"&&(h=C(n,T=>M(T,"LINE_BREAKS")?!!T.LINE_BREAKS:Ls(T,E)===!1&&fn(E,T.PATTERN)))});let m,p,d,g;r("Misc Mapping #2",()=>{m=C(n,Os),p=C(s,Np),d=ge(n,(E,T)=>{const f=T.GROUP;return he(f)&&f!==ue.SKIPPED&&(E[f]=[]),E},{}),g=C(s,(E,T)=>({pattern:s[T],longerAlt:a[T],canLineTerminator:h[T],isCustom:m[T],short:p[T],group:c[T],push:u[T],pop:l[T],tokenTypeIdx:o[T],tokenType:n[T]}))});let _=!0,y=[];return e.safeMode||r("First Char Optimization",()=>{y=ge(n,(E,T,f)=>{if(typeof T.PATTERN=="string"){const v=T.PATTERN.charCodeAt(0),R=Qe(v);pn(E,R,g[f])}else if(j(T.START_CHARS_HINT)){let v;k(T.START_CHARS_HINT,R=>{const S=typeof R=="string"?R.charCodeAt(0):R,D=Qe(S);v!==D&&(v=D,pn(E,D,g[f]))})}else if(Ve(T.PATTERN))if(T.PATTERN.unicode)_=!1,e.ensureOptimizations&&an(`${hr} Unable to analyze < ${T.PATTERN.toString()} > pattern. The regexp unicode flag is not currently supported by the regexp-to-ast library. This will disable the lexer's first char optimizations. For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{const v=up(T.PATTERN,e.ensureOptimizations);H(v)&&(_=!1),k(v,R=>{pn(E,R,g[f])})}else e.ensureOptimizations&&an(`${hr} TokenType: <${T.name}> is using a custom token pattern without providing parameter. This will disable the lexer's first char optimizations. For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),_=!1;return E},[])}),{emptyGroups:d,patternIdxToConfig:g,charCodeToPatternIdxToConfig:y,hasCustom:i,canBeOptimized:_}}function pp(t,e){let r=[];const n=mp(t);r=r.concat(n.errors);const i=gp(n.valid),s=i.valid;return r=r.concat(i.errors),r=r.concat(dp(s)),r=r.concat(Rp(s)),r=r.concat(Op(s,e)),r=r.concat(Lp(s)),r}function dp(t){let e=[];const r=Se(t,n=>Ve(n[st]));return e=e.concat(Ep(r)),e=e.concat(yp(r)),e=e.concat(Ap(r)),e=e.concat(Sp(r)),e=e.concat(Tp(r)),e}function mp(t){const e=Se(t,i=>!M(i,st)),r=C(e,i=>({message:"Token Type: ->"+i.name+"<- missing static 'PATTERN' property",type:J.MISSING_PATTERN,tokenTypes:[i]})),n=tr(t,e);return{errors:r,valid:n}}function gp(t){const e=Se(t,i=>{const s=i[st];return!Ve(s)&&!$e(s)&&!M(s,"exec")&&!he(s)}),r=C(e,i=>({message:"Token Type: ->"+i.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:J.INVALID_PATTERN,tokenTypes:[i]})),n=tr(t,e);return{errors:r,valid:n}}const vp=/[^\\][$]/;function Ep(t){class e extends un{constructor(){super(...arguments),this.found=!1}visitEndAnchor(i){this.found=!0}}const r=Se(t,n=>{const i=n.PATTERN;try{const s=lr(i),o=new e;return o.visit(s),o.found}catch{return vp.test(i.source)}});return C(r,n=>({message:`Unexpected RegExp Anchor Error: Token Type: ->`+n.name+`<- static 'PATTERN' cannot contain end of input anchor '$' See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:J.EOI_ANCHOR_FOUND,tokenTypes:[n]}))}function Tp(t){const e=Se(t,r=>r.PATTERN.test(""));return C(e,r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' must not match an empty string",type:J.EMPTY_MATCH_PATTERN,tokenTypes:[r]}))}const _p=/[^\\[][\^]|^\^/;function yp(t){class e extends un{constructor(){super(...arguments),this.found=!1}visitStartAnchor(i){this.found=!0}}const r=Se(t,n=>{const i=n.PATTERN;try{const s=lr(i),o=new e;return o.visit(s),o.found}catch{return _p.test(i.source)}});return C(r,n=>({message:`Unexpected RegExp Anchor Error: Token Type: ->`+n.name+`<- static 'PATTERN' cannot contain start of input anchor '^' See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:J.SOI_ANCHOR_FOUND,tokenTypes:[n]}))}function Ap(t){const e=Se(t,r=>{const n=r[st];return n instanceof RegExp&&(n.multiline||n.global)});return C(e,r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:J.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[r]}))}function Sp(t){const e=[];let r=C(t,i=>ge(t,(s,o)=>(i.PATTERN.source===o.PATTERN.source&&!ce(e,o)&&o.PATTERN!==ue.NA&&(e.push(o),s.push(o)),s),[]));r=Lt(r);const n=Se(r,i=>i.length>1);return C(n,i=>{const s=C(i,o=>o.name);return{message:`The same RegExp pattern ->${Ce(i).PATTERN}<-has been used in all of the following Token Types: ${s.join(", ")} <-`,type:J.DUPLICATE_PATTERNS_FOUND,tokenTypes:i}})}function Rp(t){const e=Se(t,r=>{if(!M(r,"GROUP"))return!1;const n=r.GROUP;return n!==ue.SKIPPED&&n!==ue.NA&&!he(n)});return C(e,r=>({message:"Token Type: ->"+r.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:J.INVALID_GROUP_TYPE_FOUND,tokenTypes:[r]}))}function Op(t,e){const r=Se(t,n=>n.PUSH_MODE!==void 0&&!ce(e,n.PUSH_MODE));return C(r,n=>({message:`Token Type: ->${n.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${n.PUSH_MODE}<-which does not exist`,type:J.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[n]}))}function Lp(t){const e=[],r=ge(t,(n,i,s)=>{const o=i.PATTERN;return o===ue.NA||(he(o)?n.push({str:o,idx:s,tokenType:i}):Ve(o)&&Cp(o)&&n.push({str:o.source,idx:s,tokenType:i})),n},[]);return k(t,(n,i)=>{k(r,({str:s,idx:o,tokenType:c})=>{if(i${c.name}<- can never be matched. Because it appears AFTER the Token Type ->${n.name}<-in the lexer's definition. See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:a,type:J.UNREACHABLE_PATTERN,tokenTypes:[n,c]})}})}),e}function Ip(t,e){if(Ve(e)){const r=e.exec(t);return r!==null&&r.index===0}else{if($e(e))return e(t,0,[],{});if(M(e,"exec"))return e.exec(t,0,[],{});if(typeof e=="string")return e===t;throw Error("non exhaustive match")}}function Cp(t){return pt([".","\\","[","]","|","^","$","(",")","?","*","+","{"],e=>t.source.indexOf(e)!==-1)===void 0}function Ss(t){const e=t.ignoreCase?"i":"";return new RegExp(`^(?:${t.source})`,e)}function Rs(t){const e=t.ignoreCase?"iy":"y";return new RegExp(`${t.source}`,e)}function Mp(t,e,r){const n=[];return M(t,bt)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+bt+`> property in its definition `,type:J.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),M(t,pr)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+pr+`> property in its definition `,type:J.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),M(t,pr)&&M(t,bt)&&!M(t.modes,t.defaultMode)&&n.push({message:`A MultiMode Lexer cannot be initialized with a ${bt}: <${t.defaultMode}>which does not exist `,type:J.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),M(t,pr)&&k(t.modes,(i,s)=>{k(i,(o,c)=>{if(We(o))n.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${s}> at index: <${c}> `,type:J.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if(M(o,"LONGER_ALT")){const a=j(o.LONGER_ALT)?o.LONGER_ALT:[o.LONGER_ALT];k(a,u=>{!We(u)&&!ce(i,u)&&n.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${u.name}> on token <${o.name}> outside of mode <${s}> `,type:J.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),n}function bp(t,e,r){const n=[];let i=!1;const s=Lt(Le(te(t.modes))),o=rr(s,a=>a[st]===ue.NA),c=Is(r);return e&&k(o,a=>{const u=Ls(a,c);if(u!==!1){const l={message:wp(a,u),type:u.issue,tokenType:a};n.push(l)}else M(a,"LINE_BREAKS")?a.LINE_BREAKS===!0&&(i=!0):fn(c,a.PATTERN)&&(i=!0)}),e&&!i&&n.push({message:`Warning: No LINE_BREAKS Found. This Lexer has been defined to track line and column information, But none of the Token Types can be identified as matching a line terminator. See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS for details.`,type:J.NO_LINE_BREAKS_FLAGS}),n}function kp(t){const e={},r=ye(t);return k(r,n=>{const i=t[n];if(j(i))e[n]=[];else throw Error("non exhaustive match")}),e}function Os(t){const e=t.PATTERN;if(Ve(e))return!1;if($e(e)||M(e,"exec"))return!0;if(he(e))return!1;throw Error("non exhaustive match")}function Np(t){return he(t)&&t.length===1?t.charCodeAt(0):!1}const Pp={test:function(t){const e=t.length;for(let r=this.lastIndex;r Token Type Root cause: ${e.errMsg}. For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(e.issue===J.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the option. The problem is in the <${t.name}> Token Type For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}function Is(t){return C(t,e=>he(e)?e.charCodeAt(0):e)}function pn(t,e,r){t[e]===void 0?t[e]=[r]:t[e].push(r)}const kt=256;let dr=[];function Qe(t){return t255?255+~~(t/255):t}}function Nt(t,e){const r=t.tokenTypeIdx;return r===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[r]===!0}function mr(t,e){return t.tokenTypeIdx===e.tokenTypeIdx}let Cs=1;const Ms={};function Pt(t){const e=Up(t);Dp(e),jp(e),Fp(e),k(e,r=>{r.isParent=r.categoryMatches.length>0})}function Up(t){let e=se(t),r=t,n=!0;for(;n;){r=Lt(Le(C(r,s=>s.CATEGORIES)));const i=tr(r,e);e=e.concat(i),H(i)?n=!1:r=i}return e}function Dp(t){k(t,e=>{ks(e)||(Ms[Cs]=e,e.tokenTypeIdx=Cs++),Ns(e)&&!j(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),Ns(e)||(e.CATEGORIES=[]),$p(e)||(e.categoryMatches=[]),Gp(e)||(e.categoryMatchesMap={})})}function Fp(t){k(t,e=>{e.categoryMatches=[],k(e.categoryMatchesMap,(r,n)=>{e.categoryMatches.push(Ms[n].tokenTypeIdx)})})}function jp(t){k(t,e=>{bs([],e)})}function bs(t,e){k(t,r=>{e.categoryMatchesMap[r.tokenTypeIdx]=!0}),k(e.CATEGORIES,r=>{const n=t.concat(e);ce(n,r)||bs(n,r)})}function ks(t){return M(t,"tokenTypeIdx")}function Ns(t){return M(t,"CATEGORIES")}function $p(t){return M(t,"categoryMatches")}function Gp(t){return M(t,"categoryMatchesMap")}function Bp(t){return M(t,"tokenTypeIdx")}const Vp={buildUnableToPopLexerModeMessage(t){return`Unable to pop Lexer Mode after encountering Token ->${t.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(t,e,r,n,i){return`unexpected character: ->${t.charAt(e)}<- at offset: ${e}, skipped ${r} characters.`}};var J;(function(t){t[t.MISSING_PATTERN=0]="MISSING_PATTERN",t[t.INVALID_PATTERN=1]="INVALID_PATTERN",t[t.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",t[t.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",t[t.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",t[t.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",t[t.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",t[t.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",t[t.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",t[t.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",t[t.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",t[t.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",t[t.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",t[t.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",t[t.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",t[t.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",t[t.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",t[t.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"})(J||(J={}));const wt={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[` `,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:Vp,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(wt);class ue{constructor(e,r=wt){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(i,s)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;const o=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent <${i}>`);const{time:c,value:a}=ds(s),u=c>10?console.warn:console.log;return this.traceInitIndent time: ${c}ms`),this.traceInitIndent--,a}else return s()},typeof r=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object. a boolean 2nd argument is no longer supported`);this.config=me({},wt,r);const n=this.config.traceInitPerf;n===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof n=="number"&&(this.traceInitMaxIdent=n,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let i,s=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===wt.lineTerminatorsPattern)this.config.lineTerminatorsPattern=Pp;else if(this.config.lineTerminatorCharacters===wt.lineTerminatorCharacters)throw Error(`Error: Missing property on the Lexer config. For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(r.safeMode&&r.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');this.trackStartLines=/full|onlyStart/i.test(this.config.positionTracking),this.trackEndLines=/full/i.test(this.config.positionTracking),j(e)?i={modes:{defaultMode:se(e)},defaultMode:bt}:(s=!1,i=se(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(Mp(i,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(bp(i,this.trackStartLines,this.config.lineTerminatorCharacters))})),i.modes=i.modes?i.modes:{},k(i.modes,(c,a)=>{i.modes[a]=rr(c,u=>We(u))});const o=ye(i.modes);if(k(i.modes,(c,a)=>{this.TRACE_INIT(`Mode: <${a}> processing`,()=>{if(this.modes.push(a),this.config.skipValidations===!1&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(pp(c,o))}),H(this.lexerDefinitionErrors)){Pt(c);let u;this.TRACE_INIT("analyzeTokenTypes",()=>{u=fp(c,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:r.positionTracking,ensureOptimizations:r.ensureOptimizations,safeMode:r.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[a]=u.patternIdxToConfig,this.charCodeToPatternIdxToConfig[a]=u.charCodeToPatternIdxToConfig,this.emptyGroups=me({},this.emptyGroups,u.emptyGroups),this.hasCustom=u.hasCustom||this.hasCustom,this.canModeBeOptimized[a]=u.canBeOptimized}})}),this.defaultMode=i.defaultMode,!H(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){const c=C(this.lexerDefinitionErrors,a=>a.message).join(`----------------------- `);throw new Error(`Errors detected in definition of Lexer: `+c)}k(this.lexerDefinitionWarning,c=>{ps(c.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(As?(this.chopInput=ut,this.match=this.matchWithTest):(this.updateLastIndex=ee,this.match=this.matchWithExec),s&&(this.handleModes=ee),this.trackStartLines===!1&&(this.computeNewColumn=ut),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=ee),/full/i.test(this.config.positionTracking))this.createTokenInstance=this.createFullToken;else if(/onlyStart/i.test(this.config.positionTracking))this.createTokenInstance=this.createStartOnlyToken;else if(/onlyOffset/i.test(this.config.positionTracking))this.createTokenInstance=this.createOffsetOnlyToken;else throw Error(`Invalid config option: "${this.config.positionTracking}"`);this.hasCustom?(this.addToken=this.addTokenUsingPush,this.handlePayload=this.handlePayloadWithCustom):(this.addToken=this.addTokenUsingMemberAccess,this.handlePayload=this.handlePayloadNoCustom)}),this.TRACE_INIT("Failed Optimization Warnings",()=>{const c=ge(this.canModeBeOptimized,(a,u,l)=>(u===!1&&a.push(l),a),[]);if(r.ensureOptimizations&&!H(c))throw Error(`Lexer Modes: < ${c.join(", ")} > cannot be optimized. Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode. Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{cp()}),this.TRACE_INIT("toFastProperties",()=>{ms(this)})})}tokenize(e,r=this.defaultMode){if(!H(this.lexerDefinitionErrors)){const n=C(this.lexerDefinitionErrors,i=>i.message).join(`----------------------- `);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer: `+n)}return this.tokenizeInternal(e,r)}tokenizeInternal(e,r){let n,i,s,o,c,a,u,l,h,m,p,d,g,_,y;const E=e,T=E.length;let f=0,v=0;const R=this.hasCustom?0:Math.floor(e.length/10),S=new Array(R),D=[];let ne=this.trackStartLines?1:void 0,F=this.trackStartLines?1:void 0;const I=kp(this.emptyGroups),w=this.trackStartLines,x=this.config.lineTerminatorsPattern;let N=0,O=[],B=[];const U=[],V=[];Object.freeze(V);let Y;function q(){return O}function ie(W){const ae=Qe(W),vt=B[ae];return vt===void 0?V:vt}const L=W=>{if(U.length===1&&W.tokenType.PUSH_MODE===void 0){const ae=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(W);D.push({offset:W.startOffset,line:W.startLine,column:W.startColumn,length:W.image.length,message:ae})}else{U.pop();const ae=ft(U);O=this.patternIdxToConfig[ae],B=this.charCodeToPatternIdxToConfig[ae],N=O.length;const vt=this.canModeBeOptimized[ae]&&this.config.safeMode===!1;B&&vt?Y=ie:Y=q}};function A(W){U.push(W),B=this.charCodeToPatternIdxToConfig[W],O=this.patternIdxToConfig[W],N=O.length,N=O.length;const ae=this.canModeBeOptimized[W]&&this.config.safeMode===!1;B&&ae?Y=ie:Y=q}A.call(this,r);let b;const Q=this.config.recoveryEnabled;for(;fa.length){a=o,u=l,b=ze;break}}}break}}if(a!==null){if(h=a.length,m=b.group,m!==void 0&&(p=b.tokenTypeIdx,d=this.createTokenInstance(a,f,p,b.tokenType,ne,F,h),this.handlePayload(d,u),m===!1?v=this.addToken(S,v,d):I[m].push(d)),e=this.chopInput(e,h),f=f+h,F=this.computeNewColumn(F,h),w===!0&&b.canLineTerminator===!0){let Ee=0,He,Ze;x.lastIndex=0;do He=x.test(a),He===!0&&(Ze=x.lastIndex-1,Ee++);while(He===!0);Ee!==0&&(ne=ne+Ee,F=h-Ze,this.updateTokenEndLineColumnLocation(d,m,Ze,Ee,ne,F,h))}this.handleModes(b,L,A,d)}else{const Ee=f,He=ne,Ze=F;let ze=Q===!1;for(;ze===!1&&f ${xt(t)} <--`:`token of type --> ${t.name} <--`} but found --> '${e.image}' <--`},buildNotAllInputParsedMessage({firstRedundant:t,ruleName:e}){return"Redundant input, expecting EOF but found: "+t.image},buildNoViableAltMessage({expectedPathsPerAlt:t,actual:e,previous:r,customUserDescription:n,ruleName:i}){const s="Expecting: ",o=` but found: '`+Ce(e).image+"'";if(n)return s+n+o;{const c=ge(t,(l,h)=>l.concat(h),[]),a=C(c,l=>`[${C(l,h=>xt(h)).join(", ")}]`),u=`one of these possible Token sequences: ${C(a,(l,h)=>` ${h+1}. ${l}`).join(` `)}`;return s+u+o}},buildEarlyExitMessage({expectedIterationPaths:t,actual:e,customUserDescription:r,ruleName:n}){const i="Expecting: ",s=` but found: '`+Ce(e).image+"'";if(r)return i+r+s;{const o=`expecting at least one iteration which starts with one of these possible Token sequences:: <${C(t,c=>`[${C(c,a=>xt(a)).join(",")}]`).join(" ,")}>`;return i+o+s}}};Object.freeze(Bs);const zp={buildRuleNotFoundError(t,e){return"Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+`<- inside top level rule: ->`+t.name+"<-"}},at={buildDuplicateFoundError(t,e){function r(l){return l instanceof X?l.terminalType.name:l instanceof ve?l.nonTerminalName:""}const n=t.name,i=Ce(e),s=i.idx,o=je(i),c=r(i),a=s>0;let u=`->${o}${a?s:""}<- ${c?`with argument: ->${c}<-`:""} appears more than once (${e.length} times) in the top level rule: ->${n}<-. For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES `;return u=u.replace(/[ \t]+/g," "),u=u.replace(/\s\s+/g,` `),u},buildNamespaceConflictError(t){return`Namespace conflict found in grammar. The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${t.name}>. To resolve this make sure each Terminal and Non-Terminal names are unique This is easy to accomplish by using the convention that Terminal names start with an uppercase letter and Non-Terminal names start with a lower case letter.`},buildAlternationPrefixAmbiguityError(t){const e=C(t.prefixPath,n=>xt(n)).join(", "),r=t.alternation.idx===0?"":t.alternation.idx;return`Ambiguous alternatives: <${t.ambiguityIndices.join(" ,")}> due to common lookahead prefix in inside <${t.topLevelRule.name}> Rule, <${e}> may appears as a prefix path in all these alternatives. See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX For Further details.`},buildAlternationAmbiguityError(t){const e=C(t.prefixPath,i=>xt(i)).join(", "),r=t.alternation.idx===0?"":t.alternation.idx;let n=`Ambiguous Alternatives Detected: <${t.ambiguityIndices.join(" ,")}> in inside <${t.topLevelRule.name}> Rule, <${e}> may appears as a prefix path in all these alternatives. `;return n=n+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES For Further details.`,n},buildEmptyRepetitionError(t){let e=je(t.repetition);return t.repetition.idx!==0&&(e+=t.repetition.idx),`The repetition <${e}> within Rule <${t.topLevelRule.name}> can never consume any tokens. This could lead to an infinite loop.`},buildTokenNameError(t){return"deprecated"},buildEmptyAlternationError(t){return`Ambiguous empty alternative: <${t.emptyChoiceIdx+1}> in inside <${t.topLevelRule.name}> Rule. Only the last alternative may be an empty alternative.`},buildTooManyAlternativesError(t){return`An Alternation cannot have more than 256 alternatives: inside <${t.topLevelRule.name}> Rule. has ${t.alternation.definition.length+1} alternatives.`},buildLeftRecursionError(t){const e=t.topLevelRule.name,r=C(t.leftRecursionPath,i=>i.name),n=`${e} --> ${r.concat([e]).join(" --> ")}`;return`Left Recursion found in grammar. rule: <${e}> can be invoked from itself (directly or indirectly) without consuming any Tokens. The grammar path that causes this is: ${n} To fix this refactor your grammar to remove the left recursion. see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(t){return"deprecated"},buildDuplicateRuleNameError(t){let e;return t.topLevelRule instanceof dt?e=t.topLevelRule.name:e=t.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${t.grammarName}<-`}};function qp(t,e){const r=new Yp(t,e);return r.resolveRefs(),r.errors}class Yp extends mt{constructor(e,r){super(),this.nameToTopRule=e,this.errMsgProvider=r,this.errors=[]}resolveRefs(){k(te(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){const r=this.nameToTopRule[e.nonTerminalName];if(r)e.referencedRule=r;else{const n=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:n,type:le.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}}class Xp extends sr{constructor(e,r){super(),this.topProd=e,this.path=r,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=se(this.path.ruleStack).reverse(),this.occurrenceStack=se(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,r=[]){this.found||super.walk(e,r)}walkProdRef(e,r,n){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){const i=r.concat(n);this.updateExpectedNext(),this.walk(e.referencedRule,i)}}updateExpectedNext(){H(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}}class Qp extends Xp{constructor(e,r){super(e,r),this.path=r,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,r,n){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){const i=r.concat(n),s=new fe({definition:i});this.possibleTokTypes=Ct(s),this.found=!0}}}class gr extends sr{constructor(e,r){super(),this.topRule=e,this.occurrence=r,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}}class Jp extends gr{walkMany(e,r,n){if(e.idx===this.occurrence){const i=Ce(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof X&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkMany(e,r,n)}}class Vs extends gr{walkManySep(e,r,n){if(e.idx===this.occurrence){const i=Ce(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof X&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkManySep(e,r,n)}}class Zp extends gr{walkAtLeastOne(e,r,n){if(e.idx===this.occurrence){const i=Ce(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof X&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOne(e,r,n)}}class Ws extends gr{walkAtLeastOneSep(e,r,n){if(e.idx===this.occurrence){const i=Ce(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof X&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOneSep(e,r,n)}}function mn(t,e,r=[]){r=se(r);let n=[],i=0;function s(c){return c.concat(oe(t,i+1))}function o(c){const a=mn(s(c),e,r);return n.concat(a)}for(;r.length{H(a.definition)===!1&&(n=o(a.definition))}),n;if(c instanceof X)r.push(c.terminalType);else throw Error("non exhaustive match")}i++}return n.push({partialPath:r,suffixDef:oe(t,i)}),n}function Ks(t,e,r,n){const i="EXIT_NONE_TERMINAL",s=[i],o="EXIT_ALTERNATIVE";let c=!1;const a=e.length,u=a-n-1,l=[],h=[];for(h.push({idx:-1,def:t,ruleStack:[],occurrenceStack:[]});!H(h);){const m=h.pop();if(m===o){c&&ft(h).idx<=u&&h.pop();continue}const p=m.def,d=m.idx,g=m.ruleStack,_=m.occurrenceStack;if(H(p))continue;const y=p[0];if(y===i){const E={idx:d,def:oe(p),ruleStack:It(g),occurrenceStack:It(_)};h.push(E)}else if(y instanceof X)if(d=0;E--){const T=y.definition[E],f={idx:d,def:T.definition.concat(oe(p)),ruleStack:g,occurrenceStack:_};h.push(f),h.push(o)}else if(y instanceof fe)h.push({idx:d,def:y.definition.concat(oe(p)),ruleStack:g,occurrenceStack:_});else if(y instanceof dt)h.push(ed(y,d,g,_));else throw Error("non exhaustive match")}return l}function ed(t,e,r,n){const i=se(r);i.push(t.name);const s=se(n);return s.push(1),{idx:e,def:t.definition,ruleStack:i,occurrenceStack:s}}var Z;(function(t){t[t.OPTION=0]="OPTION",t[t.REPETITION=1]="REPETITION",t[t.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",t[t.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",t[t.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",t[t.ALTERNATION=5]="ALTERNATION"})(Z||(Z={}));function Hs(t){if(t instanceof pe||t==="Option")return Z.OPTION;if(t instanceof re||t==="Repetition")return Z.REPETITION;if(t instanceof De||t==="RepetitionMandatory")return Z.REPETITION_MANDATORY;if(t instanceof Fe||t==="RepetitionMandatoryWithSeparator")return Z.REPETITION_MANDATORY_WITH_SEPARATOR;if(t instanceof be||t==="RepetitionWithSeparator")return Z.REPETITION_WITH_SEPARATOR;if(t instanceof ke||t==="Alternation")return Z.ALTERNATION;throw Error("non exhaustive match")}function td(t,e,r,n,i,s){const o=vn(t,e,r),c=Xs(o)?mr:Nt;return s(o,n,c,i)}function rd(t,e,r,n,i,s){const o=En(t,e,i,r),c=Xs(o)?mr:Nt;return s(o[0],c,n)}function nd(t,e,r,n){const i=t.length,s=Ie(t,o=>Ie(o,c=>c.length===1));if(e)return function(o){const c=C(o,a=>a.GATE);for(let a=0;aLe(a)),c=ge(o,(a,u,l)=>(k(u,h=>{M(a,h.tokenTypeIdx)||(a[h.tokenTypeIdx]=l),k(h.categoryMatches,m=>{M(a,m)||(a[m]=l)})}),a),{});return function(){const a=this.LA(1);return c[a.tokenTypeIdx]}}else return function(){for(let o=0;os.length===1),i=t.length;if(n&&!r){const s=Le(t);if(s.length===1&&H(s[0].categoryMatches)){const o=s[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===o}}else{const o=ge(s,(c,a,u)=>(c[a.tokenTypeIdx]=!0,k(a.categoryMatches,l=>{c[l]=!0}),c),[]);return function(){const c=this.LA(1);return o[c.tokenTypeIdx]===!0}}}else return function(){e:for(let s=0;smn([o],1)),n=qs(r.length),i=C(r,o=>{const c={};return k(o,a=>{const u=gn(a.partialPath);k(u,l=>{c[l]=!0})}),c});let s=r;for(let o=1;o<=e;o++){const c=s;s=qs(c.length);for(let a=0;a{const _=gn(g.partialPath);k(_,y=>{i[a][y]=!0})})}}}}return n}function vn(t,e,r,n){const i=new zs(t,Z.ALTERNATION,n);return e.accept(i),Ys(i.result,r)}function En(t,e,r,n){const i=new zs(t,r);e.accept(i);const s=i.result,o=new sd(e,t,r).startWalking(),c=new fe({definition:s}),a=new fe({definition:o});return Ys([c,a],n)}function Tn(t,e){e:for(let r=0;r{const i=e[n];return r===i||i.categoryMatchesMap[r.tokenTypeIdx]})}function Xs(t){return Ie(t,e=>Ie(e,r=>Ie(r,n=>H(n.categoryMatches))))}function cd(t){const e=t.lookaheadStrategy.validate({rules:t.rules,tokenTypes:t.tokenTypes,grammarName:t.grammarName});return C(e,r=>Object.assign({type:le.CUSTOM_LOOKAHEAD_VALIDATION},r))}function ud(t,e,r,n){const i=Re(t,a=>ld(a,r)),s=Ad(t,e,r),o=Re(t,a=>Ed(a,r)),c=Re(t,a=>pd(a,t,n,r));return i.concat(s,o,c)}function ld(t,e){const r=new fd;t.accept(r);const n=r.allProductions,i=Sf(n,hd),s=Me(i,o=>o.length>1);return C(te(s),o=>{const c=Ce(o),a=e.buildDuplicateFoundError(t,o),u=je(c),l={message:a,type:le.DUPLICATE_PRODUCTIONS,ruleName:t.name,dslName:u,occurrence:c.idx},h=Qs(c);return h&&(l.parameter=h),l})}function hd(t){return`${je(t)}_#_${t.idx}_#_${Qs(t)}`}function Qs(t){return t instanceof X?t.terminalType.name:t instanceof ve?t.nonTerminalName:""}class fd extends mt{constructor(){super(...arguments),this.allProductions=[]}visitNonTerminal(e){this.allProductions.push(e)}visitOption(e){this.allProductions.push(e)}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}visitAlternation(e){this.allProductions.push(e)}visitTerminal(e){this.allProductions.push(e)}}function pd(t,e,r,n){const i=[];if(ge(e,(s,o)=>o.name===t.name?s+1:s,0)>1){const s=n.buildDuplicateRuleNameError({topLevelRule:t,grammarName:r});i.push({message:s,type:le.DUPLICATE_RULE_NAME,ruleName:t.name})}return i}function dd(t,e,r){const n=[];let i;return ce(e,t)||(i=`Invalid rule override, rule: ->${t}<- cannot be overridden in the grammar: ->${r}<-as it is not defined in any of the super grammars `,n.push({message:i,type:le.INVALID_RULE_OVERRIDE,ruleName:t})),n}function Js(t,e,r,n=[]){const i=[],s=vr(e.definition);if(H(s))return[];{const o=t.name;ce(s,t)&&i.push({message:r.buildLeftRecursionError({topLevelRule:t,leftRecursionPath:n}),type:le.LEFT_RECURSION,ruleName:o});const c=tr(s,n.concat([t])),a=Re(c,u=>{const l=se(n);return l.push(u),Js(t,u,r,l)});return i.concat(a)}}function vr(t){let e=[];if(H(t))return e;const r=Ce(t);if(r instanceof ve)e.push(r.referencedRule);else if(r instanceof fe||r instanceof pe||r instanceof De||r instanceof Fe||r instanceof be||r instanceof re)e=e.concat(vr(r.definition));else if(r instanceof ke)e=Le(C(r.definition,s=>vr(s.definition)));else if(!(r instanceof X))throw Error("non exhaustive match");const n=ir(r),i=t.length>1;if(n&&i){const s=oe(t);return e.concat(vr(s))}else return e}class _n extends mt{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}}function md(t,e){const r=new _n;t.accept(r);const n=r.alternations;return Re(n,i=>{const s=It(i.definition);return Re(s,(o,c)=>{const a=Ks([o],[],Nt,1);return H(a)?[{message:e.buildEmptyAlternationError({topLevelRule:t,alternation:i,emptyChoiceIdx:c}),type:le.NONE_LAST_EMPTY_ALT,ruleName:t.name,occurrence:i.idx,alternative:c+1}]:[]})})}function gd(t,e,r){const n=new _n;t.accept(n);let i=n.alternations;return i=rr(i,s=>s.ignoreAmbiguities===!0),Re(i,s=>{const o=s.idx,c=s.maxLookahead||e,a=vn(o,t,c,s),u=_d(a,s,t,r),l=yd(a,s,t,r);return u.concat(l)})}class vd extends mt{constructor(){super(...arguments),this.allProductions=[]}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}}function Ed(t,e){const r=new _n;t.accept(r);const n=r.alternations;return Re(n,i=>i.definition.length>255?[{message:e.buildTooManyAlternativesError({topLevelRule:t,alternation:i}),type:le.TOO_MANY_ALTS,ruleName:t.name,occurrence:i.idx}]:[])}function Td(t,e,r){const n=[];return k(t,i=>{const s=new vd;i.accept(s);const o=s.allProductions;k(o,c=>{const a=Hs(c),u=c.maxLookahead||e,l=c.idx,h=En(l,i,a,u)[0];if(H(Le(h))){const m=r.buildEmptyRepetitionError({topLevelRule:i,repetition:c});n.push({message:m,type:le.NO_NON_EMPTY_LOOKAHEAD,ruleName:i.name})}})}),n}function _d(t,e,r,n){const i=[],s=ge(t,(o,c,a)=>(e.definition[a].ignoreAmbiguities===!0||k(c,u=>{const l=[a];k(t,(h,m)=>{a!==m&&Tn(h,u)&&e.definition[m].ignoreAmbiguities!==!0&&l.push(m)}),l.length>1&&!Tn(i,u)&&(i.push(u),o.push({alts:l,path:u}))}),o),[]);return C(s,o=>{const c=C(o.alts,a=>a+1);return{message:n.buildAlternationAmbiguityError({topLevelRule:r,alternation:e,ambiguityIndices:c,prefixPath:o.path}),type:le.AMBIGUOUS_ALTS,ruleName:r.name,occurrence:e.idx,alternatives:o.alts}})}function yd(t,e,r,n){const i=ge(t,(s,o,c)=>{const a=C(o,u=>({idx:c,path:u}));return s.concat(a)},[]);return Lt(Re(i,s=>{if(e.definition[s.idx].ignoreAmbiguities===!0)return[];const o=s.idx,c=s.path,a=Se(i,u=>e.definition[u.idx].ignoreAmbiguities!==!0&&u.idx{const l=[u.idx+1,o+1],h=e.idx===0?"":e.idx;return{message:n.buildAlternationPrefixAmbiguityError({topLevelRule:r,alternation:e,ambiguityIndices:l,prefixPath:u.path}),type:le.AMBIGUOUS_PREFIX_ALTS,ruleName:r.name,occurrence:h,alternatives:l}})}))}function Ad(t,e,r){const n=[],i=C(e,s=>s.name);return k(t,s=>{const o=s.name;if(ce(i,o)){const c=r.buildNamespaceConflictError(s);n.push({message:c,type:le.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:o})}}),n}function Sd(t){const e=sn(t,{errMsgProvider:zp}),r={};return k(t.rules,n=>{r[n.name]=n}),qp(r,e.errMsgProvider)}function Rd(t){return t=sn(t,{errMsgProvider:at}),ud(t.rules,t.tokenTypes,t.errMsgProvider,t.grammarName)}const Zs="MismatchedTokenException",eo="NoViableAltException",to="EarlyExitException",ro="NotAllInputParsedException",no=[Zs,eo,to,ro];Object.freeze(no);function Er(t){return ce(no,t.name)}class Tr extends Error{constructor(e,r){super(e),this.token=r,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}class io extends Tr{constructor(e,r,n){super(e,r),this.previousToken=n,this.name=Zs}}class Od extends Tr{constructor(e,r,n){super(e,r),this.previousToken=n,this.name=eo}}class Ld extends Tr{constructor(e,r){super(e,r),this.name=ro}}class Id extends Tr{constructor(e,r,n){super(e,r),this.previousToken=n,this.name=to}}const yn={},so="InRuleRecoveryException";class Cd extends Error{constructor(e){super(e),this.name=so}}class Md{initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=M(e,"recoveryEnabled")?e.recoveryEnabled:Ke.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=bd)}getTokenToInsert(e){const r=dn(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return r.isInsertedInRecovery=!0,r}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,r,n,i){const s=this.findReSyncTokenType(),o=this.exportLexerState(),c=[];let a=!1;const u=this.LA(1);let l=this.LA(1);const h=()=>{const m=this.LA(0),p=this.errorMessageProvider.buildMismatchTokenMessage({expected:i,actual:u,previous:m,ruleName:this.getCurrRuleFullName()}),d=new io(p,u,this.LA(0));d.resyncedTokens=It(c),this.SAVE_ERROR(d)};for(;!a;)if(this.tokenMatcher(l,i)){h();return}else if(n.call(this)){h(),e.apply(this,r);return}else this.tokenMatcher(l,s)?a=!0:(l=this.SKIP_TOKEN(),this.addToResyncTokens(l,c));this.importLexerState(o)}shouldInRepetitionRecoveryBeTried(e,r,n){return!(n===!1||this.tokenMatcher(this.LA(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,r)))}getFollowsForInRuleRecovery(e,r){const n=this.getCurrentGrammarPath(e,r);return this.getNextPossibleTokenTypes(n)}tryInRuleRecovery(e,r){if(this.canRecoverWithSingleTokenInsertion(e,r))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){const n=this.SKIP_TOKEN();return this.consumeToken(),n}throw new Cd("sad sad panda")}canPerformInRuleRecovery(e,r){return this.canRecoverWithSingleTokenInsertion(e,r)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,r){if(!this.canTokenTypeBeInsertedInRecovery(e)||H(r))return!1;const n=this.LA(1);return pt(r,i=>this.tokenMatcher(n,i))!==void 0}canRecoverWithSingleTokenDeletion(e){return this.canTokenTypeBeDeletedInRecovery(e)?this.tokenMatcher(this.LA(2),e):!1}isInCurrentRuleReSyncSet(e){const r=this.getCurrFollowKey(),n=this.getFollowSetFromFollowKey(r);return ce(n,e)}findReSyncTokenType(){const e=this.flattenFollowSet();let r=this.LA(1),n=2;for(;;){const i=pt(e,s=>Hp(r,s));if(i!==void 0)return i;r=this.LA(n),n++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return yn;const e=this.getLastExplicitRuleShortName(),r=this.getLastExplicitRuleOccurrenceIndex(),n=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:r,inRule:this.shortRuleNameToFullName(n)}}buildFullFollowKeyStack(){const e=this.RULE_STACK,r=this.RULE_OCCURRENCE_STACK;return C(e,(n,i)=>i===0?yn:{ruleName:this.shortRuleNameToFullName(n),idxInCallingRule:r[i],inRule:this.shortRuleNameToFullName(e[i-1])})}flattenFollowSet(){const e=C(this.buildFullFollowKeyStack(),r=>this.getFollowSetFromFollowKey(r));return Le(e)}getFollowSetFromFollowKey(e){if(e===yn)return[ot];const r=e.ruleName+e.idxInCallingRule+vs+e.inRule;return this.resyncFollows[r]}addToResyncTokens(e,r){return this.tokenMatcher(e,ot)||r.push(e),r}reSyncTo(e){const r=[];let n=this.LA(1);for(;this.tokenMatcher(n,e)===!1;)n=this.SKIP_TOKEN(),this.addToResyncTokens(n,r);return It(r)}attemptInRepetitionRecovery(e,r,n,i,s,o,c){}getCurrentGrammarPath(e,r){const n=this.getHumanReadableRuleStack(),i=se(this.RULE_OCCURRENCE_STACK);return{ruleStack:n,occurrenceStack:i,lastTok:e,lastTokOccurrence:r}}getHumanReadableRuleStack(){return C(this.RULE_STACK,e=>this.shortRuleNameToFullName(e))}}function bd(t,e,r,n,i,s,o){const c=this.getKeyForAutomaticLookahead(n,i);let a=this.firstAfterRepMap[c];if(a===void 0){const m=this.getCurrRuleFullName(),p=this.getGAstProductions()[m];a=new s(p,i).startWalking(),this.firstAfterRepMap[c]=a}let u=a.token,l=a.occurrence;const h=a.isEndOfRule;this.RULE_STACK.length===1&&h&&u===void 0&&(u=ot,l=1),!(u===void 0||l===void 0)&&this.shouldInRepetitionRecoveryBeTried(u,l,o)&&this.tryInRepetitionRecovery(t,e,r,u)}const kd=4,Je=8,oo=1<Js(r,r,at))}validateEmptyOrAlternatives(e){return Re(e,r=>md(r,at))}validateAmbiguousAlternationAlternatives(e,r){return Re(e,n=>gd(n,r,at))}validateSomeNonEmptyLookaheadPath(e,r){return Td(e,r,at)}buildLookaheadForAlternation(e){return td(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,nd)}buildLookaheadForOptional(e){return rd(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,Hs(e.prodType),id)}}class Pd{initLooksAhead(e){this.dynamicTokensEnabled=M(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:Ke.dynamicTokensEnabled,this.maxLookahead=M(e,"maxLookahead")?e.maxLookahead:Ke.maxLookahead,this.lookaheadStrategy=M(e,"lookaheadStrategy")?e.lookaheadStrategy:new Nd({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){k(e,r=>{this.TRACE_INIT(`${r.name} Rule Lookahead`,()=>{const{alternation:n,repetition:i,option:s,repetitionMandatory:o,repetitionMandatoryWithSeparator:c,repetitionWithSeparator:a}=xd(r);k(n,u=>{const l=u.idx===0?"":u.idx;this.TRACE_INIT(`${je(u)}${l}`,()=>{const h=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:u.idx,rule:r,maxLookahead:u.maxLookahead||this.maxLookahead,hasPredicates:u.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),m=On(this.fullRuleNameToShort[r.name],oo,u.idx);this.setLaFuncCache(m,h)})}),k(i,u=>{this.computeLookaheadFunc(r,u.idx,An,"Repetition",u.maxLookahead,je(u))}),k(s,u=>{this.computeLookaheadFunc(r,u.idx,ao,"Option",u.maxLookahead,je(u))}),k(o,u=>{this.computeLookaheadFunc(r,u.idx,Sn,"RepetitionMandatory",u.maxLookahead,je(u))}),k(c,u=>{this.computeLookaheadFunc(r,u.idx,_r,"RepetitionMandatoryWithSeparator",u.maxLookahead,je(u))}),k(a,u=>{this.computeLookaheadFunc(r,u.idx,Rn,"RepetitionWithSeparator",u.maxLookahead,je(u))})})})}computeLookaheadFunc(e,r,n,i,s,o){this.TRACE_INIT(`${o}${r===0?"":r}`,()=>{const c=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:r,rule:e,maxLookahead:s||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:i}),a=On(this.fullRuleNameToShort[e.name],n,r);this.setLaFuncCache(a,c)})}getKeyForAutomaticLookahead(e,r){const n=this.getLastExplicitRuleShortName();return On(n,e,r)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,r){this.lookAheadFuncsCache.set(e,r)}}class wd extends mt{constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(e){this.dslMethods.option.push(e)}visitRepetitionWithSeparator(e){this.dslMethods.repetitionWithSeparator.push(e)}visitRepetitionMandatory(e){this.dslMethods.repetitionMandatory.push(e)}visitRepetitionMandatoryWithSeparator(e){this.dslMethods.repetitionMandatoryWithSeparator.push(e)}visitRepetition(e){this.dslMethods.repetition.push(e)}visitAlternation(e){this.dslMethods.alternation.push(e)}}const yr=new wd;function xd(t){yr.reset(),t.accept(yr);const e=yr.dslMethods;return yr.reset(),e}function co(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.endOffset=e.endOffset):t.endOffseto.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>: ${s.join(` `).replace(/\n/g,` `)}`)}}};return r.prototype=n,r.prototype.constructor=r,r._RULE_NAMES=e,r}function Gd(t,e,r){const n=function(){};lo(n,t+"BaseSemanticsWithDefaults");const i=Object.create(r.prototype);return k(e,s=>{i[s]=jd}),n.prototype=i,n.prototype.constructor=n,n}var Ln;(function(t){t[t.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",t[t.MISSING_METHOD=1]="MISSING_METHOD"})(Ln||(Ln={}));function Bd(t,e){return Vd(t,e)}function Vd(t,e){const r=Se(e,i=>$e(t[i])===!1),n=C(r,i=>({msg:`Missing visitor method: <${i}> on ${t.constructor.name} CST Visitor.`,type:Ln.MISSING_METHOD,methodName:i}));return Lt(n)}class Wd{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=M(e,"nodeLocationTracking")?e.nodeLocationTracking:Ke.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=ee,this.cstFinallyStateUpdate=ee,this.cstPostTerminal=ee,this.cstPostNonTerminal=ee,this.cstPostRule=ee;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=uo,this.setNodeLocationFromNode=uo,this.cstPostRule=ee,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=ee,this.setNodeLocationFromNode=ee,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=co,this.setNodeLocationFromNode=co,this.cstPostRule=ee,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=ee,this.setNodeLocationFromNode=ee,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=ee,this.setNodeLocationFromNode=ee,this.cstPostRule=ee,this.setInitialNodeLocation=ee;else throw Error(`Invalid config option: "${e.nodeLocationTracking}"`)}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:NaN,endOffset:NaN}}setInitialNodeLocationOnlyOffsetRegular(e){e.location={startOffset:this.LA(1).startOffset,endOffset:NaN}}setInitialNodeLocationFullRecovery(e){e.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}}setInitialNodeLocationFullRegular(e){const r=this.LA(1);e.location={startOffset:r.startOffset,startLine:r.startLine,startColumn:r.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(e){const r={name:e,children:Object.create(null)};this.setInitialNodeLocation(r),this.CST_STACK.push(r)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){const r=this.LA(0),n=e.location;n.startOffset<=r.startOffset?(n.endOffset=r.endOffset,n.endLine=r.endLine,n.endColumn=r.endColumn):(n.startOffset=NaN,n.startLine=NaN,n.startColumn=NaN)}cstPostRuleOnlyOffset(e){const r=this.LA(0),n=e.location;n.startOffset<=r.startOffset?n.endOffset=r.endOffset:n.startOffset=NaN}cstPostTerminal(e,r){const n=this.CST_STACK[this.CST_STACK.length-1];Ud(n,r,e),this.setNodeLocationFromToken(n.location,r)}cstPostNonTerminal(e,r){const n=this.CST_STACK[this.CST_STACK.length-1];Dd(n,r,e),this.setNodeLocationFromNode(n.location,e.location)}getBaseCstVisitorConstructor(){if(We(this.baseCstVisitorConstructor)){const e=$d(this.className,ye(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(We(this.baseCstVisitorWithDefaultsConstructor)){const e=Gd(this.className,ye(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor}getLastExplicitRuleShortName(){const e=this.RULE_STACK;return e[e.length-1]}getPreviousExplicitRuleShortName(){const e=this.RULE_STACK;return e[e.length-2]}getLastExplicitRuleOccurrenceIndex(){const e=this.RULE_OCCURRENCE_STACK;return e[e.length-1]}}class Kd{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(e){if(this.selfAnalysisDone!==!0)throw Error("Missing invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=e,this.tokVectorLength=e.length}get input(){return this.tokVector}SKIP_TOKEN(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):Rr}LA(e){const r=this.currIdx+e;return r<0||this.tokVectorLength<=r?Rr:this.tokVector[r]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(e){this.currIdx=e}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVector.length-1}getLexerPosition(){return this.exportLexerState()}}class Hd{ACTION(e){return e.call(this)}consume(e,r,n){return this.consumeInternal(r,e,n)}subrule(e,r,n){return this.subruleInternal(r,e,n)}option(e,r){return this.optionInternal(r,e)}or(e,r){return this.orInternal(r,e)}many(e,r){return this.manyInternal(e,r)}atLeastOne(e,r){return this.atLeastOneInternal(e,r)}CONSUME(e,r){return this.consumeInternal(e,0,r)}CONSUME1(e,r){return this.consumeInternal(e,1,r)}CONSUME2(e,r){return this.consumeInternal(e,2,r)}CONSUME3(e,r){return this.consumeInternal(e,3,r)}CONSUME4(e,r){return this.consumeInternal(e,4,r)}CONSUME5(e,r){return this.consumeInternal(e,5,r)}CONSUME6(e,r){return this.consumeInternal(e,6,r)}CONSUME7(e,r){return this.consumeInternal(e,7,r)}CONSUME8(e,r){return this.consumeInternal(e,8,r)}CONSUME9(e,r){return this.consumeInternal(e,9,r)}SUBRULE(e,r){return this.subruleInternal(e,0,r)}SUBRULE1(e,r){return this.subruleInternal(e,1,r)}SUBRULE2(e,r){return this.subruleInternal(e,2,r)}SUBRULE3(e,r){return this.subruleInternal(e,3,r)}SUBRULE4(e,r){return this.subruleInternal(e,4,r)}SUBRULE5(e,r){return this.subruleInternal(e,5,r)}SUBRULE6(e,r){return this.subruleInternal(e,6,r)}SUBRULE7(e,r){return this.subruleInternal(e,7,r)}SUBRULE8(e,r){return this.subruleInternal(e,8,r)}SUBRULE9(e,r){return this.subruleInternal(e,9,r)}OPTION(e){return this.optionInternal(e,0)}OPTION1(e){return this.optionInternal(e,1)}OPTION2(e){return this.optionInternal(e,2)}OPTION3(e){return this.optionInternal(e,3)}OPTION4(e){return this.optionInternal(e,4)}OPTION5(e){return this.optionInternal(e,5)}OPTION6(e){return this.optionInternal(e,6)}OPTION7(e){return this.optionInternal(e,7)}OPTION8(e){return this.optionInternal(e,8)}OPTION9(e){return this.optionInternal(e,9)}OR(e){return this.orInternal(e,0)}OR1(e){return this.orInternal(e,1)}OR2(e){return this.orInternal(e,2)}OR3(e){return this.orInternal(e,3)}OR4(e){return this.orInternal(e,4)}OR5(e){return this.orInternal(e,5)}OR6(e){return this.orInternal(e,6)}OR7(e){return this.orInternal(e,7)}OR8(e){return this.orInternal(e,8)}OR9(e){return this.orInternal(e,9)}MANY(e){this.manyInternal(0,e)}MANY1(e){this.manyInternal(1,e)}MANY2(e){this.manyInternal(2,e)}MANY3(e){this.manyInternal(3,e)}MANY4(e){this.manyInternal(4,e)}MANY5(e){this.manyInternal(5,e)}MANY6(e){this.manyInternal(6,e)}MANY7(e){this.manyInternal(7,e)}MANY8(e){this.manyInternal(8,e)}MANY9(e){this.manyInternal(9,e)}MANY_SEP(e){this.manySepFirstInternal(0,e)}MANY_SEP1(e){this.manySepFirstInternal(1,e)}MANY_SEP2(e){this.manySepFirstInternal(2,e)}MANY_SEP3(e){this.manySepFirstInternal(3,e)}MANY_SEP4(e){this.manySepFirstInternal(4,e)}MANY_SEP5(e){this.manySepFirstInternal(5,e)}MANY_SEP6(e){this.manySepFirstInternal(6,e)}MANY_SEP7(e){this.manySepFirstInternal(7,e)}MANY_SEP8(e){this.manySepFirstInternal(8,e)}MANY_SEP9(e){this.manySepFirstInternal(9,e)}AT_LEAST_ONE(e){this.atLeastOneInternal(0,e)}AT_LEAST_ONE1(e){return this.atLeastOneInternal(1,e)}AT_LEAST_ONE2(e){this.atLeastOneInternal(2,e)}AT_LEAST_ONE3(e){this.atLeastOneInternal(3,e)}AT_LEAST_ONE4(e){this.atLeastOneInternal(4,e)}AT_LEAST_ONE5(e){this.atLeastOneInternal(5,e)}AT_LEAST_ONE6(e){this.atLeastOneInternal(6,e)}AT_LEAST_ONE7(e){this.atLeastOneInternal(7,e)}AT_LEAST_ONE8(e){this.atLeastOneInternal(8,e)}AT_LEAST_ONE9(e){this.atLeastOneInternal(9,e)}AT_LEAST_ONE_SEP(e){this.atLeastOneSepFirstInternal(0,e)}AT_LEAST_ONE_SEP1(e){this.atLeastOneSepFirstInternal(1,e)}AT_LEAST_ONE_SEP2(e){this.atLeastOneSepFirstInternal(2,e)}AT_LEAST_ONE_SEP3(e){this.atLeastOneSepFirstInternal(3,e)}AT_LEAST_ONE_SEP4(e){this.atLeastOneSepFirstInternal(4,e)}AT_LEAST_ONE_SEP5(e){this.atLeastOneSepFirstInternal(5,e)}AT_LEAST_ONE_SEP6(e){this.atLeastOneSepFirstInternal(6,e)}AT_LEAST_ONE_SEP7(e){this.atLeastOneSepFirstInternal(7,e)}AT_LEAST_ONE_SEP8(e){this.atLeastOneSepFirstInternal(8,e)}AT_LEAST_ONE_SEP9(e){this.atLeastOneSepFirstInternal(9,e)}RULE(e,r,n=Or){if(ce(this.definedRulesNames,e)){const s={message:at.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:le.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(s)}this.definedRulesNames.push(e);const i=this.defineRule(e,r,n);return this[e]=i,i}OVERRIDE_RULE(e,r,n=Or){const i=dd(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(i);const s=this.defineRule(e,r,n);return this[e]=s,s}BACKTRACK(e,r){return function(){this.isBackTrackingStack.push(1);const n=this.saveRecogState();try{return e.apply(this,r),!0}catch(i){if(Er(i))return!1;throw i}finally{this.reloadRecogState(n),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return qf(te(this.gastProductionsCache))}}class zd{initRecognizerEngine(e,r){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=mr,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},M(r,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a property. See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0 For Further details.`);if(j(e)){if(H(e))throw Error(`A Token Vocabulary cannot be empty. Note that the first argument for the parser constructor is no longer a Token vector (since v4.0).`);if(typeof e[0].startOffset=="number")throw Error(`The Parser constructor no longer accepts a token vector as the first argument. See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0 For Further details.`)}if(j(e))this.tokensMap=ge(e,(s,o)=>(s[o.name]=o,s),{});else if(M(e,"modes")&&Ie(Le(te(e.modes)),Bp)){const s=Le(te(e.modes)),o=on(s);this.tokensMap=ge(o,(c,a)=>(c[a.name]=a,c),{})}else if(_e(e))this.tokensMap=se(e);else throw new Error(" argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=ot;const n=M(e,"modes")?Le(te(e.modes)):te(e),i=Ie(n,s=>H(s.categoryMatches));this.tokenMatcher=i?mr:Nt,Pt(te(this.tokensMap))}defineRule(e,r,n){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called' Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);const i=M(n,"resyncEnabled")?n.resyncEnabled:Or.resyncEnabled,s=M(n,"recoveryValueFunc")?n.recoveryValueFunc:Or.recoveryValueFunc,o=this.ruleShortNameIdx<o.call(this)&&c.call(this)}}else s=e;if(i.call(this)===!0)return s.call(this)}atLeastOneInternal(e,r){const n=this.getKeyForAutomaticLookahead(Sn,e);return this.atLeastOneInternalLogic(e,r,n)}atLeastOneInternalLogic(e,r,n){let i=this.getLaFuncFromCache(n),s;if(typeof r!="function"){s=r.DEF;const o=r.GATE;if(o!==void 0){const c=i;i=()=>o.call(this)&&c.call(this)}}else s=r;if(i.call(this)===!0){let o=this.doSingleRepetition(s);for(;i.call(this)===!0&&o===!0;)o=this.doSingleRepetition(s)}else throw this.raiseEarlyExitException(e,Z.REPETITION_MANDATORY,r.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,r],i,Sn,e,Zp)}atLeastOneSepFirstInternal(e,r){const n=this.getKeyForAutomaticLookahead(_r,e);this.atLeastOneSepFirstInternalLogic(e,r,n)}atLeastOneSepFirstInternalLogic(e,r,n){const i=r.DEF,s=r.SEP;if(this.getLaFuncFromCache(n).call(this)===!0){i.call(this);const o=()=>this.tokenMatcher(this.LA(1),s);for(;this.tokenMatcher(this.LA(1),s)===!0;)this.CONSUME(s),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,s,o,i,Ws],o,_r,e,Ws)}else throw this.raiseEarlyExitException(e,Z.REPETITION_MANDATORY_WITH_SEPARATOR,r.ERR_MSG)}manyInternal(e,r){const n=this.getKeyForAutomaticLookahead(An,e);return this.manyInternalLogic(e,r,n)}manyInternalLogic(e,r,n){let i=this.getLaFuncFromCache(n),s;if(typeof r!="function"){s=r.DEF;const c=r.GATE;if(c!==void 0){const a=i;i=()=>c.call(this)&&a.call(this)}}else s=r;let o=!0;for(;i.call(this)===!0&&o===!0;)o=this.doSingleRepetition(s);this.attemptInRepetitionRecovery(this.manyInternal,[e,r],i,An,e,Jp,o)}manySepFirstInternal(e,r){const n=this.getKeyForAutomaticLookahead(Rn,e);this.manySepFirstInternalLogic(e,r,n)}manySepFirstInternalLogic(e,r,n){const i=r.DEF,s=r.SEP;if(this.getLaFuncFromCache(n).call(this)===!0){i.call(this);const o=()=>this.tokenMatcher(this.LA(1),s);for(;this.tokenMatcher(this.LA(1),s)===!0;)this.CONSUME(s),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,s,o,i,Vs],o,Rn,e,Vs)}}repetitionSepSecondInternal(e,r,n,i,s){for(;n();)this.CONSUME(r),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,r,n,i,s],n,_r,e,s)}doSingleRepetition(e){const r=this.getLexerPosition();return e.call(this),this.getLexerPosition()>r}orInternal(e,r){const n=this.getKeyForAutomaticLookahead(oo,r),i=j(e)?e:e.DEF,s=this.getLaFuncFromCache(n).call(this,i);if(s!==void 0)return i[s].ALT.call(this);this.raiseNoAltException(r,e.ERR_MSG)}ruleFinallyStateUpdate(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){const e=this.LA(1),r=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new Ld(r,e))}}subruleInternal(e,r,n){let i;try{const s=n!==void 0?n.ARGS:void 0;return this.subruleIdx=r,i=e.apply(this,s),this.cstPostNonTerminal(i,n!==void 0&&n.LABEL!==void 0?n.LABEL:e.ruleName),i}catch(s){throw this.subruleInternalError(s,n,e.ruleName)}}subruleInternalError(e,r,n){throw Er(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,r!==void 0&&r.LABEL!==void 0?r.LABEL:n),delete e.partialCstResult),e}consumeInternal(e,r,n){let i;try{const s=this.LA(1);this.tokenMatcher(s,e)===!0?(this.consumeToken(),i=s):this.consumeInternalError(e,s,n)}catch(s){i=this.consumeInternalRecovery(e,r,s)}return this.cstPostTerminal(n!==void 0&&n.LABEL!==void 0?n.LABEL:e.name,i),i}consumeInternalError(e,r,n){let i;const s=this.LA(0);throw n!==void 0&&n.ERR_MSG?i=n.ERR_MSG:i=this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:r,previous:s,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new io(i,r,s))}consumeInternalRecovery(e,r,n){if(this.recoveryEnabled&&n.name==="MismatchedTokenException"&&!this.isBackTracking()){const i=this.getFollowsForInRuleRecovery(e,r);try{return this.tryInRuleRecovery(e,i)}catch(s){throw s.name===so?n:s}}else throw n}saveRecogState(){const e=this.errors,r=se(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:r,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK}ruleInvocationStateUpdate(e,r,n){this.RULE_OCCURRENCE_STACK.push(n),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(r)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){const e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),ot)}reset(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]}}class qd{initErrorHandler(e){this._errors=[],this.errorMessageProvider=M(e,"errorMessageProvider")?e.errorMessageProvider:Ke.errorMessageProvider}SAVE_ERROR(e){if(Er(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:se(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return se(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,r,n){const i=this.getCurrRuleFullName(),s=this.getGAstProductions()[i],o=En(e,s,r,this.maxLookahead)[0],c=[];for(let u=1;u<=this.maxLookahead;u++)c.push(this.LA(u));const a=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:o,actual:c,previous:this.LA(0),customUserDescription:n,ruleName:i});throw this.SAVE_ERROR(new Id(a,this.LA(1),this.LA(0)))}raiseNoAltException(e,r){const n=this.getCurrRuleFullName(),i=this.getGAstProductions()[n],s=vn(e,i,this.maxLookahead),o=[];for(let u=1;u<=this.maxLookahead;u++)o.push(this.LA(u));const c=this.LA(0),a=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:s,actual:o,previous:c,customUserDescription:r,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new Od(a,this.LA(1),c))}}class Yd{initContentAssist(){}computeContentAssist(e,r){const n=this.gastProductionsCache[e];if(We(n))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return Ks([n],r,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){const r=Ce(e.ruleStack),n=this.getGAstProductions()[r];return new Qp(n,e).startWalking()}}const Ar={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(Ar);const ho=!0,fo=Math.pow(2,Je)-1,po=G({name:"RECORDING_PHASE_TOKEN",pattern:ue.NA});Pt([po]);const mo=dn(po,`This IToken indicates the Parser is in Recording Phase See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(mo);const Xd={name:`This CSTNode indicates the Parser is in Recording Phase See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}};class Qd{initGastRecorder(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",()=>{for(let e=0;e<10;e++){const r=e>0?e:"";this[`CONSUME${r}`]=function(n,i){return this.consumeInternalRecord(n,e,i)},this[`SUBRULE${r}`]=function(n,i){return this.subruleInternalRecord(n,e,i)},this[`OPTION${r}`]=function(n){return this.optionInternalRecord(n,e)},this[`OR${r}`]=function(n){return this.orInternalRecord(n,e)},this[`MANY${r}`]=function(n){this.manyInternalRecord(e,n)},this[`MANY_SEP${r}`]=function(n){this.manySepFirstInternalRecord(e,n)},this[`AT_LEAST_ONE${r}`]=function(n){this.atLeastOneInternalRecord(e,n)},this[`AT_LEAST_ONE_SEP${r}`]=function(n){this.atLeastOneSepFirstInternalRecord(e,n)}}this.consume=function(e,r,n){return this.consumeInternalRecord(r,e,n)},this.subrule=function(e,r,n){return this.subruleInternalRecord(r,e,n)},this.option=function(e,r){return this.optionInternalRecord(r,e)},this.or=function(e,r){return this.orInternalRecord(r,e)},this.many=function(e,r){this.manyInternalRecord(e,r)},this.atLeastOne=function(e,r){this.atLeastOneInternalRecord(e,r)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",()=>{const e=this;for(let r=0;r<10;r++){const n=r>0?r:"";delete e[`CONSUME${n}`],delete e[`SUBRULE${n}`],delete e[`OPTION${n}`],delete e[`OR${n}`],delete e[`MANY${n}`],delete e[`MANY_SEP${n}`],delete e[`AT_LEAST_ONE${n}`],delete e[`AT_LEAST_ONE_SEP${n}`]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})}ACTION_RECORD(e){}BACKTRACK_RECORD(e,r){return()=>!0}LA_RECORD(e){return Rr}topLevelRuleRecord(e,r){try{const n=new dt({definition:[],name:e});return n.name=e,this.recordingProdStack.push(n),r.call(this),this.recordingProdStack.pop(),n}catch(n){if(n.KNOWN_RECORDER_ERROR!==!0)try{n.message=n.message+` This error was thrown during the "grammar recording phase" For more info see: https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw n}throw n}}optionInternalRecord(e,r){return Ut.call(this,pe,e,r)}atLeastOneInternalRecord(e,r){Ut.call(this,De,r,e)}atLeastOneSepFirstInternalRecord(e,r){Ut.call(this,Fe,r,e,ho)}manyInternalRecord(e,r){Ut.call(this,re,r,e)}manySepFirstInternalRecord(e,r){Ut.call(this,be,r,e,ho)}orInternalRecord(e,r){return Jd.call(this,e,r)}subruleInternalRecord(e,r,n){if(Sr(r),!e||M(e,"ruleName")===!1){const c=new Error(` argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}> inside top level rule: <${this.recordingProdStack[0].name}>`);throw c.KNOWN_RECORDER_ERROR=!0,c}const i=ft(this.recordingProdStack),s=e.ruleName,o=new ve({idx:r,nonTerminalName:s,label:n==null?void 0:n.LABEL,referencedRule:void 0});return i.definition.push(o),this.outputCst?Xd:Ar}consumeInternalRecord(e,r,n){if(Sr(r),!ks(e)){const o=new Error(` argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}> inside top level rule: <${this.recordingProdStack[0].name}>`);throw o.KNOWN_RECORDER_ERROR=!0,o}const i=ft(this.recordingProdStack),s=new X({idx:r,terminalType:e,label:n==null?void 0:n.LABEL});return i.definition.push(s),mo}}function Ut(t,e,r,n=!1){Sr(r);const i=ft(this.recordingProdStack),s=$e(e)?e:e.DEF,o=new t({definition:[],idx:r});return n&&(o.separator=e.SEP),M(e,"MAX_LOOKAHEAD")&&(o.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(o),s.call(this),i.definition.push(o),this.recordingProdStack.pop(),Ar}function Jd(t,e){Sr(e);const r=ft(this.recordingProdStack),n=j(t)===!1,i=n===!1?t:t.DEF,s=new ke({definition:[],idx:e,ignoreAmbiguities:n&&t.IGNORE_AMBIGUITIES===!0});M(t,"MAX_LOOKAHEAD")&&(s.maxLookahead=t.MAX_LOOKAHEAD);const o=fs(i,c=>$e(c.GATE));return s.hasPredicates=o,r.definition.push(s),k(i,c=>{const a=new fe({definition:[]});s.definition.push(a),M(c,"IGNORE_AMBIGUITIES")?a.ignoreAmbiguities=c.IGNORE_AMBIGUITIES:M(c,"GATE")&&(a.ignoreAmbiguities=!0),this.recordingProdStack.push(a),c.ALT.call(this),this.recordingProdStack.pop()}),Ar}function go(t){return t===0?"":`${t}`}function Sr(t){if(t<0||t>fo){const e=new Error(`Invalid DSL Method idx value: <${t}> Idx value must be a none negative value smaller than ${fo+1}`);throw e.KNOWN_RECORDER_ERROR=!0,e}}class Zd{initPerformanceTracer(e){if(M(e,"traceInitPerf")){const r=e.traceInitPerf,n=typeof r=="number";this.traceInitMaxIdent=n?r:1/0,this.traceInitPerf=n?r>0:r}else this.traceInitMaxIdent=0,this.traceInitPerf=Ke.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,r){if(this.traceInitPerf===!0){this.traceInitIndent++;const n=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent <${e}>`);const{time:i,value:s}=ds(r),o=i>10?console.warn:console.log;return this.traceInitIndent time: ${i}ms`),this.traceInitIndent--,s}else return r()}}function em(t,e){e.forEach(r=>{const n=r.prototype;Object.getOwnPropertyNames(n).forEach(i=>{if(i==="constructor")return;const s=Object.getOwnPropertyDescriptor(n,i);s&&(s.get||s.set)?Object.defineProperty(t.prototype,i,s):t.prototype[i]=r.prototype[i]})})}const Rr=dn(ot,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(Rr);const Ke=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:Bs,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),Or=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0});var le;(function(t){t[t.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",t[t.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",t[t.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",t[t.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",t[t.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",t[t.LEFT_RECURSION=5]="LEFT_RECURSION",t[t.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",t[t.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",t[t.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",t[t.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",t[t.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",t[t.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",t[t.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",t[t.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION"})(le||(le={}));class Dt{static performSelfAnalysis(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT("performSelfAnalysis",()=>{let e;this.selfAnalysisDone=!0;const r=this.className;this.TRACE_INIT("toFastProps",()=>{ms(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),k(this.definedRulesNames,i=>{const s=this[i].originalGrammarAction;let o;this.TRACE_INIT(`${i} Rule`,()=>{o=this.topLevelRuleRecord(i,s)}),this.gastProductionsCache[i]=o})}finally{this.disableRecording()}});let n=[];if(this.TRACE_INIT("Grammar Resolving",()=>{n=Sd({rules:te(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(n)}),this.TRACE_INIT("Grammar Validations",()=>{if(H(n)&&this.skipValidations===!1){const i=Rd({rules:te(this.gastProductionsCache),tokenTypes:te(this.tokensMap),errMsgProvider:at,grammarName:r}),s=cd({lookaheadStrategy:this.lookaheadStrategy,rules:te(this.gastProductionsCache),tokenTypes:te(this.tokensMap),grammarName:r});this.definitionErrors=this.definitionErrors.concat(i,s)}}),H(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{const i=tp(te(this.gastProductionsCache));this.resyncFollows=i}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var i,s;(s=(i=this.lookaheadStrategy).initialize)===null||s===void 0||s.call(i,{rules:te(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(te(this.gastProductionsCache))})),!Dt.DEFER_DEFINITION_ERRORS_HANDLING&&!H(this.definitionErrors))throw e=C(this.definitionErrors,i=>i.message),new Error(`Parser Definition Errors detected: ${e.join(` ------------------------------- `)}`)})}constructor(e,r){this.definitionErrors=[],this.selfAnalysisDone=!1;const n=this;if(n.initErrorHandler(r),n.initLexerAdapter(),n.initLooksAhead(r),n.initRecognizerEngine(e,r),n.initRecoverable(r),n.initTreeBuilder(r),n.initContentAssist(),n.initGastRecorder(r),n.initPerformanceTracer(r),M(r,"ignoredIssues"))throw new Error(`The IParserConfig property has been deprecated. Please use the flag on the relevant DSL method instead. See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES For further details.`);this.skipValidations=M(r,"skipValidations")?r.skipValidations:Ke.skipValidations}}Dt.DEFER_DEFINITION_ERRORS_HANDLING=!1,em(Dt,[Md,Pd,Wd,Kd,zd,Hd,qd,Yd,Qd,Zd]);class tm extends Dt{constructor(e,r=Ke){const n=se(r);n.outputCst=!0,super(e,n)}}const vo=G({name:"HTML_COMMENT",pattern://,line_breaks:!0}),Eo=G({name:"HTML_CONDITIONAL_COMMENT",pattern://,line_breaks:!0}),rm=G({name:"XML",pattern:/<\?xml(?:.|\s)*?\?>/}),To=G({name:"CDATA",pattern://}),_o=G({name:"DTD",pattern://}),yo=G({name:"SCRIPTLET",pattern:/<%(.*?)%>|<\?(.*?)\?>/}),nm=G({name:"SEA_WS",pattern:/[ \t]+/,group:ue.SKIPPED}),Ao=G({name:"LINE_BREAK",pattern:/\r?\n/}),So=G({name:"SCRIPT_OPEN",pattern:/]*>/,push_mode:"SCRIPT"}),Ro=G({name:"STYLE_OPEN",pattern:/]*>/,push_mode:"STYLE"}),In=G({name:"TAG_OPEN",pattern://,pop_mode:!0}),Lo=G({name:"TAG_SLASH_CLOSE",pattern:/\/>/,pop_mode:!0}),Io=G({name:"TAG_SLASH",pattern:/\//}),Co=G({name:"TAG_EQUALS",pattern:/=/,push_mode:"ATTVALUE"}),Lr=G({name:"TAG_NAME",pattern:/[:@a-zA-Z\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:\.\-@\u00B7\u0300-\u036F\u203F-\u2040.0-9a-zA-Z]*/}),im=G({name:"TAG_WHITESPACE",pattern:/[ \t\r\n]+/,group:ue.SKIPPED}),Mo=G({name:"SCRIPT_BODY",pattern:/[\s\S]*?<\/script>/,pop_mode:!0}),bo=G({name:"STYLE_BODY",pattern:/[\s\S]*?<\/style>/,pop_mode:!0}),ko=G({name:"ATTVALUE_VALUE",pattern:/ *("[^<"]*"|'[^<']*'|[-_./+,?=:#;0-9a-zA-Z]+ ?|#[0-9a-fA-F]+|[0-9]+%?)/,pop_mode:!0}),Mn=G({name:"EDGE_COMMENT",pattern:/{{--[\s\S]*?--}}/,line_breaks:!0}),bn=G({name:"EDGE_MUSTACHE",pattern:/{{[\s\S]*?}}\s*/}),kn=G({name:"EDGE_SAFE_MUSTACHE",pattern:/{{{[\s\S]*?}}}\s*/}),No=G({name:"EDGE_ESCAPED_MUSTACHE",pattern:/@{{[\s\S]*?}}\s*/}),Po=G({name:"EDGE_TAG",pattern:/@(?:!?\w+(?:\.\w+)*)\s*(?:\((?:[^)(]+|\((?:[^)(]+|\([^)(]*\))*\))*\))?/}),wo=G({name:"EDGE_TAG_PROP",pattern:/@(if|elseif|else|each|flashMessage)\([^)]*\)\s*([\s\S]*?)@end/}),Nn={defaultMode:"default",modes:{default:[vo,Eo,rm,To,_o,yo,Ao,nm,So,Ro,In,Mn,No,kn,bn,Po,Oo],TAG:[Cn,Lo,Io,Co,Mn,kn,bn,wo,Lr,im],SCRIPT:[Mo],STYLE:[bo],ATTVALUE:[ko]}},sm=()=>{const t=[];for(const e in Nn.modes)t.push(...Nn.modes[e]);return t},om=new ue(Nn);class xo extends tm{constructor(){super(sm());const e=this;e.RULE("document",()=>{e.MANY(()=>{e.SUBRULE(e.content)})}),e.RULE("content",()=>{e.OR([{ALT:()=>e.CONSUME(Oo)},{ALT:()=>e.CONSUME(Ao)},{ALT:()=>e.SUBRULE(e.element)},{ALT:()=>e.SUBRULE(e.scriptlet)},{ALT:()=>e.SUBRULE(e.htmlComment)},{ALT:()=>e.SUBRULE(e.htmlConditionalComment)},{ALT:()=>e.SUBRULE(e.cdata)},{ALT:()=>e.SUBRULE(e.dtd)},{ALT:()=>e.SUBRULE(e.scriptElement)},{ALT:()=>e.SUBRULE(e.styleElement)},{ALT:()=>e.SUBRULE(e.edgeComment)},{ALT:()=>e.SUBRULE(e.edgeSafeMustache)},{ALT:()=>e.SUBRULE(e.edgeMustache)},{ALT:()=>e.SUBRULE(e.edgeEscapedMustache)},{ALT:()=>e.SUBRULE(e.edgeTag)}])}),e.RULE("element",()=>{e.OR([{ALT:()=>e.SUBRULE(e.openingTag)},{ALT:()=>e.SUBRULE(e.closingTag)}])}),e.RULE("openingTag",()=>{e.CONSUME(In),e.CONSUME(Lr),e.MANY(()=>{e.OR([{ALT:()=>e.SUBRULE(e.edgeTagProp)},{ALT:()=>e.SUBRULE(e.attribute)},{ALT:()=>e.SUBRULE(e.edgeSafeMustache)},{ALT:()=>e.SUBRULE(e.edgeMustache)},{ALT:()=>e.SUBRULE(e.edgeComment)}])}),e.OR1([{ALT:()=>e.CONSUME1(Lo)},{ALT:()=>e.CONSUME1(Cn)}])}),e.RULE("attribute",()=>{e.CONSUME(Lr),e.OPTION(()=>{e.CONSUME(Co),e.CONSUME(ko)})}),e.RULE("closingTag",()=>{e.CONSUME(In),e.CONSUME(Io),e.CONSUME(Lr),e.CONSUME(Cn)}),e.RULE("scriptlet",()=>{e.CONSUME(yo)}),e.RULE("htmlComment",()=>{e.CONSUME(vo)}),e.RULE("htmlConditionalComment",()=>{e.CONSUME(Eo)}),e.RULE("cdata",()=>{e.CONSUME(To)}),e.RULE("dtd",()=>{e.CONSUME(_o)}),e.RULE("scriptElement",()=>{e.CONSUME(So),e.CONSUME(Mo)}),e.RULE("styleElement",()=>{e.CONSUME(Ro),e.CONSUME(bo)}),e.RULE("edgeComment",()=>{e.CONSUME(Mn)}),e.RULE("edgeMustache",()=>{e.CONSUME(bn)}),e.RULE("edgeSafeMustache",()=>{e.CONSUME(kn)}),e.RULE("edgeEscapedMustache",()=>{e.CONSUME(No)}),e.RULE("edgeTag",()=>{e.CONSUME(Po)}),e.RULE("edgeTagProp",()=>{e.CONSUME(wo)}),this.performSelfAnalysis()}}const am=new xo,cm=am.getBaseCstVisitorConstructor();var Pn,Ir,wn;class um extends cm{constructor(){super(),ni(this,Ir),ni(this,Pn,new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr","animateMotion","animateTransform","animate","circle","ellipse","feGaussianBlur","feDropShadow","feOffset","feBlend","feColorMatrix","feComposite","feDisplacementMap","feFlood","feImage","feMergeNode","feMorphology","fePointLight","feSpotLight","feTile","feTurbulence","image","line","mpath","path","polygon","polyline","rect","set","stop","use","view"])),this.validateVisitor()}document(e){const r=e.content[0].startOffset,n=e.content[e.content.length-1].endOffset;return{type:"document",children:e.content.map(i=>this.visit(i)),start:r,end:n}}content(e){if(e.HTML_TEXT)return{type:"htmlText",value:e.HTML_TEXT[0].image,start:e.HTML_TEXT[0].startOffset,end:e.HTML_TEXT[0].endOffset};if(e.LINE_BREAK)return{type:"linebreak",value:e.LINE_BREAK[0].image,start:e.LINE_BREAK[0].startOffset,end:e.LINE_BREAK[0].endOffset};const r=e.element||e.scriptlet||e.htmlComment||e.htmlConditionalComment||e.cdata||e.dtd||e.scriptElement||e.styleElement||e.edgeComment||e.edgeMustache||e.edgeSafeMustache||e.edgeEscapedMustache||e.edgeTag||e.htmlText;return this.visit(r)}element(e){return e.openingTag?this.visit(e.openingTag):e.selfClosingTag?this.visit(e.selfClosingTag):this.visit(e.closingTag)}openingTag(e){const r=e.TAG_NAME[0].image,n=e.edgeSafeMustache?e.edgeSafeMustache.map(l=>this.visit(l)):[],i=e.edgeMustache?e.edgeMustache.map(l=>this.visit(l)):[],s=e.edgeTagProp?e.edgeTagProp.map(l=>this.visit(l)):[],o=e.attribute?e.attribute.map(l=>this.visit(l)):[],c=e.edgeComment?e.edgeComment.map(l=>this.visit(l)):[],a=e.TAG_NAME[0].startOffset,u=e.TAG_NAME[0].endOffset;return ii(this,Ir,wn).call(this,r)||e.TAG_SLASH_CLOSE?{type:"voidTag",tagName:r,edgeSafeMustaches:n,edgeMustaches:i,edgeTagProps:s,attributes:o,comments:c,start:a,end:u}:{type:"openingTag",tagName:r,edgeSafeMustaches:n,edgeMustaches:i,edgeTagProps:s,attributes:o,comments:c,start:a,end:u}}attribute(e){var r,n,i;const s=e.TAG_NAME[0].image,o=(i=(n=(r=e.ATTVALUE_VALUE)==null?void 0:r[0])==null?void 0:n.image)==null?void 0:i.trim(),c=e.TAG_NAME[0].startOffset,a=e.ATTVALUE_VALUE?e.ATTVALUE_VALUE[0].endOffset:e.TAG_NAME[0].endOffset;return{type:"attribute",attributeName:s,attributeValue:o,start:c,end:a}}closingTag(e){const r=e.TAG_NAME[0].image,n=e.TAG_OPEN[0].startOffset,i=e.TAG_CLOSE[0].endOffset;return ii(this,Ir,wn).call(this,r)?{type:"doNotPrint"}:{type:"closingTag",tagName:r,start:n,end:i}}scriptlet(e){const r=e.SCRIPTLET[0].image,n=e.SCRIPTLET[0].startOffset,i=e.SCRIPTLET[0].endOffset;return{type:"scriptlet",value:r,start:n,end:i}}htmlComment(e){const r=e.HTML_COMMENT[0].image,n=e.HTML_COMMENT[0].startOffset,i=e.HTML_COMMENT[0].endOffset;return{type:"htmlComment",value:r,start:n,end:i}}htmlConditionalComment(e){const r=e.HTML_CONDITIONAL_COMMENT[0].image,n=e.HTML_CONDITIONAL_COMMENT[0].startOffset,i=e.HTML_CONDITIONAL_COMMENT[0].endOffset;return{type:"htmlConditionalComment",value:r,start:n,end:i}}cdata(e){const r=e.CDATA[0].image,n=e.CDATA[0].startOffset,i=e.CDATA[0].endOffset;return{type:"cdata",value:r,start:n,end:i}}dtd(e){const r=e.DTD[0].image,n=e.DTD[0].startOffset,i=e.DTD[0].endOffset;return{type:"dtd",value:r,start:n,end:i}}scriptElement(e){const r=e.SCRIPT_OPEN[0].image+e.SCRIPT_BODY[0].image,n=e.SCRIPT_OPEN[0].startOffset,i=e.SCRIPT_BODY[0].endOffset;return{type:"scriptElement",value:r,start:n,end:i}}styleElement(e){const r=e.STYLE_OPEN[0].image+e.STYLE_BODY[0].image,n=e.STYLE_OPEN[0].startOffset,i=e.STYLE_BODY[0].endOffset;return{type:"styleElement",value:r,start:n,end:i}}edgeComment(e){const r=e.EDGE_COMMENT[0].image,n=e.EDGE_COMMENT[0].startOffset,i=e.EDGE_COMMENT[0].endOffset;return{type:"edgeComment",value:r,start:n,end:i}}edgeMustache(e){const r=e.EDGE_MUSTACHE[0].image,n=e.EDGE_MUSTACHE[0].startOffset,i=e.EDGE_MUSTACHE[0].endOffset;return{type:"edgeMustache",value:r,start:n,end:i}}edgeSafeMustache(e){const r=e.EDGE_SAFE_MUSTACHE[0].image,n=e.EDGE_SAFE_MUSTACHE[0].startOffset,i=e.EDGE_SAFE_MUSTACHE[0].endOffset;return{type:"edgeSafeMustache",value:r,start:n,end:i}}edgeEscapedMustache(e){const r=e.EDGE_ESCAPED_MUSTACHE[0].image,n=e.EDGE_ESCAPED_MUSTACHE[0].startOffset,i=e.EDGE_ESCAPED_MUSTACHE[0].endOffset;return{type:"edgeEscapedMustache",value:r,start:n,end:i}}edgeTag(e){const r=e.EDGE_TAG[0].image,n=e.EDGE_TAG[0].startOffset,i=e.EDGE_TAG[0].endOffset;return{type:"edgeTag",value:r,start:n,end:i}}edgeTagProp(e){const r=e.EDGE_TAG_PROP[0].image,n=e.EDGE_TAG_PROP[0].startOffset,i=e.EDGE_TAG_PROP[0].endOffset;return{type:"edgeTagProp",value:r,start:n,end:i}}}Pn=new WeakMap,Ir=new WeakSet,wn=function(t){return pa(this,Pn).has(t)};const Cr=new xo,lm=new um;function xn(t){const e=om.tokenize(t);Cr.input=e.tokens;const r=Cr.document();if(Cr.errors.length>0)throw new Error(`Parsing Errors Detected: ${JSON.stringify(Cr.errors)}`);return lm.visit(r)}function hm(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function fm(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var Mr={},Un,Uo;function pm(){if(Uo)return Un;Uo=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;Un=function(n,i){i=i||{};var s=1,o=1;function c(L){var A=L.match(/\n/g);A&&(s+=A.length);var b=L.lastIndexOf(` `);o=~b?L.length-b:o+L.length}function a(){var L={line:s,column:o};return function(A){return A.position=new u(L),y(),A}}function u(L){this.start=L,this.end={line:s,column:o},this.source=i.source}u.prototype.content=n;var l=[];function h(L){var A=new Error(i.source+":"+s+":"+o+": "+L);if(A.reason=L,A.filename=i.source,A.line=s,A.column=o,A.source=n,i.silent)l.push(A);else throw A}function m(){var L=g();return{type:"stylesheet",stylesheet:{source:i.source,rules:L,parsingErrors:l}}}function p(){return _(/^{\s*/)}function d(){return _(/^}/)}function g(){var L,A=[];for(y(),E(A);n.length&&n.charAt(0)!="}"&&(L=q()||ie());)L!==!1&&(A.push(L),E(A));return A}function _(L){var A=L.exec(n);if(A){var b=A[0];return c(b),n=n.slice(b.length),A}}function y(){_(/^\s*/)}function E(L){var A;for(L=L||[];A=T();)A!==!1&&L.push(A);return L}function T(){var L=a();if(!(n.charAt(0)!="/"||n.charAt(1)!="*")){for(var A=2;n.charAt(A)!=""&&(n.charAt(A)!="*"||n.charAt(A+1)!="/");)++A;if(A+=2,n.charAt(A-1)==="")return h("End of comment missing");var b=n.slice(2,A-2);return o+=2,c(b),n=n.slice(A),o+=2,L({type:"comment",comment:b})}}function f(){var L=_(/^([^{]+)/);if(L)return e(L[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,function(A){return A.replace(/,/g,"‌")}).split(/\s*(?![^(]*\)),\s*/).map(function(A){return A.replace(/\u200C/g,",")})}function v(){var L=a(),A=_(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(A){if(A=e(A[0]),!_(/^:\s*/))return h("property missing ':'");var b=_(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),Q=L({type:"declaration",property:A.replace(t,""),value:b?e(b[0]).replace(t,""):""});return _(/^[;\s]*/),Q}}function R(){var L=[];if(!p())return h("missing '{'");E(L);for(var A;A=v();)A!==!1&&(L.push(A),E(L));return d()?L:h("missing '}'")}function S(){for(var L,A=[],b=a();L=_(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)A.push(L[1]),_(/^,\s*/);if(A.length)return b({type:"keyframe",values:A,declarations:R()})}function D(){var L=a(),b=_(/^@([-\w]+)?keyframes\s*/);if(b){var A=b[1],b=_(/^([-\w]+)\s*/);if(!b)return h("@keyframes missing name");var Q=b[1];if(!p())return h("@keyframes missing '{'");for(var W,ae=E();W=S();)ae.push(W),ae=ae.concat(E());return d()?L({type:"keyframes",name:Q,vendor:A,keyframes:ae}):h("@keyframes missing '}'")}}function ne(){var L=a(),A=_(/^@supports *([^{]+)/);if(A){var b=e(A[1]);if(!p())return h("@supports missing '{'");var Q=E().concat(g());return d()?L({type:"supports",supports:b,rules:Q}):h("@supports missing '}'")}}function F(){var L=a(),A=_(/^@host\s*/);if(A){if(!p())return h("@host missing '{'");var b=E().concat(g());return d()?L({type:"host",rules:b}):h("@host missing '}'")}}function I(){var L=a(),A=_(/^@media *([^{]+)/);if(A){var b=e(A[1]);if(!p())return h("@media missing '{'");var Q=E().concat(g());return d()?L({type:"media",media:b,rules:Q}):h("@media missing '}'")}}function w(){var L=a(),A=_(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(A)return L({type:"custom-media",name:e(A[1]),media:e(A[2])})}function x(){var L=a(),A=_(/^@page */);if(A){var b=f()||[];if(!p())return h("@page missing '{'");for(var Q=E(),W;W=v();)Q.push(W),Q=Q.concat(E());return d()?L({type:"page",selectors:b,declarations:Q}):h("@page missing '}'")}}function N(){var L=a(),A=_(/^@([-\w]+)?document *([^{]+)/);if(A){var b=e(A[1]),Q=e(A[2]);if(!p())return h("@document missing '{'");var W=E().concat(g());return d()?L({type:"document",document:Q,vendor:b,rules:W}):h("@document missing '}'")}}function O(){var L=a(),A=_(/^@font-face\s*/);if(A){if(!p())return h("@font-face missing '{'");for(var b=E(),Q;Q=v();)b.push(Q),b=b.concat(E());return d()?L({type:"font-face",declarations:b}):h("@font-face missing '}'")}}var B=Y("import"),U=Y("charset"),V=Y("namespace");function Y(L){var A=new RegExp("^@"+L+"\\s*([^;]+);");return function(){var b=a(),Q=_(A);if(Q){var W={type:L};return W[L]=Q[1].trim(),b(W)}}}function q(){if(n[0]=="@")return D()||I()||w()||ne()||B()||U()||V()||N()||x()||F()||O()}function ie(){var L=a(),A=f();return A?(E(),L({type:"rule",selectors:A,declarations:R()})):h("selector missing")}return r(m())};function e(n){return n?n.replace(/^\s+|\s+$/g,""):""}function r(n,i){var s=n&&typeof n.type=="string",o=s?n:i;for(var c in n){var a=n[c];Array.isArray(a)?a.forEach(function(u){r(u,o)}):a&&typeof a=="object"&&r(a,o)}return s&&Object.defineProperty(n,"parent",{configurable:!0,writable:!0,enumerable:!1,value:i||null}),n}return Un}var Dn,Do;function Fo(){if(Do)return Dn;Do=1,Dn=t;function t(e){this.options=e||{}}return t.prototype.emit=function(e){return e},t.prototype.visit=function(e){return this[e.type](e)},t.prototype.mapVisit=function(e,r){var n="";r=r||"";for(var i=0,s=e.length;i>1;return a?-u:u}return Nr.encode=function(a){var u="",l,h=s(a);do l=h&n,h>>>=e,h>0&&(l|=i),u+=t.encode(l);while(h>0);return u},Nr.decode=function(a,u,l){var h=a.length,m=0,p=0,d,g;do{if(u>=h)throw new Error("Expected more digits in base 64 VLQ value.");if(g=t.decode(a.charCodeAt(u++)),g===-1)throw new Error("Invalid base64 digit: "+a.charAt(u-1));d=!!(g&i),g&=n,m=m+(g<=0;I--)ne=D[I],ne==="."?D.splice(I,1):ne===".."?F++:F>0&&(ne===""?(D.splice(I+1,F),F=0):(D.splice(I,2),F--));return v=D.join("/"),v===""&&(v=S?"/":"."),R?(R.path=v,s(R)):v}t.normalize=o;function c(f,v){f===""&&(f="."),v===""&&(v=".");var R=i(v),S=i(f);if(S&&(f=S.path||"/"),R&&!R.scheme)return S&&(R.scheme=S.scheme),s(R);if(R||v.match(n))return v;if(S&&!S.host&&!S.path)return S.host=v,s(S);var D=v.charAt(0)==="/"?v:o(f.replace(/\/+$/,"")+"/"+v);return S?(S.path=D,s(S)):D}t.join=c,t.isAbsolute=function(f){return f.charAt(0)==="/"||r.test(f)};function a(f,v){f===""&&(f="."),f=f.replace(/\/$/,"");for(var R=0;v.indexOf(f+"/")!==0;){var S=f.lastIndexOf("/");if(S<0||(f=f.slice(0,S),f.match(/^([^\/]+:\/)?\/*$/)))return v;++R}return Array(R+1).join("../")+v.substr(f.length+1)}t.relative=a;var u=function(){var f=Object.create(null);return!("__proto__"in f)}();function l(f){return f}function h(f){return p(f)?"$"+f:f}t.toSetString=u?l:h;function m(f){return p(f)?f.slice(1):f}t.fromSetString=u?l:m;function p(f){if(!f)return!1;var v=f.length;if(v<9||f.charCodeAt(v-1)!==95||f.charCodeAt(v-2)!==95||f.charCodeAt(v-3)!==111||f.charCodeAt(v-4)!==116||f.charCodeAt(v-5)!==111||f.charCodeAt(v-6)!==114||f.charCodeAt(v-7)!==112||f.charCodeAt(v-8)!==95||f.charCodeAt(v-9)!==95)return!1;for(var R=v-10;R>=0;R--)if(f.charCodeAt(R)!==36)return!1;return!0}function d(f,v,R){var S=_(f.source,v.source);return S!==0||(S=f.originalLine-v.originalLine,S!==0)||(S=f.originalColumn-v.originalColumn,S!==0||R)||(S=f.generatedColumn-v.generatedColumn,S!==0)||(S=f.generatedLine-v.generatedLine,S!==0)?S:_(f.name,v.name)}t.compareByOriginalPositions=d;function g(f,v,R){var S=f.generatedLine-v.generatedLine;return S!==0||(S=f.generatedColumn-v.generatedColumn,S!==0||R)||(S=_(f.source,v.source),S!==0)||(S=f.originalLine-v.originalLine,S!==0)||(S=f.originalColumn-v.originalColumn,S!==0)?S:_(f.name,v.name)}t.compareByGeneratedPositionsDeflated=g;function _(f,v){return f===v?0:f===null?1:v===null?-1:f>v?1:-1}function y(f,v){var R=f.generatedLine-v.generatedLine;return R!==0||(R=f.generatedColumn-v.generatedColumn,R!==0)||(R=_(f.source,v.source),R!==0)||(R=f.originalLine-v.originalLine,R!==0)||(R=f.originalColumn-v.originalColumn,R!==0)?R:_(f.name,v.name)}t.compareByGeneratedPositionsInflated=y;function E(f){return JSON.parse(f.replace(/^\)]}'[^\n]*\n/,""))}t.parseSourceMapInput=E;function T(f,v,R){if(v=v||"",f&&(f[f.length-1]!=="/"&&v[0]!=="/"&&(f+="/"),v=f+v),R){var S=i(R);if(!S)throw new Error("sourceMapURL could not be parsed");if(S.path){var D=S.path.lastIndexOf("/");D>=0&&(S.path=S.path.substring(0,D+1))}v=c(s(S),v)}return o(v)}t.computeSourceURL=T}(Gn)),Gn}var Bn={},zo;function qo(){if(zo)return Bn;zo=1;var t=jt(),e=Object.prototype.hasOwnProperty,r=typeof Map<"u";function n(){this._array=[],this._set=r?new Map:Object.create(null)}return n.fromArray=function(s,o){for(var c=new n,a=0,u=s.length;a=0)return o}else{var c=t.toSetString(s);if(e.call(this._set,c))return this._set[c]}throw new Error('"'+s+'" is not in the set.')},n.prototype.at=function(s){if(s>=0&&ss||o==s&&a>=c||t.compareByGeneratedPositionsInflated(n,i)<=0}function r(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}return r.prototype.unsortedForEach=function(i,s){this._array.forEach(i,s)},r.prototype.add=function(i){e(this._last,i)?(this._last=i,this._array.push(i)):(this._sorted=!1,this._array.push(i))},r.prototype.toArray=function(){return this._sorted||(this._array.sort(t.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},Vn.MappingList=r,Vn}var Xo;function Qo(){if(Xo)return $n;Xo=1;var t=Ko(),e=jt(),r=qo().ArraySet,n=vm().MappingList;function i(s){s||(s={}),this._file=e.getArg(s,"file",null),this._sourceRoot=e.getArg(s,"sourceRoot",null),this._skipValidation=e.getArg(s,"skipValidation",!1),this._sources=new r,this._names=new r,this._mappings=new n,this._sourcesContents=null}return i.prototype._version=3,i.fromSourceMap=function(o){var c=o.sourceRoot,a=new i({file:o.file,sourceRoot:c});return o.eachMapping(function(u){var l={generated:{line:u.generatedLine,column:u.generatedColumn}};u.source!=null&&(l.source=u.source,c!=null&&(l.source=e.relative(c,l.source)),l.original={line:u.originalLine,column:u.originalColumn},u.name!=null&&(l.name=u.name)),a.addMapping(l)}),o.sources.forEach(function(u){var l=u;c!==null&&(l=e.relative(c,u)),a._sources.has(l)||a._sources.add(l);var h=o.sourceContentFor(u);h!=null&&a.setSourceContent(u,h)}),a},i.prototype.addMapping=function(o){var c=e.getArg(o,"generated"),a=e.getArg(o,"original",null),u=e.getArg(o,"source",null),l=e.getArg(o,"name",null);this._skipValidation||this._validateMapping(c,a,u,l),u!=null&&(u=String(u),this._sources.has(u)||this._sources.add(u)),l!=null&&(l=String(l),this._names.has(l)||this._names.add(l)),this._mappings.add({generatedLine:c.line,generatedColumn:c.column,originalLine:a!=null&&a.line,originalColumn:a!=null&&a.column,source:u,name:l})},i.prototype.setSourceContent=function(o,c){var a=o;this._sourceRoot!=null&&(a=e.relative(this._sourceRoot,a)),c!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[e.toSetString(a)]=c):this._sourcesContents&&(delete this._sourcesContents[e.toSetString(a)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))},i.prototype.applySourceMap=function(o,c,a){var u=c;if(c==null){if(o.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);u=o.file}var l=this._sourceRoot;l!=null&&(u=e.relative(l,u));var h=new r,m=new r;this._mappings.unsortedForEach(function(p){if(p.source===u&&p.originalLine!=null){var d=o.originalPositionFor({line:p.originalLine,column:p.originalColumn});d.source!=null&&(p.source=d.source,a!=null&&(p.source=e.join(a,p.source)),l!=null&&(p.source=e.relative(l,p.source)),p.originalLine=d.line,p.originalColumn=d.column,d.name!=null&&(p.name=d.name))}var g=p.source;g!=null&&!h.has(g)&&h.add(g);var _=p.name;_!=null&&!m.has(_)&&m.add(_)},this),this._sources=h,this._names=m,o.sources.forEach(function(p){var d=o.sourceContentFor(p);d!=null&&(a!=null&&(p=e.join(a,p)),l!=null&&(p=e.relative(l,p)),this.setSourceContent(p,d))},this)},i.prototype._validateMapping=function(o,c,a,u){if(c&&typeof c.line!="number"&&typeof c.column!="number")throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(!(o&&"line"in o&&"column"in o&&o.line>0&&o.column>=0&&!c&&!a&&!u)){if(o&&"line"in o&&"column"in o&&c&&"line"in c&&"column"in c&&o.line>0&&o.column>=0&&c.line>0&&c.column>=0&&a)return;throw new Error("Invalid mapping: "+JSON.stringify({generated:o,source:a,original:c,name:u}))}},i.prototype._serializeMappings=function(){for(var o=0,c=1,a=0,u=0,l=0,h=0,m="",p,d,g,_,y=this._mappings.toArray(),E=0,T=y.length;E0){if(!e.compareByGeneratedPositionsInflated(d,y[E-1]))continue;p+=","}p+=t.encode(d.generatedColumn-o),o=d.generatedColumn,d.source!=null&&(_=this._sources.indexOf(d.source),p+=t.encode(_-h),h=_,p+=t.encode(d.originalLine-1-u),u=d.originalLine-1,p+=t.encode(d.originalColumn-a),a=d.originalColumn,d.name!=null&&(g=this._names.indexOf(d.name),p+=t.encode(g-l),l=g)),m+=p}return m},i.prototype._generateSourcesContent=function(o,c){return o.map(function(a){if(!this._sourcesContents)return null;c!=null&&(a=e.relative(c,a));var u=e.toSetString(a);return Object.prototype.hasOwnProperty.call(this._sourcesContents,u)?this._sourcesContents[u]:null},this)},i.prototype.toJSON=function(){var o={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(o.file=this._file),this._sourceRoot!=null&&(o.sourceRoot=this._sourceRoot),this._sourcesContents&&(o.sourcesContent=this._generateSourcesContent(o.sources,o.sourceRoot)),o},i.prototype.toString=function(){return JSON.stringify(this.toJSON())},$n.SourceMapGenerator=i,$n}var $t={},Wn={},Jo;function Em(){return Jo||(Jo=1,function(t){t.GREATEST_LOWER_BOUND=1,t.LEAST_UPPER_BOUND=2;function e(r,n,i,s,o,c){var a=Math.floor((n-r)/2)+r,u=o(i,s[a],!0);return u===0?a:u>0?n-a>1?e(a,n,i,s,o,c):c==t.LEAST_UPPER_BOUND?n1?e(r,a,i,s,o,c):c==t.LEAST_UPPER_BOUND?a:r<0?-1:r}t.search=function(n,i,s,o){if(i.length===0)return-1;var c=e(-1,i.length,n,i,s,o||t.GREATEST_LOWER_BOUND);if(c<0)return-1;for(;c-1>=0&&s(i[c],i[c-1],!0)===0;)--c;return c}}(Wn)),Wn}var Kn={},Zo;function Tm(){if(Zo)return Kn;Zo=1;function t(n,i,s){var o=n[i];n[i]=n[s],n[s]=o}function e(n,i){return Math.round(n+Math.random()*(i-n))}function r(n,i,s,o){if(s=0){var g=this._originalMappings[d];if(l.column===void 0)for(var _=g.originalLine;g&&g.originalLine===_;)p.push({line:t.getArg(g,"generatedLine",null),column:t.getArg(g,"generatedColumn",null),lastColumn:t.getArg(g,"lastGeneratedColumn",null)}),g=this._originalMappings[++d];else for(var y=g.originalColumn;g&&g.originalLine===h&&g.originalColumn==y;)p.push({line:t.getArg(g,"generatedLine",null),column:t.getArg(g,"generatedColumn",null),lastColumn:t.getArg(g,"lastGeneratedColumn",null)}),g=this._originalMappings[++d]}return p},$t.SourceMapConsumer=s;function o(u,l){var h=u;typeof u=="string"&&(h=t.parseSourceMapInput(u));var m=t.getArg(h,"version"),p=t.getArg(h,"sources"),d=t.getArg(h,"names",[]),g=t.getArg(h,"sourceRoot",null),_=t.getArg(h,"sourcesContent",null),y=t.getArg(h,"mappings"),E=t.getArg(h,"file",null);if(m!=this._version)throw new Error("Unsupported version: "+m);g&&(g=t.normalize(g)),p=p.map(String).map(t.normalize).map(function(T){return g&&t.isAbsolute(g)&&t.isAbsolute(T)?t.relative(g,T):T}),this._names=r.fromArray(d.map(String),!0),this._sources=r.fromArray(p,!0),this._absoluteSources=this._sources.toArray().map(function(T){return t.computeSourceURL(g,T,l)}),this.sourceRoot=g,this.sourcesContent=_,this._mappings=y,this._sourceMapURL=l,this.file=E}o.prototype=Object.create(s.prototype),o.prototype.consumer=s,o.prototype._findSourceIndex=function(u){var l=u;if(this.sourceRoot!=null&&(l=t.relative(this.sourceRoot,l)),this._sources.has(l))return this._sources.indexOf(l);var h;for(h=0;h1&&(D.source=_+F[1],_+=F[1],D.originalLine=d+F[2],d=D.originalLine,D.originalLine+=1,D.originalColumn=g+F[3],g=D.originalColumn,F.length>4&&(D.name=y+F[4],y+=F[4])),S.push(D),typeof D.originalLine=="number"&&R.push(D)}i(S,t.compareByGeneratedPositionsDeflated),this.__generatedMappings=S,i(R,t.compareByOriginalPositions),this.__originalMappings=R},o.prototype._findMapping=function(l,h,m,p,d,g){if(l[m]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+l[m]);if(l[p]<0)throw new TypeError("Column must be greater than or equal to 0, got "+l[p]);return e.search(l,h,d,g)},o.prototype.computeColumnSpans=function(){for(var l=0;l=0){var p=this._generatedMappings[m];if(p.generatedLine===h.generatedLine){var d=t.getArg(p,"source",null);d!==null&&(d=this._sources.at(d),d=t.computeSourceURL(this.sourceRoot,d,this._sourceMapURL));var g=t.getArg(p,"name",null);return g!==null&&(g=this._names.at(g)),{source:d,line:t.getArg(p,"originalLine",null),column:t.getArg(p,"originalColumn",null),name:g}}}return{source:null,line:null,column:null,name:null}},o.prototype.hasContentsOfAllSources=function(){return this.sourcesContent?this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(l){return l==null}):!1},o.prototype.sourceContentFor=function(l,h){if(!this.sourcesContent)return null;var m=this._findSourceIndex(l);if(m>=0)return this.sourcesContent[m];var p=l;this.sourceRoot!=null&&(p=t.relative(this.sourceRoot,p));var d;if(this.sourceRoot!=null&&(d=t.urlParse(this.sourceRoot))){var g=p.replace(/^file:\/\//,"");if(d.scheme=="file"&&this._sources.has(g))return this.sourcesContent[this._sources.indexOf(g)];if((!d.path||d.path=="/")&&this._sources.has("/"+p))return this.sourcesContent[this._sources.indexOf("/"+p)]}if(h)return null;throw new Error('"'+p+'" is not in the SourceMap.')},o.prototype.generatedPositionFor=function(l){var h=t.getArg(l,"source");if(h=this._findSourceIndex(h),h<0)return{line:null,column:null,lastColumn:null};var m={source:h,originalLine:t.getArg(l,"line"),originalColumn:t.getArg(l,"column")},p=this._findMapping(m,this._originalMappings,"originalLine","originalColumn",t.compareByOriginalPositions,t.getArg(l,"bias",s.GREATEST_LOWER_BOUND));if(p>=0){var d=this._originalMappings[p];if(d.source===m.source)return{line:t.getArg(d,"generatedLine",null),column:t.getArg(d,"generatedColumn",null),lastColumn:t.getArg(d,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},$t.BasicSourceMapConsumer=o;function a(u,l){var h=u;typeof u=="string"&&(h=t.parseSourceMapInput(u));var m=t.getArg(h,"version"),p=t.getArg(h,"sections");if(m!=this._version)throw new Error("Unsupported version: "+m);this._sources=new r,this._names=new r;var d={line:-1,column:0};this._sections=p.map(function(g){if(g.url)throw new Error("Support for url field in sections not implemented.");var _=t.getArg(g,"offset"),y=t.getArg(_,"line"),E=t.getArg(_,"column");if(y=0;a--)this.prepend(c[a]);else if(c[i]||typeof c=="string")this.children.unshift(c);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+c);return this},s.prototype.walk=function(c){for(var a,u=0,l=this.children.length;u0){for(a=[],u=0;u"u"||typeof Uint8Array>"u")return t(I);var w=E(I),x=new TextDecoder(y,{fatal:!0});return x.decode(w)}function f(I,w){w=s(w);var x=m(I);if(!x)return null;var N=x.match(g);if(N){var O=N[1]||"text/plain",B=N[2]||"",U=N[3]||"",V={sourceMappingURL:x,url:null,sourcesRelativeTo:w,map:U};if(!_.test(O)){var Y=new Error("Unuseful data uri mime type: "+O);throw Y.sourceMapData=V,Y}try{V.map=a(B===";base64"?T(U):decodeURIComponent(U),V)}catch(ie){throw ie.sourceMapData=V,ie}return V}var q=i(w,x);return{sourceMappingURL:x,url:q,sourcesRelativeTo:q,map:null}}function v(I,w,x,N,O){typeof N=="function"&&(O=N,N={});var B=I.sources?I.sources.length:0,U={sourcesResolved:[],sourcesContent:[]};if(B===0){c(O,null,U);return}var V=function(){B--,B===0&&O(null,U)};D(I,w,N,function(Y,q,ie){if(U.sourcesResolved[ie]=Y,typeof q=="string")U.sourcesContent[ie]=q,c(V,null);else{var L=o(Y);x(L,function(A,b){U.sourcesContent[ie]=A||String(b),V()})}})}function R(I,w,x,N){var O={sourcesResolved:[],sourcesContent:[]};return!I.sources||I.sources.length===0||D(I,w,N,function(B,U,V){if(O.sourcesResolved[V]=B,x!==null)if(typeof U=="string")O.sourcesContent[V]=U;else{var Y=o(B);try{O.sourcesContent[V]=String(x(Y))}catch(q){O.sourcesContent[V]=q}}}),O}var S=/\/?$/;function D(I,w,x,N){x=x||{},w=s(w);for(var O,B,U,V=0,Y=I.sources.length;V{const s=`${r}${n.length}`;return n.push(i),s}),t=t.replace(/{{\s*/g,"{{ ").replace(/\s*}}/g," }}"),n.forEach((i,s)=>{t=t.replace(`${r}${s}`,i)}),t}function Zn(t){return t.replace(/{{{\s*/g,"{{{ ").replace(/\s*}}}/g," }}}")}function Nm(t,e,r,n,i,s){const o=/]*>([\s\S]*?)<\/style>/gi,c=/{{.*?}}/g,a=/{{{.*?}}}/g,u=/@(?!media|keyframes|supports|font-face|viewport|counter-style|page|document|font-feature-values)(?:!?\w+(?:\.\w+)*)\s*(?:\((?:[^)(]+|\((?:[^)(]+|\([^)(]*\))*\))*\))?[\s\S]*?@end/g,l=/@(assign|!component|debugger|eval|include|includeIf|inject|stack|svg|let|newError|vite|inertia|dd|dump)\s*(?:\((?:[^)(]+|\((?:[^)(]+|\([^)(]*\))*\))*\))?/g;return t.value.replace(o,(m,p)=>{let d=[],g=0;p=p.replace(a,T=>{const f=`__SAFE_MUSTACHE_TAG_${g++}__;`;return d.push(T),f}),p=p.replace(c,T=>{const f=`__MUSTACHE_TAG_${g++}__;`;return d.push(T),f}),p=p.replace(u,T=>{const f=`/*__EDGE_TAG_BLOCK_${g++}__*/`;return d.push(T),f}),p=p.replace(l,T=>{const f=`/*__SINGLE_EDGE_TAG_${g++}__*/`;return d.push(T),f});const _=la.parse(p),y=la.stringify(_,{indent:n});return`${e}`.replace(/\/\*__EDGE_TAG_BLOCK_\d+__\*\//g,T=>{const f=d[parseInt(T.match(/\d+/)[0],10)],v=new xn(f);return new ei({...i},s+2).handlePrint(v).trim()}).replace(/__MUSTACHE_TAG_\d+__;/g,T=>d[parseInt(T.match(/\d+/)[0],10)]).replace(/__SAFE_MUSTACHE_TAG_\d+__;/g,T=>d[parseInt(T.match(/\d+/)[0],10)]).replace(/\/\*__SINGLE_EDGE_TAG_\d+__\*\//g,T=>d[parseInt(T.match(/\d+/)[0],10)])})}function Pm(t,e,r,n,i,s){const o=/]*)>([\s\S]*?)<\/script>/i,c=/{{.*?}}/g,a=/{{{.*?}}}/g,u=/@(!?\w+(?:\.\w+)*)\s*(?:\((?:[^)(]+|\((?:[^)(]+|\([^)(]*\))*\))*\))?[\s\S]*?@end/g,l=/@(assign|!component|debugger|eval|include|includeIf|inject|stack|svg|let|newError|vite|inertia|dd|dump)\s*(?:\((?:[^)(]+|\((?:[^)(]+|\([^)(]*\))*\))*\))?/g,h=t.value.match(o);if(!h)throw new Error("Invalid