Files
static-php-cli/assets/chunks/wardley-RL74JXVD.BA-8CGC6.js

163 lines
481 KiB
JavaScript
Raw Normal View History

import{W as St}from"./framework.C2AwuPrQ.js";import{m as Gt,f as $h,d as Eh}from"./min.CT2il0xb.js";import{b as Ah,l as Ch,d as Sh,m as wh,r as vc,n as Ls}from"./baseUniq.CeiE9d8M.js";import{bb as kh,bE as bh}from"./mermaid.core.FcP8wBwW.js";function Nh(t,e){return Ah(Gt(t,e))}function _h(t,e){return t&&t.length?Ch(t,Sh(e)):[]}function Fe(t){return typeof t=="object"&&t!==null&&typeof t.$type=="string"}function ut(t){return typeof t=="object"&&t!==null&&typeof t.$refText=="string"&&"ref"in t}function Qt(t){return typeof t=="object"&&t!==null&&typeof t.$refText=="string"&&"items"in t}function Ih(t){return typeof t=="object"&&t!==null&&typeof t.name=="string"&&typeof t.type=="string"&&typeof t.path=="string"}function Jn(t){return typeof t=="object"&&t!==null&&typeof t.info=="object"&&typeof t.message=="string"}class Ef{constructor(){this.subtypes={},this.allSubtypes={}}getAllTypes(){return Object.keys(this.types)}getReferenceType(e){const r=this.types[e.container.$type];if(!r)throw new Error(`Type ${e.container.$type||"undefined"} not found.`);const n=r.properties[e.property]?.referenceType;if(!n)throw new Error(`Property ${e.property||"undefined"} of type ${e.container.$type} is not a reference.`);return n}getTypeMetaData(e){const r=this.types[e];return r||{name:e,properties:{},superTypes:[]}}isInstance(e,r){return Fe(e)&&this.isSubtype(e.$type,r)}isSubtype(e,r){if(e===r)return!0;let n=this.subtypes[e];n||(n=this.subtypes[e]={});const i=n[r];if(i!==void 0)return i;{const a=this.types[e],s=a?a.superTypes.some(o=>this.isSubtype(o,r)):!1;return n[r]=s,s}}getAllSubTypes(e){const r=this.allSubtypes[e];if(r)return r;{const n=this.getAllTypes(),i=[];for(const a of n)this.isSubtype(a,e)&&i.push(a);return this.allSubtypes[e]=i,i}}}function Ii(t){return typeof t=="object"&&t!==null&&Array.isArray(t.content)}function Af(t){return typeof t=="object"&&t!==null&&typeof t.tokenType=="object"}function Cf(t){return Ii(t)&&typeof t.fullText=="string"}class xe{constructor(e,r){this.startFn=e,this.nextFn=r}iterator(){const e={state:this.startFn(),next:()=>this.nextFn(e.state),[Symbol.iterator]:()=>e};return e}[Symbol.iterator](){return this.iterator()}isEmpty(){return!!this.iterator().next().done}count(){const e=this.iterator();let r=0,n=e.next();for(;!n.done;)r++,n=e.next();return r}toArray(){const e=[],r=this.iterator();let n;do n=r.next(),n.value!==void 0&&e.push(n.value);while(!n.done);return e}toSet(){return new Set(this)}toMap(e,r){const n=this.map(i=>[e?e(i):i,r?r(i):i]);return new Map(n)}toString(){return this.join()}concat(e){return new xe(()=>({first:this.startFn(),firstDone:!1,iterator:e[Symbol.iterator]()}),r=>{let n;if(!r.firstDone){do if(n=this.nextFn(r.first),!n.done)return n;while(!n.done);r.firstDone=!0}do if(n=r.iterator.next(),!n.done)return n;while(!n.done);return Ze})}join(e=","){const r=this.iterator();let n="",i,a=!1;do i=r.next(),i.done||(a&&(n+=e),n+=Ph(i.value)),a=!0;while(!i.done);return n}indexOf(e,r=0){const n=this.iterator();let i=0,a=n.next();for(;!a.done;){if(i>=r&&a.value===e)return i;a=n.next(),i++}return-1}every(e){const r=this.iterator();let n=r.next();for(;!n.done;){if(!e(n.value))return!1;n=r.next()}return!0}some(e){const r=this.iterator();let n=r.next();for(;!n.done;){if(e(n.value))return!0;n=r.next()}return!1}forEach(e){const r=this.iterator();let n=0,i=r.next();for(;!i.done;)e(i.value,n),i=r.next(),n++}map(e){return new xe(this.startFn,r=>{const{done:n,value:i}=this.nextFn(r);return n?Ze:{done:!1,value:e(i)}})}filter(e){return new xe(this.startFn,r=>{let n;do if(n=this.nextFn(r),!n.done&&e(n.value))return n;while(!n.done);return Ze})}nonNullable(){return this.filter(e=>e!=null)}reduce(e,r){const n=this.iterator();let i=r,a=n.next();for(;!a.done;)i===void 0?i=a.value:i=e(i,a.value),a=n.next();return i}reduceRight(e,r){return this.recursiveReduce(this.iterator(),e,r)}recursiveReduce(e,r,n){const i=e.next();if(i.done)return n;const a=this.recursiveReduce(e,r,n);return a===void 0?i.value:r(a,i.value)}find(e){const r=this.iterator();let n=r.next();for(;!n.done;){if(e(n.value))return n.value;n=r.next()}}fi
`),U("\r"),U(" "),U("\v"),U(" "),U(" "),U(""),U(" "),U(""),U(""),U(""),U(""),U(""),U(""),U(""),U(""),U(""),U(""),U("\u2028"),U("\u2029"),U(""),U(""),U(" "),U("\uFEFF")],sp=/[0-9a-fA-F]/,Ta=/[0-9]/,op=/[1-9]/;class Pf{constructor(){this.idx=0,this.input="",this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar("/");const r=this.disjunction();this.consumeChar("/");const n={type:"Flags",loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":ti(n,"global");break;case"i":ti(n,"ignoreCase");break;case"m":ti(n,"multiLine");break;case"u":ti(n,"unicode");break;case"y":ti(n,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:n,value:r,loc:this.loc(0)}}disjunction(){const e=[],r=this.idx;for(e.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(r)}}alternative(){const e=[],r=this.idx;for(;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(r)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){const e=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(e)};case"$":return{type:"EndAnchor",loc:this.loc(e)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(e)};case"B":return{type:"NonWordBoundary",loc:this.loc(e)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");let r;switch(this.popChar()){case"=":r="Lookahead";break;case"!":r="NegativeLookahead";break;case"<":{switch(this.popChar()){case"=":r="Lookbehind";break;case"!":r="NegativeLookbehind"}break}}Fr(r);const n=this.disjunction();return this.consumeChar(")"),{type:r,value:n,loc:this.loc(e)}}return ap()}quantifier(e=!1){let r;const n=this.idx;switch(this.popChar()){case"*":r={atLeast:0,atMost:1/0};break;case"+":r={atLeast:1,atMost:1/0};break;case"?":r={atLeast:0,atMost:1};break;case"{":const i=this.integerIncludingZero();switch(this.popChar()){case"}":r={atLeast:i,atMost:i};break;case",":let a;this.isDigit()?(a=this.integerIncludingZero(),r={atLeast:i,atMost:a}):r={atLeast:i,atMost:1/0},this.consumeChar("}");break}if(e===!0&&r===void 0)return;Fr(r);break}if(!(e===!0&&r===void 0)&&Fr(r))return this.peekChar(0)==="?"?(this.consumeChar("?"),r.greedy=!1):r.greedy=!0,r.type="Quantifier",r.loc=this.loc(n),r}atom(){let e;const r=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group();break}if(e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),Fr(e))return e.loc=this.loc(r),this.isQuantifier()&&(e.quantifier=this.quantifier()),e}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[U(`
`),U("\r"),U("\u2028"),U("\u2029")]}}atomEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:"GroupBackReference",value:this.positiveInteger()}}characterClassEscape(){let e,r=!1;switch(this.popChar()){case"d":e=ts;break;case"D":e=ts,r=!0;break;case"s":e=Pc;break;case"S":e=Pc,r=!0;break;case"w":e=rs;break;case"W":e=rs,r=!0;break}if(Fr(e))return{type:"Set",value:e,complement:r}}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=U("\f");break;case"n":e=U(`
`);break;case"r":e=U("\r");break;case"t":e=U(" ");break;case"v":e=U("\v");break}if(Fr(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:U("\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:U(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case`
`:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:const e=this.popChar();return{type:"Character",value:U(e)}}}characterClass(){const e=[];let r=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),r=!0);this.isClassAtom();){const n=this.classAtom();if(n.type,Ic(n)&&this.isRangeDash()){this.consumeChar("-");const i=this.classAtom();if(i.type,Ic(i)){if(i.value<n.value)throw Error("Range out of order in character class");e.push({from:n.value,to:i.value})}else Ms(n.value,e),e.push(U("-")),Ms(i.value,e)}else Ms(n.value,e)}return this.consumeChar("]"),{type:"Set",complement:r,value:e}}classAtom(){switch(this.peekChar()){case"]":case`
`:case"\r":case"\u2028":case"\u2029":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:U("\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;switch(this.consumeChar("("),this.peekChar(0)){case"?":this.consumeChar("?"),this.consumeChar(":"),e=!1;break;default:this.groupIdx++;break}const r=this.disjunction();this.consumeChar(")");const n={type:"Group",capturing:e,value:r};return e&&(n.idx=this.groupIdx),n}positiveInteger(){let e=this.popChar();if(op.test(e)===!1)throw Error("Expecting a positive integer");for(;Ta.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(Ta.test(e)===!1)throw Error("Expecting an integer");for(;Ta.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){const e=this.popChar();switch(e){case`
`:case"\r":case"\u2028":case"\u2029":case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":throw Error("TBD");default:return{type:"Character",value:U(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 Ta.test(this.peekChar(0))}isClassAtom(e=0){switch(this.peekChar(e)){case"]":case`
`:case"\r":case"\u2028":case"\u2029":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"\u2028":case"\u2029":return!1;default:return!0}}parseHexDigits(e){let r="";for(let i=0;i<e;i++){const a=this.popChar();if(sp.test(a)===!1)throw Error("Expecting a HexDecimal digits");r+=a}return{type:"Character",value:parseInt(r,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 Es{visitChildren(e){for(const r in e){const n=e[r];e.hasOwnProperty(r)&&(n.type!==void 0?this.visit(n):Array.isArray(n)&&n.forEach(i=>{this.visit(i)},this))}}visit(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"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 lp=/\r?\n/gm,cp=new Pf;class up extends Es{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 r=String.fromCharCode(e.value);if(!this.multiline&&r===`
`&&(this.multiline=!0),e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{const n=As(r);this.endRegexpStack.push(n),this.isStarting&&(this.startRegexp+=n)}}visitSet(e){if(!this.multiline){const r=this.regex.substring(e.loc.begin,e.loc.end),n=new RegExp(r);this.multiline=!!`
`.match(n)}if(e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{const r=this.regex.substring(e.loc.begin,e.loc.end);this.endRegexpStack.push(r),this.isStarting&&(this.startRegexp+=r)}}visitChildren(e){e.type==="Group"&&e.quantifier||super.visitChildren(e)}}const Fs=new up;function fp(t){try{return typeof t=="string"&&(t=new RegExp(t)),t=t.toString(),Fs.reset(t),Fs.visit(cp.pattern(t)),Fs.multiline}catch{return!1}}const dp=`\f
\r \v   \u2028\u2029 \uFEFF`.split("");function Of(t){const e=typeof t=="string"?new RegExp(t):t;return dp.some(r=>e.test(r))}function As(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function hp(t,e){const r=pp(t),n=e.match(r);return!!n&&n[0].length>0}function pp(t){typeof t=="string"&&(t=new RegExp(t));const e=t,r=t.source;let n=0;function i(){let a="",s;function o(c){a+=r.substr(n,c),n+=c}function l(c){a+="(?:"+r.substr(n,c)+"|$)",n+=c}for(;n<r.length;)switch(r[n]){case"\\":switch(r[n+1]){case"c":l(3);break;case"x":l(4);break;case"u":e.unicode?r[n+2]==="{"?l(r.indexOf("}",n)-n+1):l(6):l(2);break;case"p":case"P":e.unicode?l(r.indexOf("}",n)-n+1):l(2);break;case"k":l(r.indexOf(">",n)-n+1);break;default:l(2);break}break;case"[":s=/\[(?:\\.|.)*?\]/g,s.lastIndex=n,s=s.exec(r)||[],l(s[0].length);break;case"|":case"^":case"$":case"*":case"+":case"?":o(1);break;case"{":s=/\{\d+,?\d*\}/g,s.lastIndex=n,s=s.exec(r),s?o(s[0].length):l(1);break;case"(":if(r[n+1]==="?")switch(r[n+2]){case":":a+="(?:",n+=3,a+=i()+"|$)";break;case"=":a+="(?=",n+=3,a+=i()+")";break;case"!":s=n,n+=3,i(),a+=r.substr(s,n-s);break;case"<":switch(r[n+3]){case"=":case"!":s=n,n+=4,i(),a+=r.substr(s,n-s);break;default:o(r.indexOf(">",n)-n+1),a+=i()+"|$)";break}break}else o(1),a+=i()+"|$)";break;case")":return++n,a;default:l(1);break}return a}return new RegExp(i(),t.flags)}function mp(t){return t.rules.find(e=>Wt(e)&&e.entry)}function gp(t){return t.rules.filter(e=>Vt(e)&&e.hidden)}function Lf(t,e){const r=new Set,n=mp(t);if(!n)return new Set(t.rules);const i=[n].concat(gp(t));for(const s of i)xf(s,r,e);const a=new Set;for(const s of t.rules)(r.has(s.name)||Vt(s)&&s.hidden)&&a.add(s);return a}function xf(t,e,r){e.add(t.name),qi(t).forEach(n=>{if(Nr(n)||r){const i=n.rule.ref;i&&!e.has(i.name)&&xf(i,e,r)}})}function yp(t){if(t.terminal)return t.terminal;if(t.type.ref)return Mf(t.type.ref)?.terminal}function Tp(t){return t.hidden&&!Of(ec(t))}function Rp(t,e){return!t||!e?[]:Ql(t,e,t.astNode,!0)}function Df(t,e,r){if(!t||!e)return;const n=Ql(t,e,t.astNode,!0);if(n.length!==0)return r!==void 0?r=Math.max(0,Math.min(r,n.length-1)):r=0,n[r]}function Ql(t,e,r,n){if(!n){const i=Rs(t.grammarSource,kr);if(i&&i.feature===e)return[t]}return Ii(t)&&t.astNode===r?t.content.flatMap(i=>Ql(i,e,r,!1)):[]}function vp(t,e,r){if(!t)return;const n=$p(t,e,t?.astNode);if(n.length!==0)return r!==void 0?r=Math.max(0,Math.min(r,n.length-1)):r=0,n[r]}function $p(t,e,r){if(t.astNode!==r)return[];if(br(t.grammarSource)&&t.grammarSource.value===e)return[t];const n=Ro(t).iterator();let i;const a=[];do if(i=n.next(),!i.done){const s=i.value;s.astNode===r?br(s.grammarSource)&&s.grammarSource.value===e&&a.push(s):n.prune()}while(!i.done);return a}function Ep(t){const e=t.astNode;for(;e===t.container?.astNode;){const r=Rs(t.grammarSource,kr);if(r)return r;t=t.container}}function Mf(t){let e=t;return bf(e)&&(vs(e.$container)?e=e.$container.$container:Bi(e.$container)?e=e.$container:Wi(e.$container)),Ff(t,e,new Map)}function Ff(t,e,r){function n(i,a){let s;return Rs(i,kr)||(s=Ff(a,a,r)),r.set(t,s),s}if(r.has(t))return r.get(t);r.set(t,void 0);for(const i of qi(e)){if(kr(i)&&i.feature.toLowerCase()==="name")return r.set(t,i),i;if(Nr(i)&&Wt(i.rule.ref))return n(i,i.rule.ref);if(Vh(i)&&i.typeRef?.ref)return n(i,i.typeRef.ref)}}function Gf(t){return jf(t,new Set)}function jf(t,e){if(e.has(t))return!0;e.add(t);for(const r of qi(t))if(Nr(r)){if(!r.rule.ref||Wt(r.rule.ref)&&!jf(r.rule.ref,e)||Qa(r.rule.ref))return!1}else{if(kr(r))return!1;if(vs(r))return!1}return!!t.definition}function zf(t){if(!Vt(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 Pi(t){if(Bi(t))return Wt(t)&&Gf(t)?t.name:zf(t)??t.name;if(jh(t)||Yh(t)||Wh(t))return t.name;if(vs(t)){const e=Ap(t);if(e)return e}else if(bf(t))return t.name;throw new Error("Cannot get name of Unknown Type")}function Ap(t){if(t.inferredType)return t.inferredType.name;if(t.type?.ref)return Pi(t.type.ref)}functio
`;function Bp(t,e=!1){try{const r=Ss(t);return Eo(r.value,{},r.flags.ignoreCase)}catch(r){if(r.message===Vf)e&&Uf(`${is} Unable to optimize: < ${t.toString()} >
Complement Sets cannot be automatically optimized.
This will disable the lexer's first char optimizations.
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let n="";e&&(n=`
This will disable the lexer's first char optimizations.
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),$o(`${is}
Failed parsing: < ${t.toString()} >
Using the @chevrotain/regexp-to-ast library
Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+n)}}return[]}function Eo(t,e,r){switch(t.type){case"Disjunction":for(let i=0;i<t.value.length;i++)Eo(t.value[i],e,r);break;case"Alternative":const n=t.value;for(let i=0;i<n.length;i++){const a=n[i];switch(a.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"Lookbehind":case"NegativeLookbehind":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}const s=a;switch(s.type){case"Character":Ra(s.value,e,r);break;case"Set":if(s.complement===!0)throw Error(Vf);s.value.forEach(l=>{if(typeof l=="number")Ra(l,e,r);else{const c=l;if(r===!0)for(let u=c.from;u<=c.to;u++)Ra(u,e,r);else{for(let u=c.from;u<=c.to&&u<wi;u++)Ra(u,e,r);if(c.to>=wi){const u=c.from>=wi?c.from:wi,d=c.to,g=er(u),p=er(d);for(let $=g;$<=p;$++)e[$]=$}}}});break;case"Group":Eo(s.value,e,r);break;default:throw Error("Non Exhaustive Match")}const o=s.quantifier!==void 0&&s.quantifier.atLeast===0;if(s.type==="Group"&&Ao(s)===!1||s.type!=="Group"&&o===!1)break}break;default:throw Error("non exhaustive match!")}return Object.values(e)}function Ra(t,e,r){const n=er(t);e[n]=n,r===!0&&Wp(t,e)}function Wp(t,e){const r=String.fromCharCode(t),n=r.toUpperCase();if(n!==r){const i=er(n.charCodeAt(0));e[i]=i}else{const i=r.toLowerCase();if(i!==r){const a=er(i.charCodeAt(0));e[a]=a}}}function Lc(t,e){return t.value.find(r=>{if(typeof r=="number")return e.includes(r);{const n=r;return e.find(i=>n.from<=i&&i<=n.to)!==void 0}})}function Ao(t){const e=t.quantifier;return e&&e.atLeast===0?!0:t.value?Array.isArray(t.value)?t.value.every(Ao):Ao(t.value):!1}class Vp extends Es{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){this.targetCharCodes.includes(e.value)&&(this.found=!0)}visitSet(e){e.complement?Lc(e,this.targetCharCodes)===void 0&&(this.found=!0):Lc(e,this.targetCharCodes)!==void 0&&(this.found=!0)}}function rc(t,e){if(e instanceof RegExp){const r=Ss(e),n=new Vp(t);return n.visit(r),n.found}else{for(const r of e){const n=r.charCodeAt(0);if(t.includes(n))return!0}return!1}}const _r="PATTERN",Si="defaultMode",va="modes";function Kp(t,e){e=Object.assign({safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
`],tracer:(A,w)=>w()},e);const r=e.tracer;r("initCharCodeToOptimizedIndexMap",()=>{ym()});let n;r("Reject Lexer.NA",()=>{n=t.filter(A=>A[_r]!==We.NA)});let i=!1,a;r("Transform Patterns",()=>{i=!1,a=n.map(A=>{const w=A[_r];if(w instanceof RegExp){const P=w.source;return P.length===1&&P!=="^"&&P!=="$"&&P!=="."&&!w.ignoreCase?P:P.length===2&&P[0]==="\\"&&!["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"].includes(P[1])?P[1]:xc(w)}else{if(typeof w=="function")return i=!0,{exec:w};if(typeof w=="object")return i=!0,w;if(typeof w=="string"){if(w.length===1)return w;{const P=w.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),W=new RegExp(P);return xc(W)}}else throw Error("non exhaustive match")}})});let s,o,l,c,u;r("misc mapping",()=>{s=n.map(A=>A.tokenTypeIdx),o=n.map(A=>{const w=A.GROUP;if(w!==We.SKIPPED){if(typeof w=="string")return w;if(w===void 0)return!1;throw Error("non exhaustive match")}}),l=n.map(A=>{const w=A.LONGER_ALT;if(w)return Array.isArray(w)?w.map(W=>n.indexOf(W)):[n.indexOf(w)]}),c=n.map(A=>A.PUSH_MODE),u=n.map(A=>Object.hasOwn(A,"POP_MODE"))});let d;r("Line Terminator Handling",()=>{const A=Xf(e.lineTerminatorCharacters);d=n.map(w=>!1),e.positionTracking!=="onlyOffset"&&(d=n.map(w=>Object.hasOwn(w,"LINE_BREAKS")?!!w.LINE_BREAKS:Hf(w,A)===!1&&rc(A,w.PATTERN)))});let g,p,$,_;r("Misc Mapping #2",()=>{g=n.map(Kf),p=a.map(pm),$=n.reduce((A,w)=>{const P=w.GROUP;return typeof P=="string"&&P!==We.SKIPPED&&(A[P]=[]),A},{}),_=a.map((A,w)=>({pattern:a[w],longerAlt:l[w],canLineTerminator:d[w],isCustom:g[w],short:p[w],group:o[w],push:c[w],pop:u[w],tokenTypeIdx:s[w],tokenType:n[w]}))});let I=!0,C=[];return e.safeMode||r("First Char Optimization",()=>{C=n.reduce((A,w,P)=>{if(typeof w.PATTERN=="string"){const W=w.PATTERN.charCodeAt(0),B=er(W);js(A,B,_[P])}else if(Array.isArray(w.START_CHARS_HINT)){let W;w.START_CHARS_HINT.forEach(B=>{const H=typeof B=="string"?B.charCodeAt(0):B,ne=er(H);W!==ne&&(W=ne,js(A,ne,_[P]))})}else if(w.PATTERN instanceof RegExp)if(w.PATTERN.unicode)I=!1,e.ensureOptimizations&&$o(`${is} Unable to analyze < ${w.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 W=Bp(w.PATTERN,e.ensureOptimizations);W.length===0&&(I=!1),W.forEach(B=>{js(A,B,_[P])})}else e.ensureOptimizations&&$o(`${is} TokenType: <${w.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 A},[])}),{emptyGroups:$,patternIdxToConfig:_,charCodeToPatternIdxToConfig:C,hasCustom:i,canBeOptimized:I}}function Hp(t,e){let r=[];const n=Yp(t);r=r.concat(n.errors);const i=Jp(n.valid),a=i.valid;return r=r.concat(i.errors),r=r.concat(Xp(a)),r=r.concat(am(a)),r=r.concat(sm(a,e)),r=r.concat(om(a)),r}function Xp(t){let e=[];const r=t.filter(n=>n[_r]instanceof RegExp);return e=e.concat(Qp(r)),e=e.concat(rm(r)),e=e.concat(nm(r)),e=e.concat(im(r)),e=e.concat(em(r)),e}function Yp(t){const e=t.filter(i=>!Object.hasOwn(i,_r)),r=e.map(i=>({message:"Token Type: ->"+i.name+"<- missing static 'PATTERN' property",type:Re.MISSING_PATTERN,tokenTypes:[i]})),n=t.filter(i=>!e.includes(i));return{errors:r,valid:n}}function Jp(t){const e=t.filter(i=>{const a=i[_r];return!(a instanceof RegExp)&&typeof a!="function"&&!Object.hasOwn(a,"exec")&&typeof a!="string"}),r=e.map(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:Re.INVALID_PATTERN,tokenTypes:[i]})),n=t.filter(i=>!e.includes(i));return{errors:r,valid:n}}const Zp=/[^\\][$]/;function Qp(t){class e extends Es{constructor(){super(...arguments),this.found=!1}visitEndAnchor(a){this.found=!0}}return t.filter(i=>{const a=i.PATTERN;try{const s=Ss(a),o=new e;return o.visit(s),o.found}catch{return Zp.test(a.source)}}).map(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:Re.EOI_ANCHOR_FOUND,tokenTypes:[i]}))}function em(t){return t.filter(n=>n.PATTERN.test("")).map(n=>({message:"Token Type: ->"+n.name+"<- static 'PATTERN' must not match an empty string",type:Re.EMPTY_MATCH_PATTERN,tokenTypes:[n]}))}const tm=/[^\\[][\^]|^\^/;function rm(t){class e extends Es{constructor(){super(...arguments),this.found=!1}visitStartAnchor(a){this.found=!0}}return t.filter(i=>{const a=i.PATTERN;try{const s=Ss(a),o=new e;return o.visit(s),o.found}catch{return tm.test(a.source)}}).map(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:Re.SOI_ANCHOR_FOUND,tokenTypes:[i]}))}function nm(t){return t.filter(n=>{const i=n[_r];return i instanceof RegExp&&(i.multiline||i.global)}).map(n=>({message:"Token Type: ->"+n.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:Re.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[n]}))}function im(t){const e=[];let r=t.map(a=>t.reduce((s,o)=>(a.PATTERN.source===o.PATTERN.source&&!e.includes(o)&&o.PATTERN!==We.NA&&(e.push(o),s.push(o)),s),[]));return r=r.filter(Boolean),r.filter(a=>a.length>1).map(a=>{const s=a.map(l=>l.name);return{message:`The same RegExp pattern ->${a[0].PATTERN}<-has been used in all of the following Token Types: ${s.join(", ")} <-`,type:Re.DUPLICATE_PATTERNS_FOUND,tokenTypes:a}})}function am(t){return t.filter(n=>{if(!Object.hasOwn(n,"GROUP"))return!1;const i=n.GROUP;return i!==We.SKIPPED&&i!==We.NA&&typeof i!="string"}).map(n=>({message:"Token Type: ->"+n.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:Re.INVALID_GROUP_TYPE_FOUND,tokenTypes:[n]}))}function sm(t,e){return t.filter(i=>i.PUSH_MODE!==void 0&&!e.includes(i.PUSH_MODE)).map(i=>({message:`Token Type: ->${i.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${i.PUSH_MODE}<-which does not exist`,type:Re.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[i]}))}function om(t){const e=[],r=t.reduce((n,i,a)=>{const s=i.PATTERN;return s===We.NA||(typeof s=="string"?n.push({str:s,idx:a,tokenType:i}):s instanceof RegExp&&cm(s)&&n.push({str:s.source,idx:a,tokenType:i})),n},[]);return t.forEach((n,i)=>{r.forEach(({str:a,idx:s,tokenType:o})=>{if(i<s&&lm(a,n.PATTERN)){const l=`Token: ->${o.name}<- can never be matched.
Because it appears AFTER the Token Type ->${n.name}<-in the lexer's definition.
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:l,type:Re.UNREACHABLE_PATTERN,tokenTypes:[n,o]})}})}),e}function lm(t,e){if(e instanceof RegExp){if(um(e))return!1;const r=e.exec(t);return r!==null&&r.index===0}else{if(typeof e=="function")return e(t,0,[],{});if(Object.hasOwn(e,"exec"))return e.exec(t,0,[],{});if(typeof e=="string")return e===t;throw Error("non exhaustive match")}}function cm(t){return[".","\\","[","]","|","^","$","(",")","?","*","+","{"].find(r=>t.source.indexOf(r)!==-1)===void 0}function um(t){return/(\(\?=)|(\(\?!)|(\(\?<=)|(\(\?<!)/.test(t.source)}function xc(t){const e=t.ignoreCase?"iy":"y";return new RegExp(`${t.source}`,e)}function fm(t,e,r){const n=[];return Object.hasOwn(t,Si)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+Si+`> property in its definition
`,type:Re.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),Object.hasOwn(t,va)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+va+`> property in its definition
`,type:Re.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),Object.hasOwn(t,va)&&Object.hasOwn(t,Si)&&!Object.hasOwn(t.modes,t.defaultMode)&&n.push({message:`A MultiMode Lexer cannot be initialized with a ${Si}: <${t.defaultMode}>which does not exist
`,type:Re.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),Object.hasOwn(t,va)&&Object.keys(t.modes).forEach(i=>{const a=t.modes[i];a.forEach((s,o)=>{s===void 0?n.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${i}> at index: <${o}>
`,type:Re.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED}):Object.hasOwn(s,"LONGER_ALT")&&(Array.isArray(s.LONGER_ALT)?s.LONGER_ALT:[s.LONGER_ALT]).forEach(c=>{c!==void 0&&!a.includes(c)&&n.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${c.name}> on token <${s.name}> outside of mode <${i}>
`,type:Re.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})})}),n}function dm(t,e,r){const n=[];let i=!1;const s=Object.values(t.modes||{}).flat().filter(Boolean).filter(l=>l[_r]!==We.NA),o=Xf(r);return e&&s.forEach(l=>{const c=Hf(l,o);if(c!==!1){const d={message:gm(l,c),type:c.issue,tokenType:l};n.push(d)}else Object.hasOwn(l,"LINE_BREAKS")?l.LINE_BREAKS===!0&&(i=!0):rc(o,l.PATTERN)&&(i=!0)}),e&&!i&&n.push({message:`Warning: No LINE_BREAKS Found.
This Lexer has been defined to track line and column information,
But none of the Token Types can be identified as matching a line terminator.
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
for details.`,type:Re.NO_LINE_BREAKS_FLAGS}),n}function hm(t){const e={};return Object.keys(t).forEach(n=>{const i=t[n];if(Array.isArray(i))e[n]=[];else throw Error("non exhaustive match")}),e}function Kf(t){const e=t.PATTERN;if(e instanceof RegExp)return!1;if(typeof e=="function")return!0;if(Object.hasOwn(e,"exec"))return!0;if(typeof e=="string")return!1;throw Error("non exhaustive match")}function pm(t){return typeof t=="string"&&t.length===1?t.charCodeAt(0):!1}const mm={test:function(t){const e=t.length;for(let r=this.lastIndex;r<e;r++){const n=t.charCodeAt(r);if(n===10)return this.lastIndex=r+1,!0;if(n===13)return t.charCodeAt(r+1)===10?this.lastIndex=r+2:this.lastIndex=r+1,!0}return!1},lastIndex:0};function Hf(t,e){if(Object.hasOwn(t,"LINE_BREAKS"))return!1;if(t.PATTERN instanceof RegExp){try{rc(e,t.PATTERN)}catch(r){return{issue:Re.IDENTIFY_TERMINATOR,errMsg:r.message}}return!1}else{if(typeof t.PATTERN=="string")return!1;if(Kf(t))return{issue:Re.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function gm(t,e){if(e.issue===Re.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===Re.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 Xf(t){return t.map(r=>typeof r=="string"?r.charCodeAt(0):r)}function js(t,e,r){t[e]===void 0?t[e]=[r]:t[e].push(r)}const wi=256;let Wa=[];function er(t){return t<wi?t:Wa[t]}function ym(){if(Wa.length===0){Wa=new Array(65536);for(let t=0;t<65536;t++)Wa[t]=t>255?255+~~(t/255):t}}function Ki(t,e){const r=t.tokenTypeIdx;return r===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[r]===!0}function as(t,e){return t.tokenTypeIdx===e.tokenTypeIdx}let Dc=1;const Yf={};function Hi(t){const e=Tm(t);Rm(e),$m(e),vm(e),e.forEach(r=>{r.isParent=r.categoryMatches.length>0})}function Tm(t){let e=[...t],r=t,n=!0;for(;n;){r=r.map(a=>a.CATEGORIES).flat().filter(Boolean);const i=r.filter(a=>!e.includes(a));e=e.concat(i),i.length===0?n=!1:r=i}return e}function Rm(t){t.forEach(e=>{Zf(e)||(Yf[Dc]=e,e.tokenTypeIdx=Dc++),Mc(e)&&!Array.isArray(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),Mc(e)||(e.CATEGORIES=[]),Em(e)||(e.categoryMatches=[]),Am(e)||(e.categoryMatchesMap={})})}function vm(t){t.forEach(e=>{e.categoryMatches=[],Object.keys(e.categoryMatchesMap).forEach(r=>{e.categoryMatches.push(Yf[r].tokenTypeIdx)})})}function $m(t){t.forEach(e=>{Jf([],e)})}function Jf(t,e){t.forEach(r=>{e.categoryMatchesMap[r.tokenTypeIdx]=!0}),e.CATEGORIES.forEach(r=>{const n=t.concat(e);n.includes(r)||Jf(n,r)})}function Zf(t){return Object.hasOwn(t??{},"tokenTypeIdx")}function Mc(t){return Object.hasOwn(t??{},"CATEGORIES")}function Em(t){return Object.hasOwn(t??{},"categoryMatches")}function Am(t){return Object.hasOwn(t??{},"categoryMatchesMap")}function Cm(t){return Object.hasOwn(t??{},"tokenTypeIdx")}const Co={buildUnableToPopLexerModeMessage(t){return`Unable to pop Lexer Mode after encountering Token ->${t.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(t,e,r,n,i,a){return`unexpected character: ->${t.charAt(e)}<- at offset: ${e}, skipped ${r} characters.`}};var Re;(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"})(Re||(Re={}));const ki={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:Co,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(ki);class We{constructor(e,r=ki){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,a)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;const s=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${s}--> <${i}>`);const{time:o,value:l}=qf(a),c=o>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&c(`${s}<-- <${i}> time: ${o}ms`),this.traceInitIndent--,l}else return a()},typeof r=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
a boolean 2nd argument is no longer supported`);this.config=Object.assign({},ki,r);const n=this.config.traceInitPerf;n===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof n=="number"&&(this.traceInitMaxIdent=n,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let i,a=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===ki.lineTerminatorsPattern)this.config.lineTerminatorsPattern=mm;else if(this.config.lineTerminatorCharacters===ki.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(r.safeMode&&r.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');this.trackStartLines=/full|onlyStart/i.test(this.config.positionTracking),this.trackEndLines=/full/i.test(this.config.positionTracking),Array.isArray(e)?i={modes:{defaultMode:[...e]},defaultMode:Si}:(a=!1,i=Object.assign({},e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(fm(i,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(dm(i,this.trackStartLines,this.config.lineTerminatorCharacters))})),i.modes=i.modes?i.modes:{},Object.entries(i.modes).forEach(([o,l])=>{i.modes[o]=l.filter(c=>c!==void 0)});const s=Object.keys(i.modes);if(Object.entries(i.modes).forEach(([o,l])=>{this.TRACE_INIT(`Mode: <${o}> processing`,()=>{if(this.modes.push(o),this.config.skipValidations===!1&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(Hp(l,s))}),this.lexerDefinitionErrors.length===0){Hi(l);let c;this.TRACE_INIT("analyzeTokenTypes",()=>{c=Kp(l,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:r.positionTracking,ensureOptimizations:r.ensureOptimizations,safeMode:r.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[o]=c.patternIdxToConfig,this.charCodeToPatternIdxToConfig[o]=c.charCodeToPatternIdxToConfig,this.emptyGroups=Object.assign({},this.emptyGroups,c.emptyGroups),this.hasCustom=c.hasCustom||this.hasCustom,this.canModeBeOptimized[o]=c.canBeOptimized}})}),this.defaultMode=i.defaultMode,this.lexerDefinitionErrors.length>0&&!this.config.deferDefinitionErrorsHandling){const l=this.lexerDefinitionErrors.map(c=>c.message).join(`-----------------------
`);throw new Error(`Errors detected in definition of Lexer:
`+l)}this.lexerDefinitionWarning.forEach(o=>{Uf(o.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(a&&(this.handleModes=()=>{}),this.trackStartLines===!1&&(this.computeNewColumn=o=>o),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=()=>{}),/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=Object.entries(this.canModeBeOptimized).reduce((l,[c,u])=>(u===!1&&l.push(c),l),[]);if(r.ensureOptimizations&&o.length>0)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",()=>{qp()}),this.TRACE_INIT("toFastProperties",()=>{Bf(this)})})}tokenize(e,r=this.defaultMode){if(this.lexerDefinitionErrors.length>0){const i=this.lexerDefinitionErrors.map(a=>a.message).join(`-----------------------
`);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer:
`+i)}return this.tokenizeInternal(e,r)}tokenizeInternal(e,r){let n,i,a,s,o,l,c,u,d,g,p,$,_,I,C;const A=e,w=A.length;let P=0,W=0;const B=this.hasCustom?0:Math.floor(e.length/10),H=new Array(B),ne=[];let se=this.trackStartLines?1:void 0,oe=this.trackStartLines?1:void 0;const b=hm(this.emptyGroups),T=this.trackStartLines,m=this.config.lineTerminatorsPattern;let S=0,y=[],R=[];const E=[],L=[];Object.freeze(L);let D=!1;const x=z=>{if(E.length===1&&z.tokenType.PUSH_MODE===void 0){const Q=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(z);ne.push({offset:z.startOffset,line:z.startLine,column:z.startColumn,length:z.image.length,message:Q})}else{E.pop();const Q=E.at(-1);y=this.patternIdxToConfig[Q],R=this.charCodeToPatternIdxToConfig[Q],S=y.length;const _e=this.canModeBeOptimized[Q]&&this.config.safeMode===!1;R&&_e?D=!0:D=!1}};function j(z){E.push(z),R=this.charCodeToPatternIdxToConfig[z],y=this.patternIdxToConfig[z],S=y.length,S=y.length;const Q=this.canModeBeOptimized[z]&&this.config.safeMode===!1;R&&Q?D=!0:D=!1}j.call(this,r);let F;const te=this.config.recoveryEnabled;for(;P<w;){l=null,d=-1;const z=A.charCodeAt(P);let Q;if(D){const me=er(z),le=R[me];Q=le!==void 0?le:L}else Q=y;const _e=Q.length;for(n=0;n<_e;n++){F=Q[n];const me=F.pattern;c=null;const le=F.short;if(le!==!1?z===le&&(d=1,l=me):F.isCustom===!0?(C=me.exec(A,P,H,b),C!==null?(l=C[0],d=l.length,C.payload!==void 0&&(c=C.payload)):l=null):(me.lastIndex=P,d=this.matchLength(me,e,P)),d!==-1){if(o=F.longerAlt,o!==void 0){l=e.substring(P,P+d);const ke=o.length;for(a=0;a<ke;a++){const Ie=y[o[a]],Ce=Ie.pattern;if(u=null,Ie.isCustom===!0?(C=Ce.exec(A,P,H,b),C!==null?(s=C[0],C.payload!==void 0&&(u=C.payload)):s=null):(Ce.lastIndex=P,s=this.match(Ce,e,P)),s&&s.length>l.length){l=s,d=s.length,c=u,F=Ie;break}}}break}}if(d!==-1){if(g=F.group,g!==void 0&&(l=l!==null?l:e.substring(P,P+d),p=F.tokenTypeIdx,$=this.createTokenInstance(l,P,p,F.tokenType,se,oe,d),this.handlePayload($,c),g===!1?W=this.addToken(H,W,$):b[g].push($)),T===!0&&F.canLineTerminator===!0){let me=0,le,ke;m.lastIndex=0;do l=l!==null?l:e.substring(P,P+d),le=m.test(l),le===!0&&(ke=m.lastIndex-1,me++);while(le===!0);me!==0?(se=se+me,oe=d-ke,this.updateTokenEndLineColumnLocation($,g,ke,me,se,oe,d)):oe=this.computeNewColumn(oe,d)}else oe=this.computeNewColumn(oe,d);P=P+d,this.handleModes(F,x,j,$)}else{const me=P,le=se,ke=oe;let Ie=te===!1;for(;Ie===!1&&P<w;)for(P++,i=0;i<S;i++){const Ce=y[i],Y=Ce.pattern,Xe=Ce.short;if(Xe!==!1?A.charCodeAt(P)===Xe&&(Ie=!0):Ce.isCustom===!0?Ie=Y.exec(A,P,H,b)!==null:(Y.lastIndex=P,Ie=Y.exec(e)!==null),Ie===!0)break}if(_=P-me,oe=this.computeNewColumn(oe,_),I=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(A,me,_,le,ke,E.at(-1)),ne.push({offset:me,line:le,column:ke,length:_,message:I}),te===!1)break}}return this.hasCustom||(H.length=W),{tokens:H,groups:b,errors:ne}}handleModes(e,r,n,i){if(e.pop===!0){const a=e.push;r(i),a!==void 0&&n.call(this,a)}else e.push!==void 0&&n.call(this,e.push)}updateTokenEndLineColumnLocation(e,r,n,i,a,s,o){let l,c;r!==void 0&&(l=n===o-1,c=l?-1:0,i===1&&l===!0||(e.endLine=a+c,e.endColumn=s-1+-c))}computeNewColumn(e,r){return e+r}createOffsetOnlyToken(e,r,n,i){return{image:e,startOffset:r,tokenTypeIdx:n,tokenType:i}}createStartOnlyToken(e,r,n,i,a,s){return{image:e,startOffset:r,startLine:a,startColumn:s,tokenTypeIdx:n,tokenType:i}}createFullToken(e,r,n,i,a,s,o){return{image:e,startOffset:r,endOffset:r+o-1,startLine:a,endLine:a,startColumn:s,endColumn:s+o-1,tokenTypeIdx:n,tokenType:i}}addTokenUsingPush(e,r,n){return e.push(n),r}addTokenUsingMemberAccess(e,r,n){return e[r]=n,r++,r}handlePayloadNoCustom(e,r){}handlePayloadWithCustom(e,r){r!==null&&(e.payload=r)}match(e,r,n){return e.test(r)===!0?r.substring(n,e.lastIndex):null}matchLength(e,r,n){return e.test(r)===!0?e.lastIndex-n:-1}}We.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.";We.NA=/NOT_APPLICABLE/;function an(t){return Qf(t)?
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return Object.hasOwn(t,Fc)&&(r.CATEGORIES=t[Fc]),Hi([r]),Object.hasOwn(t,Gc)&&(r.LABEL=t[Gc]),Object.hasOwn(t,jc)&&(r.GROUP=t[jc]),Object.hasOwn(t,Uc)&&(r.POP_MODE=t[Uc]),Object.hasOwn(t,zc)&&(r.PUSH_MODE=t[zc]),Object.hasOwn(t,qc)&&(r.LONGER_ALT=t[qc]),Object.hasOwn(t,Bc)&&(r.LINE_BREAKS=t[Bc]),Object.hasOwn(t,Wc)&&(r.START_CHARS_HINT=t[Wc]),r}const qt=ed({name:"EOF",pattern:We.NA});Hi([qt]);function nc(t,e,r,n,i,a,s,o){return{image:e,startOffset:r,endOffset:n,startLine:i,endLine:a,startColumn:s,endColumn:o,tokenTypeIdx:t.tokenTypeIdx,tokenType:t}}function ic(t,e){return Ki(t,e)}const rn={buildMismatchTokenMessage({expected:t,actual:e,previous:r,ruleName:n}){return`Expecting ${Qf(t)?`--> ${an(t)} <--`:`token of type --> ${t.name} <--`} but found --> '${e.image}' <--`},buildNotAllInputParsedMessage({firstRedundant:t,ruleName:e}){return"Redundant input, expecting EOF but found: "+t.image},buildNoViableAltMessage({expectedPathsPerAlt:t,actual:e,previous:r,customUserDescription:n,ruleName:i}){const a="Expecting: ",o=`
but found: '`+e[0].image+"'";if(n)return a+n+o;{const d=`one of these possible Token sequences:
${t.reduce((g,p)=>g.concat(p),[]).map(g=>`[${g.map(p=>an(p)).join(", ")}]`).map((g,p)=>` ${p+1}. ${g}`).join(`
`)}`;return a+d+o}},buildEarlyExitMessage({expectedIterationPaths:t,actual:e,customUserDescription:r,ruleName:n}){const i="Expecting: ",s=`
but found: '`+e[0].image+"'";if(r)return i+r+s;{const l=`expecting at least one iteration which starts with one of these possible Token sequences::
<${t.map(c=>`[${c.map(u=>an(u)).join(",")}]`).join(" ,")}>`;return i+l+s}}};Object.freeze(rn);const km={buildRuleNotFoundError(t,e){return"Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+`<-
inside top level rule: ->`+t.name+"<-"}},Sr={buildDuplicateFoundError(t,e){function r(u){return u instanceof ae?u.terminalType.name:u instanceof qe?u.nonTerminalName:""}const n=t.name,i=e[0],a=i.idx,s=mt(i),o=r(i),l=a>0;let c=`->${s}${l?a:""}<- ${o?`with argument: ->${o}<-`:""}
appears more than once (${e.length} times) in the top level rule: ->${n}<-.
For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES
`;return c=c.replace(/[ \t]+/g," "),c=c.replace(/\s\s+/g,`
`),c},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=t.prefixPath.map(i=>an(i)).join(", "),r=t.alternation.idx===0?"":t.alternation.idx;return`Ambiguous alternatives: <${t.ambiguityIndices.join(" ,")}> due to common lookahead prefix
in <OR${r}> 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,r=t.prefixPath.length===0;let n=`Ambiguous Alternatives Detected: <${t.ambiguityIndices.join(" ,")}> in <OR${e}> inside <${t.topLevelRule.name}> Rule,
`;if(r)n+=`These alternatives are all empty (match no tokens), making them indistinguishable.
Only the last alternative may be empty.
`;else{const i=t.prefixPath.map(a=>an(a)).join(", ");n+=`<${i}> may appears as a prefix path in all these alternatives.
`}return n+=`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
For Further details.`,n},buildEmptyRepetitionError(t){let e=mt(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,r=t.leftRecursionPath.map(a=>a.name),n=`${e} --> ${r.concat([e]).join(" --> ")}`;return`Left Recursion found in grammar.
rule: <${e}> can be invoked from itself (directly or indirectly)
without consuming any Tokens. The grammar path that causes this is:
${n}
To fix this refactor your grammar to remove the left recursion.
see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(t){return"deprecated"},buildDuplicateRuleNameError(t){let e;return t.topLevelRule instanceof On?e=t.topLevelRule.name:e=t.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${t.grammarName}<-`}};function bm(t,e){const r=new Nm(t,e);return r.resolveRefs(),r.errors}class Nm extends Ln{constructor(e,r){super(),this.nameToTopRule=e,this.errMsgProvider=r,this.errors=[]}resolveRefs(){Object.values(this.nameToTopRule).forEach(e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){const r=this.nameToTopRule[e.nonTerminalName];if(r)e.referencedRule=r;else{const n=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:n,type:Be.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}}class _m extends Cs{constructor(e,r){super(),this.topProd=e,this.path=r,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=[...this.path.ruleStack].reverse(),this.occurrenceStack=[...this.path.occurrenceStack].reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,r=[]){this.found||super.walk(e,r)}walkProdRef(e,r,n){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){const i=r.concat(n);this.updateExpectedNext(),this.walk(e.referencedRule,i)}}updateExpectedNext(){this.ruleStack.length===0?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}}class Im extends _m{constructor(e,r){super(e,r),this.path=r,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,r,n){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){const i=r.concat(n),a=new Ve({definition:i});this.possibleTokTypes=Vi(a),this.found=!0}}}class ws extends Cs{constructor(e,r){super(),this.topRule=e,this.occurrence=r,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}}class Pm extends ws{walkMany(e,r,n){if(e.idx===this.occurrence){const i=r.concat(n)[0];this.result.isEndOfRule=i===void 0,i instanceof ae&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkMany(e,r,n)}}class Vc extends ws{walkManySep(e,r,n){if(e.idx===this.occurrence){const i=r.concat(n)[0];this.result.isEndOfRule=i===void 0,i instanceof ae&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkManySep(e,r,n)}}class Om extends ws{walkAtLeastOne(e,r,n){if(e.idx===this.occurrence){const i=r.concat(n)[0];this.result.isEndOfRule=i===void 0,i instanceof ae&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOne(e,r,n)}}class Kc extends ws{walkAtLeastOneSep(e,r,n){if(e.idx===this.occurrence){const i=r.concat(n)[0];this.result.isEndOfRule=i===void 0,i instanceof ae&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOneSep(e,r,n)}}function So(t,e,r=[]){r=[...r];let n=[],i=0;function a(o){return o.concat(t.slice(i+1))}function s(o){const l=So(a(o),e,r);return n.concat(l)}for(;r.length<e&&i<t.length;){const o=t[i];if(o instanceof Ve)return s(o.definition);if(o instanceof qe)return s(o.definition);if(o instanceof Me)n=s(o.definition);else if(o instanceof et){const l=o.definition.concat([new Te({definition:o.definition})]);return s(l)}else if(o instanceof tt){const l=[new Ve({definition:o.definition}),new Te({definition:[new ae({terminalType:o.separator})].concat(o.definition)})];return s(l)
${a.join(`
`).replace(/\n/g,`
`)}`)}}};return r.prototype=n,r.prototype.constructor=r,r._RULE_NAMES=e,r}function $g(t,e,r){const n=function(){};md(n,t+"BaseSemanticsWithDefaults");const i=Object.create(r.prototype);return e.forEach(a=>{i[a]=Rg}),n.prototype=i,n.prototype.constructor=n,n}var _o;(function(t){t[t.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",t[t.MISSING_METHOD=1]="MISSING_METHOD"})(_o||(_o={}));function Eg(t,e){return Ag(t,e)}function Ag(t,e){return e.filter(i=>typeof t[i]!="function").map(i=>({msg:`Missing visitor method: <${i}> on ${t.constructor.name} CST Visitor.`,type:_o.MISSING_METHOD,methodName:i})).filter(Boolean)}class Cg{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=Object.hasOwn(e,"nodeLocationTracking")?e.nodeLocationTracking:Bt.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=()=>{},this.cstFinallyStateUpdate=()=>{},this.cstPostTerminal=()=>{},this.cstPostNonTerminal=()=>{},this.cstPostRule=()=>{};else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=Jc,this.setNodeLocationFromNode=Jc,this.cstPostRule=()=>{},this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=Yc,this.setNodeLocationFromNode=Yc,this.cstPostRule=()=>{},this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=()=>{},this.setInitialNodeLocation=()=>{};else throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`)}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:NaN,endOffset:NaN}}setInitialNodeLocationOnlyOffsetRegular(e){e.location={startOffset:this.LA_FAST(1).startOffset,endOffset:NaN}}setInitialNodeLocationFullRecovery(e){e.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}}setInitialNodeLocationFullRegular(e){const r=this.LA_FAST(1);e.location={startOffset:r.startOffset,startLine:r.startLine,startColumn:r.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(e){const r={name:e,children:Object.create(null)};this.setInitialNodeLocation(r),this.CST_STACK.push(r)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){const r=this.LA(0),n=e.location;n.startOffset<=r.startOffset?(n.endOffset=r.endOffset,n.endLine=r.endLine,n.endColumn=r.endColumn):(n.startOffset=NaN,n.startLine=NaN,n.startColumn=NaN)}cstPostRuleOnlyOffset(e){const r=this.LA(0),n=e.location;n.startOffset<=r.startOffset?n.endOffset=r.endOffset:n.startOffset=NaN}cstPostTerminal(e,r){const n=this.CST_STACK[this.CST_STACK.length-1];gg(n,r,e),this.setNodeLocationFromToken(n.location,r)}cstPostNonTerminal(e,r){const n=this.CST_STACK[this.CST_STACK.length-1];yg(n,r,e),this.setNodeLocationFromNode(n.location,e.location)}getBaseCstVisitorConstructor(){if(this.baseCstVisitorConstructor===void 0){const e=vg(this.className,Object.keys(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(this.baseCstVisitorWithDefaultsConstructor===void 0){const e=$g(this.className,Object.keys(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor}getPreviousExplicitRuleShortName(){return this.RULE_STACK[this.RULE_STACK_IDX-1]}getLastExplicitRuleOccurrenceIndex(){return this.RULE_OCCURRENCE_STACK[this.RULE_OCCURRENCE_STACK_IDX]}}class Sg{initLexerA
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
For Further details.`);if(Array.isArray(e)){if(e.length===0)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(Array.isArray(e))this.tokensMap=e.reduce((a,s)=>(a[s.name]=s,a),{});else if(Object.hasOwn(e,"modes")&&Object.values(e.modes).flat().every(Cm)){const a=Object.values(e.modes).flat(),s=[...new Set(a)];this.tokensMap=s.reduce((o,l)=>(o[l.name]=l,o),{})}else if(typeof e=="object"&&e!==null)this.tokensMap=Object.assign({},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=qt;const i=(Object.hasOwn(e,"modes")?Object.values(e.modes).flat():Object.values(e)).every(a=>{var s;return((s=a.categoryMatches)===null||s===void 0?void 0:s.length)==0});this.tokenMatcher=i?as:Ki,Hi(Object.values(this.tokensMap))}defineRule(e,r,n){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'
Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);const i=Object.hasOwn(n,"resyncEnabled")?n.resyncEnabled:ls.resyncEnabled,a=Object.hasOwn(n,"recoveryValueFunc")?n.recoveryValueFunc:ls.recoveryValueFunc,s=this.ruleShortNameIdx<<dg+rr;this.ruleShortNameIdx++,this.shortRuleNameToFull[s]=e,this.fullRuleNameToShort[e]=s;let o;return this.outputCst===!0?o=function(...d){try{this.ruleInvocationStateUpdate(s,e,this.subruleIdx),r.apply(this,d);const g=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(g),g}catch(g){return this.invokeRuleCatch(g,i,a)}finally{this.ruleFinallyStateUpdate()}}:o=function(...d){try{return this.ruleInvocationStateUpdate(s,e,this.subruleIdx),r.apply(this,d)}catch(g){return this.invokeRuleCatch(g,i,a)}finally{this.ruleFinallyStateUpdate()}},Object.assign(function(...d){this.onBeforeParse(e);try{return o.apply(this,d)}finally{this.onAfterParse(e)}},{ruleName:e,originalGrammarAction:r,coreRule:o})}invokeRuleCatch(e,r,n){const i=this.RULE_STACK_IDX===0,a=r&&!this.isBackTracking()&&this.recoveryEnabled;if(ss(e)){const s=e;if(a){const o=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(o))if(s.resyncedTokens=this.reSyncTo(o),this.outputCst){const l=this.CST_STACK[this.CST_STACK.length-1];return l.recoveredNode=!0,l}else return n(e);else{if(this.outputCst){const l=this.CST_STACK[this.CST_STACK.length-1];l.recoveredNode=!0,s.partialCstResult=l}throw s}}else{if(i)return this.moveToTerminatedState(),n(e);throw s}}else throw e}optionInternal(e,r){const n=this.getKeyForAutomaticLookahead(pd,r);return this.optionInternalLogic(e,r,n)}optionInternalLogic(e,r,n){let i=this.getLaFuncFromCache(n),a;if(typeof e!="function"){a=e.DEF;const s=e.GATE;if(s!==void 0){const o=i;i=()=>s.call(this)&&o.call(this)}}else a=e;if(i.call(this)===!0)return a.call(this)}atLeastOneInternal(e,r){const n=this.getKeyForAutomaticLookahead(bo,e);return this.atLeastOneInternalLogic(e,r,n)}atLeastOneInternalLogic(e,r,n){let i=this.getLaFuncFromCache(n),a;if(typeof r!="function"){a=r.DEF;const s=r.GATE;if(s!==void 0){const o=i;i=()=>s.call(this)&&o.call(this)}}else a=r;if(i.call(this)===!0){let s=this.doSingleRepetition(a);for(;i.call(this)===!0&&s===!0;)s=this.doSingleRepetition(a)}else throw this.raiseEarlyExitException(e,de.REPETITION_MANDATORY,r.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,r],i,bo,e,Om)}atLeastOneSepFirstInternal(e,r){const n=this.getKeyForAutomaticLookahead(Ka,e);this.atLeastOneSepFirstInternalLogic(e,r,n)}atLeastOneSepFirstInternalLogic(e,r,n){const i=r.DEF,a=r.SEP;if(this.getLaFuncFromCache(n).call(this)===!0){i.call(this);const o=()=>this.tokenMatcher(this.LA_FAST(1),a);for(;this.tokenMatcher(this.LA_FAST(1),a)===!0;)this.CONSUME(a),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,a,o,i,Kc],o,Ka,e,Kc)}else throw this.raiseEarlyExitException(e,de.REPETITION_MANDATORY_WITH_SEPARATOR,r.ERR_MSG)}manyInternal(e,r){const n=this.getKeyForAutomaticLookahead(ko,e);return this.manyInternalLogic(e,r,n)}manyInternalLogic(e,r,n){let i=this.getLaFuncFromCache(n),a;if(typeof r!="function"){a=r.DEF;const o=r.GATE;if(o!==void 0){const l=i;i=()=>o.call(this)&&l.call(this)}}else a=r;let s=!0;for(;i.call(this)===!0&&s===!0;)s=this.doSingleRepetition(a);this.attemptInRepetitionRecovery(this.manyInternal,[e,r],i,ko,e,Pm,s)}manySepFirstInternal(e,r){const n=this.getKeyForAutomaticLookahead(No,e);this.manySepFirstInternalLogic(e,r,n)}manySepFirstInternalLogic(e,r,n){const i=r.DEF,a=r.SEP;if(this.getLaFuncFromCache(n).call(this)===!0){i.call(this);const o=()=>this.tokenMatcher(this.LA_FAST(1),a);for(;this.tokenMatcher(this.LA_FAST(1),a)===!0;)this.CONSUME(a),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,a,o,i,Vc],o,No,e,Vc)}}repetitionSepSecondInternal(e,r,n,i,a){for(;n();)this.CONSUME(r),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,r,n,i,a],n,Ka,e,a)}doSingleRepetition(e){const r=this.getLexerPosition();return e.call(this),this.getLexerPosition()>r}o
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(yd);const Ng={name:`This CSTNode indicates the Parser is in Recording Phase
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}};class _g{initGastRecorder(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",()=>{for(let e=0;e<10;e++){const r=e>0?e:"";this[`CONSUME${r}`]=function(n,i){return this.consumeInternalRecord(n,e,i)},this[`SUBRULE${r}`]=function(n,i){return this.subruleInternalRecord(n,e,i)},this[`OPTION${r}`]=function(n){return this.optionInternalRecord(n,e)},this[`OR${r}`]=function(n){return this.orInternalRecord(n,e)},this[`MANY${r}`]=function(n){this.manyInternalRecord(e,n)},this[`MANY_SEP${r}`]=function(n){this.manySepFirstInternalRecord(e,n)},this[`AT_LEAST_ONE${r}`]=function(n){this.atLeastOneInternalRecord(e,n)},this[`AT_LEAST_ONE_SEP${r}`]=function(n){this.atLeastOneSepFirstInternalRecord(e,n)}}this.consume=function(e,r,n){return this.consumeInternalRecord(r,e,n)},this.subrule=function(e,r,n){return this.subruleInternalRecord(r,e,n)},this.option=function(e,r){return this.optionInternalRecord(r,e)},this.or=function(e,r){return this.orInternalRecord(r,e)},this.many=function(e,r){this.manyInternalRecord(e,r)},this.atLeastOne=function(e,r){this.atLeastOneInternalRecord(e,r)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",()=>{const e=this;for(let r=0;r<10;r++){const n=r>0?r:"";delete e[`CONSUME${n}`],delete e[`SUBRULE${n}`],delete e[`OPTION${n}`],delete e[`OR${n}`],delete e[`MANY${n}`],delete e[`MANY_SEP${n}`],delete e[`AT_LEAST_ONE${n}`],delete e[`AT_LEAST_ONE_SEP${n}`]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})}ACTION_RECORD(e){}BACKTRACK_RECORD(e,r){return()=>!0}LA_RECORD(e){return wn}topLevelRuleRecord(e,r){try{const n=new On({definition:[],name:e});return n.name=e,this.recordingProdStack.push(n),r.call(this),this.recordingProdStack.pop(),n}catch(n){if(n.KNOWN_RECORDER_ERROR!==!0)try{n.message=n.message+`
This error was thrown during the "grammar recording phase" For more info see:
https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw n}throw n}}optionInternalRecord(e,r){return ri.call(this,Me,e,r)}atLeastOneInternalRecord(e,r){ri.call(this,et,r,e)}atLeastOneSepFirstInternalRecord(e,r){ri.call(this,tt,r,e,Zc)}manyInternalRecord(e,r){ri.call(this,Te,r,e)}manySepFirstInternalRecord(e,r){ri.call(this,Ke,r,e,Zc)}orInternalRecord(e,r){return Ig.call(this,e,r)}subruleInternalRecord(e,r,n){if(os(r),!e||!Object.hasOwn(e,"ruleName")){const o=new Error(`<SUBRULE${eu(r)}> 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=this.recordingProdStack.at(-1),a=e.ruleName,s=new qe({idx:r,nonTerminalName:a,label:n?.LABEL,referencedRule:void 0});return i.definition.push(s),this.outputCst?Ng:_s}consumeInternalRecord(e,r,n){if(os(r),!Zf(e)){const s=new Error(`<CONSUME${eu(r)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>
inside top level rule: <${this.recordingProdStack[0].name}>`);throw s.KNOWN_RECORDER_ERROR=!0,s}const i=this.recordingProdStack.at(-1),a=new ae({idx:r,terminalType:e,label:n?.LABEL});return i.definition.push(a),yd}}function ri(t,e,r,n=!1){os(r);const i=this.recordingProdStack.at(-1),a=typeof e=="function"?e:e.DEF,s=new t({definition:[],idx:r});return n&&(s.separator=e.SEP),Object.hasOwn(e,"MAX_LOOKAHEAD")&&(s.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(s),a.call(this),i.definition.push(s),this.recordingProdStack.pop(),_s}function Ig(t,e){os(e);const r=this.recordingProdStack.at(-1),n=Array.isArray(t)===!1,i=n===!1?t:t.DEF,a=new He({definition:[],idx:e,ignoreAmbiguities:n&&t.IGNORE_AMBIGUITIES===!0});Object.hasOwn(t,"MAX_LOOKAHEAD")&&(a.maxLookahead=t.MAX_LOOKAHEAD);const s=i.some(o=>typeof o.GATE=="function");return a.hasPredicates=s,r.definition.push(a),i.forEach(o=>{const l=new Ve({definition:[]});a.definition.push(l),Object.hasOwn(o,"IGNORE_AMBIGUITIES")?l.ignoreAmbiguities=o.IGNORE_AMBIGUITIES:Object.hasOwn(o,"GATE")&&(l.ignoreAmbiguities=!0),this.recordingProdStack.push(l),o.ALT.call(this),this.recordingProdStack.pop()}),_s}function eu(t){return t===0?"":`${t}`}function os(t){if(t<0||t>Qc){const e=new Error(`Invalid DSL Method idx value: <${t}>
Idx value must be a none negative value smaller than ${Qc+1}`);throw e.KNOWN_RECORDER_ERROR=!0,e}}class Pg{initPerformanceTracer(e){if(Object.hasOwn(e,"traceInitPerf")){const r=e.traceInitPerf,n=typeof r=="number";this.traceInitMaxIdent=n?r:1/0,this.traceInitPerf=n?r>0:r}else this.traceInitMaxIdent=0,this.traceInitPerf=Bt.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,r){if(this.traceInitPerf===!0){this.traceInitIndent++;const n=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--> <${e}>`);const{time:i,value:a}=qf(r),s=i>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&s(`${n}<-- <${e}> time: ${i}ms`),this.traceInitIndent--,a}else return r()}}function Og(t,e){e.forEach(r=>{const n=r.prototype;Object.getOwnPropertyNames(n).forEach(i=>{if(i==="constructor")return;const a=Object.getOwnPropertyDescriptor(n,i);a&&(a.get||a.set)?Object.defineProperty(t.prototype,i,a):t.prototype[i]=r.prototype[i]})})}const wn=nc(qt,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(wn);const Bt=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:rn,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),ls=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0});var Be;(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"})(Be||(Be={}));function tu(t=void 0){return function(){return t}}class Xi{static performSelfAnalysis(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT("performSelfAnalysis",()=>{let e;this.selfAnalysisDone=!0;const r=this.className;this.TRACE_INIT("toFastProps",()=>{Bf(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),this.definedRulesNames.forEach(i=>{const s=this[i].originalGrammarAction;let o;this.TRACE_INIT(`${i} Rule`,()=>{o=this.topLevelRuleRecord(i,s)}),this.gastProductionsCache[i]=o})}finally{this.disableRecording()}});let n=[];if(this.TRACE_INIT("Grammar Resolving",()=>{n=ig({rules:Object.values(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(n)}),this.TRACE_INIT("Grammar Validations",()=>{if(n.length===0&&this.skipValidations===!1){const i=ag({rules:Object.values(this.gastProductionsCache),tokenTypes:Object.values(this.tokensMap),errMsgProvider:Sr,grammarName:r}),a=qm({lookaheadStrategy:this.lookaheadStrategy,rules:Object.values(this.gastProductionsCache),tokenTypes:Object.values(this.tokensMap),grammarName:r});this.definitionErrors=this.definitionErrors.concat(i,a)}}),this.definitionErrors.length===0&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{const i=jp(Object.values(this.gastProductionsCache));this.resyncFollows=i}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var i,a;(a=(i=this.lookaheadStrategy).initialize)===null||a===void 0||a.call(i,{rules:Object.values(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(Object.values(this.gastProductionsCache))})),!Xi.DEFER_DEFINITION_ERRORS_HANDLING&&this.definitionErrors.length!==0)throw e=this.definitionErrors.map(i=>i.message),new Error(`Parser Definition Errors detected:
${e.join(`
-------------------------------
`)}`)})}constructor(e,r){this.definitionErrors=[],this.selfAnalysisDone=!1;const n=this;if(n.initErrorHandler(r),n.initLexerAdapter(),n.initLooksAhead(r),n.initRecognizerEngine(e,r),n.initRecoverable(r),n.initTreeBuilder(r),n.initGastRecorder(r),n.initPerformanceTracer(r),Object.hasOwn(r,"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=Object.hasOwn(r,"skipValidations")?r.skipValidations:Bt.skipValidations}}Xi.DEFER_DEFINITION_ERRORS_HANDLING=!1;Og(Xi,[ug,hg,Cg,Sg,kg,wg,bg,_g,Pg]);class Lg extends Xi{constructor(e,r=Bt){const n=Object.assign({},r);n.outputCst=!1,super(e,n)}}function kn(t,e,r){return`${t.name}_${e}_${r}`}const tr=1,xg=2,Td=4,Rd=5,xn=7,Dg=8,Mg=9,Fg=10,Gg=11,vd=12;class lc{constructor(e){this.target=e}isEpsilon(){return!1}}class cc extends lc{constructor(e,r){super(e),this.tokenType=r}}class $d extends lc{constructor(e){super(e)}isEpsilon(){return!0}}class uc extends lc{constructor(e,r,n){super(e),this.rule=r,this.followState=n}isEpsilon(){return!0}}function jg(t){const e={decisionMap:{},decisionStates:[],ruleToStartState:new Map,ruleToStopState:new Map,states:[]};zg(e,t);const r=t.length;for(let n=0;n<r;n++){const i=t[n],a=Or(e,i,i);a!==void 0&&Zg(e,i,a)}return e}function zg(t,e){const r=e.length;for(let n=0;n<r;n++){const i=e[n],a=Ne(t,i,void 0,{type:xg}),s=Ne(t,i,void 0,{type:xn});a.stop=s,t.ruleToStartState.set(i,a),t.ruleToStopState.set(i,s)}}function Ed(t,e,r){return r instanceof ae?fc(t,e,r.terminalType,r):r instanceof qe?Jg(t,e,r):r instanceof He?Vg(t,e,r):r instanceof Me?Kg(t,e,r):r instanceof Te?Ug(t,e,r):r instanceof Ke?qg(t,e,r):r instanceof et?Bg(t,e,r):r instanceof tt?Wg(t,e,r):Or(t,e,r)}function Ug(t,e,r){const n=Ne(t,e,r,{type:Rd});nr(t,n);const i=Dn(t,e,n,r,Or(t,e,r));return Cd(t,e,r,i)}function qg(t,e,r){const n=Ne(t,e,r,{type:Rd});nr(t,n);const i=Dn(t,e,n,r,Or(t,e,r)),a=fc(t,e,r.separator,r);return Cd(t,e,r,i,a)}function Bg(t,e,r){const n=Ne(t,e,r,{type:Td});nr(t,n);const i=Dn(t,e,n,r,Or(t,e,r));return Ad(t,e,r,i)}function Wg(t,e,r){const n=Ne(t,e,r,{type:Td});nr(t,n);const i=Dn(t,e,n,r,Or(t,e,r)),a=fc(t,e,r.separator,r);return Ad(t,e,r,i,a)}function Vg(t,e,r){const n=Ne(t,e,r,{type:tr});nr(t,n);const i=Gt(r.definition,s=>Ed(t,e,s));return Dn(t,e,n,r,...i)}function Kg(t,e,r){const n=Ne(t,e,r,{type:tr});nr(t,n);const i=Dn(t,e,n,r,Or(t,e,r));return Hg(t,e,r,i)}function Or(t,e,r){const n=wh(Gt(r.definition,i=>Ed(t,e,i)),i=>i!==void 0);return n.length===1?n[0]:n.length===0?void 0:Yg(t,n)}function Ad(t,e,r,n,i){const a=n.left,s=n.right,o=Ne(t,e,r,{type:Gg});nr(t,o);const l=Ne(t,e,r,{type:vd});return a.loopback=o,l.loopback=o,t.decisionMap[kn(e,i?"RepetitionMandatoryWithSeparator":"RepetitionMandatory",r.idx)]=o,Se(s,o),i===void 0?(Se(o,a),Se(o,l)):(Se(o,l),Se(o,i.left),Se(i.right,a)),{left:a,right:l}}function Cd(t,e,r,n,i){const a=n.left,s=n.right,o=Ne(t,e,r,{type:Fg});nr(t,o);const l=Ne(t,e,r,{type:vd}),c=Ne(t,e,r,{type:Mg});return o.loopback=c,l.loopback=c,Se(o,a),Se(o,l),Se(s,c),i!==void 0?(Se(c,l),Se(c,i.left),Se(i.right,a)):Se(c,o),t.decisionMap[kn(e,i?"RepetitionWithSeparator":"Repetition",r.idx)]=o,{left:o,right:l}}function Hg(t,e,r,n){const i=n.left,a=n.right;return Se(i,a),t.decisionMap[kn(e,"Option",r.idx)]=i,n}function nr(t,e){return t.decisionStates.push(e),e.decision=t.decisionStates.length-1,e.decision}function Dn(t,e,r,n,...i){const a=Ne(t,e,n,{type:Dg,start:r});r.end=a;for(const o of i)o!==void 0?(Se(r,o.left),Se(o.right,a)):Se(r,a);const s={left:r,right:a};return t.decisionMap[kn(e,Xg(n),n.idx)]=r,s}function Xg(t){if(t instanceof He)return"Alternation";if(t instanceof Me)return"Option";if(t instanceof Te)return"Repetition";if(t instanceof Ke)return"RepetitionWithSeparator";if(t instanceof et)return"RepetitionMandatory";if(t instanceof tt)return"RepetitionMandatoryWithSeparator";throw new Error("Invalid production type encountered")}function Yg(t,e){const r=e.length;for(let a=0;a<r-1;a++){const s=e[a];let o;s.left.transitions.length===1&&(o=s.left.transitions[0]);const l=o instanceof uc,c=o,u=e[a+1].left;s.left.type===tr&&s.right.type===tr&&o!==void 0&&(l&&c.followState===s.right||o.target===s.right)?(l?c.followState=u:o.target=u,Qg(t,s.right)):Se(s.right,u)}const n=e[0],i=e[r-1];return{left:n.left,right:i.right}}function fc(t,e,r,n){const i=Ne(t,e,n,{type:tr}),a=Ne(t,e,n,{type:tr});return dc(i,new cc(a,r)),{left:i,right:a}}function Jg(t,e,r){const n=r.referencedR
<${e}> may appears as a prefix path in all these alternatives.
`;return n=n+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
For Further details.`,n}function oy(t){if(t instanceof qe)return"SUBRULE";if(t instanceof Me)return"OPTION";if(t instanceof He)return"OR";if(t instanceof et)return"AT_LEAST_ONE";if(t instanceof tt)return"AT_LEAST_ONE_SEP";if(t instanceof Ke)return"MANY_SEP";if(t instanceof Te)return"MANY";if(t instanceof ae)return"CONSUME";throw Error("non exhaustive match")}function ly(t,e,r){const n=Nh(e.configs.elements,a=>a.state.transitions),i=_h(n.filter(a=>a instanceof cc).map(a=>a.tokenType),a=>a.tokenTypeIdx);return{actualToken:r,possibleTokenTypes:i,tokenPath:t}}function cy(t,e){return t.edges[e.tokenTypeIdx]}function uy(t,e,r){const n=new Io,i=[];for(const s of t.elements){if(r.is(s.alt)===!1)continue;if(s.state.type===xn){i.push(s);continue}const o=s.state.transitions.length;for(let l=0;l<o;l++){const c=s.state.transitions[l],u=fy(c,e);u!==void 0&&n.add({state:u,alt:s.alt,stack:s.stack})}}let a;if(i.length===0&&n.size===1&&(a=n),a===void 0){a=new Io;for(const s of n.elements)us(s,a)}if(i.length>0&&!my(a))for(const s of i)a.add(s);return a}function fy(t,e){if(t instanceof cc&&ic(e,t.tokenType))return t.target}function dy(t,e){let r;for(const n of t.elements)if(e.is(n.alt)===!0){if(r===void 0)r=n.alt;else if(r!==n.alt)return}return r}function kd(t){return{configs:t,edges:{},isAcceptState:!1,prediction:-1}}function iu(t,e,r,n){return n=bd(t,n),e.edges[r.tokenTypeIdx]=n,n}function bd(t,e){if(e===cs)return e;const r=e.configs.key,n=t.states[r];return n!==void 0?n:(e.configs.finalize(),t.states[r]=e,e)}function hy(t){const e=new Io,r=t.transitions.length;for(let n=0;n<r;n++){const a={state:t.transitions[n].target,alt:n,stack:[]};us(a,e)}return e}function us(t,e){const r=t.state;if(r.type===xn){if(t.stack.length>0){const i=[...t.stack],s={state:i.pop(),alt:t.alt,stack:i};us(s,e)}else e.add(t);return}r.epsilonOnlyTransitions||e.add(t);const n=r.transitions.length;for(let i=0;i<n;i++){const a=r.transitions[i],s=py(t,a);s!==void 0&&us(s,e)}}function py(t,e){if(e instanceof $d)return{state:e.target,alt:t.alt,stack:t.stack};if(e instanceof uc){const r=[...t.stack,e.followState];return{state:e.target,alt:t.alt,stack:r}}}function my(t){for(const e of t.elements)if(e.state.type===xn)return!0;return!1}function gy(t){for(const e of t.elements)if(e.state.type!==xn)return!1;return!0}function yy(t){if(gy(t))return!0;const e=Ty(t.elements);return Ry(e)&&!vy(e)}function Ty(t){const e=new Map;for(const r of t){const n=Sd(r,!1);let i=e.get(n);i===void 0&&(i={},e.set(n,i)),i[r.alt]=!0}return e}function Ry(t){for(const e of Array.from(t.values()))if(Object.keys(e).length>1)return!0;return!1}function vy(t){for(const e of Array.from(t.values()))if(Object.keys(e).length===1)return!0;return!1}function $y(t,e){let r;for(const n of t.configs.elements)if(!(e.is(n.alt)===!1||n.state.type===xn)){if(r===void 0)r=n.alt;else if(r!==n.alt)return}return r}var Po;(function(t){function e(r){return typeof r=="string"}t.is=e})(Po||(Po={}));var fs;(function(t){function e(r){return typeof r=="string"}t.is=e})(fs||(fs={}));var Oo;(function(t){t.MIN_VALUE=-2147483648,t.MAX_VALUE=2147483647;function e(r){return typeof r=="number"&&t.MIN_VALUE<=r&&r<=t.MAX_VALUE}t.is=e})(Oo||(Oo={}));var Oi;(function(t){t.MIN_VALUE=0,t.MAX_VALUE=2147483647;function e(r){return typeof r=="number"&&t.MIN_VALUE<=r&&r<=t.MAX_VALUE}t.is=e})(Oi||(Oi={}));var Z;(function(t){function e(n,i){return n===Number.MAX_VALUE&&(n=Oi.MAX_VALUE),i===Number.MAX_VALUE&&(i=Oi.MAX_VALUE),{line:n,character:i}}t.create=e;function r(n){let i=n;return v.objectLiteral(i)&&v.uinteger(i.line)&&v.uinteger(i.character)}t.is=r})(Z||(Z={}));var K;(function(t){function e(n,i,a,s){if(v.uinteger(n)&&v.uinteger(i)&&v.uinteger(a)&&v.uinteger(s))return{start:Z.create(n,i),end:Z.create(a,s)};if(Z.is(n)&&Z.is(i))return{start:n,end:i};throw new Error(`Range#create called with invalid arguments[${n}, ${i}, ${a}, ${s}]`)}t.create=e;function r(n){let i=n;return v.objectLiteral(i)&&Z.is(i.start)&&Z.is(i.end)}t.is=r})(K||(K={}));var Li;(function(t){function e(n,i){return{uri:n,range:i}}t.create=e;function r(n){let i=n;return v.objectLit
`,`\r
`,"\r"];var Il;(function(t){function e(a,s,o,l){return new Cy(a,s,o,l)}t.create=e;function r(a){let s=a;return!!(v.defined(s)&&v.string(s.uri)&&(v.undefined(s.languageId)||v.string(s.languageId))&&v.uinteger(s.lineCount)&&v.func(s.getText)&&v.func(s.positionAt)&&v.func(s.offsetAt))}t.is=r;function n(a,s){let o=a.getText(),l=i(s,(u,d)=>{let g=u.range.start.line-d.range.start.line;return g===0?u.range.start.character-d.range.start.character:g}),c=o.length;for(let u=l.length-1;u>=0;u--){let d=l[u],g=a.offsetAt(d.range.start),p=a.offsetAt(d.range.end);if(p<=c)o=o.substring(0,g)+d.newText+o.substring(p,o.length);else throw new Error("Overlapping edit");c=g}return o}t.applyEdits=n;function i(a,s){if(a.length<=1)return a;const o=a.length/2|0,l=a.slice(0,o),c=a.slice(o);i(l,s),i(c,s);let u=0,d=0,g=0;for(;u<l.length&&d<c.length;)s(l[u],c[d])<=0?a[g++]=l[u++]:a[g++]=c[d++];for(;u<l.length;)a[g++]=l[u++];for(;d<c.length;)a[g++]=c[d++];return a}})(Il||(Il={}));let Cy=class{constructor(e,r,n,i){this._uri=e,this._languageId=r,this._version=n,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 r=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(r,n)}return this._content}update(e,r){this._content=e.text,this._version=r,this._lineOffsets=void 0}getLineOffsets(){if(this._lineOffsets===void 0){let e=[],r=this._content,n=!0;for(let i=0;i<r.length;i++){n&&(e.push(i),n=!1);let a=r.charAt(i);n=a==="\r"||a===`
`,a==="\r"&&i+1<r.length&&r.charAt(i+1)===`
`&&i++}n&&r.length>0&&e.push(r.length),this._lineOffsets=e}return this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let r=this.getLineOffsets(),n=0,i=r.length;if(i===0)return Z.create(0,e);for(;n<i;){let s=Math.floor((n+i)/2);r[s]>e?i=s:n=s+1}let a=n-1;return Z.create(a,e-r[a])}offsetAt(e){let r=this.getLineOffsets();if(e.line>=r.length)return this._content.length;if(e.line<0)return 0;let n=r[e.line],i=e.line+1<r.length?r[e.line+1]:this._content.length;return Math.max(Math.min(n+e.character,i),n)}get lineCount(){return this.getLineOffsets().length}};var v;(function(t){const e=Object.prototype.toString;function r(p){return typeof p<"u"}t.defined=r;function n(p){return typeof p>"u"}t.undefined=n;function i(p){return p===!0||p===!1}t.boolean=i;function a(p){return e.call(p)==="[object String]"}t.string=a;function s(p){return e.call(p)==="[object Number]"}t.number=s;function o(p,$,_){return e.call(p)==="[object Number]"&&$<=p&&p<=_}t.numberRange=o;function l(p){return e.call(p)==="[object Number]"&&-2147483648<=p&&p<=2147483647}t.integer=l;function c(p){return e.call(p)==="[object Number]"&&0<=p&&p<=2147483647}t.uinteger=c;function u(p){return e.call(p)==="[object Function]"}t.func=u;function d(p){return p!==null&&typeof p=="object"}t.objectLiteral=d;function g(p,$){return Array.isArray(p)&&p.every($)}t.typedArray=g})(v||(v={}));const Sy=Object.freeze(Object.defineProperty({__proto__:null,get AnnotatedTextEdit(){return Ft},get ChangeAnnotation(){return wr},get ChangeAnnotationIdentifier(){return De},get CodeAction(){return fl},get CodeActionContext(){return ul},get CodeActionKind(){return cl},get CodeActionTriggerKind(){return Gi},get CodeDescription(){return zo},get CodeLens(){return dl},get Color(){return ds},get ColorInformation(){return xo},get ColorPresentation(){return Do},get Command(){return Ir},get CompletionItem(){return Jo},get CompletionItemKind(){return Wo},get CompletionItemLabelDetails(){return Yo},get CompletionItemTag(){return Ko},get CompletionList(){return Zo},get CreateFile(){return bn},get DeleteFile(){return _n},get Diagnostic(){return xi},get DiagnosticRelatedInformation(){return hs},get DiagnosticSeverity(){return Go},get DiagnosticTag(){return jo},get DocumentHighlight(){return nl},get DocumentHighlightKind(){return rl},get DocumentLink(){return pl},get DocumentSymbol(){return ll},get DocumentUri(){return Po},EOL:Ay,get FoldingRange(){return Fo},get FoldingRangeKind(){return Mo},get FormattingOptions(){return hl},get Hover(){return Qo},get InlayHint(){return Al},get InlayHintKind(){return gs},get InlayHintLabelPart(){return ys},get InlineCompletionContext(){return Nl},get InlineCompletionItem(){return Sl},get InlineCompletionList(){return wl},get InlineCompletionTriggerKind(){return kl},get InlineValueContext(){return El},get InlineValueEvaluatableExpression(){return $l},get InlineValueText(){return Rl},get InlineValueVariableLookup(){return vl},get InsertReplaceEdit(){return Ho},get InsertTextFormat(){return Vo},get InsertTextMode(){return Xo},get Location(){return Li},get LocationLink(){return Lo},get MarkedString(){return Fi},get MarkupContent(){return In},get MarkupKind(){return ms},get OptionalVersionedTextDocumentIdentifier(){return Mi},get ParameterInformation(){return el},get Position(){return Z},get Range(){return K},get RenameFile(){return Nn},get SelectedCompletionInfo(){return bl},get SelectionRange(){return ml},get SemanticTokenModifiers(){return yl},get SemanticTokenTypes(){return gl},get SemanticTokens(){return Tl},get SignatureInformation(){return tl},get StringValue(){return Cl},get SymbolInformation(){return sl},get SymbolKind(){return il},get SymbolTag(){return al},get TextDocument(){return Il},get TextDocumentEdit(){return Di},get TextDocumentIdentifier(){return Uo},get TextDocumentItem(){return Bo},get TextEdit(){return yt},get URI(){return fs},get VersionedTextDocumentIdentifier(){return qo},WorkspaceChange:Ey,get WorkspaceEdit(){return ps},get WorkspaceFolder(){return _l},get WorkspaceSymbol(){return ol},get integer(){return Oo},get uinteger(){retu
`;case"r":return"\r";case"t":return" ";case"v":return"\v";case"0":return"\0";default:return c}}function n(c){return c.charAt(0)==="^"?c.substring(1):c}t.convertID=n;function i(c){return parseInt(c)}t.convertInt=i;function a(c){return BigInt(c)}t.convertBigint=a;function s(c){return new Date(c)}t.convertDate=s;function o(c){return Number(c)}t.convertNumber=o;function l(c){return c.toLowerCase()==="true"}t.convertBoolean=l})(Dt||(Dt={}));var sr={},Aa={},ou;function Lr(){if(ou)return Aa;ou=1,Object.defineProperty(Aa,"__esModule",{value:!0});let t;function e(){if(t===void 0)throw new Error("No runtime abstraction layer installed");return t}return(function(r){function n(i){if(i===void 0)throw new Error("No runtime abstraction layer provided");t=i}r.install=n})(e||(e={})),Aa.default=e,Aa}var Pe={},lu;function Yi(){if(lu)return Pe;lu=1,Object.defineProperty(Pe,"__esModule",{value:!0}),Pe.stringArray=Pe.array=Pe.func=Pe.error=Pe.number=Pe.string=Pe.boolean=void 0;function t(o){return o===!0||o===!1}Pe.boolean=t;function e(o){return typeof o=="string"||o instanceof String}Pe.string=e;function r(o){return typeof o=="number"||o instanceof Number}Pe.number=r;function n(o){return o instanceof Error}Pe.error=n;function i(o){return typeof o=="function"}Pe.func=i;function a(o){return Array.isArray(o)}Pe.array=a;function s(o){return a(o)&&o.every(l=>e(l))}return Pe.stringArray=s,Pe}var or={},cu;function Mn(){if(cu)return or;cu=1,Object.defineProperty(or,"__esModule",{value:!0}),or.Emitter=or.Event=void 0;const t=Lr();var e;(function(i){const a={dispose(){}};i.None=function(){return a}})(e||(or.Event=e={}));class r{add(a,s=null,o){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(a),this._contexts.push(s),Array.isArray(o)&&o.push({dispose:()=>this.remove(a,s)})}remove(a,s=null){if(!this._callbacks)return;let o=!1;for(let l=0,c=this._callbacks.length;l<c;l++)if(this._callbacks[l]===a)if(this._contexts[l]===s){this._callbacks.splice(l,1),this._contexts.splice(l,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(...a){if(!this._callbacks)return[];const s=[],o=this._callbacks.slice(0),l=this._contexts.slice(0);for(let c=0,u=o.length;c<u;c++)try{s.push(o[c].apply(l[c],a))}catch(d){(0,t.default)().console.error(d)}return s}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}}class n{constructor(a){this._options=a}get event(){return this._event||(this._event=(a,s,o)=>{this._callbacks||(this._callbacks=new r),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(a,s);const l={dispose:()=>{this._callbacks&&(this._callbacks.remove(a,s),l.dispose=n._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(o)&&o.push(l),l}),this._event}fire(a){this._callbacks&&this._callbacks.invoke.call(this._callbacks,a)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}}return or.Emitter=n,n._noop=function(){},or}var uu;function Is(){if(uu)return sr;uu=1,Object.defineProperty(sr,"__esModule",{value:!0}),sr.CancellationTokenSource=sr.CancellationToken=void 0;const t=Lr(),e=Yi(),r=Mn();var n;(function(o){o.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:r.Event.None}),o.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:r.Event.None});function l(c){const u=c;return u&&(u===o.None||u===o.Cancelled||e.boolean(u.isCancellationRequested)&&!!u.onCancellationRequested)}o.is=l})(n||(sr.CancellationToken=n={}));const i=Object.freeze(function(o,l){const c=(0,t.default)().timer.setTimeout(o.bind(l),0);return{dispose(){c.dispose()}}});class a{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(d))}`));return}const p=parseInt(g);if(isNaN(p)){this.fireError(new Error(`Content-Length value must be a number. Got ${g}`));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 d=this.options.contentDecoder!==void 0?await this.options.contentDecoder.decode(u):u,g=await this.options.contentTypeDecoder.decode(d,this.options);this.callback(g)}).catch(d=>{this.fireError(d)})}}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((c,u)=>{this.partialMessageTimer=void 0,c===this.messageToken&&(this.firePartialMessage({messageToken:c,waitingTime:u}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}}return kt.ReadableStreamMessageReader=o,kt}var bt={},$u;function CT(){if($u)return bt;$u=1,Object.defineProperty(bt,"__esModule",{value:!0}),bt.WriteableStreamMessageWriter=bt.AbstractMessageWriter=bt.MessageWriter=void 0;const t=Lr(),e=Yi(),r=Vd(),n=Mn(),i="Content-Length: ",a=`\r
`;var s;(function(u){function d(g){let p=g;return p&&e.func(p.dispose)&&e.func(p.onClose)&&e.func(p.onError)&&e.func(p.write)}u.is=d})(s||(bt.MessageWriter=s={}));class o{constructor(){this.errorEmitter=new n.Emitter,this.closeEmitter=new n.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(d,g,p){this.errorEmitter.fire([this.asError(d),g,p])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(d){return d instanceof Error?d:new Error(`Writer received error. Reason: ${e.string(d.message)?d.message:"unknown"}`)}}bt.AbstractMessageWriter=o;var l;(function(u){function d(g){return g===void 0||typeof g=="string"?{charset:g??"utf-8",contentTypeEncoder:(0,t.default)().applicationJson.encoder}:{charset:g.charset??"utf-8",contentEncoder:g.contentEncoder,contentTypeEncoder:g.contentTypeEncoder??(0,t.default)().applicationJson.encoder}}u.fromOptions=d})(l||(l={}));class c extends o{constructor(d,g){super(),this.writable=d,this.options=l.fromOptions(g),this.errorCount=0,this.writeSemaphore=new r.Semaphore(1),this.writable.onError(p=>this.fireError(p)),this.writable.onClose(()=>this.fireClose())}async write(d){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(d,this.options).then(p=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(p):p).then(p=>{const $=[];return $.push(i,p.byteLength.toString(),a),$.push(a),this.doWrite(d,$,p)},p=>{throw this.fireError(p),p}))}async doWrite(d,g,p){try{return await this.writable.write(g.join(""),"ascii"),this.writable.write(p)}catch($){return this.handleError($,d),Promise.reject($)}}handleError(d,g){this.errorCount++,this.fireError(d,g,this.errorCount)}end(){this.writable.end()}}return bt.WriteableStreamMessageWriter=c,bt}var si={},Eu;function ST(){if(Eu)return si;Eu=1,Object.defineProperty(si,"__esModule",{value:!0}),si.AbstractMessageBuffer=void 0;const t=13,e=10,r=`\r
`;class n{constructor(a="utf-8"){this._encoding=a,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(a){const s=typeof a=="string"?this.fromString(a,this._encoding):a;this._chunks.push(s),this._totalLength+=s.byteLength}tryReadHeaders(a=!1){if(this._chunks.length===0)return;let s=0,o=0,l=0,c=0;e:for(;o<this._chunks.length;){const p=this._chunks[o];for(l=0;l<p.length;){switch(p[l]){case t:switch(s){case 0:s=1;break;case 2:s=3;break;default:s=0}break;case e:switch(s){case 1:s=2;break;case 3:s=4,l++;break e;default:s=0}break;default:s=0}l++}c+=p.byteLength,o++}if(s!==4)return;const u=this._read(c+l),d=new Map,g=this.toString(u,"ascii").split(r);if(g.length<2)return d;for(let p=0;p<g.length-2;p++){const $=g[p],_=$.indexOf(":");if(_===-1)throw new Error(`Message header must separate key and value using ':'
${$}`);const I=$.substr(0,_),C=$.substr(_+1).trim();d.set(a?I.toLowerCase():I,C)}return d}tryReadBody(a){if(!(this._totalLength<a))return this._read(a)}get numberOfBytes(){return this._totalLength}_read(a){if(a===0)return this.emptyBuffer();if(a>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===a){const c=this._chunks[0];return this._chunks.shift(),this._totalLength-=a,this.asNative(c)}if(this._chunks[0].byteLength>a){const c=this._chunks[0],u=this.asNative(c,a);return this._chunks[0]=c.slice(a),this._totalLength-=a,u}const s=this.allocNative(a);let o=0,l=0;for(;a>0;){const c=this._chunks[l];if(c.byteLength>a){const u=c.slice(0,a);s.set(u,o),o+=a,this._chunks[l]=c.slice(a),this._totalLength-=a,a-=a}else s.set(c,o),o+=c.byteLength,this._chunks.shift(),this._totalLength-=c.byteLength,a-=c.byteLength}return s}}return si.AbstractMessageBuffer=n,si}var Hs={},Au;function wT(){return Au||(Au=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=Lr(),r=Yi(),n=Bd(),i=Wd(),a=Mn(),s=Is();var o;(function(m){m.type=new n.NotificationType("$/cancelRequest")})(o||(o={}));var l;(function(m){function S(y){return typeof y=="string"||typeof y=="number"}m.is=S})(l||(t.ProgressToken=l={}));var c;(function(m){m.type=new n.NotificationType("$/progress")})(c||(c={}));class u{constructor(){}}t.ProgressType=u;var d;(function(m){function S(y){return r.func(y)}m.is=S})(d||(d={})),t.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var g;(function(m){m[m.Off=0]="Off",m[m.Messages=1]="Messages",m[m.Compact=2]="Compact",m[m.Verbose=3]="Verbose"})(g||(t.Trace=g={}));var p;(function(m){m.Off="off",m.Messages="messages",m.Compact="compact",m.Verbose="verbose"})(p||(t.TraceValues=p={})),(function(m){function S(R){if(!r.string(R))return m.Off;switch(R=R.toLowerCase(),R){case"off":return m.Off;case"messages":return m.Messages;case"compact":return m.Compact;case"verbose":return m.Verbose;default:return m.Off}}m.fromString=S;function y(R){switch(R){case m.Off:return"off";case m.Messages:return"messages";case m.Compact:return"compact";case m.Verbose:return"verbose";default:return"off"}}m.toString=y})(g||(t.Trace=g={}));var $;(function(m){m.Text="text",m.JSON="json"})($||(t.TraceFormat=$={})),(function(m){function S(y){return r.string(y)?(y=y.toLowerCase(),y==="json"?m.JSON:m.Text):m.Text}m.fromString=S})($||(t.TraceFormat=$={}));var _;(function(m){m.type=new n.NotificationType("$/setTrace")})(_||(t.SetTraceNotification=_={}));var I;(function(m){m.type=new n.NotificationType("$/logTrace")})(I||(t.LogTraceNotification=I={}));var C;(function(m){m[m.Closed=1]="Closed",m[m.Disposed=2]="Disposed",m[m.AlreadyListening=3]="AlreadyListening"})(C||(t.ConnectionErrors=C={}));class A extends Error{constructor(S,y){super(y),this.code=S,Object.setPrototypeOf(this,A.prototype)}}t.ConnectionError=A;var w;(function(m){function S(y){const R=y;return R&&r.func(R.cancelUndispatched)}m.is=S})(w||(t.ConnectionStrategy=w={}));var P;(function(m){function S(y){const R=y;return R&&(R.kind===void 0||R.kind==="id")&&r.func(R.createCancellationTokenSource)&&(R.dispose===void 0||r.func(R.dispose))}m.is=S})(P||(t.IdCancellationReceiverStrategy=P={}));var W;(function(m){function S(y){const R=y;return R&&R.kind==="request"&&r.func(R.createCancellationTokenSource)&&(R.dispose===void 0||r.func(R.dispose))}m.is=S})(W||(t.RequestCancellationReceiverStrategy=W={}));var B;(function(m){m.Message=Object.freeze({createCancellationTokenSource(y){return new s.CancellationTokenSource}});function S(y){return P.is(y)||W.is(y)}m.is=S})(B||(t.CancellationReceiverStrategy=B={}));var H;(function(m){m.Message=Object.free
${JSON.stringify(h.error,void 0,4)}`):E.error("Received response message without id. No further error information provided.");else{const k=h.id,O=ke.get(k);if(da(h,O),O!==void 0){ke.delete(k);try{if(h.error){const M=h.error;O.reject(new n.ResponseError(M.code,M.message,M.data))}else if(h.result!==void 0)O.resolve(h.result);else throw new Error("Should never happen.")}catch(M){M.message?E.error(`Response handler '${O.method}' failed with message: ${M.message}`):E.error(`Response handler '${O.method}' failed unexpectedly.`)}}}}function oa(h){if(At())return;let k,O;if(h.method===o.type.method){const M=h.params.id;Ie.delete(M),Dr(h);return}else{const M=Q.get(h.method);M&&(O=M.handler,k=M.type)}if(O||z)try{if(Dr(h),O)if(h.params===void 0)k!==void 0&&k.numberOfParams!==0&&k.parameterStructures!==n.ParameterStructures.byName&&E.error(`Notification ${h.method} defines ${k.numberOfParams} params but received none.`),O();else if(Array.isArray(h.params)){const M=h.params;h.method===c.type.method&&M.length===2&&l.is(M[0])?O({token:M[0],value:M[1]}):(k!==void 0&&(k.parameterStructures===n.ParameterStructures.byName&&E.error(`Notification ${h.method} defines parameters by name but received parameters by position`),k.numberOfParams!==h.params.length&&E.error(`Notification ${h.method} defines ${k.numberOfParams} params but received ${M.length} arguments`)),O(...M))}else k!==void 0&&k.parameterStructures===n.ParameterStructures.byPosition&&E.error(`Notification ${h.method} defines parameters by position but received parameters by name`),O(h.params);else z&&z(h.method,h.params)}catch(M){M.message?E.error(`Notification handler '${h.method}' failed with message: ${M.message}`):E.error(`Notification handler '${h.method}' failed unexpectedly.`)}else zn.fire(h)}function la(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 k=h;if(r.string(k.id)||r.number(k.id)){const O=k.id,M=ke.get(O);M&&M.reject(new Error("The received response has neither a result nor an error property."))}}function st(h){if(h!=null)switch(Y){case g.Verbose:return JSON.stringify(h,null,4);case g.Compact:return JSON.stringify(h);default:return}}function ca(h){if(!(Y===g.Off||!ge))if(Xe===$.Text){let k;(Y===g.Verbose||Y===g.Compact)&&h.params&&(k=`Params: ${st(h.params)}
`),ge.log(`Sending request '${h.method} - (${h.id})'.`,k)}else Ct("send-request",h)}function ua(h){if(!(Y===g.Off||!ge))if(Xe===$.Text){let k;(Y===g.Verbose||Y===g.Compact)&&(h.params?k=`Params: ${st(h.params)}
`:k=`No parameters provided.
`),ge.log(`Sending notification '${h.method}'.`,k)}else Ct("send-notification",h)}function ir(h,k,O){if(!(Y===g.Off||!ge))if(Xe===$.Text){let M;(Y===g.Verbose||Y===g.Compact)&&(h.error&&h.error.data?M=`Error data: ${st(h.error.data)}
`:h.result?M=`Result: ${st(h.result)}
`:h.error===void 0&&(M=`No result returned.
`)),ge.log(`Sending response '${k} - (${h.id})'. Processing request took ${Date.now()-O}ms`,M)}else Ct("send-response",h)}function fa(h){if(!(Y===g.Off||!ge))if(Xe===$.Text){let k;(Y===g.Verbose||Y===g.Compact)&&h.params&&(k=`Params: ${st(h.params)}
`),ge.log(`Received request '${h.method} - (${h.id})'.`,k)}else Ct("receive-request",h)}function Dr(h){if(!(Y===g.Off||!ge||h.method===I.type.method))if(Xe===$.Text){let k;(Y===g.Verbose||Y===g.Compact)&&(h.params?k=`Params: ${st(h.params)}
`:k=`No parameters provided.
`),ge.log(`Received notification '${h.method}'.`,k)}else Ct("receive-notification",h)}function da(h,k){if(!(Y===g.Off||!ge))if(Xe===$.Text){let O;if((Y===g.Verbose||Y===g.Compact)&&(h.error&&h.error.data?O=`Error data: ${st(h.error.data)}
`:h.result?O=`Result: ${st(h.result)}
`:h.error===void 0&&(O=`No result returned.
`)),k){const M=h.error?` Request failed: ${h.error.message} (${h.error.code}).`:"";ge.log(`Received response '${k.method} - (${h.id})' in ${Date.now()-k.timerStart}ms.${M}`,O)}else ge.log(`Received response ${h.id} without active response promise.`,O)}else Ct("receive-response",h)}function Ct(h,k){if(!ge||Y===g.Off)return;const O={isLSPMessage:!0,type:h,message:k,timestamp:Date.now()};ge.log(O)}function Yt(){if(Vn())throw new A(C.Closed,"Connection is closed.");if(At())throw new A(C.Disposed,"Connection is disposed.")}function ha(){if(Wn())throw new A(C.AlreadyListening,"Connection is already listening")}function pa(){if(!Wn())throw new Error("Call listen() first.")}function Jt(h){return h===void 0?null:h}function Yn(h){if(h!==null)return h}function f(h){return h!=null&&!Array.isArray(h)&&typeof h=="object"}function ve(h,k){switch(h){case n.ParameterStructures.auto:return f(k)?Yn(k):[Jt(k)];case n.ParameterStructures.byName:if(!f(k))throw new Error("Received parameters by name but param is not an object literal.");return Yn(k);case n.ParameterStructures.byPosition:return[Jt(k)];default:throw new Error(`Unknown parameter structure ${h.toString()}`)}}function $e(h,k){let O;const M=h.numberOfParams;switch(M){case 0:O=void 0;break;case 1:O=ve(h.parameterStructures,k[0]);break;default:O=[];for(let ie=0;ie<k.length&&ie<M;ie++)O.push(Jt(k[ie]));if(k.length<M)for(let ie=k.length;ie<M;ie++)O.push(null);break}return O}const q={sendNotification:(h,...k)=>{Yt();let O,M;if(r.string(h)){O=h;const re=k[0];let ye=0,Ee=n.ParameterStructures.auto;n.ParameterStructures.is(re)&&(ye=1,Ee=re);let X=k.length;const ce=X-ye;switch(ce){case 0:M=void 0;break;case 1:M=ve(Ee,k[ye]);break;default:if(Ee===n.ParameterStructures.byName)throw new Error(`Received ${ce} parameters for 'by Name' notification parameter structure.`);M=k.slice(ye,X).map(ee=>Jt(ee));break}}else{const re=k;O=h.method,M=$e(h,re)}const ie={jsonrpc:j,method:O,params:M};return ua(ie),S.write(ie).catch(re=>{throw E.error("Sending notification failed."),re})},onNotification:(h,k)=>{Yt();let O;return r.func(h)?z=h:k&&(r.string(h)?(O=h,Q.set(h,{type:void 0,handler:k})):(O=h.method,Q.set(h.method,{type:h,handler:k}))),{dispose:()=>{O!==void 0?Q.delete(O):z=void 0}}},onProgress:(h,k,O)=>{if(_e.has(k))throw new Error(`Progress handler for token ${k} already registered`);return _e.set(k,O),{dispose:()=>{_e.delete(k)}}},sendProgress:(h,k,O)=>q.sendNotification(c.type,{token:k,value:O}),onUnhandledProgress:Un.event,sendRequest:(h,...k)=>{Yt(),pa();let O,M,ie;if(r.string(h)){O=h;const X=k[0],ce=k[k.length-1];let ee=0,be=n.ParameterStructures.auto;n.ParameterStructures.is(X)&&(ee=1,be=X);let Ge=k.length;s.CancellationToken.is(ce)&&(Ge=Ge-1,ie=ce);const dt=Ge-ee;switch(dt){case 0:M=void 0;break;case 1:M=ve(be,k[ee]);break;default:if(be===n.ParameterStructures.byName)throw new Error(`Received ${dt} parameters for 'by Name' request parameter structure.`);M=k.slice(ee,Ge).map(vh=>Jt(vh));break}}else{const X=k;O=h.method,M=$e(h,X);const ce=h.numberOfParams;ie=s.CancellationToken.is(X[ce])?X[ce]:void 0}const re=L++;let ye;ie&&(ye=ie.onCancellationRequested(()=>{const X=at.sender.sendCancellation(q,re);return X===void 0?(E.log(`Received no promise from cancellation strategy when cancelling id ${re}`),Promise.resolve()):X.catch(()=>{E.log(`Sending cancellation messages for id ${re} failed`)})}));const Ee={jsonrpc:j,id:re,method:O,params:M};return ca(Ee),typeof at.sender.enableCancellation=="function"&&at.sender.enableCancellation(Ee),new Promise(async(X,ce)=>{const ee=dt=>{X(dt),at.sender.cleanup(re),ye?.dispose()},be=dt=>{ce(dt),at.sender.cleanup(re),ye?.dispose()},Ge={method:O,timerStart:Date.now(),resolve:ee,reject:be};try{await S.write(Ee),ke.set(re,Ge)}catch(dt){throw E.error("Sending request failed."),Ge.reject(new n.ResponseError(n.ErrorCodes.MessageWriteError,dt.message?dt.message:"Unknown reason")),dt}})},onRequest:(h,k)=>{Yt();let O=null;return d.is(h)?(O=void 0,F=h):r.string(h)?(O=null,k!==void 0&&(O=h,te.set(h,{handler:k,type:void 0}))):k!==void 0&&(O=h.method,te.set(h.method,{type:h,handl
${r}`),this.inline?`{${e}}`:e}toMarkdown(e){return e?.renderTag?.(this)??this.toMarkdownDefault(e)}toMarkdownDefault(e){const r=this.content.toMarkdown(e);if(this.inline){const a=TR(this.name,r,e??{});if(typeof a=="string")return a}let n="";e?.tag==="italic"||e?.tag===void 0?n="*":e?.tag==="bold"?n="**":e?.tag==="bold-italic"&&(n="***");let i=`${n}@${this.name}${n}`;return this.content.inlines.length===1?i=`${i} ${r}`:this.content.inlines.length>1&&(i=`${i}
${r}`),this.inline?`{${i}}`:i}}function TR(t,e,r){if(t==="linkplain"||t==="linkcode"||t==="link"){const n=e.indexOf(" ");let i=e;if(n>0){const s=Gl(e,n);i=e.substring(s),e=e.substring(0,n)}return(t==="linkcode"||t==="link"&&r.link==="code")&&(i=`\`${i}\``),r.renderLink?.(e,i)??RR(e,i)}}function RR(t,e){try{return ft.parse(t,!0),`[${e}](${t})`}catch{return t}}class jl{constructor(e,r){this.inlines=e,this.range=r}toString(){let e="";for(let r=0;r<this.inlines.length;r++){const n=this.inlines[r],i=this.inlines[r+1];e+=n.toString(),i&&i.range.start.line>n.range.start.line&&(e+=`
`)}return e}toMarkdown(e){let r="";for(let n=0;n<this.inlines.length;n++){const i=this.inlines[n],a=this.inlines[n+1];r+=i.toMarkdown(e),a&&a.range.start.line>i.range.start.line&&(r+=`
`)}return r}}class Zd{constructor(e,r){this.text=e,this.range=r}toString(){return this.text}toMarkdown(){return this.text}}function sf(t){return t.endsWith(`
`)?`
`:`
`}class vR{constructor(e){this.indexManager=e.shared.workspace.IndexManager,this.commentProvider=e.documentation.CommentProvider}getDocumentation(e){const r=this.commentProvider.getComment(e);if(r&&oR(r))return sR(r).toMarkdown({renderLink:(i,a)=>this.documentationLinkRenderer(e,i,a),renderTag:i=>this.documentationTagRenderer(e,i)})}documentationLinkRenderer(e,r,n){const i=this.findNameInLocalSymbols(e,r)??this.findNameInGlobalScope(e,r);if(i&&i.nameSegment){const a=i.nameSegment.range.start.line+1,s=i.nameSegment.range.start.character+1,o=i.documentUri.with({fragment:`L${a},${s}`});return`[${n}](${o.toString()})`}else return}documentationTagRenderer(e,r){}findNameInLocalSymbols(e,r){const i=jt(e).localSymbols;if(!i)return;let a=e;do{const o=i.getStream(a).find(l=>l.name===r);if(o)return o;a=a.$container}while(a)}findNameInGlobalScope(e,r){return this.indexManager.allElements().find(i=>i.name===r)}}class $R{constructor(e){this.grammarConfig=()=>e.parser.GrammarConfig}getComment(e){return lT(e)?e.$comment:np(e.$cstNode,this.grammarConfig().multilineCommentRules)?.text}}class ER{constructor(e){this.syncParser=e.parser.LangiumParser}parse(e,r){return Promise.resolve(this.syncParser.parse(e))}}class AR{constructor(){this.previousTokenSource=new he.CancellationTokenSource,this.writeQueue=[],this.readQueue=[],this.done=!0}write(e){this.cancelWrite();const r=Ky();return this.previousTokenSource=r,this.enqueue(this.writeQueue,e,r.token)}read(e){return this.enqueue(this.readQueue,e)}enqueue(e,r,n=he.CancellationToken.None){const i=new gc,a={action:r,deferred:i,cancellationToken:n};return e.push(a),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:r,deferred:n,cancellationToken:i})=>{try{const a=await Promise.resolve().then(()=>r(i));n.resolve(a)}catch(a){Ps(a)?n.resolve(void 0):n.reject(a)}})),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.cancel()}}class CR{constructor(e){this.grammarElementIdMap=new du,this.tokenTypeIdMap=new du,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(r=>({...r,message:r.message})),value:this.dehydrateAstNode(e.value,this.createDehyrationContext(e.value))}}dehydrateLexerReport(e){return e}createDehyrationContext(e){const r=new Map,n=new Map;for(const i of zt(e))r.set(i,{});if(e.$cstNode)for(const i of Ro(e.$cstNode))n.set(i,{});return{astNodes:r,cstNodes:n}}dehydrateAstNode(e,r){const n=r.astNodes.get(e);n.$type=e.$type,n.$containerIndex=e.$containerIndex,n.$containerProperty=e.$containerProperty,e.$cstNode!==void 0&&(n.$cstNode=this.dehydrateCstNode(e.$cstNode,r));for(const[i,a]of Object.entries(e))if(!i.startsWith("$"))if(Array.isArray(a)){const s=[];n[i]=s;for(const o of a)Fe(o)?s.push(this.dehydrateAstNode(o,r)):ut(o)?s.push(this.dehydrateReference(o,r)):s.push(o)}else Fe(a)?n[i]=this.dehydrateAstNode(a,r):ut(a)?n[i]=this.dehydrateReference(a,r):a!==void 0&&(n[i]=a);return n}dehydrateReference(e,r){const n={};return n.$refText=e.$refText,e.$refNode&&(n.$refNode=r.cstNodes.get(e.$refNode)),n}dehydrateCstNode(e,r){const n=r.cstNodes.get(e);return Cf(e)?n.fullText=e.fullText:n.grammarSource=this.getGrammarElementId(e.grammarSource),n.hidden=e.hidden,n.astNode=r.astNodes.get(e.astNode),Ii(e)?n.content=e.content.map(i=>this.dehydrateCstNode(i,r)):Af(e)&&(n.tokenType=e.tokenType.name,n.offset=e.offset,n.length=e.length,n.startLine=e.range.start.line,n.startColumn=e.range.start.character,n.endLine=e.range.end.line,n.endColumn=e.range.end.character),n}hydrate(e){const r=e.value,n=this.createHydrationContext(r);return"$cstNode"in r&&this.hydrateCstNode(r.$cstNode,n),{lexerErrors:e.lexerErrors,lexerReport:e.lexerReport,parserErrors:e.par
`)}}},N(on,"AbstractMermaidValueConverter"),on),ln,Os=(ln=class extends Gn{runCustomConverter(e,r,n){}},N(ln,"CommonValueConverter"),ln),cn,Xt=(cn=class extends Fd{constructor(e){super(),this.keywords=new Set(e)}buildKeywordTokens(e,r,n){const i=super.buildKeywordTokens(e,r,n);return i.forEach(a=>{this.keywords.has(a.name)&&a.PATTERN!==void 0&&(a.PATTERN=new RegExp(a.PATTERN.toString()+"(?:(?=%%)|(?!\\S))"))}),i}},N(cn,"AbstractMermaidTokenBuilder"),cn),un;un=class extends Xt{},N(un,"CommonTokenBuilder");var fn,vv=(fn=class extends Xt{constructor(){super(["treemap"])}},N(fn,"TreemapTokenBuilder"),fn),$v=/classDef\s+([A-Z_a-z]\w+)(?:\s+([^\n\r;]*))?;?/,dn,Ev=(dn=class extends Gn{runCustomConverter(e,r,n){if(e.name==="NUMBER2")return parseFloat(r.replace(/,/g,""));if(e.name==="SEPARATOR")return r.substring(1,r.length-1);if(e.name==="STRING2")return r.substring(1,r.length-1);if(e.name==="INDENTATION")return r.length;if(e.name==="ClassDef"){if(typeof r!="string")return r;const i=$v.exec(r);if(i)return{$type:"ClassDefStatement",className:i[1],styleText:i[2]||void 0}}}},N(dn,"TreemapValueConverter"),dn);function th(t){const e=t.validation.TreemapValidator,r=t.validation.ValidationRegistry;if(r){const n={Treemap:e.checkSingleRoot.bind(e)};r.register(n,e)}}N(th,"registerValidationChecks");var hn,Av=(hn=class{checkSingleRoot(e,r){let n;for(const i of e.TreemapRows)i.item&&(n===void 0&&i.indent===void 0?n=0:i.indent===void 0?r("error","Multiple root nodes are not allowed in a treemap.",{node:i,property:"item"}):n!==void 0&&n>=parseInt(i.indent,10)&&r("error","Multiple root nodes are not allowed in a treemap.",{node:i,property:"item"}))}},N(hn,"TreemapValidator"),hn),rh={parser:{TokenBuilder:N(()=>new vv,"TokenBuilder"),ValueConverter:N(()=>new Ev,"ValueConverter")},validation:{TreemapValidator:N(()=>new Av,"TreemapValidator")}};function nh(t=Et){const e=we($t(t),Ht),r=we(vt({shared:e}),hv,rh);return e.ServiceRegistry.register(r),th(r),{shared:e,Treemap:r}}N(nh,"createTreemapServices");var pn,Cv=(pn=class extends Gn{runCustomConverter(e,r,n){switch(e.name.toUpperCase()){case"LINK_LABEL":return r.substring(1).trim();default:return}}},N(pn,"WardleyValueConverter"),pn),ih={parser:{ValueConverter:N(()=>new Cv,"ValueConverter")}};function ah(t=Et){const e=we($t(t),Ht),r=we(vt({shared:e}),mv,ih);return e.ServiceRegistry.register(r),{shared:e,Wardley:r}}N(ah,"createWardleyServices");var mn,Sv=(mn=class extends Xt{constructor(){super(["gitGraph"])}},N(mn,"GitGraphTokenBuilder"),mn),sh={parser:{TokenBuilder:N(()=>new Sv,"TokenBuilder"),ValueConverter:N(()=>new Os,"ValueConverter")}};function oh(t=Et){const e=we($t(t),Ht),r=we(vt({shared:e}),lv,sh);return e.ServiceRegistry.register(r),{shared:e,GitGraph:r}}N(oh,"createGitGraphServices");var gn,wv=(gn=class extends Xt{constructor(){super(["info","showInfo"])}},N(gn,"InfoTokenBuilder"),gn),lh={parser:{TokenBuilder:N(()=>new wv,"TokenBuilder"),ValueConverter:N(()=>new Os,"ValueConverter")}};function ch(t=Et){const e=we($t(t),Ht),r=we(vt({shared:e}),cv,lh);return e.ServiceRegistry.register(r),{shared:e,Info:r}}N(ch,"createInfoServices");var yn,kv=(yn=class extends Xt{constructor(){super(["packet"])}},N(yn,"PacketTokenBuilder"),yn),uh={parser:{TokenBuilder:N(()=>new kv,"TokenBuilder"),ValueConverter:N(()=>new Os,"ValueConverter")}};function fh(t=Et){const e=we($t(t),Ht),r=we(vt({shared:e}),uv,uh);return e.ServiceRegistry.register(r),{shared:e,Packet:r}}N(fh,"createPacketServices");var Tn,bv=(Tn=class extends Xt{constructor(){super(["pie","showData"])}},N(Tn,"PieTokenBuilder"),Tn),Rn,Nv=(Rn=class extends Gn{runCustomConverter(e,r,n){if(e.name==="PIE_SECTION_LABEL")return r.replace(/"/g,"").trim()}},N(Rn,"PieValueConverter"),Rn),dh={parser:{TokenBuilder:N(()=>new bv,"TokenBuilder"),ValueConverter:N(()=>new Nv,"ValueConverter")}};function hh(t=Et){const e=we($t(t),Ht),r=we(vt({shared:e}),fv,dh);return e.ServiceRegistry.register(r),{shared:e,Pie:r}}N(hh,"createPieServices");var vn,_v=(vn=class extends Gn{runCustomConverter(e,r,n){if(e.name==="INDENTATION")return r?.length||0;if(e.name==="STRING2")re
`),n=e.parserErrors.map(i=>{const a=i.token.startLine!==void 0&&!isNaN(i.token.startLine)?i.token.startLine:"?",s=i.token.startColumn!==void 0&&!isNaN(i.token.startColumn)?i.token.startColumn:"?";return`Parse error on line ${a}, column ${s}: ${i.message}`}).join(`
`);super(`Parsing failed: ${r} ${n}`),this.result=e}},N(Sn,"MermaidParseError"),Sn);const Fv=Object.freeze(Object.defineProperty({__proto__:null,InfoModule:lh,createInfoServices:ch},Symbol.toStringTag,{value:"Module"})),Gv=Object.freeze(Object.defineProperty({__proto__:null,PacketModule:uh,createPacketServices:fh},Symbol.toStringTag,{value:"Module"})),jv=Object.freeze(Object.defineProperty({__proto__:null,PieModule:dh,createPieServices:hh},Symbol.toStringTag,{value:"Module"})),zv=Object.freeze(Object.defineProperty({__proto__:null,TreeViewModule:ph,createTreeViewServices:mh},Symbol.toStringTag,{value:"Module"})),Uv=Object.freeze(Object.defineProperty({__proto__:null,ArchitectureModule:gh,createArchitectureServices:yh},Symbol.toStringTag,{value:"Module"})),qv=Object.freeze(Object.defineProperty({__proto__:null,GitGraphModule:sh,createGitGraphServices:oh},Symbol.toStringTag,{value:"Module"})),Bv=Object.freeze(Object.defineProperty({__proto__:null,RadarModule:Th,createRadarServices:Rh},Symbol.toStringTag,{value:"Module"})),Wv=Object.freeze(Object.defineProperty({__proto__:null,TreemapModule:rh,createTreemapServices:nh},Symbol.toStringTag,{value:"Module"})),Vv=Object.freeze(Object.defineProperty({__proto__:null,WardleyModule:ih,createWardleyServices:ah},Symbol.toStringTag,{value:"Module"}));export{Dv as p};