2026-03-09 21:20:57 +00:00
import { _ as En } from "./index-BzKy-nNf.js" ; import { bB as Oh , bC as xh , aQ as bd , bl as Dh , aU as Mh , aR as je , ar as Fh , as as bl , bb as Gh , be as _d , bf as Id , bc as Uh , bq as _l , au as Yn , av as ae , aS as qh , aM as jh , bD as zh } from "./mermaid.core-Bp72wBaC.js" ; import { k as qr , j as tl , g as Hr , S as Bh , w as Wh , x as Vh , c as Pd , v as $e , y as $d , l as Kh , z as Hh , A as Yh , B as Xh , C as Jh , a as Ld , d as q , i as tn , r as Je , f as ht , D as Fe } from "./_baseUniq-Blm_akxr.js" ; import { j as nl , m as M , d as Qh , f as yt , g as jr , h as z , i as rl , l as jn , e as Zh } from "./_basePickBy-BruevaAz.js" ; import { c as Be } from "./clone-BbeogWA3.js" ; var ep = Object . prototype , tp = ep . hasOwnProperty , ft = Oh ( function ( t , e ) { if ( xh ( e ) || bd ( e ) ) { Dh ( e , qr ( e ) , t ) ; return } for ( var n in e ) tp . call ( e , n ) && Mh ( t , n , e [ n ] ) } ) ; function Od ( t , e , n ) { var r = - 1 , i = t . length ; e < 0 && ( e = - e > i ? 0 : i + e ) , n = n > i ? i : n , n < 0 && ( n += i ) , i = e > n ? 0 : n - e >>> 0 , e >>>= 0 ; for ( var s = Array ( i ) ; ++ r < i ; ) s [ r ] = t [ r + e ] ; return s } function ns ( t ) { for ( var e = - 1 , n = t == null ? 0 : t . length , r = 0 , i = [ ] ; ++ e < n ; ) { var s = t [ e ] ; s && ( i [ r ++ ] = s ) } return i } function np ( t , e , n , r ) { for ( var i = - 1 , s = t == null ? 0 : t . length ; ++ i < s ; ) { var a = t [ i ] ; e ( r , a , n ( a ) , t ) } return r } function rp ( t , e , n , r ) { return tl ( t , function ( i , s , a ) { e ( r , i , n ( i ) , a ) } ) , r } function ip ( t , e ) { return function ( n , r ) { var i = je ( n ) ? np : rp , s = e ? e ( ) : { } ; return i ( n , t , Hr ( r ) , s ) } } var sp = 200 ; function ap ( t , e , n , r ) { var i = - 1 , s = Wh , a = ! 0 , o = t . length , c = [ ] , l = e . length ; if ( ! o ) return c ; e . length >= sp && ( s = Vh , a = ! 1 , e = new Bh ( e ) ) ; e : for ( ; ++ i < o ; ) { var u = t [ i ] , f = u ; if ( u = u !== 0 ? u : 0 , a && f === f ) { for ( var m = l ; m -- ; ) if ( e [ m ] === f ) continue e ; c . push ( u ) } else s ( e , f , r ) || c . push ( u ) } return c } var _a = Fh ( function ( t , e ) { return bl ( t ) ? ap ( t , Pd ( e , 1 , bl , ! 0 ) ) : [ ] } ) ; function Ge ( t , e , n ) { var r = t == null ? 0 : t . length ; return r ? ( e = e === void 0 ? 1 : nl ( e ) , Od ( t , e < 0 ? 0 : e , r ) ) : [ ] } function zi ( t , e , n ) { var r = t == null ? 0 : t . length ; return r ? ( e = e === void 0 ? 1 : nl ( e ) , e = r - e , Od ( t , 0 , e < 0 ? 0 : e ) ) : [ ] } function op ( t , e ) { for ( var n = - 1 , r = t == null ? 0 : t . length ; ++ n < r ; ) if ( ! e ( t [ n ] , n , t ) ) return ! 1 ; return ! 0 } function cp ( t , e ) { var n = ! 0 ; return tl ( t , function ( r , i , s ) { return n = ! ! e ( r , i , s ) , n } ) , n } function kt ( t , e , n ) { var r = je ( t ) ? op : cp ; return r ( t , Hr ( e ) ) } function wt ( t ) { return t && t . length ? t [ 0 ] : void 0 } function dt ( t , e ) { return Pd ( M ( t , e ) ) } var lp = Object . prototype , up = lp . hasOwnProperty , dp = ip ( function ( t , e , n ) { up . call ( t , n ) ? t [ n ] . push ( e ) : Gh ( t , n , [ e ] ) } ) , fp = "[object String]" ; function nt ( t ) { return typeof t == "string" || ! je ( t ) && _d ( t ) && Id ( t ) == fp } var hp = Math . max ; function et ( t , e , n , r ) { t = bd ( t ) ? t : $e ( t ) , n = n ? nl ( n ) : 0 ; var i = t . length ; return n < 0 && ( n = hp ( i + n , 0 ) ) , nt ( t ) ? n <= i && t . indexOf ( e , n ) > - 1 : ! ! i && $d ( t , e , n ) > - 1 } function Il ( t , e , n ) { var r = t == null ? 0 : t . length ; if ( ! r ) return - 1 ; var i = 0 ; return $d ( t , e , i ) } var pp = "[object RegExp]" ; function mp ( t ) { return _d ( t ) && Id ( t ) == pp } var Pl = _l && _l . isRegExp , nn = Pl ? Uh ( Pl ) : mp , gp = "Expected a function" ; function yp ( t ) { if ( typeof t != "function" ) throw new TypeError ( gp ) ; 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 Nt ( t , e ) { if ( t == null ) return { } ; var n = Kh ( Hh ( t ) , function ( r ) { return [ r ] } ) ; return e = Hr ( e ) , Qh ( t , n , function ( r , i ) { return e ( r , i [ 0 ] ) } ) } function Ia ( t , e ) { var n = je ( t ) ? Yh : Xh ; return n ( t , yp ( Hr ( e ) ) ) } function Tp ( t , e ) { var n ; return tl ( t , function ( r , i , s ) { return n = e ( r , i , s ) , ! n } ) , ! ! n } function xd ( t , e , n ) { var r = je ( t ) ? Jh : Tp ; return r ( t , Hr ( e ) ) } function il ( t ) { return t && t . length ? Ld ( t ) : [ ] } function Rp ( t , e ) { return t && t . length ? Ld ( t , Hr ( e ) ) : [ ] } function We ( t ) { return typeof t == "object" && t !== null && typeof t . $type == "string" } function St ( t ) { return typeof t == "object" && t !== null && typeof t . $refText == "string" && "ref" in t } function un ( t ) { return typeof t == "object" && t !== null && typeof t . $refText == "string" && "items" in t } function vp ( t ) { return typeof t == "object" && t !== null && typeof t . name == "string" && typeof t . type == "string" && typeof t . path == "string" } function fi ( t ) { return typeof t == "object" && t !== null && typeof t . info == "object" && typeof t . message == "string" } class Dd { constructor ( ) { this . subtypes = { } , this . allSubtypes = { } } getAllTypes ( ) { return Object . keys ( this . types ) } getReferenceType ( e ) { const n = this . types [ e . container . $type ] ; if ( ! n ) throw new Error ( ` Type ${ e . container . $type || "undefined" } not found. ` ) ; const r = n . properties [ e . property ] ? . ref
2026-03-07 19:52:33 +00:00
` ),W(" \r "),W(" "),W(" \v "),W(" "),W(" "),W(" "),W(" "),W(" "),W(" "),W(" "),W(" "),W(" "),W(" "),W(" "),W(" "),W(" "),W(" "),W(" \u 2028"),W(" \u 2029"),W(" "),W(" "),W(" "),W(" \u FEFF")],Yp=/[0-9a-fA-F]/,Ls=/[0-9]/,Xp=/[1-9]/;class Vd{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 n=this.disjunction();this.consumeChar("/");const r={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":gi(r,"global");break;case"i":gi(r,"ignoreCase");break;case"m":gi(r,"multiLine");break;case"u":gi(r,"unicode");break;case"y":gi(r,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:r,value:n,loc:this.loc(0)}}disjunction(){const e=[],n=this.idx;for(e.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(n)}}alternative(){const e=[],n=this.idx;for(;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(n)}}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 n;switch(this.popChar()){case"=":n="Lookahead";break;case"!":n="NegativeLookahead";break;case"<":{switch(this.popChar()){case"=":n="Lookbehind";break;case"!":n="NegativeLookbehind"}break}}rr(n);const r=this.disjunction();return this.consumeChar(")"),{type:n,value:r,loc:this.loc(e)}}return Hp()}quantifier(e=!1){let n;const r=this.idx;switch(this.popChar()){case"*":n={atLeast:0,atMost:1/0};break;case"+":n={atLeast:1,atMost:1/0};break;case"?":n={atLeast:0,atMost:1};break;case"{":const i=this.integerIncludingZero();switch(this.popChar()){case"}":n={atLeast:i,atMost:i};break;case",":let s;this.isDigit()?(s=this.integerIncludingZero(),n={atLeast:i,atMost:s}):n={atLeast:i,atMost:1/0},this.consumeChar("}");break}if(e===!0&&n===void 0)return;rr(n);break}if(!(e===!0&&n===void 0)&&rr(n))return this.peekChar(0)==="?"?(this.consumeChar("?"),n.greedy=!1):n.greedy=!0,n.type="Quantifier",n.loc=this.loc(r),n}atom(){let e;const n=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()),rr(e))return e.loc=this.loc(n),this.isQuantifier()&&(e.quantifier=this.quantifier()),e}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[W( `
` ),W(" \r "),W(" \u 2028"),W(" \u 2029")]}}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,n=!1;switch(this.popChar()){case"d":e=ua;break;case"D":e=ua,n=!0;break;case"s":e=zl;break;case"S":e=zl,n=!0;break;case"w":e=da;break;case"W":e=da,n=!0;break}if(rr(e))return{type:"Set",value:e,complement:n}}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=W(" \f ");break;case"n":e=W( `
` );break;case"r":e=W(" \r ");break;case"t":e=W(" ");break;case"v":e=W(" \v ");break}if(rr(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:W(" \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:W(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case `
` :case" \r ":case" \u 2028":case" \u 2029":case" \\ ":case"]":throw Error("TBD");default:const e=this.popChar();return{type:"Character",value:W(e)}}}characterClass(){const e=[];let n=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),n=!0);this.isClassAtom();){const r=this.classAtom();if(r.type,jl(r)&&this.isRangeDash()){this.consumeChar("-");const i=this.classAtom();if(i.type,jl(i)){if(i.value<r.value)throw Error("Range out of order in character class");e.push({from:r.value,to:i.value})}else Ya(r.value,e),e.push(W("-")),Ya(i.value,e)}else Ya(r.value,e)}return this.consumeChar("]"),{type:"Set",complement:n,value:e}}classAtom(){switch(this.peekChar()){case"]":case `
` :case" \r ":case" \u 2028":case" \u 2029":throw Error("TBD");case" \\ ":return this.classEscape();default:return this.classPatternCharacterAtom()}}classEscape(){switch(this.consumeChar(" \\ "),this.peekChar()){case"b":return this.consumeChar("b"),{type:"Character",value:W(" \b ")};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()}}group(){let e=!0;this.consumeChar("("),this.peekChar(0)==="?"?(this.consumeChar("?"),this.consumeChar(":"),e=!1):this.groupIdx++;const n=this.disjunction();this.consumeChar(")");const r={type:"Group",capturing:e,value:n};return e&&(r.idx=this.groupIdx),r}positiveInteger(){let e=this.popChar();if(Xp.test(e)===!1)throw Error("Expecting a positive integer");for(;Ls.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(Ls.test(e)===!1)throw Error("Expecting an integer");for(;Ls.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){const e=this.popChar();switch(e){case `
` :case" \r ":case" \u 2028":case" \u 2029":case"^":case" $ ":case" \\ ":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":throw Error("TBD");default:return{type:"Character",value:W(e)}}}isRegExpFlag(){switch(this.peekChar(0)){case"g":case"i":case"m":case"u":case"y":return!0;default:return!1}}isRangeDash(){return this.peekChar()==="-"&&this.isClassAtom(1)}isDigit(){return Ls.test(this.peekChar(0))}isClassAtom(e=0){switch(this.peekChar(e)){case"]":case `
` :case" \r ":case" \u 2028":case" \u 2029":return!1;default:return!0}}isTerm(){return this.isAtom()||this.isAssertion()}isAtom(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case".":case" \\ ":case"[":case"(":return!0;default:return!1}}isAssertion(){switch(this.peekChar(0)){case"^":case" $ ":return!0;case" \\ ":switch(this.peekChar(1)){case"b":case"B":return!0;default:return!1}case"(":return this.peekChar(1)==="?"&&(this.peekChar(2)==="="||this.peekChar(2)==="!"||this.peekChar(2)==="<"&&(this.peekChar(3)==="="||this.peekChar(3)==="!"));default:return!1}}isQuantifier(){const e=this.saveState();try{return this.quantifier(!0)!==void 0}catch{return!1}finally{this.restoreState(e)}}isPatternCharacter(){switch(this.peekChar()){case"^":case" $ ":case" \\ ":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":case"/":case `
` :case" \r ":case" \u 2028":case" \u 2029":return!1;default:return!0}}parseHexDigits(e){let n="";for(let i=0;i<e;i++){const s=this.popChar();if(Yp.test(s)===!1)throw Error("Expecting a HexDecimal digits");n+=s}return{type:"Character",value:parseInt(n,16)}}peekChar(e=0){return this.input[this.idx+e]}popChar(){const e=this.peekChar(0);return this.consumeChar(void 0),e}consumeChar(e){if(e!==void 0&&this.input[this.idx]!==e)throw Error("Expected: '"+e+"' but found: '"+this.input[this.idx]+"' at offset: "+this.idx);if(this.idx>=this.input.length)throw Error("Unexpected end of input");this.idx++}loc(e){return{begin:e,end:this.idx}}}class Oa{visitChildren(e){for(const n in e){const r=e[n];e.hasOwnProperty(n)&&(r.type!==void 0?this.visit(r):Array.isArray(r)&&r.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"Lookbehind":this.visitLookbehind(e);break;case"NegativeLookbehind":this.visitNegativeLookbehind(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){}visitLookbehind(e){}visitNegativeLookbehind(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}}const Jp=/ \r ? \n /gm,Qp=new Vd;class Zp extends Oa{constructor(){super(...arguments),this.isStarting=!0,this.endRegexpStack=[],this.multiline=!1}get endRegex(){return this.endRegexpStack.join("")}reset(e){this.multiline=!1,this.regex=e,this.startRegexp="",this.isStarting=!0,this.endRegexpStack=[]}visitGroup(e){e.quantifier&&(this.isStarting=!1,this.endRegexpStack=[])}visitCharacter(e){const n=String.fromCharCode(e.value);if(!this.multiline&&n=== `
` &&(this.multiline=!0),e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{const r=xa(n);this.endRegexpStack.push(r),this.isStarting&&(this.startRegexp+=r)}}visitSet(e){if(!this.multiline){const n=this.regex.substring(e.loc.begin,e.loc.end),r=new RegExp(n);this.multiline=!! `
` .match(r)}if(e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{const n=this.regex.substring(e.loc.begin,e.loc.end);this.endRegexpStack.push(n),this.isStarting&&(this.startRegexp+=n)}}visitChildren(e){e.type==="Group"&&e.quantifier||super.visitChildren(e)}}const Xa=new Zp;function em(t){try{return typeof t=="string"&&(t=new RegExp(t)),t=t.toString(),Xa.reset(t),Xa.visit(Qp.pattern(t)),Xa.multiline}catch{return!1}}const tm= ` \ f
\ r \ v \u2028\u2029 \uFEFF ` .split("");function Kd(t){const e=typeof t=="string"?new RegExp(t):t;return tm.some(n=>e.test(n))}function xa(t){return t.replace(/[.*+?^ ${ } ()|[ \] \\ ]/g," \\ $ &")}function nm(t,e){const n=rm(t),r=e.match(n);return!!r&&r[0].length>0}function rm(t){typeof t=="string"&&(t=new RegExp(t));const e=t,n=t.source;let r=0;function i(){let s="",a;function o(l){s+=n.substr(r,l),r+=l}function c(l){s+="(?:"+n.substr(r,l)+"| $ )",r+=l}for(;r<n.length;)switch(n[r]){case" \\ ":switch(n[r+1]){case"c":c(3);break;case"x":c(4);break;case"u":e.unicode?n[r+2]==="{"?c(n.indexOf("}",r)-r+1):c(6):c(2);break;case"p":case"P":e.unicode?c(n.indexOf("}",r)-r+1):c(2);break;case"k":c(n.indexOf(">",r)-r+1);break;default:c(2);break}break;case"[":a=/ \[ (?: \\ .|.)*? \] /g,a.lastIndex=r,a=a.exec(n)||[],c(a[0].length);break;case"|":case"^":case" $ ":case"*":case"+":case"?":o(1);break;case"{":a=/ \{ \d +,? \d * \} /g,a.lastIndex=r,a=a.exec(n),a?o(a[0].length):c(1);break;case"(":if(n[r+1]==="?")switch(n[r+2]){case":":s+="(?:",r+=3,s+=i()+"| $ )";break;case"=":s+="(?=",r+=3,s+=i()+")";break;case"!":a=r,r+=3,i(),s+=n.substr(a,r-a);break;case"<":switch(n[r+3]){case"=":case"!":a=r,r+=4,i(),s+=n.substr(a,r-a);break;default:o(n.indexOf(">",r)-r+1),s+=i()+"| $ )";break}break}else o(1),s+=i()+"| $ )";break;case")":return++r,s;default:c(1);break}return s}return new RegExp(i(),t.flags)}function im(t){return t.rules.find(e=>sn(e)&&e.entry)}function sm(t){return t.rules.filter(e=>an(e)&&e.hidden)}function Hd(t,e){const n=new Set,r=im(t);if(!r)return new Set(t.rules);const i=[r].concat(sm(t));for(const a of i)Yd(a,n,e);const s=new Set;for(const a of t.rules)(n.has(a.name)||an(a)&&a.hidden)&&s.add(a);return s}function Yd(t,e,n){e.add(t.name),rs(t).forEach(r=>{if(Wn(r)||n){const i=r.rule.ref;i&&!e.has(i.name)&&Yd(i,e,n)}})}function am(t){if(t.terminal)return t.terminal;if(t.type.ref)return Jd(t.type.ref)?.terminal}function om(t){return t.hidden&&!Kd(ll(t))}function cm(t,e){return!t||!e?[]:cl(t,e,t.astNode,!0)}function Xd(t,e,n){if(!t||!e)return;const r=cl(t,e,t.astNode,!0);if(r.length!==0)return n!==void 0?n=Math.max(0,Math.min(n,r.length-1)):n=0,r[n]}function cl(t,e,n,r){if(!r){const i=Pa(t.grammarSource,zn);if(i&&i.feature===e)return[t]}return Bi(t)&&t.astNode===n?t.content.flatMap(i=>cl(i,e,n,!1)):[]}function lm(t,e,n){if(!t)return;const r=um(t,e,t?.astNode);if(r.length!==0)return n!==void 0?n=Math.max(0,Math.min(n,r.length-1)):n=0,r[n]}function um(t,e,n){if(t.astNode!==n)return[];if(Bn(t.grammarSource)&&t.grammarSource.value===e)return[t];const r=wo(t).iterator();let i;const s=[];do if(i=r.next(),!i.done){const a=i.value;a.astNode===n?Bn(a.grammarSource)&&a.grammarSource.value===e&&s.push(a):r.prune()}while(!i.done);return s}function dm(t){const e=t.astNode;for(;e===t.container?.astNode;){const n=Pa(t.grammarSource,zn);if(n)return n;t=t.container}}function Jd(t){let e=t;return jd(e)&&( $ a(e. $ container)?e=e. $ container. $ container:is(e. $ container)?e=e. $ container:ss(e. $ container)),Qd(t,e,new Map)}function Qd(t,e,n){function r(i,s){let a;return Pa(i,zn)||(a=Qd(s,s,n)),n.set(t,a),a}if(n.has(t))return n.get(t);n.set(t,void 0);for(const i of rs(e)){if(zn(i)&&i.feature.toLowerCase()==="name")return n.set(t,i),i;if(Wn(i)&&sn(i.rule.ref))return r(i,i.rule.ref);if(xp(i)&&i.typeRef?.ref)return r(i,i.typeRef.ref)}}function Zd(t){return ef(t,new Set)}function ef(t,e){if(e.has(t))return!0;e.add(t);for(const n of rs(t))if(Wn(n)){if(!n.rule.ref||sn(n.rule.ref)&&!ef(n.rule.ref,e)||ca(n.rule.ref))return!1}else{if(zn(n))return!1;if( $ a(n))return!1}return!!t.definition}function tf(t){if(!an(t)){if(t.inferredType)return t.inferredType.name;if(t.dataType)return t.dataType;if(t.returnType){const e=t.returnType.ref;if(e)return e.name}}}function Wi(t){if(is(t))return sn(t)&&Zd(t)?t.name:tf(t)??t.name;if(_p(t)||Gp(t)||Op(t))return t.name;if( $ a(t)){const e=fm(t);if(e)return e}else if(jd(t))return t.name;throw new Error("Cannot get name of Unknown Type")}function fm(t){if(t.inferredType)return t.inferredType.name;if(t.type?.ref)return Wi(t.type.ref)}functio
` ;function Lm(t,e=!1){try{const n=Ma(t);return _o(n.value,{},n.flags.ignoreCase)}catch(n){if(n.message===of)e&&nf( ` $ { ha } 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 r="";e&&(r=`
This will disable the lexer ' s first char optimizations .
See : https : //chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),bo(`${ha}
Failed parsing : < $ { t . toString ( ) } >
Using the @ chevrotain / regexp - to - ast library
Please open an issue at : https : //github.com/chevrotain/chevrotain/issues`+r)}}return[]}function _o(t,e,n){switch(t.type){case"Disjunction":for(let i=0;i<t.value.length;i++)_o(t.value[i],e,n);break;case"Alternative":const r=t.value;for(let i=0;i<r.length;i++){const s=r[i];switch(s.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"Lookbehind":case"NegativeLookbehind":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}const a=s;switch(a.type){case"Character":Os(a.value,e,n);break;case"Set":if(a.complement===!0)throw Error(of);q(a.value,c=>{if(typeof c=="number")Os(c,e,n);else{const l=c;if(n===!0)for(let u=l.from;u<=l.to;u++)Os(u,e,n);else{for(let u=l.from;u<=l.to&&u<Fi;u++)Os(u,e,n);if(l.to>=Fi){const u=l.from>=Fi?l.from:Fi,f=l.to,m=dn(u),p=dn(f);for(let A=m;A<=p;A++)e[A]=A}}}});break;case"Group":_o(a.value,e,n);break;default:throw Error("Non Exhaustive Match")}const o=a.quantifier!==void 0&&a.quantifier.atLeast===0;if(a.type==="Group"&&Io(a)===!1||a.type!=="Group"&&o===!1)break}break;default:throw Error("non exhaustive match!")}return $e(e)}function Os(t,e,n){const r=dn(t);e[r]=r,n===!0&&Om(t,e)}function Om(t,e){const n=String.fromCharCode(t),r=n.toUpperCase();if(r!==n){const i=dn(r.charCodeAt(0));e[i]=i}else{const i=n.toLowerCase();if(i!==n){const s=dn(i.charCodeAt(0));e[s]=s}}}function Wl(t,e){return jr(t.value,n=>{if(typeof n=="number")return et(e,n);{const r=n;return jr(e,i=>r.from<=i&&i<=r.to)!==void 0}})}function Io(t){const e=t.quantifier;return e&&e.atLeast===0?!0:t.value?je(t.value)?kt(t.value,Io):Io(t.value):!1}class xm extends Oa{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;case"Lookbehind":this.visitLookbehind(e);return;case"NegativeLookbehind":this.visitNegativeLookbehind(e);return}super.visitChildren(e)}}visitCharacter(e){et(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?Wl(e,this.targetCharCodes)===void 0&&(this.found=!0):Wl(e,this.targetCharCodes)!==void 0&&(this.found=!0)}}function dl(t,e){if(e instanceof RegExp){const n=Ma(e),r=new xm(t);return r.visit(n),r.found}else return jr(e,n=>et(t,n.charCodeAt(0)))!==void 0}const Vn="PATTERN",Mi="defaultMode",xs="modes";function Dm(t,e){e=rl(e,{debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
` ],tracer:(w,k)=>k()});const n=e.tracer;n("initCharCodeToOptimizedIndexMap",()=>{ag()});let r;n("Reject Lexer.NA",()=>{r=Ia(t,w=>w[Vn]===tt.NA)});let i=!1,s;n("Transform Patterns",()=>{i=!1,s=M(r,w=>{const k=w[Vn];if(nn(k)){const P=k.source;return P.length===1&&P!=="^"&&P!==" $ "&&P!=="."&&!k.ignoreCase?P:P.length===2&&P[0]===" \\ "&&!et(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],P[1])?P[1]:Vl(k)}else{if(Yn(k))return i=!0,{exec:k};if(typeof k=="object")return i=!0,k;if(typeof k=="string"){if(k.length===1)return k;{const P=k.replace(/[ \\ ^ $ .*+?()[ \] {}|]/g," \\ $ &"),H=new RegExp(P);return Vl(H)}}else throw Error("non exhaustive match")}})});let a,o,c,l,u;n("misc mapping",()=>{a=M(r,w=>w.tokenTypeIdx),o=M(r,w=>{const k=w.GROUP;if(k!==tt.SKIPPED){if(nt(k))return k;if(tn(k))return!1;throw Error("non exhaustive match")}}),c=M(r,w=>{const k=w.LONGER_ALT;if(k)return je(k)?M(k,H=>Il(r,H)):[Il(r,k)]}),l=M(r,w=>w.PUSH_MODE),u=M(r,w=>z(w,"POP_MODE"))});let f;n("Line Terminator Handling",()=>{const w=uf(e.lineTerminatorCharacters);f=M(r,k=>!1),e.positionTracking!=="onlyOffset"&&(f=M(r,k=>z(k,"LINE_BREAKS")?!!k.LINE_BREAKS:lf(k,w)===!1&&dl(w,k.PATTERN)))});let m,p,A,b;n("Misc Mapping #2",()=>{m=M(r,cf),p=M(s,rg),A=Je(r,(w,k)=>{const P=k.GROUP;return nt(P)&&P!==tt.SKIPPED&&(w[P]=[]),w},{}),b=M(s,(w,k)=>({pattern:s[k],longerAlt:c[k],canLineTerminator:f[k],isCustom:m[k],short:p[k],group:o[k],push:l[k],pop:u[k],tokenTypeIdx:a[k],tokenType:r[k]}))});let I=!0,C=[];return e.safeMode||n("First Char Optimization",()=>{C=Je(r,(w,k,P)=>{if(typeof k.PATTERN=="string"){const H=k.PATTERN.charCodeAt(0),K=dn(H);Qa(w,K,b[P])}else if(je(k.START_CHARS_HINT)){let H;q(k.START_CHARS_HINT,K=>{const J=typeof K=="string"?K.charCodeAt(0):K,oe=dn(J);H!==oe&&(H=oe,Qa(w,oe,b[P]))})}else if(nn(k.PATTERN))if(k.PATTERN.unicode)I=!1,e.ensureOptimizations&&bo( ` $ { ha } Unable to analyze < $ { k . 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 H=Lm(k.PATTERN,e.ensureOptimizations);ae(H)&&(I=!1),q(H,K=>{Qa(w,K,b[P])})}else e.ensureOptimizations&&bo(`${ha} TokenType: <${k.name}> is using a custom token pattern without providing <start_chars_hint> parameter.
This will disable the lexer ' s first char optimizations .
For details See : https : //chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),I=!1;return w},[])}),{emptyGroups:A,patternIdxToConfig:b,charCodeToPatternIdxToConfig:C,hasCustom:i,canBeOptimized:I}}function Mm(t,e){let n=[];const r=Gm(t);n=n.concat(r.errors);const i=Um(r.valid),s=i.valid;return n=n.concat(i.errors),n=n.concat(Fm(s)),n=n.concat(Hm(s)),n=n.concat(Ym(s,e)),n=n.concat(Xm(s)),n}function Fm(t){let e=[];const n=ht(t,r=>nn(r[Vn]));return e=e.concat(jm(n)),e=e.concat(Wm(n)),e=e.concat(Vm(n)),e=e.concat(Km(n)),e=e.concat(zm(n)),e}function Gm(t){const e=ht(t,i=>!z(i,Vn)),n=M(e,i=>({message:"Token Type: ->"+i.name+"<- missing static 'PATTERN' property",type:Se.MISSING_PATTERN,tokenTypes:[i]})),r=_a(t,e);return{errors:n,valid:r}}function Um(t){const e=ht(t,i=>{const s=i[Vn];return!nn(s)&&!Yn(s)&&!z(s,"exec")&&!nt(s)}),n=M(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:Se.INVALID_PATTERN,tokenTypes:[i]})),r=_a(t,e);return{errors:n,valid:r}}const qm=/[^\\][$]/;function jm(t){class e extends Oa{constructor(){super(...arguments),this.found=!1}visitEndAnchor(s){this.found=!0}}const n=ht(t,i=>{const s=i.PATTERN;try{const a=Ma(s),o=new e;return o.visit(a),o.found}catch{return qm.test(s.source)}});return M(n,i=>({message:`Unexpected RegExp Anchor Error:
Token Type : - > ` +i.name+ ` < - static 'PATTERN' cannot contain end of input anchor '$'
See chevrotain . io / docs / guide / resolving _lexer _errors . html # ANCHORS for details . ` ,type:Se.EOI_ANCHOR_FOUND,tokenTypes:[i]}))}function zm(t){const e=ht(t,r=>r.PATTERN.test(""));return M(e,r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' must not match an empty string",type:Se.EMPTY_MATCH_PATTERN,tokenTypes:[r]}))}const Bm=/[^ \\ [][ \^ ]|^ \^ /;function Wm(t){class e extends Oa{constructor(){super(...arguments),this.found=!1}visitStartAnchor(s){this.found=!0}}const n=ht(t,i=>{const s=i.PATTERN;try{const a=Ma(s),o=new e;return o.visit(a),o.found}catch{return Bm.test(s.source)}});return M(n,i=>({message: ` Unexpected RegExp Anchor Error :
Token Type : - > ` +i.name+ ` < - static 'PATTERN' cannot contain start of input anchor '^'
See https : //chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:Se.SOI_ANCHOR_FOUND,tokenTypes:[i]}))}function Vm(t){const e=ht(t,r=>{const i=r[Vn];return i instanceof RegExp&&(i.multiline||i.global)});return M(e,r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:Se.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[r]}))}function Km(t){const e=[];let n=M(t,s=>Je(t,(a,o)=>(s.PATTERN.source===o.PATTERN.source&&!et(e,o)&&o.PATTERN!==tt.NA&&(e.push(o),a.push(o)),a),[]));n=ns(n);const r=ht(n,s=>s.length>1);return M(r,s=>{const a=M(s,c=>c.name);return{message:`The same RegExp pattern ->${wt(s).PATTERN}<-has been used in all of the following Token Types: ${a.join(", ")} <-`,type:Se.DUPLICATE_PATTERNS_FOUND,tokenTypes:s}})}function Hm(t){const e=ht(t,r=>{if(!z(r,"GROUP"))return!1;const i=r.GROUP;return i!==tt.SKIPPED&&i!==tt.NA&&!nt(i)});return M(e,r=>({message:"Token Type: ->"+r.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:Se.INVALID_GROUP_TYPE_FOUND,tokenTypes:[r]}))}function Ym(t,e){const n=ht(t,i=>i.PUSH_MODE!==void 0&&!et(e,i.PUSH_MODE));return M(n,i=>({message:`Token Type: ->${i.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${i.PUSH_MODE}<-which does not exist`,type:Se.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[i]}))}function Xm(t){const e=[],n=Je(t,(r,i,s)=>{const a=i.PATTERN;return a===tt.NA||(nt(a)?r.push({str:a,idx:s,tokenType:i}):nn(a)&&Qm(a)&&r.push({str:a.source,idx:s,tokenType:i})),r},[]);return q(t,(r,i)=>{q(n,({str:s,idx:a,tokenType:o})=>{if(i<a&&Jm(s,r.PATTERN)){const c=`Token: ->${o.name}<- can never be matched.
Because it appears AFTER the Token Type - > $ { r . name } < - in the lexer ' s definition .
See https : //chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:c,type:Se.UNREACHABLE_PATTERN,tokenTypes:[r,o]})}})}),e}function Jm(t,e){if(nn(e)){if(Zm(e))return!1;const n=e.exec(t);return n!==null&&n.index===0}else{if(Yn(e))return e(t,0,[],{});if(z(e,"exec"))return e.exec(t,0,[],{});if(typeof e=="string")return e===t;throw Error("non exhaustive match")}}function Qm(t){return jr([".","\\","[","]","|","^","$","(",")","?","*","+","{"],n=>t.source.indexOf(n)!==-1)===void 0}function Zm(t){return/(\(\?=)|(\(\?!)|(\(\?<=)|(\(\?<!)/.test(t.source)}function Vl(t){const e=t.ignoreCase?"iy":"y";return new RegExp(`${t.source}`,e)}function eg(t,e,n){const r=[];return z(t,Mi)||r.push({message:"A MultiMode Lexer cannot be initialized without a <"+Mi+`> property in its definition
` ,type:Se.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),z(t,xs)||r.push({message:"A MultiMode Lexer cannot be initialized without a <"+xs+ ` > property in its definition
` ,type:Se.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),z(t,xs)&&z(t,Mi)&&!z(t.modes,t.defaultMode)&&r.push({message: ` A MultiMode Lexer cannot be initialized with a $ { Mi } : < $ { t . defaultMode } > which does not exist
` ,type:Se.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),z(t,xs)&&q(t.modes,(i,s)=>{q(i,(a,o)=>{if(tn(a))r.push({message: ` A Lexer cannot be initialized using an undefined Token Type . Mode : < $ { s } > at index : < $ { o } >
` ,type:Se.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if(z(a,"LONGER_ALT")){const c=je(a.LONGER_ALT)?a.LONGER_ALT:[a.LONGER_ALT];q(c,l=>{!tn(l)&&!et(i,l)&&r.push({message: ` A MultiMode Lexer cannot be initialized with a longer _alt < $ { l . name } > on token < $ { a . name } > outside of mode < $ { s } >
` ,type:Se.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),r}function tg(t,e,n){const r=[];let i=!1;const s=ns(yt( $ e(t.modes))),a=Ia(s,c=>c[Vn]===tt.NA),o=uf(n);return e&&q(a,c=>{const l=lf(c,o);if(l!==!1){const f={message:sg(c,l),type:l.issue,tokenType:c};r.push(f)}else z(c,"LINE_BREAKS")?c.LINE_BREAKS===!0&&(i=!0):dl(o,c.PATTERN)&&(i=!0)}),e&&!i&&r.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:Se.NO_LINE_BREAKS_FLAGS}),r}function ng(t){const e={},n=qr(t);return q(n,r=>{const i=t[r];if(je(i))e[r]=[];else throw Error("non exhaustive match")}),e}function cf(t){const e=t.PATTERN;if(nn(e))return!1;if(Yn(e))return!0;if(z(e,"exec"))return!0;if(nt(e))return!1;throw Error("non exhaustive match")}function rg(t){return nt(t)&&t.length===1?t.charCodeAt(0):!1}const ig={test:function(t){const e=t.length;for(let n=this.lastIndex;n<e;n++){const r=t.charCodeAt(n);if(r===10)return this.lastIndex=n+1,!0;if(r===13)return t.charCodeAt(n+1)===10?this.lastIndex=n+2:this.lastIndex=n+1,!0}return!1},lastIndex:0};function lf(t,e){if(z(t,"LINE_BREAKS"))return!1;if(nn(t.PATTERN)){try{dl(e,t.PATTERN)}catch(n){return{issue:Se.IDENTIFY_TERMINATOR,errMsg:n.message}}return!1}else{if(nt(t.PATTERN))return!1;if(cf(t))return{issue:Se.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function sg(t,e){if(e.issue===Se.IDENTIFY_TERMINATOR)return ` Warning : unable to identify line terminator usage in pattern .
The problem is in the < $ { t . name } > Token Type
Root cause : $ { e . errMsg } .
For details See : https : //chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(e.issue===Se.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> 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 uf(t){return M(t,n=>nt(n)?n.charCodeAt(0):n)}function Qa(t,e,n){t[e]===void 0?t[e]=[n]:t[e].push(n)}const Fi=256;let ea=[];function dn(t){return t<Fi?t:ea[t]}function ag(){if(ae(ea)){ea=new Array(65536);for(let t=0;t<65536;t++)ea[t]=t>255?255+~~(t/255):t}}function os(t,e){const n=t.tokenTypeIdx;return n===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[n]===!0}function pa(t,e){return t.tokenTypeIdx===e.tokenTypeIdx}let Kl=1;const df={};function cs(t){const e=og(t);cg(e),ug(e),lg(e),q(e,n=>{n.isParent=n.categoryMatches.length>0})}function og(t){let e=Be(t),n=t,r=!0;for(;r;){n=ns(yt(M(n,s=>s.CATEGORIES)));const i=_a(n,e);e=e.concat(i),ae(i)?r=!1:n=i}return e}function cg(t){q(t,e=>{hf(e)||(df[Kl]=e,e.tokenTypeIdx=Kl++),Hl(e)&&!je(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),Hl(e)||(e.CATEGORIES=[]),dg(e)||(e.categoryMatches=[]),fg(e)||(e.categoryMatchesMap={})})}function lg(t){q(t,e=>{e.categoryMatches=[],q(e.categoryMatchesMap,(n,r)=>{e.categoryMatches.push(df[r].tokenTypeIdx)})})}function ug(t){q(t,e=>{ff([],e)})}function ff(t,e){q(t,n=>{e.categoryMatchesMap[n.tokenTypeIdx]=!0}),q(e.CATEGORIES,n=>{const r=t.concat(e);et(r,n)||ff(r,n)})}function hf(t){return z(t,"tokenTypeIdx")}function Hl(t){return z(t,"CATEGORIES")}function dg(t){return z(t,"categoryMatches")}function fg(t){return z(t,"categoryMatchesMap")}function hg(t){return z(t,"tokenTypeIdx")}const Po={buildUnableToPopLexerModeMessage(t){return`Unable to pop Lexer Mode after encountering Token ->${t.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(t,e,n,r,i,s){return`unexpected character: ->${t.charAt(e)}<- at offset: ${e}, skipped ${n} characters.`}};var Se;(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"})(Se||(Se={}));const Gi={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
` ," \r "],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:Po,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(Gi);class tt{constructor(e,n=Gi){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 a=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log( ` $ { a } -- > < $ { i } > ` );const{time:o,value:c}=rf(s),l=o>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&l( ` $ { a } < -- < $ { i } > time : $ { o } ms ` ),this.traceInitIndent--,c}else return s()},typeof n=="boolean")throw Error( ` The second argument to the Lexer constructor is now an ILexerConfig Object .
a boolean 2 nd argument is no longer supported ` );this.config=ft({},Gi,n);const r=this.config.traceInitPerf;r===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof r=="number"&&(this.traceInitMaxIdent=r,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===Gi.lineTerminatorsPattern)this.config.lineTerminatorsPattern=ig;else if(this.config.lineTerminatorCharacters===Gi.lineTerminatorCharacters)throw Error( ` Error : Missing < lineTerminatorCharacters > property on the Lexer config .
For details See : https : //chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(n.safeMode&&n.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),je(e)?i={modes:{defaultMode:Be(e)},defaultMode:Mi}:(s=!1,i=Be(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(eg(i,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(tg(i,this.trackStartLines,this.config.lineTerminatorCharacters))})),i.modes=i.modes?i.modes:{},q(i.modes,(o,c)=>{i.modes[c]=Ia(o,l=>tn(l))});const a=qr(i.modes);if(q(i.modes,(o,c)=>{this.TRACE_INIT(`Mode: <${c}> processing`,()=>{if(this.modes.push(c),this.config.skipValidations===!1&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(Mm(o,a))}),ae(this.lexerDefinitionErrors)){cs(o);let l;this.TRACE_INIT("analyzeTokenTypes",()=>{l=Dm(o,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:n.positionTracking,ensureOptimizations:n.ensureOptimizations,safeMode:n.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[c]=l.patternIdxToConfig,this.charCodeToPatternIdxToConfig[c]=l.charCodeToPatternIdxToConfig,this.emptyGroups=ft({},this.emptyGroups,l.emptyGroups),this.hasCustom=l.hasCustom||this.hasCustom,this.canModeBeOptimized[c]=l.canBeOptimized}})}),this.defaultMode=i.defaultMode,!ae(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){const c=M(this.lexerDefinitionErrors,l=>l.message).join(`-----------------------
` );throw new Error( ` Errors detected in definition of Lexer :
` +c)}q(this.lexerDefinitionWarning,o=>{nf(o.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(s&&(this.handleModes=Fe),this.trackStartLines===!1&&(this.computeNewColumn=qh),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=Fe),/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 < positionTracking > 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 o=Je(this.canModeBeOptimized,(c,l,u)=>(l===!1&&c.push(u),c),[]);if(n.ensureOptimizations&&!ae(o))throw Error( ` Lexer Modes : < $ { o . 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",()=>{ $ m()}),this.TRACE_INIT("toFastProperties",()=>{sf(this)})})}tokenize(e,n=this.defaultMode){if(!ae(this.lexerDefinitionErrors)){const i=M(this.lexerDefinitionErrors,s=>s.message).join( ` -- -- -- -- -- -- -- -- -- -- -- -
` );throw new Error( ` Unable to Tokenize because Errors detected in definition of Lexer :
` +i)}return this.tokenizeInternal(e,n)}tokenizeInternal(e,n){let r,i,s,a,o,c,l,u,f,m,p,A,b,I,C;const w=e,k=w.length;let P=0,H=0;const K=this.hasCustom?0:Math.floor(e.length/10),J=new Array(K),oe=[];let ue=this.trackStartLines?1:void 0,de=this.trackStartLines?1:void 0;const _=ng(this.emptyGroups),T=this.trackStartLines,g=this.config.lineTerminatorsPattern;let S=0,y=[],R=[];const E=[],O=[];Object.freeze(O);let D=!1;const x=B=>{if(E.length===1&&B.tokenType.PUSH_MODE===void 0){const ne=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(B);oe.push({offset:B.startOffset,line:B.startLine,column:B.startColumn,length:B.image.length,message:ne})}else{E.pop();const ne=jn(E);y=this.patternIdxToConfig[ne],R=this.charCodeToPatternIdxToConfig[ne],S=y.length;const Oe=this.canModeBeOptimized[ne]&&this.config.safeMode===!1;R&&Oe?D=!0:D=!1}};function j(B){E.push(B),R=this.charCodeToPatternIdxToConfig[B],y=this.patternIdxToConfig[B],S=y.length,S=y.length;const ne=this.canModeBeOptimized[B]&&this.config.safeMode===!1;R&&ne?D=!0:D=!1}j.call(this,n);let G;const ie=this.config.recoveryEnabled;for(;P<k;){c=null,f=-1;const B=w.charCodeAt(P);let ne;if(D){const Re=dn(B),fe=R[Re];ne=fe!==void 0?fe:O}else ne=y;const Oe=ne.length;for(r=0;r<Oe;r++){G=ne[r];const Re=G.pattern;l=null;const fe=G.short;if(fe!==!1?B===fe&&(f=1,c=Re):G.isCustom===!0?(C=Re.exec(w,P,J,_),C!==null?(c=C[0],f=c.length,C.payload!==void 0&&(l=C.payload)):c=null):(Re.lastIndex=P,f=this.matchLength(Re,e,P)),f!==-1){if(o=G.longerAlt,o!==void 0){c=e.substring(P,P+f);const Ie=o.length;for(s=0;s<Ie;s++){const xe=y[o[s]],be=xe.pattern;if(u=null,xe.isCustom===!0?(C=be.exec(w,P,J,_),C!==null?(a=C[0],C.payload!==void 0&&(u=C.payload)):a=null):(be.lastIndex=P,a=this.match(be,e,P)),a&&a.length>c.length){c=a,f=a.length,l=u,G=xe;break}}}break}}if(f!==-1){if(m=G.group,m!==void 0&&(c=c!==null?c:e.substring(P,P+f),p=G.tokenTypeIdx,A=this.createTokenInstance(c,P,p,G.tokenType,ue,de,f),this.handlePayload(A,l),m===!1?H=this.addToken(J,H,A):_[m].push(A)),T===!0&&G.canLineTerminator===!0){let Re=0,fe,Ie;g.lastIndex=0;do c=c!==null?c:e.substring(P,P+f),fe=g.test(c),fe===!0&&(Ie=g.lastIndex-1,Re++);while(fe===!0);Re!==0?(ue=ue+Re,de=f-Ie,this.updateTokenEndLineColumnLocation(A,m,Ie,Re,ue,de,f)):de=this.computeNewColumn(de,f)}else de=this.computeNewColumn(de,f);P=P+f,this.handleModes(G,x,j,A)}else{const Re=P,fe=ue,Ie=de;let xe=ie===!1;for(;xe===!1&&P<k;)for(P++,i=0;i<S;i++){const be=y[i],Z=be.pattern,at=be.short;if(at!==!1?w.charCodeAt(P)===at&&(xe=!0):be.isCustom===!0?xe=Z.exec(w,P,J,_)!==null:(Z.lastIndex=P,xe=Z.exec(e)!==null),xe===!0)break}if(b=P-Re,de=this.computeNewColumn(de,b),I=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(w,Re,b,fe,Ie,jn(E)),oe.push({offset:Re,line:fe,column:Ie,length:b,message:I}),ie===!1)break}}return this.hasCustom||(J.length=H),{tokens:J,groups:_,errors:oe}}handleModes(e,n,r,i){if(e.pop===!0){const s=e.push;n(i),s!==void 0&&r.call(this,s)}else e.push!==void 0&&r.call(this,e.push)}updateTokenEndLineColumnLocation(e,n,r,i,s,a,o){let c,l;n!==void 0&&(c=r===o-1,l=c?-1:0,i===1&&c===!0||(e.endLine=s+l,e.endColumn=a-1+-l))}computeNewColumn(e,n){return e+n}createOffsetOnlyToken(e,n,r,i){return{image:e,startOffset:n,tokenTypeIdx:r,tokenType:i}}createStartOnlyToken(e,n,r,i,s,a){return{image:e,startOffset:n,startLine:s,startColumn:a,tokenTypeIdx:r,tokenType:i}}createFullToken(e,n,r,i,s,a,o){return{image:e,startOffset:n,endOffset:n+o-1,startLine:s,endLine:s,startColumn:a,endColumn:a+o-1,tokenTypeIdx:r,tokenType:i}}addTokenUsingPush(e,n,r){return e.push(r),n}addTokenUsingMemberAccess(e,n,r){return e[n]=r,n++,n}handlePayloadNoCustom(e,n){}handlePayloadWithCustom(e,n){n!==null&&(e.payload=n)}match(e,n,r){return e.test(n)===!0?n.substring(r,e.lastIndex):null}matchLength(e,n,r){return e.test(n)===!0?e.lastIndex-r:-1}}tt.SKIPPED="This marks a skipped Token pattern, this means each token identified by it will be consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.";tt.NA=/NOT_APPLICABLE/;function Sr(t){return
See : https : //github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return z(t,Yl)&&(n.CATEGORIES=t[Yl]),cs([n]),z(t,Xl)&&(n.LABEL=t[Xl]),z(t,Jl)&&(n.GROUP=t[Jl]),z(t,Zl)&&(n.POP_MODE=t[Zl]),z(t,Ql)&&(n.PUSH_MODE=t[Ql]),z(t,eu)&&(n.LONGER_ALT=t[eu]),z(t,tu)&&(n.LINE_BREAKS=t[tu]),z(t,nu)&&(n.START_CHARS_HINT=t[nu]),n}const fn=mf({name:"EOF",pattern:tt.NA});cs([fn]);function fl(t,e,n,r,i,s,a,o){return{image:e,startOffset:n,endOffset:r,startLine:i,endLine:s,startColumn:a,endColumn:o,tokenTypeIdx:t.tokenTypeIdx,tokenType:t}}function gf(t,e){return os(t,e)}const Er={buildMismatchTokenMessage({expected:t,actual:e,previous:n,ruleName:r}){return`Expecting ${pf(t)?`--> ${Sr(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:n,customUserDescription:r,ruleName:i}){const s="Expecting: ",o=`
but found : '`+wt(e).image+"' ";if(r)return s+r+o;{const c=Je(t,(m,p)=>m.concat(p),[]),l=M(c,m=>`[${M(m,p=>Sr(p)).join(" , " ) } ] ` ),f= ` one of these possible Token sequences :
$ { M ( l , ( m , p ) => ` ${ p + 1 } . ${ m } ` ) . join ( `
` )} ` ; return s + f + o } } , buildEarlyExitMessage ( { expectedIterationPaths : t , actual : e , customUserDescription : n , ruleName : r } ) { const i = "Expecting: " , a = `
but found : '`+wt(e).image+"' " ; if ( n ) return i + n + a ; { const c = ` expecting at least one iteration which starts with one of these possible Token sequences::
< $ { M ( t , l => ` [ ${ M ( l , u => Sr ( u ) ) . join ( "," ) } ] ` ) . join ( " ," ) } > ` ;return i+c+a}}};Object.freeze(Er);const gg={buildRuleNotFoundError(t,e){return"Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+ ` < -
inside top level rule : - > ` +t.name+"<-"}},Un={buildDuplicateFoundError(t,e){function n(u){return u instanceof le?u.terminalType.name:u instanceof Qe?u.nonTerminalName:""}const r=t.name,i=wt(e),s=i.idx,a= $ t(i),o=n(i),c=s>0;let l= ` - > $ { a } $ { c ? s : "" } < - $ { o ? ` with argument: -> ${ o } <- ` : "" }
appears more than once ( $ { e . length } times ) in the top level rule : - > $ { r } < - .
For further details see : https : //chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES
` ;return l=l.replace(/[ \t ]+/g," "),l=l.replace(/ \s \s +/g, `
` ),l},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=M(t.prefixPath,i=>Sr(i)).join(", "),n=t.alternation.idx===0?"":t.alternation.idx;return ` Ambiguous alternatives : < $ { t . ambiguityIndices . join ( " ," ) } > due to common lookahead prefix
in < OR$ { n } > 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=t.alternation.idx===0?"":t.alternation.idx,n=t.prefixPath.length===0;let r= ` Ambiguous Alternatives Detected : < $ { t . ambiguityIndices . join ( " ," ) } > in < OR$ { e } > inside < $ { t . topLevelRule . name } > Rule ,
` ;if(n)r+= ` These alternatives are all empty ( match no tokens ) , making them indistinguishable .
Only the last alternative may be empty .
` ;else{const i=M(t.prefixPath,s=>Sr(s)).join(", ");r+= ` < $ { i } > may appears as a prefix path in all these alternatives .
` }return r+= ` See : https : //chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
For Further details . ` ,r},buildEmptyRepetitionError(t){let e= $ t(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 < OR$ { t . alternation . idx } > 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 :
< OR$ { t . alternation . idx } > inside < $ { t . topLevelRule . name } > Rule .
has $ { t . alternation . definition . length + 1 } alternatives . ` },buildLeftRecursionError(t){const e=t.topLevelRule.name,n=M(t.leftRecursionPath,s=>s.name),r= ` $ { e } -- > $ { n . 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 :
$ { r }
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 Xr?e=t.topLevelRule.name:e=t.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${t.grammarName}<-`}};function yg(t,e){const n=new Tg(t,e);return n.resolveRefs(),n.errors}class Tg extends Jr{constructor(e,n){super(),this.nameToTopRule=e,this.errMsgProvider=n,this.errors=[]}resolveRefs(){q($e(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){const n=this.nameToTopRule[e.nonTerminalName];if(n)e.referencedRule=n;else{const r=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:r,type:Ze.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}}class Rg extends Da{constructor(e,n){super(),this.topProd=e,this.path=n,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=Be(this.path.ruleStack).reverse(),this.occurrenceStack=Be(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,n=[]){this.found||super.walk(e,n)}walkProdRef(e,n,r){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){const i=n.concat(r);this.updateExpectedNext(),this.walk(e.referencedRule,i)}}updateExpectedNext(){ae(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}}class vg extends Rg{constructor(e,n){super(e,n),this.path=n,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,n,r){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){const i=n.concat(r),s=new rt({definition:i});this.possibleTokTypes=as(s),this.found=!0}}}class Fa extends Da{constructor(e,n){super(),this.topRule=e,this.occurrence=n,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}}class Eg extends Fa{walkMany(e,n,r){if(e.idx===this.occurrence){const i=wt(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof le&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkMany(e,n,r)}}class ru extends Fa{walkManySep(e,n,r){if(e.idx===this.occurrence){const i=wt(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof le&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkManySep(e,n,r)}}class Ag extends Fa{walkAtLeastOne(e,n,r){if(e.idx===this.occurrence){const i=wt(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof le&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOne(e,n,r)}}class iu extends Fa{walkAtLeastOneSep(e,n,r){if(e.idx===this.occurrence){const i=wt(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof le&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOneSep(e,n,r)}}function $o(t,e,n=[]){n=Be(n);let r=[],i=0;function s(o){return o.concat(Ge(t,i+1))}function a(o){const c=$o(s(o),e,n);return r.concat(c)}for(;n.length<e&&i<t.length;){const o=t[i];if(o instanceof rt)return a(o.definition);if(o instanceof Qe)return a(o.definition);if(o instanceof ze)r=a(o.definition);else if(o instanceof pt){const c=o.definition.concat([new Ae({definition:o.definition})]);return a(c)}else if(o instanceof mt){const c=[new rt({definition:o.definition}),new Ae({definition:[new le({terminalType:o.separator})].concat(o.definition)})];return a(c)}else if(o instanceof it){
$ { s . join ( `
` ).replace(/ \n /g, `
` )} ` ) } } } ; return n . prototype = r , n . prototype . constructor = n , n . _RULE _NAMES = e , n } function ly ( t , e , n ) { const r = function ( ) { } ; $f ( r , t + "BaseSemanticsWithDefaults" ) ; const i = Object . create ( n . prototype ) ; return q ( e , s => { i [ s ] = oy } ) , r . prototype = i , r . prototype . constructor = r , r } var Mo ; ( function ( t ) { t [ t . REDUNDANT _METHOD = 0 ] = "REDUNDANT_METHOD" , t [ t . MISSING _METHOD = 1 ] = "MISSING_METHOD" } ) ( Mo || ( Mo = { } ) ) ; function uy ( t , e ) { return dy ( t , e ) } function dy ( t , e ) { const n = ht ( e , i => Yn ( t [ i ] ) === ! 1 ) , r = M ( n , i => ( { msg : ` Missing visitor method: < ${ i } > on ${ t . constructor . name } CST Visitor. ` , type : Mo . MISSING _METHOD , methodName : i } ) ) ; return ns ( r ) } class fy { initTreeBuilder ( e ) { if ( this . CST _STACK = [ ] , this . outputCst = e . outputCst , this . nodeLocationTracking = z ( e , "nodeLocationTracking" ) ? e . nodeLocationTracking : rn . nodeLocationTracking , ! this . outputCst ) this . cstInvocationStateUpdate = Fe , this . cstFinallyStateUpdate = Fe , this . cstPostTerminal = Fe , this . cstPostNonTerminal = Fe , this . cstPostRule = Fe ; else if ( /full/i . test ( this . nodeLocationTracking ) ) this . recoveryEnabled ? ( this . setNodeLocationFromToken = cu , this . setNodeLocationFromNode = cu , this . cstPostRule = Fe , this . setInitialNodeLocation = this . setInitialNodeLocationFullRecovery ) : ( this . setNodeLocationFromToken = Fe , this . setNodeLocationFromNode = Fe , this . cstPostRule = this . cstPostRuleFull , this . setInitialNodeLocation = this . setInitialNodeLocationFullRegular ) ; else if ( /onlyOffset/i . test ( this . nodeLocationTracking ) ) this . recoveryEnabled ? ( this . setNodeLocationFromToken = ou , this . setNodeLocationFromNode = ou , this . cstPostRule = Fe , this . setInitialNodeLocation = this . setInitialNodeLocationOnlyOffsetRecovery ) : ( this . setNodeLocationFromToken = Fe , this . setNodeLocationFromNode = Fe , this . cstPostRule = this . cstPostRuleOnlyOffset , this . setInitialNodeLocation = this . setInitialNodeLocationOnlyOffsetRegular ) ; else if ( /none/i . test ( this . nodeLocationTracking ) ) this . setNodeLocationFromToken = Fe , this . setNodeLocationFromNode = Fe , this . cstPostRule = Fe , this . setInitialNodeLocation = Fe ; else throw Error ( ` Invalid <nodeLocationTracking> 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 n = this . LA ( 1 ) ; e . location = { startOffset : n . startOffset , startLine : n . startLine , startColumn : n . startColumn , endOffset : NaN , endLine : NaN , endColumn : NaN } } cstInvocationStateUpdate ( e ) { const n = { name : e , children : Object . create ( null ) } ; this . setInitialNodeLocation ( n ) , this . CST _STACK . push ( n ) } cstFinallyStateUpdate ( ) { this . CST _STACK . pop ( ) } cstPostRuleFull ( e ) { const n = this . LA ( 0 ) , r = e . location ; r . startOffset <= n . startOffset ? ( r . endOffset = n . endOffset , r . endLine = n . endLine , r . endColumn = n . endColumn ) : ( r . startOffset = NaN , r . startLine = NaN , r . startColumn = NaN ) } cstPostRuleOnlyOffset ( e ) { const n = this . LA ( 0 ) , r = e . location ; r . startOffset <= n . startOffset ? r . endOffset = n . endOffset : r . startOffset = NaN } cstPostTerminal ( e , n ) { const r = this . CST _STACK [ this . CST _STACK . length - 1 ] ; iy ( r , n , e ) , this . setNodeLocationFromToken ( r . location , n ) } cstPostNonTerminal ( e , n ) { const r = this . CST _STACK [ this . CST _STACK . length - 1 ] ; sy ( r , n , e ) , this . setNodeLocationFromNode ( r . location , e . location ) } getBaseCstVisitorConstructor ( ) { if ( tn ( this . baseCstVisitorConstructor ) ) { const e = cy ( this . className , qr ( this . gastProductionsCache ) ) ; return this . baseCstVisitorConstructor = e , e } return this . baseCstVisitorConstructor } getBaseCstVisitorConstructorWithDefaults ( ) { if ( tn ( this . baseCstVisitorWithDefaultsConstructor ) ) { const e = ly ( this . className , qr ( 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 hy { initLexerAdapter ( ) { this . tokVector = [ ] , this . tokVectorLength = 0 , this . currIdx = - 1
See : https : //chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
For Further details . ` );if(je(e)){if(ae(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(je(e))this.tokensMap=Je(e,(s,a)=>(s[a.name]=a,s),{});else if(z(e,"modes")&&kt(yt( $ e(e.modes)),hg)){const s=yt( $ e(e.modes)),a=il(s);this.tokensMap=Je(a,(o,c)=>(o[c.name]=c,o),{})}else if(jh(e))this.tokensMap=Be(e);else throw new Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=fn;const r=z(e,"modes")?yt( $ e(e.modes)): $ e(e),i=kt(r,s=>ae(s.categoryMatches));this.tokenMatcher=i?pa:os,cs( $ e(this.tokensMap))}defineRule(e,n,r){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=z(r,"resyncEnabled")?r.resyncEnabled:Ta.resyncEnabled,s=z(r,"recoveryValueFunc")?r.recoveryValueFunc:Ta.recoveryValueFunc,a=this.ruleShortNameIdx<<ey+pn;this.ruleShortNameIdx++,this.shortRuleNameToFull[a]=e,this.fullRuleNameToShort[e]=a;let o;return this.outputCst===!0?o=function(...u){try{this.ruleInvocationStateUpdate(a,e,this.subruleIdx),n.apply(this,u);const f=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(f),f}catch(f){return this.invokeRuleCatch(f,i,s)}finally{this.ruleFinallyStateUpdate()}}:o=function(...u){try{return this.ruleInvocationStateUpdate(a,e,this.subruleIdx),n.apply(this,u)}catch(f){return this.invokeRuleCatch(f,i,s)}finally{this.ruleFinallyStateUpdate()}},Object.assign(o,{ruleName:e,originalGrammarAction:n})}invokeRuleCatch(e,n,r){const i=this.RULE_STACK.length===1,s=n&&!this.isBackTracking()&&this.recoveryEnabled;if(ma(e)){const a=e;if(s){const o=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(o))if(a.resyncedTokens=this.reSyncTo(o),this.outputCst){const c=this.CST_STACK[this.CST_STACK.length-1];return c.recoveredNode=!0,c}else return r(e);else{if(this.outputCst){const c=this.CST_STACK[this.CST_STACK.length-1];c.recoveredNode=!0,a.partialCstResult=c}throw a}}else{if(i)return this.moveToTerminatedState(),r(e);throw a}}else throw e}optionInternal(e,n){const r=this.getKeyForAutomaticLookahead(Pf,n);return this.optionInternalLogic(e,n,r)}optionInternalLogic(e,n,r){let i=this.getLaFuncFromCache(r),s;if(typeof e!="function"){s=e.DEF;const a=e.GATE;if(a!==void 0){const o=i;i=()=>a.call(this)&&o.call(this)}}else s=e;if(i.call(this)===!0)return s.call(this)}atLeastOneInternal(e,n){const r=this.getKeyForAutomaticLookahead(xo,e);return this.atLeastOneInternalLogic(e,n,r)}atLeastOneInternalLogic(e,n,r){let i=this.getLaFuncFromCache(r),s;if(typeof n!="function"){s=n.DEF;const a=n.GATE;if(a!==void 0){const o=i;i=()=>a.call(this)&&o.call(this)}}else s=n;if(i.call(this)===!0){let a=this.doSingleRepetition(s);for(;i.call(this)===!0&&a===!0;)a=this.doSingleRepetition(s)}else throw this.raiseEarlyExitException(e,ge.REPETITION_MANDATORY,n.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,n],i,xo,e,Ag)}atLeastOneSepFirstInternal(e,n){const r=this.getKeyForAutomaticLookahead(na,e);this.atLeastOneSepFirstInternalLogic(e,n,r)}atLeastOneSepFirstInternalLogic(e,n,r){const i=n.DEF,s=n.SEP;if(this.getLaFuncFromCache(r).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,iu],o,na,e,iu)}else throw this.raiseEarlyExitException(e,ge.REPETITION_MANDATORY_WITH_SEPARATOR,n.ERR_MSG)}manyInternal(e,n){const r=this.getKeyForAutomaticLookahead(Oo,e);return this.manyInternalLogic(e,n,r)}manyInternalLogic(e,n,r){let i=this.getLaFuncFromCache(r),s;if(typeof n!="function"){s=n.DEF;const o=n.GATE;if(o!==void 0){const c=i;i=()=>o.call(this)&&c.call(this)}}else s=n;let a=!0;for(;i.call(this)===!0&&a===!0;)a=this.doSingleRepetition(s);this.attemptInRepetitionRecovery(this.manyInternal,[e,n],i,Oo,e,Eg,a)}manySepFirstInternal(e,n){const r=this.getKeyForAutomaticLookahead(Do,e);this.manySepFirstInternalLogic(e,n,r)}manySepFirstInternalLogic(e,n,r){const i=n.DEF,s=n.SEP;if(this.getLaFuncFromCache(r).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,ru],o,Do,e,ru)}}repetitionSepSecondInternal(e,n,r,i,s){for(;r();)this.CONSUME(n),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,n,r,i,s],r,na,e,s)}doSingleRepetition(e){const n=this.getLexerPosition();return e.call(this),this.getLexerPosition()>n}orInternal(e,n){const r=this.getKeyForAutomaticLookahead(If,n),i=je(e)?e:e.DEF,a=this.getLaFuncFromCache(r).call(this,i);if(a!==void 0)return i[a]
See : https : //chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(Of);const Ty={name:`This CSTNode indicates the Parser is in Recording Phase
See : https : //chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}};class Ry{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 n=e>0?e:"";this[`CONSUME${n}`]=function(r,i){return this.consumeInternalRecord(r,e,i)},this[`SUBRULE${n}`]=function(r,i){return this.subruleInternalRecord(r,e,i)},this[`OPTION${n}`]=function(r){return this.optionInternalRecord(r,e)},this[`OR${n}`]=function(r){return this.orInternalRecord(r,e)},this[`MANY${n}`]=function(r){this.manyInternalRecord(e,r)},this[`MANY_SEP${n}`]=function(r){this.manySepFirstInternalRecord(e,r)},this[`AT_LEAST_ONE${n}`]=function(r){this.atLeastOneInternalRecord(e,r)},this[`AT_LEAST_ONE_SEP${n}`]=function(r){this.atLeastOneSepFirstInternalRecord(e,r)}}this.consume=function(e,n,r){return this.consumeInternalRecord(n,e,r)},this.subrule=function(e,n,r){return this.subruleInternalRecord(n,e,r)},this.option=function(e,n){return this.optionInternalRecord(n,e)},this.or=function(e,n){return this.orInternalRecord(n,e)},this.many=function(e,n){this.manyInternalRecord(e,n)},this.atLeastOne=function(e,n){this.atLeastOneInternalRecord(e,n)},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 n=0;n<10;n++){const r=n>0?n:"";delete e[`CONSUME${r}`],delete e[`SUBRULE${r}`],delete e[`OPTION${r}`],delete e[`OR${r}`],delete e[`MANY${r}`],delete e[`MANY_SEP${r}`],delete e[`AT_LEAST_ONE${r}`],delete e[`AT_LEAST_ONE_SEP${r}`]}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,n){return()=>!0}LA_RECORD(e){return ya}topLevelRuleRecord(e,n){try{const r=new Xr({definition:[],name:e});return r.name=e,this.recordingProdStack.push(r),n.call(this),this.recordingProdStack.pop(),r}catch(r){if(r.KNOWN_RECORDER_ERROR!==!0)try{r.message=r.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 r}throw r}}optionInternalRecord(e,n){return yi.call(this,ze,e,n)}atLeastOneInternalRecord(e,n){yi.call(this,pt,n,e)}atLeastOneSepFirstInternalRecord(e,n){yi.call(this,mt,n,e,lu)}manyInternalRecord(e,n){yi.call(this,Ae,n,e)}manySepFirstInternalRecord(e,n){yi.call(this,it,n,e,lu)}orInternalRecord(e,n){return vy.call(this,e,n)}subruleInternalRecord(e,n,r){if(ga(n),!e||z(e,"ruleName")===!1){const o=new Error(`<SUBRULE${du(n)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>
inside top level rule : < $ { this . recordingProdStack [ 0 ] . name } > ` );throw o.KNOWN_RECORDER_ERROR=!0,o}const i=jn(this.recordingProdStack),s=e.ruleName,a=new Qe({idx:n,nonTerminalName:s,label:r?.LABEL,referencedRule:void 0});return i.definition.push(a),this.outputCst?Ty:ja}consumeInternalRecord(e,n,r){if(ga(n),!hf(e)){const a=new Error( ` < CONSUME$ { du ( n ) } > argument is invalid expecting a TokenType reference but got : < $ { JSON . stringify ( e ) } >
inside top level rule : < $ { this . recordingProdStack [ 0 ] . name } > ` );throw a.KNOWN_RECORDER_ERROR=!0,a}const i=jn(this.recordingProdStack),s=new le({idx:n,terminalType:e,label:r?.LABEL});return i.definition.push(s),Of}}function yi(t,e,n,r=!1){ga(n);const i=jn(this.recordingProdStack),s=Yn(e)?e:e.DEF,a=new t({definition:[],idx:n});return r&&(a.separator=e.SEP),z(e,"MAX_LOOKAHEAD")&&(a.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(a),s.call(this),i.definition.push(a),this.recordingProdStack.pop(),ja}function vy(t,e){ga(e);const n=jn(this.recordingProdStack),r=je(t)===!1,i=r===!1?t:t.DEF,s=new st({definition:[],idx:e,ignoreAmbiguities:r&&t.IGNORE_AMBIGUITIES===!0});z(t,"MAX_LOOKAHEAD")&&(s.maxLookahead=t.MAX_LOOKAHEAD);const a=xd(i,o=>Yn(o.GATE));return s.hasPredicates=a,n.definition.push(s),q(i,o=>{const c=new rt({definition:[]});s.definition.push(c),z(o,"IGNORE_AMBIGUITIES")?c.ignoreAmbiguities=o.IGNORE_AMBIGUITIES:z(o,"GATE")&&(c.ignoreAmbiguities=!0),this.recordingProdStack.push(c),o.ALT.call(this),this.recordingProdStack.pop()}),ja}function du(t){return t===0?"": ` $ { t } ` }function ga(t){if(t<0||t>uu){const e=new Error( ` Invalid DSL Method idx value : < $ { t } >
Idx value must be a none negative value smaller than $ { uu + 1 } ` );throw e.KNOWN_RECORDER_ERROR=!0,e}}class Ey{initPerformanceTracer(e){if(z(e,"traceInitPerf")){const n=e.traceInitPerf,r=typeof n=="number";this.traceInitMaxIdent=r?n:1/0,this.traceInitPerf=r?n>0:n}else this.traceInitMaxIdent=0,this.traceInitPerf=rn.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,n){if(this.traceInitPerf===!0){this.traceInitIndent++;const r=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log( ` $ { r } -- > < $ { e } > ` );const{time:i,value:s}=rf(n),a=i>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a( ` $ { r } < -- < $ { e } > time : $ { i } ms ` ),this.traceInitIndent--,s}else return n()}}function Ay(t,e){e.forEach(n=>{const r=n.prototype;Object.getOwnPropertyNames(r).forEach(i=>{if(i==="constructor")return;const s=Object.getOwnPropertyDescriptor(r,i);s&&(s.get||s.set)?Object.defineProperty(t.prototype,i,s):t.prototype[i]=n.prototype[i]})})}const ya=fl(fn,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(ya);const rn=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:Er,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),Ta=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0});var Ze;(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"})(Ze||(Ze={}));function fu(t=void 0){return function(){return t}}class ls{static performSelfAnalysis(e){throw Error("The **static** ` performSelfAnalysis ` method has been deprecated. \n Use the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT("performSelfAnalysis",()=>{let e;this.selfAnalysisDone=!0;const n=this.className;this.TRACE_INIT("toFastProps",()=>{sf(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),q(this.definedRulesNames,i=>{const a=this[i].originalGrammarAction;let o;this.TRACE_INIT( ` $ { i } Rule ` ,()=>{o=this.topLevelRuleRecord(i,a)}),this.gastProductionsCache[i]=o})}finally{this.disableRecording()}});let r=[];if(this.TRACE_INIT("Grammar Resolving",()=>{r=Vg({rules: $ e(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(r)}),this.TRACE_INIT("Grammar Validations",()=>{if(ae(r)&&this.skipValidations===!1){const i=Kg({rules: $ e(this.gastProductionsCache),tokenTypes: $ e(this.tokensMap),errMsgProvider:Un,grammarName:n}),s=Pg({lookaheadStrategy:this.lookaheadStrategy,rules: $ e(this.gastProductionsCache),tokenTypes: $ e(this.tokensMap),grammarName:n});this.definitionErrors=this.definitionErrors.concat(i,s)}}),ae(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{const i=_m( $ e(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: $ e(this.gastProductionsCache)}),this.preComputeLookaheadFunctions( $ e(this.gastProductionsCache))})),!ls.DEFER_DEFINITION_ERRORS_HANDLING&&!ae(this.definitionErrors))throw e=M(this.definitionErrors,i=>i.message),new Error( ` Parser Definition Errors detected :
$ { e . join ( `
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
` )} ` ) } ) } constructor ( e , n ) { this . definitionErrors = [ ] , this . selfAnalysisDone = ! 1 ; const r = this ; if ( r . initErrorHandler ( n ) , r . initLexerAdapter ( ) , r . initLooksAhead ( n ) , r . initRecognizerEngine ( e , n ) , r . initRecoverable ( n ) , r . initTreeBuilder ( n ) , r . initContentAssist ( ) , r . initGastRecorder ( n ) , r . initPerformanceTracer ( n ) , z ( n , "ignoredIssues" ) ) throw new Error ( ` The <ignoredIssues> IParserConfig property has been deprecated.
Please use the < IGNORE _AMBIGUITIES > flag on the relevant DSL method instead .
See : https : //chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
For further details . ` );this.skipValidations=z(n,"skipValidations")?n.skipValidations:rn.skipValidations}}ls.DEFER_DEFINITION_ERRORS_HANDLING=!1;Ay(ls,[Qg,ty,fy,hy,my,py,gy,yy,Ry,Ey]);class Sy extends ls{constructor(e,n=rn){const r=Be(n);r.outputCst=!1,super(e,r)}}function zr(t,e,n){return ` $ { t . name } _$ { e } _$ { n } ` }const hn=1,ky=2,xf=4,Df=5,us=7,Cy=8,wy=9,Ny=10,by=11,Mf=12;class gl{constructor(e){this.target=e}isEpsilon(){return!1}}class yl extends gl{constructor(e,n){super(e),this.tokenType=n}}class Ff extends gl{constructor(e){super(e)}isEpsilon(){return!0}}class Tl extends gl{constructor(e,n,r){super(e),this.rule=n,this.followState=r}isEpsilon(){return!0}}function _y(t){const e={decisionMap:{},decisionStates:[],ruleToStartState:new Map,ruleToStopState:new Map,states:[]};Iy(e,t);const n=t.length;for(let r=0;r<n;r++){const i=t[r],s=Xn(e,i,i);s!==void 0&&qy(e,i,s)}return e}function Iy(t,e){const n=e.length;for(let r=0;r<n;r++){const i=e[r],s=Le(t,i,void 0,{type:ky}),a=Le(t,i,void 0,{type:us});s.stop=a,t.ruleToStartState.set(i,s),t.ruleToStopState.set(i,a)}}function Gf(t,e,n){return n instanceof le?Rl(t,e,n.terminalType,n):n instanceof Qe?Uy(t,e,n):n instanceof st?xy(t,e,n):n instanceof ze?Dy(t,e,n):n instanceof Ae?Py(t,e,n):n instanceof it? $ y(t,e,n):n instanceof pt?Ly(t,e,n):n instanceof mt?Oy(t,e,n):Xn(t,e,n)}function Py(t,e,n){const r=Le(t,e,n,{type:Df});mn(t,r);const i=Qr(t,e,r,n,Xn(t,e,n));return qf(t,e,n,i)}function $ y(t,e,n){const r=Le(t,e,n,{type:Df});mn(t,r);const i=Qr(t,e,r,n,Xn(t,e,n)),s=Rl(t,e,n.separator,n);return qf(t,e,n,i,s)}function Ly(t,e,n){const r=Le(t,e,n,{type:xf});mn(t,r);const i=Qr(t,e,r,n,Xn(t,e,n));return Uf(t,e,n,i)}function Oy(t,e,n){const r=Le(t,e,n,{type:xf});mn(t,r);const i=Qr(t,e,r,n,Xn(t,e,n)),s=Rl(t,e,n.separator,n);return Uf(t,e,n,i,s)}function xy(t,e,n){const r=Le(t,e,n,{type:hn});mn(t,r);const i=M(n.definition,a=>Gf(t,e,a));return Qr(t,e,r,n,...i)}function Dy(t,e,n){const r=Le(t,e,n,{type:hn});mn(t,r);const i=Qr(t,e,r,n,Xn(t,e,n));return My(t,e,n,i)}function Xn(t,e,n){const r=ht(M(n.definition,i=>Gf(t,e,i)),i=>i!==void 0);return r.length===1?r[0]:r.length===0?void 0:Gy(t,r)}function Uf(t,e,n,r,i){const s=r.left,a=r.right,o=Le(t,e,n,{type:by});mn(t,o);const c=Le(t,e,n,{type:Mf});return s.loopback=o,c.loopback=o,t.decisionMap[zr(e,i?"RepetitionMandatoryWithSeparator":"RepetitionMandatory",n.idx)]=o,_e(a,o),i===void 0?(_e(o,s),_e(o,c)):(_e(o,c),_e(o,i.left),_e(i.right,s)),{left:s,right:c}}function qf(t,e,n,r,i){const s=r.left,a=r.right,o=Le(t,e,n,{type:Ny});mn(t,o);const c=Le(t,e,n,{type:Mf}),l=Le(t,e,n,{type:wy});return o.loopback=l,c.loopback=l,_e(o,s),_e(o,c),_e(a,l),i!==void 0?(_e(l,c),_e(l,i.left),_e(i.right,s)):_e(l,o),t.decisionMap[zr(e,i?"RepetitionWithSeparator":"Repetition",n.idx)]=o,{left:o,right:c}}function My(t,e,n,r){const i=r.left,s=r.right;return _e(i,s),t.decisionMap[zr(e,"Option",n.idx)]=i,r}function mn(t,e){return t.decisionStates.push(e),e.decision=t.decisionStates.length-1,e.decision}function Qr(t,e,n,r,...i){const s=Le(t,e,r,{type:Cy,start:n});n.end=s;for(const o of i)o!==void 0?(_e(n,o.left),_e(o.right,s)):_e(n,s);const a={left:n,right:s};return t.decisionMap[zr(e,Fy(r),r.idx)]=n,a}function Fy(t){if(t instanceof st)return"Alternation";if(t instanceof ze)return"Option";if(t instanceof Ae)return"Repetition";if(t instanceof it)return"RepetitionWithSeparator";if(t instanceof pt)return"RepetitionMandatory";if(t instanceof mt)return"RepetitionMandatoryWithSeparator";throw new Error("Invalid production type encountered")}function Gy(t,e){const n=e.length;for(let s=0;s<n-1;s++){const a=e[s];let o;a.left.transitions.length===1&&(o=a.left.transitions[0]);const c=o instanceof Tl,l=o,u=e[s+1].left;a.left.type===hn&&a.right.type===hn&&o!==void 0&&(c&&l.followState===a.right||o.target===a.right)?(c?l.followState=u:o.target=u,jy(t,a.right)):_e(a.right,u)}const r=e[0],i=e[n-1];return{left:r.left,right:i.right}}function Rl(t,e,n,r){const i=Le(t,e,r,{type:hn}),s=Le(t,e,r,{type:hn});return vl(i,new yl(s,n)),{left:i,right:s}}function Uy(t,e,n){const r=n.referencedRule,i=t.ruleToStartState.
< $ { e } > may appears as a prefix path in all these alternatives .
` ;return r=r+ ` See : https : //chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
For Further details . ` ,r}function Xy(t){if(t instanceof Qe)return"SUBRULE";if(t instanceof ze)return"OPTION";if(t instanceof st)return"OR";if(t instanceof pt)return"AT_LEAST_ONE";if(t instanceof mt)return"AT_LEAST_ONE_SEP";if(t instanceof it)return"MANY_SEP";if(t instanceof Ae)return"MANY";if(t instanceof le)return"CONSUME";throw Error("non exhaustive match")}function Jy(t,e,n){const r=dt(e.configs.elements,s=>s.state.transitions),i=Rp(r.filter(s=>s instanceof yl).map(s=>s.tokenType),s=>s.tokenTypeIdx);return{actualToken:n,possibleTokenTypes:i,tokenPath:t}}function Qy(t,e){return t.edges[e.tokenTypeIdx]}function Zy(t,e,n){const r=new Fo,i=[];for(const a of t.elements){if(n.is(a.alt)===!1)continue;if(a.state.type===us){i.push(a);continue}const o=a.state.transitions.length;for(let c=0;c<o;c++){const l=a.state.transitions[c],u=eT(l,e);u!==void 0&&r.add({state:u,alt:a.alt,stack:a.stack})}}let s;if(i.length===0&&r.size===1&&(s=r),s===void 0){s=new Fo;for(const a of r.elements)va(a,s)}if(i.length>0&&!iT(s))for(const a of i)s.add(a);return s}function eT(t,e){if(t instanceof yl&&gf(e,t.tokenType))return t.target}function tT(t,e){let n;for(const r of t.elements)if(e.is(r.alt)===!0){if(n===void 0)n=r.alt;else if(n!==r.alt)return}return n}function Bf(t){return{configs:t,edges:{},isAcceptState:!1,prediction:-1}}function mu(t,e,n,r){return r=Wf(t,r),e.edges[n.tokenTypeIdx]=r,r}function Wf(t,e){if(e===Ra)return e;const n=e.configs.key,r=t.states[n];return r!==void 0?r:(e.configs.finalize(),t.states[n]=e,e)}function nT(t){const e=new Fo,n=t.transitions.length;for(let r=0;r<n;r++){const s={state:t.transitions[r].target,alt:r,stack:[]};va(s,e)}return e}function va(t,e){const n=t.state;if(n.type===us){if(t.stack.length>0){const i=[...t.stack],a={state:i.pop(),alt:t.alt,stack:i};va(a,e)}else e.add(t);return}n.epsilonOnlyTransitions||e.add(t);const r=n.transitions.length;for(let i=0;i<r;i++){const s=n.transitions[i],a=rT(t,s);a!==void 0&&va(a,e)}}function rT(t,e){if(e instanceof Ff)return{state:e.target,alt:t.alt,stack:t.stack};if(e instanceof Tl){const n=[...t.stack,e.followState];return{state:e.target,alt:t.alt,stack:n}}}function iT(t){for(const e of t.elements)if(e.state.type===us)return!0;return!1}function sT(t){for(const e of t.elements)if(e.state.type!==us)return!1;return!0}function aT(t){if(sT(t))return!0;const e=oT(t.elements);return cT(e)&&!lT(e)}function oT(t){const e=new Map;for(const n of t){const r=jf(n,!1);let i=e.get(r);i===void 0&&(i={},e.set(r,i)),i[n.alt]=!0}return e}function cT(t){for(const e of Array.from(t.values()))if(Object.keys(e).length>1)return!0;return!1}function lT(t){for(const e of Array.from(t.values()))if(Object.keys(e).length===1)return!0;return!1}var Go;(function(t){function e(n){return typeof n=="string"}t.is=e})(Go||(Go={}));var Ea;(function(t){function e(n){return typeof n=="string"}t.is=e})(Ea||(Ea={}));var Uo;(function(t){t.MIN_VALUE=-2147483648,t.MAX_VALUE=2147483647;function e(n){return typeof n=="number"&&t.MIN_VALUE<=n&&n<=t.MAX_VALUE}t.is=e})(Uo||(Uo={}));var Vi;(function(t){t.MIN_VALUE=0,t.MAX_VALUE=2147483647;function e(n){return typeof n=="number"&&t.MIN_VALUE<=n&&n<=t.MAX_VALUE}t.is=e})(Vi||(Vi={}));var te;(function(t){function e(r,i){return r===Number.MAX_VALUE&&(r=Vi.MAX_VALUE),i===Number.MAX_VALUE&&(i=Vi.MAX_VALUE),{line:r,character:i}}t.create=e;function n(r){let i=r;return v.objectLiteral(i)&&v.uinteger(i.line)&&v.uinteger(i.character)}t.is=n})(te||(te={}));var X;(function(t){function e(r,i,s,a){if(v.uinteger(r)&&v.uinteger(i)&&v.uinteger(s)&&v.uinteger(a))return{start:te.create(r,i),end:te.create(s,a)};if(te.is(r)&&te.is(i))return{start:r,end:i};throw new Error( ` Range # create called with invalid arguments [ $ { r } , $ { i } , $ { s } , $ { a } ] ` )}t.create=e;function n(r){let i=r;return v.objectLiteral(i)&&te.is(i.start)&&te.is(i.end)}t.is=n})(X||(X={}));var Ki;(function(t){function e(r,i){return{uri:r,range:i}}t.create=e;function n(r){let i=r;return v.objectLiteral(i)&&X.is(i.range)&&(v.string(i.uri)||v.undefined(i.uri))}t.is=n})(Ki||(Ki={}));var qo;(function(t){function e(r,i,s,a){return{targetUri:r,targ
` , ` \ r
` ," \r "];var Fc;(function(t){function e(s,a,o,c){return new fT(s,a,o,c)}t.create=e;function n(s){let a=s;return!!(v.defined(a)&&v.string(a.uri)&&(v.undefined(a.languageId)||v.string(a.languageId))&&v.uinteger(a.lineCount)&&v.func(a.getText)&&v.func(a.positionAt)&&v.func(a.offsetAt))}t.is=n;function r(s,a){let o=s.getText(),c=i(a,(u,f)=>{let m=u.range.start.line-f.range.start.line;return m===0?u.range.start.character-f.range.start.character:m}),l=o.length;for(let u=c.length-1;u>=0;u--){let f=c[u],m=s.offsetAt(f.range.start),p=s.offsetAt(f.range.end);if(p<=l)o=o.substring(0,m)+f.newText+o.substring(p,o.length);else throw new Error("Overlapping edit");l=m}return o}t.applyEdits=r;function i(s,a){if(s.length<=1)return s;const o=s.length/2|0,c=s.slice(0,o),l=s.slice(o);i(c,a),i(l,a);let u=0,f=0,m=0;for(;u<c.length&&f<l.length;)a(c[u],l[f])<=0?s[m++]=c[u++]:s[m++]=l[f++];for(;u<c.length;)s[m++]=c[u++];for(;f<l.length;)s[m++]=l[f++];return s}})(Fc||(Fc={}));let fT=class{constructor(e,n,r,i){this._uri=e,this._languageId=n,this._version=r,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let n=this.offsetAt(e.start),r=this.offsetAt(e.end);return this._content.substring(n,r)}return this._content}update(e,n){this._content=e.text,this._version=n,this._lineOffsets=void 0}getLineOffsets(){if(this._lineOffsets===void 0){let e=[],n=this._content,r=!0;for(let i=0;i<n.length;i++){r&&(e.push(i),r=!1);let s=n.charAt(i);r=s===" \r "||s=== `
` ,s===" \r "&&i+1<n.length&&n.charAt(i+1)=== `
` &&i++}r&&n.length>0&&e.push(n.length),this._lineOffsets=e}return this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let n=this.getLineOffsets(),r=0,i=n.length;if(i===0)return te.create(0,e);for(;r<i;){let a=Math.floor((r+i)/2);n[a]>e?i=a:r=a+1}let s=r-1;return te.create(s,e-n[s])}offsetAt(e){let n=this.getLineOffsets();if(e.line>=n.length)return this._content.length;if(e.line<0)return 0;let r=n[e.line],i=e.line+1<n.length?n[e.line+1]:this._content.length;return Math.max(Math.min(r+e.character,i),r)}get lineCount(){return this.getLineOffsets().length}};var v;(function(t){const e=Object.prototype.toString;function n(p){return typeof p<"u"}t.defined=n;function r(p){return typeof p>"u"}t.undefined=r;function i(p){return p===!0||p===!1}t.boolean=i;function s(p){return e.call(p)==="[object String]"}t.string=s;function a(p){return e.call(p)==="[object Number]"}t.number=a;function o(p,A,b){return e.call(p)==="[object Number]"&&A<=p&&p<=b}t.numberRange=o;function c(p){return e.call(p)==="[object Number]"&&-2147483648<=p&&p<=2147483647}t.integer=c;function l(p){return e.call(p)==="[object Number]"&&0<=p&&p<=2147483647}t.uinteger=l;function u(p){return e.call(p)==="[object Function]"}t.func=u;function f(p){return p!==null&&typeof p=="object"}t.objectLiteral=f;function m(p,A){return Array.isArray(p)&&p.every(A)}t.typedArray=m})(v||(v={}));const hT=Object.freeze(Object.defineProperty({__proto__:null,get AnnotatedTextEdit(){return Jt},get ChangeAnnotation(){return qn},get ChangeAnnotationIdentifier(){return qe},get CodeAction(){return Tc},get CodeActionContext(){return yc},get CodeActionKind(){return gc},get CodeActionTriggerKind(){return Qi},get CodeDescription(){return Ho},get CodeLens(){return Rc},get Color(){return Aa},get ColorInformation(){return jo},get ColorPresentation(){return zo},get Command(){return Kn},get CompletionItem(){return ic},get CompletionItemKind(){return Qo},get CompletionItemLabelDetails(){return rc},get CompletionItemTag(){return ec},get CompletionList(){return sc},get CreateFile(){return Br},get DeleteFile(){return Vr},get Diagnostic(){return Hi},get DiagnosticRelatedInformation(){return Sa},get DiagnosticSeverity(){return Vo},get DiagnosticTag(){return Ko},get DocumentHighlight(){return uc},get DocumentHighlightKind(){return lc},get DocumentLink(){return Ec},get DocumentSymbol(){return mc},get DocumentUri(){return Go},EOL:dT,get FoldingRange(){return Wo},get FoldingRangeKind(){return Bo},get FormattingOptions(){return vc},get Hover(){return ac},get InlayHint(){return Ic},get InlayHintKind(){return wa},get InlayHintLabelPart(){return Na},get InlineCompletionContext(){return Dc},get InlineCompletionItem(){return $ c},get InlineCompletionList(){return Lc},get InlineCompletionTriggerKind(){return Oc},get InlineValueContext(){return _c},get InlineValueEvaluatableExpression(){return bc},get InlineValueText(){return wc},get InlineValueVariableLookup(){return Nc},get InsertReplaceEdit(){return tc},get InsertTextFormat(){return Zo},get InsertTextMode(){return nc},get Location(){return Ki},get LocationLink(){return qo},get MarkedString(){return Ji},get MarkupContent(){return Kr},get MarkupKind(){return Ca},get OptionalVersionedTextDocumentIdentifier(){return Xi},get ParameterInformation(){return oc},get Position(){return te},get Range(){return X},get RenameFile(){return Wr},get SelectedCompletionInfo(){return xc},get SelectionRange(){return Ac},get SemanticTokenModifiers(){return kc},get SemanticTokenTypes(){return Sc},get SemanticTokens(){return Cc},get SignatureInformation(){return cc},get StringValue(){return Pc},get SymbolInformation(){return hc},get SymbolKind(){return dc},get SymbolTag(){return fc},get TextDocument(){return Fc},get TextDocumentEdit(){return Yi},get TextDocumentIdentifier(){return Yo},get TextDocumentItem(){return Jo},get TextEdit(){return Ot},get URI(){return Ea},get VersionedTextDocumentIdentifier(){return Xo},WorkspaceChange:uT,get WorkspaceEdit(){return ka},get WorkspaceFolder(){return Mc},get WorkspaceSymbol(){return pc},get integer(){return Uo},get uinteger(){r
` ;case"r":return" \r ";case"t":return" ";case"v":return" \v ";case"0":return" \0 ";default:return l}}function r(l){return l.charAt(0)==="^"?l.substring(1):l}t.convertID=r;function i(l){return parseInt(l)}t.convertInt=i;function s(l){return BigInt(l)}t.convertBigint=s;function a(l){return new Date(l)}t.convertDate=a;function o(l){return Number(l)}t.convertNumber=o;function c(l){return l.toLowerCase()==="true"}t.convertBoolean=c})(Ht||(Ht={}));var Sn={},Fs={},Tu;function Jn(){if(Tu)return Fs;Tu=1,Object.defineProperty(Fs,"__esModule",{value:!0});let t;function e(){if(t===void 0)throw new Error("No runtime abstraction layer installed");return t}return(function(n){function r(i){if(i===void 0)throw new Error("No runtime abstraction layer provided");t=i}n.install=r})(e||(e={})),Fs.default=e,Fs}var De={},Ru;function ds(){if(Ru)return De;Ru=1,Object.defineProperty(De,"__esModule",{value:!0}),De.stringArray=De.array=De.func=De.error=De.number=De.string=De.boolean=void 0;function t(o){return o===!0||o===!1}De.boolean=t;function e(o){return typeof o=="string"||o instanceof String}De.string=e;function n(o){return typeof o=="number"||o instanceof Number}De.number=n;function r(o){return o instanceof Error}De.error=r;function i(o){return typeof o=="function"}De.func=i;function s(o){return Array.isArray(o)}De.array=s;function a(o){return s(o)&&o.every(c=>e(c))}return De.stringArray=a,De}var kn={},vu;function Zr(){if(vu)return kn;vu=1,Object.defineProperty(kn,"__esModule",{value:!0}),kn.Emitter=kn.Event=void 0;const t=Jn();var e;(function(i){const s={dispose(){}};i.None=function(){return s}})(e||(kn.Event=e={}));class n{add(s,a=null,o){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(s),this._contexts.push(a),Array.isArray(o)&&o.push({dispose:()=>this.remove(s,a)})}remove(s,a=null){if(!this._callbacks)return;let o=!1;for(let c=0,l=this._callbacks.length;c<l;c++)if(this._callbacks[c]===s)if(this._contexts[c]===a){this._callbacks.splice(c,1),this._contexts.splice(c,1);return}else o=!0;if(o)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...s){if(!this._callbacks)return[];const a=[],o=this._callbacks.slice(0),c=this._contexts.slice(0);for(let l=0,u=o.length;l<u;l++)try{a.push(o[l].apply(c[l],s))}catch(f){(0,t.default)().console.error(f)}return a}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}}class r{constructor(s){this._options=s}get event(){return this._event||(this._event=(s,a,o)=>{this._callbacks||(this._callbacks=new n),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(s,a);const c={dispose:()=>{this._callbacks&&(this._callbacks.remove(s,a),c.dispose=r._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(o)&&o.push(c),c}),this._event}fire(s){this._callbacks&&this._callbacks.invoke.call(this._callbacks,s)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}}return kn.Emitter=r,r._noop=function(){},kn}var Eu;function za(){if(Eu)return Sn;Eu=1,Object.defineProperty(Sn,"__esModule",{value:!0}),Sn.CancellationTokenSource=Sn.CancellationToken=void 0;const t=Jn(),e=ds(),n=Zr();var r;(function(o){o.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:n.Event.None}),o.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:n.Event.None});function c(l){const u=l;return u&&(u===o.None||u===o.Cancelled||e.boolean(u.isCancellationRequested)&&!!u.onCancellationRequested)}o.is=c})(r||(Sn.CancellationToken=r={}));const i=Object.freeze(function(o,c){const l=(0,t.default)().timer.setTimeout(o.bind(c),0);return{dispose(){l.dispose()}}});class s{constructor(){this._isCancelled=!1}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationReques
$ { JSON . stringify ( Object . fromEntries ( f ) ) } ` ));return}const p=parseInt(m);if(isNaN(p)){this.fireError(new Error( ` Content - Length value must be a number . Got $ { m } ` ));return}this.nextMessageLength=p}const u=this.buffer.tryReadBody(this.nextMessageLength);if(u===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{const f=this.options.contentDecoder!==void 0?await this.options.contentDecoder.decode(u):u,m=await this.options.contentTypeDecoder.decode(f,this.options);this.callback(m)}).catch(f=>{this.fireError(f)})}}catch(u){this.fireError(u)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,t.default)().timer.setTimeout((l,u)=>{this.partialMessageTimer=void 0,l===this.messageToken&&(this.firePartialMessage({messageToken:l,waitingTime:u}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}}return Gt.ReadableStreamMessageReader=o,Gt}var Ut={}, $ u;function fR(){if( $ u)return Ut; $ u=1,Object.defineProperty(Ut,"__esModule",{value:!0}),Ut.WriteableStreamMessageWriter=Ut.AbstractMessageWriter=Ut.MessageWriter=void 0;const t=Jn(),e=ds(),n=lh(),r=Zr(),i="Content-Length: ",s= ` \ r
` ;var a;(function(u){function f(m){let p=m;return p&&e.func(p.dispose)&&e.func(p.onClose)&&e.func(p.onError)&&e.func(p.write)}u.is=f})(a||(Ut.MessageWriter=a={}));class o{constructor(){this.errorEmitter=new r.Emitter,this.closeEmitter=new r.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(f,m,p){this.errorEmitter.fire([this.asError(f),m,p])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(f){return f instanceof Error?f:new Error( ` Writer received error . Reason : $ { e . string ( f . message ) ? f . message : "unknown" } ` )}}Ut.AbstractMessageWriter=o;var c;(function(u){function f(m){return m===void 0||typeof m=="string"?{charset:m??"utf-8",contentTypeEncoder:(0,t.default)().applicationJson.encoder}:{charset:m.charset??"utf-8",contentEncoder:m.contentEncoder,contentTypeEncoder:m.contentTypeEncoder??(0,t.default)().applicationJson.encoder}}u.fromOptions=f})(c||(c={}));class l extends o{constructor(f,m){super(),this.writable=f,this.options=c.fromOptions(m),this.errorCount=0,this.writeSemaphore=new n.Semaphore(1),this.writable.onError(p=>this.fireError(p)),this.writable.onClose(()=>this.fireClose())}async write(f){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(f,this.options).then(p=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(p):p).then(p=>{const A=[];return A.push(i,p.byteLength.toString(),s),A.push(s),this.doWrite(f,A,p)},p=>{throw this.fireError(p),p}))}async doWrite(f,m,p){try{return await this.writable.write(m.join(""),"ascii"),this.writable.write(p)}catch(A){return this.handleError(A,f),Promise.reject(A)}}handleError(f,m){this.errorCount++,this.fireError(f,m,this.errorCount)}end(){this.writable.end()}}return Ut.WriteableStreamMessageWriter=l,Ut}var Ei={},Lu;function hR(){if(Lu)return Ei;Lu=1,Object.defineProperty(Ei,"__esModule",{value:!0}),Ei.AbstractMessageBuffer=void 0;const t=13,e=10,n= ` \ r
` ;class r{constructor(s="utf-8"){this._encoding=s,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(s){const a=typeof s=="string"?this.fromString(s,this._encoding):s;this._chunks.push(a),this._totalLength+=a.byteLength}tryReadHeaders(s=!1){if(this._chunks.length===0)return;let a=0,o=0,c=0,l=0;e:for(;o<this._chunks.length;){const p=this._chunks[o];for(c=0;c<p.length;){switch(p[c]){case t:switch(a){case 0:a=1;break;case 2:a=3;break;default:a=0}break;case e:switch(a){case 1:a=2;break;case 3:a=4,c++;break e;default:a=0}break;default:a=0}c++}l+=p.byteLength,o++}if(a!==4)return;const u=this._read(l+c),f=new Map,m=this.toString(u,"ascii").split(n);if(m.length<2)return f;for(let p=0;p<m.length-2;p++){const A=m[p],b=A.indexOf(":");if(b===-1)throw new Error( ` Message header must separate key and value using ':'
$ { A } ` );const I=A.substr(0,b),C=A.substr(b+1).trim();f.set(s?I.toLowerCase():I,C)}return f}tryReadBody(s){if(!(this._totalLength<s))return this._read(s)}get numberOfBytes(){return this._totalLength}_read(s){if(s===0)return this.emptyBuffer();if(s>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===s){const l=this._chunks[0];return this._chunks.shift(),this._totalLength-=s,this.asNative(l)}if(this._chunks[0].byteLength>s){const l=this._chunks[0],u=this.asNative(l,s);return this._chunks[0]=l.slice(s),this._totalLength-=s,u}const a=this.allocNative(s);let o=0,c=0;for(;s>0;){const l=this._chunks[c];if(l.byteLength>s){const u=l.slice(0,s);a.set(u,o),o+=s,this._chunks[c]=l.slice(s),this._totalLength-=s,s-=s}else a.set(l,o),o+=l.byteLength,this._chunks.shift(),this._totalLength-=l.byteLength,s-=l.byteLength}return a}}return Ei.AbstractMessageBuffer=r,Ei}var ao={},Ou;function pR(){return Ou||(Ou=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.createMessageConnection=t.ConnectionOptions=t.MessageStrategy=t.CancellationStrategy=t.CancellationSenderStrategy=t.CancellationReceiverStrategy=t.RequestCancellationReceiverStrategy=t.IdCancellationReceiverStrategy=t.ConnectionStrategy=t.ConnectionError=t.ConnectionErrors=t.LogTraceNotification=t.SetTraceNotification=t.TraceFormat=t.TraceValues=t.Trace=t.NullLogger=t.ProgressType=t.ProgressToken=void 0;const e=Jn(),n=ds(),r=oh(),i=ch(),s=Zr(),a=za();var o;(function(g){g.type=new r.NotificationType(" $ /cancelRequest")})(o||(o={}));var c;(function(g){function S(y){return typeof y=="string"||typeof y=="number"}g.is=S})(c||(t.ProgressToken=c={}));var l;(function(g){g.type=new r.NotificationType(" $ /progress")})(l||(l={}));class u{constructor(){}}t.ProgressType=u;var f;(function(g){function S(y){return n.func(y)}g.is=S})(f||(f={})),t.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var m;(function(g){g[g.Off=0]="Off",g[g.Messages=1]="Messages",g[g.Compact=2]="Compact",g[g.Verbose=3]="Verbose"})(m||(t.Trace=m={}));var p;(function(g){g.Off="off",g.Messages="messages",g.Compact="compact",g.Verbose="verbose"})(p||(t.TraceValues=p={})),(function(g){function S(R){if(!n.string(R))return g.Off;switch(R=R.toLowerCase(),R){case"off":return g.Off;case"messages":return g.Messages;case"compact":return g.Compact;case"verbose":return g.Verbose;default:return g.Off}}g.fromString=S;function y(R){switch(R){case g.Off:return"off";case g.Messages:return"messages";case g.Compact:return"compact";case g.Verbose:return"verbose";default:return"off"}}g.toString=y})(m||(t.Trace=m={}));var A;(function(g){g.Text="text",g.JSON="json"})(A||(t.TraceFormat=A={})),(function(g){function S(y){return n.string(y)?(y=y.toLowerCase(),y==="json"?g.JSON:g.Text):g.Text}g.fromString=S})(A||(t.TraceFormat=A={}));var b;(function(g){g.type=new r.NotificationType(" $ /setTrace")})(b||(t.SetTraceNotification=b={}));var I;(function(g){g.type=new r.NotificationType(" $ /logTrace")})(I||(t.LogTraceNotification=I={}));var C;(function(g){g[g.Closed=1]="Closed",g[g.Disposed=2]="Disposed",g[g.AlreadyListening=3]="AlreadyListening"})(C||(t.ConnectionErrors=C={}));class w extends Error{constructor(S,y){super(y),this.code=S,Object.setPrototypeOf(this,w.prototype)}}t.ConnectionError=w;var k;(function(g){function S(y){const R=y;return R&&n.func(R.cancelUndispatched)}g.is=S})(k||(t.ConnectionStrategy=k={}));var P;(function(g){function S(y){const R=y;return R&&(R.kind===void 0||R.kind==="id")&&n.func(R.createCancellationTokenSource)&&(R.dispose===void 0||n.func(R.dispose))}g.is=S})(P||(t.IdCancellationReceiverStrategy=P={}));var H;(function(g){function S(y){const R=y;return R&&R.kind==="request"&&n.func(R.createCancellationTokenSource)&&(R.dispose===void 0||n.func(R.dispose))}g.is=S})(H||(t.RequestCancellationReceiverStrategy=H={}));var K;(function(g){g.Message=Object.freeze({createCancellationTokenSource(y){return new a.CancellationTokenSource}});function S(y){return P.is(y)||H.is(y)}g.is=S})(K||(t.CancellationReceiverStrategy=K={}));var J;(function(g){g.Message=Object.free
$ { JSON . stringify ( h . error , void 0 , 4 ) } ` ):E.error("Received response message without id. No further error information provided.");else{const N=h.id,L=Ie.get(N);if(Ns(h,L),L!==void 0){Ie.delete(N);try{if(h.error){const F=h.error;L.reject(new r.ResponseError(F.code,F.message,F.data))}else if(h.result!==void 0)L.resolve(h.result);else throw new Error("Should never happen.")}catch(F){F.message?E.error( ` Response handler '${L.method}' failed with message : $ { F . message } ` ):E.error( ` Response handler '${L.method}' failed unexpectedly . ` )}}}}function As(h){if(Dt())return;let N,L;if(h.method===o.type.method){const F=h.params.id;xe.delete(F),tr(h);return}else{const F=ne.get(h.method);F&&(L=F.handler,N=F.type)}if(L||B)try{if(tr(h),L)if(h.params===void 0)N!==void 0&&N.numberOfParams!==0&&N.parameterStructures!==r.ParameterStructures.byName&&E.error( ` Notification $ { h . method } defines $ { N . numberOfParams } params but received none . ` ),L();else if(Array.isArray(h.params)){const F=h.params;h.method===l.type.method&&F.length===2&&c.is(F[0])?L({token:F[0],value:F[1]}):(N!==void 0&&(N.parameterStructures===r.ParameterStructures.byName&&E.error( ` Notification $ { h . method } defines parameters by name but received parameters by position ` ),N.numberOfParams!==h.params.length&&E.error( ` Notification $ { h . method } defines $ { N . numberOfParams } params but received $ { F . length } arguments ` )),L(...F))}else N!==void 0&&N.parameterStructures===r.ParameterStructures.byPosition&&E.error( ` Notification $ { h . method } defines parameters by position but received parameters by name ` ),L(h.params);else B&&B(h.method,h.params)}catch(F){F.message?E.error( ` Notification handler '${h.method}' failed with message : $ { F . message } ` ):E.error( ` Notification handler '${h.method}' failed unexpectedly . ` )}else ni.fire(h)}function Ss(h){if(!h){E.error("Received empty message.");return}E.error( ` Received message which is neither a response nor a notification message :
$ { JSON . stringify ( h , null , 4 ) } ` );const N=h;if(n.string(N.id)||n.number(N.id)){const L=N.id,F=Ie.get(L);F&&F.reject(new Error("The received response has neither a result nor an error property."))}}function vt(h){if(h!=null)switch(Z){case m.Verbose:return JSON.stringify(h,null,4);case m.Compact:return JSON.stringify(h);default:return}}function ks(h){if(!(Z===m.Off||!ve))if(at===A.Text){let N;(Z===m.Verbose||Z===m.Compact)&&h.params&&(N= ` Params : $ { vt ( h . params ) }
` ),ve.log( ` Sending request '${h.method} - (${h.id})' . ` ,N)}else Mt("send-request",h)}function Cs(h){if(!(Z===m.Off||!ve))if(at===A.Text){let N;(Z===m.Verbose||Z===m.Compact)&&(h.params?N= ` Params : $ { vt ( h . params ) }
` :N= ` No parameters provided .
` ),ve.log( ` Sending notification '${h.method}' . ` ,N)}else Mt("send-notification",h)}function vn(h,N,L){if(!(Z===m.Off||!ve))if(at===A.Text){let F;(Z===m.Verbose||Z===m.Compact)&&(h.error&&h.error.data?F= ` Error data : $ { vt ( h . error . data ) }
` :h.result?F= ` Result : $ { vt ( h . result ) }
` :h.error===void 0&&(F= ` No result returned .
` )),ve.log( ` Sending response '${N} - (${h.id})' . Processing request took $ { Date . now ( ) - L } ms ` ,F)}else Mt("send-response",h)}function ws(h){if(!(Z===m.Off||!ve))if(at===A.Text){let N;(Z===m.Verbose||Z===m.Compact)&&h.params&&(N= ` Params : $ { vt ( h . params ) }
` ),ve.log( ` Received request '${h.method} - (${h.id})' . ` ,N)}else Mt("receive-request",h)}function tr(h){if(!(Z===m.Off||!ve||h.method===I.type.method))if(at===A.Text){let N;(Z===m.Verbose||Z===m.Compact)&&(h.params?N= ` Params : $ { vt ( h . params ) }
` :N= ` No parameters provided .
` ),ve.log( ` Received notification '${h.method}' . ` ,N)}else Mt("receive-notification",h)}function Ns(h,N){if(!(Z===m.Off||!ve))if(at===A.Text){let L;if((Z===m.Verbose||Z===m.Compact)&&(h.error&&h.error.data?L= ` Error data : $ { vt ( h . error . data ) }
` :h.result?L= ` Result : $ { vt ( h . result ) }
` :h.error===void 0&&(L= ` No result returned .
` )),N){const F=h.error? ` Request failed : $ { h . error . message } ( $ { h . error . code } ) . ` :"";ve.log( ` Received response '${N.method} - (${h.id})' in $ { Date . now ( ) - N . timerStart } ms . $ { F } ` ,L)}else ve.log( ` Received response $ { h . id } without active response promise . ` ,L)}else Mt("receive-response",h)}function Mt(h,N){if(!ve||Z===m.Off)return;const L={isLSPMessage:!0,type:h,message:N,timestamp:Date.now()};ve.log(L)}function on(){if(oi())throw new w(C.Closed,"Connection is closed.");if(Dt())throw new w(C.Disposed,"Connection is disposed.")}function bs(){if(ai())throw new w(C.AlreadyListening,"Connection is already listening")}function _s(){if(!ai())throw new Error("Call listen() first.")}function cn(h){return h===void 0?null:h}function di(h){if(h!==null)return h}function d(h){return h!=null&&!Array.isArray(h)&&typeof h=="object"}function ke(h,N){switch(h){case r.ParameterStructures.auto:return d(N)?di(N):[cn(N)];case r.ParameterStructures.byName:if(!d(N))throw new Error("Received parameters by name but param is not an object literal.");return di(N);case r.ParameterStructures.byPosition:return[cn(N)];default:throw new Error( ` Unknown parameter structure $ { h . toString ( ) } ` )}}function Ce(h,N){let L;const F=h.numberOfParams;switch(F){case 0:L=void 0;break;case 1:L=ke(h.parameterStructures,N[0]);break;default:L=[];for(let ce=0;ce<N.length&&ce<F;ce++)L.push(cn(N[ce]));if(N.length<F)for(let ce=N.length;ce<F;ce++)L.push(null);break}return L}const V={sendNotification:(h,...N)=>{on();let L,F;if(n.string(h)){L=h;const se=N[0];let Ee=0,we=r.ParameterStructures.auto;r.ParameterStructures.is(se)&&(Ee=1,we=se);let Q=N.length;const he=Q-Ee;switch(he){case 0:F=void 0;break;case 1:F=ke(we,N[Ee]);break;default:if(we===r.ParameterStructures.byName)throw new Error( ` Received $ { he } parameters for 'by Name' notification parameter structure . ` );F=N.slice(Ee,Q).map(re=>cn(re));break}}else{const se=N;L=h.method,F=Ce(h,se)}const ce={jsonrpc:j,method:L,params:F};return Cs(ce),S.write(ce).catch(se=>{throw E.error("Sending notification failed."),se})},onNotification:(h,N)=>{on();let L;return n.func(h)?B=h:N&&(n.string(h)?(L=h,ne.set(h,{type:void 0,handler:N})):(L=h.method,ne.set(h.method,{type:h,handler:N}))),{dispose:()=>{L!==void 0?ne.delete(L):B=void 0}}},onProgress:(h,N,L)=>{if(Oe.has(N))throw new Error( ` Progress handler for token $ { N } already registered ` );return Oe.set(N,L),{dispose:()=>{Oe.delete(N)}}},sendProgress:(h,N,L)=>V.sendNotification(l.type,{token:N,value:L}),onUnhandledProgress:ri.event,sendRequest:(h,...N)=>{on(),_s();let L,F,ce;if(n.string(h)){L=h;const Q=N[0],he=N[N.length-1];let re=0,Pe=r.ParameterStructures.auto;r.ParameterStructures.is(Q)&&(re=1,Pe=Q);let Ke=N.length;a.CancellationToken.is(he)&&(Ke=Ke-1,ce=he);const _t=Ke-re;switch(_t){case 0:F=void 0;break;case 1:F=ke(Pe,N[re]);break;default:if(Pe===r.ParameterStructures.byName)throw new Error( ` Received $ { _t } parameters for 'by Name' request parameter structure . ` );F=N.slice(re,Ke).map(Lh=>cn(Lh));break}}else{const Q=N;L=h.method,F=Ce(h,Q);const he=h.numberOfParams;ce=a.CancellationToken.is(Q[he])?Q[he]:void 0}const se=O++;let Ee;ce&&(Ee=ce.onCancellationRequested(()=>{const Q=Rt.sender.sendCancellation(V,se);return Q===void 0?(E.log( ` Received no promise from cancellation strategy when cancelling id $ { se } ` ),Promise.resolve()):Q.catch(()=>{E.log( ` Sending cancellation messages for id $ { se } failed ` )})}));const we={jsonrpc:j,id:se,method:L,params:F};return ks(we),typeof Rt.sender.enableCancellation=="function"&&Rt.sender.enableCancellation(we),new Promise(async(Q,he)=>{const re=_t=>{Q(_t),Rt.sender.cleanup(se),Ee?.dispose()},Pe=_t=>{he(_t),Rt.sender.cleanup(se),Ee?.dispose()},Ke={method:L,timerStart:Date.now(),resolve:re,reject:Pe};try{await S.write(we),Ie.set(se,Ke)}catch(_t){throw E.error("Sending request failed."),Ke.reject(new r.ResponseError(r.ErrorCodes.MessageWriteError,_t.message?_t.message:"Unknown reason")),_t}})},onRequest:(h,N)=>{on();let L=null;return f.is(h)?(L=void 0,G=h):n.string(h)?(L=null,N!==void 0&&(L=h,ie.set(h,{handler:N,type:void 0}))):N!==void 0&&(L=h.method,ie.set(h.method,{type:h,ha
$ { n } ` ),this.inline? ` { $ { e } } ` :e}toMarkdown(e){return e?.renderTag?.(this)??this.toMarkdownDefault(e)}toMarkdownDefault(e){const n=this.content.toMarkdown(e);if(this.inline){const s=av(this.name,n,e??{});if(typeof s=="string")return s}let r="";e?.tag==="italic"||e?.tag===void 0?r="*":e?.tag==="bold"?r="**":e?.tag==="bold-italic"&&(r="***");let i= ` $ { r } @ $ { this . name } $ { r } ` ;return this.content.inlines.length===1?i= ` $ { i } — $ { n } ` :this.content.inlines.length>1&&(i= ` $ { i }
$ { n } ` ),this.inline? ` { $ { i } } ` :i}}function av(t,e,n){if(t==="linkplain"||t==="linkcode"||t==="link"){const r=e.indexOf(" ");let i=e;if(r>0){const a=Vc(e,r);i=e.substring(a),e=e.substring(0,r)}return(t==="linkcode"||t==="link"&&n.link==="code")&&(i= ` \ ` ${ i } \` ` ) , n . renderLink ? . ( e , i ) ? ? ov ( e , i ) } } function ov ( t , e ) { try { return Ct . parse ( t , ! 0 ) , ` [ ${ e } ]( ${ t } ) ` } catch { return t } } class Kc { constructor ( e , n ) { this . inlines = e , this . range = n } toString ( ) { let e = "" ; for ( let n = 0 ; n < this . inlines . length ; n ++ ) { const r = this . inlines [ n ] , i = this . inlines [ n + 1 ] ; e += r . toString ( ) , i && i . range . start . line > r . range . start . line && ( e += `
` )}return e}toMarkdown(e){let n="";for(let r=0;r<this.inlines.length;r++){const i=this.inlines[r],s=this.inlines[r+1];n+=i.toMarkdown(e),s&&s.range.start.line>i.range.start.line&&(n+= `
` )}return n}}class mh{constructor(e,n){this.text=e,this.range=n}toString(){return this.text}toMarkdown(){return this.text}}function gd(t){return t.endsWith( `
` )? `
` : `
` }class cv{constructor(e){this.indexManager=e.shared.workspace.IndexManager,this.commentProvider=e.documentation.CommentProvider}getDocumentation(e){const n=this.commentProvider.getComment(e);if(n&&YR(n))return HR(n).toMarkdown({renderLink:(i,s)=>this.documentationLinkRenderer(e,i,s),renderTag:i=>this.documentationTagRenderer(e,i)})}documentationLinkRenderer(e,n,r){const i=this.findNameInLocalSymbols(e,n)??this.findNameInGlobalScope(e,n);if(i&&i.nameSegment){const s=i.nameSegment.range.start.line+1,a=i.nameSegment.range.start.character+1,o=i.documentUri.with({fragment: ` L$ { s } , $ { a } ` });return ` [ $ { r } ] ( $ { o . toString ( ) } ) ` }else return}documentationTagRenderer(e,n){}findNameInLocalSymbols(e,n){const i=Qt(e).localSymbols;if(!i)return;let s=e;do{const o=i.getStream(s).find(c=>c.name===n);if(o)return o;s=s. $ container}while(s)}findNameInGlobalScope(e,n){return this.indexManager.allElements().find(i=>i.name===n)}}class lv{constructor(e){this.grammarConfig=()=>e.parser.GrammarConfig}getComment(e){return XT(e)?e. $ comment:Vp(e. $ cstNode,this.grammarConfig().multilineCommentRules)?.text}}class uv{constructor(e){this.syncParser=e.parser.LangiumParser}parse(e,n){return Promise.resolve(this.syncParser.parse(e))}}class dv{constructor(){this.previousTokenSource=new ye.CancellationTokenSource,this.writeQueue=[],this.readQueue=[],this.done=!0}write(e){this.cancelWrite();const n=xT();return this.previousTokenSource=n,this.enqueue(this.writeQueue,e,n.token)}read(e){return this.enqueue(this.readQueue,e)}enqueue(e,n,r=ye.CancellationToken.None){const i=new kl,s={action:n,deferred:i,cancellationToken:r};return e.push(s),this.performNextOperation(),i.promise}async performNextOperation(){if(!this.done)return;const e=[];if(this.writeQueue.length>0)e.push(this.writeQueue.shift());else if(this.readQueue.length>0)e.push(...this.readQueue.splice(0,this.readQueue.length));else return;this.done=!1,await Promise.all(e.map(async({action:n,deferred:r,cancellationToken:i})=>{try{const s=await Promise.resolve().then(()=>n(i));r.resolve(s)}catch(s){Ba(s)?r.resolve(void 0):r.reject(s)}})),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.cancel()}}class fv{constructor(e){this.grammarElementIdMap=new Su,this.tokenTypeIdMap=new Su,this.grammar=e.Grammar,this.lexer=e.parser.Lexer,this.linker=e.references.Linker}dehydrate(e){return{lexerErrors:e.lexerErrors,lexerReport:e.lexerReport?this.dehydrateLexerReport(e.lexerReport):void 0,parserErrors:e.parserErrors.map(n=>({...n,message:n.message})),value:this.dehydrateAstNode(e.value,this.createDehyrationContext(e.value))}}dehydrateLexerReport(e){return e}createDehyrationContext(e){const n=new Map,r=new Map;for(const i of Zt(e))n.set(i,{});if(e. $ cstNode)for(const i of wo(e. $ cstNode))r.set(i,{});return{astNodes:n,cstNodes:r}}dehydrateAstNode(e,n){const r=n.astNodes.get(e);r. $ type=e. $ type,r. $ containerIndex=e. $ containerIndex,r. $ containerProperty=e. $ containerProperty,e. $ cstNode!==void 0&&(r. $ cstNode=this.dehydrateCstNode(e. $ cstNode,n));for(const[i,s]of Object.entries(e))if(!i.startsWith(" $ "))if(Array.isArray(s)){const a=[];r[i]=a;for(const o of s)We(o)?a.push(this.dehydrateAstNode(o,n)):St(o)?a.push(this.dehydrateReference(o,n)):a.push(o)}else We(s)?r[i]=this.dehydrateAstNode(s,n):St(s)?r[i]=this.dehydrateReference(s,n):s!==void 0&&(r[i]=s);return r}dehydrateReference(e,n){const r={};return r. $ refText=e. $ refText,e. $ refNode&&(r. $ refNode=n.cstNodes.get(e. $ refNode)),r}dehydrateCstNode(e,n){const r=n.cstNodes.get(e);return Fd(e)?r.fullText=e.fullText:r.grammarSource=this.getGrammarElementId(e.grammarSource),r.hidden=e.hidden,r.astNode=n.astNodes.get(e.astNode),Bi(e)?r.content=e.content.map(i=>this.dehydrateCstNode(i,n)):Md(e)&&(r.tokenType=e.tokenType.name,r.offset=e.offset,r.length=e.length,r.startLine=e.range.start.line,r.startColumn=e.range.start.character,r.endLine=e.range.end.line,r.endColumn=e.range.end.character),r}hydrate(e){const n=e.value,r=this.createHydrationContext(n);return" $ cstNode"in n&&this.hydrateCstNode(n. $ cstNode,r),{lexerErrors:e.lexerErrors,lexerReport:e.lexerReport,parserErrors:e.par
` )}}}, $ (Cr,"AbstractMermaidValueConverter"),Cr),wr,Va=(wr=class extends Wa{runCustomConverter(e,n,r){}}, $ (wr,"CommonValueConverter"),wr),Nr,Rn=(Nr=class extends th{constructor(e){super(),this.keywords=new Set(e)}buildKeywordTokens(e,n,r){const i=super.buildKeywordTokens(e,n,r);return i.forEach(s=>{this.keywords.has(s.name)&&s.PATTERN!==void 0&&(s.PATTERN=new RegExp(s.PATTERN.toString()+"(?:(?=%%)|(?! \\ S))"))}),i}}, $ (Nr,"AbstractMermaidTokenBuilder"),Nr),br;br=class extends Rn{}, $ (br,"CommonTokenBuilder");var _r,tE=(_r=class extends Rn{constructor(){super(["gitGraph"])}}, $ (_r,"GitGraphTokenBuilder"),_r),Th={parser:{TokenBuilder: $ (()=>new tE,"TokenBuilder"),ValueConverter: $ (()=>new Va,"ValueConverter")}};function Rh(t=Tn){const e=Ve(yn(t),Zn),n=Ve(gn({shared:e}),Wv,Th);return e.ServiceRegistry.register(n),{shared:e,GitGraph:n}} $ (Rh,"createGitGraphServices");var Ir,nE=(Ir=class extends Rn{constructor(){super(["info","showInfo"])}}, $ (Ir,"InfoTokenBuilder"),Ir),vh={parser:{TokenBuilder: $ (()=>new nE,"TokenBuilder"),ValueConverter: $ (()=>new Va,"ValueConverter")}};function Eh(t=Tn){const e=Ve(yn(t),Zn),n=Ve(gn({shared:e}),Vv,vh);return e.ServiceRegistry.register(n),{shared:e,Info:n}} $ (Eh,"createInfoServices");var Pr,rE=(Pr=class extends Rn{constructor(){super(["packet"])}}, $ (Pr,"PacketTokenBuilder"),Pr),Ah={parser:{TokenBuilder: $ (()=>new rE,"TokenBuilder"),ValueConverter: $ (()=>new Va,"ValueConverter")}};function Sh(t=Tn){const e=Ve(yn(t),Zn),n=Ve(gn({shared:e}),Kv,Ah);return e.ServiceRegistry.register(n),{shared:e,Packet:n}} $ (Sh,"createPacketServices");var $ r,iE=( $ r=class extends Rn{constructor(){super(["pie","showData"])}}, $ ( $ r,"PieTokenBuilder"), $ r),Lr,sE=(Lr=class extends Wa{runCustomConverter(e,n,r){if(e.name==="PIE_SECTION_LABEL")return n.replace(/"/g,"").trim()}}, $ (Lr,"PieValueConverter"),Lr),kh={parser:{TokenBuilder: $ (()=>new iE,"TokenBuilder"),ValueConverter: $ (()=>new sE,"ValueConverter")}};function Ch(t=Tn){const e=Ve(yn(t),Zn),n=Ve(gn({shared:e}),Hv,kh);return e.ServiceRegistry.register(n),{shared:e,Pie:n}} $ (Ch,"createPieServices");var Or,aE=(Or=class extends Rn{constructor(){super(["architecture"])}}, $ (Or,"ArchitectureTokenBuilder"),Or),xr,oE=(xr=class extends Wa{runCustomConverter(e,n,r){if(e.name==="ARCH_ICON")return n.replace(/[()]/g,"").trim();if(e.name==="ARCH_TEXT_ICON")return n.replace(/["()]/g,"");if(e.name==="ARCH_TITLE")return n.replace(/[[ \] ]/g,"").trim()}}, $ (xr,"ArchitectureValueConverter"),xr),wh={parser:{TokenBuilder: $ (()=>new aE,"TokenBuilder"),ValueConverter: $ (()=>new oE,"ValueConverter")}};function Nh(t=Tn){const e=Ve(yn(t),Zn),n=Ve(gn({shared:e}),Bv,wh);return e.ServiceRegistry.register(n),{shared:e,Architecture:n}} $ (Nh,"createArchitectureServices");var Dr,cE=(Dr=class extends Rn{constructor(){super(["radar-beta"])}}, $ (Dr,"RadarTokenBuilder"),Dr),bh={parser:{TokenBuilder: $ (()=>new cE,"TokenBuilder"),ValueConverter: $ (()=>new Va,"ValueConverter")}};function _h(t=Tn){const e=Ve(yn(t),Zn),n=Ve(gn({shared:e}),Yv,bh);return e.ServiceRegistry.register(n),{shared:e,Radar:n}} $ (_h,"createRadarServices");var Mr,lE=(Mr=class extends Rn{constructor(){super(["treemap"])}}, $ (Mr,"TreemapTokenBuilder"),Mr),uE=/classDef \s +([A-Z_a-z] \w +)(?: \s +([^ \n \r ;]*))?;?/,Fr,dE=(Fr=class extends Wa{runCustomConverter(e,n,r){if(e.name==="NUMBER2")return parseFloat(n.replace(/,/g,""));if(e.name==="SEPARATOR")return n.substring(1,n.length-1);if(e.name==="STRING2")return n.substring(1,n.length-1);if(e.name==="INDENTATION")return n.length;if(e.name==="ClassDef"){if(typeof n!="string")return n;const i=uE.exec(n);if(i)return{ $ type:"ClassDefStatement",className:i[1],styleText:i[2]||void 0}}}}, $ (Fr,"TreemapValueConverter"),Fr);function Ih(t){const e=t.validation.TreemapValidator,n=t.validation.ValidationRegistry;if(n){const r={Treemap:e.checkSingleRoot.bind(e)};n.register(r,e)}} $ (Ih,"registerValidationChecks");var Gr,fE=(Gr=class{checkSingleRoot(e,n){let r;for(const i of e.TreemapRows)i.item&&(r===void 0&&i.indent===void 0?r=0:i.indent===void 0?n("error","Multiple root nodes are not allowed in a treemap.",{node:i,property:"item"}):r!==void
` ),r=e.parserErrors.map(i=>i.message).join( `
` );super( ` Parsing failed : $ { n } $ { r } ` ),this.result=e}}, $ (Ur,"MermaidParseError"),Ur);const gE=Object.freeze(Object.defineProperty({__proto__:null,InfoModule:vh,createInfoServices:Eh},Symbol.toStringTag,{value:"Module"})),yE=Object.freeze(Object.defineProperty({__proto__:null,PacketModule:Ah,createPacketServices:Sh},Symbol.toStringTag,{value:"Module"})),TE=Object.freeze(Object.defineProperty({__proto__:null,PieModule:kh,createPieServices:Ch},Symbol.toStringTag,{value:"Module"})),RE=Object.freeze(Object.defineProperty({__proto__:null,ArchitectureModule:wh,createArchitectureServices:Nh},Symbol.toStringTag,{value:"Module"})),vE=Object.freeze(Object.defineProperty({__proto__:null,GitGraphModule:Th,createGitGraphServices:Rh},Symbol.toStringTag,{value:"Module"})),EE=Object.freeze(Object.defineProperty({__proto__:null,RadarModule:bh,createRadarServices:_h},Symbol.toStringTag,{value:"Module"})),AE=Object.freeze(Object.defineProperty({__proto__:null,TreemapModule:Ph,createTreemapServices: $ h},Symbol.toStringTag,{value:"Module"}));export{pE as p};