163 lines
442 KiB
JavaScript
163 lines
442 KiB
JavaScript
|
|
var Ah=Object.defineProperty;var Sh=(t,e,n)=>e in t?Ah(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var ln=(t,e,n)=>Sh(t,typeof e!="symbol"?e+"":e,n);import{bz as M,eC as gt,dc as yt,au as zi,av as tn,at as Xn,ax as ae,ai as je,eU as Fe,db as Ch,eE as jn,fD as lt,eS as kh,gg as Nh,cs as An}from"./chat-lF43mH4P.js";import{t as ut,p as wt,i as dt,d as nn,s as Sd,q as Ze,o as Ct,g as Ge,u as tl,e as ns,r as _a,l as Nl,f as Ia,k as Nt,h as ji,m as wh,j as bh}from"./uniqBy-BL6QTq6i.js";import{a as q,v as $e,r as Xe,f as ft}from"./reduce-CrPWPI9x.js";import{f as zr,h as j,d as nl,m as _h}from"./min-DqkSbwPh.js";function Be(t){return typeof t=="object"&&t!==null&&typeof t.$type=="string"}function St(t){return typeof t=="object"&&t!==null&&typeof t.$refText=="string"&&"ref"in t}function dn(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 di(t){return typeof t=="object"&&t!==null&&typeof t.info=="object"&&typeof t.message=="string"}class Cd{constructor(){this.subtypes={},this.allSubtypes={}}getAllTypes(){return Object.keys(this.types)}getReferenceType(e){var i;const n=this.types[e.container.$type];if(!n)throw new Error(`Type ${e.container.$type||"undefined"} not found.`);const r=(i=n.properties[e.property])==null?void 0:i.referenceType;if(!r)throw new Error(`Property ${e.property||"undefined"} of type ${e.container.$type} is not a reference.`);return r}getTypeMetaData(e){const n=this.types[e];return n||{name:e,properties:{},superTypes:[]}}isInstance(e,n){return Be(e)&&this.isSubtype(e.$type,n)}isSubtype(e,n){if(e===n)return!0;let r=this.subtypes[e];r||(r=this.subtypes[e]={});const i=r[n];if(i!==void 0)return i;{const s=this.types[e],a=s?s.superTypes.some(o=>this.isSubtype(o,n)):!1;return r[n]=a,a}}getAllSubTypes(e){const n=this.allSubtypes[e];if(n)return n;{const r=this.getAllTypes(),i=[];for(const s of r)this.isSubtype(s,e)&&i.push(s);return this.allSubtypes[e]=i,i}}}function Bi(t){return typeof t=="object"&&t!==null&&Array.isArray(t.content)}function kd(t){return typeof t=="object"&&t!==null&&typeof t.tokenType=="object"}function Nd(t){return Bi(t)&&typeof t.fullText=="string"}class Ue{constructor(e,n){this.startFn=e,this.nextFn=n}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 n=0,r=e.next();for(;!r.done;)n++,r=e.next();return n}toArray(){const e=[],n=this.iterator();let r;do r=n.next(),r.value!==void 0&&e.push(r.value);while(!r.done);return e}toSet(){return new Set(this)}toMap(e,n){const r=this.map(i=>[e?e(i):i,n?n(i):i]);return new Map(r)}toString(){return this.join()}concat(e){return new Ue(()=>({first:this.startFn(),firstDone:!1,iterator:e[Symbol.iterator]()}),n=>{let r;if(!n.firstDone){do if(r=this.nextFn(n.first),!r.done)return r;while(!r.done);n.firstDone=!0}do if(r=n.iterator.next(),!r.done)return r;while(!r.done);return ot})}join(e=","){const n=this.iterator();let r="",i,s=!1;do i=n.next(),i.done||(s&&(r+=e),r+=Ph(i.value)),s=!0;while(!i.done);return r}indexOf(e,n=0){const r=this.iterator();let i=0,s=r.next();for(;!s.done;){if(i>=n&&s.value===e)return i;s=r.next(),i++}return-1}every(e){const n=this.iterator();let r=n.next();for(;!r.done;){if(!e(r.value))return!1;r=n.next()}return!0}some(e){const n=this.iterator();let r=n.next();for(;!r.done;){if(e(r.value))return!0;r=n.next()}return!1}forEach(e){const n=this.iterator();let r=0,i=n.next();for(;!i.done;)e(i.value,r),i=n.next(),r++}map(e){return new Ue(this.startFn,n=>{const{done:r,value:i}=this.nextFn(n);return r?ot:{done:!1,value:e(i)}})}filter(e){return new Ue(this.startFn,n=>{let r;do if(r=this.nextFn(n),!r.done&&e(r.value))return r;while(!r.done);return ot})}nonNullable(){return this.filter(e=>e!=null)}reduce(e,n){const r=this.iterator();let i=n,s=r.next();for(;!s.done;)i===void 0?i=s.value:i=e(i,s.value
|
|||
|
|
`),W("\r"),W(" "),W("\v"),W(" "),W(" "),W(" "),W(" "),W(" "),W(" "),W(" "),W(" "),W(" "),W(" "),W(" "),W(" "),W(" "),W(" "),W("\u2028"),W("\u2029"),W(" "),W(" "),W(" "),W("\uFEFF")],sp=/[0-9a-fA-F]/,Ls=/[0-9]/,ap=/[1-9]/;class Od{constructor(){this.idx=0,this.input="",this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar("/");const n=this.disjunction();this.consumeChar("/");const r={type:"Flags",loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":mi(r,"global");break;case"i":mi(r,"ignoreCase");break;case"m":mi(r,"multiLine");break;case"u":mi(r,"unicode");break;case"y":mi(r,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:r,value:n,loc:this.loc(0)}}disjunction(){const e=[],n=this.idx;for(e.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(n)}}alternative(){const e=[],n=this.idx;for(;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(n)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){const e=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(e)};case"$":return{type:"EndAnchor",loc:this.loc(e)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(e)};case"B":return{type:"NonWordBoundary",loc:this.loc(e)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");let n;switch(this.popChar()){case"=":n="Lookahead";break;case"!":n="NegativeLookahead";break;case"<":{switch(this.popChar()){case"=":n="Lookbehind";break;case"!":n="NegativeLookbehind"}break}}ir(n);const r=this.disjunction();return this.consumeChar(")"),{type:n,value:r,loc:this.loc(e)}}return ip()}quantifier(e=!1){let n;const r=this.idx;switch(this.popChar()){case"*":n={atLeast:0,atMost:1/0};break;case"+":n={atLeast:1,atMost:1/0};break;case"?":n={atLeast:0,atMost:1};break;case"{":const i=this.integerIncludingZero();switch(this.popChar()){case"}":n={atLeast:i,atMost:i};break;case",":let s;this.isDigit()?(s=this.integerIncludingZero(),n={atLeast:i,atMost:s}):n={atLeast:i,atMost:1/0},this.consumeChar("}");break}if(e===!0&&n===void 0)return;ir(n);break}if(!(e===!0&&n===void 0)&&ir(n))return this.peekChar(0)==="?"?(this.consumeChar("?"),n.greedy=!1):n.greedy=!0,n.type="Quantifier",n.loc=this.loc(r),n}atom(){let e;const n=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group();break}if(e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),ir(e))return e.loc=this.loc(n),this.isQuantifier()&&(e.quantifier=this.quantifier()),e}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[W(`
|
|||
|
|
`),W("\r"),W("\u2028"),W("\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,n=!1;switch(this.popChar()){case"d":e=ua;break;case"D":e=ua,n=!0;break;case"s":e=Fl;break;case"S":e=Fl,n=!0;break;case"w":e=da;break;case"W":e=da,n=!0;break}if(ir(e))return{type:"Set",value:e,complement:n}}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=W("\f");break;case"n":e=W(`
|
|||
|
|
`);break;case"r":e=W("\r");break;case"t":e=W(" ");break;case"v":e=W("\v");break}if(ir(e))return{type:"Character",value:e}}controlLetterEscapeAtom(){this.consumeChar("c");const e=this.popChar();if(/[a-zA-Z]/.test(e)===!1)throw Error("Invalid ");return{type:"Character",value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:W("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){const e=this.popChar();return{type:"Character",value:W(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case`
|
|||
|
|
`:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:const e=this.popChar();return{type:"Character",value:W(e)}}}characterClass(){const e=[];let n=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),n=!0);this.isClassAtom();){const r=this.classAtom();if(r.type,Ml(r)&&this.isRangeDash()){this.consumeChar("-");const i=this.classAtom();if(i.type,Ml(i)){if(i.value<r.value)throw Error("Range out of order in character class");e.push({from:r.value,to:i.value})}else Ya(r.value,e),e.push(W("-")),Ya(i.value,e)}else Ya(r.value,e)}return this.consumeChar("]"),{type:"Set",complement:n,value:e}}classAtom(){switch(this.peekChar()){case"]":case`
|
|||
|
|
`:case"\r":case"\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:W("\b")};case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}group(){let e=!0;switch(this.consumeChar("("),this.peekChar(0)){case"?":this.consumeChar("?"),this.consumeChar(":"),e=!1;break;default:this.groupIdx++;break}const n=this.disjunction();this.consumeChar(")");const r={type:"Group",capturing:e,value:n};return e&&(r.idx=this.groupIdx),r}positiveInteger(){let e=this.popChar();if(ap.test(e)===!1)throw Error("Expecting a positive integer");for(;Ls.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(Ls.test(e)===!1)throw Error("Expecting an integer");for(;Ls.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){const e=this.popChar();switch(e){case`
|
|||
|
|
`:case"\r":case"\u2028":case"\u2029":case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":throw Error("TBD");default:return{type:"Character",value:W(e)}}}isRegExpFlag(){switch(this.peekChar(0)){case"g":case"i":case"m":case"u":case"y":return!0;default:return!1}}isRangeDash(){return this.peekChar()==="-"&&this.isClassAtom(1)}isDigit(){return Ls.test(this.peekChar(0))}isClassAtom(e=0){switch(this.peekChar(e)){case"]":case`
|
|||
|
|
`:case"\r":case"\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 n="";for(let i=0;i<e;i++){const s=this.popChar();if(sp.test(s)===!1)throw Error("Expecting a HexDecimal digits");n+=s}return{type:"Character",value:parseInt(n,16)}}peekChar(e=0){return this.input[this.idx+e]}popChar(){const e=this.peekChar(0);return this.consumeChar(void 0),e}consumeChar(e){if(e!==void 0&&this.input[this.idx]!==e)throw Error("Expected: '"+e+"' but found: '"+this.input[this.idx]+"' at offset: "+this.idx);if(this.idx>=this.input.length)throw Error("Unexpected end of input");this.idx++}loc(e){return{begin:e,end:this.idx}}}class Oa{visitChildren(e){for(const n in e){const r=e[n];e.hasOwnProperty(n)&&(r.type!==void 0?this.visit(r):Array.isArray(r)&&r.forEach(i=>{this.visit(i)},this))}}visit(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"Lookbehind":this.visitLookbehind(e);break;case"NegativeLookbehind":this.visitNegativeLookbehind(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e);break}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitLookbehind(e){}visitNegativeLookbehind(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}}const op=/\r?\n/gm,cp=new Od;class lp extends Oa{constructor(){super(...arguments),this.isStarting=!0,this.endRegexpStack=[],this.multiline=!1}get endRegex(){return this.endRegexpStack.join("")}reset(e){this.multiline=!1,this.regex=e,this.startRegexp="",this.isStarting=!0,this.endRegexpStack=[]}visitGroup(e){e.quantifier&&(this.isStarting=!1,this.endRegexpStack=[])}visitCharacter(e){const n=String.fromCharCode(e.value);if(!this.multiline&&n===`
|
|||
|
|
`&&(this.multiline=!0),e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{const r=xa(n);this.endRegexpStack.push(r),this.isStarting&&(this.startRegexp+=r)}}visitSet(e){if(!this.multiline){const n=this.regex.substring(e.loc.begin,e.loc.end),r=new RegExp(n);this.multiline=!!`
|
|||
|
|
`.match(r)}if(e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{const n=this.regex.substring(e.loc.begin,e.loc.end);this.endRegexpStack.push(n),this.isStarting&&(this.startRegexp+=n)}}visitChildren(e){e.type==="Group"&&e.quantifier||super.visitChildren(e)}}const Xa=new lp;function up(t){try{return typeof t=="string"&&(t=new RegExp(t)),t=t.toString(),Xa.reset(t),Xa.visit(cp.pattern(t)),Xa.multiline}catch{return!1}}const dp=`\f
|
|||
|
|
\r \v \u2028\u2029 \uFEFF`.split("");function xd(t){const e=typeof t=="string"?new RegExp(t):t;return dp.some(n=>e.test(n))}function xa(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function fp(t,e){const n=hp(t),r=e.match(n);return!!r&&r[0].length>0}function hp(t){typeof t=="string"&&(t=new RegExp(t));const e=t,n=t.source;let r=0;function i(){let s="",a;function o(l){s+=n.substr(r,l),r+=l}function c(l){s+="(?:"+n.substr(r,l)+"|$)",r+=l}for(;r<n.length;)switch(n[r]){case"\\":switch(n[r+1]){case"c":c(3);break;case"x":c(4);break;case"u":e.unicode?n[r+2]==="{"?c(n.indexOf("}",r)-r+1):c(6):c(2);break;case"p":case"P":e.unicode?c(n.indexOf("}",r)-r+1):c(2);break;case"k":c(n.indexOf(">",r)-r+1);break;default:c(2);break}break;case"[":a=/\[(?:\\.|.)*?\]/g,a.lastIndex=r,a=a.exec(n)||[],c(a[0].length);break;case"|":case"^":case"$":case"*":case"+":case"?":o(1);break;case"{":a=/\{\d+,?\d*\}/g,a.lastIndex=r,a=a.exec(n),a?o(a[0].length):c(1);break;case"(":if(n[r+1]==="?")switch(n[r+2]){case":":s+="(?:",r+=3,s+=i()+"|$)";break;case"=":s+="(?=",r+=3,s+=i()+")";break;case"!":a=r,r+=3,i(),s+=n.substr(a,r-a);break;case"<":switch(n[r+3]){case"=":case"!":a=r,r+=4,i(),s+=n.substr(a,r-a);break;default:o(n.indexOf(">",r)-r+1),s+=i()+"|$)";break}break}else o(1),s+=i()+"|$)";break;case")":return++r,s;default:c(1);break}return s}return new RegExp(i(),t.flags)}function pp(t){return t.rules.find(e=>sn(e)&&e.entry)}function mp(t){return t.rules.filter(e=>an(e)&&e.hidden)}function Dd(t,e){const n=new Set,r=pp(t);if(!r)return new Set(t.rules);const i=[r].concat(mp(t));for(const a of i)Md(a,n,e);const s=new Set;for(const a of t.rules)(n.has(a.name)||an(a)&&a.hidden)&&s.add(a);return s}function Md(t,e,n){e.add(t.name),rs(t).forEach(r=>{if(Vn(r)||n){const i=r.rule.ref;i&&!e.has(i.name)&&Md(i,e,n)}})}function gp(t){if(t.terminal)return t.terminal;if(t.type.ref){const e=Gd(t.type.ref);return e==null?void 0:e.terminal}}function yp(t){return t.hidden&&!xd(ol(t))}function Tp(t,e){return!t||!e?[]:al(t,e,t.astNode,!0)}function Fd(t,e,n){if(!t||!e)return;const r=al(t,e,t.astNode,!0);if(r.length!==0)return n!==void 0?n=Math.max(0,Math.min(n,r.length-1)):n=0,r[n]}function al(t,e,n,r){if(!r){const i=Pa(t.grammarSource,Bn);if(i&&i.feature===e)return[t]}return Bi(t)&&t.astNode===n?t.content.flatMap(i=>al(i,e,n,!1)):[]}function Rp(t,e,n){if(!t)return;const r=vp(t,e,t==null?void 0:t.astNode);if(r.length!==0)return n!==void 0?n=Math.max(0,Math.min(n,r.length-1)):n=0,r[n]}function vp(t,e,n){if(t.astNode!==n)return[];if(Wn(t.grammarSource)&&t.grammarSource.value===e)return[t];const r=No(t).iterator();let i;const s=[];do if(i=r.next(),!i.done){const a=i.value;a.astNode===n?Wn(a.grammarSource)&&a.grammarSource.value===e&&s.push(a):r.prune()}while(!i.done);return s}function Ep(t){var n;const e=t.astNode;for(;e===((n=t.container)==null?void 0:n.astNode);){const r=Pa(t.grammarSource,Bn);if(r)return r;t=t.container}}function Gd(t){let e=t;return Id(e)&&($a(e.$container)?e=e.$container.$container:is(e.$container)?e=e.$container:ss(e.$container)),Ud(t,e,new Map)}function Ud(t,e,n){var i;function r(s,a){let o;return Pa(s,Bn)||(o=Ud(a,a,n)),n.set(t,o),o}if(n.has(t))return n.get(t);n.set(t,void 0);for(const s of rs(e)){if(Bn(s)&&s.feature.toLowerCase()==="name")return n.set(t,s),s;if(Vn(s)&&sn(s.rule.ref))return r(s,s.rule.ref);if(Wh(s)&&((i=s.typeRef)!=null&&i.ref))return r(s,s.typeRef.ref)}}function qd(t){return zd(t,new Set)}function zd(t,e){if(e.has(t))return!0;e.add(t);for(const n of rs(t))if(Vn(n)){if(!n.rule.ref||sn(n.rule.ref)&&!zd(n.rule.ref,e)||ca(n.rule.ref))return!1}else{if(Bn(n))return!1;if($a(n))return!1}return!!t.definition}function jd(t){if(!an(t)){if(t.inferredType)return t.inferredType.name;if(t.dataType)return t.dataType;if(t.returnType){const e=t.returnType.ref;if(e)return e.name}}}function Wi(t){if(is(t))return sn(t)&&qd(t)?t.name:jd(t)??t.name;if(Gh(t)||Yh(t)||Bh(t))return t.name;if($a(t)){const e=Ap(t);if(e)return e}else if(Id(t))return t.name;throw new Error("Cannot get name of Unknown Type")}function Ap(t){var
|
|||
|
|
`;function jp(t,e=!1){try{const n=Ma(t);return _o(n.value,{},n.flags.ignoreCase)}catch(n){if(n.message===Hd)e&&Bd(`${ha} Unable to optimize: < ${t.toString()} >
|
|||
|
|
Complement Sets cannot be automatically optimized.
|
|||
|
|
This will disable the lexer's first char optimizations.
|
|||
|
|
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let r="";e&&(r=`
|
|||
|
|
This will disable the lexer's first char optimizations.
|
|||
|
|
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),bo(`${ha}
|
|||
|
|
Failed parsing: < ${t.toString()} >
|
|||
|
|
Using the @chevrotain/regexp-to-ast library
|
|||
|
|
Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+r)}}return[]}function _o(t,e,n){switch(t.type){case"Disjunction":for(let i=0;i<t.value.length;i++)_o(t.value[i],e,n);break;case"Alternative":const r=t.value;for(let i=0;i<r.length;i++){const s=r[i];switch(s.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"Lookbehind":case"NegativeLookbehind":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}const a=s;switch(a.type){case"Character":Os(a.value,e,n);break;case"Set":if(a.complement===!0)throw Error(Hd);q(a.value,c=>{if(typeof c=="number")Os(c,e,n);else{const l=c;if(n===!0)for(let u=l.from;u<=l.to;u++)Os(u,e,n);else{for(let u=l.from;u<=l.to&&u<Mi;u++)Os(u,e,n);if(l.to>=Mi){const u=l.from>=Mi?l.from:Mi,f=l.to,g=fn(u),h=fn(f);for(let E=g;E<=h;E++)e[E]=E}}}});break;case"Group":_o(a.value,e,n);break;default:throw Error("Non Exhaustive Match")}const o=a.quantifier!==void 0&&a.quantifier.atLeast===0;if(a.type==="Group"&&Io(a)===!1||a.type!=="Group"&&o===!1)break}break;default:throw Error("non exhaustive match!")}return $e(e)}function Os(t,e,n){const r=fn(t);e[r]=r,n===!0&&Bp(t,e)}function Bp(t,e){const n=String.fromCharCode(t),r=n.toUpperCase();if(r!==n){const i=fn(r.charCodeAt(0));e[i]=i}else{const i=n.toLowerCase();if(i!==n){const s=fn(i.charCodeAt(0));e[s]=s}}}function Ul(t,e){return zr(t.value,n=>{if(typeof n=="number")return Ze(e,n);{const r=n;return zr(e,i=>r.from<=i&&i<=r.to)!==void 0}})}function Io(t){const e=t.quantifier;return e&&e.atLeast===0?!0:t.value?yt(t.value)?Ct(t.value,Io):Io(t.value):!1}class Wp extends Oa{constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(this.found!==!0){switch(e.type){case"Lookahead":this.visitLookahead(e);return;case"NegativeLookahead":this.visitNegativeLookahead(e);return;case"Lookbehind":this.visitLookbehind(e);return;case"NegativeLookbehind":this.visitNegativeLookbehind(e);return}super.visitChildren(e)}}visitCharacter(e){Ze(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?Ul(e,this.targetCharCodes)===void 0&&(this.found=!0):Ul(e,this.targetCharCodes)!==void 0&&(this.found=!0)}}function ll(t,e){if(e instanceof RegExp){const n=Ma(e),r=new Wp(t);return r.visit(n),r.found}else return zr(e,n=>Ze(t,n.charCodeAt(0)))!==void 0}const Kn="PATTERN",Di="defaultMode",xs="modes";function Vp(t,e){e=nl(e,{debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
|
|||
|
|
`],tracer:(N,k)=>k()});const n=e.tracer;n("initCharCodeToOptimizedIndexMap",()=>{gm()});let r;n("Reject Lexer.NA",()=>{r=_a(t,N=>N[Kn]===et.NA)});let i=!1,s;n("Transform Patterns",()=>{i=!1,s=M(r,N=>{const k=N[Kn];if(nn(k)){const P=k.source;return P.length===1&&P!=="^"&&P!=="$"&&P!=="."&&!k.ignoreCase?P:P.length===2&&P[0]==="\\"&&!Ze(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],P[1])?P[1]:ql(k)}else{if(Xn(k))return i=!0,{exec:k};if(typeof k=="object")return i=!0,k;if(typeof k=="string"){if(k.length===1)return k;{const P=k.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),H=new RegExp(P);return ql(H)}}else throw Error("non exhaustive match")}})});let a,o,c,l,u;n("misc mapping",()=>{a=M(r,N=>N.tokenTypeIdx),o=M(r,N=>{const k=N.GROUP;if(k!==et.SKIPPED){if(dt(k))return k;if(tn(k))return!1;throw Error("non exhaustive match")}}),c=M(r,N=>{const k=N.LONGER_ALT;if(k)return yt(k)?M(k,H=>Nl(r,H)):[Nl(r,k)]}),l=M(r,N=>N.PUSH_MODE),u=M(r,N=>j(N,"POP_MODE"))});let f;n("Line Terminator Handling",()=>{const N=Jd(e.lineTerminatorCharacters);f=M(r,k=>!1),e.positionTracking!=="onlyOffset"&&(f=M(r,k=>j(k,"LINE_BREAKS")?!!k.LINE_BREAKS:Xd(k,N)===!1&&ll(N,k.PATTERN)))});let g,h,E,b;n("Misc Mapping #2",()=>{g=M(r,Yd),h=M(s,hm),E=Xe(r,(N,k)=>{const P=k.GROUP;return dt(P)&&P!==et.SKIPPED&&(N[P]=[]),N},{}),b=M(s,(N,k)=>({pattern:s[k],longerAlt:c[k],canLineTerminator:f[k],isCustom:g[k],short:h[k],group:o[k],push:l[k],pop:u[k],tokenTypeIdx:a[k],tokenType:r[k]}))});let I=!0,C=[];return e.safeMode||n("First Char Optimization",()=>{C=Xe(r,(N,k,P)=>{if(typeof k.PATTERN=="string"){const H=k.PATTERN.charCodeAt(0),K=fn(H);Qa(N,K,b[P])}else if(yt(k.START_CHARS_HINT)){let H;q(k.START_CHARS_HINT,K=>{const J=typeof K=="string"?K.charCodeAt(0):K,oe=fn(J);H!==oe&&(H=oe,Qa(N,oe,b[P]))})}else if(nn(k.PATTERN))if(k.PATTERN.unicode)I=!1,e.ensureOptimizations&&bo(`${ha} Unable to analyze < ${k.PATTERN.toString()} > pattern.
|
|||
|
|
The regexp unicode flag is not currently supported by the regexp-to-ast library.
|
|||
|
|
This will disable the lexer's first char optimizations.
|
|||
|
|
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{const H=jp(k.PATTERN,e.ensureOptimizations);ae(H)&&(I=!1),q(H,K=>{Qa(N,K,b[P])})}else e.ensureOptimizations&&bo(`${ha} TokenType: <${k.name}> is using a custom token pattern without providing <start_chars_hint> parameter.
|
|||
|
|
This will disable the lexer's first char optimizations.
|
|||
|
|
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),I=!1;return N},[])}),{emptyGroups:E,patternIdxToConfig:b,charCodeToPatternIdxToConfig:C,hasCustom:i,canBeOptimized:I}}function Kp(t,e){let n=[];const r=Yp(t);n=n.concat(r.errors);const i=Xp(r.valid),s=i.valid;return n=n.concat(i.errors),n=n.concat(Hp(s)),n=n.concat(im(s)),n=n.concat(sm(s,e)),n=n.concat(am(s)),n}function Hp(t){let e=[];const n=ft(t,r=>nn(r[Kn]));return e=e.concat(Qp(n)),e=e.concat(tm(n)),e=e.concat(nm(n)),e=e.concat(rm(n)),e=e.concat(Zp(n)),e}function Yp(t){const e=ft(t,i=>!j(i,Kn)),n=M(e,i=>({message:"Token Type: ->"+i.name+"<- missing static 'PATTERN' property",type:Se.MISSING_PATTERN,tokenTypes:[i]})),r=Ia(t,e);return{errors:n,valid:r}}function Xp(t){const e=ft(t,i=>{const s=i[Kn];return!nn(s)&&!Xn(s)&&!j(s,"exec")&&!dt(s)}),n=M(e,i=>({message:"Token Type: ->"+i.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:Se.INVALID_PATTERN,tokenTypes:[i]})),r=Ia(t,e);return{errors:n,valid:r}}const Jp=/[^\\][$]/;function Qp(t){class e extends Oa{constructor(){super(...arguments),this.found=!1}visitEndAnchor(s){this.found=!0}}const n=ft(t,i=>{const s=i.PATTERN;try{const a=Ma(s),o=new e;return o.visit(a),o.found}catch{return Jp.test(s.source)}});return M(n,i=>({message:`Unexpected RegExp Anchor Error:
|
|||
|
|
Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
|
|||
|
|
See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:Se.EOI_ANCHOR_FOUND,tokenTypes:[i]}))}function Zp(t){const e=ft(t,r=>r.PATTERN.test(""));return M(e,r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' must not match an empty string",type:Se.EMPTY_MATCH_PATTERN,tokenTypes:[r]}))}const em=/[^\\[][\^]|^\^/;function tm(t){class e extends Oa{constructor(){super(...arguments),this.found=!1}visitStartAnchor(s){this.found=!0}}const n=ft(t,i=>{const s=i.PATTERN;try{const a=Ma(s),o=new e;return o.visit(a),o.found}catch{return em.test(s.source)}});return M(n,i=>({message:`Unexpected RegExp Anchor Error:
|
|||
|
|
Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
|
|||
|
|
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:Se.SOI_ANCHOR_FOUND,tokenTypes:[i]}))}function nm(t){const e=ft(t,r=>{const i=r[Kn];return i instanceof RegExp&&(i.multiline||i.global)});return M(e,r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:Se.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[r]}))}function rm(t){const e=[];let n=M(t,s=>Xe(t,(a,o)=>(s.PATTERN.source===o.PATTERN.source&&!Ze(e,o)&&o.PATTERN!==et.NA&&(e.push(o),a.push(o)),a),[]));n=ns(n);const r=ft(n,s=>s.length>1);return M(r,s=>{const a=M(s,c=>c.name);return{message:`The same RegExp pattern ->${Nt(s).PATTERN}<-has been used in all of the following Token Types: ${a.join(", ")} <-`,type:Se.DUPLICATE_PATTERNS_FOUND,tokenTypes:s}})}function im(t){const e=ft(t,r=>{if(!j(r,"GROUP"))return!1;const i=r.GROUP;return i!==et.SKIPPED&&i!==et.NA&&!dt(i)});return M(e,r=>({message:"Token Type: ->"+r.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:Se.INVALID_GROUP_TYPE_FOUND,tokenTypes:[r]}))}function sm(t,e){const n=ft(t,i=>i.PUSH_MODE!==void 0&&!Ze(e,i.PUSH_MODE));return M(n,i=>({message:`Token Type: ->${i.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${i.PUSH_MODE}<-which does not exist`,type:Se.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[i]}))}function am(t){const e=[],n=Xe(t,(r,i,s)=>{const a=i.PATTERN;return a===et.NA||(dt(a)?r.push({str:a,idx:s,tokenType:i}):nn(a)&&cm(a)&&r.push({str:a.source,idx:s,tokenType:i})),r},[]);return q(t,(r,i)=>{q(n,({str:s,idx:a,tokenType:o})=>{if(i<a&&om(s,r.PATTERN)){const c=`Token: ->${o.name}<- can never be matched.
|
|||
|
|
Because it appears AFTER the Token Type ->${r.name}<-in the lexer's definition.
|
|||
|
|
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:c,type:Se.UNREACHABLE_PATTERN,tokenTypes:[r,o]})}})}),e}function om(t,e){if(nn(e)){if(lm(e))return!1;const n=e.exec(t);return n!==null&&n.index===0}else{if(Xn(e))return e(t,0,[],{});if(j(e,"exec"))return e.exec(t,0,[],{});if(typeof e=="string")return e===t;throw Error("non exhaustive match")}}function cm(t){return zr([".","\\","[","]","|","^","$","(",")","?","*","+","{"],n=>t.source.indexOf(n)!==-1)===void 0}function lm(t){return/(\(\?=)|(\(\?!)|(\(\?<=)|(\(\?<!)/.test(t.source)}function ql(t){const e=t.ignoreCase?"iy":"y";return new RegExp(`${t.source}`,e)}function um(t,e,n){const r=[];return j(t,Di)||r.push({message:"A MultiMode Lexer cannot be initialized without a <"+Di+`> property in its definition
|
|||
|
|
`,type:Se.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),j(t,xs)||r.push({message:"A MultiMode Lexer cannot be initialized without a <"+xs+`> property in its definition
|
|||
|
|
`,type:Se.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),j(t,xs)&&j(t,Di)&&!j(t.modes,t.defaultMode)&&r.push({message:`A MultiMode Lexer cannot be initialized with a ${Di}: <${t.defaultMode}>which does not exist
|
|||
|
|
`,type:Se.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),j(t,xs)&&q(t.modes,(i,s)=>{q(i,(a,o)=>{if(tn(a))r.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${s}> at index: <${o}>
|
|||
|
|
`,type:Se.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if(j(a,"LONGER_ALT")){const c=yt(a.LONGER_ALT)?a.LONGER_ALT:[a.LONGER_ALT];q(c,l=>{!tn(l)&&!Ze(i,l)&&r.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${l.name}> on token <${a.name}> outside of mode <${s}>
|
|||
|
|
`,type:Se.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),r}function dm(t,e,n){const r=[];let i=!1;const s=ns(gt($e(t.modes))),a=_a(s,c=>c[Kn]===et.NA),o=Jd(n);return e&&q(a,c=>{const l=Xd(c,o);if(l!==!1){const f={message:mm(c,l),type:l.issue,tokenType:c};r.push(f)}else j(c,"LINE_BREAKS")?c.LINE_BREAKS===!0&&(i=!0):ll(o,c.PATTERN)&&(i=!0)}),e&&!i&&r.push({message:`Warning: No LINE_BREAKS Found.
|
|||
|
|
This Lexer has been defined to track line and column information,
|
|||
|
|
But none of the Token Types can be identified as matching a line terminator.
|
|||
|
|
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
|
|||
|
|
for details.`,type:Se.NO_LINE_BREAKS_FLAGS}),r}function fm(t){const e={},n=zi(t);return q(n,r=>{const i=t[r];if(yt(i))e[r]=[];else throw Error("non exhaustive match")}),e}function Yd(t){const e=t.PATTERN;if(nn(e))return!1;if(Xn(e))return!0;if(j(e,"exec"))return!0;if(dt(e))return!1;throw Error("non exhaustive match")}function hm(t){return dt(t)&&t.length===1?t.charCodeAt(0):!1}const pm={test:function(t){const e=t.length;for(let n=this.lastIndex;n<e;n++){const r=t.charCodeAt(n);if(r===10)return this.lastIndex=n+1,!0;if(r===13)return t.charCodeAt(n+1)===10?this.lastIndex=n+2:this.lastIndex=n+1,!0}return!1},lastIndex:0};function Xd(t,e){if(j(t,"LINE_BREAKS"))return!1;if(nn(t.PATTERN)){try{ll(e,t.PATTERN)}catch(n){return{issue:Se.IDENTIFY_TERMINATOR,errMsg:n.message}}return!1}else{if(dt(t.PATTERN))return!1;if(Yd(t))return{issue:Se.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function mm(t,e){if(e.issue===Se.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
|
|||
|
|
The problem is in the <${t.name}> Token Type
|
|||
|
|
Root cause: ${e.errMsg}.
|
|||
|
|
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(e.issue===Se.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
|
|||
|
|
The problem is in the <${t.name}> Token Type
|
|||
|
|
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}function Jd(t){return M(t,n=>dt(n)?n.charCodeAt(0):n)}function Qa(t,e,n){t[e]===void 0?t[e]=[n]:t[e].push(n)}const Mi=256;let ea=[];function fn(t){return t<Mi?t:ea[t]}function gm(){if(ae(ea)){ea=new Array(65536);for(let t=0;t<65536;t++)ea[t]=t>255?255+~~(t/255):t}}function os(t,e){const n=t.tokenTypeIdx;return n===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[n]===!0}function pa(t,e){return t.tokenTypeIdx===e.tokenTypeIdx}let zl=1;const Qd={};function cs(t){const e=ym(t);Tm(e),vm(e),Rm(e),q(e,n=>{n.isParent=n.categoryMatches.length>0})}function ym(t){let e=je(t),n=t,r=!0;for(;r;){n=ns(gt(M(n,s=>s.CATEGORIES)));const i=Ia(n,e);e=e.concat(i),ae(i)?r=!1:n=i}return e}function Tm(t){q(t,e=>{ef(e)||(Qd[zl]=e,e.tokenTypeIdx=zl++),jl(e)&&!yt(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),jl(e)||(e.CATEGORIES=[]),Em(e)||(e.categoryMatches=[]),Am(e)||(e.categoryMatchesMap={})})}function Rm(t){q(t,e=>{e.categoryMatches=[],q(e.categoryMatchesMap,(n,r)=>{e.categoryMatches.push(Qd[r].tokenTypeIdx)})})}function vm(t){q(t,e=>{Zd([],e)})}function Zd(t,e){q(t,n=>{e.categoryMatchesMap[n.tokenTypeIdx]=!0}),q(e.CATEGORIES,n=>{const r=t.concat(e);Ze(r,n)||Zd(r,n)})}function ef(t){return j(t,"tokenTypeIdx")}function jl(t){return j(t,"CATEGORIES")}function Em(t){return j(t,"categoryMatches")}function Am(t){return j(t,"categoryMatchesMap")}function Sm(t){return j(t,"tokenTypeIdx")}const Po={buildUnableToPopLexerModeMessage(t){return`Unable to pop Lexer Mode after encountering Token ->${t.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(t,e,n,r,i,s){return`unexpected character: ->${t.charAt(e)}<- at offset: ${e}, skipped ${n} characters.`}};var Se;(function(t){t[t.MISSING_PATTERN=0]="MISSING_PATTERN",t[t.INVALID_PATTERN=1]="INVALID_PATTERN",t[t.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",t[t.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",t[t.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",t[t.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",t[t.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",t[t.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",t[t.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",t[t.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",t[t.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",t[t.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",t[t.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",t[t.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",t[t.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",t[t.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",t[t.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",t[t.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"})(Se||(Se={}));const Fi={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
|
|||
|
|
`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:Po,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(Fi);class et{constructor(e,n=Fi){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(i,s)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;const a=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${a}--> <${i}>`);const{time:o,value:c}=Wd(s),l=o>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&l(`${a}<-- <${i}> time: ${o}ms`),this.traceInitIndent--,c}else return s()},typeof n=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
|
|||
|
|
a boolean 2nd argument is no longer supported`);this.config=ut({},Fi,n);const r=this.config.traceInitPerf;r===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof r=="number"&&(this.traceInitMaxIdent=r,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let i,s=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===Fi.lineTerminatorsPattern)this.config.lineTerminatorsPattern=pm;else if(this.config.lineTerminatorCharacters===Fi.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
|
|||
|
|
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(n.safeMode&&n.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');this.trackStartLines=/full|onlyStart/i.test(this.config.positionTracking),this.trackEndLines=/full/i.test(this.config.positionTracking),yt(e)?i={modes:{defaultMode:je(e)},defaultMode:Di}:(s=!1,i=je(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(um(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:{},q(i.modes,(o,c)=>{i.modes[c]=_a(o,l=>tn(l))});const a=zi(i.modes);if(q(i.modes,(o,c)=>{this.TRACE_INIT(`Mode: <${c}> processing`,()=>{if(this.modes.push(c),this.config.skipValidations===!1&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(Kp(o,a))}),ae(this.lexerDefinitionErrors)){cs(o);let l;this.TRACE_INIT("analyzeTokenTypes",()=>{l=Vp(o,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:n.positionTracking,ensureOptimizations:n.ensureOptimizations,safeMode:n.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[c]=l.patternIdxToConfig,this.charCodeToPatternIdxToConfig[c]=l.charCodeToPatternIdxToConfig,this.emptyGroups=ut({},this.emptyGroups,l.emptyGroups),this.hasCustom=l.hasCustom||this.hasCustom,this.canModeBeOptimized[c]=l.canBeOptimized}})}),this.defaultMode=i.defaultMode,!ae(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){const c=M(this.lexerDefinitionErrors,l=>l.message).join(`-----------------------
|
|||
|
|
`);throw new Error(`Errors detected in definition of Lexer:
|
|||
|
|
`+c)}q(this.lexerDefinitionWarning,o=>{Bd(o.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(s&&(this.handleModes=Fe),this.trackStartLines===!1&&(this.computeNewColumn=Ch),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=Fe),/full/i.test(this.config.positionTracking))this.createTokenInstance=this.createFullToken;else if(/onlyStart/i.test(this.config.positionTracking))this.createTokenInstance=this.createStartOnlyToken;else if(/onlyOffset/i.test(this.config.positionTracking))this.createTokenInstance=this.createOffsetOnlyToken;else throw Error(`Invalid <positionTracking> config option: "${this.config.positionTracking}"`);this.hasCustom?(this.addToken=this.addTokenUsingPush,this.handlePayload=this.handlePayloadWithCustom):(this.addToken=this.addTokenUsingMemberAccess,this.handlePayload=this.handlePayloadNoCustom)}),this.TRACE_INIT("Failed Optimization Warnings",()=>{const o=Xe(this.canModeBeOptimized,(c,l,u)=>(l===!1&&c.push(u),c),[]);if(n.ensureOptimizations&&!ae(o))throw Error(`Lexer Modes: < ${o.join(", ")} > cannot be optimized.
|
|||
|
|
Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
|
|||
|
|
Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{zp()}),this.TRACE_INIT("toFastProperties",()=>{Vd(this)})})}tokenize(e,n=this.defaultMode){if(!ae(this.lexerDefinitionErrors)){const i=M(this.lexerDefinitionErrors,s=>s.message).join(`-----------------------
|
|||
|
|
`);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer:
|
|||
|
|
`+i)}return this.tokenizeInternal(e,n)}tokenizeInternal(e,n){let r,i,s,a,o,c,l,u,f,g,h,E,b,I,C;const N=e,k=N.length;let P=0,H=0;const K=this.hasCustom?0:Math.floor(e.length/10),J=new Array(K),oe=[];let de=this.trackStartLines?1:void 0,fe=this.trackStartLines?1:void 0;const _=fm(this.emptyGroups),R=this.trackStartLines,m=this.config.lineTerminatorsPattern;let S=0,y=[],T=[];const A=[],O=[];Object.freeze(O);let D=!1;const x=B=>{if(A.length===1&&B.tokenType.PUSH_MODE===void 0){const ne=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(B);oe.push({offset:B.startOffset,line:B.startLine,column:B.startColumn,length:B.image.length,message:ne})}else{A.pop();const ne=jn(A);y=this.patternIdxToConfig[ne],T=this.charCodeToPatternIdxToConfig[ne],S=y.length;const Oe=this.canModeBeOptimized[ne]&&this.config.safeMode===!1;T&&Oe?D=!0:D=!1}};function z(B){A.push(B),T=this.charCodeToPatternIdxToConfig[B],y=this.patternIdxToConfig[B],S=y.length,S=y.length;const ne=this.canModeBeOptimized[B]&&this.config.safeMode===!1;T&&ne?D=!0:D=!1}z.call(this,n);let G;const ie=this.config.recoveryEnabled;for(;P<k;){c=null,f=-1;const B=N.charCodeAt(P);let ne;if(D){const ve=fn(B),he=T[ve];ne=he!==void 0?he:O}else ne=y;const Oe=ne.length;for(r=0;r<Oe;r++){G=ne[r];const ve=G.pattern;l=null;const he=G.short;if(he!==!1?B===he&&(f=1,c=ve):G.isCustom===!0?(C=ve.exec(N,P,J,_),C!==null?(c=C[0],f=c.length,C.payload!==void 0&&(l=C.payload)):c=null):(ve.lastIndex=P,f=this.matchLength(ve,e,P)),f!==-1){if(o=G.longerAlt,o!==void 0){c=e.substring(P,P+f);const Ie=o.length;for(s=0;s<Ie;s++){const xe=y[o[s]],be=xe.pattern;if(u=null,xe.isCustom===!0?(C=be.exec(N,P,J,_),C!==null?(a=C[0],C.payload!==void 0&&(u=C.payload)):a=null):(be.lastIndex=P,a=this.match(be,e,P)),a&&a.length>c.length){c=a,f=a.length,l=u,G=xe;break}}}break}}if(f!==-1){if(g=G.group,g!==void 0&&(c=c!==null?c:e.substring(P,P+f),h=G.tokenTypeIdx,E=this.createTokenInstance(c,P,h,G.tokenType,de,fe,f),this.handlePayload(E,l),g===!1?H=this.addToken(J,H,E):_[g].push(E)),R===!0&&G.canLineTerminator===!0){let ve=0,he,Ie;m.lastIndex=0;do c=c!==null?c:e.substring(P,P+f),he=m.test(c),he===!0&&(Ie=m.lastIndex-1,ve++);while(he===!0);ve!==0?(de=de+ve,fe=f-Ie,this.updateTokenEndLineColumnLocation(E,g,Ie,ve,de,fe,f)):fe=this.computeNewColumn(fe,f)}else fe=this.computeNewColumn(fe,f);P=P+f,this.handleModes(G,x,z,E)}else{const ve=P,he=de,Ie=fe;let xe=ie===!1;for(;xe===!1&&P<k;)for(P++,i=0;i<S;i++){const be=y[i],Z=be.pattern,it=be.short;if(it!==!1?N.charCodeAt(P)===it&&(xe=!0):be.isCustom===!0?xe=Z.exec(N,P,J,_)!==null:(Z.lastIndex=P,xe=Z.exec(e)!==null),xe===!0)break}if(b=P-ve,fe=this.computeNewColumn(fe,b),I=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(N,ve,b,he,Ie,jn(A)),oe.push({offset:ve,line:he,column:Ie,length:b,message:I}),ie===!1)break}}return this.hasCustom||(J.length=H),{tokens:J,groups:_,errors:oe}}handleModes(e,n,r,i){if(e.pop===!0){const s=e.push;n(i),s!==void 0&&r.call(this,s)}else e.push!==void 0&&r.call(this,e.push)}updateTokenEndLineColumnLocation(e,n,r,i,s,a,o){let c,l;n!==void 0&&(c=r===o-1,l=c?-1:0,i===1&&c===!0||(e.endLine=s+l,e.endColumn=a-1+-l))}computeNewColumn(e,n){return e+n}createOffsetOnlyToken(e,n,r,i){return{image:e,startOffset:n,tokenTypeIdx:r,tokenType:i}}createStartOnlyToken(e,n,r,i,s,a){return{image:e,startOffset:n,startLine:s,startColumn:a,tokenTypeIdx:r,tokenType:i}}createFullToken(e,n,r,i,s,a,o){return{image:e,startOffset:n,endOffset:n+o-1,startLine:s,endLine:s,startColumn:a,endColumn:a+o-1,tokenTypeIdx:r,tokenType:i}}addTokenUsingPush(e,n,r){return e.push(r),n}addTokenUsingMemberAccess(e,n,r){return e[n]=r,n++,n}handlePayloadNoCustom(e,n){}handlePayloadWithCustom(e,n){n!==null&&(e.payload=n)}match(e,n,r){return e.test(n)===!0?n.substring(r,e.lastIndex):null}matchLength(e,n,r){return e.test(n)===!0?e.lastIndex-r:-1}}et.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.";et.NA=/NOT_APPLICABLE/;function Cr(t){return
|
|||
|
|
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return j(t,Bl)&&(n.CATEGORIES=t[Bl]),cs([n]),j(t,Wl)&&(n.LABEL=t[Wl]),j(t,Vl)&&(n.GROUP=t[Vl]),j(t,Hl)&&(n.POP_MODE=t[Hl]),j(t,Kl)&&(n.PUSH_MODE=t[Kl]),j(t,Yl)&&(n.LONGER_ALT=t[Yl]),j(t,Xl)&&(n.LINE_BREAKS=t[Xl]),j(t,Jl)&&(n.START_CHARS_HINT=t[Jl]),n}const hn=nf({name:"EOF",pattern:et.NA});cs([hn]);function ul(t,e,n,r,i,s,a,o){return{image:e,startOffset:n,endOffset:r,startLine:i,endLine:s,startColumn:a,endColumn:o,tokenTypeIdx:t.tokenTypeIdx,tokenType:t}}function rf(t,e){return os(t,e)}const Ar={buildMismatchTokenMessage({expected:t,actual:e,previous:n,ruleName:r}){return`Expecting ${tf(t)?`--> ${Cr(t)} <--`:`token of type --> ${t.name} <--`} but found --> '${e.image}' <--`},buildNotAllInputParsedMessage({firstRedundant:t,ruleName:e}){return"Redundant input, expecting EOF but found: "+t.image},buildNoViableAltMessage({expectedPathsPerAlt:t,actual:e,previous:n,customUserDescription:r,ruleName:i}){const s="Expecting: ",o=`
|
|||
|
|
but found: '`+Nt(e).image+"'";if(r)return s+r+o;{const c=Xe(t,(g,h)=>g.concat(h),[]),l=M(c,g=>`[${M(g,h=>Cr(h)).join(", ")}]`),f=`one of these possible Token sequences:
|
|||
|
|
${M(l,(g,h)=>` ${h+1}. ${g}`).join(`
|
|||
|
|
`)}`;return s+f+o}},buildEarlyExitMessage({expectedIterationPaths:t,actual:e,customUserDescription:n,ruleName:r}){const i="Expecting: ",a=`
|
|||
|
|
but found: '`+Nt(e).image+"'";if(n)return i+n+a;{const c=`expecting at least one iteration which starts with one of these possible Token sequences::
|
|||
|
|
<${M(t,l=>`[${M(l,u=>Cr(u)).join(",")}]`).join(" ,")}>`;return i+c+a}}};Object.freeze(Ar);const Nm={buildRuleNotFoundError(t,e){return"Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+`<-
|
|||
|
|
inside top level rule: ->`+t.name+"<-"}},qn={buildDuplicateFoundError(t,e){function n(u){return u instanceof ue?u.terminalType.name:u instanceof Je?u.nonTerminalName:""}const r=t.name,i=Nt(e),s=i.idx,a=$t(i),o=n(i),c=s>0;let l=`->${a}${c?s:""}<- ${o?`with argument: ->${o}<-`:""}
|
|||
|
|
appears more than once (${e.length} times) in the top level rule: ->${r}<-.
|
|||
|
|
For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES
|
|||
|
|
`;return l=l.replace(/[ \t]+/g," "),l=l.replace(/\s\s+/g,`
|
|||
|
|
`),l},buildNamespaceConflictError(t){return`Namespace conflict found in grammar.
|
|||
|
|
The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${t.name}>.
|
|||
|
|
To resolve this make sure each Terminal and Non-Terminal names are unique
|
|||
|
|
This is easy to accomplish by using the convention that Terminal names start with an uppercase letter
|
|||
|
|
and Non-Terminal names start with a lower case letter.`},buildAlternationPrefixAmbiguityError(t){const e=M(t.prefixPath,i=>Cr(i)).join(", "),n=t.alternation.idx===0?"":t.alternation.idx;return`Ambiguous alternatives: <${t.ambiguityIndices.join(" ,")}> due to common lookahead prefix
|
|||
|
|
in <OR${n}> inside <${t.topLevelRule.name}> Rule,
|
|||
|
|
<${e}> may appears as a prefix path in all these alternatives.
|
|||
|
|
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX
|
|||
|
|
For Further details.`},buildAlternationAmbiguityError(t){const e=t.alternation.idx===0?"":t.alternation.idx,n=t.prefixPath.length===0;let r=`Ambiguous Alternatives Detected: <${t.ambiguityIndices.join(" ,")}> in <OR${e}> inside <${t.topLevelRule.name}> Rule,
|
|||
|
|
`;if(n)r+=`These alternatives are all empty (match no tokens), making them indistinguishable.
|
|||
|
|
Only the last alternative may be empty.
|
|||
|
|
`;else{const i=M(t.prefixPath,s=>Cr(s)).join(", ");r+=`<${i}> may appears as a prefix path in all these alternatives.
|
|||
|
|
`}return r+=`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
|
|||
|
|
For Further details.`,r},buildEmptyRepetitionError(t){let e=$t(t.repetition);return t.repetition.idx!==0&&(e+=t.repetition.idx),`The repetition <${e}> within Rule <${t.topLevelRule.name}> can never consume any tokens.
|
|||
|
|
This could lead to an infinite loop.`},buildTokenNameError(t){return"deprecated"},buildEmptyAlternationError(t){return`Ambiguous empty alternative: <${t.emptyChoiceIdx+1}> in <OR${t.alternation.idx}> inside <${t.topLevelRule.name}> Rule.
|
|||
|
|
Only the last alternative may be an empty alternative.`},buildTooManyAlternativesError(t){return`An Alternation cannot have more than 256 alternatives:
|
|||
|
|
<OR${t.alternation.idx}> inside <${t.topLevelRule.name}> Rule.
|
|||
|
|
has ${t.alternation.definition.length+1} alternatives.`},buildLeftRecursionError(t){const e=t.topLevelRule.name,n=M(t.leftRecursionPath,s=>s.name),r=`${e} --> ${n.concat([e]).join(" --> ")}`;return`Left Recursion found in grammar.
|
|||
|
|
rule: <${e}> can be invoked from itself (directly or indirectly)
|
|||
|
|
without consuming any Tokens. The grammar path that causes this is:
|
|||
|
|
${r}
|
|||
|
|
To fix this refactor your grammar to remove the left recursion.
|
|||
|
|
see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(t){return"deprecated"},buildDuplicateRuleNameError(t){let e;return t.topLevelRule instanceof Yr?e=t.topLevelRule.name:e=t.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${t.grammarName}<-`}};function wm(t,e){const n=new bm(t,e);return n.resolveRefs(),n.errors}class bm extends Xr{constructor(e,n){super(),this.nameToTopRule=e,this.errMsgProvider=n,this.errors=[]}resolveRefs(){q($e(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){const n=this.nameToTopRule[e.nonTerminalName];if(n)e.referencedRule=n;else{const r=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:r,type:Qe.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}}class _m extends Da{constructor(e,n){super(),this.topProd=e,this.path=n,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=je(this.path.ruleStack).reverse(),this.occurrenceStack=je(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,n=[]){this.found||super.walk(e,n)}walkProdRef(e,n,r){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){const i=n.concat(r);this.updateExpectedNext(),this.walk(e.referencedRule,i)}}updateExpectedNext(){ae(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}}class Im extends _m{constructor(e,n){super(e,n),this.path=n,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,n,r){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){const i=n.concat(r),s=new tt({definition:i});this.possibleTokTypes=as(s),this.found=!0}}}class Fa extends Da{constructor(e,n){super(),this.topRule=e,this.occurrence=n,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}}class Pm extends Fa{walkMany(e,n,r){if(e.idx===this.occurrence){const i=Nt(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof ue&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkMany(e,n,r)}}class Ql extends Fa{walkManySep(e,n,r){if(e.idx===this.occurrence){const i=Nt(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof ue&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkManySep(e,n,r)}}class $m extends Fa{walkAtLeastOne(e,n,r){if(e.idx===this.occurrence){const i=Nt(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof ue&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOne(e,n,r)}}class Zl extends Fa{walkAtLeastOneSep(e,n,r){if(e.idx===this.occurrence){const i=Nt(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof ue&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOneSep(e,n,r)}}function $o(t,e,n=[]){n=je(n);let r=[],i=0;function s(o){return o.concat(Ge(t,i+1))}function a(o){const c=$o(s(o),e,n);return r.concat(c)}for(;n.length<e&&i<t.length;){const o=t[i];if(o instanceof tt)return a(o.definition);if(o instanceof Je)return a(o.definition);if(o instanceof ze)r=a(o.definition);else if(o instanceof ht){const c=o.definition.concat([new Ae({definition:o.definition})]);return a(c)}else if(o instanceof pt){const c=[new tt({definition:o.definition}),new Ae({definition:[new ue({terminalType:o.separator})].concat(o.definition)})];return a(c)}else if(o instanceof nt){
|
|||
|
|
${s.join(`
|
|||
|
|
|
|||
|
|
`).replace(/\n/g,`
|
|||
|
|
`)}`)}}};return n.prototype=r,n.prototype.constructor=n,n._RULE_NAMES=e,n}function Rg(t,e,n){const r=function(){};vf(r,t+"BaseSemanticsWithDefaults");const i=Object.create(n.prototype);return q(e,s=>{i[s]=yg}),r.prototype=i,r.prototype.constructor=r,r}var Mo;(function(t){t[t.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",t[t.MISSING_METHOD=1]="MISSING_METHOD"})(Mo||(Mo={}));function vg(t,e){return Eg(t,e)}function Eg(t,e){const n=ft(e,i=>Xn(t[i])===!1),r=M(n,i=>({msg:`Missing visitor method: <${i}> on ${t.constructor.name} CST Visitor.`,type:Mo.MISSING_METHOD,methodName:i}));return ns(r)}class Ag{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=j(e,"nodeLocationTracking")?e.nodeLocationTracking:rn.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=Fe,this.cstFinallyStateUpdate=Fe,this.cstPostTerminal=Fe,this.cstPostNonTerminal=Fe,this.cstPostRule=Fe;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=ru,this.setNodeLocationFromNode=ru,this.cstPostRule=Fe,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=Fe,this.setNodeLocationFromNode=Fe,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=nu,this.setNodeLocationFromNode=nu,this.cstPostRule=Fe,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=Fe,this.setNodeLocationFromNode=Fe,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=Fe,this.setNodeLocationFromNode=Fe,this.cstPostRule=Fe,this.setInitialNodeLocation=Fe;else throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`)}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:NaN,endOffset:NaN}}setInitialNodeLocationOnlyOffsetRegular(e){e.location={startOffset:this.LA(1).startOffset,endOffset:NaN}}setInitialNodeLocationFullRecovery(e){e.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}}setInitialNodeLocationFullRegular(e){const n=this.LA(1);e.location={startOffset:n.startOffset,startLine:n.startLine,startColumn:n.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(e){const n={name:e,children:Object.create(null)};this.setInitialNodeLocation(n),this.CST_STACK.push(n)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){const n=this.LA(0),r=e.location;r.startOffset<=n.startOffset?(r.endOffset=n.endOffset,r.endLine=n.endLine,r.endColumn=n.endColumn):(r.startOffset=NaN,r.startLine=NaN,r.startColumn=NaN)}cstPostRuleOnlyOffset(e){const n=this.LA(0),r=e.location;r.startOffset<=n.startOffset?r.endOffset=n.endOffset:r.startOffset=NaN}cstPostTerminal(e,n){const r=this.CST_STACK[this.CST_STACK.length-1];pg(r,n,e),this.setNodeLocationFromToken(r.location,n)}cstPostNonTerminal(e,n){const r=this.CST_STACK[this.CST_STACK.length-1];mg(r,n,e),this.setNodeLocationFromNode(r.location,e.location)}getBaseCstVisitorConstructor(){if(tn(this.baseCstVisitorConstructor)){const e=Tg(this.className,zi(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(tn(this.baseCstVisitorWithDefaultsConstructor)){const e=Rg(this.className,zi(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor}getLastExplicitRuleShortName(){const e=this.RULE_STACK;return e[e.length-1]}getPreviousExplicitRuleShortName(){const e=this.RULE_STACK;return e[e.length-2]}getLastExplicitRuleOccurrenceIndex(){const e=this.RULE_OCCURRENCE_STACK;return e[e.length-1]}}class Sg{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1
|
|||
|
|
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
|
|||
|
|
For Further details.`);if(yt(e)){if(ae(e))throw Error(`A Token Vocabulary cannot be empty.
|
|||
|
|
Note that the first argument for the parser constructor
|
|||
|
|
is no longer a Token vector (since v4.0).`);if(typeof e[0].startOffset=="number")throw Error(`The Parser constructor no longer accepts a token vector as the first argument.
|
|||
|
|
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
|
|||
|
|
For Further details.`)}if(yt(e))this.tokensMap=Xe(e,(s,a)=>(s[a.name]=a,s),{});else if(j(e,"modes")&&Ct(gt($e(e.modes)),Sm)){const s=gt($e(e.modes)),a=tl(s);this.tokensMap=Xe(a,(o,c)=>(o[c.name]=c,o),{})}else if(kh(e))this.tokensMap=je(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=hn;const r=j(e,"modes")?gt($e(e.modes)):$e(e),i=Ct(r,s=>ae(s.categoryMatches));this.tokenMatcher=i?pa:os,cs($e(this.tokensMap))}defineRule(e,n,r){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'
|
|||
|
|
Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);const i=j(r,"resyncEnabled")?r.resyncEnabled:Ta.resyncEnabled,s=j(r,"recoveryValueFunc")?r.recoveryValueFunc:Ta.recoveryValueFunc,a=this.ruleShortNameIdx<<ug+mn;this.ruleShortNameIdx++,this.shortRuleNameToFull[a]=e,this.fullRuleNameToShort[e]=a;let o;return this.outputCst===!0?o=function(...u){try{this.ruleInvocationStateUpdate(a,e,this.subruleIdx),n.apply(this,u);const f=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(f),f}catch(f){return this.invokeRuleCatch(f,i,s)}finally{this.ruleFinallyStateUpdate()}}:o=function(...u){try{return this.ruleInvocationStateUpdate(a,e,this.subruleIdx),n.apply(this,u)}catch(f){return this.invokeRuleCatch(f,i,s)}finally{this.ruleFinallyStateUpdate()}},Object.assign(o,{ruleName:e,originalGrammarAction:n})}invokeRuleCatch(e,n,r){const i=this.RULE_STACK.length===1,s=n&&!this.isBackTracking()&&this.recoveryEnabled;if(ma(e)){const a=e;if(s){const o=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(o))if(a.resyncedTokens=this.reSyncTo(o),this.outputCst){const c=this.CST_STACK[this.CST_STACK.length-1];return c.recoveredNode=!0,c}else return r(e);else{if(this.outputCst){const c=this.CST_STACK[this.CST_STACK.length-1];c.recoveredNode=!0,a.partialCstResult=c}throw a}}else{if(i)return this.moveToTerminatedState(),r(e);throw a}}else throw e}optionInternal(e,n){const r=this.getKeyForAutomaticLookahead(Rf,n);return this.optionInternalLogic(e,n,r)}optionInternalLogic(e,n,r){let i=this.getLaFuncFromCache(r),s;if(typeof e!="function"){s=e.DEF;const a=e.GATE;if(a!==void 0){const o=i;i=()=>a.call(this)&&o.call(this)}}else s=e;if(i.call(this)===!0)return s.call(this)}atLeastOneInternal(e,n){const r=this.getKeyForAutomaticLookahead(xo,e);return this.atLeastOneInternalLogic(e,n,r)}atLeastOneInternalLogic(e,n,r){let i=this.getLaFuncFromCache(r),s;if(typeof n!="function"){s=n.DEF;const a=n.GATE;if(a!==void 0){const o=i;i=()=>a.call(this)&&o.call(this)}}else s=n;if(i.call(this)===!0){let a=this.doSingleRepetition(s);for(;i.call(this)===!0&&a===!0;)a=this.doSingleRepetition(s)}else throw this.raiseEarlyExitException(e,ye.REPETITION_MANDATORY,n.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,n],i,xo,e,$m)}atLeastOneSepFirstInternal(e,n){const r=this.getKeyForAutomaticLookahead(na,e);this.atLeastOneSepFirstInternalLogic(e,n,r)}atLeastOneSepFirstInternalLogic(e,n,r){const i=n.DEF,s=n.SEP;if(this.getLaFuncFromCache(r).call(this)===!0){i.call(this);const o=()=>this.tokenMatcher(this.LA(1),s);for(;this.tokenMatcher(this.LA(1),s)===!0;)this.CONSUME(s),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,s,o,i,Zl],o,na,e,Zl)}else throw this.raiseEarlyExitException(e,ye.REPETITION_MANDATORY_WITH_SEPARATOR,n.ERR_MSG)}manyInternal(e,n){const r=this.getKeyForAutomaticLookahead(Oo,e);return this.manyInternalLogic(e,n,r)}manyInternalLogic(e,n,r){let i=this.getLaFuncFromCache(r),s;if(typeof n!="function"){s=n.DEF;const o=n.GATE;if(o!==void 0){const c=i;i=()=>o.call(this)&&c.call(this)}}else s=n;let a=!0;for(;i.call(this)===!0&&a===!0;)a=this.doSingleRepetition(s);this.attemptInRepetitionRecovery(this.manyInternal,[e,n],i,Oo,e,Pm,a)}manySepFirstInternal(e,n){const r=this.getKeyForAutomaticLookahead(Do,e);this.manySepFirstInternalLogic(e,n,r)}manySepFirstInternalLogic(e,n,r){const i=n.DEF,s=n.SEP;if(this.getLaFuncFromCache(r).call(this)===!0){i.call(this);const o=()=>this.tokenMatcher(this.LA(1),s);for(;this.tokenMatcher(this.LA(1),s)===!0;)this.CONSUME(s),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,s,o,i,Ql],o,Do,e,Ql)}}repetitionSepSecondInternal(e,n,r,i,s){for(;r();)this.CONSUME(n),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,n,r,i,s],r,na,e,s)}doSingleRepetition(e){const n=this.getLexerPosition();return e.call(this),this.getLexerPosition()>n}orInternal(e,n){const r=this.getKeyForAutomaticLookahead(Tf,n),i=yt(e)?e:e.DEF,a=this.getLaFuncFromCache(r).call(this,i);if(a!==void 0)return i[a]
|
|||
|
|
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(Af);const bg={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 n=e>0?e:"";this[`CONSUME${n}`]=function(r,i){return this.consumeInternalRecord(r,e,i)},this[`SUBRULE${n}`]=function(r,i){return this.subruleInternalRecord(r,e,i)},this[`OPTION${n}`]=function(r){return this.optionInternalRecord(r,e)},this[`OR${n}`]=function(r){return this.orInternalRecord(r,e)},this[`MANY${n}`]=function(r){this.manyInternalRecord(e,r)},this[`MANY_SEP${n}`]=function(r){this.manySepFirstInternalRecord(e,r)},this[`AT_LEAST_ONE${n}`]=function(r){this.atLeastOneInternalRecord(e,r)},this[`AT_LEAST_ONE_SEP${n}`]=function(r){this.atLeastOneSepFirstInternalRecord(e,r)}}this.consume=function(e,n,r){return this.consumeInternalRecord(n,e,r)},this.subrule=function(e,n,r){return this.subruleInternalRecord(n,e,r)},this.option=function(e,n){return this.optionInternalRecord(n,e)},this.or=function(e,n){return this.orInternalRecord(n,e)},this.many=function(e,n){this.manyInternalRecord(e,n)},this.atLeastOne=function(e,n){this.atLeastOneInternalRecord(e,n)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",()=>{const e=this;for(let n=0;n<10;n++){const r=n>0?n:"";delete e[`CONSUME${r}`],delete e[`SUBRULE${r}`],delete e[`OPTION${r}`],delete e[`OR${r}`],delete e[`MANY${r}`],delete e[`MANY_SEP${r}`],delete e[`AT_LEAST_ONE${r}`],delete e[`AT_LEAST_ONE_SEP${r}`]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})}ACTION_RECORD(e){}BACKTRACK_RECORD(e,n){return()=>!0}LA_RECORD(e){return ya}topLevelRuleRecord(e,n){try{const r=new Yr({definition:[],name:e});return r.name=e,this.recordingProdStack.push(r),n.call(this),this.recordingProdStack.pop(),r}catch(r){if(r.KNOWN_RECORDER_ERROR!==!0)try{r.message=r.message+`
|
|||
|
|
This error was thrown during the "grammar recording phase" For more info see:
|
|||
|
|
https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw r}throw r}}optionInternalRecord(e,n){return gi.call(this,ze,e,n)}atLeastOneInternalRecord(e,n){gi.call(this,ht,n,e)}atLeastOneSepFirstInternalRecord(e,n){gi.call(this,pt,n,e,iu)}manyInternalRecord(e,n){gi.call(this,Ae,n,e)}manySepFirstInternalRecord(e,n){gi.call(this,nt,n,e,iu)}orInternalRecord(e,n){return Ig.call(this,e,n)}subruleInternalRecord(e,n,r){if(ga(n),!e||j(e,"ruleName")===!1){const o=new Error(`<SUBRULE${au(n)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>
|
|||
|
|
inside top level rule: <${this.recordingProdStack[0].name}>`);throw o.KNOWN_RECORDER_ERROR=!0,o}const i=jn(this.recordingProdStack),s=e.ruleName,a=new Je({idx:n,nonTerminalName:s,label:r==null?void 0:r.LABEL,referencedRule:void 0});return i.definition.push(a),this.outputCst?bg:za}consumeInternalRecord(e,n,r){if(ga(n),!ef(e)){const a=new Error(`<CONSUME${au(n)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>
|
|||
|
|
inside top level rule: <${this.recordingProdStack[0].name}>`);throw a.KNOWN_RECORDER_ERROR=!0,a}const i=jn(this.recordingProdStack),s=new ue({idx:n,terminalType:e,label:r==null?void 0:r.LABEL});return i.definition.push(s),Af}}function gi(t,e,n,r=!1){ga(n);const i=jn(this.recordingProdStack),s=Xn(e)?e:e.DEF,a=new t({definition:[],idx:n});return r&&(a.separator=e.SEP),j(e,"MAX_LOOKAHEAD")&&(a.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(a),s.call(this),i.definition.push(a),this.recordingProdStack.pop(),za}function Ig(t,e){ga(e);const n=jn(this.recordingProdStack),r=yt(t)===!1,i=r===!1?t:t.DEF,s=new rt({definition:[],idx:e,ignoreAmbiguities:r&&t.IGNORE_AMBIGUITIES===!0});j(t,"MAX_LOOKAHEAD")&&(s.maxLookahead=t.MAX_LOOKAHEAD);const a=Sd(i,o=>Xn(o.GATE));return s.hasPredicates=a,n.definition.push(s),q(i,o=>{const c=new tt({definition:[]});s.definition.push(c),j(o,"IGNORE_AMBIGUITIES")?c.ignoreAmbiguities=o.IGNORE_AMBIGUITIES:j(o,"GATE")&&(c.ignoreAmbiguities=!0),this.recordingProdStack.push(c),o.ALT.call(this),this.recordingProdStack.pop()}),za}function au(t){return t===0?"":`${t}`}function ga(t){if(t<0||t>su){const e=new Error(`Invalid DSL Method idx value: <${t}>
|
|||
|
|
Idx value must be a none negative value smaller than ${su+1}`);throw e.KNOWN_RECORDER_ERROR=!0,e}}class Pg{initPerformanceTracer(e){if(j(e,"traceInitPerf")){const n=e.traceInitPerf,r=typeof n=="number";this.traceInitMaxIdent=r?n:1/0,this.traceInitPerf=r?n>0:n}else this.traceInitMaxIdent=0,this.traceInitPerf=rn.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,n){if(this.traceInitPerf===!0){this.traceInitIndent++;const r=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${r}--> <${e}>`);const{time:i,value:s}=Wd(n),a=i>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a(`${r}<-- <${e}> time: ${i}ms`),this.traceInitIndent--,s}else return n()}}function $g(t,e){e.forEach(n=>{const r=n.prototype;Object.getOwnPropertyNames(r).forEach(i=>{if(i==="constructor")return;const s=Object.getOwnPropertyDescriptor(r,i);s&&(s.get||s.set)?Object.defineProperty(t.prototype,i,s):t.prototype[i]=n.prototype[i]})})}const ya=ul(hn,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(ya);const rn=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:Ar,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),Ta=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0});var Qe;(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"})(Qe||(Qe={}));function ou(t=void 0){return function(){return t}}class ls{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 n=this.className;this.TRACE_INIT("toFastProps",()=>{Vd(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),q(this.definedRulesNames,i=>{const a=this[i].originalGrammarAction;let o;this.TRACE_INIT(`${i} Rule`,()=>{o=this.topLevelRuleRecord(i,a)}),this.gastProductionsCache[i]=o})}finally{this.disableRecording()}});let r=[];if(this.TRACE_INIT("Grammar Resolving",()=>{r=ng({rules:$e(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(r)}),this.TRACE_INIT("Grammar Validations",()=>{if(ae(r)&&this.skipValidations===!1){const i=rg({rules:$e(this.gastProductionsCache),tokenTypes:$e(this.tokensMap),errMsgProvider:qn,grammarName:n}),s=qm({lookaheadStrategy:this.lookaheadStrategy,rules:$e(this.gastProductionsCache),tokenTypes:$e(this.tokensMap),grammarName:n});this.definitionErrors=this.definitionErrors.concat(i,s)}}),ae(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{const i=Gp($e(this.gastProductionsCache));this.resyncFollows=i}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var i,s;(s=(i=this.lookaheadStrategy).initialize)===null||s===void 0||s.call(i,{rules:$e(this.gastProductionsCache)}),this.preComputeLookaheadFunctions($e(this.gastProductionsCache))})),!ls.DEFER_DEFINITION_ERRORS_HANDLING&&!ae(this.definitionErrors))throw e=M(this.definitionErrors,i=>i.message),new Error(`Parser Definition Errors detected:
|
|||
|
|
${e.join(`
|
|||
|
|
-------------------------------
|
|||
|
|
`)}`)})}constructor(e,n){this.definitionErrors=[],this.selfAnalysisDone=!1;const r=this;if(r.initErrorHandler(n),r.initLexerAdapter(),r.initLooksAhead(n),r.initRecognizerEngine(e,n),r.initRecoverable(n),r.initTreeBuilder(n),r.initContentAssist(),r.initGastRecorder(n),r.initPerformanceTracer(n),j(n,"ignoredIssues"))throw new Error(`The <ignoredIssues> IParserConfig property has been deprecated.
|
|||
|
|
Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
|
|||
|
|
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
|
|||
|
|
For further details.`);this.skipValidations=j(n,"skipValidations")?n.skipValidations:rn.skipValidations}}ls.DEFER_DEFINITION_ERRORS_HANDLING=!1;$g(ls,[cg,dg,Ag,Sg,kg,Cg,Ng,wg,_g,Pg]);class Lg extends ls{constructor(e,n=rn){const r=je(n);r.outputCst=!1,super(e,r)}}function jr(t,e,n){return`${t.name}_${e}_${n}`}const pn=1,Og=2,Sf=4,Cf=5,us=7,xg=8,Dg=9,Mg=10,Fg=11,kf=12;class pl{constructor(e){this.target=e}isEpsilon(){return!1}}class ml extends pl{constructor(e,n){super(e),this.tokenType=n}}class Nf extends pl{constructor(e){super(e)}isEpsilon(){return!0}}class gl extends pl{constructor(e,n,r){super(e),this.rule=n,this.followState=r}isEpsilon(){return!0}}function Gg(t){const e={decisionMap:{},decisionStates:[],ruleToStartState:new Map,ruleToStopState:new Map,states:[]};Ug(e,t);const n=t.length;for(let r=0;r<n;r++){const i=t[r],s=Jn(e,i,i);s!==void 0&&Jg(e,i,s)}return e}function Ug(t,e){const n=e.length;for(let r=0;r<n;r++){const i=e[r],s=Le(t,i,void 0,{type:Og}),a=Le(t,i,void 0,{type:us});s.stop=a,t.ruleToStartState.set(i,s),t.ruleToStopState.set(i,a)}}function wf(t,e,n){return n instanceof ue?yl(t,e,n.terminalType,n):n instanceof Je?Xg(t,e,n):n instanceof rt?Wg(t,e,n):n instanceof ze?Vg(t,e,n):n instanceof Ae?qg(t,e,n):n instanceof nt?zg(t,e,n):n instanceof ht?jg(t,e,n):n instanceof pt?Bg(t,e,n):Jn(t,e,n)}function qg(t,e,n){const r=Le(t,e,n,{type:Cf});gn(t,r);const i=Jr(t,e,r,n,Jn(t,e,n));return _f(t,e,n,i)}function zg(t,e,n){const r=Le(t,e,n,{type:Cf});gn(t,r);const i=Jr(t,e,r,n,Jn(t,e,n)),s=yl(t,e,n.separator,n);return _f(t,e,n,i,s)}function jg(t,e,n){const r=Le(t,e,n,{type:Sf});gn(t,r);const i=Jr(t,e,r,n,Jn(t,e,n));return bf(t,e,n,i)}function Bg(t,e,n){const r=Le(t,e,n,{type:Sf});gn(t,r);const i=Jr(t,e,r,n,Jn(t,e,n)),s=yl(t,e,n.separator,n);return bf(t,e,n,i,s)}function Wg(t,e,n){const r=Le(t,e,n,{type:pn});gn(t,r);const i=M(n.definition,a=>wf(t,e,a));return Jr(t,e,r,n,...i)}function Vg(t,e,n){const r=Le(t,e,n,{type:pn});gn(t,r);const i=Jr(t,e,r,n,Jn(t,e,n));return Kg(t,e,n,i)}function Jn(t,e,n){const r=ft(M(n.definition,i=>wf(t,e,i)),i=>i!==void 0);return r.length===1?r[0]:r.length===0?void 0:Yg(t,r)}function bf(t,e,n,r,i){const s=r.left,a=r.right,o=Le(t,e,n,{type:Fg});gn(t,o);const c=Le(t,e,n,{type:kf});return s.loopback=o,c.loopback=o,t.decisionMap[jr(e,i?"RepetitionMandatoryWithSeparator":"RepetitionMandatory",n.idx)]=o,_e(a,o),i===void 0?(_e(o,s),_e(o,c)):(_e(o,c),_e(o,i.left),_e(i.right,s)),{left:s,right:c}}function _f(t,e,n,r,i){const s=r.left,a=r.right,o=Le(t,e,n,{type:Mg});gn(t,o);const c=Le(t,e,n,{type:kf}),l=Le(t,e,n,{type:Dg});return o.loopback=l,c.loopback=l,_e(o,s),_e(o,c),_e(a,l),i!==void 0?(_e(l,c),_e(l,i.left),_e(i.right,s)):_e(l,o),t.decisionMap[jr(e,i?"RepetitionWithSeparator":"Repetition",n.idx)]=o,{left:o,right:c}}function Kg(t,e,n,r){const i=r.left,s=r.right;return _e(i,s),t.decisionMap[jr(e,"Option",n.idx)]=i,r}function gn(t,e){return t.decisionStates.push(e),e.decision=t.decisionStates.length-1,e.decision}function Jr(t,e,n,r,...i){const s=Le(t,e,r,{type:xg,start:n});n.end=s;for(const o of i)o!==void 0?(_e(n,o.left),_e(o.right,s)):_e(n,s);const a={left:n,right:s};return t.decisionMap[jr(e,Hg(r),r.idx)]=n,a}function Hg(t){if(t instanceof rt)return"Alternation";if(t instanceof ze)return"Option";if(t instanceof Ae)return"Repetition";if(t instanceof nt)return"RepetitionWithSeparator";if(t instanceof ht)return"RepetitionMandatory";if(t instanceof pt)return"RepetitionMandatoryWithSeparator";throw new Error("Invalid production type encountered")}function Yg(t,e){const n=e.length;for(let s=0;s<n-1;s++){const a=e[s];let o;a.left.transitions.length===1&&(o=a.left.transitions[0]);const c=o instanceof gl,l=o,u=e[s+1].left;a.left.type===pn&&a.right.type===pn&&o!==void 0&&(c&&l.followState===a.right||o.target===a.right)?(c?l.followState=u:o.target=u,Qg(t,a.right)):_e(a.right,u)}const r=e[0],i=e[n-1];return{left:r.left,right:i.right}}function yl(t,e,n,r){const i=Le(t,e,r,{type:pn}),s=Le(t,e,r,{type:pn});return Tl(i,new ml(s,n)),{left:i,right:s}}function Xg(t,e,n){const r=n.referencedRule,i=t.ruleToStartState.
|
|||
|
|
<${e}> may appears as a prefix path in all these alternatives.
|
|||
|
|
`;return r=r+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
|
|||
|
|
For Further details.`,r}function ay(t){if(t instanceof Je)return"SUBRULE";if(t instanceof ze)return"OPTION";if(t instanceof rt)return"OR";if(t instanceof ht)return"AT_LEAST_ONE";if(t instanceof pt)return"AT_LEAST_ONE_SEP";if(t instanceof nt)return"MANY_SEP";if(t instanceof Ae)return"MANY";if(t instanceof ue)return"CONSUME";throw Error("non exhaustive match")}function oy(t,e,n){const r=lt(e.configs.elements,s=>s.state.transitions),i=bh(r.filter(s=>s instanceof ml).map(s=>s.tokenType),s=>s.tokenTypeIdx);return{actualToken:n,possibleTokenTypes:i,tokenPath:t}}function cy(t,e){return t.edges[e.tokenTypeIdx]}function ly(t,e,n){const r=new Fo,i=[];for(const a of t.elements){if(n.is(a.alt)===!1)continue;if(a.state.type===us){i.push(a);continue}const o=a.state.transitions.length;for(let c=0;c<o;c++){const l=a.state.transitions[c],u=uy(l,e);u!==void 0&&r.add({state:u,alt:a.alt,stack:a.stack})}}let s;if(i.length===0&&r.size===1&&(s=r),s===void 0){s=new Fo;for(const a of r.elements)va(a,s)}if(i.length>0&&!py(s))for(const a of i)s.add(a);return s}function uy(t,e){if(t instanceof ml&&rf(e,t.tokenType))return t.target}function dy(t,e){let n;for(const r of t.elements)if(e.is(r.alt)===!0){if(n===void 0)n=r.alt;else if(n!==r.alt)return}return n}function $f(t){return{configs:t,edges:{},isAcceptState:!1,prediction:-1}}function uu(t,e,n,r){return r=Lf(t,r),e.edges[n.tokenTypeIdx]=r,r}function Lf(t,e){if(e===Ra)return e;const n=e.configs.key,r=t.states[n];return r!==void 0?r:(e.configs.finalize(),t.states[n]=e,e)}function fy(t){const e=new Fo,n=t.transitions.length;for(let r=0;r<n;r++){const s={state:t.transitions[r].target,alt:r,stack:[]};va(s,e)}return e}function va(t,e){const n=t.state;if(n.type===us){if(t.stack.length>0){const i=[...t.stack],a={state:i.pop(),alt:t.alt,stack:i};va(a,e)}else e.add(t);return}n.epsilonOnlyTransitions||e.add(t);const r=n.transitions.length;for(let i=0;i<r;i++){const s=n.transitions[i],a=hy(t,s);a!==void 0&&va(a,e)}}function hy(t,e){if(e instanceof Nf)return{state:e.target,alt:t.alt,stack:t.stack};if(e instanceof gl){const n=[...t.stack,e.followState];return{state:e.target,alt:t.alt,stack:n}}}function py(t){for(const e of t.elements)if(e.state.type===us)return!0;return!1}function my(t){for(const e of t.elements)if(e.state.type!==us)return!1;return!0}function gy(t){if(my(t))return!0;const e=yy(t.elements);return Ty(e)&&!Ry(e)}function yy(t){const e=new Map;for(const n of t){const r=If(n,!1);let i=e.get(r);i===void 0&&(i={},e.set(r,i)),i[n.alt]=!0}return e}function Ty(t){for(const e of Array.from(t.values()))if(Object.keys(e).length>1)return!0;return!1}function Ry(t){for(const e of Array.from(t.values()))if(Object.keys(e).length===1)return!0;return!1}var Go;(function(t){function e(n){return typeof n=="string"}t.is=e})(Go||(Go={}));var Ea;(function(t){function e(n){return typeof n=="string"}t.is=e})(Ea||(Ea={}));var Uo;(function(t){t.MIN_VALUE=-2147483648,t.MAX_VALUE=2147483647;function e(n){return typeof n=="number"&&t.MIN_VALUE<=n&&n<=t.MAX_VALUE}t.is=e})(Uo||(Uo={}));var Vi;(function(t){t.MIN_VALUE=0,t.MAX_VALUE=2147483647;function e(n){return typeof n=="number"&&t.MIN_VALUE<=n&&n<=t.MAX_VALUE}t.is=e})(Vi||(Vi={}));var te;(function(t){function e(r,i){return r===Number.MAX_VALUE&&(r=Vi.MAX_VALUE),i===Number.MAX_VALUE&&(i=Vi.MAX_VALUE),{line:r,character:i}}t.create=e;function n(r){let i=r;return v.objectLiteral(i)&&v.uinteger(i.line)&&v.uinteger(i.character)}t.is=n})(te||(te={}));var X;(function(t){function e(r,i,s,a){if(v.uinteger(r)&&v.uinteger(i)&&v.uinteger(s)&&v.uinteger(a))return{start:te.create(r,i),end:te.create(s,a)};if(te.is(r)&&te.is(i))return{start:r,end:i};throw new Error(`Range#create called with invalid arguments[${r}, ${i}, ${s}, ${a}]`)}t.create=e;function n(r){let i=r;return v.objectLiteral(i)&&te.is(i.start)&&te.is(i.end)}t.is=n})(X||(X={}));var Ki;(function(t){function e(r,i){return{uri:r,range:i}}t.create=e;function n(r){let i=r;return v.objectLiteral(i)&&X.is(i.range)&&(v.string(i.uri)||v.undefined(i.uri))}t.is=n})(Ki||(Ki={}));var qo;(function(t){function e(r,i,s,a){return{targetUri:r,targ
|
|||
|
|
`,`\r
|
|||
|
|
`,"\r"];var Fc;(function(t){function e(s,a,o,c){return new Ay(s,a,o,c)}t.create=e;function n(s){let a=s;return!!(v.defined(a)&&v.string(a.uri)&&(v.undefined(a.languageId)||v.string(a.languageId))&&v.uinteger(a.lineCount)&&v.func(a.getText)&&v.func(a.positionAt)&&v.func(a.offsetAt))}t.is=n;function r(s,a){let o=s.getText(),c=i(a,(u,f)=>{let g=u.range.start.line-f.range.start.line;return g===0?u.range.start.character-f.range.start.character:g}),l=o.length;for(let u=c.length-1;u>=0;u--){let f=c[u],g=s.offsetAt(f.range.start),h=s.offsetAt(f.range.end);if(h<=l)o=o.substring(0,g)+f.newText+o.substring(h,o.length);else throw new Error("Overlapping edit");l=g}return o}t.applyEdits=r;function i(s,a){if(s.length<=1)return s;const o=s.length/2|0,c=s.slice(0,o),l=s.slice(o);i(c,a),i(l,a);let u=0,f=0,g=0;for(;u<c.length&&f<l.length;)a(c[u],l[f])<=0?s[g++]=c[u++]:s[g++]=l[f++];for(;u<c.length;)s[g++]=c[u++];for(;f<l.length;)s[g++]=l[f++];return s}})(Fc||(Fc={}));let Ay=class{constructor(e,n,r,i){this._uri=e,this._languageId=n,this._version=r,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let n=this.offsetAt(e.start),r=this.offsetAt(e.end);return this._content.substring(n,r)}return this._content}update(e,n){this._content=e.text,this._version=n,this._lineOffsets=void 0}getLineOffsets(){if(this._lineOffsets===void 0){let e=[],n=this._content,r=!0;for(let i=0;i<n.length;i++){r&&(e.push(i),r=!1);let s=n.charAt(i);r=s==="\r"||s===`
|
|||
|
|
`,s==="\r"&&i+1<n.length&&n.charAt(i+1)===`
|
|||
|
|
`&&i++}r&&n.length>0&&e.push(n.length),this._lineOffsets=e}return this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let n=this.getLineOffsets(),r=0,i=n.length;if(i===0)return te.create(0,e);for(;r<i;){let a=Math.floor((r+i)/2);n[a]>e?i=a:r=a+1}let s=r-1;return te.create(s,e-n[s])}offsetAt(e){let n=this.getLineOffsets();if(e.line>=n.length)return this._content.length;if(e.line<0)return 0;let r=n[e.line],i=e.line+1<n.length?n[e.line+1]:this._content.length;return Math.max(Math.min(r+e.character,i),r)}get lineCount(){return this.getLineOffsets().length}};var v;(function(t){const e=Object.prototype.toString;function n(h){return typeof h<"u"}t.defined=n;function r(h){return typeof h>"u"}t.undefined=r;function i(h){return h===!0||h===!1}t.boolean=i;function s(h){return e.call(h)==="[object String]"}t.string=s;function a(h){return e.call(h)==="[object Number]"}t.number=a;function o(h,E,b){return e.call(h)==="[object Number]"&&E<=h&&h<=b}t.numberRange=o;function c(h){return e.call(h)==="[object Number]"&&-2147483648<=h&&h<=2147483647}t.integer=c;function l(h){return e.call(h)==="[object Number]"&&0<=h&&h<=2147483647}t.uinteger=l;function u(h){return e.call(h)==="[object Function]"}t.func=u;function f(h){return h!==null&&typeof h=="object"}t.objectLiteral=f;function g(h,E){return Array.isArray(h)&&h.every(E)}t.typedArray=g})(v||(v={}));const Sy=Object.freeze(Object.defineProperty({__proto__:null,get AnnotatedTextEdit(){return Jt},get ChangeAnnotation(){return zn},get ChangeAnnotationIdentifier(){return qe},get CodeAction(){return Tc},get CodeActionContext(){return yc},get CodeActionKind(){return gc},get CodeActionTriggerKind(){return Qi},get CodeDescription(){return Ho},get CodeLens(){return Rc},get Color(){return Aa},get ColorInformation(){return zo},get ColorPresentation(){return jo},get Command(){return Hn},get CompletionItem(){return ic},get CompletionItemKind(){return Qo},get CompletionItemLabelDetails(){return rc},get CompletionItemTag(){return ec},get CompletionList(){return sc},get CreateFile(){return Br},get DeleteFile(){return Vr},get Diagnostic(){return Hi},get DiagnosticRelatedInformation(){return Sa},get DiagnosticSeverity(){return Vo},get DiagnosticTag(){return Ko},get DocumentHighlight(){return uc},get DocumentHighlightKind(){return lc},get DocumentLink(){return Ec},get DocumentSymbol(){return mc},get DocumentUri(){return Go},EOL:Ey,get FoldingRange(){return Wo},get FoldingRangeKind(){return Bo},get FormattingOptions(){return vc},get Hover(){return ac},get InlayHint(){return Ic},get InlayHintKind(){return Na},get InlayHintLabelPart(){return wa},get InlineCompletionContext(){return Dc},get InlineCompletionItem(){return $c},get InlineCompletionList(){return Lc},get InlineCompletionTriggerKind(){return Oc},get InlineValueContext(){return _c},get InlineValueEvaluatableExpression(){return bc},get InlineValueText(){return Nc},get InlineValueVariableLookup(){return wc},get InsertReplaceEdit(){return tc},get InsertTextFormat(){return Zo},get InsertTextMode(){return nc},get Location(){return Ki},get LocationLink(){return qo},get MarkedString(){return Ji},get MarkupContent(){return Kr},get MarkupKind(){return ka},get OptionalVersionedTextDocumentIdentifier(){return Xi},get ParameterInformation(){return oc},get Position(){return te},get Range(){return X},get RenameFile(){return Wr},get SelectedCompletionInfo(){return xc},get SelectionRange(){return Ac},get SemanticTokenModifiers(){return Cc},get SemanticTokenTypes(){return Sc},get SemanticTokens(){return kc},get SignatureInformation(){return cc},get StringValue(){return Pc},get SymbolInformation(){return hc},get SymbolKind(){return dc},get SymbolTag(){return fc},get TextDocument(){return Fc},get TextDocumentEdit(){return Yi},get TextDocumentIdentifier(){return Yo},get TextDocumentItem(){return Jo},get TextEdit(){return Ot},get URI(){return Ea},get VersionedTextDocumentIdentifier(){return Xo},WorkspaceChange:vy,get WorkspaceEdit(){return Ca},get WorkspaceFolder(){return Mc},get WorkspaceSymbol(){return pc},get integer(){return Uo},get uinteger(){r
|
|||
|
|
`;case"r":return"\r";case"t":return" ";case"v":return"\v";case"0":return"\0";default:return l}}function r(l){return l.charAt(0)==="^"?l.substring(1):l}t.convertID=r;function i(l){return parseInt(l)}t.convertInt=i;function s(l){return BigInt(l)}t.convertBigint=s;function a(l){return new Date(l)}t.convertDate=a;function o(l){return Number(l)}t.convertNumber=o;function c(l){return l.toLowerCase()==="true"}t.convertBoolean=c})(Ht||(Ht={}));var Cn={},Fs={},hu;function Qn(){if(hu)return Fs;hu=1,Object.defineProperty(Fs,"__esModule",{value:!0});let t;function e(){if(t===void 0)throw new Error("No runtime abstraction layer installed");return t}return(function(n){function r(i){if(i===void 0)throw new Error("No runtime abstraction layer provided");t=i}n.install=r})(e||(e={})),Fs.default=e,Fs}var De={},pu;function ds(){if(pu)return De;pu=1,Object.defineProperty(De,"__esModule",{value:!0}),De.stringArray=De.array=De.func=De.error=De.number=De.string=De.boolean=void 0;function t(o){return o===!0||o===!1}De.boolean=t;function e(o){return typeof o=="string"||o instanceof String}De.string=e;function n(o){return typeof o=="number"||o instanceof Number}De.number=n;function r(o){return o instanceof Error}De.error=r;function i(o){return typeof o=="function"}De.func=i;function s(o){return Array.isArray(o)}De.array=s;function a(o){return s(o)&&o.every(c=>e(c))}return De.stringArray=a,De}var kn={},mu;function Qr(){if(mu)return kn;mu=1,Object.defineProperty(kn,"__esModule",{value:!0}),kn.Emitter=kn.Event=void 0;const t=Qn();var e;(function(i){const s={dispose(){}};i.None=function(){return s}})(e||(kn.Event=e={}));class n{add(s,a=null,o){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(s),this._contexts.push(a),Array.isArray(o)&&o.push({dispose:()=>this.remove(s,a)})}remove(s,a=null){if(!this._callbacks)return;let o=!1;for(let c=0,l=this._callbacks.length;c<l;c++)if(this._callbacks[c]===s)if(this._contexts[c]===a){this._callbacks.splice(c,1),this._contexts.splice(c,1);return}else o=!0;if(o)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...s){if(!this._callbacks)return[];const a=[],o=this._callbacks.slice(0),c=this._contexts.slice(0);for(let l=0,u=o.length;l<u;l++)try{a.push(o[l].apply(c[l],s))}catch(f){(0,t.default)().console.error(f)}return a}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}}class r{constructor(s){this._options=s}get event(){return this._event||(this._event=(s,a,o)=>{this._callbacks||(this._callbacks=new n),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(s,a);const c={dispose:()=>{this._callbacks&&(this._callbacks.remove(s,a),c.dispose=r._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(o)&&o.push(c),c}),this._event}fire(s){this._callbacks&&this._callbacks.invoke.call(this._callbacks,s)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}}return kn.Emitter=r,r._noop=function(){},kn}var gu;function ja(){if(gu)return Cn;gu=1,Object.defineProperty(Cn,"__esModule",{value:!0}),Cn.CancellationTokenSource=Cn.CancellationToken=void 0;const t=Qn(),e=ds(),n=Qr();var r;(function(o){o.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:n.Event.None}),o.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:n.Event.None});function c(l){const u=l;return u&&(u===o.None||u===o.Cancelled||e.boolean(u.isCancellationRequested)&&!!u.onCancellationRequested)}o.is=c})(r||(Cn.CancellationToken=r={}));const i=Object.freeze(function(o,c){const l=(0,t.default)().timer.setTimeout(o.bind(c),0);return{dispose(){l.dispose()}}});class s{constructor(){this._isCancelled=!1}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationReques
|
|||
|
|
${JSON.stringify(Object.fromEntries(f))}`));return}const h=parseInt(g);if(isNaN(h)){this.fireError(new Error(`Content-Length value must be a number. Got ${g}`));return}this.nextMessageLength=h}const u=this.buffer.tryReadBody(this.nextMessageLength);if(u===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{const f=this.options.contentDecoder!==void 0?await this.options.contentDecoder.decode(u):u,g=await this.options.contentTypeDecoder.decode(f,this.options);this.callback(g)}).catch(f=>{this.fireError(f)})}}catch(u){this.fireError(u)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,t.default)().timer.setTimeout((l,u)=>{this.partialMessageTimer=void 0,l===this.messageToken&&(this.firePartialMessage({messageToken:l,waitingTime:u}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}}return Gt.ReadableStreamMessageReader=o,Gt}var Ut={},wu;function AT(){if(wu)return Ut;wu=1,Object.defineProperty(Ut,"__esModule",{value:!0}),Ut.WriteableStreamMessageWriter=Ut.AbstractMessageWriter=Ut.MessageWriter=void 0;const t=Qn(),e=ds(),n=Jf(),r=Qr(),i="Content-Length: ",s=`\r
|
|||
|
|
`;var a;(function(u){function f(g){let h=g;return h&&e.func(h.dispose)&&e.func(h.onClose)&&e.func(h.onError)&&e.func(h.write)}u.is=f})(a||(Ut.MessageWriter=a={}));class o{constructor(){this.errorEmitter=new r.Emitter,this.closeEmitter=new r.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(f,g,h){this.errorEmitter.fire([this.asError(f),g,h])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(f){return f instanceof Error?f:new Error(`Writer received error. Reason: ${e.string(f.message)?f.message:"unknown"}`)}}Ut.AbstractMessageWriter=o;var c;(function(u){function f(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=f})(c||(c={}));class l extends o{constructor(f,g){super(),this.writable=f,this.options=c.fromOptions(g),this.errorCount=0,this.writeSemaphore=new n.Semaphore(1),this.writable.onError(h=>this.fireError(h)),this.writable.onClose(()=>this.fireClose())}async write(f){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(f,this.options).then(h=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(h):h).then(h=>{const E=[];return E.push(i,h.byteLength.toString(),s),E.push(s),this.doWrite(f,E,h)},h=>{throw this.fireError(h),h}))}async doWrite(f,g,h){try{return await this.writable.write(g.join(""),"ascii"),this.writable.write(h)}catch(E){return this.handleError(E,f),Promise.reject(E)}}handleError(f,g){this.errorCount++,this.fireError(f,g,this.errorCount)}end(){this.writable.end()}}return Ut.WriteableStreamMessageWriter=l,Ut}var vi={},bu;function ST(){if(bu)return vi;bu=1,Object.defineProperty(vi,"__esModule",{value:!0}),vi.AbstractMessageBuffer=void 0;const t=13,e=10,n=`\r
|
|||
|
|
`;class r{constructor(s="utf-8"){this._encoding=s,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(s){const a=typeof s=="string"?this.fromString(s,this._encoding):s;this._chunks.push(a),this._totalLength+=a.byteLength}tryReadHeaders(s=!1){if(this._chunks.length===0)return;let a=0,o=0,c=0,l=0;e:for(;o<this._chunks.length;){const h=this._chunks[o];for(c=0;c<h.length;){switch(h[c]){case t:switch(a){case 0:a=1;break;case 2:a=3;break;default:a=0}break;case e:switch(a){case 1:a=2;break;case 3:a=4,c++;break e;default:a=0}break;default:a=0}c++}l+=h.byteLength,o++}if(a!==4)return;const u=this._read(l+c),f=new Map,g=this.toString(u,"ascii").split(n);if(g.length<2)return f;for(let h=0;h<g.length-2;h++){const E=g[h],b=E.indexOf(":");if(b===-1)throw new Error(`Message header must separate key and value using ':'
|
|||
|
|
${E}`);const I=E.substr(0,b),C=E.substr(b+1).trim();f.set(s?I.toLowerCase():I,C)}return f}tryReadBody(s){if(!(this._totalLength<s))return this._read(s)}get numberOfBytes(){return this._totalLength}_read(s){if(s===0)return this.emptyBuffer();if(s>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===s){const l=this._chunks[0];return this._chunks.shift(),this._totalLength-=s,this.asNative(l)}if(this._chunks[0].byteLength>s){const l=this._chunks[0],u=this.asNative(l,s);return this._chunks[0]=l.slice(s),this._totalLength-=s,u}const a=this.allocNative(s);let o=0,c=0;for(;s>0;){const l=this._chunks[c];if(l.byteLength>s){const u=l.slice(0,s);a.set(u,o),o+=s,this._chunks[c]=l.slice(s),this._totalLength-=s,s-=s}else a.set(l,o),o+=l.byteLength,this._chunks.shift(),this._totalLength-=l.byteLength,s-=l.byteLength}return a}}return vi.AbstractMessageBuffer=r,vi}var ao={},_u;function CT(){return _u||(_u=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=Qn(),n=ds(),r=Yf(),i=Xf(),s=Qr(),a=ja();var o;(function(m){m.type=new r.NotificationType("$/cancelRequest")})(o||(o={}));var c;(function(m){function S(y){return typeof y=="string"||typeof y=="number"}m.is=S})(c||(t.ProgressToken=c={}));var l;(function(m){m.type=new r.NotificationType("$/progress")})(l||(l={}));class u{constructor(){}}t.ProgressType=u;var f;(function(m){function S(y){return n.func(y)}m.is=S})(f||(f={})),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 h;(function(m){m.Off="off",m.Messages="messages",m.Compact="compact",m.Verbose="verbose"})(h||(t.TraceValues=h={})),(function(m){function S(T){if(!n.string(T))return m.Off;switch(T=T.toLowerCase(),T){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(T){switch(T){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 E;(function(m){m.Text="text",m.JSON="json"})(E||(t.TraceFormat=E={})),(function(m){function S(y){return n.string(y)?(y=y.toLowerCase(),y==="json"?m.JSON:m.Text):m.Text}m.fromString=S})(E||(t.TraceFormat=E={}));var b;(function(m){m.type=new r.NotificationType("$/setTrace")})(b||(t.SetTraceNotification=b={}));var I;(function(m){m.type=new r.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 N extends Error{constructor(S,y){super(y),this.code=S,Object.setPrototypeOf(this,N.prototype)}}t.ConnectionError=N;var k;(function(m){function S(y){const T=y;return T&&n.func(T.cancelUndispatched)}m.is=S})(k||(t.ConnectionStrategy=k={}));var P;(function(m){function S(y){const T=y;return T&&(T.kind===void 0||T.kind==="id")&&n.func(T.createCancellationTokenSource)&&(T.dispose===void 0||n.func(T.dispose))}m.is=S})(P||(t.IdCancellationReceiverStrategy=P={}));var H;(function(m){function S(y){const T=y;return T&&T.kind==="request"&&n.func(T.createCancellationTokenSource)&&(T.dispose===void 0||n.func(T.dispose))}m.is=S})(H||(t.RequestCancellationReceiverStrategy=H={}));var K;(function(m){m.Message=Object.freeze({createCancellationTokenSource(y){return new a.CancellationTokenSource}});function S(y){return P.is(y)||H.is(y)}m.is=S})(K||(t.CancellationReceiverStrategy=K={}));var J;(function(m){m.Message=Object.free
|
|||
|
|
${JSON.stringify(p.error,void 0,4)}`):A.error("Received response message without id. No further error information provided.");else{const w=p.id,L=Ie.get(w);if(ws(p,L),L!==void 0){Ie.delete(w);try{if(p.error){const F=p.error;L.reject(new r.ResponseError(F.code,F.message,F.data))}else if(p.result!==void 0)L.resolve(p.result);else throw new Error("Should never happen.")}catch(F){F.message?A.error(`Response handler '${L.method}' failed with message: ${F.message}`):A.error(`Response handler '${L.method}' failed unexpectedly.`)}}}}function As(p){if(Dt())return;let w,L;if(p.method===o.type.method){const F=p.params.id;xe.delete(F),nr(p);return}else{const F=ne.get(p.method);F&&(L=F.handler,w=F.type)}if(L||B)try{if(nr(p),L)if(p.params===void 0)w!==void 0&&w.numberOfParams!==0&&w.parameterStructures!==r.ParameterStructures.byName&&A.error(`Notification ${p.method} defines ${w.numberOfParams} params but received none.`),L();else if(Array.isArray(p.params)){const F=p.params;p.method===l.type.method&&F.length===2&&c.is(F[0])?L({token:F[0],value:F[1]}):(w!==void 0&&(w.parameterStructures===r.ParameterStructures.byName&&A.error(`Notification ${p.method} defines parameters by name but received parameters by position`),w.numberOfParams!==p.params.length&&A.error(`Notification ${p.method} defines ${w.numberOfParams} params but received ${F.length} arguments`)),L(...F))}else w!==void 0&&w.parameterStructures===r.ParameterStructures.byPosition&&A.error(`Notification ${p.method} defines parameters by position but received parameters by name`),L(p.params);else B&&B(p.method,p.params)}catch(F){F.message?A.error(`Notification handler '${p.method}' failed with message: ${F.message}`):A.error(`Notification handler '${p.method}' failed unexpectedly.`)}else ti.fire(p)}function Ss(p){if(!p){A.error("Received empty message.");return}A.error(`Received message which is neither a response nor a notification message:
|
|||
|
|
${JSON.stringify(p,null,4)}`);const w=p;if(n.string(w.id)||n.number(w.id)){const L=w.id,F=Ie.get(L);F&&F.reject(new Error("The received response has neither a result nor an error property."))}}function vt(p){if(p!=null)switch(Z){case g.Verbose:return JSON.stringify(p,null,4);case g.Compact:return JSON.stringify(p);default:return}}function Cs(p){if(!(Z===g.Off||!Ee))if(it===E.Text){let w;(Z===g.Verbose||Z===g.Compact)&&p.params&&(w=`Params: ${vt(p.params)}
|
|||
|
|
|
|||
|
|
`),Ee.log(`Sending request '${p.method} - (${p.id})'.`,w)}else Mt("send-request",p)}function ks(p){if(!(Z===g.Off||!Ee))if(it===E.Text){let w;(Z===g.Verbose||Z===g.Compact)&&(p.params?w=`Params: ${vt(p.params)}
|
|||
|
|
|
|||
|
|
`:w=`No parameters provided.
|
|||
|
|
|
|||
|
|
`),Ee.log(`Sending notification '${p.method}'.`,w)}else Mt("send-notification",p)}function En(p,w,L){if(!(Z===g.Off||!Ee))if(it===E.Text){let F;(Z===g.Verbose||Z===g.Compact)&&(p.error&&p.error.data?F=`Error data: ${vt(p.error.data)}
|
|||
|
|
|
|||
|
|
`:p.result?F=`Result: ${vt(p.result)}
|
|||
|
|
|
|||
|
|
`:p.error===void 0&&(F=`No result returned.
|
|||
|
|
|
|||
|
|
`)),Ee.log(`Sending response '${w} - (${p.id})'. Processing request took ${Date.now()-L}ms`,F)}else Mt("send-response",p)}function Ns(p){if(!(Z===g.Off||!Ee))if(it===E.Text){let w;(Z===g.Verbose||Z===g.Compact)&&p.params&&(w=`Params: ${vt(p.params)}
|
|||
|
|
|
|||
|
|
`),Ee.log(`Received request '${p.method} - (${p.id})'.`,w)}else Mt("receive-request",p)}function nr(p){if(!(Z===g.Off||!Ee||p.method===I.type.method))if(it===E.Text){let w;(Z===g.Verbose||Z===g.Compact)&&(p.params?w=`Params: ${vt(p.params)}
|
|||
|
|
|
|||
|
|
`:w=`No parameters provided.
|
|||
|
|
|
|||
|
|
`),Ee.log(`Received notification '${p.method}'.`,w)}else Mt("receive-notification",p)}function ws(p,w){if(!(Z===g.Off||!Ee))if(it===E.Text){let L;if((Z===g.Verbose||Z===g.Compact)&&(p.error&&p.error.data?L=`Error data: ${vt(p.error.data)}
|
|||
|
|
|
|||
|
|
`:p.result?L=`Result: ${vt(p.result)}
|
|||
|
|
|
|||
|
|
`:p.error===void 0&&(L=`No result returned.
|
|||
|
|
|
|||
|
|
`)),w){const F=p.error?` Request failed: ${p.error.message} (${p.error.code}).`:"";Ee.log(`Received response '${w.method} - (${p.id})' in ${Date.now()-w.timerStart}ms.${F}`,L)}else Ee.log(`Received response ${p.id} without active response promise.`,L)}else Mt("receive-response",p)}function Mt(p,w){if(!Ee||Z===g.Off)return;const L={isLSPMessage:!0,type:p,message:w,timestamp:Date.now()};Ee.log(L)}function on(){if(ai())throw new N(C.Closed,"Connection is closed.");if(Dt())throw new N(C.Disposed,"Connection is disposed.")}function bs(){if(si())throw new N(C.AlreadyListening,"Connection is already listening")}function _s(){if(!si())throw new Error("Call listen() first.")}function cn(p){return p===void 0?null:p}function ui(p){if(p!==null)return p}function d(p){return p!=null&&!Array.isArray(p)&&typeof p=="object"}function Ce(p,w){switch(p){case r.ParameterStructures.auto:return d(w)?ui(w):[cn(w)];case r.ParameterStructures.byName:if(!d(w))throw new Error("Received parameters by name but param is not an object literal.");return ui(w);case r.ParameterStructures.byPosition:return[cn(w)];default:throw new Error(`Unknown parameter structure ${p.toString()}`)}}function ke(p,w){let L;const F=p.numberOfParams;switch(F){case 0:L=void 0;break;case 1:L=Ce(p.parameterStructures,w[0]);break;default:L=[];for(let le=0;le<w.length&&le<F;le++)L.push(cn(w[le]));if(w.length<F)for(let le=w.length;le<F;le++)L.push(null);break}return L}const V={sendNotification:(p,...w)=>{on();let L,F;if(n.string(p)){L=p;const se=w[0];let ce=0,Ne=r.ParameterStructures.auto;r.ParameterStructures.is(se)&&(ce=1,Ne=se);let Q=w.length;const pe=Q-ce;switch(pe){case 0:F=void 0;break;case 1:F=Ce(Ne,w[ce]);break;default:if(Ne===r.ParameterStructures.byName)throw new Error(`Received ${pe} parameters for 'by Name' notification parameter structure.`);F=w.slice(ce,Q).map(re=>cn(re));break}}else{const se=w;L=p.method,F=ke(p,se)}const le={jsonrpc:z,method:L,params:F};return ks(le),S.write(le).catch(se=>{throw A.error("Sending notification failed."),se})},onNotification:(p,w)=>{on();let L;return n.func(p)?B=p:w&&(n.string(p)?(L=p,ne.set(p,{type:void 0,handler:w})):(L=p.method,ne.set(p.method,{type:p,handler:w}))),{dispose:()=>{L!==void 0?ne.delete(L):B=void 0}}},onProgress:(p,w,L)=>{if(Oe.has(w))throw new Error(`Progress handler for token ${w} already registered`);return Oe.set(w,L),{dispose:()=>{Oe.delete(w)}}},sendProgress:(p,w,L)=>V.sendNotification(l.type,{token:w,value:L}),onUnhandledProgress:ni.event,sendRequest:(p,...w)=>{on(),_s();let L,F,le;if(n.string(p)){L=p;const Q=w[0],pe=w[w.length-1];let re=0,Pe=r.ParameterStructures.auto;r.ParameterStructures.is(Q)&&(re=1,Pe=Q);let Ve=w.length;a.CancellationToken.is(pe)&&(Ve=Ve-1,le=pe);const _t=Ve-re;switch(_t){case 0:F=void 0;break;case 1:F=Ce(Pe,w[re]);break;default:if(Pe===r.ParameterStructures.byName)throw new Error(`Received ${_t} parameters for 'by Name' request parameter structure.`);F=w.slice(re,Ve).map(Eh=>cn(Eh));break}}else{const Q=w;L=p.method,F=ke(p,Q);const pe=p.numberOfParams;le=a.CancellationToken.is(Q[pe])?Q[pe]:void 0}const se=O++;let ce;le&&(ce=le.onCancellationRequested(()=>{const Q=Rt.sender.sendCancellation(V,se);return Q===void 0?(A.log(`Received no promise from cancellation strategy when cancelling id ${se}`),Promise.resolve()):Q.catch(()=>{A.log(`Sending cancellation messages for id ${se} failed`)})}));const Ne={jsonrpc:z,id:se,method:L,params:F};return Cs(Ne),typeof Rt.sender.enableCancellation=="function"&&Rt.sender.enableCancellation(Ne),new Promise(async(Q,pe)=>{const re=_t=>{Q(_t),Rt.sender.cleanup(se),ce==null||ce.dispose()},Pe=_t=>{pe(_t),Rt.sender.cleanup(se),ce==null||ce.dispose()},Ve={method:L,timerStart:Date.now(),resolve:re,reject:Pe};try{await S.write(Ne),Ie.set(se,Ve)}catch(_t){throw A.error("Sending request failed."),Ve.reject(new r.ResponseError(r.ErrorCodes.MessageWriteError,_t.message?_t.message:"Unknown reason")),_t}})},onRequest:(p,w)=>{on();let L=null;return f.is(p)?(L=void 0,G=p):n.string(p)?(L=null,w!==void 0&&(L=p,ie.set(p,{handler:w,type:void 0}))):w!==void 0&&(L=p.method,ie.set(p
|
|||
|
|
${n}`),this.inline?`{${e}}`:e}toMarkdown(e){var n;return((n=e==null?void 0:e.renderTag)==null?void 0:n.call(e,this))??this.toMarkdownDefault(e)}toMarkdownDefault(e){const n=this.content.toMarkdown(e);if(this.inline){const s=gR(this.name,n,e??{});if(typeof s=="string")return s}let r="";(e==null?void 0:e.tag)==="italic"||(e==null?void 0:e.tag)===void 0?r="*":(e==null?void 0:e.tag)==="bold"?r="**":(e==null?void 0:e.tag)==="bold-italic"&&(r="***");let i=`${r}@${this.name}${r}`;return this.content.inlines.length===1?i=`${i} — ${n}`:this.content.inlines.length>1&&(i=`${i}
|
|||
|
|
${n}`),this.inline?`{${i}}`:i}}function gR(t,e,n){var r;if(t==="linkplain"||t==="linkcode"||t==="link"){const i=e.indexOf(" ");let s=e;if(i>0){const o=Vc(e,i);s=e.substring(o),e=e.substring(0,i)}return(t==="linkcode"||t==="link"&&n.link==="code")&&(s=`\`${s}\``),((r=n.renderLink)==null?void 0:r.call(n,e,s))??yR(e,s)}}function yR(t,e){try{return kt.parse(t,!0),`[${e}](${t})`}catch{return t}}class Kc{constructor(e,n){this.inlines=e,this.range=n}toString(){let e="";for(let n=0;n<this.inlines.length;n++){const r=this.inlines[n],i=this.inlines[n+1];e+=r.toString(),i&&i.range.start.line>r.range.start.line&&(e+=`
|
|||
|
|
`)}return e}toMarkdown(e){let n="";for(let r=0;r<this.inlines.length;r++){const i=this.inlines[r],s=this.inlines[r+1];n+=i.toMarkdown(e),s&&s.range.start.line>i.range.start.line&&(n+=`
|
|||
|
|
`)}return n}}class rh{constructor(e,n){this.text=e,this.range=n}toString(){return this.text}toMarkdown(){return this.text}}function dd(t){return t.endsWith(`
|
|||
|
|
`)?`
|
|||
|
|
`:`
|
|||
|
|
|
|||
|
|
`}class TR{constructor(e){this.indexManager=e.shared.workspace.IndexManager,this.commentProvider=e.documentation.CommentProvider}getDocumentation(e){const n=this.commentProvider.getComment(e);if(n&&sR(n))return iR(n).toMarkdown({renderLink:(i,s)=>this.documentationLinkRenderer(e,i,s),renderTag:i=>this.documentationTagRenderer(e,i)})}documentationLinkRenderer(e,n,r){const i=this.findNameInLocalSymbols(e,n)??this.findNameInGlobalScope(e,n);if(i&&i.nameSegment){const s=i.nameSegment.range.start.line+1,a=i.nameSegment.range.start.character+1,o=i.documentUri.with({fragment:`L${s},${a}`});return`[${r}](${o.toString()})`}else return}documentationTagRenderer(e,n){}findNameInLocalSymbols(e,n){const i=Qt(e).localSymbols;if(!i)return;let s=e;do{const o=i.getStream(s).find(c=>c.name===n);if(o)return o;s=s.$container}while(s)}findNameInGlobalScope(e,n){return this.indexManager.allElements().find(i=>i.name===n)}}class RR{constructor(e){this.grammarConfig=()=>e.parser.GrammarConfig}getComment(e){var n;return aT(e)?e.$comment:(n=np(e.$cstNode,this.grammarConfig().multilineCommentRules))==null?void 0:n.text}}class vR{constructor(e){this.syncParser=e.parser.LangiumParser}parse(e,n){return Promise.resolve(this.syncParser.parse(e))}}class ER{constructor(){this.previousTokenSource=new Te.CancellationTokenSource,this.writeQueue=[],this.readQueue=[],this.done=!0}write(e){this.cancelWrite();const n=Wy();return this.previousTokenSource=n,this.enqueue(this.writeQueue,e,n.token)}read(e){return this.enqueue(this.readQueue,e)}enqueue(e,n,r=Te.CancellationToken.None){const i=new Al,s={action:n,deferred:i,cancellationToken:r};return e.push(s),this.performNextOperation(),i.promise}async performNextOperation(){if(!this.done)return;const e=[];if(this.writeQueue.length>0)e.push(this.writeQueue.shift());else if(this.readQueue.length>0)e.push(...this.readQueue.splice(0,this.readQueue.length));else return;this.done=!1,await Promise.all(e.map(async({action:n,deferred:r,cancellationToken:i})=>{try{const s=await Promise.resolve().then(()=>n(i));r.resolve(s)}catch(s){Ba(s)?r.resolve(void 0):r.reject(s)}})),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.cancel()}}class AR{constructor(e){this.grammarElementIdMap=new Tu,this.tokenTypeIdMap=new Tu,this.grammar=e.Grammar,this.lexer=e.parser.Lexer,this.linker=e.references.Linker}dehydrate(e){return{lexerErrors:e.lexerErrors,lexerReport:e.lexerReport?this.dehydrateLexerReport(e.lexerReport):void 0,parserErrors:e.parserErrors.map(n=>({...n,message:n.message})),value:this.dehydrateAstNode(e.value,this.createDehyrationContext(e.value))}}dehydrateLexerReport(e){return e}createDehyrationContext(e){const n=new Map,r=new Map;for(const i of Zt(e))n.set(i,{});if(e.$cstNode)for(const i of No(e.$cstNode))r.set(i,{});return{astNodes:n,cstNodes:r}}dehydrateAstNode(e,n){const r=n.astNodes.get(e);r.$type=e.$type,r.$containerIndex=e.$containerIndex,r.$containerProperty=e.$containerProperty,e.$cstNode!==void 0&&(r.$cstNode=this.dehydrateCstNode(e.$cstNode,n));for(const[i,s]of Object.entries(e))if(!i.startsWith("$"))if(Array.isArray(s)){const a=[];r[i]=a;for(const o of s)Be(o)?a.push(this.dehydrateAstNode(o,n)):St(o)?a.push(this.dehydrateReference(o,n)):a.push(o)}else Be(s)?r[i]=this.dehydrateAstNode(s,n):St(s)?r[i]=this.dehydrateReference(s,n):s!==void 0&&(r[i]=s);return r}dehydrateReference(e,n){const r={};return r.$refText=e.$refText,e.$refNode&&(r.$refNode=n.cstNodes.get(e.$refNode)),r}dehydrateCstNode(e,n){const r=n.cstNodes.get(e);return Nd(e)?r.fullText=e.fullText:r.grammarSource=this.getGrammarElementId(e.grammarSource),r.hidden=e.hidden,r.astNode=n.astNodes.get(e.astNode),Bi(e)?r.content=e.content.map(i=>this.dehydrateCstNode(i,n)):kd(e)&&(r.tokenType=e.tokenType.name,r.offset=e.offset,r.length=e.length,r.startLine=e.range.start.line,r.startColumn=e.range.start.character,r.endLine=e.range.end.line,r.endColumn=e.range.end.character),r}hydrate(e){const n=e.value,r=this.createHydrationContext(n);return"$cstNode"in n&&this.hydrateCstNode(n.$cstNode,r),{lexerErrors:e.lexerErrors,lexerReport:e.lexerR
|
|||
|
|
`)}}},$(Nr,"AbstractMermaidValueConverter"),Nr),wr,Va=(wr=class extends Wa{runCustomConverter(e,n,r){}},$(wr,"CommonValueConverter"),wr),br,vn=(br=class extends jf{constructor(e){super(),this.keywords=new Set(e)}buildKeywordTokens(e,n,r){const i=super.buildKeywordTokens(e,n,r);return i.forEach(s=>{this.keywords.has(s.name)&&s.PATTERN!==void 0&&(s.PATTERN=new RegExp(s.PATTERN.toString()+"(?:(?=%%)|(?!\\S))"))}),i}},$(br,"AbstractMermaidTokenBuilder"),br),_r;_r=class extends vn{},$(_r,"CommonTokenBuilder");var Ir,dv=(Ir=class extends vn{constructor(){super(["gitGraph"])}},$(Ir,"GitGraphTokenBuilder"),Ir),ah={parser:{TokenBuilder:$(()=>new dv,"TokenBuilder"),ValueConverter:$(()=>new Va,"ValueConverter")}};function oh(t=Rn){const e=We(Tn(t),er),n=We(yn({shared:e}),tv,ah);return e.ServiceRegistry.register(n),{shared:e,GitGraph:n}}$(oh,"createGitGraphServices");var Pr,fv=(Pr=class extends vn{constructor(){super(["info","showInfo"])}},$(Pr,"InfoTokenBuilder"),Pr),ch={parser:{TokenBuilder:$(()=>new fv,"TokenBuilder"),ValueConverter:$(()=>new Va,"ValueConverter")}};function lh(t=Rn){const e=We(Tn(t),er),n=We(yn({shared:e}),nv,ch);return e.ServiceRegistry.register(n),{shared:e,Info:n}}$(lh,"createInfoServices");var $r,hv=($r=class extends vn{constructor(){super(["packet"])}},$($r,"PacketTokenBuilder"),$r),uh={parser:{TokenBuilder:$(()=>new hv,"TokenBuilder"),ValueConverter:$(()=>new Va,"ValueConverter")}};function dh(t=Rn){const e=We(Tn(t),er),n=We(yn({shared:e}),rv,uh);return e.ServiceRegistry.register(n),{shared:e,Packet:n}}$(dh,"createPacketServices");var Lr,pv=(Lr=class extends vn{constructor(){super(["pie","showData"])}},$(Lr,"PieTokenBuilder"),Lr),Or,mv=(Or=class extends Wa{runCustomConverter(e,n,r){if(e.name==="PIE_SECTION_LABEL")return n.replace(/"/g,"").trim()}},$(Or,"PieValueConverter"),Or),fh={parser:{TokenBuilder:$(()=>new pv,"TokenBuilder"),ValueConverter:$(()=>new mv,"ValueConverter")}};function hh(t=Rn){const e=We(Tn(t),er),n=We(yn({shared:e}),iv,fh);return e.ServiceRegistry.register(n),{shared:e,Pie:n}}$(hh,"createPieServices");var xr,gv=(xr=class extends vn{constructor(){super(["architecture"])}},$(xr,"ArchitectureTokenBuilder"),xr),Dr,yv=(Dr=class extends Wa{runCustomConverter(e,n,r){if(e.name==="ARCH_ICON")return n.replace(/[()]/g,"").trim();if(e.name==="ARCH_TEXT_ICON")return n.replace(/["()]/g,"");if(e.name==="ARCH_TITLE")return n.replace(/[[\]]/g,"").trim()}},$(Dr,"ArchitectureValueConverter"),Dr),ph={parser:{TokenBuilder:$(()=>new gv,"TokenBuilder"),ValueConverter:$(()=>new yv,"ValueConverter")}};function mh(t=Rn){const e=We(Tn(t),er),n=We(yn({shared:e}),ev,ph);return e.ServiceRegistry.register(n),{shared:e,Architecture:n}}$(mh,"createArchitectureServices");var Mr,Tv=(Mr=class extends vn{constructor(){super(["radar-beta"])}},$(Mr,"RadarTokenBuilder"),Mr),gh={parser:{TokenBuilder:$(()=>new Tv,"TokenBuilder"),ValueConverter:$(()=>new Va,"ValueConverter")}};function yh(t=Rn){const e=We(Tn(t),er),n=We(yn({shared:e}),sv,gh);return e.ServiceRegistry.register(n),{shared:e,Radar:n}}$(yh,"createRadarServices");var Fr,Rv=(Fr=class extends vn{constructor(){super(["treemap"])}},$(Fr,"TreemapTokenBuilder"),Fr),vv=/classDef\s+([A-Z_a-z]\w+)(?:\s+([^\n\r;]*))?;?/,Gr,Ev=(Gr=class extends Wa{runCustomConverter(e,n,r){if(e.name==="NUMBER2")return parseFloat(n.replace(/,/g,""));if(e.name==="SEPARATOR")return n.substring(1,n.length-1);if(e.name==="STRING2")return n.substring(1,n.length-1);if(e.name==="INDENTATION")return n.length;if(e.name==="ClassDef"){if(typeof n!="string")return n;const i=vv.exec(n);if(i)return{$type:"ClassDefStatement",className:i[1],styleText:i[2]||void 0}}}},$(Gr,"TreemapValueConverter"),Gr);function Th(t){const e=t.validation.TreemapValidator,n=t.validation.ValidationRegistry;if(n){const r={Treemap:e.checkSingleRoot.bind(e)};n.register(r,e)}}$(Th,"registerValidationChecks");var Ur,Av=(Ur=class{checkSingleRoot(e,n){let r;for(const i of e.TreemapRows)i.item&&(r===void 0&&i.indent===void 0?r=0:i.indent===void 0?n("error","Multiple root nodes are not allowed in a treemap.",{node:i,property:"item"}):r!==void
|
|||
|
|
`),r=e.parserErrors.map(i=>i.message).join(`
|
|||
|
|
`);super(`Parsing failed: ${n} ${r}`),this.result=e}},$(qr,"MermaidParseError"),qr);const Nv=Object.freeze(Object.defineProperty({__proto__:null,InfoModule:ch,createInfoServices:lh},Symbol.toStringTag,{value:"Module"})),wv=Object.freeze(Object.defineProperty({__proto__:null,PacketModule:uh,createPacketServices:dh},Symbol.toStringTag,{value:"Module"})),bv=Object.freeze(Object.defineProperty({__proto__:null,PieModule:fh,createPieServices:hh},Symbol.toStringTag,{value:"Module"})),_v=Object.freeze(Object.defineProperty({__proto__:null,ArchitectureModule:ph,createArchitectureServices:mh},Symbol.toStringTag,{value:"Module"})),Iv=Object.freeze(Object.defineProperty({__proto__:null,GitGraphModule:ah,createGitGraphServices:oh},Symbol.toStringTag,{value:"Module"})),Pv=Object.freeze(Object.defineProperty({__proto__:null,RadarModule:gh,createRadarServices:yh},Symbol.toStringTag,{value:"Module"})),$v=Object.freeze(Object.defineProperty({__proto__:null,TreemapModule:Rh,createTreemapServices:vh},Symbol.toStringTag,{value:"Module"}));export{Cv as p};
|